Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Jison is not defined" when running generated parser in debug mode #313

Open
cosmicexplorer opened this issue Dec 8, 2015 · 2 comments
Open

Comments

@cosmicexplorer
Copy link

Generated parser in debug mode with jison -t <grammar> <lex>. Got ReferenceError: Jison is not defined when running parse() on the generated parser. Traced error back to code:

trace: function trace() {
        Jison.print.apply(null, arguments);
}

in the generated output, which relies upon "Jison" to be previously defined. The Jison.print.apply call isn't there in the non-debug mode, which is why it doesn't happen all the time.

Solved by adding var Jison = require('jison'); to the top of my grammar file between %{%}. Not a huge problem, just annoying. This could be pretty easily added to the compiled output during a debug parser generation, I think.

@cosmicexplorer
Copy link
Author

This is still an issue, although the solution I showed above still works. I want to make sure this is an error before I submit an (extremely trivial) pull request. Not sure if this being actively maintained any more.

@GerHobbelt
Copy link
Contributor

You might want to check out my fork for this: https://github.com/GerHobbelt/jison/blob/master/lib/jison.js#L1699

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants