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

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