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

📄 synhighlighterrc.pas

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

function TSynRCSyn.Func84: TtkTokenKind;
begin
  if KeyComp('POPUP') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func87: TtkTokenKind;
begin
  if KeyComp('RTEXT') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func89: TtkTokenKind;
begin
  if KeyComp('COMBOBOX') then result:= tkKey
  else
   if KeyComp('LOADONCALL') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func90: TtkTokenKind;
begin
  if KeyComp('MENUBREAK') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func94: TtkTokenKind;
begin
  if KeyComp('CURSOR') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func97: TtkTokenKind;
begin
  if KeyComp('CONTROL') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func98: TtkTokenKind;
begin
  if KeyComp('FILETYPE') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func100: TtkTokenKind;
begin
  if KeyComp('MENUITEM') then result:= tkKey
  else
   if KeyComp('SCROLLBAR') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func101: TtkTokenKind;
begin
  if KeyComp('LISTBOX') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func102: TtkTokenKind;
begin
  if KeyComp('VERSION') then result:= tkKey
  else
   if KeyComp('COMMENTS') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func105: TtkTokenKind;
begin
  if KeyComp('PUSHBOX') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func107: TtkTokenKind;
begin
  if KeyComp('EDITTEXT') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func109: TtkTokenKind;
begin
  if KeyComp('MESSAGETABLE') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func110: TtkTokenKind;
begin
  if KeyComp('EXSTYLE') then result:= tkKey
  else
   if KeyComp('VIRTKEY') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func111: TtkTokenKind;
begin
  if KeyComp('MENUBARBREAK') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func113: TtkTokenKind;
begin
  if KeyComp('SEPARATOR') then result:= tkKey
  else
   if KeyComp('SPECIALBUILD') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func117: TtkTokenKind;
begin
  if KeyComp('NOINVERT') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func118: TtkTokenKind;
begin
  if KeyComp('GROUPBOX') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func120: TtkTokenKind;
begin
  if KeyComp('ACCELERATORS') then result:= tkKey
  else
   if KeyComp('COMPANYNAME') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func121: TtkTokenKind;
begin
  if KeyComp('FILEFLAGSMASK') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func125: TtkTokenKind;
begin
  if KeyComp('AUTO3STATE') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func126: TtkTokenKind;
begin
  if KeyComp('INTERNALNAME') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func127: TtkTokenKind;
begin
  if KeyComp('STRINGTABLE') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func128: TtkTokenKind;
begin
  if KeyComp('AUTOCHECKBOX') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func130: TtkTokenKind;
begin
  if KeyComp('PRODUCTNAME') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func134: TtkTokenKind;
begin
  if KeyComp('FILEVERSION') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func139: TtkTokenKind;
begin
  if KeyComp('RADIOBUTTON') then result:= tkKey
  else
   if KeyComp('PRIVATEBUILD') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func140: TtkTokenKind;
begin
  if KeyComp('FILESUBTYPE') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func146: TtkTokenKind;
begin
  if KeyComp('VERSIONINFO') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func147: TtkTokenKind;
begin
  if KeyComp('LEGALTRADEMARKS') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func150: TtkTokenKind;
begin
  if KeyComp('ORIGINALFILENAME') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func156: TtkTokenKind;
begin
  if KeyComp('CHARACTERISTICS') then result:= tkKey
  else
   if KeyComp('PUSHBUTTON') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func158: TtkTokenKind;
begin
  if KeyComp('LEGALCOPYRIGHT') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func164: TtkTokenKind;
begin
  if KeyComp('FILEDESCRIPTION') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func171: TtkTokenKind;
begin
  if KeyComp('DEFPUSHBUTTON') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func196: TtkTokenKind;
begin
  if KeyComp('AUTORADIOBUTTON') then result:= tkKey
  else
   result:= tkIdentifier;
end;

function TSynRCSyn.Func199: TtkTokenKind;
begin
  if KeyComp('PRODUCTVERSION') then result:= tkKey
  else
   result:= tkIdentifier;
end;

procedure TSynRCSyn.MakeMethodTables;
var
 i: char;
begin
  for i:= #0 to #255 do
   case i of
    #0:                         fProcTable[i]:= NullProc;
    #13:                        fProcTable[i]:= CRProc;
    #10:                        fProcTable[i]:= LFProc;
    '/':                        fProcTable[i]:= SlashProc;
    '"':                        fProcTable[i]:= QuoteProc;
    '#':                        fProcTable[i]:= DirectiveProc;
    'A'..'Z', 'a'..'z', '_':    fProcTable[i]:= IdentProc;
    '0'..'9':                   fProcTable[i]:= NumberProc;
    #1..#9, #11, #12, #14..#32: fPRocTable[i]:= SpaceProc;
    '|', ',', '{', '}':         fProcTable[i]:= SymbolProc;
   else
    fProcTable[i]:= UnknownProc;
   end;
end;

