Add support for parsing negation in scripting api preprocessor

This commit is contained in:
Wojtek Figat
2021-10-23 16:42:26 +02:00
parent 8938f13a0b
commit 7a0e2c01d4

View File

@@ -374,6 +374,9 @@ namespace Flax.Build.Bindings
}
// Very simple defines processing
var negate = tokenValue[0] == '!';
if (negate)
tokenValue = tokenValue.Substring(1);
tokenValue = ReplacePreProcessorDefines(tokenValue, context.PreprocessorDefines.Keys);
tokenValue = ReplacePreProcessorDefines(tokenValue, moduleOptions.PublicDefinitions);
tokenValue = ReplacePreProcessorDefines(tokenValue, moduleOptions.PrivateDefinitions);
@@ -383,6 +386,8 @@ namespace Flax.Build.Bindings
tokenValue = tokenValue.Replace("||", "|");
if (tokenValue.Length != 0 && tokenValue != "1" && tokenValue != "0" && tokenValue != "|")
tokenValue = "0";
if (negate)
tokenValue = tokenValue == "1" ? "0" : "1";
condition += tokenValue;
token = tokenizer.NextToken(true);