From 37247789895ccaf047962f55bf70852f276ac40a Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Sun, 3 Jan 2010 18:11:53 -0500 Subject: [PATCH] lowering the precedence of if/else/while --- lib/coffee_script/grammar.y | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/coffee_script/grammar.y b/lib/coffee_script/grammar.y index e381f7ab..83ace2e3 100644 --- a/lib/coffee_script/grammar.y +++ b/lib/coffee_script/grammar.y @@ -33,11 +33,10 @@ prechigh right INDENT left OUTDENT right WHEN IN BY - right THROW FOR WHILE NEW SUPER ELSE IF + right THROW FOR NEW SUPER left EXTENDS left ASSIGN '||=' '&&=' - right RETURN '=>' - right UNLESS POSTFIX_IF + right RETURN '=>' UNLESS IF ELSE WHILE preclow rule @@ -406,8 +405,7 @@ rule # The full complement of if blocks, including postfix one-liner ifs and unlesses. If: IfBlock IfEnd { result = val[0].add_else(val[1]) } - | Expression - IF Expression = POSTFIX_IF { result = IfNode.new(val[2], Expressions.wrap(val[0]), nil, {:statement => true}) } + | Expression IF Expression { result = IfNode.new(val[2], Expressions.wrap(val[0]), nil, {:statement => true}) } | Expression UNLESS Expression { result = IfNode.new(val[2], Expressions.wrap(val[0]), nil, {:statement => true, :invert => true}) } ;