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 FailGlob;
|
22 | class RedirectEval;
|
23 | class FatalRuntime;
|
24 | class Strict;
|
25 | class ErrExit;
|
26 | class Expr;
|
27 | class Structured;
|
28 | class AssertionErr;
|
29 | class TypeErrVerbose;
|
30 | class TypeErr;
|
31 | class Runtime;
|
32 | class Decode;
|
33 | class Encode;
|
34 | }
|
35 |
|
36 | namespace error { // declare
|
37 |
|
38 | BigStr* _ValType(value_asdl::value_t* val);
|
39 | class _ErrorWithLocation {
|
40 | public:
|
41 | _ErrorWithLocation(BigStr* msg, syntax_asdl::loc_t* location);
|
42 | bool HasLocation();
|
43 | BigStr* UserErrorString();
|
44 | syntax_asdl::loc_t* location{};
|
45 | BigStr* msg{};
|
46 |
|
47 | static constexpr uint32_t field_mask() {
|
48 | return maskbit(offsetof(_ErrorWithLocation, location))
|
49 | | maskbit(offsetof(_ErrorWithLocation, msg));
|
50 | }
|
51 |
|
52 | static constexpr ObjHeader obj_header() {
|
53 | return ObjHeader::ClassFixed(field_mask(), sizeof(_ErrorWithLocation));
|
54 | }
|
55 |
|
56 | DISALLOW_COPY_AND_ASSIGN(_ErrorWithLocation)
|
57 | };
|
58 |
|
59 | class Usage : public ::error::_ErrorWithLocation {
|
60 | public:
|
61 | Usage(BigStr* msg, syntax_asdl::loc_t* location);
|
62 |
|
63 | static constexpr uint32_t field_mask() {
|
64 | return ::error::_ErrorWithLocation::field_mask();
|
65 | }
|
66 |
|
67 | static constexpr ObjHeader obj_header() {
|
68 | return ObjHeader::ClassFixed(field_mask(), sizeof(Usage));
|
69 | }
|
70 |
|
71 | DISALLOW_COPY_AND_ASSIGN(Usage)
|
72 | };
|
73 |
|
74 | class Parse : public ::error::_ErrorWithLocation {
|
75 | public:
|
76 | Parse(BigStr* msg, syntax_asdl::loc_t* location);
|
77 |
|
78 | static constexpr uint32_t field_mask() {
|
79 | return ::error::_ErrorWithLocation::field_mask();
|
80 | }
|
81 |
|
82 | static constexpr ObjHeader obj_header() {
|
83 | return ObjHeader::ClassFixed(field_mask(), sizeof(Parse));
|
84 | }
|
85 |
|
86 | DISALLOW_COPY_AND_ASSIGN(Parse)
|
87 | };
|
88 |
|
89 | class FailGlob : public ::error::_ErrorWithLocation {
|
90 | public:
|
91 | FailGlob(BigStr* msg, syntax_asdl::loc_t* location);
|
92 |
|
93 | static constexpr uint32_t field_mask() {
|
94 | return ::error::_ErrorWithLocation::field_mask();
|
95 | }
|
96 |
|
97 | static constexpr ObjHeader obj_header() {
|
98 | return ObjHeader::ClassFixed(field_mask(), sizeof(FailGlob));
|
99 | }
|
100 |
|
101 | DISALLOW_COPY_AND_ASSIGN(FailGlob)
|
102 | };
|
103 |
|
104 | class RedirectEval : public ::error::_ErrorWithLocation {
|
105 | public:
|
106 | RedirectEval(BigStr* msg, syntax_asdl::loc_t* location);
|
107 |
|
108 | static constexpr uint32_t field_mask() {
|
109 | return ::error::_ErrorWithLocation::field_mask();
|
110 | }
|
111 |
|
112 | static constexpr ObjHeader obj_header() {
|
113 | return ObjHeader::ClassFixed(field_mask(), sizeof(RedirectEval));
|
114 | }
|
115 |
|
116 | DISALLOW_COPY_AND_ASSIGN(RedirectEval)
|
117 | };
|
118 |
|
119 | class FatalRuntime : public ::error::_ErrorWithLocation {
|
120 | public:
|
121 | FatalRuntime(int exit_status, BigStr* msg, syntax_asdl::loc_t* location);
|
122 | int ExitStatus();
|
123 |
|
124 | int exit_status{};
|
125 |
|
126 | static constexpr uint32_t field_mask() {
|
127 | return ::error::_ErrorWithLocation::field_mask();
|
128 | }
|
129 |
|
130 | static constexpr ObjHeader obj_header() {
|
131 | return ObjHeader::ClassFixed(field_mask(), sizeof(FatalRuntime));
|
132 | }
|
133 |
|
134 | DISALLOW_COPY_AND_ASSIGN(FatalRuntime)
|
135 | };
|
136 |
|
137 | class Strict : public ::error::FatalRuntime {
|
138 | public:
|
139 | Strict(BigStr* msg, syntax_asdl::loc_t* location);
|
140 |
|
141 | static constexpr uint32_t field_mask() {
|
142 | return ::error::FatalRuntime::field_mask();
|
143 | }
|
144 |
|
145 | static constexpr ObjHeader obj_header() {
|
146 | return ObjHeader::ClassFixed(field_mask(), sizeof(Strict));
|
147 | }
|
148 |
|
149 | DISALLOW_COPY_AND_ASSIGN(Strict)
|
150 | };
|
151 |
|
152 | class ErrExit : public ::error::FatalRuntime {
|
153 | public:
|
154 | ErrExit(int exit_status, BigStr* msg, syntax_asdl::loc_t* location, bool show_code = false);
|
155 |
|
156 | bool show_code{};
|
157 |
|
158 | static constexpr uint32_t field_mask() {
|
159 | return ::error::FatalRuntime::field_mask();
|
160 | }
|
161 |
|
162 | static constexpr ObjHeader obj_header() {
|
163 | return ObjHeader::ClassFixed(field_mask(), sizeof(ErrExit));
|
164 | }
|
165 |
|
166 | DISALLOW_COPY_AND_ASSIGN(ErrExit)
|
167 | };
|
168 |
|
169 | class Expr : public ::error::FatalRuntime {
|
170 | public:
|
171 | Expr(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(Expr));
|
179 | }
|
180 |
|
181 | DISALLOW_COPY_AND_ASSIGN(Expr)
|
182 | };
|
183 |
|
184 | class Structured : public ::error::FatalRuntime {
|
185 | public:
|
186 | Structured(int status, BigStr* msg, syntax_asdl::loc_t* location, Dict<BigStr*, value_asdl::value_t*>* properties = nullptr);
|
187 | value::Dict* ToDict();
|
188 |
|
189 | Dict<BigStr*, value_asdl::value_t*>* properties{};
|
190 |
|
191 | static constexpr uint32_t field_mask() {
|
192 | return ::error::FatalRuntime::field_mask()
|
193 | | maskbit(offsetof(Structured, properties));
|
194 | }
|
195 |
|
196 | static constexpr ObjHeader obj_header() {
|
197 | return ObjHeader::ClassFixed(field_mask(), sizeof(Structured));
|
198 | }
|
199 |
|
200 | DISALLOW_COPY_AND_ASSIGN(Structured)
|
201 | };
|
202 |
|
203 | class AssertionErr : public ::error::Expr {
|
204 | public:
|
205 | AssertionErr(BigStr* msg, syntax_asdl::loc_t* location);
|
206 |
|
207 | static constexpr uint32_t field_mask() {
|
208 | return ::error::Expr::field_mask();
|
209 | }
|
210 |
|
211 | static constexpr ObjHeader obj_header() {
|
212 | return ObjHeader::ClassFixed(field_mask(), sizeof(AssertionErr));
|
213 | }
|
214 |
|
215 | DISALLOW_COPY_AND_ASSIGN(AssertionErr)
|
216 | };
|
217 |
|
218 | class TypeErrVerbose : public ::error::Expr {
|
219 | public:
|
220 | TypeErrVerbose(BigStr* msg, syntax_asdl::loc_t* location);
|
221 |
|
222 | static constexpr uint32_t field_mask() {
|
223 | return ::error::Expr::field_mask();
|
224 | }
|
225 |
|
226 | static constexpr ObjHeader obj_header() {
|
227 | return ObjHeader::ClassFixed(field_mask(), sizeof(TypeErrVerbose));
|
228 | }
|
229 |
|
230 | DISALLOW_COPY_AND_ASSIGN(TypeErrVerbose)
|
231 | };
|
232 |
|
233 | class TypeErr : public ::error::TypeErrVerbose {
|
234 | public:
|
235 | TypeErr(value_asdl::value_t* actual_val, BigStr* msg, syntax_asdl::loc_t* location);
|
236 |
|
237 | static constexpr uint32_t field_mask() {
|
238 | return ::error::TypeErrVerbose::field_mask();
|
239 | }
|
240 |
|
241 | static constexpr ObjHeader obj_header() {
|
242 | return ObjHeader::ClassFixed(field_mask(), sizeof(TypeErr));
|
243 | }
|
244 |
|
245 | DISALLOW_COPY_AND_ASSIGN(TypeErr)
|
246 | };
|
247 |
|
248 | class Runtime {
|
249 | public:
|
250 | Runtime(BigStr* msg);
|
251 | BigStr* UserErrorString();
|
252 | BigStr* msg{};
|
253 |
|
254 | static constexpr ObjHeader obj_header() {
|
255 | return ObjHeader::ClassScanned(1, sizeof(Runtime));
|
256 | }
|
257 |
|
258 | DISALLOW_COPY_AND_ASSIGN(Runtime)
|
259 | };
|
260 |
|
261 | class Decode {
|
262 | public:
|
263 | Decode(BigStr* msg, BigStr* s, int start_pos, int end_pos, int line_num);
|
264 | BigStr* Message();
|
265 | BigStr* __str__();
|
266 | BigStr* msg{};
|
267 | BigStr* s{};
|
268 | int start_pos{};
|
269 | int end_pos{};
|
270 | int line_num{};
|
271 |
|
272 | static constexpr ObjHeader obj_header() {
|
273 | return ObjHeader::ClassScanned(2, sizeof(Decode));
|
274 | }
|
275 |
|
276 | DISALLOW_COPY_AND_ASSIGN(Decode)
|
277 | };
|
278 |
|
279 | class Encode {
|
280 | public:
|
281 | Encode(BigStr* msg);
|
282 | BigStr* Message();
|
283 | BigStr* msg{};
|
284 |
|
285 | static constexpr ObjHeader obj_header() {
|
286 | return ObjHeader::ClassScanned(1, sizeof(Encode));
|
287 | }
|
288 |
|
289 | DISALLOW_COPY_AND_ASSIGN(Encode)
|
290 | };
|
291 |
|
292 | [[noreturn]] void e_usage(BigStr* msg, syntax_asdl::loc_t* location);
|
293 | [[noreturn]] void e_strict(BigStr* msg, syntax_asdl::loc_t* location);
|
294 | [[noreturn]] void p_die(BigStr* msg, syntax_asdl::loc_t* location);
|
295 | [[noreturn]] void e_die(BigStr* msg, syntax_asdl::loc_t* location = nullptr);
|
296 | [[noreturn]] void e_die_status(int status, BigStr* msg, syntax_asdl::loc_t* location = nullptr);
|
297 |
|
298 | } // declare namespace error
|
299 |
|
300 | #endif // CORE_ERROR_MYCPP_H
|