codetools: started &keyword identifiers

git-svn-id: trunk@34428 -
This commit is contained in:
mattias 2011-12-26 12:52:46 +00:00
parent 180515f92a
commit 5d55835b0d
2 changed files with 24 additions and 7 deletions

View File

@ -1896,11 +1896,16 @@ begin
while IsHexNumberChar[Src^] do
inc(Src);
end;
'&': // octal constant
'&': // octal constant or keyword as identifier (e.g. &label)
begin
inc(Src);
while (Src^ in ['0'..'7']) do
inc(Src);
if Src^ in ['0'..'7'] then begin
while Src^ in ['0'..'7'] do
inc(Src);
end else begin
while IsIdentChar[Src^] do
inc(Src);
end;
end;
'{': // compiler directive
begin
@ -3892,7 +3897,13 @@ end;
function GetIdentifier(Identifier: PChar): string;
var len: integer;
begin
if (Identifier<>nil) and IsIdentStartChar[Identifier^] then begin
if (Identifier=nil) then begin
Result:='';
exit;
end;
if (Identifier^='&') and (IsIdentChar[Identifier[1]]) then
inc(Identifier);
if IsIdentStartChar[Identifier^] then begin
len:=0;
while (IsIdentChar[Identifier[len]]) do inc(len);
SetLength(Result,len);

View File

@ -1192,11 +1192,17 @@ begin
inc(p);
CurPos.EndPos:=p-PChar(Src)+1;
end;
'&': // octal number
'&': // octal number or keyword as identifier
begin
inc(p);
while p^ in ['0'..'7'] do
inc(p);
if p^ in ['0'..'7'] then begin
while p^ in ['0'..'7'] do
inc(p);
end else if IsIdentChar[p^] then begin
CurPos.Flag:=cafWord;
while IsIdentChar[p^] do
inc(p);
end;
CurPos.EndPos:=p-PChar(Src)+1;
end;
'$': // hex number