Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

wrong error line number #764

dorny opened this Issue Sep 9, 2012 · 2 comments


None yet
3 participants

dorny commented Sep 9, 2012


there's problem with blank lines and outputed error line number - blank lines are not counted.

Example code:



Compilation output:

ReferenceError: test.jade:3
    1| html
  > 3|  body
    4|      h1=some_undefined_variable

Error is on 4th line, not 3 as outputed. More blank lines (in any place in file before error) causing you have no idea where is problem (without manual search). Problem dismiss if there are whitespace or some coment instead of blank lines, but that's ugly. I use blank lines as delimiter of logic chunk of code...

dorny commented Oct 25, 2012

After while i look again at this issue and find out what happening...
In my editor i have turn on trim trailing whitespaces on save and lexer.js don't count blank lines - briliant!

FIX for lexer.js:

  | blank: function() {
  |    var captures;
  |    if (captures = /^\n *\n/.exec(this.input)) {
  |      this.consume(captures[0].length - 1);
  |      if (this.pipeless) return this.tok('text', '');
+ |
+ |      ++this.lineno;
  |       return this.next();
  |     }
  |  }


slang800 commented Oct 27, 2012

thanks, I tested this (it works perfectly) and I’ll make this into a pull request, since it looks like you haven't.

@tj tj closed this in 4bad8ee Nov 1, 2012

tj added a commit that referenced this issue Nov 1, 2012

Merge pull request #795 from slang800/blank_lines_fix
fixes #764 (incorrect line number for error messages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment