📄 synhighlighterbaan.pas
字号:
begin
if KeyComp('bool') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func47: TtkTokenKind;
begin
if KeyComp('defined') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func48: TtkTokenKind;
begin
if KeyComp('long') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func50: TtkTokenKind;
begin
if KeyComp('void') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func51: TtkTokenKind;
begin
if KeyComp('delete') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func52: TtkTokenKind;
begin
if KeyComp('pascal') then Result := tkKey else
if KeyComp('from') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func53: TtkTokenKind;
begin
if KeyComp('enum') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func54: TtkTokenKind;
begin
if KeyComp('class') then Result := tkKey else
if KeyComp('float') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func56: TtkTokenKind;
begin
if KeyComp('domain') then Result := tkKey else
if KeyComp('friend') then Result := tkKey else
if KeyComp('this') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func57: TtkTokenKind;
begin
if KeyComp('goto') then Result := tkKey else
if KeyComp('auto') then Result := tkKey else
if KeyComp('while') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func58: TtkTokenKind;
begin
if KeyComp('_cdecl') then Result := tkKey else
if KeyComp('signed') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func59: TtkTokenKind;
begin
if KeyComp('double') then Result := tkKey else
if KeyComp('where') then Result := tkKey else
if KeyComp('null') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func63: TtkTokenKind;
begin
if KeyComp('try') then Result := tkKey else
if KeyComp('public') then Result := tkKey else
if KeyComp('inline') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func64: TtkTokenKind;
begin
if KeyComp('true') then Result := tkKey else
if KeyComp('select') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func69: TtkTokenKind;
begin
if KeyComp('default') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func70: TtkTokenKind;
begin
if KeyComp('using') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func71: TtkTokenKind;
begin
if KeyComp('stdcall') then Result := tkKey else
if KeyComp('const') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func72: TtkTokenKind;
begin
if KeyComp('static') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func73: TtkTokenKind;
begin
if KeyComp('union') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func74: TtkTokenKind;
begin
if KeyComp('mutable') then Result := tkKey else
if KeyComp('fastcall') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func77: TtkTokenKind;
begin
if KeyComp('namespace') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func78: TtkTokenKind;
begin
if KeyComp('date.num') then Result := tkVariable else Result := tkIdentifier;
end;
function TSynBaanSyn.Func79: TtkTokenKind;
begin
if KeyComp('finally') then Result := tkKey else
if KeyComp('typeid') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func80: TtkTokenKind;
begin
if KeyComp('sizeof') then Result := tkKey else
if KeyComp('short') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func81: TtkTokenKind;
begin
if KeyComp('typedef') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func82: TtkTokenKind;
begin
if KeyComp('strip$') then Result := tkKey else
if KeyComp('switch') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func83: TtkTokenKind;
begin
if KeyComp('selectdo') then Result := tkKey else
if KeyComp('_pascal') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func84: TtkTokenKind;
begin
if KeyComp('throw') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func86: TtkTokenKind;
begin
if KeyComp('brp.open') then Result := tkVariable else
if KeyComp('extern') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func87: TtkTokenKind;
begin
if KeyComp('__far') then Result := tkKey else
if KeyComp('endselect') then Result := tkKey else
if KeyComp('string') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func89: TtkTokenKind;
begin
if KeyComp('__cdecl') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func91: TtkTokenKind;
begin
if KeyComp('private') then Result := tkKey else
if KeyComp('import') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func92: TtkTokenKind;
begin
if KeyComp('template') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func93: TtkTokenKind;
begin
if KeyComp('__based') then Result := tkKey else
if KeyComp('unsigned') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func96: TtkTokenKind;
begin
if KeyComp('volatile') then Result := tkKey else
if KeyComp('return') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func98: TtkTokenKind;
begin
if KeyComp('export') then Result := tkKey else
if KeyComp('explicit') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func99: TtkTokenKind;
begin
if KeyComp('typename') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func100: TtkTokenKind;
begin
if KeyComp('__near') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func101: TtkTokenKind;
begin
if KeyComp('register') then Result := tkKey else
if KeyComp('struct') then Result := tkKey else
if KeyComp('continue') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func102: TtkTokenKind;
begin
if KeyComp('_stdcall') then Result := tkKey else
if KeyComp('function') then Result := tkKey else
if KeyComp('sql.close') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func103: TtkTokenKind;
begin
if KeyComp('virtual') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func104: TtkTokenKind;
begin
if KeyComp('__self') then Result := tkKey else
if KeyComp('wchar_t') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func105: TtkTokenKind;
begin
if KeyComp('__int32') then Result := tkKey else
if KeyComp('__int16') then Result := tkKey else
if KeyComp('__int8') then Result := tkKey else
if KeyComp('__int64') then Result := tkKey else
if KeyComp('_fastcall') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func106: TtkTokenKind;
begin
if KeyComp('protected') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func107: TtkTokenKind;
begin
if KeyComp('static_ca') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func108: TtkTokenKind;
begin
if KeyComp('operator') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func114: TtkTokenKind;
begin
if KeyComp('__pascal') then Result := tkKey else
if KeyComp('__pascal') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func117: TtkTokenKind;
begin
if KeyComp('__loadds') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func118: TtkTokenKind;
begin
if KeyComp('__thread') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func122: TtkTokenKind;
begin
if KeyComp('_import') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func123: TtkTokenKind;
begin
if KeyComp('reinterpr') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func124: TtkTokenKind;
begin
if KeyComp('__fastcal') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func125: TtkTokenKind;
begin
if KeyComp('__try') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func126: TtkTokenKind;
begin
if KeyComp('__segname') then Result := tkKey else
if KeyComp('__declspe') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func129: TtkTokenKind;
begin
if KeyComp('__rtti') then Result := tkKey else
if KeyComp('_export') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func133: TtkTokenKind;
begin
if KeyComp('__stdcall') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func135: TtkTokenKind;
begin
if KeyComp('__except') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func141: TtkTokenKind;
begin
if KeyComp('interrupt') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func145: TtkTokenKind;
begin
if KeyComp('__segment') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func153: TtkTokenKind;
begin
if KeyComp('__import') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func154: TtkTokenKind;
begin
if KeyComp('__fortran') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func160: TtkTokenKind;
begin
if KeyComp('__export') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.Func183: TtkTokenKind;
begin
if KeyComp('__interrup') then Result := tkKey else Result := tkIdentifier;
end;
function TSynBaanSyn.AltFunc: TtkTokenKind;
begin
Result := tkIdentifier;
end;
function TSynBaanSyn.IdentKind(MayBe: PChar): TtkTokenKind;
var
HashKey: Integer;
begin
fToIdent := MayBe;
HashKey := KeyHash(MayBe);
if HashKey < 184 then Result := fIdentFuncTable[HashKey] else Result := tkIdentifier;
end;
procedure TSynBaanSyn.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] := ErectProc;
'>': fProcTable[I] := GreaterProc;
'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] := PlusProc;
')': 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 TSynBaanSyn.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment);
fCommentAttri.Style := [fsItalic];
AddAttribute(fCommentAttri);
fDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective);
AddAttribute(fDirectiveAttri);
fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier);
AddAttribute(fIdentifierAttri);
fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord);
fKeyAttri.Style := [fsBold];
AddAttribute(fKeyAttri);
fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber);
AddAttribute(fNumberAttri);
fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace);
AddAttribute(fSpaceAttri);
fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString);
AddAttribute(fStringAttri);
fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol);
AddAttribute(fSymbolAttri);
fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable);
AddAttribute(fVariableAttri);
SetAttributesOnChange(DefHighlightChange);
InitIdent;
MakeMethodTables;
fDefaultFilter := SYNS_FilterBaan;
end;
procedure TSynBaanSyn.SetLine(NewValue: String; LineNumber: Integer);
begin
fLine := PChar(NewValue);
Run := 0;
fLineNumber := LineNumber;
Next;
end;
procedure TSynBaanSyn.AndSymbolProc;
begin
case FLine[Run + 1] of
'=': {and assign}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
'&': {logical and}
begin
inc(Run, 2);
fTokenID := tkSymbol;
end;
else {and}
begin
inc(Run);
fTokenID := tkSymbol;
end;
end;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -