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

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