From a417c79a08feeabe555d4ab9e213294599557efc Mon Sep 17 00:00:00 2001 From: rtk0c Date: Fri, 8 Jul 2022 17:10:23 -0700 Subject: Changeset: 82 Fix compiling the main game with codegen, add Files table to replace embedding filename in each decl table directly --- source/20-codegen-compiler/main.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source/20-codegen-compiler/main.cpp') diff --git a/source/20-codegen-compiler/main.cpp b/source/20-codegen-compiler/main.cpp index 348d60e..dcec0d3 100644 --- a/source/20-codegen-compiler/main.cpp +++ b/source/20-codegen-compiler/main.cpp @@ -774,6 +774,17 @@ void ParseInputFileAndGenerate(AppState& as, CodegenLexer& /*lexingState*/ ls, s ++idx; incrementTokenIdx = false; + // For forward declarations, there are always 2 tokens after `class`: an identifier, and the ';' token + // Example: + // class MyClass; + if (tokens[idx + 0].type == CLEX_id && + tokens[idx + 1].text == ";") + { + // Skip class forward declarations + idx += 2; + break; + } + auto& idenTok = tokens[idx]; if (idenTok.type != CLEX_id) { printf("[ERROR] invalid syntax for struct or class\n"); @@ -1337,7 +1348,7 @@ where --output-dir=: the *directory* to write generated contents to. Thi DEBUG_PRINTF("Outputting to directory %.*s.\n", PRINTF_STRING_VIEW(as.outputDir)); DEBUG_PRINTF("Databse file: %.*s.\n", PRINTF_STRING_VIEW(as.databaseFilePath)); -#define BRUSSEL_ENABLE_CODEGEN_ARCHIVE 0 +#define BRUSSEL_ENABLE_CODEGEN_ARCHIVE 1 #if BRUSSEL_ENABLE_CODEGEN_ARCHIVE CodegenModelArchive archive(as.databaseFilePath); as.modelArchive = &archive; -- cgit v1.2.3-70-g09d2