aboutsummaryrefslogtreecommitdiff
path: root/Source/Parser/wp_parser.y
diff options
context:
space:
mode:
authorGravatar Weiqun Zhang <weiqunzhang@lbl.gov> 2019-03-16 11:22:19 -0700
committerGravatar Weiqun Zhang <weiqunzhang@lbl.gov> 2019-03-16 11:22:19 -0700
commit4844eb55a7c1dca03f15d07ff22a34e3ab3d134c (patch)
tree8c505360af925348f3a6bce31f9efcb1ed1eea5f /Source/Parser/wp_parser.y
parent52f718d62605d964fb7a099e50d3f0a45167e654 (diff)
downloadWarpX-4844eb55a7c1dca03f15d07ff22a34e3ab3d134c.tar.gz
WarpX-4844eb55a7c1dca03f15d07ff22a34e3ab3d134c.tar.zst
WarpX-4844eb55a7c1dca03f15d07ff22a34e3ab3d134c.zip
add unary plus sign and fix a bug
Diffstat (limited to 'Source/Parser/wp_parser.y')
-rw-r--r--Source/Parser/wp_parser.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/Parser/wp_parser.y b/Source/Parser/wp_parser.y
index e3a007949..3081125cc 100644
--- a/Source/Parser/wp_parser.y
+++ b/Source/Parser/wp_parser.y
@@ -38,7 +38,7 @@
%left '+' '-'
%left '*' '/'
%left '<' '>'
-%nonassoc NEG
+%nonassoc NEG UPLUS
%right POW
/* This specifies the type of `exp` (i.e., struct wp_node*). Rules
@@ -75,6 +75,7 @@ exp:
| exp '<' exp { $$ = wp_newf2(WP_LT, $1, $3); }
| exp '>' exp { $$ = wp_newf2(WP_GT, $1, $3); }
| '-'exp %prec NEG { $$ = wp_newnode(WP_NEG, $2, NULL); }
+| '+'exp %prec UPLUS { $$ = $2; }
| exp POW exp { $$ = wp_newf2(WP_POW, $1, $3); }
| F1 '(' exp ')' { $$ = wp_newf1($1, $3); }
| F2 '(' exp ',' exp ')' { $$ = wp_newf2($1, $3, $5); }