Fixed #763. SimpleAssignables are now the only possible recepients of ++, -- and compound assignments.

This commit is contained in:
Timothy Jones 2010-10-19 20:48:39 +13:00
parent 648d6432eb
commit fd268a0479
3 changed files with 14 additions and 14 deletions

View File

@ -555,13 +555,13 @@
return new Op('+', $2);
}, {
prec: 'UNARY'
}), o("-- Expression", function() {
}), o("-- SimpleAssignable", function() {
return new Op('--', $2);
}), o("++ Expression", function() {
}), o("++ SimpleAssignable", function() {
return new Op('++', $2);
}), o("Expression --", function() {
}), o("SimpleAssignable --", function() {
return new Op('--', $1, null, true);
}), o("Expression ++", function() {
}), o("SimpleAssignable ++", function() {
return new Op('++', $1, null, true);
}), o("Expression + Expression", function() {
return new Op('+', $1, $3);
@ -579,9 +579,9 @@
return new Op($2, $1, $3);
}), o("Expression LOGIC Expression", function() {
return new Op($2, $1, $3);
}), o("Value COMPOUND_ASSIGN Expression", function() {
}), o("SimpleAssignable COMPOUND_ASSIGN Expression", function() {
return new Op($2, $1, $3);
}), o("Value COMPOUND_ASSIGN INDENT Expression OUTDENT", function() {
}), o("SimpleAssignable COMPOUND_ASSIGN INDENT Expression OUTDENT", function() {
return new Op($2, $1, $4);
}), o("Expression RELATION Expression", function() {
return $2.charAt(0) === '!' ? ($2 === '!in' ? new Op('!', new In($1, $3)) : new Op('!', new Parens(new Op($2.slice(1), $1, $3)))) : ($2 === 'in' ? new In($1, $3) : new Op($2, $1, $3));

File diff suppressed because one or more lines are too long

View File

@ -527,10 +527,10 @@ grammar =
o "- Expression", (-> new Op '-', $2), prec: 'UNARY'
o "+ Expression", (-> new Op '+', $2), prec: 'UNARY'
o "-- Expression", -> new Op '--', $2
o "++ Expression", -> new Op '++', $2
o "Expression --", -> new Op '--', $1, null, true
o "Expression ++", -> new Op '++', $1, null, true
o "-- SimpleAssignable", -> new Op '--', $2
o "++ SimpleAssignable", -> new Op '++', $2
o "SimpleAssignable --", -> new Op '--', $1, null, true
o "SimpleAssignable ++", -> new Op '++', $1, null, true
o "Expression + Expression", -> new Op '+', $1, $3
o "Expression - Expression", -> new Op '-', $1, $3
@ -541,8 +541,8 @@ grammar =
o "Expression SHIFT Expression", -> new Op $2, $1, $3
o "Expression COMPARE Expression", -> new Op $2, $1, $3
o "Expression LOGIC Expression", -> new Op $2, $1, $3
o "Value COMPOUND_ASSIGN Expression", -> new Op $2, $1, $3
o "Value COMPOUND_ASSIGN INDENT Expression OUTDENT", -> new Op $2, $1, $4
o "SimpleAssignable COMPOUND_ASSIGN Expression", -> new Op $2, $1, $3
o "SimpleAssignable COMPOUND_ASSIGN INDENT Expression OUTDENT", -> new Op $2, $1, $4
o "Expression RELATION Expression", ->
if $2.charAt(0) is '!'