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

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