diff --git a/lib/compiler/passes/report-left-recursion.js b/lib/compiler/passes/report-left-recursion.js index 1c6a7d9..5c8592d 100644 --- a/lib/compiler/passes/report-left-recursion.js +++ b/lib/compiler/passes/report-left-recursion.js @@ -1,4 +1,5 @@ -var utils = require("../../utils"); +var utils = require("../../utils"), + GrammarError = require("../../grammar-error.js"); /* Checks that no left recursion is present. */ module.exports = function(ast) { @@ -48,7 +49,7 @@ module.exports = function(ast) { rule_ref: function(node, appliedRules) { if (utils.contains(appliedRules, node.name)) { - throw new PEG.GrammarError( + throw new GrammarError( "Left recursion detected for rule \"" + node.name + "\"." ); } diff --git a/lib/compiler/passes/report-missing-rules.js b/lib/compiler/passes/report-missing-rules.js index f600862..c1193bc 100644 --- a/lib/compiler/passes/report-missing-rules.js +++ b/lib/compiler/passes/report-missing-rules.js @@ -1,4 +1,5 @@ -var utils = require("../../utils"); +var utils = require("../../utils"), + GrammarError = require("../../grammar-error.js"); /* Checks that all referenced rules exist. */ module.exports = function(ast) { @@ -30,7 +31,7 @@ module.exports = function(ast) { rule_ref: function(node) { if (!utils.findRuleByName(ast, node.name)) { - throw new PEG.GrammarError( + throw new GrammarError( "Referenced rule \"" + node.name + "\" does not exist." ); }