diff options
-rw-r--r-- | doc/grammar.txt | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/doc/grammar.txt b/doc/grammar.txt index 486fefd..bd42658 100644 --- a/doc/grammar.txt +++ b/doc/grammar.txt @@ -51,8 +51,8 @@ call := path "(" ( expression ), ")" defer := "defer" call type := "*" type | "?" type | "!" type - | integer | float | struct | enum | union - | array | slice + | bool | integer | float | struct | enum | union + | array | path numtype := integer | float integer := "int8" | "uint8" @@ -61,11 +61,10 @@ integer := "int8" | "uint8" | "int64" | "uint64" | "int" | "uint" float := "float32" | "float64" -array := "[" expression "]" type -slice := "[]" type +array := "[" [ expression ] "]" type struct := "struct" "{" fields "}" enum := "enum" [ integer ] [ "=" expression ] "{" ( NAME ), "}" -union := "union" [ type ] "{" fields "}" +union := "union" [ type ] "{" ( type ), "}" fields := ( NAME type ), expression := disjunction @@ -84,9 +83,8 @@ unaryprefix := [ "-" | "!" | "~" ] unarypostfix unarypostfix := primary [ "*" | "?" | "!" ] primary := grouping | literal | call | path grouping := "(" expression ")" -literal := bool | string | number | arrayelems | sliceelems +literal := bool | string | number | arrayelems bool := "true" | "false" string := STRING* number := NUMBER ( numtype ) arrayelems := array "{" ( expression ), "}" -sliceelems := slice "{" ( expression ), "}" |