-
Notifications
You must be signed in to change notification settings - Fork 33
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
Parse error when using arrow function in rules #23
Comments
The lexer generator (jison-lex) specifically looks for the While I say this, I wonder why that bit of code apparently doesn't kick in in your grammar/circumstances, so further diagnosis is required to answer this one without hand-waving like I do now. |
Upon further diagnosis this turns up: Relevant code snippet in regexp-lexer, taken from the GerHobbelt/jison fork (TODO comment added today):
|
…pt and JSON/JSON5 lexer specs to be processed by jison / jison-lex: this allows us to load and execute the fail & pass examples mentioned in zaach/jison-lex#23, for starters.
…unctions in the lexer spec, both simple functions, e.g. `() => 'TOKEN'` and "complex/multiline" arrow functions, e.g. `() => { statements; return 'TOKEN'; ... }`
…or tweak to test/showcase `e + e` action code expansion with named variables: `$e1 + $e2` instead of the more cryptic (old-skool yacc style action code) `$1 + $3`
…JISON API a la JISON-LEX API for testing: in the test code we `require()` such grammar specs. Also adjust the test code to otherwise facilitate the grammars that come with this issue, which are expected to produce a numeric value rather than a simple boolean TRUE.
FYI: this issue is now fixed in jison-gho (https://www.npmjs.com/package/jison-gho) since NPM build 0.6.1-211 i.e. 'build 211'. (Your examples have been included as |
…st for jison-lex issue zaach/jison-lex#23 waiting; turned on to (minimally) improve test coverage. Also updated Makefile(s) to truly collect all coverage data when running `make test-nyc`: had seen the `nyc` commandline help, but the hint about `--clean` hadn't landed until I read https://gist.github.com/rundef/22545366591d73330a48b8948fa060a7#gistcomment-1856708
…)` API to support ES6 arrow functions and extract the code content of any such function for inlining. This code will be used in jison and jison-lex to support arrow functions passed via the programmer API (a la zaach/jison-lex#23 ) Also extended the unit tests to cover various function type input scenarios.
It will parse error:
while this is ok:
The text was updated successfully, but these errors were encountered: