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