Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1033 lines
38 KiB

  1. // table.cpp
  2. // Copyright (c)1997-1999 Microsoft Corporation, All Rights Reserved
  3. // HTML keyword tables
  4. // If you modify the element, attribute, or entity tables, then you MUST
  5. // update Token.h.
  6. #include "stdafx.h"
  7. #include "resource.h"
  8. #include "guids.h"
  9. #include "table.h"
  10. #undef ASSERT
  11. #define ASSERT(b) _ASSERTE(b)
  12. // qsort/bsearch helper
  13. int CmpFunc(const void *a, const void *b);
  14. static const TCHAR szFileSig[] = _T("@HLX@");
  15. static const TCHAR szElTag[] = _T("[Elements]");
  16. static const TCHAR szAttTag[] = _T("[Attributes]");
  17. static const TCHAR szEntTag[] = _T("[Entities]");
  18. ////////////////////////////////////////////////////////////////////////////
  19. #ifdef _DEBUG
  20. //
  21. // table verification routines
  22. //
  23. int CheckWordTable(ReservedWord *arw, int cel, LPCTSTR szName /*= NULL*/)
  24. {
  25. int cerr = 0;
  26. int cch;
  27. for (int i = 0; i < cel; i++)
  28. {
  29. // table must be sorted in ascending alpha order
  30. //
  31. if (i > 1)
  32. {
  33. if (!(_tcscmp(arw[i-1].psz, arw[i].psz) < 0))
  34. {
  35. ATLTRACE(_T("lexer:entries in %s out of order at %d: %s - %s\n"),
  36. szName?szName:_T("?"), i-1, arw[i-1].psz, arw[i].psz);
  37. cerr++;
  38. }
  39. }
  40. // length must match
  41. //
  42. cch = _tcslen(arw[i].psz);
  43. if (cch != arw[i].cb)
  44. {
  45. ATLTRACE(_T("lexer:Incorrect entry in %s: %s,%d should be %d\n"),
  46. szName?szName:_T("?"), arw[i].psz, arw[i].cb, cch);
  47. cerr++;
  48. }
  49. }
  50. return cerr;
  51. }
  52. int CheckWordTableIndex(ReservedWord *arw, int cel, int *ai, BOOL bCase /*= FALSE*/, LPCTSTR szName /* = NULL*/)
  53. {
  54. int cerr = 0;
  55. int index;
  56. int max = bCase ? 52 : 26;
  57. _ASSERTE(NULL != arw);
  58. _ASSERTE(NULL != ai);
  59. int aik[] =
  60. {
  61. //A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  62. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  63. //a b c d e f g h i j k l m n o p q r s t u v w x y z
  64. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  65. };
  66. // Build correct index array on static aik
  67. cerr += MakeIndexHere( arw, cel, aik, bCase );
  68. // Compare with declared arrray
  69. //
  70. if (0 != memcmp(aik, ai, max))
  71. cerr++;
  72. // If errors, dump correct array
  73. if (cerr)
  74. {
  75. ATLTRACE(_T("lexer: Correct index array for %s: \n{\n\t"), szName ? szName : _T("?"));
  76. for (index = 0; index < max - 1; index++)
  77. {
  78. ATLTRACE(_T("%3d,"), aik[index]);
  79. if (index % 13 == 12)
  80. ATLTRACE(_T("\n\t"));
  81. }
  82. ATLTRACE(_T("%3d\n};\n"), aik[index]);
  83. }
  84. return cerr;
  85. }
  86. #endif
  87. int MakeIndexHere(ReservedWord *arw, int cel, int *ab, BOOL bCase /*= FALSE*/, LPCTSTR szName /*= NULL*/)
  88. {
  89. int cerr = 0;
  90. int index;
  91. ASSERT(ab != NULL);
  92. ASSERT(arw != NULL);
  93. for (int irw = cel - 1; irw > 0; irw--)
  94. {
  95. index = PeekIndex(*arw[irw].psz, bCase);
  96. if (-1 != index)
  97. ab[index] = irw;
  98. else
  99. {
  100. ATLTRACE(_T("lexer:error in %s: non-alpha token %s\n"), szName?szName:_T("?"), arw[irw].psz);
  101. cerr++;
  102. }
  103. }
  104. return cerr;
  105. }
  106. int MakeIndex(ReservedWord *arw, int cel, int **pab, BOOL bCase /*= FALSE*/, LPCTSTR szName /*= NULL*/)
  107. {
  108. ASSERT(NULL != arw);
  109. ASSERT(NULL != pab);
  110. *pab = new int[ bCase ? 52 : 26 ];
  111. if (NULL == *pab)
  112. return -1;
  113. return MakeIndexHere(arw, cel, *pab, bCase, szName);
  114. }
  115. #define RW_Entry(string, attribute) \
  116. _T( #string ), sizeof( #string ) - 1, attribute
  117. ////////////////////////////////////////////////////////////////////////////
  118. // reserved word table
  119. // Two tables:
  120. // reserved[] = sorted table of reserved words
  121. // index[initial(token)] = (index of first reserved word with that initial)
  122. // If you modify the element, attribute, or entity tables, then you MUST
  123. // update Token.h.
  124. //
  125. // NOTE: the "HPn" elements are considered obsolete
  126. //
  127. static ReservedWord _rgElementNames[] =
  128. {// psz cb att
  129. _T(""), 0, 0,
  130. RW_Entry(A ,ALL ),
  131. RW_Entry(ADDRESS ,ALL ),
  132. RW_Entry(APPLET ,IEXPn ), // ???
  133. RW_Entry(AREA ,IEXPn ),
  134. RW_Entry(B ,ALL ),
  135. RW_Entry(BASE ,ALL ),
  136. RW_Entry(BASEFONT ,IEXPn ),
  137. RW_Entry(BGSOUND ,IEXPn ), // IExplore
  138. RW_Entry(BIG ,IEXP3 ),
  139. RW_Entry(BLINK ,IEXPn ), // Netscape
  140. RW_Entry(BLOCKQUOTE ,ALL ),
  141. RW_Entry(BODY ,ALL ),
  142. RW_Entry(BR ,ALL ),
  143. RW_Entry(BUTTON ,IE40 ),
  144. RW_Entry(CAPTION ,IEXPn ), // tables
  145. RW_Entry(CENTER ,IEXPn ),
  146. RW_Entry(CITE ,ALL ),
  147. RW_Entry(CODE ,ALL ),
  148. RW_Entry(COL ,IEXP3 ),
  149. RW_Entry(COLGROUP ,IEXP3 ), // HTML 3 tables?
  150. RW_Entry(COMMENT ,ALL ), // considered obsolete
  151. RW_Entry(DD ,ALL ),
  152. RW_Entry(DFN ,ALL ), // RFC1866: not in the RFC, but deployed. ital or bold ital
  153. RW_Entry(DIR ,ALL ),
  154. RW_Entry(DIV ,IEXP3 ), // HTML 3
  155. RW_Entry(DL ,ALL ),
  156. RW_Entry(DT ,ALL ),
  157. RW_Entry(EM ,ALL ),
  158. RW_Entry(EMBED ,IEXP3 ), // netscape -- IEXP3
  159. RW_Entry(FIELDSET ,IE40 ),
  160. RW_Entry(FONT ,IEXPn ),
  161. RW_Entry(FORM ,ALL ), // forms
  162. RW_Entry(FRAME ,IEXP3 ), // framesets
  163. RW_Entry(FRAMESET ,IEXP3 ), // framesets
  164. RW_Entry(H1 ,ALL ), // heading 1
  165. RW_Entry(H2 ,ALL ), // heading 2
  166. RW_Entry(H3 ,ALL ), // heading 3
  167. RW_Entry(H4 ,ALL ), // heading 4
  168. RW_Entry(H5 ,ALL ), // heading 5
  169. RW_Entry(H6 ,ALL ), // heading 6
  170. RW_Entry(HEAD ,ALL ), // document head
  171. RW_Entry(HR ,ALL ),
  172. RW_Entry(HTML ,ALL ),
  173. RW_Entry(I ,ALL ),
  174. RW_Entry(IFRAME ,IEXP3 ), // inline frames
  175. RW_Entry(IMG ,ALL ),
  176. RW_Entry(INPUT ,ALL ), // forms
  177. RW_Entry(ISINDEX ,ALL ),
  178. RW_Entry(KBD ,ALL ),
  179. RW_Entry(LABEL ,IE40 ),
  180. RW_Entry(LEGEND ,IE40 ),
  181. RW_Entry(LI ,ALL ),
  182. RW_Entry(LINK ,ALL ),
  183. RW_Entry(LISTING ,ALL ), // RFC 1866: obsolete
  184. RW_Entry(MAP ,IEXPn ),
  185. RW_Entry(MARQUEE ,IEXPn ), // IExplore
  186. RW_Entry(MENU ,ALL ),
  187. RW_Entry(META ,ALL ),
  188. RW_Entry(METADATA ,ALL ),
  189. RW_Entry(NOBR ,IEXPn ),
  190. RW_Entry(NOFRAMES ,IEXP3 ), // framesets
  191. RW_Entry(NOSCRIPT ,IE40 ), // IE4 only
  192. RW_Entry(OBJECT ,IEXP3 ), // ActiveX
  193. RW_Entry(OL ,ALL ),
  194. RW_Entry(OPTION ,ALL ), // forms
  195. RW_Entry(P ,ALL ),
  196. RW_Entry(PARAM ,IEXP3 ), // ActiveX
  197. RW_Entry(PLAINTEXT ,ALL ), // RFC 1866: deprecated, noted as obsolete
  198. RW_Entry(PRE ,ALL ),
  199. RW_Entry(S ,IEXPn ), // (apparently) synonym for strike
  200. RW_Entry(SAMP ,ALL ),
  201. RW_Entry(SCRIPT ,IEXP3 ), // ActiveX
  202. RW_Entry(SELECT ,ALL ),
  203. RW_Entry(SMALL ,IEXP3 ),
  204. RW_Entry(SPAN ,IEXP3 ), // tables
  205. RW_Entry(STRIKE ,IEXPn ), // not in RFC 1866 DTD, but noted as deployed
  206. RW_Entry(STRONG ,ALL ),
  207. RW_Entry(STYLE ,IEXP3 ), // HTML 3 stylesheets
  208. RW_Entry(SUB ,IEXP3 ), // HTML3 ???
  209. RW_Entry(SUP ,IEXP3 ), // HTML3 ???
  210. RW_Entry(TABLE ,IEXPn ), // tables
  211. RW_Entry(TBODY ,IEXP3 ), // HTML 3 tables
  212. RW_Entry(TD ,IEXPn ), // tables
  213. RW_Entry(TEXTAREA ,ALL ), // forms
  214. RW_Entry(TFOOT ,IEXP3 ), // HTML 3 tables
  215. RW_Entry(TH ,IEXPn ), // tables
  216. RW_Entry(THEAD ,IEXP3 ), // HTML 3 tables
  217. RW_Entry(TITLE ,ALL ),
  218. RW_Entry(TR ,IEXPn ), // tables
  219. RW_Entry(TT ,ALL ),
  220. RW_Entry(U ,ALL ), // not in RFC 1866 DTD, but noted as deployed
  221. RW_Entry(UL ,ALL ),
  222. RW_Entry(VAR ,ALL ),
  223. RW_Entry(WBR ,IEXPn ),
  224. RW_Entry(XMP ,ALL ), // deprecated by RFC 1866
  225. };
  226. // If you modify the element, attribute, or entity tables, then you MUST
  227. // update Token.h.
  228. // The following array is a mapping of each letter to a position in the
  229. // table where tokens starting with that letter begin.
  230. //
  231. static int _rgIndexElementNames[] = // [Elements]
  232. {
  233. /* A */ TokElem_A ,
  234. /* B */ TokElem_B ,
  235. /* C */ TokElem_CAPTION ,
  236. /* D */ TokElem_DD ,
  237. /* E */ TokElem_EM ,
  238. /* F */ TokElem_FIELDSET ,
  239. /* G */ 0 ,
  240. /* H */ TokElem_H1 ,
  241. /* I */ TokElem_I ,
  242. /* J */ 0 ,
  243. /* K */ TokElem_KBD ,
  244. /* L */ TokElem_LABEL ,
  245. /* M */ TokElem_MAP ,
  246. /* N */ TokElem_NOBR ,
  247. /* O */ TokElem_OBJECT ,
  248. /* P */ TokElem_P ,
  249. /* Q */ 0 ,
  250. /* R */ 0 ,
  251. /* S */ TokElem_S ,
  252. /* T */ TokElem_TABLE ,
  253. /* U */ TokElem_U ,
  254. /* V */ TokElem_VAR ,
  255. /* W */ TokElem_WBR ,
  256. /* X */ TokElem_XMP ,
  257. /* Y */ 0 ,
  258. /* Z */ 0
  259. };
  260. // If you modify the element, attribute, or entity tables, then you MUST
  261. // update Token.h.
  262. //
  263. // attribute name table
  264. //
  265. static ReservedWord _rgAttributeNames[] =
  266. {// psz cb att
  267. _T(""), 0, 0,
  268. RW_Entry(ACCESSKEY ,IEXP3 ),
  269. RW_Entry(ACTION ,ALL ),
  270. RW_Entry(ALIGN ,ALL ),
  271. RW_Entry(ALINK ,IEXPn ),
  272. RW_Entry(ALT ,ALL ),
  273. RW_Entry(APPNAME ,IE40 ),
  274. RW_Entry(APPVERSION ,IE40 ),
  275. RW_Entry(BACKGROUND ,IEXPn ),
  276. RW_Entry(BACKGROUNDATTACHMENT ,IE40 ),
  277. RW_Entry(BACKGROUNDCOLOR ,IE40 ),
  278. RW_Entry(BACKGROUNDIMAGE ,IE40 ),
  279. RW_Entry(BACKGROUNDPOSITION ,IE40 ),
  280. RW_Entry(BACKGROUNDPOSITIONX ,IE40 ),
  281. RW_Entry(BACKGROUNDPOSITIONY ,IE40 ),
  282. RW_Entry(BACKGROUNDREPEAT ,IE40 ),
  283. RW_Entry(BALANCE ,IE40 ),
  284. RW_Entry(BEHAVIOR ,IEXPn ), // MARQUEE
  285. RW_Entry(BGCOLOR ,IEXPn ),
  286. RW_Entry(BGPROPERTIES ,IEXPn ),
  287. RW_Entry(BORDER ,IEXPn ),
  288. RW_Entry(BORDERBOTTOM ,IE40 ),
  289. RW_Entry(BORDERBOTTOMCOLOR ,IE40 ),
  290. RW_Entry(BORDERBOTTOMSTYLE ,IE40 ),
  291. RW_Entry(BORDERBOTTOMWIDTH ,IE40 ),
  292. RW_Entry(BORDERCOLOR ,IEXPn ), // tables
  293. RW_Entry(BORDERCOLORDARK ,IEXPn ), // tables
  294. RW_Entry(BORDERCOLORLIGHT ,IEXPn ), // tables
  295. RW_Entry(BORDERLEFT ,IE40 ),
  296. RW_Entry(BORDERLEFTCOLOR ,IE40 ),
  297. RW_Entry(BORDERLEFTSTYLE ,IE40 ),
  298. RW_Entry(BORDERLEFTWIDTH ,IE40 ),
  299. RW_Entry(BORDERRIGHT ,IE40 ),
  300. RW_Entry(BORDERRIGHTCOLOR ,IE40 ),
  301. RW_Entry(BORDERRIGHTSTYLE ,IE40 ),
  302. RW_Entry(BORDERRIGHTWIDTH ,IE40 ),
  303. RW_Entry(BORDERSTYLE ,IE40 ),
  304. RW_Entry(BORDERTOP ,IE40 ),
  305. RW_Entry(BORDERTOPCOLOR ,IE40 ),
  306. RW_Entry(BORDERTOPSTYLE ,IE40 ),
  307. RW_Entry(BORDERTOPWIDTH ,IE40 ),
  308. RW_Entry(BORDERWIDTH ,IE40 ),
  309. RW_Entry(BOTTOMMARGIN ,IEXPn ),
  310. RW_Entry(BREAKPOINT ,IEXPn ), // (walts) hidden META tag attribute for brkpt mapping.
  311. RW_Entry(BUFFERDEPTH ,IE40 ),
  312. RW_Entry(BUTTON ,IE40 ),
  313. RW_Entry(CANCELBUBBLE ,IE40 ),
  314. RW_Entry(CELLPADDING ,IEXPn ), // tables
  315. RW_Entry(CELLSPACING ,IEXPn ), // tables
  316. RW_Entry(CENTER ,IEXPn ),
  317. RW_Entry(CHARSET ,IE40 ),
  318. RW_Entry(CHECKED ,ALL ),
  319. RW_Entry(CLASS ,IEXPn ),
  320. RW_Entry(CLASSID ,IEXP3 ), //objects
  321. RW_Entry(CLASSNAME ,IE40 ),
  322. RW_Entry(CLEAR ,IEXP3 ),
  323. RW_Entry(CLIP ,IE40 ),
  324. RW_Entry(CODE ,IEXPn ),
  325. RW_Entry(CODEBASE ,IEXP3 ), //objects
  326. RW_Entry(CODETYPE ,IE40 ),
  327. RW_Entry(COLOR ,IEXPn ), // font
  328. RW_Entry(COLORDEPTH ,IE40 ),
  329. RW_Entry(COLS ,ALL ),
  330. RW_Entry(COLSPAN ,IEXPn ), // tables
  331. RW_Entry(COMPACT ,ALL ),
  332. RW_Entry(COMPLETE ,IE40 ),
  333. RW_Entry(CONTENT ,ALL ),
  334. RW_Entry(CONTROLS ,IEXPn ),
  335. RW_Entry(COOKIE ,IE40 ),
  336. RW_Entry(COOKIEENABLED ,IE40 ),
  337. RW_Entry(COORDS ,IEXPn ),
  338. RW_Entry(CSSTEXT ,IE40 ),
  339. RW_Entry(CTRLKEY ,IE40 ),
  340. RW_Entry(CURSOR ,IE40 ),
  341. RW_Entry(DATA ,IEXP3 ), //objects
  342. RW_Entry(DATAFLD ,IE40 ),
  343. RW_Entry(DATAFORMATAS ,IE40 ),
  344. RW_Entry(DATAPAGESIZE ,IE40 ),
  345. RW_Entry(DATASRC ,IE40 ),
  346. RW_Entry(DECLARE ,IEXP3 ), //objects
  347. RW_Entry(DEFAULTCHECKED ,IE40 ),
  348. RW_Entry(DEFAULTSELECTED ,IE40 ),
  349. RW_Entry(DEFAULTSTATUS ,IE40 ),
  350. RW_Entry(DEFAULTVALUE ,IE40 ),
  351. RW_Entry(DIALOGARGUMENTS ,IE40 ),
  352. RW_Entry(DIALOGHEIGHT ,IE40 ),
  353. RW_Entry(DIALOGLEFT ,IE40 ),
  354. RW_Entry(DIALOGTOP ,IE40 ),
  355. RW_Entry(DIALOGWIDTH ,IE40 ),
  356. RW_Entry(DIR ,IEXP3 ), // HTML 3 ???
  357. RW_Entry(DIRECTION ,IEXPn ), // MARQUEE
  358. RW_Entry(DISABLED ,IE40 ),
  359. RW_Entry(DISPLAY ,IE40 ),
  360. RW_Entry(DOMAIN ,IE40 ),
  361. RW_Entry(DYNSRC ,IEXPn ),
  362. RW_Entry(ENCODING ,IE40 ),
  363. RW_Entry(ENCTYPE ,ALL ),
  364. RW_Entry(ENDSPAN ,IE40 ), // Designer control tags
  365. RW_Entry(ENDSPAN-- ,IE40 ), // Designer control tags HACK to handle nonspace
  366. RW_Entry(EVENT ,IEXP3 ), // ActiveX <SCRIPT>
  367. RW_Entry(FACE ,IEXPn ), // font
  368. RW_Entry(FGCOLOR ,IE40 ),
  369. RW_Entry(FILTER ,IE40 ),
  370. RW_Entry(FONT ,IE40 ),
  371. RW_Entry(FONTFAMILY ,IE40 ),
  372. RW_Entry(FONTSIZE ,IE40 ),
  373. RW_Entry(FONTSTYLE ,IE40 ),
  374. RW_Entry(FONTVARIANT ,IE40 ),
  375. RW_Entry(FONTWEIGHT ,IE40 ),
  376. RW_Entry(FOR ,IEXP3 ), // ActiveX <SCRIPT>
  377. RW_Entry(FORM ,IE40 ),
  378. RW_Entry(FRAME ,IE40 ),
  379. RW_Entry(FRAMEBORDER ,IEXP3 ),
  380. RW_Entry(FRAMESPACING ,IEXP3 ),
  381. RW_Entry(FROMELEMENT ,IE40 ),
  382. RW_Entry(HASH ,IE40 ),
  383. RW_Entry(HEIGHT ,IEXPn ),
  384. RW_Entry(HIDDEN ,IE40 ),
  385. RW_Entry(HOST ,IE40 ),
  386. RW_Entry(HOSTNAME ,IE40 ),
  387. RW_Entry(HREF ,ALL ),
  388. RW_Entry(HSPACE ,IEXPn ),
  389. RW_Entry(HTMLFOR ,IE40 ),
  390. RW_Entry(HTMLTEXT ,IE40 ),
  391. RW_Entry(HTTP-EQUIV ,ALL ),
  392. RW_Entry(HTTPEQUIV ,IE40 ),
  393. RW_Entry(ID ,IEXPn ),
  394. RW_Entry(IN ,IEXP3 ), // ActiveX <SCRIPT>
  395. RW_Entry(INDETERMINATE ,IE40 ),
  396. RW_Entry(INDEX ,IE40 ),
  397. RW_Entry(ISMAP ,ALL ),
  398. RW_Entry(LANG ,IEXPn ),
  399. RW_Entry(LANGUAGE ,IEXP3 ),
  400. RW_Entry(LEFTMARGIN ,IEXPn ),
  401. RW_Entry(LENGTH ,IE40 ),
  402. RW_Entry(LETTERSPACING ,IE40 ),
  403. RW_Entry(LINEHEIGHT ,IE40 ),
  404. RW_Entry(LINK ,IEXPn ),
  405. RW_Entry(LINKCOLOR ,IE40 ),
  406. RW_Entry(LISTSTYLE ,IE40 ),
  407. RW_Entry(LISTSTYLEIMAGE ,IE40 ),
  408. RW_Entry(LISTSTYLEPOSITION ,IE40 ),
  409. RW_Entry(LISTSTYLETYPE ,IE40 ),
  410. RW_Entry(LOCATION ,IE40 ),
  411. RW_Entry(LOOP ,IEXPn ),
  412. RW_Entry(LOWSRC ,IE40 ),
  413. RW_Entry(MAP ,IE40 ),
  414. RW_Entry(MARGIN ,IE40 ),
  415. RW_Entry(MARGINBOTTOM ,IE40 ),
  416. RW_Entry(MARGINHEIGHT ,IEXP3 ),
  417. RW_Entry(MARGINLEFT ,IE40 ),
  418. RW_Entry(MARGINRIGHT ,IE40 ),
  419. RW_Entry(MARGINTOP ,IE40 ),
  420. RW_Entry(MARGINWIDTH ,IEXP3 ),
  421. RW_Entry(MAXLENGTH ,ALL ),
  422. RW_Entry(METHOD ,ALL ),
  423. RW_Entry(METHODS ,ALL ),
  424. RW_Entry(MIMETYPES ,IE40 ),
  425. RW_Entry(MULTIPLE ,ALL ),
  426. RW_Entry(NAME ,ALL ),
  427. RW_Entry(NOHREF ,IEXPn ),
  428. RW_Entry(NORESIZE ,IEXP3 ),
  429. RW_Entry(NOSHADE ,IEXP3 ), // not implemented by IExplore 2
  430. RW_Entry(NOWRAP ,IEXPn ),
  431. RW_Entry(OBJECT ,IEXP3 ), // <PARAM>
  432. RW_Entry(OFFSCREENBUFFERING ,IE40 ),
  433. RW_Entry(OFFSETHEIGHT ,IE40 ),
  434. RW_Entry(OFFSETLEFT ,IE40 ),
  435. RW_Entry(OFFSETPARENT ,IE40 ),
  436. RW_Entry(OFFSETTOP ,IE40 ),
  437. RW_Entry(OFFSETWIDTH ,IE40 ),
  438. RW_Entry(OFFSETX ,IE40 ),
  439. RW_Entry(OFFSETY ,IE40 ),
  440. RW_Entry(ONABORT ,IE40 ),
  441. RW_Entry(ONAFTERUPDATE ,IE40 ),
  442. RW_Entry(ONBEFOREUNLOAD ,IE40 ),
  443. RW_Entry(ONBEFOREUPDATE ,IE40 ),
  444. RW_Entry(ONBLUR ,IEXP3 ), // SELECT, INPUT, TEXTAREA
  445. RW_Entry(ONBOUNCE ,IE40 ),
  446. RW_Entry(ONCHANGE ,IEXP3 ), // SELECT, INPUT, TEXTAREA
  447. RW_Entry(ONCLICK ,IEXP3 ), // INPUT, A, <more>
  448. RW_Entry(ONDATAAVAILABLE ,IE40 ),
  449. RW_Entry(ONDATASETCHANGED ,IE40 ),
  450. RW_Entry(ONDATASETCOMPLETE ,IE40 ),
  451. RW_Entry(ONDBLCLICK ,IE40 ),
  452. RW_Entry(ONDRAGSTART ,IE40 ),
  453. RW_Entry(ONERROR ,IE40 ),
  454. RW_Entry(ONERRORUPDATE ,IE40 ),
  455. RW_Entry(ONFILTERCHANGE ,IE40 ),
  456. RW_Entry(ONFINISH ,IE40 ),
  457. RW_Entry(ONFOCUS ,IEXP3 ), // SELECT, INPUT, TEXTAREA
  458. RW_Entry(ONHELP ,IE40 ),
  459. RW_Entry(ONKEYDOWN ,IE40 ),
  460. RW_Entry(ONKEYPRESS ,IE40 ),
  461. RW_Entry(ONKEYUP ,IE40 ),
  462. RW_Entry(ONLOAD ,IEXP3 ), // FRAMESET, BODY
  463. RW_Entry(ONMOUSEOUT ,IEXP3 ), // A, AREA, <more>
  464. RW_Entry(ONMOUSEOVER ,IEXP3 ), // A, AREA, <more>
  465. RW_Entry(ONMOUSEUP ,IE40 ),
  466. RW_Entry(ONREADYSTATECHANGE ,IE40 ),
  467. RW_Entry(ONRESET ,IE40 ),
  468. RW_Entry(ONRESIZE ,IE40 ),
  469. RW_Entry(ONROWENTER ,IE40 ),
  470. RW_Entry(ONROWEXIT ,IE40 ),
  471. RW_Entry(ONSCROLL ,IE40 ),
  472. RW_Entry(ONSELECT ,IEXP3 ), // INPUT, TEXTAREA
  473. RW_Entry(ONSELECTSTART ,IE40 ),
  474. RW_Entry(ONSUBMIT ,IEXP3 ), // FORM
  475. RW_Entry(ONUNLOAD ,IEXP3 ), // FRAMESET, BODY
  476. RW_Entry(OPENER ,IE40 ),
  477. RW_Entry(OUTERHTML ,IE40 ),
  478. RW_Entry(OUTERTEXT ,IE40 ),
  479. RW_Entry(OUTLINE ,IEXP3 ),
  480. RW_Entry(OVERFLOW ,IE40 ),
  481. RW_Entry(OWNINGELEMENT ,IE40 ),
  482. RW_Entry(PADDING ,IE40 ),
  483. RW_Entry(PADDINGBOTTOM ,IE40 ),
  484. RW_Entry(PADDINGLEFT ,IE40 ),
  485. RW_Entry(PADDINGRIGHT ,IE40 ),
  486. RW_Entry(PADDINGTOP ,IE40 ),
  487. RW_Entry(PAGEBREAKAFTER ,IE40 ),
  488. RW_Entry(PAGEBREAKBEFORE ,IE40 ),
  489. RW_Entry(PALETTE ,IE40 ),
  490. RW_Entry(PARENT ,IE40 ),
  491. RW_Entry(PARENTELEMENT ,IE40 ),
  492. RW_Entry(PARENTSTYLESHEET ,IE40 ),
  493. RW_Entry(PARENTTEXTEDIT ,IE40 ),
  494. RW_Entry(PARENTWINDOW ,IE40 ),
  495. RW_Entry(PATHNAME ,IE40 ),
  496. RW_Entry(PIXELHEIGHT ,IE40 ),
  497. RW_Entry(PIXELLEFT ,IE40 ),
  498. RW_Entry(PIXELTOP ,IE40 ),
  499. RW_Entry(PIXELWIDTH ,IE40 ),
  500. RW_Entry(PLUGINS ,IE40 ),
  501. RW_Entry(PLUGINSPAGE ,IE40 ),
  502. RW_Entry(PORT ,IE40 ),
  503. RW_Entry(POSHEIGHT ,IE40 ),
  504. RW_Entry(POSITION ,IE40 ),
  505. RW_Entry(POSLEFT ,IE40 ),
  506. RW_Entry(POSTOP ,IE40 ),
  507. RW_Entry(POSWIDTH ,IE40 ),
  508. RW_Entry(PROMPT ,IEXPn ),
  509. RW_Entry(PROTOCOL ,IE40 ),
  510. RW_Entry(READONLY ,IE40 ),
  511. RW_Entry(READYSTATE ,IE40 ),
  512. RW_Entry(REASON ,IE40 ),
  513. RW_Entry(RECORDNUMBER ,IE40 ),
  514. RW_Entry(RECORDSET ,IE40 ),
  515. RW_Entry(REF ,IEXP3 ),
  516. RW_Entry(REFERRER ,IE40 ),
  517. RW_Entry(REL ,ALL ),
  518. RW_Entry(RETURNVALUE ,IE40 ),
  519. RW_Entry(REV ,ALL ),
  520. RW_Entry(RIGHTMARGIN ,IEXPn ),
  521. RW_Entry(ROWS ,ALL ),
  522. RW_Entry(ROWSPAN ,IEXPn ), // tables
  523. RW_Entry(RULES ,IEXP3 ),
  524. RW_Entry(RUNAT ,IEXP3 ), // SCRIPT
  525. RW_Entry(SCREENX ,IE40 ),
  526. RW_Entry(SCREENY ,IE40 ),
  527. RW_Entry(SCRIPTENGINE ,IEXP3 ),
  528. RW_Entry(SCROLL ,IE40 ),
  529. RW_Entry(SCROLLAMOUNT ,IEXPn ), // MARQUEE
  530. RW_Entry(SCROLLDELAY ,IEXPn ), // MARQUEE
  531. RW_Entry(SCROLLHEIGHT ,IE40 ),
  532. RW_Entry(SCROLLING ,IEXP3 ), // frameset
  533. RW_Entry(SCROLLLEFT ,IE40 ),
  534. RW_Entry(SCROLLTOP ,IE40 ),
  535. RW_Entry(SCROLLWIDTH ,IE40 ),
  536. RW_Entry(SEARCH ,IE40 ),
  537. RW_Entry(SELECTED ,ALL ),
  538. RW_Entry(SELECTEDINDEX ,IE40 ),
  539. RW_Entry(SELF ,IE40 ),
  540. RW_Entry(SHAPE ,IEXPn ),
  541. RW_Entry(SHAPES ,IEXP3 ), //objects
  542. RW_Entry(SHIFTKEY ,IE40 ),
  543. RW_Entry(SIZE ,ALL ),
  544. RW_Entry(SOURCEINDEX ,IE40 ),
  545. RW_Entry(SPAN ,IEXP3 ),
  546. RW_Entry(SRC ,ALL ),
  547. RW_Entry(SRCELEMENT ,IE40 ),
  548. RW_Entry(SRCFILTER ,IE40 ),
  549. RW_Entry(STANDBY ,IEXP3 ), //objects
  550. RW_Entry(START ,IEXPn ),
  551. RW_Entry(STARTSPAN ,ALL ), // Designer control tags
  552. RW_Entry(STATUS ,IE40 ),
  553. RW_Entry(STYLE ,IEXP3 ),
  554. RW_Entry(STYLEFLOAT ,IE40 ),
  555. RW_Entry(TABINDEX ,IEXP3 ),
  556. RW_Entry(TAGNAME ,IE40 ),
  557. RW_Entry(TARGET ,IEXP3 ),
  558. RW_Entry(TEXT ,IEXPn ),
  559. RW_Entry(TEXTALIGN ,IE40 ),
  560. RW_Entry(TEXTDECORATION ,IE40 ),
  561. RW_Entry(TEXTDECORATIONBLINK ,IE40 ),
  562. RW_Entry(TEXTDECORATIONLINETHROUGH ,IE40 ),
  563. RW_Entry(TEXTDECORATIONNONE ,IE40 ),
  564. RW_Entry(TEXTDECORATIONOVERLINE ,IE40 ),
  565. RW_Entry(TEXTDECORATIONUNDERLINE ,IE40 ),
  566. RW_Entry(TEXTINDENT ,IE40 ),
  567. RW_Entry(TEXTTRANSFORM ,IE40 ),
  568. RW_Entry(TITLE ,ALL ),
  569. RW_Entry(TOELEMENT ,IE40 ),
  570. RW_Entry(TOP ,IE40 ),
  571. RW_Entry(TOPMARGIN ,IEXPn ),
  572. RW_Entry(TRUESPEED ,IE40 ),
  573. RW_Entry(TYPE ,IEXPn ),
  574. RW_Entry(UPDATEINTERVAL ,IE40 ),
  575. RW_Entry(URL ,IEXP3 ),
  576. RW_Entry(URN ,ALL ),
  577. RW_Entry(USEMAP ,IEXPn ),
  578. RW_Entry(USERAGENT ,IE40 ),
  579. RW_Entry(VALIGN ,IEXPn ),
  580. RW_Entry(VALUE ,ALL ),
  581. RW_Entry(VERSION ,IEXP3 ), // HTML
  582. RW_Entry(VERTICALALIGN ,IE40 ),
  583. RW_Entry(VIEWASTEXT ,ALL ), // ViewAsText for AspView only
  584. RW_Entry(VISIBILITY ,IE40 ),
  585. RW_Entry(VLINK ,IEXPn ),
  586. RW_Entry(VLINKCOLOR ,IE40 ),
  587. RW_Entry(VOLUME ,IE40 ),
  588. RW_Entry(VRML ,IEXPn ),
  589. RW_Entry(VSPACE ,IEXPn ),
  590. RW_Entry(WIDTH ,ALL ),
  591. RW_Entry(WRAP ,IEXP3 ),
  592. RW_Entry(X ,IE40 ),
  593. RW_Entry(Y ,IE40 ),
  594. RW_Entry(ZINDEX ,IE40 ),
  595. };
  596. // If you modify the element, attribute, or entity tables, then you MUST
  597. // update Token.h.
  598. static int _rgIndexAttributeNames[] = // [Attributes]
  599. {
  600. /* A */ TokAttrib_ACCESSKEY ,
  601. /* B */ TokAttrib_BACKGROUND ,
  602. /* C */ TokAttrib_CANCELBUBBLE ,
  603. /* D */ TokAttrib_DATA ,
  604. /* E */ TokAttrib_ENCODING ,
  605. /* F */ TokAttrib_FACE ,
  606. /* G */ 0 ,
  607. /* H */ TokAttrib_HASH ,
  608. /* I */ TokAttrib_ID ,
  609. /* J */ 0 ,
  610. /* K */ 0 ,
  611. /* L */ TokAttrib_LANG ,
  612. /* M */ TokAttrib_MAP ,
  613. /* N */ TokAttrib_NAME ,
  614. /* O */ TokAttrib_OBJECT ,
  615. /* P */ TokAttrib_PADDING ,
  616. /* Q */ 0 ,
  617. /* R */ TokAttrib_READONLY ,
  618. /* S */ TokAttrib_SCREENX ,
  619. /* T */ TokAttrib_TABINDEX ,
  620. /* U */ TokAttrib_UPDATEINTERVAL ,
  621. /* V */ TokAttrib_VALIGN ,
  622. /* W */ TokAttrib_WIDTH ,
  623. /* X */ TokAttrib_X ,
  624. /* Y */ TokAttrib_Y ,
  625. /* Z */ TokAttrib_ZINDEX
  626. };
  627. //
  628. // Entities
  629. //
  630. // ALL - Basic - RFC 1866, 9.7.1. Numeric and Special Graphic Entity Set
  631. // ALL - ISO Latin 1 - RFC 1866, 9.7.2. ISO Latin 1 Character Entity Set
  632. // IEXPn - ISO Latin 1 Added - RFC 1866, 14. Proposed Entities
  633. //
  634. // If you modify the element, attribute, or entity tables, then you MUST
  635. // update Token.h.
  636. static ReservedWord _rgEntity[] =
  637. {
  638. _T(""), 0, 0,
  639. _T("AElig"), 5, ALL, // <!ENTITY AElig CDATA "&#198;") -- capital AE diphthong (ligature) -->
  640. _T("Aacute"), 6, ALL, // <!ENTITY Aacute CDATA "&#193;") -- capital A, acute accent -->
  641. _T("Acirc"), 5, ALL, // <!ENTITY Acirc CDATA "&#194;") -- capital A, circumflex accent -->
  642. _T("Agrave"), 6, ALL, // <!ENTITY Agrave CDATA "&#192;") -- capital A, grave accent -->
  643. _T("Aring"), 5, ALL, // <!ENTITY Aring CDATA "&#197;") -- capital A, ring -->
  644. _T("Atilde"), 6, ALL, // <!ENTITY Atilde CDATA "&#195;") -- capital A, tilde -->
  645. _T("Auml"), 4, ALL, // <!ENTITY Auml CDATA "&#196;") -- capital A, dieresis or umlaut mark -->
  646. _T("Ccedil"), 6, ALL, // <!ENTITY Ccedil CDATA "&#199;") -- capital C, cedilla -->
  647. _T("ETH"), 3, ALL, // <!ENTITY ETH CDATA "&#208;") -- capital Eth, Icelandic -->
  648. _T("Eacute"), 6, ALL, // <!ENTITY Eacute CDATA "&#201;") -- capital E, acute accent -->
  649. _T("Ecirc"), 5, ALL, // <!ENTITY Ecirc CDATA "&#202;") -- capital E, circumflex accent -->
  650. _T("Egrave"), 6, ALL, // <!ENTITY Egrave CDATA "&#200;") -- capital E, grave accent -->
  651. _T("Euml"), 4, ALL, // <!ENTITY Euml CDATA "&#203;") -- capital E, dieresis or umlaut mark -->
  652. _T("Iacute"), 6, ALL, // <!ENTITY Iacute CDATA "&#205;") -- capital I, acute accent -->
  653. _T("Icirc"), 5, ALL, // <!ENTITY Icirc CDATA "&#206;") -- capital I, circumflex accent -->
  654. _T("Igrave"), 6, ALL, // <!ENTITY Igrave CDATA "&#204;") -- capital I, grave accent -->
  655. _T("Iuml"), 4, ALL, // <!ENTITY Iuml CDATA "&#207;") -- capital I, dieresis or umlaut mark -->
  656. _T("Ntilde"), 6, ALL, // <!ENTITY Ntilde CDATA "&#209;") -- capital N, tilde -->
  657. _T("Oacute"), 6, ALL, // <!ENTITY Oacute CDATA "&#211;") -- capital O, acute accent -->
  658. _T("Ocirc"), 5, ALL, // <!ENTITY Ocirc CDATA "&#212;") -- capital O, circumflex accent -->
  659. _T("Ograve"), 6, ALL, // <!ENTITY Ograve CDATA "&#210;") -- capital O, grave accent -->
  660. _T("Oslash"), 6, ALL, // <!ENTITY Oslash CDATA "&#216;") -- capital O, slash -->
  661. _T("Otilde"), 6, ALL, // <!ENTITY Otilde CDATA "&#213;") -- capital O, tilde -->
  662. _T("Ouml"), 4, ALL, // <!ENTITY Ouml CDATA "&#214;") -- capital O, dieresis or umlaut mark -->
  663. _T("THORN"), 5, ALL, // <!ENTITY THORN CDATA "&#222;") -- capital THORN, Icelandic -->
  664. _T("Uacute"), 6, ALL, // <!ENTITY Uacute CDATA "&#218;") -- capital U, acute accent -->
  665. _T("Ucirc"), 5, ALL, // <!ENTITY Ucirc CDATA "&#219;") -- capital U, circumflex accent -->
  666. _T("Ugrave"), 6, ALL, // <!ENTITY Ugrave CDATA "&#217;") -- capital U, grave accent -->
  667. _T("Uuml"), 4, ALL, // <!ENTITY Uuml CDATA "&#220;") -- capital U, dieresis or umlaut mark -->
  668. _T("Yacute"), 6, ALL, // <!ENTITY Yacute CDATA "&#221;") -- capital Y, acute accent -->
  669. _T("aacute"), 6, ALL, // <!ENTITY aacute CDATA "&#225;") -- small a, acute accent -->
  670. _T("acirc"), 5, ALL, // <!ENTITY acirc CDATA "&#226;") -- small a, circumflex accent -->
  671. _T("acute"), 5, IEXPn, // <!ENTITY acute CDATA "&#180;") -- acute accent -->
  672. _T("aelig"), 5, ALL, // <!ENTITY aelig CDATA "&#230;") -- small ae diphthong (ligature) -->
  673. _T("agrave"), 6, ALL, // <!ENTITY agrave CDATA "&#224;") -- small a, grave accent -->
  674. _T("amp"), 3, ALL,
  675. _T("aring"), 5, ALL, // <!ENTITY aring CDATA "&#229;") -- small a, ring -->
  676. _T("atilde"), 6, ALL, // <!ENTITY atilde CDATA "&#227;") -- small a, tilde -->
  677. _T("auml"), 4, ALL, // <!ENTITY auml CDATA "&#228;") -- small a, dieresis or umlaut mark -->
  678. _T("brvbar"), 6, IEXPn, // <!ENTITY brvbar CDATA "&#166;") -- broken (vertical) bar -->
  679. _T("ccedil"), 6, ALL, // <!ENTITY ccedil CDATA "&#231;") -- small c, cedilla -->
  680. _T("cedil"), 5, IEXPn, // <!ENTITY cedil CDATA "&#184;") -- cedilla -->
  681. _T("cent"), 4, IEXPn, // <!ENTITY cent CDATA "&#162;") -- cent sign -->
  682. _T("copy"), 4, IEXPn, // <!ENTITY copy CDATA "&#169;") -- copyright sign -->
  683. _T("curren"), 6, IEXPn, // <!ENTITY curren CDATA "&#164;") -- general currency sign -->
  684. _T("deg"), 3, IEXPn, // <!ENTITY deg CDATA "&#176;") -- degree sign -->
  685. _T("divide"), 6, IEXPn, // <!ENTITY divide CDATA "&#247;") -- divide sign -->
  686. _T("eacute"), 6, ALL, // <!ENTITY eacute CDATA "&#233;") -- small e, acute accent -->
  687. _T("ecirc"), 5, ALL, // <!ENTITY ecirc CDATA "&#234;") -- small e, circumflex accent -->
  688. _T("egrave"), 6, ALL, // <!ENTITY egrave CDATA "&#232;") -- small e, grave accent -->
  689. _T("eth"), 3, ALL, // <!ENTITY eth CDATA "&#240;") -- small eth, Icelandic -->
  690. _T("euml"), 4, ALL, // <!ENTITY euml CDATA "&#235;") -- small e, dieresis or umlaut mark -->
  691. _T("frac12"), 6, IEXPn, // <!ENTITY frac12 CDATA "&#189;") -- fraction one-half -->
  692. _T("frac14"), 6, IEXPn, // <!ENTITY frac14 CDATA "&#188;") -- fraction one-quarter -->
  693. _T("frac34"), 6, IEXPn, // <!ENTITY frac34 CDATA "&#190;") -- fraction three-quarters -->
  694. _T("gt"), 2, ALL,
  695. _T("iacute"), 6, ALL, // <!ENTITY iacute CDATA "&#237;") -- small i, acute accent -->
  696. _T("icirc"), 5, ALL, // <!ENTITY icirc CDATA "&#238;") -- small i, circumflex accent -->
  697. _T("iexcl"), 5, IEXPn, // <!ENTITY iexcl CDATA "&#161;") -- inverted exclamation mark -->
  698. _T("igrave"), 6, ALL, // <!ENTITY igrave CDATA "&#236;") -- small i, grave accent -->
  699. _T("iquest"), 6, IEXPn, // <!ENTITY iquest CDATA "&#191;") -- inverted question mark -->
  700. _T("iuml"), 4, ALL, // <!ENTITY iuml CDATA "&#239;") -- small i, dieresis or umlaut mark -->
  701. _T("laquo"), 5, IEXPn, // <!ENTITY laquo CDATA "&#171;") -- angle quotation mark, left -->
  702. _T("lt"), 2, ALL,
  703. _T("macr"), 4, IEXPn, // <!ENTITY macr CDATA "&#175;") -- macron -->
  704. _T("micro"), 5, IEXPn, // <!ENTITY micro CDATA "&#181;") -- micro sign -->
  705. _T("middot"), 6, IEXPn, // <!ENTITY middot CDATA "&#183;") -- middle dot -->
  706. _T("nbsp"), 4, IEXPn, // <!ENTITY nbsp CDATA "&#160;") -- no-break space -->
  707. _T("not"), 3, IEXPn, // <!ENTITY not CDATA "&#172;") -- not sign -->
  708. _T("ntilde"), 6, ALL, // <!ENTITY ntilde CDATA "&#241;") -- small n, tilde -->
  709. _T("oacute"), 6, ALL, // <!ENTITY oacute CDATA "&#243;") -- small o, acute accent -->
  710. _T("ocirc"), 5, ALL, // <!ENTITY ocirc CDATA "&#244;") -- small o, circumflex accent -->
  711. _T("ograve"), 6, ALL, // <!ENTITY ograve CDATA "&#242;") -- small o, grave accent -->
  712. _T("ordf"), 4, IEXPn, // <!ENTITY ordf CDATA "&#170;") -- ordinal indicator, feminine -->
  713. _T("ordm"), 4, IEXPn, // <!ENTITY ordm CDATA "&#186;") -- ordinal indicator, masculine -->
  714. _T("oslash"), 6, ALL, // <!ENTITY oslash CDATA "&#248;") -- small o, slash -->
  715. _T("otilde"), 6, ALL, // <!ENTITY otilde CDATA "&#245;") -- small o, tilde -->
  716. _T("ouml"), 4, ALL, // <!ENTITY ouml CDATA "&#246;") -- small o, dieresis or umlaut mark -->
  717. _T("para"), 4, IEXPn, // <!ENTITY para CDATA "&#182;") -- pilcrow (paragraph sign) -->
  718. _T("plusmn"), 6, IEXPn, // <!ENTITY plusmn CDATA "&#177;") -- plus-or-minus sign -->
  719. _T("pound"), 5, IEXPn, // <!ENTITY pound CDATA "&#163;") -- pound sterling sign -->
  720. _T("quot"), 4, ALL,
  721. _T("raquo"), 5, IEXPn, // <!ENTITY raquo CDATA "&#187;") -- angle quotation mark, right -->
  722. _T("reg"), 3, IEXPn, // <!ENTITY reg CDATA "&#174;") -- registered sign -->
  723. _T("sect"), 4, IEXPn, // <!ENTITY sect CDATA "&#167;") -- section sign -->
  724. _T("shy"), 3, IEXPn, // <!ENTITY shy CDATA "&#173;") -- soft hyphen -->
  725. _T("sup1"), 4, IEXPn, // <!ENTITY sup1 CDATA "&#185;") -- superscript one -->
  726. _T("sup2"), 4, IEXPn, // <!ENTITY sup2 CDATA "&#178;") -- superscript two -->
  727. _T("sup3"), 4, IEXPn, // <!ENTITY sup3 CDATA "&#179;") -- superscript three -->
  728. _T("szlig"), 5, ALL, // <!ENTITY szlig CDATA "&#223;") -- small sharp s, German (sz ligature)->
  729. _T("thorn"), 5, ALL, // <!ENTITY thorn CDATA "&#254;") -- small thorn, Icelandic -->
  730. _T("times"), 5, IEXPn, // <!ENTITY times CDATA "&#215;") -- multiply sign -->
  731. _T("uacute"), 6, ALL, // <!ENTITY uacute CDATA "&#250;") -- small u, acute accent -->
  732. _T("ucirc"), 5, ALL, // <!ENTITY ucirc CDATA "&#251;") -- small u, circumflex accent -->
  733. _T("ugrave"), 6, ALL, // <!ENTITY ugrave CDATA "&#249;") -- small u, grave accent -->
  734. _T("uml"), 3, IEXPn, // <!ENTITY uml CDATA "&#168;") -- umlaut (dieresis) -->
  735. _T("uuml"), 4, ALL, // <!ENTITY uuml CDATA "&#252;") -- small u, dieresis or umlaut mark -->
  736. _T("yacute"), 6, ALL, // <!ENTITY yacute CDATA "&#253;") -- small y, acute accent -->
  737. _T("yen"), 3, IEXPn, // <!ENTITY yen CDATA "&#165;") -- yen sign -->
  738. _T("yuml"), 4, ALL, // <!ENTITY yuml CDATA "&#255;") -- small y, dieresis or umlaut mark -->
  739. };
  740. // If you modify the element, attribute, or entity tables, then you MUST
  741. // update Token.h.
  742. static int _rgIndexEntity[] =
  743. {
  744. // A B C D E F G H I J K L M
  745. 1, 0, 8, 0, 9, 0, 0, 0, 14, 0, 0, 0, 0,
  746. // N O P Q R S T U V W X Y Z
  747. 18, 19, 0, 0, 0, 0, 25, 26, 0, 0, 0, 30, 0,
  748. // a b c d e f g h i j k l m
  749. 31, 40, 41, 46, 48, 53, 56, 0, 57, 0, 0, 63, 65,
  750. // n o p q r s t u v w x y z
  751. 68, 71, 79, 82, 83, 85, 91, 93, 0, 0, 0, 98, 0
  752. };
  753. ////////////////////////////////////////////////////////////////////////////
  754. //
  755. //
  756. // int LookupLinearKeyword
  757. //
  758. // Description:
  759. // Does the lookup in the given table.
  760. // Returns index into table if found, NOT_FOUND otw.
  761. //
  762. int LookupLinearKeyword
  763. (
  764. ReservedWord *rwTable,
  765. int cel,
  766. RWATT_T att,
  767. LPCTSTR pchLine,
  768. int cbLen,
  769. BOOL bCase /* = NOCASE */
  770. )
  771. {
  772. int iTable = 0;
  773. ASSERT(cel > 0);
  774. PFNNCMP pfnNCmp = bCase ? (_tcsncmp) : (_tcsnicmp);
  775. do
  776. {
  777. int Cmp;
  778. if (0 == (Cmp = pfnNCmp(pchLine, rwTable[iTable].psz, cbLen)) &&
  779. (cbLen == rwTable[iTable].cb))
  780. return (0 != (rwTable[iTable].att & att)) ? iTable : NOT_FOUND;
  781. else if (Cmp < 0)
  782. return NOT_FOUND;
  783. else
  784. iTable++;
  785. } while (iTable < cel);
  786. return NOT_FOUND;
  787. }
  788. ////////////////////////////////////////////////////////////////////////////
  789. // LookupIndexedKeyword()
  790. //
  791. int LookupIndexedKeyword
  792. (
  793. ReservedWord *rwTable,
  794. int cel,
  795. int * indexTable,
  796. RWATT_T att,
  797. LPCTSTR pchLine,
  798. int cbLen,
  799. BOOL bCase /* = NOCASE */
  800. )
  801. {
  802. // lookup table:
  803. int iTable;
  804. int index = PeekIndex(*pchLine, bCase);
  805. if (index < 0)
  806. return NOT_FOUND;
  807. else
  808. iTable = indexTable[index];
  809. if (0 == iTable)
  810. return NOT_FOUND;
  811. int iFound = LookupLinearKeyword(&rwTable[iTable], cel - iTable,
  812. att, pchLine, cbLen, bCase);
  813. return (iFound == NOT_FOUND) ? NOT_FOUND : iTable + iFound;
  814. }
  815. ////////////////////////////////////////////////////////////////////////////
  816. // hinting table - character classification
  817. // HOP
  818. // () ? , | + [] * =
  819. // in tag, op
  820. //
  821. // HDA
  822. // - op
  823. // -- comment
  824. //
  825. // HEN
  826. // & in text, entity ref
  827. // in tag, op
  828. //
  829. // HEP
  830. // % in tag, parameter entity ref (%name) or op (%WS)
  831. //
  832. // HRN
  833. // # reserved name
  834. //
  835. // HTA
  836. // < tag open
  837. // </ tag end
  838. // <! MDO Markup delimiter open
  839. // <? processing instruction - what's the syntax for a complete PI tag?
  840. // Hint table:
  841. HINT g_hintTable[128] =
  842. {
  843. // 0 1 2 3 4 5 6 7 8 9 a b c d e f
  844. EOS, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, HWS, ONL, ERR, ERR, ERR, ERR, ERR,
  845. // 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
  846. ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
  847. // spc ! " # $ % & ' ( ) * + , - . /
  848. HWS, ERR, HST, HRN, ERR, HEP, HEN, HSL, OLP, ORP, OST, OPL, OCO, ODA, HKW, HAV,
  849. // 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
  850. HNU, HNU, HNU, HNU, HNU, HNU, HNU, HNU, HNU, HNU, ERR, ERR, HTA, OEQ, HTE, OQU,
  851. // @ A B C D E F G H I J K L M N O
  852. ERR, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW,
  853. // P Q R S T U V W X Y Z [ \ ] ^ _
  854. HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, OLB, HAV, ORB, ERR, HAV,
  855. // ` a b c d e f g h i j k l m n o
  856. ERR, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW,
  857. // p q r s t u v w x y z { | } ~ DEL
  858. HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, HKW, ERR, OPI, ERR, ERR, ERR
  859. };
  860. ////////////////////////////////////////////////////////////////////////////
  861. // content model
  862. //
  863. // Map between element / lex state
  864. //
  865. // 0-terminated list
  866. // if we get more, consider putting text state in element table
  867. static ELLEX _ElTextStateTable[] =
  868. {
  869. _T("COMMENT"), 7, inCOMMENT,
  870. _T("LISTING"), 7, inLISTING,
  871. _T("PLAINTEXT"), 9, inPLAINTEXT,
  872. _T("SCRIPT"), 6, inSCRIPT,
  873. _T("XMP"), 3, inXMP,
  874. 0, 0, 0
  875. };
  876. DWORD TextStateFromElement(LPCTSTR szEl, int cb)
  877. {
  878. int cmp;
  879. for (ELLEX *pel = _ElTextStateTable; pel->sz != 0; pel++)
  880. {
  881. if (0 == (cmp = _tcsnicmp(pel->sz, szEl, cb)))
  882. {
  883. if (cb == pel->cb)
  884. return pel->lxs;
  885. }
  886. else if (cmp > 0)
  887. return 0;
  888. }
  889. return 0;
  890. }
  891. ELLEX * pellexFromTextState(DWORD state)
  892. {
  893. DWORD t = (state & TEXTMASK); // only want text state bits
  894. for (ELLEX *pellex = _ElTextStateTable; pellex->lxs != 0; pellex++)
  895. {
  896. if (t == pellex->lxs)
  897. return pellex;
  898. }
  899. return 0;
  900. }
  901. ////////////////////////////////////////////////////////////////////////////
  902. // CStaticTable
  903. CStaticTable::CStaticTable(RWATT_T att,
  904. ReservedWord *prgrw,
  905. UINT cel,
  906. int *prgi /*= NULL*/,
  907. BOOL bCase /*= FALSE*/,
  908. LPCTSTR szName /*= NULL*/)
  909. : m_att(att), m_prgrw(prgrw), m_cel(cel), m_prgi(prgi), m_bCase(bCase)
  910. {
  911. ASSERT(NULL != m_prgrw);
  912. ASSERT(m_cel > 0);
  913. ASSERT(0 == CheckWordTable(m_prgrw, cel, szName));
  914. if (NULL == m_prgi)
  915. {
  916. MakeIndex(m_prgrw, m_cel, &m_prgi, m_bCase, szName);
  917. }
  918. else
  919. ASSERT(0 == CheckWordTableIndex(m_prgrw, cel, prgi, m_bCase, szName));
  920. }
  921. int CStaticTable::Find(LPCTSTR pch, int cb)
  922. {
  923. return LookupIndexedKeyword(m_prgrw, m_cel, m_prgi, m_att, pch, cb, m_bCase);
  924. }
  925. ////////////////////////////////////////////////////////////////////////////
  926. CStaticTableSet::CStaticTableSet(RWATT_T att, UINT nIdName)
  927. : m_Elements ( att, _rgElementNames, CELEM_ARRAY(_rgElementNames),
  928. _rgIndexElementNames, NOCASE, szElTag ),
  929. m_Attributes( att, _rgAttributeNames, CELEM_ARRAY(_rgAttributeNames),
  930. _rgIndexAttributeNames, NOCASE, szAttTag ),
  931. m_Entities ( att, _rgEntity, CELEM_ARRAY(_rgEntity),
  932. _rgIndexEntity, CASE, szEntTag )
  933. {
  934. ::LoadString( _Module.GetModuleInstance(),
  935. nIdName,
  936. m_strName,
  937. sizeof(m_strName)
  938. );
  939. }
  940. int CStaticTableSet::FindElement(LPCTSTR pch, int cb)
  941. {
  942. return m_Elements.Find(pch, cb);
  943. }
  944. int CStaticTableSet::FindAttribute(LPCTSTR pch, int cb)
  945. {
  946. return m_Attributes.Find(pch, cb);
  947. }
  948. int CStaticTableSet::FindEntity(LPCTSTR pch, int cb)
  949. {
  950. return m_Entities.Find(pch, cb);
  951. }
  952. CStaticTableSet * g_pTabDefault;
  953. PTABLESET g_pTable = 0;
  954. ////////////////////////////////////////////////////////////////////////////
  955. //
  956. // Custom HTML tables
  957. //
  958. /*
  959. @HLX@ "Internet Explorer 3.0"
  960. ;Custom HTML tagset file must begin with the "@HLX@"
  961. ;signature and the name of the HTML variant in quotes.
  962. [Elements]
  963. ; element set
  964. [Attributes]
  965. ; attribute set
  966. [Entities]
  967. ; entity set
  968. */
  969. // qsort/bsearch helper
  970. int CmpFunc(const void *a, const void *b)
  971. {
  972. CLStr *A = (CLStr*)a;
  973. CLStr *B = (CLStr*)b;
  974. int r = memcmp(A->m_rgb, B->m_rgb, __min(A->m_cb, B->m_cb));
  975. return (0 == r) ? (A->m_cb - B->m_cb) : r;
  976. }