jashkenas--coffeescript/lib/parser.js

530 lines
214 KiB
JavaScript
Raw Normal View History

2010-02-11 04:24:05 +00: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,"TRUE":35,"FALSE":36,"YES":37,"NO":38,"ON":39,"OFF":40,"ASSIGN":41,"AssignObj":42,"RETURN":43,"COMMENT":44,"!":45,"!!":46,"-":47,"+":48,"NOT":49,"~":50,"--":51,"++":52,"DELETE":53,"TYPEOF":54,"*":55,"/":56,"%":57,"<<":58,">>":59,">>>":60,"&":61,"|":62,"^":63,"<=":64,"<":65,">":66,">=":67,"==":68,"!=":69,"IS":70,"ISNT":71,"&&":72,"||":73,"AND":74,"OR":75,"?":76,"-=":77,"+=":78,"/=":79,"*=":80,"%=":81,"||=":82,"&&=":83,"?=":84,"INSTANCEOF":85,"IN":86,"PARAM_START":87,"ParamList":88,"PARAM_END":89,"FuncGlyph":90,"->":91,"=>":92,"Param":93,",":94,"PARAM":95,".":96,"Array":97,"Object":98,"Parenthetical":99,"Range":100,"This":101,"Accessor":102,"Invocation":103,"PROPERTY_ACCESS":104,"PROTOTYPE_ACCESS":105,"SOAK_ACCESS":106,"Index":107,"Slice":108,"INDEX_START":109,"INDEX_END":110,"{":111,"AssignList":112,"}":113,"NEW":114,"Super":115,"EXTENDS":116,"Arguments":117,"CALL_START":118,"ArgList":119,"CALL_END":120,"SUPER":121,"@":122,"[":123,"]":124,"SimpleArgs":125,"TRY":126,"Catch":127,"FINALLY":128,"CATCH":129,"THROW":130,"(":131,")":132,"WHILE":133,"FOR":134,"ForVariables":135,"ForSource":136,"OF":137,"WHEN":138,"BY":139,"SWITCH":140,"Whens":141,"ELSE":142,"When":143,"LEADING_WHEN":144,"IfStart":145,"IF":146,"ElsIfs":147,"IfBlock":148,"ElsIf":149,"UNLESS":150,"$accept":0,"$end":1},
2010-02-13 23:19:59 +00:00
terminals_: {"3":"TERMINATOR","23":"INDENT","24":"OUTDENT","26":"IDENTIFIER","28":"NUMBER","29":"STRING","31":"JS","32":"REGEX","33":"BREAK","34":"CONTINUE","35":"TRUE","36":"FALSE","37":"YES","38":"NO","39":"ON","40":"OFF","41":"ASSIGN","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","89":"PARAM_END","91":"->","92":"=>","94":",","95":"PARAM","96":".","104":"PROPERTY_ACCESS","105":"PROTOTYPE_ACCESS","106":"SOAK_ACCESS","109":"INDEX_START","110":"INDEX_END","111":"{","113":"}","114":"NEW","116":"EXTENDS","118":"CALL_START","120":"CALL_END","121":"SUPER","122":"@","123":"[","124":"]","126":"TRY","128":"FINALLY","129":"CATCH","130":"THROW","131":"(","132":")","133":"WHILE","134":"FOR","137":"OF","138":"WHEN","139":"BY","140":"SWITCH","142":"ELSE","144":"LEADING_WHEN","146":"IF","149":"ElsIf","150":"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],[11,3],[42,3],[42,3],[42,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],[90,1],[90,1],[88,0],[88,1],[88,3],[93,1],[93,4],[20,4],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,2],[7,2],[102,2],[102,2],[102,2],[102,1],[102,1],[107,3],[98,3],[112,0],[112,1],[112,3],[112,3],[112,4],[112,3],[8,1],[8,2],[8,1],[19,3],[103,2],[103,2],[117,3],[115,4],[101,1],[101,2],[100,6],[100,7],[108,6],[108,7],[97,3],[119,0],[119,1],[119,2],[119,3],[119,3],[119,4],[119,4],[119,2],[125,1],[125,3],[13,3],[13,4],[13,5],[127,3],[14,2],[99,3],[16,3],[16,2],[16,3],[17,4],[17,4],[135,1],[135,3],[136,2],[136,2],[136,3],[136,3],[18,5],[18,7],[141,1],[141,2],[143,3],[143,4],[143,3],[145,3],[145,2],[148,1],[148,3],[147,4],[147,2],[12,1],[12,3],[12,3]],
2010-02-11 04:24:05 +00:00
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(true);
2010-02-11 04:24:05 +00:00
break;
case 35:this.$ = new LiteralNode(false);
2010-02-11 04:24:05 +00:00
break;
case 36:this.$ = new LiteralNode(true);
2010-02-11 04:24:05 +00:00
break;
case 37:this.$ = new LiteralNode(false);
2010-02-11 04:24:05 +00:00
break;
case 38:this.$ = new LiteralNode(true);
2010-02-11 04:24:05 +00:00
break;
case 39:this.$ = new LiteralNode(false);
2010-02-11 04:24:05 +00:00
break;
case 40:this.$ = new AssignNode($$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 41:this.$ = new AssignNode(new ValueNode($$[$0-3+1-1]), $$[$0-3+3-1], 'object');
2010-02-11 04:24:05 +00:00
break;
case 42:this.$ = new AssignNode(new ValueNode($$[$0-3+1-1]), $$[$0-3+3-1], 'object');
break;
case 43:this.$ = $$[$0-1+1-1];
2010-02-11 04:24:05 +00:00
break;
case 44:this.$ = new ReturnNode($$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 45:this.$ = new ReturnNode(new ValueNode(new LiteralNode('null')));
2010-02-11 04:24:05 +00:00
break;
case 46:this.$ = new CommentNode(yytext);
2010-02-11 04:24:05 +00:00
break;
case 47:this.$ = new OpNode('!', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 48:this.$ = new OpNode('!!', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 49:this.$ = new OpNode('-', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 50:this.$ = new OpNode('+', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 51:this.$ = new OpNode('not', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 52:this.$ = new OpNode('~', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 53:this.$ = new OpNode('--', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 54:this.$ = new OpNode('++', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 55:this.$ = new OpNode('delete', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 56:this.$ = new OpNode('typeof', $$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 57:this.$ = new OpNode('--', $$[$0-2+1-1], null, true);
2010-02-11 04:24:05 +00:00
break;
case 58:this.$ = new OpNode('++', $$[$0-2+1-1], null, true);
2010-02-11 04:24:05 +00:00
break;
case 59:this.$ = new OpNode('*', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 60:this.$ = new OpNode('/', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 61:this.$ = new OpNode('%', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 62:this.$ = new OpNode('+', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 63:this.$ = new OpNode('-', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 64:this.$ = new OpNode('<<', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 65:this.$ = new OpNode('>>', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 66:this.$ = new OpNode('>>>', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 67:this.$ = new OpNode('&', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 68:this.$ = new OpNode('|', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 69:this.$ = new OpNode('^', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 70:this.$ = new OpNode('<=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 71:this.$ = new OpNode('<', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 72:this.$ = new OpNode('>', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 73:this.$ = new OpNode('>=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 74:this.$ = new OpNode('==', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 75:this.$ = new OpNode('!=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 76:this.$ = new OpNode('is', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 77:this.$ = new OpNode('isnt', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 78:this.$ = new OpNode('&&', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 79:this.$ = new OpNode('||', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 80:this.$ = new OpNode('and', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 81:this.$ = new OpNode('or', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 82:this.$ = new OpNode('?', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 83:this.$ = new OpNode('-=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 84:this.$ = new OpNode('+=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 85:this.$ = new OpNode('/=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 86:this.$ = new OpNode('*=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 87:this.$ = new OpNode('%=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 88:this.$ = new OpNode('||=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 89:this.$ = new OpNode('&&=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 90:this.$ = new OpNode('?=', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 91:this.$ = new OpNode('instanceof', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 92:this.$ = new OpNode('in', $$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 93:this.$ = new ExistenceNode($$[$0-2+1-1]);
2010-02-11 04:24:05 +00:00
break;
case 94:this.$ = new CodeNode($$[$0-5+2-1], $$[$0-5+5-1], $$[$0-5+4-1]);
2010-02-11 04:24:05 +00:00
break;
case 95:this.$ = new CodeNode([], $$[$0-2+2-1], $$[$0-2+1-1]);
2010-02-11 04:24:05 +00:00
break;
case 96:this.$ = 'func';
2010-02-11 04:24:05 +00:00
break;
case 97:this.$ = 'boundfunc';
2010-02-11 04:24:05 +00:00
break;
case 98:this.$ = [];
2010-02-11 04:24:05 +00:00
break;
case 99:this.$ = [$$[$0-1+1-1]];
2010-02-11 04:24:05 +00:00
break;
case 100:this.$ = $$[$0-3+1-1].concat([$$[$0-3+3-1]]);
2010-02-11 04:24:05 +00:00
break;
case 101:this.$ = new LiteralNode(yytext);
2010-02-11 04:24:05 +00:00
break;
case 102:this.$ = new SplatNode($$[$0-4+1-1]);
break;
case 103:this.$ = new SplatNode($$[$0-4+1-1]);
2010-02-11 04:24:05 +00:00
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.$ = $$[$0-1+1-1];
2010-02-11 04:24:05 +00:00
break;
case 111:this.$ = $$[$0-2+1-1].push($$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 112:this.$ = new ValueNode($$[$0-2+1-1], [$$[$0-2+2-1]]);
2010-02-11 04:24:05 +00:00
break;
case 113:this.$ = new AccessorNode($$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 114:this.$ = new AccessorNode($$[$0-2+2-1], 'prototype');
2010-02-11 04:24:05 +00:00
break;
case 115:this.$ = new AccessorNode($$[$0-2+2-1], 'soak');
2010-02-11 04:24:05 +00:00
break;
case 116:this.$ = $$[$0-1+1-1];
2010-02-11 04:24:05 +00:00
break;
case 117:this.$ = new SliceNode($$[$0-1+1-1]);
2010-02-11 04:24:05 +00:00
break;
case 118:this.$ = new IndexNode($$[$0-3+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 119:this.$ = new ObjectNode($$[$0-3+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 120:this.$ = [];
2010-02-11 04:24:05 +00:00
break;
case 121:this.$ = [$$[$0-1+1-1]];
2010-02-11 04:24:05 +00:00
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]]);
2010-02-11 04:24:05 +00:00
break;
case 124:this.$ = $$[$0-4+1-1].concat([$$[$0-4+4-1]]);
2010-02-11 04:24:05 +00:00
break;
case 125:this.$ = $$[$0-3+2-1];
2010-02-11 04:24:05 +00:00
break;
case 126:this.$ = $$[$0-1+1-1];
2010-02-11 04:24:05 +00:00
break;
case 127:this.$ = $$[$0-2+2-1].new_instance();
2010-02-11 04:24:05 +00:00
break;
case 128:this.$ = $$[$0-1+1-1];
2010-02-11 04:24:05 +00:00
break;
case 129:this.$ = new ExtendsNode($$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
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]);
2010-02-11 04:24:05 +00:00
break;
case 132:this.$ = $$[$0-3+2-1];
2010-02-11 04:24:05 +00:00
break;
case 133:this.$ = new CallNode('super', $$[$0-4+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 134:this.$ = new ValueNode(new LiteralNode('this'));
2010-02-11 04:24:05 +00:00
break;
case 135:this.$ = new ValueNode(new LiteralNode('this'), [new AccessorNode($$[$0-2+2-1])]);
2010-02-11 04:24:05 +00:00
break;
case 136:this.$ = new RangeNode($$[$0-6+2-1], $$[$0-6+5-1]);
2010-02-11 04:24:05 +00:00
break;
case 137:this.$ = new RangeNode($$[$0-7+2-1], $$[$0-7+6-1], true);
2010-02-11 04:24:05 +00:00
break;
case 138:this.$ = new RangeNode($$[$0-6+2-1], $$[$0-6+5-1]);
2010-02-11 04:24:05 +00:00
break;
case 139:this.$ = new RangeNode($$[$0-7+2-1], $$[$0-7+6-1], true);
2010-02-11 04:24:05 +00:00
break;
case 140:this.$ = new ArrayNode($$[$0-3+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 141:this.$ = [];
2010-02-11 04:24:05 +00:00
break;
case 142:this.$ = [$$[$0-1+1-1]];
2010-02-11 04:24:05 +00:00
break;
case 143:this.$ = [$$[$0-2+2-1]];
2010-02-11 04:24:05 +00:00
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]]);
2010-02-11 04:24:05 +00:00
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]]);
2010-02-11 04:24:05 +00:00
break;
case 148:this.$ = $$[$0-2+1-1];
2010-02-11 04:24:05 +00:00
break;
case 149:this.$ = $$[$0-1+1-1];
2010-02-11 04:24:05 +00:00
break;
case 150:this.$ = $$[$0-3+1-1] instanceof Array ? $$[$0-3+1-1].concat([$$[$0-3+3-1]]) : [$$[$0-3+1-1]].concat([$$[$0-3+3-1]]);
2010-02-11 04:24:05 +00:00
break;
case 151:this.$ = new TryNode($$[$0-3+2-1], $$[$0-3+3-1][0], $$[$0-3+3-1][1]);
2010-02-11 04:24:05 +00:00
break;
case 152:this.$ = new TryNode($$[$0-4+2-1], null, null, $$[$0-4+4-1]);
2010-02-11 04:24:05 +00:00
break;
case 153:this.$ = new TryNode($$[$0-5+2-1], $$[$0-5+3-1][0], $$[$0-5+3-1][1], $$[$0-5+5-1]);
2010-02-11 04:24:05 +00:00
break;
case 154:this.$ = [$$[$0-3+2-1], $$[$0-3+3-1]];
2010-02-11 04:24:05 +00:00
break;
case 155:this.$ = new ThrowNode($$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 156:this.$ = new ParentheticalNode($$[$0-3+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 157:this.$ = new WhileNode($$[$0-3+2-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 158:this.$ = new WhileNode($$[$0-2+2-1], null);
2010-02-11 04:24:05 +00:00
break;
case 159:this.$ = new WhileNode($$[$0-3+3-1], Expressions.wrap([$$[$0-3+1-1]]));
2010-02-11 04:24:05 +00:00
break;
case 160:this.$ = new ForNode($$[$0-4+1-1], $$[$0-4+4-1], $$[$0-4+3-1][0], $$[$0-4+3-1][1]);
2010-02-11 04:24:05 +00:00
break;
case 161:this.$ = new ForNode($$[$0-4+4-1], $$[$0-4+3-1], $$[$0-4+2-1][0], $$[$0-4+2-1][1]);
2010-02-11 04:24:05 +00:00
break;
case 162:this.$ = [$$[$0-1+1-1]];
2010-02-11 04:24:05 +00:00
break;
case 163:this.$ = [$$[$0-3+1-1], $$[$0-3+3-1]];
break;
case 164:this.$ = {
2010-02-11 04:24:05 +00:00
source: $$[$0-2+2-1]
};
2010-02-11 04:24:05 +00:00
break;
case 165:this.$ = {
2010-02-11 04:24:05 +00:00
source: $$[$0-2+2-1],
object: true
};
2010-02-11 04:24:05 +00:00
break;
case 166:this.$ = (function () {
2010-02-11 04:24:05 +00:00
$$[$0-3+1-1].filter = $$[$0-3+3-1];
return $$[$0-3+1-1];
}());
break;
case 167:this.$ = (function () {
2010-02-11 04:24:05 +00:00
$$[$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]);
2010-02-11 04:24:05 +00:00
break;
case 169:this.$ = $$[$0-7+4-1].rewrite_condition($$[$0-7+2-1]).add_else($$[$0-7+6-1]);
2010-02-11 04:24:05 +00:00
break;
case 170:this.$ = $$[$0-1+1-1];
2010-02-11 04:24:05 +00:00
break;
case 171:this.$ = $$[$0-2+1-1].push($$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 172:this.$ = new IfNode($$[$0-3+2-1], $$[$0-3+3-1], null, {
statement: true
});
2010-02-11 04:24:05 +00:00
break;
case 173:this.$ = new IfNode($$[$0-4+2-1], $$[$0-4+3-1], null, {
statement: true
});
2010-02-11 04:24:05 +00:00
break;
case 174:this.$ = (function () {
2010-02-12 21:26:28 +00:00
$$[$0-3+3-1].comment = $$[$0-3+1-1];
return $$[$0-3+3-1];
}());
2010-02-11 04:24:05 +00:00
break;
case 175:this.$ = new IfNode($$[$0-3+2-1], $$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 176:this.$ = $$[$0-2+1-1].add_else($$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 177:this.$ = $$[$0-1+1-1];
2010-02-11 04:24:05 +00:00
break;
case 178:this.$ = $$[$0-3+1-1].add_else($$[$0-3+3-1]);
2010-02-11 04:24:05 +00:00
break;
case 179:this.$ = (new IfNode($$[$0-4+3-1], $$[$0-4+4-1])).force_statement();
2010-02-11 04:24:05 +00:00
break;
case 180:this.$ = $$[$0-2+1-1].add_else($$[$0-2+2-1]);
2010-02-11 04:24:05 +00:00
break;
case 181:this.$ = $$[$0-1+1-1];
2010-02-11 04:24:05 +00:00
break;
case 182:this.$ = new IfNode($$[$0-3+3-1], Expressions.wrap([$$[$0-3+1-1]]), null, {
statement: true
});
2010-02-11 04:24:05 +00:00
break;
case 183:this.$ = new IfNode($$[$0-3+3-1], Expressions.wrap([$$[$0-3+1-1]]), null, {
statement: true,
invert: true
});
2010-02-11 04:24:05 +00:00
break;
}
},
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,73]],"29":[[1,74]],"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]],"43":[[1,48]],"44":[[1,52]],"45":[[1,35]],"46":[[1,36]],"47":[[1,37]],"48":[[1,38]],"49":[[1,39]],"50":[[1,40]],"51":[[1,41]],"52":[[1,42]],"53":[[1,43]],"54":[[1,44]],"87":[[1,33]],"90":34,"91":[[1,70]],"92":[[1,71]],"97":25,"98":26,"99":27,"100":28,"101":29,"103":30,"111":[[1,66]],"114":[[1,31]],"115":32,"121":[[1,69]],"122":[[1,68]],"123":[[1,65]],"126":[[1,46]],"130":[[1,47]],"131":[[1,67]],"133":[[1,49]],"134":[[1,50]],"140":[[1,51]],"145":72,"146":[[1,75]],"148":45},{"1":[[3]]},{"1":[[2,2]]},{"1":[[2,3]],"3":[[1,76]]},{"3":[[1,77]]},{"1":[[2,5]],"3":[[2,5]],"24":[[2,5]],"47":[[1,84]],"48":[[1,83]],"51":[[1,78]],"52":[[1,79]],"55":[[1,80]],"56":[[1,81]],"57":[[1,82]],"58":[[1,85]],"59":[[1,86]],"60":[[1,87]],"61":[[1,88]],"62":[[1,89]],"63":[[1,90]],"64":[[1,91]],"65":[[1,92]],"66":[[1,93]],"67":[[1,94]],"68":[[1,95]],"69":[[1,96]],"70":[[1,97]],"71":[[1,98]],"72":[[1,99]],"73":[[1,100]],"74":[[1,101]],"75":[[1,102]],"76":[[1,103]],"77":[[1,104]],"78":[[1,105]],"79":[[1,106]],"80":[[1,107]],"81":[[1,108]],"82":[[1,109]],"83":[[1,110]],"84":[[1,111]],"85":[[1,112]],"86":[[1,113]],"96":[[1,118]],"133":[[1,116]],"134":[[1,117]],"146":[[1,114]],"150":[[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,73]],"29":[[1,74]],"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]],"43":[[1,48]],"44":[[1,52]],"45":[[1,35]],"46":[[1,36]],"47":[[1,37]],"48":[[1,38]],"49":[[1,39]],"50":[[1,40]],"51":[[1,41]],"52":[[1,42]],"53":[[1,43]],"54":[[1,44]],"87":[[1,33]],"90":34,"91":[[1,70]],"92":[[1,71]],"97":25,"98":26,"99":27,"100":28,"101":29,"103":30,"111":[[1,66]],"114":[[1,31]],"115":32,"121":[[1,69]],"122":[[1,68]],"123":[[1,65]],"126":[[1,46]],"130":[[1,47]],"131":[[1,67]],"133":[[1,49]],"134":[[1,50]],"140":[[1,51]],"145":72,"146":[[1,75]],"148":45},{"1":[[2,8]],"3":[[2,8]],"23":[[2,8]],"24":[[2,8]],"41":[[1,122]],"47":[[2,8]],"48":[[2,8]],"51":[[2,8]],"52":[[2,8]],"55":[[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]],"94":[[2,8]],"96":[[2,8]],"102":121,"104":[[1,125]],"105":[[1,126]],"106":[[1,127]],"107":128,"108":129,"109":[[1,131]],"110":[[2,8]],"113":[[2,8]],"116":[[1,123]],"117":124,"118":[[1,130]],"120":[[2,8]],"124":[[2,8]],"132":[[2,8]],"133":[[2,8]],"134":[[2,8]],"138":[[2,8]],"139":[[2,8]],"146":[[2,8]],"150":[[2,8]]},{"1":[[2,9]],"3":[[2,9]],"23":[[2,9]],"24":[[2,9]],"47":[[2,9]],"48":[[2,9]],"51":[[2,9]],"52":[[2,9]],"55":[[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]],"94":[[2,9]],"96":[[2,9]],"110":[[2,9]],"113":[[2,9]],"120":[[2,9]],"124":[[2,9]],"132":[[2,9]],"133":[[2,9]],"134":[[2,9]],"138":[[2,9]],"139":[[2,9]],"146":[[2,9]],"150":[[2,9]]},{"1":[[2,10]],"3":[[2,10]],"23":[[2,10]],"24":[[2,10]],"47":[[2,10]],"48":[[2,10]],"51":[[2,10]],"52":[[2,10]],"55":[[2,10]],"56":
2010-02-11 04:24:05 +00: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;
symbol = lex();
2010-02-11 04:24:05 +00: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-31 04:17:36 +00:00
}
2010-02-13 23:19:59 +00:00
if (this.lexer.showPosition) {
parseError('Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', '),
{text: this.lexer.match, token: this.terminals_[symbol], line: this.lexer.yylineno, expected: expected});
} else {
parseError('Parse error on line '+(yylineno+1)+": Unexpected '"+this.terminals_[symbol]+"'",
{text: this.lexer.match, token: this.terminals_[symbol], line: this.lexer.yylineno, expected: expected});
}
2010-01-31 04:17:36 +00:00
}
2010-02-11 04:24:05 +00:00
this.trace('action:',action);
2010-02-11 04:24:05 +00: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);
}
a = action[0];
2010-02-11 04:24:05 +00:00
switch (a[0]) {
case 1: // shift
shifts++;
stack.push(symbol);++ip;
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
symbol = lex();
2010-02-11 04:24:05 +00: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
this.reductionCount = reductions;
this.shiftCount = shifts;
2010-02-11 04:24:05 +00:00
return true;
}
2010-01-31 04:17:36 +00:00
}
2010-02-11 04:24:05 +00: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-13 03:16:26 +00:00
}