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