aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-09-24 11:02:34 +0200
committerHimbeer <himbeer@disroot.org>2024-09-24 11:02:34 +0200
commite228f69087c31b0d356a119d225410e3502f4d32 (patch)
tree7504d139d5ed0f5e97f78fa3427904dc821f00da
parentc9a22c04a32f3db2b0c2a70febfafcefa26f6f2a (diff)
Require enum and union tag types to be parenthesized
This should make parsing safer in cases where the tag type is omitted, ensuring that no more than one token needs to be unlex'd.
-rw-r--r--doc/grammar.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/grammar.txt b/doc/grammar.txt
index 3c3cbef..bdb71fd 100644
--- a/doc/grammar.txt
+++ b/doc/grammar.txt
@@ -63,8 +63,8 @@ integer := "int8" | "uint8"
float := "float32" | "float64"
array := "[" [ expression ] "]" type
struct := "struct" "{" fields "}"
-enum := "enum" [ integer ] [ "=" expression ] "{" ( NAME ), "}"
-union := "union" [ type ] "{" ( type ), "}"
+enum := "enum" [ "(" integer ")" ] [ "=" expression ] "{" ( NAME ), "}"
+union := "union" [ "(" type ")" ] "{" ( type ), "}"
fields := ( NAME type ),
expression := disjunction