UNPKG

tex2typst

Version:

JavaScript library for converting TeX code to Typst

24 lines (23 loc) 21.7 kB
"use strict";class M{constructor(o,n,t=[]){this.type=o,this.value=n,this.args=t}}function U(l,o){Object.defineProperty(this,"name",{enumerable:!1,writable:!1,value:"JisonParserError"}),l==null&&(l="???"),Object.defineProperty(this,"message",{enumerable:!1,writable:!0,value:l}),this.hash=o;var n;if(o&&o.exception instanceof Error){var t=o.exception;this.message=t.message||l,n=t.stack}n||(Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,this.constructor):n=new Error(l).stack),n&&Object.defineProperty(this,"stack",{enumerable:!1,writable:!1,value:n})}typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(U.prototype,Error.prototype):U.prototype=Object.create(Error.prototype),U.prototype.constructor=U,U.prototype.name="JisonParserError";function V(l){for(var o=[],n=l.pop,t=l.rule,i=0,r=n.length;i<r;i++)o.push([n[i],t[i]]);return o}function z(l){for(var o=[],n=l.len,t=l.symbol,i=l.type,r=l.state,s=l.mode,e=l.goto,h=0,_=n.length;h<_;h++){for(var v=n[h],u={},d=0;d<v;d++){var a=t.shift();switch(i.shift()){case 2:u[a]=[s.shift(),e.shift()];break;case 0:u[a]=r.shift();break;default:u[a]=[3]}}o.push(u)}return o}function g(l,o,n){n=n||0;for(var t=0;t<o;t++)this.push(l),l+=n}function T(l,o){for(l=this.length-l,o+=l;l<o;l++)this.push(this[l])}function N(l){for(var o=[],n=0,t=l.length;n<t;n++){var i=l[n];typeof i=="function"?(n++,i.apply(o,l[n])):o.push(i)}return o}var I={trace:function(){},JisonParserError:U,yy:{},options:{type:"lalr",hasPartialLrUpgradeOnConflict:!0,errorRecoveryTokenDiscardCount:3},symbols_:{$accept:0,$end:1,"*":5,"+":3,"-":4,"/":6,EOF:1,IDENTIFIER:7,NUMBER:8,error:2,expression:10,typinput:9},terminals_:{1:"EOF",2:"error",3:"+",4:"-",5:"*",6:"/",7:"IDENTIFIER",8:"NUMBER"},TERROR:2,EOF:1,originalQuoteName:null,originalParseError:null,cleanupAfterParse:null,constructParseErrorInfo:null,yyMergeLocationInfo:null,__reentrant_call_depth:0,__error_infos:[],__error_recovery_infos:[],quoteName:function(o){return'"'+o+'"'},getSymbolName:function(o){if(this.terminals_[o])return this.terminals_[o];var n=this.symbols_;for(var t in n)if(n[t]===o)return t;return null},describeSymbol:function(o){if(o!==this.EOF&&this.terminal_descriptions_&&this.terminal_descriptions_[o])return this.terminal_descriptions_[o];if(o===this.EOF)return"end of input";var n=this.getSymbolName(o);return n?this.quoteName(n):null},collect_expected_token_set:function(o,n){var t=this.TERROR,i=[],r={};if(!n&&this.state_descriptions_&&this.state_descriptions_[o])return[this.state_descriptions_[o]];for(var s in this.table[o])if(s=+s,s!==t){var e=n?s:this.describeSymbol(s);e&&!r[e]&&(i.push(e),r[e]=!0)}return i},productions_:V({pop:N([9,g,[10,6]]),rule:N([2,1,1,g,[3,4]])}),performAction:function(o,n,t){var i=this.yy,r=i.parser,s=i.lexer;switch(o){case 0:this.$=t[n-1];break;case 1:return this.$=t[n-1],t[n-1];break;case 2:this.$=new M("IDENTIFIER",t[n]);break;case 3:this.$=new M("NUMBER",t[n]);break;case 4:this.$=new M("ADD",t[n-1],[t[n-2],t[n]]);break;case 5:this.$=new M("SUB",t[n-1],[t[n-2],t[n]]);break;case 6:this.$=new M("MUL",t[n-1],[t[n-2],t[n]]);break;case 7:this.$=new M("DIV",t[n-1],[t[n-2],t[n]]);break}},table:z({len:N([4,1,5,g,[0,3],g,[3,4],5,T,[9,3]]),symbol:N([g,[7,4,1],1,1,g,[3,6,1],10,T,[3,9],T,[17,5],T,[5,5]]),type:N([2,2,0,0,1,g,[2,7],0,T,[3,11],g,[2,8]]),state:N([1,2,g,[10,4,1]]),mode:N([g,[1,15],g,[2,3],T,[5,7]]),goto:N([g,[3,7,1],3,4,3,4,T,[4,4],g,[4,3],8,9,g,[5,3],8,9])}),defaultActions:{3:2,4:3,5:1,12:6,13:7},parseError:function(o,n,t){if(n.recoverable)typeof this.trace=="function"&&this.trace(o),n.destroy();else throw typeof this.trace=="function"&&this.trace(o),t||(t=this.JisonParserError),new t(o,n)},parse:function(o){var n=this,t=new Array(128),i=new Array(128),r=new Array(128),s=this.table,e=0,h=0,_=this.TERROR,v=this.EOF,u=this.options.errorRecoveryTokenDiscardCount|0||3,d=[0,14],a;this.__lexer__?a=this.__lexer__:a=this.__lexer__=Object.create(this.lexer);var f={parseError:void 0,quoteName:void 0,lexer:void 0,parser:void 0,pre_parse:void 0,post_parse:void 0,pre_lex:void 0,post_lex:void 0},x;typeof assert!="function"?x=function(y,R){if(!y)throw new Error("assertion failed: "+(R||"***"))}:x=assert,this.yyGetSharedState=function(){return f};function j(c,y){for(var R in y)typeof c[R]>"u"&&Object.prototype.hasOwnProperty.call(y,R)&&(c[R]=y[R])}j(f,this.yy),f.lexer=a,f.parser=this,typeof f.parseError=="function"?this.parseError=function(y,R,w){return w||(w=this.JisonParserError),f.parseError.call(this,y,R,w)}:this.parseError=this.originalParseError,typeof f.quoteName=="function"?this.quoteName=function(y){return f.quoteName.call(this,y)}:this.quoteName=this.originalQuoteName,this.cleanupAfterParse=function(y,R,w){var A;if(R){var S;(f.post_parse||this.post_parse)&&(S=this.constructParseErrorInfo(null,null,null,!1)),f.post_parse&&(A=f.post_parse.call(this,f,y,S),typeof A<"u"&&(y=A)),this.post_parse&&(A=this.post_parse.call(this,f,y,S),typeof A<"u"&&(y=A)),S&&S.destroy&&S.destroy()}if(this.__reentrant_call_depth>1)return y;if(a.cleanupAfterLex&&a.cleanupAfterLex(w),f&&(f.lexer=void 0,f.parser=void 0,a.yy===f&&(a.yy=void 0)),f=void 0,this.parseError=this.originalParseError,this.quoteName=this.originalQuoteName,t.length=0,i.length=0,r.length=0,e=0,!w){for(var Y=this.__error_infos.length-1;Y>=0;Y--){var C=this.__error_infos[Y];C&&typeof C.destroy=="function"&&C.destroy()}this.__error_infos.length=0}return y},this.constructParseErrorInfo=function(y,R,w,A){var S={errStr:y,exception:R,text:a.match,value:a.yytext,token:this.describeSymbol(h)||h,token_id:h,line:a.yylineno,expected:w,recoverable:A,state:E,action:P,new_state:k,symbol_stack:t,state_stack:i,value_stack:r,stack_pointer:e,yy:f,lexer:a,parser:this,destroy:function(){var C=!!this.recoverable;for(var X in this)this.hasOwnProperty(X)&&typeof X=="object"&&(this[X]=void 0);this.recoverable=C}};return this.__error_infos.push(S),S};function q(c){var y=n.getSymbolName(c);return y||(y=c),y}function B(){var c=a.lex();return typeof c!="number"&&(c=n.symbols_[c]||c),c||v}function $(){var c=a.fastLex();return typeof c!="number"&&(c=n.symbols_[c]||c),c||v}var Q=B,E,P,p,F,L={$:!0,_$:void 0,yy:f},m,D,O,k,b=!1;try{if(this.__reentrant_call_depth++,a.setInput(o,f),typeof a.canIUse=="function"){var Z=a.canIUse();Z.fastLex&&typeof $=="function"&&(Q=$)}for(r[e]=null,i[e]=0,t[e]=0,++e,this.pre_parse&&this.pre_parse.call(this,f),f.pre_parse&&f.pre_parse.call(this,f),k=i[e-1];;){if(E=k,this.defaultActions[E])P=2,k=this.defaultActions[E];else if(h||(h=Q()),F=s[E]&&s[E][h]||d,k=F[1],P=F[0],!P){var J,W=this.describeSymbol(h)||h,G=this.collect_expected_token_set(E);typeof a.yylineno=="number"?J="Parse error on line "+(a.yylineno+1)+": ":J="Parse error: ",typeof a.showPosition=="function"&&(J+=` `+a.showPosition(69,10)+` `),G.length?J+="Expecting "+G.join(", ")+", got unexpected "+W:J+="Unexpected "+W,m=this.constructParseErrorInfo(J,null,G,!1),p=this.parseError(m.errStr,m,this.JisonParserError),typeof p<"u"&&(b=p);break}switch(P){default:if(P instanceof Array){m=this.constructParseErrorInfo("Parse Error: multiple actions possible at state: "+E+", token: "+h,null,null,!1),p=this.parseError(m.errStr,m,this.JisonParserError),typeof p<"u"&&(b=p);break}m=this.constructParseErrorInfo("Parsing halted. No viable error recovery approach available due to internal system failure.",null,null,!1),p=this.parseError(m.errStr,m,this.JisonParserError),typeof p<"u"&&(b=p);break;case 1:t[e]=h,r[e]=a.yytext,i[e]=k,++e,h=0;continue;case 2:if(O=this.productions_[k-1],D=O[1],p=this.performAction.call(L,k,e-1,r),typeof p<"u"){b=p;break}e-=D;var H=O[0];t[e]=H,r[e]=L.$,k=s[i[e-1]][H],i[e]=k,++e;continue;case 3:e!==-2&&(b=!0,e--,typeof r[e]<"u"&&(b=r[e]));break}break}}catch(c){if(c instanceof this.JisonParserError)throw c;if(a&&typeof a.JisonLexerError=="function"&&c instanceof a.JisonLexerError)throw c;m=this.constructParseErrorInfo("Parsing aborted due to exception.",c,null,!1),b=!1,p=this.parseError(m.errStr,m,this.JisonParserError),typeof p<"u"&&(b=p)}finally{b=this.cleanupAfterParse(b,!0,!0),this.__reentrant_call_depth--}return b}};I.originalParseError=I.parseError,I.originalQuoteName=I.quoteName;var tt=function(){function l(n,t){Object.defineProperty(this,"name",{enumerable:!1,writable:!1,value:"JisonLexerError"}),n==null&&(n="???"),Object.defineProperty(this,"message",{enumerable:!1,writable:!0,value:n}),this.hash=t;var i;if(t&&t.exception instanceof Error){var r=t.exception;this.message=r.message||n,i=r.stack}i||(Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,this.constructor):i=new Error(n).stack),i&&Object.defineProperty(this,"stack",{enumerable:!1,writable:!1,value:i})}typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(l.prototype,Error.prototype):l.prototype=Object.create(Error.prototype),l.prototype.constructor=l,l.prototype.name="JisonLexerError";var o={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(t,i,r){if(t=""+t,r==null&&(r=!(t.indexOf(` `)>0&&t.indexOf("^")>0)),this.yylloc&&r){if(typeof this.prettyPrintRange=="function"){var s=this.prettyPrintRange(this.yylloc);/\n\s*$/.test(t)||(t+=` `),t+=` Erroneous area: `+this.prettyPrintRange(this.yylloc)}else if(typeof this.showPosition=="function"){var e=this.showPosition();e&&(t.length&&t[t.length-1]!==` `&&e[0]!==` `?t+=` `+e:t+=e)}}var h={errStr:t,recoverable:!!i,text:this.match,token:null,line:this.yylineno,loc:this.yylloc,yy:this.yy,lexer:this,destroy:function(){var v=!!this.recoverable;for(var u in this)this.hasOwnProperty(u)&&typeof u=="object"&&(this[u]=void 0);this.recoverable=v}};return this.__error_infos.push(h),h},parseError:function(t,i,r){if(r||(r=this.JisonLexerError),this.yy){if(this.yy.parser&&typeof this.yy.parser.parseError=="function")return this.yy.parser.parseError.call(this,t,i,r)||this.ERROR;if(typeof this.yy.parseError=="function")return this.yy.parseError.call(this,t,i,r)||this.ERROR}throw new r(t,i)},yyerror:function(t){var i="";this.yylloc&&(i=" on line "+(this.yylineno+1));var r=this.constructLexErrorInfo("Lexical error"+i+": "+t,this.options.lexerErrorsAreRecoverable),s=Array.prototype.slice.call(arguments,1);return s.length&&(r.extra_error_attributes=s),this.parseError(r.errStr,r,this.JisonLexerError)||this.ERROR},cleanupAfterLex:function(t){if(this.setInput("",{}),!t){for(var i=this.__error_infos.length-1;i>=0;i--){var r=this.__error_infos[i];r&&typeof r.destroy=="function"&&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;var t=this.yylloc?this.yylloc.last_column:0;this.yylloc={first_line:this.yylineno+1,first_column:t,last_line:this.yylineno+1,last_column:t,range:[this.offset,this.offset]}},setInput:function(t,i){if(this.yy=i||this.yy||{},!this.__decompressed){for(var r=this.rules,s=0,e=r.length;s<e;s++){var h=r[s];typeof h=="number"&&(r[s]=r[h])}var _=this.conditions;for(var v in _){for(var u=_[v],d=u.rules,e=d.length,a=new Array(e+1),f=new Array(e+1),s=0;s<e;s++){var x=d[s],h=r[x];a[s+1]=h,f[s+1]=x}u.rules=f,u.__rule_regexes=a,u.__rule_count=e}this.__decompressed=!0}return this._input=t||"",this.clear(),this._signaled_error_token=!1,this.done=!1,this.yylineno=0,this.matched="",this.conditionStack=["INITIAL"],this.__currentRuleSet__=null,this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0,range:[0,0]},this.offset=0,this},editRemainingInput:function(t,i){var r=t.call(this,this._input,i);return typeof r!="string"?r&&(this._input=""+r):this._input=r,this},input:function(){if(!this._input)return null;var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var i=1,r=!1;if(t===` `)r=!0;else if(t==="\r"){r=!0;var s=this._input[1];s===` `&&(i++,t+=s,this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s,this.yylloc.range[1]++)}return r?(this.yylineno++,this.yylloc.last_line++,this.yylloc.last_column=0):this.yylloc.last_column++,this.yylloc.range[1]++,this._input=this._input.slice(i),t},unput:function(t){var i=t.length,r=t.split(/(?:\r\n?|\n)/g);if(this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.yyleng=this.yytext.length,this.offset-=i,this.match=this.match.substr(0,this.match.length-i),this.matched=this.matched.substr(0,this.matched.length-i),r.length>1){this.yylineno-=r.length-1,this.yylloc.last_line=this.yylineno+1;var s=this.match,e=s.split(/(?:\r\n?|\n)/g);e.length===1&&(s=this.matched,e=s.split(/(?:\r\n?|\n)/g)),this.yylloc.last_column=e[e.length-1].length}else this.yylloc.last_column-=i;return this.yylloc.range[1]=this.yylloc.range[0]+this.yyleng,this.done=!1,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else{var t="";this.yylloc&&(t=" on line "+(this.yylineno+1));var i=this.constructLexErrorInfo("Lexical error"+t+": You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).",!1);this._signaled_error_token=this.parseError(i.errStr,i,this.JisonLexerError)||this.ERROR}return this},less:function(t){return this.unput(this.match.slice(t))},pastInput:function(t,i){var r=this.matched.substring(0,this.matched.length-this.match.length);t<0?t=r.length:t||(t=20),i<0?i=r.length:i||(i=1),r=r.substr(-t*2-2);var s=r.replace(/\r\n|\r/g,` `).split(` `);return s=s.slice(-i),r=s.join(` `),r.length>t&&(r="..."+r.substr(-t)),r},upcomingInput:function(t,i){var r=this.match;t<0?t=r.length+this._input.length:t||(t=20),i<0?i=t:i||(i=1),r.length<t*2+2&&(r+=this._input.substring(0,t*2+2));var s=r.replace(/\r\n|\r/g,` `).split(` `);return s=s.slice(0,i),r=s.join(` `),r.length>t&&(r=r.substring(0,t)+"..."),r},showPosition:function(t,i){var r=this.pastInput(t).replace(/\s/g," "),s=new Array(r.length+1).join("-");return r+this.upcomingInput(i).replace(/\s/g," ")+` `+s+"^"},deriveLocationInfo:function(t,i,r,s){var e={first_line:1,first_column:0,last_line:1,last_column:0,range:[0,0]};return t&&(e.first_line=t.first_line|0,e.last_line=t.last_line|0,e.first_column=t.first_column|0,e.last_column=t.last_column|0,t.range&&(e.range[0]=t.range[0]|0,e.range[1]=t.range[1]|0)),(e.first_line<=0||e.last_line<e.first_line)&&(e.first_line<=0&&i&&(e.first_line=i.last_line|0,e.first_column=i.last_column|0,i.range&&(e.range[0]=t.range[1]|0)),(e.last_line<=0||e.last_line<e.first_line)&&r&&(e.last_line=r.first_line|0,e.last_column=r.first_column|0,r.range&&(e.range[1]=t.range[0]|0)),e.first_line<=0&&s&&(e.last_line<=0||s.last_line<=e.last_line)&&(e.first_line=s.first_line|0,e.first_column=s.first_column|0,s.range&&(e.range[0]=s.range[0]|0)),e.last_line<=0&&s&&(e.first_line<=0||s.first_line>=e.first_line)&&(e.last_line=s.last_line|0,e.last_column=s.last_column|0,s.range&&(e.range[1]=s.range[1]|0))),e.last_line<=0&&(e.first_line<=0?(e.first_line=this.yylloc.first_line,e.last_line=this.yylloc.last_line,e.first_column=this.yylloc.first_column,e.last_column=this.yylloc.last_column,e.range[0]=this.yylloc.range[0],e.range[1]=this.yylloc.range[1]):(e.last_line=this.yylloc.last_line,e.last_column=this.yylloc.last_column,e.range[1]=this.yylloc.range[1])),e.first_line<=0&&(e.first_line=e.last_line,e.first_column=0,e.range[1]=e.range[0]),e.first_column<0&&(e.first_column=0),e.last_column<0&&(e.last_column=e.first_column>0?e.first_column:80),e},prettyPrintRange:function(t,i,r){t=this.deriveLocationInfo(t,i,r);const s=3,e=1,h=2;var _=this.matched+this._input,v=_.split(` `),u=Math.max(1,i?i.first_line:t.first_line-s),d=Math.max(1,r?r.last_line:t.last_line+e),a=1+Math.log10(d|1)|0,f=new Array(a).join(" "),x=[],j=v.slice(u-1,d+1).map(function(E,P){var p=P+u,F=(f+p).substr(-a),L=F+": "+E,m=new Array(a+1).join("^"),D=3,O=0;if(p===t.first_line?(D+=t.first_column,O=Math.max(2,(p===t.last_line?t.last_column:E.length)-t.first_column+1)):p===t.last_line?O=Math.max(2,t.last_column+1):p>t.first_line&&p<t.last_line&&(O=Math.max(2,E.length+1)),O){var k=new Array(D).join("."),b=new Array(O).join("^");L+=` `+m+k+b,E.trim().length>0&&x.push(P)}return L=L.replace(/\t/g," "),L});if(x.length>2*h){var q=x[h-1]+1,B=x[x.length-h]-1,$=new Array(a+1).join(" ")+" (...continued...)";$+=` `+new Array(a+1).join("-")+" (---------------)",j.splice(q,B-q+1,$)}return j.join(` `)},describeYYLLOC:function(t,i){var r=t.first_line,s=t.last_line,e=t.first_column,h=t.last_column,_=s-r,v=h-e,u;if(_===0?(u="line "+r+", ",v<=1?u+="column "+e:u+="columns "+e+" .. "+h):u="lines "+r+"(column "+e+") .. "+s+"(column "+h+")",t.range&&i){var d=t.range[0],a=t.range[1]-1;a<=d?u+=" {String Offset: "+d+"}":u+=" {String Offset range: "+d+" .. "+a+"}"}return u},test_match:function(t,i){var r,s,e,h,_;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.yylloc.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column,range:this.yylloc.range.slice(0)},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}),h=t[0],_=h.length,s=h.split(/(?:\r\n?|\n)/g),s.length>1?(this.yylineno+=s.length-1,this.yylloc.last_line=this.yylineno+1,this.yylloc.last_column=s[s.length-1].length):this.yylloc.last_column+=_,this.yytext+=h,this.match+=h,this.matched+=h,this.matches=t,this.yyleng=this.yytext.length,this.yylloc.range[1]+=_,this.offset+=_,this._more=!1,this._backtrack=!1,this._input=this._input.slice(_),r=this.performAction.call(this,this.yy,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var v in e)this[v]=e[v];return this.__currentRuleSet__=null,!1}else if(this._signaled_error_token)return r=this._signaled_error_token,this._signaled_error_token=!1,r;return!1},next:function(){if(this.done)return this.clear(),this.EOF;this._input||(this.done=!0);var t,i,r,s;this._more||this.clear();var e=this.__currentRuleSet__;if(!e&&(e=this.__currentRuleSet__=this._currentRules(),!e||!e.rules)){var h="";this.options.trackPosition&&(h=" on line "+(this.yylineno+1));var _=this.constructLexErrorInfo("Internal lexer engine error"+h+': 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!',!1);return this.parseError(_.errStr,_,this.JisonLexerError)||this.ERROR}for(var v=e.rules,u=e.__rule_regexes,d=e.__rule_count,a=1;a<=d;a++)if(r=this._input.match(u[a]),r&&(!i||r[0].length>i[0].length)){if(i=r,s=a,this.options.backtrack_lexer){if(t=this.test_match(r,v[a]),t!==!1)return t;if(this._backtrack){i=void 0;continue}else return!1}else if(!this.options.flex)break}if(i)return t=this.test_match(i,v[s]),t!==!1?t:!1;if(this._input){var h="";this.options.trackPosition&&(h=" on line "+(this.yylineno+1));var _=this.constructLexErrorInfo("Lexical error"+h+": Unrecognized text.",this.options.lexerErrorsAreRecoverable),f=this._input,x=this.topState(),j=this.conditionStack.length;return t=this.parseError(_.errStr,_,this.JisonLexerError)||this.ERROR,t===this.ERROR&&!this.matches&&f===this._input&&x===this.topState()&&j===this.conditionStack.length&&this.input(),t}else return this.done=!0,this.clear(),this.EOF},lex:function(){var t;for(typeof this.pre_lex=="function"&&(t=this.pre_lex.call(this,0)),typeof this.options.pre_lex=="function"&&(t=this.options.pre_lex.call(this,t)||t),this.yy&&typeof this.yy.pre_lex=="function"&&(t=this.yy.pre_lex.call(this,t)||t);!t;)t=this.next();return this.yy&&typeof this.yy.post_lex=="function"&&(t=this.yy.post_lex.call(this,t)||t),typeof this.options.post_lex=="function"&&(t=this.options.post_lex.call(this,t)||t),typeof this.post_lex=="function"&&(t=this.post_lex.call(this,t)||t),t},fastLex:function(){for(var t;!t;)t=this.next();return t},canIUse:function(){var t={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 t},begin:function(t){return this.pushState(t)},pushState:function(t){return this.conditionStack.push(t),this.__currentRuleSet__=null,this},popState:function(){var t=this.conditionStack.length-1;return t>0?(this.__currentRuleSet__=null,this.conditionStack.pop()):this.conditionStack[0]},topState:function(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"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:{trackPosition:!0},JisonLexerError:l,performAction:function(t,i,r){var s=this,e=r;switch(i){case 0:break;default:return this.simpleCaseActionClusters[i]}},simpleCaseActionClusters:{1:8,2:5,3:6,4:3,5:4,6:7,7:1,8:"INVALID"},rules:[/^(?:\s+)/,/^(?:\d+(\.\d+)?\b)/,/^(?:\*)/,/^(?:\/)/,/^(?:\+)/,/^(?:-)/,/^(?:[^\W\d]+)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}};return o}();I.lexer=tt;function K(){this.yy={}}K.prototype=I,I.Parser=K;function et(){return I.parse.apply(I,arguments)}export default{parser:I,Parser:K,parse:et};