2010-02-10 23:24:05 -05:00
|
|
|
/* Jison generated parser */
|
|
|
|
var parser = (function(){
|
|
|
|
var parser = {trace: function trace() { },
|
|
|
|
yy: {},
|
|
|
|
symbols_: {"Root":2,"TERMINATOR":3,"Expressions":4,"Block":5,"Expression":6,"Value":7,"Call":8,"Code":9,"Operation":10,"Assign":11,"If":12,"Try":13,"Throw":14,"Return":15,"While":16,"For":17,"Switch":18,"Extends":19,"Splat":20,"Existence":21,"Comment":22,"INDENT":23,"OUTDENT":24,"Identifier":25,"IDENTIFIER":26,"AlphaNumeric":27,"NUMBER":28,"STRING":29,"Literal":30,"JS":31,"REGEX":32,"BREAK":33,"CONTINUE":34,"ARGUMENTS":35,"TRUE":36,"FALSE":37,"YES":38,"NO":39,"ON":40,"OFF":41,"ASSIGN":42,"AssignObj":43,"RETURN":44,"COMMENT":45,"!":46,"!!":47,"-":48,"+":49,"NOT":50,"~":51,"--":52,"++":53,"DELETE":54,"TYPEOF":55,"*":56,"/":57,"%":58,"<<":59,">>":60,">>>":61,"&":62,"|":63,"^":64,"<=":65,"<":66,">":67,">=":68,"==":69,"!=":70,"IS":71,"ISNT":72,"&&":73,"||":74,"AND":75,"OR":76,"?":77,"-=":78,"+=":79,"/=":80,"*=":81,"%=":82,"||=":83,"&&=":84,"?=":85,"INSTANCEOF":86,"IN":87,"PARAM_START":88,"ParamList":89,"PARAM_END":90,"FuncGlyph":91,"->":92,"=>":93,"Param":94,",":95,"PARAM":96,".":97,"Array":98,"Object":99,"Parenthetical":100,"Range":101,"This":102,"Accessor":103,"Invocation":104,"PROPERTY_ACCESS":105,"PROTOTYPE_ACCESS":106,"SOAK_ACCESS":107,"Index":108,"Slice":109,"INDEX_START":110,"INDEX_END":111,"{":112,"AssignList":113,"}":114,"NEW":115,"Super":116,"EXTENDS":117,"Arguments":118,"CALL_START":119,"ArgList":120,"CALL_END":121,"SUPER":122,"@":123,"[":124,"]":125,"SimpleArgs":126,"TRY":127,"Catch":128,"FINALLY":129,"CATCH":130,"THROW":131,"(":132,")":133,"WHILE":134,"FOR":135,"ForVariables":136,"ForSource":137,"OF":138,"WHEN":139,"BY":140,"SWITCH":141,"Whens":142,"ELSE":143,"When":144,"LEADING_WHEN":145,"IfBlock":146,"IF":147,"ElsIf":148,"ElsIfs":149,"ElseBody":150,"IfEnd":151,"UNLESS":152,"$accept":0,"$end":1},
|
|
|
|
terminals_: ["$end","TERMINATOR","INDENT","OUTDENT","IDENTIFIER","NUMBER","STRING","JS","REGEX","BREAK","CONTINUE","ARGUMENTS","TRUE","FALSE","YES","NO","ON","OFF","ASSIGN","RETURN","COMMENT","!","!!","-","+","NOT","~","--","++","DELETE","TYPEOF","*","/","%","<<",">>",">>>","&","|","^","<=","<",">",">=","==","!=","IS","ISNT","&&","||","AND","OR","?","-=","+=","/=","*=","%=","||=","&&=","?=","INSTANCEOF","IN","PARAM_START","PARAM_END","->","=>",",","PARAM",".","PROPERTY_ACCESS","PROTOTYPE_ACCESS","SOAK_ACCESS","INDEX_START","INDEX_END","{","}","NEW","EXTENDS","CALL_START","CALL_END","SUPER","@","[","]","TRY","FINALLY","CATCH","THROW","(",")","WHILE","FOR","OF","WHEN","BY","SWITCH","ELSE","LEADING_WHEN","IF","UNLESS"],
|
|
|
|
productions_: [0,[2,0],[2,1],[2,1],[2,2],[4,1],[4,3],[4,2],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[5,3],[5,2],[25,1],[27,1],[27,1],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[30,1],[11,3],[43,3],[43,3],[43,1],[15,2],[15,1],[22,1],[10,2],[10,2],[10,2],[10,2],[10,2],[10,2],[10,2],[10,2],[10,2],[10,2],[10,2],[10,2],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[21,2],[9,5],[9,2],[91,1],[91,1],[89,1],[89,3],[94,1],[94,4],[20,4],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,2],[7,2],[103,2],[103,2],[103,2],[103,1],[103,1],[108,3],[99,3],[113,0],[113,1],[113,3],[113,3],[113,4],[113,3],[8,1],[8,2],[8,1],[19,3],[104,2],[104,2],[118,3],[116,4],[102,1],[102,2],[101,6],[101,7],[109,6],[109,7],[98,3],[120,0],[120,1],[120,2],[120,3],[120,3],[120,4],[120,4],[120,2],[126,1],[126,3],[13,3],[13,4],[13,5],[128,3],[14,2],[100,3],[16,3],[16,2],[16,3],[17,4],[17,4],[136,1],[136,3],[137,2],[137,2],[137,3],[137,3],[18,5],[18,7],[142,1],[142,2],[144,3],[144,4],[144,3],[146,3],[148,2],[149,1],[149,2],[150,0],[150,2],[151,1],[151,2],[12,2],[12,3],[12,3]],
|
|
|
|
performAction: function anonymous(yytext,yyleng,yylineno,yy) {
|
|
|
|
|
|
|
|
var $$ = arguments[5],$0=arguments[5].length;
|
|
|
|
switch(arguments[4]) {
|
|
|
|
case 1:return this.$ = new Expressions();
|
|
|
|
break;
|
|
|
|
case 2:return this.$ = new Expressions();
|
|
|
|
break;
|
|
|
|
case 3:return this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 4:return this.$ = $$[$0-2+1-1];
|
|
|
|
break;
|
|
|
|
case 5:this.$ = Expressions.wrap([$$[$0-1+1-1]]);
|
|
|
|
break;
|
|
|
|
case 6:this.$ = $$[$0-3+1-1].push($$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 7:this.$ = $$[$0-2+1-1];
|
|
|
|
break;
|
|
|
|
case 8:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 9:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 10:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 11:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 12:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 13:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 14:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 15:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 16:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 17:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 18:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 19:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 20:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 21:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 22:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 23:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 24:this.$ = $$[$0-3+2-1];
|
|
|
|
break;
|
|
|
|
case 25:this.$ = new Expressions();
|
|
|
|
break;
|
|
|
|
case 26:this.$ = new LiteralNode(yytext);
|
|
|
|
break;
|
|
|
|
case 27:this.$ = new LiteralNode(yytext);
|
|
|
|
break;
|
|
|
|
case 28:this.$ = new LiteralNode(yytext);
|
|
|
|
break;
|
|
|
|
case 29:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 30:this.$ = new LiteralNode(yytext);
|
|
|
|
break;
|
|
|
|
case 31:this.$ = new LiteralNode(yytext);
|
|
|
|
break;
|
|
|
|
case 32:this.$ = new LiteralNode(yytext);
|
|
|
|
break;
|
|
|
|
case 33:this.$ = new LiteralNode(yytext);
|
|
|
|
break;
|
|
|
|
case 34:this.$ = new LiteralNode(yytext);
|
|
|
|
break;
|
|
|
|
case 35:this.$ = new LiteralNode(true);
|
|
|
|
break;
|
|
|
|
case 36:this.$ = new LiteralNode(false);
|
|
|
|
break;
|
|
|
|
case 37:this.$ = new LiteralNode(true);
|
|
|
|
break;
|
|
|
|
case 38:this.$ = new LiteralNode(false);
|
|
|
|
break;
|
|
|
|
case 39:this.$ = new LiteralNode(true);
|
|
|
|
break;
|
|
|
|
case 40:this.$ = new LiteralNode(false);
|
|
|
|
break;
|
|
|
|
case 41:this.$ = new AssignNode($$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 42:this.$ = new AssignNode(new ValueNode($$[$0-3+1-1]), $$[$0-3+3-1], 'object');
|
|
|
|
break;
|
|
|
|
case 43:this.$ = new AssignNode(new ValueNode($$[$0-3+1-1]), $$[$0-3+3-1], 'object');
|
|
|
|
break;
|
|
|
|
case 44:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 45:this.$ = new ReturnNode($$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 46:this.$ = new ReturnNode(new ValueNode(new LiteralNode('null')));
|
|
|
|
break;
|
|
|
|
case 47:this.$ = new CommentNode(yytext);
|
|
|
|
break;
|
|
|
|
case 48:this.$ = new OpNode('!', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 49:this.$ = new OpNode('!!', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 50:this.$ = new OpNode('-', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 51:this.$ = new OpNode('+', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 52:this.$ = new OpNode('not', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 53:this.$ = new OpNode('~', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 54:this.$ = new OpNode('--', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 55:this.$ = new OpNode('++', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 56:this.$ = new OpNode('delete', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 57:this.$ = new OpNode('typeof', $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 58:this.$ = new OpNode('--', $$[$0-2+1-1], null, true);
|
|
|
|
break;
|
|
|
|
case 59:this.$ = new OpNode('++', $$[$0-2+1-1], null, true);
|
|
|
|
break;
|
|
|
|
case 60:this.$ = new OpNode('*', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 61:this.$ = new OpNode('/', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 62:this.$ = new OpNode('%', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 63:this.$ = new OpNode('+', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 64:this.$ = new OpNode('-', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 65:this.$ = new OpNode('<<', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 66:this.$ = new OpNode('>>', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 67:this.$ = new OpNode('>>>', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 68:this.$ = new OpNode('&', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 69:this.$ = new OpNode('|', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 70:this.$ = new OpNode('^', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 71:this.$ = new OpNode('<=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 72:this.$ = new OpNode('<', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 73:this.$ = new OpNode('>', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 74:this.$ = new OpNode('>=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 75:this.$ = new OpNode('==', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 76:this.$ = new OpNode('!=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
2010-02-11 01:57:33 -05:00
|
|
|
case 77:this.$ = new OpNode('is', $$[$0-3+1-1], $$[$0-3+3-1]);
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
2010-02-11 01:57:33 -05:00
|
|
|
case 78:this.$ = new OpNode('isnt', $$[$0-3+1-1], $$[$0-3+3-1]);
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 79:this.$ = new OpNode('&&', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 80:this.$ = new OpNode('||', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
2010-02-11 01:57:33 -05:00
|
|
|
case 81:this.$ = new OpNode('and', $$[$0-3+1-1], $$[$0-3+3-1]);
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
2010-02-11 01:57:33 -05:00
|
|
|
case 82:this.$ = new OpNode('or', $$[$0-3+1-1], $$[$0-3+3-1]);
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 83:this.$ = new OpNode('?', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 84:this.$ = new OpNode('-=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 85:this.$ = new OpNode('+=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 86:this.$ = new OpNode('/=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 87:this.$ = new OpNode('*=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 88:this.$ = new OpNode('%=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 89:this.$ = new OpNode('||=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 90:this.$ = new OpNode('&&=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 91:this.$ = new OpNode('?=', $$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
2010-02-11 01:57:33 -05:00
|
|
|
case 92:this.$ = new OpNode('instanceof', $$[$0-3+1-1], $$[$0-3+3-1]);
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
2010-02-11 01:57:33 -05:00
|
|
|
case 93:this.$ = new OpNode('in', $$[$0-3+1-1], $$[$0-3+3-1]);
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 94:this.$ = new ExistenceNode($$[$0-2+1-1]);
|
|
|
|
break;
|
|
|
|
case 95:this.$ = new CodeNode($$[$0-5+2-1], $$[$0-5+5-1], $$[$0-5+4-1]);
|
|
|
|
break;
|
|
|
|
case 96:this.$ = new CodeNode([], $$[$0-2+2-1], $$[$0-2+1-1]);
|
|
|
|
break;
|
|
|
|
case 97:this.$ = 'func';
|
|
|
|
break;
|
|
|
|
case 98:this.$ = 'boundfunc';
|
|
|
|
break;
|
|
|
|
case 99:this.$ = [$$[$0-1+1-1]];
|
|
|
|
break;
|
|
|
|
case 100:this.$ = $$[$0-3+1-1].concat([$$[$0-3+3-1]]);
|
|
|
|
break;
|
2010-02-12 13:35:34 -05:00
|
|
|
case 101:this.$ = new LiteralNode(yytext);
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 102:this.$ = new SplatNode($$[$0-4+1-1]);
|
|
|
|
break;
|
|
|
|
case 103:this.$ = new SplatNode($$[$0-4+1-1]);
|
|
|
|
break;
|
|
|
|
case 104:this.$ = new ValueNode($$[$0-1+1-1]);
|
|
|
|
break;
|
|
|
|
case 105:this.$ = new ValueNode($$[$0-1+1-1]);
|
|
|
|
break;
|
|
|
|
case 106:this.$ = new ValueNode($$[$0-1+1-1]);
|
|
|
|
break;
|
|
|
|
case 107:this.$ = new ValueNode($$[$0-1+1-1]);
|
|
|
|
break;
|
|
|
|
case 108:this.$ = new ValueNode($$[$0-1+1-1]);
|
|
|
|
break;
|
|
|
|
case 109:this.$ = new ValueNode($$[$0-1+1-1]);
|
|
|
|
break;
|
|
|
|
case 110:this.$ = new ValueNode($$[$0-1+1-1]);
|
|
|
|
break;
|
|
|
|
case 111:this.$ = $$[$0-2+1-1].push($$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 112:this.$ = new ValueNode($$[$0-2+1-1], [$$[$0-2+2-1]]);
|
|
|
|
break;
|
|
|
|
case 113:this.$ = new AccessorNode($$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 114:this.$ = new AccessorNode($$[$0-2+2-1], 'prototype');
|
|
|
|
break;
|
|
|
|
case 115:this.$ = new AccessorNode($$[$0-2+2-1], 'soak');
|
|
|
|
break;
|
|
|
|
case 116:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 117:this.$ = new SliceNode($$[$0-1+1-1]);
|
|
|
|
break;
|
|
|
|
case 118:this.$ = new IndexNode($$[$0-3+2-1]);
|
|
|
|
break;
|
|
|
|
case 119:this.$ = new ObjectNode($$[$0-3+2-1]);
|
|
|
|
break;
|
|
|
|
case 120:this.$ = [];
|
|
|
|
break;
|
|
|
|
case 121:this.$ = [$$[$0-1+1-1]];
|
|
|
|
break;
|
|
|
|
case 122:this.$ = $$[$0-3+1-1].concat([$$[$0-3+3-1]]);
|
|
|
|
break;
|
|
|
|
case 123:this.$ = $$[$0-3+1-1].concat([$$[$0-3+3-1]]);
|
|
|
|
break;
|
|
|
|
case 124:this.$ = $$[$0-4+1-1].concat([$$[$0-4+4-1]]);
|
|
|
|
break;
|
|
|
|
case 125:this.$ = $$[$0-3+2-1];
|
|
|
|
break;
|
|
|
|
case 126:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 127:this.$ = $$[$0-2+2-1].new_instance();
|
|
|
|
break;
|
|
|
|
case 128:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 129:this.$ = new ExtendsNode($$[$0-3+1-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 130:this.$ = new CallNode($$[$0-2+1-1], $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 131:this.$ = new CallNode($$[$0-2+1-1], $$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 132:this.$ = $$[$0-3+2-1];
|
|
|
|
break;
|
|
|
|
case 133:this.$ = new CallNode('super', $$[$0-4+3-1]);
|
|
|
|
break;
|
|
|
|
case 134:this.$ = new ThisNode();
|
|
|
|
break;
|
|
|
|
case 135:this.$ = new ThisNode($$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 136:this.$ = new RangeNode($$[$0-6+2-1], $$[$0-6+5-1]);
|
|
|
|
break;
|
|
|
|
case 137:this.$ = new RangeNode($$[$0-7+2-1], $$[$0-7+6-1], true);
|
|
|
|
break;
|
|
|
|
case 138:this.$ = new RangeNode($$[$0-6+2-1], $$[$0-6+5-1]);
|
|
|
|
break;
|
|
|
|
case 139:this.$ = new RangeNode($$[$0-7+2-1], $$[$0-7+6-1], true);
|
|
|
|
break;
|
|
|
|
case 140:this.$ = new ArrayNode($$[$0-3+2-1]);
|
|
|
|
break;
|
|
|
|
case 141:this.$ = [];
|
|
|
|
break;
|
|
|
|
case 142:this.$ = [$$[$0-1+1-1]];
|
|
|
|
break;
|
|
|
|
case 143:this.$ = [$$[$0-2+2-1]];
|
|
|
|
break;
|
|
|
|
case 144:this.$ = $$[$0-3+1-1].concat([$$[$0-3+3-1]]);
|
|
|
|
break;
|
|
|
|
case 145:this.$ = $$[$0-3+1-1].concat([$$[$0-3+3-1]]);
|
|
|
|
break;
|
|
|
|
case 146:this.$ = $$[$0-4+1-1].concat([$$[$0-4+4-1]]);
|
|
|
|
break;
|
|
|
|
case 147:this.$ = $$[$0-4+1-1].concat([$$[$0-4+4-1]]);
|
|
|
|
break;
|
|
|
|
case 148:this.$ = $$[$0-2+1-1];
|
|
|
|
break;
|
|
|
|
case 149:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 150:this.$ = ([$$[$0-3+1-1]].push($$[$0-3+3-1])).reduce(function(a, b) {
|
2010-02-08 19:49:39 -05:00
|
|
|
return a.concat(b);
|
|
|
|
});
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 151:this.$ = new TryNode($$[$0-3+2-1], $$[$0-3+3-1][0], $$[$0-3+3-1][1]);
|
|
|
|
break;
|
|
|
|
case 152:this.$ = new TryNode($$[$0-4+2-1], null, null, $$[$0-4+4-1]);
|
|
|
|
break;
|
|
|
|
case 153:this.$ = new TryNode($$[$0-5+2-1], $$[$0-5+3-1][0], $$[$0-5+3-1][1], $$[$0-5+5-1]);
|
|
|
|
break;
|
|
|
|
case 154:this.$ = [$$[$0-3+2-1], $$[$0-3+3-1]];
|
|
|
|
break;
|
|
|
|
case 155:this.$ = new ThrowNode($$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 156:this.$ = new ParentheticalNode($$[$0-3+2-1]);
|
|
|
|
break;
|
|
|
|
case 157:this.$ = new WhileNode($$[$0-3+2-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 158:this.$ = new WhileNode($$[$0-2+2-1], null);
|
|
|
|
break;
|
|
|
|
case 159:this.$ = new WhileNode($$[$0-3+3-1], Expressions.wrap([$$[$0-3+1-1]]));
|
|
|
|
break;
|
|
|
|
case 160:this.$ = new ForNode($$[$0-4+1-1], $$[$0-4+4-1], $$[$0-4+3-1][0], $$[$0-4+3-1][1]);
|
|
|
|
break;
|
|
|
|
case 161:this.$ = new ForNode($$[$0-4+4-1], $$[$0-4+3-1], $$[$0-4+2-1][0], $$[$0-4+2-1][1]);
|
|
|
|
break;
|
|
|
|
case 162:this.$ = [$$[$0-1+1-1]];
|
|
|
|
break;
|
|
|
|
case 163:this.$ = [$$[$0-3+1-1], $$[$0-3+3-1]];
|
|
|
|
break;
|
|
|
|
case 164:this.$ = {
|
|
|
|
source: $$[$0-2+2-1]
|
2010-02-08 19:49:39 -05:00
|
|
|
};
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 165:this.$ = {
|
|
|
|
source: $$[$0-2+2-1],
|
2010-02-08 19:49:39 -05:00
|
|
|
object: true
|
|
|
|
};
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 166:this.$ = (function () {
|
|
|
|
$$[$0-3+1-1].filter = $$[$0-3+3-1];
|
|
|
|
return $$[$0-3+1-1];
|
|
|
|
}());
|
|
|
|
break;
|
|
|
|
case 167:this.$ = (function () {
|
|
|
|
$$[$0-3+1-1].step = $$[$0-3+3-1];
|
|
|
|
return $$[$0-3+1-1];
|
|
|
|
}());
|
|
|
|
break;
|
|
|
|
case 168:this.$ = $$[$0-5+4-1].rewrite_condition($$[$0-5+2-1]);
|
|
|
|
break;
|
|
|
|
case 169:this.$ = $$[$0-7+4-1].rewrite_condition($$[$0-7+2-1]).add_else($$[$0-7+6-1]);
|
|
|
|
break;
|
|
|
|
case 170:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 171:this.$ = $$[$0-2+1-1].push($$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 172:this.$ = new IfNode($$[$0-3+2-1], $$[$0-3+3-1], null, {
|
2010-02-08 19:49:39 -05:00
|
|
|
statement: true
|
|
|
|
});
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 173:this.$ = new IfNode($$[$0-4+2-1], $$[$0-4+3-1], null, {
|
2010-02-08 19:49:39 -05:00
|
|
|
statement: true
|
|
|
|
});
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 174:this.$ = $$[$0-3+3-1].comment = $$[$0-3+1-1];
|
|
|
|
break;
|
|
|
|
case 175:this.$ = new IfNode($$[$0-3+2-1], $$[$0-3+3-1]);
|
|
|
|
break;
|
|
|
|
case 176:this.$ = $$[$0-2+2-1].force_statement();
|
|
|
|
break;
|
|
|
|
case 177:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 178:this.$ = $$[$0-2+1-1].add_else($$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 179:this.$ = null;
|
|
|
|
break;
|
|
|
|
case 180:this.$ = $$[$0-2+2-1];
|
|
|
|
break;
|
|
|
|
case 181:this.$ = $$[$0-1+1-1];
|
|
|
|
break;
|
|
|
|
case 182:this.$ = $$[$0-2+1-1].add_else($$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 183:this.$ = $$[$0-2+1-1].add_else($$[$0-2+2-1]);
|
|
|
|
break;
|
|
|
|
case 184:this.$ = new IfNode($$[$0-3+3-1], Expressions.wrap([$$[$0-3+1-1]]), null, {
|
2010-02-08 19:49:39 -05:00
|
|
|
statement: true
|
|
|
|
});
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
case 185:this.$ = new IfNode($$[$0-3+3-1], Expressions.wrap([$$[$0-3+1-1]]), null, {
|
2010-02-08 19:49:39 -05:00
|
|
|
statement: true,
|
|
|
|
invert: true
|
|
|
|
});
|
2010-02-10 23:24:05 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
2010-02-11 23:34:45 -05:00
|
|
|
table: [{"1":[[2,1]],"2":1,"3":[[1,2]],"4":3,"5":4,"6":5,"7":7,"8":8,"9":9,"10":10,"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,"20":20,"21":21,"22":22,"23":[[1,6]],"25":23,"26":[[1,53]],"27":54,"28":[[1,74]],"29":[[1,75]],"30":24,"31":[[1,55]],"32":[[1,56]],"33":[[1,57]],"34":[[1,58]],"35":[[1,59]],"36":[[1,60]],"37":[[1,61]],"38":[[1,62]],"39":[[1,63]],"40":[[1,64]],"41":[[1,65]],"44":[[1,48]],"45":[[1,52]],"46":[[1,35]],"47":[[1,36]],"48":[[1,37]],"49":[[1,38]],"50":[[1,39]],"51":[[1,40]],"52":[[1,41]],"53":[[1,42]],"54":[[1,43]],"55":[[1,44]],"88":[[1,33]],"91":34,"92":[[1,71]],"93":[[1,72]],"98":25,"99":26,"100":27,"101":28,"102":29,"104":30,"112":[[1,67]],"115":[[1,31]],"116":32,"122":[[1,70]],"123":[[1,69]],"124":[[1,66]],"127":[[1,46]],"131":[[1,47]],"132":[[1,68]],"134":[[1,49]],"135":[[1,50]],"141":[[1,51]],"146":45,"147":[[1,73]]},{"1":[[3]]},{"1":[[2,2]]},{"1":[[2,3]],"3":[[1,76]]},{"3":[[1,77]]},{"1":[[2,5]],"3":[[2,5]],"24":[[2,5]],"48":[[1,84]],"49":[[1,83]],"52":[[1,78]],"53":[[1,79]],"56":[[1,80]],"57":[[1,81]],"58":[[1,82]],"59":[[1,85]],"60":[[1,86]],"61":[[1,87]],"62":[[1,88]],"63":[[1,89]],"64":[[1,90]],"65":[[1,91]],"66":[[1,92]],"67":[[1,93]],"68":[[1,94]],"69":[[1,95]],"70":[[1,96]],"71":[[1,97]],"72":[[1,98]],"73":[[1,99]],"74":[[1,100]],"75":[[1,101]],"76":[[1,102]],"77":[[1,103]],"78":[[1,104]],"79":[[1,105]],"80":[[1,106]],"81":[[1,107]],"82":[[1,108]],"83":[[1,109]],"84":[[1,110]],"85":[[1,111]],"86":[[1,112]],"87":[[1,113]],"97":[[1,118]],"134":[[1,116]],"135":[[1,117]],"147":[[1,114]],"152":[[1,115]]},{"4":119,"6":5,"7":7,"8":8,"9":9,"10":10,"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,"20":20,"21":21,"22":22,"24":[[1,120]],"25":23,"26":[[1,53]],"27":54,"28":[[1,74]],"29":[[1,75]],"30":24,"31":[[1,55]],"32":[[1,56]],"33":[[1,57]],"34":[[1,58]],"35":[[1,59]],"36":[[1,60]],"37":[[1,61]],"38":[[1,62]],"39":[[1,63]],"40":[[1,64]],"41":[[1,65]],"44":[[1,48]],"45":[[1,52]],"46":[[1,35]],"47":[[1,36]],"48":[[1,37]],"49":[[1,38]],"50":[[1,39]],"51":[[1,40]],"52":[[1,41]],"53":[[1,42]],"54":[[1,43]],"55":[[1,44]],"88":[[1,33]],"91":34,"92":[[1,71]],"93":[[1,72]],"98":25,"99":26,"100":27,"101":28,"102":29,"104":30,"112":[[1,67]],"115":[[1,31]],"116":32,"122":[[1,70]],"123":[[1,69]],"124":[[1,66]],"127":[[1,46]],"131":[[1,47]],"132":[[1,68]],"134":[[1,49]],"135":[[1,50]],"141":[[1,51]],"146":45,"147":[[1,73]]},{"1":[[2,8]],"3":[[2,8]],"23":[[2,8]],"24":[[2,8]],"42":[[1,122]],"48":[[2,8]],"49":[[2,8]],"52":[[2,8]],"53":[[2,8]],"56":[[2,8]],"57":[[2,8]],"58":[[2,8]],"59":[[2,8]],"60":[[2,8]],"61":[[2,8]],"62":[[2,8]],"63":[[2,8]],"64":[[2,8]],"65":[[2,8]],"66":[[2,8]],"67":[[2,8]],"68":[[2,8]],"69":[[2,8]],"70":[[2,8]],"71":[[2,8]],"72":[[2,8]],"73":[[2,8]],"74":[[2,8]],"75":[[2,8]],"76":[[2,8]],"77":[[2,8]],"78":[[2,8]],"79":[[2,8]],"80":[[2,8]],"81":[[2,8]],"82":[[2,8]],"83":[[2,8]],"84":[[2,8]],"85":[[2,8]],"86":[[2,8]],"87":[[2,8]],"95":[[2,8]],"97":[[2,8]],"103":121,"105":[[1,125]],"106":[[1,126]],"107":[[1,127]],"108":128,"109":129,"110":[[1,131]],"111":[[2,8]],"114":[[2,8]],"117":[[1,123]],"118":124,"119":[[1,130]],"121":[[2,8]],"125":[[2,8]],"133":[[2,8]],"134":[[2,8]],"135":[[2,8]],"139":[[2,8]],"140":[[2,8]],"147":[[2,8]],"152":[[2,8]]},{"1":[[2,9]],"3":[[2,9]],"23":[[2,9]],"24":[[2,9]],"48":[[2,9]],"49":[[2,9]],"52":[[2,9]],"53":[[2,9]],"56":[[2,9]],"57":[[2,9]],"58":[[2,9]],"59":[[2,9]],"60":[[2,9]],"61":[[2,9]],"62":[[2,9]],"63":[[2,9]],"64":[[2,9]],"65":[[2,9]],"66":[[2,9]],"67":[[2,9]],"68":[[2,9]],"69":[[2,9]],"70":[[2,9]],"71":[[2,9]],"72":[[2,9]],"73":[[2,9]],"74":[[2,9]],"75":[[2,9]],"76":[[2,9]],"77":[[2,9]],"78":[[2,9]],"79":[[2,9]],"80":[[2,9]],"81":[[2,9]],"82":[[2,9]],"83":[[2,9]],"84":[[2,9]],"85":[[2,9]],"86":[[2,9]],"87":[[2,9]],"95":[[2,9]],"97":[[2,9]],"111":[[2,9]],"114":[[2,9]],"121":[[2,9]],"125":[[2,9]],"133":[[2,9]],"134":[[2,9]],"135":[[2,9]],"139":[[2,9]],"140":[[2,9]],"147":[[2,9]],"152":[[2,9]]},{"1":[[2,10]],"3":[[2,10]],"23":[[2,10]],"24":[[2,10]],"48":[[2,10]],"49":[[2,10]],"52":[[2,10]],"53":[[2,10]],"56":[[
|
2010-02-10 23:24:05 -05:00
|
|
|
parseError: function parseError(str, hash) {
|
|
|
|
throw new Error(str);
|
|
|
|
},
|
|
|
|
parse: function parse(input) {
|
|
|
|
var self = this,
|
|
|
|
stack = [0],
|
|
|
|
vstack = [null], // semantic value stack
|
|
|
|
table = this.table,
|
|
|
|
yytext = '',
|
|
|
|
yylineno = 0,
|
|
|
|
yyleng = 0,
|
|
|
|
shifts = 0,
|
|
|
|
reductions = 0;
|
|
|
|
|
|
|
|
this.lexer.setInput(input);
|
|
|
|
this.lexer.yy = this.yy;
|
|
|
|
|
|
|
|
var parseError = this.yy.parseError = this.yy.parseError || this.parseError;
|
|
|
|
|
|
|
|
function lex() {
|
|
|
|
var token;
|
|
|
|
token = self.lexer.lex() || 1; // $end = 1
|
|
|
|
// if token isn't its numeric value, convert
|
|
|
|
if (typeof token !== 'number') {
|
|
|
|
token = self.symbols_[token];
|
|
|
|
}
|
|
|
|
return token;
|
|
|
|
};
|
|
|
|
|
|
|
|
var symbol, state, action, a, r, yyval={},p,len,ip=0,newState, expected;
|
2010-02-11 23:34:45 -05:00
|
|
|
symbol = lex();
|
2010-02-10 23:24:05 -05:00
|
|
|
while (true) {
|
|
|
|
// set first input
|
|
|
|
state = stack[stack.length-1];
|
|
|
|
// read action for current state and first input
|
|
|
|
action = table[state] && table[state][symbol];
|
|
|
|
|
|
|
|
if (typeof action == 'undefined' || !action.length || !action[0]) {
|
|
|
|
expected = [];
|
|
|
|
for (p in table[state]) if (this.terminals_[p] && p != 1) {
|
|
|
|
expected.push("'"+this.terminals_[p]+"'");
|
2010-01-30 23:17:36 -05:00
|
|
|
}
|
2010-02-10 23:24:05 -05:00
|
|
|
parseError('Parse error on line '+(yylineno+1)+'. Expecting: '+expected.join(', ')+"\n"+(this.lexer.showPosition && this.lexer.showPosition()),
|
|
|
|
{text: this.lexer.match, token: symbol, line: this.lexer.yylineno});
|
2010-01-30 23:17:36 -05:00
|
|
|
}
|
2010-02-10 23:24:05 -05:00
|
|
|
|
2010-02-12 13:35:34 -05:00
|
|
|
this.trace('action:',action);
|
2010-02-10 23:24:05 -05:00
|
|
|
|
|
|
|
// this shouldn't happen, unless resolve defaults are off
|
|
|
|
if (action.length > 1) {
|
|
|
|
throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
|
|
|
|
}
|
|
|
|
|
2010-02-11 23:34:45 -05:00
|
|
|
a = action[0];
|
2010-02-10 23:24:05 -05:00
|
|
|
|
|
|
|
switch (a[0]) {
|
|
|
|
|
|
|
|
case 1: // shift
|
|
|
|
shifts++;
|
|
|
|
|
|
|
|
stack.push(symbol);++ip;
|
|
|
|
yyleng = this.lexer.yyleng;
|
|
|
|
yytext = this.lexer.yytext;
|
|
|
|
yylineno = this.lexer.yylineno;
|
2010-02-11 23:34:45 -05:00
|
|
|
symbol = lex();
|
2010-02-10 23:24:05 -05:00
|
|
|
vstack.push(null); // semantic values or junk only, no terminals
|
|
|
|
stack.push(a[1]); // push state
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // reduce
|
|
|
|
reductions++;
|
|
|
|
|
|
|
|
len = this.productions_[a[1]][1];
|
|
|
|
|
|
|
|
// perform semantic action
|
|
|
|
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
|
|
|
|
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, a[1], vstack);
|
|
|
|
|
|
|
|
if (typeof r !== 'undefined') {
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
// pop off stack
|
|
|
|
if (len) {
|
|
|
|
stack = stack.slice(0,-1*len*2);
|
|
|
|
vstack = vstack.slice(0, -1*len);
|
|
|
|
}
|
|
|
|
|
|
|
|
stack.push(this.productions_[a[1]][0]); // push nonterminal (reduce)
|
|
|
|
vstack.push(yyval.$);
|
|
|
|
// goto new state = table[STATE][NONTERMINAL]
|
|
|
|
newState = table[stack[stack.length-2]][stack[stack.length-1]];
|
|
|
|
stack.push(newState);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: // accept
|
|
|
|
|
2010-02-12 13:35:34 -05:00
|
|
|
this.reductionCount = reductions;
|
|
|
|
this.shiftCount = shifts;
|
2010-02-10 23:24:05 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-30 23:17:36 -05:00
|
|
|
}
|
2010-02-10 23:24:05 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}};
|
|
|
|
return parser;
|
|
|
|
})();
|
|
|
|
if (typeof require !== 'undefined') {
|
|
|
|
exports.parser = parser;
|
|
|
|
exports.parse = function () { return parser.parse.apply(parser, arguments); }
|
|
|
|
exports.main = function commonjsMain(args) {
|
|
|
|
var cwd = require("file").path(require("file").cwd());
|
|
|
|
if (!args[1])
|
|
|
|
throw new Error('Usage: '+args[0]+' FILE');
|
|
|
|
var source = cwd.join(args[1]).read({charset: "utf-8"});
|
|
|
|
this.parse(source);
|
|
|
|
}
|
|
|
|
if (require.main === module) {
|
|
|
|
exports.main(require("system").args);
|
|
|
|
}
|
2010-02-12 00:15:09 -05:00
|
|
|
}
|