mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
Add location data to nodes without passing it in constructors.
This commit is contained in:
@@ -7,28 +7,36 @@
|
||||
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
|
||||
|
||||
o = function(patternString, action, options) {
|
||||
var match;
|
||||
var addLocationDataFn, match, patternCount;
|
||||
patternString = patternString.replace(/\s{2,}/g, ' ');
|
||||
patternCount = patternString.split(' ').length;
|
||||
if (!action) {
|
||||
return [patternString, '$$ = $1;', options];
|
||||
}
|
||||
action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())";
|
||||
action = action.replace(/\bnew /g, '$&yy.');
|
||||
action = action.replace(/\b(?:Block\.wrap|extend)\b/g, 'yy.$&');
|
||||
action = action.replace(/LOCDATA\(([0-9]*)\)/g, '@$1');
|
||||
action = action.replace(/LOCDATA\(([0-9]*),\s*([0-9]*)\)/g, '(function(){loc = {}; loc.first_column = @$1.first_column; ' + 'loc.first_line = @$1.first_line; ' + 'loc.last_column = @$2.last_column; ' + 'loc.last_line = @$2.last_line; ' + 'return loc;})()');
|
||||
return [patternString, "$$ = " + action + ";", options];
|
||||
addLocationDataFn = function(first, last) {
|
||||
if (!last) {
|
||||
return "yy.addLocationDataFn(@" + first + ")";
|
||||
} else {
|
||||
return "yy.addLocationDataFn(@" + first + ", @" + last + ")";
|
||||
}
|
||||
};
|
||||
action = action.replace(/LOCDATA\(([0-9]*)\)/g, addLocationDataFn('$1'));
|
||||
action = action.replace(/LOCDATA\(([0-9]*),\s*([0-9]*)\)/g, addLocationDataFn('$1', '$2'));
|
||||
return [patternString, "$$ = " + (addLocationDataFn(1, patternCount)) + "(" + action + ");", options];
|
||||
};
|
||||
|
||||
grammar = {
|
||||
Root: [
|
||||
o('', function() {
|
||||
return new Block(LOCDATA(1));
|
||||
return new Block;
|
||||
}), o('Body'), o('Block TERMINATOR')
|
||||
],
|
||||
Body: [
|
||||
o('Line', function() {
|
||||
return Block.wrap(LOCDATA(1), [$1]);
|
||||
return Block.wrap([$1]);
|
||||
}), o('Body TERMINATOR Line', function() {
|
||||
return $1.push($3);
|
||||
}), o('Body TERMINATOR')
|
||||
@@ -36,81 +44,81 @@
|
||||
Line: [o('Expression'), o('Statement')],
|
||||
Statement: [
|
||||
o('Return'), o('Comment'), o('STATEMENT', function() {
|
||||
return new Literal(LOCDATA(1), $1);
|
||||
return new Literal($1);
|
||||
})
|
||||
],
|
||||
Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw')],
|
||||
Block: [
|
||||
o('INDENT OUTDENT', function() {
|
||||
return new Block(LOCDATA(1));
|
||||
return new Block;
|
||||
}), o('INDENT Body OUTDENT', function() {
|
||||
return $2;
|
||||
})
|
||||
],
|
||||
Identifier: [
|
||||
o('IDENTIFIER', function() {
|
||||
return new Literal(LOCDATA(1), $1);
|
||||
return new Literal($1);
|
||||
})
|
||||
],
|
||||
AlphaNumeric: [
|
||||
o('NUMBER', function() {
|
||||
return new Literal(LOCDATA(1), $1);
|
||||
return new Literal($1);
|
||||
}), o('STRING', function() {
|
||||
return new Literal(LOCDATA(1), $1);
|
||||
return new Literal($1);
|
||||
})
|
||||
],
|
||||
Literal: [
|
||||
o('AlphaNumeric'), o('JS', function() {
|
||||
return new Literal(LOCDATA(1), $1);
|
||||
return new Literal($1);
|
||||
}), o('REGEX', function() {
|
||||
return new Literal(LOCDATA(1), $1);
|
||||
return new Literal($1);
|
||||
}), o('DEBUGGER', function() {
|
||||
return new Literal(LOCDATA(1), $1);
|
||||
return new Literal($1);
|
||||
}), o('UNDEFINED', function() {
|
||||
return new Undefined(LOCDATA(1));
|
||||
return new Undefined;
|
||||
}), o('NULL', function() {
|
||||
return new Null(LOCDATA(1));
|
||||
return new Null;
|
||||
}), o('BOOL', function() {
|
||||
return new Bool(LOCDATA(1), $1);
|
||||
return new Bool($1);
|
||||
})
|
||||
],
|
||||
Assign: [
|
||||
o('Assignable = Expression', function() {
|
||||
return new Assign(LOCDATA(1, 3), $1, $3);
|
||||
return new Assign($1, $3);
|
||||
}), o('Assignable = TERMINATOR Expression', function() {
|
||||
return new Assign(LOCDATA(1, 4), $1, $4);
|
||||
return new Assign($1, $4);
|
||||
}), o('Assignable = INDENT Expression OUTDENT', function() {
|
||||
return new Assign(LOCDATA(1, 4), $1, $4);
|
||||
return new Assign($1, $4);
|
||||
})
|
||||
],
|
||||
AssignObj: [
|
||||
o('ObjAssignable', function() {
|
||||
return new Value(LOCDATA(1), $1);
|
||||
return new Value($1);
|
||||
}), o('ObjAssignable : Expression', function() {
|
||||
return new Assign(LOCDATA(1, 3), new Value(LOCDATA(1), $1), $3, 'object');
|
||||
return new Assign(LOCDATA(1)(new Value($1)), $3, 'object');
|
||||
}), o('ObjAssignable :\
|
||||
INDENT Expression OUTDENT', function() {
|
||||
return new Assign(LOCDATA(1, 4), new Value(LOCDATA(1), $1), $4, 'object');
|
||||
return new Assign(LOCDATA(1)(new Value($1)), $4, 'object');
|
||||
}), o('Comment')
|
||||
],
|
||||
ObjAssignable: [o('Identifier'), o('AlphaNumeric'), o('ThisProperty')],
|
||||
Return: [
|
||||
o('RETURN Expression', function() {
|
||||
return new Return(LOCDATA(1, 2), $2);
|
||||
return new Return($2);
|
||||
}), o('RETURN', function() {
|
||||
return new Return(LOCDATA(1));
|
||||
return new Return;
|
||||
})
|
||||
],
|
||||
Comment: [
|
||||
o('HERECOMMENT', function() {
|
||||
return new Comment(LOCDATA(1), $1);
|
||||
return new Comment($1);
|
||||
})
|
||||
],
|
||||
Code: [
|
||||
o('PARAM_START ParamList PARAM_END FuncGlyph Block', function() {
|
||||
return new Code(LOCDATA(1, 5), $2, $5, $4);
|
||||
return new Code($2, $5, $4);
|
||||
}), o('FuncGlyph Block', function() {
|
||||
return new Code(LOCDATA(1, 2), [], $2, $1);
|
||||
return new Code([], $2, $1);
|
||||
})
|
||||
],
|
||||
FuncGlyph: [
|
||||
@@ -136,53 +144,53 @@
|
||||
],
|
||||
Param: [
|
||||
o('ParamVar', function() {
|
||||
return new Param(LOCDATA(1), $1);
|
||||
return new Param($1);
|
||||
}), o('ParamVar ...', function() {
|
||||
return new Param(LOCDATA(1), $1, null, true);
|
||||
return new Param($1, null, true);
|
||||
}), o('ParamVar = Expression', function() {
|
||||
return new Param(LOCDATA(1, 3), $1, $3);
|
||||
return new Param($1, $3);
|
||||
})
|
||||
],
|
||||
ParamVar: [o('Identifier'), o('ThisProperty'), o('Array'), o('Object')],
|
||||
Splat: [
|
||||
o('Expression ...', function() {
|
||||
return new Splat(LOCDATA(1), $1);
|
||||
return new Splat($1);
|
||||
})
|
||||
],
|
||||
SimpleAssignable: [
|
||||
o('Identifier', function() {
|
||||
return new Value(LOCDATA(1), $1);
|
||||
return new Value($1);
|
||||
}), o('Value Accessor', function() {
|
||||
return $1.add($2);
|
||||
}), o('Invocation Accessor', function() {
|
||||
return new Value(LOCDATA(1, 2), $1, [].concat($2));
|
||||
return new Value($1, [].concat($2));
|
||||
}), o('ThisProperty')
|
||||
],
|
||||
Assignable: [
|
||||
o('SimpleAssignable'), o('Array', function() {
|
||||
return new Value(LOCDATA(1), $1);
|
||||
return new Value($1);
|
||||
}), o('Object', function() {
|
||||
return new Value(LOCDATA(1), $1);
|
||||
return new Value($1);
|
||||
})
|
||||
],
|
||||
Value: [
|
||||
o('Assignable'), o('Literal', function() {
|
||||
return new Value(LOCDATA(1), $1);
|
||||
return new Value($1);
|
||||
}), o('Parenthetical', function() {
|
||||
return new Value(LOCDATA(1), $1);
|
||||
return new Value($1);
|
||||
}), o('Range', function() {
|
||||
return new Value(LOCDATA(1), $1);
|
||||
return new Value($1);
|
||||
}), o('This')
|
||||
],
|
||||
Accessor: [
|
||||
o('. Identifier', function() {
|
||||
return new Access(LOCDATA(1, 2), $2);
|
||||
return new Access($2);
|
||||
}), o('?. Identifier', function() {
|
||||
return new Access(LOCDATA(1, 2), $2, 'soak');
|
||||
return new Access($2, 'soak');
|
||||
}), o(':: Identifier', function() {
|
||||
return [new Access(LOCDATA(1), new Literal(LOCDATA(1), 'prototype')), new Access(LOCDATA(1), $2)];
|
||||
return [LOCDATA(1)(new Access(new Literal('prototype'))), LOCDATA(2)(new Access($2))];
|
||||
}), o('::', function() {
|
||||
return new Access(LOCDATA(1), new Literal(LOCDATA(1), 'prototype'));
|
||||
return new Access(new Literal('prototype'));
|
||||
}), o('Index')
|
||||
],
|
||||
Index: [
|
||||
@@ -196,14 +204,14 @@
|
||||
],
|
||||
IndexValue: [
|
||||
o('Expression', function() {
|
||||
return new Index(LOCDATA(1), $1);
|
||||
return new Index($1);
|
||||
}), o('Slice', function() {
|
||||
return new Slice(LOCDATA(1), $1);
|
||||
return new Slice($1);
|
||||
})
|
||||
],
|
||||
Object: [
|
||||
o('{ AssignList OptComma }', function() {
|
||||
return new Obj(LOCDATA(1, 2), $2, $1.generated);
|
||||
return new Obj($2, $1.generated);
|
||||
})
|
||||
],
|
||||
AssignList: [
|
||||
@@ -221,32 +229,32 @@
|
||||
],
|
||||
Class: [
|
||||
o('CLASS', function() {
|
||||
return new Class(LOCDATA(1));
|
||||
return new Class;
|
||||
}), o('CLASS Block', function() {
|
||||
return new Class(LOCDATA(1, 2), null, null, $2);
|
||||
return new Class(null, null, $2);
|
||||
}), o('CLASS EXTENDS Expression', function() {
|
||||
return new Class(LOCDATA(1, 3), null, $3);
|
||||
return new Class(null, $3);
|
||||
}), o('CLASS EXTENDS Expression Block', function() {
|
||||
return new Class(LOCDATA(1, 4), null, $3, $4);
|
||||
return new Class(null, $3, $4);
|
||||
}), o('CLASS SimpleAssignable', function() {
|
||||
return new Class(LOCDATA(1, 2), $2);
|
||||
return new Class($2);
|
||||
}), o('CLASS SimpleAssignable Block', function() {
|
||||
return new Class(LOCDATA(1, 3), $2, null, $3);
|
||||
return new Class($2, null, $3);
|
||||
}), o('CLASS SimpleAssignable EXTENDS Expression', function() {
|
||||
return new Class(LOCDATA(1, 4), $2, $4);
|
||||
return new Class($2, $4);
|
||||
}), o('CLASS SimpleAssignable EXTENDS Expression Block', function() {
|
||||
return new Class(LOCDATA(1, 5), $2, $4, $5);
|
||||
return new Class($2, $4, $5);
|
||||
})
|
||||
],
|
||||
Invocation: [
|
||||
o('Value OptFuncExist Arguments', function() {
|
||||
return new Call(LOCDATA(1, 3), $1, $3, $2);
|
||||
return new Call($1, $3, $2);
|
||||
}), o('Invocation OptFuncExist Arguments', function() {
|
||||
return new Call(LOCDATA(1, 3), $1, $3, $2);
|
||||
return new Call($1, $3, $2);
|
||||
}), o('SUPER', function() {
|
||||
return new Call(LOCDATA(1), 'super', [new Splat(LOCDATA(1), new Literal(LOCDATA(1), 'arguments'))]);
|
||||
return new Call('super', [new Splat(new Literal('arguments'))]);
|
||||
}), o('SUPER Arguments', function() {
|
||||
return new Call(LOCDATA(1, 2), 'super', $2);
|
||||
return new Call('super', $2);
|
||||
})
|
||||
],
|
||||
OptFuncExist: [
|
||||
@@ -265,21 +273,21 @@
|
||||
],
|
||||
This: [
|
||||
o('THIS', function() {
|
||||
return new Value(LOCDATA(1), new Literal(LOCDATA(1), 'this'));
|
||||
return new Value(new Literal('this'));
|
||||
}), o('@', function() {
|
||||
return new Value(LOCDATA(1), new Literal(LOCDATA(1), 'this'));
|
||||
return new Value(new Literal('this'));
|
||||
})
|
||||
],
|
||||
ThisProperty: [
|
||||
o('@ Identifier', function() {
|
||||
return new Value(LOCDATA(1, 2), new Literal(LOCDATA(1), 'this'), [new Access(LOCDATA(2), $2)], 'this');
|
||||
return new Value(LOCDATA(1)(new Literal('this')), [LOCDATA(2)(new Access($2))], 'this');
|
||||
})
|
||||
],
|
||||
Array: [
|
||||
o('[ ]', function() {
|
||||
return new Arr(LOCDATA(1), []);
|
||||
return new Arr([]);
|
||||
}), o('[ ArgList OptComma ]', function() {
|
||||
return new Arr(LOCDATA(1, 2), $2);
|
||||
return new Arr($2);
|
||||
})
|
||||
],
|
||||
RangeDots: [
|
||||
@@ -291,18 +299,18 @@
|
||||
],
|
||||
Range: [
|
||||
o('[ Expression RangeDots Expression ]', function() {
|
||||
return new Range(LOCDATA(1, 4), $2, $4, $3);
|
||||
return new Range($2, $4, $3);
|
||||
})
|
||||
],
|
||||
Slice: [
|
||||
o('Expression RangeDots Expression', function() {
|
||||
return new Range(LOCDATA(1, 3), $1, $3, $2);
|
||||
return new Range($1, $3, $2);
|
||||
}), o('Expression RangeDots', function() {
|
||||
return new Range(LOCDATA(1, 2), $1, null, $2);
|
||||
return new Range($1, null, $2);
|
||||
}), o('RangeDots Expression', function() {
|
||||
return new Range(LOCDATA(1, 2), null, $2, $1);
|
||||
return new Range(null, $2, $1);
|
||||
}), o('RangeDots', function() {
|
||||
return new Range(LOCDATA(1), null, null, $1);
|
||||
return new Range(null, null, $1);
|
||||
})
|
||||
],
|
||||
ArgList: [
|
||||
@@ -326,47 +334,47 @@
|
||||
],
|
||||
Try: [
|
||||
o('TRY Block', function() {
|
||||
return new Try(LOCDATA(1, 2), $2);
|
||||
return new Try($2);
|
||||
}), o('TRY Block Catch', function() {
|
||||
return new Try(LOCDATA(1, 3), $2, $3[0], $3[1]);
|
||||
return new Try($2, $3[0], $3[1]);
|
||||
}), o('TRY Block FINALLY Block', function() {
|
||||
return new Try(LOCDATA(1, 4), $2, null, null, $4);
|
||||
return new Try($2, null, null, $4);
|
||||
}), o('TRY Block Catch FINALLY Block', function() {
|
||||
return new Try(LOCDATA(1, 5), $2, $3[0], $3[1], $5);
|
||||
return new Try($2, $3[0], $3[1], $5);
|
||||
})
|
||||
],
|
||||
Catch: [
|
||||
o('CATCH Identifier Block', function() {
|
||||
return [$2, $3];
|
||||
}), o('CATCH Object Block', function() {
|
||||
return [new Value(LOCDATA(2), $2), $3];
|
||||
return [LOCDATA(2)(new Value($2)), $3];
|
||||
})
|
||||
],
|
||||
Throw: [
|
||||
o('THROW Expression', function() {
|
||||
return new Throw(LOCDATA(1, 2), $2);
|
||||
return new Throw($2);
|
||||
})
|
||||
],
|
||||
Parenthetical: [
|
||||
o('( Body )', function() {
|
||||
return new Parens(LOCDATA(1, 3), $2);
|
||||
return new Parens($2);
|
||||
}), o('( INDENT Body OUTDENT )', function() {
|
||||
return new Parens(LOCDATA(1, 4), $3);
|
||||
return new Parens($3);
|
||||
})
|
||||
],
|
||||
WhileSource: [
|
||||
o('WHILE Expression', function() {
|
||||
return new While(LOCDATA(1, 2), $2);
|
||||
return new While($2);
|
||||
}), o('WHILE Expression WHEN Expression', function() {
|
||||
return new While(LOCDATA(1, 4), $2, {
|
||||
return new While($2, {
|
||||
guard: $4
|
||||
});
|
||||
}), o('UNTIL Expression', function() {
|
||||
return new While(LOCDATA(1, 2), $2, {
|
||||
return new While($2, {
|
||||
invert: true
|
||||
});
|
||||
}), o('UNTIL Expression WHEN Expression', function() {
|
||||
return new While(LOCDATA(1, 4), $2, {
|
||||
return new While($2, {
|
||||
invert: true,
|
||||
guard: $4
|
||||
});
|
||||
@@ -376,33 +384,33 @@
|
||||
o('WhileSource Block', function() {
|
||||
return $1.addBody($2);
|
||||
}), o('Statement WhileSource', function() {
|
||||
return $2.addBody(Block.wrap(LOCDATA(1), [$1]));
|
||||
return $2.addBody(LOCDATA(1)(Block.wrap([$1])));
|
||||
}), o('Expression WhileSource', function() {
|
||||
return $2.addBody(Block.wrap(LOCDATA(1), [$1]));
|
||||
return $2.addBody(LOCDATA(1)(Block.wrap([$1])));
|
||||
}), o('Loop', function() {
|
||||
return $1;
|
||||
})
|
||||
],
|
||||
Loop: [
|
||||
o('LOOP Block', function() {
|
||||
return new While(LOCDATA(1, 2), new Literal(LOCDATA(1), 'true')).addBody($2);
|
||||
return new While(LOCDATA(1)(new Literal('true'))).addBody($2);
|
||||
}), o('LOOP Expression', function() {
|
||||
return new While(LOCDATA(1, 2), new Literal(LOCDATA(1), 'true')).addBody(Block.wrap(LOCDATA(2), [$2]));
|
||||
return new While(LOCDATA(1)(new Literal('true'))).addBody(LOCDATA(2)(Block.wrap([$2])));
|
||||
})
|
||||
],
|
||||
For: [
|
||||
o('Statement ForBody', function() {
|
||||
return new For(LOCDATA(1, 2), $1, $2);
|
||||
return new For($1, $2);
|
||||
}), o('Expression ForBody', function() {
|
||||
return new For(LOCDATA(1, 2), $1, $2);
|
||||
return new For($1, $2);
|
||||
}), o('ForBody Block', function() {
|
||||
return new For(LOCDATA(1, 2), $2, $1);
|
||||
return new For($2, $1);
|
||||
})
|
||||
],
|
||||
ForBody: [
|
||||
o('FOR Range', function() {
|
||||
return {
|
||||
source: new Value(LOCDATA(2), $2)
|
||||
source: LOCDATA(2)(new Value($2))
|
||||
};
|
||||
}), o('ForStart ForSource', function() {
|
||||
$2.own = $1.own;
|
||||
@@ -421,9 +429,9 @@
|
||||
],
|
||||
ForValue: [
|
||||
o('Identifier'), o('ThisProperty'), o('Array', function() {
|
||||
return new Value(LOCDATA(1), $1);
|
||||
return new Value($1);
|
||||
}), o('Object', function() {
|
||||
return new Value(LOCDATA(1), $1);
|
||||
return new Value($1);
|
||||
})
|
||||
],
|
||||
ForVariables: [
|
||||
@@ -475,13 +483,13 @@
|
||||
],
|
||||
Switch: [
|
||||
o('SWITCH Expression INDENT Whens OUTDENT', function() {
|
||||
return new Switch(LOCDATA(1, 5), $2, $4);
|
||||
return new Switch($2, $4);
|
||||
}), o('SWITCH Expression INDENT Whens ELSE Block OUTDENT', function() {
|
||||
return new Switch(LOCDATA(1, 7), $2, $4, $6);
|
||||
return new Switch($2, $4, $6);
|
||||
}), o('SWITCH INDENT Whens OUTDENT', function() {
|
||||
return new Switch(LOCDATA(1, 4), null, $3);
|
||||
return new Switch(null, $3);
|
||||
}), o('SWITCH INDENT Whens ELSE Block OUTDENT', function() {
|
||||
return new Switch(LOCDATA(1, 6), null, $3, $5);
|
||||
return new Switch(null, $3, $5);
|
||||
})
|
||||
],
|
||||
Whens: [
|
||||
@@ -498,11 +506,11 @@
|
||||
],
|
||||
IfBlock: [
|
||||
o('IF Expression Block', function() {
|
||||
return new If(LOCDATA(1, 3), $2, $3, {
|
||||
return new If($2, $3, {
|
||||
type: $1
|
||||
});
|
||||
}), o('IfBlock ELSE IF Expression Block', function() {
|
||||
return $1.addElse(new If(LOCDATA(1, 5), $4, $5, {
|
||||
return $1.addElse(new If($4, $5, {
|
||||
type: $3
|
||||
}));
|
||||
})
|
||||
@@ -511,12 +519,12 @@
|
||||
o('IfBlock'), o('IfBlock ELSE Block', function() {
|
||||
return $1.addElse($3);
|
||||
}), o('Statement POST_IF Expression', function() {
|
||||
return new If(LOCDATA(1, 3), $3, Block.wrap(LOCDATA(1), [$1]), {
|
||||
return new If($3, LOCDATA(1)(Block.wrap([$1])), {
|
||||
type: $2,
|
||||
statement: true
|
||||
});
|
||||
}), o('Expression POST_IF Expression', function() {
|
||||
return new If(LOCDATA(1, 3), $3, Block.wrap(LOCDATA(1), [$1]), {
|
||||
return new If($3, LOCDATA(1)(Block.wrap([$1])), {
|
||||
type: $2,
|
||||
statement: true
|
||||
});
|
||||
@@ -524,51 +532,51 @@
|
||||
],
|
||||
Operation: [
|
||||
o('UNARY Expression', function() {
|
||||
return new Op(LOCDATA(1, 2), $1, $2);
|
||||
return new Op($1, $2);
|
||||
}), o('- Expression', (function() {
|
||||
return new Op(LOCDATA(1, 2), '-', $2);
|
||||
return new Op('-', $2);
|
||||
}), {
|
||||
prec: 'UNARY'
|
||||
}), o('+ Expression', (function() {
|
||||
return new Op(LOCDATA(1, 2), '+', $2);
|
||||
return new Op('+', $2);
|
||||
}), {
|
||||
prec: 'UNARY'
|
||||
}), o('-- SimpleAssignable', function() {
|
||||
return new Op(LOCDATA(1, 2), '--', $2);
|
||||
return new Op('--', $2);
|
||||
}), o('++ SimpleAssignable', function() {
|
||||
return new Op(LOCDATA(1, 2), '++', $2);
|
||||
return new Op('++', $2);
|
||||
}), o('SimpleAssignable --', function() {
|
||||
return new Op(LOCDATA(1, 2), '--', $1, null, true);
|
||||
return new Op('--', $1, null, true);
|
||||
}), o('SimpleAssignable ++', function() {
|
||||
return new Op(LOCDATA(1, 2), '++', $1, null, true);
|
||||
return new Op('++', $1, null, true);
|
||||
}), o('Expression ?', function() {
|
||||
return new Existence(LOCDATA(1), $1);
|
||||
return new Existence($1);
|
||||
}), o('Expression + Expression', function() {
|
||||
return new Op(LOCDATA(1, 3), '+', $1, $3);
|
||||
return new Op('+', $1, $3);
|
||||
}), o('Expression - Expression', function() {
|
||||
return new Op(LOCDATA(1, 3), '-', $1, $3);
|
||||
return new Op('-', $1, $3);
|
||||
}), o('Expression MATH Expression', function() {
|
||||
return new Op(LOCDATA(1, 3), $2, $1, $3);
|
||||
return new Op($2, $1, $3);
|
||||
}), o('Expression SHIFT Expression', function() {
|
||||
return new Op(LOCDATA(1, 3), $2, $1, $3);
|
||||
return new Op($2, $1, $3);
|
||||
}), o('Expression COMPARE Expression', function() {
|
||||
return new Op(LOCDATA(1, 3), $2, $1, $3);
|
||||
return new Op($2, $1, $3);
|
||||
}), o('Expression LOGIC Expression', function() {
|
||||
return new Op(LOCDATA(1, 3), $2, $1, $3);
|
||||
return new Op($2, $1, $3);
|
||||
}), o('Expression RELATION Expression', function() {
|
||||
if ($2.charAt(0) === '!') {
|
||||
return new Op(LOCDATA(1, 3), $2.slice(1), $1, $3).invert();
|
||||
return new Op($2.slice(1), $1, $3).invert();
|
||||
} else {
|
||||
return new Op(LOCDATA(1, 3), $2, $1, $3);
|
||||
return new Op($2, $1, $3);
|
||||
}
|
||||
}), o('SimpleAssignable COMPOUND_ASSIGN\
|
||||
Expression', function() {
|
||||
return new Assign(LOCDATA(1, 3), $1, $3, $2);
|
||||
return new Assign($1, $3, $2);
|
||||
}), o('SimpleAssignable COMPOUND_ASSIGN\
|
||||
INDENT Expression OUTDENT', function() {
|
||||
return new Assign(LOCDATA(1, 5), $1, $4, $2);
|
||||
return new Assign($1, $4, $2);
|
||||
}), o('SimpleAssignable EXTENDS Expression', function() {
|
||||
return new Extends(LOCDATA(1, 3), $1, $3);
|
||||
return new Extends($1, $3);
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
var extend, flatten, _ref;
|
||||
var buildLocationData, extend, flatten, _ref;
|
||||
|
||||
exports.starts = function(string, literal, start) {
|
||||
return literal === string.substr(start, literal.length);
|
||||
@@ -85,4 +85,26 @@
|
||||
return false;
|
||||
};
|
||||
|
||||
buildLocationData = function(first, last) {
|
||||
if (!last) {
|
||||
return first;
|
||||
} else {
|
||||
return {
|
||||
first_line: first.first_line,
|
||||
first_column: first.first_column,
|
||||
last_line: last.last_line,
|
||||
last_column: last.last_column
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
exports.addLocationDataFn = function(first, last) {
|
||||
return function(obj) {
|
||||
if (((typeof obj) === 'object') && (!!obj['updateLocationDataIfMissing'])) {
|
||||
obj.updateLocationDataIfMissing(buildLocationData(first, last));
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
(function() {
|
||||
var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, some, starts, unfoldSoak, utility, _ref, _ref1,
|
||||
var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, addLocationDataFn, compact, del, ends, extend, flatten, last, merge, multident, some, starts, unfoldSoak, utility, _ref, _ref1,
|
||||
__hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
@@ -9,10 +9,12 @@
|
||||
|
||||
_ref = require('./lexer'), RESERVED = _ref.RESERVED, STRICT_PROSCRIBED = _ref.STRICT_PROSCRIBED;
|
||||
|
||||
_ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last, some = _ref1.some;
|
||||
_ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last, some = _ref1.some, addLocationDataFn = _ref1.addLocationDataFn;
|
||||
|
||||
exports.extend = extend;
|
||||
|
||||
exports.addLocationDataFn = addLocationDataFn;
|
||||
|
||||
YES = function() {
|
||||
return true;
|
||||
};
|
||||
@@ -54,7 +56,7 @@
|
||||
throw SyntaxError('cannot use a pure statement in an expression.');
|
||||
}
|
||||
o.sharedScope = true;
|
||||
return Closure.wrap(this.locationData, this).compileNode(o);
|
||||
return Closure.wrap(this).compileNode(o);
|
||||
};
|
||||
|
||||
Base.prototype.cache = function(o, level, reused) {
|
||||
@@ -63,8 +65,8 @@
|
||||
ref = level ? this.compile(o, level) : this;
|
||||
return [ref, ref];
|
||||
} else {
|
||||
ref = new Literal(this.locationData, reused || o.scope.freeVariable('ref'));
|
||||
sub = new Assign(this.locationData, ref, this);
|
||||
ref = new Literal(reused || o.scope.freeVariable('ref'));
|
||||
sub = new Assign(ref, this);
|
||||
if (level) {
|
||||
return [sub.compile(o, level), ref.value];
|
||||
} else {
|
||||
@@ -86,9 +88,9 @@
|
||||
var me;
|
||||
me = this.unwrapAll();
|
||||
if (res) {
|
||||
return new Call(this.locationData, new Literal(this.locationData, "" + res + ".push"), [me]);
|
||||
return new Call(new Literal("" + res + ".push"), [me]);
|
||||
} else {
|
||||
return new Return(this.locationData, me);
|
||||
return new Return(me);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -176,7 +178,7 @@
|
||||
};
|
||||
|
||||
Base.prototype.invert = function() {
|
||||
return new Op(this.locationData, '!', this);
|
||||
return new Op('!', this);
|
||||
};
|
||||
|
||||
Base.prototype.unwrapAll = function() {
|
||||
@@ -206,6 +208,16 @@
|
||||
|
||||
Base.prototype.assigns = NO;
|
||||
|
||||
Base.prototype.updateLocationDataIfMissing = function(locationData) {
|
||||
if (!this.locationData) {
|
||||
this.locationData = {};
|
||||
extend(this.locationData, locationData);
|
||||
}
|
||||
return this.eachChild(function(child) {
|
||||
return child.updateLocationDataIfMissing(locationData);
|
||||
});
|
||||
};
|
||||
|
||||
return Base;
|
||||
|
||||
})();
|
||||
@@ -214,8 +226,7 @@
|
||||
|
||||
__extends(Block, _super);
|
||||
|
||||
function Block(locationData, nodes) {
|
||||
this.locationData = locationData;
|
||||
function Block(nodes) {
|
||||
this.expressions = compact(flatten(nodes || []));
|
||||
}
|
||||
|
||||
@@ -417,11 +428,11 @@
|
||||
return code + post;
|
||||
};
|
||||
|
||||
Block.wrap = function(locationData, nodes) {
|
||||
Block.wrap = function(nodes) {
|
||||
if (nodes.length === 1 && nodes[0] instanceof Block) {
|
||||
return nodes[0];
|
||||
}
|
||||
return new Block(locationData, nodes);
|
||||
return new Block(nodes);
|
||||
};
|
||||
|
||||
return Block;
|
||||
@@ -432,8 +443,7 @@
|
||||
|
||||
__extends(Literal, _super);
|
||||
|
||||
function Literal(locationData, value) {
|
||||
this.locationData = locationData;
|
||||
function Literal(value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -491,8 +501,8 @@
|
||||
|
||||
__extends(Undefined, _super);
|
||||
|
||||
function Undefined(locationData) {
|
||||
this.locationData = locationData;
|
||||
function Undefined() {
|
||||
return Undefined.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
Undefined.prototype.isAssignable = NO;
|
||||
@@ -515,8 +525,8 @@
|
||||
|
||||
__extends(Null, _super);
|
||||
|
||||
function Null(locationData) {
|
||||
this.locationData = locationData;
|
||||
function Null() {
|
||||
return Null.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
Null.prototype.isAssignable = NO;
|
||||
@@ -543,8 +553,7 @@
|
||||
return this.val;
|
||||
};
|
||||
|
||||
function Bool(locationData, val) {
|
||||
this.locationData = locationData;
|
||||
function Bool(val) {
|
||||
this.val = val;
|
||||
}
|
||||
|
||||
@@ -556,8 +565,7 @@
|
||||
|
||||
__extends(Return, _super);
|
||||
|
||||
function Return(locationData, expr) {
|
||||
this.locationData = locationData;
|
||||
function Return(expr) {
|
||||
if (expr && !expr.unwrap().isUndefined) {
|
||||
this.expression = expr;
|
||||
}
|
||||
@@ -593,11 +601,10 @@
|
||||
|
||||
__extends(Value, _super);
|
||||
|
||||
function Value(locationData, base, props, tag) {
|
||||
function Value(base, props, tag) {
|
||||
if (!props && base instanceof Value) {
|
||||
return base;
|
||||
}
|
||||
this.locationData = locationData;
|
||||
this.base = base;
|
||||
this.properties = props || [];
|
||||
if (tag) {
|
||||
@@ -686,20 +693,20 @@
|
||||
if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) {
|
||||
return [this, this];
|
||||
}
|
||||
base = new Value(this.locationData, this.base, this.properties.slice(0, -1));
|
||||
base = new Value(this.base, this.properties.slice(0, -1));
|
||||
if (base.isComplex()) {
|
||||
bref = new Literal(this.locationData, o.scope.freeVariable('base'));
|
||||
base = new Value(this.locationData, new Parens(this.locationData, new Assign(this.locationData, bref, base)));
|
||||
bref = new Literal(o.scope.freeVariable('base'));
|
||||
base = new Value(new Parens(new Assign(bref, base)));
|
||||
}
|
||||
if (!name) {
|
||||
return [base, bref];
|
||||
}
|
||||
if (name.isComplex()) {
|
||||
nref = new Literal(this.locationData, o.scope.freeVariable('name'));
|
||||
name = new Index(this.locationData, new Assign(this.locationData, nref, name.index));
|
||||
nref = new Index(this.locationData, nref);
|
||||
nref = new Literal(o.scope.freeVariable('name'));
|
||||
name = new Index(new Assign(nref, name.index));
|
||||
nref = new Index(nref);
|
||||
}
|
||||
return [base.add(name), new Value(this.locationData, bref || base.base, [nref || name])];
|
||||
return [base.add(name), new Value(bref || base.base, [nref || name])];
|
||||
};
|
||||
|
||||
Value.prototype.compileNode = function(o) {
|
||||
@@ -736,14 +743,14 @@
|
||||
continue;
|
||||
}
|
||||
prop.soak = false;
|
||||
fst = new Value(_this.locationData, _this.base, _this.properties.slice(0, i));
|
||||
snd = new Value(_this.locationData, _this.base, _this.properties.slice(i));
|
||||
fst = new Value(_this.base, _this.properties.slice(0, i));
|
||||
snd = new Value(_this.base, _this.properties.slice(i));
|
||||
if (fst.isComplex()) {
|
||||
ref = new Literal(_this.locationData, o.scope.freeVariable('ref'));
|
||||
fst = new Parens(_this.locationData, new Assign(_this.locationData, ref, fst));
|
||||
ref = new Literal(o.scope.freeVariable('ref'));
|
||||
fst = new Parens(new Assign(ref, fst));
|
||||
snd.base = ref;
|
||||
}
|
||||
return new If(_this.locationData, new Existence(_this.locationData, fst), snd, {
|
||||
return new If(new Existence(fst), snd, {
|
||||
soak: true
|
||||
});
|
||||
}
|
||||
@@ -760,8 +767,7 @@
|
||||
|
||||
__extends(Comment, _super);
|
||||
|
||||
function Comment(locationData, comment) {
|
||||
this.locationData = locationData;
|
||||
function Comment(comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
@@ -786,8 +792,7 @@
|
||||
|
||||
__extends(Call, _super);
|
||||
|
||||
function Call(locationData, variable, args, soak) {
|
||||
this.locationData = locationData;
|
||||
function Call(variable, args, soak) {
|
||||
this.args = args != null ? args : [];
|
||||
this.soak = soak;
|
||||
this.isNew = false;
|
||||
@@ -819,12 +824,12 @@
|
||||
throw SyntaxError('cannot call super on an anonymous function.');
|
||||
}
|
||||
if (method.klass) {
|
||||
accesses = [new Access(this.locationData, new Literal(this.locationData, '__super__'))];
|
||||
accesses = [new Access(new Literal('__super__'))];
|
||||
if (method["static"]) {
|
||||
accesses.push(new Access(this.locationData, new Literal(this.locationData, 'constructor')));
|
||||
accesses.push(new Access(new Literal('constructor')));
|
||||
}
|
||||
accesses.push(new Access(this.locationData, new Literal(this.locationData, name)));
|
||||
return (new Value(this.locationData, new Literal(this.locationData, method.klass), accesses)).compile(o);
|
||||
accesses.push(new Access(new Literal(name)));
|
||||
return (new Value(new Literal(method.klass), accesses)).compile(o);
|
||||
} else {
|
||||
return "" + name + ".__super__.constructor";
|
||||
}
|
||||
@@ -843,15 +848,15 @@
|
||||
if (ifn = unfoldSoak(o, this, 'variable')) {
|
||||
return ifn;
|
||||
}
|
||||
_ref2 = new Value(this.locationData, this.variable).cacheReference(o), left = _ref2[0], rite = _ref2[1];
|
||||
_ref2 = new Value(this.variable).cacheReference(o), left = _ref2[0], rite = _ref2[1];
|
||||
} else {
|
||||
left = new Literal(this.locationData, this.superReference(o));
|
||||
rite = new Value(this.locationData, left);
|
||||
left = new Literal(this.superReference(o));
|
||||
rite = new Value(left);
|
||||
}
|
||||
rite = new Call(this.locationData, rite, this.args);
|
||||
rite = new Call(rite, this.args);
|
||||
rite.isNew = this.isNew;
|
||||
left = new Literal(this.locationData, "typeof " + (left.compile(o)) + " === \"function\"");
|
||||
return new If(this.locationData, left, new Value(this.locationData, rite), {
|
||||
left = new Literal("typeof " + (left.compile(o)) + " === \"function\"");
|
||||
return new If(left, new Value(rite), {
|
||||
soak: true
|
||||
});
|
||||
}
|
||||
@@ -901,7 +906,7 @@
|
||||
prop = _ref2[_j];
|
||||
if (prop instanceof Assign || prop instanceof Comment) {
|
||||
if (!obj) {
|
||||
nodes.push(obj = new Obj(this.locationData, properties = [], true));
|
||||
nodes.push(obj = new Obj(properties = [], true));
|
||||
}
|
||||
properties.push(prop);
|
||||
} else {
|
||||
@@ -951,7 +956,7 @@
|
||||
idt = this.tab + TAB;
|
||||
return "(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return Object(result) === result ? result : child;\n" + this.tab + "})(" + (this.variable.compile(o, LEVEL_LIST)) + ", " + splatArgs + ", function(){})";
|
||||
}
|
||||
base = new Value(this.locationData, this.variable);
|
||||
base = new Value(this.variable);
|
||||
if ((name = base.properties.pop()) && base.isComplex()) {
|
||||
ref = o.scope.freeVariable('ref');
|
||||
fun = "(" + ref + " = " + (base.compile(o, LEVEL_LIST)) + ")" + (name.compile(o));
|
||||
@@ -978,8 +983,7 @@
|
||||
|
||||
__extends(Extends, _super);
|
||||
|
||||
function Extends(locationData, child, parent) {
|
||||
this.locationData = locationData;
|
||||
function Extends(child, parent) {
|
||||
this.child = child;
|
||||
this.parent = parent;
|
||||
}
|
||||
@@ -987,7 +991,7 @@
|
||||
Extends.prototype.children = ['child', 'parent'];
|
||||
|
||||
Extends.prototype.compile = function(o) {
|
||||
return new Call(this.locationData, new Value(this.locationData, new Literal(this.locationData, utility('extends'))), [this.child, this.parent]).compile(o);
|
||||
return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compile(o);
|
||||
};
|
||||
|
||||
return Extends;
|
||||
@@ -998,8 +1002,7 @@
|
||||
|
||||
__extends(Access, _super);
|
||||
|
||||
function Access(locationData, name, tag) {
|
||||
this.locationData = locationData;
|
||||
function Access(name, tag) {
|
||||
this.name = name;
|
||||
this.name.asKey = true;
|
||||
this.soak = tag === 'soak';
|
||||
@@ -1027,8 +1030,7 @@
|
||||
|
||||
__extends(Index, _super);
|
||||
|
||||
function Index(locationData, index) {
|
||||
this.locationData = locationData;
|
||||
function Index(index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@@ -1052,8 +1054,7 @@
|
||||
|
||||
Range.prototype.children = ['from', 'to'];
|
||||
|
||||
function Range(locationData, from, to, tag) {
|
||||
this.locationData = locationData;
|
||||
function Range(from, to, tag) {
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.exclusive = tag === 'exclusive';
|
||||
@@ -1154,8 +1155,7 @@
|
||||
|
||||
Slice.prototype.children = ['range'];
|
||||
|
||||
function Slice(locationData, range) {
|
||||
this.locationData = locationData;
|
||||
function Slice(range) {
|
||||
this.range = range;
|
||||
Slice.__super__.constructor.call(this);
|
||||
}
|
||||
@@ -1179,8 +1179,7 @@
|
||||
|
||||
__extends(Obj, _super);
|
||||
|
||||
function Obj(locationData, props, generated) {
|
||||
this.locationData = locationData;
|
||||
function Obj(props, generated) {
|
||||
this.generated = generated != null ? generated : false;
|
||||
this.objects = this.properties = props || [];
|
||||
}
|
||||
@@ -1211,18 +1210,18 @@
|
||||
join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n';
|
||||
indent = prop instanceof Comment ? '' : idt;
|
||||
if (prop instanceof Value && prop["this"]) {
|
||||
prop = new Assign(this.locationData, prop.properties[0].name, prop, 'object');
|
||||
prop = new Assign(prop.properties[0].name, prop, 'object');
|
||||
}
|
||||
if (!(prop instanceof Comment)) {
|
||||
if (!(prop instanceof Assign)) {
|
||||
prop = new Assign(this.locationData, prop, prop, 'object');
|
||||
prop = new Assign(prop, prop, 'object');
|
||||
}
|
||||
(prop.variable.base || prop.variable).asKey = true;
|
||||
}
|
||||
_results.push(indent + prop.compile(o, LEVEL_TOP) + join);
|
||||
}
|
||||
return _results;
|
||||
}).call(this);
|
||||
})();
|
||||
props = props.join('');
|
||||
obj = "{" + (props && '\n' + props + '\n' + this.tab) + "}";
|
||||
if (this.front) {
|
||||
@@ -1252,8 +1251,7 @@
|
||||
|
||||
__extends(Arr, _super);
|
||||
|
||||
function Arr(locationData, objs) {
|
||||
this.locationData = locationData;
|
||||
function Arr(objs) {
|
||||
this.objects = objs || [];
|
||||
}
|
||||
|
||||
@@ -1307,11 +1305,10 @@
|
||||
|
||||
__extends(Class, _super);
|
||||
|
||||
function Class(locationData, variable, parent, body) {
|
||||
this.locationData = locationData;
|
||||
function Class(variable, parent, body) {
|
||||
this.variable = variable;
|
||||
this.parent = parent;
|
||||
this.body = body != null ? body : new Block(this.locationData);
|
||||
this.body = body != null ? body : new Block;
|
||||
this.boundFuncs = [];
|
||||
this.body.classBody = true;
|
||||
}
|
||||
@@ -1353,8 +1350,8 @@
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
bvar = _ref2[_i];
|
||||
lhs = (new Value(this.locationData, new Literal(this.locationData, "this"), [new Access(this.locationData, bvar)])).compile(o);
|
||||
_results.push(this.ctor.body.unshift(new Literal(this.locationData, "" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)")));
|
||||
lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o);
|
||||
_results.push(this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)")));
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
@@ -1382,7 +1379,7 @@
|
||||
assign = this.ctor = func;
|
||||
} else {
|
||||
this.externalCtor = o.scope.freeVariable('class');
|
||||
assign = new Assign(this.locationData, new Literal(this.locationData, this.externalCtor), func);
|
||||
assign = new Assign(new Literal(this.externalCtor), func);
|
||||
}
|
||||
} else {
|
||||
if (assign.variable["this"]) {
|
||||
@@ -1391,7 +1388,7 @@
|
||||
func.context = name;
|
||||
}
|
||||
} else {
|
||||
assign.variable = new Value(this.locationData, new Literal(this.locationData, name), [new Access(this.locationData, new Literal(this.locationData, 'prototype')), new Access(this.locationData, base)]);
|
||||
assign.variable = new Value(new Literal(name), [new Access(new Literal('prototype')), new Access(base)]);
|
||||
if (func instanceof Code && func.bound) {
|
||||
this.boundFuncs.push(base);
|
||||
func.bound = false;
|
||||
@@ -1438,12 +1435,12 @@
|
||||
|
||||
Class.prototype.ensureConstructor = function(name) {
|
||||
if (!this.ctor) {
|
||||
this.ctor = new Code(this.locationData);
|
||||
this.ctor = new Code;
|
||||
if (this.parent) {
|
||||
this.ctor.body.push(new Literal(this.locationData, "" + name + ".__super__.constructor.apply(this, arguments)"));
|
||||
this.ctor.body.push(new Literal("" + name + ".__super__.constructor.apply(this, arguments)"));
|
||||
}
|
||||
if (this.externalCtor) {
|
||||
this.ctor.body.push(new Literal(this.locationData, "" + this.externalCtor + ".apply(this, arguments)"));
|
||||
this.ctor.body.push(new Literal("" + this.externalCtor + ".apply(this, arguments)"));
|
||||
}
|
||||
this.ctor.body.makeReturn();
|
||||
this.body.expressions.unshift(this.ctor);
|
||||
@@ -1460,7 +1457,7 @@
|
||||
if (name.reserved) {
|
||||
name = "_" + name;
|
||||
}
|
||||
lname = new Literal(this.locationData, name);
|
||||
lname = new Literal(name);
|
||||
this.hoistDirectivePrologue();
|
||||
this.setContext(name);
|
||||
this.walkBody(name, o);
|
||||
@@ -1472,17 +1469,17 @@
|
||||
this.body.expressions.push(lname);
|
||||
(_ref2 = this.body.expressions).unshift.apply(_ref2, this.directives);
|
||||
this.addBoundFunctions(o);
|
||||
call = Closure.wrap(this.locationData, this.body);
|
||||
call = Closure.wrap(this.body);
|
||||
if (this.parent) {
|
||||
this.superClass = new Literal(this.locationData, o.scope.freeVariable('super', false));
|
||||
this.body.expressions.unshift(new Extends(this.locationData, lname, this.superClass));
|
||||
this.superClass = new Literal(o.scope.freeVariable('super', false));
|
||||
this.body.expressions.unshift(new Extends(lname, this.superClass));
|
||||
call.args.push(this.parent);
|
||||
params = call.variable.params || call.variable.base.params;
|
||||
params.push(new Param(this.locationData, this.superClass));
|
||||
params.push(new Param(this.superClass));
|
||||
}
|
||||
klass = new Parens(this.locationData, call, true);
|
||||
klass = new Parens(call, true);
|
||||
if (this.variable) {
|
||||
klass = new Assign(this.locationData, this.variable, klass);
|
||||
klass = new Assign(this.variable, klass);
|
||||
}
|
||||
return klass.compile(o);
|
||||
};
|
||||
@@ -1495,9 +1492,8 @@
|
||||
|
||||
__extends(Assign, _super);
|
||||
|
||||
function Assign(locationData, variable, value, context, options) {
|
||||
function Assign(variable, value, context, options) {
|
||||
var forbidden, name, _ref2;
|
||||
this.locationData = locationData;
|
||||
this.variable = variable;
|
||||
this.value = value;
|
||||
this.context = context;
|
||||
@@ -1586,18 +1582,18 @@
|
||||
_ref2 = obj, (_ref3 = _ref2.variable, idx = _ref3.base), obj = _ref2.value;
|
||||
} else {
|
||||
if (obj.base instanceof Parens) {
|
||||
_ref4 = new Value(this.locationData, obj.unwrapAll()).cacheReference(o), obj = _ref4[0], idx = _ref4[1];
|
||||
_ref4 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref4[0], idx = _ref4[1];
|
||||
} else {
|
||||
idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(this.locationData, 0);
|
||||
idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0);
|
||||
}
|
||||
}
|
||||
acc = IDENTIFIER.test(idx.unwrap().value || 0);
|
||||
value = new Value(this.locationData, value);
|
||||
value.properties.push(new (acc ? Access : Index)(this.locationData, idx));
|
||||
value = new Value(value);
|
||||
value.properties.push(new (acc ? Access : Index)(idx));
|
||||
if (_ref5 = obj.unwrap().value, __indexOf.call(RESERVED, _ref5) >= 0) {
|
||||
throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (value.compile(o)));
|
||||
}
|
||||
return new Assign(this.locationData, obj, value, null, {
|
||||
return new Assign(obj, value, null, {
|
||||
param: this.param
|
||||
}).compile(o, LEVEL_TOP);
|
||||
}
|
||||
@@ -1616,7 +1612,7 @@
|
||||
_ref6 = obj, (_ref7 = _ref6.variable, idx = _ref7.base), obj = _ref6.value;
|
||||
} else {
|
||||
if (obj.base instanceof Parens) {
|
||||
_ref8 = new Value(this.locationData, obj.unwrapAll()).cacheReference(o), obj = _ref8[0], idx = _ref8[1];
|
||||
_ref8 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref8[0], idx = _ref8[1];
|
||||
} else {
|
||||
idx = obj["this"] ? obj.properties[0].name : obj;
|
||||
}
|
||||
@@ -1632,7 +1628,7 @@
|
||||
} else {
|
||||
val += ") : []";
|
||||
}
|
||||
val = new Literal(this.locationData, val);
|
||||
val = new Literal(val);
|
||||
splat = "" + ivar + "++";
|
||||
} else {
|
||||
name = obj.unwrap().value;
|
||||
@@ -1641,17 +1637,17 @@
|
||||
throw new SyntaxError("multiple splats are disallowed in an assignment: " + obj + "...");
|
||||
}
|
||||
if (typeof idx === 'number') {
|
||||
idx = new Literal(this.locationData, splat || idx);
|
||||
idx = new Literal(splat || idx);
|
||||
acc = false;
|
||||
} else {
|
||||
acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0);
|
||||
}
|
||||
val = new Value(this.locationData, new Literal(this.locationData, vvar), [new (acc ? Access : Index)(this.locationData, idx)]);
|
||||
val = new Value(new Literal(vvar), [new (acc ? Access : Index)(idx)]);
|
||||
}
|
||||
if ((name != null) && __indexOf.call(RESERVED, name) >= 0) {
|
||||
throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (val.compile(o)));
|
||||
}
|
||||
assigns.push(new Assign(this.locationData, obj, val, null, {
|
||||
assigns.push(new Assign(obj, val, null, {
|
||||
param: this.param,
|
||||
subpattern: true
|
||||
}).compile(o, LEVEL_LIST));
|
||||
@@ -1676,7 +1672,7 @@
|
||||
if (__indexOf.call(this.context, "?") >= 0) {
|
||||
o.isExistentialEquals = true;
|
||||
}
|
||||
return new Op(this.locationData, this.context.slice(0, -1), left, new Assign(this.locationData, right, this.value, '=')).compile(o);
|
||||
return new Op(this.context.slice(0, -1), left, new Assign(right, this.value, '=')).compile(o);
|
||||
};
|
||||
|
||||
Assign.prototype.compileSplice = function(o) {
|
||||
@@ -1716,10 +1712,9 @@
|
||||
|
||||
__extends(Code, _super);
|
||||
|
||||
function Code(locationData, params, body, tag) {
|
||||
this.locationData = locationData;
|
||||
function Code(params, body, tag) {
|
||||
this.params = params || [];
|
||||
this.body = body || new Block(this.locationData);
|
||||
this.body = body || new Block;
|
||||
this.bound = tag === 'boundfunc';
|
||||
if (this.bound) {
|
||||
this.context = '_this';
|
||||
@@ -1766,7 +1761,7 @@
|
||||
o.scope.add(p.value, 'var', true);
|
||||
}
|
||||
}
|
||||
splats = new Assign(this.locationData, new Value(this.locationData, new Arr(this.locationData, (function() {
|
||||
splats = new Assign(new Value(new Arr((function() {
|
||||
var _l, _len3, _ref5, _results;
|
||||
_ref5 = this.params;
|
||||
_results = [];
|
||||
@@ -1775,7 +1770,7 @@
|
||||
_results.push(p.asReference(o));
|
||||
}
|
||||
return _results;
|
||||
}).call(this))), new Value(this.locationData, new Literal(this.locationData, 'arguments')));
|
||||
}).call(this))), new Value(new Literal('arguments')));
|
||||
break;
|
||||
}
|
||||
_ref5 = this.params;
|
||||
@@ -1784,17 +1779,17 @@
|
||||
if (param.isComplex()) {
|
||||
val = ref = param.asReference(o);
|
||||
if (param.value) {
|
||||
val = new Op(this.locationData, '?', ref, param.value);
|
||||
val = new Op('?', ref, param.value);
|
||||
}
|
||||
exprs.push(new Assign(this.locationData, new Value(this.locationData, param.name), val, '=', {
|
||||
exprs.push(new Assign(new Value(param.name), val, '=', {
|
||||
param: true
|
||||
}));
|
||||
} else {
|
||||
ref = param;
|
||||
if (param.value) {
|
||||
lit = new Literal(this.locationData, ref.name.value + ' == null');
|
||||
val = new Assign(this.locationData, new Value(this.locationData, param.name), param.value, '=');
|
||||
exprs.push(new If(this.locationData, lit, val));
|
||||
lit = new Literal(ref.name.value + ' == null');
|
||||
val = new Assign(new Value(param.name), param.value, '=');
|
||||
exprs.push(new If(lit, val));
|
||||
}
|
||||
}
|
||||
if (!splats) {
|
||||
@@ -1876,9 +1871,8 @@
|
||||
|
||||
__extends(Param, _super);
|
||||
|
||||
function Param(locationData, name, value, splat) {
|
||||
function Param(name, value, splat) {
|
||||
var _ref2;
|
||||
this.locationData = locationData;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.splat = splat;
|
||||
@@ -1902,14 +1896,14 @@
|
||||
if (node["this"]) {
|
||||
node = node.properties[0].name;
|
||||
if (node.value.reserved) {
|
||||
node = new Literal(this.locationData, o.scope.freeVariable(node.value));
|
||||
node = new Literal(o.scope.freeVariable(node.value));
|
||||
}
|
||||
} else if (node.isComplex()) {
|
||||
node = new Literal(this.locationData, o.scope.freeVariable('arg'));
|
||||
node = new Literal(o.scope.freeVariable('arg'));
|
||||
}
|
||||
node = new Value(this.locationData, node);
|
||||
node = new Value(node);
|
||||
if (this.splat) {
|
||||
node = new Splat(this.locationData, node);
|
||||
node = new Splat(node);
|
||||
}
|
||||
return this.reference = node;
|
||||
};
|
||||
@@ -1973,9 +1967,8 @@
|
||||
|
||||
Splat.prototype.isAssignable = YES;
|
||||
|
||||
function Splat(locationData, name) {
|
||||
this.locationData = locationData;
|
||||
this.name = name.compile ? name : new Literal(this.locationData, name);
|
||||
function Splat(name) {
|
||||
this.name = name.compile ? name : new Literal(name);
|
||||
}
|
||||
|
||||
Splat.prototype.assigns = function(name) {
|
||||
@@ -2040,8 +2033,7 @@
|
||||
|
||||
__extends(While, _super);
|
||||
|
||||
function While(locationData, condition, options) {
|
||||
this.locationData = locationData;
|
||||
function While(condition, options) {
|
||||
this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition;
|
||||
this.guard = options != null ? options.guard : void 0;
|
||||
}
|
||||
@@ -2097,10 +2089,10 @@
|
||||
}
|
||||
if (this.guard) {
|
||||
if (body.expressions.length > 1) {
|
||||
body.expressions.unshift(new If(this.locationData, new Parens(this.locationData, this.guard)).invert(), new Literal(this.locationData, "continue"));
|
||||
body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue")));
|
||||
} else {
|
||||
if (this.guard) {
|
||||
body = Block.wrap(this.locationData, [new If(this.locationData, this.guard, body)]);
|
||||
body = Block.wrap([new If(this.guard, body)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2122,10 +2114,9 @@
|
||||
|
||||
__extends(Op, _super);
|
||||
|
||||
function Op(locationData, op, first, second, flip) {
|
||||
this.locationData = locationData;
|
||||
function Op(op, first, second, flip) {
|
||||
if (op === 'in') {
|
||||
return new In(this.locationData, first, second);
|
||||
return new In(first, second);
|
||||
}
|
||||
if (op === 'do') {
|
||||
return this.generateDo(first);
|
||||
@@ -2135,7 +2126,7 @@
|
||||
return first.newInstance();
|
||||
}
|
||||
if (first instanceof Code && first.bound || first["do"]) {
|
||||
first = new Parens(this.locationData, first);
|
||||
first = new Parens(first);
|
||||
}
|
||||
}
|
||||
this.operator = CONVERSIONS[op] || op;
|
||||
@@ -2184,7 +2175,7 @@
|
||||
curr = curr.first;
|
||||
}
|
||||
if (!allInvertable) {
|
||||
return new Parens(this.locationData, this).invert();
|
||||
return new Parens(this).invert();
|
||||
}
|
||||
curr = this;
|
||||
while (curr && curr.operator) {
|
||||
@@ -2200,11 +2191,11 @@
|
||||
}
|
||||
return this;
|
||||
} else if (this.second) {
|
||||
return new Parens(this.locationData, this).invert();
|
||||
return new Parens(this).invert();
|
||||
} else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref2 = fst.operator) === '!' || _ref2 === 'in' || _ref2 === 'instanceof')) {
|
||||
return fst;
|
||||
} else {
|
||||
return new Op(this.locationData, '!', this);
|
||||
return new Op('!', this);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2227,7 +2218,7 @@
|
||||
passedParams.push(param);
|
||||
}
|
||||
}
|
||||
call = new Call(this.locationData, exp, passedParams);
|
||||
call = new Call(exp, passedParams);
|
||||
call["do"] = true;
|
||||
return call;
|
||||
};
|
||||
@@ -2272,13 +2263,13 @@
|
||||
Op.prototype.compileExistence = function(o) {
|
||||
var fst, ref;
|
||||
if (this.first.isComplex()) {
|
||||
ref = new Literal(this.locationData, o.scope.freeVariable('ref'));
|
||||
fst = new Parens(this.locationData, new Assign(this.locationData, ref, this.first));
|
||||
ref = new Literal(o.scope.freeVariable('ref'));
|
||||
fst = new Parens(new Assign(ref, this.first));
|
||||
} else {
|
||||
fst = this.first;
|
||||
ref = fst;
|
||||
}
|
||||
return new If(this.locationData, new Existence(this.locationData, fst), ref, {
|
||||
return new If(new Existence(fst), ref, {
|
||||
type: 'if'
|
||||
}).addElse(this.second).compile(o);
|
||||
};
|
||||
@@ -2291,14 +2282,14 @@
|
||||
return this.first.compile(o);
|
||||
}
|
||||
if (o.level >= LEVEL_ACCESS) {
|
||||
return (new Parens(this.locationData, this)).compile(o);
|
||||
return (new Parens(this)).compile(o);
|
||||
}
|
||||
plusMinus = op === '+' || op === '-';
|
||||
if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) {
|
||||
parts.push(' ');
|
||||
}
|
||||
if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) {
|
||||
this.first = new Parens(this.locationData, this.first);
|
||||
this.first = new Parens(this.first);
|
||||
}
|
||||
parts.push(this.first.compile(o, LEVEL_OP));
|
||||
if (this.flip) {
|
||||
@@ -2319,8 +2310,7 @@
|
||||
|
||||
__extends(In, _super);
|
||||
|
||||
function In(locationData, object, array) {
|
||||
this.locationData = locationData;
|
||||
function In(object, array) {
|
||||
this.object = object;
|
||||
this.array = array;
|
||||
}
|
||||
@@ -2400,8 +2390,7 @@
|
||||
|
||||
__extends(Try, _super);
|
||||
|
||||
function Try(locationData, attempt, error, recovery, ensure) {
|
||||
this.locationData = locationData;
|
||||
function Try(attempt, error, recovery, ensure) {
|
||||
this.attempt = attempt;
|
||||
this.error = error;
|
||||
this.recovery = recovery;
|
||||
@@ -2435,8 +2424,8 @@
|
||||
var _base, _ref2;
|
||||
if (this.recovery) {
|
||||
if (typeof (_base = this.error).isObject === "function" ? _base.isObject() : void 0) {
|
||||
placeholder = new Literal(this.locationData, '_error');
|
||||
this.recovery.unshift(new Assign(this.locationData, this.error, placeholder));
|
||||
placeholder = new Literal('_error');
|
||||
this.recovery.unshift(new Assign(this.error, placeholder));
|
||||
this.error = placeholder;
|
||||
}
|
||||
if (_ref2 = this.error.value, __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0) {
|
||||
@@ -2462,8 +2451,7 @@
|
||||
|
||||
__extends(Throw, _super);
|
||||
|
||||
function Throw(locationData, expression) {
|
||||
this.locationData = locationData;
|
||||
function Throw(expression) {
|
||||
this.expression = expression;
|
||||
}
|
||||
|
||||
@@ -2487,8 +2475,7 @@
|
||||
|
||||
__extends(Existence, _super);
|
||||
|
||||
function Existence(locationData, expression) {
|
||||
this.locationData = locationData;
|
||||
function Existence(expression) {
|
||||
this.expression = expression;
|
||||
}
|
||||
|
||||
@@ -2521,8 +2508,7 @@
|
||||
|
||||
__extends(Parens, _super);
|
||||
|
||||
function Parens(locationData, body) {
|
||||
this.locationData = locationData;
|
||||
function Parens(body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@@ -2560,11 +2546,10 @@
|
||||
|
||||
__extends(For, _super);
|
||||
|
||||
function For(locationData, body, source) {
|
||||
function For(body, source) {
|
||||
var _ref2;
|
||||
this.locationData = locationData;
|
||||
this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index;
|
||||
this.body = Block.wrap(this.locationData, [body]);
|
||||
this.body = Block.wrap([body]);
|
||||
this.own = !!source.own;
|
||||
this.object = !!source.object;
|
||||
if (this.object) {
|
||||
@@ -2588,7 +2573,7 @@
|
||||
|
||||
For.prototype.compileNode = function(o) {
|
||||
var body, defPart, forPart, forVarPart, guardPart, idt1, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, stepvar, svar, varPart, _ref2;
|
||||
body = Block.wrap(this.locationData, [this.body]);
|
||||
body = Block.wrap([this.body]);
|
||||
lastJumps = (_ref2 = last(body.expressions)) != null ? _ref2.jumps() : void 0;
|
||||
if (lastJumps && lastJumps instanceof Return) {
|
||||
this.returns = false;
|
||||
@@ -2651,15 +2636,15 @@
|
||||
}
|
||||
if (this.guard) {
|
||||
if (body.expressions.length > 1) {
|
||||
body.expressions.unshift(new If(this.locationData, (new Parens(this.locationData, this.guard)).invert(), new Literal(this.locationData, "continue")));
|
||||
body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue")));
|
||||
} else {
|
||||
if (this.guard) {
|
||||
body = Block.wrap(this.locationData, [new If(this.locationData, this.guard, body)]);
|
||||
body = Block.wrap([new If(this.guard, body)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.pattern) {
|
||||
body.expressions.unshift(new Assign(this.locationData, this.name, new Literal(this.locationData, "" + svar + "[" + kvar + "]")));
|
||||
body.expressions.unshift(new Assign(this.name, new Literal("" + svar + "[" + kvar + "]")));
|
||||
}
|
||||
defPart += this.pluckDirectCall(o, body);
|
||||
if (namePart) {
|
||||
@@ -2695,13 +2680,13 @@
|
||||
continue;
|
||||
}
|
||||
fn = ((_ref6 = val.base) != null ? _ref6.unwrapAll() : void 0) || val;
|
||||
ref = new Literal(this.locationData, o.scope.freeVariable('fn'));
|
||||
base = new Value(this.locationData, ref);
|
||||
ref = new Literal(o.scope.freeVariable('fn'));
|
||||
base = new Value(ref);
|
||||
if (val.base) {
|
||||
_ref7 = [base, val], val.base = _ref7[0], base = _ref7[1];
|
||||
}
|
||||
body.expressions[idx] = new Call(this.locationData, base, expr.args);
|
||||
defs += this.tab + new Assign(this.locationData, ref, fn).compile(o, LEVEL_TOP) + ';\n';
|
||||
body.expressions[idx] = new Call(base, expr.args);
|
||||
defs += this.tab + new Assign(ref, fn).compile(o, LEVEL_TOP) + ';\n';
|
||||
}
|
||||
return defs;
|
||||
};
|
||||
@@ -2714,8 +2699,7 @@
|
||||
|
||||
__extends(Switch, _super);
|
||||
|
||||
function Switch(locationData, subject, cases, otherwise) {
|
||||
this.locationData = locationData;
|
||||
function Switch(subject, cases, otherwise) {
|
||||
this.subject = subject;
|
||||
this.cases = cases;
|
||||
this.otherwise = otherwise;
|
||||
@@ -2750,7 +2734,7 @@
|
||||
pair[1].makeReturn(res);
|
||||
}
|
||||
if (res) {
|
||||
this.otherwise || (this.otherwise = new Block(this.locationData, [new Literal(this.locationData, 'void 0')]));
|
||||
this.otherwise || (this.otherwise = new Block([new Literal('void 0')]));
|
||||
}
|
||||
if ((_ref3 = this.otherwise) != null) {
|
||||
_ref3.makeReturn(res);
|
||||
@@ -2800,8 +2784,7 @@
|
||||
|
||||
__extends(If, _super);
|
||||
|
||||
function If(locationData, condition, body, options) {
|
||||
this.locationData = locationData;
|
||||
function If(condition, body, options) {
|
||||
this.body = body;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
@@ -2854,10 +2837,10 @@
|
||||
|
||||
If.prototype.makeReturn = function(res) {
|
||||
if (res) {
|
||||
this.elseBody || (this.elseBody = new Block(this.locationData, [new Literal(this.locationData, 'void 0')]));
|
||||
this.elseBody || (this.elseBody = new Block([new Literal('void 0')]));
|
||||
}
|
||||
this.body && (this.body = new Block(this.locationData, [this.body.makeReturn(res)]));
|
||||
this.elseBody && (this.elseBody = new Block(this.locationData, [this.elseBody.makeReturn(res)]));
|
||||
this.body && (this.body = new Block([this.body.makeReturn(res)]));
|
||||
this.elseBody && (this.elseBody = new Block([this.elseBody.makeReturn(res)]));
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -2865,7 +2848,7 @@
|
||||
if (node instanceof Block) {
|
||||
return node;
|
||||
} else {
|
||||
return new Block(this.locationData, [node]);
|
||||
return new Block([node]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2874,7 +2857,7 @@
|
||||
child = del(o, 'chainChild');
|
||||
exeq = del(o, 'isExistentialEquals');
|
||||
if (exeq) {
|
||||
return new If(this.locationData, this.condition.invert(), this.elseBodyNode(), {
|
||||
return new If(this.condition.invert(), this.elseBodyNode(), {
|
||||
type: 'if'
|
||||
}).compile(o);
|
||||
}
|
||||
@@ -2913,25 +2896,25 @@
|
||||
})(Base);
|
||||
|
||||
Closure = {
|
||||
wrap: function(locationData, expressions, statement, noReturn) {
|
||||
wrap: function(expressions, statement, noReturn) {
|
||||
var args, call, func, mentionsArgs, meth;
|
||||
if (expressions.jumps()) {
|
||||
return expressions;
|
||||
}
|
||||
func = new Code(locationData, [], Block.wrap(locationData, [expressions]));
|
||||
func = new Code([], Block.wrap([expressions]));
|
||||
args = [];
|
||||
if ((mentionsArgs = expressions.contains(this.literalArgs)) || expressions.contains(this.literalThis)) {
|
||||
meth = new Literal(locationData, mentionsArgs ? 'apply' : 'call');
|
||||
args = [new Literal(locationData, 'this')];
|
||||
meth = new Literal(mentionsArgs ? 'apply' : 'call');
|
||||
args = [new Literal('this')];
|
||||
if (mentionsArgs) {
|
||||
args.push(new Literal(locationData, 'arguments'));
|
||||
args.push(new Literal('arguments'));
|
||||
}
|
||||
func = new Value(this.locationData, func, [new Access(locationData, meth)]);
|
||||
func = new Value(func, [new Access(meth)]);
|
||||
}
|
||||
func.noReturn = noReturn;
|
||||
call = new Call(locationData, func, args);
|
||||
call = new Call(func, args);
|
||||
if (statement) {
|
||||
return Block.wrap(locationData, [call]);
|
||||
return Block.wrap([call]);
|
||||
} else {
|
||||
return call;
|
||||
}
|
||||
@@ -2950,7 +2933,7 @@
|
||||
return;
|
||||
}
|
||||
parent[name] = ifn.body;
|
||||
ifn.body = new Value(this.locationData, parent);
|
||||
ifn.body = new Value(parent);
|
||||
return ifn;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
|
||||
|
||||
var $0 = $$.length - 1;
|
||||
switch (yystate) {
|
||||
case 1:return this.$ = new yy.Block(_$[$0]);
|
||||
case 1:return this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Block);
|
||||
break;
|
||||
case 2:return this.$ = $$[$0];
|
||||
break;
|
||||
case 3:return this.$ = $$[$0-1];
|
||||
break;
|
||||
case 4:this.$ = yy.Block.wrap(_$[$0], [$$[$0]]);
|
||||
case 4:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Block.wrap([$$[$0]]));
|
||||
break;
|
||||
case 5:this.$ = $$[$0-2].push($$[$0]);
|
||||
case 5:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].push($$[$0]));
|
||||
break;
|
||||
case 6:this.$ = $$[$0-1];
|
||||
break;
|
||||
@@ -29,7 +29,7 @@ case 9:this.$ = $$[$0];
|
||||
break;
|
||||
case 10:this.$ = $$[$0];
|
||||
break;
|
||||
case 11:this.$ = new yy.Literal(_$[$0], $$[$0]);
|
||||
case 11:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
|
||||
break;
|
||||
case 12:this.$ = $$[$0];
|
||||
break;
|
||||
@@ -55,41 +55,41 @@ case 22:this.$ = $$[$0];
|
||||
break;
|
||||
case 23:this.$ = $$[$0];
|
||||
break;
|
||||
case 24:this.$ = new yy.Block(_$[$0-1]);
|
||||
case 24:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Block);
|
||||
break;
|
||||
case 25:this.$ = $$[$0-1];
|
||||
case 25:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]);
|
||||
break;
|
||||
case 26:this.$ = new yy.Literal(_$[$0], $$[$0]);
|
||||
case 26:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
|
||||
break;
|
||||
case 27:this.$ = new yy.Literal(_$[$0], $$[$0]);
|
||||
case 27:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
|
||||
break;
|
||||
case 28:this.$ = new yy.Literal(_$[$0], $$[$0]);
|
||||
case 28:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
|
||||
break;
|
||||
case 29:this.$ = $$[$0];
|
||||
break;
|
||||
case 30:this.$ = new yy.Literal(_$[$0], $$[$0]);
|
||||
case 30:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
|
||||
break;
|
||||
case 31:this.$ = new yy.Literal(_$[$0], $$[$0]);
|
||||
case 31:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
|
||||
break;
|
||||
case 32:this.$ = new yy.Literal(_$[$0], $$[$0]);
|
||||
case 32:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
|
||||
break;
|
||||
case 33:this.$ = new yy.Undefined(_$[$0]);
|
||||
case 33:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Undefined);
|
||||
break;
|
||||
case 34:this.$ = new yy.Null(_$[$0]);
|
||||
case 34:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Null);
|
||||
break;
|
||||
case 35:this.$ = new yy.Bool(_$[$0], $$[$0]);
|
||||
case 35:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Bool($$[$0]));
|
||||
break;
|
||||
case 36:this.$ = new yy.Assign((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], $$[$0]);
|
||||
case 36:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 37:this.$ = new yy.Assign((function(){loc = {}; loc.first_column = _$[$0-3].first_column; loc.first_line = _$[$0-3].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-3], $$[$0]);
|
||||
case 37:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0]));
|
||||
break;
|
||||
case 38:this.$ = new yy.Assign((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0-1].last_column; loc.last_line = _$[$0-1].last_line; return loc;})(), $$[$0-4], $$[$0-1]);
|
||||
case 38:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1]));
|
||||
break;
|
||||
case 39:this.$ = new yy.Value(_$[$0], $$[$0]);
|
||||
case 39:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 40:this.$ = new yy.Assign((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), new yy.Value(_$[$0-2], $$[$0-2]), $$[$0], 'object');
|
||||
case 40:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-2])(new yy.Value($$[$0-2])), $$[$0], 'object'));
|
||||
break;
|
||||
case 41:this.$ = new yy.Assign((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0-1].last_column; loc.last_line = _$[$0-1].last_line; return loc;})(), new yy.Value(_$[$0-4], $$[$0-4]), $$[$0-1], 'object');
|
||||
case 41:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-4])(new yy.Value($$[$0-4])), $$[$0-1], 'object'));
|
||||
break;
|
||||
case 42:this.$ = $$[$0];
|
||||
break;
|
||||
@@ -99,39 +99,39 @@ case 44:this.$ = $$[$0];
|
||||
break;
|
||||
case 45:this.$ = $$[$0];
|
||||
break;
|
||||
case 46:this.$ = new yy.Return((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0]);
|
||||
case 46:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Return($$[$0]));
|
||||
break;
|
||||
case 47:this.$ = new yy.Return(_$[$0]);
|
||||
case 47:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Return);
|
||||
break;
|
||||
case 48:this.$ = new yy.Comment(_$[$0], $$[$0]);
|
||||
case 48:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Comment($$[$0]));
|
||||
break;
|
||||
case 49:this.$ = new yy.Code((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-3], $$[$0], $$[$0-1]);
|
||||
case 49:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Code($$[$0-3], $$[$0], $$[$0-1]));
|
||||
break;
|
||||
case 50:this.$ = new yy.Code((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), [], $$[$0], $$[$0-1]);
|
||||
case 50:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Code([], $$[$0], $$[$0-1]));
|
||||
break;
|
||||
case 51:this.$ = 'func';
|
||||
case 51:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('func');
|
||||
break;
|
||||
case 52:this.$ = 'boundfunc';
|
||||
case 52:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('boundfunc');
|
||||
break;
|
||||
case 53:this.$ = $$[$0];
|
||||
break;
|
||||
case 54:this.$ = $$[$0];
|
||||
break;
|
||||
case 55:this.$ = [];
|
||||
case 55:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]);
|
||||
break;
|
||||
case 56:this.$ = [$$[$0]];
|
||||
case 56:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
|
||||
break;
|
||||
case 57:this.$ = $$[$0-2].concat($$[$0]);
|
||||
case 57:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0]));
|
||||
break;
|
||||
case 58:this.$ = $$[$0-3].concat($$[$0]);
|
||||
case 58:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0]));
|
||||
break;
|
||||
case 59:this.$ = $$[$0-5].concat($$[$0-2]);
|
||||
case 59:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2]));
|
||||
break;
|
||||
case 60:this.$ = new yy.Param(_$[$0], $$[$0]);
|
||||
case 60:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Param($$[$0]));
|
||||
break;
|
||||
case 61:this.$ = new yy.Param(_$[$0-1], $$[$0-1], null, true);
|
||||
case 61:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Param($$[$0-1], null, true));
|
||||
break;
|
||||
case 62:this.$ = new yy.Param((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], $$[$0]);
|
||||
case 62:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Param($$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 63:this.$ = $$[$0];
|
||||
break;
|
||||
@@ -141,129 +141,129 @@ case 65:this.$ = $$[$0];
|
||||
break;
|
||||
case 66:this.$ = $$[$0];
|
||||
break;
|
||||
case 67:this.$ = new yy.Splat(_$[$0-1], $$[$0-1]);
|
||||
case 67:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Splat($$[$0-1]));
|
||||
break;
|
||||
case 68:this.$ = new yy.Value(_$[$0], $$[$0]);
|
||||
case 68:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 69:this.$ = $$[$0-1].add($$[$0]);
|
||||
case 69:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].add($$[$0]));
|
||||
break;
|
||||
case 70:this.$ = new yy.Value((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], [].concat($$[$0]));
|
||||
case 70:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(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], $$[$0]);
|
||||
case 73:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 74:this.$ = new yy.Value(_$[$0], $$[$0]);
|
||||
case 74:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 75:this.$ = $$[$0];
|
||||
break;
|
||||
case 76:this.$ = new yy.Value(_$[$0], $$[$0]);
|
||||
case 76:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 77:this.$ = new yy.Value(_$[$0], $$[$0]);
|
||||
case 77:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 78:this.$ = new yy.Value(_$[$0], $$[$0]);
|
||||
case 78:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 79:this.$ = $$[$0];
|
||||
break;
|
||||
case 80:this.$ = new yy.Access((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0]);
|
||||
case 80:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0]));
|
||||
break;
|
||||
case 81:this.$ = new yy.Access((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0], 'soak');
|
||||
case 81:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0], 'soak'));
|
||||
break;
|
||||
case 82:this.$ = [new yy.Access(_$[$0-1], new yy.Literal(_$[$0-1], 'prototype')), new yy.Access(_$[$0-1], $$[$0])];
|
||||
case 82:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'))), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]);
|
||||
break;
|
||||
case 83:this.$ = new yy.Access(_$[$0], new yy.Literal(_$[$0], 'prototype'));
|
||||
case 83:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Access(new yy.Literal('prototype')));
|
||||
break;
|
||||
case 84:this.$ = $$[$0];
|
||||
break;
|
||||
case 85:this.$ = $$[$0-1];
|
||||
case 85:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]);
|
||||
break;
|
||||
case 86:this.$ = yy.extend($$[$0], {
|
||||
case 86:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.extend($$[$0], {
|
||||
soak: true
|
||||
});
|
||||
}));
|
||||
break;
|
||||
case 87:this.$ = new yy.Index(_$[$0], $$[$0]);
|
||||
case 87:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Index($$[$0]));
|
||||
break;
|
||||
case 88:this.$ = new yy.Slice(_$[$0], $$[$0]);
|
||||
case 88:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Slice($$[$0]));
|
||||
break;
|
||||
case 89:this.$ = new yy.Obj((function(){loc = {}; loc.first_column = _$[$0-3].first_column; loc.first_line = _$[$0-3].first_line; loc.last_column = _$[$0-2].last_column; loc.last_line = _$[$0-2].last_line; return loc;})(), $$[$0-2], $$[$0-3].generated);
|
||||
case 89:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Obj($$[$0-2], $$[$0-3].generated));
|
||||
break;
|
||||
case 90:this.$ = [];
|
||||
case 90:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]);
|
||||
break;
|
||||
case 91:this.$ = [$$[$0]];
|
||||
case 91:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
|
||||
break;
|
||||
case 92:this.$ = $$[$0-2].concat($$[$0]);
|
||||
case 92:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0]));
|
||||
break;
|
||||
case 93:this.$ = $$[$0-3].concat($$[$0]);
|
||||
case 93:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0]));
|
||||
break;
|
||||
case 94:this.$ = $$[$0-5].concat($$[$0-2]);
|
||||
case 94:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2]));
|
||||
break;
|
||||
case 95:this.$ = new yy.Class(_$[$0]);
|
||||
case 95:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Class);
|
||||
break;
|
||||
case 96:this.$ = new yy.Class((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), null, null, $$[$0]);
|
||||
case 96:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class(null, null, $$[$0]));
|
||||
break;
|
||||
case 97:this.$ = new yy.Class((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), null, $$[$0]);
|
||||
case 97:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class(null, $$[$0]));
|
||||
break;
|
||||
case 98:this.$ = new yy.Class((function(){loc = {}; loc.first_column = _$[$0-3].first_column; loc.first_line = _$[$0-3].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), null, $$[$0-1], $$[$0]);
|
||||
case 98:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class(null, $$[$0-1], $$[$0]));
|
||||
break;
|
||||
case 99:this.$ = new yy.Class((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0]);
|
||||
case 99:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class($$[$0]));
|
||||
break;
|
||||
case 100:this.$ = new yy.Class((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], null, $$[$0]);
|
||||
case 100:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class($$[$0-1], null, $$[$0]));
|
||||
break;
|
||||
case 101:this.$ = new yy.Class((function(){loc = {}; loc.first_column = _$[$0-3].first_column; loc.first_line = _$[$0-3].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], $$[$0]);
|
||||
case 101:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class($$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 102:this.$ = new yy.Class((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-3], $$[$0-1], $$[$0]);
|
||||
case 102:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Class($$[$0-3], $$[$0-1], $$[$0]));
|
||||
break;
|
||||
case 103:this.$ = new yy.Call((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], $$[$0], $$[$0-1]);
|
||||
case 103:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1]));
|
||||
break;
|
||||
case 104:this.$ = new yy.Call((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], $$[$0], $$[$0-1]);
|
||||
case 104:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1]));
|
||||
break;
|
||||
case 105:this.$ = new yy.Call(_$[$0], 'super', [new yy.Splat(_$[$0], new yy.Literal(_$[$0], 'arguments'))]);
|
||||
case 105:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]));
|
||||
break;
|
||||
case 106:this.$ = new yy.Call((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), 'super', $$[$0]);
|
||||
case 106:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Call('super', $$[$0]));
|
||||
break;
|
||||
case 107:this.$ = false;
|
||||
case 107:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(false);
|
||||
break;
|
||||
case 108:this.$ = true;
|
||||
case 108:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(true);
|
||||
break;
|
||||
case 109:this.$ = [];
|
||||
case 109:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([]);
|
||||
break;
|
||||
case 110:this.$ = $$[$0-2];
|
||||
case 110:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]);
|
||||
break;
|
||||
case 111:this.$ = new yy.Value(_$[$0], new yy.Literal(_$[$0], 'this'));
|
||||
case 111:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this')));
|
||||
break;
|
||||
case 112:this.$ = new yy.Value(_$[$0], new yy.Literal(_$[$0], 'this'));
|
||||
case 112:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this')));
|
||||
break;
|
||||
case 113:this.$ = new yy.Value((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), new yy.Literal(_$[$0-1], 'this'), [new yy.Access(_$[$0], $$[$0])], 'this');
|
||||
case 113:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('this')), [yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))], 'this'));
|
||||
break;
|
||||
case 114:this.$ = new yy.Arr(_$[$0-1], []);
|
||||
case 114:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Arr([]));
|
||||
break;
|
||||
case 115:this.$ = new yy.Arr((function(){loc = {}; loc.first_column = _$[$0-3].first_column; loc.first_line = _$[$0-3].first_line; loc.last_column = _$[$0-2].last_column; loc.last_line = _$[$0-2].last_line; return loc;})(), $$[$0-2]);
|
||||
case 115:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Arr($$[$0-2]));
|
||||
break;
|
||||
case 116:this.$ = 'inclusive';
|
||||
case 116:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('inclusive');
|
||||
break;
|
||||
case 117:this.$ = 'exclusive';
|
||||
case 117:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('exclusive');
|
||||
break;
|
||||
case 118:this.$ = new yy.Range((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0-1].last_column; loc.last_line = _$[$0-1].last_line; return loc;})(), $$[$0-3], $$[$0-1], $$[$0-2]);
|
||||
case 118:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]));
|
||||
break;
|
||||
case 119:this.$ = new yy.Range((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], $$[$0], $$[$0-1]);
|
||||
case 119:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Range($$[$0-2], $$[$0], $$[$0-1]));
|
||||
break;
|
||||
case 120:this.$ = new yy.Range((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], null, $$[$0]);
|
||||
case 120:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range($$[$0-1], null, $$[$0]));
|
||||
break;
|
||||
case 121:this.$ = new yy.Range((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), null, $$[$0], $$[$0-1]);
|
||||
case 121:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range(null, $$[$0], $$[$0-1]));
|
||||
break;
|
||||
case 122:this.$ = new yy.Range(_$[$0], null, null, $$[$0]);
|
||||
case 122:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Range(null, null, $$[$0]));
|
||||
break;
|
||||
case 123:this.$ = [$$[$0]];
|
||||
case 123:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
|
||||
break;
|
||||
case 124:this.$ = $$[$0-2].concat($$[$0]);
|
||||
case 124:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0]));
|
||||
break;
|
||||
case 125:this.$ = $$[$0-3].concat($$[$0]);
|
||||
case 125:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0]));
|
||||
break;
|
||||
case 126:this.$ = $$[$0-2];
|
||||
case 126:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]);
|
||||
break;
|
||||
case 127:this.$ = $$[$0-5].concat($$[$0-2]);
|
||||
case 127:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2]));
|
||||
break;
|
||||
case 128:this.$ = $$[$0];
|
||||
break;
|
||||
@@ -271,205 +271,205 @@ case 129:this.$ = $$[$0];
|
||||
break;
|
||||
case 130:this.$ = $$[$0];
|
||||
break;
|
||||
case 131:this.$ = [].concat($$[$0-2], $$[$0]);
|
||||
case 131:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([].concat($$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 132:this.$ = new yy.Try((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0]);
|
||||
case 132:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Try($$[$0]));
|
||||
break;
|
||||
case 133:this.$ = new yy.Try((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0][0], $$[$0][1]);
|
||||
case 133:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]));
|
||||
break;
|
||||
case 134:this.$ = new yy.Try((function(){loc = {}; loc.first_column = _$[$0-3].first_column; loc.first_line = _$[$0-3].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], null, null, $$[$0]);
|
||||
case 134:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Try($$[$0-2], null, null, $$[$0]));
|
||||
break;
|
||||
case 135:this.$ = new yy.Try((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]);
|
||||
case 135:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]));
|
||||
break;
|
||||
case 136:this.$ = [$$[$0-1], $$[$0]];
|
||||
case 136:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-1], $$[$0]]);
|
||||
break;
|
||||
case 137:this.$ = [new yy.Value(_$[$0-1], $$[$0-1]), $$[$0]];
|
||||
case 137:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Value($$[$0-1])), $$[$0]]);
|
||||
break;
|
||||
case 138:this.$ = new yy.Throw((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0]);
|
||||
case 138:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Throw($$[$0]));
|
||||
break;
|
||||
case 139:this.$ = new yy.Parens((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1]);
|
||||
case 139:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Parens($$[$0-1]));
|
||||
break;
|
||||
case 140:this.$ = new yy.Parens((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0-1].last_column; loc.last_line = _$[$0-1].last_line; return loc;})(), $$[$0-2]);
|
||||
case 140:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Parens($$[$0-2]));
|
||||
break;
|
||||
case 141:this.$ = new yy.While((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0]);
|
||||
case 141:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0]));
|
||||
break;
|
||||
case 142:this.$ = new yy.While((function(){loc = {}; loc.first_column = _$[$0-3].first_column; loc.first_line = _$[$0-3].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], {
|
||||
case 142:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], {
|
||||
guard: $$[$0]
|
||||
});
|
||||
}));
|
||||
break;
|
||||
case 143:this.$ = new yy.While((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0], {
|
||||
case 143:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0], {
|
||||
invert: true
|
||||
});
|
||||
}));
|
||||
break;
|
||||
case 144:this.$ = new yy.While((function(){loc = {}; loc.first_column = _$[$0-3].first_column; loc.first_line = _$[$0-3].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], {
|
||||
case 144:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], {
|
||||
invert: true,
|
||||
guard: $$[$0]
|
||||
}));
|
||||
break;
|
||||
case 145:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].addBody($$[$0]));
|
||||
break;
|
||||
case 146:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]]))));
|
||||
break;
|
||||
case 147:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]]))));
|
||||
break;
|
||||
case 148:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])($$[$0]);
|
||||
break;
|
||||
case 149:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody($$[$0]));
|
||||
break;
|
||||
case 150:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody(yy.addLocationDataFn(_$[$0])(yy.Block.wrap([$$[$0]]))));
|
||||
break;
|
||||
case 151:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0]));
|
||||
break;
|
||||
case 152:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0]));
|
||||
break;
|
||||
case 153:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0], $$[$0-1]));
|
||||
break;
|
||||
case 154:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({
|
||||
source: yy.addLocationDataFn(_$[$0])(new yy.Value($$[$0]))
|
||||
});
|
||||
break;
|
||||
case 145:this.$ = $$[$0-1].addBody($$[$0]);
|
||||
break;
|
||||
case 146:this.$ = $$[$0].addBody(yy.Block.wrap(_$[$0-1], [$$[$0-1]]));
|
||||
break;
|
||||
case 147:this.$ = $$[$0].addBody(yy.Block.wrap(_$[$0-1], [$$[$0-1]]));
|
||||
break;
|
||||
case 148:this.$ = $$[$0];
|
||||
break;
|
||||
case 149:this.$ = new yy.While((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), new yy.Literal(_$[$0-1], 'true')).addBody($$[$0]);
|
||||
break;
|
||||
case 150:this.$ = new yy.While((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), new yy.Literal(_$[$0-1], 'true')).addBody(yy.Block.wrap(_$[$0], [$$[$0]]));
|
||||
break;
|
||||
case 151:this.$ = new yy.For((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0]);
|
||||
break;
|
||||
case 152:this.$ = new yy.For((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0]);
|
||||
break;
|
||||
case 153:this.$ = new yy.For((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0], $$[$0-1]);
|
||||
break;
|
||||
case 154:this.$ = {
|
||||
source: new yy.Value(_$[$0], $$[$0])
|
||||
};
|
||||
break;
|
||||
case 155:this.$ = (function () {
|
||||
case 155:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])((function () {
|
||||
$$[$0].own = $$[$0-1].own;
|
||||
$$[$0].name = $$[$0-1][0];
|
||||
$$[$0].index = $$[$0-1][1];
|
||||
return $$[$0];
|
||||
}());
|
||||
}()));
|
||||
break;
|
||||
case 156:this.$ = $$[$0];
|
||||
case 156:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0]);
|
||||
break;
|
||||
case 157:this.$ = (function () {
|
||||
case 157:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () {
|
||||
$$[$0].own = true;
|
||||
return $$[$0];
|
||||
}());
|
||||
}()));
|
||||
break;
|
||||
case 158:this.$ = $$[$0];
|
||||
break;
|
||||
case 159:this.$ = $$[$0];
|
||||
break;
|
||||
case 160:this.$ = new yy.Value(_$[$0], $$[$0]);
|
||||
case 160:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 161:this.$ = new yy.Value(_$[$0], $$[$0]);
|
||||
case 161:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 162:this.$ = [$$[$0]];
|
||||
case 162:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
|
||||
break;
|
||||
case 163:this.$ = [$$[$0-2], $$[$0]];
|
||||
case 163:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-2], $$[$0]]);
|
||||
break;
|
||||
case 164:this.$ = {
|
||||
case 164:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({
|
||||
source: $$[$0]
|
||||
};
|
||||
});
|
||||
break;
|
||||
case 165:this.$ = {
|
||||
case 165:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({
|
||||
source: $$[$0],
|
||||
object: true
|
||||
};
|
||||
});
|
||||
break;
|
||||
case 166:this.$ = {
|
||||
case 166:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({
|
||||
source: $$[$0-2],
|
||||
guard: $$[$0]
|
||||
};
|
||||
});
|
||||
break;
|
||||
case 167:this.$ = {
|
||||
case 167:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({
|
||||
source: $$[$0-2],
|
||||
guard: $$[$0],
|
||||
object: true
|
||||
};
|
||||
});
|
||||
break;
|
||||
case 168:this.$ = {
|
||||
case 168:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({
|
||||
source: $$[$0-2],
|
||||
step: $$[$0]
|
||||
};
|
||||
});
|
||||
break;
|
||||
case 169:this.$ = {
|
||||
case 169:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({
|
||||
source: $$[$0-4],
|
||||
guard: $$[$0-2],
|
||||
step: $$[$0]
|
||||
};
|
||||
});
|
||||
break;
|
||||
case 170:this.$ = {
|
||||
case 170:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({
|
||||
source: $$[$0-4],
|
||||
step: $$[$0-2],
|
||||
guard: $$[$0]
|
||||
};
|
||||
});
|
||||
break;
|
||||
case 171:this.$ = new yy.Switch((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-3], $$[$0-1]);
|
||||
case 171:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Switch($$[$0-3], $$[$0-1]));
|
||||
break;
|
||||
case 172:this.$ = new yy.Switch((function(){loc = {}; loc.first_column = _$[$0-6].first_column; loc.first_line = _$[$0-6].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-5], $$[$0-3], $$[$0-1]);
|
||||
case 172:this.$ = yy.addLocationDataFn(_$[$0-6], _$[$0])(new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]));
|
||||
break;
|
||||
case 173:this.$ = new yy.Switch((function(){loc = {}; loc.first_column = _$[$0-3].first_column; loc.first_line = _$[$0-3].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), null, $$[$0-1]);
|
||||
case 173:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Switch(null, $$[$0-1]));
|
||||
break;
|
||||
case 174:this.$ = new yy.Switch((function(){loc = {}; loc.first_column = _$[$0-5].first_column; loc.first_line = _$[$0-5].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), null, $$[$0-3], $$[$0-1]);
|
||||
case 174:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])(new yy.Switch(null, $$[$0-3], $$[$0-1]));
|
||||
break;
|
||||
case 175:this.$ = $$[$0];
|
||||
break;
|
||||
case 176:this.$ = $$[$0-1].concat($$[$0]);
|
||||
case 176:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].concat($$[$0]));
|
||||
break;
|
||||
case 177:this.$ = [[$$[$0-1], $$[$0]]];
|
||||
case 177:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([[$$[$0-1], $$[$0]]]);
|
||||
break;
|
||||
case 178:this.$ = [[$$[$0-2], $$[$0-1]]];
|
||||
case 178:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])([[$$[$0-2], $$[$0-1]]]);
|
||||
break;
|
||||
case 179:this.$ = new yy.If((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0], {
|
||||
type: $$[$0-2]
|
||||
});
|
||||
break;
|
||||
case 180:this.$ = $$[$0-4].addElse(new yy.If((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0], {
|
||||
case 179:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], {
|
||||
type: $$[$0-2]
|
||||
}));
|
||||
break;
|
||||
case 180:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])($$[$0-4].addElse(new yy.If($$[$0-1], $$[$0], {
|
||||
type: $$[$0-2]
|
||||
})));
|
||||
break;
|
||||
case 181:this.$ = $$[$0];
|
||||
break;
|
||||
case 182:this.$ = $$[$0-2].addElse($$[$0]);
|
||||
case 182:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].addElse($$[$0]));
|
||||
break;
|
||||
case 183:this.$ = new yy.If((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0], yy.Block.wrap(_$[$0-2], [$$[$0-2]]), {
|
||||
case 183:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), {
|
||||
type: $$[$0-1],
|
||||
statement: true
|
||||
});
|
||||
}));
|
||||
break;
|
||||
case 184:this.$ = new yy.If((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0], yy.Block.wrap(_$[$0-2], [$$[$0-2]]), {
|
||||
case 184:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), {
|
||||
type: $$[$0-1],
|
||||
statement: true
|
||||
});
|
||||
}));
|
||||
break;
|
||||
case 185:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0]);
|
||||
case 185:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op($$[$0-1], $$[$0]));
|
||||
break;
|
||||
case 186:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), '-', $$[$0]);
|
||||
case 186:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('-', $$[$0]));
|
||||
break;
|
||||
case 187:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), '+', $$[$0]);
|
||||
case 187:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('+', $$[$0]));
|
||||
break;
|
||||
case 188:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), '--', $$[$0]);
|
||||
case 188:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0]));
|
||||
break;
|
||||
case 189:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), '++', $$[$0]);
|
||||
case 189:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0]));
|
||||
break;
|
||||
case 190:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), '--', $$[$0-1], null, true);
|
||||
case 190:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0-1], null, true));
|
||||
break;
|
||||
case 191:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-1].first_column; loc.first_line = _$[$0-1].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), '++', $$[$0-1], null, true);
|
||||
case 191:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0-1], null, true));
|
||||
break;
|
||||
case 192:this.$ = new yy.Existence(_$[$0-1], $$[$0-1]);
|
||||
case 192:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Existence($$[$0-1]));
|
||||
break;
|
||||
case 193:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), '+', $$[$0-2], $$[$0]);
|
||||
case 193:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('+', $$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 194:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), '-', $$[$0-2], $$[$0]);
|
||||
case 194:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('-', $$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 195:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0-2], $$[$0]);
|
||||
case 195:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 196:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0-2], $$[$0]);
|
||||
case 196:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 197:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0-2], $$[$0]);
|
||||
case 197:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 198:this.$ = new yy.Op((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0-2], $$[$0]);
|
||||
case 198:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
|
||||
break;
|
||||
case 199:this.$ = (function () {
|
||||
case 199:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () {
|
||||
if ($$[$0-1].charAt(0) === '!') {
|
||||
return new yy.Op((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1].slice(1), $$[$0-2], $$[$0]).invert();
|
||||
return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert();
|
||||
} else {
|
||||
return new yy.Op((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-1], $$[$0-2], $$[$0]);
|
||||
return new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
|
||||
}
|
||||
}());
|
||||
}()));
|
||||
break;
|
||||
case 200:this.$ = new yy.Assign((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], $$[$0], $$[$0-1]);
|
||||
case 200:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0], $$[$0-1]));
|
||||
break;
|
||||
case 201:this.$ = new yy.Assign((function(){loc = {}; loc.first_column = _$[$0-4].first_column; loc.first_line = _$[$0-4].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-4], $$[$0-1], $$[$0-3]);
|
||||
case 201:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]));
|
||||
break;
|
||||
case 202:this.$ = new yy.Extends((function(){loc = {}; loc.first_column = _$[$0-2].first_column; loc.first_line = _$[$0-2].first_line; loc.last_column = _$[$0].last_column; loc.last_line = _$[$0].last_line; return loc;})(), $$[$0-2], $$[$0]);
|
||||
case 202:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Extends($$[$0-2], $$[$0]));
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user