PageRenderTime 41ms CodeModel.GetById 27ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/components/synedit/synhighlightercss.pas

http://github.com/graemeg/lazarus
Pascal | 2161 lines | 1899 code | 214 blank | 48 comment | 191 complexity | 1495752305ee9075843862d627b04367 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1{-------------------------------------------------------------------------------
   2The contents of this file are subject to the Mozilla Public License
   3Version 1.1 (the "License"); you may not use this file except in compliance
   4with the License. You may obtain a copy of the License at
   5http://www.mozilla.org/MPL/
   6
   7Software distributed under the License is distributed on an "AS IS" basis,
   8WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   9the specific language governing rights and limitations under the License.
  10
  11The Original Code is: SynHighlighterCSS.pas, released 2000-04-14.
  12The Original Code is based on the mwCSSSyn.pas file from the
  13mwEdit component suite by Martin Waldenburg and other developers, the Initial
  14Author of this file is Tony De Buys.
  15All Rights Reserved.
  16
  17Contributors to the SynEdit and mwEdit projects are listed in the
  18Contributors.txt file.
  19
  20Alternatively, the contents of this file may be used under the terms of the
  21GNU General Public License Version 2 or later (the "GPL"), in which case
  22the provisions of the GPL are applicable instead of those above.
  23If you wish to allow use of your version of this file only under the terms
  24of the GPL and not to allow others to use your version of this file
  25under the MPL, indicate your decision by deleting the provisions above and
  26replace them with the notice and other provisions required by the GPL.
  27If you do not delete the provisions above, a recipient may use your version
  28of this file under either the MPL or the GPL.
  29
  30$Id$
  31
  32You may retrieve the latest version of this file at the SynEdit home page,
  33located at http://SynEdit.SourceForge.net
  34
  35Known Issues:
  36-------------------------------------------------------------------------------}
  37{
  38@abstract(Provides a CSS syntax highlighter for SynEdit)
  39@author(Tony de Buys)
  40@created(1999)
  41@lastmod(2000-06-23)
  42The SynHighlighterCss unit provides SynEdit with a Cascading Style Sheets syntax highlighter.
  43Thanks to Martin Waldenburg.
  44}
  45unit SynHighlighterCss;
  46
  47{$I SynEdit.inc}
  48
  49interface
  50
  51uses
  52
  53  SysUtils, Classes,
  54  LCLIntf, LCLType,
  55  Controls, Graphics,
  56  SynEditTypes, SynEditHighlighter;
  57
  58type
  59  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
  60    tkString, tkSymbol, tkMeasurementUnit, tkSelector, tkUnknown);
  61
  62  TRangeState = (rsCStyle, rsInDeclarationBlock);
  63  TRangeStates = set of TRangeState;
  64
  65  TProcTableProc = procedure of object;
  66
  67  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
  68  TIdentFuncTableFunc = function: TtkTokenKind of object;
  69
  70type
  71
  72  { TSynCssSyn }
  73
  74  TSynCssSyn = class(TSynCustomHighlighter)
  75  private
  76    fRange: TRangeStates;
  77    fLine: PChar;
  78    fLineNumber: Integer;
  79    fProcTable: array[#0..#255] of TProcTableProc;
  80    Run: LongInt;
  81    fStringLen: Integer;
  82    fToIdent: PChar;
  83    fTokenPos: Integer;
  84    FTokenID: TtkTokenKind;
  85    fIdentFuncTable: array[0..275] of TIdentFuncTableFunc;
  86    fCommentAttri: TSynHighlighterAttributes;
  87    fIdentifierAttri: TSynHighlighterAttributes;
  88    fKeyAttri: TSynHighlighterAttributes;
  89    fNumberAttri: TSynHighlighterAttributes;
  90    fSpaceAttri: TSynHighlighterAttributes;
  91    fStringAttri: TSynHighlighterAttributes;
  92    fSymbolAttri: TSynHighlighterAttributes;
  93    fMeasurementUnitAttri: TSynHighlighterAttributes;
  94    fSelectorAttri: TSynHighlighterAttributes;
  95    function KeyHash(ToHash: PChar): Integer;
  96    function KeyComp(const aKey: String): Boolean;
  97    function Func16: TtkTokenKind;
  98    function Func18: TtkTokenKind;
  99    function Func19: TtkTokenKind;
 100    function Func23: TtkTokenKind;
 101    function Func24: TtkTokenKind;    
 102    function Func26: TtkTokenKind;
 103    function Func29: TtkTokenKind;
 104    function Func30: TtkTokenKind;
 105    function Func32: TtkTokenKind;
 106    function Func34: TtkTokenKind;            
 107    function Func36: TtkTokenKind;
 108    function Func39: TtkTokenKind;
 109    function Func40: TtkTokenKind;
 110    function Func41: TtkTokenKind;
 111    function Func43: TtkTokenKind;
 112    function Func45: TtkTokenKind;
 113    function Func47: TtkTokenKind;
 114    function Func51: TtkTokenKind;
 115    function Func52: TtkTokenKind;
 116    function Func53: TtkTokenKind;
 117    function Func54: TtkTokenKind;
 118    function Func55: TtkTokenKind;
 119    function Func56: TtkTokenKind;
 120    function Func57: TtkTokenKind;
 121    function Func58: TtkTokenKind;    
 122    function Func59: TtkTokenKind;
 123    function Func60: TtkTokenKind;
 124    function Func61: TtkTokenKind;
 125    function Func62: TtkTokenKind;
 126    function Func63: TtkTokenKind;
 127    function Func64: TtkTokenKind;
 128    function Func65: TtkTokenKind;
 129    function Func66: TtkTokenKind;
 130    function Func67: TtkTokenKind;
 131    function Func69: TtkTokenKind;
 132    function Func70: TtkTokenKind;
 133    function Func71: TtkTokenKind;
 134    function Func72: TtkTokenKind;    
 135    function Func74: TtkTokenKind;
 136    function Func76: TtkTokenKind;
 137    function Func78: TtkTokenKind;
 138    function Func79: TtkTokenKind;
 139    function Func80: TtkTokenKind;
 140    function Func81: TtkTokenKind;
 141    function Func82: TtkTokenKind;
 142    function Func83: TtkTokenKind;
 143    function Func84: TtkTokenKind;
 144    function Func85: TtkTokenKind;
 145    function Func86: TtkTokenKind;
 146    function Func87: TtkTokenKind;
 147    function Func88: TtkTokenKind;
 148    function Func89: TtkTokenKind;
 149    function Func90: TtkTokenKind;
 150    function Func91: TtkTokenKind;
 151    function Func92: TtkTokenKind;
 152    function Func93: TtkTokenKind;
 153    function Func94: TtkTokenKind;
 154    function Func95: TtkTokenKind;
 155    function Func96: TtkTokenKind;
 156    function Func97: TtkTokenKind;
 157    function Func98: TtkTokenKind;
 158    function Func99: TtkTokenKind;    
 159    function Func100: TtkTokenKind;
 160    function Func101: TtkTokenKind;
 161    function Func102: TtkTokenKind;
 162    function Func103: TtkTokenKind;
 163    function Func105: TtkTokenKind;
 164    function Func106: TtkTokenKind;
 165    function Func107: TtkTokenKind;
 166    function Func108: TtkTokenKind;
 167    function Func109: TtkTokenKind;
 168    function Func110: TtkTokenKind;
 169    function Func111: TtkTokenKind;
 170    function Func112: TtkTokenKind;
 171    function Func113: TtkTokenKind;    
 172    function Func114: TtkTokenKind;
 173    function Func115: TtkTokenKind;
 174    function Func116: TtkTokenKind;
 175    function Func117: TtkTokenKind;
 176    function Func118: TtkTokenKind;
 177    function Func119: TtkTokenKind;
 178    function Func120: TtkTokenKind;
 179    function Func121: TtkTokenKind;
 180    function Func122: TtkTokenKind;
 181    function Func123: TtkTokenKind;
 182    function Func124: TtkTokenKind;
 183    function Func125: TtkTokenKind;
 184    function Func126: TtkTokenKind;
 185    function Func127: TtkTokenKind;
 186    function Func128: TtkTokenKind;
 187    function Func129: TtkTokenKind;
 188    function Func130: TtkTokenKind;
 189    function Func131: TtkTokenKind;
 190    function Func132: TtkTokenKind;
 191    function Func134: TtkTokenKind;
 192    function Func136: TtkTokenKind;
 193    function Func137: TtkTokenKind;
 194    function Func138: TtkTokenKind;
 195    function Func139: TtkTokenKind;
 196    function Func140: TtkTokenKind;
 197    function Func141: TtkTokenKind;
 198    function Func142: TtkTokenKind;
 199    function Func144: TtkTokenKind;
 200    function Func146: TtkTokenKind;
 201    function Func148: TtkTokenKind;
 202    function Func149: TtkTokenKind;
 203    function Func150: TtkTokenKind;
 204    function Func151: TtkTokenKind;
 205    function Func152: TtkTokenKind;
 206    function Func153: TtkTokenKind;
 207    function Func154: TtkTokenKind;
 208    function Func156: TtkTokenKind;
 209    function Func158: TtkTokenKind;
 210    function Func159: TtkTokenKind;
 211    function Func160: TtkTokenKind;
 212    function Func164: TtkTokenKind;
 213    function Func166: TtkTokenKind;
 214    function Func167: TtkTokenKind;
 215    function Func169: TtkTokenKind;
 216    function Func171: TtkTokenKind;
 217    function Func172: TtkTokenKind;
 218    function Func173: TtkTokenKind;
 219    function Func174: TtkTokenKind;
 220    function Func175: TtkTokenKind;
 221    function Func177: TtkTokenKind;
 222    function Func178: TtkTokenKind;
 223    function Func179: TtkTokenKind;
 224    function Func182: TtkTokenKind;
 225    function Func186: TtkTokenKind;
 226    function Func187: TtkTokenKind;
 227    function Func190: TtkTokenKind;
 228    function Func191: TtkTokenKind;
 229    function Func194: TtkTokenKind;
 230    function Func195: TtkTokenKind;
 231    function Func198: TtkTokenKind;
 232    function Func199: TtkTokenKind;
 233    function Func200: TtkTokenKind;
 234    function Func205: TtkTokenKind;
 235    function Func210: TtkTokenKind;
 236    function Func213: TtkTokenKind;
 237    function Func216: TtkTokenKind;
 238    function Func220: TtkTokenKind;
 239    function Func222: TtkTokenKind;
 240    function Func224: TtkTokenKind;
 241    function Func232: TtkTokenKind;
 242    function Func242: TtkTokenKind;
 243    function Func250: TtkTokenKind;
 244    function Func253: TtkTokenKind;
 245    function Func275: TtkTokenKind;
 246    procedure SymbolProc;
 247    procedure ColonProc;
 248    procedure SelectorProc;
 249    procedure PercentProc;
 250    procedure CurlyOpenProc;
 251    procedure CurlyCloseProc;
 252    procedure CRProc;
 253    procedure CStyleCommentProc;
 254    procedure DashProc;
 255    procedure IdentProc;
 256    procedure HashProc;
 257    procedure IntegerProc;
 258    procedure LFProc;
 259    procedure NullProc;
 260    procedure NumberProc;
 261    procedure RoundOpenProc;
 262    procedure SlashProc;
 263    procedure SpaceProc;
 264    procedure StringProc;
 265    procedure UnknownProc;
 266    function AltFunc: TtkTokenKind;
 267    procedure InitIdent;
 268    function IdentKind(MayBe: PChar): TtkTokenKind;
 269    procedure MakeMethodTables;
 270  protected
 271    function GetIdentChars: TSynIdentChars; override;
 272    function GetSampleSource: String; override;
 273  public
 274    class function GetLanguageName: string; override;
 275  public
 276    constructor Create(AOwner: TComponent); override;
 277    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
 278      override;
 279    function GetEol: Boolean; override;
 280    function GetRange: Pointer; override;
 281    function GetTokenID: TtkTokenKind;
 282    procedure SetLine(const NewValue: String; LineNumber: Integer); override;
 283    function GetToken: string; override;
 284    procedure GetTokenEx(out TokenStart: PChar; out TokenLength: integer); override;
 285    function GetTokenAttribute: TSynHighlighterAttributes; override;
 286    function GetTokenKind: integer; override;
 287    function GetTokenPos: Integer; override;
 288    procedure Next; override;
 289    procedure SetRange(Value: Pointer); override;
 290    procedure ReSetRange; override;
 291    property IdentChars;
 292
 293    function KeyHash2(ToHash: PChar): Integer;
 294  published
 295    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
 296      write fCommentAttri;
 297    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
 298      write fIdentifierAttri;
 299    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
 300    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
 301      write fNumberAttri;
 302    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
 303      write fSpaceAttri;
 304    property StringAttri: TSynHighlighterAttributes read fStringAttri
 305      write fStringAttri;
 306    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
 307      write fSymbolAttri;
 308    property MeasurementUnitAttri: TSynHighlighterAttributes read fMeasurementUnitAttri
 309      write fMeasurementUnitAttri;
 310    property SelectorAttri: TSynHighlighterAttributes read fSelectorAttri
 311      write fSelectorAttri;
 312  end;
 313
 314implementation
 315
 316uses
 317  SynEditStrConst;
 318
 319var
 320  Identifiers: array[#0..#255] of ByteBool;
 321  mHashTable : array[#0..#255] of Integer;
 322
 323procedure MakeIdentTable;
 324var
 325  I, J: Char;
 326begin
 327  for I := #0 to #255 do begin
 328    case I of
 329      'a'..'z', 'A'..'Z', '-', '_', '0'..'9','@': Identifiers[I] := True;
 330    else
 331      Identifiers[I] := False;
 332    end;
 333    J := UpCase(I);
 334    if I in ['a'..'z', 'A'..'Z', '-', '_','@'] then
 335      mHashTable[I] := Ord(J) - 64
 336    else
 337      mHashTable[I] := 0;
 338  end;
 339end;
 340
 341procedure TSynCssSyn.InitIdent;
 342var
 343  I: Integer;
 344  pF: PIdentFuncTableFunc;
 345begin
 346  pF := PIdentFuncTableFunc(@FIdentFuncTable);
 347  for I := Low(FIdentFuncTable) to High(FIdentFuncTable) do begin
 348    pF^ :=  @AltFunc;
 349    Inc(pF);
 350  end;
 351  FIdentFuncTable[16] := @Func16;
 352  FIdentFuncTable[18] := @Func18;
 353  FIdentFuncTable[19] := @Func19;
 354  FIdentFuncTable[23] := @Func23;
 355  FIdentFuncTable[24] := @Func24;
 356  FIdentFuncTable[26] := @Func26;
 357  FIdentFuncTable[29] := @Func29;
 358  FIdentFuncTable[30] := @Func30;
 359  FIdentFuncTable[32] := @Func32;
 360  FIdentFuncTable[34] := @Func34;
 361  FIdentFuncTable[36] := @Func36;
 362  FIdentFuncTable[39] := @Func39;
 363  FIdentFuncTable[40] := @Func40;
 364  FIdentFuncTable[41] := @Func41;
 365  FIdentFuncTable[43] := @Func43;
 366  FIdentFuncTable[45] := @Func45;
 367  FIdentFuncTable[47] := @Func47;
 368  FIdentFuncTable[51] := @Func51;
 369  FIdentFuncTable[52] := @Func52;
 370  FIdentFuncTable[53] := @Func53;
 371  FIdentFuncTable[54] := @Func54;
 372  FIdentFuncTable[55] := @Func55;
 373  FIdentFuncTable[56] := @Func56;
 374  FIdentFuncTable[57] := @Func57;
 375  FIdentFuncTable[58] := @Func58;
 376  FIdentFuncTable[59] := @Func59;
 377  FIdentFuncTable[60] := @Func60;
 378  FIdentFuncTable[61] := @Func61;
 379  FIdentFuncTable[62] := @Func62;
 380  FIdentFuncTable[63] := @Func63;
 381  FIdentFuncTable[64] := @Func64;
 382  FIdentFuncTable[65] := @Func65;
 383  FIdentFuncTable[66] := @Func66;
 384  FIdentFuncTable[67] := @Func67;
 385  FIdentFuncTable[69] := @Func69;
 386  FIdentFuncTable[70] := @Func70;
 387  FIdentFuncTable[71] := @Func71;
 388  FIdentFuncTable[72] := @Func72;
 389  FIdentFuncTable[74] := @Func74;
 390  FIdentFuncTable[76] := @Func76;
 391  FIdentFuncTable[78] := @Func78;
 392  FIdentFuncTable[79] := @Func79;
 393  FIdentFuncTable[80] := @Func80;
 394  FIdentFuncTable[81] := @Func81;
 395  FIdentFuncTable[82] := @Func82;
 396  FIdentFuncTable[83] := @Func83;
 397  FIdentFuncTable[84] := @Func84;
 398  FIdentFuncTable[85] := @Func85;
 399  FIdentFuncTable[86] := @Func86;
 400  FIdentFuncTable[87] := @Func87;
 401  FIdentFuncTable[88] := @Func88;
 402  FIdentFuncTable[89] := @Func89;
 403  FIdentFuncTable[90] := @Func90;
 404  FIdentFuncTable[91] := @Func91;
 405  FIdentFuncTable[92] := @Func92;
 406  FIdentFuncTable[93] := @Func93;
 407  FIdentFuncTable[94] := @Func94;
 408  FIdentFuncTable[95] := @Func95;
 409  FIdentFuncTable[96] := @Func96;
 410  FIdentFuncTable[97] := @Func97;
 411  FIdentFuncTable[98] := @Func98;
 412  FIdentFuncTable[99] := @Func99;
 413  FIdentFuncTable[100] := @Func100;
 414  FIdentFuncTable[101] := @Func101;
 415  FIdentFuncTable[102] := @Func102;
 416  FIdentFuncTable[103] := @Func103;
 417  FIdentFuncTable[105] := @Func105;
 418  FIdentFuncTable[106] := @Func106;
 419  FIdentFuncTable[107] := @Func107;
 420  FIdentFuncTable[108] := @Func108;
 421  FIdentFuncTable[109] := @Func109;
 422  FIdentFuncTable[110] := @Func110;
 423  FIdentFuncTable[111] := @Func111;
 424  FIdentFuncTable[112] := @Func112;
 425  FIdentFuncTable[113] := @Func113;
 426  FIdentFuncTable[114] := @Func114;
 427  FIdentFuncTable[115] := @Func115;
 428  FIdentFuncTable[116] := @Func116;
 429  FIdentFuncTable[117] := @Func117;
 430  FIdentFuncTable[118] := @Func118;
 431  FIdentFuncTable[119] := @Func119;
 432  FIdentFuncTable[120] := @Func120;
 433  FIdentFuncTable[121] := @Func121;
 434  FIdentFuncTable[122] := @Func122;
 435  FIdentFuncTable[123] := @Func123;
 436  FIdentFuncTable[124] := @Func124;
 437  FIdentFuncTable[125] := @Func125;
 438  FIdentFuncTable[126] := @Func126;
 439  FIdentFuncTable[127] := @Func127;
 440  FIdentFuncTable[128] := @Func128;
 441  FIdentFuncTable[129] := @Func129;
 442  FIdentFuncTable[130] := @Func130;
 443  FIdentFuncTable[131] := @Func131;
 444  FIdentFuncTable[132] := @Func132;
 445  FIdentFuncTable[134] := @Func134;
 446  FIdentFuncTable[136] := @Func136;
 447  FIdentFuncTable[137] := @Func137;
 448  FIdentFuncTable[138] := @Func138;
 449  FIdentFuncTable[139] := @Func139;
 450  FIdentFuncTable[140] := @Func140;
 451  FIdentFuncTable[141] := @Func141;
 452  FIdentFuncTable[142] := @Func142;
 453  FIdentFuncTable[144] := @Func144;
 454  FIdentFuncTable[146] := @Func146;
 455  FIdentFuncTable[148] := @Func148;
 456  FIdentFuncTable[149] := @Func149;
 457  FIdentFuncTable[150] := @Func150;
 458  FIdentFuncTable[151] := @Func151;
 459  FIdentFuncTable[152] := @Func152;
 460  FIdentFuncTable[153] := @Func153;
 461  FIdentFuncTable[154] := @Func154;
 462  FIdentFuncTable[156] := @Func156;
 463  FIdentFuncTable[158] := @Func158;
 464  FIdentFuncTable[159] := @Func159;
 465  FIdentFuncTable[160] := @Func160;
 466  FIdentFuncTable[164] := @Func164;
 467  FIdentFuncTable[166] := @Func166;
 468  FIdentFuncTable[167] := @Func167;
 469  FIdentFuncTable[169] := @Func169;
 470  FIdentFuncTable[171] := @Func171;
 471  FIdentFuncTable[172] := @Func172;
 472  FIdentFuncTable[173] := @Func173;
 473  FIdentFuncTable[174] := @Func174;
 474  FIdentFuncTable[175] := @Func175;
 475  FIdentFuncTable[177] := @Func177;
 476  FIdentFuncTable[178] := @Func178;
 477  FIdentFuncTable[179] := @Func179;
 478  FIdentFuncTable[182] := @Func182;
 479  FIdentFuncTable[186] := @Func186;
 480  FIdentFuncTable[187] := @Func187;
 481  FIdentFuncTable[190] := @Func190;
 482  FIdentFuncTable[191] := @Func191;
 483  FIdentFuncTable[194] := @Func194;
 484  FIdentFuncTable[195] := @Func195;
 485  FIdentFuncTable[198] := @Func198;
 486  FIdentFuncTable[199] := @Func199;
 487  FIdentFuncTable[200] := @Func200;
 488  FIdentFuncTable[205] := @Func205;
 489  FIdentFuncTable[210] := @Func210;
 490  FIdentFuncTable[213] := @Func213;
 491  FIdentFuncTable[216] := @Func216;
 492  FIdentFuncTable[220] := @Func220;
 493  FIdentFuncTable[222] := @Func222;
 494  FIdentFuncTable[224] := @Func224;
 495  FIdentFuncTable[232] := @Func232;
 496  FIdentFuncTable[242] := @Func242;
 497  FIdentFuncTable[250] := @Func250;
 498  FIdentFuncTable[253] := @Func253;
 499  FIdentFuncTable[275] := @Func275;
 500end;
 501
 502function TSynCssSyn.KeyHash(ToHash: PChar): Integer;
 503begin
 504  Result := 0;
 505  while ToHash^ in ['a'..'z', 'A'..'Z', '0'..'9', '-', '_','@'] do begin
 506    Inc(Result, mHashTable[ToHash^]);
 507    Inc(ToHash);
 508  end;
 509  FStringLen := ToHash - FToIdent;
 510end;
 511
 512function TSynCssSyn.KeyComp(const aKey: String): Boolean;
 513var
 514  iI  : Integer;
 515  Temp: PChar;
 516begin
 517  Temp := FToIdent;
 518  if Length(aKey) = FStringLen then begin
 519    Result := True;
 520    for iI := 1 to fStringLen do begin
 521      if mHashTable[Temp^] <> mHashTable[aKey[iI]] then begin
 522        Result := False;
 523        Break;
 524      end;
 525      Inc(Temp);
 526    end;
 527  end else
 528    Result := False;
 529end;
 530
 531function TSynCssSyn.Func16: TtkTokenKind;
 532begin
 533  if KeyComp('cm') then
 534    Result := tkMeasurementUnit
 535  else
 536  if KeyComp('deg') then
 537    Result := tkKey
 538  else
 539    Result := tkIdentifier;
 540end;
 541
 542function TSynCssSyn.Func18: TtkTokenKind;
 543begin
 544  if KeyComp('em') then
 545    Result := tkMeasurementUnit
 546  else
 547    Result := tkIdentifier;
 548end;
 549
 550function TSynCssSyn.Func19: TtkTokenKind;
 551begin
 552  if KeyComp('pc') then
 553    Result := tkMeasurementUnit
 554  else if KeyComp('s') then
 555    Result := tkKey
 556  else
 557    Result := tkIdentifier;
 558end;
 559
 560function TSynCssSyn.Func23: TtkTokenKind;
 561begin
 562  if KeyComp('in') then
 563    Result := tkMeasurementUnit
 564  else
 565  if  KeyComp('rad') then
 566    Result := tkKey
 567  else
 568    Result := tkIdentifier;
 569end;
 570
 571function TSynCssSyn.Func24: TtkTokenKind;
 572begin
 573  if KeyComp('b-box') then
 574    Result := tkKey
 575  else
 576    Result := tkIdentifier;
 577end;
 578
 579function TSynCssSyn.Func26: TtkTokenKind;
 580begin
 581  if KeyComp('mm') then
 582    Result := tkMeasurementUnit
 583  else
 584    Result := tkIdentifier;
 585end;
 586
 587function TSynCssSyn.Func29: TtkTokenKind;
 588begin
 589  if KeyComp('page') or KeyComp('cue') then
 590    Result := tkKey
 591  else if KeyComp('ex') then
 592    Result := tkMeasurementUnit
 593  else
 594    Result := tkIdentifier;
 595end;
 596
 597function TSynCssSyn.Func30: TtkTokenKind;
 598begin
 599  if KeyComp('grad') then
 600    Result := tkKey
 601  else
 602    Result := tkIdentifier;
 603end;
 604
 605function TSynCssSyn.Func32: TtkTokenKind;
 606begin
 607  if KeyComp('ms') or KeyComp('@media') then
 608    Result := tkKey
 609  else
 610    Result := tkIdentifier;
 611end;
 612
 613function TSynCssSyn.Func34: TtkTokenKind;
 614begin
 615  if KeyComp('Hz') then
 616    Result := tkKey
 617  else
 618    Result := tkIdentifier;
 619end;
 620
 621function TSynCssSyn.Func36: TtkTokenKind;
 622begin
 623  if KeyComp('pt') then
 624    Result := tkMeasurementUnit
 625  else
 626    Result := tkIdentifier;
 627end;
 628
 629function TSynCssSyn.Func39: TtkTokenKind;
 630begin
 631  if KeyComp('clear') then
 632    Result := tkKey
 633  else
 634    Result := tkIdentifier;
 635end;
 636
 637function TSynCssSyn.Func40: TtkTokenKind;
 638begin
 639  if KeyComp('px') then
 640    Result := tkMeasurementUnit
 641  else
 642  if KeyComp('clip') or KeyComp('src') then
 643    Result := tkKey
 644  else
 645    Result := tkIdentifier;
 646end;
 647
 648function TSynCssSyn.Func41: TtkTokenKind;
 649begin
 650  if KeyComp('icon') then
 651    Result := tkKey
 652  else
 653    Result := tkIdentifier;
 654end;
 655
 656function TSynCssSyn.Func43: TtkTokenKind;
 657begin
 658  if KeyComp('left') then
 659    Result := tkKey
 660  else
 661    Result := tkIdentifier;
 662end;
 663
 664function TSynCssSyn.Func45: TtkTokenKind;
 665begin
 666  if KeyComp('ime-mode') or KeyComp('kHz') then
 667    Result := tkKey
 668  else
 669    Result := tkIdentifier;
 670end;
 671
 672function TSynCssSyn.Func47: TtkTokenKind;
 673begin
 674  if KeyComp('flex') then
 675    Result := tkKey
 676  else
 677    Result := tkIdentifier;
 678end;
 679
 680function TSynCssSyn.Func51: TtkTokenKind;
 681begin
 682  if KeyComp('top') or KeyComp('panose-1') or KeyComp('@font-face') then
 683    Result := tkKey
 684  else
 685    Result := tkIdentifier;
 686end;
 687
 688function TSynCssSyn.Func52: TtkTokenKind;
 689begin
 690  if KeyComp('speak') then
 691    Result := tkKey
 692  else
 693    Result := tkIdentifier;
 694end;
 695
 696function TSynCssSyn.Func53: TtkTokenKind;
 697begin
 698  if KeyComp('box-pack') then
 699    Result := tkKey
 700  else
 701    Result := tkIdentifier;
 702end;
 703
 704function TSynCssSyn.Func54: TtkTokenKind;
 705begin
 706  if KeyComp('float') then
 707    Result := tkKey
 708  else
 709    Result := tkIdentifier;
 710end;
 711
 712function TSynCssSyn.Func55: TtkTokenKind;
 713begin
 714  if KeyComp('font') or KeyComp('padding') or KeyComp('nav-up') then
 715    Result := tkKey
 716  else
 717    Result := tkIdentifier;
 718end;
 719
 720function TSynCssSyn.Func56: TtkTokenKind;
 721begin
 722  if KeyComp('pitch') then
 723    Result := tkKey
 724  else
 725    Result := tkIdentifier;
 726end;
 727
 728function TSynCssSyn.Func57: TtkTokenKind;
 729begin
 730  if KeyComp('height') or KeyComp('run-in') then
 731    Result := tkKey
 732  else
 733    Result := tkIdentifier;
 734end;
 735
 736function TSynCssSyn.Func58: TtkTokenKind;
 737begin
 738  if KeyComp('line-break') or KeyComp('cap-height') then
 739    Result := tkKey
 740  else
 741    Result := tkIdentifier;
 742end;
 743
 744function TSynCssSyn.Func59: TtkTokenKind;
 745begin
 746  if KeyComp('size') then
 747    Result := tkKey
 748  else
 749    Result := tkIdentifier;
 750end;
 751
 752function TSynCssSyn.Func60: TtkTokenKind;
 753begin
 754  if KeyComp('cue-after') or KeyComp('order') then
 755    Result := tkKey
 756  else
 757    Result := tkIdentifier;
 758end;
 759
 760function TSynCssSyn.Func61: TtkTokenKind;
 761begin
 762  if KeyComp('cue-before') or KeyComp('nav-left') then
 763    Result := tkKey
 764  else
 765    Result := tkIdentifier;
 766end;
 767
 768function TSynCssSyn.Func62: TtkTokenKind;
 769begin
 770  if KeyComp('margin') or KeyComp('pause') or KeyComp('right') or
 771    KeyComp('marks') or KeyComp('border') or KeyComp('x-height') or
 772    KeyComp('ascent') then
 773    Result := tkKey
 774  else
 775    Result := tkIdentifier;
 776end;
 777
 778function TSynCssSyn.Func63: TtkTokenKind;
 779begin
 780  if KeyComp('color') or KeyComp('z-index') or KeyComp('tab-size') then
 781    Result := tkKey
 782  else
 783    Result := tkIdentifier;
 784end;
 785
 786function TSynCssSyn.Func64: TtkTokenKind;
 787begin
 788  if KeyComp('width') then
 789    Result := tkKey
 790  else
 791    Result := tkIdentifier;
 792end;
 793
 794function TSynCssSyn.Func65: TtkTokenKind;
 795begin
 796  if KeyComp('stemh') or KeyComp('box-align')  then
 797    Result := tkKey
 798  else
 799    Result := tkIdentifier;
 800end;
 801
 802function TSynCssSyn.Func66: TtkTokenKind;
 803begin
 804  if KeyComp('align-self') then
 805    Result := tkKey
 806  else
 807    Result := tkIdentifier;
 808end;
 809
 810function TSynCssSyn.Func67: TtkTokenKind;
 811begin
 812  if KeyComp('slope') or KeyComp('baseline') then
 813    Result := tkKey
 814  else
 815    Result := tkIdentifier;
 816end;
 817
 818function TSynCssSyn.Func69: TtkTokenKind;
 819begin
 820  if KeyComp('zoom') or KeyComp('box-flex') then
 821    Result := tkKey
 822  else
 823    Result := tkIdentifier;
 824end;
 825
 826function TSynCssSyn.Func70: TtkTokenKind;
 827begin
 828  if KeyComp('filter') or KeyComp('descent') then
 829    Result := tkKey
 830  else
 831    Result := tkIdentifier;
 832end;
 833
 834function TSynCssSyn.Func71: TtkTokenKind;
 835begin
 836  if KeyComp('target') or KeyComp('object-fit') then
 837    Result := tkKey
 838  else
 839    Result := tkIdentifier;
 840end;
 841
 842function TSynCssSyn.Func72: TtkTokenKind;
 843begin
 844  if KeyComp('top-line') then
 845    Result := tkKey
 846  else
 847    Result := tkIdentifier;
 848end;
 849
 850function TSynCssSyn.Func74: TtkTokenKind;
 851begin
 852  if KeyComp('speak-header') or KeyComp('min-height') or KeyComp('nav-down')
 853    or KeyComp('nav-index') or KeyComp('@charset') then
 854    Result := tkKey
 855  else
 856    Result := tkIdentifier;
 857end;
 858
 859function TSynCssSyn.Func76: TtkTokenKind;
 860begin
 861  if KeyComp('max-height') or KeyComp('unicode-bidi') then
 862    Result := tkKey
 863  else
 864    Result := tkIdentifier;
 865end;
 866
 867function TSynCssSyn.Func78: TtkTokenKind;
 868begin
 869  if KeyComp('page-break-after') or KeyComp('word-break') or KeyComp('border-image')
 870    or KeyComp('line-height') or KeyComp('flex-basis') then
 871    Result := tkKey
 872  else
 873    Result := tkIdentifier;
 874end;
 875
 876function TSynCssSyn.Func79: TtkTokenKind;
 877begin
 878  if KeyComp('padding-left') or KeyComp('page-break-before') or
 879    KeyComp('stemv') then
 880    Result := tkKey
 881  else
 882    Result := tkIdentifier;
 883end;
 884
 885function TSynCssSyn.Func80: TtkTokenKind;
 886begin
 887  if KeyComp('behavior') or KeyComp('appearance') or KeyComp('nav-right') then
 888    Result := tkKey
 889  else
 890    Result := tkIdentifier;
 891end;
 892
 893function TSynCssSyn.Func81: TtkTokenKind;
 894begin
 895  if KeyComp('speech-rate') or KeyComp('min-width')  or KeyComp('box-lines') then
 896    Result := tkKey
 897  else
 898    Result := tkIdentifier;
 899end;
 900
 901function TSynCssSyn.Func82: TtkTokenKind;
 902begin
 903  if KeyComp('pitch-range') or KeyComp('mathline') or KeyComp('resize') then
 904    Result := tkKey
 905  else
 906    Result := tkIdentifier;
 907end;
 908
 909function TSynCssSyn.Func83: TtkTokenKind;
 910begin
 911  if KeyComp('max-width') or KeyComp('widths') or KeyComp('column-gap') then
 912    Result := tkKey
 913  else
 914    Result := tkIdentifier;
 915end;
 916
 917function TSynCssSyn.Func84: TtkTokenKind;
 918begin
 919  if KeyComp('flex-flow') then
 920    Result := tkKey
 921  else
 922    Result := tkIdentifier;
 923end;
 924
 925function TSynCssSyn.Func85: TtkTokenKind;
 926begin
 927  if KeyComp('bottom') or KeyComp('target-name') then
 928    Result := tkKey
 929  else
 930    Result := tkIdentifier;
 931end;
 932
 933function TSynCssSyn.Func86: TtkTokenKind;
 934begin
 935  if KeyComp('margin-left') or KeyComp('border-left') or KeyComp('display') or KeyComp('flex-wrap') then
 936    Result := tkKey
 937  else
 938    Result := tkIdentifier;
 939end;
 940
 941function TSynCssSyn.Func87: TtkTokenKind;
 942begin
 943  if KeyComp('padding-top') then
 944    Result := tkKey
 945  else
 946    Result := tkIdentifier;
 947end;
 948
 949function TSynCssSyn.Func88: TtkTokenKind;
 950begin
 951  if KeyComp('page-break-inside') or KeyComp('volume') then
 952    Result := tkKey
 953  else
 954    Result := tkIdentifier;
 955end;
 956
 957function TSynCssSyn.Func89: TtkTokenKind;
 958begin
 959  if KeyComp('opacity') then
 960    Result := tkKey
 961  else
 962    Result := tkIdentifier;
 963end;
 964
 965function TSynCssSyn.Func90: TtkTokenKind;
 966begin
 967  if KeyComp('white-space') or KeyComp('ruby-align') or KeyComp('align-items') then
 968    Result := tkKey
 969  else
 970    Result := tkIdentifier;
 971end;
 972
 973function TSynCssSyn.Func91: TtkTokenKind;
 974begin
 975  if KeyComp('orphans') or KeyComp('content') or KeyComp('@import') or KeyComp('flex-grow') then
 976    Result := tkKey
 977  else
 978    Result := tkIdentifier;
 979end;
 980
 981function TSynCssSyn.Func92: TtkTokenKind;
 982begin
 983  if KeyComp('box-shadow') then
 984    Result := tkKey
 985  else
 986    Result := tkIdentifier;
 987end;
 988
 989function TSynCssSyn.Func93: TtkTokenKind;
 990begin
 991  if KeyComp('text-align') or KeyComp('pause-after') or KeyComp('widows') then
 992    Result := tkKey
 993  else
 994    Result := tkIdentifier;
 995end;
 996
 997function TSynCssSyn.Func94: TtkTokenKind;
 998begin
 999  if KeyComp('margin-top') or KeyComp('border-top') or KeyComp('pause-before') or
1000    KeyComp('cursor') or KeyComp('grid-rows') or KeyComp('target-new') then
1001    Result := tkKey
1002  else
1003    Result := tkIdentifier;
1004end;
1005
1006function TSynCssSyn.Func95: TtkTokenKind;
1007begin
1008  if KeyComp('font-size') or KeyComp('richness') then
1009    Result := tkKey
1010  else
1011    Result := tkIdentifier;
1012end;
1013
1014function TSynCssSyn.Func96: TtkTokenKind;
1015begin
1016  if KeyComp('background') or KeyComp('caption-side') or KeyComp('counter') or
1017    KeyComp('outline') or KeyComp('animation')  then
1018    Result := tkKey
1019  else
1020    Result := tkIdentifier;
1021end;
1022
1023function TSynCssSyn.Func97: TtkTokenKind;
1024begin
1025  if KeyComp('quotes') or KeyComp('direction') or KeyComp('unicode-range')
1026    or KeyComp('columns') then
1027    Result := tkKey
1028  else
1029    Result := tkIdentifier;
1030end;
1031
1032function TSynCssSyn.Func98: TtkTokenKind;
1033begin
1034  if KeyComp('padding-right') or KeyComp('azimuth') or KeyComp('column-fill') then
1035    Result := tkKey
1036  else
1037    Result := tkIdentifier;
1038end;
1039
1040function TSynCssSyn.Func99: TtkTokenKind;
1041begin
1042  if KeyComp('word-wrap') then
1043    Result := tkKey
1044  else
1045    Result := tkIdentifier;
1046end;
1047
1048function TSynCssSyn.Func100: TtkTokenKind;
1049begin
1050  if KeyComp('stress') then
1051    Result := tkKey
1052  else
1053    Result := tkIdentifier;
1054end;
1055
1056function TSynCssSyn.Func101: TtkTokenKind;
1057begin
1058  if KeyComp('voice-family') then
1059    Result := tkKey
1060  else
1061    Result := tkIdentifier;
1062end;
1063
1064function TSynCssSyn.Func102: TtkTokenKind;
1065begin
1066  if KeyComp('font-family') or KeyComp('units-per-em') then
1067    Result := tkKey
1068  else
1069    Result := tkIdentifier;
1070end;
1071
1072function TSynCssSyn.Func103: TtkTokenKind;
1073begin
1074  if KeyComp('elevation') or KeyComp('@keyframes') or KeyComp('box-orient') then
1075    Result := tkKey
1076  else
1077    Result := tkIdentifier;
1078end;
1079
1080function TSynCssSyn.Func105: TtkTokenKind;
1081begin
1082  if KeyComp('margin-right') or KeyComp('border-right') or
1083    KeyComp('centerline') then
1084    Result := tkKey
1085  else
1086    Result := tkIdentifier;
1087end;
1088
1089function TSynCssSyn.Func106: TtkTokenKind;
1090begin
1091  if KeyComp('border-color') or KeyComp('box-sizing')  then
1092    Result := tkKey
1093  else
1094    Result := tkIdentifier;
1095end;
1096
1097function TSynCssSyn.Func107: TtkTokenKind;
1098begin
1099  if KeyComp('border-width') or KeyComp('border-image-slice') or KeyComp('flex-shrink') then
1100    Result := tkKey
1101  else
1102    Result := tkIdentifier;
1103end;
1104
1105function TSynCssSyn.Func108: TtkTokenKind;
1106begin
1107  if KeyComp('font-weight') or KeyComp('play-during') or KeyComp('text-wrap')
1108  or KeyComp('user-select') then
1109    Result := tkKey
1110  else
1111    Result := tkIdentifier;
1112end;
1113
1114function TSynCssSyn.Func109: TtkTokenKind;
1115begin
1116  if KeyComp('column-span') then
1117    Result := tkKey
1118  else
1119    Result := tkIdentifier;
1120end;
1121
1122function TSynCssSyn.Func110: TtkTokenKind;
1123begin
1124  if KeyComp('word-spacing') or KeyComp('animation-name') then
1125    Result := tkKey
1126  else
1127    Result := tkIdentifier;
1128end;
1129
1130function TSynCssSyn.Func111: TtkTokenKind;
1131begin
1132  if KeyComp('empty-cells') then
1133    Result := tkKey
1134  else
1135    Result := tkIdentifier;
1136end;
1137
1138function TSynCssSyn.Func112: TtkTokenKind;
1139begin
1140  if KeyComp('background-image') or KeyComp('border-spacing')
1141  or KeyComp('rotation') then
1142    Result := tkKey
1143  else
1144    Result := tkIdentifier;
1145end;
1146
1147function TSynCssSyn.Func113: TtkTokenKind;
1148begin
1149  if KeyComp('layout-grid') then
1150    Result := tkKey
1151  else
1152    Result := tkIdentifier;
1153end;
1154
1155function TSynCssSyn.Func114: TtkTokenKind;
1156begin
1157  if KeyComp('vertical-align') then
1158    Result := tkKey
1159  else
1160    Result := tkIdentifier;
1161end;
1162
1163function TSynCssSyn.Func115: TtkTokenKind;
1164begin
1165  if KeyComp('table-layout') or KeyComp('border-radius')
1166  or KeyComp('column-rule') or KeyComp('align-content') then
1167    Result := tkKey
1168  else
1169    Result := tkIdentifier;
1170end;
1171
1172function TSynCssSyn.Func116: TtkTokenKind;
1173begin
1174  if KeyComp('text-indent') or KeyComp('overflow') or KeyComp('grid-columns') then
1175    Result := tkKey
1176  else
1177    Result := tkIdentifier;
1178end;
1179
1180function TSynCssSyn.Func117: TtkTokenKind;
1181begin
1182  if KeyComp('font-style') or KeyComp('position') or KeyComp('speak-numeral')
1183  or KeyComp('background-clip') then
1184    Result := tkKey
1185  else
1186    Result := tkIdentifier;
1187end;
1188
1189function TSynCssSyn.Func118: TtkTokenKind;
1190begin
1191  if KeyComp('marker-offset') or KeyComp('writing-mode') then
1192    Result := tkKey
1193  else
1194    Result := tkIdentifier;
1195end;
1196
1197function TSynCssSyn.Func119: TtkTokenKind;
1198begin
1199  if KeyComp('box-direction') then
1200    Result := tkKey
1201  else
1202    Result := tkIdentifier;
1203end;
1204
1205function TSynCssSyn.Func120: TtkTokenKind;
1206begin
1207  if KeyComp('text-shadow') then
1208    Result := tkKey
1209  else
1210    Result := tkIdentifier;
1211end;
1212
1213function TSynCssSyn.Func121: TtkTokenKind;
1214begin
1215  if KeyComp('font-variant') or KeyComp('padding-bottom') or KeyComp('overflow-x') then
1216    Result := tkKey
1217  else
1218    Result := tkIdentifier;
1219end;
1220
1221function TSynCssSyn.Func122: TtkTokenKind;
1222begin
1223  if KeyComp('list-style') or KeyComp('overflow-y') then
1224    Result := tkKey
1225  else
1226    Result := tkIdentifier;
1227end;
1228
1229function TSynCssSyn.Func123: TtkTokenKind;
1230begin
1231  if KeyComp('border-image-width') or KeyComp('column-width') then
1232    Result := tkKey
1233  else
1234    Result := tkIdentifier;
1235end;
1236
1237function TSynCssSyn.Func124: TtkTokenKind;
1238begin
1239  if KeyComp('border-style') or KeyComp('border-image-repeat') or KeyComp('animation-delay')
1240     or KeyComp('transform') then Result := tkKey
1241  else
1242    Result := tkIdentifier;
1243end;
1244
1245function TSynCssSyn.Func125: TtkTokenKind;
1246begin
1247  if KeyComp('flex-direction') then
1248    Result := tkKey
1249  else
1250    Result := tkIdentifier;
1251end;
1252
1253function TSynCssSyn.Func126: TtkTokenKind;
1254begin
1255  if KeyComp('border-collapse') or KeyComp('definition-src') or KeyComp('text-align-last') then
1256    Result := tkKey
1257  else
1258    Result := tkIdentifier;
1259end;
1260
1261function TSynCssSyn.Func127: TtkTokenKind;
1262begin
1263  if KeyComp('box-flex-group') then
1264    Result := tkKey
1265  else
1266    Result := tkIdentifier;
1267end;
1268
1269function TSynCssSyn.Func128: TtkTokenKind;
1270begin
1271  if KeyComp('margin-bottom') or KeyComp('border-bottom') or
1272    KeyComp('text-kashida-space') then
1273    Result := tkKey
1274  else
1275    Result := tkIdentifier;
1276end;
1277
1278function TSynCssSyn.Func129: TtkTokenKind;
1279begin
1280  if KeyComp('font-stretch') then
1281    Result := tkKey
1282  else
1283    Result := tkIdentifier;
1284end;
1285
1286function TSynCssSyn.Func130: TtkTokenKind;
1287begin
1288  if KeyComp('border-left-color') or KeyComp('letter-spacing') then
1289    Result := tkKey
1290  else
1291    Result := tkIdentifier;
1292end;
1293
1294function TSynCssSyn.Func131: TtkTokenKind;
1295begin
1296  if KeyComp('border-left-width') or KeyComp('layout-grid-mode') then
1297    Result := tkKey
1298  else
1299    Result := tkIdentifier;
1300end;
1301
1302function TSynCssSyn.Func132: TtkTokenKind;
1303begin
1304  if KeyComp('column-count') then
1305    Result := tkKey
1306  else
1307    Result := tkIdentifier;
1308end;
1309
1310function TSynCssSyn.Func134: TtkTokenKind;
1311begin
1312  if KeyComp('layout-grid-line') or KeyComp('animation-fill-mode') then
1313    Result := tkKey
1314  else
1315    Result := tkIdentifier;
1316end;
1317
1318function TSynCssSyn.Func136: TtkTokenKind;
1319begin
1320  if KeyComp('visibility') or KeyComp('background-size') then
1321    Result := tkKey
1322  else
1323    Result := tkIdentifier;
1324end;
1325
1326function TSynCssSyn.Func137: TtkTokenKind;
1327begin
1328  if KeyComp('ruby-overhang') then
1329    Result := tkKey
1330  else
1331    Result := tkIdentifier;
1332end;
1333
1334function TSynCssSyn.Func138: TtkTokenKind;
1335begin
1336  if KeyComp('border-top-color') or KeyComp('list-style-image') or KeyComp('perspective') then
1337    Result := tkKey
1338  else
1339    Result := tkIdentifier;
1340end;
1341
1342function TSynCssSyn.Func139: TtkTokenKind;
1343begin
1344  if KeyComp('border-top-width') or KeyComp('transition') then
1345    Result := tkKey
1346  else
1347    Result := tkIdentifier;
1348end;
1349
1350function TSynCssSyn.Func140: TtkTokenKind;
1351begin
1352  if KeyComp('background-color') or KeyComp('outline-color') or KeyComp('text-emphasis') or
1353    KeyComp('scrollbar-face-color') or KeyComp('border-image-source') then
1354    Result := tkKey
1355  else
1356    Result := tkIdentifier;
1357end;
1358
1359function TSynCssSyn.Func141: TtkTokenKind;
1360begin
1361  if KeyComp('outline-width') then
1362    Result := tkKey
1363  else
1364    Result := tkIdentifier;
1365end;
1366
1367function TSynCssSyn.Func142: TtkTokenKind;
1368begin
1369  if KeyComp('background-repeat') then
1370    Result := tkKey
1371  else
1372    Result := tkIdentifier;
1373end;
1374
1375function TSynCssSyn.Func144: TtkTokenKind;
1376begin
1377  if KeyComp('counter-reset') or KeyComp('box-decoration-break') or KeyComp('@supports') then
1378    Result := tkKey
1379  else
1380    Result := tkIdentifier;
1381end;
1382
1383function TSynCssSyn.Func146: TtkTokenKind;
1384begin
1385  if KeyComp('text-outline') then
1386    Result := tkKey
1387  else
1388    Result := tkIdentifier;
1389end;
1390
1391function TSynCssSyn.Func148: TtkTokenKind;
1392begin
1393  if KeyComp('border-left-style') or KeyComp('outline-offset') then
1394    Result := tkKey
1395  else
1396    Result := tkIdentifier;
1397end;
1398
1399function TSynCssSyn.Func149: TtkTokenKind;
1400begin
1401  if KeyComp('border-right-color') or KeyComp('background-origin') or KeyComp('backface-visibility') then
1402    Result := tkKey
1403  else
1404    Result := tkIdentifier;
1405end;
1406
1407function TSynCssSyn.Func150: TtkTokenKind;
1408begin
1409  if KeyComp('border-right-width') then
1410    Result := tkKey
1411  else
1412    Result := tkIdentifier;
1413end;
1414
1415function TSynCssSyn.Func151: TtkTokenKind;
1416begin
1417  if KeyComp('font-size-adjust') or KeyComp('text-autospace') then
1418    Result := tkKey
1419  else
1420    Result := tkIdentifier;
1421end;
1422
1423function TSynCssSyn.Func152: TtkTokenKind;
1424begin
1425  if KeyComp('scrollbar-base-color') then
1426    Result := tkKey
1427  else
1428    Result := tkIdentifier;
1429end;
1430
1431function TSynCssSyn.Func153: TtkTokenKind;
1432begin
1433  if KeyComp('box-ordinal-group') or KeyComp('object-position') then
1434    Result := tkKey
1435  else
1436    Result := tkIdentifier;
1437end;
1438
1439function TSynCssSyn.Func154: TtkTokenKind;
1440begin
1441  if KeyComp('text-decoration') then
1442    Result := tkKey
1443  else
1444    Result := tkIdentifier;
1445end;
1446
1447function TSynCssSyn.Func156: TtkTokenKind;
1448begin
1449  if KeyComp('border-top-style') then
1450    Result := tkKey
1451  else
1452    Result := tkIdentifier;
1453end;
1454
1455function TSynCssSyn.Func158: TtkTokenKind;
1456begin
1457  if KeyComp('outline-style') then
1458    Result := tkKey
1459  else
1460    Result := tkIdentifier;
1461end;
1462
1463function TSynCssSyn.Func159: TtkTokenKind;
1464begin
1465  if KeyComp('border-image-outset') or KeyComp('column-rule-color') then
1466    Result := tkKey
1467  else
1468    Result := tkIdentifier;
1469end;
1470
1471function TSynCssSyn.Func160: TtkTokenKind;
1472begin
1473  if KeyComp('layout-grid-type') or KeyComp('text-justify')
1474  or KeyComp('column-rule-width') then
1475    Result := tkKey
1476  else
1477    Result := tkIdentifier;
1478end;
1479
1480function TSynCssSyn.Func164: TtkTokenKind;
1481begin
1482  if KeyComp('ruby-position') then
1483    Result := tkKey
1484  else
1485    Result := tkIdentifier;
1486end;
1487
1488function TSynCssSyn.Func166: TtkTokenKind;
1489begin
1490  if KeyComp('scrollbar-3d-light-color') or KeyComp('text-overflow') then
1491    Result := tkKey
1492  else
1493    Result := tkIdentifier;
1494end;
1495
1496function TSynCssSyn.Func167: TtkTokenKind;
1497begin
1498  if KeyComp('border-right-style') or KeyComp('rotation-point')
1499  or KeyComp('transition-delay') then
1500    Result := tkKey
1501  else
1502    Result := tkIdentifier;
1503end;
1504
1505function TSynCssSyn.Func169: TtkTokenKind;
1506begin
1507  if KeyComp('list-style-type') or KeyComp('target-position') then
1508    Result := tkKey
1509  else
1510    Result := tkIdentifier;
1511end;
1512
1513function TSynCssSyn.Func171: TtkTokenKind;
1514begin
1515  if KeyComp('border-top-left-radius') then
1516    Result := tkKey
1517  else
1518    Result := tkIdentifier;
1519end;
1520
1521function TSynCssSyn.Func172: TtkTokenKind;
1522begin
1523  if KeyComp('border-bottom-color') then
1524    Result := tkKey
1525  else
1526    Result := tkIdentifier;
1527end;
1528
1529function TSynCssSyn.Func173: TtkTokenKind;
1530begin
1531  if KeyComp('border-bottom-width') then
1532    Result := tkKey
1533  else
1534    Result := tkIdentifier;
1535end;
1536
1537function TSynCssSyn.Func174: TtkTokenKind;
1538begin
1539  if KeyComp('text-transform') or KeyComp('animation-direction') then
1540    Result := tkKey
1541  else
1542    Result := tkIdentifier;
1543end;
1544
1545function TSynCssSyn.Func175: TtkTokenKind;
1546begin
1547  if KeyComp('text-decoration-line') then
1548    Result := tkKey
1549  else
1550    Result := tkIdentifier;
1551end;
1552
1553function TSynCssSyn.Func177: TtkTokenKind;
1554begin
1555  if KeyComp('animation-play-state') or KeyComp('column-rule-style')
1556  or KeyComp('transform-origin') then
1557    Result := tkKey
1558  else
1559    Result := tkIdentifier;
1560end;
1561
1562function TSynCssSyn.Func178: TtkTokenKind;
1563begin
1564  if KeyComp('counter-increment') or KeyComp('overflow-style') then
1565    Result := tkKey
1566  else
1567    Result := tkIdentifier;
1568end;
1569
1570function TSynCssSyn.Func179: TtkTokenKind;
1571begin
1572  if KeyComp('animation-duration') then
1573    Result := tkKey
1574  else
1575    Result := tkIdentifier;
1576end;
1577
1578function TSynCssSyn.Func182: TtkTokenKind;
1579begin
1580  if KeyComp('background-attachment') or KeyComp('justify-content') then
1581    Result := tkKey
1582  else
1583    Result := tkIdentifier;
1584end;
1585
1586function TSynCssSyn.Func186: TtkTokenKind;
1587begin
1588  if KeyComp('transform-style') then
1589    Result := tkKey
1590  else
1591    Result := tkIdentifier;
1592end;
1593
1594function TSynCssSyn.Func187: TtkTokenKind;
1595begin
1596  if KeyComp('speak-punctuation') then
1597    Result := tkKey
1598  else
1599    Result := tkIdentifier;
1600end;
1601
1602function TSynCssSyn.Func190: TtkTokenKind;
1603begin
1604  if KeyComp('border-bottom-style') or KeyComp('border-top-right-radius') then
1605    Result := tkKey
1606  else
1607    Result := tkIdentifier;
1608end;
1609
1610function TSynCssSyn.Func191: TtkTokenKind;
1611begin
1612  if KeyComp('perspective-origin') then
1613    Result := tkKey
1614  else
1615    Result := tkIdentifier;
1616end;
1617
1618function TSynCssSyn.Func194: TtkTokenKind;
1619begin
1620  if KeyComp('background-position') then
1621    Result := tkKey
1622  else
1623    Result := tkIdentifier;
1624end;
1625
1626function TSynCssSyn.Func195: TtkTokenKind;
1627begin
1628  if KeyComp('scrollbar-shadow-color') or KeyComp('hanging-punctuation')
1629    or KeyComp('punctuation-trim') then
1630    Result := tkKey
1631  else
1632    Result := tkIdentifier;
1633end;
1634
1635function TSynCssSyn.Func198: TtkTokenKind;
1636begin
1637  if KeyComp('text-decoration-color') then
1638    Result := tkKey
1639  else
1640    Result := tkIdentifier;
1641end;
1642
1643function TSynCssSyn.Func199: TtkTokenKind;
1644begin
1645  if KeyComp('background-position-x') then
1646    Result := tkKey
1647  else
1648    Result := tkIdentifier;
1649end;
1650
1651function TSynCssSyn.Func200: TtkTokenKind;
1652begin
1653  if KeyComp('background-position-y') or KeyComp('scrollbar-arrow-color') then
1654    Result := tkKey
1655  else
1656    Result := tkIdentifier;
1657end;
1658
1659function TSynCssSyn.Func205: TtkTokenKind;
1660begin
1661  if KeyComp('border-bottom-left-radius') then
1662    Result := tkKey
1663  else
1664    Result := tkIdentifier;
1665end;
1666
1667function TSynCssSyn.Func210: TtkTokenKind;
1668begin
1669  if KeyComp('scrollbar-dark-shadow-color') then
1670    Result := tkKey
1671  else
1672    Result := tkIdentifier;
1673end;
1674
1675function TSynCssSyn.Func213: TtkTokenKind;
1676begin
1677  if KeyComp('scrollbar-highlight-color') then
1678    Result := tkKey
1679  else
1680    Result := tkIdentifier;
1681end;
1682
1683function TSynCssSyn.Func216: TtkTokenKind;
1684begin
1685  if KeyComp('text-decoration-style') then
1686    Result := tkKey
1687  else
1688    Result := tkIdentifier;
1689end;
1690
1691function TSynCssSyn.Func220: TtkTokenKind;
1692begin
1693  if KeyComp('list-style-position') then
1694    Result := tkKey
1695  else
1696    Result := tkIdentifier;
1697end;
1698
1699function TSynCssSyn.Func222: TtkTokenKind;
1700begin
1701  if KeyComp('transition-duration') then
1702    Result := tkKey
1703  else
1704    Result := tkIdentifier;
1705end;
1706
1707function TSynCssSyn.Func224: TtkTokenKind;
1708begin
1709  if KeyComp('border-bottom-right-radius') then
1710    Result := tkKey
1711  else
1712    Result := tkIdentifier;
1713end;
1714
1715function TSynCssSyn.Func232: TtkTokenKind;
1716begin
1717  if KeyComp('animation-timing-function') then
1718    Result := tkKey
1719  else
1720    Result := tkIdentifier;
1721end;
1722
1723function TSynCssSyn.Func242: TtkTokenKind;
1724begin
1725  if KeyComp('animation-iteration-count') then
1726    Result := tkKey
1727  else
1728    Result := tkIdentifier;
1729end;
1730
1731function TSynCssSyn.Func250: TtkTokenKind;
1732begin
1733  if KeyComp('text-underline-position') then
1734    Result := tkKey
1735  else
1736    Result := tkIdentifier;
1737end;
1738
1739function TSynCssSyn.Func253: TtkTokenKind;
1740begin
1741  if KeyComp('transition-property') then
1742    Result := tkKey
1743  else
1744    Result := tkIdentifier;
1745end;
1746
1747function TSynCssSyn.Func275: TtkTokenKind;
1748begin
1749  if KeyComp('transition-timing-function') then
1750    Result := tkKey
1751  else
1752    Result := tkIdentifier;
1753end;
1754
1755function TSynCssSyn.AltFunc: TtkTokenKind;
1756begin
1757  Result := tkIdentifier;
1758end;
1759
1760function TSynCssSyn.IdentKind(MayBe: PChar): TtkTokenKind;
1761var
1762  HashKey: Integer;
1763begin
1764  FToIdent := MayBe;
1765  HashKey := KeyHash(MayBe);
1766  if (HashKey >= 16) and (HashKey <= 275) then
1767    Result := fIdentFuncTable[HashKey]()
1768  else
1769    Result := tkIdentifier;
1770end;
1771
1772procedure TSynCssSyn.MakeMethodTables;
1773var
1774  chI: Char;
1775begin
1776  for chI := #0 to #255 do
1777    case chI of
1778      '{'                         : FProcTable[chI] := @CurlyOpenProc;
1779      '}'                         : FProcTable[chI] := @CurlyCloseProc;
1780      ';'                         : FProcTable[chI] := @SymbolProc;
1781      ':'                         : FProcTable[chI] := @ColonProc;
1782      '.', '*', ',','>','+','~'   : FProcTable[chI] := @SelectorProc;
1783      '%'                         : FProcTable[chI] := @PercentProc;
1784      #13                         : FProcTable[chI] := @CRProc;
1785      '-'                         : FProcTable[chI] := @DashProc;
1786      'A'..'Z', 'a'..'z', '_','@' : FProcTable[chI] := @IdentProc;
1787      '#'                         : FProcTable[chI] := @HashProc;
1788      '$'                         : FProcTable[chI] := @IntegerProc;
1789      #10                         : FProcTable[chI] := @LFProc;
1790      #0                          : FProcTable[chI] := @NullProc;
1791      '0'..'9'                    : FProcTable[chI] := @NumberProc;
1792      ')', '('                    : FProcTable[chI] := @RoundOpenProc;
1793      '/'                         : FProcTable[chI] := @SlashProc;
1794      #1..#9, #11, #12, #14..#32  : FProcTable[chI] := @SpaceProc;
1795      #39                         : FProcTable[chI] := @StringProc;
1796    else
1797      FProcTable[chI] := @UnknownProc;
1798    end;
1799end;
1800
1801constructor TSynCssSyn.Create(AOwner: TComponent);
1802begin
1803  inherited Create(AOwner);
1804  fCommentAttri := TSynHighlighterAttributes.Create(@SYNS_AttrComment, SYNS_XML_AttrComment);
1805  fCommentAttri.Style := [fsItalic];
1806  AddAttribute(fCommentAttri);
1807  fIdentifierAttri := TSynHighlighterAttributes.Create(@SYNS_AttrIdentifier, SYNS_XML_AttrIdentifier);
1808  AddAttribute(fIdentifierAttri);
1809  fKeyAttri := TSynHighlighterAttributes.Create(@SYNS_AttrKey, SYNS_XML_AttrKey);
1810  fKeyAttri.Style := [fsBold];
1811  AddAttribute(fKeyAttri);
1812  fNumberAttri := TSynHighlighterAttributes.Create(@SYNS_AttrNumber, SYNS_XML_AttrNumber);
1813  AddAttribute(fNumberAttri);
1814  fSpaceAttri := TSynHighlighterAttributes.Create(@SYNS_AttrSpace, SYNS_XML_AttrSpace);
1815  AddAttribute(fSpaceAttri);
1816  fStringAttri := TSynHighlighterAttributes.Create(@SYNS_AttrString, SYNS_XML_AttrString);
1817  AddAttribute(fStringAttri);
1818  fSymbolAttri := TSynHighlighterAttributes.Create(@SYNS_AttrSymbol, SYNS_XML_AttrSymbol);
1819  AddAttribute(fSymbolAttri);
1820  fMeasurementUnitAttri := TSynHighlighterAttributes.Create(@SYNS_AttrMeasurementUnitValue, SYNS_XML_AttrMeasurementUnitValue);
1821  AddAttribute(fMeasurementUnitAttri);
1822  fSelectorAttri := TSynHighlighterAttributes.Create(@SYNS_AttrSelectorValue, SYNS_XML_AttrSelectorValue);
1823  AddAttribute(fSelectorAttri);
1824  SetAttributesOnChange(@DefHighlightChange);
1825  InitIdent;
1826  MakeMethodTables;
1827  fDefaultFilter := SYNS_FilterCSS;
1828  fRange := [];
1829end;
1830
1831procedure TSynCssSyn.SetLine(const NewValue: String; LineNumber: Integer);
1832begin
1833  inherited;
1834  fLine := PChar(NewValue);
1835  Run := 0;
1836  fLineNumber := LineNumber;
1837  Next;
1838end;
1839
1840procedure TSynCssSyn.SymbolProc;
1841begin
1842  if rsInDeclarationBlock in fRange then
1843    FTokenID := tkSymbol
1844  else
1845    FTokenID := tkIdentifier;
1846  Inc(Run);
1847end;
1848
1849procedure TSynCssSyn.ColonProc;
1850begin
1851  if not(rsInDeclarationBlock in fRange) then
1852    FTokenID := tkSelector
1853  else
1854    FTokenID := tkSymbol;
1855  Inc(Run);
1856end;
1857
1858procedure TSynCssSyn.SelectorProc;
1859begin
1860  if not(rsInDeclarationBlock in fRange) then
1861    FTokenID := tkSelector
1862  else
1863    FTokenID := tkIdentifier;
1864  Inc(Run);
1865end;
1866
1867procedure TSynCssSyn.PercentProc;
1868begin
1869  if rsInDeclarationBlock in fRange then
1870    FTokenID := tkMeasurementUnit
1871  else
1872    FTokenID := tkIdentifier;
1873  Inc(Run);
1874end;
1875
1876procedure TSynCssSyn.CurlyOpenProc;
1877begin
1878  FTokenID := tkSymbol;
1879  Inc(Run);
1880  fRange := fRange + [rsInDeclarationBlock];
1881end;
1882
1883procedure TSynCssSyn.CurlyCloseProc;
1884begin
1885  FTokenID := tkSymbol;
1886  Inc(Run);
1887  fRange := fRange - [rsInDeclarationBlock];
1888end;
1889
1890procedure TSynCssSyn.CRProc;
1891begin
1892  FTokenID := tkSpace;
1893  Inc(Run);
1894  if FLine[Run] = #10 then
1895    Inc(Run);
1896end;
1897
1898procedure TSynCssSyn.CStyleCommentProc;
1899begin
1900  if FLine[Run] = #0 then
1901    FTokenID := tkNull
1902  else begin
1903    FTokenID := tkComment;
1904    repeat
1905      if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin
1906        FRange := fRange - [rsCStyle];
1907        Inc(Run, 2);
1908        Break;
1909      end;
1910      Inc(Run);
1911    until FLine[Run] in [#0, #10, #13];
1912  end;
1913end;
1914
1915procedure TSynCssSyn.DashProc;
1916begin
1917  if (FLine[Run - 1] = ' ') then begin
1918    if (FLine[Run + 1] in ['0'..'9', 'a'..'z', 'A'..'Z']) then
1919      FTokenID := tkNumber
1920    else if (FLine[Run + 1] = '.') and (FLine[Run + 2] in ['0'..'9', 'a'..'z', 'A'..'Z']) then begin
1921      FTokenID := tkNumber;
1922      Inc(Run);
1923    end;
1924  end else
1925    FTokenID := tkIdentifier;
1926  Inc(Run);
1927end;
1928
1929procedure TSynCssSyn.IdentProc;
1930begin
1931  FTokenID := IdentKind((FLine + Run));
1932  Inc(Run, FStringLen);
1933  while Identifiers[FLine[Run]] do
1934    Inc(Run);
1935end;
1936
1937procedure TSynCssSyn.HashProc;
1938begin
1939  if (rsInDeclarationBlock in fRange) then begin
1940    IntegerProc;
1941    exit;
1942  end;
1943
1944  Inc(Run);
1945  FTokenID := tkSelector;
1946end;
1947
1948procedure TSynCssSyn.IntegerProc;
1949begin
1950  Inc(Run);
1951  if not(rsInDeclarationBlock in fRange) then begin
1952    FTokenID := tkIdentifier;
1953    exit;
1954  end;
1955
1956  FTokenID := tkNumber;
1957  while FLine[Run] in ['0'..'9', 'A'..'F', 'a'..'f'] do
1958    Inc(Run);
1959end;
1960
1961procedure TSynCssSyn.LFProc;
1962begin
1963  FTokenID := tkSpace;
1964  Inc(Run);
1965end;
1966
1967procedure TSynCssSyn.NullProc;
1968begin
1969  FTokenID := tkNull;
1970end;
1971
1972procedure TSynCssSyn.NumberProc;
1973begin
1974  Inc(Run);
1975  FTokenID := tkNumber;
1976  while FLine[Run] in ['0'..'9', '.', 'e', 'E'] do begin
1977    if ((FLine[Run] = '.') and (FLine[Run + 1] = '.')) or
1978       ((FLine[Run] = 'e') and ((FLine[Run + 1] = 'x') or (FLine[Run + 1] = 'm'))) then
1979      Break;
1980    Inc(Run);
1981  end;
1982end;
1983
1984procedure TSynCssSyn.RoundOpenProc;
1985begin
1986  Inc(Run);
1987  FTokenID := tkSymbol;
1988end;
1989
1990procedure TSynCssSyn.SlashProc;
1991begin
1992  Inc(Run);
1993  if fLine[Run] = '*' then begin
1994    FTokenID := tkComment;
1995    FRange := fRange + [rsCStyle];
1996    Inc(Run);
1997    if not (FLine[Run] in [#0, #10, #13]) then
1998      CStyleCommentProc;
1999  end else
2000    FTokenID := tkIdentifier…

Large files files are truncated, but you can click here to view the full file