| 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 | enum class job_state_e {
|
| 430 | Running = 1,
|
| 431 | Exited = 2,
|
| 432 | Stopped = 3,
|
| 433 | };
|
| 434 | typedef job_state_e job_state_t;
|
| 435 |
|
| 436 | BigStr* job_state_str(job_state_e tag, bool dot = true);
|
| 437 |
|
| 438 | ASDL_NAMES wait_status_e {
|
| 439 | enum no_name {
|
| 440 | Proc = 1,
|
| 441 | Pipeline = 2,
|
| 442 | Cancelled = 3,
|
| 443 | };
|
| 444 | };
|
| 445 |
|
| 446 | BigStr* wait_status_str(int tag, bool dot = true);
|
| 447 |
|
| 448 | class wait_status_t {
|
| 449 | protected:
|
| 450 | wait_status_t() {
|
| 451 | }
|
| 452 | public:
|
| 453 | int tag() const {
|
| 454 | return ObjHeader::FromObject(this)->type_tag;
|
| 455 | }
|
| 456 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 457 | DISALLOW_COPY_AND_ASSIGN(wait_status_t)
|
| 458 | };
|
| 459 |
|
| 460 | class wait_status__Proc : public wait_status_t {
|
| 461 | public:
|
| 462 | wait_status__Proc(job_state_t state, int code)
|
| 463 | : state(state),
|
| 464 | code(code) {
|
| 465 | }
|
| 466 |
|
| 467 | static wait_status__Proc* CreateNull(bool alloc_lists = false) {
|
| 468 | return Alloc<wait_status__Proc>(job_state_e::Running, -1);
|
| 469 | }
|
| 470 |
|
| 471 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 472 |
|
| 473 | static constexpr ObjHeader obj_header() {
|
| 474 | return ObjHeader::AsdlClass(static_cast<uint16_t>(wait_status_e::Proc), 0);
|
| 475 | }
|
| 476 |
|
| 477 | job_state_t state;
|
| 478 | int code;
|
| 479 |
|
| 480 | DISALLOW_COPY_AND_ASSIGN(wait_status__Proc)
|
| 481 | };
|
| 482 |
|
| 483 | class wait_status__Pipeline : public wait_status_t {
|
| 484 | public:
|
| 485 | wait_status__Pipeline(job_state_t state, List<int>* codes)
|
| 486 | : codes(codes),
|
| 487 | state(state) {
|
| 488 | }
|
| 489 |
|
| 490 | static wait_status__Pipeline* CreateNull(bool alloc_lists = false) {
|
| 491 | return Alloc<wait_status__Pipeline>(job_state_e::Running, alloc_lists ?
|
| 492 | Alloc<List<int>>() : nullptr);
|
| 493 | }
|
| 494 |
|
| 495 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 496 |
|
| 497 | static constexpr ObjHeader obj_header() {
|
| 498 | return ObjHeader::AsdlClass(static_cast<uint16_t>(wait_status_e::Pipeline),
|
| 499 | 1);
|
| 500 | }
|
| 501 |
|
| 502 | List<int>* codes;
|
| 503 | job_state_t state;
|
| 504 |
|
| 505 | DISALLOW_COPY_AND_ASSIGN(wait_status__Pipeline)
|
| 506 | };
|
| 507 |
|
| 508 | class wait_status__Cancelled : public wait_status_t {
|
| 509 | public:
|
| 510 | wait_status__Cancelled(int sig_num)
|
| 511 | : sig_num(sig_num) {
|
| 512 | }
|
| 513 |
|
| 514 | static wait_status__Cancelled* CreateNull(bool alloc_lists = false) {
|
| 515 | return Alloc<wait_status__Cancelled>(-1);
|
| 516 | }
|
| 517 |
|
| 518 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 519 |
|
| 520 | static constexpr ObjHeader obj_header() {
|
| 521 | return
|
| 522 | ObjHeader::AsdlClass(static_cast<uint16_t>(wait_status_e::Cancelled), 0);
|
| 523 | }
|
| 524 |
|
| 525 | int sig_num;
|
| 526 |
|
| 527 | DISALLOW_COPY_AND_ASSIGN(wait_status__Cancelled)
|
| 528 | };
|
| 529 |
|
| 530 | ASDL_NAMES wait_status {
|
| 531 | typedef wait_status__Proc Proc;
|
| 532 | typedef wait_status__Pipeline Pipeline;
|
| 533 | typedef wait_status__Cancelled Cancelled;
|
| 534 | };
|
| 535 |
|
| 536 | enum class flow_e {
|
| 537 | Nothing = 1,
|
| 538 | Break = 2,
|
| 539 | Raise = 3,
|
| 540 | };
|
| 541 | typedef flow_e flow_t;
|
| 542 |
|
| 543 | BigStr* flow_str(flow_e tag, bool dot = true);
|
| 544 |
|
| 545 | enum class span_e {
|
| 546 | Black = 1,
|
| 547 | Delim = 2,
|
| 548 | Backslash = 3,
|
| 549 | };
|
| 550 | typedef span_e span_t;
|
| 551 |
|
| 552 | BigStr* span_str(span_e tag, bool dot = true);
|
| 553 |
|
| 554 | ASDL_NAMES emit_i {
|
| 555 | enum no_name {
|
| 556 | Part = 1,
|
| 557 | Delim = 2,
|
| 558 | Empty = 3,
|
| 559 | Escape = 4,
|
| 560 | Nothing = 5,
|
| 561 | ARRAY_SIZE = 6,
|
| 562 | };
|
| 563 | };
|
| 564 |
|
| 565 | BigStr* emit_str(int tag, bool dot = true);
|
| 566 |
|
| 567 | typedef int emit_t;
|
| 568 |
|
| 569 | ASDL_NAMES state_i {
|
| 570 | enum no_name {
|
| 571 | Invalid = 1,
|
| 572 | Start = 2,
|
| 573 | DE_White1 = 3,
|
| 574 | DE_Gray = 4,
|
| 575 | DE_White2 = 5,
|
| 576 | Black = 6,
|
| 577 | Backslash = 7,
|
| 578 | Done = 8,
|
| 579 | ARRAY_SIZE = 9,
|
| 580 | };
|
| 581 | };
|
| 582 |
|
| 583 | BigStr* state_str(int tag, bool dot = true);
|
| 584 |
|
| 585 | typedef int state_t;
|
| 586 |
|
| 587 | ASDL_NAMES char_kind_i {
|
| 588 | enum no_name {
|
| 589 | DE_White = 1,
|
| 590 | DE_Gray = 2,
|
| 591 | Black = 3,
|
| 592 | Backslash = 4,
|
| 593 | Sentinel = 5,
|
| 594 | ARRAY_SIZE = 6,
|
| 595 | };
|
| 596 | };
|
| 597 |
|
| 598 | BigStr* char_kind_str(int tag, bool dot = true);
|
| 599 |
|
| 600 | typedef int char_kind_t;
|
| 601 |
|
| 602 | enum class error_code_e {
|
| 603 | OK = 1,
|
| 604 | IndexOutOfRange = 2,
|
| 605 | };
|
| 606 | typedef error_code_e error_code_t;
|
| 607 |
|
| 608 | BigStr* error_code_str(error_code_e tag, bool dot = true);
|
| 609 |
|
| 610 | enum class flag_type_e {
|
| 611 | Bool = 1,
|
| 612 | Int = 2,
|
| 613 | Float = 3,
|
| 614 | Str = 4,
|
| 615 | };
|
| 616 | typedef flag_type_e flag_type_t;
|
| 617 |
|
| 618 | BigStr* flag_type_str(flag_type_e tag, bool dot = true);
|
| 619 |
|
| 620 | ASDL_NAMES trace_e {
|
| 621 | enum no_name {
|
| 622 | External = 1,
|
| 623 | CommandSub = 2,
|
| 624 | ForkWait = 3,
|
| 625 | Fork = 4,
|
| 626 | PipelinePart = 5,
|
| 627 | ProcessSub = 6,
|
| 628 | HereDoc = 7,
|
| 629 | };
|
| 630 | };
|
| 631 |
|
| 632 | BigStr* trace_str(int tag, bool dot = true);
|
| 633 |
|
| 634 | class trace_t {
|
| 635 | protected:
|
| 636 | trace_t() {
|
| 637 | }
|
| 638 | public:
|
| 639 | int tag() const {
|
| 640 | return ObjHeader::FromObject(this)->type_tag;
|
| 641 | }
|
| 642 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 643 | DISALLOW_COPY_AND_ASSIGN(trace_t)
|
| 644 | };
|
| 645 |
|
| 646 | class trace__External : public trace_t {
|
| 647 | public:
|
| 648 | trace__External(List<BigStr*>* argv)
|
| 649 | : argv(argv) {
|
| 650 | }
|
| 651 |
|
| 652 | static trace__External* CreateNull(bool alloc_lists = false) {
|
| 653 | return Alloc<trace__External>(alloc_lists ? Alloc<List<BigStr*>>() :
|
| 654 | nullptr);
|
| 655 | }
|
| 656 |
|
| 657 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 658 |
|
| 659 | static constexpr ObjHeader obj_header() {
|
| 660 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::External), 1);
|
| 661 | }
|
| 662 |
|
| 663 | List<BigStr*>* argv;
|
| 664 |
|
| 665 | DISALLOW_COPY_AND_ASSIGN(trace__External)
|
| 666 | };
|
| 667 |
|
| 668 | class trace__CommandSub : public trace_t {
|
| 669 | public:
|
| 670 | trace__CommandSub() {}
|
| 671 |
|
| 672 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 673 |
|
| 674 | static constexpr ObjHeader obj_header() {
|
| 675 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::CommandSub), 0);
|
| 676 | }
|
| 677 |
|
| 678 |
|
| 679 | DISALLOW_COPY_AND_ASSIGN(trace__CommandSub)
|
| 680 | };
|
| 681 |
|
| 682 | class trace__ForkWait : public trace_t {
|
| 683 | public:
|
| 684 | trace__ForkWait() {}
|
| 685 |
|
| 686 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 687 |
|
| 688 | static constexpr ObjHeader obj_header() {
|
| 689 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::ForkWait), 0);
|
| 690 | }
|
| 691 |
|
| 692 |
|
| 693 | DISALLOW_COPY_AND_ASSIGN(trace__ForkWait)
|
| 694 | };
|
| 695 |
|
| 696 | class trace__Fork : public trace_t {
|
| 697 | public:
|
| 698 | trace__Fork() {}
|
| 699 |
|
| 700 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 701 |
|
| 702 | static constexpr ObjHeader obj_header() {
|
| 703 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::Fork), 0);
|
| 704 | }
|
| 705 |
|
| 706 |
|
| 707 | DISALLOW_COPY_AND_ASSIGN(trace__Fork)
|
| 708 | };
|
| 709 |
|
| 710 | class trace__PipelinePart : public trace_t {
|
| 711 | public:
|
| 712 | trace__PipelinePart() {}
|
| 713 |
|
| 714 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 715 |
|
| 716 | static constexpr ObjHeader obj_header() {
|
| 717 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::PipelinePart),
|
| 718 | 0);
|
| 719 | }
|
| 720 |
|
| 721 |
|
| 722 | DISALLOW_COPY_AND_ASSIGN(trace__PipelinePart)
|
| 723 | };
|
| 724 |
|
| 725 | class trace__ProcessSub : public trace_t {
|
| 726 | public:
|
| 727 | trace__ProcessSub() {}
|
| 728 |
|
| 729 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 730 |
|
| 731 | static constexpr ObjHeader obj_header() {
|
| 732 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::ProcessSub), 0);
|
| 733 | }
|
| 734 |
|
| 735 |
|
| 736 | DISALLOW_COPY_AND_ASSIGN(trace__ProcessSub)
|
| 737 | };
|
| 738 |
|
| 739 | class trace__HereDoc : public trace_t {
|
| 740 | public:
|
| 741 | trace__HereDoc() {}
|
| 742 |
|
| 743 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 744 |
|
| 745 | static constexpr ObjHeader obj_header() {
|
| 746 | return ObjHeader::AsdlClass(static_cast<uint16_t>(trace_e::HereDoc), 0);
|
| 747 | }
|
| 748 |
|
| 749 |
|
| 750 | DISALLOW_COPY_AND_ASSIGN(trace__HereDoc)
|
| 751 | };
|
| 752 |
|
| 753 | extern GcGlobal<trace__CommandSub> gtrace__CommandSub;
|
| 754 | extern GcGlobal<trace__ForkWait> gtrace__ForkWait;
|
| 755 | extern GcGlobal<trace__Fork> gtrace__Fork;
|
| 756 | extern GcGlobal<trace__PipelinePart> gtrace__PipelinePart;
|
| 757 | extern GcGlobal<trace__ProcessSub> gtrace__ProcessSub;
|
| 758 | extern GcGlobal<trace__HereDoc> gtrace__HereDoc;
|
| 759 | ASDL_NAMES trace {
|
| 760 | typedef trace__External External;
|
| 761 | static trace__CommandSub* CommandSub;
|
| 762 | static trace__ForkWait* ForkWait;
|
| 763 | static trace__Fork* Fork;
|
| 764 | static trace__PipelinePart* PipelinePart;
|
| 765 | static trace__ProcessSub* ProcessSub;
|
| 766 | static trace__HereDoc* HereDoc;
|
| 767 | };
|
| 768 |
|
| 769 | enum class word_style_e {
|
| 770 | Expr = 1,
|
| 771 | Unquoted = 2,
|
| 772 | DQ = 3,
|
| 773 | SQ = 4,
|
| 774 | };
|
| 775 | typedef word_style_e word_style_t;
|
| 776 |
|
| 777 | BigStr* word_style_str(word_style_e tag, bool dot = true);
|
| 778 |
|
| 779 | enum class comp_action_e {
|
| 780 | Other = 1,
|
| 781 | FileSystem = 2,
|
| 782 | BashFunc = 3,
|
| 783 | };
|
| 784 | typedef comp_action_e comp_action_t;
|
| 785 |
|
| 786 | BigStr* comp_action_str(comp_action_e tag, bool dot = true);
|
| 787 |
|
| 788 | class AssignArg {
|
| 789 | public:
|
| 790 | AssignArg(BigStr* var_name, value_asdl::value_t* rval, bool plus_eq,
|
| 791 | syntax_asdl::CompoundWord* blame_word)
|
| 792 | : var_name(var_name),
|
| 793 | rval(rval),
|
| 794 | blame_word(blame_word),
|
| 795 | plus_eq(plus_eq) {
|
| 796 | }
|
| 797 |
|
| 798 | static AssignArg* CreateNull(bool alloc_lists = false) {
|
| 799 | return Alloc<AssignArg>(kEmptyString, nullptr, false, nullptr);
|
| 800 | }
|
| 801 |
|
| 802 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 803 |
|
| 804 | static constexpr ObjHeader obj_header() {
|
| 805 | return ObjHeader::AsdlClass(64, 3);
|
| 806 | }
|
| 807 |
|
| 808 | BigStr* var_name;
|
| 809 | value_asdl::value_t* rval;
|
| 810 | syntax_asdl::CompoundWord* blame_word;
|
| 811 | bool plus_eq;
|
| 812 |
|
| 813 | DISALLOW_COPY_AND_ASSIGN(AssignArg)
|
| 814 | };
|
| 815 |
|
| 816 | class ProcArgs {
|
| 817 | public:
|
| 818 | ProcArgs(syntax_asdl::ArgList* typed_args, List<value_asdl::value_t*>*
|
| 819 | pos_args, Dict<BigStr*, value_asdl::value_t*>* named_args,
|
| 820 | value_asdl::value_t* block_arg)
|
| 821 | : typed_args(typed_args),
|
| 822 | pos_args(pos_args),
|
| 823 | named_args(named_args),
|
| 824 | block_arg(block_arg) {
|
| 825 | }
|
| 826 |
|
| 827 | static ProcArgs* CreateNull(bool alloc_lists = false) {
|
| 828 | return Alloc<ProcArgs>(nullptr, nullptr, nullptr, nullptr);
|
| 829 | }
|
| 830 |
|
| 831 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 832 |
|
| 833 | static constexpr ObjHeader obj_header() {
|
| 834 | return ObjHeader::AsdlClass(65, 4);
|
| 835 | }
|
| 836 |
|
| 837 | syntax_asdl::ArgList* typed_args;
|
| 838 | List<value_asdl::value_t*>* pos_args;
|
| 839 | Dict<BigStr*, value_asdl::value_t*>* named_args;
|
| 840 | value_asdl::value_t* block_arg;
|
| 841 |
|
| 842 | DISALLOW_COPY_AND_ASSIGN(ProcArgs)
|
| 843 | };
|
| 844 |
|
| 845 | class Piece : public part_value_t {
|
| 846 | public:
|
| 847 | Piece(BigStr* s, bool quoted, bool do_split)
|
| 848 | : s(s),
|
| 849 | quoted(quoted),
|
| 850 | do_split(do_split) {
|
| 851 | }
|
| 852 |
|
| 853 | static Piece* CreateNull(bool alloc_lists = false) {
|
| 854 | return Alloc<Piece>(kEmptyString, false, false);
|
| 855 | }
|
| 856 |
|
| 857 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 858 |
|
| 859 | static constexpr ObjHeader obj_header() {
|
| 860 | return ObjHeader::AsdlClass(66, 1);
|
| 861 | }
|
| 862 |
|
| 863 | BigStr* s;
|
| 864 | bool quoted;
|
| 865 | bool do_split;
|
| 866 |
|
| 867 | DISALLOW_COPY_AND_ASSIGN(Piece)
|
| 868 | };
|
| 869 |
|
| 870 | class VarSubState {
|
| 871 | public:
|
| 872 | VarSubState(bool join_array, value_asdl::value_t* h_value,
|
| 873 | syntax_asdl::Token* array_ref)
|
| 874 | : h_value(h_value),
|
| 875 | array_ref(array_ref),
|
| 876 | join_array(join_array) {
|
| 877 | }
|
| 878 |
|
| 879 | static VarSubState* CreateNull(bool alloc_lists = false) {
|
| 880 | return Alloc<VarSubState>(false, nullptr, nullptr);
|
| 881 | }
|
| 882 |
|
| 883 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 884 |
|
| 885 | static constexpr ObjHeader obj_header() {
|
| 886 | return ObjHeader::AsdlClass(67, 2);
|
| 887 | }
|
| 888 |
|
| 889 | value_asdl::value_t* h_value;
|
| 890 | syntax_asdl::Token* array_ref;
|
| 891 | bool join_array;
|
| 892 |
|
| 893 | DISALLOW_COPY_AND_ASSIGN(VarSubState)
|
| 894 | };
|
| 895 |
|
| 896 | class Cell {
|
| 897 | public:
|
| 898 | Cell(bool exported, bool readonly, bool nameref, value_asdl::value_t* val)
|
| 899 | : val(val),
|
| 900 | exported(exported),
|
| 901 | readonly(readonly),
|
| 902 | nameref(nameref) {
|
| 903 | }
|
| 904 |
|
| 905 | static Cell* CreateNull(bool alloc_lists = false) {
|
| 906 | return Alloc<Cell>(false, false, false, nullptr);
|
| 907 | }
|
| 908 |
|
| 909 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 910 |
|
| 911 | static constexpr ObjHeader obj_header() {
|
| 912 | return ObjHeader::AsdlClass(68, 1);
|
| 913 | }
|
| 914 |
|
| 915 | value_asdl::value_t* val;
|
| 916 | bool exported;
|
| 917 | bool readonly;
|
| 918 | bool nameref;
|
| 919 |
|
| 920 | DISALLOW_COPY_AND_ASSIGN(Cell)
|
| 921 | };
|
| 922 |
|
| 923 | class VTestPlace {
|
| 924 | public:
|
| 925 | VTestPlace(BigStr* name, a_index_t* index)
|
| 926 | : name(name),
|
| 927 | index(index) {
|
| 928 | }
|
| 929 |
|
| 930 | static VTestPlace* CreateNull(bool alloc_lists = false) {
|
| 931 | return Alloc<VTestPlace>(nullptr, nullptr);
|
| 932 | }
|
| 933 |
|
| 934 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 935 |
|
| 936 | static constexpr ObjHeader obj_header() {
|
| 937 | return ObjHeader::AsdlClass(69, 2);
|
| 938 | }
|
| 939 |
|
| 940 | BigStr* name;
|
| 941 | a_index_t* index;
|
| 942 |
|
| 943 | DISALLOW_COPY_AND_ASSIGN(VTestPlace)
|
| 944 | };
|
| 945 |
|
| 946 | class RedirValue {
|
| 947 | public:
|
| 948 | RedirValue(Id_t op_id, syntax_asdl::loc_t* op_loc, syntax_asdl::redir_loc_t*
|
| 949 | loc, redirect_arg_t* arg)
|
| 950 | : op_loc(op_loc),
|
| 951 | loc(loc),
|
| 952 | arg(arg),
|
| 953 | op_id(op_id) {
|
| 954 | }
|
| 955 |
|
| 956 | static RedirValue* CreateNull(bool alloc_lists = false) {
|
| 957 | return Alloc<RedirValue>(-1, nullptr, nullptr, nullptr);
|
| 958 | }
|
| 959 |
|
| 960 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 961 |
|
| 962 | static constexpr ObjHeader obj_header() {
|
| 963 | return ObjHeader::AsdlClass(70, 3);
|
| 964 | }
|
| 965 |
|
| 966 | syntax_asdl::loc_t* op_loc;
|
| 967 | syntax_asdl::redir_loc_t* loc;
|
| 968 | redirect_arg_t* arg;
|
| 969 | Id_t op_id;
|
| 970 |
|
| 971 | DISALLOW_COPY_AND_ASSIGN(RedirValue)
|
| 972 | };
|
| 973 |
|
| 974 | class StatusArray {
|
| 975 | public:
|
| 976 | StatusArray(List<int>* codes, List<syntax_asdl::loc_t*>* locs)
|
| 977 | : codes(codes),
|
| 978 | locs(locs) {
|
| 979 | }
|
| 980 |
|
| 981 | static StatusArray* CreateNull(bool alloc_lists = false) {
|
| 982 | return Alloc<StatusArray>(nullptr, nullptr);
|
| 983 | }
|
| 984 |
|
| 985 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 986 |
|
| 987 | static constexpr ObjHeader obj_header() {
|
| 988 | return ObjHeader::AsdlClass(71, 2);
|
| 989 | }
|
| 990 |
|
| 991 | List<int>* codes;
|
| 992 | List<syntax_asdl::loc_t*>* locs;
|
| 993 |
|
| 994 | DISALLOW_COPY_AND_ASSIGN(StatusArray)
|
| 995 | };
|
| 996 |
|
| 997 | class CommandStatus {
|
| 998 | public:
|
| 999 | CommandStatus(bool check_errexit, bool show_code, bool pipe_negated,
|
| 1000 | List<int>* pipe_status, List<syntax_asdl::loc_t*>* pipe_locs)
|
| 1001 | : pipe_status(pipe_status),
|
| 1002 | pipe_locs(pipe_locs),
|
| 1003 | check_errexit(check_errexit),
|
| 1004 | show_code(show_code),
|
| 1005 | pipe_negated(pipe_negated) {
|
| 1006 | }
|
| 1007 |
|
| 1008 | static CommandStatus* CreateNull(bool alloc_lists = false) {
|
| 1009 | return Alloc<CommandStatus>(false, false, false, nullptr, nullptr);
|
| 1010 | }
|
| 1011 |
|
| 1012 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1013 |
|
| 1014 | static constexpr ObjHeader obj_header() {
|
| 1015 | return ObjHeader::AsdlClass(72, 2);
|
| 1016 | }
|
| 1017 |
|
| 1018 | List<int>* pipe_status;
|
| 1019 | List<syntax_asdl::loc_t*>* pipe_locs;
|
| 1020 | bool check_errexit;
|
| 1021 | bool show_code;
|
| 1022 | bool pipe_negated;
|
| 1023 |
|
| 1024 | DISALLOW_COPY_AND_ASSIGN(CommandStatus)
|
| 1025 | };
|
| 1026 |
|
| 1027 | class HayNode {
|
| 1028 | public:
|
| 1029 | HayNode(Dict<BigStr*, HayNode*>* children)
|
| 1030 | : children(children) {
|
| 1031 | }
|
| 1032 |
|
| 1033 | static HayNode* CreateNull(bool alloc_lists = false) {
|
| 1034 | return Alloc<HayNode>(nullptr);
|
| 1035 | }
|
| 1036 |
|
| 1037 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1038 |
|
| 1039 | static constexpr ObjHeader obj_header() {
|
| 1040 | return ObjHeader::AsdlClass(73, 1);
|
| 1041 | }
|
| 1042 |
|
| 1043 | Dict<BigStr*, HayNode*>* children;
|
| 1044 |
|
| 1045 | DISALLOW_COPY_AND_ASSIGN(HayNode)
|
| 1046 | };
|
| 1047 |
|
| 1048 |
|
| 1049 | } // namespace runtime_asdl
|
| 1050 |
|
| 1051 | #endif // RUNTIME_ASDL
|