Exclude preceding newlines from INDENT tokens.

Produces more meanignful locationData.
This commit is contained in:
Marc Häfner 2013-03-05 00:03:08 +01:00
parent 97a41adf0c
commit ebff9fbc31
2 changed files with 2 additions and 2 deletions

View File

@ -363,7 +363,7 @@
return indent.length;
}
diff = size - this.indent + this.outdebt;
this.token('INDENT', diff, 0, indent.length);
this.token('INDENT', diff, indent.length - size, size);
this.indents.push(diff);
this.ends.push('OUTDENT');
this.outdebt = this.indebt = 0;

View File

@ -328,7 +328,7 @@ exports.Lexer = class Lexer
@suppressNewlines()
return indent.length
diff = size - @indent + @outdebt
@token 'INDENT', diff, 0, indent.length
@token 'INDENT', diff, indent.length - size, size
@indents.push diff
@ends.push 'OUTDENT'
@outdebt = @indebt = 0