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