From 9eba9d1437dda4710e51bece656b7ee981a9a4a9 Mon Sep 17 00:00:00 2001 From: Ur Mom Date: Mon, 13 May 2024 13:45:22 +0200 Subject: [PATCH] fixed shift-reduce conflict --- src/yacc/parser.y | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/yacc/parser.y b/src/yacc/parser.y index 78c2948..c9cd81f 100644 --- a/src/yacc/parser.y +++ b/src/yacc/parser.y @@ -62,6 +62,7 @@ %left OpEquals OpNot '<' '>' %left OpAnd OpOr OpXor %left OpBitand OpBitor OpBitxor OpBitnot +%nonassoc KeyAs '(' ')' %% program: program programbody @@ -74,8 +75,6 @@ programbody: moduleimport | decl | typedef; - - expr: ValFloat | ValInt | ValMultistr @@ -83,7 +82,9 @@ expr: ValFloat | Ident | operation | boxaccess - | boxselfaccess; + | boxselfaccess + | typecast + | reinterpretcast; exprlist: expr ',' exprlist | expr; @@ -166,10 +167,7 @@ identlist: Ident ',' identlist decl: type ':' identlist | storagequalifier type ':' identlist - -definition: decl '=' expr { DEBUG("Definition"); } - | decl '=' typecast { DEBUG("Definition"); }; - | decl '=' reinterpretcast { DEBUG("Definition"); }; +definition: decl '=' expr { DEBUG("Definition"); }; storagequalifier: KeyGlobal | KeyStatic