[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [abakus] src/common: fix exponentiation bug
From:       Mathias Kraus <k.hias () gmx ! de>
Date:       2013-12-06 20:22:05
Message-ID: E1Vp1uX-0002kZ-Iy () scm ! kde ! org
[Download RAW message or body]

Git commit 44682d0aa615ab319bcb0b458072e63d26913003 by Mathias Kraus.
Committed on 06/12/2013 at 20:19.
Pushed by mkraus into branch 'master'.

fix exponentiation bug

(1+2)**2 could not get resolved
this bug was introduce by the bugfix for exponentiation and unary
minus precedence

M  +1    -0    src/common/parser.yy

http://commits.kde.org/abakus/44682d0aa615ab319bcb0b458072e63d26913003

diff --git a/src/common/parser.yy b/src/common/parser.yy
index b891086..f86af81 100644
--- a/src/common/parser.yy
+++ b/src/common/parser.yy
@@ -321,6 +321,7 @@ FACTOR: TERM { $$ = $1; }
  * reduced to a TERM before the -TERM reduction is applied.
  */
 TERM: VALUE POWER TERM { $$ = new BinaryOperator(BinaryOperator::Exponentiation, $1, $3); }
+TERM: '(' EXP ')' POWER TERM { $$ = new BinaryOperator(BinaryOperator::Exponentiation, $2, $5); }
 TERM: '+' TERM { $$ = $2; }
 TERM: '-' TERM { $$ = new UnaryOperator(UnaryOperator::Negation, $2); }
 TERM: '(' EXP ')' { $$ = $2; }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic