Skip to content
Browse files

Update lib/jison/lexer.js

Odd case where oldLines[?].length didn't exist, so return a length of 0 if there is no length.
  • Loading branch information...
1 parent bdc9422 commit 3d1a0b7710be895276dfde07282660339fbf0187 @robertleeplummerjr robertleeplummerjr committed Sep 3, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/jison/lexer.js
View
3 lib/jison/lexer.js
@@ -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
};

0 comments on commit 3d1a0b7

Please sign in to comment.
Something went wrong with that request. Please try again.