mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 19:34:27 -05:00
updating Jison
This commit is contained in:
11
vendor/jison/lib/jison.js
vendored
11
vendor/jison/lib/jison.js
vendored
@@ -919,7 +919,7 @@ lrGeneratorMixin.createParser = function createParser () {
|
||||
table: this.table,
|
||||
productions_: this.productions_,
|
||||
symbols_: this.symbols_,
|
||||
terminals_: this.terminals,
|
||||
terminals_: this.terminals_,
|
||||
performAction: this.performAction
|
||||
});
|
||||
|
||||
@@ -984,8 +984,13 @@ parser.parse = function parse (input) {
|
||||
for (p in table[state]) if (this.terminals_[p] && p != 1) {
|
||||
expected.push("'"+this.terminals_[p]+"'");
|
||||
}
|
||||
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});
|
||||
if (this.lexer.showPosition) {
|
||||
parseError('Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', '),
|
||||
{text: this.lexer.match, token: this.terminals_[symbol], line: this.lexer.yylineno, expected: expected});
|
||||
} else {
|
||||
parseError('Parse error on line '+(yylineno+1)+": Unexpected '"+this.terminals_[symbol]+"'",
|
||||
{text: this.lexer.match, token: this.terminals_[symbol], line: this.lexer.yylineno, expected: expected});
|
||||
}
|
||||
}
|
||||
|
||||
this.trace('action:',action);
|
||||
|
||||
9
vendor/jison/tests/parser/api.js
vendored
9
vendor/jison/tests/parser/api.js
vendored
@@ -219,10 +219,11 @@ exports["test custom parse error method"] = function () {
|
||||
result = hash;
|
||||
throw str;
|
||||
};
|
||||
assert["throws"](function () {parser.parse("agb")});
|
||||
assert.equal(result.text, "b", "parse error text should equal b");
|
||||
assert["throws"](function () {parser.parse("agz")});
|
||||
assert.equal(result.line, 0, "lexical error should have correct line");
|
||||
|
||||
assert["throws"](function () {parser.parse("aga")});
|
||||
assert.strictEqual(result.text, "a", "parse error text should equal b");
|
||||
assert.strictEqual(typeof result.token, 'string', "parse error token should be a string");
|
||||
assert.strictEqual(result.line, 0, "hash should include line number");
|
||||
};
|
||||
|
||||
exports["test jison grammar as string"] = function () {
|
||||
|
||||
Reference in New Issue
Block a user