From c5098cb28b20e07fb828d792f3b1496c25fe63a5 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sun, 30 Jun 2024 11:12:44 +0200 Subject: [PATCH] Kludge to fix spacing in formatting of failed parses --- IDEHelper/Compiler/BfPrinter.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/IDEHelper/Compiler/BfPrinter.cpp b/IDEHelper/Compiler/BfPrinter.cpp index a5050a4c..6421be52 100644 --- a/IDEHelper/Compiler/BfPrinter.cpp +++ b/IDEHelper/Compiler/BfPrinter.cpp @@ -1399,7 +1399,20 @@ void BfPrinter::Visit(BfIdentifierNode* identifierNode) Visit(identifierNode->ToBase()); if (!CheckReplace(identifierNode)) + { + if (!mOutString.IsEmpty()) + { + char endC = mOutString[mOutString.mLength - 1]; + if ((endC == '_') || (isalnum((uint8)endC))) + { + // Can fix spacing in error conditions + if (identifierNode->mTriviaStart >= 0) + Write(identifierNode, identifierNode->mTriviaStart, identifierNode->mSrcStart - identifierNode->mTriviaStart); + } + } + WriteSourceString(identifierNode); + } } void BfPrinter::Visit(BfQualifiedNameNode* nameNode)