OILS / _gen / frontend / consts.cc View on Github | oils.pub

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