OILS / _devbuild / gen / htm8_asdl.py View on Github | oils.pub

90 lines, 78 significant
1from asdl import pybase
2from mycpp import mops
3from typing import Optional, List, Tuple, Dict, Any, cast, TYPE_CHECKING
4
5from asdl import runtime # For runtime.NO_SPID
6from asdl.runtime import NewRecord, NewLeaf, TraversalState
7from _devbuild.gen.hnode_asdl import color_e, hnode, hnode_e, hnode_t, Field
8
9class h8_id_t(pybase.SimpleObj):
10 pass
11
12class 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
57def 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
65class h8_tag_id_t(pybase.SimpleObj):
66 pass
67
68class 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
83def 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