1 | from asdl import pybase
|
2 | from mycpp import mops
|
3 | from typing import Optional, List, Tuple, Dict, Any, cast, TYPE_CHECKING
|
4 |
|
5 | from asdl import runtime # For runtime.NO_SPID
|
6 | from asdl.runtime import NewRecord, NewLeaf, TraversalState
|
7 | from _devbuild.gen.hnode_asdl import color_e, hnode, hnode_e, hnode_t, Field
|
8 |
|
9 | class h8_id_t(pybase.SimpleObj):
|
10 | pass
|
11 |
|
12 | class h8_id(object):
|
13 | Decl = h8_id_t(1)
|
14 | Comment = h8_id_t(2)
|
15 | CommentBegin = h8_id_t(3)
|
16 | Processing = h8_id_t(4)
|
17 | ProcessingBegin = h8_id_t(5)
|
18 | CData = h8_id_t(6)
|
19 | CDataBegin = h8_id_t(7)
|
20 | StartTag = h8_id_t(8)
|
21 | StartEndTag = h8_id_t(9)
|
22 | EndTag = h8_id_t(10)
|
23 | DecChar = h8_id_t(11)
|
24 | HexChar = h8_id_t(12)
|
25 | CharEntity = h8_id_t(13)
|
26 | RawData = h8_id_t(14)
|
27 | HtmlCData = h8_id_t(15)
|
28 | BadAmpersand = h8_id_t(16)
|
29 | BadGreaterThan = h8_id_t(17)
|
30 | BadLessThan = h8_id_t(18)
|
31 | Invalid = h8_id_t(19)
|
32 | EndOfStream = h8_id_t(20)
|
33 |
|
34 | _h8_id_str = {
|
35 | 1: 'Decl',
|
36 | 2: 'Comment',
|
37 | 3: 'CommentBegin',
|
38 | 4: 'Processing',
|
39 | 5: 'ProcessingBegin',
|
40 | 6: 'CData',
|
41 | 7: 'CDataBegin',
|
42 | 8: 'StartTag',
|
43 | 9: 'StartEndTag',
|
44 | 10: 'EndTag',
|
45 | 11: 'DecChar',
|
46 | 12: 'HexChar',
|
47 | 13: 'CharEntity',
|
48 | 14: 'RawData',
|
49 | 15: 'HtmlCData',
|
50 | 16: 'BadAmpersand',
|
51 | 17: 'BadGreaterThan',
|
52 | 18: 'BadLessThan',
|
53 | 19: 'Invalid',
|
54 | 20: 'EndOfStream',
|
55 | }
|
56 |
|
57 | def h8_id_str(val, dot=True):
|
58 | # type: (h8_id_t, bool) -> str
|
59 | v = _h8_id_str[val]
|
60 | if dot:
|
61 | return "h8_id.%s" % v
|
62 | else:
|
63 | return v
|
64 |
|
65 | class h8_tag_id_t(pybase.SimpleObj):
|
66 | pass
|
67 |
|
68 | class h8_tag_id(object):
|
69 | TagName = h8_tag_id_t(1)
|
70 | AttrName = h8_tag_id_t(2)
|
71 | UnquotedValue = h8_tag_id_t(3)
|
72 | QuotedValue = h8_tag_id_t(4)
|
73 | MissingValue = h8_tag_id_t(5)
|
74 |
|
75 | _h8_tag_id_str = {
|
76 | 1: 'TagName',
|
77 | 2: 'AttrName',
|
78 | 3: 'UnquotedValue',
|
79 | 4: 'QuotedValue',
|
80 | 5: 'MissingValue',
|
81 | }
|
82 |
|
83 | def h8_tag_id_str(val, dot=True):
|
84 | # type: (h8_tag_id_t, bool) -> str
|
85 | v = _h8_tag_id_str[val]
|
86 | if dot:
|
87 | return "h8_tag_id.%s" % v
|
88 | else:
|
89 | return v
|
90 |
|