OILS / _gen / asdl / examples / demo_lib.asdl.h View on Github | oils.pub

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