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

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