From b243bdafadbeaf245a00df6cbfe05d7b2efcf2ae Mon Sep 17 00:00:00 2001 From: serr Date: Sun, 18 May 2025 19:35:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B2=D0=BE=D0=B7=D0=B2=D1=80=D0=B0=D1=89=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B7=D0=BD=D0=B0?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B4=D0=BB=D1=8F=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- analyzers/test/test.y | 8 +++++++- tests/main.go | 4 ++++ tests/test_funcs.txt | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/analyzers/test/test.y b/analyzers/test/test.y index cf8e191..f9736be 100644 --- a/analyzers/test/test.y +++ b/analyzers/test/test.y @@ -106,6 +106,10 @@ math_expr_or_literals_list: math_expr_or_literals_list_or_empty: | math_expr_or_literals_list +types_list: + | type + | types_list COMMA type + // // condition @@ -342,7 +346,9 @@ arg_list: ; return_type: - | type { } + | type + | LPAREN types_list RPAREN { } + | LPAREN arg_list RPAREN { } ; func_declaration: diff --git a/tests/main.go b/tests/main.go index f31a178..41e07b8 100644 --- a/tests/main.go +++ b/tests/main.go @@ -2,6 +2,10 @@ package main import "fmt" +func add(x, y int) (z, f, u int, a string) { + z = x + y + return +} func main() { a := 1e6 fmt.Println(a) diff --git a/tests/test_funcs.txt b/tests/test_funcs.txt index dbdd07a..58a53ec 100644 --- a/tests/test_funcs.txt +++ b/tests/test_funcs.txt @@ -2,6 +2,21 @@ package main; import "fmt"; +func A(x, y int) { +} + +func B(x, y int) () { +} + +func C(x, y int) int { +} + +func D(x, y int) (int, string) { +} + +func E(x, y int) (z, f, u int, a string) { +} + // анонимные функции func anon_func(a,b,c,d string, a int) { // Присваиваем анонимную функцию переменной