slight simplification to if/else in the grammar.

This commit is contained in:
Jeremy Ashkenas 2010-06-12 13:53:11 -04:00
parent 0222d90fa3
commit 969740a263
3 changed files with 55 additions and 68 deletions

View File

@ -614,8 +614,8 @@
return new IfNode($2, $3, {
invert: true
});
}), o("IfStart ElsIf", function() {
return $1.add_else($2);
}), o("IfStart ELSE IF Expression Block", function() {
return $1.add_else((new IfNode($4, $5)).force_statement());
})
],
// An **IfStart** can optionally be followed by an else block.
@ -624,12 +624,6 @@
return $1.add_else($3);
})
],
// An *else if* continuation of the *if* expression.
ElsIf: [
o("ELSE IF Expression Block", function() {
return (new IfNode($3, $4)).force_statement();
})
],
// The full complement of *if* expressions, including postfix one-liner
// *if* and *unless*.
If: [

File diff suppressed because one or more lines are too long

View File

@ -491,7 +491,7 @@ grammar: {
IfStart: [
o "IF Expression Block", -> new IfNode $2, $3
o "UNLESS Expression Block", -> new IfNode $2, $3, {invert: true}
o "IfStart ElsIf", -> $1.add_else $2
o "IfStart ELSE IF Expression Block", -> $1.add_else (new IfNode($4, $5)).force_statement()
]
# An **IfStart** can optionally be followed by an else block.
@ -500,11 +500,6 @@ grammar: {
o "IfStart ELSE Block", -> $1.add_else $3
]
# An *else if* continuation of the *if* expression.
ElsIf: [
o "ELSE IF Expression Block", -> (new IfNode($3, $4)).force_statement()
]
# The full complement of *if* expressions, including postfix one-liner
# *if* and *unless*.
If: [