This commit is contained in:
Demian Ferreiro
2013-02-28 10:37:30 -03:00
parent c0e07013e8
commit bf70b4660e
6 changed files with 196 additions and 244 deletions

View File

@@ -16,7 +16,6 @@
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(/\b(Op|Value\.(create|wrap))\b/g, 'yy.$&');
addLocationDataFn = function(first, last) {
if (!last) {
return "yy.addLocationDataFn(@" + first + ")";
@@ -94,12 +93,12 @@
],
AssignObj: [
o('ObjAssignable', function() {
return Value.wrap($1);
return new Value($1);
}), o('ObjAssignable : Expression', function() {
return new Assign(LOC(1)(Value.wrap($1)), $3, 'object');
return new Assign(LOC(1)(new Value($1)), $3, 'object');
}), o('ObjAssignable :\
INDENT Expression OUTDENT', function() {
return new Assign(LOC(1)(Value.wrap($1)), $4, 'object');
return new Assign(LOC(1)(new Value($1)), $4, 'object');
}), o('Comment')
],
ObjAssignable: [o('Identifier'), o('AlphaNumeric'), o('ThisProperty')],
@@ -160,27 +159,27 @@
],
SimpleAssignable: [
o('Identifier', function() {
return Value.wrap($1);
return new Value($1);
}), o('Value Accessor', function() {
return $1.add($2);
}), o('Invocation Accessor', function() {
return Value.wrap($1, [].concat($2));
return new Value($1, [].concat($2));
}), o('ThisProperty')
],
Assignable: [
o('SimpleAssignable'), o('Array', function() {
return Value.wrap($1);
return new Value($1);
}), o('Object', function() {
return Value.wrap($1);
return new Value($1);
})
],
Value: [
o('Assignable'), o('Literal', function() {
return Value.wrap($1);
return new Value($1);
}), o('Parenthetical', function() {
return Value.wrap($1);
return new Value($1);
}), o('Range', function() {
return Value.wrap($1);
return new Value($1);
}), o('This')
],
Accessor: [
@@ -274,14 +273,14 @@
],
This: [
o('THIS', function() {
return Value.wrap(new Literal('this'));
return new Value(new Literal('this'));
}), o('@', function() {
return Value.wrap(new Literal('this'));
return new Value(new Literal('this'));
})
],
ThisProperty: [
o('@ Identifier', function() {
return Value.wrap(LOC(1)(new Literal('this')), [LOC(2)(new Access($2))], 'this');
return new Value(LOC(1)(new Literal('this')), [LOC(2)(new Access($2))], 'this');
})
],
Array: [
@@ -348,7 +347,7 @@
o('CATCH Identifier Block', function() {
return [$2, $3];
}), o('CATCH Object Block', function() {
return [LOC(2)(Value.wrap($2)), $3];
return [LOC(2)(new Value($2)), $3];
})
],
Throw: [
@@ -411,7 +410,7 @@
ForBody: [
o('FOR Range', function() {
return {
source: LOC(2)(Value.wrap($2))
source: LOC(2)(new Value($2))
};
}), o('ForStart ForSource', function() {
$2.own = $1.own;
@@ -430,9 +429,9 @@
],
ForValue: [
o('Identifier'), o('ThisProperty'), o('Array', function() {
return Value.wrap($1);
return new Value($1);
}), o('Object', function() {
return Value.wrap($1);
return new Value($1);
})
],
ForVariables: [
@@ -533,42 +532,42 @@
],
Operation: [
o('UNARY Expression', function() {
return Op.create($1, $2);
return new Op($1, $2);
}), o('- Expression', (function() {
return Op.create('-', $2);
return new Op('-', $2);
}), {
prec: 'UNARY'
}), o('+ Expression', (function() {
return Op.create('+', $2);
return new Op('+', $2);
}), {
prec: 'UNARY'
}), o('-- SimpleAssignable', function() {
return Op.create('--', $2);
return new Op('--', $2);
}), o('++ SimpleAssignable', function() {
return Op.create('++', $2);
return new Op('++', $2);
}), o('SimpleAssignable --', function() {
return Op.create('--', $1, null, true);
return new Op('--', $1, null, true);
}), o('SimpleAssignable ++', function() {
return Op.create('++', $1, null, true);
return new Op('++', $1, null, true);
}), o('Expression ?', function() {
return new Existence($1);
}), o('Expression + Expression', function() {
return Op.create('+', $1, $3);
return new Op('+', $1, $3);
}), o('Expression - Expression', function() {
return Op.create('-', $1, $3);
return new Op('-', $1, $3);
}), o('Expression MATH Expression', function() {
return Op.create($2, $1, $3);
return new Op($2, $1, $3);
}), o('Expression SHIFT Expression', function() {
return Op.create($2, $1, $3);
return new Op($2, $1, $3);
}), o('Expression COMPARE Expression', function() {
return Op.create($2, $1, $3);
return new Op($2, $1, $3);
}), o('Expression LOGIC Expression', function() {
return Op.create($2, $1, $3);
return new Op($2, $1, $3);
}), o('Expression RELATION Expression', function() {
if ($2.charAt(0) === '!') {
return Op.create($2.slice(1), $1, $3).invert();
return new Op($2.slice(1), $1, $3).invert();
} else {
return Op.create($2, $1, $3);
return new Op($2, $1, $3);
}
}), o('SimpleAssignable COMPOUND_ASSIGN\
Expression', function() {

View File

@@ -164,7 +164,7 @@
};
Base.prototype.invert = function() {
return Op.create('!', this);
return new Op('!', this);
};
Base.prototype.unwrapAll = function() {
@@ -488,7 +488,7 @@
__extends(Undefined, _super);
function Undefined() {
Undefined.__super__.constructor.apply(this, arguments);
return Undefined.__super__.constructor.apply(this, arguments);
}
Undefined.prototype.isAssignable = NO;
@@ -512,7 +512,7 @@
__extends(Null, _super);
function Null() {
Null.__super__.constructor.apply(this, arguments);
return Null.__super__.constructor.apply(this, arguments);
}
Null.prototype.isAssignable = NO;
@@ -587,21 +587,16 @@
__extends(Value, _super);
Value.wrap = function(base, props, tag) {
function Value(base, props, tag) {
if (!props && base instanceof Value) {
return base;
} else {
return new Value(base, props, tag);
}
};
function Value(base, properties, tag) {
this.base = base;
this.properties = properties;
this.properties || (this.properties = []);
if (tag === 'this') {
this["this"] = true;
this.properties = props || [];
if (tag) {
this[tag] = true;
}
return this;
}
Value.prototype.children = ['base', 'properties'];
@@ -684,10 +679,10 @@
if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) {
return [this, this];
}
base = Value.wrap(this.base, this.properties.slice(0, -1));
base = new Value(this.base, this.properties.slice(0, -1));
if (base.isComplex()) {
bref = new Literal(o.scope.freeVariable('base'));
base = Value.wrap(new Parens(new Assign(bref, base)));
base = new Value(new Parens(new Assign(bref, base)));
}
if (!name) {
return [base, bref];
@@ -697,7 +692,7 @@
name = new Index(new Assign(nref, name.index));
nref = new Index(nref);
}
return [base.add(name), Value.wrap(bref || base.base, [nref || name])];
return [base.add(name), new Value(bref || base.base, [nref || name])];
};
Value.prototype.compileNode = function(o) {
@@ -731,8 +726,8 @@
continue;
}
prop.soak = false;
fst = Value.wrap(_this.base, _this.properties.slice(0, i));
snd = Value.wrap(_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(o.scope.freeVariable('ref'));
fst = new Parens(new Assign(ref, fst));
@@ -816,7 +811,7 @@
accesses.push(new Access(new Literal('constructor')));
}
accesses.push(new Access(new Literal(name)));
return (Value.wrap(new Literal(method.klass), accesses)).compile(o);
return (new Value(new Literal(method.klass), accesses)).compile(o);
} else {
return "" + name + ".__super__.constructor";
}
@@ -835,15 +830,15 @@
if (ifn = unfoldSoak(o, this, 'variable')) {
return ifn;
}
_ref2 = Value.wrap(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.superReference(o));
rite = Value.wrap(left);
rite = new Value(left);
}
rite = new Call(rite, this.args);
rite.isNew = this.isNew;
left = new Literal("typeof " + (left.compile(o)) + " === \"function\"");
return new If(left, Value.wrap(rite), {
return new If(left, new Value(rite), {
soak: true
});
}
@@ -912,7 +907,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 = Value.wrap(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));
@@ -947,7 +942,7 @@
Extends.prototype.children = ['child', 'parent'];
Extends.prototype.compile = function(o) {
return new Call(Value.wrap(new Literal(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;
@@ -1302,7 +1297,7 @@
_ref2 = this.boundFuncs;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
bvar = _ref2[_i];
lhs = (Value.wrap(new Literal("this"), [new Access(bvar)])).compile(o);
lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o);
this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)"));
}
};
@@ -1338,7 +1333,7 @@
func.context = name;
}
} else {
assign.variable = Value.wrap(new Literal(name), [new Access(new Literal('prototype')), new Access(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;
@@ -1383,8 +1378,7 @@
return this.directives = expressions.splice(0, index);
};
Class.prototype.ensureConstructor = function(name, o) {
var returnExpr;
Class.prototype.ensureConstructor = function(name) {
if (!this.ctor) {
this.ctor = new Code;
if (this.parent) {
@@ -1393,20 +1387,12 @@
if (this.externalCtor) {
this.ctor.body.push(new Literal("" + this.externalCtor + ".apply(this, arguments)"));
}
this.ctor.body.makeReturn();
this.body.expressions.unshift(this.ctor);
}
this.ctor.ctor = this.ctor.name = name;
this.ctor.klass = null;
this.ctor.noReturn = true;
returnExpr = null;
this.ctor.body.traverseChildren(false, function(node) {
if (node instanceof Return && (returnExpr = node.expression)) {
return false;
}
});
if (returnExpr) {
throw SyntaxError("cannot return a value from a constructor: \"" + (returnExpr.compileNode(o)) + "\" in class " + name);
}
return this.ctor.noReturn = true;
};
Class.prototype.compileNode = function(o) {
@@ -1420,7 +1406,7 @@
this.hoistDirectivePrologue();
this.setContext(name);
this.walkBody(name, o);
this.ensureConstructor(name, o);
this.ensureConstructor(name);
this.body.spaced = true;
if (!(this.ctor instanceof Code)) {
this.body.expressions.unshift(this.ctor);
@@ -1543,7 +1529,7 @@
idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0);
}
acc = IDENTIFIER.test(idx.unwrap().value || 0);
value = Value.wrap(value);
value = new Value(value);
value.properties.push(new (acc ? Access : Index)(idx));
if (_ref4 = obj.unwrap().value, __indexOf.call(RESERVED, _ref4) >= 0) {
throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (value.compile(o)));
@@ -1567,7 +1553,7 @@
_ref5 = obj, (_ref6 = _ref5.variable, idx = _ref6.base), obj = _ref5.value;
} else {
if (obj.base instanceof Parens) {
_ref7 = Value.wrap(obj.unwrapAll()).cacheReference(o), obj = _ref7[0], idx = _ref7[1];
_ref7 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref7[0], idx = _ref7[1];
} else {
idx = obj["this"] ? obj.properties[0].name : obj;
}
@@ -1597,7 +1583,7 @@
} else {
acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0);
}
val = Value.wrap(new Literal(vvar), [new (acc ? Access : Index)(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)));
@@ -1627,7 +1613,7 @@
if (__indexOf.call(this.context, "?") >= 0) {
o.isExistentialEquals = true;
}
return Op.create(this.context.slice(0, -1), left, new Assign(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,7 +1702,7 @@
o.scope.add(p.value, 'var', true);
}
}
splats = new Assign(Value.wrap(new Arr((function() {
splats = new Assign(new Value(new Arr((function() {
var _l, _len3, _ref5, _results;
_ref5 = this.params;
_results = [];
@@ -1725,7 +1711,7 @@
_results.push(p.asReference(o));
}
return _results;
}).call(this))), Value.wrap(new Literal('arguments')));
}).call(this))), new Value(new Literal('arguments')));
break;
}
_ref5 = this.params;
@@ -1734,16 +1720,16 @@
if (param.isComplex()) {
val = ref = param.asReference(o);
if (param.value) {
val = Op.create('?', ref, param.value);
val = new Op('?', ref, param.value);
}
exprs.push(new Assign(Value.wrap(param.name), val, '=', {
exprs.push(new Assign(new Value(param.name), val, '=', {
param: true
}));
} else {
ref = param;
if (param.value) {
lit = new Literal(ref.name.value + ' == null');
val = new Assign(Value.wrap(param.name), param.value, '=');
val = new Assign(new Value(param.name), param.value, '=');
exprs.push(new If(lit, val));
}
}
@@ -1856,7 +1842,7 @@
} else if (node.isComplex()) {
node = new Literal(o.scope.freeVariable('arg'));
}
node = Value.wrap(node);
node = new Value(node);
if (this.splat) {
node = new Splat(node);
}
@@ -2065,7 +2051,7 @@
__extends(Op, _super);
Op.create = function(op, first, second, flip) {
function Op(op, first, second, flip) {
if (op === 'in') {
return new In(first, second);
}
@@ -2080,14 +2066,11 @@
first = new Parens(first);
}
}
return new Op(op, first, second, flip);
};
function Op(op, first, second, flip) {
this.operator = CONVERSIONS[op] || op;
this.first = first;
this.second = second;
this.operator = CONVERSIONS[op] || op;
this.flip = !!flip;
return this;
}
CONVERSIONS = {
@@ -2149,7 +2132,7 @@
} else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref2 = fst.operator) === '!' || _ref2 === 'in' || _ref2 === 'instanceof')) {
return fst;
} else {
return Op.create('!', this);
return new Op('!', this);
}
};
@@ -2158,7 +2141,7 @@
return ((_ref2 = this.operator) === '++' || _ref2 === '--' || _ref2 === 'delete') && unfoldSoak(o, this, 'first');
};
Op.generateDo = function(exp) {
Op.prototype.generateDo = function(exp) {
var call, func, param, passedParams, ref, _i, _len, _ref2;
passedParams = [];
func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp;
@@ -2654,7 +2637,7 @@
}
fn = ((_ref6 = val.base) != null ? _ref6.unwrapAll() : void 0) || val;
ref = new Literal(o.scope.freeVariable('fn'));
base = Value.wrap(ref);
base = new Value(ref);
if (val.base) {
_ref7 = [base, val], val.base = _ref7[0], base = _ref7[1];
}
@@ -2885,7 +2868,7 @@
if (mentionsArgs) {
args.push(new Literal('arguments'));
}
func = Value.wrap(func, [new Access(meth)]);
func = new Value(func, [new Access(meth)]);
}
func.noReturn = noReturn;
call = new Call(func, args);
@@ -2909,7 +2892,7 @@
return;
}
parent[name] = ifn.body;
ifn.body = Value.wrap(parent);
ifn.body = new Value(parent);
return ifn;
};

View File

@@ -1,4 +1,4 @@
/* Jison generated parser */
/* parser generated by jison 0.4.2 */
var parser = (function(){
var parser = {trace: function trace() { },
yy: {},
@@ -85,11 +85,11 @@ case 37:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3],
break;
case 38:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1]));
break;
case 39:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap($$[$0]));
case 39:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
break;
case 40:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-2])(yy.Value.wrap($$[$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.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-4])(yy.Value.wrap($$[$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;
@@ -143,27 +143,27 @@ case 66:this.$ = $$[$0];
break;
case 67:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Splat($$[$0-1]));
break;
case 68:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap($$[$0]));
case 68:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
break;
case 69:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].add($$[$0]));
break;
case 70:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.Value.wrap($$[$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.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap($$[$0]));
case 73:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
break;
case 74:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap($$[$0]));
case 74:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
break;
case 75:this.$ = $$[$0];
break;
case 76:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap($$[$0]));
case 76:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
break;
case 77:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap($$[$0]));
case 77:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
break;
case 78:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap($$[$0]));
case 78:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
break;
case 79:this.$ = $$[$0];
break;
@@ -231,11 +231,11 @@ case 109:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([]);
break;
case 110:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]);
break;
case 111:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap(new yy.Literal('this')));
case 111:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this')));
break;
case 112:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap(new yy.Literal('this')));
case 112:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this')));
break;
case 113:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.Value.wrap(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('this')), [yy.addLocationDataFn(_$[$0])(new yy.Access($$[$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.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Arr([]));
break;
@@ -283,7 +283,7 @@ case 135:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Try($$[$0-3], $$
break;
case 136:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-1], $$[$0]]);
break;
case 137:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([yy.addLocationDataFn(_$[$0-1])(yy.Value.wrap($$[$0-1])), $$[$0]]);
case 137:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([new yy.Value($$[$0-1]), $$[$0]]);
break;
case 138:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Throw($$[$0]));
break;
@@ -325,7 +325,7 @@ 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])(yy.Value.wrap($$[$0]))
source: new yy.Value($$[$0])
});
break;
case 155:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])((function () {
@@ -346,9 +346,9 @@ case 158:this.$ = $$[$0];
break;
case 159:this.$ = $$[$0];
break;
case 160:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap($$[$0]));
case 160:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
break;
case 161:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Value.wrap($$[$0]));
case 161:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
break;
case 162:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
break;
@@ -429,39 +429,39 @@ case 184:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.ad
statement: true
}));
break;
case 185:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.Op.create($$[$0-1], $$[$0]));
case 185:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op($$[$0-1], $$[$0]));
break;
case 186:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.Op.create('-', $$[$0]));
case 186:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('-', $$[$0]));
break;
case 187:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.Op.create('+', $$[$0]));
case 187:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('+', $$[$0]));
break;
case 188:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.Op.create('--', $$[$0]));
case 188:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0]));
break;
case 189:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.Op.create('++', $$[$0]));
case 189:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0]));
break;
case 190:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.Op.create('--', $$[$0-1], null, true));
case 190:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0-1], null, true));
break;
case 191:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.Op.create('++', $$[$0-1], null, true));
case 191:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0-1], null, true));
break;
case 192:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Existence($$[$0-1]));
break;
case 193:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(yy.Op.create('+', $$[$0-2], $$[$0]));
case 193:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('+', $$[$0-2], $$[$0]));
break;
case 194:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(yy.Op.create('-', $$[$0-2], $$[$0]));
case 194:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('-', $$[$0-2], $$[$0]));
break;
case 195:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(yy.Op.create($$[$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.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(yy.Op.create($$[$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.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(yy.Op.create($$[$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.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(yy.Op.create($$[$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.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () {
if ($$[$0-1].charAt(0) === '!') {
return yy.Op.create($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert();
return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert();
} else {
return yy.Op.create($$[$0-1], $$[$0-2], $$[$0]);
return new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
}
}()));
break;
@@ -591,19 +591,16 @@ return new Parser;
if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
exports.parser = parser;
exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }
exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain(args) {
if (!args[1])
throw new Error('Usage: '+args[0]+' FILE');
var source, cwd;
if (typeof process !== 'undefined') {
source = require('fs').readFileSync(require('path').resolve(args[1]), "utf8");
} else {
source = require("file").path(require("file").cwd()).join(args[1]).read({charset: "utf-8"});
if (!args[1]) {
console.log('Usage: '+args[0]+' FILE');
process.exit(1);
}
var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
return exports.parser.parse(source);
}
};
if (typeof module !== 'undefined' && require.main === module) {
exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
exports.main(process.argv.slice(1));
}
}