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: SynHighlighterHTML.pas, released 2000-04-10.
12The Original Code is based on the hkHTMLSyn.pas file from the
13mwEdit component suite by Martin Waldenburg and other developers, the Initial
14Author of this file is Hideo Koiso.
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: synhighlighterhtml.pp 50780 2015-12-13 20:38:06Z martin $
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 an HTML highlighter for SynEdit)
39@author(Hideo Koiso, converted to SynEdit by Michael Hieke)
40@created(1999-11-02, converted to SynEdit 2000-04-10)
41@lastmod(2000-06-23)
42The SynHighlighterHTML unit provides SynEdit with an HTML highlighter.
43}
44unit SynHighlighterHTML;
45
46{$I synedit.inc}
47
48interface
49
50uses
51  SysUtils, Classes, Graphics, SynEditTypes, SynEditHighlighter,
52  SynEditHighlighterXMLBase, SynEditHighlighterFoldBase;
53
54const
55  MAX_ESCAPEAMPS = 159;
56
57  EscapeAmps: array[0..MAX_ESCAPEAMPS - 1] of PChar = (
58    ('&'),               {   &   }
59    ('<'),                {   >   }
60    ('&gt;'),                {   <   }
61    ('&quot;'),              {   "   }
62    ('&trade;'),             {   ™   }
63    ('&nbsp;'),              { space }
64    ('&copy;'),              {   ©   }
65    ('&reg;'),               {   ®   }
66    ('&Agrave;'),            {   À   }
67    ('&Aacute;'),            {   Á   }
68    ('&Acirc;'),             {   Â   }
69    ('&Atilde;'),            {   Ã   }
70    ('&Auml;'),              {   Ä   }
71    ('&Aring;'),             {   Å   }
72    ('&AElig;'),             {   Æ   }
73    ('&Ccedil;'),            {   Ç   }
74    ('&Egrave;'),            {   È   }
75    ('&Eacute;'),            {   É   }
76    ('&Ecirc;'),             {   Ê   }
77    ('&Euml;'),              {   Ë   }
78    ('&Igrave;'),            {   Ì   }
79    ('&Iacute;'),            {   Í   }
80    ('&Icirc;'),             {   Î   }
81    ('&Iuml;'),              {   Ï   }
82    ('&ETH;'),               {   Ð   }
83    ('&Ntilde;'),            {   Ñ   }
84    ('&Ograve;'),            {   Ò   }
85    ('&Oacute;'),            {   Ó   }
86    ('&Ocirc;'),             {   Ô   }
87    ('&Otilde;'),            {   Õ   }
88    ('&Ouml;'),              {   Ö   }
89    ('&Oslash;'),            {   Ø   }
90    ('&Ugrave;'),            {   Ù   }
91    ('&Uacute;'),            {   Ú   }
92    ('&Ucirc;'),             {   Û   }
93    ('&Uuml;'),              {   Ü   }
94    ('&Yacute;'),            {   Ý   }
95    ('&THORN;'),             {   Þ   }
96    ('&szlig;'),             {   ß   }
97    ('&agrave;'),            {   à   }
98    ('&aacute;'),            {   á   }
99    ('&acirc;'),             {   â   }
100    ('&atilde;'),            {   ã   }
101    ('&auml;'),              {   ä   }
102    ('&aring;'),             {   å   }
103    ('&aelig;'),             {   æ   }
104    ('&ccedil;'),            {   ç   }
105    ('&egrave;'),            {   è   }
106    ('&eacute;'),            {   é   }
107    ('&ecirc;'),             {   ê   }
108    ('&euml;'),              {   ë   }
109    ('&igrave;'),            {   ì   }
110    ('&iacute;'),            {   í   }
111    ('&icirc;'),             {   î   }
112    ('&iuml;'),              {   ï   }
113    ('&eth;'),               {   ð   }
114    ('&ntilde;'),            {   ñ   }
115    ('&ograve;'),            {   ò   }
116    ('&oacute;'),            {   ó   }
117    ('&ocirc;'),             {   ô   }
118    ('&otilde;'),            {   õ   }
119    ('&ouml;'),              {   ö   }
120    ('&oslash;'),            {   ø   }
121    ('&ugrave;'),            {   ù   }
122    ('&uacute;'),            {   ú   }
123    ('&ucirc;'),             {   û   }
124    ('&uuml;'),              {   ü   }
125    ('&yacute;'),            {   ý   }
126    ('&thorn;'),             {   þ   }
127    ('&yuml;'),              {   ÿ   }
128    ('&iexcl;'),             {   ¡   }
129    ('&cent;'),              {   ¢   }
130    ('&pound;'),             {   £   }
131    ('&curren;'),            {   ¤   }
132    ('&yen;'),               {   ¥   }
133    ('&brvbar;'),            {   ¦   }
134    ('&sect;'),              {   §   }
135    ('&uml;'),               {   ¨   }
136    ('&ordf;'),              {   ª   }
137    ('&laquo;'),             {   «   }
138    ('&shy;'),               {   ¬   }
139    ('&macr;'),              {   ¯   }
140    ('&deg;'),               {   °   }
141    ('&plusmn;'),            {   ±   }
142    ('&sup2;'),              {   ²   }
143    ('&sup3;'),              {   ³   }
144    ('&acute;'),             {   ´   }
145    ('&micro;'),             {   µ   }
146    ('&middot;'),            {   ·   }
147    ('&cedil;'),             {   ¸   }
148    ('&sup1;'),              {   ¹   }
149    ('&ordm;'),              {   º   }
150    ('&raquo;'),             {   »   }
151    ('&frac14;'),            {   ¼   }
152    ('&frac12;'),            {   ½   }
153    ('&frac34;'),            {   ¾   }
154    ('&iquest;'),            {   ¿   }
155    ('&times;'),             {   ×   }
156    ('&divide'),             {   ÷   }
157    ('&euro;'),              {   €   }
158    ('&permil;'),
159    ('&bdquo;'),
160    ('&rdquo;'),
161    ('&lsquo;'),
162    ('&rsquo;'),
163    ('&ndash;'),
164    ('&mdash;'),
165    ('&bull;'),
166    //used by very old HTML editors
167    ('&#9;'),                {  TAB  }
168    ('&#127;'),              {      }
169    ('&#128;'),              {   €   }
170    ('&#129;'),              {      }
171    ('&#130;'),              {   ‚   }
172    ('&#131;'),              {   ƒ   }
173    ('&#132;'),              {   „   }
174    ('&ldots;'),             {   …   }
175    ('&#134;'),              {   †   }
176    ('&#135;'),              {   ‡   }
177    ('&#136;'),              {   ˆ   }
178    ('&#137;'),              {   ‰   }
179    ('&#138;'),              {   Š   }
180    ('&#139;'),              {   ‹   }
181    ('&#140;'),              {   Π  }
182    ('&#141;'),              {      }
183    ('&#142;'),              {   Ž   }
184    ('&#143;'),              {      }
185    ('&#144;'),              {      }
186    ('&#152;'),              {   ˜   }
187    ('&#153;'),              {   ™   }
188    ('&#154;'),              {   š   }
189    ('&#155;'),              {   ›   }
190    ('&#156;'),              {   œ   }
191    ('&#157;'),              {      }
192    ('&#158;'),              {   ž   }
193    ('&#159;'),              {   Ÿ   }
194    ('&#161;'),              {   ¡   }
195    ('&#162;'),              {   ¢   }
196    ('&#163;'),              {   £   }
197    ('&#164;'),              {   ¤   }
198    ('&#165;'),              {   ¥   }
199    ('&#166;'),              {   ¦   }
200    ('&#167;'),              {   §   }
201    ('&#168;'),              {   ¨   }
202    ('&#170;'),              {   ª   }
203    ('&#175;'),              {   »   }
204    ('&#176;'),              {   °   }
205    ('&#177;'),              {   ±   }
206    ('&#178;'),              {   ²   }
207    ('&#180;'),              {   ´   }
208    ('&#181;'),              {   µ   }
209    ('&#183;'),              {   ·   }
210    ('&#184;'),              {   ¸   }
211    ('&#185;'),              {   ¹   }
212    ('&#186;'),              {   º   }
213    ('&#188;'),              {   ¼   }
214    ('&#189;'),              {   ½   }
215    ('&#190;'),              {   ¾   }
216    ('&#191;'),              {   ¿   }
217    ('&#215;'));             {   Ô   }
218
219type
220  TtkTokenKind = (tkAmpersand, tkASP, tkCDATA, tkComment, tkIdentifier, tkKey, tkNull,
221    tkSpace, tkString, tkSymbol, tkText, tkUndefKey, tkValue, tkDOCTYPE);
222
223  TRangeState = (rsAmpersand, rsASP, rsCDATA, rsComment, rsKey, rsParam, rsText,
224    rsUnKnown, rsValue, rsDOCTYPE);
225
226 THtmlCodeFoldBlockType = (
227    cfbtHtmlNode,     // <foo>...</node>
228    cfbtHtmlComment,  // <!-- -->
229    cfbtHtmlAsp,  // <% asp  %>
230    cfbtHtmlCDATA, // <![CDATA[ data ]]>
231    cfbtHtmlDOCTYPE, // <!DOCTYPE data>
232    // internal types / not configurable
233    cfbtHtmlNone
234  );
235
236  TProcTableProc = procedure of object;
237  TIdentFuncTableFunc = function: TtkTokenKind of object;
238
239  TSynHTMLSynMode = (shmHtml, shmXHtml);
240
241  { TSynHTMLSyn }
242
243  TSynHTMLSyn = class(TSynCustomXmlHighlighter)
244  private
245    FMode: TSynHTMLSynMode;
246    fSimpleTag: Boolean;
247    fAndCode: Integer;
248    fRange: TRangeState;
249    fLine: PChar;
250    fProcTable: array[#0..#255] of TProcTableProc;
251    Run: Longint;
252    Temp: PChar;
253    fStringLen: Integer;
254    fToIdent: PChar;
255    fIdentFuncTable: array[0..255] of TIdentFuncTableFunc;
256    fTokenPos: Integer;
257    fTokenID: TtkTokenKind;
258    fAndAttri: TSynHighlighterAttributes;
259    fASPAttri: TSynHighlighterAttributes;
260    fCDATAAttri: TSynHighlighterAttributes;
261    fDOCTYPEAttri: TSynHighlighterAttributes;
262    fCommentAttri: TSynHighlighterAttributes;
263    fIdentifierAttri: TSynHighlighterAttributes;
264    fKeyAttri: TSynHighlighterAttributes;
265    fSpaceAttri: TSynHighlighterAttributes;
266    fSymbolAttri: TSynHighlighterAttributes;
267    fTextAttri: TSynHighlighterAttributes;
268    fUndefKeyAttri: TSynHighlighterAttributes;
269    fValueAttri: TSynHighlighterAttributes;
270    fLineNumber: Integer;
271
272    function KeyHash(ToHash: PChar): Integer;
273    function KeyComp(const aKey: string): Boolean;
274    function Func1: TtkTokenKind;
275    function Func2: TtkTokenKind;
276    function Func8: TtkTokenKind;
277    function Func9: TtkTokenKind;
278    function Func10: TtkTokenKind;
279    function Func11: TtkTokenKind;
280    function Func12: TtkTokenKind;
281    function Func13: TtkTokenKind;
282    function Func14: TtkTokenKind;
283    function Func15: TtkTokenKind;
284    function Func16: TtkTokenKind;
285    function Func17: TtkTokenKind;
286    function Func18: TtkTokenKind;
287    function Func19: TtkTokenKind;
288    function Func20: TtkTokenKind;
289    function Func21: TtkTokenKind;
290    function Func23: TtkTokenKind;
291    function Func24: TtkTokenKind;
292    function Func25: TtkTokenKind;
293    function Func26: TtkTokenKind;
294    function Func27: TtkTokenKind;
295    function Func28: TtkTokenKind;
296    function Func29: TtkTokenKind;
297    function Func30: TtkTokenKind;
298    function Func31: TtkTokenKind;
299    function Func32: TtkTokenKind;
300    function Func33: TtkTokenKind;
301    function Func34: TtkTokenKind;
302    function Func35: TtkTokenKind;
303    function Func37: TtkTokenKind;
304    function Func38: TtkTokenKind;
305    function Func39: TtkTokenKind;
306    function Func40: TtkTokenKind;
307    function Func41: TtkTokenKind;
308    function Func42: TtkTokenKind;
309    function Func43: TtkTokenKind;
310    function Func46: TtkTokenKind;
311    function Func47: TtkTokenKind;
312    function Func48: TtkTokenKind;
313    function Func49: TtkTokenKind;
314    function Func50: TtkTokenKind;
315    function Func52: TtkTokenKind;
316    function Func53: TtkTokenKind;
317    function Func55: TtkTokenKind;
318    function Func56: TtkTokenKind;
319    function Func57: TtkTokenKind;
320    function Func58: TtkTokenKind;
321    function Func60: TtkTokenKind;
322    function Func61: TtkTokenKind;
323    function Func62: TtkTokenKind;
324    function Func63: TtkTokenKind;
325    function Func64: TtkTokenKind;
326    function Func65: TtkTokenKind;
327    function Func66: TtkTokenKind;
328    function Func67: TtkTokenKind;
329    function Func68: TtkTokenKind;
330    function Func70: TtkTokenKind;
331    function Func76: TtkTokenKind;
332    function Func78: TtkTokenKind;
333    function Func79: TtkTokenKind;
334    function Func80: TtkTokenKind;
335    function Func81: TtkTokenKind;
336    function Func82: TtkTokenKind;
337    function Func83: TtkTokenKind;
338    function Func84: TtkTokenKind;
339    function Func85: TtkTokenKind;
340    function Func86: TtkTokenKind;
341    function Func87: TtkTokenKind;
342    function Func89: TtkTokenKind;
343    function Func90: TtkTokenKind;
344    function Func91: TtkTokenKind;
345    function Func92: TtkTokenKind;
346    function Func93: TtkTokenKind;
347    function Func94: TtkTokenKind;
348    function Func100: TtkTokenKind;
349    function Func105: TtkTokenKind;
350    function Func107: TtkTokenKind;
351    function Func110: TtkTokenKind;
352    function Func113: TtkTokenKind;
353    function Func114: TtkTokenKind;
354    function Func117: TtkTokenKind;
355    function Func121: TtkTokenKind;
356    function Func123: TtkTokenKind;
357    function Func124: TtkTokenKind;
358    function Func128: TtkTokenKind;
359    function Func130: TtkTokenKind;
360    function Func131: TtkTokenKind;
361    function Func132: TtkTokenKind;
362    function Func133: TtkTokenKind;
363    function Func134: TtkTokenKind;
364    function Func135: TtkTokenKind;
365    function Func136: TtkTokenKind;
366    function Func137: TtkTokenKind;
367    function Func138: TtkTokenKind;
368    function Func139: TtkTokenKind;
369    function Func140: TtkTokenKind;
370    function Func141: TtkTokenKind;
371    function Func143: TtkTokenKind;
372    function Func145: TtkTokenKind;
373    function Func146: TtkTokenKind;
374    function Func149: TtkTokenKind;
375    function Func150: TtkTokenKind;
376    function Func152: TtkTokenKind;
377    function Func153: TtkTokenKind;
378    function Func154: TtkTokenKind;
379    function Func155: TtkTokenKind;
380    function Func156: TtkTokenKind;
381    function Func157: TtkTokenKind;
382    function Func159: TtkTokenKind;
383    function Func160: TtkTokenKind;
384    function Func161: TtkTokenKind;
385    function Func162: TtkTokenKind;
386    function Func163: TtkTokenKind;
387    function Func164: TtkTokenKind;
388    function Func165: TtkTokenKind;
389    function Func168: TtkTokenKind;
390    function Func169: TtkTokenKind;
391    function Func170: TtkTokenKind;
392    function Func171: TtkTokenKind;
393    function Func172: TtkTokenKind;
394    function Func174: TtkTokenKind;
395    function Func175: TtkTokenKind;
396    function Func177: TtkTokenKind;
397    function Func178: TtkTokenKind;
398    function Func179: TtkTokenKind;
399    function Func180: TtkTokenKind;
400    function Func182: TtkTokenKind;
401    function Func183: TtkTokenKind;
402    function Func185: TtkTokenKind;
403    function Func186: TtkTokenKind;
404    function Func187: TtkTokenKind;
405    function Func188: TtkTokenKind;
406    function Func190: TtkTokenKind;
407    function Func192: TtkTokenKind;
408    function Func198: TtkTokenKind;
409    function Func200: TtkTokenKind;
410    function Func201: TtkTokenKind;
411    function Func202: TtkTokenKind;
412    function Func203: TtkTokenKind;
413    function Func204: TtkTokenKind;
414    function Func205: TtkTokenKind;
415    function Func207: TtkTokenKind;
416    function Func208: TtkTokenKind;
417    function Func209: TtkTokenKind;
418    function Func211: TtkTokenKind;
419    function Func212: TtkTokenKind;
420    function Func213: TtkTokenKind;
421    function Func214: TtkTokenKind;
422    function Func215: TtkTokenKind;
423    function Func216: TtkTokenKind;
424    function Func222: TtkTokenKind;
425    function Func227: TtkTokenKind;
426    function Func229: TtkTokenKind;
427    function Func232: TtkTokenKind;
428    function Func235: TtkTokenKind;
429    function Func236: TtkTokenKind;
430    function Func239: TtkTokenKind;
431    function Func243: TtkTokenKind;
432    function Func250: TtkTokenKind;
433    function AltFunc: TtkTokenKind;
434    function IdentKind(MayBe: PChar): TtkTokenKind;
435    procedure InitIdent;
436    procedure MakeMethodTables;
437    procedure ASPProc;
438    procedure CDATAProc;
439    procedure DOCTYPEProc;
440    procedure SetMode(const AValue: TSynHTMLSynMode);
441    procedure TextProc;
442    procedure CommentProc;
443    procedure BraceCloseProc;
444    procedure BraceOpenProc;
445    procedure CRProc;
446    procedure EqualProc;
447    procedure IdentProc;
448    procedure LFProc;
449    procedure NullProc;
450    procedure SpaceProc;
451    procedure StringProc;
452    procedure AmpersandProc;
453  protected
454    function GetIdentChars: TSynIdentChars; override;
455  protected
456    // folding
457    procedure CreateRootCodeFoldBlock; override;
458    function GetFoldConfigInstance(Index: Integer): TSynCustomFoldConfig; override;
459
460    function StartHtmlCodeFoldBlock(ABlockType: THtmlCodeFoldBlockType): TSynCustomCodeFoldBlock;
461    function StartHtmlNodeCodeFoldBlock(ABlockType: THtmlCodeFoldBlockType;
462                                   OpenPos: Integer; AName: String): TSynCustomCodeFoldBlock;
463    procedure EndHtmlNodeCodeFoldBlock(ClosePos: Integer = -1; AName: String = '');
464    function TopHtmlCodeFoldBlockType(DownIndex: Integer = 0): THtmlCodeFoldBlockType;
465
466    function GetFoldConfigCount: Integer; override;
467    function GetFoldConfigInternalCount: Integer; override;
468  public
469    class function GetLanguageName: string; override;
470  public
471    constructor Create(AOwner: TComponent); override;
472    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
473      override;
474    function GetEol: Boolean; override;
475    function GetRange: Pointer; override;
476    function GetTokenID: TtkTokenKind;
477    procedure SetLine(const NewValue: string; LineNumber:Integer); override;
478    function GetToken: string; override;
479    procedure GetTokenEx(out TokenStart: PChar; out TokenLength: integer); override;
480    function GetTokenAttribute: TSynHighlighterAttributes; override;
481    function GetTokenKind: integer; override;
482    function GetTokenPos: Integer; override;
483    procedure Next; override;
484    procedure SetRange(Value: Pointer); override;
485    procedure ReSetRange; override;
486    property IdentChars;
487  published
488    property AndAttri: TSynHighlighterAttributes read fAndAttri write fAndAttri;
489    property ASPAttri: TSynHighlighterAttributes read fASPAttri write fASPAttri;
490    property CDATAAttri: TSynHighlighterAttributes read fCDATAAttri write fCDATAAttri;
491    property DOCTYPEAttri: TSynHighlighterAttributes read fDOCTYPEAttri write fDOCTYPEAttri;
492    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
493      write fCommentAttri;
494    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
495      write fIdentifierAttri;
496    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
497    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
498      write fSpaceAttri;
499    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
500      write fSymbolAttri;
501    property TextAttri: TSynHighlighterAttributes read fTextAttri
502      write fTextAttri;
503    property UndefKeyAttri: TSynHighlighterAttributes read fUndefKeyAttri
504      write fUndefKeyAttri;
505    property ValueAttri: TSynHighlighterAttributes read fValueAttri
506      write fValueAttri;
507    property Mode: TSynHTMLSynMode read FMode write SetMode default shmHtml;
508  end;
509
510implementation
511
512uses
513  SynEditStrConst;
514
515var
516  mHashTable: array[#0..#255] of Integer;
517
518procedure MakeIdentTable;
519var
520  i: Char;
521begin
522  for i := #0 to #255 do
523    case i of
524      'a'..'z', 'A'..'Z':
525        mHashTable[i] := (Ord(UpCase(i)) - 64);
526      '!':
527        mHashTable[i] := $7B;
528      '/':
529        mHashTable[i] := $7A;
530      else
531        mHashTable[Char(i)] := 0;
532    end;
533end;
534
535procedure TSynHTMLSyn.InitIdent;
536var
537  i: Integer;
538begin
539  for i := 0 to 255 do
540    case i of
541      1:   fIdentFuncTable[i] := @Func1;
542      2:   fIdentFuncTable[i] := @Func2;
543      8:   fIdentFuncTable[i] := @Func8;
544      9:   fIdentFuncTable[i] := @Func9;
545      10:  fIdentFuncTable[i] := @Func10;
546      11:  fIdentFuncTable[i] := @Func11;
547      12:  fIdentFuncTable[i] := @Func12;
548      13:  fIdentFuncTable[i] := @Func13;
549      14:  fIdentFuncTable[i] := @Func14;
550      15:  fIdentFuncTable[i] := @Func15;
551      16:  fIdentFuncTable[i] := @Func16;
552      17:  fIdentFuncTable[i] := @Func17;
553      18:  fIdentFuncTable[i] := @Func18;
554      19:  fIdentFuncTable[i] := @Func19;
555      20:  fIdentFuncTable[i] := @Func20;
556      21:  fIdentFuncTable[i] := @Func21;
557      23:  fIdentFuncTable[i] := @Func23;
558      24:  fIdentFuncTable[i] := @Func24;
559      25:  fIdentFuncTable[i] := @Func25;
560      26:  fIdentFuncTable[i] := @Func26;
561      27:  fIdentFuncTable[i] := @Func27;
562      28:  fIdentFuncTable[i] := @Func28;
563      29:  fIdentFuncTable[i] := @Func29;
564      30:  fIdentFuncTable[i] := @Func30;
565      31:  fIdentFuncTable[i] := @Func31;
566      32:  fIdentFuncTable[i] := @Func32;
567      33:  fIdentFuncTable[i] := @Func33;
568      34:  fIdentFuncTable[i] := @Func34;
569      35:  fIdentFuncTable[i] := @Func35;
570      37:  fIdentFuncTable[i] := @Func37;
571      38:  fIdentFuncTable[i] := @Func38;
572      39:  fIdentFuncTable[i] := @Func39;
573      40:  fIdentFuncTable[i] := @Func40;
574      41:  fIdentFuncTable[i] := @Func41;
575      42:  fIdentFuncTable[i] := @Func42;
576      43:  fIdentFuncTable[i] := @Func43;
577      46:  fIdentFuncTable[i] := @Func46;
578      47:  fIdentFuncTable[i] := @Func47;
579      48:  fIdentFuncTable[i] := @Func48;
580      49:  fIdentFuncTable[i] := @Func49;
581      50:  fIdentFuncTable[i] := @Func50;
582      52:  fIdentFuncTable[i] := @Func52;
583      53:  fIdentFuncTable[i] := @Func53;
584      55:  fIdentFuncTable[i] := @Func55;
585      56:  fIdentFuncTable[i] := @Func56;
586      57:  fIdentFuncTable[i] := @Func57;
587      58:  fIdentFuncTable[i] := @Func58;
588      60:  fIdentFuncTable[i] := @Func60;
589      61:  fIdentFuncTable[i] := @Func61;
590      62:  fIdentFuncTable[i] := @Func62;
591      63:  fIdentFuncTable[i] := @Func63;
592      64:  fIdentFuncTable[i] := @Func64;
593      65:  fIdentFuncTable[i] := @Func65;
594      66:  fIdentFuncTable[i] := @Func66;
595      67:  fIdentFuncTable[i] := @Func67;
596      68:  fIdentFuncTable[i] := @Func68;
597      70:  fIdentFuncTable[i] := @Func70;
598      76:  fIdentFuncTable[i] := @Func76;
599      78:  fIdentFuncTable[i] := @Func78;
600      79:  fIdentFuncTable[i] := @Func79;
601      80:  fIdentFuncTable[i] := @Func80;
602      81:  fIdentFuncTable[i] := @Func81;
603      82:  fIdentFuncTable[i] := @Func82;
604      83:  fIdentFuncTable[i] := @Func83;
605      84:  fIdentFuncTable[i] := @Func84;
606      85:  fIdentFuncTable[i] := @Func85;
607      86:  fIdentFuncTable[i] := @Func86;
608      87:  fIdentFuncTable[i] := @Func87;
609      89:  fIdentFuncTable[i] := @Func89;
610      90:  fIdentFuncTable[i] := @Func90;
611      91:  fIdentFuncTable[i] := @Func91;
612      92:  fIdentFuncTable[i] := @Func92;
613      93:  fIdentFuncTable[i] := @Func93;
614      94:  fIdentFuncTable[i] := @Func94;
615      100: fIdentFuncTable[i] := @Func100;
616      105: fIdentFuncTable[i] := @Func105;
617      107: fIdentFuncTable[i] := @Func107;
618      110: fIdentFuncTable[i] := @Func110;
619      113: fIdentFuncTable[i] := @Func113;
620      114: fIdentFuncTable[i] := @Func114;
621      117: fIdentFuncTable[i] := @Func117;
622      121: fIdentFuncTable[i] := @Func121;
623      123: fIdentFuncTable[i] := @Func123;
624      124: fIdentFuncTable[i] := @Func124;
625      128: fIdentFuncTable[i] := @Func128;
626      130: fIdentFuncTable[i] := @Func130;
627      131: fIdentFuncTable[i] := @Func131;
628      132: fIdentFuncTable[i] := @Func132;
629      133: fIdentFuncTable[i] := @Func133;
630      134: fIdentFuncTable[i] := @Func134;
631      135: fIdentFuncTable[i] := @Func135;
632      136: fIdentFuncTable[i] := @Func136;
633      137: fIdentFuncTable[i] := @Func137;
634      138: fIdentFuncTable[i] := @Func138;
635      139: fIdentFuncTable[i] := @Func139;
636      140: fIdentFuncTable[i] := @Func140;
637      141: fIdentFuncTable[i] := @Func141;
638      143: fIdentFuncTable[i] := @Func143;
639      145: fIdentFuncTable[i] := @Func145;
640      146: fIdentFuncTable[i] := @Func146;
641      149: fIdentFuncTable[i] := @Func149;
642      150: fIdentFuncTable[i] := @Func150;
643      152: fIdentFuncTable[i] := @Func152;
644      153: fIdentFuncTable[i] := @Func153;
645      154: fIdentFuncTable[i] := @Func154;
646      155: fIdentFuncTable[i] := @Func155;
647      156: fIdentFuncTable[i] := @Func156;
648      157: fIdentFuncTable[i] := @Func157;
649      159: fIdentFuncTable[i] := @Func159;
650      160: fIdentFuncTable[i] := @Func160;
651      161: fIdentFuncTable[i] := @Func161;
652      162: fIdentFuncTable[i] := @Func162;
653      163: fIdentFuncTable[i] := @Func163;
654      164: fIdentFuncTable[i] := @Func164;
655      165: fIdentFuncTable[i] := @Func165;
656      168: fIdentFuncTable[i] := @Func168;
657      169: fIdentFuncTable[i] := @Func169;
658      170: fIdentFuncTable[i] := @Func170;
659      171: fIdentFuncTable[i] := @Func171;
660      172: fIdentFuncTable[i] := @Func172;
661      174: fIdentFuncTable[i] := @Func174;
662      175: fIdentFuncTable[i] := @Func175;
663      177: fIdentFuncTable[i] := @Func177;
664      178: fIdentFuncTable[i] := @Func178;
665      179: fIdentFuncTable[i] := @Func179;
666      180: fIdentFuncTable[i] := @Func180;
667      182: fIdentFuncTable[i] := @Func182;
668      183: fIdentFuncTable[i] := @Func183;
669      185: fIdentFuncTable[i] := @Func185;
670      186: fIdentFuncTable[i] := @Func186;
671      187: fIdentFuncTable[i] := @Func187;
672      188: fIdentFuncTable[i] := @Func188;
673      190: fIdentFuncTable[i] := @Func190;
674      192: fIdentFuncTable[i] := @Func192;
675      198: fIdentFuncTable[i] := @Func198;
676      200: fIdentFuncTable[i] := @Func200;
677      201: fIdentFuncTable[i] := @Func201;
678      202: fIdentFuncTable[i] := @Func202;
679      203: fIdentFuncTable[i] := @Func203;
680      204: fIdentFuncTable[i] := @Func204;
681      205: fIdentFuncTable[i] := @Func205;
682      207: fIdentFuncTable[i] := @Func207;
683      208: fIdentFuncTable[i] := @Func208;
684      209: fIdentFuncTable[i] := @Func209;
685      211: fIdentFuncTable[i] := @Func211;
686      212: fIdentFuncTable[i] := @Func212;
687      213: fIdentFuncTable[i] := @Func213;
688      214: fIdentFuncTable[i] := @Func214;
689      215: fIdentFuncTable[i] := @Func215;
690      216: fIdentFuncTable[i] := @Func216;
691      222: fIdentFuncTable[i] := @Func222;
692      227: fIdentFuncTable[i] := @Func227;
693      229: fIdentFuncTable[i] := @Func229;
694      232: fIdentFuncTable[i] := @Func232;
695      235: fIdentFuncTable[i] := @Func235;
696      236: fIdentFuncTable[i] := @Func236;
697      239: fIdentFuncTable[i] := @Func239;
698      243: fIdentFuncTable[i] := @Func243;
699      250: fIdentFuncTable[i] := @Func250;
700      else fIdentFuncTable[i] := @AltFunc;
701    end;
702end;
703
704function TSynHTMLSyn.KeyHash(ToHash: PChar): Integer;
705begin
706  Result := 0;
707  While (ToHash^ In ['a'..'z', 'A'..'Z', '!', '/']) do begin
708    Inc(Result, mHashTable[ToHash^]);
709    Inc(ToHash);
710  end;
711  While (ToHash^ In ['0'..'9']) do begin
712    Inc(Result, (Ord(ToHash^) - Ord('0')) );
713    Inc(ToHash);
714  end;
715  fStringLen := (ToHash - fToIdent);
716end;
717
718function TSynHTMLSyn.KeyComp(const aKey: string): Boolean;
719var
720  i: Integer;
721begin
722  Temp := fToIdent;
723  if (Length(aKey) = fStringLen) then begin
724    Result := True;
725    For i:=1 To fStringLen do begin
726      if (mHashTable[Temp^] <> mHashTable[aKey[i]]) then begin
727        Result := False;
728        Break;
729      end;
730      Inc(Temp);
731    end;
732  end else begin
733    Result := False;
734  end;
735end;
736
737function TSynHTMLSyn.Func1: TtkTokenKind;
738begin
739  if KeyComp('A') then begin
740    Result := tkKey;
741  end else begin
742    Result := tkUndefKey;
743  end;
744end;
745
746function TSynHTMLSyn.Func2: TtkTokenKind;
747begin
748  if KeyComp('B') then begin
749    Result := tkKey;
750  end else begin
751    Result := tkUndefKey;
752  end;
753end;
754
755function TSynHTMLSyn.Func8: TtkTokenKind;
756begin
757  if KeyComp('DD') then begin
758    Result := tkKey;
759  end else begin
760    Result := tkUndefKey;
761  end;
762end;
763
764function TSynHTMLSyn.Func9: TtkTokenKind;
765begin
766  if KeyComp('I') Or KeyComp('H1') then begin
767    Result := tkKey;
768  end else begin
769    Result := tkUndefKey;
770  end;
771end;
772
773function TSynHTMLSyn.Func10: TtkTokenKind;
774begin
775  if KeyComp('H2') then begin
776    Result := tkKey;
777  end else begin
778    Result := tkUndefKey;
779  end;
780end;
781
782function TSynHTMLSyn.Func11: TtkTokenKind;
783begin
784  if KeyComp('H3') then begin
785    Result := tkKey;
786  end else begin
787    Result := tkUndefKey;
788  end;
789end;
790
791function TSynHTMLSyn.Func12: TtkTokenKind;
792begin
793  if KeyComp('H4') then begin
794    Result := tkKey;
795  end else begin
796    Result := tkUndefKey;
797  end;
798end;
799
800function TSynHTMLSyn.Func13: TtkTokenKind;
801begin
802  if KeyComp('H5') then begin
803    Result := tkKey;
804  end else begin
805    Result := tkUndefKey;
806  end;
807end;
808
809function TSynHTMLSyn.Func14: TtkTokenKind;
810begin
811  if KeyComp('H6') then begin
812    Result := tkKey;
813  end else begin
814    Result := tkUndefKey;
815  end;
816end;
817
818function TSynHTMLSyn.Func15: TtkTokenKind;
819begin
820  if KeyComp('BDI') then begin
821    Result := tkKey;
822  end else begin
823    Result := tkUndefKey;
824  end;
825end;
826
827function TSynHTMLSyn.Func16: TtkTokenKind;
828begin
829  if KeyComp('DL') Or KeyComp('P') then begin
830    Result := tkKey;
831  end else begin
832    Result := tkUndefKey;
833  end;
834end;
835
836function TSynHTMLSyn.Func17: TtkTokenKind;
837begin
838  if KeyComp('KBD') Or KeyComp('Q') then begin
839    Result := tkKey;
840  end else begin
841    Result := tkUndefKey;
842  end;
843end;
844
845function TSynHTMLSyn.Func18: TtkTokenKind;
846begin
847  if KeyComp('BIG') Or KeyComp('EM') Or KeyComp('HEAD') then begin
848    Result := tkKey;
849  end else begin
850    Result := tkUndefKey;
851  end;
852end;
853
854function TSynHTMLSyn.Func19: TtkTokenKind;
855begin
856  if KeyComp('S') then begin
857    Result := tkKey;
858  end else begin
859    Result := tkUndefKey;
860  end;
861end;
862
863function TSynHTMLSyn.Func20: TtkTokenKind;
864begin
865  if KeyComp('BR') then begin
866    Result := tkKey;
867    fSimpleTag := True;
868  end else begin
869    Result := tkUndefKey;
870  end;
871end;
872
873function TSynHTMLSyn.Func21: TtkTokenKind;
874begin
875  if KeyComp('DEL') Or KeyComp('LI') Or KeyComp('U') Or KeyComp('BDO') then begin
876    Result := tkKey;
877  end else begin
878    Result := tkUndefKey;
879  end;
880end;
881
882function TSynHTMLSyn.Func23: TtkTokenKind;
883begin
884  if KeyComp('ABBR') then begin
885    Result := tkKey;
886  end else begin
887    Result := tkUndefKey;
888  end;
889end;
890
891function TSynHTMLSyn.Func24: TtkTokenKind;
892begin
893  if KeyComp('DFN') Or KeyComp('DT') Or KeyComp('TD') then begin
894    Result := tkKey;
895  end else begin
896    Result := tkUndefKey;
897  end;
898end;
899
900function TSynHTMLSyn.Func25: TtkTokenKind;
901begin
902  if KeyComp('AREA') then begin
903    Result := tkKey;
904    fSimpleTag := True;
905  end else begin
906    Result := tkUndefKey;
907  end;
908end;
909
910function TSynHTMLSyn.Func26: TtkTokenKind;
911begin
912  if KeyComp('HR') then begin
913    Result := tkKey;
914    fSimpleTag := True;
915  end else begin
916    Result := tkUndefKey;
917  end;
918end;
919
920function TSynHTMLSyn.Func27: TtkTokenKind;
921begin
922  if KeyComp('BASE') then begin
923    Result := tkKey;
924    fSimpleTag := True;
925  end else if KeyComp('CODE') Or KeyComp('OL') then begin
926    Result := tkKey;
927  end else begin
928    Result := tkUndefKey;
929  end;
930end;
931
932function TSynHTMLSyn.Func28: TtkTokenKind;
933begin
934  if KeyComp('TH') then begin
935    Result := tkKey;
936  end else begin
937    Result := tkUndefKey;
938  end;
939end;
940
941function TSynHTMLSyn.Func29: TtkTokenKind;
942begin
943  if KeyComp('IMG') or KeyComp('EMBED') then begin
944    Result := tkKey;
945    fSimpleTag := True;
946  end else begin
947    Result := tkUndefKey;
948  end;
949end;
950
951function TSynHTMLSyn.Func30: TtkTokenKind;
952begin
953  if KeyComp('COL') then begin
954    Result := tkKey;
955    fSimpleTag := True;
956  end else if KeyComp('MAP') then begin
957    Result := tkKey;
958  end else begin
959    Result := tkUndefKey;
960  end;
961end;
962
963function TSynHTMLSyn.Func31: TtkTokenKind;
964begin
965  if KeyComp('DIR') then begin
966    Result := tkKey;
967  end else begin
968    Result := tkUndefKey;
969  end;
970end;
971
972function TSynHTMLSyn.Func32: TtkTokenKind;
973begin
974  if KeyComp('LABEL') then begin
975    Result := tkKey;
976  end else begin
977    Result := tkUndefKey;
978  end;
979end;
980
981function TSynHTMLSyn.Func33: TtkTokenKind;
982begin
983  if KeyComp('UL') then begin
984    Result := tkKey;
985  end else begin
986    Result := tkUndefKey;
987  end;
988end;
989
990function TSynHTMLSyn.Func34: TtkTokenKind;
991begin
992  if KeyComp('RP') then begin
993    Result := tkKey;
994  end else begin
995    Result := tkUndefKey;
996  end;
997end;
998
999function TSynHTMLSyn.Func35: TtkTokenKind;
1000begin
1001  if KeyComp('DIV') then begin
1002    Result := tkKey;
1003  end else begin
1004    Result := tkUndefKey;
1005  end;
1006end;
1007
1008function TSynHTMLSyn.Func37: TtkTokenKind;
1009begin
1010  if KeyComp('CITE') Or KeyComp('NAV') Or KeyComp('MAIN') then begin
1011    Result := tkKey;
1012  end else begin
1013    Result := tkUndefKey;
1014  end;
1015end;
1016
1017function TSynHTMLSyn.Func38: TtkTokenKind;
1018begin
1019  if KeyComp('THEAD') Or KeyComp('TR') Or KeyComp('ASIDE') Or KeyComp('RT') then begin
1020    Result := tkKey;
1021  end else begin
1022    Result := tkUndefKey;
1023  end;
1024end;
1025
1026function TSynHTMLSyn.Func39: TtkTokenKind;
1027begin
1028  if KeyComp('META') then begin
1029    Result := tkKey;
1030    fSimpleTag := True;
1031  end else if KeyComp('PRE') then begin
1032    Result := tkKey;
1033  end else begin
1034    Result := tkUndefKey;
1035  end;
1036end;
1037
1038function TSynHTMLSyn.Func40: TtkTokenKind;
1039begin
1040  if KeyComp('TABLE') Or KeyComp('TT') then begin
1041    Result := tkKey;
1042  end else begin
1043    Result := tkUndefKey;
1044  end;
1045end;
1046
1047function TSynHTMLSyn.Func41: TtkTokenKind;
1048begin
1049  if KeyComp('VAR') Or KeyComp('HEADER') then begin
1050    Result := tkKey;
1051  end else begin
1052    Result := tkUndefKey;
1053  end;
1054end;
1055
1056function TSynHTMLSyn.Func42: TtkTokenKind;
1057begin
1058  if KeyComp('INS') Or KeyComp('SUB') then begin
1059    Result := tkKey;
1060  end else begin
1061    Result := tkUndefKey;
1062  end;
1063end;
1064
1065function TSynHTMLSyn.Func43: TtkTokenKind;
1066begin
1067  if KeyComp('FRAME') then begin
1068    Result := tkKey;
1069    fSimpleTag := True;
1070  end
1071  else if KeyComp('WBR') then begin
1072    Result := tkKey;
1073    fSimpleTag := True;
1074  end
1075  else if KeyComp('MARK') then begin
1076    Result := tkKey;
1077  end
1078  else begin
1079    Result := tkUndefKey;
1080  end;
1081end;
1082
1083function TSynHTMLSyn.Func46: TtkTokenKind;
1084begin
1085  if KeyComp('BODY') then begin
1086    Result := tkKey;
1087  end else if KeyComp('LINK') then begin
1088    Result := tkKey;
1089    fSimpleTag := True;
1090  end else begin
1091    Result := tkUndefKey;
1092  end;
1093end;
1094
1095function TSynHTMLSyn.Func47: TtkTokenKind;
1096begin
1097  if KeyComp('LEGEND') Or KeyComp('TIME') then begin
1098    Result := tkKey;
1099  end else begin
1100    Result := tkUndefKey;
1101  end;
1102end;
1103
1104function TSynHTMLSyn.Func48: TtkTokenKind;
1105begin
1106  if KeyComp('BLINK') Or KeyComp('DIALOG') then begin
1107    Result := tkKey;
1108  end else begin
1109    Result := tkUndefKey;
1110  end;
1111end;
1112
1113function TSynHTMLSyn.Func49: TtkTokenKind;
1114begin
1115  if KeyComp('PARAM') then begin
1116    Result := tkKey;
1117    fSimpleTag := True;
1118  end else if KeyComp('NOBR') Or KeyComp('SAMP') then begin
1119    Result := tkKey;
1120  end else begin
1121    Result := tkUndefKey;
1122  end;
1123end;
1124
1125function TSynHTMLSyn.Func50: TtkTokenKind;
1126begin
1127  if KeyComp('SPAN') Or KeyComp('AUDIO') then begin
1128    Result := tkKey;
1129  end else begin
1130    Result := tkUndefKey;
1131  end;
1132end;
1133
1134function TSynHTMLSyn.Func52: TtkTokenKind;
1135begin
1136  if KeyComp('FORM') Or KeyComp('IFRAME') then begin
1137    Result := tkKey;
1138  end else begin
1139    Result := tkUndefKey;
1140  end;
1141end;
1142
1143function TSynHTMLSyn.Func53: TtkTokenKind;
1144begin
1145  if KeyComp('TRACK') then begin
1146    Result := tkKey;
1147    fSimpleTag := True;
1148  end else
1149  if KeyComp('HTML') Or KeyComp('MENU') Or KeyComp('XMP') then begin
1150    Result := tkKey;
1151  end else begin
1152    Result := tkUndefKey;
1153  end;
1154end;
1155
1156function TSynHTMLSyn.Func55: TtkTokenKind;
1157begin
1158  if KeyComp('FONT') Or KeyComp('OBJECT') Or KeyComp('VIDEO') then begin
1159    Result := tkKey;
1160  end else begin
1161    Result := tkUndefKey;
1162  end;
1163end;
1164
1165function TSynHTMLSyn.Func56: TtkTokenKind;
1166begin
1167  if KeyComp('SUP') then begin
1168    Result := tkKey;
1169  end else begin
1170    Result := tkUndefKey;
1171  end;
1172end;
1173
1174function TSynHTMLSyn.Func57: TtkTokenKind;
1175begin
1176  if KeyComp('SMALL') then begin
1177    Result := tkKey;
1178  end else begin
1179    Result := tkUndefKey;
1180  end;
1181end;
1182
1183function TSynHTMLSyn.Func58: TtkTokenKind;
1184begin
1185  if KeyComp('NOEMBED') then begin
1186    Result := tkKey;
1187  end else begin
1188    Result := tkUndefKey;
1189  end;
1190end;
1191
1192function TSynHTMLSyn.Func60: TtkTokenKind;
1193begin
1194  if KeyComp('CANVAS') then begin
1195    Result := tkKey;
1196  end else begin
1197    Result := tkUndefKey;
1198  end;
1199end;
1200
1201function TSynHTMLSyn.Func61: TtkTokenKind;
1202begin
1203  if KeyComp('LAYER') Or KeyComp('METER') then begin
1204    Result := tkKey;
1205  end else begin
1206    Result := tkUndefKey;
1207  end;
1208end;
1209
1210function TSynHTMLSyn.Func62: TtkTokenKind;
1211begin
1212  if KeyComp('SPACER') then begin
1213    Result := tkKey;
1214    fSimpleTag := True;
1215  end else begin
1216    Result := tkUndefKey;
1217  end;
1218end;
1219
1220function TSynHTMLSyn.Func63: TtkTokenKind;
1221begin
1222  if KeyComp('COMMAND') then begin
1223    Result := tkKey;
1224  end else begin
1225    Result := tkUndefKey;
1226  end;
1227end;
1228
1229function TSynHTMLSyn.Func64: TtkTokenKind;
1230begin
1231  if KeyComp('SELECT') then begin
1232    Result := tkKey;
1233  end else begin
1234    Result := tkUndefKey;
1235  end;
1236end;
1237
1238function TSynHTMLSyn.Func65: TtkTokenKind;
1239begin
1240  if KeyComp('CENTER') then begin
1241    Result := tkKey;
1242  end else begin
1243    Result := tkUndefKey;
1244  end;
1245end;
1246
1247function TSynHTMLSyn.Func66: TtkTokenKind;
1248begin
1249  if KeyComp('TBODY') Or KeyComp('TITLE') Or KeyComp('FIGURE') Or KeyComp('RUBY') then begin
1250    Result := tkKey;
1251  end else begin
1252    Result := tkUndefKey;
1253  end;
1254end;
1255
1256function TSynHTMLSyn.Func67: TtkTokenKind;
1257begin
1258  if KeyComp('KEYGEN') then begin
1259    Result := tkKey;
1260    fSimpleTag := True;
1261  end else begin
1262    Result := tkUndefKey;
1263  end;
1264end;
1265
1266function TSynHTMLSyn.Func68: TtkTokenKind;
1267begin
1268  if KeyComp('ARTICLE') then begin
1269    Result := tkKey;
1270  end else begin
1271    Result := tkUndefKey;
1272  end;
1273end;
1274
1275function TSynHTMLSyn.Func70: TtkTokenKind;
1276begin
1277  if KeyComp('ADDRESS') Or KeyComp('APPLET') Or KeyComp('ILAYER') Or KeyComp('DETAILS') then begin
1278    Result := tkKey;
1279  end else begin
1280    Result := tkUndefKey;
1281  end;
1282end;
1283
1284function TSynHTMLSyn.Func76: TtkTokenKind;
1285begin
1286  if KeyComp('NEXTID') then begin
1287    Result := tkKey;
1288    fSimpleTag := True;
1289  end else
1290  if KeyComp('TFOOT') then begin
1291    Result := tkKey;
1292  end
1293  else begin
1294    Result := tkUndefKey;
1295  end;
1296end;
1297
1298function TSynHTMLSyn.Func78: TtkTokenKind;
1299begin
1300  if KeyComp('CAPTION') then begin
1301    Result := tkKey;
1302  end else begin
1303    Result := tkUndefKey;
1304  end;
1305end;
1306
1307function TSynHTMLSyn.Func79: TtkTokenKind;
1308begin
1309  if KeyComp('FOOTER') then begin
1310    Result := tkKey;
1311  end else begin
1312    Result := tkUndefKey;
1313  end;
1314end;
1315
1316function TSynHTMLSyn.Func80: TtkTokenKind;
1317begin
1318  if KeyComp('INPUT') then  begin
1319    fSimpleTag := True;
1320    Result := tkKey;
1321  end else if KeyComp('FIELDSET') Or KeyComp('MARQUEE') then begin
1322    Result := tkKey;
1323  end else
1324    Result := tkUndefKey;
1325end;
1326
1327function TSynHTMLSyn.Func81: TtkTokenKind;
1328begin
1329  if KeyComp('SOURCE') then begin
1330    Result := tkKey;
1331    fSimpleTag := True;
1332  end else
1333  if KeyComp('STYLE')  then begin
1334    Result := tkKey;
1335  end else begin
1336    Result := tkUndefKey;
1337  end;
1338end;
1339
1340function TSynHTMLSyn.Func82: TtkTokenKind;
1341begin
1342  if KeyComp('BASEFONT') Or KeyComp('BGSOUND') then begin
1343    Result := tkKey;
1344    fSimpleTag := True;
1345  end else if KeyComp('STRIKE') then begin
1346    Result := tkKey;
1347  end else begin
1348    Result := tkUndefKey;
1349  end;
1350end;
1351
1352function TSynHTMLSyn.Func83: TtkTokenKind;
1353begin
1354  if KeyComp('COMMENT') then begin
1355    Result := tkKey;
1356  end else begin
1357    Result := tkUndefKey;
1358  end;
1359end;
1360
1361function TSynHTMLSyn.Func84: TtkTokenKind;
1362begin
1363  if KeyComp('ISINDEX') then begin
1364    Result := tkKey;
1365    fSimpleTag := True;
1366  end else begin
1367    Result := tkUndefKey;
1368  end;
1369end;
1370
1371function TSynHTMLSyn.Func85: TtkTokenKind;
1372begin
1373  if KeyComp('SCRIPT') Or KeyComp('HGROUP') Or KeyComp('SECTION') then begin
1374    Result := tkKey;
1375  end else begin
1376    Result := tkUndefKey;
1377  end;
1378end;
1379
1380function TSynHTMLSyn.Func86: TtkTokenKind;
1381begin
1382  if KeyComp('DATALIST') then begin
1383    Result := tkKey;
1384  end else begin
1385    Result := tkUndefKey;
1386  end;
1387end;
1388
1389function TSynHTMLSyn.Func87: TtkTokenKind;
1390begin
1391  if KeyComp('SERVER') Or KeyComp('FRAMESET') then begin
1392    Result := tkKey;
1393  end else begin
1394    Result := tkUndefKey;
1395  end;
1396end;
1397
1398function TSynHTMLSyn.Func89: TtkTokenKind;
1399begin
1400  if KeyComp('ACRONYM') Or KeyComp('OPTION') then begin
1401    Result := tkKey;
1402  end else begin
1403    Result := tkUndefKey;
1404  end;
1405end;
1406
1407function TSynHTMLSyn.Func90: TtkTokenKind;
1408begin
1409  if KeyComp('LISTING') Or KeyComp('NOLAYER') then begin
1410    Result := tkKey;
1411  end else begin
1412    Result := tkUndefKey;
1413  end;
1414end;
1415
1416function TSynHTMLSyn.Func91: TtkTokenKind;
1417begin
1418  if KeyComp('NOFRAMES') then begin
1419    Result := tkKey;
1420  end else begin
1421    Result := tkUndefKey;
1422  end;
1423end;
1424
1425function TSynHTMLSyn.Func92: TtkTokenKind;
1426begin
1427  if KeyComp('BUTTON') then begin
1428    Result := tkKey;
1429  end else begin
1430    Result := tkUndefKey;
1431  end;
1432end;
1433
1434function TSynHTMLSyn.Func93: TtkTokenKind;
1435begin
1436  if KeyComp('STRONG') then begin
1437    Result := tkKey;
1438  end else begin
1439    Result := tkUndefKey;
1440  end;
1441end;
1442
1443function TSynHTMLSyn.Func94: TtkTokenKind;
1444begin
1445  if KeyComp('TEXTAREA') then begin
1446    Result := tkKey;
1447  end else begin
1448    Result := tkUndefKey;
1449  end;
1450end;
1451
1452function TSynHTMLSyn.Func100: TtkTokenKind;
1453begin
1454  if KeyComp('FIGCAPTION') Or KeyComp('MENUITEM') then begin
1455    Result := tkKey;
1456  end else begin
1457    Result := tkUndefKey;
1458  end;
1459end;
1460
1461function TSynHTMLSyn.Func105: TtkTokenKind;
1462begin
1463  if KeyComp('MULTICOL') then begin
1464    Result := tkKey;
1465  end else begin
1466    Result := tkUndefKey;
1467  end;
1468end;
1469
1470function TSynHTMLSyn.Func107: TtkTokenKind;
1471begin
1472  if KeyComp('COLGROUP') then begin
1473    Result := tkKey;
1474  end else begin
1475    Result := tkUndefKey;
1476  end;
1477end;
1478
1479function TSynHTMLSyn.Func110: TtkTokenKind;
1480begin
1481  if KeyComp('SUMMARY') then begin
1482    Result := tkKey;
1483  end else begin
1484    Result := tkUndefKey;
1485  end;
1486end;
1487
1488function TSynHTMLSyn.Func113: TtkTokenKind;
1489begin
1490  if KeyComp('OUTPUT') then begin
1491    Result := tkKey;
1492  end else begin
1493    Result := tkUndefKey;
1494  end;
1495end;
1496
1497function TSynHTMLSyn.Func114: TtkTokenKind;
1498begin
1499  if KeyComp('NOSCRIPT') then begin
1500    Result := tkKey;
1501  end else begin
1502    Result := tkUndefKey;
1503  end;
1504end;
1505
1506function TSynHTMLSyn.Func117: TtkTokenKind;
1507begin
1508  if KeyComp('PROGRESS') then begin
1509    Result := tkKey;
1510  end else begin
1511    Result := tkUndefKey;
1512  end;
1513end;
1514
1515function TSynHTMLSyn.Func121: TtkTokenKind;
1516begin
1517  if KeyComp('PLAINTEXT') then begin
1518    Result := tkKey;
1519    fSimpleTag := True;
1520  end else
1521  if KeyComp('BLOCKQUOTE') then begin
1522    Result := tkKey;
1523  end else begin
1524    Result := tkUndefKey;
1525  end;
1526end;
1527
1528function TSynHTMLSyn.Func123: TtkTokenKind;
1529begin
1530  if KeyComp('/A') then begin
1531    Result := tkKey;
1532  end else begin
1533    Result := tkUndefKey;
1534  end;
1535end;
1536
1537function TSynHTMLSyn.Func124: TtkTokenKind;
1538begin
1539  if KeyComp('/B') then begin
1540    Result := tkKey;
1541  end else begin
1542    Result := tkUndefKey;
1543  end;
1544end;
1545
1546function TSynHTMLSyn.Func128: TtkTokenKind;
1547begin
1548  if KeyComp('OPTGROUP') then begin
1549    Result := tkKey;
1550  end else begin
1551    Result := tkUndefKey;
1552  end;
1553end;
1554
1555function TSynHTMLSyn.Func130: TtkTokenKind;
1556begin
1557  if KeyComp('/DD') then begin
1558    Result := tkKey;
1559  end else begin
1560    Result := tkUndefKey;
1561  end;
1562end;
1563
1564function TSynHTMLSyn.Func131: TtkTokenKind;
1565begin
1566  if KeyComp('/I') Or KeyComp('/H1') then begin
1567    Result := tkKey;
1568  end else begin
1569    Result := tkUndefKey;
1570  end;
1571end;
1572
1573function TSynHTMLSyn.Func132: TtkTokenKind;
1574begin
1575  if KeyComp('/H2') then begin
1576    Result := tkKey;
1577  end else begin
1578    Result := tkUndefKey;
1579  end;
1580end;
1581
1582function TSynHTMLSyn.Func133: TtkTokenKind;
1583begin
1584  if KeyComp('/H3') then begin
1585    Result := tkKey;
1586  end else begin
1587    Result := tkUndefKey;
1588  end;
1589end;
1590
1591function TSynHTMLSyn.Func134: TtkTokenKind;
1592begin
1593  if KeyComp('/H4') then begin
1594    Result := tkKey;
1595  end else begin
1596    Result := tkUndefKey;
1597  end;
1598end;
1599
1600function TSynHTMLSyn.Func135: TtkTokenKind;
1601begin
1602  if KeyComp('/H5') then begin
1603    Result := tkKey;
1604  end else begin
1605    Result := tkUndefKey;
1606  end;
1607end;
1608
1609function TSynHTMLSyn.Func136: TtkTokenKind;
1610begin
1611  if KeyComp('/H6') then begin
1612    Result := tkKey;
1613  end else begin
1614    Result := tkUndefKey;
1615  end;
1616end;
1617
1618function TSynHTMLSyn.Func137: TtkTokenKind;
1619begin
1620  if KeyComp('/BDI') then begin
1621    Result := tkKey;
1622  end else begin
1623    Result := tkUndefKey;
1624  end;
1625end;
1626
1627function TSynHTMLSyn.Func138: TtkTokenKind;
1628begin
1629  if KeyComp('/DL') Or KeyComp('/P') then begin
1630    Result := tkKey;
1631  end else begin
1632    Result := tkUndefKey;
1633  end;
1634end;
1635
1636function TSynHTMLSyn.Func139: TtkTokenKind;
1637begin
1638  if KeyComp('/KBD') Or KeyComp('/Q') then begin
1639    Result := tkKey;
1640  end else begin
1641    Result := tkUndefKey;
1642  end;
1643end;
1644
1645function TSynHTMLSyn.Func140: TtkTokenKind;
1646begin
1647  if KeyComp('/BIG') Or KeyComp('/EM') Or KeyComp('/HEAD') then begin
1648    Result := tkKey;
1649  end else begin
1650    Result := tkUndefKey;
1651  end;
1652end;
1653
1654function TSynHTMLSyn.Func141: TtkTokenKind;
1655begin
1656  if KeyComp('/S') then begin
1657    Result := tkKey;
1658  end else begin
1659    Result := tkUndefKey;
1660  end;
1661end;
1662
1663function TSynHTMLSyn.Func143: TtkTokenKind;
1664begin
1665  if KeyComp('/DEL') Or KeyComp('/LI') Or KeyComp('/U')  Or KeyComp('/BDO') then begin
1666    Result := tkKey;
1667  end else begin
1668    Result := tkUndefKey;
1669  end;
1670end;
1671
1672function TSynHTMLSyn.Func145: TtkTokenKind;
1673begin
1674  if KeyComp('/ABBR') then begin
1675    Result := tkKey;
1676  end else begin
1677    Result := tkUndefKey;
1678  end;
1679end;
1680
1681function TSynHTMLSyn.Func146: TtkTokenKind;
1682begin
1683  if KeyComp('/DFN') Or KeyComp('/DT') Or KeyComp('/TD') then begin
1684    Result := tkKey;
1685  end else begin
1686    Result := tkUndefKey;
1687  end;
1688end;
1689
1690function TSynHTMLSyn.Func149: TtkTokenKind;
1691begin
1692  if KeyComp('/CODE') Or KeyComp('/OL') then begin
1693    Result := tkKey;
1694  end else begin
1695    Result := tkUndefKey;
1696  end;
1697end;
1698
1699function TSynHTMLSyn.Func150: TtkTokenKind;
1700begin
1701  if KeyComp('/TH') then begin
1702    Result := tkKey;
1703  end else begin
1704    Result := tkUndefKey;
1705  end;
1706end;
1707
1708function TSynHTMLSyn.Func152: TtkTokenKind;
1709begin
1710  if KeyComp('/MAP') then begin
1711    Result := tkKey;
1712  end else begin
1713    Result := tkUndefKey;
1714  end;
1715end;
1716
1717function TSynHTMLSyn.Func153: TtkTokenKind;
1718begin
1719  if KeyComp('/DIR') then begin
1720    Result := tkKey;
1721  end else begin
1722    Result := tkUndefKey;
1723  end;
1724end;
1725
1726function TSynHTMLSyn.Func154: TtkTokenKind;
1727begin
1728  if KeyComp('/LABEL') then begin
1729    Result := tkKey;
1730  end else begin
1731    Result := tkUndefKey;
1732  end;
1733end;
1734
1735function TSynHTMLSyn.Func155: TtkTokenKind;
1736begin
1737  if KeyComp('/UL') then begin
1738    Result := tkKey;
1739  end else begin
1740    Result := tkUndefKey;
1741  end;
1742end;
1743
1744function TSynHTMLSyn.Func156: TtkTokenKind;
1745begin
1746  if KeyComp('/RP') then begin
1747    Result := tkKey;
1748  end else begin
1749    Result := tkUndefKey;
1750  end;
1751end;
1752
1753function TSynHTMLSyn.Func157: TtkTokenKind;
1754begin
1755  if KeyComp('/DIV') then begin
1756    Result := tkKey;
1757  end else begin
1758    Result := tkUndefKey;
1759  end;
1760end;
1761
1762function TSynHTMLSyn.Func159: TtkTokenKind;
1763begin
1764  if KeyComp('/CITE') Or KeyComp('/NAV') Or KeyComp('/MAIN') then begin
1765    Result := tkKey;
1766  end else begin
1767    Result := tkUndefKey;
1768  end;
1769end;
1770
1771function TSynHTMLSyn.Func160: TtkTokenKind;
1772begin
1773  if KeyComp('/THEAD') Or KeyComp('/TR') Or KeyComp('/ASIDE')Or KeyComp('/RT') then begin
1774    Result := tkKey;
1775  end else begin
1776    Result := tkUndefKey;
1777  end;
1778end;
1779
1780function TSynHTMLSyn.Func161: TtkTokenKind;
1781begin
1782  if KeyComp('/PRE') then begin
1783    Result := tkKey;
1784  end else begin
1785    Result := tkUndefKey;
1786  end;
1787end;
1788
1789function TSynHTMLSyn.Func162: TtkTokenKind;
1790begin
1791  if KeyComp('/TABLE') Or KeyComp('/TT') then begin
1792    Result := tkKey;
1793  end else begin
1794    Result := tkUndefKey;
1795  end;
1796end;
1797
1798function TSynHTMLSyn.Func163: TtkTokenKind;
1799begin
1800  if KeyComp('/VAR') Or KeyComp('/HEADER') then begin
1801    Result := tkKey;
1802  end else begin
1803    Result := tkUndefKey;
1804  end;
1805end;
1806
1807function TSynHTMLSyn.Func164: TtkTokenKind;
1808begin
1809  if KeyComp('/INS') Or KeyComp('/SUB') then begin
1810    Result := tkKey;
1811  end else begin
1812    Result := tkUndefKey;
1813  end;
1814end;
1815
1816function TSynHTMLSyn.Func165: TtkTokenKind;
1817begin
1818  if KeyComp('/MARK') then begin
1819    Result := tkKey;
1820  end else begin
1821    Result := tkUndefKey;
1822  end;
1823end;
1824
1825function TSynHTMLSyn.Func168: TtkTokenKind;
1826begin
1827  if KeyComp('/BODY') then begin
1828    Result := tkKey;
1829  end else begin
1830    Result := tkUndefKey;
1831  end;
1832end;
1833
1834function TSynHTMLSyn.Func169: TtkTokenKind;
1835begin
1836  if KeyComp('/LEGEND')Or KeyComp('/TIME') then begin
1837    Result := tkKey;
1838  end else begin
1839    Result := tkUndefKey;
1840  end;
1841end;
1842
1843function TSynHTMLSyn.Func170: TtkTokenKind;
1844begin
1845  if KeyComp('/BLINK') Or KeyComp('/DIALOG') then begin
1846    Result := tkKey;
1847  end else begin
1848    Result := tkUndefKey;
1849  end;
1850end;
1851
1852function TSynHTMLSyn.Func171: TtkTokenKind;
1853begin
1854  if KeyComp('/NOBR') Or KeyComp('/SAMP') then begin
1855    Result := tkKey;
1856  end else begin
1857    Result := tkUndefKey;
1858  end;
1859end;
1860
1861function TSynHTMLSyn.Func172: TtkTokenKind;
1862begin
1863  if KeyComp('/SPAN') Or KeyComp('/AUDIO') then begin
1864    Result := tkKey;
1865  end else begin
1866    Result := tkUndefKey;
1867  end;
1868end;
1869
1870function TSynHTMLSyn.Func174: TtkTokenKind;
1871begin
1872  if KeyComp('/FORM') Or KeyComp('/IFRAME') then begin
1873    Result := tkKey;
1874  end else begin
1875    Result := tkUndefKey;
1876  end;
1877end;
1878
1879function TSynHTMLSyn.Func175: TtkTokenKind;
1880begin
1881  if KeyComp('/TRACK') then begin
1882    Result := tkKey;
1883    fSimpleTag := True;
1884  end else
1885  if KeyComp('/HTML') Or KeyComp('/MENU') Or KeyComp('/XMP') then begin
1886    Result := tkKey;
1887  end else begin
1888    Result := tkUndefKey;
1889  end;
1890end;
1891
1892function TSynHTMLSyn.Func177: TtkTokenKind;
1893begin
1894  if KeyComp('/FONT') Or KeyComp('/OBJECT') Or KeyComp('/VIDEO') then begin
1895    Result := tkKey;
1896  end else begin
1897    Result := tkUndefKey;
1898  end;
1899end;
1900
1901function TSynHTMLSyn.Func178: TtkTokenKind;
1902begin
1903  if KeyComp('/SUP') then begin
1904    Result := tkKey;
1905  end else begin
1906    Result := tkUndefKey;
1907  end;
1908end;
1909
1910function TSynHTMLSyn.Func179: TtkTokenKind;
1911begin
1912  if KeyComp('/SMALL') then begin
1913    Result := tkKey;
1914  end else begin
1915    Result := tkUndefKey;
1916  end;
1917end;
1918
1919function TSynHTMLSyn.Func180: TtkTokenKind;
1920begin
1921  if KeyComp('/NOEMBED') then begin
1922    Result := tkKey;
1923  end else begin
1924    Result := tkUndefKey;
1925  end;
1926end;
1927
1928function TSynHTMLSyn.Func182: TtkTokenKind;
1929begin
1930  if KeyComp('/CANVAS') then begin
1931    Result := tkKey;
1932  end else begin
1933    Result := tkUndefKey;
1934  end;
1935end;
1936
1937function TSynHTMLSyn.Func183: TtkTokenKind;
1938begin
1939  if KeyComp('/LAYER') Or KeyComp('/METER') then begin
1940    Result := tkKey;
1941  end else begin
1942    Result := tkUndefKey;
1943  end;
1944end;
1945
1946function TSynHTMLSyn.Func185: TtkTokenKind;
1947begin
1948  if KeyComp('/COMMAND') then begin
1949    Result := tkKey;
1950  end else begin
1951    Result := tkUndefKey;
1952  end;
1953end;
1954
1955function TSynHTMLSyn.Func186: TtkTokenKind;
1956begin
1957  if KeyComp('/SELECT') then begin
1958    Result := tkKey;
1959  end else begin
1960    Result := tkUndefKey;
1961  end;
1962end;
1963
1964function TSynHTMLSyn.Func187: TtkTokenKind;
1965begin
1966  if KeyComp('/CENTER') then begin
1967    Result := tkKey;
1968  end else begin
1969    Result := tkUndefKey;
1970  end;
1971end;
1972
1973function TSynHTMLSyn.Func188: TtkTokenKind;
1974begin
1975  if KeyComp('/TBODY') Or KeyComp('/TITLE') Or KeyComp('/FIGURE')Or KeyComp('/RUBY') then begin
1976    Result := tkKey;
1977  end else begin
1978    Result := tkUndefKey;
1979  end;
1980end;
1981
1982function TSynHTMLSyn.Func190: TtkTokenKind;
1983begin
1984  if KeyComp('/ARTICLE') then begin
1985    Result := tkKey;
1986  end else begin
1987    Result := tkUndefKey;
1988  end;
1989end;
1990
1991function TSynHTMLSyn.Func192: TtkTokenKind;
1992begin
1993  if KeyComp('/ADDRESS') Or KeyComp('/APPLET') Or KeyComp('/ILAYER') Or KeyComp('/DETAILS') then begin
1994    Result := tkKey;
1995  end else begin
1996    Result := tkUndefKey;
1997  end;
1998end;
1999
2000function TSynHTMLSyn.Func198: TtkTokenKind;
2001begin
2002  if KeyComp('/TFOOT') then begin
2003    Result := tkKey;
2004  end else begin
2005    Result := tkUndefKey;
2006  end;
2007end;
2008
2009function TSynHTMLSyn.Func200: TtkTokenKind;
2010begin
2011  if KeyComp('/CAPTION') then begin
2012    Result := tkKey;
2013  end else begin
2014    Result := tkUndefKey;
2015  end;
2016end;
2017
2018function TSynHTMLSyn.Func201: TtkTokenKind;
2019begin
2020  if KeyComp('/FOOTER') then begin
2021    Result := tkKey;
2022  end else begin
2023    Result := tkUndefKey;
2024  end;
2025end;
2026
2027function TSynHTMLSyn.Func202: TtkTokenKind;
2028begin
2029  if KeyComp('/FIELDSET') Or KeyComp('/MARQUEE') then begin
2030    Result := tkKey;
2031  end else begin
2032    Result := tkUndefKey;
2033  end;
2034end;
2035
2036function TSynHTMLSyn.Func203: TtkTokenKind;
2037begin
2038  if KeyComp('/SOURCE') then begin
2039    Result := tkKey;
2040    fSimpleTag := True;
2041  end else
2042  if KeyComp('/STYLE') then begin
2043    Result := tkKey;
2044  end else begin
2045    Result := tkUndefKey;
2046  end;
2047end;
2048
2049function TSynHTMLSyn.Func204: TtkTokenKind;
2050begin
2051  if KeyComp('/STRIKE') then begin
2052    Result := tkKey;
2053  end else begin
2054    Result := tkUndefKey;
2055  end;
2056end;
2057
2058function TSynHTMLSyn.Func205: TtkTokenKind;
2059begin
2060  if KeyComp('/COMMENT') then begin
2061    Result := tkKey;
2062  end else begin
2063    Result := tkUndefKey;
2064  end;
2065end;
2066
2067function TSynHTMLSyn.Func207: TtkTokenKind;
2068begin
2069  if KeyComp('/SCRIPT') Or KeyComp('/HGROUP') Or KeyComp('/SECTION') then begin
2070    Result := tkKey;
2071  end else begin
2072    Result := tkUndefKey;
2073  end;
2074end;
2075
2076function TSynHTMLSyn.Func208: TtkTokenKind;
2077begin
2078  if KeyComp('/DATALIST') then begin
2079    Result := tkKey;
2080  end else begin
2081    Result := tkUndefKey;
2082  end;
2083end;
2084
2085function TSynHTMLSyn.Func209: TtkTokenKind;
2086begin
2087  if KeyComp('/FRAMESET') Or KeyComp('/SERVER') then begin
2088    Result := tkKey;
2089  end else begin
2090    Result := tkUndefKey;
2091  end;
2092end;
2093
2094function TSynHTMLSyn.Func211: TtkTokenKind;
2095begin
2096  if KeyComp('/ACRONYM') Or KeyComp('/OPTION') Or KeyComp('!DOCTYPE') then begin
2097    Result := tkKey;
2098  end else begin
2099    Result := tkUndefKey;
2100  end;
2101end;
2102
2103function TSynHTMLSyn.Func212: TtkTokenKind;
2104begin
2105  if KeyComp('/LISTING') Or KeyComp('/NOLAYER') then begin
2106    Result := tkKey;
2107  end else begin
2108    Result := tkUndefKey;
2109  end;
2110end;
2111
2112function TSynHTMLSyn.Func213: TtkTokenKind;
2113begin
2114  if KeyComp('/NOFRAMES') then begin
2115    Result := tkKey;
2116  end else begin
2117    Result := tkUndefKey;
2118  end;
2119end;
2120
2121function TSynHTMLSyn.Func214: TtkTokenKind;
2122begin
2123  if KeyComp('/BUTTON') then begin
2124    Result := tkKey;
2125  end else begin
2126    Result := tkUndefKey;
2127  end;
2128end;
2129
2130function TSynHTMLSyn.Func215: TtkTokenKind;
2131begin
2132  if KeyComp('/STRONG') then begin
2133    Result := tkKey;
2134  end else begin
2135    Result := tkUndefKey;
2136  end;
2137end;
2138
2139function TSynHTMLSyn.Func216: TtkTokenKind;
2140begin
2141  if KeyComp('/TEXTAREA') then begin
2142    Result := tkKey;
2143  end else begin
2144    Result := tkUndefKey;
2145  end;
2146end;
2147
2148function TSynHTMLSyn.Func222: TtkTokenKind;
2149begin
2150  if KeyComp('/FIGCAPTION') Or KeyComp('/MENUITEM') then begin
2151    Result := tkKey;
2152  end else begin
2153    Result := tkUndefKey;
2154  end;
2155end;
2156
2157function TSynHTMLSyn.Func227: TtkTokenKind;
2158begin
2159  if KeyComp('/MULTICOL') then begin
2160    Result := tkKey;
2161  end else begin
2162    Result := tkUndefKey;
2163  end;
2164end;
2165
2166function TSynHTMLSyn.Func229: TtkTokenKind;
2167begin
2168  if KeyComp('/COLGROUP') then begin
2169    Result := tkKey;
2170  end else begin
2171    Result := tkUndefKey;
2172  end;
2173end;
2174
2175function TSynHTMLSyn.Func232: TtkTokenKind;
2176begin
2177  if KeyComp('/SUMMARY') then begin
2178    Result := tkKey;
2179  end else begin
2180    Result := tkUndefKey;
2181  end;
2182end;
2183
2184function TSynHTMLSyn.Func235: TtkTokenKind;
2185begin
2186  if KeyComp('/OUTPUT') then begin
2187    Result := tkKey;
2188  end else begin
2189    Result := tkUndefKey;
2190  end;
2191end;
2192
2193function TSynHTMLSyn.Func236: TtkTokenKind;
2194begin
2195  if KeyComp('/NOSCRIPT') then begin
2196    Result := tkKey;
2197  end else begin
2198    Result := tkUndefKey;
2199  end;
2200end;
2201
2202function TSynHTMLSyn.Func239: TtkTokenKind;
2203begin
2204  if KeyComp('/PROGRESS') then begin
2205    Result := tkKey;
2206  end else begin
2207    Result := tkUndefKey;
2208  end;
2209end;
2210
2211function TSynHTMLSyn.Func243: TtkTokenKind;
2212begin
2213  if KeyComp('/BLOCKQUOTE') then begin
2214    Result := tkKey;
2215  end else begin
2216    Result := tkUndefKey;
2217  end;
2218end;
2219
2220function TSynHTMLSyn.Func250: TtkTokenKind;
2221begin
2222  if KeyComp('/OPTGROUP') then begin
2223    Result := tkKey;
2224  end else begin
2225    Result := tkUndefKey;
2226  end;
2227end;
2228
2229function TSynHTMLSyn.AltFunc: TtkTokenKind;
2230begin
2231  Result := tkUndefKey;
2232end;
2233
2234procedure TSynHTMLSyn.MakeMethodTables;
2235var
2236  i: Char;
2237begin
2238  For i:=#0 To #255 do begin
2239    case i of
2240    #0:
2241      begin
2242        fProcTable[i] := @NullProc;
2243      end;
2244    #10:
2245      begin
2246        fProcTable[i] := @LFProc;
2247      end;
2248    #13:
2249      begin
2250        fProcTable[i] := @CRProc;
2251      end;
2252    #1..#9, #11, #12, #14..#32:
2253      begin
2254        fProcTable[i] := @SpaceProc;
2255      end;
2256    '&':
2257      begin
2258        fProcTable[i] := @AmpersandProc;
2259      end;
2260    '"':
2261      begin
2262        fProcTable[i] := @StringProc;
2263      end;
2264    '<':
2265      begin
2266        fProcTable[i] := @BraceOpenProc;
2267      end;
2268    '>':
2269      begin
2270        fProcTable[i] := @BraceCloseProc;
2271      end;
2272    '=':
2273      begin
2274        fProcTable[i] := @EqualProc;
2275      end;
2276    else
2277      fProcTable[i] := @IdentProc;
2278    end;
2279  end;
2280end;
2281
2282constructor TSynHTMLSyn.Create(AOwner: TComponent);
2283begin
2284  inherited Create(AOwner);
2285  FMode := shmHtml;
2286
2287  fASPAttri := TSynHighlighterAttributes.Create(@SYNS_AttrASP, SYNS_XML_AttrASP);
2288  fASPAttri.Foreground := clBlack;
2289  fASPAttri.Background := clYellow;
2290  AddAttribute(fASPAttri);
2291
2292  fCDATAAttri := TSynHighlighterAttributes.Create(@SYNS_AttrCDATA, SYNS_XML_AttrCDATA);
2293  fCDATAAttri.Foreground := clGreen;
2294  AddAttribute(fCDATAAttri);
2295
2296  fDOCTYPEAttri := TSynHighlighterAttributes.Create(@SYNS_AttrDOCTYPE, SYNS_XML_AttrDOCTYPE);
2297  fDOCTYPEAttri.Foreground := clBlack;
2298  fDOCTYPEAttri.Background := clYellow;
2299  fDOCTYPEAttri.Style := [fsBold];
2300  AddAttribute(fDOCTYPEAttri);
2301
2302  fCommentAttri := TSynHighlighterAttributes.Create(@SYNS_AttrComment, SYNS_XML_AttrComment);
2303  AddAttribute(fCommentAttri);
2304
2305  fIdentifierAttri := TSynHighlighterAttributes.Create(@SYNS_AttrIdentifier, SYNS_XML_AttrIdentifier);
2306  fIdentifierAttri.Style := [fsBold];
2307  AddAttribute(fIdentifierAttri);
2308
2309  fKeyAttri := TSynHighlighterAttributes.Create(@SYNS_AttrReservedWord, SYNS_XML_AttrReservedWord);
2310  fKeyAttri.Style := [fsBold];
2311  fKeyAttri.Foreground := $00ff0080;
2312  AddAttribute(fKeyAttri);
2313
2314  fSpaceAttri := TSynHighlighterAttributes.Create(@SYNS_AttrSpace, SYNS_XML_AttrSpace);
2315  AddAttribute(fSpaceAttri);
2316
2317  fSymbolAttri := TSynHighlighterAttributes.Create(@SYNS_AttrSymbol, SYNS_XML_AttrSymbol);
2318  fSymbolAttri.Style := [fsBold];
2319  AddAttribute(fSymbolAttri);
2320
2321  fTextAttri := TSynHighlighterAttributes.Create(@SYNS_AttrText, SYNS_XML_AttrText);
2322  AddAttribute(fTextAttri);
2323
2324  fUndefKeyAttri := TSynHighlighterAttributes.Create(@SYNS_AttrUnknownWord, SYNS_XML_AttrUnknownWord);
2325  fUndefKeyAttri.Style := [fsBold];
2326  fUndefKeyAttri.Foreground := clRed;
2327  AddAttribute(fUndefKeyAttri);
2328
2329  fValueAttri := TSynHighlighterAttributes.Create(@SYNS_AttrValue, SYNS_XML_AttrValue);
2330  fValueAttri.Foreground := $00ff8000;
2331  AddAttribute(fValueAttri);
2332
2333  fAndAttri := TSynHighlighterAttributes.Create(@SYNS_AttrEscapeAmpersand, SYNS_XML_AttrEscapeAmpersand);
2334  fAndAttri.Style := [fsBold];
2335  fAndAttri.Foreground := $0000ff00;
2336  AddAttribute(fAndAttri);
2337  SetAttributesOnChange(@DefHighlightChange);
2338
2339  InitIdent;
2340  MakeMethodTables;
2341  fRange := rsText;
2342  fDefaultFilter := SYNS_FilterHTML;
2343end;
2344
2345procedure TSynHTMLSyn.SetLine(const NewValue: string; LineNumber:Integer);
2346begin
2347  inherited;
2348  fLine := PChar(NewValue);
2349  Run := 0;
2350  fLineNumber := LineNumber;
2351  Next;
2352end;
2353
2354procedure TSynHTMLSyn.ASPProc;
2355begin
2356  fTokenID := tkASP;
2357  if (fLine[Run] In [#0, #10, #13]) then begin
2358    fProcTable[fLine[Run]];
2359    Exit;
2360  end;
2361
2362  while not (fLine[Run] in [#0, #10, #13]) do begin
2363    if (fLine[Run] = '>') and (fLine[Run - 1] = '%')
2364    then begin
2365      fRange := rsText;
2366      Inc(Run);
2367      if TopHtmlCodeFoldBlockType = cfbtHtmlAsp then
2368        EndHtmlNodeCodeFoldBlock;
2369      break;
2370    end;
2371    Inc(Run);
2372  end;
2373end;
2374
2375procedure TSynHTMLSyn.CDATAProc;
2376begin
2377  fTokenID := tkCDATA;
2378  if (fLine[Run] In [#0, #10, #13]) then begin
2379    fProcTable[fLine[Run]];
2380    Exit;
2381  end;
2382
2383  while not (fLine[Run] in [#0, #10, #13]) do begin
2384    if (fLine[Run] = '>') and (fLine[Run - 1] = ']') and (fLine[Run - 2] = ']')
2385    then begin
2386      fRange := rsText;
2387      Inc(Run);
2388      if TopHtmlCodeFoldBlockType = cfbtHtmlCDATA then
2389        EndHtmlNodeCodeFoldBlock;
2390      break;
2391    end;
2392    Inc(Run);
2393  end;
2394end;
2395
2396procedure TSynHTMLSyn.DOCTYPEProc;
2397begin
2398  fTokenID := tkDOCTYPE;
2399  if (fLine[Run] In [#0, #10, #13]) then begin
2400    fProcTable[fLine[Run]];
2401    Exit;
2402  end;
2403
2404  while not (fLine[Run] in [#0, #10, #13]) do begin
2405    if (fLine[Run] = '>')
2406    then begin
2407      fRange := rsText;
2408      Inc(Run);
2409      //if TopHtmlCodeFoldBlockType = cfbtHtmlCDATA then
2410       // EndHtmlNodeCodeFoldBlock;
2411      break;
2412    end;
2413    Inc(Run);
2414  end;
2415end;
2416
2417procedure TSynHTMLSyn.SetMode(const AValue: TSynHTMLSynMode);
2418begin
2419  if FMode = AValue then exit;
2420  FMode := AValue;
2421  FAttributeChangeNeedScan := True;
2422  DefHighlightChange(self);
2423end;
2424
2425procedure TSynHTMLSyn.BraceCloseProc;
2426begin
2427  fRange := rsText;
2428  fTokenId := tkSymbol;
2429  if ((FMode = shmXHtml) or (not fSimpleTag)) and (Run > 0) and (fLine[Run - 1] = '/') then
2430    EndHtmlNodeCodeFoldBlock(Run + 1, '')
2431  else
2432    fSimpleTag := False;
2433  Inc(Run);
2434end;
2435
2436procedure TSynHTMLSyn.CommentProc;
2437begin
2438  fTokenID := tkComment;
2439
2440  if (fLine[Run] In [#0, #10, #13]) then begin
2441    fProcTable[fLine[Run]];
2442    Exit;
2443  end;
2444
2445  while not (fLine[Run] in [#0, #10, #13]) do begin
2446    if (fLine[Run] = '>') and (fLine[Run - 1] = '-') and (fLine[Run - 2] = '-')
2447    then begin
2448      fRange := rsText;
2449      Inc(Run);
2450      if TopHtmlCodeFoldBlockType = cfbtHtmlComment then
2451        EndHtmlNodeCodeFoldBlock;
2452      break;
2453    end;
2454    Inc(Run);
2455  end;
2456end;
2457
2458procedure TSynHTMLSyn.BraceOpenProc;
2459begin
2460  fSimpleTag := False;
2461  Inc(Run);
2462  if (Run <= length(fLine)-2) and (fLine[Run] = '!') and (fLine[Run + 1] = '-') and (fLine[Run + 2] = '-')
2463  then begin
2464    fRange := rsComment;
2465    fTokenID := tkComment;
2466    StartHtmlCodeFoldBlock(cfbtHtmlComment);
2467    Inc(Run, 3);
2468  end
2469  else if (Run <= length(fLine)-7) and (fLine[Run] = '!') and (fLine[Run + 1] = '[')
2470  and (fLine[Run + 2] = 'C') and (fLine[Run + 3] = 'D') and (fLine[Run + 4] = 'A')
2471  and (fLine[Run + 5] = 'T') and (fLine[Run + 6] = 'A') and (fLine[Run + 7] = '[') then begin
2472    fRange := rsCDATA;
2473    fTokenID := tkCDATA;
2474    StartHtmlCodeFoldBlock(cfbtHtmlCDATA);
2475    Inc(Run);
2476  end
2477  else if fLine[Run]= '%' then begin
2478    fRange := rsASP;
2479    fTokenID := tkASP;
2480    StartHtmlCodeFoldBlock(cfbtHtmlAsp);
2481    Inc(Run);
2482  end
2483  else if (Run <= length(fLine)-7) and (fLine[Run] = '!') and (upcase(fLine[Run + 1]) = 'D')
2484  and (upcase(fLine[Run + 2]) = 'O') and (upcase(fLine[Run + 3]) = 'C') and (upcase(fLine[Run + 4]) = 'T')
2485  and (upcase(fLine[Run + 5]) = 'Y') and (upcase(fLine[Run + 6]) = 'P') and (upcase(fLine[Run + 7]) = 'E') then
2486  begin
2487    fRange := rsDOCTYPE;
2488    fTokenID := tkDOCTYPE;
2489    //StartHtmlCodeFoldBlock(cfbtHtmlDOCTYPE);
2490    Inc(Run);
2491  end else
2492  begin
2493    fRange := rsKey;
2494    fTokenID := tkSymbol;
2495  end;
2496end;
2497
2498procedure TSynHTMLSyn.CRProc;
2499begin
2500  fTokenID := tkSpace;
2501  Inc(Run);
2502  if fLine[Run] = #10 then Inc(Run);
2503end;
2504
2505procedure TSynHTMLSyn.EqualProc;
2506begin
2507  fRange := rsValue;
2508  fTokenID := tkSymbol;
2509  Inc(Run);
2510end;
2511
2512function TSynHTMLSyn.IdentKind(MayBe: PChar): TtkTokenKind;
2513var
2514  hashKey: Integer;
2515begin
2516  fToIdent := MayBe;
2517  hashKey := KeyHash(MayBe);
2518  if (hashKey <= 255) then begin
2519    Result := fIdentFuncTable[hashKey]();
2520  end else begin
2521    Result := tkIdentifier;
2522  end;
2523end;
2524
2525procedure TSynHTMLSyn.IdentProc;
2526var
2527  R: LongInt;
2528begin
2529  case fRange of
2530  rsKey:
2531    begin
2532      fRange := rsParam;
2533      fTokenID := IdentKind((fLine + Run));
2534      R := Run;
2535      Inc(Run, fStringLen);
2536      if ((FMode = shmXHtml) or (not fSimpleTag)) then
2537        if fLine[R] = '/' then
2538          EndHtmlNodeCodeFoldBlock(R+1, copy(fline, R+2, fStringLen-1))
2539        else if fLine[R] <> '!' then
2540          StartHtmlNodeCodeFoldBlock(cfbtHtmlNode, R, copy(fline, R+1, fStringLen));
2541    end;
2542  rsValue:
2543    begin
2544      fRange := rsParam;
2545      fTokenID := tkValue;
2546      repeat
2547        Inc(Run);
2548      until (fLine[Run] In [#0..#32, '>']);
2549    end;
2550  else
2551    fTokenID := tkIdentifier;
2552    repeat
2553      Inc(Run);
2554    until (fLine[Run] In [#0..#32, '=', '"', '>']);
2555  end;
2556end;
2557
2558procedure TSynHTMLSyn.LFProc;
2559begin
2560  fTokenID := tkSpace;
2561  Inc(Run);
2562end;
2563
2564procedure TSynHTMLSyn.NullProc;
2565begin
2566  fTokenID := tkNull;
2567end;
2568
2569procedure TSynHTMLSyn.TextProc;
2570const StopSet = [#0..#31, '<', '&'];
2571var
2572  i: Integer;
2573begin
2574  if fLine[Run] in (StopSet - ['&']) then begin
2575    fProcTable[fLine[Run]];
2576    exit;
2577  end;
2578
2579  fTokenID := tkText;
2580  While True do begin
2581    while not (fLine[Run] in StopSet) do Inc(Run);
2582
2583    if (fLine[Run] = '&') then begin
2584      For i:=Low(EscapeAmps) To High(EscapeAmps) do begin
2585        if (StrLIComp((fLine + Run), PChar(EscapeAmps[i]), StrLen(EscapeAmps[i])) = 0) then begin
2586          fAndCode := i;
2587          fRange := rsAmpersand;
2588          Exit;
2589        end;
2590      end;
2591
2592      Inc(Run);
2593    end else begin
2594      Break;
2595    end;
2596  end;
2597
2598end;
2599
2600procedure TSynHTMLSyn.AmpersandProc;
2601begin
2602  case fAndCode of
2603  Low(EscapeAmps)..High(EscapeAmps):
2604    begin
2605      fTokenID := tkAmpersand;
2606      Inc(Run, StrLen(EscapeAmps[fAndCode]));
2607    end;
2608  end;
2609  fAndCode := -1;
2610  fRange := rsText;
2611end;
2612
2613procedure TSynHTMLSyn.SpaceProc;
2614begin
2615  Inc(Run);
2616  fTokenID := tkSpace;
2617  while fLine[Run] <= #32 do begin
2618    if fLine[Run] in [#0, #9, #10, #13] then break;
2619    Inc(Run);
2620  end;
2621end;
2622
2623procedure TSynHTMLSyn.StringProc;
2624begin
2625  if (fRange = rsValue) then begin
2626    fRange := rsParam;
2627    fTokenID := tkValue;
2628  end else begin
2629    fTokenID := tkString;
2630  end;
2631  Inc(Run);  // first '"'
2632  while not (fLine[Run] in [#0, #10, #13, '"']) do Inc(Run);
2633  if fLine[Run] = '"' then Inc(Run);  // last '"'
2634end;
2635
2636procedure TSynHTMLSyn.Next;
2637begin
2638  fTokenPos := Run;
2639  case fRange of
2640  rsText:
2641    begin
2642      TextProc;
2643    end;
2644  rsComment:
2645    begin
2646      CommentProc;
2647    end;
2648  rsASP:
2649    begin
2650      ASPProc;
2651    end;
2652  rsCDATA:
2653    begin
2654      CDATAProc;
2655    end;
2656  rsDOCTYPE:
2657    begin
2658      DOCTYPEProc;
2659    end;
2660  else
2661    fProcTable[fLine[Run]];
2662  end;
2663end;
2664
2665function TSynHTMLSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
2666begin
2667  case Index of
2668    SYN_ATTR_COMMENT: Result := fCommentAttri;
2669    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
2670    SYN_ATTR_KEYWORD: Result := fKeyAttri;
2671    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
2672    else Result := nil;
2673  end;
2674end;
2675
2676function TSynHTMLSyn.GetEol: Boolean;
2677begin
2678  Result := fTokenId = tkNull;
2679end;
2680
2681function TSynHTMLSyn.GetToken: string;
2682var
2683  len: Longint;
2684begin
2685  Result := '';
2686  Len := (Run - fTokenPos);
2687  SetString(Result, (FLine + fTokenPos), len);
2688end;
2689
2690procedure TSynHTMLSyn.GetTokenEx(out TokenStart: PChar;
2691  out TokenLength: integer);
2692begin
2693  TokenLength:=Run-fTokenPos;
2694  TokenStart:=FLine + fTokenPos;
2695end;
2696
2697function TSynHTMLSyn.GetTokenID: TtkTokenKind;
2698begin
2699  Result := fTokenId;
2700end;
2701
2702function TSynHTMLSyn.GetTokenAttribute: TSynHighlighterAttributes;
2703begin
2704  case fTokenID of
2705    tkAmpersand: Result := fAndAttri;
2706    tkASP: Result := fASPAttri;
2707    tkCDATA: Result := fCDATAAttri;
2708    tkDOCTYPE: Result := fDOCTYPEAttri;
2709    tkComment: Result := fCommentAttri;
2710    tkIdentifier: Result := fIdentifierAttri;
2711    tkKey: Result := fKeyAttri;
2712    tkSpace: Result := fSpaceAttri;
2713    tkString: Result := fValueAttri;
2714    tkSymbol: Result := fSymbolAttri;
2715    tkText: Result := fTextAttri;
2716    tkUndefKey: Result := fUndefKeyAttri;
2717    tkValue: Result := fValueAttri;
2718    else Result := nil;
2719  end;
2720end;
2721
2722function TSynHTMLSyn.GetTokenKind: integer;
2723begin
2724  Result := Ord(fTokenId);
2725end;
2726
2727function TSynHTMLSyn.GetTokenPos: Integer;
2728begin
2729  Result := fTokenPos;
2730end;
2731
2732function TSynHTMLSyn.GetRange: Pointer;
2733begin
2734  CodeFoldRange.RangeType:=Pointer(PtrUInt(Integer(fRange)));
2735  Result := inherited;
2736end;
2737
2738procedure TSynHTMLSyn.SetRange(Value: Pointer);
2739begin
2740  inherited;
2741  fRange := TRangeState(Integer(PtrUInt(CodeFoldRange.RangeType)));
2742end;
2743
2744procedure TSynHTMLSyn.ReSetRange;
2745begin
2746  inherited;
2747  fRange:= rsText;
2748end;
2749
2750function TSynHTMLSyn.GetIdentChars: TSynIdentChars;
2751begin
2752  Result := ['0'..'9', 'a'..'z', 'A'..'Z'];
2753end;
2754
2755procedure TSynHTMLSyn.CreateRootCodeFoldBlock;
2756begin
2757  inherited CreateRootCodeFoldBlock;
2758  RootCodeFoldBlock.InitRootBlockType(Pointer(PtrInt(cfbtHtmlNone)));
2759end;
2760
2761function TSynHTMLSyn.GetFoldConfigInstance(Index: Integer): TSynCustomFoldConfig;
2762begin
2763  Result := inherited GetFoldConfigInstance(Index);
2764  Result.Enabled := True;
2765  if THtmlCodeFoldBlockType(Index) in [cfbtHtmlNode] then begin
2766    Result.SupportedModes := Result.SupportedModes + [fmMarkup];
2767    Result.Modes := Result.Modes + [fmMarkup];
2768  end;
2769end;
2770
2771function TSynHTMLSyn.StartHtmlCodeFoldBlock(ABlockType: THtmlCodeFoldBlockType): TSynCustomCodeFoldBlock;
2772begin
2773  Result := inherited StartXmlCodeFoldBlock(ord(ABlockType));
2774end;
2775
2776function TSynHTMLSyn.StartHtmlNodeCodeFoldBlock(ABlockType: THtmlCodeFoldBlockType;
2777  OpenPos: Integer; AName: String): TSynCustomCodeFoldBlock;
2778begin
2779  if not FFoldConfig[ord(cfbtHtmlNode)].Enabled then exit(nil);
2780  Result := inherited StartXmlNodeCodeFoldBlock(ord(ABlockType), OpenPos, AName);
2781end;
2782
2783procedure TSynHTMLSyn.EndHtmlNodeCodeFoldBlock(ClosePos: Integer; AName: String);
2784begin
2785  if not FFoldConfig[ord(cfbtHtmlNode)].Enabled then exit;
2786  inherited EndXmlNodeCodeFoldBlock(ClosePos, AName);
2787end;
2788
2789function TSynHTMLSyn.TopHtmlCodeFoldBlockType(DownIndex: Integer): THtmlCodeFoldBlockType;
2790begin
2791  Result := THtmlCodeFoldBlockType(PtrUInt(TopCodeFoldBlockType(DownIndex)));
2792end;
2793
2794function TSynHTMLSyn.GetFoldConfigCount: Integer;
2795begin
2796  // excluded cfbtHtmlNone;
2797  Result := ord(high(THtmlCodeFoldBlockType)) - ord(low(THtmlCodeFoldBlockType));
2798end;
2799
2800function TSynHTMLSyn.GetFoldConfigInternalCount: Integer;
2801begin
2802  // include cfbtHtmlNone;
2803  Result := ord(high(THtmlCodeFoldBlockType)) - ord(low(THtmlCodeFoldBlockType)) + 1;
2804end;
2805
2806class function TSynHTMLSyn.GetLanguageName: string;
2807begin
2808  Result := SYNS_LangHTML;
2809end;
2810
2811initialization
2812  MakeIdentTable;
2813  RegisterPlaceableHighlighter(TSynHTMLSyn);
2814
2815end.
2816