OILS / prebuilt / core / error.mycpp.h View on Github | oilshell.org

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