aboutsummaryrefslogtreecommitdiff
path: root/src/parser.h
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-11 21:24:50 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-11 21:24:50 +0200
commit9b8f937cbd26df1d47e5f5aa37b5c076eb51ecae (patch)
tree1cfcb65aacecf355056f6815db5ed22f309724a8 /src/parser.h
parent1cc4571579f675923677366acc65f4dd6d8750a7 (diff)
Assert that we don’t have too many tokens
Diffstat (limited to 'src/parser.h')
-rw-r--r--src/parser.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/parser.h b/src/parser.h
index 4fcdacd..ee6b324 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -1,6 +1,7 @@
#ifndef ORYX_PARSER_H
#define ORYX_PARSER_H
+#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@@ -44,9 +45,13 @@ enum {
/* Binary sub
‘lhs - rhs’ */
ASTBINSUB = '-',
+
+ _AST_LAST_ENT = 256,
};
typedef uint8_t ast_kind_t_;
+static_assert(_AST_LAST_ENT - 1 <= (ast_kind_t_)-1,
+ "Too many AST tokens to fix in AST_KIND_T_");
#define AST_EMPTY ((idx_t_)-1)
#define AST_SOA_BLKSZ (sizeof(ast_kind_t_) + sizeof(idx_t_) * 3)