Browse files

Remove unneeded core extension to parser and lexer, this can be done …

…after third %% in .jison file
  • Loading branch information...
1 parent 4252d2d commit 96277074988926e2d6ce88c2ec6d6341b79ced49 @robertleeplummerjr robertleeplummerjr committed May 4, 2012
Showing with 2 additions and 10 deletions.
  1. +2 −10 lib/jison.js
View
12 lib/jison.js
@@ -929,22 +929,14 @@ lrGeneratorMixin.generateModule = function generateModule (opt) {
out += moduleNameVar + ";";
//By making the factory callable, we create the ability to have multi parsers running at the same time
- out += moduleNameVar + "Factory = (function(parserExtensions, lexerExtensions){";
+ out += moduleName + "Factory = (function(parserExtensions, lexerExtensions){";
out += "\nvar parser = "+this.generateModule_();
out += "\n"+this.moduleInclude;
if (this.lexer && this.lexer.generateModule) {
out += this.lexer.generateModule();
out += "\nparser.lexer = lexer;";
}
- //give parser and lexer the ability to be extended
- out += "\nif (parserExtensions) {";
- out += "\n for (var attr in parserExtensions) { parser[attr] = parserExtensions[attr]; }";
- out += "\n}";
- out += "\nif (lexerExtensions) {";
- out += "\n for (var attr in lexerExtensions) { lexer[attr] = lexerExtensions[attr]; }";
- out += "\n}";
-
out += "\nreturn parser;\n});";
//go ahead and create a new parser just like it was before, just still keep factory available
@@ -1592,4 +1584,4 @@ return function Parser (g, options) {
return gen.createParser();
}
-})();
+})();

0 comments on commit 9627707

Please sign in to comment.