summary refs log tree commit diff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-08-02 16:03:02 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-08-02 16:03:02 +0000
commit47701677e88230abf7d9106c55f46aa660643ce7 (patch)
treea63fb4fde15c85de24b3d04a3346cd72c6e009ca /src/libexpr
parent5d147e125cea69e9a3b12f0ef64c64f42985c65e (diff)
downloadguix-47701677e88230abf7d9106c55f46aa660643ce7.tar.gz
Add integer ‘-’, ‘*’ and ‘/’ operators
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/parser.y6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 4a59a0875e..d998c840e1 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -271,7 +271,8 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, ParseData * data, const char * err
 %nonassoc EQ NEQ
 %right UPDATE
 %left NOT
-%left '+'
+%left '+' '-'
+%left '*' '/'
 %right CONCAT
 %nonassoc '?'
 %nonassoc '~'
@@ -322,6 +323,9 @@ expr_op
       l->push_back($3);
       $$ = new ExprConcatStrings(false, l);
     }
+  | expr_op '-' expr_op { $$ = new ExprApp(new ExprApp(new ExprVar(data->symbols.create("__sub")), $1), $3); }
+  | expr_op '*' expr_op { $$ = new ExprApp(new ExprApp(new ExprVar(data->symbols.create("__mul")), $1), $3); }
+  | expr_op '/' expr_op { $$ = new ExprApp(new ExprApp(new ExprVar(data->symbols.create("__div")), $1), $3); }
   | expr_op CONCAT expr_op { $$ = new ExprOpConcatLists($1, $3); }
   | expr_app
   ;