1 | // prebuilt/core/error.mycpp.h: GENERATED by mycpp
|
2 |
|
3 | #ifndef CORE_ERROR_MYCPP_H
|
4 | #define CORE_ERROR_MYCPP_H
|
5 |
|
6 | #include "_gen/asdl/hnode.asdl.h"
|
7 | #include "_gen/display/pretty.asdl.h"
|
8 | #include "cpp/data_lang.h"
|
9 | #include "mycpp/runtime.h"
|
10 |
|
11 | #include "_gen/core/runtime.asdl.h"
|
12 | #include "_gen/core/value.asdl.h"
|
13 | #include "_gen/frontend/syntax.asdl.h"
|
14 |
|
15 | using value_asdl::value; // This is a bit ad hoc
|
16 |
|
17 | namespace error { // forward declare
|
18 | class _ErrorWithLocation;
|
19 | class Usage;
|
20 | class Parse;
|
21 | class WordFailure;
|
22 | class FailGlob;
|
23 | class VarSubFailure;
|
24 | class RedirectEval;
|
25 | class FatalRuntime;
|
26 | class Strict;
|
27 | class ErrExit;
|
28 | class Expr;
|
29 | class Structured;
|
30 | class AssertionErr;
|
31 | class TypeErrVerbose;
|
32 | class TypeErr;
|
33 | class Runtime;
|
34 | class Decode;
|
35 | class Encode;
|
36 | }
|
37 |
|
38 | namespace error { // declare
|
39 |
|
40 | BigStr* _ValType(value_asdl::value_t* val);
|
41 | class _ErrorWithLocation {
|
42 | public:
|
43 | _ErrorWithLocation(BigStr* msg, syntax_asdl::loc_t* location);
|
44 | bool HasLocation();
|
45 | BigStr* UserErrorString();
|
46 | syntax_asdl::loc_t* location{};
|
47 | BigStr* msg{};
|
48 |
|
49 | static constexpr uint32_t field_mask() {
|
50 | return maskbit(offsetof(_ErrorWithLocation, location))
|
51 | | maskbit(offsetof(_ErrorWithLocation, msg));
|
52 | }
|
53 |
|
54 | static constexpr ObjHeader obj_header() {
|
55 | return ObjHeader::ClassFixed(field_mask(), sizeof(_ErrorWithLocation));
|
56 | }
|
57 |
|
58 | DISALLOW_COPY_AND_ASSIGN(_ErrorWithLocation)
|
59 | };
|
60 |
|
61 | class Usage : public ::error::_ErrorWithLocation {
|
62 | public:
|
63 | Usage(BigStr* msg, syntax_asdl::loc_t* location);
|
64 |
|
65 | static constexpr uint32_t field_mask() {
|
66 | return ::error::_ErrorWithLocation::field_mask();
|
67 | }
|
68 |
|
69 | static constexpr ObjHeader obj_header() {
|
70 | return ObjHeader::ClassFixed(field_mask(), sizeof(Usage));
|
71 | }
|
72 |
|
73 | DISALLOW_COPY_AND_ASSIGN(Usage)
|
74 | };
|
75 |
|
76 | class Parse : public ::error::_ErrorWithLocation {
|
77 | public:
|
78 | Parse(BigStr* msg, syntax_asdl::loc_t* location);
|
79 |
|
80 | static constexpr uint32_t field_mask() {
|
81 | return ::error::_ErrorWithLocation::field_mask();
|
82 | }
|
83 |
|
84 | static constexpr ObjHeader obj_header() {
|
85 | return ObjHeader::ClassFixed(field_mask(), sizeof(Parse));
|
86 | }
|
87 |
|
88 | DISALLOW_COPY_AND_ASSIGN(Parse)
|
89 | };
|
90 |
|
91 | class WordFailure : public ::error::_ErrorWithLocation {
|
92 | public:
|
93 | WordFailure(BigStr* msg, syntax_asdl::loc_t* location);
|
94 |
|
95 | static constexpr uint32_t field_mask() {
|
96 | return ::error::_ErrorWithLocation::field_mask();
|
97 | }
|
98 |
|
99 | static constexpr ObjHeader obj_header() {
|
100 | return ObjHeader::ClassFixed(field_mask(), sizeof(WordFailure));
|
101 | }
|
102 |
|
103 | DISALLOW_COPY_AND_ASSIGN(WordFailure)
|
104 | };
|
105 |
|
106 | class FailGlob : public ::error::WordFailure {
|
107 | public:
|
108 | FailGlob(BigStr* msg, syntax_asdl::loc_t* location);
|
109 |
|
110 | static constexpr uint32_t field_mask() {
|
111 | return ::error::WordFailure::field_mask();
|
112 | }
|
113 |
|
114 | static constexpr ObjHeader obj_header() {
|
115 | return ObjHeader::ClassFixed(field_mask(), sizeof(FailGlob));
|
116 | }
|
117 |
|
118 | DISALLOW_COPY_AND_ASSIGN(FailGlob)
|
119 | };
|
120 |
|
121 | class VarSubFailure : public ::error::WordFailure {
|
122 | public:
|
123 | VarSubFailure(BigStr* msg, syntax_asdl::loc_t* location);
|
124 |
|
125 | static constexpr uint32_t field_mask() {
|
126 | return ::error::WordFailure::field_mask();
|
127 | }
|
128 |
|
129 | static constexpr ObjHeader obj_header() {
|
130 | return ObjHeader::ClassFixed(field_mask(), sizeof(VarSubFailure));
|
131 | }
|
132 |
|
133 | DISALLOW_COPY_AND_ASSIGN(VarSubFailure)
|
134 | };
|
135 |
|
136 | class RedirectEval : public ::error::_ErrorWithLocation {
|
137 | public:
|
138 | RedirectEval(BigStr* msg, syntax_asdl::loc_t* location);
|
139 |
|
140 | static constexpr uint32_t field_mask() {
|
141 | return ::error::_ErrorWithLocation::field_mask();
|
142 | }
|
143 |
|
144 | static constexpr ObjHeader obj_header() {
|
145 | return ObjHeader::ClassFixed(field_mask(), sizeof(RedirectEval));
|
146 | }
|
147 |
|
148 | DISALLOW_COPY_AND_ASSIGN(RedirectEval)
|
149 | };
|
150 |
|
151 | class FatalRuntime : public ::error::_ErrorWithLocation {
|
152 | public:
|
153 | FatalRuntime(int exit_status, BigStr* msg, syntax_asdl::loc_t* location);
|
154 | int ExitStatus();
|
155 |
|
156 | int exit_status{};
|
157 |
|
158 | static constexpr uint32_t field_mask() {
|
159 | return ::error::_ErrorWithLocation::field_mask();
|
160 | }
|
161 |
|
162 | static constexpr ObjHeader obj_header() {
|
163 | return ObjHeader::ClassFixed(field_mask(), sizeof(FatalRuntime));
|
164 | }
|
165 |
|
166 | DISALLOW_COPY_AND_ASSIGN(FatalRuntime)
|
167 | };
|
168 |
|
169 | class Strict : public ::error::FatalRuntime {
|
170 | public:
|
171 | Strict(BigStr* msg, syntax_asdl::loc_t* location);
|
172 |
|
173 | static constexpr uint32_t field_mask() {
|
174 | return ::error::FatalRuntime::field_mask();
|
175 | }
|
176 |
|
177 | static constexpr ObjHeader obj_header() {
|
178 | return ObjHeader::ClassFixed(field_mask(), sizeof(Strict));
|
179 | }
|
180 |
|
181 | DISALLOW_COPY_AND_ASSIGN(Strict)
|
182 | };
|
183 |
|
184 | class ErrExit : public ::error::FatalRuntime {
|
185 | public:
|
186 | ErrExit(int exit_status, BigStr* msg, syntax_asdl::loc_t* location, bool show_code = false);
|
187 |
|
188 | bool show_code{};
|
189 |
|
190 | static constexpr uint32_t field_mask() {
|
191 | return ::error::FatalRuntime::field_mask();
|
192 | }
|
193 |
|
194 | static constexpr ObjHeader obj_header() {
|
195 | return ObjHeader::ClassFixed(field_mask(), sizeof(ErrExit));
|
196 | }
|
197 |
|
198 | DISALLOW_COPY_AND_ASSIGN(ErrExit)
|
199 | };
|
200 |
|
201 | class Expr : public ::error::FatalRuntime {
|
202 | public:
|
203 | Expr(BigStr* msg, syntax_asdl::loc_t* location);
|
204 |
|
205 | static constexpr uint32_t field_mask() {
|
206 | return ::error::FatalRuntime::field_mask();
|
207 | }
|
208 |
|
209 | static constexpr ObjHeader obj_header() {
|
210 | return ObjHeader::ClassFixed(field_mask(), sizeof(Expr));
|
211 | }
|
212 |
|
213 | DISALLOW_COPY_AND_ASSIGN(Expr)
|
214 | };
|
215 |
|
216 | class Structured : public ::error::FatalRuntime {
|
217 | public:
|
218 | Structured(int status, BigStr* msg, syntax_asdl::loc_t* location, Dict<BigStr*, value_asdl::value_t*>* properties = nullptr);
|
219 | value::Dict* ToDict();
|
220 |
|
221 | Dict<BigStr*, value_asdl::value_t*>* properties{};
|
222 |
|
223 | static constexpr uint32_t field_mask() {
|
224 | return ::error::FatalRuntime::field_mask()
|
225 | | maskbit(offsetof(Structured, properties));
|
226 | }
|
227 |
|
228 | static constexpr ObjHeader obj_header() {
|
229 | return ObjHeader::ClassFixed(field_mask(), sizeof(Structured));
|
230 | }
|
231 |
|
232 | DISALLOW_COPY_AND_ASSIGN(Structured)
|
233 | };
|
234 |
|
235 | class AssertionErr : public ::error::Expr {
|
236 | public:
|
237 | AssertionErr(BigStr* msg, syntax_asdl::loc_t* location);
|
238 |
|
239 | static constexpr uint32_t field_mask() {
|
240 | return ::error::Expr::field_mask();
|
241 | }
|
242 |
|
243 | static constexpr ObjHeader obj_header() {
|
244 | return ObjHeader::ClassFixed(field_mask(), sizeof(AssertionErr));
|
245 | }
|
246 |
|
247 | DISALLOW_COPY_AND_ASSIGN(AssertionErr)
|
248 | };
|
249 |
|
250 | class TypeErrVerbose : public ::error::Expr {
|
251 | public:
|
252 | TypeErrVerbose(BigStr* msg, syntax_asdl::loc_t* location);
|
253 |
|
254 | static constexpr uint32_t field_mask() {
|
255 | return ::error::Expr::field_mask();
|
256 | }
|
257 |
|
258 | static constexpr ObjHeader obj_header() {
|
259 | return ObjHeader::ClassFixed(field_mask(), sizeof(TypeErrVerbose));
|
260 | }
|
261 |
|
262 | DISALLOW_COPY_AND_ASSIGN(TypeErrVerbose)
|
263 | };
|
264 |
|
265 | class TypeErr : public ::error::TypeErrVerbose {
|
266 | public:
|
267 | TypeErr(value_asdl::value_t* actual_val, BigStr* msg, syntax_asdl::loc_t* location);
|
268 |
|
269 | static constexpr uint32_t field_mask() {
|
270 | return ::error::TypeErrVerbose::field_mask();
|
271 | }
|
272 |
|
273 | static constexpr ObjHeader obj_header() {
|
274 | return ObjHeader::ClassFixed(field_mask(), sizeof(TypeErr));
|
275 | }
|
276 |
|
277 | DISALLOW_COPY_AND_ASSIGN(TypeErr)
|
278 | };
|
279 |
|
280 | class Runtime {
|
281 | public:
|
282 | Runtime(BigStr* msg);
|
283 | BigStr* UserErrorString();
|
284 | BigStr* msg{};
|
285 |
|
286 | static constexpr ObjHeader obj_header() {
|
287 | return ObjHeader::ClassScanned(1, sizeof(Runtime));
|
288 | }
|
289 |
|
290 | DISALLOW_COPY_AND_ASSIGN(Runtime)
|
291 | };
|
292 |
|
293 | class Decode {
|
294 | public:
|
295 | Decode(BigStr* msg, BigStr* s, int start_pos, int end_pos, int line_num);
|
296 | BigStr* Message();
|
297 | BigStr* __str__();
|
298 | BigStr* msg{};
|
299 | BigStr* s{};
|
300 | int start_pos{};
|
301 | int end_pos{};
|
302 | int line_num{};
|
303 |
|
304 | static constexpr ObjHeader obj_header() {
|
305 | return ObjHeader::ClassScanned(2, sizeof(Decode));
|
306 | }
|
307 |
|
308 | DISALLOW_COPY_AND_ASSIGN(Decode)
|
309 | };
|
310 |
|
311 | class Encode {
|
312 | public:
|
313 | Encode(BigStr* msg);
|
314 | BigStr* Message();
|
315 | BigStr* msg{};
|
316 |
|
317 | static constexpr ObjHeader obj_header() {
|
318 | return ObjHeader::ClassScanned(1, sizeof(Encode));
|
319 | }
|
320 |
|
321 | DISALLOW_COPY_AND_ASSIGN(Encode)
|
322 | };
|
323 |
|
324 | [[noreturn]] void e_usage(BigStr* msg, syntax_asdl::loc_t* location);
|
325 | [[noreturn]] void e_strict(BigStr* msg, syntax_asdl::loc_t* location);
|
326 | [[noreturn]] void p_die(BigStr* msg, syntax_asdl::loc_t* location);
|
327 | [[noreturn]] void e_die(BigStr* msg, syntax_asdl::loc_t* location = nullptr);
|
328 | [[noreturn]] void e_die_status(int status, BigStr* msg, syntax_asdl::loc_t* location = nullptr);
|
329 |
|
330 | } // declare namespace error
|
331 |
|
332 | #endif // CORE_ERROR_MYCPP_H
|