683 lines
108 KiB
JavaScript
683 lines
108 KiB
JavaScript
|
/* Jison generated parser */
|
||
|
var parser = (function(){
|
||
|
var parser = {trace: function trace() { },
|
||
|
yy: {},
|
||
|
symbols_: {"error":2,"Root":3,"Body":4,"Block":5,"TERMINATOR":6,"Line":7,"Expression":8,"Statement":9,"Return":10,"Comment":11,"STATEMENT":12,"Value":13,"Invocation":14,"Code":15,"Operation":16,"Assign":17,"If":18,"Try":19,"While":20,"For":21,"Switch":22,"Class":23,"Throw":24,"INDENT":25,"OUTDENT":26,"Identifier":27,"IDENTIFIER":28,"AlphaNumeric":29,"NUMBER":30,"STRING":31,"Literal":32,"JS":33,"REGEX":34,"DEBUGGER":35,"UNDEFINED":36,"NULL":37,"BOOL":38,"Assignable":39,"=":40,"AssignObj":41,"ObjAssignable":42,":":43,"ThisProperty":44,"RETURN":45,"HERECOMMENT":46,"PARAM_START":47,"ParamList":48,"PARAM_END":49,"FuncGlyph":50,"->":51,"=>":52,"OptComma":53,",":54,"Param":55,"ParamVar":56,"...":57,"Array":58,"Object":59,"Splat":60,"SimpleAssignable":61,"Accessor":62,"Parenthetical":63,"Range":64,"This":65,".":66,"?.":67,"::":68,"Index":69,"INDEX_START":70,"IndexValue":71,"INDEX_END":72,"INDEX_SOAK":73,"Slice":74,"{":75,"AssignList":76,"}":77,"CLASS":78,"EXTENDS":79,"OptFuncExist":80,"Arguments":81,"SUPER":82,"FUNC_EXIST":83,"CALL_START":84,"CALL_END":85,"ArgList":86,"THIS":87,"@":88,"[":89,"]":90,"RangeDots":91,"..":92,"Arg":93,"SimpleArgs":94,"TRY":95,"Catch":96,"FINALLY":97,"CATCH":98,"THROW":99,"(":100,")":101,"WhileSource":102,"WHILE":103,"WHEN":104,"UNTIL":105,"Loop":106,"LOOP":107,"ForBody":108,"FOR":109,"ForStart":110,"ForSource":111,"ForVariables":112,"OWN":113,"ForValue":114,"FORIN":115,"FOROF":116,"BY":117,"SWITCH":118,"Whens":119,"ELSE":120,"When":121,"LEADING_WHEN":122,"IfBlock":123,"IF":124,"POST_IF":125,"UNARY":126,"-":127,"+":128,"--":129,"++":130,"?":131,"MATH":132,"SHIFT":133,"COMPARE":134,"LOGIC":135,"RELATION":136,"COMPOUND_ASSIGN":137,"$accept":0,"$end":1},
|
||
|
terminals_: {2:"error",6:"TERMINATOR",12:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"UNDEFINED",37:"NULL",38:"BOOL",40:"=",43:":",45:"RETURN",46:"HERECOMMENT",47:"PARAM_START",49:"PARAM_END",51:"->",52:"=>",54:",",57:"...",66:".",67:"?.",68:"::",70:"INDEX_START",72:"INDEX_END",73:"INDEX_SOAK",75:"{",77:"}",78:"CLASS",79:"EXTENDS",82:"SUPER",83:"FUNC_EXIST",84:"CALL_START",85:"CALL_END",87:"THIS",88:"@",89:"[",90:"]",92:"..",95:"TRY",97:"FINALLY",98:"CATCH",99:"THROW",100:"(",101:")",103:"WHILE",104:"WHEN",105:"UNTIL",107:"LOOP",109:"FOR",113:"OWN",115:"FORIN",116:"FOROF",117:"BY",118:"SWITCH",120:"ELSE",122:"LEADING_WHEN",124:"IF",125:"POST_IF",126:"UNARY",127:"-",128:"+",129:"--",130:"++",131:"?",132:"MATH",133:"SHIFT",134:"COMPARE",135:"LOGIC",136:"RELATION",137:"COMPOUND_ASSIGN"},
|
||
|
productions_: [0,[3,0],[3,1],[3,2],[4,1],[4,3],[4,2],[7,1],[7,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],[5,2],[5,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[17,3],[17,4],[17,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[10,2],[10,1],[11,1],[15,5],[15,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[13,1],[13,1],[13,1],[13,1],[13,1],[62,2],[62,2],[62,2],[62,1],[62,1],[69,3],[69,2],[71,1],[71,1],[59,4],[76,0],[76,1],[76,3],[76,4],[76,6],[23,1],[23,2],[23,3],[23,4],[23,2],[23,3],[23,4],[23,5],[14,3],[14,3],[14,1],[14,2],[80,0],[80,1],[81,2],[81,4],[65,1],[65,1],[44,2],[58,2],[58,4],[91,1],[91,1],[64,5],[74,3],[74,2],[74,2],[74,1],[86,1],[86,3],[86,4],[86,4],[86,6],[93,1],[93,1],[94,1],[94,3],[19,2],[19,3],[19,4],[19,5],[96,3],[24,2],[63,3],[63,5],[102,2],[102,4],[102,2],[102,4],[20,2],[20,2],[20,2],[20,1],[106,2],[106,2],[21,2],[21,2],[21,2],[108,2],[108,2],[110,2],[110,3],[114,1],[114,1],[114,1],[114,1],[112,1],[112,3],[111,2],[111,2],[111,4],[111,4],[111,4],[111,6],[111,6],[22,5],[22,7],[22,4],[22,6],[119,1],[119,2],[121,3],[121,4],[123,3],[123,5],[18,1],[18,3],[18,3],[18,3],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,5],[16,3]],
|
||
|
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
|
||
|
|
||
|
var $0 = $$.length - 1;
|
||
|
switch (yystate) {
|
||
|
case 1:return this.$ = new yy.Block;
|
||
|
break;
|
||
|
case 2:return this.$ = $$[$0];
|
||
|
break;
|
||
|
case 3:return this.$ = $$[$0-1];
|
||
|
break;
|
||
|
case 4:this.$ = yy.Block.wrap([$$[$0]]);
|
||
|
break;
|
||
|
case 5:this.$ = $$[$0-2].push($$[$0]);
|
||
|
break;
|
||
|
case 6:this.$ = $$[$0-1];
|
||
|
break;
|
||
|
case 7:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 8:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 9:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 10:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 11:this.$ = new yy.Literal($$[$0]);
|
||
|
break;
|
||
|
case 12:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 13:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 14:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 15:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 16:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 17:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 18:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 19:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 20:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 21:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 22:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 23:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 24:this.$ = new yy.Block;
|
||
|
break;
|
||
|
case 25:this.$ = $$[$0-1];
|
||
|
break;
|
||
|
case 26:this.$ = new yy.Literal($$[$0]);
|
||
|
break;
|
||
|
case 27:this.$ = new yy.Literal($$[$0]);
|
||
|
break;
|
||
|
case 28:this.$ = new yy.Literal($$[$0]);
|
||
|
break;
|
||
|
case 29:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 30:this.$ = new yy.Literal($$[$0]);
|
||
|
break;
|
||
|
case 31:this.$ = new yy.Literal($$[$0]);
|
||
|
break;
|
||
|
case 32:this.$ = new yy.Literal($$[$0]);
|
||
|
break;
|
||
|
case 33:this.$ = new yy.Undefined;
|
||
|
break;
|
||
|
case 34:this.$ = new yy.Null;
|
||
|
break;
|
||
|
case 35:this.$ = new yy.Bool($$[$0]);
|
||
|
break;
|
||
|
case 36:this.$ = new yy.Assign($$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 37:this.$ = new yy.Assign($$[$0-3], $$[$0]);
|
||
|
break;
|
||
|
case 38:this.$ = new yy.Assign($$[$0-4], $$[$0-1]);
|
||
|
break;
|
||
|
case 39:this.$ = new yy.Value($$[$0]);
|
||
|
break;
|
||
|
case 40:this.$ = new yy.Assign(new yy.Value($$[$0-2]), $$[$0], 'object');
|
||
|
break;
|
||
|
case 41:this.$ = new yy.Assign(new yy.Value($$[$0-4]), $$[$0-1], 'object');
|
||
|
break;
|
||
|
case 42:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 43:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 44:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 45:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 46:this.$ = new yy.Return($$[$0]);
|
||
|
break;
|
||
|
case 47:this.$ = new yy.Return;
|
||
|
break;
|
||
|
case 48:this.$ = new yy.Comment($$[$0]);
|
||
|
break;
|
||
|
case 49:this.$ = new yy.Code($$[$0-3], $$[$0], $$[$0-1]);
|
||
|
break;
|
||
|
case 50:this.$ = new yy.Code([], $$[$0], $$[$0-1]);
|
||
|
break;
|
||
|
case 51:this.$ = 'func';
|
||
|
break;
|
||
|
case 52:this.$ = 'boundfunc';
|
||
|
break;
|
||
|
case 53:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 54:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 55:this.$ = [];
|
||
|
break;
|
||
|
case 56:this.$ = [$$[$0]];
|
||
|
break;
|
||
|
case 57:this.$ = $$[$0-2].concat($$[$0]);
|
||
|
break;
|
||
|
case 58:this.$ = $$[$0-3].concat($$[$0]);
|
||
|
break;
|
||
|
case 59:this.$ = $$[$0-5].concat($$[$0-2]);
|
||
|
break;
|
||
|
case 60:this.$ = new yy.Param($$[$0]);
|
||
|
break;
|
||
|
case 61:this.$ = new yy.Param($$[$0-1], null, true);
|
||
|
break;
|
||
|
case 62:this.$ = new yy.Param($$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 63:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 64:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 65:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 66:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 67:this.$ = new yy.Splat($$[$0-1]);
|
||
|
break;
|
||
|
case 68:this.$ = new yy.Value($$[$0]);
|
||
|
break;
|
||
|
case 69:this.$ = $$[$0-1].add($$[$0]);
|
||
|
break;
|
||
|
case 70:this.$ = new yy.Value($$[$0-1], [].concat($$[$0]));
|
||
|
break;
|
||
|
case 71:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 72:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 73:this.$ = new yy.Value($$[$0]);
|
||
|
break;
|
||
|
case 74:this.$ = new yy.Value($$[$0]);
|
||
|
break;
|
||
|
case 75:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 76:this.$ = new yy.Value($$[$0]);
|
||
|
break;
|
||
|
case 77:this.$ = new yy.Value($$[$0]);
|
||
|
break;
|
||
|
case 78:this.$ = new yy.Value($$[$0]);
|
||
|
break;
|
||
|
case 79:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 80:this.$ = new yy.Access($$[$0]);
|
||
|
break;
|
||
|
case 81:this.$ = new yy.Access($$[$0], 'soak');
|
||
|
break;
|
||
|
case 82:this.$ = [new yy.Access(new yy.Literal('prototype')), new yy.Access($$[$0])];
|
||
|
break;
|
||
|
case 83:this.$ = new yy.Access(new yy.Literal('prototype'));
|
||
|
break;
|
||
|
case 84:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 85:this.$ = $$[$0-1];
|
||
|
break;
|
||
|
case 86:this.$ = yy.extend($$[$0], {
|
||
|
soak: true
|
||
|
});
|
||
|
break;
|
||
|
case 87:this.$ = new yy.Index($$[$0]);
|
||
|
break;
|
||
|
case 88:this.$ = new yy.Slice($$[$0]);
|
||
|
break;
|
||
|
case 89:this.$ = new yy.Obj($$[$0-2], $$[$0-3].generated);
|
||
|
break;
|
||
|
case 90:this.$ = [];
|
||
|
break;
|
||
|
case 91:this.$ = [$$[$0]];
|
||
|
break;
|
||
|
case 92:this.$ = $$[$0-2].concat($$[$0]);
|
||
|
break;
|
||
|
case 93:this.$ = $$[$0-3].concat($$[$0]);
|
||
|
break;
|
||
|
case 94:this.$ = $$[$0-5].concat($$[$0-2]);
|
||
|
break;
|
||
|
case 95:this.$ = new yy.Class;
|
||
|
break;
|
||
|
case 96:this.$ = new yy.Class(null, null, $$[$0]);
|
||
|
break;
|
||
|
case 97:this.$ = new yy.Class(null, $$[$0]);
|
||
|
break;
|
||
|
case 98:this.$ = new yy.Class(null, $$[$0-1], $$[$0]);
|
||
|
break;
|
||
|
case 99:this.$ = new yy.Class($$[$0]);
|
||
|
break;
|
||
|
case 100:this.$ = new yy.Class($$[$0-1], null, $$[$0]);
|
||
|
break;
|
||
|
case 101:this.$ = new yy.Class($$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 102:this.$ = new yy.Class($$[$0-3], $$[$0-1], $$[$0]);
|
||
|
break;
|
||
|
case 103:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]);
|
||
|
break;
|
||
|
case 104:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]);
|
||
|
break;
|
||
|
case 105:this.$ = new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]);
|
||
|
break;
|
||
|
case 106:this.$ = new yy.Call('super', $$[$0]);
|
||
|
break;
|
||
|
case 107:this.$ = false;
|
||
|
break;
|
||
|
case 108:this.$ = true;
|
||
|
break;
|
||
|
case 109:this.$ = [];
|
||
|
break;
|
||
|
case 110:this.$ = $$[$0-2];
|
||
|
break;
|
||
|
case 111:this.$ = new yy.Value(new yy.Literal('this'));
|
||
|
break;
|
||
|
case 112:this.$ = new yy.Value(new yy.Literal('this'));
|
||
|
break;
|
||
|
case 113:this.$ = new yy.Value(new yy.Literal('this'), [new yy.Access($$[$0])], 'this');
|
||
|
break;
|
||
|
case 114:this.$ = new yy.Arr([]);
|
||
|
break;
|
||
|
case 115:this.$ = new yy.Arr($$[$0-2]);
|
||
|
break;
|
||
|
case 116:this.$ = 'inclusive';
|
||
|
break;
|
||
|
case 117:this.$ = 'exclusive';
|
||
|
break;
|
||
|
case 118:this.$ = new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]);
|
||
|
break;
|
||
|
case 119:this.$ = new yy.Range($$[$0-2], $$[$0], $$[$0-1]);
|
||
|
break;
|
||
|
case 120:this.$ = new yy.Range($$[$0-1], null, $$[$0]);
|
||
|
break;
|
||
|
case 121:this.$ = new yy.Range(null, $$[$0], $$[$0-1]);
|
||
|
break;
|
||
|
case 122:this.$ = new yy.Range(null, null, $$[$0]);
|
||
|
break;
|
||
|
case 123:this.$ = [$$[$0]];
|
||
|
break;
|
||
|
case 124:this.$ = $$[$0-2].concat($$[$0]);
|
||
|
break;
|
||
|
case 125:this.$ = $$[$0-3].concat($$[$0]);
|
||
|
break;
|
||
|
case 126:this.$ = $$[$0-2];
|
||
|
break;
|
||
|
case 127:this.$ = $$[$0-5].concat($$[$0-2]);
|
||
|
break;
|
||
|
case 128:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 129:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 130:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 131:this.$ = [].concat($$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 132:this.$ = new yy.Try($$[$0]);
|
||
|
break;
|
||
|
case 133:this.$ = new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]);
|
||
|
break;
|
||
|
case 134:this.$ = new yy.Try($$[$0-2], null, null, $$[$0]);
|
||
|
break;
|
||
|
case 135:this.$ = new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]);
|
||
|
break;
|
||
|
case 136:this.$ = [$$[$0-1], $$[$0]];
|
||
|
break;
|
||
|
case 137:this.$ = new yy.Throw($$[$0]);
|
||
|
break;
|
||
|
case 138:this.$ = new yy.Parens($$[$0-1]);
|
||
|
break;
|
||
|
case 139:this.$ = new yy.Parens($$[$0-2]);
|
||
|
break;
|
||
|
case 140:this.$ = new yy.While($$[$0]);
|
||
|
break;
|
||
|
case 141:this.$ = new yy.While($$[$0-2], {
|
||
|
guard: $$[$0]
|
||
|
});
|
||
|
break;
|
||
|
case 142:this.$ = new yy.While($$[$0], {
|
||
|
invert: true
|
||
|
});
|
||
|
break;
|
||
|
case 143:this.$ = new yy.While($$[$0-2], {
|
||
|
invert: true,
|
||
|
guard: $$[$0]
|
||
|
});
|
||
|
break;
|
||
|
case 144:this.$ = $$[$0-1].addBody($$[$0]);
|
||
|
break;
|
||
|
case 145:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]]));
|
||
|
break;
|
||
|
case 146:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]]));
|
||
|
break;
|
||
|
case 147:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 148:this.$ = new yy.While(new yy.Literal('true')).addBody($$[$0]);
|
||
|
break;
|
||
|
case 149:this.$ = new yy.While(new yy.Literal('true')).addBody(yy.Block.wrap([$$[$0]]));
|
||
|
break;
|
||
|
case 150:this.$ = new yy.For($$[$0-1], $$[$0]);
|
||
|
break;
|
||
|
case 151:this.$ = new yy.For($$[$0-1], $$[$0]);
|
||
|
break;
|
||
|
case 152:this.$ = new yy.For($$[$0], $$[$0-1]);
|
||
|
break;
|
||
|
case 153:this.$ = {
|
||
|
source: new yy.Value($$[$0])
|
||
|
};
|
||
|
break;
|
||
|
case 154:this.$ = (function () {
|
||
|
$$[$0].own = $$[$0-1].own;
|
||
|
$$[$0].name = $$[$0-1][0];
|
||
|
$$[$0].index = $$[$0-1][1];
|
||
|
return $$[$0];
|
||
|
}());
|
||
|
break;
|
||
|
case 155:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 156:this.$ = (function () {
|
||
|
$$[$0].own = true;
|
||
|
return $$[$0];
|
||
|
}());
|
||
|
break;
|
||
|
case 157:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 158:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 159:this.$ = new yy.Value($$[$0]);
|
||
|
break;
|
||
|
case 160:this.$ = new yy.Value($$[$0]);
|
||
|
break;
|
||
|
case 161:this.$ = [$$[$0]];
|
||
|
break;
|
||
|
case 162:this.$ = [$$[$0-2], $$[$0]];
|
||
|
break;
|
||
|
case 163:this.$ = {
|
||
|
source: $$[$0]
|
||
|
};
|
||
|
break;
|
||
|
case 164:this.$ = {
|
||
|
source: $$[$0],
|
||
|
object: true
|
||
|
};
|
||
|
break;
|
||
|
case 165:this.$ = {
|
||
|
source: $$[$0-2],
|
||
|
guard: $$[$0]
|
||
|
};
|
||
|
break;
|
||
|
case 166:this.$ = {
|
||
|
source: $$[$0-2],
|
||
|
guard: $$[$0],
|
||
|
object: true
|
||
|
};
|
||
|
break;
|
||
|
case 167:this.$ = {
|
||
|
source: $$[$0-2],
|
||
|
step: $$[$0]
|
||
|
};
|
||
|
break;
|
||
|
case 168:this.$ = {
|
||
|
source: $$[$0-4],
|
||
|
guard: $$[$0-2],
|
||
|
step: $$[$0]
|
||
|
};
|
||
|
break;
|
||
|
case 169:this.$ = {
|
||
|
source: $$[$0-4],
|
||
|
step: $$[$0-2],
|
||
|
guard: $$[$0]
|
||
|
};
|
||
|
break;
|
||
|
case 170:this.$ = new yy.Switch($$[$0-3], $$[$0-1]);
|
||
|
break;
|
||
|
case 171:this.$ = new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]);
|
||
|
break;
|
||
|
case 172:this.$ = new yy.Switch(null, $$[$0-1]);
|
||
|
break;
|
||
|
case 173:this.$ = new yy.Switch(null, $$[$0-3], $$[$0-1]);
|
||
|
break;
|
||
|
case 174:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 175:this.$ = $$[$0-1].concat($$[$0]);
|
||
|
break;
|
||
|
case 176:this.$ = [[$$[$0-1], $$[$0]]];
|
||
|
break;
|
||
|
case 177:this.$ = [[$$[$0-2], $$[$0-1]]];
|
||
|
break;
|
||
|
case 178:this.$ = new yy.If($$[$0-1], $$[$0], {
|
||
|
type: $$[$0-2]
|
||
|
});
|
||
|
break;
|
||
|
case 179:this.$ = $$[$0-4].addElse(new yy.If($$[$0-1], $$[$0], {
|
||
|
type: $$[$0-2]
|
||
|
}));
|
||
|
break;
|
||
|
case 180:this.$ = $$[$0];
|
||
|
break;
|
||
|
case 181:this.$ = $$[$0-2].addElse($$[$0]);
|
||
|
break;
|
||
|
case 182:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), {
|
||
|
type: $$[$0-1],
|
||
|
statement: true
|
||
|
});
|
||
|
break;
|
||
|
case 183:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), {
|
||
|
type: $$[$0-1],
|
||
|
statement: true
|
||
|
});
|
||
|
break;
|
||
|
case 184:this.$ = new yy.Op($$[$0-1], $$[$0]);
|
||
|
break;
|
||
|
case 185:this.$ = new yy.Op('-', $$[$0]);
|
||
|
break;
|
||
|
case 186:this.$ = new yy.Op('+', $$[$0]);
|
||
|
break;
|
||
|
case 187:this.$ = new yy.Op('--', $$[$0]);
|
||
|
break;
|
||
|
case 188:this.$ = new yy.Op('++', $$[$0]);
|
||
|
break;
|
||
|
case 189:this.$ = new yy.Op('--', $$[$0-1], null, true);
|
||
|
break;
|
||
|
case 190:this.$ = new yy.Op('++', $$[$0-1], null, true);
|
||
|
break;
|
||
|
case 191:this.$ = new yy.Existence($$[$0-1]);
|
||
|
break;
|
||
|
case 192:this.$ = new yy.Op('+', $$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 193:this.$ = new yy.Op('-', $$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 194:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 195:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 196:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 197:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
case 198:this.$ = (function () {
|
||
|
if ($$[$0-1].charAt(0) === '!') {
|
||
|
return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert();
|
||
|
} else {
|
||
|
return new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
|
||
|
}
|
||
|
}());
|
||
|
break;
|
||
|
case 199:this.$ = new yy.Assign($$[$0-2], $$[$0], $$[$0-1]);
|
||
|
break;
|
||
|
case 200:this.$ = new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]);
|
||
|
break;
|
||
|
case 201:this.$ = new yy.Extends($$[$0-2], $$[$0]);
|
||
|
break;
|
||
|
}
|
||
|
},
|
||
|
table: [{1:[2,1],3:1,4:2,5:3,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[3]},{1:[2,2],6:[1,74]},{6:[1,75]},{1:[2,4],6:[2,4],26:[2,4],101:[2,4]},{4:77,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[1,76],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,7],6:[2,7],26:[2,7],101:[2,7],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,8],6:[2,8],26:[2,8],101:[2,8],102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,12],73:[1,100],77:[2,12],80:92,83:[1,94],84:[2,107],85:[2,12],90:[2,12],92:[2,12],101:[2,12],103:[2,12],104:[2,12],105:[2,12],109:[2,12],117:[2,12],125:[2,12],127:[2,12],128:[2,12],131:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,13],73:[1,100],77:[2,13],80:101,83:[1,94],84:[2,107],85:[2,13],90:[2,13],92:[2,13],101:[2,13],103:[2,13],104:[2,13],105:[2,13],109:[2,13],117:[2,13],125:[2,13],127:[2,13],128:[2,13],131:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],72:[2,14],77:[2,14],85:[2,14],90:[2,14],92:[2,14],101:[2,14],103:[2,14],104:[2,14],105:[2,14],109:[2,14],117:[2,14],125:[2,14],127:[2,14],128:[2,14],131:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],72:[2,15],77:[2,15],85:[2,15],90:[2,15],92:[2,15],101:[2,15],103:[2,15],104:[2,15],105:[2,15],109:[2,15],117:[2,15],125:[2,15],127:[2,15],128:[2,15],131:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],72:[2,16],77:[2,16],85:[2,16],90:[2,16],92:[2,16],101:[2,16],103:[2,16],104:[2,16],105:[2,16],109:[2,16],117:[2,16],125:[2,16],127:[2,16],128:[2,16],131:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],72:[2,17],77:[2,17],85:[2,17],90:[2,17],92:[2,17],101:[2,17],103:[2,17],104:[2,17],105:[2,17],109:[2,17],117:[2,17],125:[2,17],127:[2,17],128:[2,17],131:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],72:[2,18],77:[2,18],85:[2,18],90:[2,18],92:[2,18],101:[2,18],103:[2,18],104:[2,18],105:[2,18],109:[2,18],117:[2,18],125:[2,18],127:[2,18],128:[2,18],131:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],72:[2,19],77:[2,19],85:[2,19],90:[2,19],92:[2,19],101:[2,19],103:[2,19],104:[2,19],105:[2,19],109:[2,19],117:[2,19],125:[2,19],127:[2,19],128:[2,19],131:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],72:[2,20],77:[2
|
||
|
defaultActions: {60:[2,51],61:[2,52],75:[2,3],94:[2,108],189:[2,88]},
|
||
|
parseError: function parseError(str, hash) {
|
||
|
throw new Error(str);
|
||
|
},
|
||
|
parse: function parse(input) {
|
||
|
var self = this,
|
||
|
stack = [0],
|
||
|
vstack = [null], // semantic value stack
|
||
|
lstack = [], // location stack
|
||
|
table = this.table,
|
||
|
yytext = '',
|
||
|
yylineno = 0,
|
||
|
yyleng = 0,
|
||
|
recovering = 0,
|
||
|
TERROR = 2,
|
||
|
EOF = 1;
|
||
|
|
||
|
//this.reductionCount = this.shiftCount = 0;
|
||
|
|
||
|
this.lexer.setInput(input);
|
||
|
this.lexer.yy = this.yy;
|
||
|
this.yy.lexer = this.lexer;
|
||
|
if (typeof this.lexer.yylloc == 'undefined')
|
||
|
this.lexer.yylloc = {};
|
||
|
var yyloc = this.lexer.yylloc;
|
||
|
lstack.push(yyloc);
|
||
|
|
||
|
if (typeof this.yy.parseError === 'function')
|
||
|
this.parseError = this.yy.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() || 1; // $end = 1
|
||
|
// if token isn't its numeric value, convert
|
||
|
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) {
|
||
|
// retreive state number from top of stack
|
||
|
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];
|
||
|
}
|
||
|
|
||
|
// handle parse error
|
||
|
_handle_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]+"'");
|
||
|
}
|
||
|
var errStr = '';
|
||
|
if (this.lexer.showPosition) {
|
||
|
errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
|
||
|
} else {
|
||
|
errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
|
||
|
(symbol == 1 /*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});
|
||
|
}
|
||
|
|
||
|
// just recovered from another error
|
||
|
if (recovering == 3) {
|
||
|
if (symbol == EOF) {
|
||
|
throw new Error(errStr || 'Parsing halted.');
|
||
|
}
|
||
|
|
||
|
// discard current lookahead and grab another
|
||
|
yyleng = this.lexer.yyleng;
|
||
|
yytext = this.lexer.yytext;
|
||
|
yylineno = this.lexer.yylineno;
|
||
|
yyloc = this.lexer.yylloc;
|
||
|
symbol = lex();
|
||
|
}
|
||
|
|
||
|
// try to recover from error
|
||
|
while (1) {
|
||
|
// check for error recovery rule in this state
|
||
|
if ((TERROR.toString()) in table[state]) {
|
||
|
break;
|
||
|
}
|
||
|
if (state == 0) {
|
||
|
throw new Error(errStr || 'Parsing halted.');
|
||
|
}
|
||
|
popStack(1);
|
||
|
state = stack[stack.length-1];
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
|
||
|
// this shouldn't happen, unless resolve defaults are off
|
||
|
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: // shift
|
||
|
//this.shiftCount++;
|
||
|
|
||
|
stack.push(symbol);
|
||
|
vstack.push(this.lexer.yytext);
|
||
|
lstack.push(this.lexer.yylloc);
|
||
|
stack.push(action[1]); // push state
|
||
|
symbol = null;
|
||
|
if (!preErrorSymbol) { // normal execution/no error
|
||
|
yyleng = this.lexer.yyleng;
|
||
|
yytext = this.lexer.yytext;
|
||
|
yylineno = this.lexer.yylineno;
|
||
|
yyloc = this.lexer.yylloc;
|
||
|
if (recovering > 0)
|
||
|
recovering--;
|
||
|
} else { // error just occurred, resume old lookahead f/ before error
|
||
|
symbol = preErrorSymbol;
|
||
|
preErrorSymbol = null;
|
||
|
}
|
||
|
break;
|
||
|
|
||
|
case 2: // reduce
|
||
|
//this.reductionCount++;
|
||
|
|
||
|
len = this.productions_[action[1]][1];
|
||
|
|
||
|
// perform semantic action
|
||
|
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
|
||
|
// default location, uses first token for firsts, last for lasts
|
||
|
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
|
||
|
};
|
||
|
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
|
||
|
|
||
|
if (typeof r !== 'undefined') {
|
||
|
return r;
|
||
|
}
|
||
|
|
||
|
// pop off stack
|
||
|
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]); // push nonterminal (reduce)
|
||
|
vstack.push(yyval.$);
|
||
|
lstack.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
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
}};
|
||
|
undefined
|
||
|
return parser;
|
||
|
})();
|
||
|
if (typeof require !== 'undefined' && typeof exports !== '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);
|
||
|
}
|
||
|
if (typeof module !== 'undefined' && require.main === module) {
|
||
|
exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
|
||
|
}
|
||
|
}
|