codetools: clean up

git-svn-id: trunk@38213 -
This commit is contained in:
mattias 2012-08-09 17:01:45 +00:00
parent 18d15fd899
commit bd89c5bdc7

View File

@ -1137,137 +1137,137 @@ begin
// read token // read token
c1:=p^; c1:=p^;
case c1 of case c1 of
'_','A'..'Z','a'..'z': '_','A'..'Z','a'..'z':
begin begin
// keyword or identifier // keyword or identifier
inc(p);
while IsIdentChar[p^] do
inc(p); inc(p);
while IsIdentChar[p^] do TokenType:=lsttWord;
inc(p); SrcPos:=p-PChar(Src)+1;
TokenType:=lsttWord; if FMacrosOn then begin
SrcPos:=p-PChar(Src)+1; MacroID:=IndexOfMacro(@Src[TokenStart],false);
if FMacrosOn then begin if MacroID>=0 then begin
MacroID:=IndexOfMacro(@Src[TokenStart],false); AddMacroSource(MacroID);
if MacroID>=0 then begin
AddMacroSource(MacroID);
end;
end; end;
end; end;
'''','#': end;
begin '''','#':
TokenType:=lsttStringConstant; begin
while true do begin TokenType:=lsttStringConstant;
case p^ of while true do begin
#0: case p^ of
begin #0:
SrcPos:=p-PChar(Src)+1; begin
if SrcPos>SrcLen then break; SrcPos:=p-PChar(Src)+1;
inc(p); if SrcPos>SrcLen then break;
end; inc(p);
'#':
begin
inc(p);
while IsNumberChar[p^] do
inc(p);
end;
'''':
begin
inc(p);
while true do begin
case p^ of
#0:
begin
SrcPos:=p-PChar(Src)+1;
if SrcPos>SrcLen then break;
inc(p);
end;
'''':
begin
inc(p);
break;
end;
#10,#13:
break;
else
inc(p);
end;
end;
end;
else
break;
end; end;
end; '#':
SrcPos:=p-PChar(Src)+1; begin
end;
'0'..'9':
begin
TokenType:=lsttNone;
inc(p);
while IsNumberChar[p^] do
inc(p);
if (p^='.') and (p[1]<>'.') then begin
// real type number
inc(p);
while IsNumberChar[p^] do
inc(p); inc(p);
if (p^ in ['E','e']) then begin
// read exponent
inc(p);
if (p^ in ['-','+']) then inc(p);
while IsNumberChar[p^] do while IsNumberChar[p^] do
inc(p); inc(p);
end; end;
'''':
begin
inc(p);
while true do begin
case p^ of
#0:
begin
SrcPos:=p-PChar(Src)+1;
if SrcPos>SrcLen then break;
inc(p);
end;
'''':
begin
inc(p);
break;
end;
#10,#13:
break;
else
inc(p);
end;
end;
end;
else
break;
end; end;
SrcPos:=p-PChar(Src)+1;
end; end;
'%': // boolean SrcPos:=p-PChar(Src)+1;
begin end;
TokenType:=lsttNone; '0'..'9':
inc(p); begin
while p^ in ['0'..'1'] do
inc(p);
SrcPos:=p-PChar(Src)+1;
end;
'$': // hex
begin
TokenType:=lsttNone;
inc(p);
while IsHexNumberChar[p^] do
inc(p);
SrcPos:=p-PChar(Src)+1;
end;
'=':
begin
SrcPos:=p-PChar(Src)+2;
TokenType:=lsttEqual;
end;
'.':
begin
SrcPos:=p-PChar(Src)+2;
TokenType:=lsttPoint;
end;
';':
begin
SrcPos:=p-PChar(Src)+2;
TokenType:=lsttSemicolon;
end;
',':
begin
SrcPos:=p-PChar(Src)+2;
TokenType:=lsttComma;
end;
else
TokenType:=lsttNone; TokenType:=lsttNone;
inc(p); inc(p);
c2:=p^; while IsNumberChar[p^] do
// test for double char operators inc(p);
// :=, +=, -=, /=, *=, <>, <=, >=, **, ><, .. if (p^='.') and (p[1]<>'.') then begin
if ((c2='=') and (IsEqualOperatorStartChar[c1])) // real type number
or ((c1='<') and (c2='>')) inc(p);
or ((c1='>') and (c2='<')) while IsNumberChar[p^] do
or ((c1='.') and (c2='.')) inc(p);
or ((c1='*') and (c2='*')) if (p^ in ['E','e']) then begin
then inc(p); // read exponent
inc(p);
if (p^ in ['-','+']) then inc(p);
while IsNumberChar[p^] do
inc(p);
end;
end;
SrcPos:=p-PChar(Src)+1; SrcPos:=p-PChar(Src)+1;
end;
'%': // boolean
begin
TokenType:=lsttNone;
inc(p);
while p^ in ['0'..'1'] do
inc(p);
SrcPos:=p-PChar(Src)+1;
end;
'$': // hex
begin
TokenType:=lsttNone;
inc(p);
while IsHexNumberChar[p^] do
inc(p);
SrcPos:=p-PChar(Src)+1;
end;
'=':
begin
SrcPos:=p-PChar(Src)+2;
TokenType:=lsttEqual;
end;
'.':
begin
SrcPos:=p-PChar(Src)+2;
TokenType:=lsttPoint;
end;
';':
begin
SrcPos:=p-PChar(Src)+2;
TokenType:=lsttSemicolon;
end;
',':
begin
SrcPos:=p-PChar(Src)+2;
TokenType:=lsttComma;
end;
else
TokenType:=lsttNone;
inc(p);
c2:=p^;
// test for double char operators
// :=, +=, -=, /=, *=, <>, <=, >=, **, ><, ..
if ((c2='=') and (IsEqualOperatorStartChar[c1]))
or ((c1='<') and (c2='>'))
or ((c1='>') and (c2='<'))
or ((c1='.') and (c2='.'))
or ((c1='*') and (c2='*'))
then inc(p);
SrcPos:=p-PChar(Src)+1;
end; end;
{$IFDEF RangeChecking}{$R+}{$UNDEF RangeChecking}{$ENDIF} {$IFDEF RangeChecking}{$R+}{$UNDEF RangeChecking}{$ENDIF}
end; end;