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

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