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