data tokens lexing

This commit is contained in:
2024-11-21 12:03:53 +05:00
parent ad232f187a
commit bd8215fd73
3 changed files with 102 additions and 12 deletions

View File

@@ -1,15 +1,19 @@
#include "token.h"
static cstr TokenType_str[] = {
static cstr _TokenType_str[] = {
"Unset",
"SingleLineComment",
"MultiLineComment",
"Label",
"Instruction",
"Argument",
"Data",
"Number",
"Char",
"String",
};
cstr TokenType_toString(TokenType t){
return TokenType_str[t];
if(t >= sizeof(_TokenType_str) / sizeof(cstr))
return "!!INDEX_ERROR!!";
return _TokenType_str[t];
}