Removing the last Jison hack. (Jison 0.1.25)
This commit is contained in:
parent
6b4e437c93
commit
6d8126e498
4
Cakefile
4
Cakefile
|
@ -56,9 +56,7 @@ task 'build:full', 'rebuild the source twice, and run the tests', ->
|
||||||
task 'build:parser', 'rebuild the Jison parser (run build first)', ->
|
task 'build:parser', 'rebuild the Jison parser (run build first)', ->
|
||||||
require 'jison'
|
require 'jison'
|
||||||
parser = require('./lib/grammar').parser
|
parser = require('./lib/grammar').parser
|
||||||
js = parser.generate()
|
fs.writeFile 'lib/parser.js', parser.generate()
|
||||||
js = js.replace /else {\s+parseError/m, 'else { if (symbol === 1) symbol = "EOF"; parseError'
|
|
||||||
fs.writeFile 'lib/parser.js', js
|
|
||||||
|
|
||||||
|
|
||||||
task 'build:ultraviolet', 'build and install the Ultraviolet syntax highlighter', ->
|
task 'build:ultraviolet', 'build and install the Ultraviolet syntax highlighter', ->
|
||||||
|
|
|
@ -561,7 +561,10 @@ parse: function parse(input) {
|
||||||
if (this.lexer.showPosition) {
|
if (this.lexer.showPosition) {
|
||||||
parseError.call(this, 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', '),
|
parseError.call(this, 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', '),
|
||||||
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, expected: expected});
|
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, expected: expected});
|
||||||
} else { if (symbol === 1) symbol = "EOF"; parseError.call(this, 'Parse error on line '+(yylineno+1)+": Unexpected '"+(this.terminals_[symbol] || symbol)+"'",
|
} else {
|
||||||
|
var errStr = symbol == 1 /*EOF*/ ? "end of input" :
|
||||||
|
("'"+(this.terminals_[symbol] || symbol)+"'");
|
||||||
|
parseError.call(this, 'Parse error on line '+(yylineno+1)+": Unexpected "+errStr,
|
||||||
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, expected: expected});
|
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, expected: expected});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue