Parent: #899
Problem
Ten direct bare exits across binary/unary parsing, member access, optional chains, and new discard grammar-specific context.
Executed on current main (029a701), twelve eval probes all expose eval: UnexpectedToken at .... Raw JavaScriptCore 625.1.22 instead reports exact prose for:
- mixing
??with&&/||without parentheses - strict deletion of an unqualified identifier
- a unary expression on the left of
** - a tagged template in an optional chain
new import(...)- optional-chain constructor property and call forms
- invalid ordinary and
new.property-name tokens
One adjacent site, new await value inside an async function, has a genuine oracle split: Node 24.18 rejects it as required by the grammar while JavaScriptCore 625.1.22 accepts it. zig-js must preserve the standards-correct rejection and retain the exact await token; no JavaScriptCore message-parity claim applies to that form.
Implementation
- Retain the current operator/member token at grammar rejections.
- Retain the optional template token and optional-chain operator offset.
- Attach strict delete to the identifier spelling and
new importto the consumednewkeyword. - Match raw JavaScriptCore prose for all twelve shared rejections.
- Keep
new awaitstandards-correct with a token-specific diagnostic. - Add no allocation or source rescan to successful expression parsing.
Verification
- Pin reason, message, and byte offset for all twelve JavaScriptCore cases plus the Node-validated
new awaitcase. - Add a focused production eval case for every message family.
- Compare exact-parent logical/coalescing, exponentiation, delete, optional-chaining, and new-expression test262 subtrees with nonzero denominators and report flips.