fix: better error when a supertype rule is invalid
This commit is contained in:
parent
e553578696
commit
a73191bf0e
1 changed files with 6 additions and 1 deletions
|
|
@ -394,7 +394,12 @@ function grammar(baseGrammar, options) {
|
|||
throw new Error("Grammar's supertypes must be an array of rules.");
|
||||
}
|
||||
|
||||
supertypes = supertypeRules.map(symbol => symbol.name);
|
||||
supertypes = supertypeRules.map(symbol => {
|
||||
if (symbol.name === 'ReferenceError') {
|
||||
throw new Error(`Supertype rule \`${symbol.symbol.name}\` is not defined.`);
|
||||
}
|
||||
return symbol.name;
|
||||
});
|
||||
}
|
||||
|
||||
let precedences = baseGrammar.precedences;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue