CodeTools: ofall() code macro: keep & prefixes. Issue #35801

git-svn-id: trunk@62244 -
This commit is contained in:
ondrej 2019-11-15 21:38:13 +00:00
parent fde024d03d
commit b21a3831c1
2 changed files with 11 additions and 6 deletions

View File

@ -107,7 +107,7 @@ procedure GetIdentStartEndAtPosition(const Source:string; Position:integer;
out IdentStart,IdentEnd:integer); out IdentStart,IdentEnd:integer);
function GetIdentStartPosition(const Source:string; Position:integer): integer; function GetIdentStartPosition(const Source:string; Position:integer): integer;
function GetIdentLen(Identifier: PChar): integer; function GetIdentLen(Identifier: PChar): integer;
function GetIdentifier(Identifier: PChar): string; function GetIdentifier(Identifier: PChar; const aSkipAmp: Boolean = True): string;
function FindNextIdentifier(const Source: string; StartPos, MaxPos: integer): integer; function FindNextIdentifier(const Source: string; StartPos, MaxPos: integer): integer;
function FindNextIdentifierSkipStrings(const Source: string; function FindNextIdentifierSkipStrings(const Source: string;
StartPos, MaxPos: integer): integer; StartPos, MaxPos: integer): integer;
@ -4719,17 +4719,22 @@ begin
+'Actual: '+dbgstr(Actual,1,d-1)+'|'+dbgstr(Actual,d,length(Actual)); +'Actual: '+dbgstr(Actual,1,d-1)+'|'+dbgstr(Actual,d,length(Actual));
end; end;
function GetIdentifier(Identifier: PChar): string; function GetIdentifier(Identifier: PChar; const aSkipAmp: Boolean): string;
var len: integer; var len: integer;
begin begin
if (Identifier=nil) then begin if (Identifier=nil) then begin
Result:=''; Result:='';
exit; exit;
end; end;
if (Identifier^='&') and (IsIdentChar[Identifier[1]]) then if IsIdentStartChar[Identifier^] or ((Identifier^='&') and (IsIdentStartChar[Identifier[1]])) then begin
inc(Identifier);
if IsIdentStartChar[Identifier^] then begin
len:=0; len:=0;
if (Identifier^='&') then
begin
if aSkipAmp then
inc(Identifier)
else
inc(len);
end;
while (IsIdentChar[Identifier[len]]) do inc(len); while (IsIdentChar[Identifier[len]]) do inc(len);
SetLength(Result,len); SetLength(Result,len);
if len>0 then if len>0 then

View File

@ -3765,7 +3765,7 @@ begin
Node:=Node.FirstChild; Node:=Node.FirstChild;
while Node<>nil do begin while Node<>nil do begin
List.Add(EnumPrefix+GetIdentifier(@Tool.Src[Node.StartPos])); List.Add(EnumPrefix+GetIdentifier(@Tool.Src[Node.StartPos], False));
Node:=Node.NextBrother; Node:=Node.NextBrother;
end; end;
end; end;