Moved lexer enum name arrays to lexer.h

This commit is contained in:
Kyler Olsen 2025-10-30 22:31:37 -06:00
parent 4dc58b85c1
commit e320bc39c6
2 changed files with 46 additions and 24 deletions

View File

@ -10,6 +10,8 @@
#include "sls_errors.h"
const size_t TYPE_NAMES_SAFE_LENGTH = 20;
typedef struct {
const char *filename;
const char *source_code;
@ -31,6 +33,19 @@ typedef enum {
TOKEN_TYPE_TUPLE,
} TokenType;
const char *TOKEN_TYPES_NAMES[] = {
"End of File",
"Identifier",
"Integer",
"Float",
"Double",
"String",
"Boolean",
"Array",
"Token String",
"Type Tuple",
};
typedef enum {
ARRAY_IDENTIFIER,
ARRAY_I64,
@ -51,6 +66,26 @@ typedef enum {
ARRAY_STRUCT_INLINE,
} ArrayType;
const char *ARRAY_TYPES_NAMES[] = {
"Identifier",
"i64",
"i32",
"i16",
"i8",
"u64",
"u32",
"u16",
"u8",
"Float",
"Double",
"String",
"Boolean",
"Array",
"Token String",
"Type Tuple",
"Inline Struct",
};
typedef struct {
const char *name;
size_t length;
@ -68,6 +103,17 @@ typedef enum {
INTEGER_U8,
} IntegerBuiltInType;
const char *INTEGER_TYPES_NAMES[] = {
"i64",
"i32",
"i16",
"i8",
"u64",
"u32",
"u16",
"u8",
};
typedef struct {
uint64_t value;
IntegerBuiltInType type;

View File

@ -19,30 +19,6 @@ typedef struct {
LexerInfo lexer_info;
} LexerTest;
static const char *TOKEN_TYPES_NAMES[] = {
"End of File",
"Identifier",
"Integer",
"Float",
"Double",
"String",
"Boolean",
"Array",
"Token String",
"Type Tuple",
};
static const char *INTEGER_TYPES_NAMES[] = {
"i64",
"i32",
"i16",
"i8",
"u64",
"u32",
"u16",
"u8",
};
typedef struct {
const char *value;
size_t length;