| 1 | // _gen/asdl/examples/demo_lib.asdl.h is generated by asdl_main.py
|
| 2 |
|
| 3 | #ifndef DEMO_LIB_ASDL
|
| 4 | #define DEMO_LIB_ASDL
|
| 5 |
|
| 6 | #include <cstdint>
|
| 7 |
|
| 8 | #include "mycpp/runtime.h"
|
| 9 | #include "asdl/cpp_runtime.h"
|
| 10 | namespace demo_lib_asdl {
|
| 11 |
|
| 12 | // use struct instead of namespace so 'using' works consistently
|
| 13 | #define ASDL_NAMES struct
|
| 14 |
|
| 15 | class value_t;
|
| 16 | class t2;
|
| 17 | class t3;
|
| 18 | class t4;
|
| 19 | class LibToken;
|
| 20 |
|
| 21 | ASDL_NAMES value_e {
|
| 22 | enum no_name {
|
| 23 | Str = 1,
|
| 24 | Array = 2,
|
| 25 | };
|
| 26 | };
|
| 27 |
|
| 28 | BigStr* value_str(int tag, bool dot = true);
|
| 29 |
|
| 30 | class value_t {
|
| 31 | protected:
|
| 32 | value_t() {
|
| 33 | }
|
| 34 | public:
|
| 35 | int tag() const {
|
| 36 | return ObjHeader::FromObject(this)->type_tag;
|
| 37 | }
|
| 38 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 39 |
|
| 40 | DISALLOW_COPY_AND_ASSIGN(value_t)
|
| 41 | };
|
| 42 |
|
| 43 | class value__Str : public value_t {
|
| 44 | public:
|
| 45 | value__Str() {}
|
| 46 |
|
| 47 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 48 |
|
| 49 | static constexpr ObjHeader obj_header() {
|
| 50 | return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Str), 0);
|
| 51 | }
|
| 52 |
|
| 53 | DISALLOW_COPY_AND_ASSIGN(value__Str)
|
| 54 | };
|
| 55 |
|
| 56 | class value__Array : public value_t {
|
| 57 | public:
|
| 58 | value__Array(int a)
|
| 59 | : a(a) {
|
| 60 | }
|
| 61 |
|
| 62 | static value__Array* CreateNull(bool alloc_lists = false) {
|
| 63 | return Alloc<value__Array>(-1);
|
| 64 | }
|
| 65 |
|
| 66 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 67 |
|
| 68 | static constexpr ObjHeader obj_header() {
|
| 69 | return ObjHeader::AsdlClass(static_cast<uint16_t>(value_e::Array), 0);
|
| 70 | }
|
| 71 | int a;
|
| 72 |
|
| 73 | DISALLOW_COPY_AND_ASSIGN(value__Array)
|
| 74 | };
|
| 75 |
|
| 76 | extern GcGlobal<value__Str> gvalue__Str;
|
| 77 | ASDL_NAMES value {
|
| 78 | static value__Str* Str;
|
| 79 | typedef value__Array Array;
|
| 80 | };
|
| 81 |
|
| 82 | class t2 {
|
| 83 | public:
|
| 84 | t2(int a, int b)
|
| 85 | : a(a),
|
| 86 | b(b) {
|
| 87 | }
|
| 88 |
|
| 89 | static t2* CreateNull(bool alloc_lists = false) {
|
| 90 | return Alloc<t2>(-1, -1);
|
| 91 | }
|
| 92 |
|
| 93 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 94 |
|
| 95 | static constexpr ObjHeader obj_header() {
|
| 96 | return ObjHeader::AsdlClass(64, 0);
|
| 97 | }
|
| 98 | int a;
|
| 99 | int b;
|
| 100 |
|
| 101 | DISALLOW_COPY_AND_ASSIGN(t2)
|
| 102 | };
|
| 103 |
|
| 104 | class t3 {
|
| 105 | public:
|
| 106 | t3(int a, int b)
|
| 107 | : a(a),
|
| 108 | b(b) {
|
| 109 | }
|
| 110 |
|
| 111 | static t3* CreateNull(bool alloc_lists = false) {
|
| 112 | return Alloc<t3>(-1, -1);
|
| 113 | }
|
| 114 |
|
| 115 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 116 |
|
| 117 | static constexpr ObjHeader obj_header() {
|
| 118 | return ObjHeader::AsdlClass(65, 0);
|
| 119 | }
|
| 120 | int a;
|
| 121 | int b;
|
| 122 |
|
| 123 | DISALLOW_COPY_AND_ASSIGN(t3)
|
| 124 | };
|
| 125 |
|
| 126 | class t4 {
|
| 127 | public:
|
| 128 | t4(int a, int b)
|
| 129 | : a(a),
|
| 130 | b(b) {
|
| 131 | }
|
| 132 |
|
| 133 | static t4* CreateNull(bool alloc_lists = false) {
|
| 134 | return Alloc<t4>(-1, -1);
|
| 135 | }
|
| 136 |
|
| 137 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 138 |
|
| 139 | static constexpr ObjHeader obj_header() {
|
| 140 | return ObjHeader::AsdlClass(66, 0);
|
| 141 | }
|
| 142 | int a;
|
| 143 | int b;
|
| 144 |
|
| 145 | DISALLOW_COPY_AND_ASSIGN(t4)
|
| 146 | };
|
| 147 |
|
| 148 | class LibToken {
|
| 149 | public:
|
| 150 | LibToken(BigStr* s, int i)
|
| 151 | : s(s),
|
| 152 | i(i) {
|
| 153 | }
|
| 154 |
|
| 155 | static LibToken* CreateNull(bool alloc_lists = false) {
|
| 156 | return Alloc<LibToken>(kEmptyString, -1);
|
| 157 | }
|
| 158 |
|
| 159 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 160 |
|
| 161 | static constexpr ObjHeader obj_header() {
|
| 162 | return ObjHeader::AsdlClass(67, 1);
|
| 163 | }
|
| 164 | BigStr* s;
|
| 165 | int i;
|
| 166 |
|
| 167 | DISALLOW_COPY_AND_ASSIGN(LibToken)
|
| 168 | };
|
| 169 |
|
| 170 |
|
| 171 | } // namespace demo_lib_asdl
|
| 172 |
|
| 173 | #endif // DEMO_LIB_ASDL
|