mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
upgrading to latest jison, rebuilding the parser
This commit is contained in:
parent
29267593c2
commit
fd8b540a66
2 changed files with 9 additions and 32 deletions
|
@ -209,7 +209,7 @@ case 99:this.$ = [$$[$0-1+1-1]];
|
||||||
break;
|
break;
|
||||||
case 100:this.$ = $$[$0-3+1-1].concat([$$[$0-3+3-1]]);
|
case 100:this.$ = $$[$0-3+1-1].concat([$$[$0-3+3-1]]);
|
||||||
break;
|
break;
|
||||||
case 101:this.$ = yytext;
|
case 101:this.$ = new LiteralNode(yytext);
|
||||||
break;
|
break;
|
||||||
case 102:this.$ = new SplatNode($$[$0-4+1-1]);
|
case 102:this.$ = new SplatNode($$[$0-4+1-1]);
|
||||||
break;
|
break;
|
||||||
|
@ -436,8 +436,6 @@ parse: function parse(input) {
|
||||||
var symbol, state, action, a, r, yyval={},p,len,ip=0,newState, expected;
|
var symbol, state, action, a, r, yyval={},p,len,ip=0,newState, expected;
|
||||||
symbol = lex();
|
symbol = lex();
|
||||||
while (true) {
|
while (true) {
|
||||||
// this.trace('stack:',JSON.stringify(stack), '\n\t\t\tinput:', this.lexer._input);
|
|
||||||
// this.trace('vstack:',JSON.stringify(vstack));
|
|
||||||
// set first input
|
// set first input
|
||||||
state = stack[stack.length-1];
|
state = stack[stack.length-1];
|
||||||
// read action for current state and first input
|
// read action for current state and first input
|
||||||
|
@ -448,13 +446,11 @@ parse: function parse(input) {
|
||||||
for (p in table[state]) if (this.terminals_[p] && p != 1) {
|
for (p in table[state]) if (this.terminals_[p] && p != 1) {
|
||||||
expected.push("'"+this.terminals_[p]+"'");
|
expected.push("'"+this.terminals_[p]+"'");
|
||||||
}
|
}
|
||||||
self.trace("stack:",JSON.stringify(stack), 'symbol:',symbol, 'input', this.lexer.upcomingInput());
|
|
||||||
if (this.lexer.upcomingInput) self.trace('input', this.lexer.upcomingInput());
|
|
||||||
parseError('Parse error on line '+(yylineno+1)+'. Expecting: '+expected.join(', ')+"\n"+(this.lexer.showPosition && this.lexer.showPosition()),
|
parseError('Parse error on line '+(yylineno+1)+'. Expecting: '+expected.join(', ')+"\n"+(this.lexer.showPosition && this.lexer.showPosition()),
|
||||||
{text: this.lexer.match, token: symbol, line: this.lexer.yylineno});
|
{text: this.lexer.match, token: symbol, line: this.lexer.yylineno});
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.trace('action:',action);
|
this.trace('action:',action);
|
||||||
|
|
||||||
// this shouldn't happen, unless resolve defaults are off
|
// this shouldn't happen, unless resolve defaults are off
|
||||||
if (action.length > 1) {
|
if (action.length > 1) {
|
||||||
|
@ -481,7 +477,6 @@ parse: function parse(input) {
|
||||||
reductions++;
|
reductions++;
|
||||||
|
|
||||||
len = this.productions_[a[1]][1];
|
len = this.productions_[a[1]][1];
|
||||||
// this.trace('reduce by: ', this.productions ? this.productions[a[1]] : a[1]);
|
|
||||||
|
|
||||||
// perform semantic action
|
// perform semantic action
|
||||||
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
|
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
|
||||||
|
@ -491,11 +486,8 @@ parse: function parse(input) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.trace('yyval=',JSON.stringify(yyval.$));
|
|
||||||
|
|
||||||
// pop off stack
|
// pop off stack
|
||||||
if (len) {
|
if (len) {
|
||||||
// this.trace('production length:',len);
|
|
||||||
stack = stack.slice(0,-1*len*2);
|
stack = stack.slice(0,-1*len*2);
|
||||||
vstack = vstack.slice(0, -1*len);
|
vstack = vstack.slice(0, -1*len);
|
||||||
}
|
}
|
||||||
|
@ -509,10 +501,8 @@ parse: function parse(input) {
|
||||||
|
|
||||||
case 3: // accept
|
case 3: // accept
|
||||||
|
|
||||||
// this.trace('stack:',stack, '\n\tinput:', this.lexer._input);
|
this.reductionCount = reductions;
|
||||||
// this.trace('vstack:',JSON.stringify(vstack));
|
this.shiftCount = shifts;
|
||||||
// this.trace('Total reductions:', reductions);
|
|
||||||
// this.trace('Total shifts:', shifts);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,4 +525,4 @@ exports.main = function commonjsMain(args) {
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
exports.main(require("system").args);
|
exports.main(require("system").args);
|
||||||
}
|
}
|
||||||
}
|
}
|
21
vendor/jison/lib/jison.js
vendored
21
vendor/jison/lib/jison.js
vendored
|
@ -737,7 +737,6 @@ lrGeneratorMixin.parseTable = function parseTable (itemSets) {
|
||||||
if (action.length) {
|
if (action.length) {
|
||||||
var sol = resolveConflict(item.production, op, [r,item.production.id], action[0]);
|
var sol = resolveConflict(item.production, op, [r,item.production.id], action[0]);
|
||||||
self.resolutions.push([k,stackSymbol,sol]);
|
self.resolutions.push([k,stackSymbol,sol]);
|
||||||
//self.trace(sol.msg);
|
|
||||||
if (sol.bydefault) {
|
if (sol.bydefault) {
|
||||||
self.conflicts++;
|
self.conflicts++;
|
||||||
if (!self.DEBUG) {
|
if (!self.DEBUG) {
|
||||||
|
@ -753,7 +752,6 @@ lrGeneratorMixin.parseTable = function parseTable (itemSets) {
|
||||||
action.push([r,item.production.id]);
|
action.push([r,item.production.id]);
|
||||||
}
|
}
|
||||||
if (action && action.length) {
|
if (action && action.length) {
|
||||||
//self.trace(k, stackSymbol, action);
|
|
||||||
state[self.symbols_[stackSymbol]] = action;
|
state[self.symbols_[stackSymbol]] = action;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -893,12 +891,12 @@ var lrGeneratorDebug = {
|
||||||
afterparseTable: function () {
|
afterparseTable: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (this.conflicts > 0) {
|
if (this.conflicts > 0) {
|
||||||
this.trace("\n"+this.conflicts+" Conflict(s) found in grammar:");
|
|
||||||
this.resolutions.forEach(function (r, i) {
|
this.resolutions.forEach(function (r, i) {
|
||||||
if (r[2].bydefault) {
|
if (r[2].bydefault) {
|
||||||
self.warn('State:',r[0], ', Token:',r[1], "\n ", printAction(r[2].r, self), "\n ", printAction(r[2].s, self));
|
self.warn('Conflict at state:',r[0], ', Token:',r[1], "\n ", printAction(r[2].r, self), "\n ", printAction(r[2].s, self));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.trace("\n"+this.conflicts+" Conflict(s) found in grammar.");
|
||||||
}
|
}
|
||||||
this.trace("Done.");
|
this.trace("Done.");
|
||||||
},
|
},
|
||||||
|
@ -976,8 +974,6 @@ parser.parse = function parse (input) {
|
||||||
var symbol, state, action, a, r, yyval={},p,len,ip=0,newState, expected;
|
var symbol, state, action, a, r, yyval={},p,len,ip=0,newState, expected;
|
||||||
symbol = lex();
|
symbol = lex();
|
||||||
while (true) {
|
while (true) {
|
||||||
this.trace('stack:',JSON.stringify(stack), '\n\t\t\tinput:', this.lexer._input);
|
|
||||||
this.trace('vstack:',JSON.stringify(vstack));
|
|
||||||
// set first input
|
// set first input
|
||||||
state = stack[stack.length-1];
|
state = stack[stack.length-1];
|
||||||
// read action for current state and first input
|
// read action for current state and first input
|
||||||
|
@ -988,8 +984,6 @@ parser.parse = function parse (input) {
|
||||||
for (p in table[state]) if (this.terminals_[p] && p != 1) {
|
for (p in table[state]) if (this.terminals_[p] && p != 1) {
|
||||||
expected.push("'"+this.terminals_[p]+"'");
|
expected.push("'"+this.terminals_[p]+"'");
|
||||||
}
|
}
|
||||||
self.trace("stack:",JSON.stringify(stack), 'symbol:',symbol, 'input', this.lexer.upcomingInput());
|
|
||||||
if (this.lexer.upcomingInput) self.trace('input', this.lexer.upcomingInput());
|
|
||||||
parseError('Parse error on line '+(yylineno+1)+'. Expecting: '+expected.join(', ')+"\n"+(this.lexer.showPosition && this.lexer.showPosition()),
|
parseError('Parse error on line '+(yylineno+1)+'. Expecting: '+expected.join(', ')+"\n"+(this.lexer.showPosition && this.lexer.showPosition()),
|
||||||
{text: this.lexer.match, token: symbol, line: this.lexer.yylineno});
|
{text: this.lexer.match, token: symbol, line: this.lexer.yylineno});
|
||||||
}
|
}
|
||||||
|
@ -1021,7 +1015,6 @@ parser.parse = function parse (input) {
|
||||||
reductions++;
|
reductions++;
|
||||||
|
|
||||||
len = this.productions_[a[1]][1];
|
len = this.productions_[a[1]][1];
|
||||||
this.trace('reduce by: ', this.productions ? this.productions[a[1]] : a[1]);
|
|
||||||
|
|
||||||
// perform semantic action
|
// perform semantic action
|
||||||
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
|
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
|
||||||
|
@ -1031,11 +1024,8 @@ parser.parse = function parse (input) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.trace('yyval=',JSON.stringify(yyval.$));
|
|
||||||
|
|
||||||
// pop off stack
|
// pop off stack
|
||||||
if (len) {
|
if (len) {
|
||||||
this.trace('production length:',len);
|
|
||||||
stack = stack.slice(0,-1*len*2);
|
stack = stack.slice(0,-1*len*2);
|
||||||
vstack = vstack.slice(0, -1*len);
|
vstack = vstack.slice(0, -1*len);
|
||||||
}
|
}
|
||||||
|
@ -1049,10 +1039,8 @@ parser.parse = function parse (input) {
|
||||||
|
|
||||||
case 3: // accept
|
case 3: // accept
|
||||||
|
|
||||||
this.trace('stack:',stack, '\n\tinput:', this.lexer._input);
|
this.reductionCount = reductions;
|
||||||
this.trace('vstack:',JSON.stringify(vstack));
|
this.shiftCount = shifts;
|
||||||
this.trace('Total reductions:', reductions);
|
|
||||||
this.trace('Total shifts:', shifts);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1392,7 +1380,6 @@ exports.main = function main (args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var opt = grammar.options || {};
|
var opt = grammar.options || {};
|
||||||
opt.debug = true;
|
|
||||||
|
|
||||||
// lexer file
|
// lexer file
|
||||||
if (args[2]) {
|
if (args[2]) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue