добавил слайсы
parent
85405e614a
commit
9517568501
|
@ -301,6 +301,7 @@ func_types:
|
|||
|
||||
type:
|
||||
int_types { }
|
||||
| slice_types
|
||||
| arr_types { }
|
||||
| struct_types { }
|
||||
| func_types { }
|
||||
|
@ -316,6 +317,7 @@ type:
|
|||
// literals
|
||||
literal:
|
||||
STRING_LITERAL { }
|
||||
| slice_literal
|
||||
| arr_literal { }
|
||||
| struct_literal { }
|
||||
| func_literal { }
|
||||
|
@ -371,6 +373,13 @@ arr_types:
|
|||
arr_element:
|
||||
IDENTIFIER LBRACK NUMBER RBRACK
|
||||
|
||||
// slices
|
||||
slice_literal:
|
||||
LBRACK RBRACK type LBRACE math_expr_or_literals_list_or_empty RBRACE
|
||||
|
||||
slice_types:
|
||||
LBRACK RBRACK type
|
||||
|
||||
// functions
|
||||
|
||||
func_literal:
|
||||
|
|
|
@ -19,4 +19,13 @@ func main() {
|
|||
arr[1] = [4]int{3, 2, 5, 4};
|
||||
arr[1] = "test";
|
||||
|
||||
// СЛАЙСЫ
|
||||
var slice1 []int;
|
||||
var slice2 = []int{};
|
||||
slice6 := []int{};
|
||||
slice7 := []int{1, 2, 3};
|
||||
slice7[2] = 123;
|
||||
|
||||
slice8, slice8 = []int{1,2,3,4}, []int{1,2,3,4};
|
||||
|
||||
}
|
Loading…
Reference in New Issue