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

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