From 9c24dcaa1eeaf75a7a6d4674a7c19da4649f31ce Mon Sep 17 00:00:00 2001 From: chuacw <1757930+chuacw@users.noreply.github.com> Date: Thu, 19 Feb 2026 23:22:45 +0800 Subject: [PATCH] Fixes simple bracketed compiler version compare Fixes simple bracketed compiler version compare --- Source/SimpleParser/SimpleParser.Lexer.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/SimpleParser/SimpleParser.Lexer.pas b/Source/SimpleParser/SimpleParser.Lexer.pas index 585f2e5..cd97491 100644 --- a/Source/SimpleParser/SimpleParser.Lexer.pas +++ b/Source/SimpleParser/SimpleParser.Lexer.pas @@ -1702,12 +1702,17 @@ function TmwBasePasLex.EvaluateConditionalExpression(const AParams: String): Boo LIsComVer: Boolean; LIsRtlVer: Boolean; LOper: string; - LValue: Integer; + LValue: Extended; p: Integer; begin { TODO : Expand support for <=> evaluations (complicated to do). Expand support for NESTED expressions } LEvaluation := leeNone; LParams := TrimLeft(AParams); + if LParams.StartsWith('(') and LParams.EndsWith(')') then + begin + Delete(LParams,1, 1); + Delete(LParams, Length(LParams), 1); + end; LIsComVer := Pos('COMPILERVERSION', LParams) = 1; LIsRtlVer := Pos('RTLVERSION', LParams) = 1; if LIsComVer or LIsRtlVer then //simple parser which covers most frequent use cases @@ -1729,7 +1734,7 @@ function TmwBasePasLex.EvaluateConditionalExpression(const AParams: String): Boo p := Pos(' ', LParams); if p = 0 then p := Length(LParams) + 1; - if TryStrToInt(Copy(LParams, 1, p-1), LValue) then + if TryStrToFloat(Copy(LParams, 1, p-1), LValue) then begin Delete(LParams, 1, p); while (LParams <> '') and (LParams[1] = ' ') do