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

📄 synhighlighterkix.pas

📁 SynEditStudio delphi 代码编辑器
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  if KeyComp('SCRIPTDIR') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func118: TtkTokenKind;
begin
  if KeyComp('EXISTKEY') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func119: TtkTokenKind;
begin
  if KeyComp('GETDISKSPACE') then Result := tkKey else
    if KeyComp('OLEGETOBJECT') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func120: TtkTokenKind;
begin
  if KeyComp('LONGHOMEDIR') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func123: TtkTokenKind;
begin
  if KeyComp('GETFILESIZE') then Result := tkKey else
    if KeyComp('GETFILEATTR') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func124: TtkTokenKind;
begin
  if KeyComp('SHUTDOWN') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func127: TtkTokenKind;
begin
  if KeyComp('SETCONSOLE') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func130: TtkTokenKind;
begin
  if KeyComp('ENUMGROUP') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func135: TtkTokenKind;
begin
  if KeyComp('SETFILEATTR') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func136: TtkTokenKind;
begin
  if KeyComp('WRITEVALUE') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func139: TtkTokenKind;
begin
  if KeyComp('OLECREATEOBJECT') then Result := tkKey else
    if KeyComp('CLEAREVENTLOG') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func140: TtkTokenKind;
begin
  if KeyComp('OLEENUMOBJECT') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func144: TtkTokenKind;
begin
  if KeyComp('ADDPROGRAMITEM') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func148: TtkTokenKind;
begin
  if KeyComp('SETWALLPAPER') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func152: TtkTokenKind;
begin
  if KeyComp('OLERELEASEOBJECT') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func154: TtkTokenKind;
begin
  if KeyComp('BACKUPEVENTLOG') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func156: TtkTokenKind;
begin
  if KeyComp('DELPROGRAMITEM') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func161: TtkTokenKind;
begin
  if KeyComp('OLEGETSUBOBJECT') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func166: TtkTokenKind;
begin
  if KeyComp('GETFILEVERSION') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func169: TtkTokenKind;
begin
  if KeyComp('COMPAREFILETIMES') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func173: TtkTokenKind;
begin
  if KeyComp('ENUMLOCALGROUP') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func174: TtkTokenKind;
begin
  if KeyComp('ADDPROGRAMGROUP') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func177: TtkTokenKind;
begin
  if KeyComp('PRIMARYGROUP') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func186: TtkTokenKind;
begin
  if KeyComp('DELPROGRAMGROUP') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func195: TtkTokenKind;
begin
  if KeyComp('REDIRECTOUTPUT') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func196: TtkTokenKind;
begin
  if KeyComp('READPROFILESTRING') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func197: TtkTokenKind;
begin
  if KeyComp('OLEGETPROPERTY') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func213: TtkTokenKind;
begin
  if KeyComp('SETDEFAULTPRINTER') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func221: TtkTokenKind;
begin
  if KeyComp('ADDPRINTERCONNECTION') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func222: TtkTokenKind;
begin
  if KeyComp('OLEPUTPROPERTY') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func230: TtkTokenKind;
begin
  if KeyComp('SHOWPROGRAMGROUP') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func233: TtkTokenKind;
begin
  if KeyComp('DELPRINTERCONNECTION') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func243: TtkTokenKind;
begin
  if KeyComp('WRITEPROFILESTRING') then Result := tkKey else Result := tkIdentifier;
end;

function TSynKixSyn.Func273: TtkTokenKind;
begin
  if KeyComp('EXPANDENVIRONMENTVARS') then Result := tkKey else Result := tkIdentifier;
end;

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

function TSynKixSyn.IdentKind(MayBe: PChar): TtkTokenKind;
var
  HashKey: Integer;
begin
  fToIdent := MayBe;
  HashKey := KeyHash(MayBe);
  if HashKey < 274 then
    Result := fIdentFuncTable[HashKey]
  else
    Result := tkIdentifier;
end;

procedure TSynKixSyn.MakeMethodTables;
var
  I: Char;
