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

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