1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
jashkenas--coffeescript/lib/parser.js

687 lines
129 KiB
JavaScript
Raw Normal View History

2010-02-10 23:24:05 -05:00
/* Jison generated parser */
var parser = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"Root":3,"TERMINATOR":4,"Body":5,"Block":6,"Line":7,"Expression":8,"Statement":9,"Return":10,"Throw":11,"BREAK":12,"CONTINUE":13,"DEBUGGER":14,"Value":15,"Invocation":16,"Code":17,"Operation":18,"Assign":19,"If":20,"Try":21,"While":22,"For":23,"Switch":24,"Extends":25,"Class":26,"Comment":27,"INDENT":28,"OUTDENT":29,"Identifier":30,"IDENTIFIER":31,"AlphaNumeric":32,"NUMBER":33,"STRING":34,"Literal":35,"JS":36,"REGEX":37,"BOOL":38,"Assignable":39,"=":40,"AssignObj":41,"ObjAssignable":42,":":43,"ThisProperty":44,"Parenthetical":45,"RETURN":46,"HERECOMMENT":47,"PARAM_START":48,"ParamList":49,"PARAM_END":50,"FuncGlyph":51,"->":52,"=>":53,"OptComma":54,",":55,"Param":56,"PARAM":57,"...":58,"@":59,"Splat":60,"SimpleAssignable":61,"Accessor":62,"Array":63,"Object":64,"This":65,".":66,"?.":67,"::":68,"Index":69,"INDEX_START":70,"INDEX_END":71,"INDEX_SOAK":72,"INDEX_PROTO":73,"{":74,"AssignList":75,"}":76,"CLASS":77,"EXTENDS":78,"ClassBody":79,"ClassAssign":80,"OptFuncExist":81,"Arguments":82,"SUPER":83,"FUNC_EXIST":84,"CALL_START":85,"CALL_END":86,"ArgList":87,"THIS":88,"[":89,"]":90,"Arg":91,"SimpleArgs":92,"TRY":93,"Catch":94,"FINALLY":95,"CATCH":96,"THROW":97,"(":98,")":99,"WhileSource":100,"WHILE":101,"WHEN":102,"UNTIL":103,"Loop":104,"LOOP":105,"ForBody":106,"ForValue":107,"ForIn":108,"FORIN":109,"BY":110,"ForOf":111,"FOROF":112,"ForTo":113,"TO":114,"FOR":115,"ALL":116,"FROM":117,"SWITCH":118,"Whens":119,"ELSE":120,"When":121,"LEADING_WHEN":122,"IfBlock":123,"IF":124,"UNLESS":125,"POST_IF":126,"POST_UNLESS":127,"UNARY":128,"-":129,"+":130,"--":131,"++":132,"?":133,"MATH":134,"SHIFT":135,"COMPARE":136,"LOGIC":137,"RELATION":138,"COMPOUND_ASSIGN":139,"$accept":0,"$end":1},
terminals_: {"2":"error","4":"TERMINATOR","12":"BREAK","13":"CONTINUE","14":"DEBUGGER","28":"INDENT","29":"OUTDENT","31":"IDENTIFIER","33":"NUMBER","34":"STRING","36":"JS","37":"REGEX","38":"BOOL","40":"=","43":":","46":"RETURN","47":"HERECOMMENT","48":"PARAM_START","50":"PARAM_END","52":"->","53":"=>","55":",","57":"PARAM","58":"...","59":"@","66":".","67":"?.","68":"::","70":"INDEX_START","71":"INDEX_END","72":"INDEX_SOAK","73":"INDEX_PROTO","74":"{","76":"}","77":"CLASS","78":"EXTENDS","83":"SUPER","84":"FUNC_EXIST","85":"CALL_START","86":"CALL_END","88":"THIS","89":"[","90":"]","93":"TRY","95":"FINALLY","96":"CATCH","97":"THROW","98":"(","99":")","101":"WHILE","102":"WHEN","103":"UNTIL","105":"LOOP","109":"FORIN","110":"BY","112":"FOROF","114":"TO","115":"FOR","116":"ALL","117":"FROM","118":"SWITCH","120":"ELSE","122":"LEADING_WHEN","124":"IF","125":"UNLESS","126":"POST_IF","127":"POST_UNLESS","128":"UNARY","129":"-","130":"+","131":"--","132":"++","133":"?","134":"MATH","135":"SHIFT","136":"COMPARE","137":"LOGIC","138":"RELATION","139":"COMPOUND_ASSIGN"},
productions_: [0,[3,0],[3,1],[3,1],[3,2],[5,1],[5,3],[5,2],[7,1],[7,1],[9,1],[9,1],[9,1],[9,1],[9,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[6,3],[6,2],[6,2],[30,1],[32,1],[32,1],[35,1],[35,1],[35,1],[35,1],[19,3],[19,5],[41,1],[41,3],[41,5],[41,1],[41,1],[42,1],[42,1],[42,1],[10,2],[10,1],[27,1],[17,5],[17,2],[51,1],[51,1],[54,0],[54,1],[49,0],[49,1],[49,3],[56,1],[56,2],[56,2],[56,3],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[15,1],[15,1],[15,1],[15,1],[62,2],[62,2],[62,2],[62,1],[62,1],[69,3],[69,2],[69,2],[64,4],[75,0],[75,1],[75,3],[75,4],[75,6],[26,2],[26,4],[26,5],[26,7],[26,4],[26,1],[26,3],[26,6],[80,1],[80,3],[80,5],[79,0],[79,1],[79,3],[79,3],[25,3],[16,3],[16,3],[16,1],[16,2],[81,0],[81,1],[82,2],[82,4],[65,1],[65,1],[44,2],[63,2],[63,4],[87,1],[87,3],[87,4],[87,4],[87,6],[91,1],[91,1],[92,1],[92,3],[21,2],[21,3],[21,4],[21,5],[94,3],[11,2],[45,3],[100,2],[100,4],[100,2],[100,4],[22,2],[22,2],[22,2],[22,1],[104,2],[104,2],[23,2],[23,2],[23,2],[107,1],[107,1],[107,1],[108,2],[108,4],[108,4],[108,6],[111,2],[111,4],[113,2],[113,4],[113,4],[113,6],[106,3],[106,5],[106,3],[106,5],[106,4],[106,6],[106,5],[24,5],[24,7],[24,4],[24,6],[119,1],[119,2],[121,3],[121,4],[123,3],[123,3],[123,5],[123,3],[20,1],[20,3],[20,3],[20,3],[20,3],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,5]],
2010-02-10 23:24:05 -05:00
performAction: function anonymous(yytext,yyleng,yylineno,yy) {
var $$ = arguments[5],$0=arguments[5].length;
switch(arguments[4]) {
case 1:return this.$ = new yy.Expressions;
2010-02-10 23:24:05 -05:00
break;
case 2:return this.$ = new yy.Expressions;
2010-02-10 23:24:05 -05:00
break;
case 3:return this.$ = $$[$0-1+1-1];
break;
case 4:return this.$ = $$[$0-2+1-1];
break;
2010-09-21 03:50:32 -04:00
case 5:this.$ = yy.Expressions.wrap([$$[$0-1+1-1]]);
2010-02-10 23:24:05 -05:00
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.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 13:this.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 14:this.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
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-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 25:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 26:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
2010-04-05 10:26:23 -04:00
case 27:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 28:this.$ = $$[$0-3+2-1];
2010-02-10 23:24:05 -05:00
break;
case 29:this.$ = new yy.Expressions;
2010-02-10 23:24:05 -05:00
break;
case 30:this.$ = yy.Expressions.wrap([$$[$0-2+2-1]]);
2010-02-10 23:24:05 -05:00
break;
case 31:this.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
2010-10-24 20:34:50 -04:00
case 32:this.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 33:this.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 34:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 35:this.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
2010-10-24 20:34:50 -04:00
case 36:this.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 37:this.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 38:this.$ = new yy.Assign($$[$0-3+1-1], $$[$0-3+3-1]);
2010-02-10 23:24:05 -05:00
break;
case 39:this.$ = new yy.Assign($$[$0-5+1-1], $$[$0-5+4-1]);
2010-02-10 23:24:05 -05:00
break;
case 40:this.$ = new yy.Value($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 41:this.$ = new yy.Assign(new yy.Value($$[$0-3+1-1]), $$[$0-3+3-1], 'object');
2010-02-10 23:24:05 -05:00
break;
case 42:this.$ = new yy.Assign(new yy.Value($$[$0-5+1-1]), $$[$0-5+4-1], 'object');
2010-02-10 23:24:05 -05:00
break;
case 43:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
2010-10-24 20:34:50 -04:00
case 44:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
2010-10-24 01:05:31 -04:00
case 45:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
2010-10-24 01:05:31 -04:00
case 46:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
2010-10-24 01:05:31 -04:00
case 47:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 48:this.$ = new yy.Return($$[$0-2+2-1]);
2010-02-10 23:24:05 -05:00
break;
case 49:this.$ = new yy.Return;
2010-02-10 23:24:05 -05:00
break;
case 50:this.$ = new yy.Comment($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 51:this.$ = new yy.Code($$[$0-5+2-1], $$[$0-5+5-1], $$[$0-5+4-1]);
2010-02-10 23:24:05 -05:00
break;
case 52:this.$ = new yy.Code([], $$[$0-2+2-1], $$[$0-2+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 53:this.$ = 'func';
2010-02-10 23:24:05 -05:00
break;
case 54:this.$ = 'boundfunc';
2010-02-10 23:24:05 -05:00
break;
case 55:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 56:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 57:this.$ = [];
2010-02-10 23:24:05 -05:00
break;
case 58:this.$ = [$$[$0-1+1-1]];
2010-02-10 23:24:05 -05:00
break;
case 59:this.$ = $$[$0-3+1-1].concat($$[$0-3+3-1]);
2010-02-10 23:24:05 -05:00
break;
case 60:this.$ = new yy.Literal($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 61:this.$ = new yy.Param($$[$0-2+1-1], false, true);
2010-02-10 23:24:05 -05:00
break;
case 62:this.$ = new yy.Param($$[$0-2+2-1], true);
2010-02-10 23:24:05 -05:00
break;
case 63:this.$ = new yy.Param($$[$0-3+2-1], true, true);
2010-02-10 23:24:05 -05:00
break;
case 64:this.$ = new yy.Splat($$[$0-2+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 65:this.$ = new yy.Value($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 66:this.$ = $$[$0-2+1-1].push($$[$0-2+2-1]);
2010-02-10 23:24:05 -05:00
break;
case 67:this.$ = new yy.Value($$[$0-2+1-1], [$$[$0-2+2-1]]);
2010-02-10 23:24:05 -05:00
break;
case 68:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 69:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 70:this.$ = new yy.Value($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 71:this.$ = new yy.Value($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 72:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
2010-10-24 20:34:50 -04:00
case 73:this.$ = new yy.Value($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 74:this.$ = new yy.Value($$[$0-1+1-1]);
2010-02-10 23:24:05 -05:00
break;
case 75:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 76:this.$ = new yy.Accessor($$[$0-2+2-1]);
2010-02-10 23:24:05 -05:00
break;
case 77:this.$ = new yy.Accessor($$[$0-2+2-1], 'soak');
2010-02-10 23:24:05 -05:00
break;
case 78:this.$ = new yy.Accessor($$[$0-2+2-1], 'proto');
2010-02-10 23:24:05 -05:00
break;
case 79:this.$ = new yy.Accessor(new yy.Literal('prototype'));
2010-02-10 23:24:05 -05:00
break;
case 80:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 81:this.$ = new yy.Index($$[$0-3+2-1]);
2010-02-10 23:24:05 -05:00
break;
case 82:this.$ = yy.extend($$[$0-2+2-1], {
2010-10-25 09:31:52 -04:00
soak: true
});
break;
case 83:this.$ = yy.extend($$[$0-2+2-1], {
proto: true
});
2010-02-10 23:24:05 -05:00
break;
case 84:this.$ = new yy.Obj($$[$0-4+2-1]);
2010-02-10 23:24:05 -05:00
break;
case 85:this.$ = [];
2010-02-10 23:24:05 -05:00
break;
case 86:this.$ = [$$[$0-1+1-1]];
2010-02-10 23:24:05 -05:00
break;
case 87:this.$ = $$[$0-3+1-1].concat($$[$0-3+3-1]);
2010-02-10 23:24:05 -05:00
break;
case 88:this.$ = $$[$0-4+1-1].concat($$[$0-4+4-1]);
2010-02-10 23:24:05 -05:00
break;
case 89:this.$ = $$[$0-6+1-1].concat($$[$0-6+4-1]);
2010-02-10 23:24:05 -05:00
break;
case 90:this.$ = new yy.Class($$[$0-2+2-1]);
2010-02-10 23:24:05 -05:00
break;
case 91:this.$ = new yy.Class($$[$0-4+2-1], $$[$0-4+4-1]);
2010-02-10 23:24:05 -05:00
break;
case 92:this.$ = new yy.Class($$[$0-5+2-1], null, $$[$0-5+4-1]);
2010-02-10 23:24:05 -05:00
break;
case 93:this.$ = new yy.Class($$[$0-7+2-1], $$[$0-7+4-1], $$[$0-7+6-1]);
2010-02-10 23:24:05 -05:00
break;
case 94:this.$ = new yy.Class(null, null, $$[$0-4+3-1]);
2010-02-10 23:24:05 -05:00
break;
case 95:this.$ = new yy.Class(null, null, new yy.Expressions);
2010-02-10 23:24:05 -05:00
break;
case 96:this.$ = new yy.Class(null, $$[$0-3+3-1], new yy.Expressions);
2010-02-10 23:24:05 -05:00
break;
case 97:this.$ = new yy.Class(null, $$[$0-6+3-1], $$[$0-6+5-1]);
2010-02-10 23:24:05 -05:00
break;
case 98:this.$ = $$[$0-1+1-1];
2010-06-26 13:36:31 -04:00
break;
case 99:this.$ = new yy.Assign(new yy.Value($$[$0-3+1-1]), $$[$0-3+3-1], 'this');
2010-02-10 23:24:05 -05:00
break;
case 100:this.$ = new yy.Assign(new yy.Value($$[$0-5+1-1]), $$[$0-5+4-1], 'this');
2010-02-10 23:24:05 -05:00
break;
case 101:this.$ = [];
2010-02-10 23:24:05 -05:00
break;
case 102:this.$ = [$$[$0-1+1-1]];
2010-02-10 23:24:05 -05:00
break;
case 103:this.$ = $$[$0-3+1-1].concat($$[$0-3+3-1]);
2010-02-10 23:24:05 -05:00
break;
case 104:this.$ = $$[$0-3+2-1];
2010-02-10 23:24:05 -05:00
break;
case 105:this.$ = new yy.Extends($$[$0-3+1-1], $$[$0-3+3-1]);
2010-10-23 16:35:35 -04:00
break;
case 106:this.$ = new yy.Call($$[$0-3+1-1], $$[$0-3+3-1], $$[$0-3+2-1]);
break;
case 107:this.$ = new yy.Call($$[$0-3+1-1], $$[$0-3+3-1], $$[$0-3+2-1]);
break;
case 108:this.$ = new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]);
break;
case 109:this.$ = new yy.Call('super', $$[$0-2+2-1]);
break;
case 110:this.$ = false;
break;
case 111:this.$ = true;
break;
case 112:this.$ = [];
2010-03-28 13:06:16 -04:00
break;
case 113:this.$ = $$[$0-4+2-1];
2010-03-28 13:06:16 -04:00
break;
case 114:this.$ = new yy.Value(new yy.Literal('this'));
2010-03-28 13:06:16 -04:00
break;
case 115:this.$ = new yy.Value(new yy.Literal('this'));
break;
case 116:this.$ = new yy.Value(new yy.Literal('this'), [new yy.Accessor($$[$0-2+2-1])], 'this');
break;
case 117:this.$ = new yy.Arr([]);
break;
case 118:this.$ = new yy.Arr($$[$0-4+2-1]);
break;
case 119:this.$ = [$$[$0-1+1-1]];
break;
case 120:this.$ = $$[$0-3+1-1].concat($$[$0-3+3-1]);
break;
case 121:this.$ = $$[$0-4+1-1].concat($$[$0-4+4-1]);
break;
case 122:this.$ = $$[$0-4+2-1];
break;
case 123:this.$ = $$[$0-6+1-1].concat($$[$0-6+4-1]);
2010-07-18 14:46:21 -04:00
break;
case 124:this.$ = $$[$0-1+1-1];
break;
case 125:this.$ = $$[$0-1+1-1];
break;
case 126:this.$ = $$[$0-1+1-1];
break;
case 127:this.$ = [].concat($$[$0-3+1-1], $$[$0-3+3-1]);
break;
case 128:this.$ = new yy.Try($$[$0-2+2-1]);
2010-08-17 21:31:32 -04:00
break;
case 129:this.$ = new yy.Try($$[$0-3+2-1], $$[$0-3+3-1][0], $$[$0-3+3-1][1]);
break;
case 130:this.$ = new yy.Try($$[$0-4+2-1], null, null, $$[$0-4+4-1]);
break;
case 131:this.$ = new yy.Try($$[$0-5+2-1], $$[$0-5+3-1][0], $$[$0-5+3-1][1], $$[$0-5+5-1]);
break;
case 132:this.$ = [$$[$0-3+2-1], $$[$0-3+3-1]];
break;
case 133:this.$ = new yy.Throw($$[$0-2+2-1]);
break;
case 134:this.$ = new yy.Parens($$[$0-3+2-1]);
break;
case 135:this.$ = new yy.While($$[$0-2+2-1]);
break;
case 136:this.$ = new yy.While($$[$0-4+2-1], {
guard: $$[$0-4+4-1]
});
2010-02-10 23:24:05 -05:00
break;
case 137:this.$ = new yy.While($$[$0-2+2-1], {
invert: true
});
break;
case 138:this.$ = new yy.While($$[$0-4+2-1], {
invert: true,
guard: $$[$0-4+4-1]
});
break;
case 139:this.$ = $$[$0-2+1-1].addBody($$[$0-2+2-1]);
2010-10-23 16:35:35 -04:00
break;
case 140:this.$ = $$[$0-2+2-1].addBody(yy.Expressions.wrap([$$[$0-2+1-1]]));
break;
case 141:this.$ = $$[$0-2+2-1].addBody(yy.Expressions.wrap([$$[$0-2+1-1]]));
break;
case 142:this.$ = $$[$0-1+1-1];
break;
case 143:this.$ = new yy.While(new yy.Literal('true')).addBody($$[$0-2+2-1]);
2010-08-17 21:31:32 -04:00
break;
case 144:this.$ = new yy.While(new yy.Literal('true')).addBody(yy.Expressions.wrap([$$[$0-2+2-1]]));
break;
case 145:this.$ = new yy.For($$[$0-2+1-1], $$[$0-2+2-1]);
break;
case 146:this.$ = new yy.For($$[$0-2+1-1], $$[$0-2+2-1]);
2010-10-04 16:53:32 -04:00
break;
case 147:this.$ = new yy.For($$[$0-2+2-1], $$[$0-2+1-1]);
break;
case 148:this.$ = $$[$0-1+1-1];
break;
case 149:this.$ = new yy.Value($$[$0-1+1-1]);
break;
case 150:this.$ = new yy.Value($$[$0-1+1-1]);
break;
case 151:this.$ = {
source: $$[$0-2+2-1]
};
break;
case 152:this.$ = {
source: $$[$0-4+2-1],
guard: $$[$0-4+4-1]
};
2010-10-04 16:53:32 -04:00
break;
case 153:this.$ = {
source: $$[$0-4+2-1],
step: $$[$0-4+4-1]
};
break;
case 154:this.$ = {
source: $$[$0-6+2-1],
step: $$[$0-6+4-1],
guard: $$[$0-6+6-1]
};
break;
case 155:this.$ = {
object: true,
source: $$[$0-2+2-1]
};
2010-02-10 23:24:05 -05:00
break;
case 156:this.$ = {
object: true,
source: $$[$0-4+2-1],
guard: $$[$0-4+4-1]
};
2010-02-10 23:24:05 -05:00
break;
case 157:this.$ = {
to: $$[$0-2+2-1]
};
break;
case 158:this.$ = {
to: $$[$0-4+2-1],
guard: $$[$0-4+4-1]
};
break;
case 159:this.$ = {
to: $$[$0-4+2-1],
step: $$[$0-4+4-1]
};
2010-02-10 23:24:05 -05:00
break;
case 160:this.$ = {
to: $$[$0-6+2-1],
step: $$[$0-6+4-1],
guard: $$[$0-6+6-1]
};
2010-02-10 23:24:05 -05:00
break;
case 161:this.$ = yy.extend($$[$0-3+3-1], {
name: $$[$0-3+2-1]
});
break;
case 162:this.$ = yy.extend($$[$0-5+5-1], {
name: $$[$0-5+2-1],
index: $$[$0-5+4-1]
});
break;
case 163:this.$ = yy.extend($$[$0-3+3-1], {
index: $$[$0-3+2-1]
});
break;
case 164:this.$ = yy.extend($$[$0-5+5-1], {
index: $$[$0-5+2-1],
name: $$[$0-5+4-1]
});
break;
case 165:this.$ = yy.extend($$[$0-4+4-1], {
raw: true,
index: $$[$0-4+3-1]
});
break;
case 166:this.$ = yy.extend($$[$0-6+6-1], {
raw: true,
index: $$[$0-6+3-1],
name: $$[$0-6+5-1]
});
break;
case 167:this.$ = yy.extend($$[$0-5+5-1], {
index: $$[$0-5+2-1],
from: $$[$0-5+4-1]
});
break;
case 168:this.$ = new yy.Switch($$[$0-5+2-1], $$[$0-5+4-1]);
break;
case 169:this.$ = new yy.Switch($$[$0-7+2-1], $$[$0-7+4-1], $$[$0-7+6-1]);
break;
case 170:this.$ = new yy.Switch(null, $$[$0-4+3-1]);
2010-05-10 22:57:51 -04:00
break;
case 171:this.$ = new yy.Switch(null, $$[$0-6+3-1], $$[$0-6+5-1]);
2010-05-10 22:57:51 -04:00
break;
case 172:this.$ = $$[$0-1+1-1];
break;
case 173:this.$ = $$[$0-2+1-1].concat($$[$0-2+2-1]);
break;
case 174:this.$ = [[$$[$0-3+2-1], $$[$0-3+3-1]]];
2010-04-05 10:26:23 -04:00
break;
case 175:this.$ = [[$$[$0-4+2-1], $$[$0-4+3-1]]];
break;
case 176:this.$ = new yy.If($$[$0-3+2-1], $$[$0-3+3-1]);
break;
case 177:this.$ = new yy.If($$[$0-3+2-1], $$[$0-3+3-1], {
2010-04-27 19:35:15 -04:00
invert: true
});
2010-02-10 23:24:05 -05:00
break;
case 178:this.$ = $$[$0-5+1-1].addElse(new yy.If($$[$0-5+4-1], $$[$0-5+5-1]));
2010-02-10 23:24:05 -05:00
break;
case 179:this.$ = $$[$0-3+1-1].addElse($$[$0-3+3-1]);
2010-02-10 23:24:05 -05:00
break;
case 180:this.$ = $$[$0-1+1-1];
2010-02-10 23:24:05 -05:00
break;
case 181:this.$ = new yy.If($$[$0-3+3-1], yy.Expressions.wrap([$$[$0-3+1-1]]), {
statement: true
});
2010-02-10 23:24:05 -05:00
break;
case 182:this.$ = new yy.If($$[$0-3+3-1], yy.Expressions.wrap([$$[$0-3+1-1]]), {
2010-04-27 19:35:15 -04:00
statement: true
});
break;
case 183:this.$ = new yy.If($$[$0-3+3-1], yy.Expressions.wrap([$$[$0-3+1-1]]), {
2010-04-05 10:26:23 -04:00
statement: true,
invert: true
});
break;
case 184:this.$ = new yy.If($$[$0-3+3-1], yy.Expressions.wrap([$$[$0-3+1-1]]), {
statement: true,
invert: true
});
2010-02-10 23:24:05 -05:00
break;
case 185:this.$ = new yy.Op($$[$0-2+1-1], $$[$0-2+2-1]);
break;
case 186:this.$ = new yy.Op('-', $$[$0-2+2-1]);
break;
case 187:this.$ = new yy.Op('+', $$[$0-2+2-1]);
2010-10-11 04:05:50 -04:00
break;
case 188:this.$ = new yy.Op('--', $$[$0-2+2-1]);
break;
case 189:this.$ = new yy.Op('++', $$[$0-2+2-1]);
break;
case 190:this.$ = new yy.Op('--', $$[$0-2+1-1], null, true);
break;
case 191:this.$ = new yy.Op('++', $$[$0-2+1-1], null, true);
break;
case 192:this.$ = new yy.Existence($$[$0-2+1-1]);
break;
case 193:this.$ = new yy.Op('+', $$[$0-3+1-1], $$[$0-3+3-1]);
break;
case 194:this.$ = new yy.Op('-', $$[$0-3+1-1], $$[$0-3+3-1]);
break;
case 195:this.$ = new yy.Op($$[$0-3+2-1], $$[$0-3+1-1], $$[$0-3+3-1]);
break;
2010-10-24 20:34:50 -04:00
case 196:this.$ = new yy.Op($$[$0-3+2-1], $$[$0-3+1-1], $$[$0-3+3-1]);
break;
2010-10-24 20:34:50 -04:00
case 197:this.$ = new yy.Op($$[$0-3+2-1], $$[$0-3+1-1], $$[$0-3+3-1]);
break;
2010-10-24 20:34:50 -04:00
case 198:this.$ = new yy.Op($$[$0-3+2-1], $$[$0-3+1-1], $$[$0-3+3-1]);
break;
case 199:this.$ = $$[$0-3+2-1].charAt(0) === '!' ? new yy.Op($$[$0-3+2-1].slice(1), $$[$0-3+1-1], $$[$0-3+3-1]).invert() : new yy.Op($$[$0-3+2-1], $$[$0-3+1-1], $$[$0-3+3-1]);
2010-08-17 21:31:32 -04:00
break;
case 200:this.$ = new yy.Assign($$[$0-3+1-1], $$[$0-3+3-1], $$[$0-3+2-1]);
break;
case 201:this.$ = new yy.Assign($$[$0-5+1-1], $$[$0-5+4-1], $$[$0-5+2-1]);
2010-08-21 08:56:25 -04:00
break;
}
},
table: [{"1":[2,1],"3":1,"4":[1,2],"5":3,"6":4,"7":5,"8":7,"9":8,"10":22,"11":23,"12":[1,24],"13":[1,25],"14":[1,26],"15":9,"16":10,"17":11,"18":12,"19":13,"20":14,"21":15,"22":16,"23":17,"24":18,"25":19,"26":20,"27":21,"28":[1,6],"30":61,"31":[1,73],"32":52,"33":[1,71],"34":[1,72],"35":28,"36":[1,53],"37":[1,54],"38":[1,55],"39":27,"44":62,"45":29,"46":[1,48],"47":[1,47],"48":[1,32],"51":33,"52":[1,59],"53":[1,60],"59":[1,58],"61":39,"63":50,"64":51,"65":30,"74":[1,70],"77":[1,46],"83":[1,31],"88":[1,57],"89":[1,69],"93":[1,41],"97":[1,49],"98":[1,56],"100":42,"101":[1,65],"103":[1,66],"104":43,"105":[1,67],"106":44,"115":[1,68],"118":[1,45],"123":40,"124":[1,63],"125":[1,64],"128":[1,34],"129":[1,35],"130":[1,36],"131":[1,37],"132":[1,38]},{"1":[3]},{"1":[2,2],"27":74,"47":[1,47]},{"1":[2,3],"4":[1,75]},{"4":[1,76]},{"1":[2,5],"4":[2,5],"29":[2,5]},{"5":77,"7":5,"8":7,"9":8,"10":22,"11":23,"12":[1,24],"13":[1,25],"14":[1,26],"15":9,"16":10,"17":11,"18":12,"19":13,"20":14,"21":15,"22":16,"23":17,"24":18,"25":19,"26":20,"27":21,"29":[1,78],"30":61,"31":[1,73],"32":52,"33":[1,71],"34":[1,72],"35":28,"36":[1,53],"37":[1,54],"38":[1,55],"39":27,"44":62,"45":29,"46":[1,48],"47":[1,47],"48":[1,32],"51":33,"52":[1,59],"53":[1,60],"59":[1,58],"61":39,"63":50,"64":51,"65":30,"74":[1,70],"77":[1,46],"83":[1,31],"88":[1,57],"89":[1,69],"93":[1,41],"97":[1,49],"98":[1,56],"100":42,"101":[1,65],"103":[1,66],"104":43,"105":[1,67],"106":44,"115":[1,68],"118":[1,45],"123":40,"124":[1,63],"125":[1,64],"128":[1,34],"129":[1,35],"130":[1,36],"131":[1,37],"132":[1,38]},{"1":[2,8],"4":[2,8],"29":[2,8],"100":89,"101":[1,65],"103":[1,66],"106":90,"115":[1,68],"126":[1,87],"127":[1,88],"129":[1,81],"130":[1,80],"133":[1,79],"134":[1,82],"135":[1,83],"136":[1,84],"137":[1,85],"138":[1,86]},{"1":[2,9],"4":[2,9],"29":[2,9],"100":93,"101":[1,65],"103":[1,66],"106":94,"115":[1,68],"126":[1,91],"127":[1,92]},{"1":[2,15],"4":[2,15],"28":[2,15],"29":[2,15],"55":[2,15],"58":[2,15],"62":96,"66":[1,98],"67":[1,99],"68":[1,100],"69":101,"70":[1,102],"71":[2,15],"72":[1,103],"73":[1,104],"76":[2,15],"81":95,"84":[1,97],"85":[2,110],"86":[2,15],"90":[2,15],"99":[2,15],"101":[2,15],"102":[2,15],"103":[2,15],"110":[2,15],"114":[2,15],"115":[2,15],"126":[2,15],"127":[2,15],"129":[2,15],"130":[2,15],"133":[2,15],"134":[2,15],"135":[2,15],"136":[2,15],"137":[2,15],"138":[2,15]},{"1":[2,16],"4":[2,16],"28":[2,16],"29":[2,16],"55":[2,16],"58":[2,16],"62":106,"66":[1,98],"67":[1,99],"68":[1,100],"69":101,"70":[1,102],"71":[2,16],"72":[1,103],"73":[1,104],"76":[2,16],"81":105,"84":[1,97],"85":[2,110],"86":[2,16],"90":[2,16],"99":[2,16],"101":[2,16],"102":[2,16],"103":[2,16],"110":[2,16],"114":[2,16],"115":[2,16],"126":[2,16],"127":[2,16],"129":[2,16],"130":[2,16],"133":[2,16],"134":[2,16],"135":[2,16],"136":[2,16],"137":[2,16],"138":[2,16]},{"1":[2,17],"4":[2,17],"28":[2,17],"29":[2,17],"55":[2,17],"58":[2,17],"71":[2,17],"76":[2,17],"86":[2,17],"90":[2,17],"99":[2,17],"101":[2,17],"102":[2,17],"103":[2,17],"110":[2,17],"114":[2,17],"115":[2,17],"126":[2,17],"127":[2,17],"129":[2,17],"130":[2,17],"133":[2,17],"134":[2,17],"135":[2,17],"136":[2,17],"137":[2,17],"138":[2,17]},{"1":[2,18],"4":[2,18],"28":[2,18],"29":[2,18],"55":[2,18],"58":[2,18],"71":[2,18],"76":[2,18],"86":[2,18],"90":[2,18],"99":[2,18],"101":[2,18],"102":[2,18],"103":[2,18],"110":[2,18],"114":[2,18],"115":[2,18],"126":[2,18],"127":[2,18],"129":[2,18],"130":[2,18],"133":[2,18],"134":[2,18],"135":[2,18],"136":[2,18],"137":[2,18],"138":[2,18]},{"1":[2,19],"4":[2,19],"28":[2,19],"29":[2,19],"55":[2,19],"58":[2,19],"71":[2,19],"76":[2,19],"86":[2,19],"90":[2,19],"99":[2,19],"101":[2,19],"102":[2,19],"103":[2,19],"110":[2,19],"114":[2,19],"115":[2,19],"126":[2,19],"127":[2,19],"129":[2,19],"130":[2,19],"133":[2,19],"134":[2,19],"135":[2,19],"136":[2,19],"137":[2,19],"138":[2,19]},{"1":[2,20],"4":[2,20],"28":[2,20],"29":[2,20],"55":[2,20],"58":[2,20],"71":[2,20],"76":[2,20],"86":[2,20],"90":[2,20],"99":[2,20],"101":[2,20],"102":[2,20],"103":[2,20],"110":[2,20],"114":[2,20],"115":[2,20],"126":[2,20],"127":
2010-10-25 14:56:02 -04:00
defaultActions: {"76":[2,4],"97":[2,111],"308":[2,148]},
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,
recovering = 0,
TERROR = 2,
EOF = 1;
2010-02-10 23:24:05 -05:00
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
2010-02-10 23:24:05 -05:00
var parseError = this.yy.parseError = typeof this.yy.parseError == 'function' ? this.yy.parseError : this.parseError;
function popStack (n) {
stack.length = stack.length - 2*n;
vstack.length = vstack.length - n;
}
function checkRecover (st) {
for (var p in table[st]) if (p == TERROR) {
return true;
}
return false;
}
2010-02-10 23:24:05 -05:00
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] || token;
2010-02-10 23:24:05 -05:00
}
return token;
};
var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected, recovered = false;
2010-02-10 23:24:05 -05:00
while (true) {
// retreive state number from top of stack
2010-02-10 23:24:05 -05:00
state = stack[stack.length-1];
// use default actions if available
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol == null)
symbol = lex();
// read action for current state and first input
action = table[state] && table[state][symbol];
}
2010-02-10 23:24:05 -05:00
// handle parse error
if (typeof action === 'undefined' || !action.length || !action[0]) {
if (!recovering) {
// Report error
expected = [];
for (p in table[state]) if (this.terminals_[p] && p > 2) {
expected.push("'"+this.terminals_[p]+"'");
}
if (this.lexer.showPosition) {
parseError.call(this, 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', '),
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, expected: expected});
} else {
parseError.call(this, 'Parse error on line '+(yylineno+1)+": Unexpected '"+(this.terminals_[symbol] || symbol)+"'",
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, expected: expected});
}
}
// just recovered from another error
if (recovering == 3) {
if (symbol == EOF) {
throw 'Parsing halted.'
}
// discard current lookahead and grab another
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
symbol = lex();
2010-01-30 23:17:36 -05:00
}
// try to recover from error
while (1) {
// check for error recovery rule in this state
if (checkRecover(state)) {
break;
}
if (state == 0) {
throw 'Parsing halted.'
}
popStack(1);
state = stack[stack.length-1];
2010-02-13 18:19:59 -05:00
}
preErrorSymbol = symbol; // save the lookahead token
symbol = TERROR; // insert generic error symbol as new lookahead
state = stack[stack.length-1];
action = table[state] && table[state][TERROR];
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
2010-01-30 23:17:36 -05:00
}
2010-02-10 23:24:05 -05:00
// this shouldn't happen, unless resolve defaults are off
if (action[0] instanceof Array && action.length > 1) {
2010-02-10 23:24:05 -05:00
throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
}
a = action;
2010-02-10 23:24:05 -05:00
switch (a[0]) {
case 1: // shift
shifts++;
stack.push(symbol);
vstack.push(this.lexer.yytext); // semantic values or junk only, no terminals
2010-02-10 23:24:05 -05:00
stack.push(a[1]); // push state
symbol = null;
if (!preErrorSymbol) { // normal execution/no error
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
if (recovering > 0)
recovering--;
} else { // error just occurred, resume old lookahead f/ before error
symbol = preErrorSymbol;
preErrorSymbol = null;
}
2010-02-10 23:24:05 -05:00
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-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) {
if (!args[1])
throw new Error('Usage: '+args[0]+' FILE');
if (typeof process !== 'undefined') {
var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
} else {
var cwd = require("file").path(require("file").cwd());
var source = cwd.join(args[1]).read({charset: "utf-8"});
}
return exports.parser.parse(source);
2010-02-10 23:24:05 -05:00
}
if (typeof module !== 'undefined' && require.main === module) {
exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
2010-02-10 23:24:05 -05:00
}
}