Skip to content

Reserved word dsl declarations#4661

Merged
clason merged 1 commit intorelease-0.25from
backport-4650-to-release-0.25
Aug 2, 2025
Merged

Reserved word dsl declarations#4661
clason merged 1 commit intorelease-0.25from
backport-4650-to-release-0.25

Conversation

@tree-sitter-ci-bot
Copy link

Description

Backport of #4650 to release-0.25.

- Use `globalThis` for `reserved` function export
- Add `reserved` field and function to DSL declarations
- Add `reserved` rule to grammar schema

(cherry picked from commit 07b4c8d)
@clason clason merged commit 05bfeb5 into release-0.25 Aug 2, 2025
18 checks passed
@clason clason deleted the backport-4650-to-release-0.25 branch August 2, 2025 09:51
type PrecRule = { type: 'PREC'; content: Rule; value: number };
type Repeat1Rule = { type: 'REPEAT1'; content: Rule };
type RepeatRule = { type: 'REPEAT'; content: Rule };
type ReservedRule = { type: 'RESERVED'; content: Rule; context_name: string };
Copy link

@chharvey chharvey Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like ReservedRule should also be added to the Rule type union on line 19 below. When attempting to call reserved() within a rule in my grammar, I get the following TS error:

Argument of type 'ReservedRule' is not assignable to parameter of type 'RuleOrLiteral'.
Type 'ReservedRule' is not assignable to type 'RegExp | SymbolRule | AliasRule | BlankRule | ChoiceRule | FieldRule | ImmediateTokenRule | ... 10 more ... | RustRegex'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants