OILS / _gen / yaks / yaks.asdl.h View on Github | oils.pub

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