From 0c83d031ff793f364b86bcf557584580edfe66a5 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 22 Jun 2024 13:25:24 +0200 Subject: Rename lots of things to make my life easier --- src/lexer.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/lexer.h') diff --git a/src/lexer.h b/src/lexer.h index 67adc93..5436030 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -6,6 +6,7 @@ #include #include "common.h" +#include "strview.h" #include "types.h" enum { @@ -41,21 +42,20 @@ enum { _LEX_LAST_ENT, }; -typedef uint8_t lexeme_kind_t_; -static_assert(_LEX_LAST_ENT - 1 <= (lexeme_kind_t_)-1, - "Too many lexer tokens to fix in LEXEME_KIND_T_"); +static_assert(_LEX_LAST_ENT - 1 <= UINT8_MAX, + "Too many lexer tokens to fix in uint8_t"); -#define LEXEMES_BLKSZ (sizeof(lexeme_kind_t_) + sizeof(struct strview)) +#define LEXEMES_BLKSZ (1 + sizeof(strview_t)) -struct lexemes { - lexeme_kind_t_ *kinds; - struct strview *strs; +typedef struct { + uint8_t *kinds; + strview_t *strs; size_t len, cap; -}; +} lexemes_t; #define lexemes_free(x) free((x).kinds) -struct lexemes lexstring(const uchar *, size_t) +lexemes_t lexstring(const uchar *, size_t) __attribute__((nonnull)); #endif /* !ORYX_LEXER_H */ -- cgit v1.2.3