mirror of
https://github.com/atom/atom.git
synced 2026-02-08 13:45:09 -05:00
Add support for TextMate grammars with newlines in their regexes
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user