zaach / jison

Bison in JavaScript.
http://jison.org
4.36k stars 450 forks source link

0.4.15 breaks parser name set on %start #248

Open sl45sms opened 10 years ago

sl45sms commented 10 years ago

0.4.15 seems to ignore %start and always set parser as name

$ cat gl.y ..... ..... %start gl

/* language grammar */ %%

gl
: stmt '.' { return {"groups":groups,"program":$1}; } ; .... ....

$ diff -u gl0.4.13.js gl0.4.15.js

-/* parser generated by jison 0.4.13 / +/ parser generated by jison 0.4.15 */

-var gl = (function(){ +var parser = (function(){ ..... ..... -exports.parser = gl; -exports.Parser = gl.Parser; -exports.parse = function () { return gl.parse.apply(gl, arguments); }; +exports.parser = parser; +exports.Parser = parser.Parser; +exports.parse = function () { return parser.parse.apply(parser, arguments); };

zaach commented 10 years ago

Thanks. The name isn't determined by %start but rather by the name of the grammar file, but you are correct that it's currently broken. On it!

sl45sms commented 10 years ago

a ok,i've had misunderstanding this! Thanks!