diff --git a/analyzers/test/test.y b/analyzers/test/test.y index f99a05a..d75029b 100644 --- a/analyzers/test/test.y +++ b/analyzers/test/test.y @@ -89,12 +89,12 @@ identifiers_list: IDENTIFIER { } | identifiers_list COMMA IDENTIFIER { } -math_expr_and_literals_list: +math_expr_or_literals_list: literal { } - | math_expr_and_literals_list COMMA literal + | math_expr_or_literals_list COMMA literal | math_expr { } - | math_expr_and_literals_list COMMA math_expr + | math_expr_or_literals_list COMMA math_expr // // condition @@ -119,7 +119,7 @@ cicle: ; post_statement: - | identifiers_list ASSIGN math_expr_and_literals_list { } + | identifiers_list ASSIGN math_expr_or_literals_list { } | IDENTIFIER INC { } | IDENTIFIER DEC { } | IDENTIFIER PLUS_EQ math_expr { } @@ -139,8 +139,8 @@ loop_block: ; init_loop_statement: - | identifiers_list SHORT_DECLARATION math_expr_and_literals_list - | identifiers_list ASSIGN math_expr_and_literals_list + | identifiers_list SHORT_DECLARATION math_expr_or_literals_list + | identifiers_list ASSIGN math_expr_or_literals_list loop_statements: | loop_statements statement @@ -304,7 +304,7 @@ func_declaration: // vars decl var_multiple_short_declaration: - identifiers_list SHORT_DECLARATION math_expr_and_literals_list + identifiers_list SHORT_DECLARATION math_expr_or_literals_list var_declaration: VAR IDENTIFIER type { { printf("\033[1;33mVAR DECL without init value: %s\n\033[0m", $2); } } diff --git a/tests/test_multiple_declaration.txt b/tests/test_multiple_declaration.txt index 647ee9c..0ebacaf 100644 --- a/tests/test_multiple_declaration.txt +++ b/tests/test_multiple_declaration.txt @@ -8,6 +8,7 @@ func test() { a, b := "hello", "sailor"; // декларация нескольких переменных (строковые литералы) a, b, c, d := "hello", 2, 3.123, true; // декларация нескольких переменных (всякое) + // цикл с множественной декларацией и множественным присвоением for k, l := 0, 10; k < l; k, l = k+1, l-1 { }