- separated the Doom specific parts of the ZScript parser from the core into a subclass.

This commit is contained in:
Christoph Oelckers 2020-04-11 19:37:15 +02:00
commit 466ed4e8f2
10 changed files with 1216 additions and 1060 deletions

View file

@ -53,6 +53,8 @@
#include "stats.h"
#include "info.h"
#include "thingdef.h"
#include "zcc_parser.h"
#include "zcc_compile_doom.h"
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
void InitThingdef();
@ -408,6 +410,34 @@ void ParseAllDecorate();
void SynthesizeFlagFields();
void SetDoomCompileEnvironment();
void ParseScripts()
{
int lump, lastlump = 0;
FScriptPosition::ResetErrorCounter();
while ((lump = fileSystem.FindLump("ZSCRIPT", &lastlump)) != -1)
{
ZCCParseState state;
auto newns = ParseOneScript(lump, state);
PSymbolTable symtable;
ZCCDoomCompiler cc(state, NULL, symtable, newns, lump, state.ParseVersion);
cc.Compile();
if (FScriptPosition::ErrorCounter > 0)
{
// Abort if the compiler produced any errors. Also do not compile further lumps, because they very likely miss some stuff.
I_Error("%d errors, %d warnings while compiling %s", FScriptPosition::ErrorCounter, FScriptPosition::WarnCounter, fileSystem.GetFileFullPath(lump).GetChars());
}
else if (FScriptPosition::WarnCounter > 0)
{
// If we got warnings, but no errors, print the information but continue.
Printf(TEXTCOLOR_ORANGE "%d warnings while compiling %s\n", FScriptPosition::WarnCounter, fileSystem.GetFileFullPath(lump).GetChars());
}
}
}
void LoadActors()
{
cycle_t timer;