mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 23:17:10 +01:00
FpDebug: PascalParser, fixed unary +/- / Added unary for float / tests for float
git-svn-id: trunk@64388 -
This commit is contained in:
parent
3f5954b07e
commit
fa1a2fa3b0
@ -2708,20 +2708,23 @@ begin
|
||||
if IsAdd then begin
|
||||
case tmp1.Kind of
|
||||
skPointer: ;
|
||||
skInteger: Result := tmp1;
|
||||
skInteger: Result := tmp1;
|
||||
skCardinal: Result := tmp1;
|
||||
skFloat: Result := tmp1;
|
||||
end;
|
||||
Result.AddReference{$IFDEF WITH_REFCOUNT_DEBUG}(@FValue, 'DoGetResultValue'){$ENDIF};
|
||||
end
|
||||
else begin
|
||||
case tmp1.Kind of
|
||||
skPointer: ;
|
||||
skInteger: Result := TFpValueConstNumber.Create(-tmp1.AsInteger, True);
|
||||
skInteger: Result := TFpValueConstNumber.Create(-tmp1.AsInteger, True);
|
||||
skCardinal: Result := TFpValueConstNumber.Create(-tmp1.AsCardinal, True);
|
||||
skFloat: Result := TFpValueConstFloat.Create(-tmp1.AsFloat);
|
||||
end;
|
||||
{$IFDEF WITH_REFCOUNT_DEBUG}if Result <> nil then Result.DbgRenameReference(nil, 'DoGetResultValue');{$ENDIF}
|
||||
end;
|
||||
{$POP}
|
||||
|
||||
{$IFDEF WITH_REFCOUNT_DEBUG}if Result <> nil then Result.DbgRenameReference(nil, 'DoGetResultValue');{$ENDIF}
|
||||
end;
|
||||
|
||||
{ TFpPascalExpressionPartOperatorPlusMinus }
|
||||
|
||||
@ -2192,9 +2192,15 @@ begin
|
||||
t.Add('Const-Expr: ansistring ', '#A', weAnsiStr('abc')).IgnKind.AddFlag(ehExpectError);
|
||||
t.Add('Const-Expr: ansistring ', '#$X', weAnsiStr('abc')).IgnKind.AddFlag(ehExpectError);
|
||||
|
||||
t.Add('Const-Op: ', '10', weInteger(10));
|
||||
t.Add('Const-Op: ', '-10', weInteger(-10));
|
||||
t.Add('Const-Op: ', '- -10', weInteger(10)); // 2 unary
|
||||
t.Add('Const-Op: ', '+10', weInteger(10));
|
||||
|
||||
t.Add('Const-Op: ', '107 + 1', weInteger(108));
|
||||
t.Add('Const-Op: ', '107 - 1', weInteger(106));
|
||||
t.Add('Const-Op: ', '107 + -1', weInteger(106));
|
||||
t.Add('Const-Op: ', '107 + +1', weInteger(108));
|
||||
t.Add('Const-Op: ', '107 - -1', weInteger(108));
|
||||
t.Add('Const-Op: ', '11 * 3', weInteger(33));
|
||||
t.Add('Const-Op: ', '11 * -3', weInteger(-33));
|
||||
@ -2208,6 +2214,35 @@ begin
|
||||
t.Add('Const-bracket: ', '(1 + 11) * 3', weInteger(36));
|
||||
t.Add('Const-bracket: ', '11 * (3 + 1)', weInteger(44));
|
||||
|
||||
t.Add('Const-Op: ', '1.5', weFloat(1.5));
|
||||
t.Add('Const-Op: ', '-1.5', weFloat(-1.5));
|
||||
t.Add('Const-Op: ', '- -1.5', weFloat(1.5));
|
||||
t.Add('Const-Op: ', '+1.5', weFloat(1.5));
|
||||
|
||||
t.Add('Const-Op: ', ' 10.5 + 1', weFloat(11.5));
|
||||
t.Add('Const-Op: ', ' 10.0 + 1', weFloat(11));
|
||||
t.Add('Const-Op: ', ' 10 + 1.5', weFloat(11.5));
|
||||
t.Add('Const-Op: ', '-10 + 1.5', weFloat(-8.5));
|
||||
t.Add('Const-Op: ', '-10 + -1.5', weFloat(-11.5));
|
||||
|
||||
t.Add('Const-Op: ', ' 10.5 - 1', weFloat(9.5));
|
||||
t.Add('Const-Op: ', ' 10.0 - 1', weFloat(9));
|
||||
t.Add('Const-Op: ', ' 10 - 1.5', weFloat(8.5));
|
||||
t.Add('Const-Op: ', '-10 - 1.5', weFloat(-11.5));
|
||||
t.Add('Const-Op: ', '-10 - -1.5', weFloat(-8.5));
|
||||
|
||||
t.Add('Const-Op: ', '10.5 * 3', weFloat(31.5));
|
||||
t.Add('Const-Op: ', '10.0 * 3', weFloat(30));
|
||||
t.Add('Const-Op: ', ' 9 * 1.5', weFloat(13.5));
|
||||
t.Add('Const-Op: ', '-9 * 1.5', weFloat(-13.5));
|
||||
t.Add('Const-Op: ', '-9 * -1.5', weFloat(13.5));
|
||||
|
||||
t.Add('Const-Op: ', ' 31.5 / 3', weFloat(10.5));
|
||||
t.Add('Const-Op: ', ' 30.0 / 3', weFloat(10));
|
||||
t.Add('Const-Op: ', ' 13.5 / 1.5', weFloat(9));
|
||||
t.Add('Const-Op: ', '-13.5 / 1.5', weFloat(-9));
|
||||
t.Add('Const-Op: ', '-13.5 / -1.5', weFloat(9));
|
||||
|
||||
t.Add('Const-Op: ', '35 And 17', weInteger(1));
|
||||
t.Add('Const-Op: ', '35 And 7', weInteger(3));
|
||||
t.Add('Const-Op: ', '35 or 7', weInteger(39));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user