-{Rewriter, INVERSES} = require './rewriter'
diff --git a/docs/v2/annotated-source/grammar.html b/docs/v2/annotated-source/grammar.html index e9a2fbadd4..2a04921548 100644 --- a/docs/v2/annotated-source/grammar.html +++ b/docs/v2/annotated-source/grammar.html @@ -657,21 +657,15 @@
-{Rewriter, INVERSES} = require './rewriter'
outdentToken: ({moveOut, noNewlines, outdentLength = 0, offset = 0, indentSize}) ->
+ outdentToken: ({moveOut, noNewlines, outdentLength = 0, offset = 0, indentSize, endsContinuationLineIndentation}) ->
decreasedIndent = @indent - moveOut
while moveOut > 0
lastIndent = @indents[@indents.length - 1]
@@ -1072,7 +1075,9 @@ Tokenizers
@outdebt -= moveOut if dent
@suppressSemicolons()
- @token 'TERMINATOR', '\n', offset: offset + outdentLength, length: 0 unless @tag() is 'TERMINATOR' or noNewlines
+ unless @tag() is 'TERMINATOR' or noNewlines
+ terminatorToken = @token 'TERMINATOR', '\n', offset: offset + outdentLength, length: 0
+ terminatorToken.endsContinuationLineIndentation = {preContinuationLineIndent: @indent} if endsContinuationLineIndentation
@indent = decreasedIndent
@indentLiteral = @indentLiteral[...decreasedIndent]
this
@@ -1977,14 +1982,17 @@ Helpers
getLocationDataCompensation: (start, end) ->
- compensation = 0
+ totalCompensation = 0
initialEnd = end
- for index, length of @locationDataCompensations
- index = parseInt index, 10
- continue unless start <= index and (index < end or index is end and start is initialEnd)
- compensation += length
- end += length
- compensation
Tokens that, when appearing at the end of a line, suppress a following TERMINATOR/INDENT token
- -UNFINISHED = ['\\', '.', '?.', '?::', 'UNARY', 'DO', 'DO_IIFE', 'MATH', 'UNARY_MATH', '+', '-',
- '**', 'SHIFT', 'RELATION', 'COMPARE', '&', '^', '|', '&&', '||',
- 'BIN?', 'EXTENDS']