- fixed bad definition of struct grammar which tried to resolve from right to left, creating large amounts of recursion and strange problems with PlayerInfo.
- added a command line option to generate a parser trace file. - fixed a syntax error in player.txt.
This commit is contained in:
parent
b10ffb5133
commit
36f559ecb7
3 changed files with 13 additions and 11 deletions
|
|
@ -302,12 +302,15 @@ static void DoParse(int lumpnum)
|
|||
|
||||
parser = ZCCParseAlloc(malloc);
|
||||
ZCCParseState state;
|
||||
//#define TRACE
|
||||
#ifdef TRACE // this costs a lot of time and should only be activated when it's really needed.
|
||||
FILE *f = fopen("trace.txt", "w");
|
||||
char prompt = '\0';
|
||||
ZCCParseTrace(f, &prompt);
|
||||
#endif
|
||||
|
||||
FILE *f = nullptr;
|
||||
const char *tracefile = Args->CheckValue("-tracefile");
|
||||
if (tracefile != nullptr)
|
||||
{
|
||||
f = fopen(tracefile, "w");
|
||||
char prompt = '\0';
|
||||
ZCCParseTrace(f, &prompt);
|
||||
}
|
||||
|
||||
sc.OpenLumpNum(lumpnum);
|
||||
auto saved = sc.SavePos();
|
||||
|
|
@ -341,6 +344,7 @@ static void DoParse(int lumpnum)
|
|||
}
|
||||
}
|
||||
|
||||
if (f) fprintf(f, "Starting parsing %s\n", sc.String);
|
||||
ParseSingleFile(sc.String, 0, parser, state);
|
||||
}
|
||||
}
|
||||
|
|
@ -356,12 +360,10 @@ static void DoParse(int lumpnum)
|
|||
I_Error("%d errors while parsing %s", FScriptPosition::ErrorCounter, Wads.GetLumpFullPath(lumpnum).GetChars());
|
||||
}
|
||||
|
||||
#ifdef TRACE
|
||||
if (f != NULL)
|
||||
if (f != nullptr)
|
||||
{
|
||||
fclose(f);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Make a dump of the AST before running the compiler for diagnostic purposes.
|
||||
if (Args->CheckParm("-dumpast"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue