OILS / _devbuild / gen / arg_types.py View on Github | oilshell.org

368 lines, 242 significant
1
2from _devbuild.gen.value_asdl import value, value_e, value_t
3from frontend.args import _Attributes
4from mycpp import mops
5from typing import cast, Dict, Optional
6
7
8class cd(object):
9 def __init__(self, attrs):
10 # type: (Dict[str, value_t]) -> None
11
12 self.L = cast(value.Bool, attrs['L']).b # type: bool
13 self.P = cast(value.Bool, attrs['P']).b # type: bool
14
15
16class command(object):
17 def __init__(self, attrs):
18 # type: (Dict[str, value_t]) -> None
19
20 self.V = cast(value.Bool, attrs['V']).b # type: bool
21 self.p = cast(value.Bool, attrs['p']).b # type: bool
22 self.v = cast(value.Bool, attrs['v']).b # type: bool
23
24
25class compadjust(object):
26 def __init__(self, attrs):
27 # type: (Dict[str, value_t]) -> None
28
29 val0 = attrs['n']
30 self.n = None if val0.tag() == value_e.Undef else cast(value.Str, val0).s # type: Optional[str]
31 self.s = cast(value.Bool, attrs['s']).b # type: bool
32
33
34class compexport(object):
35 def __init__(self, attrs):
36 # type: (Dict[str, value_t]) -> None
37
38 val0 = attrs['begin']
39 self.begin = mops.BigInt(-1) if val0.tag() == value_e.Undef else cast(value.Int, val0).i # type: mops.BigInt
40 val1 = attrs['c']
41 self.c = None if val1.tag() == value_e.Undef else cast(value.Str, val1).s # type: Optional[str]
42 val2 = attrs['end']
43 self.end = mops.BigInt(-1) if val2.tag() == value_e.Undef else cast(value.Int, val2).i # type: mops.BigInt
44 val3 = attrs['format']
45 self.format = None if val3.tag() == value_e.Undef else cast(value.Str, val3).s # type: Optional[str]
46
47
48class compgen(object):
49 def __init__(self, attrs):
50 # type: (Dict[str, value_t]) -> None
51
52 val0 = attrs['C']
53 self.C = None if val0.tag() == value_e.Undef else cast(value.Str, val0).s # type: Optional[str]
54 val1 = attrs['F']
55 self.F = None if val1.tag() == value_e.Undef else cast(value.Str, val1).s # type: Optional[str]
56 val2 = attrs['P']
57 self.P = None if val2.tag() == value_e.Undef else cast(value.Str, val2).s # type: Optional[str]
58 val3 = attrs['S']
59 self.S = None if val3.tag() == value_e.Undef else cast(value.Str, val3).s # type: Optional[str]
60 val4 = attrs['W']
61 self.W = None if val4.tag() == value_e.Undef else cast(value.Str, val4).s # type: Optional[str]
62 val5 = attrs['X']
63 self.X = None if val5.tag() == value_e.Undef else cast(value.Str, val5).s # type: Optional[str]
64
65
66class complete(object):
67 def __init__(self, attrs):
68 # type: (Dict[str, value_t]) -> None
69
70 val0 = attrs['C']
71 self.C = None if val0.tag() == value_e.Undef else cast(value.Str, val0).s # type: Optional[str]
72 self.D = cast(value.Bool, attrs['D']).b # type: bool
73 self.E = cast(value.Bool, attrs['E']).b # type: bool
74 val3 = attrs['F']
75 self.F = None if val3.tag() == value_e.Undef else cast(value.Str, val3).s # type: Optional[str]
76 val4 = attrs['P']
77 self.P = None if val4.tag() == value_e.Undef else cast(value.Str, val4).s # type: Optional[str]
78 val5 = attrs['S']
79 self.S = None if val5.tag() == value_e.Undef else cast(value.Str, val5).s # type: Optional[str]
80 val6 = attrs['W']
81 self.W = None if val6.tag() == value_e.Undef else cast(value.Str, val6).s # type: Optional[str]
82 val7 = attrs['X']
83 self.X = None if val7.tag() == value_e.Undef else cast(value.Str, val7).s # type: Optional[str]
84
85
86class dirs(object):
87 def __init__(self, attrs):
88 # type: (Dict[str, value_t]) -> None
89
90 self.c = cast(value.Bool, attrs['c']).b # type: bool
91 self.l = cast(value.Bool, attrs['l']).b # type: bool
92 self.p = cast(value.Bool, attrs['p']).b # type: bool
93 self.v = cast(value.Bool, attrs['v']).b # type: bool
94
95
96class echo(object):
97 def __init__(self, attrs):
98 # type: (Dict[str, value_t]) -> None
99
100 self.e = cast(value.Bool, attrs['e']).b # type: bool
101 self.n = cast(value.Bool, attrs['n']).b # type: bool
102
103
104class export_(object):
105 def __init__(self, attrs):
106 # type: (Dict[str, value_t]) -> None
107
108 self.f = cast(value.Bool, attrs['f']).b # type: bool
109 self.n = cast(value.Bool, attrs['n']).b # type: bool
110 self.p = cast(value.Bool, attrs['p']).b # type: bool
111
112
113class hash(object):
114 def __init__(self, attrs):
115 # type: (Dict[str, value_t]) -> None
116
117 self.r = cast(value.Bool, attrs['r']).b # type: bool
118
119
120class history(object):
121 def __init__(self, attrs):
122 # type: (Dict[str, value_t]) -> None
123
124 self.a = cast(value.Bool, attrs['a']).b # type: bool
125 self.c = cast(value.Bool, attrs['c']).b # type: bool
126 val2 = attrs['d']
127 self.d = mops.BigInt(-1) if val2.tag() == value_e.Undef else cast(value.Int, val2).i # type: mops.BigInt
128 self.r = cast(value.Bool, attrs['r']).b # type: bool
129
130
131class jobs(object):
132 def __init__(self, attrs):
133 # type: (Dict[str, value_t]) -> None
134
135 self.debug = cast(value.Bool, attrs['debug']).b # type: bool
136 self.l = cast(value.Bool, attrs['l']).b # type: bool
137 self.p = cast(value.Bool, attrs['p']).b # type: bool
138
139
140class json_write(object):
141 def __init__(self, attrs):
142 # type: (Dict[str, value_t]) -> None
143
144 val0 = attrs['indent']
145 self.indent = mops.BigInt(-1) if val0.tag() == value_e.Undef else cast(value.Int, val0).i # type: mops.BigInt
146 self.pretty = cast(value.Bool, attrs['pretty']).b # type: bool
147 self.surrogate_ok = cast(value.Bool, attrs['surrogate_ok']).b # type: bool
148
149
150class main(object):
151 def __init__(self, attrs):
152 # type: (Dict[str, value_t]) -> None
153
154 val0 = attrs['ast_format']
155 self.ast_format = None if val0.tag() == value_e.Undef else cast(value.Str, val0).s # type: Optional[str]
156 val1 = attrs['c']
157 self.c = None if val1.tag() == value_e.Undef else cast(value.Str, val1).s # type: Optional[str]
158 self.completion_demo = cast(value.Bool, attrs['completion_demo']).b # type: bool
159 val3 = attrs['completion_display']
160 self.completion_display = None if val3.tag() == value_e.Undef else cast(value.Str, val3).s # type: Optional[str]
161 val4 = attrs['debug_file']
162 self.debug_file = None if val4.tag() == value_e.Undef else cast(value.Str, val4).s # type: Optional[str]
163 self.do_lossless = cast(value.Bool, attrs['do_lossless']).b # type: bool
164 self.headless = cast(value.Bool, attrs['headless']).b # type: bool
165 self.help = cast(value.Bool, attrs['help']).b # type: bool
166 self.i = cast(value.Bool, attrs['i']).b # type: bool
167 self.l = cast(value.Bool, attrs['l']).b # type: bool
168 val10 = attrs['location_start_line']
169 self.location_start_line = mops.BigInt(-1) if val10.tag() == value_e.Undef else cast(value.Int, val10).i # type: mops.BigInt
170 val11 = attrs['location_str']
171 self.location_str = None if val11.tag() == value_e.Undef else cast(value.Str, val11).s # type: Optional[str]
172 self.login = cast(value.Bool, attrs['login']).b # type: bool
173 self.norc = cast(value.Bool, attrs['norc']).b # type: bool
174 self.print_status = cast(value.Bool, attrs['print_status']).b # type: bool
175 val15 = attrs['rcdir']
176 self.rcdir = None if val15.tag() == value_e.Undef else cast(value.Str, val15).s # type: Optional[str]
177 val16 = attrs['rcfile']
178 self.rcfile = None if val16.tag() == value_e.Undef else cast(value.Str, val16).s # type: Optional[str]
179 val17 = attrs['tool']
180 self.tool = None if val17.tag() == value_e.Undef else cast(value.Str, val17).s # type: Optional[str]
181 self.version = cast(value.Bool, attrs['version']).b # type: bool
182 self.xtrace_to_debug_file = cast(value.Bool, attrs['xtrace_to_debug_file']).b # type: bool
183
184
185class mapfile(object):
186 def __init__(self, attrs):
187 # type: (Dict[str, value_t]) -> None
188
189 self.t = cast(value.Bool, attrs['t']).b # type: bool
190
191
192class new_var(object):
193 def __init__(self, attrs):
194 # type: (Dict[str, value_t]) -> None
195
196 self.A = cast(value.Bool, attrs['A']).b # type: bool
197 self.F = cast(value.Bool, attrs['F']).b # type: bool
198 self.a = cast(value.Bool, attrs['a']).b # type: bool
199 self.f = cast(value.Bool, attrs['f']).b # type: bool
200 self.g = cast(value.Bool, attrs['g']).b # type: bool
201 self.i = cast(value.Bool, attrs['i']).b # type: bool
202 self.l = cast(value.Bool, attrs['l']).b # type: bool
203 val7 = attrs['n']
204 self.n = None if val7.tag() == value_e.Undef else cast(value.Str, val7).s # type: Optional[str]
205 self.p = cast(value.Bool, attrs['p']).b # type: bool
206 val9 = attrs['r']
207 self.r = None if val9.tag() == value_e.Undef else cast(value.Str, val9).s # type: Optional[str]
208 self.u = cast(value.Bool, attrs['u']).b # type: bool
209 val11 = attrs['x']
210 self.x = None if val11.tag() == value_e.Undef else cast(value.Str, val11).s # type: Optional[str]
211
212
213class printf(object):
214 def __init__(self, attrs):
215 # type: (Dict[str, value_t]) -> None
216
217 val0 = attrs['v']
218 self.v = None if val0.tag() == value_e.Undef else cast(value.Str, val0).s # type: Optional[str]
219
220
221class pwd(object):
222 def __init__(self, attrs):
223 # type: (Dict[str, value_t]) -> None
224
225 self.L = cast(value.Bool, attrs['L']).b # type: bool
226 self.P = cast(value.Bool, attrs['P']).b # type: bool
227
228
229class read(object):
230 def __init__(self, attrs):
231 # type: (Dict[str, value_t]) -> None
232
233 val0 = attrs['N']
234 self.N = mops.BigInt(-1) if val0.tag() == value_e.Undef else cast(value.Int, val0).i # type: mops.BigInt
235 self.Z = cast(value.Bool, attrs['Z']).b # type: bool
236 val2 = attrs['a']
237 self.a = None if val2.tag() == value_e.Undef else cast(value.Str, val2).s # type: Optional[str]
238 self.all = cast(value.Bool, attrs['all']).b # type: bool
239 val4 = attrs['d']
240 self.d = None if val4.tag() == value_e.Undef else cast(value.Str, val4).s # type: Optional[str]
241 val5 = attrs['n']
242 self.n = mops.BigInt(-1) if val5.tag() == value_e.Undef else cast(value.Int, val5).i # type: mops.BigInt
243 val6 = attrs['num_bytes']
244 self.num_bytes = mops.BigInt(-1) if val6.tag() == value_e.Undef else cast(value.Int, val6).i # type: mops.BigInt
245 val7 = attrs['p']
246 self.p = None if val7.tag() == value_e.Undef else cast(value.Str, val7).s # type: Optional[str]
247 self.r = cast(value.Bool, attrs['r']).b # type: bool
248 self.raw_line = cast(value.Bool, attrs['raw_line']).b # type: bool
249 self.s = cast(value.Bool, attrs['s']).b # type: bool
250 val11 = attrs['t']
251 self.t = -1.0 if val11.tag() == value_e.Undef else cast(value.Float, val11).f # type: float
252 val12 = attrs['u']
253 self.u = mops.BigInt(-1) if val12.tag() == value_e.Undef else cast(value.Int, val12).i # type: mops.BigInt
254 self.with_eol = cast(value.Bool, attrs['with_eol']).b # type: bool
255
256
257class readonly(object):
258 def __init__(self, attrs):
259 # type: (Dict[str, value_t]) -> None
260
261 self.A = cast(value.Bool, attrs['A']).b # type: bool
262 self.a = cast(value.Bool, attrs['a']).b # type: bool
263 self.p = cast(value.Bool, attrs['p']).b # type: bool
264
265
266class runproc(object):
267 def __init__(self, attrs):
268 # type: (Dict[str, value_t]) -> None
269
270 self.h = cast(value.Bool, attrs['h']).b # type: bool
271
272
273class shopt(object):
274 def __init__(self, attrs):
275 # type: (Dict[str, value_t]) -> None
276
277 self.o = cast(value.Bool, attrs['o']).b # type: bool
278 self.p = cast(value.Bool, attrs['p']).b # type: bool
279 self.q = cast(value.Bool, attrs['q']).b # type: bool
280 self.s = cast(value.Bool, attrs['s']).b # type: bool
281 self.u = cast(value.Bool, attrs['u']).b # type: bool
282
283
284class source(object):
285 def __init__(self, attrs):
286 # type: (Dict[str, value_t]) -> None
287
288 self.builtin = cast(value.Bool, attrs['builtin']).b # type: bool
289
290
291class trap(object):
292 def __init__(self, attrs):
293 # type: (Dict[str, value_t]) -> None
294
295 self.l = cast(value.Bool, attrs['l']).b # type: bool
296 self.p = cast(value.Bool, attrs['p']).b # type: bool
297
298
299class try_(object):
300 def __init__(self, attrs):
301 # type: (Dict[str, value_t]) -> None
302
303 val0 = attrs['assign']
304 self.assign = None if val0.tag() == value_e.Undef else cast(value.Str, val0).s # type: Optional[str]
305
306
307class type(object):
308 def __init__(self, attrs):
309 # type: (Dict[str, value_t]) -> None
310
311 self.P = cast(value.Bool, attrs['P']).b # type: bool
312 self.a = cast(value.Bool, attrs['a']).b # type: bool
313 self.f = cast(value.Bool, attrs['f']).b # type: bool
314 self.p = cast(value.Bool, attrs['p']).b # type: bool
315 self.t = cast(value.Bool, attrs['t']).b # type: bool
316
317
318class ulimit(object):
319 def __init__(self, attrs):
320 # type: (Dict[str, value_t]) -> None
321
322 self.H = cast(value.Bool, attrs['H']).b # type: bool
323 self.S = cast(value.Bool, attrs['S']).b # type: bool
324 self.a = cast(value.Bool, attrs['a']).b # type: bool
325 self.all = cast(value.Bool, attrs['all']).b # type: bool
326 self.c = cast(value.Bool, attrs['c']).b # type: bool
327 self.d = cast(value.Bool, attrs['d']).b # type: bool
328 self.f = cast(value.Bool, attrs['f']).b # type: bool
329 self.n = cast(value.Bool, attrs['n']).b # type: bool
330 self.s = cast(value.Bool, attrs['s']).b # type: bool
331 self.t = cast(value.Bool, attrs['t']).b # type: bool
332 self.v = cast(value.Bool, attrs['v']).b # type: bool
333
334
335class unalias(object):
336 def __init__(self, attrs):
337 # type: (Dict[str, value_t]) -> None
338
339 self.a = cast(value.Bool, attrs['a']).b # type: bool
340
341
342class unset(object):
343 def __init__(self, attrs):
344 # type: (Dict[str, value_t]) -> None
345
346 self.f = cast(value.Bool, attrs['f']).b # type: bool
347 self.v = cast(value.Bool, attrs['v']).b # type: bool
348
349
350class wait(object):
351 def __init__(self, attrs):
352 # type: (Dict[str, value_t]) -> None
353
354 self.n = cast(value.Bool, attrs['n']).b # type: bool
355
356
357class write(object):
358 def __init__(self, attrs):
359 # type: (Dict[str, value_t]) -> None
360
361 val0 = attrs['end']
362 self.end = None if val0.tag() == value_e.Undef else cast(value.Str, val0).s # type: Optional[str]
363 self.j8 = cast(value.Bool, attrs['j8']).b # type: bool
364 self.json = cast(value.Bool, attrs['json']).b # type: bool
365 self.n = cast(value.Bool, attrs['n']).b # type: bool
366 val4 = attrs['sep']
367 self.sep = None if val4.tag() == value_e.Undef else cast(value.Str, val4).s # type: Optional[str]
368