Make grammar handle lines that don't match *any* of the current rule's patterns

It's possible to get a match based on a lookahead, but not actually have any non-empty capture groups. This should be considered a failed match.
This commit is contained in:
Nathan Sobo
2012-08-08 08:59:13 -06:00
parent 827b3e29d3
commit f559ad73a7
2 changed files with 13 additions and 4 deletions

View File

@@ -92,7 +92,9 @@ class Rule
regexPatternPairs
getNextTokens: (stack, line, position) ->
return {} unless tree = @regex.getCaptureTree(line, position)
tree = @regex.getCaptureTree(line, position)
return {} unless tree?.captures
match = tree.captures[0]
pattern = @patternsByCaptureIndex[match.index]
@adjustCaptureTreeIndices(match, match.index)