mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 16:59:20 +02:00
FpDebug: fix constant char 'a' as array index. Amend Precedence for [n..m]
This commit is contained in:
parent
a839afef06
commit
aa389e7e47
@ -620,9 +620,9 @@ const
|
||||
PRECEDENCE_BIT_SHIFT = 12; // << >> shr shr
|
||||
PRECEDENCE_PLUS_MINUS = 13; // a + b
|
||||
PRECEDENCE_OR = 13; // a OR b // XOR
|
||||
PRECEDENCE_ARRAY_SLICE= 18; // array[5..9] // array slice
|
||||
PRECEDENCE_IN = 19; // enum IN set // officially the same as PRECEDENCE_COMPARE
|
||||
PRECEDENCE_COMPARE = 20; // a <> b // a=b
|
||||
PRECEDENCE_ARRAY_SLICE= 30; // array[5..9] // array slice
|
||||
|
||||
type
|
||||
|
||||
@ -2595,8 +2595,10 @@ end;
|
||||
|
||||
function TFpPascalExpressionPartConstantText.DoGetResultValue: TFpValue;
|
||||
begin
|
||||
//s := GetText;
|
||||
Result := TFpValueConstString.Create(FValue);
|
||||
if Length(FValue) = 1 then
|
||||
Result := TFpValueConstChar.Create(FValue[1])
|
||||
else
|
||||
Result := TFpValueConstString.Create(FValue);
|
||||
{$IFDEF WITH_REFCOUNT_DEBUG}Result.DbgRenameReference(nil, 'DoGetResultValue'){$ENDIF};
|
||||
end;
|
||||
|
||||
@ -2978,7 +2980,6 @@ var
|
||||
end;
|
||||
if not FValid then
|
||||
exit;
|
||||
// If Length(str) = 1 then // char
|
||||
AddPart(TFpPascalExpressionPartConstantText);
|
||||
TFpPascalExpressionPartConstantText(NewPart).FValue := str;
|
||||
end;
|
||||
|
@ -3461,12 +3461,12 @@ begin
|
||||
t.Add('Const-Expr: ansistring ', '''abc''''DE''', weAnsiStr('abcDE')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '''abc''#32''DE''', weAnsiStr('abc DE')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#32''abc''', weAnsiStr(' abc')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#49', weAnsiStr('1')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#49#50', weAnsiStr('12')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#$30#$31', weAnsiStr('01')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#&61#&62', weAnsiStr('12')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#%110001', weAnsiStr('1')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#%00110001', weAnsiStr('1')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#49', weChar('1')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#%110001', weChar('1')).IgnKind;
|
||||
t.Add('Const-Expr: ansistring ', '#%00110001', weChar('1')).IgnKind;
|
||||
|
||||
t.Add('Const-Expr: ansistring ', '''a', weAnsiStr('1')).IgnKind^.AddFlag(ehExpectError);
|
||||
t.Add('Const-Expr: ansistring ', '''', weAnsiStr('1')).IgnKind^.AddFlag(ehExpectError);
|
||||
|
Loading…
Reference in New Issue
Block a user