Exclude preceding newlines from INDENT tokens.
Produces more meanignful locationData.
This commit is contained in:
parent
97a41adf0c
commit
ebff9fbc31
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue