From f81a812f59f95d1c2fb7e20ab462015d0646ef53 Mon Sep 17 00:00:00 2001 From: Marvin Schlegel Date: Thu, 16 May 2024 11:15:41 +0200 Subject: [PATCH] parser add assigment statement --- src/Parser/JavaParser.y | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Parser/JavaParser.y b/src/Parser/JavaParser.y index 513b198..7002706 100644 --- a/src/Parser/JavaParser.y +++ b/src/Parser/JavaParser.y @@ -215,7 +215,7 @@ localvariabledeclaration : type variabledeclarators { map LocalVariableDeclarati statementwithouttrailingsubstatement : block { [$1] } | emptystatement { [] } - -- | expressionstatement { } + | expressionstatement { [$1] } | returnstatement { [$1] } ifthenstatement : IF LBRACE expression RBRACE statement { If $3 (Block $5) Nothing } @@ -229,7 +229,7 @@ assignmentexpression : conditionalexpression { $1 } emptystatement : SEMICOLON { Block [] } -expressionstatement : statementexpression SEMICOLON { } +expressionstatement : statementexpression SEMICOLON { StatementExpressionStatement $1 } returnstatement : RETURN SEMICOLON { Return Nothing } | RETURN expression SEMICOLON { Return $ Just $2 } @@ -248,13 +248,13 @@ assignment : lefthandside assignmentoperator assignmentexpression { } -statementexpression : assignment { } - | preincrementexpression { } - | predecrementexpression { } - | postincrementexpression { } - | postdecrementexpression { } - | methodinvocation { } - | classinstancecreationexpression { } +statementexpression : assignment { $1 } + -- | preincrementexpression { } + -- | predecrementexpression { } + -- | postincrementexpression { } + -- | postdecrementexpression { } + -- | methodinvocation { } + -- | classinstancecreationexpression { } ifthenelsestatementnoshortif :IF LBRACE expression RBRACE statementnoshortif ELSE statementnoshortif { }