| 1 | // _gen/asdl/examples/shared_variant.asdl.h is generated by asdl_main.py
|
| 2 |
|
| 3 | #ifndef SHARED_VARIANT_ASDL
|
| 4 | #define SHARED_VARIANT_ASDL
|
| 5 |
|
| 6 | #include <cstdint>
|
| 7 | #include "mycpp/runtime.h"
|
| 8 |
|
| 9 | #include "asdl/cpp_runtime.h"
|
| 10 | namespace shared_variant_asdl {
|
| 11 |
|
| 12 | // use struct instead of namespace so 'using' works consistently
|
| 13 | #define ASDL_NAMES struct
|
| 14 |
|
| 15 | class prod;
|
| 16 | class DoubleQuoted;
|
| 17 | class expr_t;
|
| 18 | class Token;
|
| 19 | class tok_t;
|
| 20 | class tok_struct;
|
| 21 | class tok_array;
|
| 22 | class word_part_t;
|
| 23 | class cflow_t;
|
| 24 |
|
| 25 | ASDL_NAMES expr_e {
|
| 26 | enum no_name {
|
| 27 | Binary = 1,
|
| 28 | DoubleQuoted = 65,
|
| 29 | };
|
| 30 | };
|
| 31 |
|
| 32 | BigStr* expr_str(int tag, bool dot = true);
|
| 33 |
|
| 34 | class expr_t {
|
| 35 | protected:
|
| 36 | expr_t() {
|
| 37 | }
|
| 38 | public:
|
| 39 | int tag() const {
|
| 40 | return ObjHeader::FromObject(this)->type_tag;
|
| 41 | }
|
| 42 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 43 |
|
| 44 | DISALLOW_COPY_AND_ASSIGN(expr_t)
|
| 45 | };
|
| 46 |
|
| 47 | class expr__Binary : public expr_t {
|
| 48 | public:
|
| 49 | expr__Binary(expr_t* left, expr_t* right)
|
| 50 | : left(left),
|
| 51 | right(right) {
|
| 52 | }
|
| 53 |
|
| 54 | static expr__Binary* CreateNull(bool alloc_lists = false) {
|
| 55 | return Alloc<expr__Binary>(nullptr, nullptr);
|
| 56 | }
|
| 57 |
|
| 58 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 59 |
|
| 60 | static constexpr ObjHeader obj_header() {
|
| 61 | return ObjHeader::AsdlClass(static_cast<uint16_t>(expr_e::Binary), 2);
|
| 62 | }
|
| 63 | expr_t* left;
|
| 64 | expr_t* right;
|
| 65 |
|
| 66 | DISALLOW_COPY_AND_ASSIGN(expr__Binary)
|
| 67 | };
|
| 68 |
|
| 69 | ASDL_NAMES expr {
|
| 70 | typedef expr__Binary Binary;
|
| 71 | };
|
| 72 |
|
| 73 | ASDL_NAMES tok_e {
|
| 74 | enum no_name {
|
| 75 | Eof = 1,
|
| 76 | Token = 66,
|
| 77 | };
|
| 78 | };
|
| 79 |
|
| 80 | BigStr* tok_str(int tag, bool dot = true);
|
| 81 |
|
| 82 | class tok_t {
|
| 83 | protected:
|
| 84 | tok_t() {
|
| 85 | }
|
| 86 | public:
|
| 87 | int tag() const {
|
| 88 | return ObjHeader::FromObject(this)->type_tag;
|
| 89 | }
|
| 90 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 91 |
|
| 92 | DISALLOW_COPY_AND_ASSIGN(tok_t)
|
| 93 | };
|
| 94 |
|
| 95 | class tok__Eof : public tok_t {
|
| 96 | public:
|
| 97 | tok__Eof() {}
|
| 98 |
|
| 99 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 100 |
|
| 101 | static constexpr ObjHeader obj_header() {
|
| 102 | return ObjHeader::AsdlClass(static_cast<uint16_t>(tok_e::Eof), 0);
|
| 103 | }
|
| 104 |
|
| 105 | DISALLOW_COPY_AND_ASSIGN(tok__Eof)
|
| 106 | };
|
| 107 |
|
| 108 | extern GcGlobal<tok__Eof> gtok__Eof;
|
| 109 | ASDL_NAMES tok {
|
| 110 | static tok__Eof* Eof;
|
| 111 | };
|
| 112 |
|
| 113 | ASDL_NAMES word_part_e {
|
| 114 | enum no_name {
|
| 115 | Literal = 1,
|
| 116 | DoubleQuoted = 65,
|
| 117 | };
|
| 118 | };
|
| 119 |
|
| 120 | BigStr* word_part_str(int tag, bool dot = true);
|
| 121 |
|
| 122 | class word_part_t {
|
| 123 | protected:
|
| 124 | word_part_t() {
|
| 125 | }
|
| 126 | public:
|
| 127 | int tag() const {
|
| 128 | return ObjHeader::FromObject(this)->type_tag;
|
| 129 | }
|
| 130 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 131 |
|
| 132 | DISALLOW_COPY_AND_ASSIGN(word_part_t)
|
| 133 | };
|
| 134 |
|
| 135 | class word_part__Literal : public word_part_t {
|
| 136 | public:
|
| 137 | word_part__Literal(BigStr* s)
|
| 138 | : s(s) {
|
| 139 | }
|
| 140 |
|
| 141 | static word_part__Literal* CreateNull(bool alloc_lists = false) {
|
| 142 | return Alloc<word_part__Literal>(kEmptyString);
|
| 143 | }
|
| 144 |
|
| 145 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 146 |
|
| 147 | static constexpr ObjHeader obj_header() {
|
| 148 | return ObjHeader::AsdlClass(static_cast<uint16_t>(word_part_e::Literal), 1);
|
| 149 | }
|
| 150 | BigStr* s;
|
| 151 |
|
| 152 | DISALLOW_COPY_AND_ASSIGN(word_part__Literal)
|
| 153 | };
|
| 154 |
|
| 155 | ASDL_NAMES word_part {
|
| 156 | typedef word_part__Literal Literal;
|
| 157 | };
|
| 158 |
|
| 159 | ASDL_NAMES cflow_e {
|
| 160 | enum no_name {
|
| 161 | Break = 1,
|
| 162 | Continue = 2,
|
| 163 | Return = 3,
|
| 164 | };
|
| 165 | };
|
| 166 |
|
| 167 | BigStr* cflow_str(int tag, bool dot = true);
|
| 168 |
|
| 169 | class cflow_t {
|
| 170 | protected:
|
| 171 | cflow_t() {
|
| 172 | }
|
| 173 | public:
|
| 174 | int tag() const {
|
| 175 | return ObjHeader::FromObject(this)->type_tag;
|
| 176 | }
|
| 177 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 178 |
|
| 179 | DISALLOW_COPY_AND_ASSIGN(cflow_t)
|
| 180 | };
|
| 181 |
|
| 182 | class cflow__Break : public cflow_t {
|
| 183 | public:
|
| 184 | cflow__Break() {}
|
| 185 |
|
| 186 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 187 |
|
| 188 | static constexpr ObjHeader obj_header() {
|
| 189 | return ObjHeader::AsdlClass(static_cast<uint16_t>(cflow_e::Break), 0);
|
| 190 | }
|
| 191 |
|
| 192 | DISALLOW_COPY_AND_ASSIGN(cflow__Break)
|
| 193 | };
|
| 194 |
|
| 195 | class cflow__Continue : public cflow_t {
|
| 196 | public:
|
| 197 | cflow__Continue() {}
|
| 198 |
|
| 199 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 200 |
|
| 201 | static constexpr ObjHeader obj_header() {
|
| 202 | return ObjHeader::AsdlClass(static_cast<uint16_t>(cflow_e::Continue), 0);
|
| 203 | }
|
| 204 |
|
| 205 | DISALLOW_COPY_AND_ASSIGN(cflow__Continue)
|
| 206 | };
|
| 207 |
|
| 208 | class cflow__Return : public cflow_t {
|
| 209 | public:
|
| 210 | cflow__Return(int val)
|
| 211 | : val(val) {
|
| 212 | }
|
| 213 |
|
| 214 | static cflow__Return* CreateNull(bool alloc_lists = false) {
|
| 215 | return Alloc<cflow__Return>(-1);
|
| 216 | }
|
| 217 |
|
| 218 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 219 |
|
| 220 | static constexpr ObjHeader obj_header() {
|
| 221 | return ObjHeader::AsdlClass(static_cast<uint16_t>(cflow_e::Return), 0);
|
| 222 | }
|
| 223 | int val;
|
| 224 |
|
| 225 | DISALLOW_COPY_AND_ASSIGN(cflow__Return)
|
| 226 | };
|
| 227 |
|
| 228 | extern GcGlobal<cflow__Break> gcflow__Break;
|
| 229 | extern GcGlobal<cflow__Continue> gcflow__Continue;
|
| 230 | ASDL_NAMES cflow {
|
| 231 | static cflow__Break* Break;
|
| 232 | static cflow__Continue* Continue;
|
| 233 | typedef cflow__Return Return;
|
| 234 | };
|
| 235 |
|
| 236 | class prod {
|
| 237 | public:
|
| 238 | prod(BigStr* a, BigStr* b)
|
| 239 | : a(a),
|
| 240 | b(b) {
|
| 241 | }
|
| 242 |
|
| 243 | static prod* CreateNull(bool alloc_lists = false) {
|
| 244 | return Alloc<prod>(kEmptyString, kEmptyString);
|
| 245 | }
|
| 246 |
|
| 247 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 248 |
|
| 249 | static constexpr ObjHeader obj_header() {
|
| 250 | return ObjHeader::AsdlClass(64, 2);
|
| 251 | }
|
| 252 | BigStr* a;
|
| 253 | BigStr* b;
|
| 254 |
|
| 255 | DISALLOW_COPY_AND_ASSIGN(prod)
|
| 256 | };
|
| 257 |
|
| 258 | class DoubleQuoted : public expr_t, public word_part_t {
|
| 259 | public:
|
| 260 | DoubleQuoted(int left, List<BigStr*>* tokens)
|
| 261 | : tokens(tokens),
|
| 262 | left(left) {
|
| 263 | }
|
| 264 |
|
| 265 | static DoubleQuoted* CreateNull(bool alloc_lists = false) {
|
| 266 | return Alloc<DoubleQuoted>(-1, alloc_lists ? Alloc<List<BigStr*>>() :
|
| 267 | nullptr);
|
| 268 | }
|
| 269 |
|
| 270 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 271 |
|
| 272 | static constexpr ObjHeader obj_header() {
|
| 273 | return ObjHeader::AsdlClass(65, 1);
|
| 274 | }
|
| 275 | List<BigStr*>* tokens;
|
| 276 | int left;
|
| 277 |
|
| 278 | DISALLOW_COPY_AND_ASSIGN(DoubleQuoted)
|
| 279 | };
|
| 280 |
|
| 281 | class Token : public tok_t {
|
| 282 | public:
|
| 283 | Token(int id, BigStr* val)
|
| 284 | : val(val),
|
| 285 | id(id) {
|
| 286 | }
|
| 287 |
|
| 288 | static Token* CreateNull(bool alloc_lists = false) {
|
| 289 | return Alloc<Token>(-1, kEmptyString);
|
| 290 | }
|
| 291 |
|
| 292 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 293 |
|
| 294 | static constexpr ObjHeader obj_header() {
|
| 295 | return ObjHeader::AsdlClass(66, 1);
|
| 296 | }
|
| 297 | BigStr* val;
|
| 298 | int id;
|
| 299 |
|
| 300 | DISALLOW_COPY_AND_ASSIGN(Token)
|
| 301 | };
|
| 302 |
|
| 303 | class tok_struct {
|
| 304 | public:
|
| 305 | tok_struct(tok_t* token, int x)
|
| 306 | : token(token),
|
| 307 | x(x) {
|
| 308 | }
|
| 309 |
|
| 310 | static tok_struct* CreateNull(bool alloc_lists = false) {
|
| 311 | return Alloc<tok_struct>(nullptr, -1);
|
| 312 | }
|
| 313 |
|
| 314 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 315 |
|
| 316 | static constexpr ObjHeader obj_header() {
|
| 317 | return ObjHeader::AsdlClass(67, 1);
|
| 318 | }
|
| 319 | tok_t* token;
|
| 320 | int x;
|
| 321 |
|
| 322 | DISALLOW_COPY_AND_ASSIGN(tok_struct)
|
| 323 | };
|
| 324 |
|
| 325 | class tok_array {
|
| 326 | public:
|
| 327 | tok_array(List<tok_t*>* tokens)
|
| 328 | : tokens(tokens) {
|
| 329 | }
|
| 330 |
|
| 331 | static tok_array* CreateNull(bool alloc_lists = false) {
|
| 332 | return Alloc<tok_array>(alloc_lists ? Alloc<List<tok_t*>>() : nullptr);
|
| 333 | }
|
| 334 |
|
| 335 | hnode_t* PrettyTree(bool do_abbrev, Dict<int, bool>* seen = nullptr);
|
| 336 |
|
| 337 | static constexpr ObjHeader obj_header() {
|
| 338 | return ObjHeader::AsdlClass(68, 1);
|
| 339 | }
|
| 340 | List<tok_t*>* tokens;
|
| 341 |
|
| 342 | DISALLOW_COPY_AND_ASSIGN(tok_array)
|
| 343 | };
|
| 344 |
|
| 345 |
|
| 346 | } // namespace shared_variant_asdl
|
| 347 |
|
| 348 | #endif // SHARED_VARIANT_ASDL
|