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

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