Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update lib/jison/lexer.js #112

Closed
wants to merge 1 commit into from

3 participants

@robertleeplummerjr

Odd case where oldLines[?].length didn't exist, so return a length of 0 if there is no length.

@robertleeplummerjr robertleeplummerjr Update lib/jison/lexer.js
Odd case where oldLines[?].length didn't exist, so return a length of 0 if there is no length.
3d1a0b7
@travisbot

This pull request passes (merged 3d1a0b7 into bdc9422).

@zaach
Owner

Do you have the case for when this causes an error? I'd like to add a test case for this before fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 3, 2012
  1. @robertleeplummerjr

    Update lib/jison/lexer.js

    robertleeplummerjr authored
    Odd case where oldLines[?].length didn't exist, so return a length of 0 if there is no length.
This page is out of date. Refresh to see the latest.
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
};
Something went wrong with that request. Please try again.