feat: support passing in a Rust regex in the grammar dsl

This commit is contained in:
Amaan Qureshi 2025-01-06 01:54:38 -05:00
parent 4170f71dbc
commit 68e707eb4f
4 changed files with 35 additions and 4 deletions

10
cli/npm/dsl.d.ts vendored
View file

@ -33,7 +33,15 @@ type Rule =
| SymbolRule<string>
| TokenRule;
type RuleOrLiteral = Rule | RegExp | string;
class RustRegex {
value: string;
constructor(pattern: string) {
this.value = pattern;
}
}
type RuleOrLiteral = Rule | RegExp | RustRegex | string;
type GrammarSymbols<RuleName extends string> = {
[name in RuleName]: SymbolRule<name>;