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"
|
10 | using hnode_asdl::hnode_t;
|
11 |
|
12 | namespace 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 |
|
14 | namespace runtime_asdl { class Cell; }
|
15 |
|
16 | namespace value_asdl {
|
17 |
|
18 | // use struct instead of namespace so 'using' works consistently
|
19 | #define ASDL_NAMES struct
|
20 |
|
21 | class IntBox;
|
22 | class ProcDefaults;
|
23 | class LeftName;
|
24 | class y_lvalue_t;
|
25 | class sh_lvalue_t;
|
26 | class eggex_ops_t;
|
27 | class RegexMatch;
|
28 | class regex_match_t;
|
29 | class Obj;
|
30 | class value_t;
|
31 |
|
32 | ASDL_NAMES y_lvalue_e {
|
33 | enum no_name {
|
34 | Local = 66,
|
35 | Container = 2,
|
36 | };
|
37 | };
|
38 |
|
39 | BigStr* y_lvalue_str(int tag, bool dot = true);
|
40 |
|
41 | class 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 |
|
53 | class 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 |
|
77 | ASDL_NAMES y_lvalue {
|
78 | typedef y_lvalue__Container Container;
|
79 | };
|
80 |
|
81 | ASDL_NAMES sh_lvalue_e {
|
82 | enum no_name {
|
83 | Var = 66,
|
84 | Indexed = 2,
|
85 | Keyed = 3,
|
86 | };
|
87 | };
|
88 |
|
89 | BigStr* sh_lvalue_str(int tag, bool dot = true);
|
90 |
|
91 | class 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 |
|
103 | class 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 |
|
128 | class 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 |
|
153 | ASDL_NAMES sh_lvalue {
|
154 | typedef sh_lvalue__Indexed Indexed;
|
155 | typedef sh_lvalue__Keyed Keyed;
|
156 | };
|
157 |
|
158 | ASDL_NAMES eggex_ops_e {
|
159 | enum no_name {
|
160 | No = 1,
|
161 | Yes = 2,
|
162 | };
|
163 | };
|
164 |
|
165 | BigStr* eggex_ops_str(int tag, bool dot = true);
|
166 |
|
167 | class 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 |
|
179 | class 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 |
|
193 | class 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 |
|
223 | extern GcGlobal<eggex_ops__No> geggex_ops__No;
|
224 | ASDL_NAMES eggex_ops {
|
225 | static eggex_ops__No* No;
|
226 | typedef eggex_ops__Yes Yes;
|
227 | };
|
228 |
|
229 | ASDL_NAMES regex_match_e {
|
230 | enum no_name {
|
231 | No = 1,
|
232 | Yes = 67,
|
233 | };
|
234 | };
|
235 |
|
236 | BigStr* regex_match_str(int tag, bool dot = true);
|
237 |
|
238 | class 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 |
|
250 | class 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 |
|
264 | extern GcGlobal<regex_match__No> gregex_match__No;
|
265 | ASDL_NAMES regex_match {
|
266 | static regex_match__No* No;
|
267 | };
|
268 |
|
269 | ASDL_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 | Module = 21,
|
292 | BuiltinFunc = 22,
|
293 | BoundFunc = 23,
|
294 | Proc = 24,
|
295 | Func = 25,
|
296 | Range = 26,
|
297 | Slice = 27,
|
298 | };
|
299 | };
|
300 |
|
301 | BigStr* value_str(int tag, bool dot = true);
|
302 |
|
303 | class 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 |
|
315 | class 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 |
|
329 | class 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 |
|
343 | class 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 |
|
357 | class 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 |
|
378 | class 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 |
|
400 | class 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 |
|
423 | class 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 |
|
444 | class 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 |
|
458 | class 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 |
|
479 | class 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 |
|
500 | class 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 |
|
521 | class 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 |
|
542 | class 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 |
|
563 | class 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 |
|
600 | class 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 |
|
621 | class 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 |
|
642 | class 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 |
|
663 | class 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 |
|
686 | class value__Module : public value_t {
|
687 | public:
|
688 | value__Module(Dict<BigStr*, value_t*>* defs)
|
689 | : defs(defs) {
|
690 | }
|
691 |
|
692 | static value__Module* CreateNull(bool alloc_lists = false) {
|
693 | return Alloc<value__Module>(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::Module), 1);
|
700 | }
|
701 |
|
702 | Dict<BigStr*, value_t*>* defs;
|
703 |
|
704 | DISALLOW_COPY_AND_ASSIGN(value__Module)
|
705 | };
|
706 |
|
707 | class 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 |
|
728 | class 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 |
|
751 | class 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)
|
756 | : name(name),
|
757 | name_tok(name_tok),
|
758 | sig(sig),
|
759 | body(body),
|
760 | defaults(defaults),
|
761 | sh_compat(sh_compat) {
|
762 | }
|
763 |
|
764 | static value__Proc* CreateNull(bool alloc_lists = false) {
|
765 | return Alloc<value__Proc>(kEmptyString, nullptr, nullptr, nullptr, nullptr,
|
766 | false);
|
767 | }
|
768 |
|
769 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
770 |
|
771 | static constexpr ObjHeader obj_header() {
|
772 | return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Proc), 5);
|
773 | }
|
774 |
|
775 | BigStr* name;
|
776 | syntax_asdl::Token* name_tok;
|
777 | syntax_asdl::proc_sig_t* sig;
|
778 | syntax_asdl::command_t* body;
|
779 | ProcDefaults* defaults;
|
780 | bool sh_compat;
|
781 |
|
782 | DISALLOW_COPY_AND_ASSIGN(value__Proc)
|
783 | };
|
784 |
|
785 | class value__Func : public value_t {
|
786 | public:
|
787 | value__Func(BigStr* name, syntax_asdl::Func* parsed, List<value_t*>*
|
788 | pos_defaults, Dict<BigStr*, value_t*>* named_defaults,
|
789 | Dict<BigStr*, runtime_asdl::Cell*>* module_)
|
790 | : name(name),
|
791 | parsed(parsed),
|
792 | pos_defaults(pos_defaults),
|
793 | named_defaults(named_defaults),
|
794 | module_(module_) {
|
795 | }
|
796 |
|
797 | static value__Func* CreateNull(bool alloc_lists = false) {
|
798 | return Alloc<value__Func>(kEmptyString, nullptr, alloc_lists ?
|
799 | Alloc<List<value_t*>>() : nullptr, nullptr,
|
800 | nullptr);
|
801 | }
|
802 |
|
803 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
804 |
|
805 | static constexpr ObjHeader obj_header() {
|
806 | return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Func), 5);
|
807 | }
|
808 |
|
809 | BigStr* name;
|
810 | syntax_asdl::Func* parsed;
|
811 | List<value_t*>* pos_defaults;
|
812 | Dict<BigStr*, value_t*>* named_defaults;
|
813 | Dict<BigStr*, runtime_asdl::Cell*>* module_;
|
814 |
|
815 | DISALLOW_COPY_AND_ASSIGN(value__Func)
|
816 | };
|
817 |
|
818 | class value__Range : public value_t {
|
819 | public:
|
820 | value__Range(int lower, int upper)
|
821 | : lower(lower),
|
822 | upper(upper) {
|
823 | }
|
824 |
|
825 | static value__Range* CreateNull(bool alloc_lists = false) {
|
826 | return Alloc<value__Range>(-1, -1);
|
827 | }
|
828 |
|
829 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
830 |
|
831 | static constexpr ObjHeader obj_header() {
|
832 | return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Range), 0);
|
833 | }
|
834 |
|
835 | int lower;
|
836 | int upper;
|
837 |
|
838 | DISALLOW_COPY_AND_ASSIGN(value__Range)
|
839 | };
|
840 |
|
841 | class value__Slice : public value_t {
|
842 | public:
|
843 | value__Slice(IntBox* lower, IntBox* upper)
|
844 | : lower(lower),
|
845 | upper(upper) {
|
846 | }
|
847 |
|
848 | static value__Slice* CreateNull(bool alloc_lists = false) {
|
849 | return Alloc<value__Slice>(nullptr, nullptr);
|
850 | }
|
851 |
|
852 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
853 |
|
854 | static constexpr ObjHeader obj_header() {
|
855 | return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Slice), 2);
|
856 | }
|
857 |
|
858 | IntBox* lower;
|
859 | IntBox* upper;
|
860 |
|
861 | DISALLOW_COPY_AND_ASSIGN(value__Slice)
|
862 | };
|
863 |
|
864 | extern GcGlobal<value__Interrupted> gvalue__Interrupted;
|
865 | extern GcGlobal<value__Stdin> gvalue__Stdin;
|
866 | extern GcGlobal<value__Undef> gvalue__Undef;
|
867 | extern GcGlobal<value__Null> gvalue__Null;
|
868 | ASDL_NAMES value {
|
869 | static value__Interrupted* Interrupted;
|
870 | static value__Stdin* Stdin;
|
871 | static value__Undef* Undef;
|
872 | typedef value__Str Str;
|
873 | typedef value__BashArray BashArray;
|
874 | typedef value__SparseArray SparseArray;
|
875 | typedef value__BashAssoc BashAssoc;
|
876 | static value__Null* Null;
|
877 | typedef value__Bool Bool;
|
878 | typedef value__Int Int;
|
879 | typedef value__Float Float;
|
880 | typedef value__List List;
|
881 | typedef value__Dict Dict;
|
882 | typedef value__Eggex Eggex;
|
883 | typedef value__Expr Expr;
|
884 | typedef value__Command Command;
|
885 | typedef value__Block Block;
|
886 | typedef value__Place Place;
|
887 | typedef value__Module Module;
|
888 | typedef value__BuiltinFunc BuiltinFunc;
|
889 | typedef value__BoundFunc BoundFunc;
|
890 | typedef value__Proc Proc;
|
891 | typedef value__Func Func;
|
892 | typedef value__Range Range;
|
893 | typedef value__Slice Slice;
|
894 | };
|
895 |
|
896 | class IntBox {
|
897 | public:
|
898 | IntBox(int i)
|
899 | : i(i) {
|
900 | }
|
901 |
|
902 | static IntBox* CreateNull(bool alloc_lists = false) {
|
903 | return Alloc<IntBox>(-1);
|
904 | }
|
905 |
|
906 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
907 |
|
908 | static constexpr ObjHeader obj_header() {
|
909 | return ObjHeader::AsdlClass(64, 0);
|
910 | }
|
911 |
|
912 | int i;
|
913 |
|
914 | DISALLOW_COPY_AND_ASSIGN(IntBox)
|
915 | };
|
916 |
|
917 | class ProcDefaults {
|
918 | public:
|
919 | ProcDefaults(List<value_t*>* for_word, List<value_t*>* for_typed,
|
920 | Dict<BigStr*, value_t*>* for_named, value_t* for_block)
|
921 | : for_word(for_word),
|
922 | for_typed(for_typed),
|
923 | for_named(for_named),
|
924 | for_block(for_block) {
|
925 | }
|
926 |
|
927 | static ProcDefaults* CreateNull(bool alloc_lists = false) {
|
928 | return Alloc<ProcDefaults>(nullptr, nullptr, nullptr, nullptr);
|
929 | }
|
930 |
|
931 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
932 |
|
933 | static constexpr ObjHeader obj_header() {
|
934 | return ObjHeader::AsdlClass(65, 4);
|
935 | }
|
936 |
|
937 | List<value_t*>* for_word;
|
938 | List<value_t*>* for_typed;
|
939 | Dict<BigStr*, value_t*>* for_named;
|
940 | value_t* for_block;
|
941 |
|
942 | DISALLOW_COPY_AND_ASSIGN(ProcDefaults)
|
943 | };
|
944 |
|
945 | class LeftName : public y_lvalue_t, public sh_lvalue_t {
|
946 | public:
|
947 | LeftName(BigStr* name, syntax_asdl::loc_t* blame_loc)
|
948 | : name(name),
|
949 | blame_loc(blame_loc) {
|
950 | }
|
951 |
|
952 | static LeftName* CreateNull(bool alloc_lists = false) {
|
953 | return Alloc<LeftName>(kEmptyString, nullptr);
|
954 | }
|
955 |
|
956 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
957 |
|
958 | static constexpr ObjHeader obj_header() {
|
959 | return ObjHeader::AsdlClass(66, 2);
|
960 | }
|
961 |
|
962 | BigStr* name;
|
963 | syntax_asdl::loc_t* blame_loc;
|
964 |
|
965 | DISALLOW_COPY_AND_ASSIGN(LeftName)
|
966 | };
|
967 |
|
968 | class RegexMatch : public regex_match_t, public value_t {
|
969 | public:
|
970 | RegexMatch(BigStr* s, List<int>* indices, eggex_ops_t* ops)
|
971 | : s(s),
|
972 | indices(indices),
|
973 | ops(ops) {
|
974 | }
|
975 |
|
976 | static RegexMatch* CreateNull(bool alloc_lists = false) {
|
977 | return Alloc<RegexMatch>(kEmptyString, alloc_lists ? Alloc<List<int>>() :
|
978 | nullptr, nullptr);
|
979 | }
|
980 |
|
981 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
982 |
|
983 | static constexpr ObjHeader obj_header() {
|
984 | return ObjHeader::AsdlClass(67, 3);
|
985 | }
|
986 |
|
987 | BigStr* s;
|
988 | List<int>* indices;
|
989 | eggex_ops_t* ops;
|
990 |
|
991 | DISALLOW_COPY_AND_ASSIGN(RegexMatch)
|
992 | };
|
993 |
|
994 | class Obj : public value_t {
|
995 | public:
|
996 | Obj(Obj* prototype, Dict<BigStr*, value_t*>* d)
|
997 | : prototype(prototype),
|
998 | d(d) {
|
999 | }
|
1000 |
|
1001 | static Obj* CreateNull(bool alloc_lists = false) {
|
1002 | return Alloc<Obj>(nullptr, nullptr);
|
1003 | }
|
1004 |
|
1005 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
1006 |
|
1007 | static constexpr ObjHeader obj_header() {
|
1008 | return ObjHeader::AsdlClass(68, 2);
|
1009 | }
|
1010 |
|
1011 | Obj* prototype;
|
1012 | Dict<BigStr*, value_t*>* d;
|
1013 |
|
1014 | DISALLOW_COPY_AND_ASSIGN(Obj)
|
1015 | };
|
1016 |
|
1017 |
|
1018 | } // namespace value_asdl
|
1019 |
|
1020 | #endif // VALUE_ASDL
|