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

1045 lines, 686 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 Dict_;
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 = 68,
284 Eggex = 14,
285 Match = 67,
286 Expr = 16,
287 Command = 17,
288 Block = 18,
289 Place = 19,
290 Module = 20,
291 IO = 21,
292 Guts = 22,
293 BuiltinFunc = 23,
294 BoundFunc = 24,
295 Proc = 25,
296 Func = 26,
297 Slice = 27,
298 Range = 28,
299 };
300};
301
302BigStr* value_str(int tag, bool dot = true);
303
304class value_t {
305 protected:
306 value_t() {
307 }
308 public:
309 int tag() const {
310 return ObjHeader::FromObject(this)->type_tag;
311 }
312 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
313 DISALLOW_COPY_AND_ASSIGN(value_t)
314};
315
316class value__Interrupted : public value_t {
317 public:
318 value__Interrupted() {}
319
320 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
321
322 static constexpr ObjHeader obj_header() {
323 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Interrupted), 0);
324 }
325
326
327 DISALLOW_COPY_AND_ASSIGN(value__Interrupted)
328};
329
330class value__Stdin : public value_t {
331 public:
332 value__Stdin() {}
333
334 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
335
336 static constexpr ObjHeader obj_header() {
337 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Stdin), 0);
338 }
339
340
341 DISALLOW_COPY_AND_ASSIGN(value__Stdin)
342};
343
344class value__Undef : public value_t {
345 public:
346 value__Undef() {}
347
348 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
349
350 static constexpr ObjHeader obj_header() {
351 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Undef), 0);
352 }
353
354
355 DISALLOW_COPY_AND_ASSIGN(value__Undef)
356};
357
358class value__Str : public value_t {
359 public:
360 value__Str(BigStr* s)
361 : s(s) {
362 }
363
364 static value__Str* CreateNull(bool alloc_lists = false) {
365 return Alloc<value__Str>(kEmptyString);
366 }
367
368 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
369
370 static constexpr ObjHeader obj_header() {
371 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Str), 1);
372 }
373
374 BigStr* s;
375
376 DISALLOW_COPY_AND_ASSIGN(value__Str)
377};
378
379class value__BashArray : public value_t {
380 public:
381 value__BashArray(List<BigStr*>* strs)
382 : strs(strs) {
383 }
384
385 static value__BashArray* CreateNull(bool alloc_lists = false) {
386 return Alloc<value__BashArray>(alloc_lists ? Alloc<List<BigStr*>>() :
387 nullptr);
388 }
389
390 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
391
392 static constexpr ObjHeader obj_header() {
393 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::BashArray), 1);
394 }
395
396 List<BigStr*>* strs;
397
398 DISALLOW_COPY_AND_ASSIGN(value__BashArray)
399};
400
401class value__SparseArray : public value_t {
402 public:
403 value__SparseArray(Dict<mops::BigInt, BigStr*>* d, mops::BigInt max_index)
404 : d(d),
405 max_index(max_index) {
406 }
407
408 static value__SparseArray* CreateNull(bool alloc_lists = false) {
409 return Alloc<value__SparseArray>(nullptr, -1);
410 }
411
412 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
413
414 static constexpr ObjHeader obj_header() {
415 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::SparseArray), 1);
416 }
417
418 Dict<mops::BigInt, BigStr*>* d;
419 mops::BigInt max_index;
420
421 DISALLOW_COPY_AND_ASSIGN(value__SparseArray)
422};
423
424class value__BashAssoc : public value_t {
425 public:
426 value__BashAssoc(Dict<BigStr*, BigStr*>* d)
427 : d(d) {
428 }
429
430 static value__BashAssoc* CreateNull(bool alloc_lists = false) {
431 return Alloc<value__BashAssoc>(nullptr);
432 }
433
434 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
435
436 static constexpr ObjHeader obj_header() {
437 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::BashAssoc), 1);
438 }
439
440 Dict<BigStr*, BigStr*>* d;
441
442 DISALLOW_COPY_AND_ASSIGN(value__BashAssoc)
443};
444
445class value__Null : public value_t {
446 public:
447 value__Null() {}
448
449 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
450
451 static constexpr ObjHeader obj_header() {
452 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Null), 0);
453 }
454
455
456 DISALLOW_COPY_AND_ASSIGN(value__Null)
457};
458
459class value__Bool : public value_t {
460 public:
461 value__Bool(bool b)
462 : b(b) {
463 }
464
465 static value__Bool* CreateNull(bool alloc_lists = false) {
466 return Alloc<value__Bool>(false);
467 }
468
469 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
470
471 static constexpr ObjHeader obj_header() {
472 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Bool), 0);
473 }
474
475 bool b;
476
477 DISALLOW_COPY_AND_ASSIGN(value__Bool)
478};
479
480class value__Int : public value_t {
481 public:
482 value__Int(mops::BigInt i)
483 : i(i) {
484 }
485
486 static value__Int* CreateNull(bool alloc_lists = false) {
487 return Alloc<value__Int>(-1);
488 }
489
490 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
491
492 static constexpr ObjHeader obj_header() {
493 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Int), 0);
494 }
495
496 mops::BigInt i;
497
498 DISALLOW_COPY_AND_ASSIGN(value__Int)
499};
500
501class value__Float : public value_t {
502 public:
503 value__Float(double f)
504 : f(f) {
505 }
506
507 static value__Float* CreateNull(bool alloc_lists = false) {
508 return Alloc<value__Float>(0.0);
509 }
510
511 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
512
513 static constexpr ObjHeader obj_header() {
514 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Float), 0);
515 }
516
517 double f;
518
519 DISALLOW_COPY_AND_ASSIGN(value__Float)
520};
521
522class value__List : public value_t {
523 public:
524 value__List(List<value_t*>* items)
525 : items(items) {
526 }
527
528 static value__List* CreateNull(bool alloc_lists = false) {
529 return Alloc<value__List>(alloc_lists ? Alloc<List<value_t*>>() : nullptr);
530 }
531
532 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
533
534 static constexpr ObjHeader obj_header() {
535 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::List), 1);
536 }
537
538 List<value_t*>* items;
539
540 DISALLOW_COPY_AND_ASSIGN(value__List)
541};
542
543class value__Eggex : public value_t {
544 public:
545 value__Eggex(syntax_asdl::re_t* spliced, BigStr* canonical_flags,
546 List<value_t*>* convert_funcs, List<syntax_asdl::Token*>*
547 convert_toks, BigStr* as_ere, List<BigStr*>* capture_names)
548 : spliced(spliced),
549 canonical_flags(canonical_flags),
550 convert_funcs(convert_funcs),
551 convert_toks(convert_toks),
552 as_ere(as_ere),
553 capture_names(capture_names) {
554 }
555
556 static value__Eggex* CreateNull(bool alloc_lists = false) {
557 return Alloc<value__Eggex>(nullptr, kEmptyString, alloc_lists ?
558 Alloc<List<value_t*>>() : nullptr, alloc_lists ?
559 Alloc<List<syntax_asdl::Token*>>() : nullptr,
560 nullptr, alloc_lists ? Alloc<List<BigStr*>>() :
561 nullptr);
562 }
563
564 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
565
566 static constexpr ObjHeader obj_header() {
567 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Eggex), 6);
568 }
569
570 syntax_asdl::re_t* spliced;
571 BigStr* canonical_flags;
572 List<value_t*>* convert_funcs;
573 List<syntax_asdl::Token*>* convert_toks;
574 BigStr* as_ere;
575 List<BigStr*>* capture_names;
576
577 DISALLOW_COPY_AND_ASSIGN(value__Eggex)
578};
579
580class value__Expr : public value_t {
581 public:
582 value__Expr(syntax_asdl::expr_t* e)
583 : e(e) {
584 }
585
586 static value__Expr* CreateNull(bool alloc_lists = false) {
587 return Alloc<value__Expr>(nullptr);
588 }
589
590 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
591
592 static constexpr ObjHeader obj_header() {
593 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Expr), 1);
594 }
595
596 syntax_asdl::expr_t* e;
597
598 DISALLOW_COPY_AND_ASSIGN(value__Expr)
599};
600
601class value__Command : public value_t {
602 public:
603 value__Command(syntax_asdl::command_t* c)
604 : c(c) {
605 }
606
607 static value__Command* CreateNull(bool alloc_lists = false) {
608 return Alloc<value__Command>(nullptr);
609 }
610
611 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
612
613 static constexpr ObjHeader obj_header() {
614 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Command), 1);
615 }
616
617 syntax_asdl::command_t* c;
618
619 DISALLOW_COPY_AND_ASSIGN(value__Command)
620};
621
622class value__Block : public value_t {
623 public:
624 value__Block(syntax_asdl::LiteralBlock* block)
625 : block(block) {
626 }
627
628 static value__Block* CreateNull(bool alloc_lists = false) {
629 return Alloc<value__Block>(nullptr);
630 }
631
632 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
633
634 static constexpr ObjHeader obj_header() {
635 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Block), 1);
636 }
637
638 syntax_asdl::LiteralBlock* block;
639
640 DISALLOW_COPY_AND_ASSIGN(value__Block)
641};
642
643class value__Place : public value_t {
644 public:
645 value__Place(y_lvalue_t* lval, Dict<BigStr*, runtime_asdl::Cell*>* frame)
646 : lval(lval),
647 frame(frame) {
648 }
649
650 static value__Place* CreateNull(bool alloc_lists = false) {
651 return Alloc<value__Place>(nullptr, 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::Place), 2);
658 }
659
660 y_lvalue_t* lval;
661 Dict<BigStr*, runtime_asdl::Cell*>* frame;
662
663 DISALLOW_COPY_AND_ASSIGN(value__Place)
664};
665
666class value__Module : public value_t {
667 public:
668 value__Module(Dict<BigStr*, value_t*>* defs)
669 : defs(defs) {
670 }
671
672 static value__Module* CreateNull(bool alloc_lists = false) {
673 return Alloc<value__Module>(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::Module), 1);
680 }
681
682 Dict<BigStr*, value_t*>* defs;
683
684 DISALLOW_COPY_AND_ASSIGN(value__Module)
685};
686
687class value__IO : public value_t {
688 public:
689 value__IO(void* cmd_ev, void* prompt_ev)
690 : cmd_ev(cmd_ev),
691 prompt_ev(prompt_ev) {
692 }
693
694 static value__IO* CreateNull(bool alloc_lists = false) {
695 return Alloc<value__IO>(nullptr, 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::IO), 2);
702 }
703
704 void* cmd_ev;
705 void* prompt_ev;
706
707 DISALLOW_COPY_AND_ASSIGN(value__IO)
708};
709
710class value__Guts : public value_t {
711 public:
712 value__Guts(void* vm)
713 : vm(vm) {
714 }
715
716 static value__Guts* CreateNull(bool alloc_lists = false) {
717 return Alloc<value__Guts>(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::Guts), 1);
724 }
725
726 void* vm;
727
728 DISALLOW_COPY_AND_ASSIGN(value__Guts)
729};
730
731class value__BuiltinFunc : public value_t {
732 public:
733 value__BuiltinFunc(void* callable)
734 : callable(callable) {
735 }
736
737 static value__BuiltinFunc* CreateNull(bool alloc_lists = false) {
738 return Alloc<value__BuiltinFunc>(nullptr);
739 }
740
741 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
742
743 static constexpr ObjHeader obj_header() {
744 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::BuiltinFunc), 1);
745 }
746
747 void* callable;
748
749 DISALLOW_COPY_AND_ASSIGN(value__BuiltinFunc)
750};
751
752class value__BoundFunc : public value_t {
753 public:
754 value__BoundFunc(value_t* me, value_t* func)
755 : me(me),
756 func(func) {
757 }
758
759 static value__BoundFunc* CreateNull(bool alloc_lists = false) {
760 return Alloc<value__BoundFunc>(nullptr, 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::BoundFunc), 2);
767 }
768
769 value_t* me;
770 value_t* func;
771
772 DISALLOW_COPY_AND_ASSIGN(value__BoundFunc)
773};
774
775class value__Proc : public value_t {
776 public:
777 value__Proc(BigStr* name, syntax_asdl::Token* name_tok,
778 syntax_asdl::proc_sig_t* sig, syntax_asdl::command_t* body,
779 ProcDefaults* defaults, bool sh_compat)
780 : name(name),
781 name_tok(name_tok),
782 sig(sig),
783 body(body),
784 defaults(defaults),
785 sh_compat(sh_compat) {
786 }
787
788 static value__Proc* CreateNull(bool alloc_lists = false) {
789 return Alloc<value__Proc>(kEmptyString, nullptr, nullptr, nullptr, nullptr,
790 false);
791 }
792
793 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
794
795 static constexpr ObjHeader obj_header() {
796 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Proc), 5);
797 }
798
799 BigStr* name;
800 syntax_asdl::Token* name_tok;
801 syntax_asdl::proc_sig_t* sig;
802 syntax_asdl::command_t* body;
803 ProcDefaults* defaults;
804 bool sh_compat;
805
806 DISALLOW_COPY_AND_ASSIGN(value__Proc)
807};
808
809class value__Func : public value_t {
810 public:
811 value__Func(BigStr* name, syntax_asdl::Func* parsed, List<value_t*>*
812 pos_defaults, Dict<BigStr*, value_t*>* named_defaults,
813 Dict<BigStr*, runtime_asdl::Cell*>* module_)
814 : name(name),
815 parsed(parsed),
816 pos_defaults(pos_defaults),
817 named_defaults(named_defaults),
818 module_(module_) {
819 }
820
821 static value__Func* CreateNull(bool alloc_lists = false) {
822 return Alloc<value__Func>(kEmptyString, nullptr, alloc_lists ?
823 Alloc<List<value_t*>>() : nullptr, nullptr,
824 nullptr);
825 }
826
827 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
828
829 static constexpr ObjHeader obj_header() {
830 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Func), 5);
831 }
832
833 BigStr* name;
834 syntax_asdl::Func* parsed;
835 List<value_t*>* pos_defaults;
836 Dict<BigStr*, value_t*>* named_defaults;
837 Dict<BigStr*, runtime_asdl::Cell*>* module_;
838
839 DISALLOW_COPY_AND_ASSIGN(value__Func)
840};
841
842class value__Slice : public value_t {
843 public:
844 value__Slice(IntBox* lower, IntBox* upper)
845 : lower(lower),
846 upper(upper) {
847 }
848
849 static value__Slice* CreateNull(bool alloc_lists = false) {
850 return Alloc<value__Slice>(nullptr, nullptr);
851 }
852
853 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
854
855 static constexpr ObjHeader obj_header() {
856 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Slice), 2);
857 }
858
859 IntBox* lower;
860 IntBox* upper;
861
862 DISALLOW_COPY_AND_ASSIGN(value__Slice)
863};
864
865class value__Range : public value_t {
866 public:
867 value__Range(int lower, int upper)
868 : lower(lower),
869 upper(upper) {
870 }
871
872 static value__Range* CreateNull(bool alloc_lists = false) {
873 return Alloc<value__Range>(-1, -1);
874 }
875
876 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
877
878 static constexpr ObjHeader obj_header() {
879 return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Range), 0);
880 }
881
882 int lower;
883 int upper;
884
885 DISALLOW_COPY_AND_ASSIGN(value__Range)
886};
887
888extern GcGlobal<value__Interrupted> gvalue__Interrupted;
889extern GcGlobal<value__Stdin> gvalue__Stdin;
890extern GcGlobal<value__Undef> gvalue__Undef;
891extern GcGlobal<value__Null> gvalue__Null;
892ASDL_NAMES value {
893 static value__Interrupted* Interrupted;
894 static value__Stdin* Stdin;
895 static value__Undef* Undef;
896 typedef value__Str Str;
897 typedef value__BashArray BashArray;
898 typedef value__SparseArray SparseArray;
899 typedef value__BashAssoc BashAssoc;
900 static value__Null* Null;
901 typedef value__Bool Bool;
902 typedef value__Int Int;
903 typedef value__Float Float;
904 typedef value__List List;
905 typedef value__Eggex Eggex;
906 typedef value__Expr Expr;
907 typedef value__Command Command;
908 typedef value__Block Block;
909 typedef value__Place Place;
910 typedef value__Module Module;
911 typedef value__IO IO;
912 typedef value__Guts Guts;
913 typedef value__BuiltinFunc BuiltinFunc;
914 typedef value__BoundFunc BoundFunc;
915 typedef value__Proc Proc;
916 typedef value__Func Func;
917 typedef value__Slice Slice;
918 typedef value__Range Range;
919};
920
921class IntBox {
922 public:
923 IntBox(int i)
924 : i(i) {
925 }
926
927 static IntBox* CreateNull(bool alloc_lists = false) {
928 return Alloc<IntBox>(-1);
929 }
930
931 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
932
933 static constexpr ObjHeader obj_header() {
934 return ObjHeader::AsdlClass(64, 0);
935 }
936
937 int i;
938
939 DISALLOW_COPY_AND_ASSIGN(IntBox)
940};
941
942class ProcDefaults {
943 public:
944 ProcDefaults(List<value_t*>* for_word, List<value_t*>* for_typed,
945 Dict<BigStr*, value_t*>* for_named, value_t* for_block)
946 : for_word(for_word),
947 for_typed(for_typed),
948 for_named(for_named),
949 for_block(for_block) {
950 }
951
952 static ProcDefaults* CreateNull(bool alloc_lists = false) {
953 return Alloc<ProcDefaults>(nullptr, nullptr, nullptr, nullptr);
954 }
955
956 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
957
958 static constexpr ObjHeader obj_header() {
959 return ObjHeader::AsdlClass(65, 4);
960 }
961
962 List<value_t*>* for_word;
963 List<value_t*>* for_typed;
964 Dict<BigStr*, value_t*>* for_named;
965 value_t* for_block;
966
967 DISALLOW_COPY_AND_ASSIGN(ProcDefaults)
968};
969
970class LeftName : public y_lvalue_t, public sh_lvalue_t {
971 public:
972 LeftName(BigStr* name, syntax_asdl::loc_t* blame_loc)
973 : name(name),
974 blame_loc(blame_loc) {
975 }
976
977 static LeftName* CreateNull(bool alloc_lists = false) {
978 return Alloc<LeftName>(kEmptyString, nullptr);
979 }
980
981 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
982
983 static constexpr ObjHeader obj_header() {
984 return ObjHeader::AsdlClass(66, 2);
985 }
986
987 BigStr* name;
988 syntax_asdl::loc_t* blame_loc;
989
990 DISALLOW_COPY_AND_ASSIGN(LeftName)
991};
992
993class RegexMatch : public regex_match_t, public value_t {
994 public:
995 RegexMatch(BigStr* s, List<int>* indices, eggex_ops_t* ops)
996 : s(s),
997 indices(indices),
998 ops(ops) {
999 }
1000
1001 static RegexMatch* CreateNull(bool alloc_lists = false) {
1002 return Alloc<RegexMatch>(kEmptyString, alloc_lists ? Alloc<List<int>>() :
1003 nullptr, nullptr);
1004 }
1005
1006 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
1007
1008 static constexpr ObjHeader obj_header() {
1009 return ObjHeader::AsdlClass(67, 3);
1010 }
1011
1012 BigStr* s;
1013 List<int>* indices;
1014 eggex_ops_t* ops;
1015
1016 DISALLOW_COPY_AND_ASSIGN(RegexMatch)
1017};
1018
1019class Dict_ : public value_t {
1020 public:
1021 Dict_(Dict<BigStr*, value_t*>* d, Dict_* prototype)
1022 : d(d),
1023 prototype(prototype) {
1024 }
1025
1026 static Dict_* CreateNull(bool alloc_lists = false) {
1027 return Alloc<Dict_>(nullptr, nullptr);
1028 }
1029
1030 hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
1031
1032 static constexpr ObjHeader obj_header() {
1033 return ObjHeader::AsdlClass(68, 2);
1034 }
1035
1036 Dict<BigStr*, value_t*>* d;
1037 Dict_* prototype;
1038
1039 DISALLOW_COPY_AND_ASSIGN(Dict_)
1040};
1041
1042
1043} // namespace value_asdl
1044
1045#endif // VALUE_ASDL