diff --git a/lib/coffee-script/lexer.js b/lib/coffee-script/lexer.js index ebacc5a5..62b2d3ca 100644 --- a/lib/coffee-script/lexer.js +++ b/lib/coffee-script/lexer.js @@ -275,6 +275,9 @@ } } if (dent) this.outdebt -= moveOut; + while (this.value() === ';') { + this.tokens.pop(); + } if (!(this.tag() === 'TERMINATOR' || noNewlines)) { this.token('TERMINATOR', '\n'); } @@ -294,6 +297,9 @@ } }; Lexer.prototype.newlineToken = function() { + while (this.value() === ';') { + this.tokens.pop(); + } if (this.tag() !== 'TERMINATOR') this.token('TERMINATOR', '\n'); return this; }; diff --git a/src/lexer.coffee b/src/lexer.coffee index 8ca39613..13a076ef 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -279,6 +279,7 @@ exports.Lexer = class Lexer @outdebt = 0 @token 'OUTDENT', dent @outdebt -= moveOut if dent + @tokens.pop() while @value() is ';' @token 'TERMINATOR', '\n' unless @tag() is 'TERMINATOR' or noNewlines this @@ -293,6 +294,7 @@ exports.Lexer = class Lexer # Generate a newline token. Consecutive newlines get merged together. newlineToken: -> + @tokens.pop() while @value() is ';' @token 'TERMINATOR', '\n' unless @tag() is 'TERMINATOR' this