From 07a2e88960b00ac705927680741f3f79990bd199 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Wed, 28 May 2025 10:07:28 +0200 Subject: [PATCH] String interpolation fix with string literals inside brackets --- IDEHelper/Compiler/BfParser.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/IDEHelper/Compiler/BfParser.cpp b/IDEHelper/Compiler/BfParser.cpp index c2e3a6fa..91f4d957 100644 --- a/IDEHelper/Compiler/BfParser.cpp +++ b/IDEHelper/Compiler/BfParser.cpp @@ -3616,6 +3616,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate) SizedArray childArr; int parenDepth = 0; + int bracketDepth = 0; while (true) { @@ -3627,7 +3628,7 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate) isAsmBlock = true; } - NextToken(-1, isInterpolate && (parenDepth == 0) && (!forceAllowNext)); + NextToken(-1, isInterpolate && (parenDepth == 0) && (bracketDepth == 0) && (!forceAllowNext)); forceAllowNext = false; if (mPreprocessorIgnoredSectionNode != NULL) @@ -3730,7 +3731,12 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate) else if (mToken == BfToken_RParen) 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) {