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

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