Merge pull request #135 from hyperpape/master

PEG.GrammarError is undefined in report-missing-rules and report-left-recursion
redux
David Majda 12 years ago
commit 09f3f83e1c

@ -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 + "\"."
);
}

@ -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."
);
}

Loading…
Cancel
Save