From 441e978f7459dcda1318f8453f41604a8a9e7ae1 Mon Sep 17 00:00:00 2001 From: Steve McNeill Date: Thu, 8 Feb 2024 14:43:27 -0500 Subject: [PATCH 1/2] Fix $IF prioritization --- source/qb64pe.bas | 81 ++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/source/qb64pe.bas b/source/qb64pe.bas index 27960447a..a6ad531fb 100644 --- a/source/qb64pe.bas +++ b/source/qb64pe.bas @@ -1610,52 +1610,12 @@ DO IF LEN(wholeline$) THEN - IF UCASE$(_TRIM$(wholeline$)) = "$NOPREFIX" THEN - qb64prefix_set_desiredState = 1 - IF qb64prefix_set = 0 THEN - IF qb64prefix_set_recompileAttempts = 0 THEN - qb64prefix_set_recompileAttempts = qb64prefix_set_recompileAttempts + 1 - GOTO do_recompile - END IF - END IF - END IF - wholeline$ = lineformat(wholeline$) IF Error_Happened THEN GOTO errmes temp$ = LTRIM$(RTRIM$(UCASE$(wholestv$))) - IF temp$ = "$COLOR:0" THEN - IF qb64prefix_set THEN - addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0_noprefix.bi" - ELSE - addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0.bi" - END IF - GOTO finishedlinepp - END IF - - IF temp$ = "$COLOR:32" THEN - IF qb64prefix_set THEN - addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32_noprefix.bi" - ELSE - addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32.bi" - END IF - GOTO finishedlinepp - END IF - - IF temp$ = "$DEBUG" THEN - vWatchDesiredState = 1 - IF vWatchOn = 0 THEN - IF vWatchRecompileAttempts = 0 THEN - 'this is the first time a conflict has occurred, so react immediately with a full recompilation using the desired state - vWatchRecompileAttempts = vWatchRecompileAttempts + 1 - GOTO do_recompile - ELSE - 'continue compilation to retrieve the final state requested and act on that as required - END IF - END IF - END IF IF LEFT$(temp$, 4) = "$IF " THEN IF RIGHT$(temp$, 5) <> " THEN" THEN a$ = "$IF without THEN": GOTO errmes @@ -1724,6 +1684,47 @@ DO GOTO finishedlinepp 'we don't check for anything inside lines that we've marked for skipping END IF + IF temp$ = "$COLOR:0" THEN + IF qb64prefix_set THEN + addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0_noprefix.bi" + ELSE + addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0.bi" + END IF + GOTO finishedlinepp + END IF + + IF temp$ = "$COLOR:32" THEN + IF qb64prefix_set THEN + addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32_noprefix.bi" + ELSE + addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32.bi" + END IF + GOTO finishedlinepp + END IF + + IF temp$ = "$DEBUG" THEN + vWatchDesiredState = 1 + IF vWatchOn = 0 THEN + IF vWatchRecompileAttempts = 0 THEN + 'this is the first time a conflict has occurred, so react immediately with a full recompilation using the desired state + vWatchRecompileAttempts = vWatchRecompileAttempts + 1 + GOTO do_recompile + ELSE + 'continue compilation to retrieve the final state requested and act on that as required + END IF + END IF + END IF + + IF temp$ = "$NOPREFIX" THEN + qb64prefix_set_desiredState = 1 + IF qb64prefix_set = 0 THEN + IF qb64prefix_set_recompileAttempts = 0 THEN + qb64prefix_set_recompileAttempts = qb64prefix_set_recompileAttempts + 1 + GOTO do_recompile + END IF + END IF + END IF + IF LEFT$(temp$, 7) = "$ERROR " THEN temp$ = RemoveStringEnclosingPair(LTRIM$(MID$(temp$, 7)), METACOMMAND_STRING_ENCLOSING_PAIR) a$ = "Compilation check failed: " + temp$ From f67803254a870b76477f717f21df51da6692a2a4 Mon Sep 17 00:00:00 2001 From: Steve McNeill Date: Fri, 9 Feb 2024 02:46:00 -0500 Subject: [PATCH 2/2] Move lineformat to AFTER $metacommands in prepass loop As per Discord discussion --- source/qb64pe.bas | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/qb64pe.bas b/source/qb64pe.bas index a6ad531fb..55e2dce03 100644 --- a/source/qb64pe.bas +++ b/source/qb64pe.bas @@ -1610,10 +1610,6 @@ DO IF LEN(wholeline$) THEN - wholeline$ = lineformat(wholeline$) - IF Error_Happened THEN GOTO errmes - - temp$ = LTRIM$(RTRIM$(UCASE$(wholestv$))) @@ -1794,6 +1790,9 @@ DO END SELECT END IF + wholeline$ = lineformat(wholeline$) + IF Error_Happened THEN GOTO errmes + cwholeline$ = wholeline$ wholeline$ = eleucase$(wholeline$) '********REMOVE THIS LINE LATER********