Skip to content

Commit a11fb91

Browse files
committed
Unterminated bracket
1 parent ae64dca commit a11fb91

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Util/FileMatcher.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ private static function processTokens(array $tokens): array
128128
{
129129
$resolved = [];
130130
$escaped = false;
131+
$brackets = [];
131132
for ($offset = 0; $offset < count($tokens); $offset++) {
132133
[$type, $char] = $tokens[$offset];
133134

@@ -171,8 +172,18 @@ private static function processTokens(array $tokens): array
171172
continue;
172173
}
173174

175+
if ($type === self::T_BRACKET_OPEN) {
176+
$brackets[] = $offset;
177+
}
178+
if ($type === self::T_BRACKET_CLOSE) {
179+
array_pop($brackets);
180+
}
181+
174182
$resolved[] = [$type, $char];
175183
}
184+
foreach ($brackets as $unterminatedBracket) {
185+
$resolved[$unterminatedBracket] = [self::T_CHAR, '['];
186+
}
176187
return $resolved;
177188
}
178189
}

0 commit comments

Comments
 (0)