aboutsummaryrefslogtreecommitdiff
path: root/src/lexer.h
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-22 13:25:24 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-22 13:26:22 +0200
commit0c83d031ff793f364b86bcf557584580edfe66a5 (patch)
treebeef319096e8545d7dbf0091e46a57626c27ea1f /src/lexer.h
parent9e127d92246d6577792122b013088466e3688da1 (diff)
Rename lots of things to make my life easier
Diffstat (limited to 'src/lexer.h')
-rw-r--r--src/lexer.h18
1 files changed, 9 insertions, 9 deletions
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 <stdint.h>
#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 */