| 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)
|
| 157 | : strs(strs) {
|
| 158 | }
|
| 159 |
|
| 160 | static part_value__Array* CreateNull(bool alloc_lists = false) {
|
| 161 | return Alloc<part_value__Array>(alloc_lists ? Alloc<List<BigStr*>>() :
|
| 162 | nullptr);
|
| 163 | }
|
| 164 |
|
| 165 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 166 |
|
| 167 | static constexpr ObjHeader obj_header() {
|
| 168 | return ObjHeader::AsdlClass(static_cast<uint16_t>(part_value_e::Array), 1);
|
| 169 | }
|
| 170 |
|
| 171 | List<BigStr*>* strs;
|
| 172 |
|
| 173 | DISALLOW_COPY_AND_ASSIGN(part_value__Array)
|
| 174 | };
|
| 175 |
|
| 176 | class part_value__ExtGlob : public part_value_t {
|
| 177 | public:
|
| 178 | part_value__ExtGlob(List<part_value_t*>* part_vals)
|
| 179 | : part_vals(part_vals) {
|
| 180 | }
|
| 181 |
|
| 182 | static part_value__ExtGlob* CreateNull(bool alloc_lists = false) {
|
| 183 | return Alloc<part_value__ExtGlob>(alloc_lists ?
|
| 184 | Alloc<List<part_value_t*>>() : nullptr);
|
| 185 | }
|
| 186 |
|
| 187 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 188 |
|
| 189 | static constexpr ObjHeader obj_header() {
|
| 190 | return ObjHeader::AsdlClass(static_cast<uint16_t>(part_value_e::ExtGlob),
|
| 191 | 1);
|
| 192 | }
|
| 193 |
|
| 194 | List<part_value_t*>* part_vals;
|
| 195 |
|
| 196 | DISALLOW_COPY_AND_ASSIGN(part_value__ExtGlob)
|
| 197 | };
|
| 198 |
|
| 199 | ASDL_NAMES part_value {
|
| 200 | typedef part_value__Array Array;
|
| 201 | typedef part_value__ExtGlob ExtGlob;
|
| 202 | };
|
| 203 |
|
| 204 | enum class coerced_e {
|
| 205 | Int = 1,
|
| 206 | Float = 2,
|
| 207 | Neither = 3,
|
| 208 | };
|
| 209 | typedef coerced_e coerced_t;
|
| 210 |
|
| 211 | BigStr* coerced_str(coerced_e tag, bool dot = true);
|
| 212 |
|
| 213 | enum class scope_e {
|
| 214 | Shopt = 1,
|
| 215 | Dynamic = 2,
|
| 216 | LocalOrGlobal = 3,
|
| 217 | LocalOnly = 4,
|
| 218 | GlobalOnly = 5,
|
| 219 | };
|
| 220 | typedef scope_e scope_t;
|
| 221 |
|
| 222 | BigStr* scope_str(scope_e tag, bool dot = true);
|
| 223 |
|
| 224 | ASDL_NAMES a_index_e {
|
| 225 | enum no_name {
|
| 226 | Str = 1,
|
| 227 | Int = 2,
|
| 228 | };
|
| 229 | };
|
| 230 |
|
| 231 | BigStr* a_index_str(int tag, bool dot = true);
|
| 232 |
|
| 233 | class a_index_t {
|
| 234 | protected:
|
| 235 | a_index_t() {
|
| 236 | }
|
| 237 | public:
|
| 238 | int tag() const {
|
| 239 | return ObjHeader::FromObject(this)->type_tag;
|
| 240 | }
|
| 241 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 242 | DISALLOW_COPY_AND_ASSIGN(a_index_t)
|
| 243 | };
|
| 244 |
|
| 245 | class a_index__Str : public a_index_t {
|
| 246 | public:
|
| 247 | a_index__Str(BigStr* s)
|
| 248 | : s(s) {
|
| 249 | }
|
| 250 |
|
| 251 | static a_index__Str* CreateNull(bool alloc_lists = false) {
|
| 252 | return Alloc<a_index__Str>(kEmptyString);
|
| 253 | }
|
| 254 |
|
| 255 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 256 |
|
| 257 | static constexpr ObjHeader obj_header() {
|
| 258 | return ObjHeader::AsdlClass(static_cast<uint16_t>(a_index_e::Str), 1);
|
| 259 | }
|
| 260 |
|
| 261 | BigStr* s;
|
| 262 |
|
| 263 | DISALLOW_COPY_AND_ASSIGN(a_index__Str)
|
| 264 | };
|
| 265 |
|
| 266 | class a_index__Int : public a_index_t {
|
| 267 | public:
|
| 268 | a_index__Int(int i)
|
| 269 | : i(i) {
|
| 270 | }
|
| 271 |
|
| 272 | static a_index__Int* CreateNull(bool alloc_lists = false) {
|
| 273 | return Alloc<a_index__Int>(-1);
|
| 274 | }
|
| 275 |
|
| 276 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 277 |
|
| 278 | static constexpr ObjHeader obj_header() {
|
| 279 | return ObjHeader::AsdlClass(static_cast<uint16_t>(a_index_e::Int), 0);
|
| 280 | }
|
| 281 |
|
| 282 | int i;
|
| 283 |
|
| 284 | DISALLOW_COPY_AND_ASSIGN(a_index__Int)
|
| 285 | };
|
| 286 |
|
| 287 | ASDL_NAMES a_index {
|
| 288 | typedef a_index__Str Str;
|
| 289 | typedef a_index__Int Int;
|
| 290 | };
|
| 291 |
|
| 292 | ASDL_NAMES redirect_arg_e {
|
| 293 | enum no_name {
|
| 294 | Path = 1,
|
| 295 | CopyFd = 2,
|
| 296 | MoveFd = 3,
|
| 297 | CloseFd = 4,
|
| 298 | HereDoc = 5,
|
| 299 | };
|
| 300 | };
|
| 301 |
|
| 302 | BigStr* redirect_arg_str(int tag, bool dot = true);
|
| 303 |
|
| 304 | class redirect_arg_t {
|
| 305 | protected:
|
| 306 | redirect_arg_t() {
|
| 307 | }
|
| 308 | public:
|
| 309 | int tag() const {
|
| 310 | return ObjHeader::FromObject(this)->type_tag;
|
| 311 | }
|
| 312 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 313 | DISALLOW_COPY_AND_ASSIGN(redirect_arg_t)
|
| 314 | };
|
| 315 |
|
| 316 | class redirect_arg__Path : public redirect_arg_t {
|
| 317 | public:
|
| 318 | redirect_arg__Path(BigStr* filename)
|
| 319 | : filename(filename) {
|
| 320 | }
|
| 321 |
|
| 322 | static redirect_arg__Path* CreateNull(bool alloc_lists = false) {
|
| 323 | return Alloc<redirect_arg__Path>(kEmptyString);
|
| 324 | }
|
| 325 |
|
| 326 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 327 |
|
| 328 | static constexpr ObjHeader obj_header() {
|
| 329 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::Path), 1);
|
| 330 | }
|
| 331 |
|
| 332 | BigStr* filename;
|
| 333 |
|
| 334 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__Path)
|
| 335 | };
|
| 336 |
|
| 337 | class redirect_arg__CopyFd : public redirect_arg_t {
|
| 338 | public:
|
| 339 | redirect_arg__CopyFd(int target_fd)
|
| 340 | : target_fd(target_fd) {
|
| 341 | }
|
| 342 |
|
| 343 | static redirect_arg__CopyFd* CreateNull(bool alloc_lists = false) {
|
| 344 | return Alloc<redirect_arg__CopyFd>(-1);
|
| 345 | }
|
| 346 |
|
| 347 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 348 |
|
| 349 | static constexpr ObjHeader obj_header() {
|
| 350 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::CopyFd),
|
| 351 | 0);
|
| 352 | }
|
| 353 |
|
| 354 | int target_fd;
|
| 355 |
|
| 356 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__CopyFd)
|
| 357 | };
|
| 358 |
|
| 359 | class redirect_arg__MoveFd : public redirect_arg_t {
|
| 360 | public:
|
| 361 | redirect_arg__MoveFd(int target_fd)
|
| 362 | : target_fd(target_fd) {
|
| 363 | }
|
| 364 |
|
| 365 | static redirect_arg__MoveFd* CreateNull(bool alloc_lists = false) {
|
| 366 | return Alloc<redirect_arg__MoveFd>(-1);
|
| 367 | }
|
| 368 |
|
| 369 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 370 |
|
| 371 | static constexpr ObjHeader obj_header() {
|
| 372 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::MoveFd),
|
| 373 | 0);
|
| 374 | }
|
| 375 |
|
| 376 | int target_fd;
|
| 377 |
|
| 378 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__MoveFd)
|
| 379 | };
|
| 380 |
|
| 381 | class redirect_arg__CloseFd : public redirect_arg_t {
|
| 382 | public:
|
| 383 | redirect_arg__CloseFd() {}
|
| 384 |
|
| 385 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 386 |
|
| 387 | static constexpr ObjHeader obj_header() {
|
| 388 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::CloseFd),
|
| 389 | 0);
|
| 390 | }
|
| 391 |
|
| 392 |
|
| 393 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__CloseFd)
|
| 394 | };
|
| 395 |
|
| 396 | class redirect_arg__HereDoc : public redirect_arg_t {
|
| 397 | public:
|
| 398 | redirect_arg__HereDoc(BigStr* body)
|
| 399 | : body(body) {
|
| 400 | }
|
| 401 |
|
| 402 | static redirect_arg__HereDoc* CreateNull(bool alloc_lists = false) {
|
| 403 | return Alloc<redirect_arg__HereDoc>(kEmptyString);
|
| 404 | }
|
| 405 |
|
| 406 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 407 |
|
| 408 | static constexpr ObjHeader obj_header() {
|
| 409 | return ObjHeader::AsdlClass(static_cast<uint16_t>(redirect_arg_e::HereDoc),
|
| 410 | 1);
|
| 411 | }
|
| 412 |
|
| 413 | BigStr* body;
|
| 414 |
|
| 415 | DISALLOW_COPY_AND_ASSIGN(redirect_arg__HereDoc)
|
| 416 | };
|
| 417 |
|
| 418 | extern GcGlobal<redirect_arg__CloseFd> gredirect_arg__CloseFd;
|
| 419 | ASDL_NAMES redirect_arg {
|
| 420 | typedef redirect_arg__Path Path;
|
| 421 | typedef redirect_arg__CopyFd CopyFd;
|
| 422 | typedef redirect_arg__MoveFd MoveFd;
|
| 423 | static redirect_arg__CloseFd* CloseFd;
|
| 424 | typedef redirect_arg__HereDoc HereDoc;
|
| 425 | };
|
| 426 |
|
| 427 | ASDL_NAMES wait_status_e {
|
| 428 | enum no_name {
|
| 429 | Proc = 1,
|
| 430 | Pipeline = 2,
|
| 431 | Cancelled = 3,
|
| 432 | };
|
| 433 | };
|
| 434 |
|
| 435 | BigStr* wait_status_str(int tag, bool dot = true);
|
| 436 |
|
| 437 | class wait_status_t {
|
| 438 | protected:
|
| 439 | wait_status_t() {
|
| 440 | }
|
| 441 | public:
|
| 442 | int tag() const {
|
| 443 | return ObjHeader::FromObject(this)->type_tag;
|
| 444 | }
|
| 445 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 446 | DISALLOW_COPY_AND_ASSIGN(wait_status_t)
|
| 447 | };
|
| 448 |
|
| 449 | class wait_status__Proc : public wait_status_t {
|
| 450 | public:
|
| 451 | wait_status__Proc(int code)
|
| 452 | : code(code) {
|
| 453 | }
|
| 454 |
|
| 455 | static wait_status__Proc* CreateNull(bool alloc_lists = false) {
|
| 456 | return Alloc<wait_status__Proc>(-1);
|
| 457 | }
|
| 458 |
|
| 459 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 460 |
|
| 461 | static constexpr ObjHeader obj_header() {
|
| 462 | return ObjHeader::AsdlClass(static_cast<uint16_t>(wait_status_e::Proc), 0);
|
| 463 | }
|
| 464 |
|
| 465 | int code;
|
| 466 |
|
| 467 | DISALLOW_COPY_AND_ASSIGN(wait_status__Proc)
|
| 468 | };
|
| 469 |
|
| 470 | class wait_status__Pipeline : public wait_status_t {
|
| 471 | public:
|
| 472 | wait_status__Pipeline(List<int>* codes)
|
| 473 | : codes(codes) {
|
| 474 | }
|
| 475 |
|
| 476 | static wait_status__Pipeline* CreateNull(bool alloc_lists = false) {
|
| 477 | return Alloc<wait_status__Pipeline>(alloc_lists ? Alloc<List<int>>() :
|
| 478 | nullptr);
|
| 479 | }
|
| 480 |
|
| 481 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 482 |
|
| 483 | static constexpr ObjHeader obj_header() {
|
| 484 | return ObjHeader::AsdlClass(static_cast<uint16_t>(wait_status_e::Pipeline),
|
| 485 | 1);
|
| 486 | }
|
| 487 |
|
| 488 | List<int>* codes;
|
| 489 |
|
| 490 | DISALLOW_COPY_AND_ASSIGN(wait_status__Pipeline)
|
| 491 | };
|
| 492 |
|
| 493 | class wait_status__Cancelled : public wait_status_t {
|
| 494 | public:
|
| 495 | wait_status__Cancelled(int sig_num)
|
| 496 | : sig_num(sig_num) {
|
| 497 | }
|
| 498 |
|
| 499 | static wait_status__Cancelled* CreateNull(bool alloc_lists = false) {
|
| 500 | return Alloc<wait_status__Cancelled>(-1);
|
| 501 | }
|
| 502 |
|
| 503 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 504 |
|
| 505 | static constexpr ObjHeader obj_header() {
|
| 506 | return
|
| 507 | ObjHeader::AsdlClass(static_cast<uint16_t>(wait_status_e::Cancelled), 0);
|
| 508 | }
|
| 509 |
|
| 510 | int sig_num;
|
| 511 |
|
| 512 | DISALLOW_COPY_AND_ASSIGN(wait_status__Cancelled)
|
| 513 | };
|
| 514 |
|
| 515 | ASDL_NAMES wait_status {
|
| 516 | typedef wait_status__Proc Proc;
|
| 517 | typedef wait_status__Pipeline Pipeline;
|
| 518 | typedef wait_status__Cancelled Cancelled;
|
| 519 | };
|
| 520 |
|
| 521 | enum class flow_e {
|
| 522 | Nothing = 1,
|
| 523 | Break = 2,
|
| 524 | Raise = 3,
|
| 525 | };
|
| 526 | typedef flow_e flow_t;
|
| 527 |
|
| 528 | BigStr* flow_str(flow_e tag, bool dot = true);
|
| 529 |
|
| 530 | enum class span_e {
|
| 531 | Black = 1,
|
| 532 | Delim = 2,
|
| 533 | Backslash = 3,
|
| 534 | };
|
| 535 | typedef span_e span_t;
|
| 536 |
|
| 537 | BigStr* span_str(span_e tag, bool dot = true);
|
| 538 |
|
| 539 | ASDL_NAMES emit_i {
|
| 540 | enum no_name {
|
| 541 | Part = 1,
|
| 542 | Delim = 2,
|
| 543 | Empty = 3,
|
| 544 | Escape = 4,
|
| 545 | Nothing = 5,
|
| 546 | ARRAY_SIZE = 6,
|
| 547 | };
|
| 548 | };
|
| 549 |
|
| 550 | BigStr* emit_str(int tag, bool dot = true);
|
| 551 |
|
| 552 | typedef int emit_t;
|
| 553 |
|
| 554 | ASDL_NAMES state_i {
|
| 555 | enum no_name {
|
| 556 | Invalid = 1,
|
| 557 | Start = 2,
|
| 558 | DE_White1 = 3,
|
| 559 | DE_Gray = 4,
|
| 560 | DE_White2 = 5,
|
| 561 | Black = 6,
|
| 562 | Backslash = 7,
|
| 563 | Done = 8,
|
| 564 | ARRAY_SIZE = 9,
|
| 565 | };
|
| 566 | };
|
| 567 |
|
| 568 | BigStr* state_str(int tag, bool dot = true);
|
| 569 |
|
| 570 | typedef int state_t;
|
| 571 |
|
| 572 | ASDL_NAMES char_kind_i {
|
| 573 | enum no_name {
|
| 574 | DE_White = 1,
|
| 575 | DE_Gray = 2,
|
| 576 | Black = 3,
|
| 577 | Backslash = 4,
|
| 578 | Sentinel = 5,
|
| 579 | ARRAY_SIZE = 6,
|
| 580 | };
|
| 581 | };
|
| 582 |
|
| 583 | BigStr* char_kind_str(int tag, bool dot = true);
|
| 584 |
|
| 585 | typedef int char_kind_t;
|
| 586 |
|
| 587 | enum class job_state_e {
|
| 588 | Running = 1,
|
| 589 | Done = 2,
|
| 590 | Stopped = 3,
|
| 591 | };
|
| 592 | typedef job_state_e job_state_t;
|
| 593 |
|
| 594 | BigStr* job_state_str(job_state_e tag, bool dot = true);
|
| 595 |
|
| 596 | enum class error_code_e {
|
| 597 | OK = 1,
|
| 598 | IndexOutOfRange = 2,
|
| 599 | };
|
| 600 | typedef error_code_e error_code_t;
|
| 601 |
|
| 602 | BigStr* error_code_str(error_code_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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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(bool do_abbrev, 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 ProcArgs {
|
| 811 | public:
|
| 812 | ProcArgs(syntax_asdl::ArgList* typed_args, List<value_asdl::value_t*>*
|
| 813 | pos_args, Dict<BigStr*, value_asdl::value_t*>* named_args,
|
| 814 | value_asdl::value_t* block_arg)
|
| 815 | : typed_args(typed_args),
|
| 816 | pos_args(pos_args),
|
| 817 | named_args(named_args),
|
| 818 | block_arg(block_arg) {
|
| 819 | }
|
| 820 |
|
| 821 | static ProcArgs* CreateNull(bool alloc_lists = false) {
|
| 822 | return Alloc<ProcArgs>(nullptr, nullptr, nullptr, nullptr);
|
| 823 | }
|
| 824 |
|
| 825 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 826 |
|
| 827 | static constexpr ObjHeader obj_header() {
|
| 828 | return ObjHeader::AsdlClass(65, 4);
|
| 829 | }
|
| 830 |
|
| 831 | syntax_asdl::ArgList* typed_args;
|
| 832 | List<value_asdl::value_t*>* pos_args;
|
| 833 | Dict<BigStr*, value_asdl::value_t*>* named_args;
|
| 834 | value_asdl::value_t* block_arg;
|
| 835 |
|
| 836 | DISALLOW_COPY_AND_ASSIGN(ProcArgs)
|
| 837 | };
|
| 838 |
|
| 839 | class Piece : public part_value_t {
|
| 840 | public:
|
| 841 | Piece(BigStr* s, bool quoted, bool do_split)
|
| 842 | : s(s),
|
| 843 | quoted(quoted),
|
| 844 | do_split(do_split) {
|
| 845 | }
|
| 846 |
|
| 847 | static Piece* CreateNull(bool alloc_lists = false) {
|
| 848 | return Alloc<Piece>(kEmptyString, false, false);
|
| 849 | }
|
| 850 |
|
| 851 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 852 |
|
| 853 | static constexpr ObjHeader obj_header() {
|
| 854 | return ObjHeader::AsdlClass(66, 1);
|
| 855 | }
|
| 856 |
|
| 857 | BigStr* s;
|
| 858 | bool quoted;
|
| 859 | bool do_split;
|
| 860 |
|
| 861 | DISALLOW_COPY_AND_ASSIGN(Piece)
|
| 862 | };
|
| 863 |
|
| 864 | class VarSubState {
|
| 865 | public:
|
| 866 | VarSubState(bool join_array, value_asdl::value_t* h_value,
|
| 867 | syntax_asdl::Token* array_ref)
|
| 868 | : h_value(h_value),
|
| 869 | array_ref(array_ref),
|
| 870 | join_array(join_array) {
|
| 871 | }
|
| 872 |
|
| 873 | static VarSubState* CreateNull(bool alloc_lists = false) {
|
| 874 | return Alloc<VarSubState>(false, nullptr, nullptr);
|
| 875 | }
|
| 876 |
|
| 877 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 878 |
|
| 879 | static constexpr ObjHeader obj_header() {
|
| 880 | return ObjHeader::AsdlClass(67, 2);
|
| 881 | }
|
| 882 |
|
| 883 | value_asdl::value_t* h_value;
|
| 884 | syntax_asdl::Token* array_ref;
|
| 885 | bool join_array;
|
| 886 |
|
| 887 | DISALLOW_COPY_AND_ASSIGN(VarSubState)
|
| 888 | };
|
| 889 |
|
| 890 | class Cell {
|
| 891 | public:
|
| 892 | Cell(bool exported, bool readonly, bool nameref, value_asdl::value_t* val)
|
| 893 | : val(val),
|
| 894 | exported(exported),
|
| 895 | readonly(readonly),
|
| 896 | nameref(nameref) {
|
| 897 | }
|
| 898 |
|
| 899 | static Cell* CreateNull(bool alloc_lists = false) {
|
| 900 | return Alloc<Cell>(false, false, false, nullptr);
|
| 901 | }
|
| 902 |
|
| 903 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 904 |
|
| 905 | static constexpr ObjHeader obj_header() {
|
| 906 | return ObjHeader::AsdlClass(68, 1);
|
| 907 | }
|
| 908 |
|
| 909 | value_asdl::value_t* val;
|
| 910 | bool exported;
|
| 911 | bool readonly;
|
| 912 | bool nameref;
|
| 913 |
|
| 914 | DISALLOW_COPY_AND_ASSIGN(Cell)
|
| 915 | };
|
| 916 |
|
| 917 | class VTestPlace {
|
| 918 | public:
|
| 919 | VTestPlace(BigStr* name, a_index_t* index)
|
| 920 | : name(name),
|
| 921 | index(index) {
|
| 922 | }
|
| 923 |
|
| 924 | static VTestPlace* CreateNull(bool alloc_lists = false) {
|
| 925 | return Alloc<VTestPlace>(nullptr, nullptr);
|
| 926 | }
|
| 927 |
|
| 928 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 929 |
|
| 930 | static constexpr ObjHeader obj_header() {
|
| 931 | return ObjHeader::AsdlClass(69, 2);
|
| 932 | }
|
| 933 |
|
| 934 | BigStr* name;
|
| 935 | a_index_t* index;
|
| 936 |
|
| 937 | DISALLOW_COPY_AND_ASSIGN(VTestPlace)
|
| 938 | };
|
| 939 |
|
| 940 | class RedirValue {
|
| 941 | public:
|
| 942 | RedirValue(Id_t op_id, syntax_asdl::loc_t* op_loc, syntax_asdl::redir_loc_t*
|
| 943 | loc, redirect_arg_t* arg)
|
| 944 | : op_loc(op_loc),
|
| 945 | loc(loc),
|
| 946 | arg(arg),
|
| 947 | op_id(op_id) {
|
| 948 | }
|
| 949 |
|
| 950 | static RedirValue* CreateNull(bool alloc_lists = false) {
|
| 951 | return Alloc<RedirValue>(-1, nullptr, nullptr, nullptr);
|
| 952 | }
|
| 953 |
|
| 954 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 955 |
|
| 956 | static constexpr ObjHeader obj_header() {
|
| 957 | return ObjHeader::AsdlClass(70, 3);
|
| 958 | }
|
| 959 |
|
| 960 | syntax_asdl::loc_t* op_loc;
|
| 961 | syntax_asdl::redir_loc_t* loc;
|
| 962 | redirect_arg_t* arg;
|
| 963 | Id_t op_id;
|
| 964 |
|
| 965 | DISALLOW_COPY_AND_ASSIGN(RedirValue)
|
| 966 | };
|
| 967 |
|
| 968 | class StatusArray {
|
| 969 | public:
|
| 970 | StatusArray(List<int>* codes, List<syntax_asdl::loc_t*>* locs)
|
| 971 | : codes(codes),
|
| 972 | locs(locs) {
|
| 973 | }
|
| 974 |
|
| 975 | static StatusArray* CreateNull(bool alloc_lists = false) {
|
| 976 | return Alloc<StatusArray>(nullptr, nullptr);
|
| 977 | }
|
| 978 |
|
| 979 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 980 |
|
| 981 | static constexpr ObjHeader obj_header() {
|
| 982 | return ObjHeader::AsdlClass(71, 2);
|
| 983 | }
|
| 984 |
|
| 985 | List<int>* codes;
|
| 986 | List<syntax_asdl::loc_t*>* locs;
|
| 987 |
|
| 988 | DISALLOW_COPY_AND_ASSIGN(StatusArray)
|
| 989 | };
|
| 990 |
|
| 991 | class CommandStatus {
|
| 992 | public:
|
| 993 | CommandStatus(bool check_errexit, bool show_code, bool pipe_negated,
|
| 994 | List<int>* pipe_status, List<syntax_asdl::loc_t*>* pipe_locs)
|
| 995 | : pipe_status(pipe_status),
|
| 996 | pipe_locs(pipe_locs),
|
| 997 | check_errexit(check_errexit),
|
| 998 | show_code(show_code),
|
| 999 | pipe_negated(pipe_negated) {
|
| 1000 | }
|
| 1001 |
|
| 1002 | static CommandStatus* CreateNull(bool alloc_lists = false) {
|
| 1003 | return Alloc<CommandStatus>(false, false, false, nullptr, nullptr);
|
| 1004 | }
|
| 1005 |
|
| 1006 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1007 |
|
| 1008 | static constexpr ObjHeader obj_header() {
|
| 1009 | return ObjHeader::AsdlClass(72, 2);
|
| 1010 | }
|
| 1011 |
|
| 1012 | List<int>* pipe_status;
|
| 1013 | List<syntax_asdl::loc_t*>* pipe_locs;
|
| 1014 | bool check_errexit;
|
| 1015 | bool show_code;
|
| 1016 | bool pipe_negated;
|
| 1017 |
|
| 1018 | DISALLOW_COPY_AND_ASSIGN(CommandStatus)
|
| 1019 | };
|
| 1020 |
|
| 1021 | class HayNode {
|
| 1022 | public:
|
| 1023 | HayNode(Dict<BigStr*, HayNode*>* children)
|
| 1024 | : children(children) {
|
| 1025 | }
|
| 1026 |
|
| 1027 | static HayNode* CreateNull(bool alloc_lists = false) {
|
| 1028 | return Alloc<HayNode>(nullptr);
|
| 1029 | }
|
| 1030 |
|
| 1031 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1032 |
|
| 1033 | static constexpr ObjHeader obj_header() {
|
| 1034 | return ObjHeader::AsdlClass(73, 1);
|
| 1035 | }
|
| 1036 |
|
| 1037 | Dict<BigStr*, HayNode*>* children;
|
| 1038 |
|
| 1039 | DISALLOW_COPY_AND_ASSIGN(HayNode)
|
| 1040 | };
|
| 1041 |
|
| 1042 |
|
| 1043 | } // namespace runtime_asdl
|
| 1044 |
|
| 1045 | #endif // RUNTIME_ASDL
|