mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
tweak to parser.lexer
This commit is contained in:
parent
987aaa0e19
commit
a257f5993a
2 changed files with 11 additions and 17 deletions
|
@ -55,15 +55,12 @@
|
|||
lexer = new Lexer;
|
||||
parser.lexer = {
|
||||
lex: function() {
|
||||
var token;
|
||||
token = this.tokens[this.pos] || [""];
|
||||
this.pos += 1;
|
||||
this.yylineno = token[2];
|
||||
this.yytext = token[1];
|
||||
return token[0];
|
||||
var tag, _ref;
|
||||
_ref = this.tokens[this.pos++] || [''], tag = _ref[0], this.yytext = _ref[1], this.yylineno = _ref[2];
|
||||
return tag;
|
||||
},
|
||||
setInput: function(tokens) {
|
||||
this.tokens = tokens;
|
||||
setInput: function(_arg) {
|
||||
this.tokens = _arg;
|
||||
return this.pos = 0;
|
||||
},
|
||||
upcomingInput: function() {
|
||||
|
|
|
@ -76,14 +76,11 @@ lexer = new Lexer
|
|||
# directly as a "Jison lexer".
|
||||
parser.lexer =
|
||||
lex: ->
|
||||
token = @tokens[@pos] or [""]
|
||||
@pos += 1
|
||||
this.yylineno = token[2]
|
||||
this.yytext = token[1]
|
||||
token[0]
|
||||
setInput: (tokens) ->
|
||||
@tokens = tokens
|
||||
@pos = 0
|
||||
upcomingInput: -> ""
|
||||
[tag, @yytext, @yylineno] = @tokens[@pos++] or ['']
|
||||
tag
|
||||
setInput: (@tokens) ->
|
||||
@pos = 0
|
||||
upcomingInput: ->
|
||||
""
|
||||
|
||||
parser.yy = require './nodes'
|
||||
|
|
Loading…
Add table
Reference in a new issue