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

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