Skip to content

Commit 44087a2

Browse files
committed
Edited regex for filenames matching.
1 parent 82e776a commit 44087a2

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Symfony/src/Codebender/CompilerBundle/Handler/CompilerHandler.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,17 +1066,21 @@ private function getClangErrorFileList ($clang_output) {
10661066
// Get all the 'filename.extension:line' elements. Include only those followed by an 'error' statement.
10671067
$tag_free_content = strip_tags($clang_output); // Remove color tags (as many as possible).
10681068

1069-
$clang_matches = preg_split('/(([!@#$%^&*()-+"\'<>?]*\w*)+\.\w+:\d+:)/', $tag_free_content, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
1069+
$clang_matches = preg_split('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $tag_free_content, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
10701070

10711071
$elements = array();
10721072
foreach ($clang_matches as $key => $val ) {
1073-
if (preg_match('/(([!@#$%^&*()-+"\'<>?]*\w*)+\.\w+:\d+:)/', $val)
1073+
if (preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $val)
10741074
&& array_key_exists($key + 1, $clang_matches)
10751075
&& (strpos($clang_matches[$key +1 ],"error:") !== false
10761076
|| strpos($clang_matches[$key +1 ],"note:") !== false
10771077
|| strpos($clang_matches[$key +1 ],"in asm") !== false
1078-
|| strpos($clang_matches[$key],"in asm") !== false))
1078+
|| strpos($clang_matches[$key],"in asm") !== false)) {
1079+
if (strpos($val, "In file included from ") !== false)
1080+
$val = str_replace("In file included from ", "", $val);
1081+
$val = str_replace("In file included from ", "", $val);
10791082
$elements[] = $val;
1083+
}
10801084
}
10811085

10821086
// Split the elements from above and get an associative array structure of [filename => lines]
@@ -1103,7 +1107,7 @@ private function getGccErrorFileList ($avr_output) {
11031107
*/
11041108
// Get all 'filename.extension:line' elements.
11051109
// Note that avr-gcc output only includes filenames and lines in error reporting, not collumns.
1106-
preg_match_all('/(([!@#$%^&*()-+"\'<>?]*\w*)+\.\w+:\d+:)/', $avr_output, $gcc_matches, PREG_PATTERN_ORDER);
1110+
preg_match_all('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $avr_output, $gcc_matches, PREG_PATTERN_ORDER);
11071111

11081112
$gcc_elements = array();
11091113
foreach ($gcc_matches[0] as $element) {
@@ -1135,10 +1139,10 @@ private function cleanUpClangOutput ($clang_output, $compiler_config, $option) {
11351139
foreach ($content_line_array as $key => $line) {
11361140

11371141
if ((strpos($line, "In file included from") !== false
1138-
&& preg_match('/(([!@#$%^&*()-+"\'<>?]*\w*)+\.\w+:\d+:)/', $line))
1139-
|| (preg_match('/(([!@#$%^&*()-+"\'<>?]*\w*)+\.\w+:\d+:)/', $line)
1142+
&& preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $line))
1143+
|| (preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $line)
11401144
&& strpos($line, "error:") !== false)
1141-
|| (preg_match('/(([!@#$%^&*()-+"\'<>?]*\w*)+\.\w+:\d+:)/', $line)
1145+
|| (preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $line)
11421146
&& strpos($line, "note:") !== false)) {
11431147

11441148
if ($header_found === false) {

0 commit comments

Comments
 (0)