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

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