summaryrefslogtreecommitdiff
path: root/src/lexer.h
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2023-04-16 03:29:02 +0200
committerJohnny Richard <johnny@johnnyrichard.com>2023-04-16 03:29:02 +0200
commitd951985665bf3e0248286a30c67c28f505eb27c9 (patch)
treed8c77d73366d8a3eeb94f11163edc23201fff5c0 /src/lexer.h
parentd55938b34d6b7ee2c2d7da8483aaed5c8b9078a0 (diff)
Start using string_view on lexer and parser
This change fixes the memory leak when token got created. Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Diffstat (limited to 'src/lexer.h')
-rw-r--r--src/lexer.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lexer.h b/src/lexer.h
index 472ee10..a091fb7 100644
--- a/src/lexer.h
+++ b/src/lexer.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
+#include "string_view.h"
typedef enum {
TOKEN_NAME,
@@ -35,7 +36,7 @@ typedef enum {
typedef struct token_t {
token_kind_t kind;
- char *value;
+ string_view_t value;
char *filepath;
uint32_t row;
uint32_t col;