fix: properly error out when the word property is an invalid rule
This commit is contained in:
parent
cca814afd2
commit
78ccc39ca9
1 changed files with 4 additions and 0 deletions
|
|
@ -310,6 +310,10 @@ function grammar(baseGrammar, options) {
|
|||
if (typeof word != 'string') {
|
||||
throw new Error("Grammar's 'word' property must be a named rule.");
|
||||
}
|
||||
|
||||
if (word === 'ReferenceError') {
|
||||
throw new Error("Grammar's 'word' property must be a valid rule name.");
|
||||
}
|
||||
}
|
||||
|
||||
let conflicts = baseGrammar.conflicts;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue