From 7a0e2c01d4670637e15d77b579969ec6270b0699 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 23 Oct 2021 16:42:26 +0200 Subject: [PATCH] Add support for parsing negation in scripting api preprocessor --- Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs index 280006170..553c13c50 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs @@ -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);