home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue29 / s3demo / S3DEMO.ZIP / Scripts.ZIP / HTMLScript.txt < prev    next >
Encoding:
Text File  |  1997-11-06  |  26.6 KB  |  538 lines

  1. /*
  2.  * TSyntaxMemoParser Script
  3.  * ------------------------
  4.  *
  5.  * Author  :          David Brock
  6.  * Date    :          October 18 1997
  7.  * Language:          HTML
  8.  */
  9.  
  10. //--------------------------------------------------------------------------------------------------------------------
  11. //
  12. //
  13. //
  14. // Macro definitions. Parameters may be specified and the replacement text terminates with the end of
  15. // line (watch trailing blanks).
  16. //
  17. #define ht_DEFAULT                   0
  18. #define ht_TAGNAME                   20
  19. #define ht_UNKNOWN                   21
  20. #define ht_TAGSTART                  22
  21. #define ht_TAGEND                    23
  22. #define ht_COMMENT                   24
  23. #define ht_WHITESPACE                25
  24. #define ht_IDENTIFIER                26
  25. #define ht_STRING                    27
  26. #define ht_MISC                      28
  27. #define ht_FIELDNAME                 29
  28. #define ht_NUMBER                    30
  29. #define ht_WEBURL                    31
  30. #define ht_MAILURL                   32
  31.  
  32. #define ht_TAGNAME_A                 100
  33. #define ht_TAGNAME_ADDRESS           101
  34. #define ht_TAGNAME_APPLET            102
  35. #define ht_TAGNAME_B                 103
  36. #define ht_TAGNAME_BASEFONT          104
  37. #define ht_TAGNAME_BLINK             105
  38. #define ht_TAGNAME_BIG               106
  39. #define ht_TAGNAME_BLOCKQUOTE        107
  40. #define ht_TAGNAME_BODY              108
  41. #define ht_TAGNAME_BR                109
  42. #define ht_TAGNAME_CAPTION           110
  43. #define ht_TAGNAME_CENTER            111
  44. #define ht_TAGNAME_CITE              112
  45. #define ht_TAGNAME_CODE              113
  46. #define ht_TAGNAME_DD                114
  47. #define ht_TAGNAME_DIR               115
  48. #define ht_TAGNAME_DIV               116
  49. #define ht_TAGNAME_DL                117
  50. #define ht_TAGNAME_DOCTYPE           118
  51. #define ht_TAGNAME_DT                119
  52. #define ht_TAGNAME_EM                120
  53. #define ht_TAGNAME_EMBED             121
  54. #define ht_TAGNAME_FONT              122
  55. #define ht_TAGNAME_FORM              123
  56. #define ht_TAGNAME_FRAME             124
  57. #define ht_TAGNAME_FRAMESET          125
  58. #define ht_TAGNAME_H                 126
  59. #define ht_TAGNAME_H1                127
  60. #define ht_TAGNAME_H2                128
  61. #define ht_TAGNAME_H3                129
  62. #define ht_TAGNAME_H4                130
  63. #define ht_TAGNAME_H5                131
  64. #define ht_TAGNAME_H6                132
  65. #define ht_TAGNAME_HEAD              133
  66. #define ht_TAGNAME_HR                134
  67. #define ht_TAGNAME_HTML              135
  68. #define ht_TAGNAME_I                 136
  69. #define ht_TAGNAME_IMAGE             137
  70. #define ht_TAGNAME_INPUT             138
  71. #define ht_TAGNAME_ISINDEX           139
  72. #define ht_TAGNAME_KBD               140
  73. #define ht_TAGNAME_LI                141
  74. #define ht_TAGNAME_LINK              142
  75. #define ht_TAGNAME_MARK              143
  76. #define ht_TAGNAME_MARQUEE           144
  77. #define ht_TAGNAME_MENU              145
  78. #define ht_TAGNAME_META              146
  79. #define ht_TAGNAME_NEXTID            147
  80. #define ht_TAGNAME_NOBR              148
  81. #define ht_TAGNAME_NOFRAMES          149
  82. #define ht_TAGNAME_OL                150
  83. #define ht_TAGNAME_OPTION            151
  84. #define ht_TAGNAME_P                 152
  85. #define ht_TAGNAME_PRE               153
  86. #define ht_TAGNAME_SAMP              154
  87. #define ht_TAGNAME_SCRIPT            155
  88. #define ht_TAGNAME_SELECT            156
  89. #define ht_TAGNAME_SMALL             157
  90. #define ht_TAGNAME_SOUND             158
  91. #define ht_TAGNAME_STRIKE            159
  92. #define ht_TAGNAME_STRONG            160
  93. #define ht_TAGNAME_SUB               161
  94. #define ht_TAGNAME_SUP               162
  95. #define ht_TAGNAME_TABLE             163
  96. #define ht_TAGNAME_TD                164
  97. #define ht_TAGNAME_TEXTAREA          165
  98. #define ht_TAGNAME_TH                166
  99. #define ht_TAGNAME_TITLE             167
  100. #define ht_TAGNAME_TR                168
  101. #define ht_TAGNAME_TT                169
  102. #define ht_TAGNAME_U                 170
  103. #define ht_TAGNAME_UL                171
  104. #define ht_TAGNAME_VAR               172
  105. #define ht_TAGNAME_WBR               173
  106.  
  107.  
  108. #define _non_alpha_                 '[^_A-Za-z0-9]'
  109. #define _all_chars_                 '[\x00-\xFF]'
  110. #define _no_chars_                  '[]'
  111. #define _dont_care_                 _all_chars_
  112. #define _DEFAULT_BACKGROUND         clWhite
  113. #define _DEFAULT_FOREGROUND         clBlack
  114.  
  115.  
  116.  
  117. /******************************************************************************
  118.  *
  119.  * HTML requires states within the parser to cope with scripts and text
  120.  * outwith tags:
  121.  *   ss_START             Start state
  122.  *   ss_INTAG             Within <...........> section
  123.  * Specifically -- parsing is performed in the ss_INTAG state. In the
  124.  * ss_START state only tag/comment starts are recognised, everything
  125.  * else is ignored and treated as plain text (i.e. default).
  126.  *
  127.  *****************************************************************************
  128.  */
  129. #define ss_START                    0
  130. #define ss_INTAG                    1
  131. #define ss_STRING                   2
  132.  
  133. //--------------------------------------------------------------------------------------------------------------------
  134. //
  135. // %%language section
  136. //
  137. // Header section. Describes the textual name of the language, case sensitivity and options used by the language.
  138. //
  139. %%language
  140. Name                      = 'HTML'
  141. Case                      = __INSENSITIVE
  142. Options                   = __DEFAULT_OPTIONS
  143. WordWrapColumn            = _EDGE
  144. Gutter                    = _DEFAULT_GUTTER
  145. Anchor                    = ht_TAGSTART
  146. ExampleText               = '<!-- Syntax Highlighting -->\n\
  147.                             \<HTML>\n\
  148.                             \<HEAD><TITLE>New Page</TITLE></HEAD>\n\
  149.                             \<BODY>\n\
  150.                             \Plain HTML body text\n\
  151.                             \</BODY>\n\
  152.                             \</HTML>\n'
  153.  
  154. EditableStyles              ('Comment',       ht_COMMENT),
  155.                             ('String',        ht_STRING),
  156.                             ('Tag name',      ht_TAGNAME),
  157.                             ('Field name',    ht_FIELDNAME),
  158.                             ('Identifier',    ht_IDENTIFIER),
  159.                             ('Number',        ht_NUMBER),
  160.                             ('Web URLs',      ht_WEBURL),
  161.                             ('Default',       ht_DEFAULT)
  162.  
  163.  
  164.  
  165. //--------------------------------------------------------------------------------------------------------------------
  166. //
  167. // %%words section
  168. //
  169. // Used to specify simple languge keywords. These are constant value lexemes that always contain the same characters
  170. // and only require the end style to be specified. The words present here will always be tried first. If they fail
  171. // then the entries in the %%tokens section will be allowed to try a match.
  172. //
  173. // %%words table entries have 3 columns:
  174. //     Column 1          Quoted string giving the characters that make up the word
  175. //     Column 2          Quoted string that specifies how the word is terminated
  176. //     Column 3          Token value returned when word is recognised
  177. //
  178. %%words
  179.  
  180. '</'                 _dont_care_              ht_TAGSTART
  181. '<'                  _dont_care_              ht_TAGSTART
  182. '>'                  _dont_care_              ht_TAGEND                  [ss_INTAG]
  183. '<!--'               _dont_care_              ht_COMMENT
  184. '<!'                 _dont_care_              ht_TAGSTART
  185. 'a'                  _non_alpha_              ht_TAGNAME_A               [ss_INTAG]
  186. 'address'            _non_alpha_              ht_TAGNAME_ADDRESS         [ss_INTAG]
  187. 'align'              _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  188. 'alt'                _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  189. 'applet'             _non_alpha_              ht_TAGNAME_APPLET          [ss_INTAG]
  190. 'b'                  _non_alpha_              ht_TAGNAME_B               [ss_INTAG]
  191. 'basefont'           _non_alpha_              ht_TAGNAME_BASEFONT        [ss_INTAG]
  192. 'big'                _non_alpha_              ht_TAGNAME_BIG             [ss_INTAG]
  193. 'blink'              _non_alpha_              ht_TAGNAME_BLINK           [ss_INTAG]
  194. 'blockquote'         _non_alpha_              ht_TAGNAME_BLOCKQUOTE      [ss_INTAG]
  195. 'body'               _non_alpha_              ht_TAGNAME_BODY            [ss_INTAG]
  196. 'br'                 _non_alpha_              ht_TAGNAME_BR              [ss_INTAG]
  197. 'caption'            _non_alpha_              ht_TAGNAME_CAPTION         [ss_INTAG]
  198. 'center'             _non_alpha_              ht_TAGNAME_CENTER          [ss_INTAG]
  199. 'cite'               _non_alpha_              ht_TAGNAME_CITE            [ss_INTAG]
  200. 'code'               _non_alpha_              ht_TAGNAME_CODE            [ss_INTAG]
  201. 'codebase'           _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  202. 'dd'                 _non_alpha_              ht_TAGNAME_DD              [ss_INTAG]
  203. 'dir'                _non_alpha_              ht_TAGNAME_DIR             [ss_INTAG]
  204. 'div'                _non_alpha_              ht_TAGNAME_DIV             [ss_INTAG]
  205. 'dl'                 _non_alpha_              ht_TAGNAME_DL              [ss_INTAG]
  206. 'doctype'            _non_alpha_              ht_TAGNAME_DOCTYPE         [ss_INTAG]
  207. 'dt'                 _non_alpha_              ht_TAGNAME_DT              [ss_INTAG]
  208. 'em'                 _non_alpha_              ht_TAGNAME_EM              [ss_INTAG]
  209. 'embed'              _non_alpha_              ht_TAGNAME_EMBED           [ss_INTAG]
  210. 'font'               _non_alpha_              ht_TAGNAME_FONT            [ss_INTAG]
  211. 'form'               _non_alpha_              ht_TAGNAME_FORM            [ss_INTAG]
  212. 'frame'              _non_alpha_              ht_TAGNAME_FRAME           [ss_INTAG]
  213. 'frameset'           _non_alpha_              ht_TAGNAME_FRAMESET        [ss_INTAG]
  214. 'h'                  _non_alpha_              ht_TAGNAME_H               [ss_INTAG]
  215. 'h1'                 _non_alpha_              ht_TAGNAME_H1              [ss_INTAG]
  216. 'h2'                 _non_alpha_              ht_TAGNAME_H2              [ss_INTAG]
  217. 'h3'                 _non_alpha_              ht_TAGNAME_H3              [ss_INTAG]
  218. 'h4'                 _non_alpha_              ht_TAGNAME_H4              [ss_INTAG]
  219. 'h5'                 _non_alpha_              ht_TAGNAME_H5              [ss_INTAG]
  220. 'h6'                 _non_alpha_              ht_TAGNAME_H6              [ss_INTAG]
  221. 'head'               _non_alpha_              ht_TAGNAME_HEAD            [ss_INTAG]
  222. 'height'             _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  223. 'hr'                 _non_alpha_              ht_TAGNAME_HR              [ss_INTAG]
  224. 'href'               _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  225. 'hspace'             _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  226. 'html'               _non_alpha_              ht_TAGNAME_HTML            [ss_INTAG]
  227. 'i'                  _non_alpha_              ht_TAGNAME_I               [ss_INTAG]
  228. 'img'                _non_alpha_              ht_TAGNAME_IMAGE           [ss_INTAG]
  229. 'input'              _non_alpha_              ht_TAGNAME_INPUT           [ss_INTAG]
  230. 'isindex'            _non_alpha_              ht_TAGNAME_ISINDEX         [ss_INTAG]
  231. 'kbd'                _non_alpha_              ht_TAGNAME_KBD             [ss_INTAG]
  232. 'li'                 _non_alpha_              ht_TAGNAME_LI              [ss_INTAG]
  233. 'link'               _non_alpha_              ht_TAGNAME_LINK            [ss_INTAG]
  234. 'mark'               _non_alpha_              ht_TAGNAME_MARK            [ss_INTAG]
  235. 'marquee'            _non_alpha_              ht_TAGNAME_MARQUEE         [ss_INTAG]
  236. 'menu'               _non_alpha_              ht_TAGNAME_MENU            [ss_INTAG]
  237. 'meta'               _non_alpha_              ht_TAGNAME_META            [ss_INTAG]
  238. 'methods'            _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  239. 'name'               _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  240. 'nextid'             _non_alpha_              ht_TAGNAME_NEXTID          [ss_INTAG]
  241. 'nobr'               _non_alpha_              ht_TAGNAME_NOBR            [ss_INTAG]
  242. 'noframes'           _non_alpha_              ht_TAGNAME_NOFRAMES        [ss_INTAG]
  243. 'ol'                 _non_alpha_              ht_TAGNAME_OL              [ss_INTAG]
  244. 'option'             _non_alpha_              ht_TAGNAME_OPTION          [ss_INTAG]
  245. 'p'                  _non_alpha_              ht_TAGNAME_P               [ss_INTAG]
  246. 'pre'                _non_alpha_              ht_TAGNAME_PRE             [ss_INTAG]
  247. 'samp'               _non_alpha_              ht_TAGNAME_SAMP            [ss_INTAG]
  248. 'script'             _non_alpha_              ht_TAGNAME_SCRIPT          [ss_INTAG]
  249. 'select'             _non_alpha_              ht_TAGNAME_SELECT          [ss_INTAG]
  250. 'small'              _non_alpha_              ht_TAGNAME_SMALL           [ss_INTAG]
  251. 'sound'              _non_alpha_              ht_TAGNAME_SOUND           [ss_INTAG]
  252. 'strike'             _non_alpha_              ht_TAGNAME_STRIKE          [ss_INTAG]
  253. 'strong'             _non_alpha_              ht_TAGNAME_STRONG          [ss_INTAG]
  254. 'sub'                _non_alpha_              ht_TAGNAME_SUB             [ss_INTAG]
  255. 'sup'                _non_alpha_              ht_TAGNAME_SUP             [ss_INTAG]
  256. 'rel'                _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  257. 'rev'                _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  258. 'table'              _non_alpha_              ht_TAGNAME_TABLE           [ss_INTAG]
  259. 'target'             _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  260. 'td'                 _non_alpha_              ht_TAGNAME_TD              [ss_INTAG]
  261. 'textarea'           _non_alpha_              ht_TAGNAME_TEXTAREA        [ss_INTAG]
  262. 'th'                 _non_alpha_              ht_TAGNAME_TH              [ss_INTAG]
  263. 'title'              _non_alpha_              ht_TAGNAME_TITLE           [ss_INTAG]
  264. 'tr'                 _non_alpha_              ht_TAGNAME_TR              [ss_INTAG]
  265. 'tt'                 _non_alpha_              ht_TAGNAME_TT              [ss_INTAG]
  266. 'u'                  _non_alpha_              ht_TAGNAME_U               [ss_INTAG]
  267. 'ul'                 _non_alpha_              ht_TAGNAME_UL              [ss_INTAG]
  268. 'urn'                _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  269. 'value'              _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  270. 'var'                _non_alpha_              ht_TAGNAME_VAR             [ss_INTAG]
  271. 'vspace'             _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  272. 'wbr'                _non_alpha_              ht_TAGNAME_WBR             [ss_INTAG]
  273. 'width'              _non_alpha_              ht_FIELDNAME               [ss_INTAG]
  274.  
  275. 'http://'            _dont_care_              ht_WEBURL                  [ss_START ss_INTAG ss_STRING]
  276. 'ftp://'             _dont_care_              ht_WEBURL                  [ss_START ss_INTAG ss_STRING]
  277. 'mailto:'            _dont_care_              ht_MAILURL                 [ss_START ss_INTAG ss_STRING]
  278.  
  279.  
  280. //--------------------------------------------------------------------------------------------------------------------
  281. //
  282. // %%handler section               > hi@
  283. //
  284. // The %%handler section gives rules to be applied once an entry in the %%words table has been recognised. Normally
  285. // no further processing is required but sometimes a token starts with a fixed set of characters but may be followed
  286. // by a character class rather than a known sequence.
  287. //
  288. // %%handler table entries have 4 columns:
  289. //     Column 1          Token value to be processed
  290. //     Column 2          Character specifier that follows recognised word
  291. //     Column 3          Quoted string specifying end sequence
  292. //     Column 4          Whether end sequence is part of lexeme
  293. //
  294. // The <character specifier> is defined as:
  295. //     Column 2          A single character specifier or pre-defined system character macro:
  296. //                         _PASCAL_CHAR         Pascal style character specifier
  297. //                         _C_CHAR              C style character specifier
  298. //                       If the lexeme can optionally have these characters then append '?' to the end
  299. //                       of the quoted string.
  300. //     Column 3          Up to 2 characters may be given as a sequence to terminate the lexeme.
  301. //                       Characters are specified using a simplified regular expression. If this
  302. //                       string is empty then the lexeme will never be matched.
  303. //
  304. %%handler
  305. ht_COMMENT              _all_chars_?                '->'                     _use_
  306. ht_MAILURL              __STD_MAIL_URL
  307. ht_WEBURL               _WEB_CHAR                  _all_chars_               _discard_
  308.  
  309. //--------------------------------------------------------------------------------------------------------------------
  310. //
  311. // %%tokens section
  312. //
  313. // Used to specify how to recognise non-fixed lexemes. Non-fixed lexemes are only tried if the table entries in the
  314. // %%words section have failed. The non-fixed lexeme is defiened by 5 columns as below:
  315. //     Column 1          Token value
  316. //     Column 2          Single start character specifier
  317. //     Column 3          Single contains character specifier
  318. //     Column 4          End sequence specifier
  319. //     Column 5          Whether end sequence is part of lexeme
  320. //     Column 6          Valid states for token 
  321. // Pre-defined token styles are implemented. If used they should be specified in Column 2. The implemented ones
  322. // are:
  323. //  __STD_PASCALSTRING   Pascal string -- starts with ' ands with ' and uses '' to represent
  324. //                       ' within a string. Does not extend beywond end of line.
  325. //  __STD_IDENTIFIER     Standard identifier. Starts with [_a-zA-Z], contains [_a-zA-Z0-9] and ends with
  326. //                       a non-alpha numeric character that is not part of the lexeme
  327. //  __STD_NUMBER_OR_FP   Integer or floating point constant of syntax:
  328. //                           <Digit String> [ '.' <Digit string> ] [ e|E [+-] <Digit string> ]
  329. //
  330. %%tokens
  331. ht_NUMBER               __STD_NUMBER                                                                 [ss_INTAG]
  332. ht_STRING               __STD_C_STRING                                                               [ss_INTAG]
  333. ht_WHITESPACE           '[\x00-\s]'                 '[\x00-\s]'?       '[^\x00-\s]'     _discard_    [ss_INTAG ss_START]
  334. ht_IDENTIFIER           __STD_IDENTIFIER                                                             [ss_INTAG]
  335.  
  336. //--------------------------------------------------------------------------------------------------------------------
  337. //
  338. // %%effects section
  339. //
  340. // Used to specify the default colors and font styles used for each token
  341. //
  342. //     Column 1          Token value
  343. //     Column 2          Font styles
  344. //     Column 3          Foreground color
  345. //     Column 4          Background color
  346. //     Column 5          Optional column specifying whether map entry is a 'hotspot'
  347. //
  348. // Columns 1-4 must be completed for all rows, Column 5 defaults to non-hotspot.
  349. //
  350. %%effects
  351. ht_DEFAULT              []                          _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  352. ht_TAGNAME              [fsBold]                    clBlue                      _DEFAULT_BACKGROUND
  353. ht_COMMENT              []                          clGreen                     _DEFAULT_BACKGROUND
  354. ht_IDENTIFIER           [fsBOLD]                    _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  355. ht_STRING               []                          clRed                       _DEFAULT_BACKGROUND
  356. ht_FIELDNAME            [fsBold]                    _DEFAULT_FOREGROUND         _DEFAULT_BACKGROUND
  357. ht_WEBURL               [fsUnderline]               clBlue                      _DEFAULT_BACKGROUND  'hotspot'
  358.  
  359. //--------------------------------------------------------------------------------------------------------------------
  360. //
  361. // %%map section
  362. //
  363. // Used to specify which entry in the %%effects table each token value uses. By default all token values map onto
  364. // __DEFAULT_TOKEN which is defined as zero. Table has 2 columns:
  365. //     Column 1          Recognised token value
  366. //     Column 2          Map table entry (i.e. %%effects table entry)
  367. // Normally the %%map table consists of identical value entries.
  368. %%map
  369. ht_DEFAULT                    ht_DEFAULT
  370. ht_TAGNAME                    ht_TAGNAME
  371. ht_COMMENT                    ht_COMMENT
  372. ht_IDENTIFIER                 ht_IDENTIFIER
  373. ht_STRING                     ht_STRING
  374. ht_FIELDNAME                  ht_FIELDNAME
  375. ht_UNKNOWN                    ht_DEFAULT
  376. ht_MISC                       ht_DEFAULT
  377. ht_TAGSTART                   ht_TAGNAME
  378. ht_TAGEND                     ht_TAGNAME
  379. ht_WEBURL                     ht_WEBURL
  380. ht_MAILURL                    ht_WEBURL
  381.  
  382. ht_TAGNAME_A                  ht_TAGNAME
  383. ht_TAGNAME_ADDRESS            ht_TAGNAME
  384. ht_FIELDNAME                  ht_TAGNAME
  385. ht_FIELDNAME                  ht_TAGNAME
  386. ht_TAGNAME_APPLET             ht_TAGNAME
  387. ht_TAGNAME_B                  ht_TAGNAME
  388. ht_TAGNAME_BASEFONT           ht_TAGNAME
  389. ht_TAGNAME_BIG                ht_TAGNAME
  390. ht_TAGNAME_BLINK              ht_TAGNAME
  391. ht_TAGNAME_BLOCKQUOTE         ht_TAGNAME
  392. ht_TAGNAME_BODY               ht_TAGNAME
  393. ht_TAGNAME_BR                 ht_TAGNAME
  394. ht_TAGNAME_CAPTION            ht_TAGNAME
  395. ht_TAGNAME_CENTER             ht_TAGNAME
  396. ht_TAGNAME_CITE               ht_TAGNAME
  397. ht_TAGNAME_CODE               ht_TAGNAME
  398. ht_FIELDNAME                  ht_TAGNAME
  399. ht_TAGNAME_DD                 ht_TAGNAME
  400. ht_TAGNAME_DIR                ht_TAGNAME
  401. ht_TAGNAME_DIV                ht_TAGNAME
  402. ht_TAGNAME_DL                 ht_TAGNAME
  403. ht_TAGNAME_DOCTYPE            ht_TAGNAME
  404. ht_TAGNAME_DT                 ht_TAGNAME
  405. ht_TAGNAME_EM                 ht_TAGNAME
  406. ht_TAGNAME_EMBED              ht_TAGNAME
  407. ht_TAGNAME_FONT               ht_TAGNAME
  408. ht_TAGNAME_FORM               ht_TAGNAME
  409. ht_TAGNAME_FRAME              ht_TAGNAME
  410. ht_TAGNAME_FRAMESET           ht_TAGNAME
  411. ht_TAGNAME_H                  ht_TAGNAME
  412. ht_TAGNAME_H1                 ht_TAGNAME
  413. ht_TAGNAME_H2                 ht_TAGNAME
  414. ht_TAGNAME_H3                 ht_TAGNAME
  415. ht_TAGNAME_H4                 ht_TAGNAME
  416. ht_TAGNAME_H5                 ht_TAGNAME
  417. ht_TAGNAME_H6                 ht_TAGNAME
  418. ht_TAGNAME_HEAD               ht_TAGNAME
  419. ht_FIELDNAME                  ht_TAGNAME
  420. ht_TAGNAME_HR                 ht_TAGNAME
  421. ht_FIELDNAME                  ht_TAGNAME
  422. ht_FIELDNAME                  ht_TAGNAME
  423. ht_TAGNAME_HTML               ht_TAGNAME
  424. ht_TAGNAME_I                  ht_TAGNAME
  425. ht_TAGNAME_IMAGE              ht_TAGNAME
  426. ht_TAGNAME_INPUT              ht_TAGNAME
  427. ht_TAGNAME_ISINDEX            ht_TAGNAME
  428. ht_TAGNAME_KBD                ht_TAGNAME
  429. ht_TAGNAME_LI                 ht_TAGNAME
  430. ht_TAGNAME_LINK               ht_TAGNAME
  431. ht_TAGNAME_MARK               ht_TAGNAME
  432. ht_TAGNAME_MARQUEE            ht_TAGNAME
  433. ht_TAGNAME_MENU               ht_TAGNAME
  434. ht_TAGNAME_META               ht_TAGNAME
  435. ht_FIELDNAME                  ht_TAGNAME
  436. ht_TAGNAME_NEXTID             ht_TAGNAME
  437. ht_TAGNAME_NOBR               ht_TAGNAME
  438. ht_TAGNAME_NOFRAMES           ht_TAGNAME
  439. ht_TAGNAME_OL                 ht_TAGNAME
  440. ht_TAGNAME_OPTION             ht_TAGNAME
  441. ht_TAGNAME_P                  ht_TAGNAME
  442. ht_TAGNAME_PRE                ht_TAGNAME
  443. ht_TAGNAME_SAMP               ht_TAGNAME
  444. ht_TAGNAME_SCRIPT             ht_TAGNAME
  445. ht_TAGNAME_SELECT             ht_TAGNAME
  446. ht_TAGNAME_SMALL              ht_TAGNAME
  447. ht_TAGNAME_SOUND              ht_TAGNAME
  448. ht_TAGNAME_STRIKE             ht_TAGNAME
  449. ht_TAGNAME_STRONG             ht_TAGNAME
  450. ht_TAGNAME_SUB                ht_TAGNAME
  451. ht_TAGNAME_SUP                ht_TAGNAME
  452. ht_FIELDNAME                  ht_TAGNAME
  453. ht_FIELDNAME                  ht_TAGNAME
  454. ht_TAGNAME_TABLE              ht_TAGNAME
  455. ht_FIELDNAME                  ht_TAGNAME
  456. ht_TAGNAME_TD                 ht_TAGNAME
  457. ht_TAGNAME_TEXTAREA           ht_TAGNAME
  458. ht_TAGNAME_TH                 ht_TAGNAME
  459. ht_TAGNAME_TITLE              ht_TAGNAME
  460. ht_TAGNAME_TR                 ht_TAGNAME
  461. ht_TAGNAME_TT                 ht_TAGNAME
  462. ht_TAGNAME_U                  ht_TAGNAME
  463. ht_TAGNAME_UL                 ht_TAGNAME
  464. ht_FIELDNAME                  ht_TAGNAME
  465. ht_FIELDNAME                  ht_TAGNAME
  466. ht_TAGNAME_VAR                ht_TAGNAME
  467. ht_FIELDNAME                  ht_TAGNAME
  468. ht_TAGNAME_WBR                ht_TAGNAME
  469. ht_FIELDNAME                  ht_TAGNAME
  470.  
  471. %%states
  472. ht_TAGSTART                   (+[ss_INTAG])
  473. ht_TAGEND                     (-[ss_INTAG])
  474.  
  475. %%containers
  476. ht_STRING                     (+[ss_STRING] -[ss_START ss_INTAG])
  477.  
  478.  
  479. #define bgcolor_effects
  480.  
  481. #ifdef bgcolor_effects
  482. /*----------------------------------------------------------------------------*
  483.    Optional addendum to script to illustrate method to allow fields of the
  484.    same name to be highlighted dependent upon the parent tag name.
  485.  
  486.    Remove the #define for bgcolor_effects (above) for this new section to be
  487.    ignored by the script compiler (and revert to previous behaviour).
  488. */
  489.  
  490. /*
  491.  * STEP 1:   Define new token values for the different 'bgcolor' fields
  492.  */
  493. #define ht_FIELD_BGCOLOR_BODY        200
  494. #define ht_FIELD_BGCOLOR_TD          201
  495.  
  496. /*
  497.  * STEP 2:   Define new states to allow the same text 'bgcolor' to be
  498.  *           recognised as different dependent upon the current state set
  499.  */
  500. #define ss_BGCOLOR_BODY             3
  501. #define ss_BGCOLOR_TD               4
  502.  
  503. /*
  504.  * STEP 3:   Declare new words, making their active states different
  505.  */
  506. %%words
  507. 'bgcolor'            _non_alpha_              ht_FIELD_BGCOLOR_BODY      [ss_BGCOLOR_BODY]
  508. 'bgcolor'            _non_alpha_              ht_FIELD_BGCOLOR_TD        [ss_BGCOLOR_TD]
  509.  
  510. /*
  511.  * STEP 4:   Define the highlights used by the new tokens
  512.  */
  513. %%effects
  514. ht_FIELD_BGCOLOR_BODY   [fsBold]     clRed      _DEFAULT_BACKGROUND
  515. ht_FIELD_BGCOLOR_TD     [fsBold]     clGreen    _DEFAULT_BACKGROUND
  516.  
  517.  
  518. /*
  519.  * STEP 5:   Override the default mapping for the new token values
  520.  */
  521. %%map
  522. ht_FIELD_BGCOLOR_BODY         ht_FIELD_BGCOLOR_BODY
  523. ht_FIELD_BGCOLOR_TD           ht_FIELD_BGCOLOR_TD
  524.  
  525. /* STEP 6:   The bit that makes it operate -- when each of the parent tags
  526.  *           is recognised we require to turn on the respective new state.
  527.  *
  528.  *           In addition, when we end the tag with '>' we must ensure that
  529.  *           the new states are turned off as well as the standard
  530.  *           ss_INTAG
  531.  */
  532. %%states
  533. ht_TAGEND                     (-[ss_INTAG ss_BGCOLOR_BODY ss_BGCOLOR_TD])
  534. ht_TAGNAME_BODY               (+[ss_BGCOLOR_BODY])
  535. ht_TAGNAME_TD                 (+[ss_BGCOLOR_TD])
  536. #endif
  537.  
  538.