OILS / _gen / core / value.asdl.h View on Github | oilshell.org

1118 lines, 735 significant
1// _gen/core/value.asdl.h is generated by asdl_main.py
2
3#ifndef VALUE_ASDL
4#define VALUE_ASDL
5
6#include <cstdint>
7
8#include "mycpp/runtime.h"
9#include "_gen/asdl/hnode.asdl.h"
10using hnode_asdl::hnode_t;
11
12namespace syntax_asdl { class loc_t; class Token; class expr_t; class command_t; class DoubleQuoted; class re_t; class proc_sig_t; class LiteralBlock; class Func; class NameType; class EggexFlag; }
13
14namespace runtime_asdl { class Cell; }
15
16namespace value_asdl {
17
18// use struct instead of namespace so 'using' works consistently
19#define ASDL_NAMES struct
20
21class IntBox;
22class ProcDefaults;
23class LeftName;
24class y_lvalue_t;
25class sh_lvalue_t;
26class eggex_ops_t;
27class RegexMatch;
28class regex_match_t;
29class block_val_t;
30class Obj;
31class value_t;
32
33ASDL_NAMES y_lvalue_e {
34 enum no_name {
35 Local = 66,
36 Container = 2,
37 };
38};
39
40BigStr* y_lvalue_str(int tag, bool dot = true);
41
42class y_lvalue_t {
43 protected:
44 y_lvalue_t() {
45 }
46 public:
47 int tag() const {
48 return ObjHeader::FromObject(this)->type_tag;
49 }
50 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
51 DISALLOW_COPY_AND_ASSIGN(y_lvalue_t)
52};
53
54class y_lvalue__Container : public y_lvalue_t {
55 public:
56 y_lvalue__Container(value_t* obj, value_t* index)
57 : obj(obj),
58 index(index) {
59 }
60
61 static y_lvalue__Container* CreateNull(bool alloc_lists = false) {
62 return Alloc<y_lvalue__Container>(nullptr, nullptr);
63 }
64
65 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
66
67 static constexpr ObjHeader obj_header() {
68 return ObjHeader::AsdlClass(static_cast<uint16_t>(y_lvalue_e::Container),
69 2);
70 }
71
72 value_t* obj;
73 value_t* index;
74
75 DISALLOW_COPY_AND_ASSIGN(y_lvalue__Container)
76};
77
78ASDL_NAMES y_lvalue {
79 typedef y_lvalue__Container Container;
80};
81
82ASDL_NAMES sh_lvalue_e {
83 enum no_name {
84 Var = 66,
85 Indexed = 2,
86 Keyed = 3,
87 };
88};
89
90BigStr* sh_lvalue_str(int tag, bool dot = true);
91
92class sh_lvalue_t {
93 protected:
94 sh_lvalue_t() {
95 }
96 public:
97 int tag() const {
98 return ObjHeader::FromObject(this)->type_tag;
99 }
100 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
101 DISALLOW_COPY_AND_ASSIGN(sh_lvalue_t)
102};
103
104class sh_lvalue__Indexed : public sh_lvalue_t {
105 public:
106 sh_lvalue__Indexed(BigStr* name, int index, syntax_asdl::loc_t* blame_loc)
107 : name(name),
108 blame_loc(blame_loc),
109 index(index) {
110 }
111
112 static sh_lvalue__Indexed* CreateNull(bool alloc_lists = false) {
113 return Alloc<sh_lvalue__Indexed>(kEmptyString, -1, nullptr);
114 }
115
116 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
117
118 static constexpr ObjHeader obj_header() {
119 return ObjHeader::AsdlClass(static_cast<uint16_t>(sh_lvalue_e::Indexed), 2);
120 }
121
122 BigStr* name;
123 syntax_asdl::loc_t* blame_loc;
124 int index;
125
126 DISALLOW_COPY_AND_ASSIGN(sh_lvalue__Indexed)
127};
128
129class sh_lvalue__Keyed : public sh_lvalue_t {
130 public:
131 sh_lvalue__Keyed(BigStr* name, BigStr* key, syntax_asdl::loc_t* blame_loc)
132 : name(name),
133 key(key),
134 blame_loc(blame_loc) {
135 }
136
137 static sh_lvalue__Keyed* CreateNull(bool alloc_lists = false) {
138 return Alloc<sh_lvalue__Keyed>(kEmptyString, kEmptyString, nullptr);
139 }
140
141 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
142
143 static constexpr ObjHeader obj_header() {
144 return ObjHeader::AsdlClass(static_cast<uint16_t>(sh_lvalue_e::Keyed), 3);
145 }
146
147 BigStr* name;
148 BigStr* key;
149 syntax_asdl::loc_t* blame_loc;
150
151 DISALLOW_COPY_AND_ASSIGN(sh_lvalue__Keyed)
152};
153
154ASDL_NAMES sh_lvalue {
155 typedef sh_lvalue__Indexed Indexed;
156 typedef sh_lvalue__Keyed Keyed;
157};
158
159ASDL_NAMES eggex_ops_e {
160 enum no_name {
161 No = 1,
162 Yes = 2,
163 };
164};
165
166BigStr* eggex_ops_str(int tag, bool dot = true);
167
168class eggex_ops_t {
169 protected:
170 eggex_ops_t() {
171 }
172 public:
173 int tag() const {
174 return ObjHeader::FromObject(this)->type_tag;
175 }
176 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
177 DISALLOW_COPY_AND_ASSIGN(eggex_ops_t)
178};
179
180class eggex_ops__No : public eggex_ops_t {
181 public:
182 eggex_ops__No() {}
183
184 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
185
186 static constexpr ObjHeader obj_header() {
187 return ObjHeader::AsdlClass(static_cast<uint16_t>(eggex_ops_e::No), 0);
188 }
189
190
191 DISALLOW_COPY_AND_ASSIGN(eggex_ops__No)
192};
193
194class eggex_ops__Yes : public eggex_ops_t {
195 public:
196 eggex_ops__Yes(List<value_t*>* convert_funcs, List<syntax_asdl::Token*>*
197 convert_toks, List<BigStr*>* capture_names)
198 : convert_funcs(convert_funcs),
199 convert_toks(convert_toks),
200 capture_names(capture_names) {
201 }
202
203 static eggex_ops__Yes* CreateNull(bool alloc_lists = false) {
204 return Alloc<eggex_ops__Yes>(alloc_lists ? Alloc<List<value_t*>>() :
205 nullptr, alloc_lists ?
206 Alloc<List<syntax_asdl::Token*>>() : nullptr,
207 alloc_lists ? Alloc<List<BigStr*>>() :
208 nullptr);
209 }
210
211 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
212
213 static constexpr ObjHeader obj_header() {
214 return ObjHeader::AsdlClass(static_cast<uint16_t>(eggex_ops_e::Yes), 3);
215 }
216
217 List<value_t*>* convert_funcs;
218 List<syntax_asdl::Token*>* convert_toks;
219 List<BigStr*>* capture_names;
220
221 DISALLOW_COPY_AND_ASSIGN(eggex_ops__Yes)
222};
223
224extern GcGlobal<eggex_ops__No> geggex_ops__No;
225ASDL_NAMES eggex_ops {
226 static eggex_ops__No* No;
227 typedef eggex_ops__Yes Yes;
228};
229
230ASDL_NAMES regex_match_e {
231 enum no_name {
232 No = 1,
233 Yes = 67,
234 };
235};
236
237BigStr* regex_match_str(int tag, bool dot = true);
238
239class regex_match_t {
240 protected:
241 regex_match_t() {
242 }
243 public:
244 int tag() const {
245 return ObjHeader::FromObject(this)->type_tag;
246 }
247 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
248 DISALLOW_COPY_AND_ASSIGN(regex_match_t)
249};
250
251class regex_match__No : public regex_match_t {
252 public:
253 regex_match__No() {}
254
255 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
256
257 static constexpr ObjHeader obj_header() {
258 return ObjHeader::AsdlClass(static_cast<uint16_t>(regex_match_e::No), 0);
259 }
260
261
262 DISALLOW_COPY_AND_ASSIGN(regex_match__No)
263};
264
265extern GcGlobal<regex_match__No> gregex_match__No;
266ASDL_NAMES regex_match {
267 static regex_match__No* No;
268};
269
270ASDL_NAMES block_val_e {
271 enum no_name {
272 Literal = 1,
273 Expr = 2,
274 };
275};
276
277BigStr* block_val_str(int tag, bool dot = true);
278
279class block_val_t {
280 protected:
281 block_val_t() {
282 }
283 public:
284 int tag() const {
285 return ObjHeader::FromObject(this)->type_tag;
286 }
287 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
288 DISALLOW_COPY_AND_ASSIGN(block_val_t)
289};
290
291class block_val__Literal : public block_val_t {
292 public:
293 block_val__Literal(syntax_asdl::LiteralBlock* b)
294 : b(b) {
295 }
296
297 static block_val__Literal* CreateNull(bool alloc_lists = false) {
298 return Alloc<block_val__Literal>(nullptr);
299 }
300
301 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
302
303 static constexpr ObjHeader obj_header() {
304 return ObjHeader::AsdlClass(static_cast<uint16_t>(block_val_e::Literal), 1);
305 }
306
307 syntax_asdl::LiteralBlock* b;
308
309 DISALLOW_COPY_AND_ASSIGN(block_val__Literal)
310};
311
312class block_val__Expr : public block_val_t {
313 public:
314 block_val__Expr(syntax_asdl::command_t* c)
315 : c(c) {
316 }
317
318 static block_val__Expr* CreateNull(bool alloc_lists = false) {
319 return Alloc<block_val__Expr>(nullptr);
320 }
321
322 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
323
324 static constexpr ObjHeader obj_header() {
325 return ObjHeader::AsdlClass(static_cast<uint16_t>(block_val_e::Expr), 1);
326 }
327
328 syntax_asdl::command_t* c;
329
330 DISALLOW_COPY_AND_ASSIGN(block_val__Expr)
331};
332
333ASDL_NAMES block_val {
334 typedef block_val__Literal Literal;
335 typedef block_val__Expr Expr;
336};
337
338ASDL_NAMES value_e {
339 enum no_name {
340 Interrupted = 1,
341 Stdin = 2,
342 Undef = 3,
343 Str = 4,
344 BashArray = 5,
345 SparseArray = 6,
346 BashAssoc = 7,
347 Null = 8,
348 Bool = 9,
349 Int = 10,
350 Float = 11,
351 List = 12,
352 Dict = 13,
353 Obj = 68,
354 Eggex = 15,
355 Match = 67,
356 Expr = 17,
357 Command = 18,
358 Block = 19,
359 Place = 20,
360 Frame = 21,
361 BuiltinFunc = 22,
362 BoundFunc = 23,
363 Func = 24,
364 BuiltinProc = 25,
365 Proc = 26,
366 Range = 27,
367 Slice = 28,
368 };
369};
370
371BigStr* value_str(int tag, bool dot = true);
372
373class value_t {
374 protected:
375 value_t() {
376 }
377 public:
378 int tag() const {
379 return ObjHeader::FromObject(this)->type_tag;
380 }
381 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
382 DISALLOW_COPY_AND_ASSIGN(value_t)
383};
384
385class value__Interrupted : public value_t {
386 public:
387 value__Interrupted() {}
388
389 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
390
391 static constexpr ObjHeader obj_header() {
392 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Interrupted), 0);
393 }
394
395
396 DISALLOW_COPY_AND_ASSIGN(value__Interrupted)
397};
398
399class value__Stdin : public value_t {
400 public:
401 value__Stdin() {}
402
403 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
404
405 static constexpr ObjHeader obj_header() {
406 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Stdin), 0);
407 }
408
409
410 DISALLOW_COPY_AND_ASSIGN(value__Stdin)
411};
412
413class value__Undef : public value_t {
414 public:
415 value__Undef() {}
416
417 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
418
419 static constexpr ObjHeader obj_header() {
420 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Undef), 0);
421 }
422
423
424 DISALLOW_COPY_AND_ASSIGN(value__Undef)
425};
426
427class value__Str : public value_t {
428 public:
429 value__Str(BigStr* s)
430 : s(s) {
431 }
432
433 static value__Str* CreateNull(bool alloc_lists = false) {
434 return Alloc<value__Str>(kEmptyString);
435 }
436
437 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
438
439 static constexpr ObjHeader obj_header() {
440 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Str), 1);
441 }
442
443 BigStr* s;
444
445 DISALLOW_COPY_AND_ASSIGN(value__Str)
446};
447
448class value__BashArray : public value_t {
449 public:
450 value__BashArray(List<BigStr*>* strs)
451 : strs(strs) {
452 }
453
454 static value__BashArray* CreateNull(bool alloc_lists = false) {
455 return Alloc<value__BashArray>(alloc_lists ? Alloc<List<BigStr*>>() :
456 nullptr);
457 }
458
459 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
460
461 static constexpr ObjHeader obj_header() {
462 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::BashArray), 1);
463 }
464
465 List<BigStr*>* strs;
466
467 DISALLOW_COPY_AND_ASSIGN(value__BashArray)
468};
469
470class value__SparseArray : public value_t {
471 public:
472 value__SparseArray(Dict<mops::BigInt, BigStr*>* d, mops::BigInt max_index)
473 : d(d),
474 max_index(max_index) {
475 }
476
477 static value__SparseArray* CreateNull(bool alloc_lists = false) {
478 return Alloc<value__SparseArray>(nullptr, -1);
479 }
480
481 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
482
483 static constexpr ObjHeader obj_header() {
484 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::SparseArray), 1);
485 }
486
487 Dict<mops::BigInt, BigStr*>* d;
488 mops::BigInt max_index;
489
490 DISALLOW_COPY_AND_ASSIGN(value__SparseArray)
491};
492
493class value__BashAssoc : public value_t {
494 public:
495 value__BashAssoc(Dict<BigStr*, BigStr*>* d)
496 : d(d) {
497 }
498
499 static value__BashAssoc* CreateNull(bool alloc_lists = false) {
500 return Alloc<value__BashAssoc>(nullptr);
501 }
502
503 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
504
505 static constexpr ObjHeader obj_header() {
506 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::BashAssoc), 1);
507 }
508
509 Dict<BigStr*, BigStr*>* d;
510
511 DISALLOW_COPY_AND_ASSIGN(value__BashAssoc)
512};
513
514class value__Null : public value_t {
515 public:
516 value__Null() {}
517
518 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
519
520 static constexpr ObjHeader obj_header() {
521 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Null), 0);
522 }
523
524
525 DISALLOW_COPY_AND_ASSIGN(value__Null)
526};
527
528class value__Bool : public value_t {
529 public:
530 value__Bool(bool b)
531 : b(b) {
532 }
533
534 static value__Bool* CreateNull(bool alloc_lists = false) {
535 return Alloc<value__Bool>(false);
536 }
537
538 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
539
540 static constexpr ObjHeader obj_header() {
541 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Bool), 0);
542 }
543
544 bool b;
545
546 DISALLOW_COPY_AND_ASSIGN(value__Bool)
547};
548
549class value__Int : public value_t {
550 public:
551 value__Int(mops::BigInt i)
552 : i(i) {
553 }
554
555 static value__Int* CreateNull(bool alloc_lists = false) {
556 return Alloc<value__Int>(-1);
557 }
558
559 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
560
561 static constexpr ObjHeader obj_header() {
562 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Int), 0);
563 }
564
565 mops::BigInt i;
566
567 DISALLOW_COPY_AND_ASSIGN(value__Int)
568};
569
570class value__Float : public value_t {
571 public:
572 value__Float(double f)
573 : f(f) {
574 }
575
576 static value__Float* CreateNull(bool alloc_lists = false) {
577 return Alloc<value__Float>(0.0);
578 }
579
580 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
581
582 static constexpr ObjHeader obj_header() {
583 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Float), 0);
584 }
585
586 double f;
587
588 DISALLOW_COPY_AND_ASSIGN(value__Float)
589};
590
591class value__List : public value_t {
592 public:
593 value__List(List<value_t*>* items)
594 : items(items) {
595 }
596
597 static value__List* CreateNull(bool alloc_lists = false) {
598 return Alloc<value__List>(alloc_lists ? Alloc<List<value_t*>>() : nullptr);
599 }
600
601 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
602
603 static constexpr ObjHeader obj_header() {
604 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::List), 1);
605 }
606
607 List<value_t*>* items;
608
609 DISALLOW_COPY_AND_ASSIGN(value__List)
610};
611
612class value__Dict : public value_t {
613 public:
614 value__Dict(Dict<BigStr*, value_t*>* d)
615 : d(d) {
616 }
617
618 static value__Dict* CreateNull(bool alloc_lists = false) {
619 return Alloc<value__Dict>(nullptr);
620 }
621
622 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
623
624 static constexpr ObjHeader obj_header() {
625 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Dict), 1);
626 }
627
628 Dict<BigStr*, value_t*>* d;
629
630 DISALLOW_COPY_AND_ASSIGN(value__Dict)
631};
632
633class value__Eggex : public value_t {
634 public:
635 value__Eggex(syntax_asdl::re_t* spliced, BigStr* canonical_flags,
636 List<value_t*>* convert_funcs, List<syntax_asdl::Token*>*
637 convert_toks, BigStr* as_ere, List<BigStr*>* capture_names)
638 : spliced(spliced),
639 canonical_flags(canonical_flags),
640 convert_funcs(convert_funcs),
641 convert_toks(convert_toks),
642 as_ere(as_ere),
643 capture_names(capture_names) {
644 }
645
646 static value__Eggex* CreateNull(bool alloc_lists = false) {
647 return Alloc<value__Eggex>(nullptr, kEmptyString, alloc_lists ?
648 Alloc<List<value_t*>>() : nullptr, alloc_lists ?
649 Alloc<List<syntax_asdl::Token*>>() : nullptr,
650 nullptr, alloc_lists ? Alloc<List<BigStr*>>() :
651 nullptr);
652 }
653
654 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
655
656 static constexpr ObjHeader obj_header() {
657 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Eggex), 6);
658 }
659
660 syntax_asdl::re_t* spliced;
661 BigStr* canonical_flags;
662 List<value_t*>* convert_funcs;
663 List<syntax_asdl::Token*>* convert_toks;
664 BigStr* as_ere;
665 List<BigStr*>* capture_names;
666
667 DISALLOW_COPY_AND_ASSIGN(value__Eggex)
668};
669
670class value__Expr : public value_t {
671 public:
672 value__Expr(syntax_asdl::expr_t* e)
673 : e(e) {
674 }
675
676 static value__Expr* CreateNull(bool alloc_lists = false) {
677 return Alloc<value__Expr>(nullptr);
678 }
679
680 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
681
682 static constexpr ObjHeader obj_header() {
683 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Expr), 1);
684 }
685
686 syntax_asdl::expr_t* e;
687
688 DISALLOW_COPY_AND_ASSIGN(value__Expr)
689};
690
691class value__Command : public value_t {
692 public:
693 value__Command(syntax_asdl::command_t* c)
694 : c(c) {
695 }
696
697 static value__Command* CreateNull(bool alloc_lists = false) {
698 return Alloc<value__Command>(nullptr);
699 }
700
701 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
702
703 static constexpr ObjHeader obj_header() {
704 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Command), 1);
705 }
706
707 syntax_asdl::command_t* c;
708
709 DISALLOW_COPY_AND_ASSIGN(value__Command)
710};
711
712class value__Block : public value_t {
713 public:
714 value__Block(block_val_t* block, Dict<BigStr*, runtime_asdl::Cell*>*
715 captured_frame)
716 : block(block),
717 captured_frame(captured_frame) {
718 }
719
720 static value__Block* CreateNull(bool alloc_lists = false) {
721 return Alloc<value__Block>(nullptr, nullptr);
722 }
723
724 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
725
726 static constexpr ObjHeader obj_header() {
727 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Block), 2);
728 }
729
730 block_val_t* block;
731 Dict<BigStr*, runtime_asdl::Cell*>* captured_frame;
732
733 DISALLOW_COPY_AND_ASSIGN(value__Block)
734};
735
736class value__Place : public value_t {
737 public:
738 value__Place(y_lvalue_t* lval, Dict<BigStr*, runtime_asdl::Cell*>* frame)
739 : lval(lval),
740 frame(frame) {
741 }
742
743 static value__Place* CreateNull(bool alloc_lists = false) {
744 return Alloc<value__Place>(nullptr, nullptr);
745 }
746
747 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
748
749 static constexpr ObjHeader obj_header() {
750 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Place), 2);
751 }
752
753 y_lvalue_t* lval;
754 Dict<BigStr*, runtime_asdl::Cell*>* frame;
755
756 DISALLOW_COPY_AND_ASSIGN(value__Place)
757};
758
759class value__Frame : public value_t {
760 public:
761 value__Frame(Dict<BigStr*, runtime_asdl::Cell*>* frame)
762 : frame(frame) {
763 }
764
765 static value__Frame* CreateNull(bool alloc_lists = false) {
766 return Alloc<value__Frame>(nullptr);
767 }
768
769 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
770
771 static constexpr ObjHeader obj_header() {
772 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Frame), 1);
773 }
774
775 Dict<BigStr*, runtime_asdl::Cell*>* frame;
776
777 DISALLOW_COPY_AND_ASSIGN(value__Frame)
778};
779
780class value__BuiltinFunc : public value_t {
781 public:
782 value__BuiltinFunc(void* callable)
783 : callable(callable) {
784 }
785
786 static value__BuiltinFunc* CreateNull(bool alloc_lists = false) {
787 return Alloc<value__BuiltinFunc>(nullptr);
788 }
789
790 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
791
792 static constexpr ObjHeader obj_header() {
793 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::BuiltinFunc), 1);
794 }
795
796 void* callable;
797
798 DISALLOW_COPY_AND_ASSIGN(value__BuiltinFunc)
799};
800
801class value__BoundFunc : public value_t {
802 public:
803 value__BoundFunc(value_t* me, value_t* func)
804 : me(me),
805 func(func) {
806 }
807
808 static value__BoundFunc* CreateNull(bool alloc_lists = false) {
809 return Alloc<value__BoundFunc>(nullptr, nullptr);
810 }
811
812 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
813
814 static constexpr ObjHeader obj_header() {
815 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::BoundFunc), 2);
816 }
817
818 value_t* me;
819 value_t* func;
820
821 DISALLOW_COPY_AND_ASSIGN(value__BoundFunc)
822};
823
824class value__Func : public value_t {
825 public:
826 value__Func(BigStr* name, syntax_asdl::Func* parsed, List<value_t*>*
827 pos_defaults, Dict<BigStr*, value_t*>* named_defaults,
828 Dict<BigStr*, runtime_asdl::Cell*>* module_frame)
829 : name(name),
830 parsed(parsed),
831 pos_defaults(pos_defaults),
832 named_defaults(named_defaults),
833 module_frame(module_frame) {
834 }
835
836 static value__Func* CreateNull(bool alloc_lists = false) {
837 return Alloc<value__Func>(kEmptyString, nullptr, alloc_lists ?
838 Alloc<List<value_t*>>() : nullptr, nullptr,
839 nullptr);
840 }
841
842 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
843
844 static constexpr ObjHeader obj_header() {
845 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Func), 5);
846 }
847
848 BigStr* name;
849 syntax_asdl::Func* parsed;
850 List<value_t*>* pos_defaults;
851 Dict<BigStr*, value_t*>* named_defaults;
852 Dict<BigStr*, runtime_asdl::Cell*>* module_frame;
853
854 DISALLOW_COPY_AND_ASSIGN(value__Func)
855};
856
857class value__BuiltinProc : public value_t {
858 public:
859 value__BuiltinProc(void* builtin)
860 : builtin(builtin) {
861 }
862
863 static value__BuiltinProc* CreateNull(bool alloc_lists = false) {
864 return Alloc<value__BuiltinProc>(nullptr);
865 }
866
867 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
868
869 static constexpr ObjHeader obj_header() {
870 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::BuiltinProc), 1);
871 }
872
873 void* builtin;
874
875 DISALLOW_COPY_AND_ASSIGN(value__BuiltinProc)
876};
877
878class value__Proc : public value_t {
879 public:
880 value__Proc(BigStr* name, syntax_asdl::Token* name_tok,
881 syntax_asdl::proc_sig_t* sig, syntax_asdl::command_t* body,
882 ProcDefaults* defaults, bool sh_compat, Dict<BigStr*,
883 runtime_asdl::Cell*>* module_frame)
884 : name(name),
885 name_tok(name_tok),
886 sig(sig),
887 body(body),
888 defaults(defaults),
889 module_frame(module_frame),
890 sh_compat(sh_compat) {
891 }
892
893 static value__Proc* CreateNull(bool alloc_lists = false) {
894 return Alloc<value__Proc>(kEmptyString, nullptr, nullptr, nullptr, nullptr,
895 false, nullptr);
896 }
897
898 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
899
900 static constexpr ObjHeader obj_header() {
901 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Proc), 6);
902 }
903
904 BigStr* name;
905 syntax_asdl::Token* name_tok;
906 syntax_asdl::proc_sig_t* sig;
907 syntax_asdl::command_t* body;
908 ProcDefaults* defaults;
909 Dict<BigStr*, runtime_asdl::Cell*>* module_frame;
910 bool sh_compat;
911
912 DISALLOW_COPY_AND_ASSIGN(value__Proc)
913};
914
915class value__Range : public value_t {
916 public:
917 value__Range(int lower, int upper)
918 : lower(lower),
919 upper(upper) {
920 }
921
922 static value__Range* CreateNull(bool alloc_lists = false) {
923 return Alloc<value__Range>(-1, -1);
924 }
925
926 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
927
928 static constexpr ObjHeader obj_header() {
929 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Range), 0);
930 }
931
932 int lower;
933 int upper;
934
935 DISALLOW_COPY_AND_ASSIGN(value__Range)
936};
937
938class value__Slice : public value_t {
939 public:
940 value__Slice(IntBox* lower, IntBox* upper)
941 : lower(lower),
942 upper(upper) {
943 }
944
945 static value__Slice* CreateNull(bool alloc_lists = false) {
946 return Alloc<value__Slice>(nullptr, nullptr);
947 }
948
949 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
950
951 static constexpr ObjHeader obj_header() {
952 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Slice), 2);
953 }
954
955 IntBox* lower;
956 IntBox* upper;
957
958 DISALLOW_COPY_AND_ASSIGN(value__Slice)
959};
960
961extern GcGlobal<value__Interrupted> gvalue__Interrupted;
962extern GcGlobal<value__Stdin> gvalue__Stdin;
963extern GcGlobal<value__Undef> gvalue__Undef;
964extern GcGlobal<value__Null> gvalue__Null;
965ASDL_NAMES value {
966 static value__Interrupted* Interrupted;
967 static value__Stdin* Stdin;
968 static value__Undef* Undef;
969 typedef value__Str Str;
970 typedef value__BashArray BashArray;
971 typedef value__SparseArray SparseArray;
972 typedef value__BashAssoc BashAssoc;
973 static value__Null* Null;
974 typedef value__Bool Bool;
975 typedef value__Int Int;
976 typedef value__Float Float;
977 typedef value__List List;
978 typedef value__Dict Dict;
979 typedef value__Eggex Eggex;
980 typedef value__Expr Expr;
981 typedef value__Command Command;
982 typedef value__Block Block;
983 typedef value__Place Place;
984 typedef value__Frame Frame;
985 typedef value__BuiltinFunc BuiltinFunc;
986 typedef value__BoundFunc BoundFunc;
987 typedef value__Func Func;
988 typedef value__BuiltinProc BuiltinProc;
989 typedef value__Proc Proc;
990 typedef value__Range Range;
991 typedef value__Slice Slice;
992};
993
994class IntBox {
995 public:
996 IntBox(int i)
997 : i(i) {
998 }
999
1000 static IntBox* CreateNull(bool alloc_lists = false) {
1001 return Alloc<IntBox>(-1);
1002 }
1003
1004 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
1005
1006 static constexpr ObjHeader obj_header() {
1007 return ObjHeader::AsdlClass(64, 0);
1008 }
1009
1010 int i;
1011
1012 DISALLOW_COPY_AND_ASSIGN(IntBox)
1013};
1014
1015class ProcDefaults {
1016 public:
1017 ProcDefaults(List<value_t*>* for_word, List<value_t*>* for_typed,
1018 Dict<BigStr*, value_t*>* for_named, value_t* for_block)
1019 : for_word(for_word),
1020 for_typed(for_typed),
1021 for_named(for_named),
1022 for_block(for_block) {
1023 }
1024
1025 static ProcDefaults* CreateNull(bool alloc_lists = false) {
1026 return Alloc<ProcDefaults>(nullptr, nullptr, nullptr, nullptr);
1027 }
1028
1029 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
1030
1031 static constexpr ObjHeader obj_header() {
1032 return ObjHeader::AsdlClass(65, 4);
1033 }
1034
1035 List<value_t*>* for_word;
1036 List<value_t*>* for_typed;
1037 Dict<BigStr*, value_t*>* for_named;
1038 value_t* for_block;
1039
1040 DISALLOW_COPY_AND_ASSIGN(ProcDefaults)
1041};
1042
1043class LeftName : public y_lvalue_t, public sh_lvalue_t {
1044 public:
1045 LeftName(BigStr* name, syntax_asdl::loc_t* blame_loc)
1046 : name(name),
1047 blame_loc(blame_loc) {
1048 }
1049
1050 static LeftName* CreateNull(bool alloc_lists = false) {
1051 return Alloc<LeftName>(kEmptyString, nullptr);
1052 }
1053
1054 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
1055
1056 static constexpr ObjHeader obj_header() {
1057 return ObjHeader::AsdlClass(66, 2);
1058 }
1059
1060 BigStr* name;
1061 syntax_asdl::loc_t* blame_loc;
1062
1063 DISALLOW_COPY_AND_ASSIGN(LeftName)
1064};
1065
1066class RegexMatch : public regex_match_t, public value_t {
1067 public:
1068 RegexMatch(BigStr* s, List<int>* indices, eggex_ops_t* ops)
1069 : s(s),
1070 indices(indices),
1071 ops(ops) {
1072 }
1073
1074 static RegexMatch* CreateNull(bool alloc_lists = false) {
1075 return Alloc<RegexMatch>(kEmptyString, alloc_lists ? Alloc<List<int>>() :
1076 nullptr, nullptr);
1077 }
1078
1079 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
1080
1081 static constexpr ObjHeader obj_header() {
1082 return ObjHeader::AsdlClass(67, 3);
1083 }
1084
1085 BigStr* s;
1086 List<int>* indices;
1087 eggex_ops_t* ops;
1088
1089 DISALLOW_COPY_AND_ASSIGN(RegexMatch)
1090};
1091
1092class Obj : public value_t {
1093 public:
1094 Obj(Obj* prototype, Dict<BigStr*, value_t*>* d)
1095 : prototype(prototype),
1096 d(d) {
1097 }
1098
1099 static Obj* CreateNull(bool alloc_lists = false) {
1100 return Alloc<Obj>(nullptr, nullptr);
1101 }
1102
1103 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
1104
1105 static constexpr ObjHeader obj_header() {
1106 return ObjHeader::AsdlClass(68, 2);
1107 }
1108
1109 Obj* prototype;
1110 Dict<BigStr*, value_t*>* d;
1111
1112 DISALLOW_COPY_AND_ASSIGN(Obj)
1113};
1114
1115
1116} // namespace value_asdl
1117
1118#endif // VALUE_ASDL