1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

More permissive parsing to allow for $"{a ? "b" : "c"}"

This commit is contained in:
Brian Fiete 2023-12-31 06:41:46 -05:00
parent c1bc60d964
commit 100e4c7fe8

View file

@ -3488,6 +3488,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
bool isAsmBlock = false;
bool isTernary = false;
bool forceAllowNext = false;
SizedArray<BfAstNode*, 32> childArr;
@ -3503,7 +3504,8 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
isAsmBlock = true;
}
NextToken(-1, isInterpolate && (parenDepth == 0));
NextToken(-1, isInterpolate && (parenDepth == 0) && (!forceAllowNext));
forceAllowNext = false;
if (mPreprocessorIgnoredSectionNode != NULL)
{
@ -3587,7 +3589,10 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
if ((isInterpolate) && (parenDepth == 0))
{
if (mToken == BfToken_Question)
{
isTernary = true;
forceAllowNext = true;
}
bool endNow = false;
if (mToken == BfToken_Colon)
@ -3605,6 +3610,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
if ((endNow) && (isTernary))
{
forceAllowNext = true;
isTernary = false;
endNow = false;
}