mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Hook up new token location data to parser.
This commit is contained in:
parent
969e45a599
commit
3142b237f5
2 changed files with 7 additions and 10 deletions
|
@ -153,14 +153,10 @@
|
||||||
|
|
||||||
parser.lexer = {
|
parser.lexer = {
|
||||||
lex: function() {
|
lex: function() {
|
||||||
var tag, _ref1;
|
var tag, token;
|
||||||
_ref1 = this.tokens[this.pos++] || [''], tag = _ref1[0], this.yytext = _ref1[1], this.yylineno = _ref1[2];
|
token = this.tokens[this.pos++] || [''];
|
||||||
this.yylloc = {
|
tag = token[0], this.yytext = token[1], this.yylineno = token[2];
|
||||||
first_line: this.yylineno,
|
this.yylloc = token.locationData;
|
||||||
last_line: this.yylineno,
|
|
||||||
first_column: 0,
|
|
||||||
last_column: 0
|
|
||||||
};
|
|
||||||
return tag;
|
return tag;
|
||||||
},
|
},
|
||||||
setInput: function(tokens) {
|
setInput: function(tokens) {
|
||||||
|
|
|
@ -120,8 +120,9 @@ lexer = new Lexer
|
||||||
# directly as a "Jison lexer".
|
# directly as a "Jison lexer".
|
||||||
parser.lexer =
|
parser.lexer =
|
||||||
lex: ->
|
lex: ->
|
||||||
[tag, @yytext, @yylineno] = @tokens[@pos++] or ['']
|
token = @tokens[@pos++] or ['']
|
||||||
@yylloc = {first_line: @yylineno, last_line: @yylineno, first_column: 0, last_column: 0}
|
[tag, @yytext, @yylineno] = token
|
||||||
|
@yylloc = token.locationData
|
||||||
tag
|
tag
|
||||||
setInput: (@tokens) ->
|
setInput: (@tokens) ->
|
||||||
@pos = 0
|
@pos = 0
|
||||||
|
|
Loading…
Reference in a new issue