Update grammar to cover array spreads, variant type spreads and newer operators. #267
Open
mvaled wants to merge 3 commits intorescript-lang:mainfrom
Open
Update grammar to cover array spreads, variant type spreads and newer operators. #267mvaled wants to merge 3 commits intorescript-lang:mainfrom
mvaled wants to merge 3 commits intorescript-lang:mainfrom
Conversation
Add parser support for the ReScript 12 operator improvements that were missing from the grammar. This covers modulo, bitwise operators, and shift operators, and adds corpus and highlight updates for the new syntax. Unrelated untracked files are left out of the commit.
Add grammar support for variant type spreads and variant pattern spreads. This adds corpus coverage for type declarations and expressions, including a dedicated variant pattern spread example. Also ignore local uv lockfiles via .git/info/exclude.
Allow spread elements in array expressions. Add corpus coverage for array spread syntax using the ReScript 11.1 style example, including multiple spreads in the same array literal.
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.
Disclosure: This PR was generated with AI assistance and reviewed by the author. The author's goal is to improve the Emacs
rescript-ts-mode(jjlee/rescript-mode#19).Summary
This PR updates the Tree-sitter grammar to better match recent ReScript language features across three areas:
What changed
1. ReScript 12 operator support
Added grammar support for the newer operator syntax introduced in ReScript 12, including:
modulo:
%bitwise operators:
&&&|||^^^~~~shift operators:
<<>>>>>2. Variant spread syntax
Added support for:
variant type spreads, e.g.
variant pattern spreads, e.g.
3. Array spread expressions
Added support for spread elements inside array literals, including multiple spreads, e.g.
This brings the grammar in line with array spread syntax available since ReScript v11.