From 50952155b7f90155fc100a070d5742431fe8a50f Mon Sep 17 00:00:00 2001 From: NightRa Date: Tue, 13 Sep 2016 15:49:15 +0300 Subject: [PATCH] Split into two functions for the optimization to happen --- lib/jison.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/jison.js b/lib/jison.js index 55d1ebde3..a93827225 100755 --- a/lib/jison.js +++ b/lib/jison.js @@ -1368,6 +1368,12 @@ function parseError (str, hash) { parser.parseError = lrGeneratorMixin.parseError = parseError; parser.parse = function parse (input) { + var args = new Array(arguments.length - 1); + for (var i = 0; i < arguments.length - 1; i++) { + args[i] = arguments[i + 1]; + } + +var parseInner = function parseInner (input, args) { var self = this, stack = [0], tstack = [], // token stack @@ -1381,11 +1387,6 @@ parser.parse = function parse (input) { TERROR = 2, EOF = 1; - var args = new Array(arguments.length - 1); - for (var i = 0; i < arguments.length - 1; i++) { - args[i] = arguments[i + 1]; - } - //this.reductionCount = this.shiftCount = 0; var lexer = Object.create(this.lexer); @@ -1607,7 +1608,13 @@ _handle_error: } return true; -}; +} + + return parseInner.bind(this)(input, args); + +} + + parser.init = function parser_init (dict) { this.table = dict.table;