You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
…he received user-defined action code within `()` braces so that the generated parser will certainly treat the entire blurb as a single JavaScript *expression* rather than a single or compound *statement*; also note commit SHA-1: 1c8c89d :: BNF parser: produce stricter action code for arrow action in any jison grammar so that we can more easily check coding mistakes in a production's arrow code, e.g. unwanted semicolons, multiple statements, etc., which can currently slip through the net and cause hard-to-diagnose havoc down the line.
Adjusted unit tests accordingly.
jison has an ARROW_ACTION feature (see ebnf_parser) where you can write a grammar production with shorthand action code like this:
which, similar to ES6 arrow JavaScript functions, is shorthand for this jison production/action:
However, the ARROW_ACTION code is a simple code injection into the generated parser, such that this code is accepted by jison:
which is treated as:
which is VERY PROBABLY not as intended, resulting in unexpected behaviour.
Suggested fix direction:
Do not accept compound statements like these, but only accept a single (possibly comma-separated) JavaScript expression, e.g.:
so that the
$$
rule's result would be assigned the value returned bycalc(...)
in there.The text was updated successfully, but these errors were encountered: