mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- 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
|
@ -299,7 +299,7 @@ opt_struct_body(X) ::= error. { X = NULL; }
|
|||
|
||||
|
||||
struct_body(X) ::= struct_member(X).
|
||||
struct_body(X) ::= struct_member(A) struct_body(B). { X = A; /*X-overwrites-A*/ AppendTreeNodeSibling(X, B); }
|
||||
struct_body(X) ::= struct_body(A) struct_member(B). { X = A; /*X-overwrites-A*/ AppendTreeNodeSibling(X, B); }
|
||||
|
||||
struct_member(X) ::= declarator(A). { X = A; /*X-overwrites-A*/ }
|
||||
struct_member(X) ::= enum_def(A). { X = A; /*X-overwrites-A*/ }
|
||||
|
|
|
@ -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");
|
||||
|
||||
FILE *f = nullptr;
|
||||
const char *tracefile = Args->CheckValue("-tracefile");
|
||||
if (tracefile != nullptr)
|
||||
{
|
||||
f = fopen(tracefile, "w");
|
||||
char prompt = '\0';
|
||||
ZCCParseTrace(f, &prompt);
|
||||
#endif
|
||||
}
|
||||
|
||||
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"))
|
||||
|
|
|
@ -228,7 +228,7 @@ FWeaponSlots weapons;
|
|||
|
||||
native bool UndoPlayerMorph(playerinfo player, int unmorphflag = 0, bool force = false);
|
||||
native bool PoisonPlayer(Actor poisoner, Actor source, int poison);
|
||||
native PoisonDamage(Actor source, int damage, bool playPainSound)
|
||||
native void PoisonDamage(Actor source, int damage, bool playPainSound);
|
||||
native void SetPsprite(int id, State stat, bool pending = false);
|
||||
native void SetSafeFlash(Weapon weap, State flashstate, int index);
|
||||
native PSprite GetPSprite(int id);
|
||||
|
|
Loading…
Reference in a new issue