📄 psvcplusplus.pas
字号:
begin
if KeyComp('enum') then Result := tkKey else
if KeyComp('delete') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func58: TtkTokenKind;
begin
if KeyComp('_pascal') then Result := tkKey else
if KeyComp('__pascal') then Result := tkKey else
if KeyComp('pascal') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func59: TtkTokenKind;
begin
if KeyComp('class') then Result := tkKey else
if KeyComp('float') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func60: TtkTokenKind;
begin
if KeyComp('this') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func61: TtkTokenKind;
begin
if KeyComp('goto') then Result := tkKey else
if KeyComp('auto') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func62: TtkTokenKind;
begin
if KeyComp('__thread') then Result := tkKey else
if KeyComp('while') then Result := tkKey else
if KeyComp('friend') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func64: TtkTokenKind;
begin
if KeyComp('signed') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func65: TtkTokenKind;
begin
if KeyComp('double') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func66: TtkTokenKind;
begin
if KeyComp('__try') then Result := tkKey else
if KeyComp('try') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func67: TtkTokenKind;
begin
if KeyComp('__dispid') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func68: TtkTokenKind;
begin
if KeyComp('true') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func69: TtkTokenKind;
begin
if KeyComp('public') then Result := tkKey else
if KeyComp('inline') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func71: TtkTokenKind;
begin
if KeyComp('__rtti') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func74: TtkTokenKind;
begin
if KeyComp('__classid') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func75: TtkTokenKind;
begin
if KeyComp('__declspec') then Result := tkKey else
if KeyComp('using') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func76: TtkTokenKind;
begin
if KeyComp('const') then Result := tkKey else
if KeyComp('default') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func78: TtkTokenKind;
begin
if KeyComp('_stdcall') then Result := tkKey else
if KeyComp('union') then Result := tkKey else
if KeyComp('__stdcall') then Result := tkKey else
if KeyComp('static') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func79: TtkTokenKind;
begin
if KeyComp('__except') then Result := tkKey else
if KeyComp('wchar_t') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func81: TtkTokenKind;
begin
if KeyComp('mutable') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func82: TtkTokenKind;
begin
if KeyComp('_fastcall') then Result := tkKey else
if KeyComp('__fastcall') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func85: TtkTokenKind;
begin
if KeyComp('short') then Result := tkKey else
if KeyComp('typeid') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func86: TtkTokenKind;
begin
if KeyComp('sizeof') then Result := tkKey else
if KeyComp('__finally') then Result := tkKey else
if KeyComp('namespace') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func88: TtkTokenKind;
begin
if KeyComp('switch') then Result := tkKey else
if KeyComp('typedef') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func89: TtkTokenKind;
begin
if KeyComp('throw') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func92: TtkTokenKind;
begin
if KeyComp('extern') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func97: TtkTokenKind;
begin
if KeyComp('__import') then Result := tkKey else
if KeyComp('_import') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func98: TtkTokenKind;
begin
if KeyComp('private') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func100: TtkTokenKind;
begin
if KeyComp('template') then Result := tkKey else
if KeyComp('__closure') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func101: TtkTokenKind;
begin
if KeyComp('unsigned') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func102: TtkTokenKind;
begin
if KeyComp('return') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func104: TtkTokenKind;
begin
if KeyComp('volatile') then Result := tkKey else
if KeyComp('_export') then Result := tkKey else
if KeyComp('__export') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func105: TtkTokenKind;
begin
if KeyComp('__published') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func106: TtkTokenKind;
begin
if KeyComp('explicit') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func107: TtkTokenKind;
begin
if KeyComp('typename') then Result := tkKey else
if KeyComp('struct') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func109: TtkTokenKind;
begin
if KeyComp('register') then Result := tkKey else
if KeyComp('continue') then Result := tkKey else
if KeyComp('__automated') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func110: TtkTokenKind;
begin
if KeyComp('virtual') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func115: TtkTokenKind;
begin
if KeyComp('protected') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func116: TtkTokenKind;
begin
if KeyComp('operator') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func123: TtkTokenKind;
begin
if KeyComp('dynamic_cast') then Result := tkKey else
if KeyComp('const_cast') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func125: TtkTokenKind;
begin
if KeyComp('static_cast') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func141: TtkTokenKind;
begin
if KeyComp('__property') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.Func206: TtkTokenKind;
begin
if KeyComp('reinterpret_cast') then Result := tkKey else Result := tkIdentifier;
end;
function TpsvCppRTF.AltFunc: TtkTokenKind;
begin
Result := tkIdentifier;
end;
function TpsvCppRTF.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 TpsvCppRTF.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] := DirectiveProc;
'=': fProcTable[I] := EqualProc;
'>': fProcTable[I] := GreaterProc;
'?': fProcTable[I] := QuestionProc;
'A'..'Z', 'a'..'z', '_': fProcTable[I] := IdentProc;
#10: fProcTable[I] := LFProc;
'<': fProcTable[I] := LowerProc;
'-': fProcTable[I] := MinusProc;
'%': fProcTable[I] := ModSymbolProc;
'!': fProcTable[I] := NotSymbolProc;
#0: fProcTable[I] := NullProc;
'0'..'9': fProcTable[I] := NumberProc;
'|': fProcTable[I] := OrSymbolProc;
'+': fProcTable[I] := PlusProc;
'.': fProcTable[I] := PointProc;
')': 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;
'*': fProcTable[I] := StarProc;
#34: fProcTable[I] := StringProc;
'~': fProcTable[I] := TildeProc;
'^': fProcTable[I] := XOrSymbolProc;
else fProcTable[I] := UnknownProc;
end;
end;
constructor TpsvCppRTF.Create;
begin
inherited Create;
InitIdent;
MakeMethodTables;
fRange := rsUnknown;
fAsmStart := False;
CreateColorTable(
[clBlack, //1 tkAsm
clGreen, //2 tkComment
clBlack, //3 tkDirective
clBlack, //4 tkIdentifier
clBlue, //5 tkKey
clBlue, //6 tkNumber
clBlack, //7 tkFloat
clBlack, //8 tkHex
clBlack, //9 tkOctal
clBlack, //10 tkSpace
clBlack, //11 tkString
clBlack, //12 tkChar
clBlack, //13 tkSymbol
clBlack, //14 tkUnknown
clBlack] //15 else
);
end; { Create }
procedure TpsvCppRTF.SetLine(NewValue: String; LineNumber:Integer);
begin
fLine := PChar(NewValue);
Run := 0;
fLineNumber := LineNumber;
Next;
end; { SetLine }
procedure TpsvCppRTF.AnsiCProc;
begin
fTokenID := tkComment;
case FLine[Run] of
#0:
begin
NullProc;
exit;
end;
#10:
begin
LFProc;
exit;
end;
#13:
begin
CRProc;
exit;
end;
end;
while FLine[Run] <> #0 do
case FLine[Run] of
'*':
if fLine[Run + 1] = '/' then
begin
inc(Run, 2);
if fRange = rsAnsiCAsm then
fRange := rsAsm
else if fRange = rsAnsiCAsmBlock then
fRange := rsAsmBlock
else if (fRange = rsDirectiveComment) and
not (fLine[Run] in [#0, #13, #10]) then
fRange := rsMultiLineDirective //dj
else
fRange := rsUnKnown;
break;
end else
inc(Run);
#10: break;
#13: break;
else inc(Run);
end;
end;
procedure TpsvCppRTF.AndSymbolProc;
begin
fTokenID := tkSymbol;
case FLine[Run + 1] of
'=': {and assign}
begin
inc(Run, 2);
FExtTokenID := xtkAndAssign;
end;
'&': {logical and}
begin
inc(Run, 2);
FExtTokenID := xtkLogAnd;
end;
else {and}
begin
inc(Run);
FExtTokenID := xtkAnd;
end;
end;
end;
procedure TpsvCppRTF.AsciiCharProc;
begin
fTokenID := tkChar;
repeat
if fLine[Run] = '\' then begin
if fLine[Run + 1] in [#39, '\'] then //ek 2000-04-26
inc(Run);
end;
inc(Run);
until fLine[Run] in [#0, #10, #13, #39];
if fLine[Run] = #39 then
inc(Run);
end;
procedure TpsvCppRTF.AtSymbolProc;
begin
fTokenID := tkUnknown;
inc(Run);
end;
procedure TpsvCppRTF.BraceCloseProc;
begin
inc(Run);
fTokenId := tkSymbol;
FExtTokenID := xtkBraceClose;
if fRange = rsAsmBlock then fRange := rsUnknown;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -