Ich bleib' bei #2, schmeiß die KeyIndices raus.
Delphi-Quellcode:
type
TIdentFuncTableFunc =
type TtkTokenKind;
...
function TSynPHPSyn.HashKey(Str: PWideChar): integer;
var
I: integer;
S: AnsiString;
begin
Result := -1;
S:= LowerCase(AnsiString(WideCharToString(Str)));
for I:= 0
to Length(KeyWords) - 1
do
if AnsiString(KeyWords[I]) = S
then
begin
Result := I;
Break;
end;
// fStringLen ???
// fToIdent ???
// sind keine Variablen der unit ???
end;
function TSynPHPSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
var
Key: integer;
begin
Key := HashKey(MayBe);
if HashKey(MayBe) > -1
then
Result := fIdentFuncTable[Key]
else
Result := tkIdentifier;
end;
procedure TSynPHPSyn.InitIdent;
var
I: Integer;
begin
for I := Low(fIdentFuncTable)
to High(fIdentFuncTable)
do
if I > High(KeyWords)
then
...
else
...
end;
...