OILS / _devbuild / gen / option_asdl.py View on Github | oils.pub

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