1 | // _gen/core/runtime.asdl.h is generated by asdl_main.py
|
2 |
|
3 | #ifndef RUNTIME_ASDL
|
4 | #define RUNTIME_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 | #include "_gen/frontend/id_kind.asdl.h"
|
13 | using id_kind_asdl::Id_t;
|
14 |
|
15 | namespace syntax_asdl { class loc_t; class Token; class expr_t; class word_t; class command_t; class CompoundWord; class DoubleQuoted; class ArgList; class re_t; class redir_loc_t; class proc_sig_t; class Func; }
|
16 |
|
17 | namespace value_asdl { class value_t; class Obj; }
|
18 |
|
19 | namespace runtime_asdl {
|
20 |
|
21 | // use struct instead of namespace so 'using' works consistently
|
22 | #define ASDL_NAMES struct
|
23 |
|
24 | class AssignArg;
|
25 | class ProcArgs;
|
26 | class cmd_value_t;
|
27 | class Piece;
|
28 | class part_value_t;
|
29 | class VarSubState;
|
30 | class Cell;
|
31 | class a_index_t;
|
32 | class VTestPlace;
|
33 | class redirect_arg_t;
|
34 | class RedirValue;
|
35 | class StatusArray;
|
36 | class CommandStatus;
|
37 | class wait_status_t;
|
38 | class trace_t;
|
39 | class HayNode;
|
40 |
|
41 | ASDL_NAMES cmd_value_e {
|
42 | enum no_name {
|
43 | Argv = 1,
|
44 | Assign = 2,
|
45 | };
|
46 | };
|
47 |
|
48 | BigStr* cmd_value_str(int tag, bool dot = true);
|
49 |
|
50 | class cmd_value_t {
|
51 | protected:
|
52 | cmd_value_t() {
|
53 | }
|
54 | public:
|
55 | int tag() const {
|
56 | return ObjHeader::FromObject(this)->type_tag;
|
57 | }
|
58 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
59 | DISALLOW_COPY_AND_ASSIGN(cmd_value_t)
|
60 | };
|
61 |
|
62 | class cmd_value__Argv : public cmd_value_t {
|
63 | public:
|
64 | cmd_value__Argv(List<BigStr*>* argv, List<syntax_asdl::CompoundWord*>*
|
65 | arg_locs, bool is_last_cmd, value_asdl::Obj* self_obj,
|
66 | ProcArgs* proc_args)
|
67 | : argv(argv),
|
68 | arg_locs(arg_locs),
|
69 | self_obj(self_obj),
|
70 | proc_args(proc_args),
|
71 | is_last_cmd(is_last_cmd) {
|
72 | }
|
73 |
|
74 | static cmd_value__Argv* CreateNull(bool alloc_lists = false) {
|
75 | return Alloc<cmd_value__Argv>(alloc_lists ? Alloc<List<BigStr*>>() :
|
76 | nullptr, alloc_lists ?
|
77 | Alloc<List<syntax_asdl::CompoundWord*>>() :
|
78 | nullptr, false, nullptr, nullptr);
|
79 | }
|
80 |
|
81 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
82 |
|
83 | static constexpr ObjHeader obj_header() {
|
84 | return ObjHeader::AsdlClass(static_cast<uint16_t>(cmd_value_e::Argv), 4);
|
85 | }
|
86 |
|
87 | List<BigStr*>* argv;
|
88 | List<syntax_asdl::CompoundWord*>* arg_locs;
|
89 | value_asdl::Obj* self_obj;
|
90 | ProcArgs* proc_args;
|
91 | bool is_last_cmd;
|
92 |
|
93 | DISALLOW_COPY_AND_ASSIGN(cmd_value__Argv)
|
94 | };
|
95 |
|
96 | class cmd_value__Assign : public cmd_value_t {
|
97 | public:
|
98 | cmd_value__Assign(int builtin_id, List<BigStr*>* argv,
|
99 | List<syntax_asdl::CompoundWord*>* arg_locs,
|
100 | List<AssignArg*>* pairs)
|
101 | : argv(argv),
|
102 | arg_locs(arg_locs),
|
103 | pairs(pairs),
|
104 | builtin_id(builtin_id) {
|
105 | }
|
106 |
|
107 | static cmd_value__Assign* CreateNull(bool alloc_lists = false) {
|
108 | return Alloc<cmd_value__Assign>(-1, alloc_lists ? Alloc<List<BigStr*>>() :
|
109 | nullptr, alloc_lists ?
|
110 | Alloc<List<syntax_asdl::CompoundWord*>>() :
|
111 | nullptr, alloc_lists ?
|
112 | Alloc<List<AssignArg*>>() : 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>(cmd_value_e::Assign), 3);
|
119 | }
|
120 |
|
121 | List<BigStr*>* argv;
|
122 | List<syntax_asdl::CompoundWord*>* arg_locs;
|
123 | List<AssignArg*>* pairs;
|
124 | int builtin_id;
|
125 |
|
126 | DISALLOW_COPY_AND_ASSIGN(cmd_value__Assign)
|
127 | };
|
128 |
|
129 | ASDL_NAMES cmd_value {
|
130 | typedef cmd_value__Argv Argv;
|
131 | typedef cmd_value__Assign Assign;
|
132 | };
|
133 |
|
134 | ASDL_NAMES part_value_e {
|
135 | enum no_name {
|
136 | String = 66,
|
137 | Array = 2,
|
138 | ExtGlob = 3,
|
139 | };
|
140 | };
|
141 |
|
142 | BigStr* part_value_str(int tag, bool dot = true);
|
143 |
|
144 | class part_value_t {
|
145 | protected:
|
146 | part_value_t() {
|
147 | }
|
148 | public:
|
149 | int tag() const {
|
150 | return ObjHeader::FromObject(this)->type_tag;
|
151 | }
|
152 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
153 | DISALLOW_COPY_AND_ASSIGN(part_value_t)
|
154 | };
|
155 |
|
156 | class part_value__Array : public part_value_t {
|
157 | public:
|
158 | part_value__Array(List<BigStr*>* strs)
|
159 | : strs(strs) {
|
160 | }
|
161 |
|
162 | static part_value__Array* CreateNull(bool alloc_lists = false) {
|
163 | return Alloc<part_value__Array>(alloc_lists ? Alloc<List<BigStr*>>() :
|
164 | nullptr);
|
165 | }
|
166 |
|
167 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
168 |
|
169 | static constexpr ObjHeader obj_header() {
|
170 | return ObjHeader::AsdlClass(static_cast<uint16_t>(part_value_e::Array), 1);
|
171 | }
|
172 |
|
173 | List<BigStr*>* strs;
|
174 |
|
175 | DISALLOW_COPY_AND_ASSIGN(part_value__Array)
|
176 | };
|
177 |
|
178 | class part_value__ExtGlob : public part_value_t {
|
179 | public:
|
180 | part_value__ExtGlob(List<part_value_t*>* part_vals)
|
181 | : part_vals(part_vals) {
|
182 | }
|
183 |
|
184 | static part_value__ExtGlob* CreateNull(bool alloc_lists = false) {
|
185 | return Alloc<part_value__ExtGlob>(alloc_lists ?
|
186 | Alloc<List<part_value_t*>>() : nullptr);
|
187 | }
|
188 |
|
189 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
190 |
|
191 | static constexpr ObjHeader obj_header() {
|
192 | return ObjHeader::AsdlClass(static_cast<uint16_t>(part_value_e::ExtGlob),
|
193 | 1);
|
194 | }
|
195 |
|
196 | List<part_value_t*>* part_vals;
|
197 |
|
198 | DISALLOW_COPY_AND_ASSIGN(part_value__ExtGlob)
|
199 | };
|
200 |
|
201 | ASDL_NAMES part_value {
|
202 | typedef part_value__Array Array;
|
203 | typedef part_value__ExtGlob ExtGlob;
|
204 | };
|
205 |
|
206 | enum class coerced_e {
|
207 | Int = 1,
|
208 | Float = 2,
|
209 | Neither = 3,
|
210 | };
|
211 | typedef coerced_e coerced_t;
|
212 |
|
213 | BigStr* coerced_str(coerced_e tag, bool dot = true);
|
214 |
|
215 | enum class scope_e {
|
216 | Shopt = 1,
|
217 | Dynamic = 2,
|
218 | LocalOrGlobal = 3,
|
219 | LocalOnly = 4,
|
220 | GlobalOnly = 5,
|
221 | };
|
222 | typedef scope_e scope_t;
|
223 |
|
224 | BigStr* scope_str(scope_e tag, bool dot = true);
|
225 |
|
226 | ASDL_NAMES a_index_e {
|
227 | enum no_name {
|
228 | Str = 1,
|
229 | Int = 2,
|
230 | };
|
231 | };
|
232 |
|
233 | BigStr* a_index_str(int tag, bool dot = true);
|
234 |
|
235 | class a_index_t {
|
236 | protected:
|
237 | a_index_t() {
|
238 | }
|
239 | public:
|
240 | int tag() const {
|
241 | return ObjHeader::FromObject(this)->type_tag;
|
242 | }
|
243 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
244 | DISALLOW_COPY_AND_ASSIGN(a_index_t)
|
245 | };
|
246 |
|
247 | class a_index__Str : public a_index_t {
|
248 | public:
|
249 | a_index__Str(BigStr* s)
|
250 | : s(s) {
|
251 | }
|
252 |
|
253 | static a_index__Str* CreateNull(bool alloc_lists = false) {
|
254 | return Alloc<a_index__Str>(kEmptyString);
|
255 | }
|
256 |
|
257 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
258 |
|
259 | static constexpr ObjHeader obj_header() {
|
260 | return ObjHeader::AsdlClass(static_cast<uint16_t>(a_index_e::Str), 1);
|
261 | }
|
262 |
|
263 | BigStr* s;
|
264 |
|
265 | DISALLOW_COPY_AND_ASSIGN(a_index__Str)
|
266 | };
|
267 |
|
268 | class a_index__Int : public a_index_t {
|
269 | public:
|
270 | a_index__Int(int i)
|
271 | : i(i) {
|
272 | }
|
273 |
|
274 | static a_index__Int* CreateNull(bool alloc_lists = false) {
|
275 | return Alloc<a_index__Int>(-1);
|
276 | }
|
277 |
|
278 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
279 |
|
280 | static constexpr ObjHeader obj_header() {
|
281 | return ObjHeader::AsdlClass(static_cast<uint16_t>(a_index_e::Int), 0);
|
282 | }
|
283 |
|
284 | int i;
|
285 |
|
286 | DISALLOW_COPY_AND_ASSIGN(a_index__Int)
|
287 | };
|
288 |
|
289 | ASDL_NAMES a_index {
|
290 | typedef a_index__Str Str;
|
291 | typedef a_index__Int Int;
|
292 | };
|
293 |
|
294 | ASDL_NAMES redirect_arg_e {
|
295 | enum no_name {
|
296 | Path = 1,
|
297 | CopyFd = 2,
|
298 | MoveFd = 3,
|
299 | CloseFd = 4,
|
300 | HereDoc = 5,
|
301 | };
|
302 | };
|
303 |
|
304 | BigStr* redirect_arg_str(int tag, bool dot = true);
|
305 |
|
306 | class redirect_arg_t {
|
307 | protected:
|
308 | redirect_arg_t() {
|
309 | }
|
310 | public:
|
311 | int tag() const {
|
312 | return ObjHeader::FromObject(this)->type_tag;
|
313 | }
|
314 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
315 | DISALLOW_COPY_AND_ASSIGN(redirect_arg_t)
|
316 | };
|
317 |
|
318 | class redirect_arg__Path : public redirect_arg_t {
|
319 | public:
|
320 | redirect_arg__Path(BigStr* filename)
|
321 | : filename(filename) {
|
322 | }
|
323 |
|
324 | static redirect_arg__Path* CreateNull(bool alloc_lists = false) {
|
325 | return Alloc<redirect_arg__Path>(kEmptyString);
|
326 | }
|
327 |
|
328 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
329 |
|
330 | static constexpr ObjHeader obj_header() {
|
331 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::Path), 1);
|
332 | }
|
333 |
|
334 | BigStr* filename;
|
335 |
|
336 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__Path)
|
337 | };
|
338 |
|
339 | class redirect_arg__CopyFd : public redirect_arg_t {
|
340 | public:
|
341 | redirect_arg__CopyFd(int target_fd)
|
342 | : target_fd(target_fd) {
|
343 | }
|
344 |
|
345 | static redirect_arg__CopyFd* CreateNull(bool alloc_lists = false) {
|
346 | return Alloc<redirect_arg__CopyFd>(-1);
|
347 | }
|
348 |
|
349 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
350 |
|
351 | static constexpr ObjHeader obj_header() {
|
352 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::CopyFd),
|
353 | 0);
|
354 | }
|
355 |
|
356 | int target_fd;
|
357 |
|
358 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__CopyFd)
|
359 | };
|
360 |
|
361 | class redirect_arg__MoveFd : public redirect_arg_t {
|
362 | public:
|
363 | redirect_arg__MoveFd(int target_fd)
|
364 | : target_fd(target_fd) {
|
365 | }
|
366 |
|
367 | static redirect_arg__MoveFd* CreateNull(bool alloc_lists = false) {
|
368 | return Alloc<redirect_arg__MoveFd>(-1);
|
369 | }
|
370 |
|
371 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
372 |
|
373 | static constexpr ObjHeader obj_header() {
|
374 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::MoveFd),
|
375 | 0);
|
376 | }
|
377 |
|
378 | int target_fd;
|
379 |
|
380 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__MoveFd)
|
381 | };
|
382 |
|
383 | class redirect_arg__CloseFd : public redirect_arg_t {
|
384 | public:
|
385 | redirect_arg__CloseFd() {}
|
386 |
|
387 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
388 |
|
389 | static constexpr ObjHeader obj_header() {
|
390 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::CloseFd),
|
391 | 0);
|
392 | }
|
393 |
|
394 |
|
395 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__CloseFd)
|
396 | };
|
397 |
|
398 | class redirect_arg__HereDoc : public redirect_arg_t {
|
399 | public:
|
400 | redirect_arg__HereDoc(BigStr* body)
|
401 | : body(body) {
|
402 | }
|
403 |
|
404 | static redirect_arg__HereDoc* CreateNull(bool alloc_lists = false) {
|
405 | return Alloc<redirect_arg__HereDoc>(kEmptyString);
|
406 | }
|
407 |
|
408 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
409 |
|
410 | static constexpr ObjHeader obj_header() {
|
411 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::HereDoc),
|
412 | 1);
|
413 | }
|
414 |
|
415 | BigStr* body;
|
416 |
|
417 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__HereDoc)
|
418 | };
|
419 |
|
420 | extern GcGlobal<redirect_arg__CloseFd> gredirect_arg__CloseFd;
|
421 | ASDL_NAMES redirect_arg {
|
422 | typedef redirect_arg__Path Path;
|
423 | typedef redirect_arg__CopyFd CopyFd;
|
424 | typedef redirect_arg__MoveFd MoveFd;
|
425 | static redirect_arg__CloseFd* CloseFd;
|
426 | typedef redirect_arg__HereDoc HereDoc;
|
427 | };
|
428 |
|
429 | ASDL_NAMES wait_status_e {
|
430 | enum no_name {
|
431 | Proc = 1,
|
432 | Pipeline = 2,
|
433 | Cancelled = 3,
|
434 | };
|
435 | };
|
436 |
|
437 | BigStr* wait_status_str(int tag, bool dot = true);
|
438 |
|
439 | class wait_status_t {
|
440 | protected:
|
441 | wait_status_t() {
|
442 | }
|
443 | public:
|
444 | int tag() const {
|
445 | return ObjHeader::FromObject(this)->type_tag;
|
446 | }
|
447 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
448 | DISALLOW_COPY_AND_ASSIGN(wait_status_t)
|
449 | };
|
450 |
|
451 | class wait_status__Proc : public wait_status_t {
|
452 | public:
|
453 | wait_status__Proc(int code)
|
454 | : code(code) {
|
455 | }
|
456 |
|
457 | static wait_status__Proc* CreateNull(bool alloc_lists = false) {
|
458 | return Alloc<wait_status__Proc>(-1);
|
459 | }
|
460 |
|
461 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
462 |
|
463 | static constexpr ObjHeader obj_header() {
|
464 | return ObjHeader::AsdlClass(static_cast<uint16_t>(wait_status_e::Proc), 0);
|
465 | }
|
466 |
|
467 | int code;
|
468 |
|
469 | DISALLOW_COPY_AND_ASSIGN(wait_status__Proc)
|
470 | };
|
471 |
|
472 | class wait_status__Pipeline : public wait_status_t {
|
473 | public:
|
474 | wait_status__Pipeline(List<int>* codes)
|
475 | : codes(codes) {
|
476 | }
|
477 |
|
478 | static wait_status__Pipeline* CreateNull(bool alloc_lists = false) {
|
479 | return Alloc<wait_status__Pipeline>(alloc_lists ? Alloc<List<int>>() :
|
480 | nullptr);
|
481 | }
|
482 |
|
483 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
484 |
|
485 | static constexpr ObjHeader obj_header() {
|
486 | return ObjHeader::AsdlClass(static_cast<uint16_t>(wait_status_e::Pipeline),
|
487 | 1);
|
488 | }
|
489 |
|
490 | List<int>* codes;
|
491 |
|
492 | DISALLOW_COPY_AND_ASSIGN(wait_status__Pipeline)
|
493 | };
|
494 |
|
495 | class wait_status__Cancelled : public wait_status_t {
|
496 | public:
|
497 | wait_status__Cancelled(int sig_num)
|
498 | : sig_num(sig_num) {
|
499 | }
|
500 |
|
501 | static wait_status__Cancelled* CreateNull(bool alloc_lists = false) {
|
502 | return Alloc<wait_status__Cancelled>(-1);
|
503 | }
|
504 |
|
505 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
506 |
|
507 | static constexpr ObjHeader obj_header() {
|
508 | return
|
509 | ObjHeader::AsdlClass(static_cast<uint16_t>(wait_status_e::Cancelled), 0);
|
510 | }
|
511 |
|
512 | int sig_num;
|
513 |
|
514 | DISALLOW_COPY_AND_ASSIGN(wait_status__Cancelled)
|
515 | };
|
516 |
|
517 | ASDL_NAMES wait_status {
|
518 | typedef wait_status__Proc Proc;
|
519 | typedef wait_status__Pipeline Pipeline;
|
520 | typedef wait_status__Cancelled Cancelled;
|
521 | };
|
522 |
|
523 | enum class flow_e {
|
524 | Nothing = 1,
|
525 | Break = 2,
|
526 | Raise = 3,
|
527 | };
|
528 | typedef flow_e flow_t;
|
529 |
|
530 | BigStr* flow_str(flow_e tag, bool dot = true);
|
531 |
|
532 | enum class span_e {
|
533 | Black = 1,
|
534 | Delim = 2,
|
535 | Backslash = 3,
|
536 | };
|
537 | typedef span_e span_t;
|
538 |
|
539 | BigStr* span_str(span_e tag, bool dot = true);
|
540 |
|
541 | ASDL_NAMES emit_i {
|
542 | enum no_name {
|
543 | Part = 1,
|
544 | Delim = 2,
|
545 | Empty = 3,
|
546 | Escape = 4,
|
547 | Nothing = 5,
|
548 | ARRAY_SIZE = 6,
|
549 | };
|
550 | };
|
551 |
|
552 | BigStr* emit_str(int tag, bool dot = true);
|
553 |
|
554 | typedef int emit_t;
|
555 |
|
556 | ASDL_NAMES state_i {
|
557 | enum no_name {
|
558 | Invalid = 1,
|
559 | Start = 2,
|
560 | DE_White1 = 3,
|
561 | DE_Gray = 4,
|
562 | DE_White2 = 5,
|
563 | Black = 6,
|
564 | Backslash = 7,
|
565 | Done = 8,
|
566 | ARRAY_SIZE = 9,
|
567 | };
|
568 | };
|
569 |
|
570 | BigStr* state_str(int tag, bool dot = true);
|
571 |
|
572 | typedef int state_t;
|
573 |
|
574 | ASDL_NAMES char_kind_i {
|
575 | enum no_name {
|
576 | DE_White = 1,
|
577 | DE_Gray = 2,
|
578 | Black = 3,
|
579 | Backslash = 4,
|
580 | Sentinel = 5,
|
581 | ARRAY_SIZE = 6,
|
582 | };
|
583 | };
|
584 |
|
585 | BigStr* char_kind_str(int tag, bool dot = true);
|
586 |
|
587 | typedef int char_kind_t;
|
588 |
|
589 | enum class job_state_e {
|
590 | Running = 1,
|
591 | Done = 2,
|
592 | Stopped = 3,
|
593 | };
|
594 | typedef job_state_e job_state_t;
|
595 |
|
596 | BigStr* job_state_str(job_state_e tag, bool dot = true);
|
597 |
|
598 | enum class flag_type_e {
|
599 | Bool = 1,
|
600 | Int = 2,
|
601 | Float = 3,
|
602 | Str = 4,
|
603 | };
|
604 | typedef flag_type_e flag_type_t;
|
605 |
|
606 | BigStr* flag_type_str(flag_type_e tag, bool dot = true);
|
607 |
|
608 | ASDL_NAMES trace_e {
|
609 | enum no_name {
|
610 | External = 1,
|
611 | CommandSub = 2,
|
612 | ForkWait = 3,
|
613 | Fork = 4,
|
614 | PipelinePart = 5,
|
615 | ProcessSub = 6,
|
616 | HereDoc = 7,
|
617 | };
|
618 | };
|
619 |
|
620 | BigStr* trace_str(int tag, bool dot = true);
|
621 |
|
622 | class trace_t {
|
623 | protected:
|
624 | trace_t() {
|
625 | }
|
626 | public:
|
627 | int tag() const {
|
628 | return ObjHeader::FromObject(this)->type_tag;
|
629 | }
|
630 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
631 | DISALLOW_COPY_AND_ASSIGN(trace_t)
|
632 | };
|
633 |
|
634 | class trace__External : public trace_t {
|
635 | public:
|
636 | trace__External(List<BigStr*>* argv)
|
637 | : argv(argv) {
|
638 | }
|
639 |
|
640 | static trace__External* CreateNull(bool alloc_lists = false) {
|
641 | return Alloc<trace__External>(alloc_lists ? Alloc<List<BigStr*>>() :
|
642 | nullptr);
|
643 | }
|
644 |
|
645 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
646 |
|
647 | static constexpr ObjHeader obj_header() {
|
648 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::External), 1);
|
649 | }
|
650 |
|
651 | List<BigStr*>* argv;
|
652 |
|
653 | DISALLOW_COPY_AND_ASSIGN(trace__External)
|
654 | };
|
655 |
|
656 | class trace__CommandSub : public trace_t {
|
657 | public:
|
658 | trace__CommandSub() {}
|
659 |
|
660 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
661 |
|
662 | static constexpr ObjHeader obj_header() {
|
663 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::CommandSub), 0);
|
664 | }
|
665 |
|
666 |
|
667 | DISALLOW_COPY_AND_ASSIGN(trace__CommandSub)
|
668 | };
|
669 |
|
670 | class trace__ForkWait : public trace_t {
|
671 | public:
|
672 | trace__ForkWait() {}
|
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>(trace_e::ForkWait), 0);
|
678 | }
|
679 |
|
680 |
|
681 | DISALLOW_COPY_AND_ASSIGN(trace__ForkWait)
|
682 | };
|
683 |
|
684 | class trace__Fork : public trace_t {
|
685 | public:
|
686 | trace__Fork() {}
|
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>(trace_e::Fork), 0);
|
692 | }
|
693 |
|
694 |
|
695 | DISALLOW_COPY_AND_ASSIGN(trace__Fork)
|
696 | };
|
697 |
|
698 | class trace__PipelinePart : public trace_t {
|
699 | public:
|
700 | trace__PipelinePart() {}
|
701 |
|
702 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
703 |
|
704 | static constexpr ObjHeader obj_header() {
|
705 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::PipelinePart),
|
706 | 0);
|
707 | }
|
708 |
|
709 |
|
710 | DISALLOW_COPY_AND_ASSIGN(trace__PipelinePart)
|
711 | };
|
712 |
|
713 | class trace__ProcessSub : public trace_t {
|
714 | public:
|
715 | trace__ProcessSub() {}
|
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>(trace_e::ProcessSub), 0);
|
721 | }
|
722 |
|
723 |
|
724 | DISALLOW_COPY_AND_ASSIGN(trace__ProcessSub)
|
725 | };
|
726 |
|
727 | class trace__HereDoc : public trace_t {
|
728 | public:
|
729 | trace__HereDoc() {}
|
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>(trace_e::HereDoc), 0);
|
735 | }
|
736 |
|
737 |
|
738 | DISALLOW_COPY_AND_ASSIGN(trace__HereDoc)
|
739 | };
|
740 |
|
741 | extern GcGlobal<trace__CommandSub> gtrace__CommandSub;
|
742 | extern GcGlobal<trace__ForkWait> gtrace__ForkWait;
|
743 | extern GcGlobal<trace__Fork> gtrace__Fork;
|
744 | extern GcGlobal<trace__PipelinePart> gtrace__PipelinePart;
|
745 | extern GcGlobal<trace__ProcessSub> gtrace__ProcessSub;
|
746 | extern GcGlobal<trace__HereDoc> gtrace__HereDoc;
|
747 | ASDL_NAMES trace {
|
748 | typedef trace__External External;
|
749 | static trace__CommandSub* CommandSub;
|
750 | static trace__ForkWait* ForkWait;
|
751 | static trace__Fork* Fork;
|
752 | static trace__PipelinePart* PipelinePart;
|
753 | static trace__ProcessSub* ProcessSub;
|
754 | static trace__HereDoc* HereDoc;
|
755 | };
|
756 |
|
757 | enum class word_style_e {
|
758 | Expr = 1,
|
759 | Unquoted = 2,
|
760 | DQ = 3,
|
761 | SQ = 4,
|
762 | };
|
763 | typedef word_style_e word_style_t;
|
764 |
|
765 | BigStr* word_style_str(word_style_e tag, bool dot = true);
|
766 |
|
767 | enum class comp_action_e {
|
768 | Other = 1,
|
769 | FileSystem = 2,
|
770 | BashFunc = 3,
|
771 | };
|
772 | typedef comp_action_e comp_action_t;
|
773 |
|
774 | BigStr* comp_action_str(comp_action_e tag, bool dot = true);
|
775 |
|
776 | class AssignArg {
|
777 | public:
|
778 | AssignArg(BigStr* var_name, value_asdl::value_t* rval, bool plus_eq,
|
779 | syntax_asdl::CompoundWord* blame_word)
|
780 | : var_name(var_name),
|
781 | rval(rval),
|
782 | blame_word(blame_word),
|
783 | plus_eq(plus_eq) {
|
784 | }
|
785 |
|
786 | static AssignArg* CreateNull(bool alloc_lists = false) {
|
787 | return Alloc<AssignArg>(kEmptyString, nullptr, false, nullptr);
|
788 | }
|
789 |
|
790 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
791 |
|
792 | static constexpr ObjHeader obj_header() {
|
793 | return ObjHeader::AsdlClass(64, 3);
|
794 | }
|
795 |
|
796 | BigStr* var_name;
|
797 | value_asdl::value_t* rval;
|
798 | syntax_asdl::CompoundWord* blame_word;
|
799 | bool plus_eq;
|
800 |
|
801 | DISALLOW_COPY_AND_ASSIGN(AssignArg)
|
802 | };
|
803 |
|
804 | class ProcArgs {
|
805 | public:
|
806 | ProcArgs(syntax_asdl::ArgList* typed_args, List<value_asdl::value_t*>*
|
807 | pos_args, Dict<BigStr*, value_asdl::value_t*>* named_args,
|
808 | value_asdl::value_t* block_arg)
|
809 | : typed_args(typed_args),
|
810 | pos_args(pos_args),
|
811 | named_args(named_args),
|
812 | block_arg(block_arg) {
|
813 | }
|
814 |
|
815 | static ProcArgs* CreateNull(bool alloc_lists = false) {
|
816 | return Alloc<ProcArgs>(nullptr, nullptr, nullptr, nullptr);
|
817 | }
|
818 |
|
819 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
820 |
|
821 | static constexpr ObjHeader obj_header() {
|
822 | return ObjHeader::AsdlClass(65, 4);
|
823 | }
|
824 |
|
825 | syntax_asdl::ArgList* typed_args;
|
826 | List<value_asdl::value_t*>* pos_args;
|
827 | Dict<BigStr*, value_asdl::value_t*>* named_args;
|
828 | value_asdl::value_t* block_arg;
|
829 |
|
830 | DISALLOW_COPY_AND_ASSIGN(ProcArgs)
|
831 | };
|
832 |
|
833 | class Piece : public part_value_t {
|
834 | public:
|
835 | Piece(BigStr* s, bool quoted, bool do_split)
|
836 | : s(s),
|
837 | quoted(quoted),
|
838 | do_split(do_split) {
|
839 | }
|
840 |
|
841 | static Piece* CreateNull(bool alloc_lists = false) {
|
842 | return Alloc<Piece>(kEmptyString, false, false);
|
843 | }
|
844 |
|
845 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
846 |
|
847 | static constexpr ObjHeader obj_header() {
|
848 | return ObjHeader::AsdlClass(66, 1);
|
849 | }
|
850 |
|
851 | BigStr* s;
|
852 | bool quoted;
|
853 | bool do_split;
|
854 |
|
855 | DISALLOW_COPY_AND_ASSIGN(Piece)
|
856 | };
|
857 |
|
858 | class VarSubState {
|
859 | public:
|
860 | VarSubState(bool join_array, bool is_type_query, bool has_test_op)
|
861 | : join_array(join_array),
|
862 | is_type_query(is_type_query),
|
863 | has_test_op(has_test_op) {
|
864 | }
|
865 |
|
866 | static VarSubState* CreateNull(bool alloc_lists = false) {
|
867 | return Alloc<VarSubState>(false, false, false);
|
868 | }
|
869 |
|
870 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
871 |
|
872 | static constexpr ObjHeader obj_header() {
|
873 | return ObjHeader::AsdlClass(67, 0);
|
874 | }
|
875 |
|
876 | bool join_array;
|
877 | bool is_type_query;
|
878 | bool has_test_op;
|
879 |
|
880 | DISALLOW_COPY_AND_ASSIGN(VarSubState)
|
881 | };
|
882 |
|
883 | class Cell {
|
884 | public:
|
885 | Cell(bool exported, bool readonly, bool nameref, value_asdl::value_t* val)
|
886 | : val(val),
|
887 | exported(exported),
|
888 | readonly(readonly),
|
889 | nameref(nameref) {
|
890 | }
|
891 |
|
892 | static Cell* CreateNull(bool alloc_lists = false) {
|
893 | return Alloc<Cell>(false, false, false, nullptr);
|
894 | }
|
895 |
|
896 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
897 |
|
898 | static constexpr ObjHeader obj_header() {
|
899 | return ObjHeader::AsdlClass(68, 1);
|
900 | }
|
901 |
|
902 | value_asdl::value_t* val;
|
903 | bool exported;
|
904 | bool readonly;
|
905 | bool nameref;
|
906 |
|
907 | DISALLOW_COPY_AND_ASSIGN(Cell)
|
908 | };
|
909 |
|
910 | class VTestPlace {
|
911 | public:
|
912 | VTestPlace(BigStr* name, a_index_t* index)
|
913 | : name(name),
|
914 | index(index) {
|
915 | }
|
916 |
|
917 | static VTestPlace* CreateNull(bool alloc_lists = false) {
|
918 | return Alloc<VTestPlace>(nullptr, nullptr);
|
919 | }
|
920 |
|
921 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
922 |
|
923 | static constexpr ObjHeader obj_header() {
|
924 | return ObjHeader::AsdlClass(69, 2);
|
925 | }
|
926 |
|
927 | BigStr* name;
|
928 | a_index_t* index;
|
929 |
|
930 | DISALLOW_COPY_AND_ASSIGN(VTestPlace)
|
931 | };
|
932 |
|
933 | class RedirValue {
|
934 | public:
|
935 | RedirValue(Id_t op_id, syntax_asdl::loc_t* op_loc, syntax_asdl::redir_loc_t*
|
936 | loc, redirect_arg_t* arg)
|
937 | : op_loc(op_loc),
|
938 | loc(loc),
|
939 | arg(arg),
|
940 | op_id(op_id) {
|
941 | }
|
942 |
|
943 | static RedirValue* CreateNull(bool alloc_lists = false) {
|
944 | return Alloc<RedirValue>(-1, nullptr, nullptr, nullptr);
|
945 | }
|
946 |
|
947 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
948 |
|
949 | static constexpr ObjHeader obj_header() {
|
950 | return ObjHeader::AsdlClass(70, 3);
|
951 | }
|
952 |
|
953 | syntax_asdl::loc_t* op_loc;
|
954 | syntax_asdl::redir_loc_t* loc;
|
955 | redirect_arg_t* arg;
|
956 | Id_t op_id;
|
957 |
|
958 | DISALLOW_COPY_AND_ASSIGN(RedirValue)
|
959 | };
|
960 |
|
961 | class StatusArray {
|
962 | public:
|
963 | StatusArray(List<int>* codes, List<syntax_asdl::loc_t*>* locs)
|
964 | : codes(codes),
|
965 | locs(locs) {
|
966 | }
|
967 |
|
968 | static StatusArray* CreateNull(bool alloc_lists = false) {
|
969 | return Alloc<StatusArray>(nullptr, nullptr);
|
970 | }
|
971 |
|
972 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
973 |
|
974 | static constexpr ObjHeader obj_header() {
|
975 | return ObjHeader::AsdlClass(71, 2);
|
976 | }
|
977 |
|
978 | List<int>* codes;
|
979 | List<syntax_asdl::loc_t*>* locs;
|
980 |
|
981 | DISALLOW_COPY_AND_ASSIGN(StatusArray)
|
982 | };
|
983 |
|
984 | class CommandStatus {
|
985 | public:
|
986 | CommandStatus(bool check_errexit, bool show_code, bool pipe_negated,
|
987 | List<int>* pipe_status, List<syntax_asdl::loc_t*>* pipe_locs)
|
988 | : pipe_status(pipe_status),
|
989 | pipe_locs(pipe_locs),
|
990 | check_errexit(check_errexit),
|
991 | show_code(show_code),
|
992 | pipe_negated(pipe_negated) {
|
993 | }
|
994 |
|
995 | static CommandStatus* CreateNull(bool alloc_lists = false) {
|
996 | return Alloc<CommandStatus>(false, false, false, nullptr, nullptr);
|
997 | }
|
998 |
|
999 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
1000 |
|
1001 | static constexpr ObjHeader obj_header() {
|
1002 | return ObjHeader::AsdlClass(72, 2);
|
1003 | }
|
1004 |
|
1005 | List<int>* pipe_status;
|
1006 | List<syntax_asdl::loc_t*>* pipe_locs;
|
1007 | bool check_errexit;
|
1008 | bool show_code;
|
1009 | bool pipe_negated;
|
1010 |
|
1011 | DISALLOW_COPY_AND_ASSIGN(CommandStatus)
|
1012 | };
|
1013 |
|
1014 | class HayNode {
|
1015 | public:
|
1016 | HayNode(Dict<BigStr*, HayNode*>* children)
|
1017 | : children(children) {
|
1018 | }
|
1019 |
|
1020 | static HayNode* CreateNull(bool alloc_lists = false) {
|
1021 | return Alloc<HayNode>(nullptr);
|
1022 | }
|
1023 |
|
1024 | hnode_t* PrettyTree(Dict<int, bool>* seen = nullptr);
|
1025 |
|
1026 | static constexpr ObjHeader obj_header() {
|
1027 | return ObjHeader::AsdlClass(73, 1);
|
1028 | }
|
1029 |
|
1030 | Dict<BigStr*, HayNode*>* children;
|
1031 |
|
1032 | DISALLOW_COPY_AND_ASSIGN(HayNode)
|
1033 | };
|
1034 |
|
1035 |
|
1036 | } // namespace runtime_asdl
|
1037 |
|
1038 | #endif // RUNTIME_ASDL
|