begin
  for I := #0 to #255 do
    case I of
      '#': fProcTable[I] := AsciiCharProc;
      #13: fProcTable[I] := CRProc;
      'A'..'Z', 'a'..'z', '_': fProcTable[I] := IdentProc;
      #10: fProcTable[I] := LFProc;
      #0: fProcTable[I] := NullProc;
      '0'..'9': fProcTable[I] := NumberProc;
      ';': fProcTable[I] := CommentProc;
      #1..#9, #11, #12, #14..#32: fProcTable[I] := SpaceProc;
      '"','''': fProcTable[I] := StringProc;
      '@': fProcTable[I] := MacroProc;
      '?': fProcTable[I] := PrintProc;
      '$': fProcTable[I] := VariableProc;
    else
      fProcTable[I] := UnknownProc;
    end;
end;

constructor TSynKixSyn.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment);
  fCommentAttri.Style := [fsItalic];
  AddAttribute(fCommentAttri);
  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier);
  AddAttribute(fIdentifierAttri);
  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey);
  fKeyAttri.Style := [fsBold];
  AddAttribute(fKeyAttri);
  fMiscellaneousAttri := TSynHighlighterAttributes.Create(SYNS_AttrMiscellaneous);
  AddAttribute(fMiscellaneousAttri);
  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_FilterKIX;
end;

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

procedure TSynKixSyn.AsciiCharProc;
begin
  fTokenID := tkString;
  inc(Run);
  while FLine[Run] in ['0'..'9'] do inc(Run);
end;

procedure TSynKixSyn.CRProc;
begin
  fTokenID := tkSpace;
  inc(Run);
  if fLine[Run] = #10 then inc(Run);
end;

procedure TSynKixSyn.IdentProc;
begin
  fTokenID := IdentKind((fLine + Run));
  inc(Run, fStringLen);
  while Identifiers[fLine[Run]] do inc(Run);
end;

procedure TSynKixSyn.MacroProc;
begin
  inc(Run);
  fTokenID := tkMiscellaneous;
  while FLine[Run] in ['0'..'9', 'A'..'Z', 'a'..'z'] do inc(Run);
end;

procedure TSynKixSyn.LFProc;
begin
  fTokenID := tkSpace;
  inc(Run);
end;

procedure TSynKixSyn.PrintProc;
begin
  fTokenID := tkKey;
  inc(Run);
end;

procedure TSynKixSyn.VariableProc;
begin
  fTokenId := tkVariable;
  inc(run);
  while FLine[Run] in ['_','0'..'9', 'A'..'Z', 'a'..'z'] do inc(run);
end;

procedure TSynKixSyn.NullProc;
begin
  fTokenID := tkNull;
end;

procedure TSynKixSyn.NumberProc;
begin
  inc(Run);
  fTokenID := tkNumber;
  while FLine[Run] in ['0'..'9', '.', 'e', 'E'] do
  begin
    case FLine[Run] of
      '.':
        if FLine[Run + 1] = '.' then break;
    end;
    inc(Run);
  end;
end;

procedure TSynKixSyn.CommentProc;
begin
  fTokenID := tkComment;
  repeat
    inc(Run);
  until fLine[Run] in [#0, #10, #13];
end;

procedure TSynKixSyn.SpaceProc;
begin
  inc(Run);
  fTokenID := tkSpace;
  while FLine[Run] in [#1..#9, #11, #12, #14..#32] do inc(Run);
end;

procedure TSynKixSyn.StringProc;
var
   achr : char;
begin
  fTokenID := tkString;
  achr := fline[run];
  repeat
    case FLine[Run] of
      #0, #10, #13: break;
    end;
    inc(Run);
  until FLine[Run] = achr;
  if FLine[Run] <> #0 then inc(Run);
end;

procedure TSynKixSyn.UnknownProc;
begin
{$IFDEF SYN_MBCSSUPPORT}
  if FLine[Run] in LeadBytes then
    Inc(Run, 2)
  else
{$ENDIF}
  inc(Run);
  fTokenID := tkUnknown;
end;

procedure TSynKixSyn.Next;
begin
  fTokenPos := Run;
  fProcTable[fLine[Run]];
end;

function TSynKixSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
begin
  case Index of
    SYN_ATTR_COMMENT: Result := fCommentAttri;
    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
    SYN_ATTR_KEYWORD: Result := fKeyAttri;
    SYN_ATTR_STRING: Result := fStringAttri;
    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
  else
    Result := nil;
  end;
end;

function TSynKixSyn.GetEol: Boolean;
begin
  Result := fTokenID = tkNull;
end;

function TSynKixSyn.GetToken: string;
var
  Len: LongInt;
begin
  Len := Run - fTokenPos;
  SetString(Result, (FLine + fTokenPos), Len);
end;

function TSynKixSyn.GetTokenID: TtkTokenKind;
begin
  Result := fTokenId;
end;

function TSynKixSyn.GetTokenAttribute: TSynHighlighterAttributes;
begin
  case GetTokenID of
    tkComment: Result := fCommentAttri;
    tkIdentifier: Result := fIdentifierAttri;
    tkKey: Result := fKeyAttri;
    tkMiscellaneous: Result := fMiscellaneousAttri;
    tkNumber: Result := fNumberAttri;
    tkSpace: Result := fSpaceAttri;
    tkString: Result := fStringAttri;
    tkSymbol: Result := fSymbolAttri;
    tkVariable: Result := fVariableAttri;
    tkUnknown: Result := fIdentifierAttri;
    else Result := nil;
  end;
end;

function TSynKixSyn.GetTokenKind: integer;
begin
  Result := Ord(fTokenId);
end;

function TSynKixSyn.GetTokenPos: Integer;
begin
  Result := fTokenPos;
end;

function TSynKixSyn.GetIdentChars: TSynIdentChars;
begin
  Result := TSynValidStringChars;
end;

class function TSynKixSyn.GetLanguageName: string;
begin
  Result := SYNS_LangKIX;
end;

function TSynKixSyn.IsFilterStored: Boolean;
begin
  Result := fDefaultFilter <> SYNS_FilterKIX;
end;

function TSynKixSyn.GetSampleSource: string;
begin
  Result := '; KiXtart sample source'#13#10 +
            'break on'#13#10 +
            'color b/n'#13#10 +
            #13#10 +
            'AT(1, 30) "Hello World!"'#13#10 +
            '$USERID = @USERID'#13#10 +
            'AT(1, 30) $USERID';
end;

initialization
  MakeIdentTable;
{$IFNDEF SYN_CPPB_1}
  RegisterPlaceableHighlighter(TSynKixSyn);
{$ENDIF}
end.

⌨️ 快捷键说明

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