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

406 lines, 395 significant
1from asdl import pybase
2
3option_t = int # type alias for integer
4
5class option_i(object):
6 errexit = 1
7 nounset = 2
8 pipefail = 3
9 inherit_errexit = 4
10 nullglob = 5
11 verbose_errexit = 6
12 noexec = 7
13 xtrace = 8
14 verbose = 9
15 noglob = 10
16 noclobber = 11
17 errtrace = 12
18 posix = 13
19 vi = 14
20 emacs = 15
21 interactive = 16
22 hashall = 17
23 lastpipe = 18
24 failglob = 19
25 extglob = 20
26 nocasematch = 21
27 eval_unsafe_arith = 22
28 ignore_flags_not_impl = 23
29 ignore_shopt_not_impl = 24
30 _allow_command_sub = 25
31 _allow_process_sub = 26
32 dynamic_scope = 27
33 redefine_const = 28
34 redefine_source = 29
35 _running_trap = 30
36 _running_hay = 31
37 _no_debug_trap = 32
38 _no_err_trap = 33
39 strict_parse_slice = 34
40 strict_argv = 35
41 strict_arith = 36
42 strict_array = 37
43 strict_control_flow = 38
44 strict_errexit = 39
45 strict_nameref = 40
46 strict_word_eval = 41
47 strict_tilde = 42
48 strict_glob = 43
49 no_copy_env = 44
50 parse_at = 45
51 parse_proc = 46
52 parse_func = 47
53 parse_brace = 48
54 parse_bracket = 49
55 parse_equals = 50
56 parse_paren = 51
57 parse_ysh_string = 52
58 parse_triple_quote = 53
59 simple_word_eval = 54
60 dashglob = 55
61 command_sub_errexit = 56
62 process_sub_fail = 57
63 xtrace_rich = 58
64 xtrace_details = 59
65 sigpipe_status_ok = 60
66 env_obj = 61
67 parse_at_all = 62
68 parse_backslash = 63
69 parse_backticks = 64
70 parse_dollar = 65
71 parse_ignored = 66
72 parse_sh_arith = 67
73 parse_dparen = 68
74 parse_dbracket = 69
75 parse_bare_word = 70
76 simple_echo = 71
77 simple_eval_builtin = 72
78 simple_test_builtin = 73
79 expand_aliases = 74
80 progcomp = 75
81 histappend = 76
82 hostcomplete = 77
83 cmdhist = 78
84 assoc_expand_once = 79
85 autocd = 80
86 cdable_vars = 81
87 cdspell = 82
88 checkhash = 83
89 checkjobs = 84
90 checkwinsize = 85
91 complete_fullquote = 86
92 direxpand = 87
93 dirspell = 88
94 dotglob = 89
95 execfail = 90
96 extdebug = 91
97 extquote = 92
98 force_fignore = 93
99 globasciiranges = 94
100 globstar = 95
101 gnu_errfmt = 96
102 histreedit = 97
103 histverify = 98
104 huponexit = 99
105 interactive_comments = 100
106 lithist = 101
107 localvar_inherit = 102
108 localvar_unset = 103
109 login_shell = 104
110 mailwarn = 105
111 no_empty_cmd_completion = 106
112 nocaseglob = 107
113 progcomp_alias = 108
114 promptvars = 109
115 restricted_shell = 110
116 shift_verbose = 111
117 sourcepath = 112
118 xpg_echo = 113
119 ARRAY_SIZE = 114
120
121_option_str = {
122 1: 'option.errexit',
123 2: 'option.nounset',
124 3: 'option.pipefail',
125 4: 'option.inherit_errexit',
126 5: 'option.nullglob',
127 6: 'option.verbose_errexit',
128 7: 'option.noexec',
129 8: 'option.xtrace',
130 9: 'option.verbose',
131 10: 'option.noglob',
132 11: 'option.noclobber',
133 12: 'option.errtrace',
134 13: 'option.posix',
135 14: 'option.vi',
136 15: 'option.emacs',
137 16: 'option.interactive',
138 17: 'option.hashall',
139 18: 'option.lastpipe',
140 19: 'option.failglob',
141 20: 'option.extglob',
142 21: 'option.nocasematch',
143 22: 'option.eval_unsafe_arith',
144 23: 'option.ignore_flags_not_impl',
145 24: 'option.ignore_shopt_not_impl',
146 25: 'option._allow_command_sub',
147 26: 'option._allow_process_sub',
148 27: 'option.dynamic_scope',
149 28: 'option.redefine_const',
150 29: 'option.redefine_source',
151 30: 'option._running_trap',
152 31: 'option._running_hay',
153 32: 'option._no_debug_trap',
154 33: 'option._no_err_trap',
155 34: 'option.strict_parse_slice',
156 35: 'option.strict_argv',
157 36: 'option.strict_arith',
158 37: 'option.strict_array',
159 38: 'option.strict_control_flow',
160 39: 'option.strict_errexit',
161 40: 'option.strict_nameref',
162 41: 'option.strict_word_eval',
163 42: 'option.strict_tilde',
164 43: 'option.strict_glob',
165 44: 'option.no_copy_env',
166 45: 'option.parse_at',
167 46: 'option.parse_proc',
168 47: 'option.parse_func',
169 48: 'option.parse_brace',
170 49: 'option.parse_bracket',
171 50: 'option.parse_equals',
172 51: 'option.parse_paren',
173 52: 'option.parse_ysh_string',
174 53: 'option.parse_triple_quote',
175 54: 'option.simple_word_eval',
176 55: 'option.dashglob',
177 56: 'option.command_sub_errexit',
178 57: 'option.process_sub_fail',
179 58: 'option.xtrace_rich',
180 59: 'option.xtrace_details',
181 60: 'option.sigpipe_status_ok',
182 61: 'option.env_obj',
183 62: 'option.parse_at_all',
184 63: 'option.parse_backslash',
185 64: 'option.parse_backticks',
186 65: 'option.parse_dollar',
187 66: 'option.parse_ignored',
188 67: 'option.parse_sh_arith',
189 68: 'option.parse_dparen',
190 69: 'option.parse_dbracket',
191 70: 'option.parse_bare_word',
192 71: 'option.simple_echo',
193 72: 'option.simple_eval_builtin',
194 73: 'option.simple_test_builtin',
195 74: 'option.expand_aliases',
196 75: 'option.progcomp',
197 76: 'option.histappend',
198 77: 'option.hostcomplete',
199 78: 'option.cmdhist',
200 79: 'option.assoc_expand_once',
201 80: 'option.autocd',
202 81: 'option.cdable_vars',
203 82: 'option.cdspell',
204 83: 'option.checkhash',
205 84: 'option.checkjobs',
206 85: 'option.checkwinsize',
207 86: 'option.complete_fullquote',
208 87: 'option.direxpand',
209 88: 'option.dirspell',
210 89: 'option.dotglob',
211 90: 'option.execfail',
212 91: 'option.extdebug',
213 92: 'option.extquote',
214 93: 'option.force_fignore',
215 94: 'option.globasciiranges',
216 95: 'option.globstar',
217 96: 'option.gnu_errfmt',
218 97: 'option.histreedit',
219 98: 'option.histverify',
220 99: 'option.huponexit',
221 100: 'option.interactive_comments',
222 101: 'option.lithist',
223 102: 'option.localvar_inherit',
224 103: 'option.localvar_unset',
225 104: 'option.login_shell',
226 105: 'option.mailwarn',
227 106: 'option.no_empty_cmd_completion',
228 107: 'option.nocaseglob',
229 108: 'option.progcomp_alias',
230 109: 'option.promptvars',
231 110: 'option.restricted_shell',
232 111: 'option.shift_verbose',
233 112: 'option.sourcepath',
234 113: 'option.xpg_echo',
235}
236
237def option_str(val):
238 # type: (option_t) -> str
239 return _option_str[val]
240
241builtin_t = int # type alias for integer
242
243class builtin_i(object):
244 colon = 1
245 dot = 2
246 exec_ = 3
247 eval = 4
248 set = 5
249 shift = 6
250 times = 7
251 trap = 8
252 unset = 9
253 readonly = 10
254 local = 11
255 declare = 12
256 typeset = 13
257 export_ = 14
258 extern_ = 15
259 true_ = 16
260 false_ = 17
261 try_ = 18
262 assert_ = 19
263 read = 20
264 echo = 21
265 printf = 22
266 mapfile = 23
267 readarray = 24
268 cd = 25
269 pushd = 26
270 popd = 27
271 dirs = 28
272 pwd = 29
273 source = 30
274 umask = 31
275 ulimit = 32
276 wait = 33
277 jobs = 34
278 fg = 35
279 bg = 36
280 shopt = 37
281 complete = 38
282 compgen = 39
283 compopt = 40
284 compadjust = 41
285 compexport = 42
286 getopts = 43
287 builtin = 44
288 command = 45
289 type = 46
290 hash = 47
291 help = 48
292 history = 49
293 alias = 50
294 unalias = 51
295 bind = 52
296 append = 53
297 write = 54
298 json = 55
299 json8 = 56
300 pp = 57
301 hay = 58
302 haynode = 59
303 use = 60
304 error = 61
305 failed = 62
306 fork = 63
307 forkwait = 64
308 redir = 65
309 fopen = 66
310 shvar = 67
311 ctx = 68
312 invoke = 69
313 runproc = 70
314 boolstatus = 71
315 test = 72
316 bracket = 73
317 push_registers = 74
318 source_guard = 75
319 is_main = 76
320 cat = 77
321 ARRAY_SIZE = 78
322
323_builtin_str = {
324 1: 'builtin.colon',
325 2: 'builtin.dot',
326 3: 'builtin.exec_',
327 4: 'builtin.eval',
328 5: 'builtin.set',
329 6: 'builtin.shift',
330 7: 'builtin.times',
331 8: 'builtin.trap',
332 9: 'builtin.unset',
333 10: 'builtin.readonly',
334 11: 'builtin.local',
335 12: 'builtin.declare',
336 13: 'builtin.typeset',
337 14: 'builtin.export_',
338 15: 'builtin.extern_',
339 16: 'builtin.true_',
340 17: 'builtin.false_',
341 18: 'builtin.try_',
342 19: 'builtin.assert_',
343 20: 'builtin.read',
344 21: 'builtin.echo',
345 22: 'builtin.printf',
346 23: 'builtin.mapfile',
347 24: 'builtin.readarray',
348 25: 'builtin.cd',
349 26: 'builtin.pushd',
350 27: 'builtin.popd',
351 28: 'builtin.dirs',
352 29: 'builtin.pwd',
353 30: 'builtin.source',
354 31: 'builtin.umask',
355 32: 'builtin.ulimit',
356 33: 'builtin.wait',
357 34: 'builtin.jobs',
358 35: 'builtin.fg',
359 36: 'builtin.bg',
360 37: 'builtin.shopt',
361 38: 'builtin.complete',
362 39: 'builtin.compgen',
363 40: 'builtin.compopt',
364 41: 'builtin.compadjust',
365 42: 'builtin.compexport',
366 43: 'builtin.getopts',
367 44: 'builtin.builtin',
368 45: 'builtin.command',
369 46: 'builtin.type',
370 47: 'builtin.hash',
371 48: 'builtin.help',
372 49: 'builtin.history',
373 50: 'builtin.alias',
374 51: 'builtin.unalias',
375 52: 'builtin.bind',
376 53: 'builtin.append',
377 54: 'builtin.write',
378 55: 'builtin.json',
379 56: 'builtin.json8',
380 57: 'builtin.pp',
381 58: 'builtin.hay',
382 59: 'builtin.haynode',
383 60: 'builtin.use',
384 61: 'builtin.error',
385 62: 'builtin.failed',
386 63: 'builtin.fork',
387 64: 'builtin.forkwait',
388 65: 'builtin.redir',
389 66: 'builtin.fopen',
390 67: 'builtin.shvar',
391 68: 'builtin.ctx',
392 69: 'builtin.invoke',
393 70: 'builtin.runproc',
394 71: 'builtin.boolstatus',
395 72: 'builtin.test',
396 73: 'builtin.bracket',
397 74: 'builtin.push_registers',
398 75: 'builtin.source_guard',
399 76: 'builtin.is_main',
400 77: 'builtin.cat',
401}
402
403def builtin_str(val):
404 # type: (builtin_t) -> str
405 return _builtin_str[val]
406