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

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