Merge pull request #2500 from amaanq/dsl-update

feat: improve dsl definitions
This commit is contained in:
Amaan Qureshi 2023-08-16 02:58:41 -04:00 committed by GitHub
commit 28b831456e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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

@ -69,11 +69,17 @@ interface Grammar<
rules: Rules;
/**
* An array of arrays of precedence names. Each inner array represents
* a *descending* ordering. Names listed earlier in one of these arrays
* have higher precedence than any names listed later in the same array.
* An array of arrays of precedence names or rules. Each inner array represents
* a *descending* ordering. Names/rules listed earlier in one of these arrays
* have higher precedence than any names/rules listed later in the same array.
*
* Using rules is just a shorthand way for using a name then calling prec()
* with that name. It is just a convenience.
*/
precedences?: () => String[][],
precedences?: (
$: GrammarSymbols<RuleName | BaseGrammarRuleName>,
previous: Rule[][],
) => RuleOrLiteral[][],
/**
* An array of arrays of rule names. Each inner array represents a set of
@ -87,6 +93,7 @@ interface Grammar<
*/
conflicts?: (
$: GrammarSymbols<RuleName | BaseGrammarRuleName>,
previous: Rule[][],
) => RuleOrLiteral[][];
/**
@ -103,7 +110,7 @@ interface Grammar<
externals?: (
$: Record<string, SymbolRule<string>>,
previous: Rule[],
) => (SymbolRule<string> | RegExp | string)[];
) => RuleOrLiteral[];
/**
* An array of tokens that may appear anywhere in the language. This
@ -127,6 +134,7 @@ interface Grammar<
*/
inline?: (
$: GrammarSymbols<RuleName | BaseGrammarRuleName>,
previous: Rule[],
) => RuleOrLiteral[];
/**
@ -139,6 +147,7 @@ interface Grammar<
*/
supertypes?: (
$: GrammarSymbols<RuleName | BaseGrammarRuleName>,
previous: Rule[],
) => RuleOrLiteral[];
/**