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