From 85fb8aaa0ed54531242235d126543341e660e684 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sun, 3 Jul 2016 17:43:56 +0200 Subject: [PATCH] Grammar error messages 1/3: Improve the missing rule message New wording is more similar to wording used in various programming languages and it is in line with the duplicate rule message. Part of #371. --- lib/compiler/passes/report-missing-rules.js | 2 +- spec/unit/compiler/passes/report-missing-rules.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compiler/passes/report-missing-rules.js b/lib/compiler/passes/report-missing-rules.js index 476d84e..8a7a46e 100644 --- a/lib/compiler/passes/report-missing-rules.js +++ b/lib/compiler/passes/report-missing-rules.js @@ -10,7 +10,7 @@ function reportMissingRules(ast) { rule_ref: function(node) { if (!asts.findRule(ast, node.name)) { throw new GrammarError( - "Referenced rule \"" + node.name + "\" does not exist.", + "Rule \"" + node.name + "\" is not defined.", node.location ); } diff --git a/spec/unit/compiler/passes/report-missing-rules.spec.js b/spec/unit/compiler/passes/report-missing-rules.spec.js index a5dd268..00b2cff 100644 --- a/spec/unit/compiler/passes/report-missing-rules.spec.js +++ b/spec/unit/compiler/passes/report-missing-rules.spec.js @@ -7,7 +7,7 @@ describe("compiler pass |reportMissingRules|", function() { it("reports missing rules", function() { expect(pass).toReportError('start = missing', { - message: 'Referenced rule "missing" does not exist.', + message: 'Rule "missing" is not defined.', location: { start: { offset: 8, line: 1, column: 9 }, end: { offset: 15, line: 1, column: 16 }