Line | Count | Source |
1 | | #line 2 "src/lexer.c" |
2 | | |
3 | | #line 4 "src/lexer.c" |
4 | | |
5 | | #define YY_INT_ALIGNED short int |
6 | | |
7 | | /* A lexical scanner generated by flex */ |
8 | | |
9 | | #define FLEX_SCANNER |
10 | | #define YY_FLEX_MAJOR_VERSION 2 |
11 | | #define YY_FLEX_MINOR_VERSION 6 |
12 | | #define YY_FLEX_SUBMINOR_VERSION 4 |
13 | | #if YY_FLEX_SUBMINOR_VERSION > 0 |
14 | | #define FLEX_BETA |
15 | | #endif |
16 | | |
17 | | #ifdef yy_create_buffer |
18 | | #define jq_yy_create_buffer_ALREADY_DEFINED |
19 | | #else |
20 | 0 | #define yy_create_buffer jq_yy_create_buffer |
21 | | #endif |
22 | | |
23 | | #ifdef yy_delete_buffer |
24 | | #define jq_yy_delete_buffer_ALREADY_DEFINED |
25 | | #else |
26 | 0 | #define yy_delete_buffer jq_yy_delete_buffer |
27 | | #endif |
28 | | |
29 | | #ifdef yy_scan_buffer |
30 | | #define jq_yy_scan_buffer_ALREADY_DEFINED |
31 | | #else |
32 | 0 | #define yy_scan_buffer jq_yy_scan_buffer |
33 | | #endif |
34 | | |
35 | | #ifdef yy_scan_string |
36 | | #define jq_yy_scan_string_ALREADY_DEFINED |
37 | | #else |
38 | | #define yy_scan_string jq_yy_scan_string |
39 | | #endif |
40 | | |
41 | | #ifdef yy_scan_bytes |
42 | | #define jq_yy_scan_bytes_ALREADY_DEFINED |
43 | | #else |
44 | 0 | #define yy_scan_bytes jq_yy_scan_bytes |
45 | | #endif |
46 | | |
47 | | #ifdef yy_init_buffer |
48 | | #define jq_yy_init_buffer_ALREADY_DEFINED |
49 | | #else |
50 | 0 | #define yy_init_buffer jq_yy_init_buffer |
51 | | #endif |
52 | | |
53 | | #ifdef yy_flush_buffer |
54 | | #define jq_yy_flush_buffer_ALREADY_DEFINED |
55 | | #else |
56 | 0 | #define yy_flush_buffer jq_yy_flush_buffer |
57 | | #endif |
58 | | |
59 | | #ifdef yy_load_buffer_state |
60 | | #define jq_yy_load_buffer_state_ALREADY_DEFINED |
61 | | #else |
62 | 0 | #define yy_load_buffer_state jq_yy_load_buffer_state |
63 | | #endif |
64 | | |
65 | | #ifdef yy_switch_to_buffer |
66 | | #define jq_yy_switch_to_buffer_ALREADY_DEFINED |
67 | | #else |
68 | 0 | #define yy_switch_to_buffer jq_yy_switch_to_buffer |
69 | | #endif |
70 | | |
71 | | #ifdef yypush_buffer_state |
72 | | #define jq_yypush_buffer_state_ALREADY_DEFINED |
73 | | #else |
74 | | #define yypush_buffer_state jq_yypush_buffer_state |
75 | | #endif |
76 | | |
77 | | #ifdef yypop_buffer_state |
78 | | #define jq_yypop_buffer_state_ALREADY_DEFINED |
79 | | #else |
80 | 0 | #define yypop_buffer_state jq_yypop_buffer_state |
81 | | #endif |
82 | | |
83 | | #ifdef yyensure_buffer_stack |
84 | | #define jq_yyensure_buffer_stack_ALREADY_DEFINED |
85 | | #else |
86 | 0 | #define yyensure_buffer_stack jq_yyensure_buffer_stack |
87 | | #endif |
88 | | |
89 | | #ifdef yylex |
90 | | #define jq_yylex_ALREADY_DEFINED |
91 | | #else |
92 | | #define yylex jq_yylex |
93 | | #endif |
94 | | |
95 | | #ifdef yyrestart |
96 | | #define jq_yyrestart_ALREADY_DEFINED |
97 | | #else |
98 | 0 | #define yyrestart jq_yyrestart |
99 | | #endif |
100 | | |
101 | | #ifdef yylex_init |
102 | | #define jq_yylex_init_ALREADY_DEFINED |
103 | | #else |
104 | | #define yylex_init jq_yylex_init |
105 | | #endif |
106 | | |
107 | | #ifdef yylex_init_extra |
108 | | #define jq_yylex_init_extra_ALREADY_DEFINED |
109 | | #else |
110 | | #define yylex_init_extra jq_yylex_init_extra |
111 | | #endif |
112 | | |
113 | | #ifdef yylex_destroy |
114 | | #define jq_yylex_destroy_ALREADY_DEFINED |
115 | | #else |
116 | | #define yylex_destroy jq_yylex_destroy |
117 | | #endif |
118 | | |
119 | | #ifdef yyget_debug |
120 | | #define jq_yyget_debug_ALREADY_DEFINED |
121 | | #else |
122 | | #define yyget_debug jq_yyget_debug |
123 | | #endif |
124 | | |
125 | | #ifdef yyset_debug |
126 | | #define jq_yyset_debug_ALREADY_DEFINED |
127 | | #else |
128 | | #define yyset_debug jq_yyset_debug |
129 | | #endif |
130 | | |
131 | | #ifdef yyget_extra |
132 | | #define jq_yyget_extra_ALREADY_DEFINED |
133 | | #else |
134 | 0 | #define yyget_extra jq_yyget_extra |
135 | | #endif |
136 | | |
137 | | #ifdef yyset_extra |
138 | | #define jq_yyset_extra_ALREADY_DEFINED |
139 | | #else |
140 | 0 | #define yyset_extra jq_yyset_extra |
141 | | #endif |
142 | | |
143 | | #ifdef yyget_in |
144 | | #define jq_yyget_in_ALREADY_DEFINED |
145 | | #else |
146 | | #define yyget_in jq_yyget_in |
147 | | #endif |
148 | | |
149 | | #ifdef yyset_in |
150 | | #define jq_yyset_in_ALREADY_DEFINED |
151 | | #else |
152 | | #define yyset_in jq_yyset_in |
153 | | #endif |
154 | | |
155 | | #ifdef yyget_out |
156 | | #define jq_yyget_out_ALREADY_DEFINED |
157 | | #else |
158 | | #define yyget_out jq_yyget_out |
159 | | #endif |
160 | | |
161 | | #ifdef yyset_out |
162 | | #define jq_yyset_out_ALREADY_DEFINED |
163 | | #else |
164 | | #define yyset_out jq_yyset_out |
165 | | #endif |
166 | | |
167 | | #ifdef yyget_leng |
168 | | #define jq_yyget_leng_ALREADY_DEFINED |
169 | | #else |
170 | | #define yyget_leng jq_yyget_leng |
171 | | #endif |
172 | | |
173 | | #ifdef yyget_text |
174 | | #define jq_yyget_text_ALREADY_DEFINED |
175 | | #else |
176 | | #define yyget_text jq_yyget_text |
177 | | #endif |
178 | | |
179 | | #ifdef yyget_lineno |
180 | | #define jq_yyget_lineno_ALREADY_DEFINED |
181 | | #else |
182 | | #define yyget_lineno jq_yyget_lineno |
183 | | #endif |
184 | | |
185 | | #ifdef yyset_lineno |
186 | | #define jq_yyset_lineno_ALREADY_DEFINED |
187 | | #else |
188 | | #define yyset_lineno jq_yyset_lineno |
189 | | #endif |
190 | | |
191 | | #ifdef yyget_column |
192 | | #define jq_yyget_column_ALREADY_DEFINED |
193 | | #else |
194 | | #define yyget_column jq_yyget_column |
195 | | #endif |
196 | | |
197 | | #ifdef yyset_column |
198 | | #define jq_yyset_column_ALREADY_DEFINED |
199 | | #else |
200 | | #define yyset_column jq_yyset_column |
201 | | #endif |
202 | | |
203 | | #ifdef yywrap |
204 | | #define jq_yywrap_ALREADY_DEFINED |
205 | | #else |
206 | 0 | #define yywrap jq_yywrap |
207 | | #endif |
208 | | |
209 | | #ifdef yyget_lval |
210 | | #define jq_yyget_lval_ALREADY_DEFINED |
211 | | #else |
212 | | #define yyget_lval jq_yyget_lval |
213 | | #endif |
214 | | |
215 | | #ifdef yyset_lval |
216 | | #define jq_yyset_lval_ALREADY_DEFINED |
217 | | #else |
218 | | #define yyset_lval jq_yyset_lval |
219 | | #endif |
220 | | |
221 | | #ifdef yyget_lloc |
222 | | #define jq_yyget_lloc_ALREADY_DEFINED |
223 | | #else |
224 | | #define yyget_lloc jq_yyget_lloc |
225 | | #endif |
226 | | |
227 | | #ifdef yyset_lloc |
228 | | #define jq_yyset_lloc_ALREADY_DEFINED |
229 | | #else |
230 | | #define yyset_lloc jq_yyset_lloc |
231 | | #endif |
232 | | |
233 | | #ifdef yyalloc |
234 | | #define jq_yyalloc_ALREADY_DEFINED |
235 | | #else |
236 | 0 | #define yyalloc jq_yyalloc |
237 | | #endif |
238 | | |
239 | | #ifdef yyrealloc |
240 | | #define jq_yyrealloc_ALREADY_DEFINED |
241 | | #else |
242 | 0 | #define yyrealloc jq_yyrealloc |
243 | | #endif |
244 | | |
245 | | #ifdef yyfree |
246 | | #define jq_yyfree_ALREADY_DEFINED |
247 | | #else |
248 | 0 | #define yyfree jq_yyfree |
249 | | #endif |
250 | | |
251 | | /* First, we deal with platform-specific or compiler-specific issues. */ |
252 | | |
253 | | /* begin standard C headers. */ |
254 | | #include <stdio.h> |
255 | | #include <string.h> |
256 | | #include <errno.h> |
257 | | #include <stdlib.h> |
258 | | |
259 | | /* end standard C headers. */ |
260 | | |
261 | | /* flex integer type definitions */ |
262 | | |
263 | | #ifndef FLEXINT_H |
264 | | #define FLEXINT_H |
265 | | |
266 | | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
267 | | |
268 | | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
269 | | |
270 | | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
271 | | * if you want the limit (max/min) macros for int types. |
272 | | */ |
273 | | #ifndef __STDC_LIMIT_MACROS |
274 | | #define __STDC_LIMIT_MACROS 1 |
275 | | #endif |
276 | | |
277 | | #include <inttypes.h> |
278 | | typedef int8_t flex_int8_t; |
279 | | typedef uint8_t flex_uint8_t; |
280 | | typedef int16_t flex_int16_t; |
281 | | typedef uint16_t flex_uint16_t; |
282 | | typedef int32_t flex_int32_t; |
283 | | typedef uint32_t flex_uint32_t; |
284 | | #else |
285 | | typedef signed char flex_int8_t; |
286 | | typedef short int flex_int16_t; |
287 | | typedef int flex_int32_t; |
288 | | typedef unsigned char flex_uint8_t; |
289 | | typedef unsigned short int flex_uint16_t; |
290 | | typedef unsigned int flex_uint32_t; |
291 | | |
292 | | /* Limits of integral types. */ |
293 | | #ifndef INT8_MIN |
294 | | #define INT8_MIN (-128) |
295 | | #endif |
296 | | #ifndef INT16_MIN |
297 | | #define INT16_MIN (-32767-1) |
298 | | #endif |
299 | | #ifndef INT32_MIN |
300 | | #define INT32_MIN (-2147483647-1) |
301 | | #endif |
302 | | #ifndef INT8_MAX |
303 | | #define INT8_MAX (127) |
304 | | #endif |
305 | | #ifndef INT16_MAX |
306 | | #define INT16_MAX (32767) |
307 | | #endif |
308 | | #ifndef INT32_MAX |
309 | | #define INT32_MAX (2147483647) |
310 | | #endif |
311 | | #ifndef UINT8_MAX |
312 | | #define UINT8_MAX (255U) |
313 | | #endif |
314 | | #ifndef UINT16_MAX |
315 | | #define UINT16_MAX (65535U) |
316 | | #endif |
317 | | #ifndef UINT32_MAX |
318 | | #define UINT32_MAX (4294967295U) |
319 | | #endif |
320 | | |
321 | | #ifndef SIZE_MAX |
322 | | #define SIZE_MAX (~(size_t)0) |
323 | | #endif |
324 | | |
325 | | #endif /* ! C99 */ |
326 | | |
327 | | #endif /* ! FLEXINT_H */ |
328 | | |
329 | | /* begin standard C++ headers. */ |
330 | | |
331 | | /* TODO: this is always defined, so inline it */ |
332 | | #define yyconst const |
333 | | |
334 | | #if defined(__GNUC__) && __GNUC__ >= 3 |
335 | | #define yynoreturn __attribute__((__noreturn__)) |
336 | | #else |
337 | | #define yynoreturn |
338 | | #endif |
339 | | |
340 | | /* Returned upon end-of-file. */ |
341 | 0 | #define YY_NULL 0 |
342 | | |
343 | | /* Promotes a possibly negative, possibly signed char to an |
344 | | * integer in range [0..255] for use as an array index. |
345 | | */ |
346 | 0 | #define YY_SC_TO_UI(c) ((YY_CHAR) (c)) |
347 | | |
348 | | /* An opaque pointer. */ |
349 | | #ifndef YY_TYPEDEF_YY_SCANNER_T |
350 | | #define YY_TYPEDEF_YY_SCANNER_T |
351 | | typedef void* yyscan_t; |
352 | | #endif |
353 | | |
354 | | /* For convenience, these vars (plus the bison vars far below) |
355 | | are macros in the reentrant scanner. */ |
356 | 0 | #define yyin yyg->yyin_r |
357 | 0 | #define yyout yyg->yyout_r |
358 | 0 | #define yyextra yyg->yyextra_r |
359 | 0 | #define yyleng yyg->yyleng_r |
360 | 0 | #define yytext yyg->yytext_r |
361 | 0 | #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) |
362 | 0 | #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) |
363 | 0 | #define yy_flex_debug yyg->yy_flex_debug_r |
364 | | |
365 | | /* Enter a start condition. This macro really ought to take a parameter, |
366 | | * but we do it the disgusting crufty way forced on us by the ()-less |
367 | | * definition of BEGIN. |
368 | | */ |
369 | 0 | #define BEGIN yyg->yy_start = 1 + 2 * |
370 | | /* Translate the current start state into a value that can be later handed |
371 | | * to BEGIN to return to the state. The YYSTATE alias is for lex |
372 | | * compatibility. |
373 | | */ |
374 | 0 | #define YY_START ((yyg->yy_start - 1) / 2) |
375 | | #define YYSTATE YY_START |
376 | | /* Action number for EOF rule of a given start state. */ |
377 | 0 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
378 | | /* Special action meaning "start processing a new file". */ |
379 | 0 | #define YY_NEW_FILE yyrestart( yyin , yyscanner ) |
380 | 0 | #define YY_END_OF_BUFFER_CHAR 0 |
381 | | |
382 | | /* Size of default input buffer. */ |
383 | | #ifndef YY_BUF_SIZE |
384 | | #ifdef __ia64__ |
385 | | /* On IA-64, the buffer size is 16k, not 8k. |
386 | | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
387 | | * Ditto for the __ia64__ case accordingly. |
388 | | */ |
389 | | #define YY_BUF_SIZE 32768 |
390 | | #else |
391 | 0 | #define YY_BUF_SIZE 16384 |
392 | | #endif /* __ia64__ */ |
393 | | #endif |
394 | | |
395 | | /* The state buf must be large enough to hold one state per character in the main buffer. |
396 | | */ |
397 | | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
398 | | |
399 | | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
400 | | #define YY_TYPEDEF_YY_BUFFER_STATE |
401 | | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
402 | | #endif |
403 | | |
404 | | #ifndef YY_TYPEDEF_YY_SIZE_T |
405 | | #define YY_TYPEDEF_YY_SIZE_T |
406 | | typedef size_t yy_size_t; |
407 | | #endif |
408 | | |
409 | 0 | #define EOB_ACT_CONTINUE_SCAN 0 |
410 | 0 | #define EOB_ACT_END_OF_FILE 1 |
411 | 0 | #define EOB_ACT_LAST_MATCH 2 |
412 | | |
413 | | #define YY_LESS_LINENO(n) |
414 | | #define YY_LINENO_REWIND_TO(ptr) |
415 | | |
416 | | /* Return all but the first "n" matched characters back to the input stream. */ |
417 | | #define yyless(n) \ |
418 | | do \ |
419 | | { \ |
420 | | /* Undo effects of setting up yytext. */ \ |
421 | | int yyless_macro_arg = (n); \ |
422 | | YY_LESS_LINENO(yyless_macro_arg);\ |
423 | | *yy_cp = yyg->yy_hold_char; \ |
424 | | YY_RESTORE_YY_MORE_OFFSET \ |
425 | | yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
426 | | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
427 | | } \ |
428 | | while ( 0 ) |
429 | | #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) |
430 | | |
431 | | #ifndef YY_STRUCT_YY_BUFFER_STATE |
432 | | #define YY_STRUCT_YY_BUFFER_STATE |
433 | | struct yy_buffer_state |
434 | | { |
435 | | FILE *yy_input_file; |
436 | | |
437 | | char *yy_ch_buf; /* input buffer */ |
438 | | char *yy_buf_pos; /* current position in input buffer */ |
439 | | |
440 | | /* Size of input buffer in bytes, not including room for EOB |
441 | | * characters. |
442 | | */ |
443 | | int yy_buf_size; |
444 | | |
445 | | /* Number of characters read into yy_ch_buf, not including EOB |
446 | | * characters. |
447 | | */ |
448 | | int yy_n_chars; |
449 | | |
450 | | /* Whether we "own" the buffer - i.e., we know we created it, |
451 | | * and can realloc() it to grow it, and should free() it to |
452 | | * delete it. |
453 | | */ |
454 | | int yy_is_our_buffer; |
455 | | |
456 | | /* Whether this is an "interactive" input source; if so, and |
457 | | * if we're using stdio for input, then we want to use getc() |
458 | | * instead of fread(), to make sure we stop fetching input after |
459 | | * each newline. |
460 | | */ |
461 | | int yy_is_interactive; |
462 | | |
463 | | /* Whether we're considered to be at the beginning of a line. |
464 | | * If so, '^' rules will be active on the next match, otherwise |
465 | | * not. |
466 | | */ |
467 | | int yy_at_bol; |
468 | | |
469 | | int yy_bs_lineno; /**< The line count. */ |
470 | | int yy_bs_column; /**< The column count. */ |
471 | | |
472 | | /* Whether to try to fill the input buffer when we reach the |
473 | | * end of it. |
474 | | */ |
475 | | int yy_fill_buffer; |
476 | | |
477 | | int yy_buffer_status; |
478 | | |
479 | 0 | #define YY_BUFFER_NEW 0 |
480 | 0 | #define YY_BUFFER_NORMAL 1 |
481 | | /* When an EOF's been seen but there's still some text to process |
482 | | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
483 | | * shouldn't try reading from the input source any more. We might |
484 | | * still have a bunch of tokens to match, though, because of |
485 | | * possible backing-up. |
486 | | * |
487 | | * When we actually see the EOF, we change the status to "new" |
488 | | * (via yyrestart()), so that the user can continue scanning by |
489 | | * just pointing yyin at a new input file. |
490 | | */ |
491 | 0 | #define YY_BUFFER_EOF_PENDING 2 |
492 | | |
493 | | }; |
494 | | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
495 | | |
496 | | /* We provide macros for accessing buffer states in case in the |
497 | | * future we want to put the buffer states in a more general |
498 | | * "scanner state". |
499 | | * |
500 | | * Returns the top of the stack, or NULL. |
501 | | */ |
502 | 0 | #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ |
503 | 0 | ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ |
504 | 0 | : NULL) |
505 | | /* Same as previous macro, but useful when we know that the buffer stack is not |
506 | | * NULL or when we need an lvalue. For internal use only. |
507 | | */ |
508 | 0 | #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] |
509 | | |
510 | | void yyrestart ( FILE *input_file , yyscan_t yyscanner ); |
511 | | void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); |
512 | | YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); |
513 | | void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); |
514 | | void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); |
515 | | void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); |
516 | | void yypop_buffer_state ( yyscan_t yyscanner ); |
517 | | |
518 | | static void yyensure_buffer_stack ( yyscan_t yyscanner ); |
519 | | static void yy_load_buffer_state ( yyscan_t yyscanner ); |
520 | | static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); |
521 | | #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) |
522 | | |
523 | | YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); |
524 | | YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); |
525 | | YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); |
526 | | |
527 | | void *yyalloc ( yy_size_t , yyscan_t yyscanner ); |
528 | | void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); |
529 | | void yyfree ( void * , yyscan_t yyscanner ); |
530 | | |
531 | | #define yy_new_buffer yy_create_buffer |
532 | | #define yy_set_interactive(is_interactive) \ |
533 | | { \ |
534 | | if ( ! YY_CURRENT_BUFFER ){ \ |
535 | | yyensure_buffer_stack (yyscanner); \ |
536 | | YY_CURRENT_BUFFER_LVALUE = \ |
537 | | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ |
538 | | } \ |
539 | | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
540 | | } |
541 | | #define yy_set_bol(at_bol) \ |
542 | | { \ |
543 | | if ( ! YY_CURRENT_BUFFER ){\ |
544 | | yyensure_buffer_stack (yyscanner); \ |
545 | | YY_CURRENT_BUFFER_LVALUE = \ |
546 | | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ |
547 | | } \ |
548 | | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
549 | | } |
550 | | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
551 | | |
552 | | /* Begin user sect3 */ |
553 | | |
554 | 0 | #define jq_yywrap(yyscanner) (/*CONSTCOND*/1) |
555 | | #define YY_SKIP_YYWRAP |
556 | | typedef flex_uint8_t YY_CHAR; |
557 | | |
558 | | typedef int yy_state_type; |
559 | | |
560 | 0 | #define yytext_ptr yytext_r |
561 | | |
562 | | static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); |
563 | | static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); |
564 | | static int yy_get_next_buffer ( yyscan_t yyscanner ); |
565 | | static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); |
566 | | |
567 | | /* Done after the current pattern has been matched and before the |
568 | | * corresponding action - sets up yytext. |
569 | | */ |
570 | | #define YY_DO_BEFORE_ACTION \ |
571 | 0 | yyg->yytext_ptr = yy_bp; \ |
572 | 0 | yyleng = (int) (yy_cp - yy_bp); \ |
573 | 0 | yyg->yy_hold_char = *yy_cp; \ |
574 | 0 | *yy_cp = '\0'; \ |
575 | 0 | yyg->yy_c_buf_p = yy_cp; |
576 | | #define YY_NUM_RULES 53 |
577 | 0 | #define YY_END_OF_BUFFER 54 |
578 | | /* This struct is not used in this scanner, |
579 | | but its presence is necessary. */ |
580 | | struct yy_trans_info |
581 | | { |
582 | | flex_int32_t yy_verify; |
583 | | flex_int32_t yy_nxt; |
584 | | }; |
585 | | static const flex_int16_t yy_accept[171] = |
586 | | { 0, |
587 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
588 | | 0, 0, 0, 0, 54, 52, 51, 51, 52, 42, |
589 | | 1, 37, 37, 38, 39, 37, 37, 37, 37, 37, |
590 | | 37, 41, 37, 37, 37, 37, 52, 48, 48, 48, |
591 | | 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, |
592 | | 37, 46, 46, 44, 47, 2, 3, 2, 2, 51, |
593 | | 4, 50, 50, 31, 29, 27, 28, 35, 41, 49, |
594 | | 20, 30, 41, 41, 0, 33, 5, 34, 0, 40, |
595 | | 48, 0, 48, 6, 48, 48, 48, 48, 48, 48, |
596 | | 11, 48, 48, 48, 48, 16, 48, 48, 48, 26, |
597 | | |
598 | | 46, 45, 43, 45, 3, 2, 0, 50, 0, 50, |
599 | | 49, 32, 41, 0, 41, 36, 0, 15, 48, 48, |
600 | | 10, 48, 48, 17, 48, 48, 48, 48, 48, 48, |
601 | | 48, 21, 0, 45, 0, 50, 48, 48, 48, 14, |
602 | | 13, 48, 48, 48, 48, 48, 48, 12, 45, 50, |
603 | | 24, 22, 48, 48, 48, 23, 48, 48, 45, 50, |
604 | | 48, 7, 48, 9, 18, 50, 19, 8, 25, 0 |
605 | | } ; |
606 | | |
607 | | static const YY_CHAR yy_ec[256] = |
608 | | { 0, |
609 | | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
610 | | 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, |
611 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
612 | | 1, 2, 5, 6, 7, 8, 9, 1, 1, 10, |
613 | | 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, |
614 | | 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, |
615 | | 22, 23, 24, 25, 26, 26, 26, 26, 27, 26, |
616 | | 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, |
617 | | 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, |
618 | | 28, 29, 30, 1, 31, 1, 32, 33, 34, 35, |
619 | | |
620 | | 36, 37, 26, 38, 39, 26, 40, 41, 42, 43, |
621 | | 44, 45, 26, 46, 47, 48, 49, 26, 26, 26, |
622 | | 50, 26, 51, 52, 53, 1, 1, 1, 1, 1, |
623 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
624 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
625 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
626 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
627 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
628 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
629 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
630 | | |
631 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
632 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
633 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
634 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
635 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
636 | | 1, 1, 1, 1, 1 |
637 | | } ; |
638 | | |
639 | | static const YY_CHAR yy_meta[54] = |
640 | | { 0, |
641 | | 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, |
642 | | 1, 1, 1, 1, 1, 3, 1, 4, 5, 1, |
643 | | 1, 1, 1, 1, 1, 6, 6, 1, 7, 1, |
644 | | 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, |
645 | | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, |
646 | | 1, 1, 1 |
647 | | } ; |
648 | | |
649 | | static const flex_int16_t yy_base[186] = |
650 | | { 0, |
651 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
652 | | 51, 52, 56, 58, 340, 341, 61, 64, 317, 341, |
653 | | 341, 307, 315, 341, 341, 314, 313, 341, 312, 53, |
654 | | 53, 56, 311, 310, 309, 313, 0, 310, 54, 57, |
655 | | 58, 59, 63, 65, 70, 67, 72, 69, 60, 79, |
656 | | 306, 0, 0, 341, 83, 341, 341, 324, 107, 116, |
657 | | 341, 307, 83, 341, 341, 341, 341, 341, 103, 0, |
658 | | 303, 341, 104, 108, 128, 341, 341, 341, 307, 0, |
659 | | 304, 301, 110, 297, 114, 75, 115, 108, 118, 119, |
660 | | 293, 109, 123, 129, 132, 290, 137, 130, 139, 341, |
661 | | |
662 | | 0, 276, 341, 273, 341, 341, 297, 278, 265, 140, |
663 | | 0, 341, 142, 261, 258, 341, 0, 252, 142, 145, |
664 | | 250, 149, 144, 247, 151, 152, 154, 156, 157, 158, |
665 | | 165, 245, 172, 231, 0, 166, 222, 164, 171, 221, |
666 | | 220, 169, 172, 174, 175, 178, 179, 218, 206, 180, |
667 | | 215, 214, 181, 183, 192, 213, 184, 186, 201, 193, |
668 | | 198, 210, 206, 209, 89, 207, 86, 81, 37, 341, |
669 | | 242, 250, 253, 259, 264, 269, 277, 285, 290, 295, |
670 | | 300, 302, 307, 311, 315 |
671 | | } ; |
672 | | |
673 | | static const flex_int16_t yy_def[186] = |
674 | | { 0, |
675 | | 170, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
676 | | 171, 171, 172, 172, 170, 170, 170, 170, 170, 170, |
677 | | 170, 173, 170, 170, 170, 170, 170, 170, 170, 174, |
678 | | 170, 170, 170, 170, 170, 170, 175, 176, 176, 176, |
679 | | 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, |
680 | | 170, 177, 177, 170, 178, 170, 170, 170, 170, 170, |
681 | | 170, 179, 179, 170, 170, 170, 170, 170, 170, 180, |
682 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 175, |
683 | | 176, 170, 176, 176, 176, 176, 176, 176, 176, 176, |
684 | | 176, 176, 176, 176, 176, 176, 176, 176, 176, 170, |
685 | | |
686 | | 177, 170, 170, 181, 170, 170, 170, 179, 170, 179, |
687 | | 180, 170, 170, 170, 170, 170, 182, 176, 176, 176, |
688 | | 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, |
689 | | 176, 176, 178, 183, 173, 179, 176, 176, 176, 176, |
690 | | 176, 176, 176, 176, 176, 176, 176, 176, 184, 179, |
691 | | 176, 176, 176, 176, 176, 176, 176, 176, 185, 179, |
692 | | 176, 176, 176, 176, 176, 179, 176, 176, 179, 0, |
693 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
694 | | 170, 170, 170, 170, 170 |
695 | | } ; |
696 | | |
697 | | static const flex_int16_t yy_nxt[395] = |
698 | | { 0, |
699 | | 16, 17, 18, 17, 19, 20, 21, 22, 23, 24, |
700 | | 25, 26, 27, 28, 29, 30, 31, 32, 28, 28, |
701 | | 33, 34, 35, 36, 37, 38, 38, 24, 16, 25, |
702 | | 38, 39, 40, 41, 42, 43, 44, 38, 45, 38, |
703 | | 46, 47, 38, 48, 38, 49, 38, 50, 38, 38, |
704 | | 24, 51, 25, 53, 53, 109, 54, 54, 57, 58, |
705 | | 57, 58, 60, 60, 60, 60, 60, 60, 68, 71, |
706 | | 69, 73, 82, 74, 72, 82, 82, 82, 82, 55, |
707 | | 55, 82, 75, 82, 59, 82, 59, 82, 82, 86, |
708 | | 82, 75, 103, 82, 87, 97, 83, 82, 94, 82, |
709 | | |
710 | | 84, 109, 85, 88, 82, 89, 91, 82, 90, 106, |
711 | | 107, 92, 93, 110, 96, 95, 98, 60, 60, 60, |
712 | | 69, 113, 120, 73, 99, 74, 82, 82, 82, 75, |
713 | | 75, 104, 82, 82, 75, 106, 82, 82, 75, 75, |
714 | | 114, 82, 114, 75, 118, 115, 122, 82, 82, 119, |
715 | | 82, 121, 124, 126, 123, 82, 127, 82, 109, 113, |
716 | | 82, 128, 82, 82, 125, 131, 129, 82, 75, 82, |
717 | | 82, 130, 82, 138, 82, 82, 82, 75, 139, 141, |
718 | | 136, 170, 82, 82, 109, 140, 142, 82, 132, 82, |
719 | | 82, 145, 82, 82, 144, 143, 82, 82, 109, 82, |
720 | | |
721 | | 153, 82, 82, 151, 82, 146, 147, 148, 152, 150, |
722 | | 82, 109, 158, 160, 161, 156, 82, 154, 157, 164, |
723 | | 104, 165, 155, 166, 82, 109, 163, 82, 82, 133, |
724 | | 162, 82, 82, 82, 133, 167, 82, 169, 82, 82, |
725 | | 82, 168, 52, 52, 52, 52, 52, 52, 52, 52, |
726 | | 56, 56, 56, 56, 56, 56, 56, 56, 62, 133, |
727 | | 62, 70, 70, 82, 70, 82, 70, 80, 82, 80, |
728 | | 82, 80, 81, 81, 81, 115, 81, 101, 115, 101, |
729 | | 101, 101, 101, 135, 101, 102, 102, 102, 102, 102, |
730 | | 102, 102, 102, 108, 108, 108, 109, 108, 111, 106, |
731 | | |
732 | | 111, 133, 111, 134, 133, 134, 134, 137, 82, 137, |
733 | | 149, 82, 149, 149, 159, 82, 159, 159, 102, 117, |
734 | | 102, 102, 82, 116, 112, 109, 105, 100, 82, 79, |
735 | | 78, 77, 76, 67, 66, 65, 64, 63, 61, 170, |
736 | | 15, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
737 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
738 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
739 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
740 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
741 | | 170, 170, 170, 170 |
742 | | |
743 | | } ; |
744 | | |
745 | | static const flex_int16_t yy_chk[395] = |
746 | | { 0, |
747 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
748 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
749 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
750 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
751 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
752 | | 1, 1, 1, 11, 12, 169, 11, 12, 13, 13, |
753 | | 14, 14, 17, 17, 17, 18, 18, 18, 30, 31, |
754 | | 30, 32, 39, 32, 31, 40, 41, 42, 49, 11, |
755 | | 12, 43, 32, 44, 13, 46, 14, 48, 45, 41, |
756 | | 47, 32, 55, 86, 42, 49, 39, 50, 46, 168, |
757 | | |
758 | | 39, 63, 40, 43, 167, 43, 45, 165, 44, 59, |
759 | | 59, 45, 45, 63, 48, 47, 50, 60, 60, 60, |
760 | | 69, 73, 86, 74, 50, 74, 88, 92, 83, 69, |
761 | | 73, 55, 85, 87, 74, 59, 89, 90, 69, 73, |
762 | | 75, 93, 75, 74, 83, 75, 88, 94, 98, 85, |
763 | | 95, 87, 89, 92, 88, 97, 93, 99, 110, 113, |
764 | | 119, 94, 123, 120, 90, 98, 95, 122, 113, 125, |
765 | | 126, 97, 127, 119, 128, 129, 130, 113, 120, 123, |
766 | | 110, 133, 138, 131, 136, 122, 125, 142, 99, 139, |
767 | | 143, 128, 144, 145, 127, 126, 146, 147, 150, 153, |
768 | | |
769 | | 142, 154, 157, 138, 158, 129, 130, 131, 139, 136, |
770 | | 155, 160, 147, 150, 153, 145, 161, 143, 146, 157, |
771 | | 133, 158, 144, 160, 163, 166, 155, 164, 162, 159, |
772 | | 154, 156, 152, 151, 149, 161, 148, 166, 141, 140, |
773 | | 137, 163, 171, 171, 171, 171, 171, 171, 171, 171, |
774 | | 172, 172, 172, 172, 172, 172, 172, 172, 173, 134, |
775 | | 173, 174, 174, 132, 174, 124, 174, 175, 121, 175, |
776 | | 118, 175, 176, 176, 176, 115, 176, 177, 114, 177, |
777 | | 177, 177, 177, 109, 177, 178, 178, 178, 178, 178, |
778 | | 178, 178, 178, 179, 179, 179, 108, 179, 180, 107, |
779 | | |
780 | | 180, 104, 180, 181, 102, 181, 181, 182, 96, 182, |
781 | | 183, 91, 183, 183, 184, 84, 184, 184, 185, 82, |
782 | | 185, 185, 81, 79, 71, 62, 58, 51, 38, 36, |
783 | | 35, 34, 33, 29, 27, 26, 23, 22, 19, 15, |
784 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
785 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
786 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
787 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
788 | | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
789 | | 170, 170, 170, 170 |
790 | | |
791 | | } ; |
792 | | |
793 | | /* The intent behind this definition is that it'll catch |
794 | | * any uses of REJECT which flex missed. |
795 | | */ |
796 | | #define REJECT reject_used_but_not_detected |
797 | | #define yymore() yymore_used_but_not_detected |
798 | 0 | #define YY_MORE_ADJ 0 |
799 | | #define YY_RESTORE_YY_MORE_OFFSET |
800 | | #line 1 "src/lexer.l" |
801 | | #line 2 "src/lexer.l" |
802 | | #include <assert.h> |
803 | | #include "jv_alloc.h" |
804 | | #include "compile.h" |
805 | | |
806 | | struct lexer_param; |
807 | | |
808 | | #include "parser.h" /* Generated by bison. */ |
809 | | |
810 | | #define YY_USER_ACTION \ |
811 | 0 | do { \ |
812 | 0 | yylloc->start = yyget_extra(yyscanner); \ |
813 | 0 | yylloc->end = yylloc->start + yyleng; \ |
814 | 0 | yyset_extra(yylloc->end, yyscanner); \ |
815 | 0 | } while (0); |
816 | | |
817 | | #line 818 "src/lexer.c" |
818 | | |
819 | | #line 26 "src/lexer.l" |
820 | | static int enter(int opening, int state, yyscan_t yyscanner); |
821 | | static int try_exit(int closing, int state, yyscan_t yyscanner); |
822 | | #line 823 "src/lexer.c" |
823 | | #define YY_NO_INPUT 1 |
824 | | #line 825 "src/lexer.c" |
825 | | |
826 | | #define INITIAL 0 |
827 | 0 | #define IN_PAREN 1 |
828 | 0 | #define IN_BRACKET 2 |
829 | 0 | #define IN_BRACE 3 |
830 | 0 | #define IN_QQINTERP 4 |
831 | 0 | #define IN_QQSTRING 5 |
832 | 0 | #define IN_COMMENT 6 |
833 | | |
834 | | #ifndef YY_NO_UNISTD_H |
835 | | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
836 | | * down here because we want the user's section 1 to have been scanned first. |
837 | | * The user has a chance to override it with an option. |
838 | | */ |
839 | | #include <unistd.h> |
840 | | #endif |
841 | | |
842 | | #define YY_EXTRA_TYPE int |
843 | | |
844 | | /* Holds the entire state of the reentrant scanner. */ |
845 | | struct yyguts_t |
846 | | { |
847 | | |
848 | | /* User-defined. Not touched by flex. */ |
849 | | YY_EXTRA_TYPE yyextra_r; |
850 | | |
851 | | /* The rest are the same as the globals declared in the non-reentrant scanner. */ |
852 | | FILE *yyin_r, *yyout_r; |
853 | | size_t yy_buffer_stack_top; /**< index of top of stack. */ |
854 | | size_t yy_buffer_stack_max; /**< capacity of stack. */ |
855 | | YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ |
856 | | char yy_hold_char; |
857 | | int yy_n_chars; |
858 | | int yyleng_r; |
859 | | char *yy_c_buf_p; |
860 | | int yy_init; |
861 | | int yy_start; |
862 | | int yy_did_buffer_switch_on_eof; |
863 | | int yy_start_stack_ptr; |
864 | | int yy_start_stack_depth; |
865 | | int *yy_start_stack; |
866 | | yy_state_type yy_last_accepting_state; |
867 | | char* yy_last_accepting_cpos; |
868 | | |
869 | | int yylineno_r; |
870 | | int yy_flex_debug_r; |
871 | | |
872 | | char *yytext_r; |
873 | | int yy_more_flag; |
874 | | int yy_more_len; |
875 | | |
876 | | YYSTYPE * yylval_r; |
877 | | |
878 | | YYLTYPE * yylloc_r; |
879 | | |
880 | | }; /* end struct yyguts_t */ |
881 | | |
882 | | static int yy_init_globals ( yyscan_t yyscanner ); |
883 | | |
884 | | /* This must go here because YYSTYPE and YYLTYPE are included |
885 | | * from bison output in section 1.*/ |
886 | 0 | # define yylval yyg->yylval_r |
887 | | |
888 | 0 | # define yylloc yyg->yylloc_r |
889 | | |
890 | | int yylex_init (yyscan_t* scanner); |
891 | | |
892 | | int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); |
893 | | |
894 | | /* Accessor methods to globals. |
895 | | These are made visible to non-reentrant scanners for convenience. */ |
896 | | |
897 | | int yylex_destroy ( yyscan_t yyscanner ); |
898 | | |
899 | | int yyget_debug ( yyscan_t yyscanner ); |
900 | | |
901 | | void yyset_debug ( int debug_flag , yyscan_t yyscanner ); |
902 | | |
903 | | YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); |
904 | | |
905 | | void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); |
906 | | |
907 | | FILE *yyget_in ( yyscan_t yyscanner ); |
908 | | |
909 | | void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); |
910 | | |
911 | | FILE *yyget_out ( yyscan_t yyscanner ); |
912 | | |
913 | | void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); |
914 | | |
915 | | int yyget_leng ( yyscan_t yyscanner ); |
916 | | |
917 | | char *yyget_text ( yyscan_t yyscanner ); |
918 | | |
919 | | int yyget_lineno ( yyscan_t yyscanner ); |
920 | | |
921 | | void yyset_lineno ( int _line_number , yyscan_t yyscanner ); |
922 | | |
923 | | int yyget_column ( yyscan_t yyscanner ); |
924 | | |
925 | | void yyset_column ( int _column_no , yyscan_t yyscanner ); |
926 | | |
927 | | YYSTYPE * yyget_lval ( yyscan_t yyscanner ); |
928 | | |
929 | | void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); |
930 | | |
931 | | YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); |
932 | | |
933 | | void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); |
934 | | |
935 | | /* Macros after this point can all be overridden by user definitions in |
936 | | * section 1. |
937 | | */ |
938 | | |
939 | | #ifndef YY_SKIP_YYWRAP |
940 | | #ifdef __cplusplus |
941 | | extern "C" int yywrap ( yyscan_t yyscanner ); |
942 | | #else |
943 | | extern int yywrap ( yyscan_t yyscanner ); |
944 | | #endif |
945 | | #endif |
946 | | |
947 | | #ifndef YY_NO_UNPUT |
948 | | |
949 | | #endif |
950 | | |
951 | | #ifndef yytext_ptr |
952 | | static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); |
953 | | #endif |
954 | | |
955 | | #ifdef YY_NEED_STRLEN |
956 | | static int yy_flex_strlen ( const char * , yyscan_t yyscanner); |
957 | | #endif |
958 | | |
959 | | #ifndef YY_NO_INPUT |
960 | | #ifdef __cplusplus |
961 | | static int yyinput ( yyscan_t yyscanner ); |
962 | | #else |
963 | | static int input ( yyscan_t yyscanner ); |
964 | | #endif |
965 | | |
966 | | #endif |
967 | | |
968 | | static void yy_push_state ( int _new_state , yyscan_t yyscanner); |
969 | | |
970 | | static void yy_pop_state ( yyscan_t yyscanner ); |
971 | | |
972 | | static int yy_top_state ( yyscan_t yyscanner ); |
973 | | |
974 | | /* Amount of stuff to slurp up with each read. */ |
975 | | #ifndef YY_READ_BUF_SIZE |
976 | | #ifdef __ia64__ |
977 | | /* On IA-64, the buffer size is 16k, not 8k */ |
978 | | #define YY_READ_BUF_SIZE 16384 |
979 | | #else |
980 | 0 | #define YY_READ_BUF_SIZE 8192 |
981 | | #endif /* __ia64__ */ |
982 | | #endif |
983 | | |
984 | | /* Copy whatever the last rule matched to the standard output. */ |
985 | | #ifndef ECHO |
986 | | /* This used to be an fputs(), but since the string might contain NUL's, |
987 | | * we now use fwrite(). |
988 | | */ |
989 | | #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) |
990 | | #endif |
991 | | |
992 | | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
993 | | * is returned in "result". |
994 | | */ |
995 | | #ifndef YY_INPUT |
996 | | #define YY_INPUT(buf,result,max_size) \ |
997 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
998 | 0 | { \ |
999 | 0 | int c = '*'; \ |
1000 | 0 | int n; \ |
1001 | 0 | for ( n = 0; n < max_size && \ |
1002 | 0 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
1003 | 0 | buf[n] = (char) c; \ |
1004 | 0 | if ( c == '\n' ) \ |
1005 | 0 | buf[n++] = (char) c; \ |
1006 | 0 | if ( c == EOF && ferror( yyin ) ) \ |
1007 | 0 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1008 | 0 | result = n; \ |
1009 | 0 | } \ |
1010 | 0 | else \ |
1011 | 0 | { \ |
1012 | 0 | errno=0; \ |
1013 | 0 | while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ |
1014 | 0 | { \ |
1015 | 0 | if( errno != EINTR) \ |
1016 | 0 | { \ |
1017 | 0 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1018 | 0 | break; \ |
1019 | 0 | } \ |
1020 | 0 | errno=0; \ |
1021 | 0 | clearerr(yyin); \ |
1022 | 0 | } \ |
1023 | 0 | }\ |
1024 | | \ |
1025 | | |
1026 | | #endif |
1027 | | |
1028 | | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
1029 | | * we don't want an extra ';' after the "return" because that will cause |
1030 | | * some compilers to complain about unreachable statements. |
1031 | | */ |
1032 | | #ifndef yyterminate |
1033 | 0 | #define yyterminate() return YY_NULL |
1034 | | #endif |
1035 | | |
1036 | | /* Number of entries by which start-condition stack grows. */ |
1037 | | #ifndef YY_START_STACK_INCR |
1038 | 0 | #define YY_START_STACK_INCR 25 |
1039 | | #endif |
1040 | | |
1041 | | /* Report a fatal error. */ |
1042 | | #ifndef YY_FATAL_ERROR |
1043 | 0 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) |
1044 | | #endif |
1045 | | |
1046 | | /* end tables serialization structures and prototypes */ |
1047 | | |
1048 | | /* Default declaration of generated scanner - a define so the user can |
1049 | | * easily add parameters. |
1050 | | */ |
1051 | | #ifndef YY_DECL |
1052 | | #define YY_DECL_IS_OURS 1 |
1053 | | |
1054 | | extern int yylex \ |
1055 | | (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); |
1056 | | |
1057 | | #define YY_DECL int yylex \ |
1058 | | (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) |
1059 | | #endif /* !YY_DECL */ |
1060 | | |
1061 | | /* Code executed at the beginning of each rule, after yytext and yyleng |
1062 | | * have been set up. |
1063 | | */ |
1064 | | #ifndef YY_USER_ACTION |
1065 | | #define YY_USER_ACTION |
1066 | | #endif |
1067 | | |
1068 | | /* Code executed at the end of each rule. */ |
1069 | | #ifndef YY_BREAK |
1070 | 0 | #define YY_BREAK /*LINTED*/break; |
1071 | | #endif |
1072 | | |
1073 | | #define YY_RULE_SETUP \ |
1074 | 0 | YY_USER_ACTION |
1075 | | |
1076 | | /** The main scanner function which does all the work. |
1077 | | */ |
1078 | | YY_DECL |
1079 | 0 | { |
1080 | 0 | yy_state_type yy_current_state; |
1081 | 0 | char *yy_cp, *yy_bp; |
1082 | 0 | int yy_act; |
1083 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1084 | |
|
1085 | 0 | yylval = yylval_param; |
1086 | |
|
1087 | 0 | yylloc = yylloc_param; |
1088 | |
|
1089 | 0 | if ( !yyg->yy_init ) |
1090 | 0 | { |
1091 | 0 | yyg->yy_init = 1; |
1092 | |
|
1093 | | #ifdef YY_USER_INIT |
1094 | | YY_USER_INIT; |
1095 | | #endif |
1096 | |
|
1097 | 0 | if ( ! yyg->yy_start ) |
1098 | 0 | yyg->yy_start = 1; /* first start state */ |
1099 | |
|
1100 | 0 | if ( ! yyin ) |
1101 | 0 | yyin = stdin; |
1102 | |
|
1103 | 0 | if ( ! yyout ) |
1104 | 0 | yyout = stdout; |
1105 | |
|
1106 | 0 | if ( ! YY_CURRENT_BUFFER ) { |
1107 | 0 | yyensure_buffer_stack (yyscanner); |
1108 | 0 | YY_CURRENT_BUFFER_LVALUE = |
1109 | 0 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); |
1110 | 0 | } |
1111 | |
|
1112 | 0 | yy_load_buffer_state( yyscanner ); |
1113 | 0 | } |
1114 | |
|
1115 | 0 | { |
1116 | 0 | #line 39 "src/lexer.l" |
1117 | | |
1118 | |
|
1119 | 0 | #line 1120 "src/lexer.c" |
1120 | |
|
1121 | 0 | while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ |
1122 | 0 | { |
1123 | 0 | yy_cp = yyg->yy_c_buf_p; |
1124 | | |
1125 | | /* Support of yytext. */ |
1126 | 0 | *yy_cp = yyg->yy_hold_char; |
1127 | | |
1128 | | /* yy_bp points to the position in yy_ch_buf of the start of |
1129 | | * the current run. |
1130 | | */ |
1131 | 0 | yy_bp = yy_cp; |
1132 | |
|
1133 | 0 | yy_current_state = yyg->yy_start; |
1134 | 0 | yy_match: |
1135 | 0 | do |
1136 | 0 | { |
1137 | 0 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
1138 | 0 | if ( yy_accept[yy_current_state] ) |
1139 | 0 | { |
1140 | 0 | yyg->yy_last_accepting_state = yy_current_state; |
1141 | 0 | yyg->yy_last_accepting_cpos = yy_cp; |
1142 | 0 | } |
1143 | 0 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1144 | 0 | { |
1145 | 0 | yy_current_state = (int) yy_def[yy_current_state]; |
1146 | 0 | if ( yy_current_state >= 171 ) |
1147 | 0 | yy_c = yy_meta[yy_c]; |
1148 | 0 | } |
1149 | 0 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1150 | 0 | ++yy_cp; |
1151 | 0 | } |
1152 | 0 | while ( yy_base[yy_current_state] != 341 ); |
1153 | |
|
1154 | 0 | yy_find_action: |
1155 | 0 | yy_act = yy_accept[yy_current_state]; |
1156 | 0 | if ( yy_act == 0 ) |
1157 | 0 | { /* have to back up */ |
1158 | 0 | yy_cp = yyg->yy_last_accepting_cpos; |
1159 | 0 | yy_current_state = yyg->yy_last_accepting_state; |
1160 | 0 | yy_act = yy_accept[yy_current_state]; |
1161 | 0 | } |
1162 | |
|
1163 | 0 | YY_DO_BEFORE_ACTION; |
1164 | |
|
1165 | 0 | do_action: /* This label is used only to access EOF actions. */ |
1166 | |
|
1167 | 0 | switch ( yy_act ) |
1168 | 0 | { /* beginning of action switch */ |
1169 | 0 | case 0: /* must back up */ |
1170 | | /* undo the effects of YY_DO_BEFORE_ACTION */ |
1171 | 0 | *yy_cp = yyg->yy_hold_char; |
1172 | 0 | yy_cp = yyg->yy_last_accepting_cpos; |
1173 | 0 | yy_current_state = yyg->yy_last_accepting_state; |
1174 | 0 | goto yy_find_action; |
1175 | | |
1176 | 0 | case 1: |
1177 | 0 | YY_RULE_SETUP |
1178 | 0 | #line 41 "src/lexer.l" |
1179 | 0 | { yy_push_state(IN_COMMENT, yyscanner); } |
1180 | 0 | YY_BREAK |
1181 | | |
1182 | 0 | case 2: |
1183 | | /* rule 2 can match eol */ |
1184 | 0 | YY_RULE_SETUP |
1185 | 0 | #line 43 "src/lexer.l" |
1186 | 0 | { } |
1187 | 0 | YY_BREAK |
1188 | 0 | case 3: |
1189 | | /* rule 3 can match eol */ |
1190 | 0 | YY_RULE_SETUP |
1191 | 0 | #line 44 "src/lexer.l" |
1192 | 0 | { yy_pop_state(yyscanner); } |
1193 | 0 | YY_BREAK |
1194 | | |
1195 | 0 | case YY_STATE_EOF(IN_COMMENT): |
1196 | 0 | #line 46 "src/lexer.l" |
1197 | 0 | { yy_pop_state(yyscanner); } |
1198 | 0 | YY_BREAK |
1199 | 0 | case 4: |
1200 | 0 | YY_RULE_SETUP |
1201 | 0 | #line 48 "src/lexer.l" |
1202 | 0 | { return NEQ; } |
1203 | 0 | YY_BREAK |
1204 | 0 | case 5: |
1205 | 0 | YY_RULE_SETUP |
1206 | 0 | #line 49 "src/lexer.l" |
1207 | 0 | { return EQ; } |
1208 | 0 | YY_BREAK |
1209 | 0 | case 6: |
1210 | 0 | YY_RULE_SETUP |
1211 | 0 | #line 50 "src/lexer.l" |
1212 | 0 | { return AS; } |
1213 | 0 | YY_BREAK |
1214 | 0 | case 7: |
1215 | 0 | YY_RULE_SETUP |
1216 | 0 | #line 51 "src/lexer.l" |
1217 | 0 | { return IMPORT; } |
1218 | 0 | YY_BREAK |
1219 | 0 | case 8: |
1220 | 0 | YY_RULE_SETUP |
1221 | 0 | #line 52 "src/lexer.l" |
1222 | 0 | { return INCLUDE; } |
1223 | 0 | YY_BREAK |
1224 | 0 | case 9: |
1225 | 0 | YY_RULE_SETUP |
1226 | 0 | #line 53 "src/lexer.l" |
1227 | 0 | { return MODULE; } |
1228 | 0 | YY_BREAK |
1229 | 0 | case 10: |
1230 | 0 | YY_RULE_SETUP |
1231 | 0 | #line 54 "src/lexer.l" |
1232 | 0 | { return DEF; } |
1233 | 0 | YY_BREAK |
1234 | 0 | case 11: |
1235 | 0 | YY_RULE_SETUP |
1236 | 0 | #line 55 "src/lexer.l" |
1237 | 0 | { return IF; } |
1238 | 0 | YY_BREAK |
1239 | 0 | case 12: |
1240 | 0 | YY_RULE_SETUP |
1241 | 0 | #line 56 "src/lexer.l" |
1242 | 0 | { return THEN; } |
1243 | 0 | YY_BREAK |
1244 | 0 | case 13: |
1245 | 0 | YY_RULE_SETUP |
1246 | 0 | #line 57 "src/lexer.l" |
1247 | 0 | { return ELSE; } |
1248 | 0 | YY_BREAK |
1249 | 0 | case 14: |
1250 | 0 | YY_RULE_SETUP |
1251 | 0 | #line 58 "src/lexer.l" |
1252 | 0 | { return ELSE_IF; } |
1253 | 0 | YY_BREAK |
1254 | 0 | case 15: |
1255 | 0 | YY_RULE_SETUP |
1256 | 0 | #line 59 "src/lexer.l" |
1257 | 0 | { return AND; } |
1258 | 0 | YY_BREAK |
1259 | 0 | case 16: |
1260 | 0 | YY_RULE_SETUP |
1261 | 0 | #line 60 "src/lexer.l" |
1262 | 0 | { return OR; } |
1263 | 0 | YY_BREAK |
1264 | 0 | case 17: |
1265 | 0 | YY_RULE_SETUP |
1266 | 0 | #line 61 "src/lexer.l" |
1267 | 0 | { return END; } |
1268 | 0 | YY_BREAK |
1269 | 0 | case 18: |
1270 | 0 | YY_RULE_SETUP |
1271 | 0 | #line 62 "src/lexer.l" |
1272 | 0 | { return REDUCE; } |
1273 | 0 | YY_BREAK |
1274 | 0 | case 19: |
1275 | 0 | YY_RULE_SETUP |
1276 | 0 | #line 63 "src/lexer.l" |
1277 | 0 | { return FOREACH; } |
1278 | 0 | YY_BREAK |
1279 | 0 | case 20: |
1280 | 0 | YY_RULE_SETUP |
1281 | 0 | #line 64 "src/lexer.l" |
1282 | 0 | { return DEFINEDOR; } |
1283 | 0 | YY_BREAK |
1284 | 0 | case 21: |
1285 | 0 | YY_RULE_SETUP |
1286 | 0 | #line 65 "src/lexer.l" |
1287 | 0 | { return TRY; } |
1288 | 0 | YY_BREAK |
1289 | 0 | case 22: |
1290 | 0 | YY_RULE_SETUP |
1291 | 0 | #line 66 "src/lexer.l" |
1292 | 0 | { return CATCH; } |
1293 | 0 | YY_BREAK |
1294 | 0 | case 23: |
1295 | 0 | YY_RULE_SETUP |
1296 | 0 | #line 67 "src/lexer.l" |
1297 | 0 | { return LABEL; } |
1298 | 0 | YY_BREAK |
1299 | 0 | case 24: |
1300 | 0 | YY_RULE_SETUP |
1301 | 0 | #line 68 "src/lexer.l" |
1302 | 0 | { return BREAK; } |
1303 | 0 | YY_BREAK |
1304 | 0 | case 25: |
1305 | 0 | YY_RULE_SETUP |
1306 | 0 | #line 69 "src/lexer.l" |
1307 | 0 | { return LOC; } |
1308 | 0 | YY_BREAK |
1309 | 0 | case 26: |
1310 | 0 | YY_RULE_SETUP |
1311 | 0 | #line 70 "src/lexer.l" |
1312 | 0 | { return SETPIPE; } |
1313 | 0 | YY_BREAK |
1314 | 0 | case 27: |
1315 | 0 | YY_RULE_SETUP |
1316 | 0 | #line 71 "src/lexer.l" |
1317 | 0 | { return SETPLUS; } |
1318 | 0 | YY_BREAK |
1319 | 0 | case 28: |
1320 | 0 | YY_RULE_SETUP |
1321 | 0 | #line 72 "src/lexer.l" |
1322 | 0 | { return SETMINUS; } |
1323 | 0 | YY_BREAK |
1324 | 0 | case 29: |
1325 | 0 | YY_RULE_SETUP |
1326 | 0 | #line 73 "src/lexer.l" |
1327 | 0 | { return SETMULT; } |
1328 | 0 | YY_BREAK |
1329 | 0 | case 30: |
1330 | 0 | YY_RULE_SETUP |
1331 | 0 | #line 74 "src/lexer.l" |
1332 | 0 | { return SETDIV; } |
1333 | 0 | YY_BREAK |
1334 | 0 | case 31: |
1335 | 0 | YY_RULE_SETUP |
1336 | 0 | #line 75 "src/lexer.l" |
1337 | 0 | { return SETMOD; } |
1338 | 0 | YY_BREAK |
1339 | 0 | case 32: |
1340 | 0 | YY_RULE_SETUP |
1341 | 0 | #line 76 "src/lexer.l" |
1342 | 0 | { return SETDEFINEDOR; } |
1343 | 0 | YY_BREAK |
1344 | 0 | case 33: |
1345 | 0 | YY_RULE_SETUP |
1346 | 0 | #line 77 "src/lexer.l" |
1347 | 0 | { return LESSEQ; } |
1348 | 0 | YY_BREAK |
1349 | 0 | case 34: |
1350 | 0 | YY_RULE_SETUP |
1351 | 0 | #line 78 "src/lexer.l" |
1352 | 0 | { return GREATEREQ; } |
1353 | 0 | YY_BREAK |
1354 | 0 | case 35: |
1355 | 0 | YY_RULE_SETUP |
1356 | 0 | #line 79 "src/lexer.l" |
1357 | 0 | { return REC; } |
1358 | 0 | YY_BREAK |
1359 | 0 | case 36: |
1360 | 0 | YY_RULE_SETUP |
1361 | 0 | #line 80 "src/lexer.l" |
1362 | 0 | { return ALTERNATION; } |
1363 | 0 | YY_BREAK |
1364 | 0 | case 37: |
1365 | 0 | YY_RULE_SETUP |
1366 | 0 | #line 81 "src/lexer.l" |
1367 | 0 | { return yytext[0];} |
1368 | 0 | YY_BREAK |
1369 | 0 | case 38: |
1370 | 0 | YY_RULE_SETUP |
1371 | 0 | #line 83 "src/lexer.l" |
1372 | 0 | { |
1373 | 0 | return enter(yytext[0], YY_START, yyscanner); |
1374 | 0 | } |
1375 | 0 | YY_BREAK |
1376 | 0 | case 39: |
1377 | 0 | YY_RULE_SETUP |
1378 | 0 | #line 87 "src/lexer.l" |
1379 | 0 | { |
1380 | 0 | return try_exit(yytext[0], YY_START, yyscanner); |
1381 | 0 | } |
1382 | 0 | YY_BREAK |
1383 | 0 | case 40: |
1384 | 0 | YY_RULE_SETUP |
1385 | 0 | #line 91 "src/lexer.l" |
1386 | 0 | { |
1387 | 0 | yylval->literal = jv_string_sized(yytext + 1, yyleng - 1); return FORMAT; |
1388 | 0 | } |
1389 | 0 | YY_BREAK |
1390 | 0 | case 41: |
1391 | 0 | YY_RULE_SETUP |
1392 | 0 | #line 95 "src/lexer.l" |
1393 | 0 | { |
1394 | 0 | yylval->literal = jv_parse_sized(yytext, yyleng); return LITERAL; |
1395 | 0 | } |
1396 | 0 | YY_BREAK |
1397 | 0 | case 42: |
1398 | 0 | YY_RULE_SETUP |
1399 | 0 | #line 99 "src/lexer.l" |
1400 | 0 | { |
1401 | 0 | yy_push_state(IN_QQSTRING, yyscanner); |
1402 | 0 | return QQSTRING_START; |
1403 | 0 | } |
1404 | 0 | YY_BREAK |
1405 | | |
1406 | 0 | case 43: |
1407 | 0 | YY_RULE_SETUP |
1408 | 0 | #line 105 "src/lexer.l" |
1409 | 0 | { |
1410 | 0 | return enter(QQSTRING_INTERP_START, YY_START, yyscanner); |
1411 | 0 | } |
1412 | 0 | YY_BREAK |
1413 | 0 | case 44: |
1414 | 0 | YY_RULE_SETUP |
1415 | 0 | #line 108 "src/lexer.l" |
1416 | 0 | { |
1417 | 0 | yy_pop_state(yyscanner); |
1418 | 0 | return QQSTRING_END; |
1419 | 0 | } |
1420 | 0 | YY_BREAK |
1421 | 0 | case 45: |
1422 | | /* rule 45 can match eol */ |
1423 | 0 | YY_RULE_SETUP |
1424 | 0 | #line 112 "src/lexer.l" |
1425 | 0 | { |
1426 | | /* pass escapes to the json parser */ |
1427 | 0 | jv escapes = jv_string_fmt("\"%.*s\"", (int)yyleng, yytext); |
1428 | 0 | yylval->literal = jv_parse_sized(jv_string_value(escapes), jv_string_length_bytes(jv_copy(escapes))); |
1429 | 0 | jv_free(escapes); |
1430 | 0 | return QQSTRING_TEXT; |
1431 | 0 | } |
1432 | 0 | YY_BREAK |
1433 | 0 | case 46: |
1434 | | /* rule 46 can match eol */ |
1435 | 0 | YY_RULE_SETUP |
1436 | 0 | #line 119 "src/lexer.l" |
1437 | 0 | { |
1438 | 0 | yylval->literal = jv_string_sized(yytext, yyleng); |
1439 | 0 | return QQSTRING_TEXT; |
1440 | 0 | } |
1441 | 0 | YY_BREAK |
1442 | 0 | case 47: |
1443 | 0 | YY_RULE_SETUP |
1444 | 0 | #line 123 "src/lexer.l" |
1445 | 0 | { |
1446 | 0 | return INVALID_CHARACTER; |
1447 | 0 | } |
1448 | 0 | YY_BREAK |
1449 | | |
1450 | 0 | case 48: |
1451 | 0 | YY_RULE_SETUP |
1452 | 0 | #line 129 "src/lexer.l" |
1453 | 0 | { yylval->literal = jv_string(yytext); return IDENT;} |
1454 | 0 | YY_BREAK |
1455 | 0 | case 49: |
1456 | 0 | YY_RULE_SETUP |
1457 | 0 | #line 130 "src/lexer.l" |
1458 | 0 | { yylval->literal = jv_string(yytext+1); return FIELD;} |
1459 | 0 | YY_BREAK |
1460 | 0 | case 50: |
1461 | 0 | YY_RULE_SETUP |
1462 | 0 | #line 131 "src/lexer.l" |
1463 | 0 | { yylval->literal = jv_string(yytext+1); return BINDING;} |
1464 | 0 | YY_BREAK |
1465 | 0 | case 51: |
1466 | | /* rule 51 can match eol */ |
1467 | 0 | YY_RULE_SETUP |
1468 | 0 | #line 133 "src/lexer.l" |
1469 | 0 | {} |
1470 | 0 | YY_BREAK |
1471 | 0 | case 52: |
1472 | 0 | YY_RULE_SETUP |
1473 | 0 | #line 135 "src/lexer.l" |
1474 | 0 | { return INVALID_CHARACTER; } |
1475 | 0 | YY_BREAK |
1476 | 0 | case 53: |
1477 | 0 | YY_RULE_SETUP |
1478 | 0 | #line 137 "src/lexer.l" |
1479 | 0 | YY_FATAL_ERROR( "flex scanner jammed" ); |
1480 | 0 | YY_BREAK |
1481 | 0 | #line 1482 "src/lexer.c" |
1482 | 0 | case YY_STATE_EOF(INITIAL): |
1483 | 0 | case YY_STATE_EOF(IN_PAREN): |
1484 | 0 | case YY_STATE_EOF(IN_BRACKET): |
1485 | 0 | case YY_STATE_EOF(IN_BRACE): |
1486 | 0 | case YY_STATE_EOF(IN_QQINTERP): |
1487 | 0 | case YY_STATE_EOF(IN_QQSTRING): |
1488 | 0 | yyterminate(); |
1489 | | |
1490 | 0 | case YY_END_OF_BUFFER: |
1491 | 0 | { |
1492 | | /* Amount of text matched not including the EOB char. */ |
1493 | 0 | int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; |
1494 | | |
1495 | | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
1496 | 0 | *yy_cp = yyg->yy_hold_char; |
1497 | 0 | YY_RESTORE_YY_MORE_OFFSET |
1498 | |
|
1499 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) |
1500 | 0 | { |
1501 | | /* We're scanning a new file or input source. It's |
1502 | | * possible that this happened because the user |
1503 | | * just pointed yyin at a new source and called |
1504 | | * yylex(). If so, then we have to assure |
1505 | | * consistency between YY_CURRENT_BUFFER and our |
1506 | | * globals. Here is the right place to do so, because |
1507 | | * this is the first action (other than possibly a |
1508 | | * back-up) that will match for the new input source. |
1509 | | */ |
1510 | 0 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
1511 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
1512 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
1513 | 0 | } |
1514 | | |
1515 | | /* Note that here we test for yy_c_buf_p "<=" to the position |
1516 | | * of the first EOB in the buffer, since yy_c_buf_p will |
1517 | | * already have been incremented past the NUL character |
1518 | | * (since all states make transitions on EOB to the |
1519 | | * end-of-buffer state). Contrast this with the test |
1520 | | * in input(). |
1521 | | */ |
1522 | 0 | if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
1523 | 0 | { /* This was really a NUL. */ |
1524 | 0 | yy_state_type yy_next_state; |
1525 | |
|
1526 | 0 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
1527 | |
|
1528 | 0 | yy_current_state = yy_get_previous_state( yyscanner ); |
1529 | | |
1530 | | /* Okay, we're now positioned to make the NUL |
1531 | | * transition. We couldn't have |
1532 | | * yy_get_previous_state() go ahead and do it |
1533 | | * for us because it doesn't know how to deal |
1534 | | * with the possibility of jamming (and we don't |
1535 | | * want to build jamming into it because then it |
1536 | | * will run more slowly). |
1537 | | */ |
1538 | |
|
1539 | 0 | yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); |
1540 | |
|
1541 | 0 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1542 | |
|
1543 | 0 | if ( yy_next_state ) |
1544 | 0 | { |
1545 | | /* Consume the NUL. */ |
1546 | 0 | yy_cp = ++yyg->yy_c_buf_p; |
1547 | 0 | yy_current_state = yy_next_state; |
1548 | 0 | goto yy_match; |
1549 | 0 | } |
1550 | | |
1551 | 0 | else |
1552 | 0 | { |
1553 | 0 | yy_cp = yyg->yy_c_buf_p; |
1554 | 0 | goto yy_find_action; |
1555 | 0 | } |
1556 | 0 | } |
1557 | | |
1558 | 0 | else switch ( yy_get_next_buffer( yyscanner ) ) |
1559 | 0 | { |
1560 | 0 | case EOB_ACT_END_OF_FILE: |
1561 | 0 | { |
1562 | 0 | yyg->yy_did_buffer_switch_on_eof = 0; |
1563 | |
|
1564 | 0 | if ( yywrap( yyscanner ) ) |
1565 | 0 | { |
1566 | | /* Note: because we've taken care in |
1567 | | * yy_get_next_buffer() to have set up |
1568 | | * yytext, we can now set up |
1569 | | * yy_c_buf_p so that if some total |
1570 | | * hoser (like flex itself) wants to |
1571 | | * call the scanner after we return the |
1572 | | * YY_NULL, it'll still work - another |
1573 | | * YY_NULL will get returned. |
1574 | | */ |
1575 | 0 | yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; |
1576 | |
|
1577 | 0 | yy_act = YY_STATE_EOF(YY_START); |
1578 | 0 | goto do_action; |
1579 | 0 | } |
1580 | | |
1581 | 0 | else |
1582 | 0 | { |
1583 | 0 | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
1584 | 0 | YY_NEW_FILE; |
1585 | 0 | } |
1586 | 0 | break; |
1587 | 0 | } |
1588 | | |
1589 | 0 | case EOB_ACT_CONTINUE_SCAN: |
1590 | 0 | yyg->yy_c_buf_p = |
1591 | 0 | yyg->yytext_ptr + yy_amount_of_matched_text; |
1592 | |
|
1593 | 0 | yy_current_state = yy_get_previous_state( yyscanner ); |
1594 | |
|
1595 | 0 | yy_cp = yyg->yy_c_buf_p; |
1596 | 0 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1597 | 0 | goto yy_match; |
1598 | | |
1599 | 0 | case EOB_ACT_LAST_MATCH: |
1600 | 0 | yyg->yy_c_buf_p = |
1601 | 0 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; |
1602 | |
|
1603 | 0 | yy_current_state = yy_get_previous_state( yyscanner ); |
1604 | |
|
1605 | 0 | yy_cp = yyg->yy_c_buf_p; |
1606 | 0 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1607 | 0 | goto yy_find_action; |
1608 | 0 | } |
1609 | 0 | break; |
1610 | 0 | } |
1611 | | |
1612 | 0 | default: |
1613 | 0 | YY_FATAL_ERROR( |
1614 | 0 | "fatal flex scanner internal error--no action found" ); |
1615 | 0 | } /* end of action switch */ |
1616 | 0 | } /* end of scanning one token */ |
1617 | 0 | } /* end of user's declarations */ |
1618 | 0 | } /* end of yylex */ |
1619 | | |
1620 | | /* yy_get_next_buffer - try to read in a new buffer |
1621 | | * |
1622 | | * Returns a code representing an action: |
1623 | | * EOB_ACT_LAST_MATCH - |
1624 | | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
1625 | | * EOB_ACT_END_OF_FILE - end of file |
1626 | | */ |
1627 | | static int yy_get_next_buffer (yyscan_t yyscanner) |
1628 | 0 | { |
1629 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1630 | 0 | char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
1631 | 0 | char *source = yyg->yytext_ptr; |
1632 | 0 | int number_to_move, i; |
1633 | 0 | int ret_val; |
1634 | |
|
1635 | 0 | if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) |
1636 | 0 | YY_FATAL_ERROR( |
1637 | 0 | "fatal flex scanner internal error--end of buffer missed" ); |
1638 | | |
1639 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
1640 | 0 | { /* Don't try to fill the buffer, so this is an EOF. */ |
1641 | 0 | if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) |
1642 | 0 | { |
1643 | | /* We matched a single character, the EOB, so |
1644 | | * treat this as a final EOF. |
1645 | | */ |
1646 | 0 | return EOB_ACT_END_OF_FILE; |
1647 | 0 | } |
1648 | | |
1649 | 0 | else |
1650 | 0 | { |
1651 | | /* We matched some text prior to the EOB, first |
1652 | | * process it. |
1653 | | */ |
1654 | 0 | return EOB_ACT_LAST_MATCH; |
1655 | 0 | } |
1656 | 0 | } |
1657 | | |
1658 | | /* Try to read more data. */ |
1659 | | |
1660 | | /* First move last chars to start of buffer. */ |
1661 | 0 | number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); |
1662 | |
|
1663 | 0 | for ( i = 0; i < number_to_move; ++i ) |
1664 | 0 | *(dest++) = *(source++); |
1665 | |
|
1666 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
1667 | | /* don't do the read, it's not guaranteed to return an EOF, |
1668 | | * just force an EOF |
1669 | | */ |
1670 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; |
1671 | | |
1672 | 0 | else |
1673 | 0 | { |
1674 | 0 | int num_to_read = |
1675 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
1676 | |
|
1677 | 0 | while ( num_to_read <= 0 ) |
1678 | 0 | { /* Not enough room in the buffer - grow it. */ |
1679 | | |
1680 | | /* just a shorter name for the current buffer */ |
1681 | 0 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
1682 | |
|
1683 | 0 | int yy_c_buf_p_offset = |
1684 | 0 | (int) (yyg->yy_c_buf_p - b->yy_ch_buf); |
1685 | |
|
1686 | 0 | if ( b->yy_is_our_buffer ) |
1687 | 0 | { |
1688 | 0 | int new_size = b->yy_buf_size * 2; |
1689 | |
|
1690 | 0 | if ( new_size <= 0 ) |
1691 | 0 | b->yy_buf_size += b->yy_buf_size / 8; |
1692 | 0 | else |
1693 | 0 | b->yy_buf_size *= 2; |
1694 | |
|
1695 | 0 | b->yy_ch_buf = (char *) |
1696 | | /* Include room in for 2 EOB chars. */ |
1697 | 0 | yyrealloc( (void *) b->yy_ch_buf, |
1698 | 0 | (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
1699 | 0 | } |
1700 | 0 | else |
1701 | | /* Can't grow it, we don't own it. */ |
1702 | 0 | b->yy_ch_buf = NULL; |
1703 | |
|
1704 | 0 | if ( ! b->yy_ch_buf ) |
1705 | 0 | YY_FATAL_ERROR( |
1706 | 0 | "fatal error - scanner input buffer overflow" ); |
1707 | | |
1708 | 0 | yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
1709 | |
|
1710 | 0 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - |
1711 | 0 | number_to_move - 1; |
1712 | |
|
1713 | 0 | } |
1714 | | |
1715 | 0 | if ( num_to_read > YY_READ_BUF_SIZE ) |
1716 | 0 | num_to_read = YY_READ_BUF_SIZE; |
1717 | | |
1718 | | /* Read in more data. */ |
1719 | 0 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
1720 | 0 | yyg->yy_n_chars, num_to_read ); |
1721 | |
|
1722 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
1723 | 0 | } |
1724 | | |
1725 | 0 | if ( yyg->yy_n_chars == 0 ) |
1726 | 0 | { |
1727 | 0 | if ( number_to_move == YY_MORE_ADJ ) |
1728 | 0 | { |
1729 | 0 | ret_val = EOB_ACT_END_OF_FILE; |
1730 | 0 | yyrestart( yyin , yyscanner); |
1731 | 0 | } |
1732 | | |
1733 | 0 | else |
1734 | 0 | { |
1735 | 0 | ret_val = EOB_ACT_LAST_MATCH; |
1736 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = |
1737 | 0 | YY_BUFFER_EOF_PENDING; |
1738 | 0 | } |
1739 | 0 | } |
1740 | | |
1741 | 0 | else |
1742 | 0 | ret_val = EOB_ACT_CONTINUE_SCAN; |
1743 | |
|
1744 | 0 | if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { |
1745 | | /* Extend the array by 50%, plus the number we really need. */ |
1746 | 0 | int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); |
1747 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( |
1748 | 0 | (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); |
1749 | 0 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
1750 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); |
1751 | | /* "- 2" to take care of EOB's */ |
1752 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); |
1753 | 0 | } |
1754 | | |
1755 | 0 | yyg->yy_n_chars += number_to_move; |
1756 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
1757 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
1758 | |
|
1759 | 0 | yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
1760 | |
|
1761 | 0 | return ret_val; |
1762 | 0 | } |
1763 | | |
1764 | | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
1765 | | |
1766 | | static yy_state_type yy_get_previous_state (yyscan_t yyscanner) |
1767 | 0 | { |
1768 | 0 | yy_state_type yy_current_state; |
1769 | 0 | char *yy_cp; |
1770 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1771 | |
|
1772 | 0 | yy_current_state = yyg->yy_start; |
1773 | |
|
1774 | 0 | for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) |
1775 | 0 | { |
1776 | 0 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
1777 | 0 | if ( yy_accept[yy_current_state] ) |
1778 | 0 | { |
1779 | 0 | yyg->yy_last_accepting_state = yy_current_state; |
1780 | 0 | yyg->yy_last_accepting_cpos = yy_cp; |
1781 | 0 | } |
1782 | 0 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1783 | 0 | { |
1784 | 0 | yy_current_state = (int) yy_def[yy_current_state]; |
1785 | 0 | if ( yy_current_state >= 171 ) |
1786 | 0 | yy_c = yy_meta[yy_c]; |
1787 | 0 | } |
1788 | 0 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1789 | 0 | } |
1790 | |
|
1791 | 0 | return yy_current_state; |
1792 | 0 | } |
1793 | | |
1794 | | /* yy_try_NUL_trans - try to make a transition on the NUL character |
1795 | | * |
1796 | | * synopsis |
1797 | | * next_state = yy_try_NUL_trans( current_state ); |
1798 | | */ |
1799 | | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) |
1800 | 0 | { |
1801 | 0 | int yy_is_jam; |
1802 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ |
1803 | 0 | char *yy_cp = yyg->yy_c_buf_p; |
1804 | |
|
1805 | 0 | YY_CHAR yy_c = 1; |
1806 | 0 | if ( yy_accept[yy_current_state] ) |
1807 | 0 | { |
1808 | 0 | yyg->yy_last_accepting_state = yy_current_state; |
1809 | 0 | yyg->yy_last_accepting_cpos = yy_cp; |
1810 | 0 | } |
1811 | 0 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1812 | 0 | { |
1813 | 0 | yy_current_state = (int) yy_def[yy_current_state]; |
1814 | 0 | if ( yy_current_state >= 171 ) |
1815 | 0 | yy_c = yy_meta[yy_c]; |
1816 | 0 | } |
1817 | 0 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1818 | 0 | yy_is_jam = (yy_current_state == 170); |
1819 | |
|
1820 | 0 | (void)yyg; |
1821 | 0 | return yy_is_jam ? 0 : yy_current_state; |
1822 | 0 | } |
1823 | | |
1824 | | #ifndef YY_NO_UNPUT |
1825 | | |
1826 | | #endif |
1827 | | |
1828 | | #ifndef YY_NO_INPUT |
1829 | | #ifdef __cplusplus |
1830 | | static int yyinput (yyscan_t yyscanner) |
1831 | | #else |
1832 | | static int input (yyscan_t yyscanner) |
1833 | | #endif |
1834 | | |
1835 | | { |
1836 | | int c; |
1837 | | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1838 | | |
1839 | | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
1840 | | |
1841 | | if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
1842 | | { |
1843 | | /* yy_c_buf_p now points to the character we want to return. |
1844 | | * If this occurs *before* the EOB characters, then it's a |
1845 | | * valid NUL; if not, then we've hit the end of the buffer. |
1846 | | */ |
1847 | | if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
1848 | | /* This was really a NUL. */ |
1849 | | *yyg->yy_c_buf_p = '\0'; |
1850 | | |
1851 | | else |
1852 | | { /* need more input */ |
1853 | | int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); |
1854 | | ++yyg->yy_c_buf_p; |
1855 | | |
1856 | | switch ( yy_get_next_buffer( yyscanner ) ) |
1857 | | { |
1858 | | case EOB_ACT_LAST_MATCH: |
1859 | | /* This happens because yy_g_n_b() |
1860 | | * sees that we've accumulated a |
1861 | | * token and flags that we need to |
1862 | | * try matching the token before |
1863 | | * proceeding. But for input(), |
1864 | | * there's no matching to consider. |
1865 | | * So convert the EOB_ACT_LAST_MATCH |
1866 | | * to EOB_ACT_END_OF_FILE. |
1867 | | */ |
1868 | | |
1869 | | /* Reset buffer status. */ |
1870 | | yyrestart( yyin , yyscanner); |
1871 | | |
1872 | | /*FALLTHROUGH*/ |
1873 | | |
1874 | | case EOB_ACT_END_OF_FILE: |
1875 | | { |
1876 | | if ( yywrap( yyscanner ) ) |
1877 | | return 0; |
1878 | | |
1879 | | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
1880 | | YY_NEW_FILE; |
1881 | | #ifdef __cplusplus |
1882 | | return yyinput(yyscanner); |
1883 | | #else |
1884 | | return input(yyscanner); |
1885 | | #endif |
1886 | | } |
1887 | | |
1888 | | case EOB_ACT_CONTINUE_SCAN: |
1889 | | yyg->yy_c_buf_p = yyg->yytext_ptr + offset; |
1890 | | break; |
1891 | | } |
1892 | | } |
1893 | | } |
1894 | | |
1895 | | c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ |
1896 | | *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ |
1897 | | yyg->yy_hold_char = *++yyg->yy_c_buf_p; |
1898 | | |
1899 | | return c; |
1900 | | } |
1901 | | #endif /* ifndef YY_NO_INPUT */ |
1902 | | |
1903 | | /** Immediately switch to a different input stream. |
1904 | | * @param input_file A readable stream. |
1905 | | * @param yyscanner The scanner object. |
1906 | | * @note This function does not reset the start condition to @c INITIAL . |
1907 | | */ |
1908 | | void yyrestart (FILE * input_file , yyscan_t yyscanner) |
1909 | 0 | { |
1910 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1911 | |
|
1912 | 0 | if ( ! YY_CURRENT_BUFFER ){ |
1913 | 0 | yyensure_buffer_stack (yyscanner); |
1914 | 0 | YY_CURRENT_BUFFER_LVALUE = |
1915 | 0 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); |
1916 | 0 | } |
1917 | |
|
1918 | 0 | yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); |
1919 | 0 | yy_load_buffer_state( yyscanner ); |
1920 | 0 | } |
1921 | | |
1922 | | /** Switch to a different input buffer. |
1923 | | * @param new_buffer The new input buffer. |
1924 | | * @param yyscanner The scanner object. |
1925 | | */ |
1926 | | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
1927 | 0 | { |
1928 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1929 | | |
1930 | | /* TODO. We should be able to replace this entire function body |
1931 | | * with |
1932 | | * yypop_buffer_state(); |
1933 | | * yypush_buffer_state(new_buffer); |
1934 | | */ |
1935 | 0 | yyensure_buffer_stack (yyscanner); |
1936 | 0 | if ( YY_CURRENT_BUFFER == new_buffer ) |
1937 | 0 | return; |
1938 | | |
1939 | 0 | if ( YY_CURRENT_BUFFER ) |
1940 | 0 | { |
1941 | | /* Flush out information for old buffer. */ |
1942 | 0 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
1943 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
1944 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
1945 | 0 | } |
1946 | |
|
1947 | 0 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
1948 | 0 | yy_load_buffer_state( yyscanner ); |
1949 | | |
1950 | | /* We don't actually know whether we did this switch during |
1951 | | * EOF (yywrap()) processing, but the only time this flag |
1952 | | * is looked at is after yywrap() is called, so it's safe |
1953 | | * to go ahead and always set it. |
1954 | | */ |
1955 | 0 | yyg->yy_did_buffer_switch_on_eof = 1; |
1956 | 0 | } |
1957 | | |
1958 | | static void yy_load_buffer_state (yyscan_t yyscanner) |
1959 | 0 | { |
1960 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1961 | 0 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
1962 | 0 | yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
1963 | 0 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
1964 | 0 | yyg->yy_hold_char = *yyg->yy_c_buf_p; |
1965 | 0 | } |
1966 | | |
1967 | | /** Allocate and initialize an input buffer state. |
1968 | | * @param file A readable stream. |
1969 | | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
1970 | | * @param yyscanner The scanner object. |
1971 | | * @return the allocated buffer state. |
1972 | | */ |
1973 | | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) |
1974 | 0 | { |
1975 | 0 | YY_BUFFER_STATE b; |
1976 | | |
1977 | 0 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
1978 | 0 | if ( ! b ) |
1979 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
1980 | | |
1981 | 0 | b->yy_buf_size = size; |
1982 | | |
1983 | | /* yy_ch_buf has to be 2 characters longer than the size given because |
1984 | | * we need to put in 2 end-of-buffer characters. |
1985 | | */ |
1986 | 0 | b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
1987 | 0 | if ( ! b->yy_ch_buf ) |
1988 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
1989 | | |
1990 | 0 | b->yy_is_our_buffer = 1; |
1991 | |
|
1992 | 0 | yy_init_buffer( b, file , yyscanner); |
1993 | |
|
1994 | 0 | return b; |
1995 | 0 | } |
1996 | | |
1997 | | /** Destroy the buffer. |
1998 | | * @param b a buffer created with yy_create_buffer() |
1999 | | * @param yyscanner The scanner object. |
2000 | | */ |
2001 | | void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
2002 | 0 | { |
2003 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2004 | |
|
2005 | 0 | if ( ! b ) |
2006 | 0 | return; |
2007 | | |
2008 | 0 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ |
2009 | 0 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; |
2010 | |
|
2011 | 0 | if ( b->yy_is_our_buffer ) |
2012 | 0 | yyfree( (void *) b->yy_ch_buf , yyscanner ); |
2013 | |
|
2014 | 0 | yyfree( (void *) b , yyscanner ); |
2015 | 0 | } |
2016 | | |
2017 | | /* Initializes or reinitializes a buffer. |
2018 | | * This function is sometimes called more than once on the same buffer, |
2019 | | * such as during a yyrestart() or at EOF. |
2020 | | */ |
2021 | | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) |
2022 | | |
2023 | 0 | { |
2024 | 0 | int oerrno = errno; |
2025 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2026 | |
|
2027 | 0 | yy_flush_buffer( b , yyscanner); |
2028 | |
|
2029 | 0 | b->yy_input_file = file; |
2030 | 0 | b->yy_fill_buffer = 1; |
2031 | | |
2032 | | /* If b is the current buffer, then yy_init_buffer was _probably_ |
2033 | | * called from yyrestart() or through yy_get_next_buffer. |
2034 | | * In that case, we don't want to reset the lineno or column. |
2035 | | */ |
2036 | 0 | if (b != YY_CURRENT_BUFFER){ |
2037 | 0 | b->yy_bs_lineno = 1; |
2038 | 0 | b->yy_bs_column = 0; |
2039 | 0 | } |
2040 | |
|
2041 | 0 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; |
2042 | | |
2043 | 0 | errno = oerrno; |
2044 | 0 | } |
2045 | | |
2046 | | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
2047 | | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
2048 | | * @param yyscanner The scanner object. |
2049 | | */ |
2050 | | void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
2051 | 0 | { |
2052 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2053 | 0 | if ( ! b ) |
2054 | 0 | return; |
2055 | | |
2056 | 0 | b->yy_n_chars = 0; |
2057 | | |
2058 | | /* We always need two end-of-buffer characters. The first causes |
2059 | | * a transition to the end-of-buffer state. The second causes |
2060 | | * a jam in that state. |
2061 | | */ |
2062 | 0 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
2063 | 0 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
2064 | |
|
2065 | 0 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
2066 | |
|
2067 | 0 | b->yy_at_bol = 1; |
2068 | 0 | b->yy_buffer_status = YY_BUFFER_NEW; |
2069 | |
|
2070 | 0 | if ( b == YY_CURRENT_BUFFER ) |
2071 | 0 | yy_load_buffer_state( yyscanner ); |
2072 | 0 | } |
2073 | | |
2074 | | /** Pushes the new state onto the stack. The new state becomes |
2075 | | * the current state. This function will allocate the stack |
2076 | | * if necessary. |
2077 | | * @param new_buffer The new state. |
2078 | | * @param yyscanner The scanner object. |
2079 | | */ |
2080 | | void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
2081 | 0 | { |
2082 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2083 | 0 | if (new_buffer == NULL) |
2084 | 0 | return; |
2085 | | |
2086 | 0 | yyensure_buffer_stack(yyscanner); |
2087 | | |
2088 | | /* This block is copied from yy_switch_to_buffer. */ |
2089 | 0 | if ( YY_CURRENT_BUFFER ) |
2090 | 0 | { |
2091 | | /* Flush out information for old buffer. */ |
2092 | 0 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
2093 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
2094 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
2095 | 0 | } |
2096 | | |
2097 | | /* Only push if top exists. Otherwise, replace top. */ |
2098 | 0 | if (YY_CURRENT_BUFFER) |
2099 | 0 | yyg->yy_buffer_stack_top++; |
2100 | 0 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
2101 | | |
2102 | | /* copied from yy_switch_to_buffer. */ |
2103 | 0 | yy_load_buffer_state( yyscanner ); |
2104 | 0 | yyg->yy_did_buffer_switch_on_eof = 1; |
2105 | 0 | } |
2106 | | |
2107 | | /** Removes and deletes the top of the stack, if present. |
2108 | | * The next element becomes the new top. |
2109 | | * @param yyscanner The scanner object. |
2110 | | */ |
2111 | | void yypop_buffer_state (yyscan_t yyscanner) |
2112 | 0 | { |
2113 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2114 | 0 | if (!YY_CURRENT_BUFFER) |
2115 | 0 | return; |
2116 | | |
2117 | 0 | yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); |
2118 | 0 | YY_CURRENT_BUFFER_LVALUE = NULL; |
2119 | 0 | if (yyg->yy_buffer_stack_top > 0) |
2120 | 0 | --yyg->yy_buffer_stack_top; |
2121 | |
|
2122 | 0 | if (YY_CURRENT_BUFFER) { |
2123 | 0 | yy_load_buffer_state( yyscanner ); |
2124 | 0 | yyg->yy_did_buffer_switch_on_eof = 1; |
2125 | 0 | } |
2126 | 0 | } |
2127 | | |
2128 | | /* Allocates the stack if it does not exist. |
2129 | | * Guarantees space for at least one push. |
2130 | | */ |
2131 | | static void yyensure_buffer_stack (yyscan_t yyscanner) |
2132 | 0 | { |
2133 | 0 | yy_size_t num_to_alloc; |
2134 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2135 | |
|
2136 | 0 | if (!yyg->yy_buffer_stack) { |
2137 | | |
2138 | | /* First allocation is just for 2 elements, since we don't know if this |
2139 | | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
2140 | | * immediate realloc on the next call. |
2141 | | */ |
2142 | 0 | num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ |
2143 | 0 | yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc |
2144 | 0 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
2145 | 0 | , yyscanner); |
2146 | 0 | if ( ! yyg->yy_buffer_stack ) |
2147 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
2148 | | |
2149 | 0 | memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
2150 | |
|
2151 | 0 | yyg->yy_buffer_stack_max = num_to_alloc; |
2152 | 0 | yyg->yy_buffer_stack_top = 0; |
2153 | 0 | return; |
2154 | 0 | } |
2155 | | |
2156 | 0 | if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ |
2157 | | |
2158 | | /* Increase the buffer to prepare for a possible push. */ |
2159 | 0 | yy_size_t grow_size = 8 /* arbitrary grow size */; |
2160 | |
|
2161 | 0 | num_to_alloc = yyg->yy_buffer_stack_max + grow_size; |
2162 | 0 | yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc |
2163 | 0 | (yyg->yy_buffer_stack, |
2164 | 0 | num_to_alloc * sizeof(struct yy_buffer_state*) |
2165 | 0 | , yyscanner); |
2166 | 0 | if ( ! yyg->yy_buffer_stack ) |
2167 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
2168 | | |
2169 | | /* zero only the new slots.*/ |
2170 | 0 | memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); |
2171 | 0 | yyg->yy_buffer_stack_max = num_to_alloc; |
2172 | 0 | } |
2173 | 0 | } |
2174 | | |
2175 | | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
2176 | | * @param base the character buffer |
2177 | | * @param size the size in bytes of the character buffer |
2178 | | * @param yyscanner The scanner object. |
2179 | | * @return the newly allocated buffer state object. |
2180 | | */ |
2181 | | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) |
2182 | 0 | { |
2183 | 0 | YY_BUFFER_STATE b; |
2184 | | |
2185 | 0 | if ( size < 2 || |
2186 | 0 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
2187 | 0 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
2188 | | /* They forgot to leave room for the EOB's. */ |
2189 | 0 | return NULL; |
2190 | | |
2191 | 0 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
2192 | 0 | if ( ! b ) |
2193 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
2194 | | |
2195 | 0 | b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ |
2196 | 0 | b->yy_buf_pos = b->yy_ch_buf = base; |
2197 | 0 | b->yy_is_our_buffer = 0; |
2198 | 0 | b->yy_input_file = NULL; |
2199 | 0 | b->yy_n_chars = b->yy_buf_size; |
2200 | 0 | b->yy_is_interactive = 0; |
2201 | 0 | b->yy_at_bol = 1; |
2202 | 0 | b->yy_fill_buffer = 0; |
2203 | 0 | b->yy_buffer_status = YY_BUFFER_NEW; |
2204 | |
|
2205 | 0 | yy_switch_to_buffer( b , yyscanner ); |
2206 | |
|
2207 | 0 | return b; |
2208 | 0 | } |
2209 | | |
2210 | | /** Setup the input buffer state to scan a string. The next call to yylex() will |
2211 | | * scan from a @e copy of @a str. |
2212 | | * @param yystr a NUL-terminated string to scan |
2213 | | * @param yyscanner The scanner object. |
2214 | | * @return the newly allocated buffer state object. |
2215 | | * @note If you want to scan bytes that may contain NUL values, then use |
2216 | | * yy_scan_bytes() instead. |
2217 | | */ |
2218 | | YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) |
2219 | 0 | { |
2220 | | |
2221 | 0 | return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); |
2222 | 0 | } |
2223 | | |
2224 | | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
2225 | | * scan from a @e copy of @a bytes. |
2226 | | * @param yybytes the byte buffer to scan |
2227 | | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
2228 | | * @param yyscanner The scanner object. |
2229 | | * @return the newly allocated buffer state object. |
2230 | | */ |
2231 | | YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) |
2232 | 0 | { |
2233 | 0 | YY_BUFFER_STATE b; |
2234 | 0 | char *buf; |
2235 | 0 | yy_size_t n; |
2236 | 0 | int i; |
2237 | | |
2238 | | /* Get memory for full buffer, including space for trailing EOB's. */ |
2239 | 0 | n = (yy_size_t) (_yybytes_len + 2); |
2240 | 0 | buf = (char *) yyalloc( n , yyscanner ); |
2241 | 0 | if ( ! buf ) |
2242 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
2243 | | |
2244 | 0 | for ( i = 0; i < _yybytes_len; ++i ) |
2245 | 0 | buf[i] = yybytes[i]; |
2246 | |
|
2247 | 0 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
2248 | |
|
2249 | 0 | b = yy_scan_buffer( buf, n , yyscanner); |
2250 | 0 | if ( ! b ) |
2251 | 0 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
2252 | | |
2253 | | /* It's okay to grow etc. this buffer, and we should throw it |
2254 | | * away when we're done. |
2255 | | */ |
2256 | 0 | b->yy_is_our_buffer = 1; |
2257 | |
|
2258 | 0 | return b; |
2259 | 0 | } |
2260 | | |
2261 | | static void yy_push_state (int _new_state , yyscan_t yyscanner) |
2262 | 0 | { |
2263 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2264 | 0 | if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) |
2265 | 0 | { |
2266 | 0 | yy_size_t new_size; |
2267 | |
|
2268 | 0 | yyg->yy_start_stack_depth += YY_START_STACK_INCR; |
2269 | 0 | new_size = (yy_size_t) yyg->yy_start_stack_depth * sizeof( int ); |
2270 | |
|
2271 | 0 | if ( ! yyg->yy_start_stack ) |
2272 | 0 | yyg->yy_start_stack = (int *) yyalloc( new_size , yyscanner ); |
2273 | | |
2274 | 0 | else |
2275 | 0 | yyg->yy_start_stack = (int *) yyrealloc( |
2276 | 0 | (void *) yyg->yy_start_stack, new_size , yyscanner ); |
2277 | |
|
2278 | 0 | if ( ! yyg->yy_start_stack ) |
2279 | 0 | YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); |
2280 | 0 | } |
2281 | | |
2282 | 0 | yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; |
2283 | |
|
2284 | 0 | BEGIN(_new_state); |
2285 | 0 | } |
2286 | | |
2287 | | static void yy_pop_state (yyscan_t yyscanner) |
2288 | 0 | { |
2289 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2290 | 0 | if ( --yyg->yy_start_stack_ptr < 0 ) |
2291 | 0 | YY_FATAL_ERROR( "start-condition stack underflow" ); |
2292 | | |
2293 | 0 | BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); |
2294 | 0 | } |
2295 | | |
2296 | | static int yy_top_state (yyscan_t yyscanner) |
2297 | 0 | { |
2298 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2299 | 0 | return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; |
2300 | 0 | } |
2301 | | |
2302 | | #ifndef YY_EXIT_FAILURE |
2303 | 0 | #define YY_EXIT_FAILURE 2 |
2304 | | #endif |
2305 | | |
2306 | | static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) |
2307 | 0 | { |
2308 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2309 | 0 | (void)yyg; |
2310 | 0 | fprintf( stderr, "%s\n", msg ); |
2311 | 0 | exit( YY_EXIT_FAILURE ); |
2312 | 0 | } |
2313 | | |
2314 | | /* Redefine yyless() so it works in section 3 code. */ |
2315 | | |
2316 | | #undef yyless |
2317 | | #define yyless(n) \ |
2318 | | do \ |
2319 | | { \ |
2320 | | /* Undo effects of setting up yytext. */ \ |
2321 | | int yyless_macro_arg = (n); \ |
2322 | | YY_LESS_LINENO(yyless_macro_arg);\ |
2323 | | yytext[yyleng] = yyg->yy_hold_char; \ |
2324 | | yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ |
2325 | | yyg->yy_hold_char = *yyg->yy_c_buf_p; \ |
2326 | | *yyg->yy_c_buf_p = '\0'; \ |
2327 | | yyleng = yyless_macro_arg; \ |
2328 | | } \ |
2329 | | while ( 0 ) |
2330 | | |
2331 | | /* Accessor methods (get/set functions) to struct members. */ |
2332 | | |
2333 | | /** Get the user-defined data for this scanner. |
2334 | | * @param yyscanner The scanner object. |
2335 | | */ |
2336 | | YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) |
2337 | 0 | { |
2338 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2339 | 0 | return yyextra; |
2340 | 0 | } |
2341 | | |
2342 | | /** Get the current line number. |
2343 | | * @param yyscanner The scanner object. |
2344 | | */ |
2345 | | int yyget_lineno (yyscan_t yyscanner) |
2346 | 0 | { |
2347 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2348 | |
|
2349 | 0 | if (! YY_CURRENT_BUFFER) |
2350 | 0 | return 0; |
2351 | | |
2352 | 0 | return yylineno; |
2353 | 0 | } |
2354 | | |
2355 | | /** Get the current column number. |
2356 | | * @param yyscanner The scanner object. |
2357 | | */ |
2358 | | int yyget_column (yyscan_t yyscanner) |
2359 | 0 | { |
2360 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2361 | |
|
2362 | 0 | if (! YY_CURRENT_BUFFER) |
2363 | 0 | return 0; |
2364 | | |
2365 | 0 | return yycolumn; |
2366 | 0 | } |
2367 | | |
2368 | | /** Get the input stream. |
2369 | | * @param yyscanner The scanner object. |
2370 | | */ |
2371 | | FILE *yyget_in (yyscan_t yyscanner) |
2372 | 0 | { |
2373 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2374 | 0 | return yyin; |
2375 | 0 | } |
2376 | | |
2377 | | /** Get the output stream. |
2378 | | * @param yyscanner The scanner object. |
2379 | | */ |
2380 | | FILE *yyget_out (yyscan_t yyscanner) |
2381 | 0 | { |
2382 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2383 | 0 | return yyout; |
2384 | 0 | } |
2385 | | |
2386 | | /** Get the length of the current token. |
2387 | | * @param yyscanner The scanner object. |
2388 | | */ |
2389 | | int yyget_leng (yyscan_t yyscanner) |
2390 | 0 | { |
2391 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2392 | 0 | return yyleng; |
2393 | 0 | } |
2394 | | |
2395 | | /** Get the current token. |
2396 | | * @param yyscanner The scanner object. |
2397 | | */ |
2398 | | |
2399 | | char *yyget_text (yyscan_t yyscanner) |
2400 | 0 | { |
2401 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2402 | 0 | return yytext; |
2403 | 0 | } |
2404 | | |
2405 | | /** Set the user-defined data. This data is never touched by the scanner. |
2406 | | * @param user_defined The data to be associated with this scanner. |
2407 | | * @param yyscanner The scanner object. |
2408 | | */ |
2409 | | void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) |
2410 | 0 | { |
2411 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2412 | 0 | yyextra = user_defined ; |
2413 | 0 | } |
2414 | | |
2415 | | /** Set the current line number. |
2416 | | * @param _line_number line number |
2417 | | * @param yyscanner The scanner object. |
2418 | | */ |
2419 | | void yyset_lineno (int _line_number , yyscan_t yyscanner) |
2420 | 0 | { |
2421 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2422 | | |
2423 | | /* lineno is only valid if an input buffer exists. */ |
2424 | 0 | if (! YY_CURRENT_BUFFER ) |
2425 | 0 | YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); |
2426 | | |
2427 | 0 | yylineno = _line_number; |
2428 | 0 | } |
2429 | | |
2430 | | /** Set the current column. |
2431 | | * @param _column_no column number |
2432 | | * @param yyscanner The scanner object. |
2433 | | */ |
2434 | | void yyset_column (int _column_no , yyscan_t yyscanner) |
2435 | 0 | { |
2436 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2437 | | |
2438 | | /* column is only valid if an input buffer exists. */ |
2439 | 0 | if (! YY_CURRENT_BUFFER ) |
2440 | 0 | YY_FATAL_ERROR( "yyset_column called with no buffer" ); |
2441 | | |
2442 | 0 | yycolumn = _column_no; |
2443 | 0 | } |
2444 | | |
2445 | | /** Set the input stream. This does not discard the current |
2446 | | * input buffer. |
2447 | | * @param _in_str A readable stream. |
2448 | | * @param yyscanner The scanner object. |
2449 | | * @see yy_switch_to_buffer |
2450 | | */ |
2451 | | void yyset_in (FILE * _in_str , yyscan_t yyscanner) |
2452 | 0 | { |
2453 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2454 | 0 | yyin = _in_str ; |
2455 | 0 | } |
2456 | | |
2457 | | void yyset_out (FILE * _out_str , yyscan_t yyscanner) |
2458 | 0 | { |
2459 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2460 | 0 | yyout = _out_str ; |
2461 | 0 | } |
2462 | | |
2463 | | int yyget_debug (yyscan_t yyscanner) |
2464 | 0 | { |
2465 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2466 | 0 | return yy_flex_debug; |
2467 | 0 | } |
2468 | | |
2469 | | void yyset_debug (int _bdebug , yyscan_t yyscanner) |
2470 | 0 | { |
2471 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2472 | 0 | yy_flex_debug = _bdebug ; |
2473 | 0 | } |
2474 | | |
2475 | | /* Accessor methods for yylval and yylloc */ |
2476 | | |
2477 | | YYSTYPE * yyget_lval (yyscan_t yyscanner) |
2478 | 0 | { |
2479 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2480 | 0 | return yylval; |
2481 | 0 | } |
2482 | | |
2483 | | void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) |
2484 | 0 | { |
2485 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2486 | 0 | yylval = yylval_param; |
2487 | 0 | } |
2488 | | |
2489 | | YYLTYPE *yyget_lloc (yyscan_t yyscanner) |
2490 | 0 | { |
2491 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2492 | 0 | return yylloc; |
2493 | 0 | } |
2494 | | |
2495 | | void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) |
2496 | 0 | { |
2497 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2498 | 0 | yylloc = yylloc_param; |
2499 | 0 | } |
2500 | | |
2501 | | /* User-visible API */ |
2502 | | |
2503 | | /* yylex_init is special because it creates the scanner itself, so it is |
2504 | | * the ONLY reentrant function that doesn't take the scanner as the last argument. |
2505 | | * That's why we explicitly handle the declaration, instead of using our macros. |
2506 | | */ |
2507 | | int yylex_init(yyscan_t* ptr_yy_globals) |
2508 | 0 | { |
2509 | 0 | if (ptr_yy_globals == NULL){ |
2510 | 0 | errno = EINVAL; |
2511 | 0 | return 1; |
2512 | 0 | } |
2513 | | |
2514 | 0 | *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); |
2515 | |
|
2516 | 0 | if (*ptr_yy_globals == NULL){ |
2517 | 0 | errno = ENOMEM; |
2518 | 0 | return 1; |
2519 | 0 | } |
2520 | | |
2521 | | /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ |
2522 | 0 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
2523 | |
|
2524 | 0 | return yy_init_globals ( *ptr_yy_globals ); |
2525 | 0 | } |
2526 | | |
2527 | | /* yylex_init_extra has the same functionality as yylex_init, but follows the |
2528 | | * convention of taking the scanner as the last argument. Note however, that |
2529 | | * this is a *pointer* to a scanner, as it will be allocated by this call (and |
2530 | | * is the reason, too, why this function also must handle its own declaration). |
2531 | | * The user defined value in the first argument will be available to yyalloc in |
2532 | | * the yyextra field. |
2533 | | */ |
2534 | | int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) |
2535 | 0 | { |
2536 | 0 | struct yyguts_t dummy_yyguts; |
2537 | |
|
2538 | 0 | yyset_extra (yy_user_defined, &dummy_yyguts); |
2539 | |
|
2540 | 0 | if (ptr_yy_globals == NULL){ |
2541 | 0 | errno = EINVAL; |
2542 | 0 | return 1; |
2543 | 0 | } |
2544 | | |
2545 | 0 | *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); |
2546 | |
|
2547 | 0 | if (*ptr_yy_globals == NULL){ |
2548 | 0 | errno = ENOMEM; |
2549 | 0 | return 1; |
2550 | 0 | } |
2551 | | |
2552 | | /* By setting to 0xAA, we expose bugs in |
2553 | | yy_init_globals. Leave at 0x00 for releases. */ |
2554 | 0 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
2555 | |
|
2556 | 0 | yyset_extra (yy_user_defined, *ptr_yy_globals); |
2557 | |
|
2558 | 0 | return yy_init_globals ( *ptr_yy_globals ); |
2559 | 0 | } |
2560 | | |
2561 | | static int yy_init_globals (yyscan_t yyscanner) |
2562 | 0 | { |
2563 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2564 | | /* Initialization is the same as for the non-reentrant scanner. |
2565 | | * This function is called from yylex_destroy(), so don't allocate here. |
2566 | | */ |
2567 | |
|
2568 | 0 | yyg->yy_buffer_stack = NULL; |
2569 | 0 | yyg->yy_buffer_stack_top = 0; |
2570 | 0 | yyg->yy_buffer_stack_max = 0; |
2571 | 0 | yyg->yy_c_buf_p = NULL; |
2572 | 0 | yyg->yy_init = 0; |
2573 | 0 | yyg->yy_start = 0; |
2574 | |
|
2575 | 0 | yyg->yy_start_stack_ptr = 0; |
2576 | 0 | yyg->yy_start_stack_depth = 0; |
2577 | 0 | yyg->yy_start_stack = NULL; |
2578 | | |
2579 | | /* Defined in main.c */ |
2580 | | #ifdef YY_STDINIT |
2581 | | yyin = stdin; |
2582 | | yyout = stdout; |
2583 | | #else |
2584 | 0 | yyin = NULL; |
2585 | 0 | yyout = NULL; |
2586 | 0 | #endif |
2587 | | |
2588 | | /* For future reference: Set errno on error, since we are called by |
2589 | | * yylex_init() |
2590 | | */ |
2591 | 0 | return 0; |
2592 | 0 | } |
2593 | | |
2594 | | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
2595 | | int yylex_destroy (yyscan_t yyscanner) |
2596 | 0 | { |
2597 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2598 | | |
2599 | | /* Pop the buffer stack, destroying each element. */ |
2600 | 0 | while(YY_CURRENT_BUFFER){ |
2601 | 0 | yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); |
2602 | 0 | YY_CURRENT_BUFFER_LVALUE = NULL; |
2603 | 0 | yypop_buffer_state(yyscanner); |
2604 | 0 | } |
2605 | | |
2606 | | /* Destroy the stack itself. */ |
2607 | 0 | yyfree(yyg->yy_buffer_stack , yyscanner); |
2608 | 0 | yyg->yy_buffer_stack = NULL; |
2609 | | |
2610 | | /* Destroy the start condition stack. */ |
2611 | 0 | yyfree( yyg->yy_start_stack , yyscanner ); |
2612 | 0 | yyg->yy_start_stack = NULL; |
2613 | | |
2614 | | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
2615 | | * yylex() is called, initialization will occur. */ |
2616 | 0 | yy_init_globals( yyscanner); |
2617 | | |
2618 | | /* Destroy the main struct (reentrant only). */ |
2619 | 0 | yyfree ( yyscanner , yyscanner ); |
2620 | 0 | yyscanner = NULL; |
2621 | 0 | return 0; |
2622 | 0 | } |
2623 | | |
2624 | | /* |
2625 | | * Internal utility routines. |
2626 | | */ |
2627 | | |
2628 | | #ifndef yytext_ptr |
2629 | | static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) |
2630 | | { |
2631 | | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2632 | | (void)yyg; |
2633 | | |
2634 | | int i; |
2635 | | for ( i = 0; i < n; ++i ) |
2636 | | s1[i] = s2[i]; |
2637 | | } |
2638 | | #endif |
2639 | | |
2640 | | #ifdef YY_NEED_STRLEN |
2641 | | static int yy_flex_strlen (const char * s , yyscan_t yyscanner) |
2642 | | { |
2643 | | int n; |
2644 | | for ( n = 0; s[n]; ++n ) |
2645 | | ; |
2646 | | |
2647 | | return n; |
2648 | | } |
2649 | | #endif |
2650 | | |
2651 | | #define YYTABLES_NAME "yytables" |
2652 | | |
2653 | | #line 137 "src/lexer.l" |
2654 | | |
2655 | | /* perhaps these should be calls... */ |
2656 | | /* |
2657 | | "true" { return TRUE; } |
2658 | | "false" { return FALSE; } |
2659 | | "null" { return NULL; } |
2660 | | */ |
2661 | 0 | static int try_exit(int c, int state, yyscan_t yyscanner) { |
2662 | 0 | char match = 0; |
2663 | 0 | int ret; |
2664 | 0 | switch (state) { |
2665 | 0 | case IN_PAREN: match = ret = ')'; break; |
2666 | 0 | case IN_BRACKET: match = ret = ']'; break; |
2667 | 0 | case IN_BRACE: match = ret = '}'; break; |
2668 | | |
2669 | 0 | case IN_QQINTERP: |
2670 | 0 | match = ')'; |
2671 | 0 | ret = QQSTRING_INTERP_END; |
2672 | 0 | break; |
2673 | | |
2674 | 0 | default: |
2675 | | // may not be the best error to give |
2676 | 0 | return INVALID_CHARACTER; |
2677 | 0 | } |
2678 | 0 | assert(match); |
2679 | 0 | if (match == c) { |
2680 | 0 | yy_pop_state(yyscanner); |
2681 | 0 | return ret; |
2682 | 0 | } else { |
2683 | | // FIXME: should we pop? Give a better error at least |
2684 | 0 | return INVALID_CHARACTER; |
2685 | 0 | } |
2686 | 0 | } |
2687 | | |
2688 | 0 | static int enter(int c, int currstate, yyscan_t yyscanner) { |
2689 | 0 | int state = 0; |
2690 | 0 | switch (c) { |
2691 | 0 | case '(': state = IN_PAREN; break; |
2692 | 0 | case '[': state = IN_BRACKET; break; |
2693 | 0 | case '{': state = IN_BRACE; break; |
2694 | 0 | case QQSTRING_INTERP_START: state = IN_QQINTERP; break; |
2695 | 0 | } |
2696 | 0 | assert(state); |
2697 | 0 | yy_push_state(state, yyscanner); |
2698 | 0 | return c; |
2699 | 0 | } |
2700 | | |
2701 | 0 | void* yyalloc(size_t sz, void* extra) { |
2702 | 0 | return jv_mem_alloc(sz); |
2703 | 0 | } |
2704 | 0 | void* yyrealloc(void* p, size_t sz, void* extra) { |
2705 | 0 | return jv_mem_realloc(p, sz); |
2706 | 0 | } |
2707 | 0 | void yyfree(void* p, void* extra) { |
2708 | 0 | jv_mem_free(p); |
2709 | 0 | } |
2710 | | |