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

View File

@ -3765,7 +3765,7 @@ begin
Node:=Node.FirstChild;
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;
end;
end;