Add #error lexing

This commit is contained in:
Krzosa Karol
2024-01-25 17:29:32 +01:00
parent f6a709bd26
commit 738d27db9d
5 changed files with 59 additions and 39 deletions

View File

@@ -2,8 +2,7 @@
#include "test_table.cpp"
#include "test_array.cpp"
#include "test_arena.cpp"
void TestClexer();
#include "test_lexer.cpp"
int main() {
TestSimpleInsertAndIntegrity();
@@ -54,28 +53,3 @@ int main() {
IO_Assert(i == 5);
}
}
#define CL_Allocator MA_Arena *
#define CL_Allocate(a, s) MA_PushSizeNonZeroed(a, s)
#define CL_ASSERT IO_Assert
#define CL_VSNPRINTF stbsp_vsnprintf
#define CL_SNPRINTF stbsp_snprintf
#include "../standalone_libraries/clexer.c"
void TestClexer() {
MA_Scratch scratch;
S8_String filename = "../standalone_libraries/clexer.c";
S8_String file = OS_ReadFile(scratch, filename);
CL_Lexer lexer = CL_Begin(scratch, file.str, filename.str);
char buff[1024];
for (;;) {
CL_Token token = CL_Next(&lexer);
if (token.kind == CL_EOF) break;
if (token.kind != CL_PREPROC_INCLUDE) continue;
CL_Stringify(buff, sizeof(buff), &token);
// IO_Printf("%s\n", buff);
}
}