Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Source/SimpleParser/SimpleParser.Lexer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down