Repository navigation
Conversation
Support ReScript 13 iteration over synchronous and asynchronous sources, including parenthesized headers, without changing numeric loop trees.
Keep cleanup clauses attached across newlines and comments while preserving finally as an identifier when no block follows it.
Allow ReScript dictionary composition to mix entries and spreads in source order, including nested dictionaries and trailing commas.
Use ReScript 13 keyword semantics instead of treating loop control as identifier references, while retaining escaped identifier support.
Parse inferred and explicitly typed rest bindings in record patterns, including qualified generic types, while rejecting duplicate rests.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10ca34478e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Require a following cleanup block before recognizing a finally clause. Semicolon lookahead alone cannot distinguish JSX attribute boundaries. Cover adjacent attributes, newlines, comments, and cleanup clauses followed by a finally attribute without changing existing syntax trees.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f963f08ae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Preserve statement boundaries when finally is an ordinary identifier. Only the guarded cleanup-clause scanner paths should recognize it as a continuation. Add a regression for an identifier followed by a block.
Revert b15a6d1 to keep older ReScript code compatible. Highlight standalone break and continue expressions as keywords without reserving either identifier. Cover loop control, legacy bindings, and member access in parsing and highlighting tests. All 2,084 wild-project files parse successfully.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74b76f9674
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| choice( | ||
| seq( | ||
| 'for', | ||
| optional('await'), |
There was a problem hiding this comment.
Preserve
await as a numeric-loop binding name
For an existing numeric loop such as for await in 0 to 3 { () }, the newly available await literal wins over value_identifier immediately after for. The parser therefore commits to the asynchronous iterable branch and errors at in, whereas the parent parser accepts this loop (await is not globally reserved). Keep the async prefix contextual so the numeric branch can still use this binding name.
Useful? React with 👍 / 👎.
| if (!scan_keyword(lexer, "finally")) return false; | ||
| for (;;) { | ||
| scan_whitespace(lexer, true); | ||
| if (lexer->lookahead != '/') return lexer->lookahead == '{'; |
There was a problem hiding this comment.
Distinguish JSX spread props from cleanup blocks
Unlike the repaired finally=true boundary, a bare finally prop followed by a spread prop still fails: <C value=try f() catch { | _ => () } finally {...props} /> is accepted by the parent parser but now errors at .... The {-only lookahead treats the spread prop's braces as a cleanup block and emits FINALLY_CLAUSE_START, preventing the valid jsx_attribute followed by jsx_expression interpretation. Preserve that alternative when the following braces cannot form a cleanup block.
Useful? React with 👍 / 👎.
| record_rest_pattern: ($) => | ||
| seq( | ||
| '...', | ||
| optional(seq($._non_function_inline_type, 'as')), |
There was a problem hiding this comment.
Preserve
unit as an inferred record-rest binding
For let {a, ...unit} = value, the optional _non_function_inline_type prefix makes unit tokenize as unit_type instead of the non-reserved value_identifier. The parser then requires as and rejects the closing }, so the new inferred-rest syntax fails for a binding name that works in ordinary record patterns and let bindings. Retain the identifier interpretation when there is no following as.
Useful? React with 👍 / 👎.
Summary
Support ReScript 13 iteration, cleanup clauses, dictionary spreads, and record rest destructuring. Highlight loop-control expressions while preserving compatibility with older code that uses
breakandcontinueas identifiers.Iterable and asynchronous loops
Support variable and wildcard bindings, parenthesized headers, and expression-based iterables while preserving numeric loop syntax.
Try/finally
Support cleanup blocks with or without
catch, including nested expressions and comments between clauses. Recognizefinallyas a cleanup clause only in an active try context when a block follows it, preserving ordinary identifiers and JSX attribute boundaries.Dictionary spreads
Allow spreads before, between, and after entries, including nested dictionary literals.
Backward-compatible break and continue highlighting
Parse
breakandcontinueasvalue_identifiernodes and highlight standalone expression statements askeyword.repeat. Do not reserve either name or introduce dedicated loop-control nodes. Bindings and member access retain normal variable highlighting.The original reserved-keyword implementation in
b15a6d1was reverted in74b76f9. This intentionally leaves version-specific keyword restrictions to the ReScript compiler. A standalone legacy reference namedbreakorcontinuealso receives keyword highlighting because its syntax is indistinguishable from loop control.Record rest destructuring
Support inferred and explicitly typed rest bindings, including qualified generic types, function parameters, and nested patterns. Reject multiple rest bindings in the same record pattern.
Validation
finallyregressions.git diff --checkpass.continueas a variable.Scope
Dollar identifiers and the other previously audited syntax gaps are outside this PR's scope.
References
for...ofandfor await...ofloops rescript#7887