Export FScanner parser to ZScript as ScriptScanner

This commit is contained in:
Cacodemon345 2023-12-08 20:11:30 +01:00 committed by Christoph Oelckers
commit a368588db6
4 changed files with 428 additions and 4 deletions

View file

@ -260,6 +260,7 @@ void FScanner::PrepareScript ()
StateOptions = false;
StringBuffer[0] = '\0';
BigStringBuffer = "";
ParseError = false;
}
//==========================================================================
@ -1089,13 +1090,14 @@ void FScanner::ScriptError (const char *message, ...)
va_end (arglist);
}
ParseError = true;
if (NoFatalErrors)
{
Printf(TEXTCOLOR_RED "Script error, \"%s\"" TEXTCOLOR_RED " line %d:\n" TEXTCOLOR_RED "%s\n", ScriptName.GetChars(),
Printf(TEXTCOLOR_RED "%sScript error, \"%s\"" TEXTCOLOR_RED " line %d:\n" TEXTCOLOR_RED "%s\n", PrependMessage.GetChars(), ScriptName.GetChars(),
AlreadyGot ? AlreadyGotLine : Line, composed.GetChars());
return;
}
I_Error ("Script error, \"%s\" line %d:\n%s\n", ScriptName.GetChars(),
I_Error ("%sScript error, \"%s\" line %d:\n%s\n", PrependMessage.GetChars(), ScriptName.GetChars(),
AlreadyGot? AlreadyGotLine : Line, composed.GetChars());
}
@ -1121,7 +1123,8 @@ void FScanner::ScriptMessage (const char *message, ...)
va_end (arglist);
}
Printf (TEXTCOLOR_RED "Script error, \"%s\"" TEXTCOLOR_RED " line %d:\n" TEXTCOLOR_RED "%s\n", ScriptName.GetChars(),
ParseError = true;
Printf (TEXTCOLOR_RED "%sScript error, \"%s\"" TEXTCOLOR_RED " line %d:\n" TEXTCOLOR_RED "%s\n", PrependMessage.GetChars(), ScriptName.GetChars(),
AlreadyGot? AlreadyGotLine : Line, composed.GetChars());
}
@ -1383,4 +1386,3 @@ int ParseHex(const char* hex, FScriptPosition* sc)
return num;
}