// provide a local version for test purposes: // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility // with userland code which might access the derived class in a 'classic' way. function e(e,n){Object.defineProperty(this,"name",{enumerable:!1,writable:!1,value:"JisonLexerError"}),null==e&&(e="???"),Object.defineProperty(this,"message",{enumerable:!1,writable:!0,value:e}),this.hash=n;var r;if(n&&n.exception instanceof Error){var t=n.exception;this.message=t.message||e,r=t.stack}r||(Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,this.constructor):r=new Error(e).stack),r&&Object.defineProperty(this,"stack",{enumerable:!1,writable:!1,value:r})} "function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,Error.prototype):e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.name="JisonLexerError" var lexer = { // Code Generator Information Report // --------------------------------- // // Options: // backtracking: false // location.ranges: undefined // // Forwarded Parser Analysis flags: // uses yyleng: false // uses yylineno: false // uses yytext: false // uses yylloc: false // uses lexer values: true / true // location tracking: false // location assignment: false // // --------- END OF REPORT ----------- EOF:1,ERROR:2,__currentRuleSet__:null,__error_infos:[],__decompressed:!1,done:!1,_backtrack:!1,_input:"",_more:!1,_signaled_error_token:!1,conditionStack:[],match:"",matched:"",matches:!1,yytext:"",offset:0,yyleng:0,yylineno:0,yylloc:null,constructLexErrorInfo:function(e,n){var r={errStr:e,recoverable:!!n,text:this.match,token:null,line:this.yylineno,loc:this.yylloc,yy:this.yy,lexer:this,destroy:function(){var e=!!this.recoverable;for(var n in this)this.hasOwnProperty(n)&&"object"==typeof n&&(this[n]=void 0);this.recoverable=e}};return this.__error_infos.push(r),r},parseError:function(e,n,r){if(this.yy.parser&&"function"==typeof this.yy.parser.parseError)return this.yy.parser.parseError(e,n,r)||this.ERROR;if("function"==typeof this.yy.parseError)return this.yy.parseError(e,n,r)||this.ERROR;throw new r(e,n)},cleanupAfterLex:function(e){if(this.setInput("",{}),!e){for(var n=this.__error_infos.length-1;n>=0;n--){var r=this.__error_infos[n];r&&"function"==typeof r.destroy&&r.destroy()}this.__error_infos.length=0}return this},clear:function(){this.yytext="",this.yyleng=0,this.match="",this.matches=!1,this._more=!1,this._backtrack=!1},setInput:function(e,n){if(this.yy=n||this.yy||{},!this.__decompressed){for(var r=this.rules,t=0,o=r.length;te&&(r="..."+r.substr(-e)),r},upcomingInput:function(e,n){var r=this.match;e<0?e=r.length+this._input.length:e||(e=20),n<0?n=e:n||(n=1),r.length<2*e+2&&(r+=this._input.substring(0,2*e+2));var t=r.replace(/\r\n|\r/g,"\n").split("\n");return t=t.slice(0,n),r=t.join("\n"),r.length>e&&(r=r.substring(0,e)+"..."),r},showPosition:function(e,n){var r=this.pastInput(e).replace(/\s/g," "),t=new Array(r.length+1).join("-");return r+this.upcomingInput(n).replace(/\s/g," ")+"\n"+t+"^"},describeYYLLOC:function(e,n){var r,t=e.first_line,o=e.last_line,i=e.first_column,s=e.last_column-1,a=o-t,l=0===a?s-i:1e3;if(0===a?(r="line "+t+", ",r+=0===l?"column "+i:"columns "+i+" .. "+s):r="lines "+t+"(column "+i+") .. "+o+"(column "+s+")",e.range&&n){var c=e.range[0],u=e.range[1]-1;r+=u===c?" {String Offset: "+c+"}":" {String Offset range: "+c+" .. "+u+"}"}return r},test_match:function(e,n,r){var t,o,i,s,a;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),s=e[0],a=s.length,o=s.match(/(?:\r\n?|\n).*/g),o&&(this.yylineno+=o.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:o?o[o.length-1].length-o[o.length-1].match(/^\r?\n?/)[0].length:this.yylloc.last_column+a},this.yytext+=s,this.match+=s,this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+this.yyleng]),this.offset+=a,this._more=!1,this._backtrack=!1,this._input=this._input.slice(a),this.matched+=s,t=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1],r),this.done&&this._input&&(this.done=!1),t)return t;if(this._backtrack){for(var l in i)this[l]=i[l];return this.__currentRuleSet__=null,!1}return!!this._signaled_error_token&&(t=this._signaled_error_token,this._signaled_error_token=!1,t)},next:function(e){if(this.done)return this.clear(),this.EOF;this._input||(this.done=!0);var n,r,t,o;this._more||this.clear();var i=this.__currentRuleSet__;if(!(i||(i=this.__currentRuleSet__=this._currentRules())&&i.rules)){var s=this.constructLexErrorInfo("Internal lexer engine error on line "+(this.yylineno+1)+'. 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!\n',!1);return this.parseError(s.errStr,s,this.JisonLexerError)||this.ERROR}for(var a=i.rules,l=i.__rule_regexes,c=i.__rule_count,u=1;u<=c;u++)if((t=this._input.match(l[u]))&&(!r||t[0].length>r[0].length)){if(r=t,o=u,this.options.backtrack_lexer){if(!1!==(n=this.test_match(t,a[u],e)))return n;if(this._backtrack){r=void 0;continue}return!1}if(!this.options.flex)break}if(r)return!1!==(n=this.test_match(r,a[o],e))&&n;if(""===this._input)return this.done=!0,this.EOF;var s=this.constructLexErrorInfo("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),this.options.lexer_errors_are_recoverable);return n=this.parseError(s.errStr,s,this.JisonLexerError)||this.ERROR,n===this.ERROR&&(this.match.length||this.input()),n},lex:function(e){var n;for("function"==typeof this.options.pre_lex&&(n=this.options.pre_lex.call(this,e));!n;)n=this.next(e);return"function"==typeof this.options.post_lex&&(n=this.options.post_lex.call(this,n,e)||n),n},begin:function(e){return this.pushState(e)},pushState:function(e){return this.conditionStack.push(e),this.__currentRuleSet__=null,this},popState:function(){return this.conditionStack.length-1>0?(this.__currentRuleSet__=null,this.conditionStack.pop()):this.conditionStack[0]},topState:function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:"INITIAL"},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]]:this.conditions.INITIAL},stateStackSize:function(){return this.conditionStack.length}}, options: {}, JisonLexerError: JisonLexerError, performAction: null, simpleCaseActionClusters: { }, rules: [ ], conditions: [] }; return lexer;