summaryrefslogtreecommitdiffstats
path: root/Source/cmExprParser.y
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmExprParser.y')
-rw-r--r--Source/cmExprParser.y19
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/cmExprParser.y b/Source/cmExprParser.y
index ce467cf..c7c4a7b 100644
--- a/Source/cmExprParser.y
+++ b/Source/cmExprParser.y
@@ -118,19 +118,30 @@ shift:
}
term:
- factor {
+ unary {
$<Number>$ = $<Number>1;
}
-| term exp_TIMES factor {
+| term exp_TIMES unary {
$<Number>$ = $<Number>1 * $<Number>3;
}
-| term exp_DIVIDE factor {
+| term exp_DIVIDE unary {
$<Number>$ = $<Number>1 / $<Number>3;
}
-| term exp_MOD factor {
+| term exp_MOD unary {
$<Number>$ = $<Number>1 % $<Number>3;
}
+unary:
+ factor {
+ $<Number>$ = $<Number>1;
+ }
+| exp_PLUS unary {
+ $<Number>$ = + $<Number>2;
+ }
+| exp_MINUS unary {
+ $<Number>$ = - $<Number>2;
+ }
+
factor:
exp_NUMBER {
$<Number>$ = $<Number>1;