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

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