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

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