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