diff options
author | Himbeer <himbeer@disroot.org> | 2024-09-15 16:41:36 +0200 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2024-09-15 16:41:36 +0200 |
commit | 1664955ab70531b5a479ca9f81040af87a3b6f8b (patch) | |
tree | 8fdab217dc6d1aff89a869ffab769a4985ce7cfd | |
parent | ab096f2a2410c9660333377411aa84838db05ac4 (diff) |
Merge INTEGER and FLOAT tokens into NUMBER token
-rw-r--r-- | doc/grammar.txt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/doc/grammar.txt b/doc/grammar.txt index 937fc06..7532af7 100644 --- a/doc/grammar.txt +++ b/doc/grammar.txt @@ -13,7 +13,7 @@ externfunc := "extern" "func" NAME "(" ( type ), ")" type ";" constant := [ COMMENT ] [ "pub" ] "const" NAME "=" - ( type | bool | INTEGER | FLOAT | STRING* ) ";" + ( type | bool | NUMBER | STRING* ) ";" block := "{" body* "}" @@ -44,7 +44,7 @@ declaration := "let" [ "mut" ] NAME "=" expression ";" assignment := location "=" expression ";" location := NAME ( index | field )* [ "*" ] -index := "[" INTEGER "]" +index := "[" expression "]" field := "." NAME call := path "(" ( expression ), ")" @@ -53,13 +53,14 @@ defer := "defer" call type := integer | float | array | slice | struct | enum | union | "*" type | "?" type | "!" type | path +numtype := integer | float integer := "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "int64" | "uint64" | "int" | "uint" float := "float32" | "float64" -array := "[" INTEGER "]" type +array := "[" expression "]" type slice := "[]" type struct := "struct" "{" fields "}" enum := "enum" [ expression ] "{" ( NAME ), "}" @@ -85,6 +86,6 @@ grouping := "(" expression ")" literal := bool | string | number | arrayelems | sliceelems bool := "true" | "false" string := STRING* -number := ( INTEGER integer ) | ( FLOAT float ) +number := NUMBER ( numtype ) arrayelems := array "{" ( expression ), "}" sliceelems := slice "{" ( expression ), "}" |