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 | DoubleQuote = h8_id_t(21)
|
34 | SingleQuote = h8_id_t(22)
|
35 |
|
36 | _h8_id_str = {
|
37 | 1: 'Decl',
|
38 | 2: 'Comment',
|
39 | 3: 'CommentBegin',
|
40 | 4: 'Processing',
|
41 | 5: 'ProcessingBegin',
|
42 | 6: 'CData',
|
43 | 7: 'CDataBegin',
|
44 | 8: 'StartTag',
|
45 | 9: 'StartEndTag',
|
46 | 10: 'EndTag',
|
47 | 11: 'DecChar',
|
48 | 12: 'HexChar',
|
49 | 13: 'CharEntity',
|
50 | 14: 'RawData',
|
51 | 15: 'HtmlCData',
|
52 | 16: 'BadAmpersand',
|
53 | 17: 'BadGreaterThan',
|
54 | 18: 'BadLessThan',
|
55 | 19: 'Invalid',
|
56 | 20: 'EndOfStream',
|
57 | 21: 'DoubleQuote',
|
58 | 22: 'SingleQuote',
|
59 | }
|
60 |
|
61 | def h8_id_str(val, dot=True):
|
62 | # type: (h8_id_t, bool) -> str
|
63 | v = _h8_id_str[val]
|
64 | if dot:
|
65 | return "h8_id.%s" % v
|
66 | else:
|
67 | return v
|
68 |
|
69 | class attr_name_t(pybase.SimpleObj):
|
70 | pass
|
71 |
|
72 | class attr_name(object):
|
73 | Ok = attr_name_t(1)
|
74 | Done = attr_name_t(2)
|
75 | Invalid = attr_name_t(3)
|
76 |
|
77 | _attr_name_str = {
|
78 | 1: 'Ok',
|
79 | 2: 'Done',
|
80 | 3: 'Invalid',
|
81 | }
|
82 |
|
83 | def attr_name_str(val, dot=True):
|
84 | # type: (attr_name_t, bool) -> str
|
85 | v = _attr_name_str[val]
|
86 | if dot:
|
87 | return "attr_name.%s" % v
|
88 | else:
|
89 | return v
|
90 |
|
91 | class h8_val_id_t(pybase.SimpleObj):
|
92 | pass
|
93 |
|
94 | class h8_val_id(object):
|
95 | UnquotedVal = h8_val_id_t(1)
|
96 | DoubleQuote = h8_val_id_t(2)
|
97 | SingleQuote = h8_val_id_t(3)
|
98 | NoMatch = h8_val_id_t(4)
|
99 |
|
100 | _h8_val_id_str = {
|
101 | 1: 'UnquotedVal',
|
102 | 2: 'DoubleQuote',
|
103 | 3: 'SingleQuote',
|
104 | 4: 'NoMatch',
|
105 | }
|
106 |
|
107 | def h8_val_id_str(val, dot=True):
|
108 | # type: (h8_val_id_t, bool) -> str
|
109 | v = _h8_val_id_str[val]
|
110 | if dot:
|
111 | return "h8_val_id.%s" % v
|
112 | else:
|
113 | return v
|
114 |
|
115 | class attr_value_t(pybase.SimpleObj):
|
116 | pass
|
117 |
|
118 | class attr_value_e(object):
|
119 | Missing = attr_value_t(1)
|
120 | Empty = attr_value_t(2)
|
121 | Unquoted = attr_value_t(3)
|
122 | DoubleQuoted = attr_value_t(4)
|
123 | SingleQuoted = attr_value_t(5)
|
124 |
|
125 | _attr_value_str = {
|
126 | 1: 'Missing',
|
127 | 2: 'Empty',
|
128 | 3: 'Unquoted',
|
129 | 4: 'DoubleQuoted',
|
130 | 5: 'SingleQuoted',
|
131 | }
|
132 |
|
133 | def attr_value_str(val, dot=True):
|
134 | # type: (attr_value_t, bool) -> str
|
135 | v = _attr_value_str[val]
|
136 | if dot:
|
137 | return "attr_value.%s" % v
|
138 | else:
|
139 | return v
|
140 |
|
141 | class h8_tag_id_t(pybase.SimpleObj):
|
142 | pass
|
143 |
|
144 | class h8_tag_id(object):
|
145 | TagName = h8_tag_id_t(1)
|
146 | AttrName = h8_tag_id_t(2)
|
147 | UnquotedValue = h8_tag_id_t(3)
|
148 | QuotedValue = h8_tag_id_t(4)
|
149 | MissingValue = h8_tag_id_t(5)
|
150 |
|
151 | _h8_tag_id_str = {
|
152 | 1: 'TagName',
|
153 | 2: 'AttrName',
|
154 | 3: 'UnquotedValue',
|
155 | 4: 'QuotedValue',
|
156 | 5: 'MissingValue',
|
157 | }
|
158 |
|
159 | def h8_tag_id_str(val, dot=True):
|
160 | # type: (h8_tag_id_t, bool) -> str
|
161 | v = _h8_tag_id_str[val]
|
162 | if dot:
|
163 | return "h8_tag_id.%s" % v
|
164 | else:
|
165 | return v
|
166 |
|