📄 psvphpscript.pas
字号:
function TpsvPHPRTF.Func71: TtkTokenKind;
begin
if KeyComp('const') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func72: TtkTokenKind;
begin
if KeyComp('isset') then Result := tkKey else
if KeyComp('static') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func77: TtkTokenKind;
begin
if KeyComp('print') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func78: TtkTokenKind;
begin
if KeyComp('integer') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func79: TtkTokenKind;
begin
if KeyComp('empty') then Result := tkKey else
if KeyComp('unset') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func80: TtkTokenKind;
begin
if KeyComp('endwhile') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func82: TtkTokenKind;
begin
if KeyComp('switch') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func87: TtkTokenKind;
begin
if KeyComp('string') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func91: TtkTokenKind;
begin
if KeyComp('extends') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func93: TtkTokenKind;
begin
if KeyComp('require') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func96: TtkTokenKind;
begin
if KeyComp('return') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func101: TtkTokenKind;
begin
if KeyComp('continue') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func102: TtkTokenKind;
begin
if KeyComp('function') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func105: TtkTokenKind;
begin
if KeyComp('cfunction') then Result := tkKey else
if KeyComp('endswitch') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func151: TtkTokenKind;
begin
if KeyComp('highlight_file') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func156: TtkTokenKind;
begin
if KeyComp('__FILE__') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func164: TtkTokenKind;
begin
if KeyComp('old_function') then Result := tkKey else
if KeyComp('__LINE__') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func177: TtkTokenKind;
begin
if KeyComp('show_source') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.Func206: TtkTokenKind;
begin
if KeyComp('highlight_string') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvPHPRTF.AltFunc: TtkTokenKind;
begin
Result := tkIdentifier;
end;
function TpsvPHPRTF.IdentKind(MayBe: PChar): TtkTokenKind;
var
HashKey: Integer;
begin
fToIdent := MayBe;
HashKey := KeyHash(MayBe);
if HashKey < 207 then Result := fIdentFuncTable[HashKey] else Result := tkIdentifier;
end;
procedure TpsvPHPRTF.MakeMethodTables;
var
I: Char;
begin
for I := #0 to #255 do
case I of
'&': fProcTable[I] := AndSymbolProc;
#39: fProcTable[I] := AsciiCharProc;
'@': fProcTable[I] := AtSymbolProc;
'}': fProcTable[I] := BraceCloseProc;
'{': fProcTable[I] := BraceOpenProc;
#13: fProcTable[I] := CRProc;
':': fProcTable[I] := ColonProc;
',': fProcTable[I] := CommaProc;
'=': fProcTable[I] := EqualProc;
'>': fProcTable[I] := GreaterProc;
'A'..'Z', 'a'..'z', '_': fProcTable[I] := IdentProc;
#10: fProcTable[I] := LFProc;
'<': fProcTable[I] := LowerProc;
'-': fProcTable[I] := MinusProc;
'*': fProcTable[I] := MultiplyProc;
'!': fProcTable[I] := NotSymbolProc;
#0: fProcTable[I] := NullProc;
'0'..'9': fProcTable[I] := NumberProc;
'|': fProcTable[I] := OrSymbolProc;
'+': fProcTable[I] := PlusProc;
'.': fProcTable[I] := PointProc;
'#': fProcTable[I] := PoundProc;
'?': fProcTable[I] := QuestionProc;
'%': fProcTable[I] := RemainderSymbolProc;
')': fProcTable[I] := RoundCloseProc;
'(': fProcTable[I] := RoundOpenProc;
';': fProcTable[I] := SemiColonProc;
'/': fProcTable[I] := SlashProc;
#1..#9, #11, #12, #14..#32: fProcTable[I] := SpaceProc;
']': fProcTable[I] := SquareCloseProc;
'[': fProcTable[I] := SquareOpenProc;
#34: fProcTable[I] := StringProc;
'~': fProcTable[I] := TildeProc;
'$': fProcTable[I] := VariableProc;
'^': fProcTable[I] := XOrSymbolProc;
else fProcTable[I] := UnknownProc;
end;
end;
constructor TpsvPHPRTF.Create;
begin
inherited Create;
InitIdent;
MakeMethodTables;
fRange := rsUnknown;
CreateColorTable([clBlue, //1 tkComment
clBlack, //2 tkIdentifier
clRed, //3 tkInvalidSymbol
clNavy, //4 tkKey
clGreen, //5 tkNumber
clBlack, //6 tkSpace
clMaroon, //7 tkString
clBlack, //8 tkSymbol
clBlack, //9 tkVariable
clBlack, //10 tkUnknown
clBlack]); //11
end;
procedure TpsvPHPRTF.SetLine(NewValue: String; LineNumber: Integer);
begin
fLine := PChar(NewValue);
Run := 0;
fLineNumber := LineNumber;
Next;
end;
procedure TpsvPHPRTF.AndSymbolProc;
begin
case FLine[Run + 1] of
'=': {and assign}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
'&': {conditional and}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
else {and}
begin
inc(Run);
fTokenID := tkSymbol;
end;
end;
end;
procedure TpsvPHPRTF.AsciiCharProc;
begin
fRange := rsString39;
fTokenID := tkString;
repeat
case FLine[Run] of
#0, #10, #13: break;
end;
inc(Run);
until FLine[Run] = #39;
if (FLine[Run] = #39) then
fRange := rsUnKnown;
if FLine[Run] <> #0 then inc(Run);
end;
procedure TpsvPHPRTF.AtSymbolProc;
begin
fTokenID := tkInvalidSymbol;
inc(Run);
end;
procedure TpsvPHPRTF.BraceCloseProc;
begin
inc(Run);
fTokenId := tkSymbol;
end;
procedure TpsvPHPRTF.BraceOpenProc;
begin
inc(Run);
fTokenId := tkSymbol;
end;
procedure TpsvPHPRTF.CRProc;
begin
fTokenID := tkSpace;
Case FLine[Run + 1] of
#10: inc(Run, 2);
else inc(Run);
end;
end;
procedure TpsvPHPRTF.ColonProc;
begin
inc(Run); {colon - conditional}
fTokenID := tkSymbol;
end;
procedure TpsvPHPRTF.CommaProc;
begin
inc(Run);
fTokenID := tkSymbol;
end;
procedure TpsvPHPRTF.EqualProc;
begin
case FLine[Run + 1] of
'=': {logical equal}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
'>': {Hash operator}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
else {assign}
begin
inc(Run);
fTokenID := tkSymbol;
end;
end;
end;
procedure TpsvPHPRTF.GreaterProc;
begin
Case FLine[Run + 1] of
'=': {greater than or equal to}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
'>':
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
else {greater than}
begin
inc(Run);
fTokenID := tkSymbol;
end;
end;
end;
procedure TpsvPHPRTF.IdentProc;
begin
fTokenID := IdentKind((fLine + Run));
inc(Run, fStringLen);
while Identifiers[fLine[Run]] do inc(Run);
end;
procedure TpsvPHPRTF.LFProc;
begin
fTokenID := tkSpace;
inc(Run);
end;
procedure TpsvPHPRTF.LowerProc;
begin
case FLine[Run + 1] of
'=': {less than or equal to}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
'<':
begin
if FLine[Run + 2] = '=' then {shift left assign}
begin
inc(Run, 3)
end
else {shift left}
begin
inc(Run, 2);
end;
fTokenID := tkSymbol;
end;
else {less than}
begin
inc(Run);
fTokenID := tkSymbol;
end;
end;
end;
procedure TpsvPHPRTF.MinusProc;
begin
case FLine[Run + 1] of
'=': {subtract assign}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
'-': {decrement}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
'>': {Class operator}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
else {subtract}
begin
inc(Run);
fTokenID := tkSymbol;
end;
end;
end;
procedure TpsvPHPRTF.MultiplyProc;
begin
case FLine[Run + 1] of
'=': {multiply assign}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
else {multiply}
begin
inc(Run);
fTokenID := tkSymbol;
end;
end;
end;
procedure TpsvPHPRTF.NotSymbolProc;
begin
case FLine[Run + 1] of
'=': {not equal}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
else {logical complement}
begin
inc(Run);
fTokenID := tkSymbol;
end;
end;
end;
procedure TpsvPHPRTF.NullProc;
begin
fTokenID := tkNull;
end;
procedure TpsvPHPRTF.NumberProc;
begin
inc(Run);
fTokenID := tkNumber;
while FLine[Run] in
['0'..'9', '.', '-', 'l', 'L', 'x', 'X', 'A'..'F', 'a'..'f'] do
begin
case FLine[Run] of
'.':
if FLine[Run + 1] = '.' then break;
end;
inc(Run);
end;
end;
procedure TpsvPHPRTF.OrSymbolProc;
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -