Fix processing else and elif preprocessor blocks in Flax.Build bindings parser

This commit is contained in:
Wojtek Figat
2022-05-23 17:46:26 +02:00
parent c0412cc4f4
commit d39b6d7120

View File

@@ -361,6 +361,7 @@ namespace Flax.Build.Bindings
break;
}
case "if":
case "elif":
{
// Parse condition
var condition = string.Empty;
@@ -510,6 +511,22 @@ namespace Flax.Build.Bindings
case "ifdef":
ifsCount++;
break;
case "else":
if (ifsCount == 1)
{
// Continue with `else` block
return;
}
break;
case "elif":
if (ifsCount == 1)
{
// Rollback to process conditional block
tokenizer.PreviousToken();
tokenizer.PreviousToken();
return;
}
break;
case "endif":
ifsCount--;
break;