1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

String interpolation fix with string literals inside brackets

This commit is contained in:
Brian Fiete 2025-05-28 10:07:28 +02:00
parent ee3aa7fc26
commit 07a2e88960

View file

@ -3616,6 +3616,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
SizedArray<BfAstNode*, 32> childArr; SizedArray<BfAstNode*, 32> childArr;
int parenDepth = 0; int parenDepth = 0;
int bracketDepth = 0;
while (true) while (true)
{ {
@ -3627,7 +3628,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
isAsmBlock = true; isAsmBlock = true;
} }
NextToken(-1, isInterpolate && (parenDepth == 0) && (!forceAllowNext)); NextToken(-1, isInterpolate && (parenDepth == 0) && (bracketDepth == 0) && (!forceAllowNext));
forceAllowNext = false; forceAllowNext = false;
if (mPreprocessorIgnoredSectionNode != NULL) if (mPreprocessorIgnoredSectionNode != NULL)
@ -3730,7 +3731,12 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
else if (mToken == BfToken_RParen) else if (mToken == BfToken_RParen)
parenDepth--; parenDepth--;
if ((isInterpolate) && (parenDepth == 0)) if (mToken == BfToken_LBracket)
bracketDepth++;
else if (mToken == BfToken_RBracket)
bracketDepth--;
if ((isInterpolate) && (parenDepth == 0) && (bracketDepth == 0))
{ {
if (mToken == BfToken_Question) if (mToken == BfToken_Question)
{ {