From 2aef8dbeec758db7aaf5c46e3130e5f1a0400236 Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Sun, 23 Nov 2014 20:47:39 +0100 Subject: [PATCH] Allow semi expressions in branch conditions. --- Monicelli.y | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Monicelli.y b/Monicelli.y index eeca4f6..79d38b7 100644 --- a/Monicelli.y +++ b/Monicelli.y @@ -110,8 +110,10 @@ cases: case_stmt | case_stmt cases ; case_stmt: - expression COLON statements CASE_END + case_hp COLON statements CASE_END ; +case_hp: + expression | semi_expression ; fun_call: FUNCALL ID args @@ -136,6 +138,17 @@ expression: expression OP_SHL expression | expression OP_SHR expression ; - +semi_expression: + OP_LT expression | + OP_GT expression | + OP_LTE expression | + OP_GTE expression | + OP_PLUS expression | + OP_MINUS expression | + OP_TIMES expression | + OP_DIV expression | + OP_SHL expression | + OP_SHR expression +; %%