Repository navigation
Fix override parsing and preserve comments in JSX applications - #18
Merged
Merged
Conversation
davesnx
added a commit
that referenced
this pull request
Oct 1, 2026
* origin/main: Fix override parsing and preserve comments in JSX applications (#18)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #16 and #17. Companion parser fix: ocaml-mlx/mlx#47.
Restore object-override expressions
The two-token
GREATER RBRACEcloser made ordinary override expressions ambiguous, including examples without a comparison:{< x = true && false >} {< x = if condition then 1 else 2 >}Adding parentheses let these parse, but the formatter removed them and then failed its own syntax check. The previous workaround only handled top-level
>comparisons.GREATER_BEFORE_RBRACEtoken for the closing angle while leaving}to be lexed separately. The name makes clear that the token consumes only>, not the brace.Preserve comments on hand-written JSX applications
Previously, this failed with
BUG: comment changedbecause conversion to JSX omitted the commented unit argument:<App>...xs</App>.Tests
Added regressions for override comparisons, boolean operators, conditionals, local bindings, functions, match/try expressions, empty/local overrides, nested braces, object types, and JSX closing tags. Comment regressions cover unit-argument placement and applications nested in children, spreads, and props, including idempotency checks.
Passed the full local suite with OCaml 5.5.0 and Menhir 20230608:
DEVELOPER_DIR=/Library/Developer/CommandLineTools \ SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX15.4.sdk \ opam exec --switch=/Users/davesnx/Code/github/ocaml-mlx/mlx -- dune runtestPublication note
The initial commit was accidentally pushed to
mainand reverted in 252fe2f. This PR reapplies the fixes through review and includes the explicit token name;main's content was restored before this branch was published.