ZScript: fixed an issue where #include files were not parsed when the parent file had a //$GZDB_Skip comment. Fixes #716

This commit is contained in:
biwa 2022-04-09 17:00:49 +02:00
parent 9c7526a80c
commit 5cb40a23c2

View file

@ -846,16 +846,7 @@ namespace CodeImp.DoomBuilder.ZDoom
ZScriptTokenType.Preprocessor);
if (token == null) // EOF reached
{
// Now parse all included files
foreach(string include in includes)
{
if (!ParseInclude(include))
return false;
}
break;
}
if (!token.IsValid)
{
@ -863,6 +854,10 @@ namespace CodeImp.DoomBuilder.ZDoom
return false;
}
// If $GZDB_SKIP is encountered we stop parsing. Not that we can't "return" here yet, because the includes still have to be parsed
if (token.Type == ZScriptTokenType.LineComment && token.Value.Trim().ToLowerInvariant() == "$gzdb_skip")
break;
// toplevel tokens allowed are only Preprocessor and Identifier.
switch (token.Type)
{
@ -876,9 +871,6 @@ namespace CodeImp.DoomBuilder.ZDoom
string cmtval = token.Value.TrimStart();
if (cmtval.Length <= 0 || cmtval[0] != '$')
break;
// check for $GZDB_SKIP
if (cmtval.Trim().ToLowerInvariant() == "$gzdb_skip")
return true;
// if we are in a region, read property using function from ZScriptActorStructure
if (regions.Count > 0)
ZScriptActorStructure.ParseGZDBComment(regions.Last().Properties, cmtval);
@ -1014,6 +1006,13 @@ namespace CodeImp.DoomBuilder.ZDoom
}
}
// Now parse all included files
foreach (string include in includes)
{
if (!ParseInclude(include))
return false;
}
return true;
}