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 "asdl/cpp_runtime.h"
|
10 | #include "_gen/frontend/id_kind.asdl.h"
|
11 | using id_kind_asdl::Id_t;
|
12 |
|
13 | 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; }
|
14 |
|
15 | namespace value_asdl { class value_t; class Obj; }
|
16 |
|
17 | namespace runtime_asdl {
|
18 |
|
19 | // use struct instead of namespace so 'using' works consistently
|
20 | #define ASDL_NAMES struct
|
21 |
|
22 | class AssignArg;
|
23 | class ProcArgs;
|
24 | class cmd_value_t;
|
25 | class Piece;
|
26 | class part_value_t;
|
27 | class VarSubState;
|
28 | class Cell;
|
29 | class a_index_t;
|
30 | class VTestPlace;
|
31 | class redirect_arg_t;
|
32 | class RedirValue;
|
33 | class StatusArray;
|
34 | class CommandStatus;
|
35 | class wait_status_t;
|
36 | class trace_t;
|
37 | class HayNode;
|
38 |
|
39 | ASDL_NAMES cmd_value_e {
|
40 | enum no_name {
|
41 | Argv = 1,
|
42 | Assign = 2,
|
43 | };
|
44 | };
|
45 |
|
46 | BigStr* cmd_value_str(int tag, bool dot = true);
|
47 |
|
48 | class cmd_value_t {
|
49 | protected:
|
50 | cmd_value_t() {
|
51 | }
|
52 | public:
|
53 | int tag() const {
|
54 | return ObjHeader::FromObject(this)->type_tag;
|
55 | }
|
56 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
57 | DISALLOW_COPY_AND_ASSIGN(cmd_value_t)
|
58 | };
|
59 |
|
60 | class cmd_value__Argv : public cmd_value_t {
|
61 | public:
|
62 | cmd_value__Argv(List<BigStr*>* argv, List<syntax_asdl::CompoundWord*>*
|
63 | arg_locs, bool is_last_cmd, value_asdl::Obj* self_obj,
|
64 | ProcArgs* proc_args)
|
65 | : argv(argv),
|
66 | arg_locs(arg_locs),
|
67 | self_obj(self_obj),
|
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, nullptr);
|
77 | }
|
78 |
|
79 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
80 |
|
81 | static constexpr ObjHeader obj_header() {
|
82 | return ObjHeader::AsdlClass(static_cast<uint16_t>(cmd_value_e::Argv), 4);
|
83 | }
|
84 |
|
85 | List<BigStr*>* argv;
|
86 | List<syntax_asdl::CompoundWord*>* arg_locs;
|
87 | value_asdl::Obj* self_obj;
|
88 | ProcArgs* proc_args;
|
89 | bool is_last_cmd;
|
90 |
|
91 | DISALLOW_COPY_AND_ASSIGN(cmd_value__Argv)
|
92 | };
|
93 |
|
94 | class cmd_value__Assign : public cmd_value_t {
|
95 | public:
|
96 | cmd_value__Assign(int builtin_id, List<BigStr*>* argv,
|
97 | List<syntax_asdl::CompoundWord*>* arg_locs,
|
98 | List<AssignArg*>* pairs)
|
99 | : argv(argv),
|
100 | arg_locs(arg_locs),
|
101 | pairs(pairs),
|
102 | builtin_id(builtin_id) {
|
103 | }
|
104 |
|
105 | static cmd_value__Assign* CreateNull(bool alloc_lists = false) {
|
106 | return Alloc<cmd_value__Assign>(-1, alloc_lists ? Alloc<List<BigStr*>>() :
|
107 | nullptr, alloc_lists ?
|
108 | Alloc<List<syntax_asdl::CompoundWord*>>() :
|
109 | nullptr, alloc_lists ?
|
110 | Alloc<List<AssignArg*>>() : nullptr);
|
111 | }
|
112 |
|
113 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
114 |
|
115 | static constexpr ObjHeader obj_header() {
|
116 | return ObjHeader::AsdlClass(static_cast<uint16_t>(cmd_value_e::Assign), 3);
|
117 | }
|
118 |
|
119 | List<BigStr*>* argv;
|
120 | List<syntax_asdl::CompoundWord*>* arg_locs;
|
121 | List<AssignArg*>* pairs;
|
122 | int builtin_id;
|
123 |
|
124 | DISALLOW_COPY_AND_ASSIGN(cmd_value__Assign)
|
125 | };
|
126 |
|
127 | ASDL_NAMES cmd_value {
|
128 | typedef cmd_value__Argv Argv;
|
129 | typedef cmd_value__Assign Assign;
|
130 | };
|
131 |
|
132 | ASDL_NAMES part_value_e {
|
133 | enum no_name {
|
134 | String = 66,
|
135 | Array = 2,
|
136 | ExtGlob = 3,
|
137 | };
|
138 | };
|
139 |
|
140 | BigStr* part_value_str(int tag, bool dot = true);
|
141 |
|
142 | class part_value_t {
|
143 | protected:
|
144 | part_value_t() {
|
145 | }
|
146 | public:
|
147 | int tag() const {
|
148 | return ObjHeader::FromObject(this)->type_tag;
|
149 | }
|
150 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
151 | DISALLOW_COPY_AND_ASSIGN(part_value_t)
|
152 | };
|
153 |
|
154 | class part_value__Array : public part_value_t {
|
155 | public:
|
156 | part_value__Array(List<BigStr*>* strs, bool quoted)
|
157 | : strs(strs),
|
158 | quoted(quoted) {
|
159 | }
|
160 |
|
161 | static part_value__Array* CreateNull(bool alloc_lists = false) {
|
162 | return Alloc<part_value__Array>(alloc_lists ? Alloc<List<BigStr*>>() :
|
163 | nullptr, false);
|
164 | }
|
165 |
|
166 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
167 |
|
168 | static constexpr ObjHeader obj_header() {
|
169 | return ObjHeader::AsdlClass(static_cast<uint16_t>(part_value_e::Array), 1);
|
170 | }
|
171 |
|
172 | List<BigStr*>* strs;
|
173 | bool quoted;
|
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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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 error_code_e {
|
599 | OK = 1,
|
600 | IndexOutOfRange = 2,
|
601 | };
|
602 | typedef error_code_e error_code_t;
|
603 |
|
604 | BigStr* error_code_str(error_code_e tag, bool dot = true);
|
605 |
|
606 | enum class flag_type_e {
|
607 | Bool = 1,
|
608 | Int = 2,
|
609 | Float = 3,
|
610 | Str = 4,
|
611 | };
|
612 | typedef flag_type_e flag_type_t;
|
613 |
|
614 | BigStr* flag_type_str(flag_type_e tag, bool dot = true);
|
615 |
|
616 | ASDL_NAMES trace_e {
|
617 | enum no_name {
|
618 | External = 1,
|
619 | CommandSub = 2,
|
620 | ForkWait = 3,
|
621 | Fork = 4,
|
622 | PipelinePart = 5,
|
623 | ProcessSub = 6,
|
624 | HereDoc = 7,
|
625 | };
|
626 | };
|
627 |
|
628 | BigStr* trace_str(int tag, bool dot = true);
|
629 |
|
630 | class trace_t {
|
631 | protected:
|
632 | trace_t() {
|
633 | }
|
634 | public:
|
635 | int tag() const {
|
636 | return ObjHeader::FromObject(this)->type_tag;
|
637 | }
|
638 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
639 | DISALLOW_COPY_AND_ASSIGN(trace_t)
|
640 | };
|
641 |
|
642 | class trace__External : public trace_t {
|
643 | public:
|
644 | trace__External(List<BigStr*>* argv)
|
645 | : argv(argv) {
|
646 | }
|
647 |
|
648 | static trace__External* CreateNull(bool alloc_lists = false) {
|
649 | return Alloc<trace__External>(alloc_lists ? Alloc<List<BigStr*>>() :
|
650 | nullptr);
|
651 | }
|
652 |
|
653 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
654 |
|
655 | static constexpr ObjHeader obj_header() {
|
656 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::External), 1);
|
657 | }
|
658 |
|
659 | List<BigStr*>* argv;
|
660 |
|
661 | DISALLOW_COPY_AND_ASSIGN(trace__External)
|
662 | };
|
663 |
|
664 | class trace__CommandSub : public trace_t {
|
665 | public:
|
666 | trace__CommandSub() {}
|
667 |
|
668 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
669 |
|
670 | static constexpr ObjHeader obj_header() {
|
671 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::CommandSub), 0);
|
672 | }
|
673 |
|
674 |
|
675 | DISALLOW_COPY_AND_ASSIGN(trace__CommandSub)
|
676 | };
|
677 |
|
678 | class trace__ForkWait : public trace_t {
|
679 | public:
|
680 | trace__ForkWait() {}
|
681 |
|
682 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
683 |
|
684 | static constexpr ObjHeader obj_header() {
|
685 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::ForkWait), 0);
|
686 | }
|
687 |
|
688 |
|
689 | DISALLOW_COPY_AND_ASSIGN(trace__ForkWait)
|
690 | };
|
691 |
|
692 | class trace__Fork : public trace_t {
|
693 | public:
|
694 | trace__Fork() {}
|
695 |
|
696 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
697 |
|
698 | static constexpr ObjHeader obj_header() {
|
699 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::Fork), 0);
|
700 | }
|
701 |
|
702 |
|
703 | DISALLOW_COPY_AND_ASSIGN(trace__Fork)
|
704 | };
|
705 |
|
706 | class trace__PipelinePart : public trace_t {
|
707 | public:
|
708 | trace__PipelinePart() {}
|
709 |
|
710 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
711 |
|
712 | static constexpr ObjHeader obj_header() {
|
713 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::PipelinePart),
|
714 | 0);
|
715 | }
|
716 |
|
717 |
|
718 | DISALLOW_COPY_AND_ASSIGN(trace__PipelinePart)
|
719 | };
|
720 |
|
721 | class trace__ProcessSub : public trace_t {
|
722 | public:
|
723 | trace__ProcessSub() {}
|
724 |
|
725 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
726 |
|
727 | static constexpr ObjHeader obj_header() {
|
728 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::ProcessSub), 0);
|
729 | }
|
730 |
|
731 |
|
732 | DISALLOW_COPY_AND_ASSIGN(trace__ProcessSub)
|
733 | };
|
734 |
|
735 | class trace__HereDoc : public trace_t {
|
736 | public:
|
737 | trace__HereDoc() {}
|
738 |
|
739 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
740 |
|
741 | static constexpr ObjHeader obj_header() {
|
742 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::HereDoc), 0);
|
743 | }
|
744 |
|
745 |
|
746 | DISALLOW_COPY_AND_ASSIGN(trace__HereDoc)
|
747 | };
|
748 |
|
749 | extern GcGlobal<trace__CommandSub> gtrace__CommandSub;
|
750 | extern GcGlobal<trace__ForkWait> gtrace__ForkWait;
|
751 | extern GcGlobal<trace__Fork> gtrace__Fork;
|
752 | extern GcGlobal<trace__PipelinePart> gtrace__PipelinePart;
|
753 | extern GcGlobal<trace__ProcessSub> gtrace__ProcessSub;
|
754 | extern GcGlobal<trace__HereDoc> gtrace__HereDoc;
|
755 | ASDL_NAMES trace {
|
756 | typedef trace__External External;
|
757 | static trace__CommandSub* CommandSub;
|
758 | static trace__ForkWait* ForkWait;
|
759 | static trace__Fork* Fork;
|
760 | static trace__PipelinePart* PipelinePart;
|
761 | static trace__ProcessSub* ProcessSub;
|
762 | static trace__HereDoc* HereDoc;
|
763 | };
|
764 |
|
765 | enum class word_style_e {
|
766 | Expr = 1,
|
767 | Unquoted = 2,
|
768 | DQ = 3,
|
769 | SQ = 4,
|
770 | };
|
771 | typedef word_style_e word_style_t;
|
772 |
|
773 | BigStr* word_style_str(word_style_e tag, bool dot = true);
|
774 |
|
775 | enum class comp_action_e {
|
776 | Other = 1,
|
777 | FileSystem = 2,
|
778 | BashFunc = 3,
|
779 | };
|
780 | typedef comp_action_e comp_action_t;
|
781 |
|
782 | BigStr* comp_action_str(comp_action_e tag, bool dot = true);
|
783 |
|
784 | class AssignArg {
|
785 | public:
|
786 | AssignArg(BigStr* var_name, value_asdl::value_t* rval, bool plus_eq,
|
787 | syntax_asdl::CompoundWord* blame_word)
|
788 | : var_name(var_name),
|
789 | rval(rval),
|
790 | blame_word(blame_word),
|
791 | plus_eq(plus_eq) {
|
792 | }
|
793 |
|
794 | static AssignArg* CreateNull(bool alloc_lists = false) {
|
795 | return Alloc<AssignArg>(kEmptyString, nullptr, false, nullptr);
|
796 | }
|
797 |
|
798 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
799 |
|
800 | static constexpr ObjHeader obj_header() {
|
801 | return ObjHeader::AsdlClass(64, 3);
|
802 | }
|
803 |
|
804 | BigStr* var_name;
|
805 | value_asdl::value_t* rval;
|
806 | syntax_asdl::CompoundWord* blame_word;
|
807 | bool plus_eq;
|
808 |
|
809 | DISALLOW_COPY_AND_ASSIGN(AssignArg)
|
810 | };
|
811 |
|
812 | class ProcArgs {
|
813 | public:
|
814 | ProcArgs(syntax_asdl::ArgList* typed_args, List<value_asdl::value_t*>*
|
815 | pos_args, Dict<BigStr*, value_asdl::value_t*>* named_args,
|
816 | value_asdl::value_t* block_arg)
|
817 | : typed_args(typed_args),
|
818 | pos_args(pos_args),
|
819 | named_args(named_args),
|
820 | block_arg(block_arg) {
|
821 | }
|
822 |
|
823 | static ProcArgs* CreateNull(bool alloc_lists = false) {
|
824 | return Alloc<ProcArgs>(nullptr, nullptr, nullptr, nullptr);
|
825 | }
|
826 |
|
827 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
828 |
|
829 | static constexpr ObjHeader obj_header() {
|
830 | return ObjHeader::AsdlClass(65, 4);
|
831 | }
|
832 |
|
833 | syntax_asdl::ArgList* typed_args;
|
834 | List<value_asdl::value_t*>* pos_args;
|
835 | Dict<BigStr*, value_asdl::value_t*>* named_args;
|
836 | value_asdl::value_t* block_arg;
|
837 |
|
838 | DISALLOW_COPY_AND_ASSIGN(ProcArgs)
|
839 | };
|
840 |
|
841 | class Piece : public part_value_t {
|
842 | public:
|
843 | Piece(BigStr* s, bool quoted, bool do_split)
|
844 | : s(s),
|
845 | quoted(quoted),
|
846 | do_split(do_split) {
|
847 | }
|
848 |
|
849 | static Piece* CreateNull(bool alloc_lists = false) {
|
850 | return Alloc<Piece>(kEmptyString, false, false);
|
851 | }
|
852 |
|
853 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
854 |
|
855 | static constexpr ObjHeader obj_header() {
|
856 | return ObjHeader::AsdlClass(66, 1);
|
857 | }
|
858 |
|
859 | BigStr* s;
|
860 | bool quoted;
|
861 | bool do_split;
|
862 |
|
863 | DISALLOW_COPY_AND_ASSIGN(Piece)
|
864 | };
|
865 |
|
866 | class VarSubState {
|
867 | public:
|
868 | VarSubState(bool join_array, value_asdl::value_t* h_value,
|
869 | syntax_asdl::Token* array_ref)
|
870 | : h_value(h_value),
|
871 | array_ref(array_ref),
|
872 | join_array(join_array) {
|
873 | }
|
874 |
|
875 | static VarSubState* CreateNull(bool alloc_lists = false) {
|
876 | return Alloc<VarSubState>(false, nullptr, nullptr);
|
877 | }
|
878 |
|
879 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
880 |
|
881 | static constexpr ObjHeader obj_header() {
|
882 | return ObjHeader::AsdlClass(67, 2);
|
883 | }
|
884 |
|
885 | value_asdl::value_t* h_value;
|
886 | syntax_asdl::Token* array_ref;
|
887 | bool join_array;
|
888 |
|
889 | DISALLOW_COPY_AND_ASSIGN(VarSubState)
|
890 | };
|
891 |
|
892 | class Cell {
|
893 | public:
|
894 | Cell(bool exported, bool readonly, bool nameref, value_asdl::value_t* val)
|
895 | : val(val),
|
896 | exported(exported),
|
897 | readonly(readonly),
|
898 | nameref(nameref) {
|
899 | }
|
900 |
|
901 | static Cell* CreateNull(bool alloc_lists = false) {
|
902 | return Alloc<Cell>(false, false, false, nullptr);
|
903 | }
|
904 |
|
905 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
906 |
|
907 | static constexpr ObjHeader obj_header() {
|
908 | return ObjHeader::AsdlClass(68, 1);
|
909 | }
|
910 |
|
911 | value_asdl::value_t* val;
|
912 | bool exported;
|
913 | bool readonly;
|
914 | bool nameref;
|
915 |
|
916 | DISALLOW_COPY_AND_ASSIGN(Cell)
|
917 | };
|
918 |
|
919 | class VTestPlace {
|
920 | public:
|
921 | VTestPlace(BigStr* name, a_index_t* index)
|
922 | : name(name),
|
923 | index(index) {
|
924 | }
|
925 |
|
926 | static VTestPlace* CreateNull(bool alloc_lists = false) {
|
927 | return Alloc<VTestPlace>(nullptr, nullptr);
|
928 | }
|
929 |
|
930 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
931 |
|
932 | static constexpr ObjHeader obj_header() {
|
933 | return ObjHeader::AsdlClass(69, 2);
|
934 | }
|
935 |
|
936 | BigStr* name;
|
937 | a_index_t* index;
|
938 |
|
939 | DISALLOW_COPY_AND_ASSIGN(VTestPlace)
|
940 | };
|
941 |
|
942 | class RedirValue {
|
943 | public:
|
944 | RedirValue(Id_t op_id, syntax_asdl::loc_t* op_loc, syntax_asdl::redir_loc_t*
|
945 | loc, redirect_arg_t* arg)
|
946 | : op_loc(op_loc),
|
947 | loc(loc),
|
948 | arg(arg),
|
949 | op_id(op_id) {
|
950 | }
|
951 |
|
952 | static RedirValue* CreateNull(bool alloc_lists = false) {
|
953 | return Alloc<RedirValue>(-1, nullptr, nullptr, nullptr);
|
954 | }
|
955 |
|
956 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
957 |
|
958 | static constexpr ObjHeader obj_header() {
|
959 | return ObjHeader::AsdlClass(70, 3);
|
960 | }
|
961 |
|
962 | syntax_asdl::loc_t* op_loc;
|
963 | syntax_asdl::redir_loc_t* loc;
|
964 | redirect_arg_t* arg;
|
965 | Id_t op_id;
|
966 |
|
967 | DISALLOW_COPY_AND_ASSIGN(RedirValue)
|
968 | };
|
969 |
|
970 | class StatusArray {
|
971 | public:
|
972 | StatusArray(List<int>* codes, List<syntax_asdl::loc_t*>* locs)
|
973 | : codes(codes),
|
974 | locs(locs) {
|
975 | }
|
976 |
|
977 | static StatusArray* CreateNull(bool alloc_lists = false) {
|
978 | return Alloc<StatusArray>(nullptr, nullptr);
|
979 | }
|
980 |
|
981 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
982 |
|
983 | static constexpr ObjHeader obj_header() {
|
984 | return ObjHeader::AsdlClass(71, 2);
|
985 | }
|
986 |
|
987 | List<int>* codes;
|
988 | List<syntax_asdl::loc_t*>* locs;
|
989 |
|
990 | DISALLOW_COPY_AND_ASSIGN(StatusArray)
|
991 | };
|
992 |
|
993 | class CommandStatus {
|
994 | public:
|
995 | CommandStatus(bool check_errexit, bool show_code, bool pipe_negated,
|
996 | List<int>* pipe_status, List<syntax_asdl::loc_t*>* pipe_locs)
|
997 | : pipe_status(pipe_status),
|
998 | pipe_locs(pipe_locs),
|
999 | check_errexit(check_errexit),
|
1000 | show_code(show_code),
|
1001 | pipe_negated(pipe_negated) {
|
1002 | }
|
1003 |
|
1004 | static CommandStatus* CreateNull(bool alloc_lists = false) {
|
1005 | return Alloc<CommandStatus>(false, false, false, nullptr, nullptr);
|
1006 | }
|
1007 |
|
1008 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
1009 |
|
1010 | static constexpr ObjHeader obj_header() {
|
1011 | return ObjHeader::AsdlClass(72, 2);
|
1012 | }
|
1013 |
|
1014 | List<int>* pipe_status;
|
1015 | List<syntax_asdl::loc_t*>* pipe_locs;
|
1016 | bool check_errexit;
|
1017 | bool show_code;
|
1018 | bool pipe_negated;
|
1019 |
|
1020 | DISALLOW_COPY_AND_ASSIGN(CommandStatus)
|
1021 | };
|
1022 |
|
1023 | class HayNode {
|
1024 | public:
|
1025 | HayNode(Dict<BigStr*, HayNode*>* children)
|
1026 | : children(children) {
|
1027 | }
|
1028 |
|
1029 | static HayNode* CreateNull(bool alloc_lists = false) {
|
1030 | return Alloc<HayNode>(nullptr);
|
1031 | }
|
1032 |
|
1033 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
1034 |
|
1035 | static constexpr ObjHeader obj_header() {
|
1036 | return ObjHeader::AsdlClass(73, 1);
|
1037 | }
|
1038 |
|
1039 | Dict<BigStr*, HayNode*>* children;
|
1040 |
|
1041 | DISALLOW_COPY_AND_ASSIGN(HayNode)
|
1042 | };
|
1043 |
|
1044 |
|
1045 | } // namespace runtime_asdl
|
1046 |
|
1047 | #endif // RUNTIME_ASDL
|