⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 synhighlightercs.pas

📁 用delphi写的delphi源代码 用delphi写的delphi源代码 用delphi写的delphi源代码 用delphi写的delphi源代码
💻 PAS
📖 第 1 页 / 共 4 页
字号:
  if KeyComp('base') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func34: TtkTokenKind;
begin
  if KeyComp('char') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func40: TtkTokenKind;
begin
  if KeyComp('catch') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func42: TtkTokenKind;
begin
  if KeyComp('for') then Result := tkKey else
    if KeyComp('break') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func45: TtkTokenKind;
begin
  if KeyComp('lock') then Result := tkKey else
    if KeyComp('else') then Result := tkKey else
      if KeyComp('new') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func46: TtkTokenKind;
begin
	if KeyComp('int') then Result := tkKey
		else if KeyComp('checked') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func48: TtkTokenKind;
begin
  if KeyComp('false') then Result := tkKey else
	if KeyComp('bool') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func52: TtkTokenKind;
begin
  if KeyComp('sealed') then Result := tkKey else
    if KeyComp('long') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func53: TtkTokenKind;
begin
  if KeyComp('fixed') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func54: TtkTokenKind;
begin
  if KeyComp('decimal') then Result := tkKey else
    if KeyComp('void') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func56: TtkTokenKind;
begin
  if KeyComp('byte') then Result := tkKey else Result := tkIdentifier;
end;


function TSynCSSyn.Func57: TtkTokenKind;
begin
  if KeyComp('enum') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func59: TtkTokenKind;
begin
  if KeyComp('out') then Result := tkKey else
    if KeyComp('class') then Result := tkKey else
      if KeyComp('float') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func60: TtkTokenKind;
begin
  if KeyComp('this') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func61: TtkTokenKind;
begin
  if KeyComp('object') then Result := tkKey else  
    if KeyComp('goto') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func62: TtkTokenKind;
begin
    
  if KeyComp('while') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func63: TtkTokenKind;
begin
  if KeyComp('foreach') then Result := tkKey else    
    if KeyComp('null') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func65: TtkTokenKind;
begin
  if KeyComp('double') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func66: TtkTokenKind;
begin
  if KeyComp('try') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func67: TtkTokenKind;
begin
    if KeyComp('delegate') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func68: TtkTokenKind;
begin
  if KeyComp('uint') then Result := tkKey else    
    if KeyComp('true') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func69: TtkTokenKind;
begin
  
  if KeyComp('public') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func71: TtkTokenKind;
begin
  if KeyComp('event') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func72: TtkTokenKind;
begin
  if KeyComp('unsafe') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func74: TtkTokenKind;
begin
  if KeyComp('ulong') then Result := tkKey else    
    if KeyComp('params') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func75: TtkTokenKind;
begin
    if KeyComp('using') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func76: TtkTokenKind;
begin
  if KeyComp('sbyte') then Result := tkKey else
    if KeyComp('const') then Result := tkKey else
      if KeyComp('default') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func78: TtkTokenKind;
begin
  if KeyComp('static') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func83: TtkTokenKind;
begin
  if KeyComp('unchecked') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.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 TSynCSSyn.Func88: TtkTokenKind;
begin
  
  if KeyComp('switch') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func89: TtkTokenKind;
begin
  if KeyComp('throw') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func90: TtkTokenKind;
begin
  if KeyComp('interface') then Result := tkKey else Result := tkIdentifier;
end;


function TSynCSSyn.Func92: TtkTokenKind;
begin
  if KeyComp('abstract') then Result := tkKey else
    if KeyComp('extern') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func93: TtkTokenKind;
begin
  if KeyComp('typeof') then Result := tkKey else
	if KeyComp('string') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func98: TtkTokenKind;
begin
  if KeyComp('private') then Result := tkKey else Result := tkIdentifier;
end;


function TSynCSSyn.Func99: TtkTokenKind;
begin
  if KeyComp('implicit') then Result := tkKey else Result := tkIdentifier;
end;


function TSynCSSyn.Func101: TtkTokenKind;
begin
  if KeyComp('internal') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func102: TtkTokenKind;
begin
  if KeyComp('readonly') then Result := tkKey else
    if KeyComp('return') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func104: TtkTokenKind;
begin
  if KeyComp('override') then Result := tkKey else Result := tkIdentifier;
end;


function TSynCSSyn.Func106: TtkTokenKind;
begin
  if KeyComp('explicit') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func107: TtkTokenKind;
begin
  if KeyComp('ushort') then Result := tkKey else
    if KeyComp('stackalloc') then Result := tkKey else
      if KeyComp('struct') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func109: TtkTokenKind;
begin
    
  if KeyComp('continue') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func110: TtkTokenKind;
begin
  if KeyComp('virtual') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func115: TtkTokenKind;
begin
  if KeyComp('protected') then Result := tkKey else Result := tkIdentifier;
end;

function TSynCSSyn.Func116: TtkTokenKind;
begin
  if KeyComp('operator') then Result := tkKey else Result := tkIdentifier;
end;


function TSynCSSyn.AltFunc: TtkTokenKind;
begin
  Result := tkIdentifier;
end;

function TSynCSSyn.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 TSynCSSyn.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 TSynCSSyn.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler);
  AddAttribute(fAsmAttri);
  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment);
  fCommentAttri.Style:= [fsItalic];
  AddAttribute(fCommentAttri);
  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier);
  AddAttribute(fIdentifierAttri);
  fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar);
  AddAttribute(fInvalidAttri);
  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord);
  fKeyAttri.Style:= [fsBold];
  AddAttribute(fKeyAttri);
  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber);
  AddAttribute(fNumberAttri);
  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace);
  fSpaceAttri.Foreground := clWindow;
  AddAttribute(fSpaceAttri);
  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString);
  AddAttribute(fStringAttri);
  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol);
  AddAttribute(fSymbolAttri);
  fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor);
  AddAttribute(fDirecAttri);
  SetAttributesOnChange(DefHighlightChange);
  InitIdent;
  MakeMethodTables;
  fRange := rsUnknown;
  fAsmStart := False;
  fDefaultFilter := SYNS_FilterCS;
end; { Create }

procedure TSynCSSyn.SetLine(NewValue: String; LineNumber:Integer);
begin
  fLine := PChar(NewValue);
  Run := 0;
  fLineNumber := LineNumber;
  Next;
end; { SetLine }

procedure TSynCSSyn.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 then
            fRange := rsDirective
          else
            fRange := rsUnKnown;
          break;
        end else
          inc(Run);
      #10: break;
      #13: break;
    else inc(Run);
    end;
end;

procedure TSynCSSyn.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 TSynCSSyn.AsciiCharProc;
begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -