line numbers out by one in parse errors.
dominictarr opened this issue · 4 comments
dominictarr commented
if true or false then
console.log( 'hello')
Error: Parse error on line 2: Unexpected 'IDENTIFIER'
at. ...
should be line 1.
puffnfresh commented
I've take a look at this previously - couldn't figure it out.
Need to take another look.
alsonkemp commented
The off-by-one error seems to be in lexer.js (I fixed it by setting lineno=0):
exports.tokenise = function(source) {
indent = 0;
indents = [];
tokens = [];
lineno = 0; // Was 1
dominictarr commented
awesome
puffnfresh commented
So Jison indexes lines from 0.
Thanks @alsonkemp - I've merged your commit.