1 | // _gen/yaks/yaks.asdl.h is generated by asdl_main.py
|
2 |
|
3 | #ifndef YAKS_ASDL
|
4 | #define YAKS_ASDL
|
5 |
|
6 | #include <cstdint>
|
7 |
|
8 | #include "mycpp/runtime.h"
|
9 | #include "asdl/cpp_runtime.h"
|
10 | namespace yaks_asdl {
|
11 |
|
12 | // use struct instead of namespace so 'using' works consistently
|
13 | #define ASDL_NAMES struct
|
14 |
|
15 | class Token;
|
16 | class Bool;
|
17 | class Int;
|
18 | class Str;
|
19 | class MultiStr;
|
20 | class kexpr_t;
|
21 | class Field_;
|
22 | class variant;
|
23 | class ktype_t;
|
24 | class NameType;
|
25 | class stmt_t;
|
26 | class Signature;
|
27 | class mod_def_t;
|
28 | class Module;
|
29 | class Program;
|
30 |
|
31 | enum class op_e {
|
32 | Plus = 1,
|
33 | Minus = 2,
|
34 | };
|
35 | typedef op_e op_t;
|
36 |
|
37 | BigStr* op_str(op_e tag, bool dot = true);
|
38 |
|
39 | ASDL_NAMES kexpr_e {
|
40 | enum no_name {
|
41 | Bool = 65,
|
42 | Int = 66,
|
43 | Str = 67,
|
44 | MultiStr = 68,
|
45 | Unary = 5,
|
46 | Binary = 6,
|
47 | Ternary = 7,
|
48 | Call = 8,
|
49 | };
|
50 | };
|
51 |
|
52 | BigStr* kexpr_str(int tag, bool dot = true);
|
53 |
|
54 | class kexpr_t {
|
55 | protected:
|
56 | kexpr_t() {
|
57 | }
|
58 | public:
|
59 | int tag() const {
|
60 | return ObjHeader::FromObject(this)->type_tag;
|
61 | }
|
62 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
63 | DISALLOW_COPY_AND_ASSIGN(kexpr_t)
|
64 | };
|
65 |
|
66 | class kexpr__Unary : public kexpr_t {
|
67 | public:
|
68 | kexpr__Unary(Token* op, kexpr_t* child)
|
69 | : op(op),
|
70 | child(child) {
|
71 | }
|
72 |
|
73 | static kexpr__Unary* CreateNull(bool alloc_lists = false) {
|
74 | return Alloc<kexpr__Unary>(nullptr, nullptr);
|
75 | }
|
76 |
|
77 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
78 |
|
79 | static constexpr ObjHeader obj_header() {
|
80 | return ObjHeader::AsdlClass(static_cast<uint16_t>(kexpr_e::Unary), 2);
|
81 | }
|
82 |
|
83 | Token* op;
|
84 | kexpr_t* child;
|
85 |
|
86 | DISALLOW_COPY_AND_ASSIGN(kexpr__Unary)
|
87 | };
|
88 |
|
89 | class kexpr__Binary : public kexpr_t {
|
90 | public:
|
91 | kexpr__Binary(Token* op, kexpr_t* left, kexpr_t* right)
|
92 | : op(op),
|
93 | left(left),
|
94 | right(right) {
|
95 | }
|
96 |
|
97 | static kexpr__Binary* CreateNull(bool alloc_lists = false) {
|
98 | return Alloc<kexpr__Binary>(nullptr, nullptr, nullptr);
|
99 | }
|
100 |
|
101 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
102 |
|
103 | static constexpr ObjHeader obj_header() {
|
104 | return ObjHeader::AsdlClass(static_cast<uint16_t>(kexpr_e::Binary), 3);
|
105 | }
|
106 |
|
107 | Token* op;
|
108 | kexpr_t* left;
|
109 | kexpr_t* right;
|
110 |
|
111 | DISALLOW_COPY_AND_ASSIGN(kexpr__Binary)
|
112 | };
|
113 |
|
114 | class kexpr__Ternary : public kexpr_t {
|
115 | public:
|
116 | kexpr__Ternary(Token* op, kexpr_t* left, kexpr_t* cond, kexpr_t* right)
|
117 | : op(op),
|
118 | left(left),
|
119 | cond(cond),
|
120 | right(right) {
|
121 | }
|
122 |
|
123 | static kexpr__Ternary* CreateNull(bool alloc_lists = false) {
|
124 | return Alloc<kexpr__Ternary>(nullptr, nullptr, nullptr, nullptr);
|
125 | }
|
126 |
|
127 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
128 |
|
129 | static constexpr ObjHeader obj_header() {
|
130 | return ObjHeader::AsdlClass(static_cast<uint16_t>(kexpr_e::Ternary), 4);
|
131 | }
|
132 |
|
133 | Token* op;
|
134 | kexpr_t* left;
|
135 | kexpr_t* cond;
|
136 | kexpr_t* right;
|
137 |
|
138 | DISALLOW_COPY_AND_ASSIGN(kexpr__Ternary)
|
139 | };
|
140 |
|
141 | class kexpr__Call : public kexpr_t {
|
142 | public:
|
143 | kexpr__Call(kexpr_t* f, List<kexpr_t*>* args)
|
144 | : f(f),
|
145 | args(args) {
|
146 | }
|
147 |
|
148 | static kexpr__Call* CreateNull(bool alloc_lists = false) {
|
149 | return Alloc<kexpr__Call>(nullptr, alloc_lists ? Alloc<List<kexpr_t*>>() :
|
150 | nullptr);
|
151 | }
|
152 |
|
153 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
154 |
|
155 | static constexpr ObjHeader obj_header() {
|
156 | return ObjHeader::AsdlClass(static_cast<uint16_t>(kexpr_e::Call), 2);
|
157 | }
|
158 |
|
159 | kexpr_t* f;
|
160 | List<kexpr_t*>* args;
|
161 |
|
162 | DISALLOW_COPY_AND_ASSIGN(kexpr__Call)
|
163 | };
|
164 |
|
165 | ASDL_NAMES kexpr {
|
166 | typedef kexpr__Unary Unary;
|
167 | typedef kexpr__Binary Binary;
|
168 | typedef kexpr__Ternary Ternary;
|
169 | typedef kexpr__Call Call;
|
170 | };
|
171 |
|
172 | ASDL_NAMES ktype_e {
|
173 | enum no_name {
|
174 | Bool = 1,
|
175 | Int = 2,
|
176 | Str = 3,
|
177 | List = 4,
|
178 | Dict = 5,
|
179 | Class = 6,
|
180 | Data = 7,
|
181 | Enum = 8,
|
182 | };
|
183 | };
|
184 |
|
185 | BigStr* ktype_str(int tag, bool dot = true);
|
186 |
|
187 | class ktype_t {
|
188 | protected:
|
189 | ktype_t() {
|
190 | }
|
191 | public:
|
192 | int tag() const {
|
193 | return ObjHeader::FromObject(this)->type_tag;
|
194 | }
|
195 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
196 | DISALLOW_COPY_AND_ASSIGN(ktype_t)
|
197 | };
|
198 |
|
199 | class ktype__Bool : public ktype_t {
|
200 | public:
|
201 | ktype__Bool() {}
|
202 |
|
203 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
204 |
|
205 | static constexpr ObjHeader obj_header() {
|
206 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Bool), 0);
|
207 | }
|
208 |
|
209 |
|
210 | DISALLOW_COPY_AND_ASSIGN(ktype__Bool)
|
211 | };
|
212 |
|
213 | class ktype__Int : public ktype_t {
|
214 | public:
|
215 | ktype__Int() {}
|
216 |
|
217 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
218 |
|
219 | static constexpr ObjHeader obj_header() {
|
220 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Int), 0);
|
221 | }
|
222 |
|
223 |
|
224 | DISALLOW_COPY_AND_ASSIGN(ktype__Int)
|
225 | };
|
226 |
|
227 | class ktype__Str : public ktype_t {
|
228 | public:
|
229 | ktype__Str() {}
|
230 |
|
231 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
232 |
|
233 | static constexpr ObjHeader obj_header() {
|
234 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Str), 0);
|
235 | }
|
236 |
|
237 |
|
238 | DISALLOW_COPY_AND_ASSIGN(ktype__Str)
|
239 | };
|
240 |
|
241 | class ktype__List : public ktype_t {
|
242 | public:
|
243 | ktype__List(ktype_t* T)
|
244 | : T(T) {
|
245 | }
|
246 |
|
247 | static ktype__List* CreateNull(bool alloc_lists = false) {
|
248 | return Alloc<ktype__List>(nullptr);
|
249 | }
|
250 |
|
251 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
252 |
|
253 | static constexpr ObjHeader obj_header() {
|
254 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::List), 1);
|
255 | }
|
256 |
|
257 | ktype_t* T;
|
258 |
|
259 | DISALLOW_COPY_AND_ASSIGN(ktype__List)
|
260 | };
|
261 |
|
262 | class ktype__Dict : public ktype_t {
|
263 | public:
|
264 | ktype__Dict(ktype_t* K, ktype_t* V)
|
265 | : K(K),
|
266 | V(V) {
|
267 | }
|
268 |
|
269 | static ktype__Dict* CreateNull(bool alloc_lists = false) {
|
270 | return Alloc<ktype__Dict>(nullptr, 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(static_cast<uint16_t>(ktype_e::Dict), 2);
|
277 | }
|
278 |
|
279 | ktype_t* K;
|
280 | ktype_t* V;
|
281 |
|
282 | DISALLOW_COPY_AND_ASSIGN(ktype__Dict)
|
283 | };
|
284 |
|
285 | class ktype__Class : public ktype_t {
|
286 | public:
|
287 | ktype__Class(BigStr* name)
|
288 | : name(name) {
|
289 | }
|
290 |
|
291 | static ktype__Class* CreateNull(bool alloc_lists = false) {
|
292 | return Alloc<ktype__Class>(kEmptyString);
|
293 | }
|
294 |
|
295 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
296 |
|
297 | static constexpr ObjHeader obj_header() {
|
298 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Class), 1);
|
299 | }
|
300 |
|
301 | BigStr* name;
|
302 |
|
303 | DISALLOW_COPY_AND_ASSIGN(ktype__Class)
|
304 | };
|
305 |
|
306 | class ktype__Data : public ktype_t {
|
307 | public:
|
308 | ktype__Data(List<Field_*>* fields)
|
309 | : fields(fields) {
|
310 | }
|
311 |
|
312 | static ktype__Data* CreateNull(bool alloc_lists = false) {
|
313 | return Alloc<ktype__Data>(alloc_lists ? Alloc<List<Field_*>>() : nullptr);
|
314 | }
|
315 |
|
316 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
317 |
|
318 | static constexpr ObjHeader obj_header() {
|
319 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Data), 1);
|
320 | }
|
321 |
|
322 | List<Field_*>* fields;
|
323 |
|
324 | DISALLOW_COPY_AND_ASSIGN(ktype__Data)
|
325 | };
|
326 |
|
327 | class ktype__Enum : public ktype_t {
|
328 | public:
|
329 | ktype__Enum(List<variant*>* variants)
|
330 | : variants(variants) {
|
331 | }
|
332 |
|
333 | static ktype__Enum* CreateNull(bool alloc_lists = false) {
|
334 | return Alloc<ktype__Enum>(alloc_lists ? Alloc<List<variant*>>() : nullptr);
|
335 | }
|
336 |
|
337 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
338 |
|
339 | static constexpr ObjHeader obj_header() {
|
340 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Enum), 1);
|
341 | }
|
342 |
|
343 | List<variant*>* variants;
|
344 |
|
345 | DISALLOW_COPY_AND_ASSIGN(ktype__Enum)
|
346 | };
|
347 |
|
348 | extern GcGlobal<ktype__Bool> gktype__Bool;
|
349 | extern GcGlobal<ktype__Int> gktype__Int;
|
350 | extern GcGlobal<ktype__Str> gktype__Str;
|
351 | ASDL_NAMES ktype {
|
352 | static ktype__Bool* Bool;
|
353 | static ktype__Int* Int;
|
354 | static ktype__Str* Str;
|
355 | typedef ktype__List List;
|
356 | typedef ktype__Dict Dict;
|
357 | typedef ktype__Class Class;
|
358 | typedef ktype__Data Data;
|
359 | typedef ktype__Enum Enum;
|
360 | };
|
361 |
|
362 | ASDL_NAMES stmt_e {
|
363 | enum no_name {
|
364 | VarDecl = 1,
|
365 | PlaceMutation = 2,
|
366 | If = 3,
|
367 | Switch = 4,
|
368 | For = 5,
|
369 | While = 6,
|
370 | Break = 7,
|
371 | Continue = 8,
|
372 | Return = 9,
|
373 | Try = 10,
|
374 | With = 11,
|
375 | };
|
376 | };
|
377 |
|
378 | BigStr* stmt_str(int tag, bool dot = true);
|
379 |
|
380 | class stmt_t {
|
381 | protected:
|
382 | stmt_t() {
|
383 | }
|
384 | public:
|
385 | int tag() const {
|
386 | return ObjHeader::FromObject(this)->type_tag;
|
387 | }
|
388 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
389 | DISALLOW_COPY_AND_ASSIGN(stmt_t)
|
390 | };
|
391 |
|
392 | class stmt__VarDecl : public stmt_t {
|
393 | public:
|
394 | stmt__VarDecl(Token* keyword)
|
395 | : keyword(keyword) {
|
396 | }
|
397 |
|
398 | static stmt__VarDecl* CreateNull(bool alloc_lists = false) {
|
399 | return Alloc<stmt__VarDecl>(nullptr);
|
400 | }
|
401 |
|
402 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
403 |
|
404 | static constexpr ObjHeader obj_header() {
|
405 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::VarDecl), 1);
|
406 | }
|
407 |
|
408 | Token* keyword;
|
409 |
|
410 | DISALLOW_COPY_AND_ASSIGN(stmt__VarDecl)
|
411 | };
|
412 |
|
413 | class stmt__PlaceMutation : public stmt_t {
|
414 | public:
|
415 | stmt__PlaceMutation(Token* keyword)
|
416 | : keyword(keyword) {
|
417 | }
|
418 |
|
419 | static stmt__PlaceMutation* CreateNull(bool alloc_lists = false) {
|
420 | return Alloc<stmt__PlaceMutation>(nullptr);
|
421 | }
|
422 |
|
423 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
424 |
|
425 | static constexpr ObjHeader obj_header() {
|
426 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::PlaceMutation),
|
427 | 1);
|
428 | }
|
429 |
|
430 | Token* keyword;
|
431 |
|
432 | DISALLOW_COPY_AND_ASSIGN(stmt__PlaceMutation)
|
433 | };
|
434 |
|
435 | class stmt__If : public stmt_t {
|
436 | public:
|
437 | stmt__If() {}
|
438 |
|
439 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
440 |
|
441 | static constexpr ObjHeader obj_header() {
|
442 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::If), 0);
|
443 | }
|
444 |
|
445 |
|
446 | DISALLOW_COPY_AND_ASSIGN(stmt__If)
|
447 | };
|
448 |
|
449 | class stmt__Switch : public stmt_t {
|
450 | public:
|
451 | stmt__Switch() {}
|
452 |
|
453 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
454 |
|
455 | static constexpr ObjHeader obj_header() {
|
456 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Switch), 0);
|
457 | }
|
458 |
|
459 |
|
460 | DISALLOW_COPY_AND_ASSIGN(stmt__Switch)
|
461 | };
|
462 |
|
463 | class stmt__For : public stmt_t {
|
464 | public:
|
465 | stmt__For() {}
|
466 |
|
467 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
468 |
|
469 | static constexpr ObjHeader obj_header() {
|
470 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::For), 0);
|
471 | }
|
472 |
|
473 |
|
474 | DISALLOW_COPY_AND_ASSIGN(stmt__For)
|
475 | };
|
476 |
|
477 | class stmt__While : public stmt_t {
|
478 | public:
|
479 | stmt__While() {}
|
480 |
|
481 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
482 |
|
483 | static constexpr ObjHeader obj_header() {
|
484 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::While), 0);
|
485 | }
|
486 |
|
487 |
|
488 | DISALLOW_COPY_AND_ASSIGN(stmt__While)
|
489 | };
|
490 |
|
491 | class stmt__Break : public stmt_t {
|
492 | public:
|
493 | stmt__Break() {}
|
494 |
|
495 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
496 |
|
497 | static constexpr ObjHeader obj_header() {
|
498 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Break), 0);
|
499 | }
|
500 |
|
501 |
|
502 | DISALLOW_COPY_AND_ASSIGN(stmt__Break)
|
503 | };
|
504 |
|
505 | class stmt__Continue : public stmt_t {
|
506 | public:
|
507 | stmt__Continue() {}
|
508 |
|
509 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
510 |
|
511 | static constexpr ObjHeader obj_header() {
|
512 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Continue), 0);
|
513 | }
|
514 |
|
515 |
|
516 | DISALLOW_COPY_AND_ASSIGN(stmt__Continue)
|
517 | };
|
518 |
|
519 | class stmt__Return : public stmt_t {
|
520 | public:
|
521 | stmt__Return(kexpr_t* e)
|
522 | : e(e) {
|
523 | }
|
524 |
|
525 | static stmt__Return* CreateNull(bool alloc_lists = false) {
|
526 | return Alloc<stmt__Return>(nullptr);
|
527 | }
|
528 |
|
529 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
530 |
|
531 | static constexpr ObjHeader obj_header() {
|
532 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Return), 1);
|
533 | }
|
534 |
|
535 | kexpr_t* e;
|
536 |
|
537 | DISALLOW_COPY_AND_ASSIGN(stmt__Return)
|
538 | };
|
539 |
|
540 | class stmt__Try : public stmt_t {
|
541 | public:
|
542 | stmt__Try() {}
|
543 |
|
544 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
545 |
|
546 | static constexpr ObjHeader obj_header() {
|
547 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Try), 0);
|
548 | }
|
549 |
|
550 |
|
551 | DISALLOW_COPY_AND_ASSIGN(stmt__Try)
|
552 | };
|
553 |
|
554 | class stmt__With : public stmt_t {
|
555 | public:
|
556 | stmt__With() {}
|
557 |
|
558 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
559 |
|
560 | static constexpr ObjHeader obj_header() {
|
561 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::With), 0);
|
562 | }
|
563 |
|
564 |
|
565 | DISALLOW_COPY_AND_ASSIGN(stmt__With)
|
566 | };
|
567 |
|
568 | extern GcGlobal<stmt__If> gstmt__If;
|
569 | extern GcGlobal<stmt__Switch> gstmt__Switch;
|
570 | extern GcGlobal<stmt__For> gstmt__For;
|
571 | extern GcGlobal<stmt__While> gstmt__While;
|
572 | extern GcGlobal<stmt__Break> gstmt__Break;
|
573 | extern GcGlobal<stmt__Continue> gstmt__Continue;
|
574 | extern GcGlobal<stmt__Try> gstmt__Try;
|
575 | extern GcGlobal<stmt__With> gstmt__With;
|
576 | ASDL_NAMES stmt {
|
577 | typedef stmt__VarDecl VarDecl;
|
578 | typedef stmt__PlaceMutation PlaceMutation;
|
579 | static stmt__If* If;
|
580 | static stmt__Switch* Switch;
|
581 | static stmt__For* For;
|
582 | static stmt__While* While;
|
583 | static stmt__Break* Break;
|
584 | static stmt__Continue* Continue;
|
585 | typedef stmt__Return Return;
|
586 | static stmt__Try* Try;
|
587 | static stmt__With* With;
|
588 | };
|
589 |
|
590 | enum class class_def_e {
|
591 | Constructor = 1,
|
592 | Destructor = 2,
|
593 | Method = 3,
|
594 | Field = 4,
|
595 | };
|
596 | typedef class_def_e class_def_t;
|
597 |
|
598 | BigStr* class_def_str(class_def_e tag, bool dot = true);
|
599 |
|
600 | ASDL_NAMES mod_def_e {
|
601 | enum no_name {
|
602 | Global = 1,
|
603 | Func = 2,
|
604 | Class = 3,
|
605 | Import = 4,
|
606 | Include = 5,
|
607 | Data = 6,
|
608 | Enum = 7,
|
609 | };
|
610 | };
|
611 |
|
612 | BigStr* mod_def_str(int tag, bool dot = true);
|
613 |
|
614 | class mod_def_t {
|
615 | protected:
|
616 | mod_def_t() {
|
617 | }
|
618 | public:
|
619 | int tag() const {
|
620 | return ObjHeader::FromObject(this)->type_tag;
|
621 | }
|
622 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
623 | DISALLOW_COPY_AND_ASSIGN(mod_def_t)
|
624 | };
|
625 |
|
626 | class mod_def__Global : public mod_def_t {
|
627 | public:
|
628 | mod_def__Global(NameType* name_type)
|
629 | : name_type(name_type) {
|
630 | }
|
631 |
|
632 | static mod_def__Global* CreateNull(bool alloc_lists = false) {
|
633 | return Alloc<mod_def__Global>(nullptr);
|
634 | }
|
635 |
|
636 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
637 |
|
638 | static constexpr ObjHeader obj_header() {
|
639 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Global), 1);
|
640 | }
|
641 |
|
642 | NameType* name_type;
|
643 |
|
644 | DISALLOW_COPY_AND_ASSIGN(mod_def__Global)
|
645 | };
|
646 |
|
647 | class mod_def__Func : public mod_def_t {
|
648 | public:
|
649 | mod_def__Func(BigStr* name, Signature* sig, List<stmt_t*>* statements)
|
650 | : name(name),
|
651 | sig(sig),
|
652 | statements(statements) {
|
653 | }
|
654 |
|
655 | static mod_def__Func* CreateNull(bool alloc_lists = false) {
|
656 | return Alloc<mod_def__Func>(kEmptyString, nullptr, alloc_lists ?
|
657 | Alloc<List<stmt_t*>>() : nullptr);
|
658 | }
|
659 |
|
660 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
661 |
|
662 | static constexpr ObjHeader obj_header() {
|
663 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Func), 3);
|
664 | }
|
665 |
|
666 | BigStr* name;
|
667 | Signature* sig;
|
668 | List<stmt_t*>* statements;
|
669 |
|
670 | DISALLOW_COPY_AND_ASSIGN(mod_def__Func)
|
671 | };
|
672 |
|
673 | class mod_def__Class : public mod_def_t {
|
674 | public:
|
675 | mod_def__Class(BigStr* name, List<class_def_t>* defs)
|
676 | : name(name),
|
677 | defs(defs) {
|
678 | }
|
679 |
|
680 | static mod_def__Class* CreateNull(bool alloc_lists = false) {
|
681 | return Alloc<mod_def__Class>(kEmptyString, alloc_lists ?
|
682 | Alloc<List<class_def_t>>() : nullptr);
|
683 | }
|
684 |
|
685 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
686 |
|
687 | static constexpr ObjHeader obj_header() {
|
688 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Class), 2);
|
689 | }
|
690 |
|
691 | BigStr* name;
|
692 | List<class_def_t>* defs;
|
693 |
|
694 | DISALLOW_COPY_AND_ASSIGN(mod_def__Class)
|
695 | };
|
696 |
|
697 | class mod_def__Import : public mod_def_t {
|
698 | public:
|
699 | mod_def__Import() {}
|
700 |
|
701 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
702 |
|
703 | static constexpr ObjHeader obj_header() {
|
704 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Import), 0);
|
705 | }
|
706 |
|
707 |
|
708 | DISALLOW_COPY_AND_ASSIGN(mod_def__Import)
|
709 | };
|
710 |
|
711 | class mod_def__Include : public mod_def_t {
|
712 | public:
|
713 | mod_def__Include(BigStr* path)
|
714 | : path(path) {
|
715 | }
|
716 |
|
717 | static mod_def__Include* CreateNull(bool alloc_lists = false) {
|
718 | return Alloc<mod_def__Include>(kEmptyString);
|
719 | }
|
720 |
|
721 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
722 |
|
723 | static constexpr ObjHeader obj_header() {
|
724 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Include), 1);
|
725 | }
|
726 |
|
727 | BigStr* path;
|
728 |
|
729 | DISALLOW_COPY_AND_ASSIGN(mod_def__Include)
|
730 | };
|
731 |
|
732 | class mod_def__Data : public mod_def_t {
|
733 | public:
|
734 | mod_def__Data() {}
|
735 |
|
736 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
737 |
|
738 | static constexpr ObjHeader obj_header() {
|
739 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Data), 0);
|
740 | }
|
741 |
|
742 |
|
743 | DISALLOW_COPY_AND_ASSIGN(mod_def__Data)
|
744 | };
|
745 |
|
746 | class mod_def__Enum : public mod_def_t {
|
747 | public:
|
748 | mod_def__Enum() {}
|
749 |
|
750 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
751 |
|
752 | static constexpr ObjHeader obj_header() {
|
753 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Enum), 0);
|
754 | }
|
755 |
|
756 |
|
757 | DISALLOW_COPY_AND_ASSIGN(mod_def__Enum)
|
758 | };
|
759 |
|
760 | extern GcGlobal<mod_def__Import> gmod_def__Import;
|
761 | extern GcGlobal<mod_def__Data> gmod_def__Data;
|
762 | extern GcGlobal<mod_def__Enum> gmod_def__Enum;
|
763 | ASDL_NAMES mod_def {
|
764 | typedef mod_def__Global Global;
|
765 | typedef mod_def__Func Func;
|
766 | typedef mod_def__Class Class;
|
767 | static mod_def__Import* Import;
|
768 | typedef mod_def__Include Include;
|
769 | static mod_def__Data* Data;
|
770 | static mod_def__Enum* Enum;
|
771 | };
|
772 |
|
773 | class Token {
|
774 | public:
|
775 | Token(BigStr* path, BigStr* chunk, int start, int length)
|
776 | : path(path),
|
777 | chunk(chunk),
|
778 | start(start),
|
779 | length(length) {
|
780 | }
|
781 |
|
782 | static Token* CreateNull(bool alloc_lists = false) {
|
783 | return Alloc<Token>(kEmptyString, kEmptyString, -1, -1);
|
784 | }
|
785 |
|
786 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
787 |
|
788 | static constexpr ObjHeader obj_header() {
|
789 | return ObjHeader::AsdlClass(64, 2);
|
790 | }
|
791 |
|
792 | BigStr* path;
|
793 | BigStr* chunk;
|
794 | int start;
|
795 | int length;
|
796 |
|
797 | DISALLOW_COPY_AND_ASSIGN(Token)
|
798 | };
|
799 |
|
800 | class Bool : public kexpr_t {
|
801 | public:
|
802 | Bool(bool b, Token* loc)
|
803 | : loc(loc),
|
804 | b(b) {
|
805 | }
|
806 |
|
807 | static Bool* CreateNull(bool alloc_lists = false) {
|
808 | return Alloc<Bool>(false, nullptr);
|
809 | }
|
810 |
|
811 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
812 |
|
813 | static constexpr ObjHeader obj_header() {
|
814 | return ObjHeader::AsdlClass(65, 1);
|
815 | }
|
816 |
|
817 | Token* loc;
|
818 | bool b;
|
819 |
|
820 | DISALLOW_COPY_AND_ASSIGN(Bool)
|
821 | };
|
822 |
|
823 | class Int : public kexpr_t {
|
824 | public:
|
825 | Int(int i, Token* loc)
|
826 | : loc(loc),
|
827 | i(i) {
|
828 | }
|
829 |
|
830 | static Int* CreateNull(bool alloc_lists = false) {
|
831 | return Alloc<Int>(-1, nullptr);
|
832 | }
|
833 |
|
834 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
835 |
|
836 | static constexpr ObjHeader obj_header() {
|
837 | return ObjHeader::AsdlClass(66, 1);
|
838 | }
|
839 |
|
840 | Token* loc;
|
841 | int i;
|
842 |
|
843 | DISALLOW_COPY_AND_ASSIGN(Int)
|
844 | };
|
845 |
|
846 | class Str : public kexpr_t {
|
847 | public:
|
848 | Str(BigStr* s, Token* loc)
|
849 | : s(s),
|
850 | loc(loc) {
|
851 | }
|
852 |
|
853 | static Str* CreateNull(bool alloc_lists = false) {
|
854 | return Alloc<Str>(kEmptyString, nullptr);
|
855 | }
|
856 |
|
857 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
858 |
|
859 | static constexpr ObjHeader obj_header() {
|
860 | return ObjHeader::AsdlClass(67, 2);
|
861 | }
|
862 |
|
863 | BigStr* s;
|
864 | Token* loc;
|
865 |
|
866 | DISALLOW_COPY_AND_ASSIGN(Str)
|
867 | };
|
868 |
|
869 | class MultiStr : public kexpr_t {
|
870 | public:
|
871 | MultiStr(List<Token*>* lines)
|
872 | : lines(lines) {
|
873 | }
|
874 |
|
875 | static MultiStr* CreateNull(bool alloc_lists = false) {
|
876 | return Alloc<MultiStr>(alloc_lists ? Alloc<List<Token*>>() : nullptr);
|
877 | }
|
878 |
|
879 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
880 |
|
881 | static constexpr ObjHeader obj_header() {
|
882 | return ObjHeader::AsdlClass(68, 1);
|
883 | }
|
884 |
|
885 | List<Token*>* lines;
|
886 |
|
887 | DISALLOW_COPY_AND_ASSIGN(MultiStr)
|
888 | };
|
889 |
|
890 | class Field_ {
|
891 | public:
|
892 | Field_(BigStr* name, ktype_t* typ)
|
893 | : name(name),
|
894 | typ(typ) {
|
895 | }
|
896 |
|
897 | static Field_* CreateNull(bool alloc_lists = false) {
|
898 | return Alloc<Field_>(kEmptyString, nullptr);
|
899 | }
|
900 |
|
901 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
902 |
|
903 | static constexpr ObjHeader obj_header() {
|
904 | return ObjHeader::AsdlClass(69, 2);
|
905 | }
|
906 |
|
907 | BigStr* name;
|
908 | ktype_t* typ;
|
909 |
|
910 | DISALLOW_COPY_AND_ASSIGN(Field_)
|
911 | };
|
912 |
|
913 | class variant {
|
914 | public:
|
915 | variant(List<Field_*>* fields)
|
916 | : fields(fields) {
|
917 | }
|
918 |
|
919 | static variant* CreateNull(bool alloc_lists = false) {
|
920 | return Alloc<variant>(alloc_lists ? Alloc<List<Field_*>>() : nullptr);
|
921 | }
|
922 |
|
923 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
924 |
|
925 | static constexpr ObjHeader obj_header() {
|
926 | return ObjHeader::AsdlClass(70, 1);
|
927 | }
|
928 |
|
929 | List<Field_*>* fields;
|
930 |
|
931 | DISALLOW_COPY_AND_ASSIGN(variant)
|
932 | };
|
933 |
|
934 | class NameType {
|
935 | public:
|
936 | NameType(BigStr* name, ktype_t* typ)
|
937 | : name(name),
|
938 | typ(typ) {
|
939 | }
|
940 |
|
941 | static NameType* CreateNull(bool alloc_lists = false) {
|
942 | return Alloc<NameType>(kEmptyString, nullptr);
|
943 | }
|
944 |
|
945 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
946 |
|
947 | static constexpr ObjHeader obj_header() {
|
948 | return ObjHeader::AsdlClass(71, 2);
|
949 | }
|
950 |
|
951 | BigStr* name;
|
952 | ktype_t* typ;
|
953 |
|
954 | DISALLOW_COPY_AND_ASSIGN(NameType)
|
955 | };
|
956 |
|
957 | class Signature {
|
958 | public:
|
959 | Signature(List<NameType*>* params, ktype_t* return_type)
|
960 | : params(params),
|
961 | return_type(return_type) {
|
962 | }
|
963 |
|
964 | static Signature* CreateNull(bool alloc_lists = false) {
|
965 | return Alloc<Signature>(alloc_lists ? Alloc<List<NameType*>>() : nullptr,
|
966 | nullptr);
|
967 | }
|
968 |
|
969 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
970 |
|
971 | static constexpr ObjHeader obj_header() {
|
972 | return ObjHeader::AsdlClass(72, 2);
|
973 | }
|
974 |
|
975 | List<NameType*>* params;
|
976 | ktype_t* return_type;
|
977 |
|
978 | DISALLOW_COPY_AND_ASSIGN(Signature)
|
979 | };
|
980 |
|
981 | class Module {
|
982 | public:
|
983 | Module(BigStr* name, List<mod_def_t*>* defs)
|
984 | : name(name),
|
985 | defs(defs) {
|
986 | }
|
987 |
|
988 | static Module* CreateNull(bool alloc_lists = false) {
|
989 | return Alloc<Module>(kEmptyString, alloc_lists ? Alloc<List<mod_def_t*>>()
|
990 | : nullptr);
|
991 | }
|
992 |
|
993 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
994 |
|
995 | static constexpr ObjHeader obj_header() {
|
996 | return ObjHeader::AsdlClass(73, 2);
|
997 | }
|
998 |
|
999 | BigStr* name;
|
1000 | List<mod_def_t*>* defs;
|
1001 |
|
1002 | DISALLOW_COPY_AND_ASSIGN(Module)
|
1003 | };
|
1004 |
|
1005 | class Program {
|
1006 | public:
|
1007 | Program(BigStr* main_module, List<Module*>* modules)
|
1008 | : main_module(main_module),
|
1009 | modules(modules) {
|
1010 | }
|
1011 |
|
1012 | static Program* CreateNull(bool alloc_lists = false) {
|
1013 | return Alloc<Program>(kEmptyString, alloc_lists ? Alloc<List<Module*>>() :
|
1014 | nullptr);
|
1015 | }
|
1016 |
|
1017 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
1018 |
|
1019 | static constexpr ObjHeader obj_header() {
|
1020 | return ObjHeader::AsdlClass(74, 2);
|
1021 | }
|
1022 |
|
1023 | BigStr* main_module;
|
1024 | List<Module*>* modules;
|
1025 |
|
1026 | DISALLOW_COPY_AND_ASSIGN(Program)
|
1027 | };
|
1028 |
|
1029 |
|
1030 | } // namespace yaks_asdl
|
1031 |
|
1032 | #endif // YAKS_ASDL
|