From 07ca4e9dab7738c7270ee88d4e7ad86c47931b7a Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Thu, 30 Jul 2020 20:56:08 -0300 Subject: [PATCH] Improves binary QuickBASIC 4.5 converter. - Instead of aborting upon finding a bad token, proceed with processing; - Adds space after line numbers. --- source/utilities/QB45BIN.bas | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/utilities/QB45BIN.bas b/source/utilities/QB45BIN.bas index 25deb8583..a20c9daee 100644 --- a/source/utilities/QB45BIN.bas +++ b/source/utilities/QB45BIN.bas @@ -944,7 +944,7 @@ FUNCTION DelimitParseRule$ (ParseRule AS STRING, DefaultRuleID AS STRING) RuleEnd = LEN(ParseRule) + 1 DO - + BraceOffset = INSTR(RuleOffset, ParseRule, "{") IF BraceOffset = 0 THEN BraceOffset = RuleEnd @@ -1376,10 +1376,10 @@ FUNCTION FindRuleDelimiter% (ParseRule AS STRING) RuleEnd = LEN(ParseRule) + 1 DO WHILE RuleOffset < RuleEnd - + BraceOffset = INSTR(RuleOffset, ParseRule, "{") PipeOffset = INSTR(RuleOffset, ParseRule, "|") - + IF BraceOffset = 0 OR PipeOffset <= BraceOffset THEN EXIT DO RuleOffset = INSTR(BraceOffset + 1, ParseRule, "}") @@ -1421,7 +1421,7 @@ FUNCTION GetHashedSymbol (ParseRuleSymbol AS STRING) GetHashedSymbol% = SymbolID% EXIT FUNCTION END IF - + Hash = HashPJW(SymbolID$) LookupSymbol = "[" + SymbolID$ + "]" @@ -1492,9 +1492,9 @@ FUNCTION GetID$ (SymTblOffset AS INTEGER) SymbolFlags = PEEK(Symbol& + 2) IF SymbolFlags AND 2 THEN - + ' Short line numbers are stored as integers. - + NumericID& = PEEK(Symbol& + 4) OR PEEK(Symbol& + 5) * &H100& GetID$ = LTRIM$(STR$(NumericID&)) ELSE @@ -1599,7 +1599,7 @@ FUNCTION GetTaggedItem$ (TagTxt AS STRING, DP AS INTEGER) CASE "int": SubstTxt = FetchLiteralINT(DP, 10) CASE "int&h": SubstTxt = FetchLiteralINT(DP, 16) CASE "int&o": SubstTxt = FetchLiteralINT(DP, 8) - CASE "label": SubstTxt = FetchID(DP): IF NOT IsLineNumber(SubstTxt) THEN SubstTxt = SubstTxt + ":" + CASE "label": SubstTxt = FetchID(DP): IF IsLineNumber(SubstTxt) THEN SubstTxt = SubstTxt + " " ELSE SubstTxt = SubstTxt + ":" CASE "lng": SubstTxt = FetchLiteralLNG(DP, 10) CASE "lng&h": SubstTxt = FetchLiteralLNG(DP, 16) @@ -2307,7 +2307,7 @@ SUB ProcessProcDefType IP = IP - 1 EXIT DO END IF - + IF NOT ReadToken THEN EXIT DO UnwantedReturnValue$ = SubstTagDEFxxx(ProcDefType()) @@ -2682,7 +2682,7 @@ FUNCTION ReadToken '---------------------------------------------------------------------------- IF PCODE < LBOUND(ParseRules) OR PCODE > UBOUND(ParseRules) THEN IP = IP + 1 - PRINT "Bad token found.": SYSTEM 1 'ERROR QBErrBadToken + 'PRINT "Bad token found.": SYSTEM 1 'ERROR QBErrBadToken PCODE = 0: HPARAM = 0: TOKEN = MKI$(0) EXIT FUNCTION END IF