OILS / _gen / asdl / examples / shared_variant.asdl.h View on Github | oilshell.org

355 lines, 230 significant
1// _gen/asdl/examples/shared_variant.asdl.h is generated by asdl_main.py
2
3#ifndef SHARED_VARIANT_ASDL
4#define SHARED_VARIANT_ASDL
5
6#include <cstdint>
7
8#include "mycpp/runtime.h"
9#include "asdl/cpp_runtime.h"
10namespace shared_variant_asdl {
11
12// use struct instead of namespace so 'using' works consistently
13#define ASDL_NAMES struct
14
15class prod;
16class DoubleQuoted;
17class expr_t;
18class Token;
19class tok_t;
20class tok_struct;
21class tok_array;
22class word_part_t;
23class cflow_t;
24
25ASDL_NAMES expr_e {
26 enum no_name {
27 Binary = 1,
28 DoubleQuoted = 65,
29 };
30};
31
32BigStr* expr_str(int tag, bool dot = true);
33
34class expr_t {
35 protected:
36 expr_t() {
37 }
38 public:
39 int tag() const {
40 return ObjHeader::FromObject(this)->type_tag;
41 }
42 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
43 DISALLOW_COPY_AND_ASSIGN(expr_t)
44};
45
46class expr__Binary : public expr_t {
47 public:
48 expr__Binary(expr_t* left, expr_t* right)
49 : left(left),
50 right(right) {
51 }
52
53 static expr__Binary* CreateNull(bool alloc_lists = false) {
54 return Alloc<expr__Binary>(nullptr, nullptr);
55 }
56
57 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
58
59 static constexpr ObjHeader obj_header() {
60 return ObjHeader::AsdlClass(static_cast<uint16_t>(expr_e::Binary), 2);
61 }
62
63 expr_t* left;
64 expr_t* right;
65
66 DISALLOW_COPY_AND_ASSIGN(expr__Binary)
67};
68
69ASDL_NAMES expr {
70 typedef expr__Binary Binary;
71};
72
73ASDL_NAMES tok_e {
74 enum no_name {
75 Eof = 1,
76 Token = 66,
77 };
78};
79
80BigStr* tok_str(int tag, bool dot = true);
81
82class tok_t {
83 protected:
84 tok_t() {
85 }
86 public:
87 int tag() const {
88 return ObjHeader::FromObject(this)->type_tag;
89 }
90 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
91 DISALLOW_COPY_AND_ASSIGN(tok_t)
92};
93
94class tok__Eof : public tok_t {
95 public:
96 tok__Eof() {}
97
98 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
99
100 static constexpr ObjHeader obj_header() {
101 return ObjHeader::AsdlClass(static_cast<uint16_t>(tok_e::Eof), 0);
102 }
103
104
105 DISALLOW_COPY_AND_ASSIGN(tok__Eof)
106};
107
108extern GcGlobal<tok__Eof> gtok__Eof;
109ASDL_NAMES tok {
110 static tok__Eof* Eof;
111};
112
113ASDL_NAMES word_part_e {
114 enum no_name {
115 Literal = 1,
116 DoubleQuoted = 65,
117 };
118};
119
120BigStr* word_part_str(int tag, bool dot = true);
121
122class word_part_t {
123 protected:
124 word_part_t() {
125 }
126 public:
127 int tag() const {
128 return ObjHeader::FromObject(this)->type_tag;
129 }
130 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
131 DISALLOW_COPY_AND_ASSIGN(word_part_t)
132};
133
134class word_part__Literal : public word_part_t {
135 public:
136 word_part__Literal(BigStr* s)
137 : s(s) {
138 }
139
140 static word_part__Literal* CreateNull(bool alloc_lists = false) {
141 return Alloc<word_part__Literal>(kEmptyString);
142 }
143
144 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
145
146 static constexpr ObjHeader obj_header() {
147 return ObjHeader::AsdlClass(static_cast<uint16_t>(word_part_e::Literal), 1);
148 }
149
150 BigStr* s;
151
152 DISALLOW_COPY_AND_ASSIGN(word_part__Literal)
153};
154
155ASDL_NAMES word_part {
156 typedef word_part__Literal Literal;
157};
158
159ASDL_NAMES cflow_e {
160 enum no_name {
161 Break = 1,
162 Continue = 2,
163 Return = 3,
164 };
165};
166
167BigStr* cflow_str(int tag, bool dot = true);
168
169class cflow_t {
170 protected:
171 cflow_t() {
172 }
173 public:
174 int tag() const {
175 return ObjHeader::FromObject(this)->type_tag;
176 }
177 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
178 DISALLOW_COPY_AND_ASSIGN(cflow_t)
179};
180
181class cflow__Break : public cflow_t {
182 public:
183 cflow__Break() {}
184
185 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
186
187 static constexpr ObjHeader obj_header() {
188 return ObjHeader::AsdlClass(static_cast<uint16_t>(cflow_e::Break), 0);
189 }
190
191
192 DISALLOW_COPY_AND_ASSIGN(cflow__Break)
193};
194
195class cflow__Continue : public cflow_t {
196 public:
197 cflow__Continue() {}
198
199 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
200
201 static constexpr ObjHeader obj_header() {
202 return ObjHeader::AsdlClass(static_cast<uint16_t>(cflow_e::Continue), 0);
203 }
204
205
206 DISALLOW_COPY_AND_ASSIGN(cflow__Continue)
207};
208
209class cflow__Return : public cflow_t {
210 public:
211 cflow__Return(int val)
212 : val(val) {
213 }
214
215 static cflow__Return* CreateNull(bool alloc_lists = false) {
216 return Alloc<cflow__Return>(-1);
217 }
218
219 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
220
221 static constexpr ObjHeader obj_header() {
222 return ObjHeader::AsdlClass(static_cast<uint16_t>(cflow_e::Return), 0);
223 }
224
225 int val;
226
227 DISALLOW_COPY_AND_ASSIGN(cflow__Return)
228};
229
230extern GcGlobal<cflow__Break> gcflow__Break;
231extern GcGlobal<cflow__Continue> gcflow__Continue;
232ASDL_NAMES cflow {
233 static cflow__Break* Break;
234 static cflow__Continue* Continue;
235 typedef cflow__Return Return;
236};
237
238class prod {
239 public:
240 prod(BigStr* a, BigStr* b)
241 : a(a),
242 b(b) {
243 }
244
245 static prod* CreateNull(bool alloc_lists = false) {
246 return Alloc<prod>(kEmptyString, kEmptyString);
247 }
248
249 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
250
251 static constexpr ObjHeader obj_header() {
252 return ObjHeader::AsdlClass(64, 2);
253 }
254
255 BigStr* a;
256 BigStr* b;
257
258 DISALLOW_COPY_AND_ASSIGN(prod)
259};
260
261class DoubleQuoted : public expr_t, public word_part_t {
262 public:
263 DoubleQuoted(int left, List<BigStr*>* tokens)
264 : tokens(tokens),
265 left(left) {
266 }
267
268 static DoubleQuoted* CreateNull(bool alloc_lists = false) {
269 return Alloc<DoubleQuoted>(-1, alloc_lists ? Alloc<List<BigStr*>>() :
270 nullptr);
271 }
272
273 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
274
275 static constexpr ObjHeader obj_header() {
276 return ObjHeader::AsdlClass(65, 1);
277 }
278
279 List<BigStr*>* tokens;
280 int left;
281
282 DISALLOW_COPY_AND_ASSIGN(DoubleQuoted)
283};
284
285class Token : public tok_t {
286 public:
287 Token(int id, BigStr* val)
288 : val(val),
289 id(id) {
290 }
291
292 static Token* CreateNull(bool alloc_lists = false) {
293 return Alloc<Token>(-1, kEmptyString);
294 }
295
296 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
297
298 static constexpr ObjHeader obj_header() {
299 return ObjHeader::AsdlClass(66, 1);
300 }
301
302 BigStr* val;
303 int id;
304
305 DISALLOW_COPY_AND_ASSIGN(Token)
306};
307
308class tok_struct {
309 public:
310 tok_struct(tok_t* token, int x)
311 : token(token),
312 x(x) {
313 }
314
315 static tok_struct* CreateNull(bool alloc_lists = false) {
316 return Alloc<tok_struct>(nullptr, -1);
317 }
318
319 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
320
321 static constexpr ObjHeader obj_header() {
322 return ObjHeader::AsdlClass(67, 1);
323 }
324
325 tok_t* token;
326 int x;
327
328 DISALLOW_COPY_AND_ASSIGN(tok_struct)
329};
330
331class tok_array {
332 public:
333 tok_array(List<tok_t*>* tokens)
334 : tokens(tokens) {
335 }
336
337 static tok_array* CreateNull(bool alloc_lists = false) {
338 return Alloc<tok_array>(alloc_lists ? Alloc<List<tok_t*>>() : nullptr);
339 }
340
341 hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
342
343 static constexpr ObjHeader obj_header() {
344 return ObjHeader::AsdlClass(68, 1);
345 }
346
347 List<tok_t*>* tokens;
348
349 DISALLOW_COPY_AND_ASSIGN(tok_array)
350};
351
352
353} // namespace shared_variant_asdl
354
355#endif // SHARED_VARIANT_ASDL