procedure TSynRCSyn.QuoteProc;
begin
  fTokenId:= tkString;
  repeat
   inc(Run);
  until (fLine[Run] in [#0, #10, #13, #34]);
  if fLine[Run] = #34 then
    inc(Run);
end;

procedure TSynRCSyn.SlashProc;
begin
  case fLine[Run +1] of
   #13: CRPRoc;
   #10: LFProc;
   '/':
    begin
      fTokenId:= tkComment;
      inc(Run, 2);
      while not (fLine[Run] in [#0, #13, #10]) do inc(Run);
    end;
   '*':
    begin
      fTokenID:= tkComment;
      fRange:= rsComment;
      inc(Run, 2);
      while fLine[Run] <> #0 do
       case fLine[Run] of
        '*':
         if fLine[Run +1] = '/' then
          begin
            inc(Run, 2);
            fRange:= rsUnknown;
            break;
          end
         else inc(Run);
        #10, #13: break;
       else
        inc(Run);
       end;
    end;
  else
   fTokenId:= tkSymbol;
   inc(Run);  
  end
end;

procedure TSynRCSyn.CommentProc;
begin
  fTokenId:= tkComment;
  case fLine[Run] of
   #0: NullProc;
  #13: CRProc;
  #10: LFProc;
  else
   fTokenId:= tkComment;
   repeat
    if (fLine[Run] = '*') and (fLine[Run +1] = '/') then
     begin
       inc(Run, 2);
       fRange:= rsUnknown;
       break;
     end
    else
     inc(Run);
   until fLine[Run] in [#0, #10, #13];
  end;
end;

procedure TSynRCSyn.DirectiveProc;
begin
  fTokenId:= tkDirective;
  repeat
   if (fLine[Run] = '/') then
    begin
      if fLine[Run +1] = '/' then
       begin
         fRange:= rsUnknown;
         exit;
       end
      else
       if fLine[Run +1] = '*' then
        begin
          fRange:= rsComment;
          exit;
        end
    end;
   inc(Run);
  until (fLine[Run] in [#0, #13, #10]);
end;

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

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

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

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

procedure TSynRCSyn.NullProc;
begin
  fTokenId:= tkNull;
end;

procedure TSynRCSyn.NumberProc;
begin
  inc(Run);
  fTokenID:= tkNumber;
  while fLine[Run] in ['0'..'9', '.', 'u', 'U', 'e', 'E', 'x', 'X',
                       'A'..'F', 'a'..'f', 'L', 'l', '-', '+'] do
   begin
     case fLine[Run] of
      '.': if fLine[Run +1] = '.' then break;
     end;
     inc(Run);
   end;
end;

procedure TSynRCSyn.SymbolProc;
begin
  inc(Run);
  fTokenID:= tkSymbol;
end;

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

procedure TSynRCSyn.Next;
begin
  fTokenPos:= Run;
  case fRange of
   rsDirective: DirectiveProc;
   rsComment: CommentProc;
  else
   fProcTable[fLine[Run]];
  end;
end;

function TSynRCSyn.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 TSynRCSyn.GetEOL: boolean;
begin
  result:= fTokenID = tkNull;
end;

function TSynRCSyn.GetRange: pointer;
begin
  result:= pointer(fRange);
end;

function TSynRCSyn.GetToken: string;
var
 len: longint;
begin
  len:= Run - fTokenPos;
  SetString(result, (fLine +fTokenPos), len);
end;

function TSynRCSyn.GetTokenID: TtkTokenKind;
begin
  result:= fTokenID;
end;

function TSynRCSyn.GetTokenAttribute: TSynHighlighterAttributes;
begin
  case fTokenID of
   tkComment: result:= fCommentAttri;
   tkDirective: result:= fDirecAttri;
   tkIdentifier: result:= fIdentifierAttri;
   tkKey: result:= fKeyAttri;
   tkNumber: result:= fNumberAttri;
   tkSpace: result:= fSpaceAttri;
   tkString: result:= fStringAttri;
   tkSymbol: result:= fSymbolAttri;
   tkUnknown: result:= fSymbolAttri;
  else
   result:= nil;
  end;
end;

function TSynRCSyn.GetTokenKind: integer;
begin
  result:= ord(GetTokenID);
end;

function TSynRCSyn.GetTokenPos: integer;
begin
  result:= fTokenPos;
end;

procedure TSynRCSyn.ResetRange;
begin
  fRange:= rsUnknown;
end;

procedure TSynRCSyn.SetRange(value: pointer);
begin
  fRange:= TRangeState(value);
end;

procedure TSynRCSyn.EnumUserSettings(Settings: TStrings);
begin
  // ** ??
end;

function TSynRCSyn.UseUserSettings(SettingIndex: integer): boolean;
begin
  result:= FALSE;
end;

function TSynRCSyn.GetIdentChars: TSynIdentChars;
begin
  result:= TSynValidStringChars; // ** check
end;

class function TSynRCSyn.GetCapabilities: TSynHighlighterCapabilities;
begin
  result:= inherited GetCapabilities;
end;

function TSynRCSyn.IsFilterStored: Boolean;
begin
  Result := fDefaultFilter <> SYNS_FilterRC;
end;

class function TSynRCSyn.GetLanguageName: string;
begin
  result:= SYNS_LangRC;
end;

function TSynRCSyn.GetSampleSource: string;
begin
  result:= '';
end;

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

⌨️ 快捷键说明

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