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

The lexer emitted by jison contains non-es5 code. #37

Open
lddubeau opened this issue May 8, 2018 · 1 comment
Open

The lexer emitted by jison contains non-es5 code. #37

lddubeau opened this issue May 8, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@lddubeau
Copy link

lddubeau commented May 8, 2018

I took from #14 that jison should be producing es5 code. However, the lexer emitted by jison contains const, which is not a keyword recognized in es5. The code may misleadingly run just fine on browsers/JS engines that declare themselves to be es5 engines. The problem is that, historically, many engines declaring themselves to support es5, in fact support es5 and let and const though they are not part of es5 proper.

Steps to reproduce:

  1. Install the latest jison. (I used 0.6.1-215).

  2. Grab the basic_lex.jison example from the examples subdirectory.

  3. Run jison basic_lex.jison.

  4. Open the resulting basic_lex.js and search for const. You'll find some in the lexer_prettyPrintRange function.

@GerHobbelt GerHobbelt added this to the 0.6.5 milestone Jun 17, 2018
@GerHobbelt GerHobbelt self-assigned this Jun 17, 2018
@GerHobbelt
Copy link
Owner

Good catch!

Jison (jison-gho, rather) is being reworked to become a babel-assisted process: the goal with upcoming v0.6.5 is to have a parser-generator which can validate/parse modern JS code in action code and spit out JS that's suitable for modern platforms with babel-assisted support for older platforms where and when one wants. That includes ES5 support.

I don't plan to fix this in a 0.6.1 hotfix release as all effort should focus on 0.6.5 and making sure that one delivers as expected.

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

No branches or pull requests

2 participants