[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for Dlang support 1/4] examples: d: fix the handling of unary +
From: |
Adela Vais |
Subject: |
[PATCH for Dlang support 1/4] examples: d: fix the handling of unary + |
Date: |
Wed, 2 Sep 2020 14:32:21 +0300 |
It was interpreting "+exp" as "-exp".
* examples/d/calc.y: Fix.
* examples/d/calc.test: Check it.
---
examples/d/calc.y | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/d/calc.y b/examples/d/calc.y
index b0dee929..15b4f7c7 100644
--- a/examples/d/calc.y
+++ b/examples/d/calc.y
@@ -61,7 +61,7 @@ exp:
| exp "-" exp { $$ = $1 - $3; }
| exp "*" exp { $$ = $1 * $3; }
| exp "/" exp { $$ = $1 / $3; }
-| "+" exp %prec UNARY { $$ = -$2; }
+| "+" exp %prec UNARY { $$ = $2; }
| "-" exp %prec UNARY { $$ = -$2; }
| "(" exp ")" { $$ = $2; }
;
--
2.17.1
- [PATCH for Dlang support 1/4] examples: d: fix the handling of unary +,
Adela Vais <=