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

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