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

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