From 8758ceb606f1a321101577e2c89e4e68a036e525 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 12 Nov 2017 01:44:58 +0100 Subject: [PATCH] regenerated library files --- dist/cli-cjs-es5.js | 103 +++++++++++--- dist/cli-cjs.js | 130 +++++++++++++++--- dist/cli-es6.js | 130 +++++++++++++++--- dist/cli-umd-es5.js | 103 +++++++++++--- dist/cli-umd.js | 130 +++++++++++++++--- dist/jison-cjs-es5.js | 103 +++++++++++--- dist/jison-cjs.js | 130 +++++++++++++++--- dist/jison-es6.js | 130 +++++++++++++++--- dist/jison-umd-es5.js | 103 +++++++++++--- dist/jison-umd.js | 130 +++++++++++++++--- docs/assets/js/calculator.js | 29 +++- docs/assets/js/jison.js | 103 +++++++++++--- .../ebnf-parser/dist/ebnf-parser-cjs-es5.js | 99 +++++++++++-- packages/ebnf-parser/dist/ebnf-parser-cjs.js | 99 +++++++++++-- packages/ebnf-parser/dist/ebnf-parser-es6.js | 99 +++++++++++-- .../ebnf-parser/dist/ebnf-parser-umd-es5.js | 99 +++++++++++-- packages/ebnf-parser/dist/ebnf-parser-umd.js | 99 +++++++++++-- packages/ebnf-parser/parser.js | 33 ++++- packages/ebnf-parser/transform-parser.js | 33 ++++- packages/jison-lex/dist/cli-cjs-es5.js | 35 ++++- packages/jison-lex/dist/cli-cjs.js | 39 ++++-- packages/jison-lex/dist/cli-es6.js | 39 ++++-- packages/jison-lex/dist/cli-umd-es5.js | 35 ++++- packages/jison-lex/dist/cli-umd.js | 39 ++++-- .../jison-lex/dist/regexp-lexer-cjs-es5.js | 35 ++++- packages/jison-lex/dist/regexp-lexer-cjs.js | 39 ++++-- packages/jison-lex/dist/regexp-lexer-es6.js | 39 ++++-- .../jison-lex/dist/regexp-lexer-umd-es5.js | 35 ++++- packages/jison-lex/dist/regexp-lexer-umd.js | 39 ++++-- .../lex-parser/dist/lex-parser-cjs-es5.js | 33 ++++- packages/lex-parser/dist/lex-parser-cjs.js | 33 ++++- packages/lex-parser/dist/lex-parser-es6.js | 33 ++++- .../lex-parser/dist/lex-parser-umd-es5.js | 33 ++++- packages/lex-parser/dist/lex-parser-umd.js | 33 ++++- packages/lex-parser/lex-parser.js | 33 ++++- web/content/assets/js/calculator.js | 29 +++- web/content/assets/js/jison.js | 103 +++++++++++--- 37 files changed, 2180 insertions(+), 409 deletions(-) diff --git a/dist/cli-cjs-es5.js b/dist/cli-cjs-es5.js index 2c6a4b1e3..5b2cdc9b5 100644 --- a/dist/cli-cjs-es5.js +++ b/dist/cli-cjs-es5.js @@ -742,7 +742,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3337,7 +3337,7 @@ var parser$1 = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3347,6 +3347,18 @@ var parser$1 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3417,6 +3429,17 @@ var parser$1 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -4008,7 +4031,7 @@ var parser$1 = { }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5511,10 +5534,10 @@ var lexer = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8839,7 +8862,7 @@ function RegExpLexer(dict, input, tokens, build_options) { */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } @@ -9268,7 +9291,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -10323,7 +10346,7 @@ var parser$3 = { return pei; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -10333,6 +10356,18 @@ var parser$3 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -10350,6 +10385,17 @@ var parser$3 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; @@ -10539,7 +10585,7 @@ var parser$3 = { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -12042,10 +12088,10 @@ var lexer$2 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12633,7 +12679,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -15271,7 +15317,7 @@ var parser$2 = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -15281,6 +15327,18 @@ var parser$2 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -15351,6 +15409,17 @@ var parser$2 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -15942,7 +16011,7 @@ var parser$2 = { }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -17445,10 +17514,10 @@ var lexer$1 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -24564,7 +24633,7 @@ for (var api in api_set) { } // --- START parser kernel --- -parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function lex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; +parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function stdLex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n function fastLex() {\n var token = lexer.fastLex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n var lex = stdLex;\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n // NOTE: we *assume* no lexer pre/post handlers are set up *after* \n // this initial `setInput()` call: hence we can now check and decide\n // whether we\'ll go with the standard, slower, lex() API or the\n // `fast_lex()` one:\n if (typeof lexer.canIUse === \'function\') {\n var lexerInfo = lexer.canIUse();\n if (lexerInfo.fastLex && typeof fastLex === \'function\') {\n lex = fastLex;\n }\n } \n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; // --- END parser kernel --- diff --git a/dist/cli-cjs.js b/dist/cli-cjs.js index b15fd739f..21d969547 100644 --- a/dist/cli-cjs.js +++ b/dist/cli-cjs.js @@ -668,7 +668,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4989,7 +4989,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4999,6 +4999,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -5110,6 +5122,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5867,7 +5890,7 @@ yyError: 1 }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7401,10 +7424,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12309,16 +12332,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, @@ -13180,7 +13203,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -14577,7 +14600,7 @@ parse: function parse(input) { - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -14587,6 +14610,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -14606,6 +14641,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -14848,7 +14894,7 @@ parse: function parse(input) { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -16382,10 +16428,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -17023,7 +17069,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -21417,7 +21463,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -21427,6 +21473,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -21538,6 +21596,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -22295,7 +22364,7 @@ yyError: 1 }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -23829,10 +23898,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -33116,7 +33185,7 @@ parser.parse = `function parse(input, parseParams) { //_lexer_without_token_stack: - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -33126,6 +33195,18 @@ parser.parse = `function parse(input, parseParams) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + //_lexer_with_token_stack: // lex function that supports token stacks @@ -33222,6 +33303,17 @@ parser.parse = `function parse(input, parseParams) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial \`setInput()\` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // \`fast_lex()\` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; diff --git a/dist/cli-es6.js b/dist/cli-es6.js index d5e7be4b1..01a262c58 100644 --- a/dist/cli-es6.js +++ b/dist/cli-es6.js @@ -664,7 +664,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4985,7 +4985,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4995,6 +4995,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -5106,6 +5118,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5863,7 +5886,7 @@ yyError: 1 }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7397,10 +7420,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12305,16 +12328,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, @@ -13176,7 +13199,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -14573,7 +14596,7 @@ parse: function parse(input) { - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -14583,6 +14606,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -14602,6 +14637,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -14844,7 +14890,7 @@ parse: function parse(input) { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -16378,10 +16424,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -17019,7 +17065,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -21413,7 +21459,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -21423,6 +21469,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -21534,6 +21592,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -22291,7 +22360,7 @@ yyError: 1 }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -23825,10 +23894,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -33112,7 +33181,7 @@ parser.parse = `function parse(input, parseParams) { //_lexer_without_token_stack: - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -33122,6 +33191,18 @@ parser.parse = `function parse(input, parseParams) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + //_lexer_with_token_stack: // lex function that supports token stacks @@ -33218,6 +33299,17 @@ parser.parse = `function parse(input, parseParams) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial \`setInput()\` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // \`fast_lex()\` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; diff --git a/dist/cli-umd-es5.js b/dist/cli-umd-es5.js index 53ddebe13..30c72af2d 100644 --- a/dist/cli-umd-es5.js +++ b/dist/cli-umd-es5.js @@ -743,7 +743,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert$1; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3338,7 +3338,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3348,6 +3348,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3418,6 +3430,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -4009,7 +4032,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5512,10 +5535,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8840,7 +8863,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } @@ -9269,7 +9292,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -10324,7 +10347,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return pei; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -10334,6 +10357,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -10351,6 +10386,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; @@ -10540,7 +10586,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -12043,10 +12089,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12634,7 +12680,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert$2; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -15272,7 +15318,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -15282,6 +15328,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -15352,6 +15410,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -15943,7 +16012,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -17446,10 +17515,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -24565,7 +24634,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi } // --- START parser kernel --- - parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function lex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; + parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function stdLex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n function fastLex() {\n var token = lexer.fastLex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n var lex = stdLex;\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n // NOTE: we *assume* no lexer pre/post handlers are set up *after* \n // this initial `setInput()` call: hence we can now check and decide\n // whether we\'ll go with the standard, slower, lex() API or the\n // `fast_lex()` one:\n if (typeof lexer.canIUse === \'function\') {\n var lexerInfo = lexer.canIUse();\n if (lexerInfo.fastLex && typeof fastLex === \'function\') {\n lex = fastLex;\n }\n } \n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; // --- END parser kernel --- diff --git a/dist/cli-umd.js b/dist/cli-umd.js index 4a1b09f20..c47ed1050 100644 --- a/dist/cli-umd.js +++ b/dist/cli-umd.js @@ -670,7 +670,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4991,7 +4991,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -5001,6 +5001,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -5112,6 +5124,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5869,7 +5892,7 @@ yyError: 1 }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7403,10 +7426,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12311,16 +12334,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, @@ -13182,7 +13205,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -14579,7 +14602,7 @@ parse: function parse(input) { - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -14589,6 +14612,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -14608,6 +14643,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -14850,7 +14896,7 @@ parse: function parse(input) { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -16384,10 +16430,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -17025,7 +17071,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -21419,7 +21465,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -21429,6 +21475,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -21540,6 +21598,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -22297,7 +22366,7 @@ yyError: 1 }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -23831,10 +23900,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -33118,7 +33187,7 @@ parser.parse = `function parse(input, parseParams) { //_lexer_without_token_stack: - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -33128,6 +33197,18 @@ parser.parse = `function parse(input, parseParams) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + //_lexer_with_token_stack: // lex function that supports token stacks @@ -33224,6 +33305,17 @@ parser.parse = `function parse(input, parseParams) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial \`setInput()\` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // \`fast_lex()\` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; diff --git a/dist/jison-cjs-es5.js b/dist/jison-cjs-es5.js index 19d4a578c..49db6e795 100644 --- a/dist/jison-cjs-es5.js +++ b/dist/jison-cjs-es5.js @@ -736,7 +736,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3331,7 +3331,7 @@ var parser$1 = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3341,6 +3341,18 @@ var parser$1 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3411,6 +3423,17 @@ var parser$1 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -4002,7 +4025,7 @@ var parser$1 = { }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5505,10 +5528,10 @@ var lexer = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8833,7 +8856,7 @@ function RegExpLexer(dict, input, tokens, build_options) { */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } @@ -9262,7 +9285,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -10317,7 +10340,7 @@ var parser$3 = { return pei; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -10327,6 +10350,18 @@ var parser$3 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -10344,6 +10379,17 @@ var parser$3 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; @@ -10533,7 +10579,7 @@ var parser$3 = { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -12036,10 +12082,10 @@ var lexer$2 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12627,7 +12673,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -15265,7 +15311,7 @@ var parser$2 = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -15275,6 +15321,18 @@ var parser$2 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -15345,6 +15403,17 @@ var parser$2 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -15936,7 +16005,7 @@ var parser$2 = { }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -17439,10 +17508,10 @@ var lexer$1 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -24558,7 +24627,7 @@ for (var api in api_set) { } // --- START parser kernel --- -parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function lex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; +parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function stdLex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n function fastLex() {\n var token = lexer.fastLex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n var lex = stdLex;\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n // NOTE: we *assume* no lexer pre/post handlers are set up *after* \n // this initial `setInput()` call: hence we can now check and decide\n // whether we\'ll go with the standard, slower, lex() API or the\n // `fast_lex()` one:\n if (typeof lexer.canIUse === \'function\') {\n var lexerInfo = lexer.canIUse();\n if (lexerInfo.fastLex && typeof fastLex === \'function\') {\n lex = fastLex;\n }\n } \n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; // --- END parser kernel --- diff --git a/dist/jison-cjs.js b/dist/jison-cjs.js index f2eacd1f5..fb4204694 100644 --- a/dist/jison-cjs.js +++ b/dist/jison-cjs.js @@ -663,7 +663,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4984,7 +4984,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4994,6 +4994,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -5105,6 +5117,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5862,7 +5885,7 @@ yyError: 1 }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7396,10 +7419,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12304,16 +12327,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, @@ -13175,7 +13198,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -14572,7 +14595,7 @@ parse: function parse(input) { - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -14582,6 +14605,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -14601,6 +14636,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -14843,7 +14889,7 @@ parse: function parse(input) { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -16377,10 +16423,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -17018,7 +17064,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -21412,7 +21458,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -21422,6 +21468,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -21533,6 +21591,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -22290,7 +22359,7 @@ yyError: 1 }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -23824,10 +23893,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -33111,7 +33180,7 @@ parser.parse = `function parse(input, parseParams) { //_lexer_without_token_stack: - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -33121,6 +33190,18 @@ parser.parse = `function parse(input, parseParams) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + //_lexer_with_token_stack: // lex function that supports token stacks @@ -33217,6 +33298,17 @@ parser.parse = `function parse(input, parseParams) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial \`setInput()\` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // \`fast_lex()\` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; diff --git a/dist/jison-es6.js b/dist/jison-es6.js index 4207133e9..92f8f5ddc 100644 --- a/dist/jison-es6.js +++ b/dist/jison-es6.js @@ -659,7 +659,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4980,7 +4980,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4990,6 +4990,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -5101,6 +5113,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5858,7 +5881,7 @@ yyError: 1 }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7392,10 +7415,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12300,16 +12323,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, @@ -13171,7 +13194,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -14568,7 +14591,7 @@ parse: function parse(input) { - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -14578,6 +14601,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -14597,6 +14632,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -14839,7 +14885,7 @@ parse: function parse(input) { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -16373,10 +16419,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -17014,7 +17060,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -21408,7 +21454,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -21418,6 +21464,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -21529,6 +21587,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -22286,7 +22355,7 @@ yyError: 1 }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -23820,10 +23889,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -33107,7 +33176,7 @@ parser.parse = `function parse(input, parseParams) { //_lexer_without_token_stack: - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -33117,6 +33186,18 @@ parser.parse = `function parse(input, parseParams) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + //_lexer_with_token_stack: // lex function that supports token stacks @@ -33213,6 +33294,17 @@ parser.parse = `function parse(input, parseParams) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial \`setInput()\` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // \`fast_lex()\` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; diff --git a/dist/jison-umd-es5.js b/dist/jison-umd-es5.js index 2597455b6..20e60b7fa 100644 --- a/dist/jison-umd-es5.js +++ b/dist/jison-umd-es5.js @@ -737,7 +737,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert$1; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3332,7 +3332,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3342,6 +3342,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3412,6 +3424,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -4003,7 +4026,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5506,10 +5529,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8834,7 +8857,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } @@ -9263,7 +9286,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -10318,7 +10341,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return pei; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -10328,6 +10351,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -10345,6 +10380,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; @@ -10534,7 +10580,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -12037,10 +12083,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12628,7 +12674,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert$2; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -15266,7 +15312,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -15276,6 +15322,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -15346,6 +15404,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -15937,7 +16006,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -17440,10 +17509,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -24559,7 +24628,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi } // --- START parser kernel --- - parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function lex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; + parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function stdLex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n function fastLex() {\n var token = lexer.fastLex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n var lex = stdLex;\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n // NOTE: we *assume* no lexer pre/post handlers are set up *after* \n // this initial `setInput()` call: hence we can now check and decide\n // whether we\'ll go with the standard, slower, lex() API or the\n // `fast_lex()` one:\n if (typeof lexer.canIUse === \'function\') {\n var lexerInfo = lexer.canIUse();\n if (lexerInfo.fastLex && typeof fastLex === \'function\') {\n lex = fastLex;\n }\n } \n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; // --- END parser kernel --- diff --git a/dist/jison-umd.js b/dist/jison-umd.js index fbffad46a..c2a9e9ea1 100644 --- a/dist/jison-umd.js +++ b/dist/jison-umd.js @@ -665,7 +665,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4986,7 +4986,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4996,6 +4996,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -5107,6 +5119,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5864,7 +5887,7 @@ yyError: 1 }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7398,10 +7421,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12306,16 +12329,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, @@ -13177,7 +13200,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -14574,7 +14597,7 @@ parse: function parse(input) { - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -14584,6 +14607,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -14603,6 +14638,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -14845,7 +14891,7 @@ parse: function parse(input) { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -16379,10 +16425,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -17020,7 +17066,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -21414,7 +21460,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -21424,6 +21470,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -21535,6 +21593,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -22292,7 +22361,7 @@ yyError: 1 }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -23826,10 +23895,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -33113,7 +33182,7 @@ parser.parse = `function parse(input, parseParams) { //_lexer_without_token_stack: - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -33123,6 +33192,18 @@ parser.parse = `function parse(input, parseParams) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + //_lexer_with_token_stack: // lex function that supports token stacks @@ -33219,6 +33300,17 @@ parser.parse = `function parse(input, parseParams) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial \`setInput()\` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // \`fast_lex()\` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; diff --git a/docs/assets/js/calculator.js b/docs/assets/js/calculator.js index 5f25548af..da6423e2e 100644 --- a/docs/assets/js/calculator.js +++ b/docs/assets/js/calculator.js @@ -1403,7 +1403,7 @@ parse: function parse(input) { } - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -1413,6 +1413,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -1432,6 +1444,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -3208,10 +3231,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/docs/assets/js/jison.js b/docs/assets/js/jison.js index ba5896466..1edee0da0 100644 --- a/docs/assets/js/jison.js +++ b/docs/assets/js/jison.js @@ -738,7 +738,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3333,7 +3333,7 @@ var parser$1 = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3343,6 +3343,18 @@ var parser$1 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3413,6 +3425,17 @@ var parser$1 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -4004,7 +4027,7 @@ var parser$1 = { }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5507,10 +5530,10 @@ var lexer = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8835,7 +8858,7 @@ function RegExpLexer(dict, input, tokens, build_options) { */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } @@ -9264,7 +9287,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -10319,7 +10342,7 @@ var parser$3 = { return pei; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -10329,6 +10352,18 @@ var parser$3 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -10346,6 +10381,17 @@ var parser$3 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; @@ -10535,7 +10581,7 @@ var parser$3 = { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -12038,10 +12084,10 @@ var lexer$2 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12629,7 +12675,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -15267,7 +15313,7 @@ var parser$2 = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -15277,6 +15323,18 @@ var parser$2 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -15347,6 +15405,17 @@ var parser$2 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -15938,7 +16007,7 @@ var parser$2 = { }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -17441,10 +17510,10 @@ var lexer$1 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -24560,7 +24629,7 @@ for (var api in api_set) { } // --- START parser kernel --- -parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function lex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; +parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function stdLex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n function fastLex() {\n var token = lexer.fastLex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n var lex = stdLex;\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n // NOTE: we *assume* no lexer pre/post handlers are set up *after* \n // this initial `setInput()` call: hence we can now check and decide\n // whether we\'ll go with the standard, slower, lex() API or the\n // `fast_lex()` one:\n if (typeof lexer.canIUse === \'function\') {\n var lexerInfo = lexer.canIUse();\n if (lexerInfo.fastLex && typeof fastLex === \'function\') {\n lex = fastLex;\n }\n } \n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; // --- END parser kernel --- diff --git a/packages/ebnf-parser/dist/ebnf-parser-cjs-es5.js b/packages/ebnf-parser/dist/ebnf-parser-cjs-es5.js index da80ee21b..4fc65af4f 100644 --- a/packages/ebnf-parser/dist/ebnf-parser-cjs-es5.js +++ b/packages/ebnf-parser/dist/ebnf-parser-cjs-es5.js @@ -452,7 +452,7 @@ var helpers = { printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer }; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -1507,7 +1507,7 @@ var parser$1 = { return pei; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -1517,6 +1517,18 @@ var parser$1 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -1534,6 +1546,17 @@ var parser$1 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; @@ -1723,7 +1746,7 @@ var parser$1 = { }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -3226,10 +3249,10 @@ var lexer$1 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -3817,7 +3840,7 @@ function transform(ebnf) { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -6455,7 +6478,7 @@ var parser = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -6465,6 +6488,18 @@ var parser = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -6535,6 +6570,17 @@ var parser = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -7126,7 +7172,7 @@ var parser = { }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -8629,10 +8675,10 @@ var lexer = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -9578,7 +9624,7 @@ var bnf = { // hack: var assert$3; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -12173,7 +12219,7 @@ var parser$3 = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -12183,6 +12229,18 @@ var parser$3 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -12253,6 +12311,17 @@ var parser$3 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -12844,7 +12913,7 @@ var parser$3 = { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -14347,10 +14416,10 @@ var lexer$2 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/ebnf-parser/dist/ebnf-parser-cjs.js b/packages/ebnf-parser/dist/ebnf-parser-cjs.js index 96f1f1f65..a89394346 100644 --- a/packages/ebnf-parser/dist/ebnf-parser-cjs.js +++ b/packages/ebnf-parser/dist/ebnf-parser-cjs.js @@ -409,7 +409,7 @@ var helpers = { printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer, }; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -1806,7 +1806,7 @@ parse: function parse(input) { - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -1816,6 +1816,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -1835,6 +1847,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -2077,7 +2100,7 @@ parse: function parse(input) { }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -3611,10 +3634,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -4252,7 +4275,7 @@ function transform(ebnf) { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -8646,7 +8669,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -8656,6 +8679,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -8767,6 +8802,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -9524,7 +9570,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -11058,10 +11104,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12284,7 +12330,7 @@ var bnf = { // hack: var assert$3; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -16605,7 +16651,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -16615,6 +16661,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -16726,6 +16784,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -17483,7 +17552,7 @@ yyError: 1 }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -19017,10 +19086,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/ebnf-parser/dist/ebnf-parser-es6.js b/packages/ebnf-parser/dist/ebnf-parser-es6.js index 53acb1c5e..e11a8b75e 100644 --- a/packages/ebnf-parser/dist/ebnf-parser-es6.js +++ b/packages/ebnf-parser/dist/ebnf-parser-es6.js @@ -405,7 +405,7 @@ var helpers = { printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer, }; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -1802,7 +1802,7 @@ parse: function parse(input) { - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -1812,6 +1812,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -1831,6 +1843,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -2073,7 +2096,7 @@ parse: function parse(input) { }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -3607,10 +3630,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -4248,7 +4271,7 @@ function transform(ebnf) { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -8642,7 +8665,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -8652,6 +8675,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -8763,6 +8798,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -9520,7 +9566,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -11054,10 +11100,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12280,7 +12326,7 @@ var bnf = { // hack: var assert$3; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -16601,7 +16647,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -16611,6 +16657,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -16722,6 +16780,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -17479,7 +17548,7 @@ yyError: 1 }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -19013,10 +19082,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/ebnf-parser/dist/ebnf-parser-umd-es5.js b/packages/ebnf-parser/dist/ebnf-parser-umd-es5.js index 7a813011d..a1eeaf47e 100644 --- a/packages/ebnf-parser/dist/ebnf-parser-umd-es5.js +++ b/packages/ebnf-parser/dist/ebnf-parser-umd-es5.js @@ -453,7 +453,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer }; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -1508,7 +1508,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return pei; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -1518,6 +1518,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -1535,6 +1547,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; @@ -1724,7 +1747,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -3227,10 +3250,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -3818,7 +3841,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert$1; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -6456,7 +6479,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -6466,6 +6489,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -6536,6 +6571,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -7127,7 +7173,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -8630,10 +8676,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -9579,7 +9625,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert$3; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -12174,7 +12220,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -12184,6 +12230,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -12254,6 +12312,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -12845,7 +12914,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -14348,10 +14417,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/ebnf-parser/dist/ebnf-parser-umd.js b/packages/ebnf-parser/dist/ebnf-parser-umd.js index 55bf2be4d..b2b9a748e 100644 --- a/packages/ebnf-parser/dist/ebnf-parser-umd.js +++ b/packages/ebnf-parser/dist/ebnf-parser-umd.js @@ -411,7 +411,7 @@ var helpers = { printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer, }; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -1808,7 +1808,7 @@ parse: function parse(input) { - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -1818,6 +1818,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -1837,6 +1849,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -2079,7 +2102,7 @@ parse: function parse(input) { }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -3613,10 +3636,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -4254,7 +4277,7 @@ function transform(ebnf) { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -8648,7 +8671,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -8658,6 +8681,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -8769,6 +8804,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -9526,7 +9572,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -11060,10 +11106,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12286,7 +12332,7 @@ var bnf = { // hack: var assert$3; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -16607,7 +16653,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -16617,6 +16663,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -16728,6 +16786,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -17485,7 +17554,7 @@ yyError: 1 }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -19019,10 +19088,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/ebnf-parser/parser.js b/packages/ebnf-parser/parser.js index 083645217..e8a477674 100644 --- a/packages/ebnf-parser/parser.js +++ b/packages/ebnf-parser/parser.js @@ -2,7 +2,7 @@ // hack: var assert; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4410,7 +4410,7 @@ parse: function parse(input) { } - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4420,6 +4420,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4531,6 +4543,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5288,7 +5311,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -6822,10 +6845,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/ebnf-parser/transform-parser.js b/packages/ebnf-parser/transform-parser.js index 57054bdb9..2bd9eeafc 100644 --- a/packages/ebnf-parser/transform-parser.js +++ b/packages/ebnf-parser/transform-parser.js @@ -2,7 +2,7 @@ // hack: var assert; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -1421,7 +1421,7 @@ parse: function parse(input) { } - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -1431,6 +1431,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -1450,6 +1462,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -1692,7 +1715,7 @@ parse: function parse(input) { }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -3226,10 +3249,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/jison-lex/dist/cli-cjs-es5.js b/packages/jison-lex/dist/cli-cjs-es5.js index f01457ae5..53673805c 100644 --- a/packages/jison-lex/dist/cli-cjs-es5.js +++ b/packages/jison-lex/dist/cli-cjs-es5.js @@ -429,7 +429,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3024,7 +3024,7 @@ var parser = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3034,6 +3034,18 @@ var parser = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3104,6 +3116,17 @@ var parser = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -3695,7 +3718,7 @@ var parser = { }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5198,10 +5221,10 @@ var lexer = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8526,7 +8549,7 @@ function RegExpLexer(dict, input, tokens, build_options) { */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } diff --git a/packages/jison-lex/dist/cli-cjs.js b/packages/jison-lex/dist/cli-cjs.js index 6cf4e3fb6..fa990b0b3 100644 --- a/packages/jison-lex/dist/cli-cjs.js +++ b/packages/jison-lex/dist/cli-cjs.js @@ -417,7 +417,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4738,7 +4738,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4748,6 +4748,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4859,6 +4871,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5616,7 +5639,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7150,10 +7173,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12058,16 +12081,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, diff --git a/packages/jison-lex/dist/cli-es6.js b/packages/jison-lex/dist/cli-es6.js index 69ad206de..3750a31d9 100644 --- a/packages/jison-lex/dist/cli-es6.js +++ b/packages/jison-lex/dist/cli-es6.js @@ -413,7 +413,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4734,7 +4734,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4744,6 +4744,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4855,6 +4867,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5612,7 +5635,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7146,10 +7169,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12054,16 +12077,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, diff --git a/packages/jison-lex/dist/cli-umd-es5.js b/packages/jison-lex/dist/cli-umd-es5.js index 43ce871e6..a32933c28 100644 --- a/packages/jison-lex/dist/cli-umd-es5.js +++ b/packages/jison-lex/dist/cli-umd-es5.js @@ -430,7 +430,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert$1; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3025,7 +3025,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3035,6 +3035,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3105,6 +3117,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -3696,7 +3719,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5199,10 +5222,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8527,7 +8550,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } diff --git a/packages/jison-lex/dist/cli-umd.js b/packages/jison-lex/dist/cli-umd.js index 060e48980..23b9ab95e 100644 --- a/packages/jison-lex/dist/cli-umd.js +++ b/packages/jison-lex/dist/cli-umd.js @@ -419,7 +419,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4740,7 +4740,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4750,6 +4750,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4861,6 +4873,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5618,7 +5641,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7152,10 +7175,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12060,16 +12083,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, diff --git a/packages/jison-lex/dist/regexp-lexer-cjs-es5.js b/packages/jison-lex/dist/regexp-lexer-cjs-es5.js index 02dc06912..f480d5cfb 100644 --- a/packages/jison-lex/dist/regexp-lexer-cjs-es5.js +++ b/packages/jison-lex/dist/regexp-lexer-cjs-es5.js @@ -425,7 +425,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3020,7 +3020,7 @@ var parser = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3030,6 +3030,18 @@ var parser = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3100,6 +3112,17 @@ var parser = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -3691,7 +3714,7 @@ var parser = { }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5194,10 +5217,10 @@ var lexer = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8522,7 +8545,7 @@ function RegExpLexer(dict, input, tokens, build_options) { */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } diff --git a/packages/jison-lex/dist/regexp-lexer-cjs.js b/packages/jison-lex/dist/regexp-lexer-cjs.js index b6612cc6f..3f1ca6bf5 100644 --- a/packages/jison-lex/dist/regexp-lexer-cjs.js +++ b/packages/jison-lex/dist/regexp-lexer-cjs.js @@ -413,7 +413,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4734,7 +4734,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4744,6 +4744,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4855,6 +4867,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5612,7 +5635,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7146,10 +7169,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12054,16 +12077,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, diff --git a/packages/jison-lex/dist/regexp-lexer-es6.js b/packages/jison-lex/dist/regexp-lexer-es6.js index 48b19c263..51ec17df7 100644 --- a/packages/jison-lex/dist/regexp-lexer-es6.js +++ b/packages/jison-lex/dist/regexp-lexer-es6.js @@ -409,7 +409,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4730,7 +4730,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4740,6 +4740,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4851,6 +4863,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5608,7 +5631,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7142,10 +7165,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12050,16 +12073,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, diff --git a/packages/jison-lex/dist/regexp-lexer-umd-es5.js b/packages/jison-lex/dist/regexp-lexer-umd-es5.js index af2106a88..ded55a297 100644 --- a/packages/jison-lex/dist/regexp-lexer-umd-es5.js +++ b/packages/jison-lex/dist/regexp-lexer-umd-es5.js @@ -426,7 +426,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert$1; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3021,7 +3021,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3031,6 +3031,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3101,6 +3113,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -3692,7 +3715,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5195,10 +5218,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8523,7 +8546,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } diff --git a/packages/jison-lex/dist/regexp-lexer-umd.js b/packages/jison-lex/dist/regexp-lexer-umd.js index 8fbf68972..7ef057035 100644 --- a/packages/jison-lex/dist/regexp-lexer-umd.js +++ b/packages/jison-lex/dist/regexp-lexer-umd.js @@ -415,7 +415,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4736,7 +4736,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4746,6 +4746,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4857,6 +4869,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5614,7 +5637,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7148,10 +7171,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12056,16 +12079,16 @@ return `{ */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !( + fastLex: !( typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || (this.yy && typeof this.yy.pre_lex === 'function') || (this.yy && typeof this.yy.post_lex === 'function') || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function' - ), + ) && typeof this.fastLex === 'function', }; - return r; + return rv; }, diff --git a/packages/lex-parser/dist/lex-parser-cjs-es5.js b/packages/lex-parser/dist/lex-parser-cjs-es5.js index a32ed9eea..547a3e4fe 100644 --- a/packages/lex-parser/dist/lex-parser-cjs-es5.js +++ b/packages/lex-parser/dist/lex-parser-cjs-es5.js @@ -417,7 +417,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3012,7 +3012,7 @@ var parser = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3022,6 +3022,18 @@ var parser = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3092,6 +3104,17 @@ var parser = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -3683,7 +3706,7 @@ var parser = { }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5186,10 +5209,10 @@ var lexer = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/lex-parser/dist/lex-parser-cjs.js b/packages/lex-parser/dist/lex-parser-cjs.js index 42f4eb2ac..45c7c9423 100644 --- a/packages/lex-parser/dist/lex-parser-cjs.js +++ b/packages/lex-parser/dist/lex-parser-cjs.js @@ -412,7 +412,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4733,7 +4733,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4743,6 +4743,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4854,6 +4866,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5611,7 +5634,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7145,10 +7168,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/lex-parser/dist/lex-parser-es6.js b/packages/lex-parser/dist/lex-parser-es6.js index 7cab99d91..0fcaa94bb 100644 --- a/packages/lex-parser/dist/lex-parser-es6.js +++ b/packages/lex-parser/dist/lex-parser-es6.js @@ -408,7 +408,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4729,7 +4729,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4739,6 +4739,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4850,6 +4862,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5607,7 +5630,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7141,10 +7164,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/lex-parser/dist/lex-parser-umd-es5.js b/packages/lex-parser/dist/lex-parser-umd-es5.js index 72c224c34..bb4f47476 100644 --- a/packages/lex-parser/dist/lex-parser-umd-es5.js +++ b/packages/lex-parser/dist/lex-parser-umd-es5.js @@ -418,7 +418,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert$1; - /* parser generated by jison 0.6.1-209 */ + /* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3013,7 +3013,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3023,6 +3023,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3093,6 +3105,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -3684,7 +3707,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; - /* lexer generated by jison-lex 0.6.1-209 */ + /* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5187,10 +5210,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/lex-parser/dist/lex-parser-umd.js b/packages/lex-parser/dist/lex-parser-umd.js index 2904419be..3e6ab3983 100644 --- a/packages/lex-parser/dist/lex-parser-umd.js +++ b/packages/lex-parser/dist/lex-parser-umd.js @@ -414,7 +414,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4735,7 +4735,7 @@ parse: function parse(input) { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4745,6 +4745,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4856,6 +4868,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5613,7 +5636,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -7147,10 +7170,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/packages/lex-parser/lex-parser.js b/packages/lex-parser/lex-parser.js index b9707ce83..f893ac0f9 100644 --- a/packages/lex-parser/lex-parser.js +++ b/packages/lex-parser/lex-parser.js @@ -2,7 +2,7 @@ // hack: var assert; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -4336,7 +4336,7 @@ parse: function parse(input) { } - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -4346,6 +4346,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -4457,6 +4469,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -5214,7 +5237,7 @@ yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -6748,10 +6771,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/web/content/assets/js/calculator.js b/web/content/assets/js/calculator.js index 5f25548af..da6423e2e 100644 --- a/web/content/assets/js/calculator.js +++ b/web/content/assets/js/calculator.js @@ -1403,7 +1403,7 @@ parse: function parse(input) { } - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -1413,6 +1413,18 @@ parse: function parse(input) { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { @@ -1432,6 +1444,17 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; @@ -3208,10 +3231,10 @@ EOF: 1, */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** diff --git a/web/content/assets/js/jison.js b/web/content/assets/js/jison.js index ba5896466..1edee0da0 100644 --- a/web/content/assets/js/jison.js +++ b/web/content/assets/js/jison.js @@ -738,7 +738,7 @@ var helpers = { // hack: var assert$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -3333,7 +3333,7 @@ var parser$1 = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -3343,6 +3343,18 @@ var parser$1 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -3413,6 +3425,17 @@ var parser$1 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -4004,7 +4027,7 @@ var parser$1 = { }; parser$1.originalParseError = parser$1.parseError; parser$1.originalQuoteName = parser$1.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -5507,10 +5530,10 @@ var lexer = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -8835,7 +8858,7 @@ function RegExpLexer(dict, input, tokens, build_options) { */ function getRegExpLexerPrototype() { // --- START lexer kernel --- - return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fast_lex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ),\n };\n return r;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; + return '{\n EOF: 1,\n ERROR: 2,\n\n // JisonLexerError: JisonLexerError, /// <-- injected by the code generator\n\n // options: {}, /// <-- injected by the code generator\n\n // yy: ..., /// <-- injected by setInput()\n\n __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state\n\n __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup\n\n __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been \'unfolded\' completely and is now ready for use\n\n done: false, /// INTERNAL USE ONLY\n _backtrack: false, /// INTERNAL USE ONLY\n _input: \'\', /// INTERNAL USE ONLY\n _more: false, /// INTERNAL USE ONLY\n _signaled_error_token: false, /// INTERNAL USE ONLY\n\n conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()`\n\n match: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely!\n matched: \'\', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far\n matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt\n yytext: \'\', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the \'token value\' when the parser consumes the lexer token produced through a call to the `lex()` API.\n offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the \'cursor position\' in the input string, i.e. the number of characters matched so far\n yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`)\n yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: \'line number\' at which the token under construction is located\n yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction\n\n /**\n * INTERNAL USE: construct a suitable error info hash object instance for `parseError`.\n * \n * @public\n * @this {RegExpLexer}\n */\n constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) {\n msg = \'\' + msg;\n\n // heuristic to determine if the error message already contains a (partial) source code dump\n // as produced by either `showPosition()` or `prettyPrintRange()`:\n if (show_input_position == undefined) {\n show_input_position = !(msg.indexOf(\'\\n\') > 0 && msg.indexOf(\'^\') > 0);\n }\n if (this.yylloc && show_input_position) {\n if (typeof this.prettyPrintRange === \'function\') {\n var pretty_src = this.prettyPrintRange(this.yylloc);\n\n if (!/\\n\\s*$/.test(msg)) {\n msg += \'\\n\';\n }\n msg += \'\\n Erroneous area:\\n\' + this.prettyPrintRange(this.yylloc); \n } else if (typeof this.showPosition === \'function\') {\n var pos_str = this.showPosition();\n if (pos_str) {\n if (msg.length && msg[msg.length - 1] !== \'\\n\' && pos_str[0] !== \'\\n\') {\n msg += \'\\n\' + pos_str;\n } else {\n msg += pos_str;\n }\n }\n }\n }\n /** @constructor */\n var pei = {\n errStr: msg,\n recoverable: !!recoverable,\n text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the \'lexer cursor position\'...\n token: null,\n line: this.yylineno,\n loc: this.yylloc,\n yy: this.yy,\n lexer: this,\n\n /**\n * and make sure the error info doesn\'t stay due to potential\n * ref cycle via userland code manipulations.\n * These would otherwise all be memory leak opportunities!\n * \n * Note that only array and object references are nuked as those\n * constitute the set of elements which can produce a cyclic ref.\n * The rest of the members is kept intact as they are harmless.\n * \n * @public\n * @this {LexErrorInfo}\n */\n destroy: function destructLexErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n },\n\n /**\n * handler which is invoked when a lexer error occurs.\n * \n * @public\n * @this {RegExpLexer}\n */\n parseError: function lexer_parseError(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonLexerError;\n }\n if (this.yy) {\n if (this.yy.parser && typeof this.yy.parser.parseError === \'function\') {\n return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } else if (typeof this.yy.parseError === \'function\') {\n return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR;\n } \n }\n throw new ExceptionClass(str, hash);\n },\n\n /**\n * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions.\n * \n * @public\n * @this {RegExpLexer}\n */\n yyerror: function yyError(str /*, ...args */) {\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': \' + str, this.options.lexerErrorsAreRecoverable);\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n p.extra_error_attributes = args;\n }\n\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n },\n\n /**\n * final cleanup function for when we have completed lexing the input;\n * make it an API so that external code can use this one once userland\n * code has decided it\'s time to destroy any lingering lexer error\n * hash object instances and the like: this function helps to clean\n * up these constructs, which *may* carry cyclic references which would\n * otherwise prevent the instances from being properly and timely\n * garbage-collected, i.e. this function helps prevent memory leaks!\n * \n * @public\n * @this {RegExpLexer}\n */\n cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) {\n // prevent lingering circular references from causing memory leaks:\n this.setInput(\'\', {});\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n }\n\n return this;\n },\n\n /**\n * clear the lexer token context; intended for internal use only\n * \n * @public\n * @this {RegExpLexer}\n */\n clear: function lexer_clear() {\n this.yytext = \'\';\n this.yyleng = 0;\n this.match = \'\';\n // - DO NOT reset `this.matched`\n this.matches = false;\n this._more = false;\n this._backtrack = false;\n\n var col = (this.yylloc ? this.yylloc.last_column : 0);\n this.yylloc = {\n first_line: this.yylineno + 1,\n first_column: col,\n last_line: this.yylineno + 1,\n last_column: col,\n\n range: [this.offset, this.offset]\n };\n },\n\n /**\n * resets the lexer, sets new input\n * \n * @public\n * @this {RegExpLexer}\n */\n setInput: function lexer_setInput(input, yy) {\n this.yy = yy || this.yy || {};\n\n // also check if we\'ve fully initialized the lexer instance,\n // including expansion work to be done to go from a loaded\n // lexer to a usable lexer:\n if (!this.__decompressed) {\n // step 1: decompress the regex list:\n var rules = this.rules;\n for (var i = 0, len = rules.length; i < len; i++) {\n var rule_re = rules[i];\n\n // compression: is the RE an xref to another RE slot in the rules[] table?\n if (typeof rule_re === \'number\') {\n rules[i] = rules[rule_re];\n }\n }\n\n // step 2: unfold the conditions[] set to make these ready for use:\n var conditions = this.conditions;\n for (var k in conditions) {\n var spec = conditions[k];\n\n var rule_ids = spec.rules;\n\n var len = rule_ids.length;\n var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple!\n var rule_new_ids = new Array(len + 1);\n\n for (var i = 0; i < len; i++) {\n var idx = rule_ids[i];\n var rule_re = rules[idx];\n rule_regexes[i + 1] = rule_re;\n rule_new_ids[i + 1] = idx;\n }\n\n spec.rules = rule_new_ids;\n spec.__rule_regexes = rule_regexes;\n spec.__rule_count = len;\n }\n\n this.__decompressed = true;\n }\n\n this._input = input || \'\';\n this.clear();\n this._signaled_error_token = false;\n this.done = false;\n this.yylineno = 0;\n this.matched = \'\';\n this.conditionStack = [\'INITIAL\'];\n this.__currentRuleSet__ = null;\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n this.offset = 0;\n return this;\n },\n\n /**\n * edit the remaining input via user-specified callback.\n * This can be used to forward-adjust the input-to-parse, \n * e.g. inserting macro expansions and alike in the\n * input which has yet to be lexed.\n * The behaviour of this API contrasts the `unput()` et al\n * APIs as those act on the *consumed* input, while this\n * one allows one to manipulate the future, without impacting\n * the current `yyloc` cursor location or any history. \n * \n * Use this API to help implement C-preprocessor-like\n * `#include` statements, etc.\n * \n * The provided callback must be synchronous and is\n * expected to return the edited input (string).\n *\n * The `cpsArg` argument value is passed to the callback\n * as-is.\n *\n * `callback` interface: \n * `function callback(input, cpsArg)`\n * \n * - `input` will carry the remaining-input-to-lex string\n * from the lexer.\n * - `cpsArg` is `cpsArg` passed into this API.\n * \n * The `this` reference for the callback will be set to\n * reference this lexer instance so that userland code\n * in the callback can easily and quickly access any lexer\n * API. \n *\n * When the callback returns a non-string-type falsey value,\n * we assume the callback did not edit the input and we\n * will using the input as-is.\n *\n * When the callback returns a non-string-type value, it\n * is converted to a string for lexing via the `"" + retval`\n * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html \n * -- that way any returned object\'s `toValue()` and `toString()`\n * methods will be invoked in a proper/desirable order.)\n * \n * @public\n * @this {RegExpLexer}\n */\n editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) {\n var rv = callback.call(this, this._input, cpsArg);\n if (typeof rv !== \'string\') {\n if (rv) {\n this._input = \'\' + rv; \n }\n // else: keep `this._input` as is. \n } else {\n this._input = rv; \n }\n return this;\n },\n\n /**\n * consumes and returns one char from the input\n * \n * @public\n * @this {RegExpLexer}\n */\n input: function lexer_input() {\n if (!this._input) {\n //this.done = true; -- don\'t set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*)\n return null;\n }\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n // Count the linenumber up when we hit the LF (or a stand-alone CR).\n // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo\n // and we advance immediately past the LF as well, returning both together as if\n // it was all a single \'character\' only.\n var slice_len = 1;\n var lines = false;\n if (ch === \'\\n\') {\n lines = true;\n } else if (ch === \'\\r\') {\n lines = true;\n var ch2 = this._input[1];\n if (ch2 === \'\\n\') {\n slice_len++;\n ch += ch2;\n this.yytext += ch2;\n this.yyleng++;\n this.offset++;\n this.match += ch2;\n this.matched += ch2;\n this.yylloc.range[1]++;\n }\n }\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n this.yylloc.last_column = 0;\n } else {\n this.yylloc.last_column++;\n }\n this.yylloc.range[1]++;\n\n this._input = this._input.slice(slice_len);\n return ch;\n },\n\n /**\n * unshifts one char (or an entire string) into the input\n * \n * @public\n * @this {RegExpLexer}\n */\n unput: function lexer_unput(ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n this.yyleng = this.yytext.length;\n this.offset -= len;\n this.match = this.match.substr(0, this.match.length - len);\n this.matched = this.matched.substr(0, this.matched.length - len);\n\n if (lines.length > 1) {\n this.yylineno -= lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n\n // Get last entirely matched line into the `pre_lines[]` array\'s\n // last index slot; we don\'t mind when other previously \n // matched lines end up in the array too. \n var pre = this.match;\n var pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n if (pre_lines.length === 1) {\n pre = this.matched;\n pre_lines = pre.split(/(?:\\r\\n?|\\n)/g);\n }\n this.yylloc.last_column = pre_lines[pre_lines.length - 1].length;\n } else {\n this.yylloc.last_column -= len;\n }\n\n this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng;\n\n this.done = false;\n return this;\n },\n\n /**\n * cache matched text and append it on next action\n * \n * @public\n * @this {RegExpLexer}\n */\n more: function lexer_more() {\n this._more = true;\n return this;\n },\n\n /**\n * signal the lexer that this rule fails to match the input, so the\n * next matching rule (regex) should be tested instead.\n * \n * @public\n * @this {RegExpLexer}\n */\n reject: function lexer_reject() {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n // when the `parseError()` call returns, we MUST ensure that the error is registered.\n // We accomplish this by signaling an \'error\' token to be produced for the current\n // `.lex()` run.\n var lineno_msg = \'\';\n if (this.yylloc) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\', false);\n this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n return this;\n },\n\n /**\n * retain first n characters of the match\n * \n * @public\n * @this {RegExpLexer}\n */\n less: function lexer_less(n) {\n return this.unput(this.match.slice(n));\n },\n\n /**\n * return (part of the) already matched input, i.e. for error\n * messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of\n * input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n * \n * @public\n * @this {RegExpLexer}\n */\n pastInput: function lexer_pastInput(maxSize, maxLines) {\n var past = this.matched.substring(0, this.matched.length - this.match.length);\n if (maxSize < 0)\n maxSize = past.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = past.length; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substr` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n past = past.substr(-maxSize * 2 - 2);\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = past.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(-maxLines);\n past = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis prefix...\n if (past.length > maxSize) {\n past = \'...\' + past.substr(-maxSize);\n }\n return past;\n },\n\n /**\n * return (part of the) upcoming input, i.e. for error messages.\n * \n * Limit the returned string length to `maxSize` (default: 20).\n * \n * Limit the returned string to the `maxLines` number of lines of input (default: 1).\n * \n * Negative limit values equal *unlimited*.\n *\n * > ### NOTE ###\n * >\n * > *"upcoming input"* is defined as the whole of the both\n * > the *currently lexed* input, together with any remaining input\n * > following that. *"currently lexed"* input is the input \n * > already recognized by the lexer but not yet returned with\n * > the lexer token. This happens when you are invoking this API\n * > from inside any lexer rule action code block. \n * >\n * \n * @public\n * @this {RegExpLexer}\n */\n upcomingInput: function lexer_upcomingInput(maxSize, maxLines) {\n var next = this.match;\n if (maxSize < 0)\n maxSize = next.length + this._input.length;\n else if (!maxSize)\n maxSize = 20;\n if (maxLines < 0)\n maxLines = maxSize; // can\'t ever have more input lines than this!\n else if (!maxLines)\n maxLines = 1;\n // `substring` anticipation: treat \\r\\n as a single character and take a little\n // more than necessary so that we can still properly check against maxSize\n // after we\'ve transformed and limited the newLines in here:\n if (next.length < maxSize * 2 + 2) {\n next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8\n }\n // now that we have a significantly reduced string to process, transform the newlines\n // and chop them, then limit them:\n var a = next.replace(/\\r\\n|\\r/g, \'\\n\').split(\'\\n\');\n a = a.slice(0, maxLines);\n next = a.join(\'\\n\');\n // When, after limiting to maxLines, we still have too much to return,\n // do add an ellipsis postfix...\n if (next.length > maxSize) {\n next = next.substring(0, maxSize) + \'...\';\n }\n return next;\n },\n\n /**\n * return a string which displays the character position where the\n * lexing error occurred, i.e. for error messages\n * \n * @public\n * @this {RegExpLexer}\n */\n showPosition: function lexer_showPosition(maxPrefix, maxPostfix) {\n var pre = this.pastInput(maxPrefix).replace(/\\s/g, \' \');\n var c = new Array(pre.length + 1).join(\'-\');\n return pre + this.upcomingInput(maxPostfix).replace(/\\s/g, \' \') + \'\\n\' + c + \'^\';\n },\n\n /**\n * return an YYLLOC info object derived off the given context (actual, preceding, following, current).\n * Use this method when the given `actual` location is not guaranteed to exist (i.e. when\n * it MAY be NULL) and you MUST have a valid location info object anyway:\n * then we take the given context of the `preceding` and `following` locations, IFF those are available,\n * and reconstruct the `actual` location info from those.\n * If this fails, the heuristic is to take the `current` location, IFF available.\n * If this fails as well, we assume the sought location is at/around the current lexer position\n * and then produce that one as a response. DO NOTE that these heuristic/derived location info\n * values MAY be inaccurate!\n *\n * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just\n * a *reference* hence all input location objects can be assumed to be \'constant\' (function has no side-effects).\n * \n * @public\n * @this {RegExpLexer}\n */\n deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) {\n var loc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0,\n\n range: [0, 0]\n };\n if (actual) {\n loc.first_line = actual.first_line | 0;\n loc.last_line = actual.last_line | 0;\n loc.first_column = actual.first_column | 0;\n loc.last_column = actual.last_column | 0;\n\n if (actual.range) {\n loc.range[0] = actual.range[0] | 0; \n loc.range[1] = actual.range[1] | 0;\n } \n }\n if (loc.first_line <= 0 || loc.last_line < loc.first_line) {\n // plan B: heuristic using preceding and following:\n if (loc.first_line <= 0 && preceding) {\n loc.first_line = preceding.last_line | 0;\n loc.first_column = preceding.last_column | 0;\n\n if (preceding.range) {\n loc.range[0] = actual.range[1] | 0; \n } \n }\n\n if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) {\n loc.last_line = following.first_line | 0;\n loc.last_column = following.first_column | 0;\n\n if (following.range) {\n loc.range[1] = actual.range[0] | 0; \n } \n }\n\n // plan C?: see if the \'current\' location is useful/sane too:\n if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) {\n loc.first_line = current.first_line | 0;\n loc.first_column = current.first_column | 0;\n\n if (current.range) {\n loc.range[0] = current.range[0] | 0; \n } \n }\n\n if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) {\n loc.last_line = current.last_line | 0;\n loc.last_column = current.last_column | 0;\n\n if (current.range) {\n loc.range[1] = current.range[1] | 0; \n } \n }\n }\n // sanitize: fix last_line BEFORE we fix first_line as we use the \'raw\' value of the latter\n // or plan D heuristics to produce a \'sensible\' last_line value:\n if (loc.last_line <= 0) {\n if (loc.first_line <= 0) {\n loc.first_line = this.yylloc.first_line;\n loc.last_line = this.yylloc.last_line;\n loc.first_column = this.yylloc.first_column;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[0] = this.yylloc.range[0];\n loc.range[1] = this.yylloc.range[1];\n } else {\n loc.last_line = this.yylloc.last_line;\n loc.last_column = this.yylloc.last_column;\n\n loc.range[1] = this.yylloc.range[1];\n }\n }\n if (loc.first_line <= 0) {\n loc.first_line = loc.last_line;\n loc.first_column = 0; // loc.last_column;\n\n loc.range[1] = loc.range[0];\n }\n if (loc.first_column < 0) {\n loc.first_column = 0;\n }\n if (loc.last_column < 0) {\n loc.last_column = (loc.first_column > 0 ? loc.first_column : 80);\n }\n return loc;\n },\n\n /**\n * return a string which displays the lines & columns of input which are referenced \n * by the given location info range, plus a few lines of context.\n * \n * This function pretty-prints the indicated section of the input, with line numbers \n * and everything!\n * \n * This function is very useful to provide highly readable error reports, while\n * the location range may be specified in various flexible ways:\n * \n * - `loc` is the location info object which references the area which should be\n * displayed and \'marked up\': these lines & columns of text are marked up by `^`\n * characters below each character in the entire input range.\n * \n * - `context_loc` is the *optional* location info object which instructs this\n * pretty-printer how much *leading* context should be displayed alongside\n * the area referenced by `loc`. This can help provide context for the displayed\n * error, etc.\n * \n * When this location info is not provided, a default context of 3 lines is\n * used.\n * \n * - `context_loc2` is another *optional* location info object, which serves\n * a similar purpose to `context_loc`: it specifies the amount of *trailing*\n * context lines to display in the pretty-print output.\n * \n * When this location info is not provided, a default context of 1 line only is\n * used.\n * \n * Special Notes:\n * \n * - when the `loc`-indicated range is very large (about 5 lines or more), then\n * only the first and last few lines of this block are printed while a\n * `...continued...` message will be printed between them.\n * \n * This serves the purpose of not printing a huge amount of text when the `loc`\n * range happens to be huge: this way a manageable & readable output results\n * for arbitrary large ranges.\n * \n * - this function can display lines of input which whave not yet been lexed.\n * `prettyPrintRange()` can access the entire input!\n * \n * @public\n * @this {RegExpLexer}\n */\n prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) {\n loc = this.deriveLocationInfo(loc, context_loc, context_loc2); \n const CONTEXT = 3;\n const CONTEXT_TAIL = 1;\n const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2;\n var input = this.matched + this._input;\n var lines = input.split(\'\\n\');\n var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT));\n var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL));\n var lineno_display_width = (1 + Math.log10(l1 | 1) | 0);\n var ws_prefix = new Array(lineno_display_width).join(\' \');\n var nonempty_line_indexes = [];\n var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) {\n var lno = index + l0;\n var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width);\n var rv = lno_pfx + \': \' + line;\n var errpfx = (new Array(lineno_display_width + 1)).join(\'^\');\n var offset = 2 + 1;\n var len = 0;\n\n if (lno === loc.first_line) {\n offset += loc.first_column;\n\n len = Math.max(\n 2,\n ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1\n );\n } else if (lno === loc.last_line) {\n len = Math.max(2, loc.last_column + 1);\n } else if (lno > loc.first_line && lno < loc.last_line) {\n len = Math.max(2, line.length + 1);\n }\n\n if (len) {\n var lead = new Array(offset).join(\'.\');\n var mark = new Array(len).join(\'^\');\n rv += \'\\n\' + errpfx + lead + mark;\n\n if (line.trim().length > 0) {\n nonempty_line_indexes.push(index);\n }\n }\n\n rv = rv.replace(/\\t/g, \' \');\n return rv;\n });\n\n // now make sure we don\'t print an overly large amount of error area: limit it \n // to the top and bottom line count:\n if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) {\n var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1;\n var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1;\n\n var intermediate_line = (new Array(lineno_display_width + 1)).join(\' \') + \' (...continued...)\';\n intermediate_line += \'\\n\' + (new Array(lineno_display_width + 1)).join(\'-\') + \' (---------------)\';\n rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line);\n }\n return rv.join(\'\\n\');\n },\n\n /**\n * helper function, used to produce a human readable description as a string, given\n * the input `yylloc` location object.\n * \n * Set `display_range_too` to TRUE to include the string character index position(s)\n * in the description if the `yylloc.range` is available.\n * \n * @public\n * @this {RegExpLexer}\n */\n describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) {\n var l1 = yylloc.first_line;\n var l2 = yylloc.last_line;\n var c1 = yylloc.first_column;\n var c2 = yylloc.last_column;\n var dl = l2 - l1;\n var dc = c2 - c1;\n var rv;\n if (dl === 0) {\n rv = \'line \' + l1 + \', \';\n if (dc <= 1) {\n rv += \'column \' + c1;\n } else {\n rv += \'columns \' + c1 + \' .. \' + c2;\n }\n } else {\n rv = \'lines \' + l1 + \'(column \' + c1 + \') .. \' + l2 + \'(column \' + c2 + \')\';\n }\n if (yylloc.range && display_range_too) {\n var r1 = yylloc.range[0];\n var r2 = yylloc.range[1] - 1;\n if (r2 <= r1) {\n rv += \' {String Offset: \' + r1 + \'}\';\n } else {\n rv += \' {String Offset range: \' + r1 + \' .. \' + r2 + \'}\';\n }\n }\n return rv;\n },\n\n /**\n * test the lexed token: return FALSE when not a match, otherwise return token.\n * \n * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]`\n * contains the actually matched text string.\n * \n * Also move the input cursor forward and update the match collectors:\n * \n * - `yytext`\n * - `yyleng`\n * - `match`\n * - `matches`\n * - `yylloc`\n * - `offset`\n * \n * @public\n * @this {RegExpLexer}\n */\n test_match: function lexer_test_match(match, indexed_rule) {\n var token,\n lines,\n backup,\n match_str,\n match_str_len;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.yylloc.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column,\n\n range: this.yylloc.range.slice(0)\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n //_signaled_error_token: this._signaled_error_token,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n }\n\n match_str = match[0];\n match_str_len = match_str.length;\n // if (match_str.indexOf(\'\\n\') !== -1 || match_str.indexOf(\'\\r\') !== -1) {\n lines = match_str.split(/(?:\\r\\n?|\\n)/g);\n if (lines.length > 1) {\n this.yylineno += lines.length - 1;\n\n this.yylloc.last_line = this.yylineno + 1;\n this.yylloc.last_column = lines[lines.length - 1].length;\n } else {\n this.yylloc.last_column += match_str_len;\n }\n // }\n this.yytext += match_str;\n this.match += match_str;\n this.matched += match_str;\n this.matches = match;\n this.yyleng = this.yytext.length;\n this.yylloc.range[1] += match_str_len;\n\n // previous lex rules MAY have invoked the `more()` API rather than producing a token:\n // those rules will already have moved this `offset` forward matching their match lengths,\n // hence we must only add our own match length now:\n this.offset += match_str_len;\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match_str_len);\n\n // calling this method:\n //\n // function lexer__performAction(yy, yyrulenumber, YY_START) {...}\n token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */);\n // otherwise, when the action codes are all simple return token statements:\n //token = this.simpleCaseActionClusters[indexed_rule];\n\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n this.__currentRuleSet__ = null;\n return false; // rule action called reject() implying the next rule should be tested instead.\n } else if (this._signaled_error_token) {\n // produce one \'error\' token as `.parseError()` in `reject()`\n // did not guarantee a failure signal by throwing an exception!\n token = this._signaled_error_token;\n this._signaled_error_token = false;\n return token;\n }\n return false;\n },\n\n /**\n * return next match in input\n * \n * @public\n * @this {RegExpLexer}\n */\n next: function lexer_next() {\n if (this.done) {\n this.clear();\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.clear();\n }\n var spec = this.__currentRuleSet__;\n if (!spec) {\n // Update the ruleset cache as we apparently encountered a state change or just started lexing.\n // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will\n // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps\n // speed up those activities a tiny bit.\n spec = this.__currentRuleSet__ = this._currentRules();\n // Check whether a *sane* condition has been pushed before: this makes the lexer robust against\n // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19\n if (!spec || !spec.rules) {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Internal lexer engine error\' + lineno_msg + \': The lex grammar programmer pushed a non-existing condition name "\' + this.topState() + \'"; this is a fatal error and should be reported to the application programmer team!\', false);\n // produce one \'error\' token until this situation has been resolved, most probably by parse termination!\n return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n }\n }\n\n var rule_ids = spec.rules;\n var regexes = spec.__rule_regexes;\n var len = spec.__rule_count;\n\n // Note: the arrays are 1-based, while `len` itself is a valid index,\n // hence the non-standard less-or-equal check in the next loop condition!\n for (var i = 1; i <= len; i++) {\n tempMatch = this._input.match(regexes[i]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rule_ids[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = undefined;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rule_ids[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (!this._input) {\n this.done = true;\n this.clear();\n return this.EOF;\n } else {\n var lineno_msg = \'\';\n if (this.options.trackPosition) {\n lineno_msg = \' on line \' + (this.yylineno + 1);\n }\n var p = this.constructLexErrorInfo(\'Lexical error\' + lineno_msg + \': Unrecognized text.\', this.options.lexerErrorsAreRecoverable);\n\n var pendingInput = this._input;\n var activeCondition = this.topState();\n var conditionStackDepth = this.conditionStack.length;\n\n token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR);\n if (token === this.ERROR) {\n // we can try to recover from a lexer error that `parseError()` did not \'recover\' for us\n // by moving forward at least one character at a time IFF the (user-specified?) `parseError()`\n // has not consumed/modified any pending input or changed state in the error handler:\n if (!this.matches && \n // and make sure the input has been modified/consumed ...\n pendingInput === this._input &&\n // ...or the lexer state has been modified significantly enough\n // to merit a non-consuming error handling action right now.\n activeCondition === this.topState() && \n conditionStackDepth === this.conditionStack.length\n ) {\n this.input();\n }\n }\n return token;\n }\n },\n\n /**\n * return next match that has a token\n * \n * @public\n * @this {RegExpLexer}\n */\n lex: function lexer_lex() {\n var r;\n // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer:\n if (typeof this.pre_lex === \'function\') {\n r = this.pre_lex.call(this, 0);\n }\n if (typeof this.options.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.pre_lex.call(this, r) || r;\n }\n if (this.yy && typeof this.yy.pre_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.pre_lex.call(this, r) || r;\n }\n\n while (!r) {\n r = this.next();\n }\n\n if (this.yy && typeof this.yy.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.yy.post_lex.call(this, r) || r;\n }\n if (typeof this.options.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.options.post_lex.call(this, r) || r;\n }\n if (typeof this.post_lex === \'function\') {\n // (also account for a userdef function which does not return any value: keep the token as is)\n r = this.post_lex.call(this, r) || r;\n }\n return r;\n },\n\n /**\n * return next match that has a token. Identical to the `lex()` API but does not invoke any of the \n * `pre_lex()` nor any of the `post_lex()` callbacks.\n * \n * @public\n * @this {RegExpLexer}\n */\n fastLex: function lexer_fastLex() {\n var r;\n\n while (!r) {\n r = this.next();\n }\n\n return r;\n },\n\n /**\n * return info about the lexer state that can help a parser or other lexer API user to use the\n * most efficient means available. This API is provided to aid run-time performance for larger\n * systems which employ this lexer.\n * \n * @public\n * @this {RegExpLexer}\n */\n canIUse: function lexer_canIUse() {\n var rv = {\n fastLex: !(\n typeof this.pre_lex === \'function\' ||\n typeof this.options.pre_lex === \'function\' ||\n (this.yy && typeof this.yy.pre_lex === \'function\') ||\n (this.yy && typeof this.yy.post_lex === \'function\') ||\n typeof this.options.post_lex === \'function\' ||\n typeof this.post_lex === \'function\'\n ) && typeof this.fastLex === \'function\',\n };\n return rv;\n },\n\n\n /**\n * backwards compatible alias for `pushState()`;\n * the latter is symmetrical with `popState()` and we advise to use\n * those APIs in any modern lexer code, rather than `begin()`.\n * \n * @public\n * @this {RegExpLexer}\n */\n begin: function lexer_begin(condition) {\n return this.pushState(condition);\n },\n\n /**\n * activates a new lexer condition state (pushes the new lexer\n * condition state onto the condition stack)\n * \n * @public\n * @this {RegExpLexer}\n */\n pushState: function lexer_pushState(condition) {\n this.conditionStack.push(condition);\n this.__currentRuleSet__ = null;\n return this;\n },\n\n /**\n * pop the previously active lexer condition state off the condition\n * stack\n * \n * @public\n * @this {RegExpLexer}\n */\n popState: function lexer_popState() {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n this.__currentRuleSet__ = null; \n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n /**\n * return the currently active lexer condition state; when an index\n * argument is provided it produces the N-th previous condition state,\n * if available\n * \n * @public\n * @this {RegExpLexer}\n */\n topState: function lexer_topState(n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \'INITIAL\';\n }\n },\n\n /**\n * (internal) determine the lexer rule set which is active for the\n * currently active lexer condition state\n * \n * @public\n * @this {RegExpLexer}\n */\n _currentRules: function lexer__currentRules() {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]];\n } else {\n return this.conditions[\'INITIAL\'];\n }\n },\n\n /**\n * return the number of states currently on the stack\n * \n * @public\n * @this {RegExpLexer}\n */\n stateStackSize: function lexer_stateStackSize() {\n return this.conditionStack.length;\n }\n}'; // --- END lexer kernel --- } @@ -9264,7 +9287,7 @@ RegExpLexer.mkStdOptions = mkStdOptions$1; RegExpLexer.camelCase = camelCase$1; RegExpLexer.autodetectAndConvertToJSONformat = autodetectAndConvertToJSONformat$1; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -10319,7 +10342,7 @@ var parser$3 = { return pei; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -10329,6 +10352,18 @@ var parser$3 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -10346,6 +10381,17 @@ var parser$3 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; @@ -10535,7 +10581,7 @@ var parser$3 = { }; parser$3.originalParseError = parser$3.parseError; parser$3.originalQuoteName = parser$3.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -12038,10 +12084,10 @@ var lexer$2 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -12629,7 +12675,7 @@ function transform(ebnf) { // hack: var assert$2; -/* parser generated by jison 0.6.1-209 */ +/* parser generated by jison 0.6.1-210 */ /* * Returns a Parser object of the following structure: @@ -15267,7 +15313,7 @@ var parser$2 = { return rv; }; - function lex() { + function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { @@ -15277,6 +15323,18 @@ var parser$2 = { return token || EOF; } + function fastLex() { + var token = lexer.fastLex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token || EOF; + } + + var lex = stdLex; + var state, action, r, t; var yyval = { $: true, @@ -15347,6 +15405,17 @@ var parser$2 = { lexer.setInput(input, sharedState_yy); + // NOTE: we *assume* no lexer pre/post handlers are set up *after* + // this initial `setInput()` call: hence we can now check and decide + // whether we'll go with the standard, slower, lex() API or the + // `fast_lex()` one: + if (typeof lexer.canIUse === 'function') { + var lexerInfo = lexer.canIUse(); + if (lexerInfo.fastLex && typeof fastLex === 'function') { + lex = fastLex; + } + } + yyloc = lexer.yylloc; lstack[sp] = yyloc; vstack[sp] = null; @@ -15938,7 +16007,7 @@ var parser$2 = { }; parser$2.originalParseError = parser$2.parseError; parser$2.originalQuoteName = parser$2.quoteName; -/* lexer generated by jison-lex 0.6.1-209 */ +/* lexer generated by jison-lex 0.6.1-210 */ /* * Returns a Lexer object of the following structure: @@ -17441,10 +17510,10 @@ var lexer$1 = function () { */ canIUse: function lexer_canIUse() { var rv = { - fast_lex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') + fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; - return r; + return rv; }, /** @@ -24560,7 +24629,7 @@ for (var api in api_set) { } // --- START parser kernel --- -parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function lex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; +parser.parse = 'function parse(input, parseParams) {\n var self = this;\n var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage)\n var sstack = new Array(128); // state stack: stores states (column storage)\n var tstack = []; // token stack (only used when `%options token_stack` support has been enabled)\n var vstack = new Array(128); // semantic value stack\n var lstack = new Array(128); // location stack\n var table = this.table;\n var sp = 0; // \'stack pointer\': index into the stacks\n var yyloc;\n var yytext;\n var yylineno;\n var yyleng;\n\n var symbol = 0;\n var preErrorSymbol = 0;\n var lastEofErrorStateDepth = Infinity;\n var recoveringErrorInfo = null;\n var recovering = 0; // (only used when the grammar contains error recovery rules)\n var TERROR = this.TERROR;\n var EOF = this.EOF;\n var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3;\n var NO_ACTION = [0, YY_ERROR_RECOVERY_COMBINE_ID /* === table.length :: ensures that anyone using this new state will fail dramatically! */];\n\n var lexer;\n if (this.__lexer__) {\n lexer = this.__lexer__;\n } else {\n lexer = this.__lexer__ = Object.create(this.lexer);\n }\n\n var sharedState_yy = {\n parseError: undefined,\n quoteName: undefined,\n lexer: undefined,\n parser: undefined,\n pre_parse: undefined,\n post_parse: undefined,\n pre_lex: undefined,\n post_lex: undefined,\n parseParamsAsMembers: parseParamsAsMembers // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes!\n };\n\n var ASSERT;\n if (typeof assert !== \'function\') {\n ASSERT = function JisonAssert(cond, msg) {\n if (!cond) {\n throw new Error(\'assertion failed: \' + (msg || \'***\'));\n }\n };\n } else {\n ASSERT = assert;\n }\n\n this.yyGetSharedState = function yyGetSharedState() {\n return sharedState_yy;\n };\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() {\n return recoveringErrorInfo;\n };\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // shallow clone objects, straight copy of simple `src` values\n // e.g. `lexer.yytext` MAY be a complex value object,\n // rather than a simple string/value.\n function shallow_copy(src) {\n if (typeof src === \'object\') {\n var dst = {};\n for (var k in src) {\n if (Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n return dst;\n }\n return src;\n }\n function shallow_copy_noclobber(dst, src) {\n for (var k in src) {\n if (typeof dst[k] === \'undefined\' && Object.prototype.hasOwnProperty.call(src, k)) {\n dst[k] = src[k];\n }\n }\n }\n function copy_yylloc(loc) {\n var rv = shallow_copy(loc);\n if (rv && rv.range) {\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n\n // copy state\n shallow_copy_noclobber(sharedState_yy, this.yy);\n\n sharedState_yy.lexer = lexer;\n sharedState_yy.parser = this;\n\n var yydebug = false;\n if (this.options.debug) {\n yydebug = function yydebug_impl(msg, obj) {\n var ref_list;\n var ref_names;\n\n function deepClone(from, sub) {\n if (sub == null) {\n ref_list = [];\n ref_names = [];\n sub = \'root\';\n }\n if (typeof from === \'function\') return \'[Function]\';\n if (from == null || typeof from !== \'object\') return from;\n if (from.constructor !== Object && from.constructor !== Array) {\n return from;\n }\n\n for (var i = 0, len = ref_list.length; i < len; i++) {\n if (ref_list[i] === from) {\n return \'[Circular/Xref:\' + ref_names[i] + \']\'; // circular or cross reference\n }\n }\n ref_list.push(from);\n ref_names.push(sub);\n\n var to = new from.constructor();\n for (var name in from) {\n if (name === \'parser\') continue;\n if (name === \'lexer\') continue;\n to[name] = deepClone(from[name], name);\n }\n return to;\n }\n\n obj = obj || {};\n if (obj.symbol) {\n obj.local_yytext = yytext;\n obj.lexer_yytext = lexer.yytext;\n obj.lexer_yylloc = lexer.yylloc;\n obj.lexer_yyllineno = lexer.yyllineno;\n }\n\n // warning: here we fetch from closure (stack et al)\n obj.symbol_stack = stack;\n obj.state_stack = sstack;\n obj.value_stack = vstack;\n obj.location_stack = lstack;\n obj.stack_pointer = sp;\n\n // ready the object for printing:\n obj = deepClone(obj);\n\n // wrap try/catch in a function to help the V8 JIT compiler...\n function yydebug_cvt(obj) {\n var js;\n try {\n var re1;\n if (typeof XRegExp === \'undefined\') {\n re1 = / \\"([a-z_][a-z_0-9. ]*)\\": /ig;\n } else {\n re1 = new XRegExp(\' \\"([\\\\p{Alphabetic}_][\\\\p{Alphabetic}\\\\p{Number}_. ]*)\\": \', \'g\');\n }\n js = JSON.stringify(obj, null, 2).replace(re1, \' $1: \').replace(/[\\n\\s]+/g, \' \');\n } catch (ex) {\n js = String(obj);\n }\n return js;\n }\n\n self.trace(msg, yydebug_cvt(obj), \'\\n\');\n };\n }\n\n // disable debugging at run-time ANYWAY when you\'ve *explicitly* set "yy.yydebug = false":\n if (sharedState_yy.yydebug === false) {\n yydebug = undefined;\n }\n\n // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount\n // to have *their* closure match ours -- if we only set them up once,\n // any subsequent `parse()` runs will fail in very obscure ways when\n // these functions are invoked in the user action code block(s) as\n // their closure will still refer to the `parse()` instance which set\n // them up. Hence we MUST set them up at the start of every `parse()` run!\n if (this.yyError) {\n this.yyError = function yyError(str /*, ...args */) {\n if (yydebug) yydebug(\'yyerror: \', { message: str, args: arguments, symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1);\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0));\n // append to the old one?\n if (recoveringErrorInfo) {\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n var v = this.shallowCopyErrorInfo(hash);\n v.yyError = true;\n v.errorRuleDepth = error_rule_depth;\n v.recovering = recovering;\n // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH;\n\n recoveringErrorInfo.value_stack[esp] = v;\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n } else {\n recoveringErrorInfo = this.shallowCopyErrorInfo(hash);\n recoveringErrorInfo.yyError = true;\n recoveringErrorInfo.errorRuleDepth = error_rule_depth;\n recoveringErrorInfo.recovering = recovering;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n var expected = this.collect_expected_token_set(state);\n var hash = this.constructParseErrorInfo(str, null, expected, false);\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Add any extra args to the hash under the name `extra_error_attributes`:\n var args = Array.prototype.slice.call(arguments, 1);\n if (args.length) {\n hash.extra_error_attributes = args;\n }\n\n var r = this.parseError(str, hash, this.JisonParserError);\n return r;\n };\n }\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n if (this.yyRecovering) {\n this.yyRecovering = function yyRecovering() {\n if (yydebug) yydebug(\'yyrecovering: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n return recovering;\n };\n }\n\n if (this.yyErrOk) {\n this.yyErrOk = function yyErrOk() {\n if (yydebug) yydebug(\'yyerrok: \', { symbol: symbol, state: state, newState: newState, recovering: recovering, action: action });\n recovering = 0;\n\n // DO NOT reset/cleanup `recoveringErrorInfo` yet: userland code\n // MAY invoke this API before the error is actually fully\n // recovered, in which case the parser recovery code won\'t be able\n // to append the skipped tokens to this info object.\n // \n // The rest of the kernel code is safe enough that it won\'t inadvertedly\n // re-use an old `recoveringErrorInfo` chunk so we\'ld better wait\n // with destruction/cleanup until the end of the parse or until another\n // fresh parse error rears its ugly head...\n //\n // if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === \'function\') {\n // recoveringErrorInfo.destroy();\n // recoveringErrorInfo = undefined;\n // }\n };\n }\n\n if (this.yyClearIn) {\n this.yyClearIn = function yyClearIn() {\n if (yydebug) yydebug(\'yyclearin: \', { symbol: symbol, newState: newState, recovering: recovering, action: action, preErrorSymbol: preErrorSymbol });\n if (symbol === TERROR) {\n symbol = 0;\n yytext = null;\n yyleng = 0;\n yyloc = undefined;\n }\n preErrorSymbol = 0;\n };\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n // Does the shared state override the default `parseError` that already comes with this instance?\n if (typeof sharedState_yy.parseError === \'function\') {\n this.parseError = function parseErrorAlt(str, hash, ExceptionClass) {\n if (!ExceptionClass) {\n ExceptionClass = this.JisonParserError;\n }\n return sharedState_yy.parseError.call(this, str, hash, ExceptionClass);\n };\n } else {\n this.parseError = this.originalParseError;\n }\n\n // Does the shared state override the default `quoteName` that already comes with this instance?\n if (typeof sharedState_yy.quoteName === \'function\') {\n this.quoteName = function quoteNameAlt(id_str) {\n return sharedState_yy.quoteName.call(this, id_str);\n };\n } else {\n this.quoteName = this.originalQuoteName;\n }\n\n // set up the cleanup function; make it an API so that external code can re-use this one in case of\n // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which\n // case this parse() API method doesn\'t come with a `finally { ... }` block any more!\n //\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `sharedState`, etc. references will be *wrong*!\n this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) {\n var rv;\n\n if (invoke_post_methods) {\n var hash;\n\n if (sharedState_yy.post_parse || this.post_parse) {\n // create an error hash info instance: we re-use this API in a **non-error situation**\n // as this one delivers all parser internals ready for access by userland code.\n hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false);\n }\n\n if (sharedState_yy.post_parse) {\n rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n if (this.post_parse) {\n rv = this.post_parse.call(this, sharedState_yy, resultValue, hash);\n if (typeof rv !== \'undefined\') resultValue = rv;\n }\n\n // cleanup:\n if (hash && hash.destroy) {\n hash.destroy();\n }\n }\n\n if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run.\n\n // clean up the lingering lexer structures as well:\n if (lexer.cleanupAfterLex) {\n lexer.cleanupAfterLex(do_not_nuke_errorinfos);\n }\n\n // prevent lingering circular references from causing memory leaks:\n if (sharedState_yy) {\n sharedState_yy.lexer = undefined;\n sharedState_yy.parser = undefined;\n if (lexer.yy === sharedState_yy) {\n lexer.yy = undefined;\n }\n }\n sharedState_yy = undefined;\n this.parseError = this.originalParseError;\n this.quoteName = this.originalQuoteName;\n\n // nuke the vstack[] array at least as that one will still reference obsoleted user values.\n // To be safe, we nuke the other internal stack columns as well...\n stack.length = 0; // fastest way to nuke an array without overly bothering the GC\n sstack.length = 0;\n lstack.length = 0;\n vstack.length = 0;\n sp = 0;\n\n // nuke the error hash info instances created during this run.\n // Userland code must COPY any data/references\n // in the error hash instance(s) it is more permanently interested in.\n if (!do_not_nuke_errorinfos) {\n for (var i = this.__error_infos.length - 1; i >= 0; i--) {\n var el = this.__error_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_infos.length = 0;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) {\n var el = this.__error_recovery_infos[i];\n if (el && typeof el.destroy === \'function\') {\n el.destroy();\n }\n }\n this.__error_recovery_infos.length = 0;\n\n // `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,\n // hence has been destroyed already: no need to do that *twice*.\n if (recoveringErrorInfo) {\n recoveringErrorInfo = undefined;\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n return resultValue;\n };\n\n // merge yylloc info into a new yylloc instance.\n //\n // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array.\n //\n // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which\n // case these override the corresponding first/last indexes.\n //\n // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search\n // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!)\n // yylloc info.\n //\n // Note: epsilon rule\'s yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL.\n this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) {\n var i1 = first_index | 0,\n i2 = last_index | 0;\n var l1 = first_yylloc,\n l2 = last_yylloc;\n var rv;\n\n // rules:\n // - first/last yylloc entries override first/last indexes\n\n if (!l1) {\n if (first_index != null) {\n for (var i = i1; i <= i2; i++) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n }\n\n if (!l2) {\n if (last_index != null) {\n for (var i = i2; i >= i1; i--) {\n l2 = lstack[i];\n if (l2) {\n break;\n }\n }\n }\n }\n\n // - detect if an epsilon rule is being processed and act accordingly:\n if (!l1 && first_index == null) {\n // epsilon rule span merger. With optional look-ahead in l2.\n if (!dont_look_back) {\n for (var i = (i1 || sp) - 1; i >= 0; i--) {\n l1 = lstack[i];\n if (l1) {\n break;\n }\n }\n }\n if (!l1) {\n if (!l2) {\n // when we still don\'t have any valid yylloc info, we\'re looking at an epsilon rule\n // without look-ahead and no preceding terms and/or `dont_look_back` set:\n // in that case we ca do nothing but return NULL/UNDEFINED:\n return undefined;\n } else {\n // shallow-copy L2: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l2);\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n return rv;\n }\n } else {\n // shallow-copy L1, then adjust first col/row 1 column past the end.\n rv = shallow_copy(l1);\n rv.first_line = rv.last_line;\n rv.first_column = rv.last_column;\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n rv.range[0] = rv.range[1];\n }\n\n if (l2) {\n // shallow-mixin L2, then adjust last col/row accordingly.\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n return rv;\n }\n }\n\n if (!l1) {\n l1 = l2;\n l2 = null;\n }\n if (!l1) {\n return undefined;\n }\n\n // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking\n // at unconventional yylloc info objects...\n rv = shallow_copy(l1);\n\n // first_line: ...,\n // first_column: ...,\n // last_line: ...,\n // last_column: ...,\n if (rv.range) {\n // shallow copy the yylloc ranges info to prevent us from modifying the original arguments\' entries:\n rv.range = rv.range.slice(0);\n }\n\n if (l2) {\n shallow_copy_noclobber(rv, l2);\n rv.last_line = l2.last_line;\n rv.last_column = l2.last_column;\n if (rv.range && l2.range) {\n rv.range[1] = l2.range[1];\n }\n }\n\n return rv;\n };\n\n // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation,\n // or else your `lexer`, `sharedState`, etc. references will be *wrong*!\n this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) {\n var pei = {\n errStr: msg,\n exception: ex,\n text: lexer.match,\n value: lexer.yytext,\n token: this.describeSymbol(symbol) || symbol,\n token_id: symbol,\n line: lexer.yylineno,\n loc: copy_yylloc(lexer.yylloc),\n expected: expected,\n recoverable: recoverable,\n state: state,\n action: action,\n new_state: newState,\n symbol_stack: stack,\n state_stack: sstack,\n value_stack: vstack,\n location_stack: lstack,\n stack_pointer: sp,\n yy: sharedState_yy,\n lexer: lexer,\n parser: this,\n\n // and make sure the error info doesn\'t stay due to potential\n // ref cycle via userland code manipulations.\n // These would otherwise all be memory leak opportunities!\n //\n // Note that only array and object references are nuked as those\n // constitute the set of elements which can produce a cyclic ref.\n // The rest of the members is kept intact as they are harmless.\n destroy: function destructParseErrorInfo() {\n // remove cyclic references added to error info:\n // info.yy = null;\n // info.lexer = null;\n // info.value = null;\n // info.value_stack = null;\n // ...\n var rec = !!this.recoverable;\n for (var key in this) {\n if (this.hasOwnProperty(key) && typeof key === \'object\') {\n this[key] = undefined;\n }\n }\n this.recoverable = rec;\n }\n };\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_infos.push(pei);\n return pei;\n };\n\n // clone some parts of the (possibly enhanced!) errorInfo object\n // to give them some persistence.\n this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) {\n var rv = shallow_copy(p);\n\n // remove the large parts which can only cause cyclic references\n // and are otherwise available from the parser kernel anyway.\n delete rv.sharedState_yy;\n delete rv.parser;\n delete rv.lexer;\n\n // lexer.yytext MAY be a complex value object, rather than a simple string/value:\n rv.value = shallow_copy(rv.value);\n\n // yylloc info:\n rv.loc = copy_yylloc(rv.loc);\n\n // the \'expected\' set won\'t be modified, so no need to clone it:\n //rv.expected = rv.expected.slice(0);\n\n //symbol stack is a simple array:\n rv.symbol_stack = rv.symbol_stack.slice(0);\n // ditto for state stack:\n rv.state_stack = rv.state_stack.slice(0);\n // clone the yylloc\'s in the location stack?:\n rv.location_stack = rv.location_stack.map(copy_yylloc);\n // and the value stack may carry both simple and complex values:\n // shallow-copy the latter.\n rv.value_stack = rv.value_stack.map(shallow_copy);\n\n // and we don\'t bother with the sharedState_yy reference:\n //delete rv.yy;\n\n // now we prepare for tracking the COMBINE actions\n // in the error recovery code path:\n //\n // as we want to keep the maximum error info context, we\n // *scan* the state stack to find the first *empty* slot.\n // This position will surely be AT OR ABOVE the current\n // stack pointer, but we want to keep the \'used but discarded\'\n // part of the parse stacks *intact* as those slots carry\n // error context that may be useful when you want to produce\n // very detailed error diagnostic reports.\n //\n // ### Purpose of each stack pointer:\n //\n // - stack_pointer: points at the top of the parse stack\n // **as it existed at the time of the error\n // occurrence, i.e. at the time the stack\n // snapshot was taken and copied into the\n // errorInfo object.**\n // - base_pointer: the bottom of the **empty part** of the\n // stack, i.e. **the start of the rest of\n // the stack space /above/ the existing\n // parse stack. This section will be filled\n // by the error recovery process as it\n // travels the parse state machine to\n // arrive at the resolving error recovery rule.**\n // - info_stack_pointer:\n // this stack pointer points to the **top of\n // the error ecovery tracking stack space**, i.e.\n // this stack pointer takes up the role of\n // the `stack_pointer` for the error recovery\n // process. Any mutations in the **parse stack**\n // are **copy-appended** to this part of the\n // stack space, keeping the bottom part of the\n // stack (the \'snapshot\' part where the parse\n // state at the time of error occurrence was kept)\n // intact.\n // - root_failure_pointer:\n // copy of the `stack_pointer`...\n //\n for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== \'undefined\'; i++) {\n // empty\n }\n rv.base_pointer = i;\n rv.info_stack_pointer = i;\n\n rv.root_failure_pointer = rv.stack_pointer;\n\n // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection!\n this.__error_recovery_infos.push(rv);\n\n return rv;\n };\n\n function getNonTerminalFromCode(symbol) {\n var tokenName = self.getSymbolName(symbol);\n if (!tokenName) {\n tokenName = symbol;\n }\n return tokenName;\n }\n\n//_lexer_without_token_stack:\n\n function stdLex() {\n var token = lexer.lex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n function fastLex() {\n var token = lexer.fastLex();\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n\n return token || EOF;\n }\n\n var lex = stdLex;\n\n//_lexer_with_token_stack:\n\n // lex function that supports token stacks\n function tokenStackLex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n // if token isn\'t its numeric value, convert\n if (typeof token !== \'number\') {\n token = self.symbols_[token] || token;\n }\n }\n\n return token || EOF;\n }\n\n//_lexer_with_token_stack_end:\n\n var state, action, r, t;\n var yyval = {\n $: true,\n _$: undefined,\n yy: sharedState_yy\n };\n var p;\n var yyrulelen;\n var this_production;\n var newState;\n var retval = false;\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // Return the rule stack depth where the nearest error rule can be found.\n // Return -1 when no error recovery rule was found.\n function locateNearestErrorRecoveryRule(state) {\n var stack_probe = sp - 1;\n var depth = 0;\n\n // try to recover from error\n while (stack_probe >= 0) {\n // check for error recovery rule in this state\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #test#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n var t = table[state][TERROR] || NO_ACTION;\n if (t[0]) {\n // We need to make sure we\'re not cycling forever:\n // once we hit EOF, even when we `yyerrok()` an error, we must\n // prevent the core from running forever,\n // e.g. when parent rules are still expecting certain input to\n // follow after this, for example when you handle an error inside a set\n // of braces which are matched by a parent rule in your grammar.\n //\n // Hence we require that every error handling/recovery attempt\n // *after we\'ve hit EOF* has a diminishing state stack: this means\n // we will ultimately have unwound the state stack entirely and thus\n // terminate the parse in a controlled fashion even when we have\n // very complex error/recovery code interplay in the core + user\n // action code blocks:\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #found#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n if (symbol === EOF) {\n if (lastEofErrorStateDepth > sp - 1 - depth) {\n lastEofErrorStateDepth = sp - 1 - depth;\n } else {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #skip#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n continue;\n }\n }\n return depth;\n }\n if (state === 0 /* $accept rule */ || stack_probe < 1) {\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #end=NIL#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n --stack_probe; // popStack(1): [symbol, action]\n state = sstack[stack_probe];\n ++depth;\n }\n if (yydebug) yydebug(\'locateNearestErrorRecoveryRule #EMPTY#: \', { symbol: symbol, state: state, depth: depth, stackidx: sp - 1 - depth, lastidx: lastEofErrorStateDepth });\n return -1; // No suitable error recovery rule available.\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n try {\n this.__reentrant_call_depth++;\n\n lexer.setInput(input, sharedState_yy);\n\n // NOTE: we *assume* no lexer pre/post handlers are set up *after* \n // this initial `setInput()` call: hence we can now check and decide\n // whether we\'ll go with the standard, slower, lex() API or the\n // `fast_lex()` one:\n if (typeof lexer.canIUse === \'function\') {\n var lexerInfo = lexer.canIUse();\n if (lexerInfo.fastLex && typeof fastLex === \'function\') {\n lex = fastLex;\n }\n } \n\n yyloc = lexer.yylloc;\n lstack[sp] = yyloc;\n vstack[sp] = null;\n sstack[sp] = 0;\n stack[sp] = 0;\n ++sp;\n\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyleng = lexer.yyleng;\n\n if (this.pre_parse) {\n this.pre_parse.call(this, sharedState_yy);\n }\n if (sharedState_yy.pre_parse) {\n sharedState_yy.pre_parse.call(this, sharedState_yy);\n }\n\n newState = sstack[sp - 1];\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n//_handle_error_with_recovery: // run this code when the grammar includes error recovery rules\n\n // handle parse error\n if (!action) {\n // first see if there\'s any chance at hitting an error recovery rule:\n var error_rule_depth = locateNearestErrorRecoveryRule(state);\n var errStr = null;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n if (!recovering) {\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));\n\n // DO NOT cleanup the old one before we start the new error info track:\n // the old one will *linger* on the error stack and stay alive until we \n // invoke the parser\'s cleanup API!\n recoveringErrorInfo = this.shallowCopyErrorInfo(p);\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n\n if (yydebug) yydebug(\'error recovery rule detected: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n // Protect against overly blunt userland `parseError` code which *sets*\n // the `recoverable` flag without properly checking first:\n // we always terminate the parse when there\'s no recovery rule available anyhow!\n if (!p.recoverable || error_rule_depth < 0) {\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n } else {\n // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process...\n }\n }\n\n if (yydebug) yydebug(\'after ERROR DETECT: \', { error_rule_depth: error_rule_depth, error: p.errStr, error_hash: p });\n\n var esp = recoveringErrorInfo.info_stack_pointer;\n\n // just recovered from another error\n if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) {\n // SHIFT current lookahead and grab another\n recoveringErrorInfo.symbol_stack[esp] = symbol;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState; // push state\n ++esp;\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n preErrorSymbol = 0;\n symbol = lex();\n\n if (yydebug) yydebug(\'after ERROR RECOVERY-3: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol] });\n }\n\n // try to recover from error\n if (error_rule_depth < 0) {\n ASSERT(recovering > 0, "line 897");\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // barf a fatal hairball when we\'re out of look-ahead symbols and none hit a match\n // while we are still busy recovering from another error:\n var po = this.__error_infos[this.__error_infos.length - 1];\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parsing halted on line \' + (lexer.yylineno + 1) + \' while starting to recover from another error\';\n } else {\n errStr = \'Parsing halted while starting to recover from another error\';\n }\n\n if (po) {\n errStr += \' -- previous error which resulted in this fatal result: \' + po.errStr;\n } else {\n errStr += \': \';\n }\n\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n if (po) {\n p.extra_error_attributes = po;\n }\n\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token\n symbol = TERROR; // insert generic error symbol as new lookahead\n\n const EXTRA_STACK_SAMPLE_DEPTH = 3;\n\n // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token:\n recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol;\n if (errStr) {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n errStr: errStr,\n errorSymbolDescr: errSymbolDescr,\n expectedStr: expected,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n if (yydebug) yydebug(\'Error recovery process: pushed error info item on the info stack: \', {\n item: vstack[sp],\n sp,\n esp,\n vstack,\n stack,\n sstack,\n combineState: NO_ACTION[1]\n });\n } else {\n recoveringErrorInfo.value_stack[esp] = {\n yytext: shallow_copy(lexer.yytext),\n errorRuleDepth: error_rule_depth,\n stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH\n };\n }\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc);\n recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1];\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n yyval.$ = recoveringErrorInfo;\n yyval._$ = undefined;\n\n yyrulelen = error_rule_depth;\n\n if (yydebug) yydebug(\'Error recovery process: performAction: COMBINE: \', {\n yyval, yytext, sp, pop_size: yyrulelen, vstack, stack, sstack,\n combineState: NO_ACTION[1]\n });\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // and move the top entries + discarded part of the parse stacks onto the error info stack:\n for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) {\n recoveringErrorInfo.symbol_stack[esp] = stack[idx];\n recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]);\n recoveringErrorInfo.state_stack[esp] = sstack[idx];\n }\n\n recoveringErrorInfo.symbol_stack[esp] = TERROR;\n recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$);\n recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$);\n\n // goto new state = table[STATE][NONTERMINAL]\n newState = sstack[sp - 1];\n\n if (this.defaultActions[newState]) {\n recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState];\n } else {\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n recoveringErrorInfo.state_stack[esp] = t[1];\n }\n\n ++esp;\n recoveringErrorInfo.info_stack_pointer = esp;\n\n // allow N (default: 3) real symbols to be shifted before reporting a new error\n recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT;\n\n if (yydebug) yydebug(\'after ERROR POP: \', { error_rule_depth: error_rule_depth, symbol: symbol, preErrorSymbol: preErrorSymbol });\n\n // Now duplicate the standard parse machine here, at least its initial\n // couple of rounds until the TERROR symbol is **pushed onto the parse stack**,\n // as we wish to push something special then!\n //\n // Run the state machine in this copy of the parser state machine\n // until we *either* consume the error symbol (and its related information)\n // *or* we run into another error while recovering from this one\n // *or* we execute a `reduce` action which outputs a final parse\n // result (yes, that MAY happen!).\n //\n // We stay in this secondary parse loop until we have completed\n // the *error recovery phase* as the main parse loop (further below)\n // is optimized for regular parse operation and DOES NOT cope with\n // error recovery *at all*.\n //\n // We call the secondary parse loop just below the "slow parse loop",\n // while the main parse loop, which is an almost-duplicate of this one,\n // yet optimized for regular parse operation, is called the "fast\n // parse loop".\n //\n // Compare this to `bison` & (vanilla) `jison`, both of which have\n // only a single parse loop, which handles everything. Our goal is\n // to eke out every drop of performance in the main parse loop...\n\n ASSERT(recoveringErrorInfo, "line 1049");\n ASSERT(symbol === TERROR, "line 1050");\n ASSERT(!action, "line 1051");\n var errorSymbolFromParser = true;\n for (;;) {\n // retrieve state number from top of stack\n state = newState; // sstack[sp - 1];\n\n // use default actions if available\n if (this.defaultActions[state]) {\n action = 2;\n newState = this.defaultActions[state];\n } else {\n // The single `==` condition below covers both these `===` comparisons in a single\n // operation:\n //\n // if (symbol === null || typeof symbol === \'undefined\') ...\n if (!symbol) {\n symbol = lex();\n // **Warning: Edge Case**: the *lexer* may produce\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n }\n // read action for current state and first input\n t = (table[state] && table[state][symbol]) || NO_ACTION;\n newState = t[1];\n action = t[0];\n\n if (yydebug) yydebug(\'after FETCH/LEX: \', { symbol: symbol, symbolID: this.terminals_ && this.terminals_[symbol], state: state, newState: newState, recovering: recovering, action: action });\n\n // encountered another parse error? If so, break out to main loop\n // and take it from there!\n if (!action) {\n if (yydebug) yydebug(\'**NESTED ERROR DETECTED** while still recovering from previous error\');\n\n ASSERT(recoveringErrorInfo, "line 1087");\n\n // Prep state variables so that upon breaking out of\n // this "slow parse loop" and hitting the `continue;`\n // statement in the outer "fast parse loop" we redo\n // the exact same state table lookup as the one above\n // so that the outer=main loop will also correctly\n // detect the \'parse error\' state (`!action`) we have\n // just encountered above.\n newState = state;\n break;\n }\n }\n\n if (yydebug) yydebug(\'::: SLOW ERROR RECOVERY PHASE CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n //\n // SILENTLY SIGNAL that the outer "fast parse loop" should\n // take care of this internal error condition:\n // prevent useless code duplication now/here.\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n // ### Note/Warning ###\n //\n // The *lexer* may also produce TERROR tokens on its own,\n // so we specifically test for the TERROR we did set up\n // in the error recovery logic further above!\n if (symbol === TERROR && errorSymbolFromParser) {\n // Push a special value onto the stack when we\'re\n // shifting the `error` symbol that is related to the\n // error we\'re recovering from.\n ASSERT(recoveringErrorInfo, "line 1131");\n vstack[sp] = recoveringErrorInfo;\n lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true);\n } else {\n ASSERT(symbol !== 0, "line 1135");\n ASSERT(preErrorSymbol === 0, "line 1136");\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n }\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n // **Warning: Edge Case**: the *lexer* may have produced\n // TERROR tokens of its own volition: *those* TERROR\n // tokens should be treated like *regular tokens*\n // i.e. tokens which have a lexer-provided `yyvalue`\n // and `yylloc`:\n errorSymbolFromParser = false;\n if (!preErrorSymbol) { // normal execution / no error\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n\n if (recovering > 0) {\n recovering--;\n if (yydebug) yydebug(\'... SHIFT:error rule matching: \', { recovering: recovering, symbol: symbol });\n }\n } else {\n // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode:\n ASSERT(recovering > 0, "line 1163");\n symbol = preErrorSymbol;\n preErrorSymbol = 0;\n if (yydebug) yydebug(\'... SHIFT:error recovery: \', { recovering: recovering, symbol: symbol });\n // read action for current state and first input\n t = (table[newState] && table[newState][symbol]) || NO_ACTION;\n if (!t[0] || symbol === TERROR) {\n // forget about that symbol and move forward: this wasn\'t a \'forgot to insert\' error type where\n // (simple) stuff might have been missing before the token which caused the error we\'re\n // recovering from now...\n //\n // Also check if the LookAhead symbol isn\'t the ERROR token we set as part of the error\n // recovery, for then this we would we idling (cycling) on the error forever.\n // Yes, this does not take into account the possibility that the *lexer* may have\n // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar!\n if (yydebug) yydebug(\'... SHIFT:error recovery: re-application of old symbol doesn\\\'t work: instead, we\\\'re moving forward now. \', { recovering: recovering, symbol: symbol });\n symbol = 0;\n }\n }\n\n // once we have pushed the special ERROR token value,\n // we REMAIN in this inner, "slow parse loop" until\n // the entire error recovery phase has completed.\n //\n // ### Note About Edge Case ###\n //\n // Userland action code MAY already have \'reset\' the\n // error recovery phase marker `recovering` to ZERO(0)\n // while the error symbol hasn\'t been shifted onto\n // the stack yet. Hence we only exit this "slow parse loop"\n // when *both* conditions are met!\n ASSERT(preErrorSymbol === 0, "line 1194");\n if (recovering === 0) {\n break;\n }\n continue;\n\n // reduce:\n case 2:\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n // signal end of error recovery loop AND end of outer parse loop\n action = 3;\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (sp >= 0 && typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n sp = -2; // magic number: signal outer "fast parse loop" ACCEPT state that we already have a properly set up `retval` parser return value.\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n\n // should we also break out of the regular/outer parse loop,\n // i.e. did the parser already produce a parse result in here?!\n // *or* did we hit an unsupported parse state, to be handled\n // in the `switch/default` code further below?\n ASSERT(action !== 2, "line 1272");\n if (action === 0 || action === 1) {\n continue;\n }\n }\n\n//_handle_error_no_recovery: // run this code when the grammar does not include any error recovery rules\n\n // handle parse error\n if (!action) {\n var errStr;\n var errSymbolDescr = (this.describeSymbol(symbol) || symbol);\n var expected = this.collect_expected_token_set(state);\n\n // Report error\n if (typeof lexer.yylineno === \'number\') {\n errStr = \'Parse error on line \' + (lexer.yylineno + 1) + \': \';\n } else {\n errStr = \'Parse error: \';\n }\n if (typeof lexer.showPosition === \'function\') {\n errStr += \'\\n\' + lexer.showPosition(79 - 10, 10) + \'\\n\';\n }\n if (expected.length) {\n errStr += \'Expecting \' + expected.join(\', \') + \', got unexpected \' + errSymbolDescr;\n } else {\n errStr += \'Unexpected \' + errSymbolDescr;\n }\n // we cannot recover from the error!\n p = this.constructParseErrorInfo(errStr, null, expected, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n\n//_handle_error_end_of_section: // this concludes the error recovery / no error recovery code section choice above\n\n }\n\n if (yydebug) yydebug(\'::: MAIN CYCLE action: \' + (action === 1 ? \'shift token \' + symbol + \' (then go to state \' + newState + \')\' : action === 2 ? \'reduce by rule: \' + newState + (function __print_rule(nt, state) {\n if (!nt || !nt.states || !nt.rules)\n return \'\';\n var rulename = nt.states[state];\n var rulespec = nt.rules[rulename][state];\n return \' (\' + rulespec.symbol + \' := \' + rulespec.handle + \')\';\n })(this.nonterminals_, newState) : action === 3 ? \'accept\' : \'???unexpected???\'), { action: action, newState: newState, recovering: recovering, symbol: symbol });\n\n switch (action) {\n // catch misc. parse failures:\n default:\n // this shouldn\'t happen, unless resolve defaults are off\n if (action instanceof Array) {\n p = this.constructParseErrorInfo(\'Parse Error: multiple actions possible at state: \' + state + \', token: \' + symbol, null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n }\n // Another case of better safe than sorry: in case state transitions come out of another error recovery process\n // or a buggy LUT (LookUp Table):\n p = this.constructParseErrorInfo(\'Parsing halted. No viable error recovery approach available due to internal system failure.\', null, null, false);\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n break;\n\n // shift:\n case 1:\n stack[sp] = symbol;\n vstack[sp] = lexer.yytext;\n lstack[sp] = copy_yylloc(lexer.yylloc);\n sstack[sp] = newState; // push state\n\n ++sp;\n symbol = 0;\n\n ASSERT(preErrorSymbol === 0, "line 1352"); // normal execution / no error\n ASSERT(recovering === 0, "line 1353"); // normal execution / no error\n\n // Pick up the lexer details for the current symbol as that one is not \'look-ahead\' any more:\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n continue;\n\n // reduce:\n case 2:\n ASSERT(preErrorSymbol === 0, "line 1364"); // normal execution / no error\n ASSERT(recovering === 0, "line 1365"); // normal execution / no error\n\n this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards...\n yyrulelen = this_production[1];\n\n if (yydebug) yydebug(\'~~~ REDUCE: \', { pop_size: yyrulelen, newState: newState, recovering: recovering, symbol: symbol });\n\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack);\n\n if (typeof r !== \'undefined\') {\n retval = r;\n break;\n }\n\n // pop off stack\n sp -= yyrulelen;\n\n // don\'t overwrite the `symbol` variable: use a local var to speed things up:\n var ntsymbol = this_production[0]; // push nonterminal (reduce)\n stack[sp] = ntsymbol;\n vstack[sp] = yyval.$;\n lstack[sp] = yyval._$;\n // goto new state = table[STATE][NONTERMINAL]\n newState = table[sstack[sp - 1]][ntsymbol];\n sstack[sp] = newState;\n ++sp;\n if (yydebug) yydebug(\'REDUCED: \', { newState: newState, recovering: recovering, symbol: symbol });\n continue;\n\n // accept:\n case 3:\n if (sp !== -2) {\n retval = true;\n // Return the `$accept` rule\'s `$$` result, if available.\n //\n // Also note that JISON always adds this top-most `$accept` rule (with implicit,\n // default, action):\n //\n // $accept: $end\n // %{ $$ = $1; @$ = @1; %}\n //\n // which, combined with the parse kernel\'s `$accept` state behaviour coded below,\n // will produce the `$$` value output of the rule as the parse result,\n // IFF that result is *not* `undefined`. (See also the parser kernel code.)\n //\n // In code:\n //\n // %{\n // @$ = @1; // if location tracking support is included\n // if (typeof $1 !== \'undefined\')\n // return $1;\n // else\n // return true; // the default parse result if the rule actions don\'t produce anything\n // %}\n sp--;\n if (typeof vstack[sp] !== \'undefined\') {\n retval = vstack[sp];\n }\n }\n break;\n }\n\n // break out of loop: we accept or fail with error\n break;\n }\n } catch (ex) {\n // report exceptions through the parseError callback too, but keep the exception intact\n // if it is a known parser or lexer error which has been thrown by parseError() already:\n if (ex instanceof this.JisonParserError) {\n throw ex;\n }\n else if (lexer && typeof lexer.JisonLexerError === \'function\' && ex instanceof lexer.JisonLexerError) {\n throw ex;\n }\n else {\n p = this.constructParseErrorInfo(\'Parsing aborted due to exception.\', ex, null, false);\n retval = false;\n r = this.parseError(p.errStr, p, this.JisonParserError);\n if (typeof r !== \'undefined\') {\n retval = r;\n }\n }\n } finally {\n retval = this.cleanupAfterParse(retval, true, true);\n this.__reentrant_call_depth--;\n } // /finally\n\n return retval;\n}'; // --- END parser kernel ---