Add support for TextMate grammars with newlines in their regexes

This commit is contained in:
Corey Johnson
2012-10-16 15:58:11 -07:00
parent 0dfc57a98f
commit 6171ea33e1
5 changed files with 36 additions and 8 deletions

View File

@@ -93,9 +93,14 @@ class Rule
getNextTokens: (stack, line, position) ->
patterns = @getIncludedPatterns()
return null unless result = @getScanner().findNextMatch(line, position)
return null unless result = @getScanner().findNextMatch(line + "\n", position)
{ index, captureIndices } = result
lineLength = line.length
captureIndices = captureIndices.map (value, index) ->
value = lineLength if index % 3 != 0 and value > lineLength
value
[firstCaptureIndex, firstCaptureStart, firstCaptureEnd] = captureIndices
nextTokens = patterns[index].handleMatch(stack, line, captureIndices)
{ nextTokens, tokensStartPosition: firstCaptureStart, tokensEndPosition: firstCaptureEnd }