refactor(tests): migrate remaining grammar.json tests to grammar.js

This commit is contained in:
Amaan Qureshi 2024-04-28 23:50:41 -04:00
parent 26fa3a76a5
commit 627617edb4
36 changed files with 560 additions and 1212 deletions

View file

@ -418,7 +418,20 @@ function grammar(baseGrammar, options) {
throw new Error("Grammar must have at least one rule.");
}
return { grammar: { name, inherits, word, rules, extras, conflicts, precedences, externals, inline, supertypes } };
return {
grammar: {
name,
...(inherits ? ( inherits ) : {}),
word,
rules,
extras,
conflicts,
precedences,
externals,
inline,
supertypes,
},
};
}
function checkArguments(args, ruleCount, caller, callerName, suffix = '', argType = 'rule') {