UNPKG

9.63 kBJavaScriptView Raw
1var parser=function(){var parser={trace:function trace(){},yy:{},symbols_:{error:2,root:3,lines:4,line:5,indentation:6,indentationLevel:7,INDENT:8,lineMain:9,end:10,tag:11,rest:12,COMMENT:13,FILTER:14,FILTER_LINE:15,NEWLINE:16,EOF:17,name:18,tagComponents:19,attributes:20,idComponent:21,classComponents:22,ID:23,CLASS:24,LEFT_PARENTHESIS:25,attributePairs:26,RIGHT_PARENTHESIS:27,LEFT_BRACE:28,RIGHT_BRACE:29,SEPARATOR:30,attributePair:31,ATTRIBUTE:32,EQUAL:33,ATTRIBUTE_VALUE:34,TAG:35,BUFFERED_CODE:36,UNBUFFERED_CODE:37,TEXT:38,$accept:0,$end:1},terminals_:{2:"error",8:"INDENT",13:"COMMENT",14:"FILTER",15:"FILTER_LINE",16:"NEWLINE",17:"EOF",23:"ID",24:"CLASS",25:"LEFT_PARENTHESIS",27:"RIGHT_PARENTHESIS",28:"LEFT_BRACE",29:"RIGHT_BRACE",30:"SEPARATOR",32:"ATTRIBUTE",33:"EQUAL",34:"ATTRIBUTE_VALUE",35:"TAG",36:"BUFFERED_CODE",37:"UNBUFFERED_CODE",38:"TEXT"},productions_:[0,[3,1],[4,2],[4,1],[6,0],[6,1],[7,2],[7,1],[5,3],[5,1],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[10,1],[10,1],[11,2],[11,2],[11,1],[11,1],[19,3],[19,2],[19,2],[19,2],[19,1],[19,1],[21,1],[22,2],[22,1],[20,3],[20,3],[26,3],[26,1],[31,3],[18,1],[12,1],[12,1],[12,1]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return this.$=yy.nodePath[0].children;break;case 2:this.$=$$[$0-1];break;case 3:this.$=$$[$0];break;case 4:this.$=0;break;case 5:this.$=$$[$0];break;case 6:this.$=$$[$0-1]+1;break;case 7:this.$=1;break;case 8:this.$=yy.append($$[$0-1],$$[$0-2]);break;case 9:this.$=function(){if($$[$0].newline){return yy.newline()}}();break;case 10:this.$=yy.extend($$[$0-1],$$[$0]);break;case 11:this.$=$$[$0];break;case 12:this.$=$$[$0];break;case 13:this.$={comment:$$[$0]};break;case 14:this.$={filter:$$[$0]};break;case 15:this.$={filterLine:$$[$0]};break;case 16:this.$={newline:true};break;case 17:this.$=$$[$0];break;case 18:this.$=function(){$$[$0].tag=$$[$0-1];return $$[$0]}();break;case 19:this.$={tag:$$[$0-1],attributes:$$[$0]};break;case 20:this.$={tag:$$[$0]};break;case 21:this.$=yy.extend($$[$0],{tag:"div"});break;case 22:this.$={id:$$[$0-2],classes:$$[$0-1],attributes:$$[$0]};break;case 23:this.$={id:$$[$0-1],attributes:$$[$0]};break;case 24:this.$={classes:$$[$0-1],attributes:$$[$0]};break;case 25:this.$={id:$$[$0-1],classes:$$[$0]};break;case 26:this.$={id:$$[$0]};break;case 27:this.$={classes:$$[$0]};break;case 28:this.$=$$[$0];break;case 29:this.$=$$[$0-1].concat($$[$0]);break;case 30:this.$=[$$[$0]];break;case 31:this.$=$$[$0-1];break;case 32:this.$=$$[$0-1];break;case 33:this.$=$$[$0-2].concat($$[$0]);break;case 34:this.$=[$$[$0]];break;case 35:this.$={name:$$[$0-2],value:$$[$0]};break;case 36:this.$=$$[$0];break;case 37:this.$={bufferedCode:$$[$0]};break;case 38:this.$={unbufferedCode:$$[$0]};break;case 39:this.$={text:$$[$0]+"\n"};break}},table:[{3:1,4:2,5:3,6:4,7:6,8:[1,9],10:5,13:[2,4],14:[2,4],15:[2,4],16:[1,7],17:[1,8],23:[2,4],24:[2,4],35:[2,4],36:[2,4],37:[2,4],38:[2,4]},{1:[3]},{1:[2,1],5:10,6:4,7:6,8:[1,9],10:5,13:[2,4],14:[2,4],15:[2,4],16:[1,7],17:[1,8],23:[2,4],24:[2,4],35:[2,4],36:[2,4],37:[2,4],38:[2,4]},{1:[2,3],8:[2,3],13:[2,3],14:[2,3],15:[2,3],16:[2,3],17:[2,3],23:[2,3],24:[2,3],35:[2,3],36:[2,3],37:[2,3],38:[2,3]},{9:11,11:12,12:13,13:[1,14],14:[1,15],15:[1,16],18:17,19:18,21:23,22:24,23:[1,25],24:[1,26],35:[1,22],36:[1,19],37:[1,20],38:[1,21]},{1:[2,9],8:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[2,9],17:[2,9],23:[2,9],24:[2,9],35:[2,9],36:[2,9],37:[2,9],38:[2,9]},{8:[1,27],13:[2,5],14:[2,5],15:[2,5],23:[2,5],24:[2,5],35:[2,5],36:[2,5],37:[2,5],38:[2,5]},{1:[2,16],8:[2,16],13:[2,16],14:[2,16],15:[2,16],16:[2,16],17:[2,16],23:[2,16],24:[2,16],35:[2,16],36:[2,16],37:[2,16],38:[2,16]},{1:[2,17],8:[2,17],13:[2,17],14:[2,17],15:[2,17],16:[2,17],17:[2,17],23:[2,17],24:[2,17],35:[2,17],36:[2,17],37:[2,17],38:[2,17]},{8:[2,7],13:[2,7],14:[2,7],15:[2,7],23:[2,7],24:[2,7],35:[2,7],36:[2,7],37:[2,7],38:[2,7]},{1:[2,2],8:[2,2],13:[2,2],14:[2,2],15:[2,2],16:[2,2],17:[2,2],23:[2,2],24:[2,2],35:[2,2],36:[2,2],37:[2,2],38:[2,2]},{10:28,16:[1,7],17:[1,8]},{12:29,16:[2,11],17:[2,11],36:[1,19],37:[1,20],38:[1,21]},{16:[2,12],17:[2,12]},{16:[2,13],17:[2,13]},{16:[2,14],17:[2,14]},{16:[2,15],17:[2,15]},{16:[2,20],17:[2,20],19:30,20:31,21:23,22:24,23:[1,25],24:[1,26],25:[1,32],28:[1,33],36:[2,20],37:[2,20],38:[2,20]},{16:[2,21],17:[2,21],36:[2,21],37:[2,21],38:[2,21]},{16:[2,37],17:[2,37]},{16:[2,38],17:[2,38]},{16:[2,39],17:[2,39]},{16:[2,36],17:[2,36],23:[2,36],24:[2,36],25:[2,36],28:[2,36],36:[2,36],37:[2,36],38:[2,36]},{16:[2,26],17:[2,26],20:35,22:34,24:[1,26],25:[1,32],28:[1,33],36:[2,26],37:[2,26],38:[2,26]},{16:[2,27],17:[2,27],20:36,24:[1,37],25:[1,32],28:[1,33],36:[2,27],37:[2,27],38:[2,27]},{16:[2,28],17:[2,28],24:[2,28],25:[2,28],28:[2,28],36:[2,28],37:[2,28],38:[2,28]},{16:[2,30],17:[2,30],24:[2,30],25:[2,30],28:[2,30],36:[2,30],37:[2,30],38:[2,30]},{8:[2,6],13:[2,6],14:[2,6],15:[2,6],23:[2,6],24:[2,6],35:[2,6],36:[2,6],37:[2,6],38:[2,6]},{1:[2,8],8:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[2,8],17:[2,8],23:[2,8],24:[2,8],35:[2,8],36:[2,8],37:[2,8],38:[2,8]},{16:[2,10],17:[2,10]},{16:[2,18],17:[2,18],36:[2,18],37:[2,18],38:[2,18]},{16:[2,19],17:[2,19],36:[2,19],37:[2,19],38:[2,19]},{26:38,31:39,32:[1,40]},{26:41,31:39,32:[1,40]},{16:[2,25],17:[2,25],20:42,24:[1,37],25:[1,32],28:[1,33],36:[2,25],37:[2,25],38:[2,25]},{16:[2,23],17:[2,23],36:[2,23],37:[2,23],38:[2,23]},{16:[2,24],17:[2,24],36:[2,24],37:[2,24],38:[2,24]},{16:[2,29],17:[2,29],24:[2,29],25:[2,29],28:[2,29],36:[2,29],37:[2,29],38:[2,29]},{27:[1,43],30:[1,44]},{27:[2,34],29:[2,34],30:[2,34]},{33:[1,45]},{29:[1,46],30:[1,44]},{16:[2,22],17:[2,22],36:[2,22],37:[2,22],38:[2,22]},{16:[2,31],17:[2,31],36:[2,31],37:[2,31],38:[2,31]},{31:47,32:[1,40]},{34:[1,48]},{16:[2,32],17:[2,32],36:[2,32],37:[2,32],38:[2,32]},{27:[2,33],29:[2,33],30:[2,33]},{27:[2,35],29:[2,35],30:[2,35]}],defaultActions:{},parseError:function parseError(str,hash){if(hash.recoverable){this.trace(str)}else{throw new Error(str)}},parse:function parse(input){var self=this,stack=[0],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;this.lexer.setInput(input);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;this.yy.parser=this;if(typeof this.lexer.yylloc=="undefined"){this.lexer.yylloc={}}var yyloc=this.lexer.yylloc;lstack.push(yyloc);var ranges=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function"){this.parseError=this.yy.parseError}else{this.parseError=Object.getPrototypeOf(this).parseError}function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n}function lex(){var token;token=self.lexer.lex()||EOF;if(typeof token!=="number"){token=self.symbols_[token]||token}return token}var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state]}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex()}action=table[state]&&table[state][symbol]}if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";expected=[];for(p in table[state]){if(this.terminals_[p]&&p>TERROR){expected.push("'"+this.terminals_[p]+"'")}}if(this.lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'"}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==EOF?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'")}this.parseError(errStr,{text:this.lexer.match,token:this.terminals_[symbol]||symbol,line:this.lexer.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol)}switch(action[0]){case 1:stack.push(symbol);vstack.push(this.lexer.yytext);lstack.push(this.lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=this.lexer.yyleng;yytext=this.lexer.yytext;yylineno=this.lexer.yylineno;yyloc=this.lexer.yylloc;if(recovering>0){recovering--}}else{symbol=preErrorSymbol;preErrorSymbol=null}break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]}r=this.performAction.call(yyval,yytext,yyleng,yylineno,this.yy,action[1],vstack,lstack);if(typeof r!=="undefined"){return r}if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len)}stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true}}return true}};undefined;function Parser(){this.yy={}}Parser.prototype=parser;parser.Parser=Parser;return new Parser}();if(typeof require!=="undefined"&&typeof exports!=="undefined"){exports.parser=parser;exports.Parser=parser.Parser;exports.parse=function(){return parser.parse.apply(parser,arguments)};exports.main=function commonjsMain(args){if(!args[1]){console.log("Usage: "+args[0]+" FILE");process.exit(1)}var source=require("fs").readFileSync(require("path").normalize(args[1]),"utf8");return exports.parser.parse(source)};if(typeof module!=="undefined"&&require.main===module){exports.main(process.argv.slice(1))}}
\No newline at end of file