From 1aa3d8e07ed7217dc6d44b07ba5a71cc9a22cf72 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sun, 11 Apr 2010 14:16:38 +0200 Subject: [PATCH] Implemented a nop (no operation) function and used it on few places. --- lib/compiler.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 830add9..485510b 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -6,6 +6,8 @@ (function() { +function nop() {} + /* ===== PEG ===== */ /* @@ -111,11 +113,11 @@ PEG.Grammar.Rule.prototype.checkReferencedRulesExist = function(grammar) { this._expression.checkReferencedRulesExist(grammar); }; -PEG.Grammar.Literal.prototype.checkReferencedRulesExist = function(grammar) {}; +PEG.Grammar.Literal.prototype.checkReferencedRulesExist = nop; -PEG.Grammar.Class.prototype.checkReferencedRulesExist = function(grammar) {}; +PEG.Grammar.Class.prototype.checkReferencedRulesExist = nop; -PEG.Grammar.Any.prototype.checkReferencedRulesExist = function(grammar) {}; +PEG.Grammar.Any.prototype.checkReferencedRulesExist = nop; PEG.Grammar.Sequence.prototype.checkReferencedRulesExist = function(grammar) { PEG.ArrayUtils.each(this._elements, function(element) { @@ -153,11 +155,11 @@ PEG.Grammar.Rule.prototype.checkNoLeftRecursion = function(grammar, appliedRules this._expression.checkNoLeftRecursion(grammar, appliedRules.concat(this._name)); }; -PEG.Grammar.Literal.prototype.checkNoLeftRecursion = function(grammar, appliedRules) {}; +PEG.Grammar.Literal.prototype.checkNoLeftRecursion = nop; -PEG.Grammar.Class.prototype.checkNoLeftRecursion = function(grammar, appliedRules) {}; +PEG.Grammar.Class.prototype.checkNoLeftRecursion = nop; -PEG.Grammar.Any.prototype.checkNoLeftRecursion = function(grammar, appliedRules) {}; +PEG.Grammar.Any.prototype.checkNoLeftRecursion = nop; PEG.Grammar.Sequence.prototype.checkNoLeftRecursion = function(grammar, appliedRules) { if (this._elements.length > 0) {