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