Terminate when no more tokens and at end of line

This corrects a regression when pattern matching
to the newline was added.

If the newline is never matched the loop still needs to
terminated so now when the position is before the newline
and the last match had no tokens the loop is broken out of.
This commit is contained in:
Kevin Sawicki
2012-12-26 11:41:50 -08:00
parent cf66892b09
commit f592242737
3 changed files with 21 additions and 0 deletions

View File

@@ -53,6 +53,7 @@ class TextMateGrammar
tokens.push(nextTokens...)
position = tokensEndPosition
break if position is line.length and nextTokens.length is 0
else # push filler token for unmatched text at end of line
if position < line.length