diff options
author | rtk0c <[email protected]> | 2022-07-08 17:10:23 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-07-08 17:10:23 -0700 |
commit | a417c79a08feeabe555d4ab9e213294599557efc (patch) | |
tree | b1efa0859a730bc0f6edaac565dfac34d03d706f /source/20-codegen-compiler/main.cpp | |
parent | 8776b737483f579d2d2034bb91efe0794bf67d92 (diff) |
Changeset: 82 Fix compiling the main game with codegen, add Files table to replace embedding filename in each decl table directly
Diffstat (limited to 'source/20-codegen-compiler/main.cpp')
-rw-r--r-- | source/20-codegen-compiler/main.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
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=<path>: 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; |