OILS / _gen / frontend / consts.cc View on Github | oilshell.org

1784 lines, 1691 significant
1#include "_gen/frontend/consts.h"
2
3using id_kind_asdl::Id;
4using id_kind_asdl::Kind;
5using types_asdl::redir_arg_type_e;
6using types_asdl::bool_arg_type_e;
7using option_asdl::builtin_t;
8
9namespace consts {
10
11int NO_INDEX = 0; // duplicated from frontend/consts.py
12
13GLOBAL_STR(gVersion, "0.23.0");
14
15GLOBAL_LIST(STRICT_ALL, int, 10, {34 COMMA 35 COMMA 36 COMMA 37 COMMA 38 COMMA 42 COMMA 39 COMMA 33 COMMA 41 COMMA 40});
16GLOBAL_LIST(YSH_UPGRADE, int, 23, {54 COMMA 53 COMMA 1 COMMA 4 COMMA 2 COMMA 5 COMMA 43 COMMA 46 COMMA 47 COMMA 48 COMMA 45 COMMA 49 COMMA 44 COMMA 51 COMMA 50 COMMA 3 COMMA 55 COMMA 59 COMMA 58 COMMA 52 COMMA 6 COMMA 57 COMMA 56});
17GLOBAL_LIST(YSH_ALL, int, 46, {54 COMMA 53 COMMA 1 COMMA 72 COMMA 4 COMMA 2 COMMA 5 COMMA 43 COMMA 60 COMMA 61 COMMA 62 COMMA 68 COMMA 46 COMMA 47 COMMA 67 COMMA 63 COMMA 66 COMMA 48 COMMA 45 COMMA 64 COMMA 49 COMMA 44 COMMA 65 COMMA 51 COMMA 50 COMMA 3 COMMA 55 COMMA 59 COMMA 58 COMMA 69 COMMA 70 COMMA 71 COMMA 52 COMMA 34 COMMA 35 COMMA 36 COMMA 37 COMMA 38 COMMA 42 COMMA 39 COMMA 33 COMMA 41 COMMA 40 COMMA 6 COMMA 57 COMMA 56});
18GLOBAL_LIST(DEFAULT_TRUE, int, 16, {25 COMMA 26 COMMA 53 COMMA 27 COMMA 72 COMMA 17 COMMA 61 COMMA 62 COMMA 68 COMMA 67 COMMA 63 COMMA 66 COMMA 64 COMMA 65 COMMA 59 COMMA 57});
19GLOBAL_LIST(PARSE_OPTION_NUMS, int, 20, {72 COMMA 43 COMMA 60 COMMA 61 COMMA 62 COMMA 68 COMMA 46 COMMA 47 COMMA 67 COMMA 63 COMMA 66 COMMA 48 COMMA 45 COMMA 64 COMMA 49 COMMA 44 COMMA 65 COMMA 51 COMMA 50 COMMA 33});
20GLOBAL_LIST(SHOPT_OPTION_NUMS, int, 98, {25 COMMA 26 COMMA 31 COMMA 32 COMMA 30 COMMA 29 COMMA 78 COMMA 79 COMMA 80 COMMA 81 COMMA 82 COMMA 83 COMMA 84 COMMA 77 COMMA 54 COMMA 85 COMMA 53 COMMA 86 COMMA 87 COMMA 88 COMMA 27 COMMA 22 COMMA 89 COMMA 72 COMMA 90 COMMA 19 COMMA 91 COMMA 18 COMMA 92 COMMA 93 COMMA 94 COMMA 95 COMMA 75 COMMA 96 COMMA 97 COMMA 76 COMMA 98 COMMA 23 COMMA 24 COMMA 4 COMMA 99 COMMA 73 COMMA 100 COMMA 101 COMMA 102 COMMA 103 COMMA 104 COMMA 21 COMMA 105 COMMA 106 COMMA 20 COMMA 5 COMMA 43 COMMA 60 COMMA 61 COMMA 62 COMMA 68 COMMA 46 COMMA 47 COMMA 67 COMMA 63 COMMA 66 COMMA 48 COMMA 45 COMMA 64 COMMA 49 COMMA 44 COMMA 65 COMMA 51 COMMA 50 COMMA 55 COMMA 74 COMMA 107 COMMA 108 COMMA 28 COMMA 59 COMMA 109 COMMA 110 COMMA 58 COMMA 69 COMMA 70 COMMA 71 COMMA 52 COMMA 111 COMMA 34 COMMA 35 COMMA 36 COMMA 37 COMMA 38 COMMA 42 COMMA 39 COMMA 33 COMMA 41 COMMA 40 COMMA 6 COMMA 112 COMMA 57 COMMA 56});
21GLOBAL_LIST(SET_OPTION_NUMS, int, 13, {15 COMMA 1 COMMA 12 COMMA 17 COMMA 11 COMMA 7 COMMA 10 COMMA 2 COMMA 3 COMMA 13 COMMA 9 COMMA 14 COMMA 8});
22GLOBAL_LIST(VISIBLE_SHOPT_NUMS, int, 58, {25 COMMA 26 COMMA 31 COMMA 32 COMMA 30 COMMA 29 COMMA 54 COMMA 53 COMMA 27 COMMA 22 COMMA 72 COMMA 19 COMMA 18 COMMA 23 COMMA 24 COMMA 4 COMMA 21 COMMA 20 COMMA 5 COMMA 43 COMMA 60 COMMA 61 COMMA 62 COMMA 68 COMMA 46 COMMA 47 COMMA 67 COMMA 63 COMMA 66 COMMA 48 COMMA 45 COMMA 64 COMMA 49 COMMA 44 COMMA 65 COMMA 51 COMMA 50 COMMA 55 COMMA 28 COMMA 59 COMMA 58 COMMA 69 COMMA 70 COMMA 71 COMMA 52 COMMA 34 COMMA 35 COMMA 36 COMMA 37 COMMA 38 COMMA 42 COMMA 39 COMMA 33 COMMA 41 COMMA 40 COMMA 6 COMMA 57 COMMA 56});
23
24int RedirDefaultFd(id_kind_asdl::Id_t id) {
25 // relies on "switch lowering"
26 switch (id) {
27
28 case Id::Redir_Less: return 0;
29 case Id::Redir_Great: return 1;
30 case Id::Redir_DLess: return 0;
31 case Id::Redir_TLess: return 0;
32 case Id::Redir_DGreat: return 1;
33 case Id::Redir_GreatAnd: return 1;
34 case Id::Redir_LessAnd: return 0;
35 case Id::Redir_DLessDash: return 0;
36 case Id::Redir_LessGreat: return 0;
37 case Id::Redir_Clobber: return 1;
38 case Id::Redir_AndGreat: return 1;
39 case Id::Redir_AndDGreat: return 1;
40 }
41 FAIL(kShouldNotGetHere);
42}
43
44types_asdl::redir_arg_type_t RedirArgType(id_kind_asdl::Id_t id) {
45 // relies on "switch lowering"
46 switch (id) {
47
48 case Id::Redir_Less: return redir_arg_type_e::Path;
49 case Id::Redir_Great: return redir_arg_type_e::Path;
50 case Id::Redir_TLess: return redir_arg_type_e::Here;
51 case Id::Redir_DGreat: return redir_arg_type_e::Path;
52 case Id::Redir_GreatAnd: return redir_arg_type_e::Desc;
53 case Id::Redir_LessAnd: return redir_arg_type_e::Desc;
54 case Id::Redir_LessGreat: return redir_arg_type_e::Path;
55 case Id::Redir_Clobber: return redir_arg_type_e::Path;
56 case Id::Redir_AndGreat: return redir_arg_type_e::Path;
57 case Id::Redir_AndDGreat: return redir_arg_type_e::Path;
58 }
59 FAIL(kShouldNotGetHere);
60}
61
62types_asdl::bool_arg_type_t BoolArgType(id_kind_asdl::Id_t id) {
63 // relies on "switch lowering"
64 switch (id) {
65
66 case Id::Op_DAmp: return bool_arg_type_e::Undefined;
67 case Id::Op_DPipe: return bool_arg_type_e::Undefined;
68 case Id::Op_Less: return bool_arg_type_e::Str;
69 case Id::Op_Great: return bool_arg_type_e::Str;
70 case Id::KW_Bang: return bool_arg_type_e::Undefined;
71 case Id::BoolUnary_z: return bool_arg_type_e::Str;
72 case Id::BoolUnary_n: return bool_arg_type_e::Str;
73 case Id::BoolUnary_o: return bool_arg_type_e::Other;
74 case Id::BoolUnary_t: return bool_arg_type_e::Other;
75 case Id::BoolUnary_v: return bool_arg_type_e::Other;
76 case Id::BoolUnary_R: return bool_arg_type_e::Other;
77 case Id::BoolUnary_a: return bool_arg_type_e::Path;
78 case Id::BoolUnary_b: return bool_arg_type_e::Path;
79 case Id::BoolUnary_c: return bool_arg_type_e::Path;
80 case Id::BoolUnary_d: return bool_arg_type_e::Path;
81 case Id::BoolUnary_e: return bool_arg_type_e::Path;
82 case Id::BoolUnary_f: return bool_arg_type_e::Path;
83 case Id::BoolUnary_g: return bool_arg_type_e::Path;
84 case Id::BoolUnary_h: return bool_arg_type_e::Path;
85 case Id::BoolUnary_k: return bool_arg_type_e::Path;
86 case Id::BoolUnary_L: return bool_arg_type_e::Path;
87 case Id::BoolUnary_p: return bool_arg_type_e::Path;
88 case Id::BoolUnary_r: return bool_arg_type_e::Path;
89 case Id::BoolUnary_s: return bool_arg_type_e::Path;
90 case Id::BoolUnary_S: return bool_arg_type_e::Path;
91 case Id::BoolUnary_u: return bool_arg_type_e::Path;
92 case Id::BoolUnary_w: return bool_arg_type_e::Path;
93 case Id::BoolUnary_x: return bool_arg_type_e::Path;
94 case Id::BoolUnary_O: return bool_arg_type_e::Path;
95 case Id::BoolUnary_G: return bool_arg_type_e::Path;
96 case Id::BoolUnary_N: return bool_arg_type_e::Path;
97 case Id::BoolBinary_GlobEqual: return bool_arg_type_e::Str;
98 case Id::BoolBinary_GlobDEqual: return bool_arg_type_e::Str;
99 case Id::BoolBinary_GlobNEqual: return bool_arg_type_e::Str;
100 case Id::BoolBinary_EqualTilde: return bool_arg_type_e::Str;
101 case Id::BoolBinary_ef: return bool_arg_type_e::Path;
102 case Id::BoolBinary_nt: return bool_arg_type_e::Path;
103 case Id::BoolBinary_ot: return bool_arg_type_e::Path;
104 case Id::BoolBinary_eq: return bool_arg_type_e::Int;
105 case Id::BoolBinary_ne: return bool_arg_type_e::Int;
106 case Id::BoolBinary_gt: return bool_arg_type_e::Int;
107 case Id::BoolBinary_ge: return bool_arg_type_e::Int;
108 case Id::BoolBinary_lt: return bool_arg_type_e::Int;
109 case Id::BoolBinary_le: return bool_arg_type_e::Int;
110 case Id::BoolBinary_Equal: return bool_arg_type_e::Str;
111 case Id::BoolBinary_DEqual: return bool_arg_type_e::Str;
112 case Id::BoolBinary_NEqual: return bool_arg_type_e::Str;
113 }
114 FAIL(kShouldNotGetHere);
115}
116
117Kind GetKind(id_kind_asdl::Id_t id) {
118 // relies on "switch lowering"
119 switch (id) {
120
121 case Id::Word_Compound: return Kind::Word;
122 case Id::Arith_Semi: return Kind::Arith;
123 case Id::Arith_Comma: return Kind::Arith;
124 case Id::Arith_Plus: return Kind::Arith;
125 case Id::Arith_Minus: return Kind::Arith;
126 case Id::Arith_Star: return Kind::Arith;
127 case Id::Arith_Slash: return Kind::Arith;
128 case Id::Arith_Percent: return Kind::Arith;
129 case Id::Arith_DPlus: return Kind::Arith;
130 case Id::Arith_DMinus: return Kind::Arith;
131 case Id::Arith_DStar: return Kind::Arith;
132 case Id::Arith_LParen: return Kind::Arith;
133 case Id::Arith_RParen: return Kind::Arith;
134 case Id::Arith_LBracket: return Kind::Arith;
135 case Id::Arith_RBracket: return Kind::Arith;
136 case Id::Arith_RBrace: return Kind::Arith;
137 case Id::Arith_QMark: return Kind::Arith;
138 case Id::Arith_Colon: return Kind::Arith;
139 case Id::Arith_LessEqual: return Kind::Arith;
140 case Id::Arith_Less: return Kind::Arith;
141 case Id::Arith_GreatEqual: return Kind::Arith;
142 case Id::Arith_Great: return Kind::Arith;
143 case Id::Arith_DEqual: return Kind::Arith;
144 case Id::Arith_NEqual: return Kind::Arith;
145 case Id::Arith_DAmp: return Kind::Arith;
146 case Id::Arith_DPipe: return Kind::Arith;
147 case Id::Arith_Bang: return Kind::Arith;
148 case Id::Arith_DGreat: return Kind::Arith;
149 case Id::Arith_DLess: return Kind::Arith;
150 case Id::Arith_Amp: return Kind::Arith;
151 case Id::Arith_Pipe: return Kind::Arith;
152 case Id::Arith_Caret: return Kind::Arith;
153 case Id::Arith_Tilde: return Kind::Arith;
154 case Id::Arith_Equal: return Kind::Arith;
155 case Id::Arith_PlusEqual: return Kind::Arith;
156 case Id::Arith_MinusEqual: return Kind::Arith;
157 case Id::Arith_StarEqual: return Kind::Arith;
158 case Id::Arith_SlashEqual: return Kind::Arith;
159 case Id::Arith_PercentEqual: return Kind::Arith;
160 case Id::Arith_DGreatEqual: return Kind::Arith;
161 case Id::Arith_DLessEqual: return Kind::Arith;
162 case Id::Arith_AmpEqual: return Kind::Arith;
163 case Id::Arith_CaretEqual: return Kind::Arith;
164 case Id::Arith_PipeEqual: return Kind::Arith;
165 case Id::Eof_Real: return Kind::Eof;
166 case Id::Eof_RParen: return Kind::Eof;
167 case Id::Eof_Backtick: return Kind::Eof;
168 case Id::Undefined_Tok: return Kind::Undefined;
169 case Id::Unknown_Tok: return Kind::Unknown;
170 case Id::Unknown_Backslash: return Kind::Unknown;
171 case Id::Unknown_DEqual: return Kind::Unknown;
172 case Id::Eol_Tok: return Kind::Eol;
173 case Id::Ignored_LineCont: return Kind::Ignored;
174 case Id::Ignored_Space: return Kind::Ignored;
175 case Id::Ignored_Comment: return Kind::Ignored;
176 case Id::Ignored_Newline: return Kind::Ignored;
177 case Id::WS_Space: return Kind::WS;
178 case Id::Lit_Chars: return Kind::Lit;
179 case Id::Lit_CharsWithoutPrefix: return Kind::Lit;
180 case Id::Lit_VarLike: return Kind::Lit;
181 case Id::Lit_ArrayLhsOpen: return Kind::Lit;
182 case Id::Lit_ArrayLhsClose: return Kind::Lit;
183 case Id::Lit_Splice: return Kind::Lit;
184 case Id::Lit_AtLBracket: return Kind::Lit;
185 case Id::Lit_AtLBraceDot: return Kind::Lit;
186 case Id::Lit_Other: return Kind::Lit;
187 case Id::Lit_EscapedChar: return Kind::Lit;
188 case Id::Lit_LBracket: return Kind::Lit;
189 case Id::Lit_RBracket: return Kind::Lit;
190 case Id::Lit_Star: return Kind::Lit;
191 case Id::Lit_QMark: return Kind::Lit;
192 case Id::Lit_LBrace: return Kind::Lit;
193 case Id::Lit_RBrace: return Kind::Lit;
194 case Id::Lit_Comma: return Kind::Lit;
195 case Id::Lit_Equals: return Kind::Lit;
196 case Id::Lit_Dollar: return Kind::Lit;
197 case Id::Lit_DRightBracket: return Kind::Lit;
198 case Id::Lit_Tilde: return Kind::Lit;
199 case Id::Lit_Pound: return Kind::Lit;
200 case Id::Lit_TPound: return Kind::Lit;
201 case Id::Lit_TDot: return Kind::Lit;
202 case Id::Lit_Slash: return Kind::Lit;
203 case Id::Lit_Percent: return Kind::Lit;
204 case Id::Lit_Colon: return Kind::Lit;
205 case Id::Lit_Digits: return Kind::Lit;
206 case Id::Lit_At: return Kind::Lit;
207 case Id::Lit_ArithVarLike: return Kind::Lit;
208 case Id::Lit_BadBackslash: return Kind::Lit;
209 case Id::Lit_CompDummy: return Kind::Lit;
210 case Id::Backtick_Right: return Kind::Backtick;
211 case Id::Backtick_Quoted: return Kind::Backtick;
212 case Id::Backtick_DoubleQuote: return Kind::Backtick;
213 case Id::Backtick_Other: return Kind::Backtick;
214 case Id::History_Op: return Kind::History;
215 case Id::History_Num: return Kind::History;
216 case Id::History_Search: return Kind::History;
217 case Id::History_Other: return Kind::History;
218 case Id::Op_Newline: return Kind::Op;
219 case Id::Op_Amp: return Kind::Op;
220 case Id::Op_Pipe: return Kind::Op;
221 case Id::Op_PipeAmp: return Kind::Op;
222 case Id::Op_DAmp: return Kind::Op;
223 case Id::Op_DPipe: return Kind::Op;
224 case Id::Op_Semi: return Kind::Op;
225 case Id::Op_DSemi: return Kind::Op;
226 case Id::Op_SemiAmp: return Kind::Op;
227 case Id::Op_DSemiAmp: return Kind::Op;
228 case Id::Op_LParen: return Kind::Op;
229 case Id::Op_RParen: return Kind::Op;
230 case Id::Op_DLeftParen: return Kind::Op;
231 case Id::Op_DRightParen: return Kind::Op;
232 case Id::Op_Less: return Kind::Op;
233 case Id::Op_Great: return Kind::Op;
234 case Id::Op_Bang: return Kind::Op;
235 case Id::Op_LBracket: return Kind::Op;
236 case Id::Op_RBracket: return Kind::Op;
237 case Id::Op_LBrace: return Kind::Op;
238 case Id::Op_RBrace: return Kind::Op;
239 case Id::Expr_Reserved: return Kind::Expr;
240 case Id::Expr_Symbol: return Kind::Expr;
241 case Id::Expr_Name: return Kind::Expr;
242 case Id::Expr_DecInt: return Kind::Expr;
243 case Id::Expr_BinInt: return Kind::Expr;
244 case Id::Expr_OctInt: return Kind::Expr;
245 case Id::Expr_HexInt: return Kind::Expr;
246 case Id::Expr_Float: return Kind::Expr;
247 case Id::Expr_Bang: return Kind::Expr;
248 case Id::Expr_Dot: return Kind::Expr;
249 case Id::Expr_DDot: return Kind::Expr;
250 case Id::Expr_Colon: return Kind::Expr;
251 case Id::Expr_RArrow: return Kind::Expr;
252 case Id::Expr_RDArrow: return Kind::Expr;
253 case Id::Expr_DSlash: return Kind::Expr;
254 case Id::Expr_TEqual: return Kind::Expr;
255 case Id::Expr_NotDEqual: return Kind::Expr;
256 case Id::Expr_TildeDEqual: return Kind::Expr;
257 case Id::Expr_At: return Kind::Expr;
258 case Id::Expr_DoubleAt: return Kind::Expr;
259 case Id::Expr_Ellipsis: return Kind::Expr;
260 case Id::Expr_Dollar: return Kind::Expr;
261 case Id::Expr_NotTilde: return Kind::Expr;
262 case Id::Expr_DTilde: return Kind::Expr;
263 case Id::Expr_NotDTilde: return Kind::Expr;
264 case Id::Expr_DStarEqual: return Kind::Expr;
265 case Id::Expr_DSlashEqual: return Kind::Expr;
266 case Id::Expr_CastedDummy: return Kind::Expr;
267 case Id::Expr_Null: return Kind::Expr;
268 case Id::Expr_True: return Kind::Expr;
269 case Id::Expr_False: return Kind::Expr;
270 case Id::Expr_And: return Kind::Expr;
271 case Id::Expr_Or: return Kind::Expr;
272 case Id::Expr_Not: return Kind::Expr;
273 case Id::Expr_For: return Kind::Expr;
274 case Id::Expr_Is: return Kind::Expr;
275 case Id::Expr_In: return Kind::Expr;
276 case Id::Expr_If: return Kind::Expr;
277 case Id::Expr_Else: return Kind::Expr;
278 case Id::Expr_Func: return Kind::Expr;
279 case Id::Expr_Capture: return Kind::Expr;
280 case Id::Expr_As: return Kind::Expr;
281 case Id::Char_OneChar: return Kind::Char;
282 case Id::Char_Stop: return Kind::Char;
283 case Id::Char_Hex: return Kind::Char;
284 case Id::Char_YHex: return Kind::Char;
285 case Id::Char_Octal3: return Kind::Char;
286 case Id::Char_Octal4: return Kind::Char;
287 case Id::Char_Unicode4: return Kind::Char;
288 case Id::Char_SurrogatePair: return Kind::Char;
289 case Id::Char_Unicode8: return Kind::Char;
290 case Id::Char_UBraced: return Kind::Char;
291 case Id::Char_Pound: return Kind::Char;
292 case Id::Char_AsciiControl: return Kind::Char;
293 case Id::BashRegex_LParen: return Kind::BashRegex;
294 case Id::BashRegex_AllowedInParens: return Kind::BashRegex;
295 case Id::Eggex_Start: return Kind::Eggex;
296 case Id::Eggex_End: return Kind::Eggex;
297 case Id::Eggex_Dot: return Kind::Eggex;
298 case Id::Redir_Less: return Kind::Redir;
299 case Id::Redir_Great: return Kind::Redir;
300 case Id::Redir_DLess: return Kind::Redir;
301 case Id::Redir_TLess: return Kind::Redir;
302 case Id::Redir_DGreat: return Kind::Redir;
303 case Id::Redir_GreatAnd: return Kind::Redir;
304 case Id::Redir_LessAnd: return Kind::Redir;
305 case Id::Redir_DLessDash: return Kind::Redir;
306 case Id::Redir_LessGreat: return Kind::Redir;
307 case Id::Redir_Clobber: return Kind::Redir;
308 case Id::Redir_AndGreat: return Kind::Redir;
309 case Id::Redir_AndDGreat: return Kind::Redir;
310 case Id::Left_DoubleQuote: return Kind::Left;
311 case Id::Left_JDoubleQuote: return Kind::Left;
312 case Id::Left_SingleQuote: return Kind::Left;
313 case Id::Left_DollarSingleQuote: return Kind::Left;
314 case Id::Left_RSingleQuote: return Kind::Left;
315 case Id::Left_USingleQuote: return Kind::Left;
316 case Id::Left_BSingleQuote: return Kind::Left;
317 case Id::Left_TDoubleQuote: return Kind::Left;
318 case Id::Left_DollarTDoubleQuote: return Kind::Left;
319 case Id::Left_TSingleQuote: return Kind::Left;
320 case Id::Left_RTSingleQuote: return Kind::Left;
321 case Id::Left_UTSingleQuote: return Kind::Left;
322 case Id::Left_BTSingleQuote: return Kind::Left;
323 case Id::Left_Backtick: return Kind::Left;
324 case Id::Left_DollarParen: return Kind::Left;
325 case Id::Left_DollarBrace: return Kind::Left;
326 case Id::Left_DollarBraceZsh: return Kind::Left;
327 case Id::Left_DollarDParen: return Kind::Left;
328 case Id::Left_DollarBracket: return Kind::Left;
329 case Id::Left_DollarDoubleQuote: return Kind::Left;
330 case Id::Left_ProcSubIn: return Kind::Left;
331 case Id::Left_ProcSubOut: return Kind::Left;
332 case Id::Left_AtParen: return Kind::Left;
333 case Id::Left_CaretParen: return Kind::Left;
334 case Id::Left_CaretBracket: return Kind::Left;
335 case Id::Left_CaretBrace: return Kind::Left;
336 case Id::Left_CaretDoubleQuote: return Kind::Left;
337 case Id::Left_ColonPipe: return Kind::Left;
338 case Id::Left_PercentParen: return Kind::Left;
339 case Id::Right_DoubleQuote: return Kind::Right;
340 case Id::Right_SingleQuote: return Kind::Right;
341 case Id::Right_Backtick: return Kind::Right;
342 case Id::Right_DollarBrace: return Kind::Right;
343 case Id::Right_DollarDParen: return Kind::Right;
344 case Id::Right_DollarDoubleQuote: return Kind::Right;
345 case Id::Right_DollarSingleQuote: return Kind::Right;
346 case Id::Right_Subshell: return Kind::Right;
347 case Id::Right_ShFunction: return Kind::Right;
348 case Id::Right_CasePat: return Kind::Right;
349 case Id::Right_ShArrayLiteral: return Kind::Right;
350 case Id::Right_ExtGlob: return Kind::Right;
351 case Id::Right_BashRegexGroup: return Kind::Right;
352 case Id::Right_BlockLiteral: return Kind::Right;
353 case Id::ExtGlob_Comma: return Kind::ExtGlob;
354 case Id::ExtGlob_At: return Kind::ExtGlob;
355 case Id::ExtGlob_Star: return Kind::ExtGlob;
356 case Id::ExtGlob_Plus: return Kind::ExtGlob;
357 case Id::ExtGlob_QMark: return Kind::ExtGlob;
358 case Id::ExtGlob_Bang: return Kind::ExtGlob;
359 case Id::VSub_DollarName: return Kind::VSub;
360 case Id::VSub_Name: return Kind::VSub;
361 case Id::VSub_Number: return Kind::VSub;
362 case Id::VSub_Bang: return Kind::VSub;
363 case Id::VSub_At: return Kind::VSub;
364 case Id::VSub_Pound: return Kind::VSub;
365 case Id::VSub_Dollar: return Kind::VSub;
366 case Id::VSub_Star: return Kind::VSub;
367 case Id::VSub_Hyphen: return Kind::VSub;
368 case Id::VSub_QMark: return Kind::VSub;
369 case Id::VSub_Dot: return Kind::VSub;
370 case Id::VTest_ColonHyphen: return Kind::VTest;
371 case Id::VTest_Hyphen: return Kind::VTest;
372 case Id::VTest_ColonEquals: return Kind::VTest;
373 case Id::VTest_Equals: return Kind::VTest;
374 case Id::VTest_ColonQMark: return Kind::VTest;
375 case Id::VTest_QMark: return Kind::VTest;
376 case Id::VTest_ColonPlus: return Kind::VTest;
377 case Id::VTest_Plus: return Kind::VTest;
378 case Id::VOp0_Q: return Kind::VOp0;
379 case Id::VOp0_E: return Kind::VOp0;
380 case Id::VOp0_P: return Kind::VOp0;
381 case Id::VOp0_A: return Kind::VOp0;
382 case Id::VOp0_a: return Kind::VOp0;
383 case Id::VOp1_Percent: return Kind::VOp1;
384 case Id::VOp1_DPercent: return Kind::VOp1;
385 case Id::VOp1_Pound: return Kind::VOp1;
386 case Id::VOp1_DPound: return Kind::VOp1;
387 case Id::VOp1_Caret: return Kind::VOp1;
388 case Id::VOp1_DCaret: return Kind::VOp1;
389 case Id::VOp1_Comma: return Kind::VOp1;
390 case Id::VOp1_DComma: return Kind::VOp1;
391 case Id::VOpYsh_Pipe: return Kind::VOpYsh;
392 case Id::VOpYsh_Space: return Kind::VOpYsh;
393 case Id::VOp2_Slash: return Kind::VOp2;
394 case Id::VOp2_Colon: return Kind::VOp2;
395 case Id::VOp2_LBracket: return Kind::VOp2;
396 case Id::VOp2_RBracket: return Kind::VOp2;
397 case Id::VOp3_At: return Kind::VOp3;
398 case Id::VOp3_Star: return Kind::VOp3;
399 case Id::Node_PostDPlus: return Kind::Node;
400 case Id::Node_PostDMinus: return Kind::Node;
401 case Id::Node_UnaryPlus: return Kind::Node;
402 case Id::Node_UnaryMinus: return Kind::Node;
403 case Id::Node_NotIn: return Kind::Node;
404 case Id::Node_IsNot: return Kind::Node;
405 case Id::KW_DLeftBracket: return Kind::KW;
406 case Id::KW_Bang: return Kind::KW;
407 case Id::KW_For: return Kind::KW;
408 case Id::KW_While: return Kind::KW;
409 case Id::KW_Until: return Kind::KW;
410 case Id::KW_Do: return Kind::KW;
411 case Id::KW_Done: return Kind::KW;
412 case Id::KW_In: return Kind::KW;
413 case Id::KW_Case: return Kind::KW;
414 case Id::KW_Esac: return Kind::KW;
415 case Id::KW_If: return Kind::KW;
416 case Id::KW_Fi: return Kind::KW;
417 case Id::KW_Then: return Kind::KW;
418 case Id::KW_Else: return Kind::KW;
419 case Id::KW_Elif: return Kind::KW;
420 case Id::KW_Function: return Kind::KW;
421 case Id::KW_Time: return Kind::KW;
422 case Id::KW_Const: return Kind::KW;
423 case Id::KW_Var: return Kind::KW;
424 case Id::KW_SetVar: return Kind::KW;
425 case Id::KW_SetGlobal: return Kind::KW;
426 case Id::KW_Call: return Kind::KW;
427 case Id::KW_Proc: return Kind::KW;
428 case Id::KW_Typed: return Kind::KW;
429 case Id::KW_Func: return Kind::KW;
430 case Id::ControlFlow_Break: return Kind::ControlFlow;
431 case Id::ControlFlow_Continue: return Kind::ControlFlow;
432 case Id::ControlFlow_Return: return Kind::ControlFlow;
433 case Id::ControlFlow_Exit: return Kind::ControlFlow;
434 case Id::LookAhead_FuncParens: return Kind::LookAhead;
435 case Id::Glob_LBracket: return Kind::Glob;
436 case Id::Glob_RBracket: return Kind::Glob;
437 case Id::Glob_Star: return Kind::Glob;
438 case Id::Glob_QMark: return Kind::Glob;
439 case Id::Glob_Bang: return Kind::Glob;
440 case Id::Glob_Caret: return Kind::Glob;
441 case Id::Glob_EscapedChar: return Kind::Glob;
442 case Id::Glob_BadBackslash: return Kind::Glob;
443 case Id::Glob_CleanLiterals: return Kind::Glob;
444 case Id::Glob_OtherLiteral: return Kind::Glob;
445 case Id::Format_EscapedPercent: return Kind::Format;
446 case Id::Format_Percent: return Kind::Format;
447 case Id::Format_Flag: return Kind::Format;
448 case Id::Format_Num: return Kind::Format;
449 case Id::Format_Dot: return Kind::Format;
450 case Id::Format_Type: return Kind::Format;
451 case Id::Format_Star: return Kind::Format;
452 case Id::Format_Time: return Kind::Format;
453 case Id::Format_Zero: return Kind::Format;
454 case Id::PS_Subst: return Kind::PS;
455 case Id::PS_Octal3: return Kind::PS;
456 case Id::PS_LBrace: return Kind::PS;
457 case Id::PS_RBrace: return Kind::PS;
458 case Id::PS_Literals: return Kind::PS;
459 case Id::PS_BadBackslash: return Kind::PS;
460 case Id::Range_Int: return Kind::Range;
461 case Id::Range_Char: return Kind::Range;
462 case Id::Range_Dots: return Kind::Range;
463 case Id::Range_Other: return Kind::Range;
464 case Id::J8_LBracket: return Kind::J8;
465 case Id::J8_RBracket: return Kind::J8;
466 case Id::J8_LBrace: return Kind::J8;
467 case Id::J8_RBrace: return Kind::J8;
468 case Id::J8_Comma: return Kind::J8;
469 case Id::J8_Colon: return Kind::J8;
470 case Id::J8_Null: return Kind::J8;
471 case Id::J8_Bool: return Kind::J8;
472 case Id::J8_Int: return Kind::J8;
473 case Id::J8_Float: return Kind::J8;
474 case Id::J8_String: return Kind::J8;
475 case Id::J8_Identifier: return Kind::J8;
476 case Id::J8_Newline: return Kind::J8;
477 case Id::J8_Tab: return Kind::J8;
478 case Id::J8_LParen: return Kind::J8;
479 case Id::J8_RParen: return Kind::J8;
480 case Id::J8_Operator: return Kind::J8;
481 case Id::ShNumber_Dec: return Kind::ShNumber;
482 case Id::ShNumber_Hex: return Kind::ShNumber;
483 case Id::ShNumber_Oct: return Kind::ShNumber;
484 case Id::ShNumber_BaseN: return Kind::ShNumber;
485 case Id::BoolUnary_z: return Kind::BoolUnary;
486 case Id::BoolUnary_n: return Kind::BoolUnary;
487 case Id::BoolUnary_o: return Kind::BoolUnary;
488 case Id::BoolUnary_t: return Kind::BoolUnary;
489 case Id::BoolUnary_v: return Kind::BoolUnary;
490 case Id::BoolUnary_R: return Kind::BoolUnary;
491 case Id::BoolUnary_a: return Kind::BoolUnary;
492 case Id::BoolUnary_b: return Kind::BoolUnary;
493 case Id::BoolUnary_c: return Kind::BoolUnary;
494 case Id::BoolUnary_d: return Kind::BoolUnary;
495 case Id::BoolUnary_e: return Kind::BoolUnary;
496 case Id::BoolUnary_f: return Kind::BoolUnary;
497 case Id::BoolUnary_g: return Kind::BoolUnary;
498 case Id::BoolUnary_h: return Kind::BoolUnary;
499 case Id::BoolUnary_k: return Kind::BoolUnary;
500 case Id::BoolUnary_L: return Kind::BoolUnary;
501 case Id::BoolUnary_p: return Kind::BoolUnary;
502 case Id::BoolUnary_r: return Kind::BoolUnary;
503 case Id::BoolUnary_s: return Kind::BoolUnary;
504 case Id::BoolUnary_S: return Kind::BoolUnary;
505 case Id::BoolUnary_u: return Kind::BoolUnary;
506 case Id::BoolUnary_w: return Kind::BoolUnary;
507 case Id::BoolUnary_x: return Kind::BoolUnary;
508 case Id::BoolUnary_O: return Kind::BoolUnary;
509 case Id::BoolUnary_G: return Kind::BoolUnary;
510 case Id::BoolUnary_N: return Kind::BoolUnary;
511 case Id::BoolBinary_GlobEqual: return Kind::BoolBinary;
512 case Id::BoolBinary_GlobDEqual: return Kind::BoolBinary;
513 case Id::BoolBinary_GlobNEqual: return Kind::BoolBinary;
514 case Id::BoolBinary_EqualTilde: return Kind::BoolBinary;
515 case Id::BoolBinary_ef: return Kind::BoolBinary;
516 case Id::BoolBinary_nt: return Kind::BoolBinary;
517 case Id::BoolBinary_ot: return Kind::BoolBinary;
518 case Id::BoolBinary_eq: return Kind::BoolBinary;
519 case Id::BoolBinary_ne: return Kind::BoolBinary;
520 case Id::BoolBinary_gt: return Kind::BoolBinary;
521 case Id::BoolBinary_ge: return Kind::BoolBinary;
522 case Id::BoolBinary_lt: return Kind::BoolBinary;
523 case Id::BoolBinary_le: return Kind::BoolBinary;
524 case Id::BoolBinary_Equal: return Kind::BoolBinary;
525 case Id::BoolBinary_DEqual: return Kind::BoolBinary;
526 case Id::BoolBinary_NEqual: return Kind::BoolBinary;
527 }
528 FAIL(kShouldNotGetHere);
529}
530
531types_asdl::opt_group_t OptionGroupNum(BigStr* s) {
532 int length = len(s);
533 if (length == 0) return 0; // consts.NO_INDEX
534
535 const char* data = s->data_;
536 switch (data[0]) {
537 case 'o':
538 if (length == 7 && memcmp("oil:all", data, 7) == 0) return 3;
539 if (length == 11 && memcmp("oil:upgrade", data, 11) == 0) return 2;
540 break;
541 case 's':
542 if (length == 10 && memcmp("strict:all", data, 10) == 0) return 1;
543 break;
544 case 'y':
545 if (length == 7 && memcmp("ysh:all", data, 7) == 0) return 3;
546 if (length == 11 && memcmp("ysh:upgrade", data, 11) == 0) return 2;
547 break;
548 }
549
550 return 0; // consts.NO_INDEX
551}
552
553option_asdl::option_t OptionNum(BigStr* s) {
554 int length = len(s);
555 if (length == 0) return 0; // consts.NO_INDEX
556
557 const char* data = s->data_;
558 switch (data[0]) {
559 case '_':
560 if (length == 18 && memcmp("_allow_command_sub", data, 18) == 0) return 25;
561 if (length == 18 && memcmp("_allow_process_sub", data, 18) == 0) return 26;
562 if (length == 13 && memcmp("_running_trap", data, 13) == 0) return 29;
563 if (length == 12 && memcmp("_running_hay", data, 12) == 0) return 30;
564 if (length == 14 && memcmp("_no_debug_trap", data, 14) == 0) return 31;
565 if (length == 12 && memcmp("_no_err_trap", data, 12) == 0) return 32;
566 break;
567 case 'a':
568 if (length == 17 && memcmp("assoc_expand_once", data, 17) == 0) return 78;
569 if (length == 6 && memcmp("autocd", data, 6) == 0) return 79;
570 break;
571 case 'c':
572 if (length == 19 && memcmp("command_sub_errexit", data, 19) == 0) return 54;
573 if (length == 7 && memcmp("cmdhist", data, 7) == 0) return 77;
574 if (length == 11 && memcmp("cdable_vars", data, 11) == 0) return 80;
575 if (length == 7 && memcmp("cdspell", data, 7) == 0) return 81;
576 if (length == 9 && memcmp("checkhash", data, 9) == 0) return 82;
577 if (length == 9 && memcmp("checkjobs", data, 9) == 0) return 83;
578 if (length == 12 && memcmp("checkwinsize", data, 12) == 0) return 84;
579 if (length == 18 && memcmp("complete_fullquote", data, 18) == 0) return 85;
580 break;
581 case 'd':
582 if (length == 13 && memcmp("dynamic_scope", data, 13) == 0) return 27;
583 if (length == 8 && memcmp("dashglob", data, 8) == 0) return 53;
584 if (length == 9 && memcmp("direxpand", data, 9) == 0) return 86;
585 if (length == 8 && memcmp("dirspell", data, 8) == 0) return 87;
586 if (length == 7 && memcmp("dotglob", data, 7) == 0) return 88;
587 break;
588 case 'e':
589 if (length == 7 && memcmp("errexit", data, 7) == 0) return 1;
590 if (length == 8 && memcmp("errtrace", data, 8) == 0) return 12;
591 if (length == 5 && memcmp("emacs", data, 5) == 0) return 15;
592 if (length == 7 && memcmp("extglob", data, 7) == 0) return 19;
593 if (length == 17 && memcmp("eval_unsafe_arith", data, 17) == 0) return 22;
594 if (length == 14 && memcmp("expand_aliases", data, 14) == 0) return 72;
595 if (length == 8 && memcmp("execfail", data, 8) == 0) return 89;
596 if (length == 8 && memcmp("extdebug", data, 8) == 0) return 90;
597 if (length == 8 && memcmp("extquote", data, 8) == 0) return 91;
598 break;
599 case 'f':
600 if (length == 8 && memcmp("failglob", data, 8) == 0) return 18;
601 if (length == 13 && memcmp("force_fignore", data, 13) == 0) return 92;
602 break;
603 case 'g':
604 if (length == 15 && memcmp("globasciiranges", data, 15) == 0) return 93;
605 if (length == 8 && memcmp("globstar", data, 8) == 0) return 94;
606 if (length == 10 && memcmp("gnu_errfmt", data, 10) == 0) return 95;
607 break;
608 case 'h':
609 if (length == 7 && memcmp("hashall", data, 7) == 0) return 17;
610 if (length == 10 && memcmp("histappend", data, 10) == 0) return 75;
611 if (length == 12 && memcmp("hostcomplete", data, 12) == 0) return 76;
612 if (length == 10 && memcmp("histreedit", data, 10) == 0) return 96;
613 if (length == 10 && memcmp("histverify", data, 10) == 0) return 97;
614 if (length == 9 && memcmp("huponexit", data, 9) == 0) return 98;
615 break;
616 case 'i':
617 if (length == 15 && memcmp("inherit_errexit", data, 15) == 0) return 4;
618 if (length == 11 && memcmp("interactive", data, 11) == 0) return 16;
619 if (length == 21 && memcmp("ignore_flags_not_impl", data, 21) == 0) return 23;
620 if (length == 20 && memcmp("ignore_opts_not_impl", data, 20) == 0) return 24;
621 if (length == 20 && memcmp("interactive_comments", data, 20) == 0) return 99;
622 break;
623 case 'l':
624 if (length == 8 && memcmp("lastpipe", data, 8) == 0) return 73;
625 if (length == 7 && memcmp("lithist", data, 7) == 0) return 100;
626 if (length == 16 && memcmp("localvar_inherit", data, 16) == 0) return 101;
627 if (length == 14 && memcmp("localvar_unset", data, 14) == 0) return 102;
628 if (length == 11 && memcmp("login_shell", data, 11) == 0) return 103;
629 break;
630 case 'm':
631 if (length == 8 && memcmp("mailwarn", data, 8) == 0) return 104;
632 break;
633 case 'n':
634 if (length == 7 && memcmp("nounset", data, 7) == 0) return 2;
635 if (length == 8 && memcmp("nullglob", data, 8) == 0) return 5;
636 if (length == 6 && memcmp("noexec", data, 6) == 0) return 7;
637 if (length == 6 && memcmp("noglob", data, 6) == 0) return 10;
638 if (length == 9 && memcmp("noclobber", data, 9) == 0) return 11;
639 if (length == 11 && memcmp("nocasematch", data, 11) == 0) return 20;
640 if (length == 11 && memcmp("no_copy_env", data, 11) == 0) return 21;
641 if (length == 23 && memcmp("no_empty_cmd_completion", data, 23) == 0) return 105;
642 if (length == 10 && memcmp("nocaseglob", data, 10) == 0) return 106;
643 break;
644 case 'p':
645 if (length == 8 && memcmp("pipefail", data, 8) == 0) return 3;
646 if (length == 5 && memcmp("posix", data, 5) == 0) return 13;
647 if (length == 8 && memcmp("parse_at", data, 8) == 0) return 43;
648 if (length == 10 && memcmp("parse_proc", data, 10) == 0) return 44;
649 if (length == 10 && memcmp("parse_func", data, 10) == 0) return 45;
650 if (length == 11 && memcmp("parse_brace", data, 11) == 0) return 46;
651 if (length == 13 && memcmp("parse_bracket", data, 13) == 0) return 47;
652 if (length == 12 && memcmp("parse_equals", data, 12) == 0) return 48;
653 if (length == 11 && memcmp("parse_paren", data, 11) == 0) return 49;
654 if (length == 16 && memcmp("parse_ysh_string", data, 16) == 0) return 50;
655 if (length == 18 && memcmp("parse_triple_quote", data, 18) == 0) return 51;
656 if (length == 16 && memcmp("process_sub_fail", data, 16) == 0) return 55;
657 if (length == 12 && memcmp("parse_at_all", data, 12) == 0) return 60;
658 if (length == 15 && memcmp("parse_backslash", data, 15) == 0) return 61;
659 if (length == 15 && memcmp("parse_backticks", data, 15) == 0) return 62;
660 if (length == 12 && memcmp("parse_dollar", data, 12) == 0) return 63;
661 if (length == 13 && memcmp("parse_ignored", data, 13) == 0) return 64;
662 if (length == 14 && memcmp("parse_sh_arith", data, 14) == 0) return 65;
663 if (length == 12 && memcmp("parse_dparen", data, 12) == 0) return 66;
664 if (length == 14 && memcmp("parse_dbracket", data, 14) == 0) return 67;
665 if (length == 15 && memcmp("parse_bare_word", data, 15) == 0) return 68;
666 if (length == 8 && memcmp("progcomp", data, 8) == 0) return 74;
667 if (length == 14 && memcmp("progcomp_alias", data, 14) == 0) return 107;
668 if (length == 10 && memcmp("promptvars", data, 10) == 0) return 108;
669 break;
670 case 'r':
671 if (length == 15 && memcmp("redefine_module", data, 15) == 0) return 28;
672 if (length == 18 && memcmp("redefine_proc_func", data, 18) == 0) return 59;
673 if (length == 16 && memcmp("restricted_shell", data, 16) == 0) return 109;
674 break;
675 case 's':
676 if (length == 18 && memcmp("strict_parse_slice", data, 18) == 0) return 33;
677 if (length == 11 && memcmp("strict_argv", data, 11) == 0) return 34;
678 if (length == 12 && memcmp("strict_arith", data, 12) == 0) return 35;
679 if (length == 12 && memcmp("strict_array", data, 12) == 0) return 36;
680 if (length == 19 && memcmp("strict_control_flow", data, 19) == 0) return 37;
681 if (length == 14 && memcmp("strict_errexit", data, 14) == 0) return 38;
682 if (length == 14 && memcmp("strict_nameref", data, 14) == 0) return 39;
683 if (length == 16 && memcmp("strict_word_eval", data, 16) == 0) return 40;
684 if (length == 12 && memcmp("strict_tilde", data, 12) == 0) return 41;
685 if (length == 11 && memcmp("strict_glob", data, 11) == 0) return 42;
686 if (length == 16 && memcmp("simple_word_eval", data, 16) == 0) return 52;
687 if (length == 17 && memcmp("sigpipe_status_ok", data, 17) == 0) return 58;
688 if (length == 11 && memcmp("simple_echo", data, 11) == 0) return 69;
689 if (length == 19 && memcmp("simple_eval_builtin", data, 19) == 0) return 70;
690 if (length == 19 && memcmp("simple_test_builtin", data, 19) == 0) return 71;
691 if (length == 13 && memcmp("shift_verbose", data, 13) == 0) return 110;
692 if (length == 10 && memcmp("sourcepath", data, 10) == 0) return 111;
693 break;
694 case 'v':
695 if (length == 15 && memcmp("verbose_errexit", data, 15) == 0) return 6;
696 if (length == 7 && memcmp("verbose", data, 7) == 0) return 9;
697 if (length == 2 && memcmp("vi", data, 2) == 0) return 14;
698 break;
699 case 'x':
700 if (length == 6 && memcmp("xtrace", data, 6) == 0) return 8;
701 if (length == 11 && memcmp("xtrace_rich", data, 11) == 0) return 56;
702 if (length == 14 && memcmp("xtrace_details", data, 14) == 0) return 57;
703 if (length == 8 && memcmp("xpg_echo", data, 8) == 0) return 112;
704 break;
705 }
706
707 return 0; // consts.NO_INDEX
708}
709
710builtin_t LookupNormalBuiltin(BigStr* s) {
711 int length = len(s);
712 if (length == 0) return 0; // consts.NO_INDEX
713
714 const char* data = s->data_;
715 switch (data[0]) {
716 case '[':
717 if (length == 1 && memcmp("[", data, 1) == 0) return 70;
718 break;
719 case '_':
720 if (length == 5 && memcmp("__cat", data, 5) == 0) return 74;
721 break;
722 case 'a':
723 if (length == 6 && memcmp("assert", data, 6) == 0) return 18;
724 if (length == 5 && memcmp("alias", data, 5) == 0) return 49;
725 if (length == 6 && memcmp("append", data, 6) == 0) return 52;
726 break;
727 case 'b':
728 if (length == 2 && memcmp("bg", data, 2) == 0) return 35;
729 if (length == 7 && memcmp("builtin", data, 7) == 0) return 43;
730 if (length == 4 && memcmp("bind", data, 4) == 0) return 51;
731 if (length == 10 && memcmp("boolstatus", data, 10) == 0) return 68;
732 break;
733 case 'c':
734 if (length == 2 && memcmp("cd", data, 2) == 0) return 24;
735 if (length == 8 && memcmp("complete", data, 8) == 0) return 37;
736 if (length == 7 && memcmp("compgen", data, 7) == 0) return 38;
737 if (length == 7 && memcmp("compopt", data, 7) == 0) return 39;
738 if (length == 10 && memcmp("compadjust", data, 10) == 0) return 40;
739 if (length == 10 && memcmp("compexport", data, 10) == 0) return 41;
740 if (length == 7 && memcmp("command", data, 7) == 0) return 44;
741 if (length == 3 && memcmp("ctx", data, 3) == 0) return 66;
742 break;
743 case 'd':
744 if (length == 4 && memcmp("dirs", data, 4) == 0) return 27;
745 break;
746 case 'e':
747 if (length == 4 && memcmp("echo", data, 4) == 0) return 20;
748 if (length == 5 && memcmp("error", data, 5) == 0) return 60;
749 break;
750 case 'f':
751 if (length == 5 && memcmp("false", data, 5) == 0) return 16;
752 if (length == 2 && memcmp("fg", data, 2) == 0) return 34;
753 if (length == 6 && memcmp("failed", data, 6) == 0) return 61;
754 if (length == 4 && memcmp("fork", data, 4) == 0) return 62;
755 if (length == 8 && memcmp("forkwait", data, 8) == 0) return 63;
756 if (length == 5 && memcmp("fopen", data, 5) == 0) return 64;
757 break;
758 case 'g':
759 if (length == 7 && memcmp("getopts", data, 7) == 0) return 42;
760 break;
761 case 'h':
762 if (length == 4 && memcmp("hash", data, 4) == 0) return 46;
763 if (length == 4 && memcmp("help", data, 4) == 0) return 47;
764 if (length == 7 && memcmp("history", data, 7) == 0) return 48;
765 if (length == 3 && memcmp("hay", data, 3) == 0) return 57;
766 if (length == 7 && memcmp("haynode", data, 7) == 0) return 58;
767 break;
768 case 'i':
769 if (length == 7 && memcmp("is-main", data, 7) == 0) return 73;
770 break;
771 case 'j':
772 if (length == 4 && memcmp("jobs", data, 4) == 0) return 33;
773 if (length == 4 && memcmp("json", data, 4) == 0) return 54;
774 if (length == 5 && memcmp("json8", data, 5) == 0) return 55;
775 break;
776 case 'm':
777 if (length == 7 && memcmp("mapfile", data, 7) == 0) return 22;
778 break;
779 case 'p':
780 if (length == 6 && memcmp("printf", data, 6) == 0) return 21;
781 if (length == 5 && memcmp("pushd", data, 5) == 0) return 25;
782 if (length == 4 && memcmp("popd", data, 4) == 0) return 26;
783 if (length == 3 && memcmp("pwd", data, 3) == 0) return 28;
784 if (length == 2 && memcmp("pp", data, 2) == 0) return 56;
785 if (length == 14 && memcmp("push-registers", data, 14) == 0) return 71;
786 break;
787 case 'r':
788 if (length == 4 && memcmp("read", data, 4) == 0) return 19;
789 if (length == 9 && memcmp("readarray", data, 9) == 0) return 23;
790 if (length == 7 && memcmp("runproc", data, 7) == 0) return 67;
791 break;
792 case 's':
793 if (length == 6 && memcmp("source", data, 6) == 0) return 29;
794 if (length == 5 && memcmp("shopt", data, 5) == 0) return 36;
795 if (length == 5 && memcmp("shvar", data, 5) == 0) return 65;
796 if (length == 12 && memcmp("source-guard", data, 12) == 0) return 72;
797 break;
798 case 't':
799 if (length == 4 && memcmp("true", data, 4) == 0) return 15;
800 if (length == 3 && memcmp("try", data, 3) == 0) return 17;
801 if (length == 4 && memcmp("type", data, 4) == 0) return 45;
802 if (length == 4 && memcmp("test", data, 4) == 0) return 69;
803 break;
804 case 'u':
805 if (length == 5 && memcmp("umask", data, 5) == 0) return 30;
806 if (length == 6 && memcmp("ulimit", data, 6) == 0) return 31;
807 if (length == 7 && memcmp("unalias", data, 7) == 0) return 50;
808 if (length == 3 && memcmp("use", data, 3) == 0) return 59;
809 break;
810 case 'w':
811 if (length == 4 && memcmp("wait", data, 4) == 0) return 32;
812 if (length == 5 && memcmp("write", data, 5) == 0) return 53;
813 break;
814 }
815
816 return 0; // consts.NO_INDEX
817}
818
819builtin_t LookupAssignBuiltin(BigStr* s) {
820 int length = len(s);
821 if (length == 0) return 0; // consts.NO_INDEX
822
823 const char* data = s->data_;
824 switch (data[0]) {
825 case 'd':
826 if (length == 7 && memcmp("declare", data, 7) == 0) return 12;
827 break;
828 case 'e':
829 if (length == 6 && memcmp("export", data, 6) == 0) return 14;
830 break;
831 case 'l':
832 if (length == 5 && memcmp("local", data, 5) == 0) return 11;
833 break;
834 case 'r':
835 if (length == 8 && memcmp("readonly", data, 8) == 0) return 10;
836 break;
837 case 't':
838 if (length == 7 && memcmp("typeset", data, 7) == 0) return 13;
839 break;
840 }
841
842 return 0; // consts.NO_INDEX
843}
844
845builtin_t LookupSpecialBuiltin(BigStr* s) {
846 int length = len(s);
847 if (length == 0) return 0; // consts.NO_INDEX
848
849 const char* data = s->data_;
850 switch (data[0]) {
851 case '.':
852 if (length == 1 && memcmp(".", data, 1) == 0) return 2;
853 break;
854 case ':':
855 if (length == 1 && memcmp(":", data, 1) == 0) return 1;
856 break;
857 case 'e':
858 if (length == 4 && memcmp("exec", data, 4) == 0) return 3;
859 if (length == 4 && memcmp("eval", data, 4) == 0) return 4;
860 break;
861 case 's':
862 if (length == 3 && memcmp("set", data, 3) == 0) return 5;
863 if (length == 5 && memcmp("shift", data, 5) == 0) return 6;
864 break;
865 case 't':
866 if (length == 5 && memcmp("times", data, 5) == 0) return 7;
867 if (length == 4 && memcmp("trap", data, 4) == 0) return 8;
868 break;
869 case 'u':
870 if (length == 5 && memcmp("unset", data, 5) == 0) return 9;
871 break;
872 }
873
874 return 0; // consts.NO_INDEX
875}
876
877bool IsControlFlow(BigStr* s) {
878 int length = len(s);
879 if (length == 0) return false;
880
881 const char* data = s->data_;
882 switch (data[0]) {
883 case 'b':
884 if (length == 5 && memcmp("break", data, 5) == 0) return true;
885 break;
886 case 'c':
887 if (length == 8 && memcmp("continue", data, 8) == 0) return true;
888 break;
889 case 'e':
890 if (length == 4 && memcmp("exit", data, 4) == 0) return true;
891 break;
892 case 'r':
893 if (length == 6 && memcmp("return", data, 6) == 0) return true;
894 break;
895 }
896
897 return false;
898}
899
900GLOBAL_STR(kControlFlowName_310, "break");
901GLOBAL_STR(kControlFlowName_311, "continue");
902GLOBAL_STR(kControlFlowName_312, "return");
903GLOBAL_STR(kControlFlowName_313, "exit");
904
905BigStr* ControlFlowName(int i) {
906 switch (i) {
907 case 310:
908 return kControlFlowName_310;
909 break;
910 case 311:
911 return kControlFlowName_311;
912 break;
913 case 312:
914 return kControlFlowName_312;
915 break;
916 case 313:
917 return kControlFlowName_313;
918 break;
919 default:
920 FAIL(kShouldNotGetHere);
921 }
922}
923
924bool IsKeyword(BigStr* s) {
925 int length = len(s);
926 if (length == 0) return false;
927
928 const char* data = s->data_;
929 switch (data[0]) {
930 case '!':
931 if (length == 1 && memcmp("!", data, 1) == 0) return true;
932 break;
933 case '=':
934 if (length == 1 && memcmp("=", data, 1) == 0) return true;
935 break;
936 case '[':
937 if (length == 2 && memcmp("[[", data, 2) == 0) return true;
938 break;
939 case ']':
940 if (length == 2 && memcmp("]]", data, 2) == 0) return true;
941 break;
942 case 'c':
943 if (length == 4 && memcmp("case", data, 4) == 0) return true;
944 if (length == 5 && memcmp("const", data, 5) == 0) return true;
945 if (length == 4 && memcmp("call", data, 4) == 0) return true;
946 break;
947 case 'd':
948 if (length == 2 && memcmp("do", data, 2) == 0) return true;
949 if (length == 4 && memcmp("done", data, 4) == 0) return true;
950 break;
951 case 'e':
952 if (length == 4 && memcmp("esac", data, 4) == 0) return true;
953 if (length == 4 && memcmp("else", data, 4) == 0) return true;
954 if (length == 4 && memcmp("elif", data, 4) == 0) return true;
955 break;
956 case 'f':
957 if (length == 3 && memcmp("for", data, 3) == 0) return true;
958 if (length == 2 && memcmp("fi", data, 2) == 0) return true;
959 if (length == 8 && memcmp("function", data, 8) == 0) return true;
960 if (length == 4 && memcmp("func", data, 4) == 0) return true;
961 break;
962 case 'i':
963 if (length == 2 && memcmp("in", data, 2) == 0) return true;
964 if (length == 2 && memcmp("if", data, 2) == 0) return true;
965 break;
966 case 'p':
967 if (length == 4 && memcmp("proc", data, 4) == 0) return true;
968 break;
969 case 's':
970 if (length == 6 && memcmp("setvar", data, 6) == 0) return true;
971 if (length == 9 && memcmp("setglobal", data, 9) == 0) return true;
972 break;
973 case 't':
974 if (length == 4 && memcmp("then", data, 4) == 0) return true;
975 if (length == 4 && memcmp("time", data, 4) == 0) return true;
976 if (length == 5 && memcmp("typed", data, 5) == 0) return true;
977 break;
978 case 'u':
979 if (length == 5 && memcmp("until", data, 5) == 0) return true;
980 break;
981 case 'v':
982 if (length == 3 && memcmp("var", data, 3) == 0) return true;
983 break;
984 case 'w':
985 if (length == 5 && memcmp("while", data, 5) == 0) return true;
986 break;
987 case '{':
988 if (length == 1 && memcmp("{", data, 1) == 0) return true;
989 break;
990 case '}':
991 if (length == 1 && memcmp("}", data, 1) == 0) return true;
992 break;
993 }
994
995 return false;
996}
997
998BigStr* LookupCharC(BigStr* c) {
999 assert(len(c) == 1);
1000
1001 char ch = c->data_[0];
1002
1003 // TODO-intern: return value
1004 switch (ch) {
1005 case '\"':
1006 return StrFromC("\"", 1);
1007 break;
1008 case '\'':
1009 return StrFromC("\'", 1);
1010 break;
1011 case '/':
1012 return StrFromC("/", 1);
1013 break;
1014 case '0':
1015 return StrFromC("\0", 1);
1016 break;
1017 case 'E':
1018 return StrFromC("\x1b", 1);
1019 break;
1020 case '\\':
1021 return StrFromC("\\", 1);
1022 break;
1023 case 'a':
1024 return StrFromC("\a", 1);
1025 break;
1026 case 'b':
1027 return StrFromC("\b", 1);
1028 break;
1029 case 'e':
1030 return StrFromC("\x1b", 1);
1031 break;
1032 case 'f':
1033 return StrFromC("\f", 1);
1034 break;
1035 case 'n':
1036 return StrFromC("\n", 1);
1037 break;
1038 case 'r':
1039 return StrFromC("\r", 1);
1040 break;
1041 case 't':
1042 return StrFromC("\t", 1);
1043 break;
1044 case 'v':
1045 return StrFromC("\v", 1);
1046 break;
1047 default:
1048 assert(0);
1049
1050 }
1051}
1052BigStr* LookupCharPrompt(BigStr* c) {
1053 assert(len(c) == 1);
1054
1055 char ch = c->data_[0];
1056
1057 // TODO-intern: return value
1058 switch (ch) {
1059 case '\\':
1060 return StrFromC("\\", 1);
1061 break;
1062 case 'a':
1063 return StrFromC("\a", 1);
1064 break;
1065 case 'e':
1066 return StrFromC("\x1b", 1);
1067 break;
1068 case 'n':
1069 return StrFromC("\n", 1);
1070 break;
1071 case 'r':
1072 return StrFromC("\r", 1);
1073 break;
1074 default:
1075 return nullptr;
1076
1077 }
1078}
1079GLOBAL_STR(kOptionName_1, "errexit");
1080GLOBAL_STR(kOptionName_2, "nounset");
1081GLOBAL_STR(kOptionName_3, "pipefail");
1082GLOBAL_STR(kOptionName_4, "inherit_errexit");
1083GLOBAL_STR(kOptionName_5, "nullglob");
1084GLOBAL_STR(kOptionName_6, "verbose_errexit");
1085GLOBAL_STR(kOptionName_7, "noexec");
1086GLOBAL_STR(kOptionName_8, "xtrace");
1087GLOBAL_STR(kOptionName_9, "verbose");
1088GLOBAL_STR(kOptionName_10, "noglob");
1089GLOBAL_STR(kOptionName_11, "noclobber");
1090GLOBAL_STR(kOptionName_12, "errtrace");
1091GLOBAL_STR(kOptionName_13, "posix");
1092GLOBAL_STR(kOptionName_14, "vi");
1093GLOBAL_STR(kOptionName_15, "emacs");
1094GLOBAL_STR(kOptionName_16, "interactive");
1095GLOBAL_STR(kOptionName_17, "hashall");
1096GLOBAL_STR(kOptionName_18, "failglob");
1097GLOBAL_STR(kOptionName_19, "extglob");
1098GLOBAL_STR(kOptionName_20, "nocasematch");
1099GLOBAL_STR(kOptionName_21, "no_copy_env");
1100GLOBAL_STR(kOptionName_22, "eval_unsafe_arith");
1101GLOBAL_STR(kOptionName_23, "ignore_flags_not_impl");
1102GLOBAL_STR(kOptionName_24, "ignore_opts_not_impl");
1103GLOBAL_STR(kOptionName_25, "_allow_command_sub");
1104GLOBAL_STR(kOptionName_26, "_allow_process_sub");
1105GLOBAL_STR(kOptionName_27, "dynamic_scope");
1106GLOBAL_STR(kOptionName_28, "redefine_module");
1107GLOBAL_STR(kOptionName_29, "_running_trap");
1108GLOBAL_STR(kOptionName_30, "_running_hay");
1109GLOBAL_STR(kOptionName_31, "_no_debug_trap");
1110GLOBAL_STR(kOptionName_32, "_no_err_trap");
1111GLOBAL_STR(kOptionName_33, "strict_parse_slice");
1112GLOBAL_STR(kOptionName_34, "strict_argv");
1113GLOBAL_STR(kOptionName_35, "strict_arith");
1114GLOBAL_STR(kOptionName_36, "strict_array");
1115GLOBAL_STR(kOptionName_37, "strict_control_flow");
1116GLOBAL_STR(kOptionName_38, "strict_errexit");
1117GLOBAL_STR(kOptionName_39, "strict_nameref");
1118GLOBAL_STR(kOptionName_40, "strict_word_eval");
1119GLOBAL_STR(kOptionName_41, "strict_tilde");
1120GLOBAL_STR(kOptionName_42, "strict_glob");
1121GLOBAL_STR(kOptionName_43, "parse_at");
1122GLOBAL_STR(kOptionName_44, "parse_proc");
1123GLOBAL_STR(kOptionName_45, "parse_func");
1124GLOBAL_STR(kOptionName_46, "parse_brace");
1125GLOBAL_STR(kOptionName_47, "parse_bracket");
1126GLOBAL_STR(kOptionName_48, "parse_equals");
1127GLOBAL_STR(kOptionName_49, "parse_paren");
1128GLOBAL_STR(kOptionName_50, "parse_ysh_string");
1129GLOBAL_STR(kOptionName_51, "parse_triple_quote");
1130GLOBAL_STR(kOptionName_52, "simple_word_eval");
1131GLOBAL_STR(kOptionName_53, "dashglob");
1132GLOBAL_STR(kOptionName_54, "command_sub_errexit");
1133GLOBAL_STR(kOptionName_55, "process_sub_fail");
1134GLOBAL_STR(kOptionName_56, "xtrace_rich");
1135GLOBAL_STR(kOptionName_57, "xtrace_details");
1136GLOBAL_STR(kOptionName_58, "sigpipe_status_ok");
1137GLOBAL_STR(kOptionName_59, "redefine_proc_func");
1138GLOBAL_STR(kOptionName_60, "parse_at_all");
1139GLOBAL_STR(kOptionName_61, "parse_backslash");
1140GLOBAL_STR(kOptionName_62, "parse_backticks");
1141GLOBAL_STR(kOptionName_63, "parse_dollar");
1142GLOBAL_STR(kOptionName_64, "parse_ignored");
1143GLOBAL_STR(kOptionName_65, "parse_sh_arith");
1144GLOBAL_STR(kOptionName_66, "parse_dparen");
1145GLOBAL_STR(kOptionName_67, "parse_dbracket");
1146GLOBAL_STR(kOptionName_68, "parse_bare_word");
1147GLOBAL_STR(kOptionName_69, "simple_echo");
1148GLOBAL_STR(kOptionName_70, "simple_eval_builtin");
1149GLOBAL_STR(kOptionName_71, "simple_test_builtin");
1150GLOBAL_STR(kOptionName_72, "expand_aliases");
1151GLOBAL_STR(kOptionName_73, "lastpipe");
1152GLOBAL_STR(kOptionName_74, "progcomp");
1153GLOBAL_STR(kOptionName_75, "histappend");
1154GLOBAL_STR(kOptionName_76, "hostcomplete");
1155GLOBAL_STR(kOptionName_77, "cmdhist");
1156GLOBAL_STR(kOptionName_78, "assoc_expand_once");
1157GLOBAL_STR(kOptionName_79, "autocd");
1158GLOBAL_STR(kOptionName_80, "cdable_vars");
1159GLOBAL_STR(kOptionName_81, "cdspell");
1160GLOBAL_STR(kOptionName_82, "checkhash");
1161GLOBAL_STR(kOptionName_83, "checkjobs");
1162GLOBAL_STR(kOptionName_84, "checkwinsize");
1163GLOBAL_STR(kOptionName_85, "complete_fullquote");
1164GLOBAL_STR(kOptionName_86, "direxpand");
1165GLOBAL_STR(kOptionName_87, "dirspell");
1166GLOBAL_STR(kOptionName_88, "dotglob");
1167GLOBAL_STR(kOptionName_89, "execfail");
1168GLOBAL_STR(kOptionName_90, "extdebug");
1169GLOBAL_STR(kOptionName_91, "extquote");
1170GLOBAL_STR(kOptionName_92, "force_fignore");
1171GLOBAL_STR(kOptionName_93, "globasciiranges");
1172GLOBAL_STR(kOptionName_94, "globstar");
1173GLOBAL_STR(kOptionName_95, "gnu_errfmt");
1174GLOBAL_STR(kOptionName_96, "histreedit");
1175GLOBAL_STR(kOptionName_97, "histverify");
1176GLOBAL_STR(kOptionName_98, "huponexit");
1177GLOBAL_STR(kOptionName_99, "interactive_comments");
1178GLOBAL_STR(kOptionName_100, "lithist");
1179GLOBAL_STR(kOptionName_101, "localvar_inherit");
1180GLOBAL_STR(kOptionName_102, "localvar_unset");
1181GLOBAL_STR(kOptionName_103, "login_shell");
1182GLOBAL_STR(kOptionName_104, "mailwarn");
1183GLOBAL_STR(kOptionName_105, "no_empty_cmd_completion");
1184GLOBAL_STR(kOptionName_106, "nocaseglob");
1185GLOBAL_STR(kOptionName_107, "progcomp_alias");
1186GLOBAL_STR(kOptionName_108, "promptvars");
1187GLOBAL_STR(kOptionName_109, "restricted_shell");
1188GLOBAL_STR(kOptionName_110, "shift_verbose");
1189GLOBAL_STR(kOptionName_111, "sourcepath");
1190GLOBAL_STR(kOptionName_112, "xpg_echo");
1191
1192BigStr* OptionName(int i) {
1193 switch (i) {
1194 case 1:
1195 return kOptionName_1;
1196 break;
1197 case 2:
1198 return kOptionName_2;
1199 break;
1200 case 3:
1201 return kOptionName_3;
1202 break;
1203 case 4:
1204 return kOptionName_4;
1205 break;
1206 case 5:
1207 return kOptionName_5;
1208 break;
1209 case 6:
1210 return kOptionName_6;
1211 break;
1212 case 7:
1213 return kOptionName_7;
1214 break;
1215 case 8:
1216 return kOptionName_8;
1217 break;
1218 case 9:
1219 return kOptionName_9;
1220 break;
1221 case 10:
1222 return kOptionName_10;
1223 break;
1224 case 11:
1225 return kOptionName_11;
1226 break;
1227 case 12:
1228 return kOptionName_12;
1229 break;
1230 case 13:
1231 return kOptionName_13;
1232 break;
1233 case 14:
1234 return kOptionName_14;
1235 break;
1236 case 15:
1237 return kOptionName_15;
1238 break;
1239 case 16:
1240 return kOptionName_16;
1241 break;
1242 case 17:
1243 return kOptionName_17;
1244 break;
1245 case 18:
1246 return kOptionName_18;
1247 break;
1248 case 19:
1249 return kOptionName_19;
1250 break;
1251 case 20:
1252 return kOptionName_20;
1253 break;
1254 case 21:
1255 return kOptionName_21;
1256 break;
1257 case 22:
1258 return kOptionName_22;
1259 break;
1260 case 23:
1261 return kOptionName_23;
1262 break;
1263 case 24:
1264 return kOptionName_24;
1265 break;
1266 case 25:
1267 return kOptionName_25;
1268 break;
1269 case 26:
1270 return kOptionName_26;
1271 break;
1272 case 27:
1273 return kOptionName_27;
1274 break;
1275 case 28:
1276 return kOptionName_28;
1277 break;
1278 case 29:
1279 return kOptionName_29;
1280 break;
1281 case 30:
1282 return kOptionName_30;
1283 break;
1284 case 31:
1285 return kOptionName_31;
1286 break;
1287 case 32:
1288 return kOptionName_32;
1289 break;
1290 case 33:
1291 return kOptionName_33;
1292 break;
1293 case 34:
1294 return kOptionName_34;
1295 break;
1296 case 35:
1297 return kOptionName_35;
1298 break;
1299 case 36:
1300 return kOptionName_36;
1301 break;
1302 case 37:
1303 return kOptionName_37;
1304 break;
1305 case 38:
1306 return kOptionName_38;
1307 break;
1308 case 39:
1309 return kOptionName_39;
1310 break;
1311 case 40:
1312 return kOptionName_40;
1313 break;
1314 case 41:
1315 return kOptionName_41;
1316 break;
1317 case 42:
1318 return kOptionName_42;
1319 break;
1320 case 43:
1321 return kOptionName_43;
1322 break;
1323 case 44:
1324 return kOptionName_44;
1325 break;
1326 case 45:
1327 return kOptionName_45;
1328 break;
1329 case 46:
1330 return kOptionName_46;
1331 break;
1332 case 47:
1333 return kOptionName_47;
1334 break;
1335 case 48:
1336 return kOptionName_48;
1337 break;
1338 case 49:
1339 return kOptionName_49;
1340 break;
1341 case 50:
1342 return kOptionName_50;
1343 break;
1344 case 51:
1345 return kOptionName_51;
1346 break;
1347 case 52:
1348 return kOptionName_52;
1349 break;
1350 case 53:
1351 return kOptionName_53;
1352 break;
1353 case 54:
1354 return kOptionName_54;
1355 break;
1356 case 55:
1357 return kOptionName_55;
1358 break;
1359 case 56:
1360 return kOptionName_56;
1361 break;
1362 case 57:
1363 return kOptionName_57;
1364 break;
1365 case 58:
1366 return kOptionName_58;
1367 break;
1368 case 59:
1369 return kOptionName_59;
1370 break;
1371 case 60:
1372 return kOptionName_60;
1373 break;
1374 case 61:
1375 return kOptionName_61;
1376 break;
1377 case 62:
1378 return kOptionName_62;
1379 break;
1380 case 63:
1381 return kOptionName_63;
1382 break;
1383 case 64:
1384 return kOptionName_64;
1385 break;
1386 case 65:
1387 return kOptionName_65;
1388 break;
1389 case 66:
1390 return kOptionName_66;
1391 break;
1392 case 67:
1393 return kOptionName_67;
1394 break;
1395 case 68:
1396 return kOptionName_68;
1397 break;
1398 case 69:
1399 return kOptionName_69;
1400 break;
1401 case 70:
1402 return kOptionName_70;
1403 break;
1404 case 71:
1405 return kOptionName_71;
1406 break;
1407 case 72:
1408 return kOptionName_72;
1409 break;
1410 case 73:
1411 return kOptionName_73;
1412 break;
1413 case 74:
1414 return kOptionName_74;
1415 break;
1416 case 75:
1417 return kOptionName_75;
1418 break;
1419 case 76:
1420 return kOptionName_76;
1421 break;
1422 case 77:
1423 return kOptionName_77;
1424 break;
1425 case 78:
1426 return kOptionName_78;
1427 break;
1428 case 79:
1429 return kOptionName_79;
1430 break;
1431 case 80:
1432 return kOptionName_80;
1433 break;
1434 case 81:
1435 return kOptionName_81;
1436 break;
1437 case 82:
1438 return kOptionName_82;
1439 break;
1440 case 83:
1441 return kOptionName_83;
1442 break;
1443 case 84:
1444 return kOptionName_84;
1445 break;
1446 case 85:
1447 return kOptionName_85;
1448 break;
1449 case 86:
1450 return kOptionName_86;
1451 break;
1452 case 87:
1453 return kOptionName_87;
1454 break;
1455 case 88:
1456 return kOptionName_88;
1457 break;
1458 case 89:
1459 return kOptionName_89;
1460 break;
1461 case 90:
1462 return kOptionName_90;
1463 break;
1464 case 91:
1465 return kOptionName_91;
1466 break;
1467 case 92:
1468 return kOptionName_92;
1469 break;
1470 case 93:
1471 return kOptionName_93;
1472 break;
1473 case 94:
1474 return kOptionName_94;
1475 break;
1476 case 95:
1477 return kOptionName_95;
1478 break;
1479 case 96:
1480 return kOptionName_96;
1481 break;
1482 case 97:
1483 return kOptionName_97;
1484 break;
1485 case 98:
1486 return kOptionName_98;
1487 break;
1488 case 99:
1489 return kOptionName_99;
1490 break;
1491 case 100:
1492 return kOptionName_100;
1493 break;
1494 case 101:
1495 return kOptionName_101;
1496 break;
1497 case 102:
1498 return kOptionName_102;
1499 break;
1500 case 103:
1501 return kOptionName_103;
1502 break;
1503 case 104:
1504 return kOptionName_104;
1505 break;
1506 case 105:
1507 return kOptionName_105;
1508 break;
1509 case 106:
1510 return kOptionName_106;
1511 break;
1512 case 107:
1513 return kOptionName_107;
1514 break;
1515 case 108:
1516 return kOptionName_108;
1517 break;
1518 case 109:
1519 return kOptionName_109;
1520 break;
1521 case 110:
1522 return kOptionName_110;
1523 break;
1524 case 111:
1525 return kOptionName_111;
1526 break;
1527 case 112:
1528 return kOptionName_112;
1529 break;
1530 default:
1531 FAIL(kShouldNotGetHere);
1532 }
1533}
1534
1535int _IFS_EDGE[8][6] = {
1536 { -1, -1, -1, -1, -1, -1 },
1537 { -1, -1, -1, -1, -1, -1 },
1538 { -1, (1<<16)|5, (4<<16)|3, (6<<16)|5, (7<<16)|5, (8<<16)|5 },
1539 { -1, (3<<16)|5, (4<<16)|5, (6<<16)|2, (7<<16)|2, (8<<16)|5 },
1540 { -1, (5<<16)|5, (4<<16)|3, (6<<16)|2, (6<<16)|2, (8<<16)|2 },
1541 { -1, (5<<16)|5, (4<<16)|3, (6<<16)|2, (7<<16)|2, (8<<16)|2 },
1542 { -1, (3<<16)|1, (4<<16)|1, (6<<16)|5, (7<<16)|1, (8<<16)|1 },
1543 { -1, (6<<16)|4, (6<<16)|4, (6<<16)|4, (6<<16)|4, (8<<16)|4 },
1544
1545};
1546
1547// Note: all of these are integers, e.g. state_i, emit_i, char_kind_i
1548using runtime_asdl::state_t;
1549using runtime_asdl::emit_t;
1550using runtime_asdl::char_kind_t;
1551
1552Tuple2<state_t, emit_t> IfsEdge(state_t state, runtime_asdl::char_kind_t ch) {
1553 int cell = _IFS_EDGE[state][ch];
1554 state_t new_state = cell >> 16;
1555 emit_t emit = cell & 0xFFFF;
1556 return Tuple2<state_t, emit_t>(new_state, emit);
1557}
1558
1559GLOBAL_STR(kBUILTIN_NAMES_0, ":");
1560GLOBAL_STR(kBUILTIN_NAMES_1, ".");
1561GLOBAL_STR(kBUILTIN_NAMES_2, "exec");
1562GLOBAL_STR(kBUILTIN_NAMES_3, "eval");
1563GLOBAL_STR(kBUILTIN_NAMES_4, "set");
1564GLOBAL_STR(kBUILTIN_NAMES_5, "shift");
1565GLOBAL_STR(kBUILTIN_NAMES_6, "times");
1566GLOBAL_STR(kBUILTIN_NAMES_7, "trap");
1567GLOBAL_STR(kBUILTIN_NAMES_8, "unset");
1568GLOBAL_STR(kBUILTIN_NAMES_9, "readonly");
1569GLOBAL_STR(kBUILTIN_NAMES_10, "local");
1570GLOBAL_STR(kBUILTIN_NAMES_11, "declare");
1571GLOBAL_STR(kBUILTIN_NAMES_12, "typeset");
1572GLOBAL_STR(kBUILTIN_NAMES_13, "export");
1573GLOBAL_STR(kBUILTIN_NAMES_14, "true");
1574GLOBAL_STR(kBUILTIN_NAMES_15, "false");
1575GLOBAL_STR(kBUILTIN_NAMES_16, "try");
1576GLOBAL_STR(kBUILTIN_NAMES_17, "assert");
1577GLOBAL_STR(kBUILTIN_NAMES_18, "read");
1578GLOBAL_STR(kBUILTIN_NAMES_19, "echo");
1579GLOBAL_STR(kBUILTIN_NAMES_20, "printf");
1580GLOBAL_STR(kBUILTIN_NAMES_21, "mapfile");
1581GLOBAL_STR(kBUILTIN_NAMES_22, "readarray");
1582GLOBAL_STR(kBUILTIN_NAMES_23, "cd");
1583GLOBAL_STR(kBUILTIN_NAMES_24, "pushd");
1584GLOBAL_STR(kBUILTIN_NAMES_25, "popd");
1585GLOBAL_STR(kBUILTIN_NAMES_26, "dirs");
1586GLOBAL_STR(kBUILTIN_NAMES_27, "pwd");
1587GLOBAL_STR(kBUILTIN_NAMES_28, "source");
1588GLOBAL_STR(kBUILTIN_NAMES_29, "umask");
1589GLOBAL_STR(kBUILTIN_NAMES_30, "ulimit");
1590GLOBAL_STR(kBUILTIN_NAMES_31, "wait");
1591GLOBAL_STR(kBUILTIN_NAMES_32, "jobs");
1592GLOBAL_STR(kBUILTIN_NAMES_33, "fg");
1593GLOBAL_STR(kBUILTIN_NAMES_34, "bg");
1594GLOBAL_STR(kBUILTIN_NAMES_35, "shopt");
1595GLOBAL_STR(kBUILTIN_NAMES_36, "complete");
1596GLOBAL_STR(kBUILTIN_NAMES_37, "compgen");
1597GLOBAL_STR(kBUILTIN_NAMES_38, "compopt");
1598GLOBAL_STR(kBUILTIN_NAMES_39, "compadjust");
1599GLOBAL_STR(kBUILTIN_NAMES_40, "compexport");
1600GLOBAL_STR(kBUILTIN_NAMES_41, "getopts");
1601GLOBAL_STR(kBUILTIN_NAMES_42, "builtin");
1602GLOBAL_STR(kBUILTIN_NAMES_43, "command");
1603GLOBAL_STR(kBUILTIN_NAMES_44, "type");
1604GLOBAL_STR(kBUILTIN_NAMES_45, "hash");
1605GLOBAL_STR(kBUILTIN_NAMES_46, "help");
1606GLOBAL_STR(kBUILTIN_NAMES_47, "history");
1607GLOBAL_STR(kBUILTIN_NAMES_48, "alias");
1608GLOBAL_STR(kBUILTIN_NAMES_49, "unalias");
1609GLOBAL_STR(kBUILTIN_NAMES_50, "bind");
1610GLOBAL_STR(kBUILTIN_NAMES_51, "append");
1611GLOBAL_STR(kBUILTIN_NAMES_52, "write");
1612GLOBAL_STR(kBUILTIN_NAMES_53, "json");
1613GLOBAL_STR(kBUILTIN_NAMES_54, "json8");
1614GLOBAL_STR(kBUILTIN_NAMES_55, "pp");
1615GLOBAL_STR(kBUILTIN_NAMES_56, "hay");
1616GLOBAL_STR(kBUILTIN_NAMES_57, "haynode");
1617GLOBAL_STR(kBUILTIN_NAMES_58, "use");
1618GLOBAL_STR(kBUILTIN_NAMES_59, "error");
1619GLOBAL_STR(kBUILTIN_NAMES_60, "failed");
1620GLOBAL_STR(kBUILTIN_NAMES_61, "fork");
1621GLOBAL_STR(kBUILTIN_NAMES_62, "forkwait");
1622GLOBAL_STR(kBUILTIN_NAMES_63, "fopen");
1623GLOBAL_STR(kBUILTIN_NAMES_64, "shvar");
1624GLOBAL_STR(kBUILTIN_NAMES_65, "ctx");
1625GLOBAL_STR(kBUILTIN_NAMES_66, "runproc");
1626GLOBAL_STR(kBUILTIN_NAMES_67, "boolstatus");
1627GLOBAL_STR(kBUILTIN_NAMES_68, "test");
1628GLOBAL_STR(kBUILTIN_NAMES_69, "[");
1629GLOBAL_STR(kBUILTIN_NAMES_70, "push-registers");
1630GLOBAL_STR(kBUILTIN_NAMES_71, "source-guard");
1631GLOBAL_STR(kBUILTIN_NAMES_72, "is-main");
1632GLOBAL_STR(kBUILTIN_NAMES_73, "__cat");
1633GLOBAL_LIST(BUILTIN_NAMES, BigStr*, 74, {kBUILTIN_NAMES_0 COMMA kBUILTIN_NAMES_1 COMMA kBUILTIN_NAMES_2 COMMA kBUILTIN_NAMES_3 COMMA kBUILTIN_NAMES_4 COMMA kBUILTIN_NAMES_5 COMMA kBUILTIN_NAMES_6 COMMA kBUILTIN_NAMES_7 COMMA kBUILTIN_NAMES_8 COMMA kBUILTIN_NAMES_9 COMMA kBUILTIN_NAMES_10 COMMA kBUILTIN_NAMES_11 COMMA kBUILTIN_NAMES_12 COMMA kBUILTIN_NAMES_13 COMMA kBUILTIN_NAMES_14 COMMA kBUILTIN_NAMES_15 COMMA kBUILTIN_NAMES_16 COMMA kBUILTIN_NAMES_17 COMMA kBUILTIN_NAMES_18 COMMA kBUILTIN_NAMES_19 COMMA kBUILTIN_NAMES_20 COMMA kBUILTIN_NAMES_21 COMMA kBUILTIN_NAMES_22 COMMA kBUILTIN_NAMES_23 COMMA kBUILTIN_NAMES_24 COMMA kBUILTIN_NAMES_25 COMMA kBUILTIN_NAMES_26 COMMA kBUILTIN_NAMES_27 COMMA kBUILTIN_NAMES_28 COMMA kBUILTIN_NAMES_29 COMMA kBUILTIN_NAMES_30 COMMA kBUILTIN_NAMES_31 COMMA kBUILTIN_NAMES_32 COMMA kBUILTIN_NAMES_33 COMMA kBUILTIN_NAMES_34 COMMA kBUILTIN_NAMES_35 COMMA kBUILTIN_NAMES_36 COMMA kBUILTIN_NAMES_37 COMMA kBUILTIN_NAMES_38 COMMA kBUILTIN_NAMES_39 COMMA kBUILTIN_NAMES_40 COMMA kBUILTIN_NAMES_41 COMMA kBUILTIN_NAMES_42 COMMA kBUILTIN_NAMES_43 COMMA kBUILTIN_NAMES_44 COMMA kBUILTIN_NAMES_45 COMMA kBUILTIN_NAMES_46 COMMA kBUILTIN_NAMES_47 COMMA kBUILTIN_NAMES_48 COMMA kBUILTIN_NAMES_49 COMMA kBUILTIN_NAMES_50 COMMA kBUILTIN_NAMES_51 COMMA kBUILTIN_NAMES_52 COMMA kBUILTIN_NAMES_53 COMMA kBUILTIN_NAMES_54 COMMA kBUILTIN_NAMES_55 COMMA kBUILTIN_NAMES_56 COMMA kBUILTIN_NAMES_57 COMMA kBUILTIN_NAMES_58 COMMA kBUILTIN_NAMES_59 COMMA kBUILTIN_NAMES_60 COMMA kBUILTIN_NAMES_61 COMMA kBUILTIN_NAMES_62 COMMA kBUILTIN_NAMES_63 COMMA kBUILTIN_NAMES_64 COMMA kBUILTIN_NAMES_65 COMMA kBUILTIN_NAMES_66 COMMA kBUILTIN_NAMES_67 COMMA kBUILTIN_NAMES_68 COMMA kBUILTIN_NAMES_69 COMMA kBUILTIN_NAMES_70 COMMA kBUILTIN_NAMES_71 COMMA kBUILTIN_NAMES_72 COMMA kBUILTIN_NAMES_73});
1634
1635GLOBAL_STR(kOSH_KEYWORD_NAMES_0, "[[");
1636GLOBAL_STR(kOSH_KEYWORD_NAMES_1, "!");
1637GLOBAL_STR(kOSH_KEYWORD_NAMES_2, "for");
1638GLOBAL_STR(kOSH_KEYWORD_NAMES_3, "while");
1639GLOBAL_STR(kOSH_KEYWORD_NAMES_4, "until");
1640GLOBAL_STR(kOSH_KEYWORD_NAMES_5, "do");
1641GLOBAL_STR(kOSH_KEYWORD_NAMES_6, "done");
1642GLOBAL_STR(kOSH_KEYWORD_NAMES_7, "in");
1643GLOBAL_STR(kOSH_KEYWORD_NAMES_8, "case");
1644GLOBAL_STR(kOSH_KEYWORD_NAMES_9, "esac");
1645GLOBAL_STR(kOSH_KEYWORD_NAMES_10, "if");
1646GLOBAL_STR(kOSH_KEYWORD_NAMES_11, "fi");
1647GLOBAL_STR(kOSH_KEYWORD_NAMES_12, "then");
1648GLOBAL_STR(kOSH_KEYWORD_NAMES_13, "else");
1649GLOBAL_STR(kOSH_KEYWORD_NAMES_14, "elif");
1650GLOBAL_STR(kOSH_KEYWORD_NAMES_15, "function");
1651GLOBAL_STR(kOSH_KEYWORD_NAMES_16, "time");
1652GLOBAL_STR(kOSH_KEYWORD_NAMES_17, "const");
1653GLOBAL_STR(kOSH_KEYWORD_NAMES_18, "var");
1654GLOBAL_STR(kOSH_KEYWORD_NAMES_19, "setvar");
1655GLOBAL_STR(kOSH_KEYWORD_NAMES_20, "setglobal");
1656GLOBAL_STR(kOSH_KEYWORD_NAMES_21, "call");
1657GLOBAL_STR(kOSH_KEYWORD_NAMES_22, "proc");
1658GLOBAL_STR(kOSH_KEYWORD_NAMES_23, "typed");
1659GLOBAL_STR(kOSH_KEYWORD_NAMES_24, "func");
1660GLOBAL_STR(kOSH_KEYWORD_NAMES_25, "{");
1661GLOBAL_STR(kOSH_KEYWORD_NAMES_26, "=");
1662GLOBAL_STR(kOSH_KEYWORD_NAMES_27, "}");
1663GLOBAL_STR(kOSH_KEYWORD_NAMES_28, "]]");
1664GLOBAL_LIST(OSH_KEYWORD_NAMES, BigStr*, 29, {kOSH_KEYWORD_NAMES_0 COMMA kOSH_KEYWORD_NAMES_1 COMMA kOSH_KEYWORD_NAMES_2 COMMA kOSH_KEYWORD_NAMES_3 COMMA kOSH_KEYWORD_NAMES_4 COMMA kOSH_KEYWORD_NAMES_5 COMMA kOSH_KEYWORD_NAMES_6 COMMA kOSH_KEYWORD_NAMES_7 COMMA kOSH_KEYWORD_NAMES_8 COMMA kOSH_KEYWORD_NAMES_9 COMMA kOSH_KEYWORD_NAMES_10 COMMA kOSH_KEYWORD_NAMES_11 COMMA kOSH_KEYWORD_NAMES_12 COMMA kOSH_KEYWORD_NAMES_13 COMMA kOSH_KEYWORD_NAMES_14 COMMA kOSH_KEYWORD_NAMES_15 COMMA kOSH_KEYWORD_NAMES_16 COMMA kOSH_KEYWORD_NAMES_17 COMMA kOSH_KEYWORD_NAMES_18 COMMA kOSH_KEYWORD_NAMES_19 COMMA kOSH_KEYWORD_NAMES_20 COMMA kOSH_KEYWORD_NAMES_21 COMMA kOSH_KEYWORD_NAMES_22 COMMA kOSH_KEYWORD_NAMES_23 COMMA kOSH_KEYWORD_NAMES_24 COMMA kOSH_KEYWORD_NAMES_25 COMMA kOSH_KEYWORD_NAMES_26 COMMA kOSH_KEYWORD_NAMES_27 COMMA kOSH_KEYWORD_NAMES_28});
1665
1666GLOBAL_STR(kSET_OPTION_NAMES_0, "emacs");
1667GLOBAL_STR(kSET_OPTION_NAMES_1, "errexit");
1668GLOBAL_STR(kSET_OPTION_NAMES_2, "errtrace");
1669GLOBAL_STR(kSET_OPTION_NAMES_3, "hashall");
1670GLOBAL_STR(kSET_OPTION_NAMES_4, "noclobber");
1671GLOBAL_STR(kSET_OPTION_NAMES_5, "noexec");
1672GLOBAL_STR(kSET_OPTION_NAMES_6, "noglob");
1673GLOBAL_STR(kSET_OPTION_NAMES_7, "nounset");
1674GLOBAL_STR(kSET_OPTION_NAMES_8, "pipefail");
1675GLOBAL_STR(kSET_OPTION_NAMES_9, "posix");
1676GLOBAL_STR(kSET_OPTION_NAMES_10, "verbose");
1677GLOBAL_STR(kSET_OPTION_NAMES_11, "vi");
1678GLOBAL_STR(kSET_OPTION_NAMES_12, "xtrace");
1679GLOBAL_LIST(SET_OPTION_NAMES, BigStr*, 13, {kSET_OPTION_NAMES_0 COMMA kSET_OPTION_NAMES_1 COMMA kSET_OPTION_NAMES_2 COMMA kSET_OPTION_NAMES_3 COMMA kSET_OPTION_NAMES_4 COMMA kSET_OPTION_NAMES_5 COMMA kSET_OPTION_NAMES_6 COMMA kSET_OPTION_NAMES_7 COMMA kSET_OPTION_NAMES_8 COMMA kSET_OPTION_NAMES_9 COMMA kSET_OPTION_NAMES_10 COMMA kSET_OPTION_NAMES_11 COMMA kSET_OPTION_NAMES_12});
1680
1681GLOBAL_STR(kSHOPT_OPTION_NAMES_0, "_allow_command_sub");
1682GLOBAL_STR(kSHOPT_OPTION_NAMES_1, "_allow_process_sub");
1683GLOBAL_STR(kSHOPT_OPTION_NAMES_2, "_no_debug_trap");
1684GLOBAL_STR(kSHOPT_OPTION_NAMES_3, "_no_err_trap");
1685GLOBAL_STR(kSHOPT_OPTION_NAMES_4, "_running_hay");
1686GLOBAL_STR(kSHOPT_OPTION_NAMES_5, "_running_trap");
1687GLOBAL_STR(kSHOPT_OPTION_NAMES_6, "assoc_expand_once");
1688GLOBAL_STR(kSHOPT_OPTION_NAMES_7, "autocd");
1689GLOBAL_STR(kSHOPT_OPTION_NAMES_8, "cdable_vars");
1690GLOBAL_STR(kSHOPT_OPTION_NAMES_9, "cdspell");
1691GLOBAL_STR(kSHOPT_OPTION_NAMES_10, "checkhash");
1692GLOBAL_STR(kSHOPT_OPTION_NAMES_11, "checkjobs");
1693GLOBAL_STR(kSHOPT_OPTION_NAMES_12, "checkwinsize");
1694GLOBAL_STR(kSHOPT_OPTION_NAMES_13, "cmdhist");
1695GLOBAL_STR(kSHOPT_OPTION_NAMES_14, "command_sub_errexit");
1696GLOBAL_STR(kSHOPT_OPTION_NAMES_15, "complete_fullquote");
1697GLOBAL_STR(kSHOPT_OPTION_NAMES_16, "dashglob");
1698GLOBAL_STR(kSHOPT_OPTION_NAMES_17, "direxpand");
1699GLOBAL_STR(kSHOPT_OPTION_NAMES_18, "dirspell");
1700GLOBAL_STR(kSHOPT_OPTION_NAMES_19, "dotglob");
1701GLOBAL_STR(kSHOPT_OPTION_NAMES_20, "dynamic_scope");
1702GLOBAL_STR(kSHOPT_OPTION_NAMES_21, "eval_unsafe_arith");
1703GLOBAL_STR(kSHOPT_OPTION_NAMES_22, "execfail");
1704GLOBAL_STR(kSHOPT_OPTION_NAMES_23, "expand_aliases");
1705GLOBAL_STR(kSHOPT_OPTION_NAMES_24, "extdebug");
1706GLOBAL_STR(kSHOPT_OPTION_NAMES_25, "extglob");
1707GLOBAL_STR(kSHOPT_OPTION_NAMES_26, "extquote");
1708GLOBAL_STR(kSHOPT_OPTION_NAMES_27, "failglob");
1709GLOBAL_STR(kSHOPT_OPTION_NAMES_28, "force_fignore");
1710GLOBAL_STR(kSHOPT_OPTION_NAMES_29, "globasciiranges");
1711GLOBAL_STR(kSHOPT_OPTION_NAMES_30, "globstar");
1712GLOBAL_STR(kSHOPT_OPTION_NAMES_31, "gnu_errfmt");
1713GLOBAL_STR(kSHOPT_OPTION_NAMES_32, "histappend");
1714GLOBAL_STR(kSHOPT_OPTION_NAMES_33, "histreedit");
1715GLOBAL_STR(kSHOPT_OPTION_NAMES_34, "histverify");
1716GLOBAL_STR(kSHOPT_OPTION_NAMES_35, "hostcomplete");
1717GLOBAL_STR(kSHOPT_OPTION_NAMES_36, "huponexit");
1718GLOBAL_STR(kSHOPT_OPTION_NAMES_37, "ignore_flags_not_impl");
1719GLOBAL_STR(kSHOPT_OPTION_NAMES_38, "ignore_opts_not_impl");
1720GLOBAL_STR(kSHOPT_OPTION_NAMES_39, "inherit_errexit");
1721GLOBAL_STR(kSHOPT_OPTION_NAMES_40, "interactive_comments");
1722GLOBAL_STR(kSHOPT_OPTION_NAMES_41, "lastpipe");
1723GLOBAL_STR(kSHOPT_OPTION_NAMES_42, "lithist");
1724GLOBAL_STR(kSHOPT_OPTION_NAMES_43, "localvar_inherit");
1725GLOBAL_STR(kSHOPT_OPTION_NAMES_44, "localvar_unset");
1726GLOBAL_STR(kSHOPT_OPTION_NAMES_45, "login_shell");
1727GLOBAL_STR(kSHOPT_OPTION_NAMES_46, "mailwarn");
1728GLOBAL_STR(kSHOPT_OPTION_NAMES_47, "no_copy_env");
1729GLOBAL_STR(kSHOPT_OPTION_NAMES_48, "no_empty_cmd_completion");
1730GLOBAL_STR(kSHOPT_OPTION_NAMES_49, "nocaseglob");
1731GLOBAL_STR(kSHOPT_OPTION_NAMES_50, "nocasematch");
1732GLOBAL_STR(kSHOPT_OPTION_NAMES_51, "nullglob");
1733GLOBAL_STR(kSHOPT_OPTION_NAMES_52, "parse_at");
1734GLOBAL_STR(kSHOPT_OPTION_NAMES_53, "parse_at_all");
1735GLOBAL_STR(kSHOPT_OPTION_NAMES_54, "parse_backslash");
1736GLOBAL_STR(kSHOPT_OPTION_NAMES_55, "parse_backticks");
1737GLOBAL_STR(kSHOPT_OPTION_NAMES_56, "parse_bare_word");
1738GLOBAL_STR(kSHOPT_OPTION_NAMES_57, "parse_brace");
1739GLOBAL_STR(kSHOPT_OPTION_NAMES_58, "parse_bracket");
1740GLOBAL_STR(kSHOPT_OPTION_NAMES_59, "parse_dbracket");
1741GLOBAL_STR(kSHOPT_OPTION_NAMES_60, "parse_dollar");
1742GLOBAL_STR(kSHOPT_OPTION_NAMES_61, "parse_dparen");
1743GLOBAL_STR(kSHOPT_OPTION_NAMES_62, "parse_equals");
1744GLOBAL_STR(kSHOPT_OPTION_NAMES_63, "parse_func");
1745GLOBAL_STR(kSHOPT_OPTION_NAMES_64, "parse_ignored");
1746GLOBAL_STR(kSHOPT_OPTION_NAMES_65, "parse_paren");
1747GLOBAL_STR(kSHOPT_OPTION_NAMES_66, "parse_proc");
1748GLOBAL_STR(kSHOPT_OPTION_NAMES_67, "parse_sh_arith");
1749GLOBAL_STR(kSHOPT_OPTION_NAMES_68, "parse_triple_quote");
1750GLOBAL_STR(kSHOPT_OPTION_NAMES_69, "parse_ysh_string");
1751GLOBAL_STR(kSHOPT_OPTION_NAMES_70, "process_sub_fail");
1752GLOBAL_STR(kSHOPT_OPTION_NAMES_71, "progcomp");
1753GLOBAL_STR(kSHOPT_OPTION_NAMES_72, "progcomp_alias");
1754GLOBAL_STR(kSHOPT_OPTION_NAMES_73, "promptvars");
1755GLOBAL_STR(kSHOPT_OPTION_NAMES_74, "redefine_module");
1756GLOBAL_STR(kSHOPT_OPTION_NAMES_75, "redefine_proc_func");
1757GLOBAL_STR(kSHOPT_OPTION_NAMES_76, "restricted_shell");
1758GLOBAL_STR(kSHOPT_OPTION_NAMES_77, "shift_verbose");
1759GLOBAL_STR(kSHOPT_OPTION_NAMES_78, "sigpipe_status_ok");
1760GLOBAL_STR(kSHOPT_OPTION_NAMES_79, "simple_echo");
1761GLOBAL_STR(kSHOPT_OPTION_NAMES_80, "simple_eval_builtin");
1762GLOBAL_STR(kSHOPT_OPTION_NAMES_81, "simple_test_builtin");
1763GLOBAL_STR(kSHOPT_OPTION_NAMES_82, "simple_word_eval");
1764GLOBAL_STR(kSHOPT_OPTION_NAMES_83, "sourcepath");
1765GLOBAL_STR(kSHOPT_OPTION_NAMES_84, "strict_argv");
1766GLOBAL_STR(kSHOPT_OPTION_NAMES_85, "strict_arith");
1767GLOBAL_STR(kSHOPT_OPTION_NAMES_86, "strict_array");
1768GLOBAL_STR(kSHOPT_OPTION_NAMES_87, "strict_control_flow");
1769GLOBAL_STR(kSHOPT_OPTION_NAMES_88, "strict_errexit");
1770GLOBAL_STR(kSHOPT_OPTION_NAMES_89, "strict_glob");
1771GLOBAL_STR(kSHOPT_OPTION_NAMES_90, "strict_nameref");
1772GLOBAL_STR(kSHOPT_OPTION_NAMES_91, "strict_parse_slice");
1773GLOBAL_STR(kSHOPT_OPTION_NAMES_92, "strict_tilde");
1774GLOBAL_STR(kSHOPT_OPTION_NAMES_93, "strict_word_eval");
1775GLOBAL_STR(kSHOPT_OPTION_NAMES_94, "verbose_errexit");
1776GLOBAL_STR(kSHOPT_OPTION_NAMES_95, "xpg_echo");
1777GLOBAL_STR(kSHOPT_OPTION_NAMES_96, "xtrace_details");
1778GLOBAL_STR(kSHOPT_OPTION_NAMES_97, "xtrace_rich");
1779GLOBAL_LIST(SHOPT_OPTION_NAMES, BigStr*, 98, {kSHOPT_OPTION_NAMES_0 COMMA kSHOPT_OPTION_NAMES_1 COMMA kSHOPT_OPTION_NAMES_2 COMMA kSHOPT_OPTION_NAMES_3 COMMA kSHOPT_OPTION_NAMES_4 COMMA kSHOPT_OPTION_NAMES_5 COMMA kSHOPT_OPTION_NAMES_6 COMMA kSHOPT_OPTION_NAMES_7 COMMA kSHOPT_OPTION_NAMES_8 COMMA kSHOPT_OPTION_NAMES_9 COMMA kSHOPT_OPTION_NAMES_10 COMMA kSHOPT_OPTION_NAMES_11 COMMA kSHOPT_OPTION_NAMES_12 COMMA kSHOPT_OPTION_NAMES_13 COMMA kSHOPT_OPTION_NAMES_14 COMMA kSHOPT_OPTION_NAMES_15 COMMA kSHOPT_OPTION_NAMES_16 COMMA kSHOPT_OPTION_NAMES_17 COMMA kSHOPT_OPTION_NAMES_18 COMMA kSHOPT_OPTION_NAMES_19 COMMA kSHOPT_OPTION_NAMES_20 COMMA kSHOPT_OPTION_NAMES_21 COMMA kSHOPT_OPTION_NAMES_22 COMMA kSHOPT_OPTION_NAMES_23 COMMA kSHOPT_OPTION_NAMES_24 COMMA kSHOPT_OPTION_NAMES_25 COMMA kSHOPT_OPTION_NAMES_26 COMMA kSHOPT_OPTION_NAMES_27 COMMA kSHOPT_OPTION_NAMES_28 COMMA kSHOPT_OPTION_NAMES_29 COMMA kSHOPT_OPTION_NAMES_30 COMMA kSHOPT_OPTION_NAMES_31 COMMA kSHOPT_OPTION_NAMES_32 COMMA kSHOPT_OPTION_NAMES_33 COMMA kSHOPT_OPTION_NAMES_34 COMMA kSHOPT_OPTION_NAMES_35 COMMA kSHOPT_OPTION_NAMES_36 COMMA kSHOPT_OPTION_NAMES_37 COMMA kSHOPT_OPTION_NAMES_38 COMMA kSHOPT_OPTION_NAMES_39 COMMA kSHOPT_OPTION_NAMES_40 COMMA kSHOPT_OPTION_NAMES_41 COMMA kSHOPT_OPTION_NAMES_42 COMMA kSHOPT_OPTION_NAMES_43 COMMA kSHOPT_OPTION_NAMES_44 COMMA kSHOPT_OPTION_NAMES_45 COMMA kSHOPT_OPTION_NAMES_46 COMMA kSHOPT_OPTION_NAMES_47 COMMA kSHOPT_OPTION_NAMES_48 COMMA kSHOPT_OPTION_NAMES_49 COMMA kSHOPT_OPTION_NAMES_50 COMMA kSHOPT_OPTION_NAMES_51 COMMA kSHOPT_OPTION_NAMES_52 COMMA kSHOPT_OPTION_NAMES_53 COMMA kSHOPT_OPTION_NAMES_54 COMMA kSHOPT_OPTION_NAMES_55 COMMA kSHOPT_OPTION_NAMES_56 COMMA kSHOPT_OPTION_NAMES_57 COMMA kSHOPT_OPTION_NAMES_58 COMMA kSHOPT_OPTION_NAMES_59 COMMA kSHOPT_OPTION_NAMES_60 COMMA kSHOPT_OPTION_NAMES_61 COMMA kSHOPT_OPTION_NAMES_62 COMMA kSHOPT_OPTION_NAMES_63 COMMA kSHOPT_OPTION_NAMES_64 COMMA kSHOPT_OPTION_NAMES_65 COMMA kSHOPT_OPTION_NAMES_66 COMMA kSHOPT_OPTION_NAMES_67 COMMA kSHOPT_OPTION_NAMES_68 COMMA kSHOPT_OPTION_NAMES_69 COMMA kSHOPT_OPTION_NAMES_70 COMMA kSHOPT_OPTION_NAMES_71 COMMA kSHOPT_OPTION_NAMES_72 COMMA kSHOPT_OPTION_NAMES_73 COMMA kSHOPT_OPTION_NAMES_74 COMMA kSHOPT_OPTION_NAMES_75 COMMA kSHOPT_OPTION_NAMES_76 COMMA kSHOPT_OPTION_NAMES_77 COMMA kSHOPT_OPTION_NAMES_78 COMMA kSHOPT_OPTION_NAMES_79 COMMA kSHOPT_OPTION_NAMES_80 COMMA kSHOPT_OPTION_NAMES_81 COMMA kSHOPT_OPTION_NAMES_82 COMMA kSHOPT_OPTION_NAMES_83 COMMA kSHOPT_OPTION_NAMES_84 COMMA kSHOPT_OPTION_NAMES_85 COMMA kSHOPT_OPTION_NAMES_86 COMMA kSHOPT_OPTION_NAMES_87 COMMA kSHOPT_OPTION_NAMES_88 COMMA kSHOPT_OPTION_NAMES_89 COMMA kSHOPT_OPTION_NAMES_90 COMMA kSHOPT_OPTION_NAMES_91 COMMA kSHOPT_OPTION_NAMES_92 COMMA kSHOPT_OPTION_NAMES_93 COMMA kSHOPT_OPTION_NAMES_94 COMMA kSHOPT_OPTION_NAMES_95 COMMA kSHOPT_OPTION_NAMES_96 COMMA kSHOPT_OPTION_NAMES_97});
1780
1781GLOBAL_STR(ASSIGN_ARG_RE, "^([a-zA-Z_][a-zA-Z0-9_]*)((=|\\+=)(.*))?$");
1782GLOBAL_STR(TEST_V_RE, "^([a-zA-Z_][a-zA-Z0-9_]*)(\\[([^][]*)\\])?$");
1783} // namespace consts
1784