Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

wrong error line number #764

Closed
dorny opened this Issue · 2 comments

3 participants

@dorny

Hello,

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

Example code:

html

    body
        h1=some_undefined_variable

Compilation output:

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

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

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.