| 1 | // _gen/yaks/yaks.asdl.h is generated by asdl_main.py
|
| 2 |
|
| 3 | #ifndef YAKS_ASDL
|
| 4 | #define YAKS_ASDL
|
| 5 |
|
| 6 | #include <cstdint>
|
| 7 |
|
| 8 | #include "mycpp/runtime.h"
|
| 9 | #include "asdl/cpp_runtime.h"
|
| 10 | namespace yaks_asdl {
|
| 11 |
|
| 12 | // use struct instead of namespace so 'using' works consistently
|
| 13 | #define ASDL_NAMES struct
|
| 14 |
|
| 15 | class Token;
|
| 16 | class Bool;
|
| 17 | class Int;
|
| 18 | class Str;
|
| 19 | class MultiStr;
|
| 20 | class kexpr_t;
|
| 21 | class Field_;
|
| 22 | class variant;
|
| 23 | class ktype_t;
|
| 24 | class NameType;
|
| 25 | class stmt_t;
|
| 26 | class Signature;
|
| 27 | class mod_def_t;
|
| 28 | class Module;
|
| 29 | class Program;
|
| 30 |
|
| 31 | enum class op_e {
|
| 32 | Plus = 1,
|
| 33 | Minus = 2,
|
| 34 | };
|
| 35 | typedef op_e op_t;
|
| 36 |
|
| 37 | BigStr* op_str(op_e tag, bool dot = true);
|
| 38 |
|
| 39 | ASDL_NAMES kexpr_e {
|
| 40 | enum no_name {
|
| 41 | Bool = 65,
|
| 42 | Int = 66,
|
| 43 | Str = 67,
|
| 44 | MultiStr = 68,
|
| 45 | Unary = 5,
|
| 46 | Binary = 6,
|
| 47 | Ternary = 7,
|
| 48 | Call = 8,
|
| 49 | };
|
| 50 | };
|
| 51 |
|
| 52 | BigStr* kexpr_str(int tag, bool dot = true);
|
| 53 |
|
| 54 | class kexpr_t {
|
| 55 | protected:
|
| 56 | kexpr_t() {
|
| 57 | }
|
| 58 | public:
|
| 59 | int tag() const {
|
| 60 | return ObjHeader::FromObject(this)->type_tag;
|
| 61 | }
|
| 62 | constexpr int sum_type_id() {
|
| 63 | return 256;
|
| 64 | }
|
| 65 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 66 |
|
| 67 | DISALLOW_COPY_AND_ASSIGN(kexpr_t)
|
| 68 | };
|
| 69 |
|
| 70 | class kexpr__Unary : public kexpr_t {
|
| 71 | public:
|
| 72 | kexpr__Unary(Token* op, kexpr_t* child)
|
| 73 | : op(op),
|
| 74 | child(child) {
|
| 75 | }
|
| 76 |
|
| 77 | static kexpr__Unary* CreateNull(bool alloc_lists = false) {
|
| 78 | return Alloc<kexpr__Unary>(nullptr, nullptr);
|
| 79 | }
|
| 80 |
|
| 81 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 82 |
|
| 83 | int type_id() {
|
| 84 | return this->sum_type_id() + this->tag();
|
| 85 | }
|
| 86 |
|
| 87 | static constexpr ObjHeader obj_header() {
|
| 88 | return ObjHeader::AsdlClass(static_cast<uint16_t>(kexpr_e::Unary), 2);
|
| 89 | }
|
| 90 | Token* op;
|
| 91 | kexpr_t* child;
|
| 92 |
|
| 93 | DISALLOW_COPY_AND_ASSIGN(kexpr__Unary)
|
| 94 | };
|
| 95 |
|
| 96 | class kexpr__Binary : public kexpr_t {
|
| 97 | public:
|
| 98 | kexpr__Binary(Token* op, kexpr_t* left, kexpr_t* right)
|
| 99 | : op(op),
|
| 100 | left(left),
|
| 101 | right(right) {
|
| 102 | }
|
| 103 |
|
| 104 | static kexpr__Binary* CreateNull(bool alloc_lists = false) {
|
| 105 | return Alloc<kexpr__Binary>(nullptr, nullptr, nullptr);
|
| 106 | }
|
| 107 |
|
| 108 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 109 |
|
| 110 | int type_id() {
|
| 111 | return this->sum_type_id() + this->tag();
|
| 112 | }
|
| 113 |
|
| 114 | static constexpr ObjHeader obj_header() {
|
| 115 | return ObjHeader::AsdlClass(static_cast<uint16_t>(kexpr_e::Binary), 3);
|
| 116 | }
|
| 117 | Token* op;
|
| 118 | kexpr_t* left;
|
| 119 | kexpr_t* right;
|
| 120 |
|
| 121 | DISALLOW_COPY_AND_ASSIGN(kexpr__Binary)
|
| 122 | };
|
| 123 |
|
| 124 | class kexpr__Ternary : public kexpr_t {
|
| 125 | public:
|
| 126 | kexpr__Ternary(Token* op, kexpr_t* left, kexpr_t* cond, kexpr_t* right)
|
| 127 | : op(op),
|
| 128 | left(left),
|
| 129 | cond(cond),
|
| 130 | right(right) {
|
| 131 | }
|
| 132 |
|
| 133 | static kexpr__Ternary* CreateNull(bool alloc_lists = false) {
|
| 134 | return Alloc<kexpr__Ternary>(nullptr, nullptr, nullptr, nullptr);
|
| 135 | }
|
| 136 |
|
| 137 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 138 |
|
| 139 | int type_id() {
|
| 140 | return this->sum_type_id() + this->tag();
|
| 141 | }
|
| 142 |
|
| 143 | static constexpr ObjHeader obj_header() {
|
| 144 | return ObjHeader::AsdlClass(static_cast<uint16_t>(kexpr_e::Ternary), 4);
|
| 145 | }
|
| 146 | Token* op;
|
| 147 | kexpr_t* left;
|
| 148 | kexpr_t* cond;
|
| 149 | kexpr_t* right;
|
| 150 |
|
| 151 | DISALLOW_COPY_AND_ASSIGN(kexpr__Ternary)
|
| 152 | };
|
| 153 |
|
| 154 | class kexpr__Call : public kexpr_t {
|
| 155 | public:
|
| 156 | kexpr__Call(kexpr_t* f, List<kexpr_t*>* args)
|
| 157 | : f(f),
|
| 158 | args(args) {
|
| 159 | }
|
| 160 |
|
| 161 | static kexpr__Call* CreateNull(bool alloc_lists = false) {
|
| 162 | return Alloc<kexpr__Call>(nullptr, alloc_lists ? Alloc<List<kexpr_t*>>() :
|
| 163 | nullptr);
|
| 164 | }
|
| 165 |
|
| 166 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 167 |
|
| 168 | int type_id() {
|
| 169 | return this->sum_type_id() + this->tag();
|
| 170 | }
|
| 171 |
|
| 172 | static constexpr ObjHeader obj_header() {
|
| 173 | return ObjHeader::AsdlClass(static_cast<uint16_t>(kexpr_e::Call), 2);
|
| 174 | }
|
| 175 | kexpr_t* f;
|
| 176 | List<kexpr_t*>* args;
|
| 177 |
|
| 178 | DISALLOW_COPY_AND_ASSIGN(kexpr__Call)
|
| 179 | };
|
| 180 |
|
| 181 | ASDL_NAMES kexpr {
|
| 182 | typedef kexpr__Unary Unary;
|
| 183 | typedef kexpr__Binary Binary;
|
| 184 | typedef kexpr__Ternary Ternary;
|
| 185 | typedef kexpr__Call Call;
|
| 186 | };
|
| 187 |
|
| 188 | ASDL_NAMES ktype_e {
|
| 189 | enum no_name {
|
| 190 | Bool = 1,
|
| 191 | Int = 2,
|
| 192 | Str = 3,
|
| 193 | List = 4,
|
| 194 | Dict = 5,
|
| 195 | Class = 6,
|
| 196 | Data = 7,
|
| 197 | Enum = 8,
|
| 198 | };
|
| 199 | };
|
| 200 |
|
| 201 | BigStr* ktype_str(int tag, bool dot = true);
|
| 202 |
|
| 203 | class ktype_t {
|
| 204 | protected:
|
| 205 | ktype_t() {
|
| 206 | }
|
| 207 | public:
|
| 208 | int tag() const {
|
| 209 | return ObjHeader::FromObject(this)->type_tag;
|
| 210 | }
|
| 211 | constexpr int sum_type_id() {
|
| 212 | return 320;
|
| 213 | }
|
| 214 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 215 |
|
| 216 | DISALLOW_COPY_AND_ASSIGN(ktype_t)
|
| 217 | };
|
| 218 |
|
| 219 | class ktype__Bool : public ktype_t {
|
| 220 | public:
|
| 221 | ktype__Bool() {}
|
| 222 |
|
| 223 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 224 |
|
| 225 | int type_id() {
|
| 226 | return this->sum_type_id() + this->tag();
|
| 227 | }
|
| 228 |
|
| 229 | static constexpr ObjHeader obj_header() {
|
| 230 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Bool), 0);
|
| 231 | }
|
| 232 |
|
| 233 | DISALLOW_COPY_AND_ASSIGN(ktype__Bool)
|
| 234 | };
|
| 235 |
|
| 236 | class ktype__Int : public ktype_t {
|
| 237 | public:
|
| 238 | ktype__Int() {}
|
| 239 |
|
| 240 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 241 |
|
| 242 | int type_id() {
|
| 243 | return this->sum_type_id() + this->tag();
|
| 244 | }
|
| 245 |
|
| 246 | static constexpr ObjHeader obj_header() {
|
| 247 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Int), 0);
|
| 248 | }
|
| 249 |
|
| 250 | DISALLOW_COPY_AND_ASSIGN(ktype__Int)
|
| 251 | };
|
| 252 |
|
| 253 | class ktype__Str : public ktype_t {
|
| 254 | public:
|
| 255 | ktype__Str() {}
|
| 256 |
|
| 257 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 258 |
|
| 259 | int type_id() {
|
| 260 | return this->sum_type_id() + this->tag();
|
| 261 | }
|
| 262 |
|
| 263 | static constexpr ObjHeader obj_header() {
|
| 264 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Str), 0);
|
| 265 | }
|
| 266 |
|
| 267 | DISALLOW_COPY_AND_ASSIGN(ktype__Str)
|
| 268 | };
|
| 269 |
|
| 270 | class ktype__List : public ktype_t {
|
| 271 | public:
|
| 272 | ktype__List(ktype_t* T)
|
| 273 | : T(T) {
|
| 274 | }
|
| 275 |
|
| 276 | static ktype__List* CreateNull(bool alloc_lists = false) {
|
| 277 | return Alloc<ktype__List>(nullptr);
|
| 278 | }
|
| 279 |
|
| 280 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 281 |
|
| 282 | int type_id() {
|
| 283 | return this->sum_type_id() + this->tag();
|
| 284 | }
|
| 285 |
|
| 286 | static constexpr ObjHeader obj_header() {
|
| 287 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::List), 1);
|
| 288 | }
|
| 289 | ktype_t* T;
|
| 290 |
|
| 291 | DISALLOW_COPY_AND_ASSIGN(ktype__List)
|
| 292 | };
|
| 293 |
|
| 294 | class ktype__Dict : public ktype_t {
|
| 295 | public:
|
| 296 | ktype__Dict(ktype_t* K, ktype_t* V)
|
| 297 | : K(K),
|
| 298 | V(V) {
|
| 299 | }
|
| 300 |
|
| 301 | static ktype__Dict* CreateNull(bool alloc_lists = false) {
|
| 302 | return Alloc<ktype__Dict>(nullptr, nullptr);
|
| 303 | }
|
| 304 |
|
| 305 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 306 |
|
| 307 | int type_id() {
|
| 308 | return this->sum_type_id() + this->tag();
|
| 309 | }
|
| 310 |
|
| 311 | static constexpr ObjHeader obj_header() {
|
| 312 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Dict), 2);
|
| 313 | }
|
| 314 | ktype_t* K;
|
| 315 | ktype_t* V;
|
| 316 |
|
| 317 | DISALLOW_COPY_AND_ASSIGN(ktype__Dict)
|
| 318 | };
|
| 319 |
|
| 320 | class ktype__Class : public ktype_t {
|
| 321 | public:
|
| 322 | ktype__Class(BigStr* name)
|
| 323 | : name(name) {
|
| 324 | }
|
| 325 |
|
| 326 | static ktype__Class* CreateNull(bool alloc_lists = false) {
|
| 327 | return Alloc<ktype__Class>(kEmptyString);
|
| 328 | }
|
| 329 |
|
| 330 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 331 |
|
| 332 | int type_id() {
|
| 333 | return this->sum_type_id() + this->tag();
|
| 334 | }
|
| 335 |
|
| 336 | static constexpr ObjHeader obj_header() {
|
| 337 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Class), 1);
|
| 338 | }
|
| 339 | BigStr* name;
|
| 340 |
|
| 341 | DISALLOW_COPY_AND_ASSIGN(ktype__Class)
|
| 342 | };
|
| 343 |
|
| 344 | class ktype__Data : public ktype_t {
|
| 345 | public:
|
| 346 | ktype__Data(List<Field_*>* fields)
|
| 347 | : fields(fields) {
|
| 348 | }
|
| 349 |
|
| 350 | static ktype__Data* CreateNull(bool alloc_lists = false) {
|
| 351 | return Alloc<ktype__Data>(alloc_lists ? Alloc<List<Field_*>>() : nullptr);
|
| 352 | }
|
| 353 |
|
| 354 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 355 |
|
| 356 | int type_id() {
|
| 357 | return this->sum_type_id() + this->tag();
|
| 358 | }
|
| 359 |
|
| 360 | static constexpr ObjHeader obj_header() {
|
| 361 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Data), 1);
|
| 362 | }
|
| 363 | List<Field_*>* fields;
|
| 364 |
|
| 365 | DISALLOW_COPY_AND_ASSIGN(ktype__Data)
|
| 366 | };
|
| 367 |
|
| 368 | class ktype__Enum : public ktype_t {
|
| 369 | public:
|
| 370 | ktype__Enum(List<variant*>* variants)
|
| 371 | : variants(variants) {
|
| 372 | }
|
| 373 |
|
| 374 | static ktype__Enum* CreateNull(bool alloc_lists = false) {
|
| 375 | return Alloc<ktype__Enum>(alloc_lists ? Alloc<List<variant*>>() : nullptr);
|
| 376 | }
|
| 377 |
|
| 378 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 379 |
|
| 380 | int type_id() {
|
| 381 | return this->sum_type_id() + this->tag();
|
| 382 | }
|
| 383 |
|
| 384 | static constexpr ObjHeader obj_header() {
|
| 385 | return ObjHeader::AsdlClass(static_cast<uint16_t>(ktype_e::Enum), 1);
|
| 386 | }
|
| 387 | List<variant*>* variants;
|
| 388 |
|
| 389 | DISALLOW_COPY_AND_ASSIGN(ktype__Enum)
|
| 390 | };
|
| 391 |
|
| 392 | extern GcGlobal<ktype__Bool> gktype__Bool;
|
| 393 | extern GcGlobal<ktype__Int> gktype__Int;
|
| 394 | extern GcGlobal<ktype__Str> gktype__Str;
|
| 395 | ASDL_NAMES ktype {
|
| 396 | static ktype__Bool* Bool;
|
| 397 | static ktype__Int* Int;
|
| 398 | static ktype__Str* Str;
|
| 399 | typedef ktype__List List;
|
| 400 | typedef ktype__Dict Dict;
|
| 401 | typedef ktype__Class Class;
|
| 402 | typedef ktype__Data Data;
|
| 403 | typedef ktype__Enum Enum;
|
| 404 | };
|
| 405 |
|
| 406 | ASDL_NAMES stmt_e {
|
| 407 | enum no_name {
|
| 408 | VarDecl = 1,
|
| 409 | PlaceMutation = 2,
|
| 410 | If = 3,
|
| 411 | Switch = 4,
|
| 412 | For = 5,
|
| 413 | While = 6,
|
| 414 | Break = 7,
|
| 415 | Continue = 8,
|
| 416 | Return = 9,
|
| 417 | Try = 10,
|
| 418 | With = 11,
|
| 419 | };
|
| 420 | };
|
| 421 |
|
| 422 | BigStr* stmt_str(int tag, bool dot = true);
|
| 423 |
|
| 424 | class stmt_t {
|
| 425 | protected:
|
| 426 | stmt_t() {
|
| 427 | }
|
| 428 | public:
|
| 429 | int tag() const {
|
| 430 | return ObjHeader::FromObject(this)->type_tag;
|
| 431 | }
|
| 432 | constexpr int sum_type_id() {
|
| 433 | return 384;
|
| 434 | }
|
| 435 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 436 |
|
| 437 | DISALLOW_COPY_AND_ASSIGN(stmt_t)
|
| 438 | };
|
| 439 |
|
| 440 | class stmt__VarDecl : public stmt_t {
|
| 441 | public:
|
| 442 | stmt__VarDecl(Token* keyword)
|
| 443 | : keyword(keyword) {
|
| 444 | }
|
| 445 |
|
| 446 | static stmt__VarDecl* CreateNull(bool alloc_lists = false) {
|
| 447 | return Alloc<stmt__VarDecl>(nullptr);
|
| 448 | }
|
| 449 |
|
| 450 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 451 |
|
| 452 | int type_id() {
|
| 453 | return this->sum_type_id() + this->tag();
|
| 454 | }
|
| 455 |
|
| 456 | static constexpr ObjHeader obj_header() {
|
| 457 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::VarDecl), 1);
|
| 458 | }
|
| 459 | Token* keyword;
|
| 460 |
|
| 461 | DISALLOW_COPY_AND_ASSIGN(stmt__VarDecl)
|
| 462 | };
|
| 463 |
|
| 464 | class stmt__PlaceMutation : public stmt_t {
|
| 465 | public:
|
| 466 | stmt__PlaceMutation(Token* keyword)
|
| 467 | : keyword(keyword) {
|
| 468 | }
|
| 469 |
|
| 470 | static stmt__PlaceMutation* CreateNull(bool alloc_lists = false) {
|
| 471 | return Alloc<stmt__PlaceMutation>(nullptr);
|
| 472 | }
|
| 473 |
|
| 474 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 475 |
|
| 476 | int type_id() {
|
| 477 | return this->sum_type_id() + this->tag();
|
| 478 | }
|
| 479 |
|
| 480 | static constexpr ObjHeader obj_header() {
|
| 481 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::PlaceMutation),
|
| 482 | 1);
|
| 483 | }
|
| 484 | Token* keyword;
|
| 485 |
|
| 486 | DISALLOW_COPY_AND_ASSIGN(stmt__PlaceMutation)
|
| 487 | };
|
| 488 |
|
| 489 | class stmt__If : public stmt_t {
|
| 490 | public:
|
| 491 | stmt__If() {}
|
| 492 |
|
| 493 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 494 |
|
| 495 | int type_id() {
|
| 496 | return this->sum_type_id() + this->tag();
|
| 497 | }
|
| 498 |
|
| 499 | static constexpr ObjHeader obj_header() {
|
| 500 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::If), 0);
|
| 501 | }
|
| 502 |
|
| 503 | DISALLOW_COPY_AND_ASSIGN(stmt__If)
|
| 504 | };
|
| 505 |
|
| 506 | class stmt__Switch : public stmt_t {
|
| 507 | public:
|
| 508 | stmt__Switch() {}
|
| 509 |
|
| 510 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 511 |
|
| 512 | int type_id() {
|
| 513 | return this->sum_type_id() + this->tag();
|
| 514 | }
|
| 515 |
|
| 516 | static constexpr ObjHeader obj_header() {
|
| 517 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Switch), 0);
|
| 518 | }
|
| 519 |
|
| 520 | DISALLOW_COPY_AND_ASSIGN(stmt__Switch)
|
| 521 | };
|
| 522 |
|
| 523 | class stmt__For : public stmt_t {
|
| 524 | public:
|
| 525 | stmt__For() {}
|
| 526 |
|
| 527 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 528 |
|
| 529 | int type_id() {
|
| 530 | return this->sum_type_id() + this->tag();
|
| 531 | }
|
| 532 |
|
| 533 | static constexpr ObjHeader obj_header() {
|
| 534 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::For), 0);
|
| 535 | }
|
| 536 |
|
| 537 | DISALLOW_COPY_AND_ASSIGN(stmt__For)
|
| 538 | };
|
| 539 |
|
| 540 | class stmt__While : public stmt_t {
|
| 541 | public:
|
| 542 | stmt__While() {}
|
| 543 |
|
| 544 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 545 |
|
| 546 | int type_id() {
|
| 547 | return this->sum_type_id() + this->tag();
|
| 548 | }
|
| 549 |
|
| 550 | static constexpr ObjHeader obj_header() {
|
| 551 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::While), 0);
|
| 552 | }
|
| 553 |
|
| 554 | DISALLOW_COPY_AND_ASSIGN(stmt__While)
|
| 555 | };
|
| 556 |
|
| 557 | class stmt__Break : public stmt_t {
|
| 558 | public:
|
| 559 | stmt__Break() {}
|
| 560 |
|
| 561 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 562 |
|
| 563 | int type_id() {
|
| 564 | return this->sum_type_id() + this->tag();
|
| 565 | }
|
| 566 |
|
| 567 | static constexpr ObjHeader obj_header() {
|
| 568 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Break), 0);
|
| 569 | }
|
| 570 |
|
| 571 | DISALLOW_COPY_AND_ASSIGN(stmt__Break)
|
| 572 | };
|
| 573 |
|
| 574 | class stmt__Continue : public stmt_t {
|
| 575 | public:
|
| 576 | stmt__Continue() {}
|
| 577 |
|
| 578 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 579 |
|
| 580 | int type_id() {
|
| 581 | return this->sum_type_id() + this->tag();
|
| 582 | }
|
| 583 |
|
| 584 | static constexpr ObjHeader obj_header() {
|
| 585 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Continue), 0);
|
| 586 | }
|
| 587 |
|
| 588 | DISALLOW_COPY_AND_ASSIGN(stmt__Continue)
|
| 589 | };
|
| 590 |
|
| 591 | class stmt__Return : public stmt_t {
|
| 592 | public:
|
| 593 | stmt__Return(kexpr_t* e)
|
| 594 | : e(e) {
|
| 595 | }
|
| 596 |
|
| 597 | static stmt__Return* CreateNull(bool alloc_lists = false) {
|
| 598 | return Alloc<stmt__Return>(nullptr);
|
| 599 | }
|
| 600 |
|
| 601 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 602 |
|
| 603 | int type_id() {
|
| 604 | return this->sum_type_id() + this->tag();
|
| 605 | }
|
| 606 |
|
| 607 | static constexpr ObjHeader obj_header() {
|
| 608 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Return), 1);
|
| 609 | }
|
| 610 | kexpr_t* e;
|
| 611 |
|
| 612 | DISALLOW_COPY_AND_ASSIGN(stmt__Return)
|
| 613 | };
|
| 614 |
|
| 615 | class stmt__Try : public stmt_t {
|
| 616 | public:
|
| 617 | stmt__Try() {}
|
| 618 |
|
| 619 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 620 |
|
| 621 | int type_id() {
|
| 622 | return this->sum_type_id() + this->tag();
|
| 623 | }
|
| 624 |
|
| 625 | static constexpr ObjHeader obj_header() {
|
| 626 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::Try), 0);
|
| 627 | }
|
| 628 |
|
| 629 | DISALLOW_COPY_AND_ASSIGN(stmt__Try)
|
| 630 | };
|
| 631 |
|
| 632 | class stmt__With : public stmt_t {
|
| 633 | public:
|
| 634 | stmt__With() {}
|
| 635 |
|
| 636 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 637 |
|
| 638 | int type_id() {
|
| 639 | return this->sum_type_id() + this->tag();
|
| 640 | }
|
| 641 |
|
| 642 | static constexpr ObjHeader obj_header() {
|
| 643 | return ObjHeader::AsdlClass(static_cast<uint16_t>(stmt_e::With), 0);
|
| 644 | }
|
| 645 |
|
| 646 | DISALLOW_COPY_AND_ASSIGN(stmt__With)
|
| 647 | };
|
| 648 |
|
| 649 | extern GcGlobal<stmt__If> gstmt__If;
|
| 650 | extern GcGlobal<stmt__Switch> gstmt__Switch;
|
| 651 | extern GcGlobal<stmt__For> gstmt__For;
|
| 652 | extern GcGlobal<stmt__While> gstmt__While;
|
| 653 | extern GcGlobal<stmt__Break> gstmt__Break;
|
| 654 | extern GcGlobal<stmt__Continue> gstmt__Continue;
|
| 655 | extern GcGlobal<stmt__Try> gstmt__Try;
|
| 656 | extern GcGlobal<stmt__With> gstmt__With;
|
| 657 | ASDL_NAMES stmt {
|
| 658 | typedef stmt__VarDecl VarDecl;
|
| 659 | typedef stmt__PlaceMutation PlaceMutation;
|
| 660 | static stmt__If* If;
|
| 661 | static stmt__Switch* Switch;
|
| 662 | static stmt__For* For;
|
| 663 | static stmt__While* While;
|
| 664 | static stmt__Break* Break;
|
| 665 | static stmt__Continue* Continue;
|
| 666 | typedef stmt__Return Return;
|
| 667 | static stmt__Try* Try;
|
| 668 | static stmt__With* With;
|
| 669 | };
|
| 670 |
|
| 671 | enum class class_def_e {
|
| 672 | Constructor = 1,
|
| 673 | Destructor = 2,
|
| 674 | Method = 3,
|
| 675 | Field = 4,
|
| 676 | };
|
| 677 | typedef class_def_e class_def_t;
|
| 678 |
|
| 679 | BigStr* class_def_str(class_def_e tag, bool dot = true);
|
| 680 |
|
| 681 | ASDL_NAMES mod_def_e {
|
| 682 | enum no_name {
|
| 683 | Global = 1,
|
| 684 | Func = 2,
|
| 685 | Class = 3,
|
| 686 | Import = 4,
|
| 687 | Include = 5,
|
| 688 | Data = 6,
|
| 689 | Enum = 7,
|
| 690 | };
|
| 691 | };
|
| 692 |
|
| 693 | BigStr* mod_def_str(int tag, bool dot = true);
|
| 694 |
|
| 695 | class mod_def_t {
|
| 696 | protected:
|
| 697 | mod_def_t() {
|
| 698 | }
|
| 699 | public:
|
| 700 | int tag() const {
|
| 701 | return ObjHeader::FromObject(this)->type_tag;
|
| 702 | }
|
| 703 | constexpr int sum_type_id() {
|
| 704 | return 448;
|
| 705 | }
|
| 706 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 707 |
|
| 708 | DISALLOW_COPY_AND_ASSIGN(mod_def_t)
|
| 709 | };
|
| 710 |
|
| 711 | class mod_def__Global : public mod_def_t {
|
| 712 | public:
|
| 713 | mod_def__Global(NameType* name_type)
|
| 714 | : name_type(name_type) {
|
| 715 | }
|
| 716 |
|
| 717 | static mod_def__Global* CreateNull(bool alloc_lists = false) {
|
| 718 | return Alloc<mod_def__Global>(nullptr);
|
| 719 | }
|
| 720 |
|
| 721 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 722 |
|
| 723 | int type_id() {
|
| 724 | return this->sum_type_id() + this->tag();
|
| 725 | }
|
| 726 |
|
| 727 | static constexpr ObjHeader obj_header() {
|
| 728 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Global), 1);
|
| 729 | }
|
| 730 | NameType* name_type;
|
| 731 |
|
| 732 | DISALLOW_COPY_AND_ASSIGN(mod_def__Global)
|
| 733 | };
|
| 734 |
|
| 735 | class mod_def__Func : public mod_def_t {
|
| 736 | public:
|
| 737 | mod_def__Func(BigStr* name, Signature* sig, List<stmt_t*>* statements)
|
| 738 | : name(name),
|
| 739 | sig(sig),
|
| 740 | statements(statements) {
|
| 741 | }
|
| 742 |
|
| 743 | static mod_def__Func* CreateNull(bool alloc_lists = false) {
|
| 744 | return Alloc<mod_def__Func>(kEmptyString, nullptr, alloc_lists ?
|
| 745 | Alloc<List<stmt_t*>>() : nullptr);
|
| 746 | }
|
| 747 |
|
| 748 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 749 |
|
| 750 | int type_id() {
|
| 751 | return this->sum_type_id() + this->tag();
|
| 752 | }
|
| 753 |
|
| 754 | static constexpr ObjHeader obj_header() {
|
| 755 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Func), 3);
|
| 756 | }
|
| 757 | BigStr* name;
|
| 758 | Signature* sig;
|
| 759 | List<stmt_t*>* statements;
|
| 760 |
|
| 761 | DISALLOW_COPY_AND_ASSIGN(mod_def__Func)
|
| 762 | };
|
| 763 |
|
| 764 | class mod_def__Class : public mod_def_t {
|
| 765 | public:
|
| 766 | mod_def__Class(BigStr* name, List<class_def_t>* defs)
|
| 767 | : name(name),
|
| 768 | defs(defs) {
|
| 769 | }
|
| 770 |
|
| 771 | static mod_def__Class* CreateNull(bool alloc_lists = false) {
|
| 772 | return Alloc<mod_def__Class>(kEmptyString, alloc_lists ?
|
| 773 | Alloc<List<class_def_t>>() : nullptr);
|
| 774 | }
|
| 775 |
|
| 776 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 777 |
|
| 778 | int type_id() {
|
| 779 | return this->sum_type_id() + this->tag();
|
| 780 | }
|
| 781 |
|
| 782 | static constexpr ObjHeader obj_header() {
|
| 783 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Class), 2);
|
| 784 | }
|
| 785 | BigStr* name;
|
| 786 | List<class_def_t>* defs;
|
| 787 |
|
| 788 | DISALLOW_COPY_AND_ASSIGN(mod_def__Class)
|
| 789 | };
|
| 790 |
|
| 791 | class mod_def__Import : public mod_def_t {
|
| 792 | public:
|
| 793 | mod_def__Import() {}
|
| 794 |
|
| 795 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 796 |
|
| 797 | int type_id() {
|
| 798 | return this->sum_type_id() + this->tag();
|
| 799 | }
|
| 800 |
|
| 801 | static constexpr ObjHeader obj_header() {
|
| 802 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Import), 0);
|
| 803 | }
|
| 804 |
|
| 805 | DISALLOW_COPY_AND_ASSIGN(mod_def__Import)
|
| 806 | };
|
| 807 |
|
| 808 | class mod_def__Include : public mod_def_t {
|
| 809 | public:
|
| 810 | mod_def__Include(BigStr* path)
|
| 811 | : path(path) {
|
| 812 | }
|
| 813 |
|
| 814 | static mod_def__Include* CreateNull(bool alloc_lists = false) {
|
| 815 | return Alloc<mod_def__Include>(kEmptyString);
|
| 816 | }
|
| 817 |
|
| 818 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 819 |
|
| 820 | int type_id() {
|
| 821 | return this->sum_type_id() + this->tag();
|
| 822 | }
|
| 823 |
|
| 824 | static constexpr ObjHeader obj_header() {
|
| 825 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Include), 1);
|
| 826 | }
|
| 827 | BigStr* path;
|
| 828 |
|
| 829 | DISALLOW_COPY_AND_ASSIGN(mod_def__Include)
|
| 830 | };
|
| 831 |
|
| 832 | class mod_def__Data : public mod_def_t {
|
| 833 | public:
|
| 834 | mod_def__Data() {}
|
| 835 |
|
| 836 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 837 |
|
| 838 | int type_id() {
|
| 839 | return this->sum_type_id() + this->tag();
|
| 840 | }
|
| 841 |
|
| 842 | static constexpr ObjHeader obj_header() {
|
| 843 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Data), 0);
|
| 844 | }
|
| 845 |
|
| 846 | DISALLOW_COPY_AND_ASSIGN(mod_def__Data)
|
| 847 | };
|
| 848 |
|
| 849 | class mod_def__Enum : public mod_def_t {
|
| 850 | public:
|
| 851 | mod_def__Enum() {}
|
| 852 |
|
| 853 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 854 |
|
| 855 | int type_id() {
|
| 856 | return this->sum_type_id() + this->tag();
|
| 857 | }
|
| 858 |
|
| 859 | static constexpr ObjHeader obj_header() {
|
| 860 | return ObjHeader::AsdlClass(static_cast<uint16_t>(mod_def_e::Enum), 0);
|
| 861 | }
|
| 862 |
|
| 863 | DISALLOW_COPY_AND_ASSIGN(mod_def__Enum)
|
| 864 | };
|
| 865 |
|
| 866 | extern GcGlobal<mod_def__Import> gmod_def__Import;
|
| 867 | extern GcGlobal<mod_def__Data> gmod_def__Data;
|
| 868 | extern GcGlobal<mod_def__Enum> gmod_def__Enum;
|
| 869 | ASDL_NAMES mod_def {
|
| 870 | typedef mod_def__Global Global;
|
| 871 | typedef mod_def__Func Func;
|
| 872 | typedef mod_def__Class Class;
|
| 873 | static mod_def__Import* Import;
|
| 874 | typedef mod_def__Include Include;
|
| 875 | static mod_def__Data* Data;
|
| 876 | static mod_def__Enum* Enum;
|
| 877 | };
|
| 878 |
|
| 879 | class Token {
|
| 880 | public:
|
| 881 | Token(BigStr* path, BigStr* chunk, int start, int length)
|
| 882 | : path(path),
|
| 883 | chunk(chunk),
|
| 884 | start(start),
|
| 885 | length(length) {
|
| 886 | }
|
| 887 |
|
| 888 | static Token* CreateNull(bool alloc_lists = false) {
|
| 889 | return Alloc<Token>(kEmptyString, kEmptyString, -1, -1);
|
| 890 | }
|
| 891 |
|
| 892 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 893 |
|
| 894 | int type_id() {
|
| 895 | return ObjHeader::FromObject(this)->type_tag;
|
| 896 | }
|
| 897 |
|
| 898 | static constexpr ObjHeader obj_header() {
|
| 899 | return ObjHeader::AsdlClass(64, 2);
|
| 900 | }
|
| 901 | BigStr* path;
|
| 902 | BigStr* chunk;
|
| 903 | int start;
|
| 904 | int length;
|
| 905 |
|
| 906 | DISALLOW_COPY_AND_ASSIGN(Token)
|
| 907 | };
|
| 908 |
|
| 909 | class Bool : public kexpr_t {
|
| 910 | public:
|
| 911 | Bool(bool b, Token* loc)
|
| 912 | : loc(loc),
|
| 913 | b(b) {
|
| 914 | }
|
| 915 |
|
| 916 | static Bool* CreateNull(bool alloc_lists = false) {
|
| 917 | return Alloc<Bool>(false, nullptr);
|
| 918 | }
|
| 919 |
|
| 920 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 921 |
|
| 922 | int type_id() {
|
| 923 | return ObjHeader::FromObject(this)->type_tag;
|
| 924 | }
|
| 925 |
|
| 926 | static constexpr ObjHeader obj_header() {
|
| 927 | return ObjHeader::AsdlClass(65, 1);
|
| 928 | }
|
| 929 | Token* loc;
|
| 930 | bool b;
|
| 931 |
|
| 932 | DISALLOW_COPY_AND_ASSIGN(Bool)
|
| 933 | };
|
| 934 |
|
| 935 | class Int : public kexpr_t {
|
| 936 | public:
|
| 937 | Int(int i, Token* loc)
|
| 938 | : loc(loc),
|
| 939 | i(i) {
|
| 940 | }
|
| 941 |
|
| 942 | static Int* CreateNull(bool alloc_lists = false) {
|
| 943 | return Alloc<Int>(-1, nullptr);
|
| 944 | }
|
| 945 |
|
| 946 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 947 |
|
| 948 | int type_id() {
|
| 949 | return ObjHeader::FromObject(this)->type_tag;
|
| 950 | }
|
| 951 |
|
| 952 | static constexpr ObjHeader obj_header() {
|
| 953 | return ObjHeader::AsdlClass(66, 1);
|
| 954 | }
|
| 955 | Token* loc;
|
| 956 | int i;
|
| 957 |
|
| 958 | DISALLOW_COPY_AND_ASSIGN(Int)
|
| 959 | };
|
| 960 |
|
| 961 | class Str : public kexpr_t {
|
| 962 | public:
|
| 963 | Str(BigStr* s, Token* loc)
|
| 964 | : s(s),
|
| 965 | loc(loc) {
|
| 966 | }
|
| 967 |
|
| 968 | static Str* CreateNull(bool alloc_lists = false) {
|
| 969 | return Alloc<Str>(kEmptyString, nullptr);
|
| 970 | }
|
| 971 |
|
| 972 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 973 |
|
| 974 | int type_id() {
|
| 975 | return ObjHeader::FromObject(this)->type_tag;
|
| 976 | }
|
| 977 |
|
| 978 | static constexpr ObjHeader obj_header() {
|
| 979 | return ObjHeader::AsdlClass(67, 2);
|
| 980 | }
|
| 981 | BigStr* s;
|
| 982 | Token* loc;
|
| 983 |
|
| 984 | DISALLOW_COPY_AND_ASSIGN(Str)
|
| 985 | };
|
| 986 |
|
| 987 | class MultiStr : public kexpr_t {
|
| 988 | public:
|
| 989 | MultiStr(List<Token*>* lines)
|
| 990 | : lines(lines) {
|
| 991 | }
|
| 992 |
|
| 993 | static MultiStr* CreateNull(bool alloc_lists = false) {
|
| 994 | return Alloc<MultiStr>(alloc_lists ? Alloc<List<Token*>>() : nullptr);
|
| 995 | }
|
| 996 |
|
| 997 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 998 |
|
| 999 | int type_id() {
|
| 1000 | return ObjHeader::FromObject(this)->type_tag;
|
| 1001 | }
|
| 1002 |
|
| 1003 | static constexpr ObjHeader obj_header() {
|
| 1004 | return ObjHeader::AsdlClass(68, 1);
|
| 1005 | }
|
| 1006 | List<Token*>* lines;
|
| 1007 |
|
| 1008 | DISALLOW_COPY_AND_ASSIGN(MultiStr)
|
| 1009 | };
|
| 1010 |
|
| 1011 | class Field_ {
|
| 1012 | public:
|
| 1013 | Field_(BigStr* name, ktype_t* typ)
|
| 1014 | : name(name),
|
| 1015 | typ(typ) {
|
| 1016 | }
|
| 1017 |
|
| 1018 | static Field_* CreateNull(bool alloc_lists = false) {
|
| 1019 | return Alloc<Field_>(kEmptyString, nullptr);
|
| 1020 | }
|
| 1021 |
|
| 1022 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1023 |
|
| 1024 | int type_id() {
|
| 1025 | return ObjHeader::FromObject(this)->type_tag;
|
| 1026 | }
|
| 1027 |
|
| 1028 | static constexpr ObjHeader obj_header() {
|
| 1029 | return ObjHeader::AsdlClass(69, 2);
|
| 1030 | }
|
| 1031 | BigStr* name;
|
| 1032 | ktype_t* typ;
|
| 1033 |
|
| 1034 | DISALLOW_COPY_AND_ASSIGN(Field_)
|
| 1035 | };
|
| 1036 |
|
| 1037 | class variant {
|
| 1038 | public:
|
| 1039 | variant(List<Field_*>* fields)
|
| 1040 | : fields(fields) {
|
| 1041 | }
|
| 1042 |
|
| 1043 | static variant* CreateNull(bool alloc_lists = false) {
|
| 1044 | return Alloc<variant>(alloc_lists ? Alloc<List<Field_*>>() : nullptr);
|
| 1045 | }
|
| 1046 |
|
| 1047 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1048 |
|
| 1049 | int type_id() {
|
| 1050 | return ObjHeader::FromObject(this)->type_tag;
|
| 1051 | }
|
| 1052 |
|
| 1053 | static constexpr ObjHeader obj_header() {
|
| 1054 | return ObjHeader::AsdlClass(70, 1);
|
| 1055 | }
|
| 1056 | List<Field_*>* fields;
|
| 1057 |
|
| 1058 | DISALLOW_COPY_AND_ASSIGN(variant)
|
| 1059 | };
|
| 1060 |
|
| 1061 | class NameType {
|
| 1062 | public:
|
| 1063 | NameType(BigStr* name, ktype_t* typ)
|
| 1064 | : name(name),
|
| 1065 | typ(typ) {
|
| 1066 | }
|
| 1067 |
|
| 1068 | static NameType* CreateNull(bool alloc_lists = false) {
|
| 1069 | return Alloc<NameType>(kEmptyString, nullptr);
|
| 1070 | }
|
| 1071 |
|
| 1072 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1073 |
|
| 1074 | int type_id() {
|
| 1075 | return ObjHeader::FromObject(this)->type_tag;
|
| 1076 | }
|
| 1077 |
|
| 1078 | static constexpr ObjHeader obj_header() {
|
| 1079 | return ObjHeader::AsdlClass(71, 2);
|
| 1080 | }
|
| 1081 | BigStr* name;
|
| 1082 | ktype_t* typ;
|
| 1083 |
|
| 1084 | DISALLOW_COPY_AND_ASSIGN(NameType)
|
| 1085 | };
|
| 1086 |
|
| 1087 | class Signature {
|
| 1088 | public:
|
| 1089 | Signature(List<NameType*>* params, ktype_t* return_type)
|
| 1090 | : params(params),
|
| 1091 | return_type(return_type) {
|
| 1092 | }
|
| 1093 |
|
| 1094 | static Signature* CreateNull(bool alloc_lists = false) {
|
| 1095 | return Alloc<Signature>(alloc_lists ? Alloc<List<NameType*>>() : nullptr,
|
| 1096 | nullptr);
|
| 1097 | }
|
| 1098 |
|
| 1099 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1100 |
|
| 1101 | int type_id() {
|
| 1102 | return ObjHeader::FromObject(this)->type_tag;
|
| 1103 | }
|
| 1104 |
|
| 1105 | static constexpr ObjHeader obj_header() {
|
| 1106 | return ObjHeader::AsdlClass(72, 2);
|
| 1107 | }
|
| 1108 | List<NameType*>* params;
|
| 1109 | ktype_t* return_type;
|
| 1110 |
|
| 1111 | DISALLOW_COPY_AND_ASSIGN(Signature)
|
| 1112 | };
|
| 1113 |
|
| 1114 | class Module {
|
| 1115 | public:
|
| 1116 | Module(BigStr* name, List<mod_def_t*>* defs)
|
| 1117 | : name(name),
|
| 1118 | defs(defs) {
|
| 1119 | }
|
| 1120 |
|
| 1121 | static Module* CreateNull(bool alloc_lists = false) {
|
| 1122 | return Alloc<Module>(kEmptyString, alloc_lists ? Alloc<List<mod_def_t*>>()
|
| 1123 | : nullptr);
|
| 1124 | }
|
| 1125 |
|
| 1126 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1127 |
|
| 1128 | int type_id() {
|
| 1129 | return ObjHeader::FromObject(this)->type_tag;
|
| 1130 | }
|
| 1131 |
|
| 1132 | static constexpr ObjHeader obj_header() {
|
| 1133 | return ObjHeader::AsdlClass(73, 2);
|
| 1134 | }
|
| 1135 | BigStr* name;
|
| 1136 | List<mod_def_t*>* defs;
|
| 1137 |
|
| 1138 | DISALLOW_COPY_AND_ASSIGN(Module)
|
| 1139 | };
|
| 1140 |
|
| 1141 | class Program {
|
| 1142 | public:
|
| 1143 | Program(BigStr* main_module, List<Module*>* modules)
|
| 1144 | : main_module(main_module),
|
| 1145 | modules(modules) {
|
| 1146 | }
|
| 1147 |
|
| 1148 | static Program* CreateNull(bool alloc_lists = false) {
|
| 1149 | return Alloc<Program>(kEmptyString, alloc_lists ? Alloc<List<Module*>>() :
|
| 1150 | nullptr);
|
| 1151 | }
|
| 1152 |
|
| 1153 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 1154 |
|
| 1155 | int type_id() {
|
| 1156 | return ObjHeader::FromObject(this)->type_tag;
|
| 1157 | }
|
| 1158 |
|
| 1159 | static constexpr ObjHeader obj_header() {
|
| 1160 | return ObjHeader::AsdlClass(74, 2);
|
| 1161 | }
|
| 1162 | BigStr* main_module;
|
| 1163 | List<Module*>* modules;
|
| 1164 |
|
| 1165 | DISALLOW_COPY_AND_ASSIGN(Program)
|
| 1166 | };
|
| 1167 |
|
| 1168 |
|
| 1169 | } // namespace yaks_asdl
|
| 1170 |
|
| 1171 | #endif // YAKS_ASDL
|