Update lib/jison/lexer.js #112

Closed
wants to merge 1 commit into
from
Jump to file
+2 −1
Split
View
@@ -193,12 +193,13 @@ RegExpLexer.prototype = {
if (lines.length-1) this.yylineno -= lines.length-1;
var r = this.yylloc.range;
+ var oldLinesLength = (oldLines[oldLines.length - lines.length] ? oldLines[oldLines.length - lines.length].length : 0);
this.yylloc = {first_line: this.yylloc.first_line,
last_line: this.yylineno+1,
first_column: this.yylloc.first_column,
last_column: lines ?
- (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length:
+ (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLinesLength - lines[0].length:
this.yylloc.first_column - len
};