From 78ccc39ca916c7738ba56cf50d25b8bfb92dba88 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sat, 10 Feb 2024 20:05:29 -0500 Subject: [PATCH] fix: properly error out when the word property is an invalid rule --- cli/src/generate/dsl.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cli/src/generate/dsl.js b/cli/src/generate/dsl.js index d4ef2f25..0aa367fd 100644 --- a/cli/src/generate/dsl.js +++ b/cli/src/generate/dsl.js @@ -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;