1 |
|
2 | /* Common stuff */
|
3 |
|
4 | /*!re2c
|
5 | re2c:define:YYCTYPE = "unsigned char";
|
6 | re2c:define:YYCURSOR = p;
|
7 | re2c:yyfill:enable = 0; // generated code doesn't ask for more input
|
8 | */
|
9 |
|
10 | static inline void MatchOshToken(int lex_mode, const unsigned char* line, int line_len,
|
11 | int start_pos, int* id, int* end_pos) {
|
12 | assert(start_pos <= line_len); /* caller should have checked */
|
13 |
|
14 | const unsigned char* p = line + start_pos; /* modified by re2c */
|
15 | //printf("p: %p q: %p\n", p, q);
|
16 |
|
17 | __attribute__((unused)) const unsigned char* YYMARKER; /* why do we need this? */
|
18 | switch (lex_mode) {
|
19 |
|
20 | case lex_mode__Comment:
|
21 | for (;;) {
|
22 | /*!re2c
|
23 | [^\n\x00]* { *id = id__Ignored_Comment; break; }
|
24 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
25 | */
|
26 | }
|
27 | break;
|
28 |
|
29 | case lex_mode__ShCommand:
|
30 | for (;;) {
|
31 | /*!re2c
|
32 | [a-zA-Z_][a-zA-Z0-9_]* "+" ? "=" { *id = id__Lit_VarLike; break; }
|
33 | [a-zA-Z_][a-zA-Z0-9_]* "[" { *id = id__Lit_ArrayLhsOpen; break; }
|
34 | "]" "+" ? "=" { *id = id__Lit_ArrayLhsClose; break; }
|
35 | "((" { *id = id__Op_DLeftParen; break; }
|
36 | "[" { *id = id__Lit_LBracket; break; }
|
37 | "]" { *id = id__Lit_RBracket; break; }
|
38 | "*" { *id = id__Lit_Star; break; }
|
39 | "?" { *id = id__Lit_QMark; break; }
|
40 | "###" { *id = id__Lit_TPound; break; }
|
41 | "..." { *id = id__Lit_TDot; break; }
|
42 | "{" { *id = id__Lit_LBrace; break; }
|
43 | "}" { *id = id__Lit_RBrace; break; }
|
44 | "," { *id = id__Lit_Comma; break; }
|
45 | "=" { *id = id__Lit_Equals; break; }
|
46 | "@" { *id = id__Lit_At; break; }
|
47 | "@" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__Lit_Splice; break; }
|
48 | "@[" { *id = id__Lit_AtLBracket; break; }
|
49 | "@{." { *id = id__Lit_AtLBraceDot; break; }
|
50 | [0-9]? [0-9]? "<" { *id = id__Redir_Less; break; }
|
51 | [0-9]? [0-9]? ">" { *id = id__Redir_Great; break; }
|
52 | [0-9]? [0-9]? "<" "<" { *id = id__Redir_DLess; break; }
|
53 | [0-9]? [0-9]? "<" "<" "<" { *id = id__Redir_TLess; break; }
|
54 | [0-9]? [0-9]? ">" ">" { *id = id__Redir_DGreat; break; }
|
55 | [0-9]? [0-9]? "<" "<" "-" { *id = id__Redir_DLessDash; break; }
|
56 | [0-9]? [0-9]? ">" "&" { *id = id__Redir_GreatAnd; break; }
|
57 | [0-9]? [0-9]? "<" "&" { *id = id__Redir_LessAnd; break; }
|
58 | [0-9]? [0-9]? "<" ">" { *id = id__Redir_LessGreat; break; }
|
59 | [0-9]? [0-9]? ">" "|" { *id = id__Redir_Clobber; break; }
|
60 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" { *id = id__Redir_Less; break; }
|
61 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" ">" { *id = id__Redir_Great; break; }
|
62 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" "<" { *id = id__Redir_DLess; break; }
|
63 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" "<" "<" { *id = id__Redir_TLess; break; }
|
64 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" ">" ">" { *id = id__Redir_DGreat; break; }
|
65 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" "<" "-" { *id = id__Redir_DLessDash; break; }
|
66 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" ">" "&" { *id = id__Redir_GreatAnd; break; }
|
67 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" "&" { *id = id__Redir_LessAnd; break; }
|
68 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" ">" { *id = id__Redir_LessGreat; break; }
|
69 | "{" [a-zA-Z_][a-zA-Z0-9_]* "}" ">" "|" { *id = id__Redir_Clobber; break; }
|
70 | "&>" { *id = id__Redir_AndGreat; break; }
|
71 | "&>>" { *id = id__Redir_AndDGreat; break; }
|
72 | "[[" { *id = id__KW_DLeftBracket; break; }
|
73 | "!" { *id = id__KW_Bang; break; }
|
74 | "for" { *id = id__KW_For; break; }
|
75 | "while" { *id = id__KW_While; break; }
|
76 | "until" { *id = id__KW_Until; break; }
|
77 | "do" { *id = id__KW_Do; break; }
|
78 | "done" { *id = id__KW_Done; break; }
|
79 | "in" { *id = id__KW_In; break; }
|
80 | "case" { *id = id__KW_Case; break; }
|
81 | "esac" { *id = id__KW_Esac; break; }
|
82 | "if" { *id = id__KW_If; break; }
|
83 | "fi" { *id = id__KW_Fi; break; }
|
84 | "then" { *id = id__KW_Then; break; }
|
85 | "else" { *id = id__KW_Else; break; }
|
86 | "elif" { *id = id__KW_Elif; break; }
|
87 | "function" { *id = id__KW_Function; break; }
|
88 | "time" { *id = id__KW_Time; break; }
|
89 | "const" { *id = id__KW_Const; break; }
|
90 | "var" { *id = id__KW_Var; break; }
|
91 | "setvar" { *id = id__KW_SetVar; break; }
|
92 | "setglobal" { *id = id__KW_SetGlobal; break; }
|
93 | "call" { *id = id__KW_Call; break; }
|
94 | "proc" { *id = id__KW_Proc; break; }
|
95 | "func" { *id = id__KW_Func; break; }
|
96 | "class" { *id = id__KW_Class; break; }
|
97 | "data" { *id = id__KW_Data; break; }
|
98 | "enum" { *id = id__KW_Enum; break; }
|
99 | "break" { *id = id__ControlFlow_Break; break; }
|
100 | "continue" { *id = id__ControlFlow_Continue; break; }
|
101 | "return" { *id = id__ControlFlow_Return; break; }
|
102 | "exit" { *id = id__ControlFlow_Exit; break; }
|
103 | "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; }
|
104 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
105 | "`" { *id = id__Left_Backtick; break; }
|
106 | "$(" { *id = id__Left_DollarParen; break; }
|
107 | "${" { *id = id__Left_DollarBrace; break; }
|
108 | "$((" { *id = id__Left_DollarDParen; break; }
|
109 | "$[" { *id = id__Left_DollarBracket; break; }
|
110 | "\"" { *id = id__Left_DoubleQuote; break; }
|
111 | "'" { *id = id__Left_SingleQuote; break; }
|
112 | "$\"" { *id = id__Left_DollarDoubleQuote; break; }
|
113 | "$'" { *id = id__Left_DollarSingleQuote; break; }
|
114 | "<(" { *id = id__Left_ProcSubIn; break; }
|
115 | ">(" { *id = id__Left_ProcSubOut; break; }
|
116 | "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; }
|
117 | "$" [0-9] { *id = id__VSub_Number; break; }
|
118 | "$!" { *id = id__VSub_Bang; break; }
|
119 | "$@" { *id = id__VSub_At; break; }
|
120 | "$#" { *id = id__VSub_Pound; break; }
|
121 | "$$" { *id = id__VSub_Dollar; break; }
|
122 | "$*" { *id = id__VSub_Star; break; }
|
123 | "$-" { *id = id__VSub_Hyphen; break; }
|
124 | "$?" { *id = id__VSub_QMark; break; }
|
125 | [\x80-\xffa-zA-Z0-9_/.\-]+ { *id = id__Lit_Chars; break; }
|
126 | "~" [a-zA-Z0-9_.\-]* { *id = id__Lit_TildeLike; break; }
|
127 | ":" { *id = id__Lit_Colon; break; }
|
128 | "$" { *id = id__Lit_Dollar; break; }
|
129 | "#" { *id = id__Lit_Pound; break; }
|
130 | [ \t]+ { *id = id__WS_Space; break; }
|
131 | "\n" { *id = id__Op_Newline; break; }
|
132 | "&" { *id = id__Op_Amp; break; }
|
133 | "|" { *id = id__Op_Pipe; break; }
|
134 | "|&" { *id = id__Op_PipeAmp; break; }
|
135 | "&&" { *id = id__Op_DAmp; break; }
|
136 | "||" { *id = id__Op_DPipe; break; }
|
137 | ";" { *id = id__Op_Semi; break; }
|
138 | ";;" { *id = id__Op_DSemi; break; }
|
139 | "(" { *id = id__Op_LParen; break; }
|
140 | ")" { *id = id__Op_RParen; break; }
|
141 | [^\x00] { *id = id__Lit_Other; break; }
|
142 | ",(" { *id = id__ExtGlob_Comma; break; }
|
143 | "@(" { *id = id__ExtGlob_At; break; }
|
144 | "*(" { *id = id__ExtGlob_Star; break; }
|
145 | "+(" { *id = id__ExtGlob_Plus; break; }
|
146 | "?(" { *id = id__ExtGlob_QMark; break; }
|
147 | "!(" { *id = id__ExtGlob_Bang; break; }
|
148 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
149 | */
|
150 | }
|
151 | break;
|
152 |
|
153 | case lex_mode__Backtick:
|
154 | for (;;) {
|
155 | /*!re2c
|
156 | "`" { *id = id__Backtick_Right; break; }
|
157 | "\\" [$`\\] { *id = id__Backtick_Quoted; break; }
|
158 | "\\" "\"" { *id = id__Backtick_DoubleQuote; break; }
|
159 | [^`\\\x00]+ { *id = id__Backtick_Other; break; }
|
160 | [^\x00] { *id = id__Backtick_Other; break; }
|
161 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
162 | */
|
163 | }
|
164 | break;
|
165 |
|
166 | case lex_mode__DBracket:
|
167 | for (;;) {
|
168 | /*!re2c
|
169 | "]]" { *id = id__Lit_DRightBracket; break; }
|
170 | "!" { *id = id__KW_Bang; break; }
|
171 | "<" { *id = id__Op_Less; break; }
|
172 | ">" { *id = id__Op_Great; break; }
|
173 | "-z" { *id = id__BoolUnary_z; break; }
|
174 | "-n" { *id = id__BoolUnary_n; break; }
|
175 | "-o" { *id = id__BoolUnary_o; break; }
|
176 | "-t" { *id = id__BoolUnary_t; break; }
|
177 | "-v" { *id = id__BoolUnary_v; break; }
|
178 | "-R" { *id = id__BoolUnary_R; break; }
|
179 | "-a" { *id = id__BoolUnary_a; break; }
|
180 | "-b" { *id = id__BoolUnary_b; break; }
|
181 | "-c" { *id = id__BoolUnary_c; break; }
|
182 | "-d" { *id = id__BoolUnary_d; break; }
|
183 | "-e" { *id = id__BoolUnary_e; break; }
|
184 | "-f" { *id = id__BoolUnary_f; break; }
|
185 | "-g" { *id = id__BoolUnary_g; break; }
|
186 | "-h" { *id = id__BoolUnary_h; break; }
|
187 | "-k" { *id = id__BoolUnary_k; break; }
|
188 | "-L" { *id = id__BoolUnary_L; break; }
|
189 | "-p" { *id = id__BoolUnary_p; break; }
|
190 | "-r" { *id = id__BoolUnary_r; break; }
|
191 | "-s" { *id = id__BoolUnary_s; break; }
|
192 | "-S" { *id = id__BoolUnary_S; break; }
|
193 | "-u" { *id = id__BoolUnary_u; break; }
|
194 | "-w" { *id = id__BoolUnary_w; break; }
|
195 | "-x" { *id = id__BoolUnary_x; break; }
|
196 | "-O" { *id = id__BoolUnary_O; break; }
|
197 | "-G" { *id = id__BoolUnary_G; break; }
|
198 | "-N" { *id = id__BoolUnary_N; break; }
|
199 | "=" { *id = id__BoolBinary_GlobEqual; break; }
|
200 | "==" { *id = id__BoolBinary_GlobDEqual; break; }
|
201 | "!=" { *id = id__BoolBinary_GlobNEqual; break; }
|
202 | "=~" { *id = id__BoolBinary_EqualTilde; break; }
|
203 | "-ef" { *id = id__BoolBinary_ef; break; }
|
204 | "-nt" { *id = id__BoolBinary_nt; break; }
|
205 | "-ot" { *id = id__BoolBinary_ot; break; }
|
206 | "-eq" { *id = id__BoolBinary_eq; break; }
|
207 | "-ne" { *id = id__BoolBinary_ne; break; }
|
208 | "-gt" { *id = id__BoolBinary_gt; break; }
|
209 | "-ge" { *id = id__BoolBinary_ge; break; }
|
210 | "-lt" { *id = id__BoolBinary_lt; break; }
|
211 | "-le" { *id = id__BoolBinary_le; break; }
|
212 | "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; }
|
213 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
214 | "`" { *id = id__Left_Backtick; break; }
|
215 | "$(" { *id = id__Left_DollarParen; break; }
|
216 | "${" { *id = id__Left_DollarBrace; break; }
|
217 | "$((" { *id = id__Left_DollarDParen; break; }
|
218 | "$[" { *id = id__Left_DollarBracket; break; }
|
219 | "\"" { *id = id__Left_DoubleQuote; break; }
|
220 | "'" { *id = id__Left_SingleQuote; break; }
|
221 | "$\"" { *id = id__Left_DollarDoubleQuote; break; }
|
222 | "$'" { *id = id__Left_DollarSingleQuote; break; }
|
223 | "<(" { *id = id__Left_ProcSubIn; break; }
|
224 | ">(" { *id = id__Left_ProcSubOut; break; }
|
225 | "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; }
|
226 | "$" [0-9] { *id = id__VSub_Number; break; }
|
227 | "$!" { *id = id__VSub_Bang; break; }
|
228 | "$@" { *id = id__VSub_At; break; }
|
229 | "$#" { *id = id__VSub_Pound; break; }
|
230 | "$$" { *id = id__VSub_Dollar; break; }
|
231 | "$*" { *id = id__VSub_Star; break; }
|
232 | "$-" { *id = id__VSub_Hyphen; break; }
|
233 | "$?" { *id = id__VSub_QMark; break; }
|
234 | [\x80-\xffa-zA-Z0-9_/.\-]+ { *id = id__Lit_Chars; break; }
|
235 | "~" [a-zA-Z0-9_.\-]* { *id = id__Lit_TildeLike; break; }
|
236 | ":" { *id = id__Lit_Colon; break; }
|
237 | "$" { *id = id__Lit_Dollar; break; }
|
238 | "#" { *id = id__Lit_Pound; break; }
|
239 | [ \t]+ { *id = id__WS_Space; break; }
|
240 | "\n" { *id = id__Op_Newline; break; }
|
241 | "&" { *id = id__Op_Amp; break; }
|
242 | "|" { *id = id__Op_Pipe; break; }
|
243 | "|&" { *id = id__Op_PipeAmp; break; }
|
244 | "&&" { *id = id__Op_DAmp; break; }
|
245 | "||" { *id = id__Op_DPipe; break; }
|
246 | ";" { *id = id__Op_Semi; break; }
|
247 | ";;" { *id = id__Op_DSemi; break; }
|
248 | "(" { *id = id__Op_LParen; break; }
|
249 | ")" { *id = id__Op_RParen; break; }
|
250 | [^\x00] { *id = id__Lit_Other; break; }
|
251 | ",(" { *id = id__ExtGlob_Comma; break; }
|
252 | "@(" { *id = id__ExtGlob_At; break; }
|
253 | "*(" { *id = id__ExtGlob_Star; break; }
|
254 | "+(" { *id = id__ExtGlob_Plus; break; }
|
255 | "?(" { *id = id__ExtGlob_QMark; break; }
|
256 | "!(" { *id = id__ExtGlob_Bang; break; }
|
257 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
258 | */
|
259 | }
|
260 | break;
|
261 |
|
262 | case lex_mode__SQ_Raw:
|
263 | for (;;) {
|
264 | /*!re2c
|
265 | [^'\x00]+ { *id = id__Lit_Chars; break; }
|
266 | "'" { *id = id__Right_SingleQuote; break; }
|
267 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
268 | */
|
269 | }
|
270 | break;
|
271 |
|
272 | case lex_mode__DQ:
|
273 | for (;;) {
|
274 | /*!re2c
|
275 | "\\" [$`"\\] { *id = id__Lit_EscapedChar; break; }
|
276 | "\\" { *id = id__Lit_BadBackslash; break; }
|
277 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
278 | "`" { *id = id__Left_Backtick; break; }
|
279 | "$(" { *id = id__Left_DollarParen; break; }
|
280 | "${" { *id = id__Left_DollarBrace; break; }
|
281 | "$((" { *id = id__Left_DollarDParen; break; }
|
282 | "$[" { *id = id__Left_DollarBracket; break; }
|
283 | "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; }
|
284 | "$" [0-9] { *id = id__VSub_Number; break; }
|
285 | "$!" { *id = id__VSub_Bang; break; }
|
286 | "$@" { *id = id__VSub_At; break; }
|
287 | "$#" { *id = id__VSub_Pound; break; }
|
288 | "$$" { *id = id__VSub_Dollar; break; }
|
289 | "$*" { *id = id__VSub_Star; break; }
|
290 | "$-" { *id = id__VSub_Hyphen; break; }
|
291 | "$?" { *id = id__VSub_QMark; break; }
|
292 | [^$`"\x00\\]+ { *id = id__Lit_Chars; break; }
|
293 | "$" { *id = id__Lit_Dollar; break; }
|
294 | "\"" { *id = id__Right_DoubleQuote; break; }
|
295 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
296 | */
|
297 | }
|
298 | break;
|
299 |
|
300 | case lex_mode__SQ_C:
|
301 | for (;;) {
|
302 | /*!re2c
|
303 | "\\" "x" [0-9a-fA-F]{1,2} { *id = id__Char_Hex; break; }
|
304 | "\\" "u" [0-9a-fA-F]{1,4} { *id = id__Char_Unicode4; break; }
|
305 | "\\" "U" [0-9a-fA-F]{1,8} { *id = id__Char_Unicode8; break; }
|
306 | "\\" [0abeEfrtnv\\] { *id = id__Char_OneChar; break; }
|
307 | "\\\n" { *id = id__Char_Literals; break; }
|
308 | "\\" { *id = id__Unknown_Backslash; break; }
|
309 | "\\" [0-7]{1,3} { *id = id__Char_Octal3; break; }
|
310 | "\\'" { *id = id__Char_OneChar; break; }
|
311 | "\\\"" { *id = id__Char_OneChar; break; }
|
312 | [^\\'\x00]+ { *id = id__Char_Literals; break; }
|
313 | "'" { *id = id__Right_SingleQuote; break; }
|
314 | "\\\x00" { *id = id__Unknown_Tok; break; }
|
315 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
316 | */
|
317 | }
|
318 | break;
|
319 |
|
320 | case lex_mode__J8_Str:
|
321 | for (;;) {
|
322 | /*!re2c
|
323 | "'" { *id = id__Right_SingleQuote; break; }
|
324 | "\\" [\\"/bfnrt] { *id = id__Char_OneChar; break; }
|
325 | "\\'" { *id = id__Char_OneChar; break; }
|
326 | "\\" "y" [0-9a-fA-F]{2,2} { *id = id__Char_YHex; break; }
|
327 | "\\" [uU]"{" [0-9a-fA-F]{1,6} "}" { *id = id__Char_UBraced; break; }
|
328 | [\x01-\x1f] { *id = id__Char_AsciiControl; break; }
|
329 | [^\\'\x00]+ { *id = id__Char_Literals; break; }
|
330 | [^\x00] { *id = id__Unknown_Tok; break; }
|
331 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
332 | */
|
333 | }
|
334 | break;
|
335 |
|
336 | case lex_mode__Arith:
|
337 | for (;;) {
|
338 | /*!re2c
|
339 | "`" { *id = id__Left_Backtick; break; }
|
340 | "$(" { *id = id__Left_DollarParen; break; }
|
341 | "${" { *id = id__Left_DollarBrace; break; }
|
342 | "$((" { *id = id__Left_DollarDParen; break; }
|
343 | "$[" { *id = id__Left_DollarBracket; break; }
|
344 | "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; }
|
345 | "$" [0-9] { *id = id__VSub_Number; break; }
|
346 | "$!" { *id = id__VSub_Bang; break; }
|
347 | "$@" { *id = id__VSub_At; break; }
|
348 | "$#" { *id = id__VSub_Pound; break; }
|
349 | "$$" { *id = id__VSub_Dollar; break; }
|
350 | "$*" { *id = id__VSub_Star; break; }
|
351 | "$-" { *id = id__VSub_Hyphen; break; }
|
352 | "$?" { *id = id__VSub_QMark; break; }
|
353 | "\"" { *id = id__Left_DoubleQuote; break; }
|
354 | "'" { *id = id__Left_SingleQuote; break; }
|
355 | "$\"" { *id = id__Left_DollarDoubleQuote; break; }
|
356 | "$'" { *id = id__Left_DollarSingleQuote; break; }
|
357 | [ \t\r\n]+ { *id = id__Ignored_Space; break; }
|
358 | [a-zA-Z_][a-zA-Z0-9_]* { *id = id__Lit_ArithVarLike; break; }
|
359 | [0-9]+ { *id = id__Lit_Digits; break; }
|
360 | "@" { *id = id__Lit_At; break; }
|
361 | "#" { *id = id__Lit_Pound; break; }
|
362 | ";" { *id = id__Arith_Semi; break; }
|
363 | "," { *id = id__Arith_Comma; break; }
|
364 | "+" { *id = id__Arith_Plus; break; }
|
365 | "-" { *id = id__Arith_Minus; break; }
|
366 | "*" { *id = id__Arith_Star; break; }
|
367 | "/" { *id = id__Arith_Slash; break; }
|
368 | "%" { *id = id__Arith_Percent; break; }
|
369 | "++" { *id = id__Arith_DPlus; break; }
|
370 | "--" { *id = id__Arith_DMinus; break; }
|
371 | "**" { *id = id__Arith_DStar; break; }
|
372 | "(" { *id = id__Arith_LParen; break; }
|
373 | ")" { *id = id__Arith_RParen; break; }
|
374 | "[" { *id = id__Arith_LBracket; break; }
|
375 | "]" { *id = id__Arith_RBracket; break; }
|
376 | "}" { *id = id__Arith_RBrace; break; }
|
377 | "?" { *id = id__Arith_QMark; break; }
|
378 | ":" { *id = id__Arith_Colon; break; }
|
379 | "<=" { *id = id__Arith_LessEqual; break; }
|
380 | "<" { *id = id__Arith_Less; break; }
|
381 | ">=" { *id = id__Arith_GreatEqual; break; }
|
382 | ">" { *id = id__Arith_Great; break; }
|
383 | "==" { *id = id__Arith_DEqual; break; }
|
384 | "!=" { *id = id__Arith_NEqual; break; }
|
385 | "&&" { *id = id__Arith_DAmp; break; }
|
386 | "||" { *id = id__Arith_DPipe; break; }
|
387 | "!" { *id = id__Arith_Bang; break; }
|
388 | ">>" { *id = id__Arith_DGreat; break; }
|
389 | "<<" { *id = id__Arith_DLess; break; }
|
390 | "&" { *id = id__Arith_Amp; break; }
|
391 | "|" { *id = id__Arith_Pipe; break; }
|
392 | "^" { *id = id__Arith_Caret; break; }
|
393 | "~" { *id = id__Arith_Tilde; break; }
|
394 | "=" { *id = id__Arith_Equal; break; }
|
395 | "+=" { *id = id__Arith_PlusEqual; break; }
|
396 | "-=" { *id = id__Arith_MinusEqual; break; }
|
397 | "*=" { *id = id__Arith_StarEqual; break; }
|
398 | "/=" { *id = id__Arith_SlashEqual; break; }
|
399 | "%=" { *id = id__Arith_PercentEqual; break; }
|
400 | ">>=" { *id = id__Arith_DGreatEqual; break; }
|
401 | "<<=" { *id = id__Arith_DLessEqual; break; }
|
402 | "&=" { *id = id__Arith_AmpEqual; break; }
|
403 | "^=" { *id = id__Arith_CaretEqual; break; }
|
404 | "|=" { *id = id__Arith_PipeEqual; break; }
|
405 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
406 | [^\x00] { *id = id__Unknown_Tok; break; }
|
407 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
408 | */
|
409 | }
|
410 | break;
|
411 |
|
412 | case lex_mode__ExtGlob:
|
413 | for (;;) {
|
414 | /*!re2c
|
415 | "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; }
|
416 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
417 | "`" { *id = id__Left_Backtick; break; }
|
418 | "$(" { *id = id__Left_DollarParen; break; }
|
419 | "${" { *id = id__Left_DollarBrace; break; }
|
420 | "$((" { *id = id__Left_DollarDParen; break; }
|
421 | "$[" { *id = id__Left_DollarBracket; break; }
|
422 | "\"" { *id = id__Left_DoubleQuote; break; }
|
423 | "'" { *id = id__Left_SingleQuote; break; }
|
424 | "$\"" { *id = id__Left_DollarDoubleQuote; break; }
|
425 | "$'" { *id = id__Left_DollarSingleQuote; break; }
|
426 | "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; }
|
427 | "$" [0-9] { *id = id__VSub_Number; break; }
|
428 | "$!" { *id = id__VSub_Bang; break; }
|
429 | "$@" { *id = id__VSub_At; break; }
|
430 | "$#" { *id = id__VSub_Pound; break; }
|
431 | "$$" { *id = id__VSub_Dollar; break; }
|
432 | "$*" { *id = id__VSub_Star; break; }
|
433 | "$-" { *id = id__VSub_Hyphen; break; }
|
434 | "$?" { *id = id__VSub_QMark; break; }
|
435 | ",(" { *id = id__ExtGlob_Comma; break; }
|
436 | "@(" { *id = id__ExtGlob_At; break; }
|
437 | "*(" { *id = id__ExtGlob_Star; break; }
|
438 | "+(" { *id = id__ExtGlob_Plus; break; }
|
439 | "?(" { *id = id__ExtGlob_QMark; break; }
|
440 | "!(" { *id = id__ExtGlob_Bang; break; }
|
441 | [^\\$`"'|)@*+!?\x00]+ { *id = id__Lit_Chars; break; }
|
442 | "|" { *id = id__Op_Pipe; break; }
|
443 | ")" { *id = id__Op_RParen; break; }
|
444 | [^\x00] { *id = id__Lit_Other; break; }
|
445 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
446 | */
|
447 | }
|
448 | break;
|
449 |
|
450 | case lex_mode__VSub_1:
|
451 | for (;;) {
|
452 | /*!re2c
|
453 | [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_Name; break; }
|
454 | [0-9]+ { *id = id__VSub_Number; break; }
|
455 | "!" { *id = id__VSub_Bang; break; }
|
456 | "@" { *id = id__VSub_At; break; }
|
457 | "#" { *id = id__VSub_Pound; break; }
|
458 | "$" { *id = id__VSub_Dollar; break; }
|
459 | "*" { *id = id__VSub_Star; break; }
|
460 | "-" { *id = id__VSub_Hyphen; break; }
|
461 | "?" { *id = id__VSub_QMark; break; }
|
462 | "." { *id = id__VSub_Dot; break; }
|
463 | "}" { *id = id__Right_DollarBrace; break; }
|
464 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
465 | "\n" { *id = id__Unknown_Tok; break; }
|
466 | [^\x00] { *id = id__Unknown_Tok; break; }
|
467 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
468 | */
|
469 | }
|
470 | break;
|
471 |
|
472 | case lex_mode__VSub_2:
|
473 | for (;;) {
|
474 | /*!re2c
|
475 | ":-" { *id = id__VTest_ColonHyphen; break; }
|
476 | "-" { *id = id__VTest_Hyphen; break; }
|
477 | ":=" { *id = id__VTest_ColonEquals; break; }
|
478 | "=" { *id = id__VTest_Equals; break; }
|
479 | ":?" { *id = id__VTest_ColonQMark; break; }
|
480 | "?" { *id = id__VTest_QMark; break; }
|
481 | ":+" { *id = id__VTest_ColonPlus; break; }
|
482 | "+" { *id = id__VTest_Plus; break; }
|
483 | "@Q" { *id = id__VOp0_Q; break; }
|
484 | "@E" { *id = id__VOp0_E; break; }
|
485 | "@P" { *id = id__VOp0_P; break; }
|
486 | "@A" { *id = id__VOp0_A; break; }
|
487 | "@a" { *id = id__VOp0_a; break; }
|
488 | "|" { *id = id__VOpOil_Pipe; break; }
|
489 | " " { *id = id__VOpOil_Space; break; }
|
490 | "%" { *id = id__VOp1_Percent; break; }
|
491 | "%%" { *id = id__VOp1_DPercent; break; }
|
492 | "#" { *id = id__VOp1_Pound; break; }
|
493 | "##" { *id = id__VOp1_DPound; break; }
|
494 | "^" { *id = id__VOp1_Caret; break; }
|
495 | "^^" { *id = id__VOp1_DCaret; break; }
|
496 | "," { *id = id__VOp1_Comma; break; }
|
497 | ",," { *id = id__VOp1_DComma; break; }
|
498 | "/" { *id = id__VOp2_Slash; break; }
|
499 | ":" { *id = id__VOp2_Colon; break; }
|
500 | "[" { *id = id__VOp2_LBracket; break; }
|
501 | "]" { *id = id__VOp2_RBracket; break; }
|
502 | "@" { *id = id__VOp3_At; break; }
|
503 | "*" { *id = id__VOp3_Star; break; }
|
504 | "}" { *id = id__Right_DollarBrace; break; }
|
505 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
506 | "\n" { *id = id__Unknown_Tok; break; }
|
507 | [^\x00] { *id = id__Unknown_Tok; break; }
|
508 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
509 | */
|
510 | }
|
511 | break;
|
512 |
|
513 | case lex_mode__VSub_ArgUnquoted:
|
514 | for (;;) {
|
515 | /*!re2c
|
516 | "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; }
|
517 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
518 | "/" { *id = id__Lit_Slash; break; }
|
519 | "#" { *id = id__Lit_Pound; break; }
|
520 | "%" { *id = id__Lit_Percent; break; }
|
521 | "}" { *id = id__Right_DollarBrace; break; }
|
522 | "$" { *id = id__Lit_Dollar; break; }
|
523 | "`" { *id = id__Left_Backtick; break; }
|
524 | "$(" { *id = id__Left_DollarParen; break; }
|
525 | "${" { *id = id__Left_DollarBrace; break; }
|
526 | "$((" { *id = id__Left_DollarDParen; break; }
|
527 | "$[" { *id = id__Left_DollarBracket; break; }
|
528 | "\"" { *id = id__Left_DoubleQuote; break; }
|
529 | "'" { *id = id__Left_SingleQuote; break; }
|
530 | "$\"" { *id = id__Left_DollarDoubleQuote; break; }
|
531 | "$'" { *id = id__Left_DollarSingleQuote; break; }
|
532 | "<(" { *id = id__Left_ProcSubIn; break; }
|
533 | ">(" { *id = id__Left_ProcSubOut; break; }
|
534 | "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; }
|
535 | "$" [0-9] { *id = id__VSub_Number; break; }
|
536 | "$!" { *id = id__VSub_Bang; break; }
|
537 | "$@" { *id = id__VSub_At; break; }
|
538 | "$#" { *id = id__VSub_Pound; break; }
|
539 | "$$" { *id = id__VSub_Dollar; break; }
|
540 | "$*" { *id = id__VSub_Star; break; }
|
541 | "$-" { *id = id__VSub_Hyphen; break; }
|
542 | "$?" { *id = id__VSub_QMark; break; }
|
543 | ",(" { *id = id__ExtGlob_Comma; break; }
|
544 | "@(" { *id = id__ExtGlob_At; break; }
|
545 | "*(" { *id = id__ExtGlob_Star; break; }
|
546 | "+(" { *id = id__ExtGlob_Plus; break; }
|
547 | "?(" { *id = id__ExtGlob_QMark; break; }
|
548 | "!(" { *id = id__ExtGlob_Bang; break; }
|
549 | "~" [a-zA-Z0-9_.\-]* { *id = id__Lit_TildeLike; break; }
|
550 | [^$`/}"'\x00\\#%<>@!?+*]+ { *id = id__Lit_Chars; break; }
|
551 | [^\x00] { *id = id__Lit_Other; break; }
|
552 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
553 | */
|
554 | }
|
555 | break;
|
556 |
|
557 | case lex_mode__VSub_ArgDQ:
|
558 | for (;;) {
|
559 | /*!re2c
|
560 | "\\" [$`"\\] { *id = id__Lit_EscapedChar; break; }
|
561 | "\\" { *id = id__Lit_BadBackslash; break; }
|
562 | "/" { *id = id__Lit_Slash; break; }
|
563 | "#" { *id = id__Lit_Pound; break; }
|
564 | "%" { *id = id__Lit_Percent; break; }
|
565 | "}" { *id = id__Right_DollarBrace; break; }
|
566 | "$" { *id = id__Lit_Dollar; break; }
|
567 | "`" { *id = id__Left_Backtick; break; }
|
568 | "$(" { *id = id__Left_DollarParen; break; }
|
569 | "${" { *id = id__Left_DollarBrace; break; }
|
570 | "$((" { *id = id__Left_DollarDParen; break; }
|
571 | "$[" { *id = id__Left_DollarBracket; break; }
|
572 | "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; }
|
573 | "$" [0-9] { *id = id__VSub_Number; break; }
|
574 | "$!" { *id = id__VSub_Bang; break; }
|
575 | "$@" { *id = id__VSub_At; break; }
|
576 | "$#" { *id = id__VSub_Pound; break; }
|
577 | "$$" { *id = id__VSub_Dollar; break; }
|
578 | "$*" { *id = id__VSub_Star; break; }
|
579 | "$-" { *id = id__VSub_Hyphen; break; }
|
580 | "$?" { *id = id__VSub_QMark; break; }
|
581 | "\\}" { *id = id__Lit_EscapedChar; break; }
|
582 | [^$`/}"\x00\\#%]+ { *id = id__Lit_Chars; break; }
|
583 | "\"" { *id = id__Left_DoubleQuote; break; }
|
584 | "$'" { *id = id__Left_DollarSingleQuote; break; }
|
585 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
586 | */
|
587 | }
|
588 | break;
|
589 |
|
590 | case lex_mode__BashRegex:
|
591 | for (;;) {
|
592 | /*!re2c
|
593 | "`" { *id = id__Left_Backtick; break; }
|
594 | "$(" { *id = id__Left_DollarParen; break; }
|
595 | "${" { *id = id__Left_DollarBrace; break; }
|
596 | "$((" { *id = id__Left_DollarDParen; break; }
|
597 | "$[" { *id = id__Left_DollarBracket; break; }
|
598 | "\"" { *id = id__Left_DoubleQuote; break; }
|
599 | "'" { *id = id__Left_SingleQuote; break; }
|
600 | "$\"" { *id = id__Left_DollarDoubleQuote; break; }
|
601 | "$'" { *id = id__Left_DollarSingleQuote; break; }
|
602 | "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; }
|
603 | "$" [0-9] { *id = id__VSub_Number; break; }
|
604 | "$!" { *id = id__VSub_Bang; break; }
|
605 | "$@" { *id = id__VSub_At; break; }
|
606 | "$#" { *id = id__VSub_Pound; break; }
|
607 | "$$" { *id = id__VSub_Dollar; break; }
|
608 | "$*" { *id = id__VSub_Star; break; }
|
609 | "$-" { *id = id__VSub_Hyphen; break; }
|
610 | "$?" { *id = id__VSub_QMark; break; }
|
611 | [a-zA-Z0-9_/\-]+ { *id = id__Lit_Chars; break; }
|
612 | "~" [a-zA-Z0-9_.\-]* { *id = id__Lit_TildeLike; break; }
|
613 | [ \t]+ { *id = id__WS_Space; break; }
|
614 | "\\" [*+?.^$[\]] { *id = id__Lit_RegexMeta; break; }
|
615 | [^\x00] { *id = id__Lit_Other; break; }
|
616 | "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; }
|
617 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
618 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
619 | */
|
620 | }
|
621 | break;
|
622 |
|
623 | case lex_mode__FuncParens:
|
624 | for (;;) {
|
625 | /*!re2c
|
626 | [ \t]* "(" [ \t]* ")" { *id = id__LookAhead_FuncParens; break; }
|
627 | [^\x00] { *id = id__Unknown_Tok; break; }
|
628 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
629 | */
|
630 | }
|
631 | break;
|
632 |
|
633 | case lex_mode__PrintfOuter:
|
634 | for (;;) {
|
635 | /*!re2c
|
636 | "\\" "x" [0-9a-fA-F]{1,2} { *id = id__Char_Hex; break; }
|
637 | "\\" "u" [0-9a-fA-F]{1,4} { *id = id__Char_Unicode4; break; }
|
638 | "\\" "U" [0-9a-fA-F]{1,8} { *id = id__Char_Unicode8; break; }
|
639 | "\\" [0abeEfrtnv\\] { *id = id__Char_OneChar; break; }
|
640 | "\\\n" { *id = id__Char_Literals; break; }
|
641 | "\\" { *id = id__Unknown_Backslash; break; }
|
642 | "\\" [0-7]{1,3} { *id = id__Char_Octal3; break; }
|
643 | [^%\\\x00]+ { *id = id__Char_Literals; break; }
|
644 | "%%" { *id = id__Format_EscapedPercent; break; }
|
645 | "%" { *id = id__Format_Percent; break; }
|
646 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
647 | */
|
648 | }
|
649 | break;
|
650 |
|
651 | case lex_mode__PrintfPercent:
|
652 | for (;;) {
|
653 | /*!re2c
|
654 | [\- +#] { *id = id__Format_Flag; break; }
|
655 | "0" { *id = id__Format_Zero; break; }
|
656 | [1-9][0-9]* { *id = id__Format_Num; break; }
|
657 | "*" { *id = id__Format_Star; break; }
|
658 | "." { *id = id__Format_Dot; break; }
|
659 | [disqbcouxXeEfFgG] { *id = id__Format_Type; break; }
|
660 | "(" [^()\x00]* ")" "T" { *id = id__Format_Time; break; }
|
661 | [^\x00] { *id = id__Unknown_Tok; break; }
|
662 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
663 | */
|
664 | }
|
665 | break;
|
666 |
|
667 | case lex_mode__Expr:
|
668 | for (;;) {
|
669 | /*!re2c
|
670 | "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; }
|
671 | "$" [0-9] { *id = id__VSub_Number; break; }
|
672 | "$!" { *id = id__VSub_Bang; break; }
|
673 | "$@" { *id = id__VSub_At; break; }
|
674 | "$#" { *id = id__VSub_Pound; break; }
|
675 | "$$" { *id = id__VSub_Dollar; break; }
|
676 | "$*" { *id = id__VSub_Star; break; }
|
677 | "$-" { *id = id__VSub_Hyphen; break; }
|
678 | "$?" { *id = id__VSub_QMark; break; }
|
679 | "$(" { *id = id__Left_DollarParen; break; }
|
680 | "${" { *id = id__Left_DollarBrace; break; }
|
681 | "$[" { *id = id__Left_DollarBracket; break; }
|
682 | "\"" { *id = id__Left_DoubleQuote; break; }
|
683 | "'" { *id = id__Left_SingleQuote; break; }
|
684 | "r'" { *id = id__Left_RSingleQuote; break; }
|
685 | "u'" { *id = id__Left_USingleQuote; break; }
|
686 | "b'" { *id = id__Left_BSingleQuote; break; }
|
687 | "$'" { *id = id__Left_DollarSingleQuote; break; }
|
688 | "^\"" { *id = id__Left_CaretDoubleQuote; break; }
|
689 | "\"\"\"" { *id = id__Left_TDoubleQuote; break; }
|
690 | "'''" { *id = id__Left_TSingleQuote; break; }
|
691 | "r'''" { *id = id__Left_RTSingleQuote; break; }
|
692 | "u'''" { *id = id__Left_UTSingleQuote; break; }
|
693 | "b'''" { *id = id__Left_BTSingleQuote; break; }
|
694 | "@(" { *id = id__Left_AtParen; break; }
|
695 | "^(" { *id = id__Left_CaretParen; break; }
|
696 | "^[" { *id = id__Left_CaretBracket; break; }
|
697 | "^{" { *id = id__Left_CaretBrace; break; }
|
698 | ":|" { *id = id__Left_ColonPipe; break; }
|
699 | "%(" { *id = id__Left_PercentParen; break; }
|
700 | "%[" { *id = id__Expr_Reserved; break; }
|
701 | "%{" { *id = id__Expr_Reserved; break; }
|
702 | "@{" { *id = id__Expr_Reserved; break; }
|
703 | "@[" { *id = id__Expr_Reserved; break; }
|
704 | ";" { *id = id__Op_Semi; break; }
|
705 | "(" { *id = id__Op_LParen; break; }
|
706 | ")" { *id = id__Op_RParen; break; }
|
707 | "[" { *id = id__Op_LBracket; break; }
|
708 | "]" { *id = id__Op_RBracket; break; }
|
709 | "{" { *id = id__Op_LBrace; break; }
|
710 | "}" { *id = id__Op_RBrace; break; }
|
711 | "null" { *id = id__Expr_Null; break; }
|
712 | "true" { *id = id__Expr_True; break; }
|
713 | "false" { *id = id__Expr_False; break; }
|
714 | "and" { *id = id__Expr_And; break; }
|
715 | "or" { *id = id__Expr_Or; break; }
|
716 | "not" { *id = id__Expr_Not; break; }
|
717 | "for" { *id = id__Expr_For; break; }
|
718 | "while" { *id = id__Expr_While; break; }
|
719 | "is" { *id = id__Expr_Is; break; }
|
720 | "in" { *id = id__Expr_In; break; }
|
721 | "if" { *id = id__Expr_If; break; }
|
722 | "else" { *id = id__Expr_Else; break; }
|
723 | "func" { *id = id__Expr_Func; break; }
|
724 | "capture" { *id = id__Expr_Capture; break; }
|
725 | "as" { *id = id__Expr_As; break; }
|
726 | "break" { *id = id__Expr_Break; break; }
|
727 | "continue" { *id = id__Expr_Continue; break; }
|
728 | "return" { *id = id__Expr_Return; break; }
|
729 | "\\" [0rtn\\"'] { *id = id__Char_OneChar; break; }
|
730 | "\\" "x" [0-9a-fA-F]{2,2} { *id = id__Char_Hex; break; }
|
731 | "#" "'" [^'\x00]"'" { *id = id__Char_Pound; break; }
|
732 | "\\" [uU]"{" [0-9a-fA-F]{1,6} "}" { *id = id__Char_UBraced; break; }
|
733 | [0-9]("_" ? [0-9])* { *id = id__Expr_DecInt; break; }
|
734 | "0" [bB]("_" ? [01])+ { *id = id__Expr_BinInt; break; }
|
735 | "0" [oO]("_" ? [0-7])+ { *id = id__Expr_OctInt; break; }
|
736 | "0" [xX]("_" ? [0-9a-fA-F])+ { *id = id__Expr_HexInt; break; }
|
737 | [0-9]("_" ? [0-9])* ("." [0-9]("_" ? [0-9])* )? ([eE][+\-]? [0-9]+ )? { *id = id__Expr_Float; break; }
|
738 | [a-zA-Z_][a-zA-Z0-9_]* { *id = id__Expr_Name; break; }
|
739 | "%" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__Expr_Symbol; break; }
|
740 | "," { *id = id__Arith_Comma; break; }
|
741 | ":" { *id = id__Arith_Colon; break; }
|
742 | "?" { *id = id__Arith_QMark; break; }
|
743 | "+" { *id = id__Arith_Plus; break; }
|
744 | "-" { *id = id__Arith_Minus; break; }
|
745 | "*" { *id = id__Arith_Star; break; }
|
746 | "^" { *id = id__Arith_Caret; break; }
|
747 | "/" { *id = id__Arith_Slash; break; }
|
748 | "%" { *id = id__Arith_Percent; break; }
|
749 | "**" { *id = id__Arith_DStar; break; }
|
750 | "++" { *id = id__Arith_DPlus; break; }
|
751 | "<" { *id = id__Arith_Less; break; }
|
752 | ">" { *id = id__Arith_Great; break; }
|
753 | "<=" { *id = id__Arith_LessEqual; break; }
|
754 | ">=" { *id = id__Arith_GreatEqual; break; }
|
755 | "===" { *id = id__Expr_TEqual; break; }
|
756 | "!==" { *id = id__Expr_NotDEqual; break; }
|
757 | "==" { *id = id__Unknown_DEqual; break; }
|
758 | "&" { *id = id__Arith_Amp; break; }
|
759 | "|" { *id = id__Arith_Pipe; break; }
|
760 | ">>" { *id = id__Arith_DGreat; break; }
|
761 | "<<" { *id = id__Arith_DLess; break; }
|
762 | "~" { *id = id__Arith_Tilde; break; }
|
763 | "!~" { *id = id__Expr_NotTilde; break; }
|
764 | "~~" { *id = id__Expr_DTilde; break; }
|
765 | "!~~" { *id = id__Expr_NotDTilde; break; }
|
766 | "=" { *id = id__Arith_Equal; break; }
|
767 | "+=" { *id = id__Arith_PlusEqual; break; }
|
768 | "-=" { *id = id__Arith_MinusEqual; break; }
|
769 | "*=" { *id = id__Arith_StarEqual; break; }
|
770 | "/=" { *id = id__Arith_SlashEqual; break; }
|
771 | "%=" { *id = id__Arith_PercentEqual; break; }
|
772 | ">>=" { *id = id__Arith_DGreatEqual; break; }
|
773 | "<<=" { *id = id__Arith_DLessEqual; break; }
|
774 | "&=" { *id = id__Arith_AmpEqual; break; }
|
775 | "|=" { *id = id__Arith_PipeEqual; break; }
|
776 | "^=" { *id = id__Arith_CaretEqual; break; }
|
777 | "**=" { *id = id__Expr_DStarEqual; break; }
|
778 | "//=" { *id = id__Expr_DSlashEqual; break; }
|
779 | "!" { *id = id__Expr_Bang; break; }
|
780 | "//" { *id = id__Expr_DSlash; break; }
|
781 | "~==" { *id = id__Expr_TildeDEqual; break; }
|
782 | "." { *id = id__Expr_Dot; break; }
|
783 | ".." { *id = id__Expr_DDot; break; }
|
784 | "->" { *id = id__Expr_RArrow; break; }
|
785 | "$" { *id = id__Expr_Dollar; break; }
|
786 | "<-" { *id = id__Expr_Reserved; break; }
|
787 | "=>" { *id = id__Expr_RDArrow; break; }
|
788 | "..." { *id = id__Expr_Ellipsis; break; }
|
789 | "///" { *id = id__Expr_Reserved; break; }
|
790 | "@" { *id = id__Expr_At; break; }
|
791 | "@@" { *id = id__Expr_DoubleAt; break; }
|
792 | "\n" { *id = id__Op_Newline; break; }
|
793 | "#" [^\n\x00]* { *id = id__Ignored_Comment; break; }
|
794 | [ \t\r]+ { *id = id__Ignored_Space; break; }
|
795 | "\\\n" { *id = id__Ignored_LineCont; break; }
|
796 | [^\x00] { *id = id__Unknown_Tok; break; }
|
797 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
798 | */
|
799 | }
|
800 | break;
|
801 |
|
802 | default:
|
803 | assert(0);
|
804 |
|
805 | }
|
806 | *end_pos = p - line; /* relative */
|
807 | }
|
808 |
|
809 |
|
810 | static inline void MatchEchoToken(const unsigned char* line, int line_len,
|
811 | int start_pos, int* id, int* end_pos) {
|
812 | assert(start_pos <= line_len); /* caller should have checked */
|
813 |
|
814 | const unsigned char* p = line + start_pos; /* modified by re2c */
|
815 |
|
816 | /* Echo and History lexer apparently need this, but others don't */
|
817 | __attribute__((unused)) const unsigned char* YYMARKER;
|
818 |
|
819 | for (;;) {
|
820 | /*!re2c
|
821 |
|
822 | "\\" "x" [0-9a-fA-F]{1,2} { *id = id__Char_Hex; break; }
|
823 | "\\" "u" [0-9a-fA-F]{1,4} { *id = id__Char_Unicode4; break; }
|
824 | "\\" "U" [0-9a-fA-F]{1,8} { *id = id__Char_Unicode8; break; }
|
825 | "\\" [0abeEfrtnv\\] { *id = id__Char_OneChar; break; }
|
826 | "\\\n" { *id = id__Char_Literals; break; }
|
827 | "\\" { *id = id__Unknown_Backslash; break; }
|
828 | "\\" "0" [0-7]{1,3} { *id = id__Char_Octal4; break; }
|
829 | "\\c" { *id = id__Char_Stop; break; }
|
830 | [^\\\x00]+ { *id = id__Char_Literals; break; }
|
831 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
832 |
|
833 | */
|
834 | }
|
835 | *end_pos = p - line; /* relative */
|
836 | }
|
837 |
|
838 |
|
839 | static inline void MatchGlobToken(const unsigned char* line, int line_len,
|
840 | int start_pos, int* id, int* end_pos) {
|
841 | assert(start_pos <= line_len); /* caller should have checked */
|
842 |
|
843 | const unsigned char* p = line + start_pos; /* modified by re2c */
|
844 |
|
845 | /* Echo and History lexer apparently need this, but others don't */
|
846 | __attribute__((unused)) const unsigned char* YYMARKER;
|
847 |
|
848 | for (;;) {
|
849 | /*!re2c
|
850 |
|
851 | "*" { *id = id__Glob_Star; break; }
|
852 | "?" { *id = id__Glob_QMark; break; }
|
853 | "!" { *id = id__Glob_Bang; break; }
|
854 | "^" { *id = id__Glob_Caret; break; }
|
855 | "[" { *id = id__Glob_LBracket; break; }
|
856 | "]" { *id = id__Glob_RBracket; break; }
|
857 | "\\" [^\x00] { *id = id__Glob_EscapedChar; break; }
|
858 | "\\" { *id = id__Glob_BadBackslash; break; }
|
859 | [a-zA-Z0-9_]+ { *id = id__Glob_CleanLiterals; break; }
|
860 | [^\x00] { *id = id__Glob_OtherLiteral; break; }
|
861 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
862 |
|
863 | */
|
864 | }
|
865 | *end_pos = p - line; /* relative */
|
866 | }
|
867 |
|
868 |
|
869 | static inline void MatchPS1Token(const unsigned char* line, int line_len,
|
870 | int start_pos, int* id, int* end_pos) {
|
871 | assert(start_pos <= line_len); /* caller should have checked */
|
872 |
|
873 | const unsigned char* p = line + start_pos; /* modified by re2c */
|
874 |
|
875 | /* Echo and History lexer apparently need this, but others don't */
|
876 | __attribute__((unused)) const unsigned char* YYMARKER;
|
877 |
|
878 | for (;;) {
|
879 | /*!re2c
|
880 |
|
881 | "\\" [0-7]{1,3} { *id = id__PS_Octal3; break; }
|
882 | "\\" [adehHjlnrstT@AuvVwW!#$\\] { *id = id__PS_Subst; break; }
|
883 | "\\" "D" "{" [^}\x00]* "}" { *id = id__PS_Subst; break; }
|
884 | "\\[" { *id = id__PS_LBrace; break; }
|
885 | "\\]" { *id = id__PS_RBrace; break; }
|
886 | [^\\\x00]+ { *id = id__PS_Literals; break; }
|
887 | "\\" { *id = id__PS_BadBackslash; break; }
|
888 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
889 |
|
890 | */
|
891 | }
|
892 | *end_pos = p - line; /* relative */
|
893 | }
|
894 |
|
895 |
|
896 | static inline void MatchHistoryToken(const unsigned char* line, int line_len,
|
897 | int start_pos, int* id, int* end_pos) {
|
898 | assert(start_pos <= line_len); /* caller should have checked */
|
899 |
|
900 | const unsigned char* p = line + start_pos; /* modified by re2c */
|
901 |
|
902 | /* Echo and History lexer apparently need this, but others don't */
|
903 | __attribute__((unused)) const unsigned char* YYMARKER;
|
904 |
|
905 | for (;;) {
|
906 | /*!re2c
|
907 |
|
908 | "!" [!*^$] { *id = id__History_Op; break; }
|
909 | "!" "-" ? [0-9]+ { *id = id__History_Num; break; }
|
910 | "!" "?" ? [a-zA-Z_/.][0-9a-zA-Z_/.]+ [ \t\r\n] { *id = id__History_Search; break; }
|
911 | "#" [^\x00]* { *id = id__History_Other; break; }
|
912 | "'" [^'\x00]* "'" ? { *id = id__History_Other; break; }
|
913 | [^!\\'#\x00]+ { *id = id__History_Other; break; }
|
914 | "\\" [^\x00] { *id = id__History_Other; break; }
|
915 | [^\x00] { *id = id__History_Other; break; }
|
916 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
917 |
|
918 | */
|
919 | }
|
920 | *end_pos = p - line; /* relative */
|
921 | }
|
922 |
|
923 |
|
924 | static inline void MatchBraceRangeToken(const unsigned char* line, int line_len,
|
925 | int start_pos, int* id, int* end_pos) {
|
926 | assert(start_pos <= line_len); /* caller should have checked */
|
927 |
|
928 | const unsigned char* p = line + start_pos; /* modified by re2c */
|
929 |
|
930 | /* Echo and History lexer apparently need this, but others don't */
|
931 | __attribute__((unused)) const unsigned char* YYMARKER;
|
932 |
|
933 | for (;;) {
|
934 | /*!re2c
|
935 |
|
936 | "-" ? [0-9]+ { *id = id__Range_Int; break; }
|
937 | [a-zA-Z] { *id = id__Range_Char; break; }
|
938 | "." "." { *id = id__Range_Dots; break; }
|
939 | [^\x00] { *id = id__Range_Other; break; }
|
940 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
941 |
|
942 | */
|
943 | }
|
944 | *end_pos = p - line; /* relative */
|
945 | }
|
946 |
|
947 |
|
948 | static inline void MatchJ8Token(const unsigned char* line, int line_len,
|
949 | int start_pos, int* id, int* end_pos) {
|
950 | assert(start_pos <= line_len); /* caller should have checked */
|
951 |
|
952 | const unsigned char* p = line + start_pos; /* modified by re2c */
|
953 |
|
954 | /* Echo and History lexer apparently need this, but others don't */
|
955 | __attribute__((unused)) const unsigned char* YYMARKER;
|
956 |
|
957 | for (;;) {
|
958 | /*!re2c
|
959 |
|
960 | "\"" { *id = id__Left_DoubleQuote; break; }
|
961 | "u'" { *id = id__Left_USingleQuote; break; }
|
962 | "'" { *id = id__Left_USingleQuote; break; }
|
963 | "b'" { *id = id__Left_BSingleQuote; break; }
|
964 | "[" { *id = id__J8_LBracket; break; }
|
965 | "]" { *id = id__J8_RBracket; break; }
|
966 | "{" { *id = id__J8_LBrace; break; }
|
967 | "}" { *id = id__J8_RBrace; break; }
|
968 | "(" { *id = id__J8_LParen; break; }
|
969 | ")" { *id = id__J8_RParen; break; }
|
970 | "," { *id = id__J8_Comma; break; }
|
971 | ":" { *id = id__J8_Colon; break; }
|
972 | "null" { *id = id__J8_Null; break; }
|
973 | "true" { *id = id__J8_Bool; break; }
|
974 | "false" { *id = id__J8_Bool; break; }
|
975 | ([1-9][0-9]* | [0-9]) { *id = id__J8_Int; break; }
|
976 | ([1-9][0-9]* | [0-9])("." [0-9]+ )? ([eE][\-+]? [0-9]+ )? { *id = id__J8_Float; break; }
|
977 | [ \r\n\t]+ { *id = id__Ignored_Space; break; }
|
978 | [^\x00] { *id = id__Unknown_Tok; break; }
|
979 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
980 |
|
981 | */
|
982 | }
|
983 | *end_pos = p - line; /* relative */
|
984 | }
|
985 |
|
986 |
|
987 | static inline void MatchJ8StrToken(const unsigned char* line, int line_len,
|
988 | int start_pos, int* id, int* end_pos) {
|
989 | assert(start_pos <= line_len); /* caller should have checked */
|
990 |
|
991 | const unsigned char* p = line + start_pos; /* modified by re2c */
|
992 |
|
993 | /* Echo and History lexer apparently need this, but others don't */
|
994 | __attribute__((unused)) const unsigned char* YYMARKER;
|
995 |
|
996 | for (;;) {
|
997 | /*!re2c
|
998 |
|
999 | "'" { *id = id__Right_SingleQuote; break; }
|
1000 | "\\" [\\"/bfnrt] { *id = id__Char_OneChar; break; }
|
1001 | "\\'" { *id = id__Char_OneChar; break; }
|
1002 | "\\" "y" [0-9a-fA-F]{2,2} { *id = id__Char_YHex; break; }
|
1003 | "\\" [uU]"{" [0-9a-fA-F]{1,6} "}" { *id = id__Char_UBraced; break; }
|
1004 | [\x01-\x1f] { *id = id__Char_AsciiControl; break; }
|
1005 | [^\\'\x00]+ { *id = id__Char_Literals; break; }
|
1006 | [^\x00] { *id = id__Unknown_Tok; break; }
|
1007 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
1008 |
|
1009 | */
|
1010 | }
|
1011 | *end_pos = p - line; /* relative */
|
1012 | }
|
1013 |
|
1014 |
|
1015 | static inline void MatchJsonStrToken(const unsigned char* line, int line_len,
|
1016 | int start_pos, int* id, int* end_pos) {
|
1017 | assert(start_pos <= line_len); /* caller should have checked */
|
1018 |
|
1019 | const unsigned char* p = line + start_pos; /* modified by re2c */
|
1020 |
|
1021 | /* Echo and History lexer apparently need this, but others don't */
|
1022 | __attribute__((unused)) const unsigned char* YYMARKER;
|
1023 |
|
1024 | for (;;) {
|
1025 | /*!re2c
|
1026 |
|
1027 | "\"" { *id = id__Right_DoubleQuote; break; }
|
1028 | "\\" [\\"/bfnrt] { *id = id__Char_OneChar; break; }
|
1029 | "\\" "u" [0-9a-fA-F]{4,4} { *id = id__Char_Unicode4; break; }
|
1030 | "\\" "u" [dD][89aAbB][0-9a-fA-F][0-9a-fA-F]"\\" "u" [dD][cCdDeEfF][0-9a-fA-F][0-9a-fA-F] { *id = id__Char_SurrogatePair; break; }
|
1031 | [\x01-\x1f] { *id = id__Char_AsciiControl; break; }
|
1032 | [^\\"\x00]+ { *id = id__Char_Literals; break; }
|
1033 | [^\x00] { *id = id__Unknown_Tok; break; }
|
1034 | "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; }
|
1035 |
|
1036 | */
|
1037 | }
|
1038 | *end_pos = p - line; /* relative */
|
1039 | }
|
1040 |
|
1041 |
|
1042 | static inline int IsValidVarName(const unsigned char* s, int len) {
|
1043 | const unsigned char* p = s; /* modified by re2c */
|
1044 | const unsigned char* end = s + len;
|
1045 |
|
1046 | /* MatchBraceRangeToken needs this, but others don't */
|
1047 | __attribute__((unused)) const unsigned char* YYMARKER;
|
1048 |
|
1049 | /*!re2c
|
1050 | re2c:define:YYCTYPE = "unsigned char";
|
1051 | re2c:define:YYCURSOR = p;
|
1052 | [a-zA-Z_][a-zA-Z0-9_]* { return p == end; } // Match must be anchored right, like $
|
1053 | * { return 0; }
|
1054 | */
|
1055 | }
|
1056 |
|
1057 |
|
1058 | static inline int ShouldHijack(const unsigned char* s, int len) {
|
1059 | const unsigned char* p = s; /* modified by re2c */
|
1060 | const unsigned char* end = s + len;
|
1061 |
|
1062 | /* MatchBraceRangeToken needs this, but others don't */
|
1063 | __attribute__((unused)) const unsigned char* YYMARKER;
|
1064 |
|
1065 | /*!re2c
|
1066 | re2c:define:YYCTYPE = "unsigned char";
|
1067 | re2c:define:YYCURSOR = p;
|
1068 | "#" "!" [^\x00]* "s" "h" [ \t\r\n][^\x00]* { return p == end; } // Match must be anchored right, like $
|
1069 | * { return 0; }
|
1070 | */
|
1071 | }
|
1072 |
|
1073 |
|
1074 | static inline int LooksLikeInteger(const unsigned char* s, int len) {
|
1075 | const unsigned char* p = s; /* modified by re2c */
|
1076 | const unsigned char* end = s + len;
|
1077 |
|
1078 | /* MatchBraceRangeToken needs this, but others don't */
|
1079 | __attribute__((unused)) const unsigned char* YYMARKER;
|
1080 |
|
1081 | /*!re2c
|
1082 | re2c:define:YYCTYPE = "unsigned char";
|
1083 | re2c:define:YYCURSOR = p;
|
1084 | [ \t\r\n]* "-" ? [0-9]("_" ? [0-9])* [ \t\r\n]* { return p == end; } // Match must be anchored right, like $
|
1085 | * { return 0; }
|
1086 | */
|
1087 | }
|
1088 |
|
1089 |
|
1090 | static inline int LooksLikeFloat(const unsigned char* s, int len) {
|
1091 | const unsigned char* p = s; /* modified by re2c */
|
1092 | const unsigned char* end = s + len;
|
1093 |
|
1094 | /* MatchBraceRangeToken needs this, but others don't */
|
1095 | __attribute__((unused)) const unsigned char* YYMARKER;
|
1096 |
|
1097 | /*!re2c
|
1098 | re2c:define:YYCTYPE = "unsigned char";
|
1099 | re2c:define:YYCURSOR = p;
|
1100 | [ \t\r\n]* "-" ? [0-9]("_" ? [0-9])* ("." [0-9]("_" ? [0-9])* )? ([eE][+\-]? [0-9]+ )? [ \t\r\n]* { return p == end; } // Match must be anchored right, like $
|
1101 | * { return 0; }
|
1102 | */
|
1103 | }
|
1104 |
|
1105 |
|
1106 | static inline int BracketUnary(const unsigned char* s, int len) {
|
1107 | const unsigned char* p = s; /* modified by re2c */
|
1108 | const unsigned char* end = s + len;
|
1109 |
|
1110 | __attribute__((unused)) const unsigned char* YYMARKER;
|
1111 | int id;
|
1112 |
|
1113 | for (;;) {
|
1114 | /*!re2c
|
1115 |
|
1116 | "-G" { id = id__BoolUnary_G; break; }
|
1117 | "-L" { id = id__BoolUnary_L; break; }
|
1118 | "-N" { id = id__BoolUnary_N; break; }
|
1119 | "-O" { id = id__BoolUnary_O; break; }
|
1120 | "-R" { id = id__BoolUnary_R; break; }
|
1121 | "-S" { id = id__BoolUnary_S; break; }
|
1122 | "-a" { id = id__BoolUnary_a; break; }
|
1123 | "-b" { id = id__BoolUnary_b; break; }
|
1124 | "-c" { id = id__BoolUnary_c; break; }
|
1125 | "-d" { id = id__BoolUnary_d; break; }
|
1126 | "-e" { id = id__BoolUnary_e; break; }
|
1127 | "-f" { id = id__BoolUnary_f; break; }
|
1128 | "-g" { id = id__BoolUnary_g; break; }
|
1129 | "-h" { id = id__BoolUnary_h; break; }
|
1130 | "-k" { id = id__BoolUnary_k; break; }
|
1131 | "-n" { id = id__BoolUnary_n; break; }
|
1132 | "-o" { id = id__BoolUnary_o; break; }
|
1133 | "-p" { id = id__BoolUnary_p; break; }
|
1134 | "-r" { id = id__BoolUnary_r; break; }
|
1135 | "-s" { id = id__BoolUnary_s; break; }
|
1136 | "-t" { id = id__BoolUnary_t; break; }
|
1137 | "-u" { id = id__BoolUnary_u; break; }
|
1138 | "-v" { id = id__BoolUnary_v; break; }
|
1139 | "-w" { id = id__BoolUnary_w; break; }
|
1140 | "-x" { id = id__BoolUnary_x; break; }
|
1141 | "-z" { id = id__BoolUnary_z; break; }
|
1142 | * { return id__Undefined_Tok; }
|
1143 |
|
1144 | */
|
1145 | }
|
1146 | // must be an exact match
|
1147 | return (p == end) ? id : id__Undefined_Tok;
|
1148 | }
|
1149 |
|
1150 |
|
1151 | static inline int BracketBinary(const unsigned char* s, int len) {
|
1152 | const unsigned char* p = s; /* modified by re2c */
|
1153 | const unsigned char* end = s + len;
|
1154 |
|
1155 | __attribute__((unused)) const unsigned char* YYMARKER;
|
1156 | int id;
|
1157 |
|
1158 | for (;;) {
|
1159 | /*!re2c
|
1160 |
|
1161 | "!=" { id = id__BoolBinary_NEqual; break; }
|
1162 | "-ef" { id = id__BoolBinary_ef; break; }
|
1163 | "-eq" { id = id__BoolBinary_eq; break; }
|
1164 | "-ge" { id = id__BoolBinary_ge; break; }
|
1165 | "-gt" { id = id__BoolBinary_gt; break; }
|
1166 | "-le" { id = id__BoolBinary_le; break; }
|
1167 | "-lt" { id = id__BoolBinary_lt; break; }
|
1168 | "-ne" { id = id__BoolBinary_ne; break; }
|
1169 | "-nt" { id = id__BoolBinary_nt; break; }
|
1170 | "-ot" { id = id__BoolBinary_ot; break; }
|
1171 | "<" { id = id__Op_Less; break; }
|
1172 | "=" { id = id__BoolBinary_Equal; break; }
|
1173 | "==" { id = id__BoolBinary_DEqual; break; }
|
1174 | ">" { id = id__Op_Great; break; }
|
1175 | * { return id__Undefined_Tok; }
|
1176 |
|
1177 | */
|
1178 | }
|
1179 | // must be an exact match
|
1180 | return (p == end) ? id : id__Undefined_Tok;
|
1181 | }
|
1182 |
|
1183 |
|
1184 | static inline int BracketOther(const unsigned char* s, int len) {
|
1185 | const unsigned char* p = s; /* modified by re2c */
|
1186 | const unsigned char* end = s + len;
|
1187 |
|
1188 | __attribute__((unused)) const unsigned char* YYMARKER;
|
1189 | int id;
|
1190 |
|
1191 | for (;;) {
|
1192 | /*!re2c
|
1193 |
|
1194 | "!" { id = id__KW_Bang; break; }
|
1195 | "(" { id = id__Op_LParen; break; }
|
1196 | ")" { id = id__Op_RParen; break; }
|
1197 | "]" { id = id__Arith_RBracket; break; }
|
1198 | * { return id__Undefined_Tok; }
|
1199 |
|
1200 | */
|
1201 | }
|
1202 | // must be an exact match
|
1203 | return (p == end) ? id : id__Undefined_Tok;
|
1204 | }
|
1205 |
|