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.

809 lines
31 KiB

  1. /* Copied from ..\htmed\itoken.h and changed name from ITokenizer to ITokGen
  2. and itoken.h to token.h just to avoid name confusion in future. */
  3. /*
  4. File: Token.h
  5. Copyright (c) 1997-1999 Microsoft Corporation. All Rights Reserved.
  6. Abstract:
  7. ITokenizer interface and its types
  8. */
  9. #if !defined __INC_TOKEN_H__
  10. #define __INC_TOKEN_H__
  11. typedef int TOKEN;
  12. // A text token block indicates the token, and its starting and ending
  13. // indexes in the line of source just lexed.
  14. // Note that for any N > 0, rgtxtb[N].ibTokMin >= rgtxtb[N-1].ibTokMac.
  15. // if it is such that rgtxtb[N].ibTokMin > rgtxtb[N-1].ibTokMac, then
  16. // the intervening unclassified characters are treated as white space tokens.
  17. typedef struct _tagTXTB { // Text token class block
  18. TOKEN tok;
  19. TOKEN tokClass;
  20. UINT ibTokMin; // token length given by ibTokMac - ibTokMin
  21. UINT ibTokMac; // given in bytes
  22. } TXTB;
  23. // ********* defines specific to TRIEDIT begin here
  24. enum ObjectTypes
  25. {
  26. OT_NONE = 0,
  27. OT_ACTIVEXCONTROL = 0x1,
  28. OT_DESIGNTIMECONTROL = 0x2,
  29. OT_INPUT = 0x4,
  30. OT_TABLE = 0x8,
  31. OT_APPLET = 0x10,
  32. OT_INVISIBLE = 0x8000,
  33. OT_VISIBLEITEMS = 0x4fff,
  34. OT_ALLITEMS = 0xffff
  35. };
  36. enum ParserStates
  37. {
  38. PS_HTML,
  39. PS_SIMPLETAG, // simple tag that cannot have </ nested within it
  40. PS_OBJECT,
  41. PS_METADATASTART,
  42. PS_METADATABODY,
  43. PS_METADATAEND
  44. };
  45. enum ObjectParserStates
  46. {
  47. OPS_NONE,
  48. OPS_CLASSID
  49. };
  50. enum TagStates
  51. {
  52. TS_NONE, // in tag, looking for the end tag
  53. TS_FOUNDTAGCLOSE, // found > closing the start element
  54. TS_FOUNDTAGEND // found </ next token should be end tag token
  55. };
  56. enum DesignControlStates
  57. {
  58. DTCS_NONE, // just found METADATA
  59. DTCS_TYPE, // found TYPE attribute
  60. DTCS_DTCTYPE, // found DesignerControl attribute value
  61. DTCS_ENDSPAN // found endspan
  62. };
  63. enum FilterMode
  64. { modeNone, modeInput, modeOutput };
  65. #define cbHeader 0x8000 // initial buffer size to save all contents before/after <BODY> tag
  66. #define MAX_BLOCKS 20 // max # of blocks that hold the replaced data
  67. #define MAX_TOKIDLEN 32 // max length of a token identifier
  68. struct TOKSTRUCT // holds elements of token array generated from the document
  69. {
  70. TXTB token;
  71. BOOL fStart;
  72. UINT ichStart;
  73. UINT iNextprev;
  74. UINT iNextPrevAlternate;
  75. INT tagID;
  76. };
  77. struct TOKSTACK
  78. {
  79. UINT iMatch;
  80. INT tagID;
  81. UINT ichStart; // start char position of this token in the input buffer
  82. TXTB token; // used in special cases (<%, %>) where tagID is -1
  83. };
  84. // ********* defines specific to TRIEDIT end here
  85. interface ITokenGen : public IUnknown
  86. {
  87. public:
  88. // Gets then next token given the text
  89. // pszText: stream of text - UNICODE only!!!!
  90. // cbText: count of bytes in pszText
  91. // pcbCur: current byte position in pszText.
  92. // set to 0 for start of pszText
  93. // pLXS: should be 0, on initial call
  94. // pToken: TXTB structure which contains the token info
  95. // returns:
  96. // NOERROR if found the next token
  97. // S_FALSE if no more tokens
  98. // error if there was an error
  99. //
  100. virtual HRESULT STDMETHODCALLTYPE NextToken(
  101. /* [in] */ LPCWSTR pszText,
  102. /* [in] */ UINT cbText,
  103. /* [in, out] */ UINT *pcbCur,
  104. /* [in, out] */ DWORD *pLXS,
  105. /* [out] */ TXTB *pToken) = 0;
  106. // Tokenizes & Parses the input buffer
  107. // hOld: source buffer
  108. // phNew or pStmNew: filtered buffer (based on dwFlagsUsePstmNew)
  109. // pStmNew
  110. // dwFlags:filter flags
  111. // mode: input/output mode.
  112. // cbSizeIn: size of input buffer in bytes (if -1, assume NULL terminated buffer)
  113. // *pcbSizeOut:size of output buffer in bytes
  114. // pUnkTrident:trident's IUnknown
  115. // phgTokArray:Token Array (freed by the caller)
  116. // pcMaxToken:number of tokens in phgTokArray
  117. // phgDocRestore:stores document contents which are used for filtering
  118. // bstrBaseURL:used to convert URLs on a page into Relative URL (can be NULL)
  119. // dwReserved - must be 0 (added for future use)
  120. // returns:
  121. // S_OK if no errors
  122. // E_OUTOFMEMORY if any allocation failed
  123. // E_FILTERFRAMESET or E_FILTERSERVERSCRIPT for html files that cannot be filtered
  124. virtual HRESULT STDMETHODCALLTYPE hrTokenizeAndParse(
  125. /* [in] */ HGLOBAL hOld,
  126. /* [out] */ HGLOBAL *phNew,
  127. /* [in/out]*/ IStream *pStmNew,
  128. /* [in] */ DWORD dwFlags,
  129. /* [in] */ FilterMode mode,
  130. /* [in] */ int cbSizeIn,
  131. /* [out] */ UINT* pcbSizeOut,
  132. /* [in] */ IUnknown *pUnkTrident,
  133. /* [out] */ HGLOBAL *phgTokArray,
  134. /* [out] */ UINT *pcMaxToken,
  135. /* [in/out]*/ HGLOBAL *phgDocRestore,
  136. /* [in] */ BSTR bstrBaseURL,
  137. /* [in] */ DWORD dwReserved) = 0;
  138. };
  139. enum TOKCLS { // token classes
  140. tokclsError = 0,
  141. // all standard language keywords
  142. tokclsKeyWordMin = 1,
  143. // for block start/end that are keywords instead of operators...like
  144. // Pascal or BASIC for instance.
  145. tokclsKeyWordOpenBlock = 0xfe,
  146. tokclsKeyWordCloseBlock = 0xff,
  147. tokclsKeyWordMax = 0x100,
  148. // all language operators
  149. tokclsOpMin = 0x100,
  150. tokclsOpSpecOpenBlock = 0x1fe,
  151. tokclsOpSpecCloseBlock = 0x1ff,
  152. tokclsOpMax = 0x200,
  153. // special, hard coded operators that editor keys off of
  154. tokclsOpSpecMin = 0x200,
  155. tokclsOpSpecEOL = 0x200,
  156. tokclsOpSpecLineCmt = 0x201, // automatic skip to eol on this one
  157. tokclsOpSpecEOS = 0x202,
  158. tokclsOpSpecMax = 0x210,
  159. // all identifiers, give ~500 possibilities
  160. tokclsIdentMin = 0x210,
  161. tokclsIdentUser = 0x211, // special idents (user keywords)
  162. tokclsIdentMax = 0x400,
  163. // all constants (numeric and string)
  164. tokclsConstMin = 0x400,
  165. tokclsConstInteger = 0x400,
  166. tokclsConstReal = 0x401,
  167. tokclsConstString = 0x402,
  168. tokclsStringPart = 0x402, // partial string ("....)
  169. tokclsConstMax = 0x410,
  170. // comments
  171. tokclsCommentMin = 0x500,
  172. tokclsCommentPart = 0x500, // partial comment (/* ...)
  173. tokclsCommentMax = 0x510,
  174. // language dependent token class(es) start at 0x800 to 0xfff
  175. tokclsUserMin = 0x800,
  176. tokclsUserLast = 0xfff,
  177. tokclsUserMax = 0x1000,
  178. // mask to ignore all the bits in a token[class] that the lexer can use
  179. // for private status. they will be masked off and ignored by clients
  180. // of the lexer. A good use of this feature is to encode the real token
  181. // type in the lexer private portion (area is ~tokclsMask) when including
  182. // meta-token types (such as MFC/Wizard user token types) so that other
  183. // clients of the lexer can keep that information.
  184. tokclsUserMask = ~(tokclsUserMin - 1),
  185. tokclsMask = tokclsUserLast,
  186. };
  187. // NOTE:
  188. // ========================================================================
  189. // PLEASE LET sridharc KNOW IF YOU PLAN TO ADD/REMOVE A TOKEN FROM
  190. // THE BELOW ENUM, SINCE HE IS DEPENDING UPON THIS ORDER FOR HIS TAG PROPERTY
  191. // EDITING. THANKS.
  192. // ========================================================================
  193. typedef enum tagElementTokens
  194. {
  195. TokElem_Empty = 0 , /* Empty */
  196. TokElem_A = 1 , /* A */
  197. TokElem_ADDRESS = 2 , /* ADDRESS */
  198. TokElem_APPLET = 3 , /* APPLET */
  199. TokElem_AREA = 4 , /* AREA */
  200. TokElem_B = 5 , /* B */
  201. TokElem_BASE = 6 , /* BASE */
  202. TokElem_BASEFONT = 7 , /* BASEFONT */
  203. TokElem_BGSOUND = 8 , /* BGSOUND */
  204. TokElem_BIG = 9 , /* BIG */
  205. TokElem_BLINK = 10 , /* BLINK */
  206. TokElem_BLOCKQUOTE = 11 , /* BLOCKQUOTE */
  207. TokElem_BODY = 12 , /* BODY */
  208. TokElem_BR = 13 , /* BR */
  209. TokElem_BUTTON = 14 , /* BUTTON */
  210. TokElem_CAPTION = 15 , /* CAPTION */
  211. TokElem_CENTER = 16 , /* CENTER */
  212. TokElem_CITE = 17 , /* CITE */
  213. TokElem_CODE = 18 , /* CODE */
  214. TokElem_COL = 19 , /* COL */
  215. TokElem_COLGROUP = 20 , /* COLGROUP */
  216. TokElem_COMMENT = 21 , /* COMMENT */
  217. TokElem_DD = 22 , /* DD */
  218. TokElem_DFN = 23 , /* DFN */
  219. TokElem_DIR = 24 , /* DIR */
  220. TokElem_DIV = 25 , /* DIV */
  221. TokElem_DL = 26 , /* DL */
  222. TokElem_DT = 27 , /* DT */
  223. TokElem_EM = 28 , /* EM */
  224. TokElem_EMBED = 29 , /* EMBED */
  225. TokElem_FIELDSET = 30 , /* FIELDSET */
  226. TokElem_FONT = 31 , /* FONT */
  227. TokElem_FORM = 32 , /* FORM */
  228. TokElem_FRAME = 33 , /* FRAME */
  229. TokElem_FRAMESET = 34 , /* FRAMESET */
  230. TokElem_H1 = 35 , /* H1 */
  231. TokElem_H2 = 36 , /* H2 */
  232. TokElem_H3 = 37 , /* H3 */
  233. TokElem_H4 = 38 , /* H4 */
  234. TokElem_H5 = 39 , /* H5 */
  235. TokElem_H6 = 40 , /* H6 */
  236. TokElem_HEAD = 41 , /* HEAD */
  237. TokElem_HR = 42 , /* HR */
  238. TokElem_HTML = 43 , /* HTML */
  239. TokElem_I = 44 , /* I */
  240. TokElem_IFRAME = 45 , /* IFRAME */
  241. TokElem_IMG = 46 , /* IMG */
  242. TokElem_INPUT = 47 , /* INPUT */
  243. TokElem_ISINDEX = 48 , /* ISINDEX */
  244. TokElem_KBD = 49 , /* KBD */
  245. TokElem_LABEL = 50 , /* LABEL */
  246. TokElem_LEGEND = 51 , /* LEGEND */
  247. TokElem_LI = 52 , /* LI */
  248. TokElem_LINK = 53 , /* LINK */
  249. TokElem_LISTING = 54 , /* LISTING */
  250. TokElem_MAP = 55 , /* MAP */
  251. TokElem_MARQUEE = 56 , /* MARQUEE */
  252. TokElem_MENU = 57 , /* MENU */
  253. TokElem_META = 58 , /* META */
  254. TokElem_METADATA = 59 , /* METADATA */
  255. TokElem_NOBR = 60 , /* NOBR */
  256. TokElem_NOFRAMES = 61 , /* NOFRAMES */
  257. TokElem_NOSCRIPT = 62 , /* NOSCRIPT */
  258. TokElem_OBJECT = 63 , /* OBJECT */
  259. TokElem_OL = 64 , /* OL */
  260. TokElem_OPTION = 65 , /* OPTION */
  261. TokElem_P = 66 , /* P */
  262. TokElem_PARAM = 67 , /* PARAM */
  263. TokElem_PLAINTEXT = 68 , /* PLAINTEXT */
  264. TokElem_PRE = 69 , /* PRE */
  265. TokElem_S = 70 , /* S */
  266. TokElem_SAMP = 71 , /* SAMP */
  267. TokElem_SCRIPT = 72 , /* SCRIPT */
  268. TokElem_SELECT = 73 , /* SELECT */
  269. TokElem_SMALL = 74 , /* SMALL */
  270. TokElem_SPAN = 75 , /* SPAN */
  271. TokElem_STRIKE = 76 , /* STRIKE */
  272. TokElem_STRONG = 77 , /* STRONG */
  273. TokElem_STYLE = 78 , /* STYLE */
  274. TokElem_SUB = 79 , /* SUB */
  275. TokElem_SUP = 80 , /* SUP */
  276. TokElem_TABLE = 81 , /* TABLE */
  277. TokElem_TBODY = 82 , /* TBODY */
  278. TokElem_TD = 83 , /* TD */
  279. TokElem_TEXTAREA = 84 , /* TEXTAREA */
  280. TokElem_TFOOT = 85 , /* TFOOT */
  281. TokElem_TH = 86 , /* TH */
  282. TokElem_THEAD = 87 , /* THEAD */
  283. TokElem_TITLE = 88 , /* TITLE */
  284. TokElem_TR = 89 , /* TR */
  285. TokElem_TT = 90 , /* TT */
  286. TokElem_U = 91 , /* U */
  287. TokElem_UL = 92 , /* UL */
  288. TokElem_VAR = 93 , /* VAR */
  289. TokElem_WBR = 94 , /* WBR */
  290. TokElem_XMP = 95 /* XMP */
  291. } ElementTokens;
  292. // NOTE:
  293. // ========================================================================
  294. // PLEASE LET sridharc KNOW IF YOU PLAN TO ADD/REMOVE A TOKEN FROM
  295. // THE ABOVE ENUM, SINCE HE IS DEPENDING UPON THIS ORDER FOR HIS TAG PROPERTY
  296. // ========================================================================
  297. typedef enum tagAttributeTokens
  298. {
  299. TokAttrib_Empty =0 , /* */
  300. TokAttrib_ACCESSKEY =1 ,// ACCESSKEY
  301. TokAttrib_ACTION =2 ,// ACTION
  302. TokAttrib_ALIGN =3 ,// ALIGN
  303. TokAttrib_ALINK =4 ,// ALINK
  304. TokAttrib_ALT =5 ,// ALT
  305. TokAttrib_APPNAME =6 ,// APPNAME
  306. TokAttrib_APPVERSION =7 ,// APPVERSION
  307. TokAttrib_BACKGROUND =8 ,// BACKGROUND
  308. TokAttrib_BACKGROUNDATTACHMENT =9 ,// BACKGROUNDATTACHMENT
  309. TokAttrib_BACKGROUNDCOLOR =10 ,// BACKGROUNDCOLOR
  310. TokAttrib_BACKGROUNDIMAGE =11 ,// BACKGROUNDIMAGE
  311. TokAttrib_BACKGROUNDPOSITION =12 ,// BACKGROUNDPOSITION
  312. TokAttrib_BACKGROUNDPOSITIONX =13 ,// BACKGROUNDPOSITIONX
  313. TokAttrib_BACKGROUNDPOSITIONY =14 ,// BACKGROUNDPOSITIONY
  314. TokAttrib_BACKGROUNDREPEAT =15 ,// BACKGROUNDREPEAT
  315. TokAttrib_BALANCE =16 ,// BALANCE
  316. TokAttrib_BEHAVIOR =17 ,// BEHAVIOR
  317. TokAttrib_BGCOLOR =18 ,// BGCOLOR
  318. TokAttrib_BGPROPERTIES =19 ,// BGPROPERTIES
  319. TokAttrib_BORDER =20 ,// BORDER
  320. TokAttrib_BORDERBOTTOM =21 ,// BORDERBOTTOM
  321. TokAttrib_BORDERBOTTOMCOLOR =22 ,// BORDERBOTTOMCOLOR
  322. TokAttrib_BORDERBOTTOMSTYLE =23 ,// BORDERBOTTOMSTYLE
  323. TokAttrib_BORDERBOTTOMWIDTH =24 ,// BORDERBOTTOMWIDTH
  324. TokAttrib_BORDERCOLOR =25 ,// BORDERCOLOR
  325. TokAttrib_BORDERCOLORDARK =26 ,// BORDERCOLORDARK
  326. TokAttrib_BORDERCOLORLIGHT =27 ,// BORDERCOLORLIGHT
  327. TokAttrib_BORDERLEFT =28 ,// BORDERLEFT
  328. TokAttrib_BORDERLEFTCOLOR =29 ,// BORDERLEFTCOLOR
  329. TokAttrib_BORDERLEFTSTYLE =30 ,// BORDERLEFTSTYLE
  330. TokAttrib_BORDERLEFTWIDTH =31 ,// BORDERLEFTWIDTH
  331. TokAttrib_BORDERRIGHT =32 ,// BORDERRIGHT
  332. TokAttrib_BORDERRIGHTCOLOR =33 ,// BORDERRIGHTCOLOR
  333. TokAttrib_BORDERRIGHTSTYLE =34 ,// BORDERRIGHTSTYLE
  334. TokAttrib_BORDERRIGHTWIDTH =35 ,// BORDERRIGHTWIDTH
  335. TokAttrib_BORDERSTYLE =36 ,// BORDERSTYLE
  336. TokAttrib_BORDERTOP =37 ,// BORDERTOP
  337. TokAttrib_BORDERTOPCOLOR =38 ,// BORDERTOPCOLOR
  338. TokAttrib_BORDERTOPSTYLE =39 ,// BORDERTOPSTYLE
  339. TokAttrib_BORDERTOPWIDTH =40 ,// BORDERTOPWIDTH
  340. TokAttrib_BORDERWIDTH =41 ,// BORDERWIDTH
  341. TokAttrib_BOTTOMMARGIN =42 ,// BOTTOMMARGIN
  342. TokAttrib_BREAKPOINT =43 ,// BREAKPOINT
  343. TokAttrib_BUFFERDEPTH =44 ,// BUFFERDEPTH
  344. TokAttrib_BUTTON =45 ,// BUTTON
  345. TokAttrib_CANCELBUBBLE =46 ,// CANCELBUBBLE
  346. TokAttrib_CELLPADDING =47 ,// CELLPADDING
  347. TokAttrib_CELLSPACING =48 ,// CELLSPACING
  348. TokAttrib_CENTER =49 ,// CENTER
  349. TokAttrib_CHARSET =50 ,// CHARSET
  350. TokAttrib_CHECKED =51 ,// CHECKED
  351. TokAttrib_CLASS =52 ,// CLASS
  352. TokAttrib_CLASSID =53 ,// CLASSID
  353. TokAttrib_CLASSNAME =54 ,// CLASSNAME
  354. TokAttrib_CLEAR =55 ,// CLEAR
  355. TokAttrib_CLIP =56 ,// CLIP
  356. TokAttrib_CODE =57 ,// CODE
  357. TokAttrib_CODEBASE =58 ,// CODEBASE
  358. TokAttrib_CODETYPE =59 ,// CODETYPE
  359. TokAttrib_COLOR =60 ,// COLOR
  360. TokAttrib_COLORDEPTH =61 ,// COLORDEPTH
  361. TokAttrib_COLS =62 ,// COLS
  362. TokAttrib_COLSPAN =63 ,// COLSPAN
  363. TokAttrib_COMPACT =64 ,// COMPACT
  364. TokAttrib_COMPLETE =65 ,// COMPLETE
  365. TokAttrib_CONTENT =66 ,// CONTENT
  366. TokAttrib_CONTROLS =67 ,// CONTROLS
  367. TokAttrib_COOKIE =68 ,// COOKIE
  368. TokAttrib_COOKIEENABLED =69 ,// COOKIEENABLED
  369. TokAttrib_COORDS =70 ,// COORDS
  370. TokAttrib_CSSTEXT =71 ,// CSSTEXT
  371. TokAttrib_CTRLKEY =72 ,// CTRLKEY
  372. TokAttrib_CURSOR =73 ,// CURSOR
  373. TokAttrib_DATA =74 ,// DATA
  374. TokAttrib_DECLARE =75 ,// DECLARE
  375. TokAttrib_DATAFLD =76 ,// DATAFLD
  376. TokAttrib_DATAFORMATAS =77 ,// DATAFORMATAS
  377. TokAttrib_DATAPAGESIZE =78 ,// DATAPAGESIZE
  378. TokAttrib_DATASRC =79 ,// DATASRC
  379. TokAttrib_DEFAULTCHECKED =80 ,// DEFAULTCHECKED
  380. TokAttrib_DEFAULTSELECTED =81 ,// DEFAULTSELECTED
  381. TokAttrib_DEFAULTSTATUS =82 ,// DEFAULTSTATUS
  382. TokAttrib_DEFAULTVALUE =83 ,// DEFAULTVALUE
  383. TokAttrib_DIALOGARGUMENTS =84 ,// DIALOGARGUMENTS
  384. TokAttrib_DIALOGHEIGHT =85 ,// DIALOGHEIGHT
  385. TokAttrib_DIALOGLEFT =86 ,// DIALOGLEFT
  386. TokAttrib_DIALOGTOP =87 ,// DIALOGTOP
  387. TokAttrib_DIALOGWIDTH =88 ,// DIALOGWIDTH
  388. TokAttrib_DIR =89 ,// DIR
  389. TokAttrib_DIRECTION =90 ,// DIRECTION
  390. TokAttrib_DISABLED =91 ,// DISABLED
  391. TokAttrib_DISPLAY =92 ,// DISPLAY
  392. TokAttrib_DOMAIN =93 ,// DOMAIN
  393. TokAttrib_DYNSRC =94 ,// DYNSRC
  394. TokAttrib_ENCODING =95 ,// ENCODING
  395. TokAttrib_ENCTYPE =96 ,// ENCTYPE
  396. TokAttrib_ENDSPAN =97 ,// ENDSPAN
  397. TokAttrib_ENDSPAN__ =98 ,// ENDSPAN--
  398. TokAttrib_EVENT =99 ,// EVENT
  399. TokAttrib_FACE =100 ,// FACE
  400. TokAttrib_FGCOLOR =101 ,// FGCOLOR
  401. TokAttrib_FILTER =102 ,// FILTER
  402. TokAttrib_FONT =103 ,// FONT
  403. TokAttrib_FONTFAMILY =104 ,// FONTFAMILY
  404. TokAttrib_FONTSIZE =105 ,// FONTSIZE
  405. TokAttrib_FONTSTYLE =106 ,// FONTSTYLE
  406. TokAttrib_FONTVARIANT =107 ,// FONTVARIANT
  407. TokAttrib_FONTWEIGHT =108 ,// FONTWEIGHT
  408. TokAttrib_FOR =109 ,// FOR
  409. TokAttrib_FORM =110 ,// FORM
  410. TokAttrib_FRAME =111 ,// FRAME
  411. TokAttrib_FRAMEBORDER =112 ,// FRAMEBORDER
  412. TokAttrib_FRAMESPACING =113 ,// FRAMESPACING
  413. TokAttrib_FROMELEMENT =114 ,// FROMELEMENT
  414. TokAttrib_HASH =115 ,// HASH
  415. TokAttrib_HEIGHT =116 ,// HEIGHT
  416. TokAttrib_HIDDEN =117 ,// HIDDEN
  417. TokAttrib_HOST =118 ,// HOST
  418. TokAttrib_HOSTNAME =119 ,// HOSTNAME
  419. TokAttrib_HREF =120 ,// HREF
  420. TokAttrib_HSPACE =121 ,// HSPACE
  421. TokAttrib_HTMLFOR =122 ,// HTMLFOR
  422. TokAttrib_HTMLTEXT =123 ,// HTMLTEXT
  423. TokAttrib_HTTPEQUIV =124 ,// HTTPEQUIV
  424. TokAttrib_HTTP_EQUIV =125 ,// HTTP-EQUIV
  425. TokAttrib_ID =126 ,// ID
  426. TokAttrib_IN =127 ,// IN
  427. TokAttrib_INDETERMINATE =128 ,// INDETERMINATE
  428. TokAttrib_INDEX =129 ,// INDEX
  429. TokAttrib_ISMAP =130 ,// ISMAP
  430. TokAttrib_LANG =131 ,// LANG
  431. TokAttrib_LANGUAGE =132 ,// LANGUAGE
  432. TokAttrib_LEFTMARGIN =133 ,// LEFTMARGIN
  433. TokAttrib_LENGTH =134 ,// LENGTH
  434. TokAttrib_LETTERSPACING =135 ,// LETTERSPACING
  435. TokAttrib_LINEHEIGHT =136 ,// LINEHEIGHT
  436. TokAttrib_LINK =137 ,// LINK
  437. TokAttrib_LINKCOLOR =138 ,// LINKCOLOR
  438. TokAttrib_LISTSTYLE =139 ,// LISTSTYLE
  439. TokAttrib_LISTSTYLEIMAGE =140 ,// LISTSTYLEIMAGE
  440. TokAttrib_LISTSTYLEPOSITION =141 ,// LISTSTYLEPOSITION
  441. TokAttrib_LISTSTYLETYPE =142 ,// LISTSTYLETYPE
  442. TokAttrib_LOCATION =143 ,// LOCATION
  443. TokAttrib_LOOP =144 ,// LOOP
  444. TokAttrib_LOWSRC =145 ,// LOWSRC
  445. TokAttrib_MAP =146 ,// MAP
  446. TokAttrib_MARGIN =147 ,// MARGIN
  447. TokAttrib_MARGINBOTTOM =148 ,// MARGINBOTTOM
  448. TokAttrib_MARGINHEIGHT =149 ,// MARGINHEIGHT
  449. TokAttrib_MARGINLEFT =150 ,// MARGINLEFT
  450. TokAttrib_MARGINRIGHT =151 ,// MARGINRIGHT
  451. TokAttrib_MARGINTOP =152 ,// MARGINTOP
  452. TokAttrib_MARGINWIDTH =153 ,// MARGINWIDTH
  453. TokAttrib_MAXLENGTH =154 ,// MAXLENGTH
  454. TokAttrib_METHOD =155 ,// METHOD
  455. TokAttrib_METHODS =156 ,// METHODS
  456. TokAttrib_MIMETYPES =157 ,// MIMETYPES
  457. TokAttrib_MULTIPLE =158 ,// MULTIPLE
  458. TokAttrib_NAME =159 ,// NAME
  459. TokAttrib_NOHREF =160 ,// NOHREF
  460. TokAttrib_NORESIZE =161 ,// NORESIZE
  461. TokAttrib_NOSHADE =162 ,// NOSHADE
  462. TokAttrib_NOWRAP =163 ,// NOWRAP
  463. TokAttrib_OBJECT =164 ,// OBJECT
  464. TokAttrib_OFFSCREENBUFFERING =165 ,// OFFSCREENBUFFERING
  465. TokAttrib_OFFSETHEIGHT =166 ,// OFFSETHEIGHT
  466. TokAttrib_OFFSETLEFT =167 ,// OFFSETLEFT
  467. TokAttrib_OFFSETPARENT =168 ,// OFFSETPARENT
  468. TokAttrib_OFFSETTOP =169 ,// OFFSETTOP
  469. TokAttrib_OFFSETWIDTH =170 ,// OFFSETWIDTH
  470. TokAttrib_OFFSETX =171 ,// OFFSETX
  471. TokAttrib_OFFSETY =172 ,// OFFSETY
  472. TokAttrib_ONABORT =173 ,// ONABORT
  473. TokAttrib_ONAFTERUPDATE =174 ,// ONAFTERUPDATE
  474. TokAttrib_ONBEFOREUNLOAD =175 ,// ONBEFOREUNLOAD
  475. TokAttrib_ONBEFOREUPDATE =176 ,// ONBEFOREUPDATE
  476. TokAttrib_ONBLUR =177 ,// ONBLUR
  477. TokAttrib_ONBOUNCE =178 ,// ONBOUNCE
  478. TokAttrib_ONCHANGE =179 ,// ONCHANGE
  479. TokAttrib_ONCLICK =180 ,// ONCLICK
  480. TokAttrib_ONDATAAVAILABLE =181 ,// ONDATAAVAILABLE
  481. TokAttrib_ONDATASETCHANGED =182 ,// ONDATASETCHANGED
  482. TokAttrib_ONDATASETCOMPLETE =183 ,// ONDATASETCOMPLETE
  483. TokAttrib_ONDBLCLICK =184 ,// ONDBLCLICK
  484. TokAttrib_ONDRAGSTART =185 ,// ONDRAGSTART
  485. TokAttrib_ONERROR =186 ,// ONERROR
  486. TokAttrib_ONERRORUPDATE =187 ,// ONERRORUPDATE
  487. TokAttrib_ONFILTERCHANGE =188 ,// ONFILTERCHANGE
  488. TokAttrib_ONFINISH =189 ,// ONFINISH
  489. TokAttrib_ONFOCUS =190 ,// ONFOCUS
  490. TokAttrib_ONHELP =191 ,// ONHELP
  491. TokAttrib_ONKEYDOWN =192 ,// ONKEYDOWN
  492. TokAttrib_ONKEYPRESS =193 ,// ONKEYPRESS
  493. TokAttrib_ONKEYUP =194 ,// ONKEYUP
  494. TokAttrib_ONLOAD =195 ,// ONLOAD
  495. TokAttrib_ONMOUSEOUT =196 ,// ONMOUSEOUT
  496. TokAttrib_ONMOUSEOVER =197 ,// ONMOUSEOVER
  497. TokAttrib_ONMOUSEUP =198 ,// ONMOUSEUP
  498. TokAttrib_ONREADYSTATECHANGE =199 ,// ONREADYSTATECHANGE
  499. TokAttrib_ONRESET =200 ,// ONRESET
  500. TokAttrib_ONRESIZE =201 ,// ONRESIZE
  501. TokAttrib_ONROWENTER =202 ,// ONROWENTER
  502. TokAttrib_ONROWEXIT =203 ,// ONROWEXIT
  503. TokAttrib_ONSCROLL =204 ,// ONSCROLL
  504. TokAttrib_ONSELECT =205 ,// ONSELECT
  505. TokAttrib_ONSELECTSTART =206 ,// ONSELECTSTART
  506. TokAttrib_ONSUBMIT =207 ,// ONSUBMIT
  507. TokAttrib_ONUNLOAD =208 ,// ONUNLOAD
  508. TokAttrib_OPENER =209 ,// OPENER
  509. TokAttrib_OUTERHTML =210 ,// OUTERHTML
  510. TokAttrib_OUTERTEXT =211 ,// OUTERTEXT
  511. TokAttrib_OUTLINE =212 ,// OUTLINE
  512. TokAttrib_OVERFLOW =213 ,// OVERFLOW
  513. TokAttrib_OWNINGELEMENT =214 ,// OWNINGELEMENT
  514. TokAttrib_PADDING =215 ,// PADDING
  515. TokAttrib_PADDINGBOTTOM =216 ,// PADDINGBOTTOM
  516. TokAttrib_PADDINGLEFT =217 ,// PADDINGLEFT
  517. TokAttrib_PADDINGRIGHT =218 ,// PADDINGRIGHT
  518. TokAttrib_PADDINGTOP =219 ,// PADDINGTOP
  519. TokAttrib_PAGEBREAKAFTER =220 ,// PAGEBREAKAFTER
  520. TokAttrib_PAGEBREAKBEFORE =221 ,// PAGEBREAKBEFORE
  521. TokAttrib_PALETTE =222 ,// PALETTE
  522. TokAttrib_PARENT =223 ,// PARENT
  523. TokAttrib_PARENTELEMENT =224 ,// PARENTELEMENT
  524. TokAttrib_PARENTSTYLESHEET =225 ,// PARENTSTYLESHEET
  525. TokAttrib_PARENTTEXTEDIT =226 ,// PARENTTEXTEDIT
  526. TokAttrib_PARENTWINDOW =227 ,// PARENTWINDOW
  527. TokAttrib_PATHNAME =228 ,// PATHNAME
  528. TokAttrib_PIXELHEIGHT =229 ,// PIXELHEIGHT
  529. TokAttrib_PIXELLEFT =230 ,// PIXELLEFT
  530. TokAttrib_PIXELTOP =231 ,// PIXELTOP
  531. TokAttrib_PIXELWIDTH =232 ,// PIXELWIDTH
  532. TokAttrib_PLUGINS =233 ,// PLUGINS
  533. TokAttrib_PLUGINSPAGE =234 ,// PLUGINSPAGE
  534. TokAttrib_PORT =235 ,// PORT
  535. TokAttrib_POSHEIGHT =236 ,// POSHEIGHT
  536. TokAttrib_POSITION =237 ,// POSITION
  537. TokAttrib_POSLEFT =238 ,// POSLEFT
  538. TokAttrib_POSTOP =239 ,// POSTOP
  539. TokAttrib_POSWIDTH =240 ,// POSWIDTH
  540. TokAttrib_PROMPT =241 ,// PROMPT
  541. TokAttrib_PROTOCOL =242 ,// PROTOCOL
  542. TokAttrib_READONLY =243 ,// READONLY
  543. TokAttrib_READYSTATE =244 ,// READYSTATE
  544. TokAttrib_REASON =245 ,// REASON
  545. TokAttrib_RECORDNUMBER =246 ,// RECORDNUMBER
  546. TokAttrib_RECORDSET =247 ,// RECORDSET
  547. TokAttrib_REF =248 ,// REF
  548. TokAttrib_REFERRER =249 ,// REFERRER
  549. TokAttrib_REL =250 ,// REL
  550. TokAttrib_RETURNVALUE =251 ,// RETURNVALUE
  551. TokAttrib_REV =252 ,// REV
  552. TokAttrib_RIGHTMARGIN =253 ,// RIGHTMARGIN
  553. TokAttrib_ROWS =254 ,// ROWS
  554. TokAttrib_ROWSPAN =255 ,// ROWSPAN
  555. TokAttrib_RULES =256 ,// RULES
  556. TokAttrib_RUNAT =257 ,// RUNAT
  557. TokAttrib_SCREENX =258 ,// SCREENX
  558. TokAttrib_SCREENY =259 ,// SCREENY
  559. TokAttrib_SCRIPTENGINE =260 ,// SCRIPTENGINE
  560. TokAttrib_SCROLL =261 ,// SCROLL
  561. TokAttrib_SCROLLAMOUNT =262 ,// SCROLLAMOUNT
  562. TokAttrib_SCROLLDELAY =263 ,// SCROLLDELAY
  563. TokAttrib_SCROLLHEIGHT =264 ,// SCROLLHEIGHT
  564. TokAttrib_SCROLLING =265 ,// SCROLLING
  565. TokAttrib_SCROLLLEFT =266 ,// SCROLLLEFT
  566. TokAttrib_SCROLLTOP =267 ,// SCROLLTOP
  567. TokAttrib_SCROLLWIDTH =268 ,// SCROLLWIDTH
  568. TokAttrib_SEARCH =269 ,// SEARCH
  569. TokAttrib_SELECTED =270 ,// SELECTED
  570. TokAttrib_SELECTEDINDEX =271 ,// SELECTEDINDEX
  571. TokAttrib_SELF =272 ,// SELF
  572. TokAttrib_SHAPE =273 ,// SHAPE
  573. TokAttrib_SHAPES =274 ,// SHAPES
  574. TokAttrib_SHIFTKEY =275 ,// SHIFTKEY
  575. TokAttrib_SIZE =276 ,// SIZE
  576. TokAttrib_SPAN =277 ,// SPAN
  577. TokAttrib_SOURCEINDEX =278 ,// SOURCEINDEX
  578. TokAttrib_SRC =279 ,// SRC
  579. TokAttrib_SRCELEMENT =280 ,// SRCELEMENT
  580. TokAttrib_SRCFILTER =281 ,// SRCFILTER
  581. TokAttrib_STANDBY =282 ,// STANDBY
  582. TokAttrib_START =283 ,// START
  583. TokAttrib_STARTSPAN =284 ,// STARTSPAN
  584. TokAttrib_STATUS =285 ,// STATUS
  585. TokAttrib_STYLE =286 ,// STYLE
  586. TokAttrib_STYLEFLOAT =287 ,// STYLEFLOAT
  587. TokAttrib_TABINDEX =288 ,// TABINDEX
  588. TokAttrib_TAGNAME =289 ,// TAGNAME
  589. TokAttrib_TARGET =290 ,// TARGET
  590. TokAttrib_TEXT =291 ,// TEXT
  591. TokAttrib_TEXTALIGN =292 ,// TEXTALIGN
  592. TokAttrib_TEXTDECORATION =293 ,// TEXTDECORATION
  593. TokAttrib_TEXTDECORATIONBLINK =294 ,// TEXTDECORATIONBLINK
  594. TokAttrib_TEXTDECORATIONLINETHROUGH =295 ,// TEXTDECORATIONLINETHROUGH
  595. TokAttrib_TEXTDECORATIONNONE =296 ,// TEXTDECORATIONNONE
  596. TokAttrib_TEXTDECORATIONOVERLINE =297 ,// TEXTDECORATIONOVERLINE
  597. TokAttrib_TEXTDECORATIONUNDERLINE =298 ,// TEXTDECORATIONUNDERLINE
  598. TokAttrib_TEXTINDENT =299 ,// TEXTINDENT
  599. TokAttrib_TEXTTRANSFORM =300 ,// TEXTTRANSFORM
  600. TokAttrib_TITLE =301 ,// TITLE
  601. TokAttrib_TOELEMENT =302 ,// TOELEMENT
  602. TokAttrib_TOP =303 ,// TOP
  603. TokAttrib_TOPMARGIN =304 ,// TOPMARGIN
  604. TokAttrib_TRUESPEED =305 ,// TRUESPEED
  605. TokAttrib_TYPE =306 ,// TYPE
  606. TokAttrib_UPDATEINTERVAL =307 ,// UPDATEINTERVAL
  607. TokAttrib_URL =308 ,// URL
  608. TokAttrib_URN =309 ,// URN
  609. TokAttrib_USEMAP =310 ,// USEMAP
  610. TokAttrib_USERAGENT =311 ,// USERAGENT
  611. TokAttrib_VALIGN =312 ,// VALIGN
  612. TokAttrib_VALUE =313 ,// VALUE
  613. TokAttrib_VERSION =314 ,// VERSION
  614. TokAttrib_VERTICALALIGN =315 ,// VERTICALALIGN
  615. TokAttrib_VIEWASTEXT =316 ,// VIEWASTEXT
  616. TokAttrib_VISIBILITY =317 ,// VISIBILITY
  617. TokAttrib_VLINK =318 ,// VLINK
  618. TokAttrib_VLINKCOLOR =319 ,// VLINKCOLOR
  619. TokAttrib_VOLUME =320 ,// VOLUME
  620. TokAttrib_VRML =321 ,// VRML
  621. TokAttrib_VSPACE =322 ,// VSPACE
  622. TokAttrib_WIDTH =323 ,// WIDTH
  623. TokAttrib_WRAP =324 ,// WRAP
  624. TokAttrib_X =325 ,// X
  625. TokAttrib_Y =326 ,// Y
  626. TokAttrib_ZINDEX =327 // ZINDEX
  627. } AttributeTokens;
  628. typedef enum tagTagTokens
  629. {
  630. TokTag_START = 1, /* < */
  631. TokTag_END = 2, /* </ */
  632. TokTag_CLOSE = 3, /* > */
  633. TokTag_BANG = 4, /* <! */
  634. TokTag_PI = 5, /* <? */
  635. TokTag_SSSOPEN = 6, /* <% */
  636. TokTag_SSSCLOSE = 7, /* %> */
  637. TokTag_SSSOPEN_TRIEDIT = 8, /* <% inside <script block>*/
  638. TokTag_SSSCLOSE_TRIEDIT = 9 /* %> inside <script block>*/
  639. } TagTokens;
  640. enum HtmlToken
  641. {
  642. tokUNKNOWN = tokclsError,
  643. tokIDENTIFIER = tokclsIdentMin, // identifier/plain text
  644. tokNEWLINE = tokclsUserMin,
  645. //
  646. // colored HTML items
  647. //
  648. tokElem, // element name
  649. tokAttr, // attribute name
  650. tokValue, // attribute value
  651. tokComment, // comment
  652. tokEntity, // entity reference: e.g. "&nbsp;"
  653. tokTag, // tag delimiter
  654. tokString, // string
  655. tokSpace, // whitespace and unrecognized text in a tag
  656. tokOp, // operator
  657. tokSSS, // server-side script <%...%>
  658. //
  659. // parsed HTML and SGML items - tokens folded with items above
  660. //
  661. tokName, // NAMETOKEN
  662. tokNum, // NUMTOKEN
  663. tokParEnt, // parameter entity: e.g. "%name;"
  664. tokResName, // reserved name
  665. //
  666. // operators - colors folded with tokOp above
  667. //
  668. tokOP_MIN,
  669. tokOpDash = tokOP_MIN, // -
  670. tokOP_SINGLE,
  671. tokOpQuestion = tokOP_SINGLE, // ?
  672. tokOpComma, // ,
  673. tokOpPipe, // |
  674. tokOpPlus, // +
  675. tokOpEqual, // =
  676. tokOpStar, // *
  677. tokOpAmp, // &
  678. tokOpCent, // %
  679. tokOpLP, // (
  680. tokOpRP, // )
  681. tokOpLB, // [
  682. tokOpRB, // ]
  683. tokOP_MAX, // token op MAX
  684. tokEOF
  685. };
  686. // the state of lexical analyser
  687. //
  688. // We're generally in one of two states:
  689. // 1. scanning text
  690. // 2. scanning tag info
  691. //
  692. // Within these states, the lexer can be in several substates.
  693. //
  694. // Text substates:
  695. //
  696. // inText HTML text content -- process markup
  697. // inPLAINTEXT after a <PLAINTEXT> tag - remainder of file is not HTML
  698. // inCOMMENT COMMENT content -- suppress all markup but </COMMENT>
  699. // color text as comment
  700. // inXMP XMP content -- suppress all markup but </XMP>
  701. // inLISTING LISTING content -- suppress all markup but </LISTING>
  702. // inSCRIPT SCRIPT content -- colorize with script engine
  703. //
  704. // Tag substates:
  705. //
  706. // inTag inside a tag < ... >
  707. // inBangTag inside an SGML MDO tag <! ... >
  708. // inPITag inside an SGML Prcessing Instruction tag <? ... >
  709. // inHTXTag inside an ODBC HTML Extension template tag <% ... %>
  710. // inEndTag inside an end tag </name>
  711. // inAttribute expecting an attribute
  712. // inValue expecting an attribute value (right of =)
  713. // inComment inside a comment
  714. // inString inside a " string, terminated by "
  715. // inStringA inside a ' (Alternate) string, terminated by '
  716. //
  717. enum HtmlLexState
  718. {
  719. // tag types
  720. inTag = 0x00000001, // < ... >
  721. inBangTag = 0x00000002, // <! ... >
  722. inPITag = 0x00000004, // <? ... >
  723. inHTXTag = 0x00000008, // <% ... %>
  724. inEndTag = 0x00000010, // </ ... >
  725. // tag scanning states
  726. inAttribute = 0x00000020,
  727. inValue = 0x00000040,
  728. inComment = 0x00000080,
  729. inString = 0x00000100,
  730. inStringA = 0x00000200,
  731. inScriptText = 0x00000400,
  732. inNestedQuoteinSSS= 0x00000800, // e.g. attr="<%if something Response.Write("X")%>"
  733. // text content model states
  734. inPLAINTEXT = 0x00001000,
  735. inCOMMENT = 0x00002000,
  736. inXMP = 0x00004000,
  737. inLISTING = 0x00008000,
  738. inSCRIPT = 0x00010000,
  739. // sublanguages
  740. inVariant = 0x00F00000, // mask for sublang index
  741. inHTML2 = 0x00000000,
  742. inIExplore2 = 0x00100000,
  743. inIExplore3 = 0x00200000,
  744. // script languages
  745. inJavaScript = 0x01000000,
  746. inVBScript = 0x02000000,
  747. inServerASP = 0x04000000, // in triedit's special script (serverside->clientside conversion)
  748. };
  749. // masks for subsets of the state
  750. // These masks will not show up in the generated file
  751. // Just copy paste these into your file.
  752. #define INTAG (inTag|inBangTag|inPITag|inHTXTag|inEndTag)
  753. #define INSTRING (inString|inStringA)
  754. #define TAGMASK (INTAG|inAttribute|inValue|inComment|INSTRING)
  755. #define TEXTMASK (inPLAINTEXT|inCOMMENT|inXMP|inLISTING)
  756. #define STATEMASK (TAGMASK|TEXTMASK)
  757. #endif __INC_TOKEN_H__