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) { // Присваиваем анонимную функцию переменной