1 | #line 2 "specscanner.c" |
2 | |
3 | #line 4 "specscanner.c" |
4 | |
5 | #define YY_INT_ALIGNED short int |
6 | |
7 | /* A lexical scanner generated by flex */ |
8 | |
9 | #define yy_create_buffer spec_yy_create_buffer |
10 | #define yy_delete_buffer spec_yy_delete_buffer |
11 | #define yy_flex_debug spec_yy_flex_debug |
12 | #define yy_init_buffer spec_yy_init_buffer |
13 | #define yy_flush_buffer spec_yy_flush_buffer |
14 | #define yy_load_buffer_state spec_yy_load_buffer_state |
15 | #define yy_switch_to_buffer spec_yy_switch_to_buffer |
16 | #define yyin spec_yyin |
17 | #define yyleng spec_yyleng |
18 | #define yylex spec_yylex |
19 | #define yylineno spec_yylineno |
20 | #define yyout spec_yyout |
21 | #define yyrestart spec_yyrestart |
22 | #define yytext spec_yytext |
23 | #define yywrap spec_yywrap |
24 | #define yyalloc spec_yyalloc |
25 | #define yyrealloc spec_yyrealloc |
26 | #define yyfree spec_yyfree |
27 | |
28 | #define FLEX_SCANNER |
29 | #define YY_FLEX_MAJOR_VERSION 2 |
30 | #define YY_FLEX_MINOR_VERSION 6 |
31 | #define YY_FLEX_SUBMINOR_VERSION 1 |
32 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
33 | #define FLEX_BETA |
34 | #endif |
35 | |
36 | /* First, we deal with platform-specific or compiler-specific issues. */ |
37 | |
38 | /* begin standard C headers. */ |
39 | #include <stdio.h> |
40 | #include <string.h> |
41 | #include <errno.h> |
42 | #include <stdlib.h> |
43 | |
44 | /* end standard C headers. */ |
45 | |
46 | /* flex integer type definitions */ |
47 | |
48 | #ifndef FLEXINT_H |
49 | #define FLEXINT_H |
50 | |
51 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
52 | |
53 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
54 | |
55 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
56 | * if you want the limit (max/min) macros for int types. |
57 | */ |
58 | #ifndef __STDC_LIMIT_MACROS |
59 | #define __STDC_LIMIT_MACROS 1 |
60 | #endif |
61 | |
62 | #include <inttypes.h> |
63 | typedef int8_t flex_int8_t; |
64 | typedef uint8_t flex_uint8_t; |
65 | typedef int16_t flex_int16_t; |
66 | typedef uint16_t flex_uint16_t; |
67 | typedef int32_t flex_int32_t; |
68 | typedef uint32_t flex_uint32_t; |
69 | #else |
70 | typedef signed char flex_int8_t; |
71 | typedef short int flex_int16_t; |
72 | typedef int flex_int32_t; |
73 | typedef unsigned char flex_uint8_t; |
74 | typedef unsigned short int flex_uint16_t; |
75 | typedef unsigned int flex_uint32_t; |
76 | |
77 | /* Limits of integral types. */ |
78 | #ifndef INT8_MIN |
79 | #define INT8_MIN (-128) |
80 | #endif |
81 | #ifndef INT16_MIN |
82 | #define INT16_MIN (-32767-1) |
83 | #endif |
84 | #ifndef INT32_MIN |
85 | #define INT32_MIN (-2147483647-1) |
86 | #endif |
87 | #ifndef INT8_MAX |
88 | #define INT8_MAX (127) |
89 | #endif |
90 | #ifndef INT16_MAX |
91 | #define INT16_MAX (32767) |
92 | #endif |
93 | #ifndef INT32_MAX |
94 | #define INT32_MAX (2147483647) |
95 | #endif |
96 | #ifndef UINT8_MAX |
97 | #define UINT8_MAX (255U) |
98 | #endif |
99 | #ifndef UINT16_MAX |
100 | #define UINT16_MAX (65535U) |
101 | #endif |
102 | #ifndef UINT32_MAX |
103 | #define UINT32_MAX (4294967295U) |
104 | #endif |
105 | |
106 | #endif /* ! C99 */ |
107 | |
108 | #endif /* ! FLEXINT_H */ |
109 | |
110 | /* TODO: this is always defined, so inline it */ |
111 | #define yyconst const |
112 | |
113 | #if defined(__GNUC__) && __GNUC__ >= 3 |
114 | #define yynoreturn __attribute__((__noreturn__)) |
115 | #else |
116 | #define yynoreturn |
117 | #endif |
118 | |
119 | /* Returned upon end-of-file. */ |
120 | #define YY_NULL 0 |
121 | |
122 | /* Promotes a possibly negative, possibly signed char to an unsigned |
123 | * integer for use as an array index. If the signed char is negative, |
124 | * we want to instead treat it as an 8-bit unsigned char, hence the |
125 | * double cast. |
126 | */ |
127 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) |
128 | |
129 | /* Enter a start condition. This macro really ought to take a parameter, |
130 | * but we do it the disgusting crufty way forced on us by the ()-less |
131 | * definition of BEGIN. |
132 | */ |
133 | #define BEGIN (yy_start) = 1 + 2 * |
134 | |
135 | /* Translate the current start state into a value that can be later handed |
136 | * to BEGIN to return to the state. The YYSTATE alias is for lex |
137 | * compatibility. |
138 | */ |
139 | #define YY_START (((yy_start) - 1) / 2) |
140 | #define YYSTATE YY_START |
141 | |
142 | /* Action number for EOF rule of a given start state. */ |
143 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
144 | |
145 | /* Special action meaning "start processing a new file". */ |
146 | #define YY_NEW_FILE spec_yyrestart(spec_yyin ) |
147 | |
148 | #define YY_END_OF_BUFFER_CHAR 0 |
149 | |
150 | /* Size of default input buffer. */ |
151 | #ifndef YY_BUF_SIZE |
152 | #ifdef __ia64__ |
153 | /* On IA-64, the buffer size is 16k, not 8k. |
154 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
155 | * Ditto for the __ia64__ case accordingly. |
156 | */ |
157 | #define YY_BUF_SIZE 32768 |
158 | #else |
159 | #define YY_BUF_SIZE 16384 |
160 | #endif /* __ia64__ */ |
161 | #endif |
162 | |
163 | /* The state buf must be large enough to hold one state per character in the main buffer. |
164 | */ |
165 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
166 | |
167 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
168 | #define YY_TYPEDEF_YY_BUFFER_STATE |
169 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
170 | #endif |
171 | |
172 | #ifndef YY_TYPEDEF_YY_SIZE_T |
173 | #define YY_TYPEDEF_YY_SIZE_T |
174 | typedef size_t yy_size_t; |
175 | #endif |
176 | |
177 | extern int spec_yyleng; |
178 | |
179 | extern FILE *spec_yyin, *spec_yyout; |
180 | |
181 | #define EOB_ACT_CONTINUE_SCAN 0 |
182 | #define EOB_ACT_END_OF_FILE 1 |
183 | #define EOB_ACT_LAST_MATCH 2 |
184 | |
185 | #define YY_LESS_LINENO(n) |
186 | #define YY_LINENO_REWIND_TO(ptr) |
187 | |
188 | /* Return all but the first "n" matched characters back to the input stream. */ |
189 | #define yyless(n) \ |
190 | do \ |
191 | { \ |
192 | /* Undo effects of setting up spec_yytext. */ \ |
193 | int yyless_macro_arg = (n); \ |
194 | YY_LESS_LINENO(yyless_macro_arg);\ |
195 | *yy_cp = (yy_hold_char); \ |
196 | YY_RESTORE_YY_MORE_OFFSET \ |
197 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
198 | YY_DO_BEFORE_ACTION; /* set up spec_yytext again */ \ |
199 | } \ |
200 | while ( 0 ) |
201 | |
202 | #define unput(c) yyunput( c, (yytext_ptr) ) |
203 | |
204 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
205 | #define YY_STRUCT_YY_BUFFER_STATE |
206 | struct yy_buffer_state |
207 | { |
208 | FILE *yy_input_file; |
209 | |
210 | char *yy_ch_buf; /* input buffer */ |
211 | char *yy_buf_pos; /* current position in input buffer */ |
212 | |
213 | /* Size of input buffer in bytes, not including room for EOB |
214 | * characters. |
215 | */ |
216 | int yy_buf_size; |
217 | |
218 | /* Number of characters read into yy_ch_buf, not including EOB |
219 | * characters. |
220 | */ |
221 | int yy_n_chars; |
222 | |
223 | /* Whether we "own" the buffer - i.e., we know we created it, |
224 | * and can realloc() it to grow it, and should free() it to |
225 | * delete it. |
226 | */ |
227 | int yy_is_our_buffer; |
228 | |
229 | /* Whether this is an "interactive" input source; if so, and |
230 | * if we're using stdio for input, then we want to use getc() |
231 | * instead of fread(), to make sure we stop fetching input after |
232 | * each newline. |
233 | */ |
234 | int yy_is_interactive; |
235 | |
236 | /* Whether we're considered to be at the beginning of a line. |
237 | * If so, '^' rules will be active on the next match, otherwise |
238 | * not. |
239 | */ |
240 | int yy_at_bol; |
241 | |
242 | int yy_bs_lineno; /**< The line count. */ |
243 | int yy_bs_column; /**< The column count. */ |
244 | |
245 | /* Whether to try to fill the input buffer when we reach the |
246 | * end of it. |
247 | */ |
248 | int yy_fill_buffer; |
249 | |
250 | int yy_buffer_status; |
251 | |
252 | #define YY_BUFFER_NEW 0 |
253 | #define YY_BUFFER_NORMAL 1 |
254 | /* When an EOF's been seen but there's still some text to process |
255 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
256 | * shouldn't try reading from the input source any more. We might |
257 | * still have a bunch of tokens to match, though, because of |
258 | * possible backing-up. |
259 | * |
260 | * When we actually see the EOF, we change the status to "new" |
261 | * (via spec_yyrestart()), so that the user can continue scanning by |
262 | * just pointing spec_yyin at a new input file. |
263 | */ |
264 | #define YY_BUFFER_EOF_PENDING 2 |
265 | |
266 | }; |
267 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
268 | |
269 | /* Stack of input buffers. */ |
270 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ |
271 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ |
272 | static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ |
273 | |
274 | /* We provide macros for accessing buffer states in case in the |
275 | * future we want to put the buffer states in a more general |
276 | * "scanner state". |
277 | * |
278 | * Returns the top of the stack, or NULL. |
279 | */ |
280 | #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ |
281 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ |
282 | : NULL) |
283 | |
284 | /* Same as previous macro, but useful when we know that the buffer stack is not |
285 | * NULL or when we need an lvalue. For internal use only. |
286 | */ |
287 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] |
288 | |
289 | /* yy_hold_char holds the character lost when spec_yytext is formed. */ |
290 | static char yy_hold_char; |
291 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ |
292 | int spec_yyleng; |
293 | |
294 | /* Points to current character in buffer. */ |
295 | static char *yy_c_buf_p = NULL; |
296 | static int yy_init = 0; /* whether we need to initialize */ |
297 | static int yy_start = 0; /* start state number */ |
298 | |
299 | /* Flag which is used to allow spec_yywrap()'s to do buffer switches |
300 | * instead of setting up a fresh spec_yyin. A bit of a hack ... |
301 | */ |
302 | static int yy_did_buffer_switch_on_eof; |
303 | |
304 | void spec_yyrestart (FILE *input_file ); |
305 | void spec_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); |
306 | YY_BUFFER_STATE spec_yy_create_buffer (FILE *file,int size ); |
307 | void spec_yy_delete_buffer (YY_BUFFER_STATE b ); |
308 | void spec_yy_flush_buffer (YY_BUFFER_STATE b ); |
309 | void spec_yypush_buffer_state (YY_BUFFER_STATE new_buffer ); |
310 | void spec_yypop_buffer_state (void ); |
311 | |
312 | static void spec_yyensure_buffer_stack (void ); |
313 | static void spec_yy_load_buffer_state (void ); |
314 | static void spec_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); |
315 | |
316 | #define YY_FLUSH_BUFFER spec_yy_flush_buffer(YY_CURRENT_BUFFER ) |
317 | |
318 | YY_BUFFER_STATE spec_yy_scan_buffer (char *base,yy_size_t size ); |
319 | YY_BUFFER_STATE spec_yy_scan_string (yyconst char *yy_str ); |
320 | YY_BUFFER_STATE spec_yy_scan_bytes (yyconst char *bytes,int len ); |
321 | |
322 | void *spec_yyalloc (yy_size_t ); |
323 | void *spec_yyrealloc (void *,yy_size_t ); |
324 | void spec_yyfree (void * ); |
325 | |
326 | #define yy_new_buffer spec_yy_create_buffer |
327 | |
328 | #define yy_set_interactive(is_interactive) \ |
329 | { \ |
330 | if ( ! YY_CURRENT_BUFFER ){ \ |
331 | spec_yyensure_buffer_stack (); \ |
332 | YY_CURRENT_BUFFER_LVALUE = \ |
333 | spec_yy_create_buffer(spec_yyin,YY_BUF_SIZE ); \ |
334 | } \ |
335 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
336 | } |
337 | |
338 | #define yy_set_bol(at_bol) \ |
339 | { \ |
340 | if ( ! YY_CURRENT_BUFFER ){\ |
341 | spec_yyensure_buffer_stack (); \ |
342 | YY_CURRENT_BUFFER_LVALUE = \ |
343 | spec_yy_create_buffer(spec_yyin,YY_BUF_SIZE ); \ |
344 | } \ |
345 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
346 | } |
347 | |
348 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
349 | |
350 | /* Begin user sect3 */ |
351 | |
352 | #define spec_yywrap() (/*CONSTCOND*/1) |
353 | #define YY_SKIP_YYWRAP |
354 | |
355 | typedef unsigned char YY_CHAR; |
356 | |
357 | FILE *spec_yyin = NULL, *spec_yyout = NULL; |
358 | |
359 | typedef int yy_state_type; |
360 | |
361 | extern int spec_yylineno; |
362 | |
363 | int spec_yylineno = 1; |
364 | |
365 | extern char *spec_yytext; |
366 | #ifdef yytext_ptr |
367 | #undef yytext_ptr |
368 | #endif |
369 | #define yytext_ptr spec_yytext |
370 | |
371 | static yy_state_type yy_get_previous_state (void ); |
372 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); |
373 | static int yy_get_next_buffer (void ); |
374 | static void yynoreturn yy_fatal_error (yyconst char* msg ); |
375 | |
376 | /* Done after the current pattern has been matched and before the |
377 | * corresponding action - sets up spec_yytext. |
378 | */ |
379 | #define YY_DO_BEFORE_ACTION \ |
380 | (yytext_ptr) = yy_bp; \ |
381 | spec_yyleng = (int) (yy_cp - yy_bp); \ |
382 | (yy_hold_char) = *yy_cp; \ |
383 | *yy_cp = '\0'; \ |
384 | (yy_c_buf_p) = yy_cp; |
385 | |
386 | #define YY_NUM_RULES 18 |
387 | #define YY_END_OF_BUFFER 19 |
388 | /* This struct is not used in this scanner, |
389 | but its presence is necessary. */ |
390 | struct yy_trans_info |
391 | { |
392 | flex_int32_t yy_verify; |
393 | flex_int32_t yy_nxt; |
394 | }; |
395 | static yyconst flex_int16_t yy_accept[58] = |
396 | { 0, |
397 | 0, 0, 0, 0, 0, 0, 19, 17, 8, 6, |
398 | 9, 7, 17, 17, 17, 13, 15, 15, 16, 14, |
399 | 11, 12, 10, 7, 0, 0, 0, 0, 13, 0, |
400 | 14, 0, 0, 0, 0, 0, 0, 0, 0, 4, |
401 | 0, 0, 0, 3, 0, 0, 0, 0, 0, 2, |
402 | 0, 0, 5, 0, 0, 1, 0 |
403 | } ; |
404 | |
405 | static yyconst YY_CHAR yy_ec[256] = |
406 | { 0, |
407 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
408 | 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, |
409 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
410 | 1, 2, 1, 5, 6, 1, 1, 1, 1, 1, |
411 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
412 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
413 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
414 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
415 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
416 | 1, 1, 1, 1, 1, 1, 7, 1, 1, 8, |
417 | |
418 | 9, 1, 1, 1, 10, 1, 1, 1, 11, 12, |
419 | 13, 14, 1, 15, 16, 17, 18, 1, 19, 1, |
420 | 1, 1, 20, 1, 21, 1, 1, 1, 1, 1, |
421 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
422 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
423 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
424 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
425 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
426 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
427 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
428 | |
429 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
430 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
431 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
432 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
433 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
434 | 1, 1, 1, 1, 1 |
435 | } ; |
436 | |
437 | static yyconst YY_CHAR yy_meta[22] = |
438 | { 0, |
439 | 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, |
440 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
441 | 1 |
442 | } ; |
443 | |
444 | static yyconst flex_uint16_t yy_base[61] = |
445 | { 0, |
446 | 0, 0, 20, 40, 22, 23, 78, 79, 79, 79, |
447 | 79, 0, 68, 20, 67, 28, 79, 29, 79, 79, |
448 | 79, 79, 79, 0, 60, 18, 65, 66, 34, 43, |
449 | 79, 61, 55, 52, 55, 48, 44, 50, 45, 79, |
450 | 50, 40, 43, 79, 42, 47, 41, 33, 34, 79, |
451 | 37, 38, 79, 33, 28, 79, 79, 64, 66, 38 |
452 | } ; |
453 | |
454 | static yyconst flex_int16_t yy_def[61] = |
455 | { 0, |
456 | 57, 1, 58, 58, 59, 59, 57, 57, 57, 57, |
457 | 57, 60, 57, 57, 57, 57, 57, 57, 57, 57, |
458 | 57, 57, 57, 60, 57, 57, 57, 57, 57, 57, |
459 | 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, |
460 | 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, |
461 | 57, 57, 57, 57, 57, 57, 0, 57, 57, 57 |
462 | } ; |
463 | |
464 | static yyconst flex_uint16_t yy_nxt[101] = |
465 | { 0, |
466 | 8, 9, 10, 9, 11, 12, 8, 8, 8, 8, |
467 | 8, 8, 8, 13, 8, 14, 15, 8, 8, 16, |
468 | 8, 18, 19, 18, 22, 22, 23, 23, 26, 29, |
469 | 30, 29, 30, 33, 34, 29, 27, 29, 24, 56, |
470 | 20, 18, 19, 18, 30, 55, 30, 54, 53, 31, |
471 | 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, |
472 | 20, 42, 41, 31, 17, 17, 21, 21, 40, 39, |
473 | 38, 37, 36, 35, 32, 28, 25, 57, 7, 57, |
474 | 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, |
475 | 57, 57, 57, 57, 57, 57, 57, 57, 57, 57 |
476 | |
477 | } ; |
478 | |
479 | static yyconst flex_int16_t yy_chk[101] = |
480 | { 0, |
481 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
482 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
483 | 1, 3, 3, 3, 5, 6, 5, 6, 14, 16, |
484 | 18, 16, 18, 26, 26, 29, 14, 29, 60, 55, |
485 | 3, 4, 4, 4, 30, 54, 30, 52, 51, 18, |
486 | 49, 48, 47, 46, 45, 43, 42, 41, 39, 38, |
487 | 4, 37, 36, 30, 58, 58, 59, 59, 35, 34, |
488 | 33, 32, 28, 27, 25, 15, 13, 7, 57, 57, |
489 | 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, |
490 | 57, 57, 57, 57, 57, 57, 57, 57, 57, 57 |
491 | |
492 | } ; |
493 | |
494 | static yy_state_type yy_last_accepting_state; |
495 | static char *yy_last_accepting_cpos; |
496 | |
497 | extern int spec_yy_flex_debug; |
498 | int spec_yy_flex_debug = 0; |
499 | |
500 | /* The intent behind this definition is that it'll catch |
501 | * any uses of REJECT which flex missed. |
502 | */ |
503 | #define REJECT reject_used_but_not_detected |
504 | #define yymore() yymore_used_but_not_detected |
505 | #define YY_MORE_ADJ 0 |
506 | #define YY_RESTORE_YY_MORE_OFFSET |
507 | char *spec_yytext; |
508 | #line 1 "specscanner.l" |
509 | #line 2 "specscanner.l" |
510 | /*------------------------------------------------------------------------- |
511 | * |
512 | * specscanner.l |
513 | * a lexical scanner for an isolation test specification |
514 | * |
515 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
516 | * Portions Copyright (c) 1994, Regents of the University of California |
517 | * |
518 | *------------------------------------------------------------------------- |
519 | */ |
520 | |
521 | static int yyline = 1; /* line number for error reporting */ |
522 | |
523 | #define LITBUF_INIT 1024 /* initial size of litbuf */ |
524 | static char *litbuf = NULL; |
525 | static size_t litbufsize = 0; |
526 | static size_t litbufpos = 0; |
527 | |
528 | static void addlitchar(char c); |
529 | |
530 | /* LCOV_EXCL_START */ |
531 | |
532 | #define YY_NO_INPUT 1 |
533 | |
534 | |
535 | #line 536 "specscanner.c" |
536 | |
537 | #define INITIAL 0 |
538 | #define sql 1 |
539 | #define qstr 2 |
540 | |
541 | #ifndef YY_NO_UNISTD_H |
542 | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
543 | * down here because we want the user's section 1 to have been scanned first. |
544 | * The user has a chance to override it with an option. |
545 | */ |
546 | #include <unistd.h> |
547 | #endif |
548 | |
549 | #ifndef YY_EXTRA_TYPE |
550 | #define void * |
551 | #endif |
552 | |
553 | static int yy_init_globals (void ); |
554 | |
555 | /* Accessor methods to globals. |
556 | These are made visible to non-reentrant scanners for convenience. */ |
557 | |
558 | int spec_yylex_destroy (void ); |
559 | |
560 | int spec_yyget_debug (void ); |
561 | |
562 | void spec_yyset_debug (int debug_flag ); |
563 | |
564 | YY_EXTRA_TYPE (void ); |
565 | |
566 | void (YY_EXTRA_TYPE user_defined ); |
567 | |
568 | FILE *spec_yyget_in (void ); |
569 | |
570 | void spec_yyset_in (FILE * _in_str ); |
571 | |
572 | FILE *spec_yyget_out (void ); |
573 | |
574 | void spec_yyset_out (FILE * _out_str ); |
575 | |
576 | int spec_yyget_leng (void ); |
577 | |
578 | char *spec_yyget_text (void ); |
579 | |
580 | int spec_yyget_lineno (void ); |
581 | |
582 | void spec_yyset_lineno (int _line_number ); |
583 | |
584 | /* Macros after this point can all be overridden by user definitions in |
585 | * section 1. |
586 | */ |
587 | |
588 | #ifndef YY_SKIP_YYWRAP |
589 | #ifdef __cplusplus |
590 | extern "C" int spec_yywrap (void ); |
591 | #else |
592 | extern int spec_yywrap (void ); |
593 | #endif |
594 | #endif |
595 | |
596 | #ifndef YY_NO_UNPUT |
597 | |
598 | #endif |
599 | |
600 | #ifndef yytext_ptr |
601 | static void yy_flex_strncpy (char *,yyconst char *,int ); |
602 | #endif |
603 | |
604 | #ifdef YY_NEED_STRLEN |
605 | static int yy_flex_strlen (yyconst char * ); |
606 | #endif |
607 | |
608 | #ifndef YY_NO_INPUT |
609 | |
610 | #ifdef __cplusplus |
611 | static int yyinput (void ); |
612 | #else |
613 | static int input (void ); |
614 | #endif |
615 | |
616 | #endif |
617 | |
618 | /* Amount of stuff to slurp up with each read. */ |
619 | #ifndef YY_READ_BUF_SIZE |
620 | #ifdef __ia64__ |
621 | /* On IA-64, the buffer size is 16k, not 8k */ |
622 | #define YY_READ_BUF_SIZE 16384 |
623 | #else |
624 | #define YY_READ_BUF_SIZE 8192 |
625 | #endif /* __ia64__ */ |
626 | #endif |
627 | |
628 | /* Copy whatever the last rule matched to the standard output. */ |
629 | #ifndef ECHO |
630 | /* This used to be an fputs(), but since the string might contain NUL's, |
631 | * we now use fwrite(). |
632 | */ |
633 | #define ECHO do { if (fwrite( spec_yytext, (size_t) spec_yyleng, 1, spec_yyout )) {} } while (0) |
634 | #endif |
635 | |
636 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
637 | * is returned in "result". |
638 | */ |
639 | #ifndef YY_INPUT |
640 | #define YY_INPUT(buf,result,max_size) \ |
641 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
642 | { \ |
643 | int c = '*'; \ |
644 | size_t n; \ |
645 | for ( n = 0; n < max_size && \ |
646 | (c = getc( spec_yyin )) != EOF && c != '\n'; ++n ) \ |
647 | buf[n] = (char) c; \ |
648 | if ( c == '\n' ) \ |
649 | buf[n++] = (char) c; \ |
650 | if ( c == EOF && ferror( spec_yyin ) ) \ |
651 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
652 | result = n; \ |
653 | } \ |
654 | else \ |
655 | { \ |
656 | errno=0; \ |
657 | while ( (result = (int) fread(buf, 1, max_size, spec_yyin))==0 && ferror(spec_yyin)) \ |
658 | { \ |
659 | if( errno != EINTR) \ |
660 | { \ |
661 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
662 | break; \ |
663 | } \ |
664 | errno=0; \ |
665 | clearerr(spec_yyin); \ |
666 | } \ |
667 | }\ |
668 | \ |
669 | |
670 | #endif |
671 | |
672 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
673 | * we don't want an extra ';' after the "return" because that will cause |
674 | * some compilers to complain about unreachable statements. |
675 | */ |
676 | #ifndef yyterminate |
677 | #define yyterminate() return YY_NULL |
678 | #endif |
679 | |
680 | /* Number of entries by which start-condition stack grows. */ |
681 | #ifndef YY_START_STACK_INCR |
682 | #define YY_START_STACK_INCR 25 |
683 | #endif |
684 | |
685 | /* Report a fatal error. */ |
686 | #ifndef YY_FATAL_ERROR |
687 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) |
688 | #endif |
689 | |
690 | /* end tables serialization structures and prototypes */ |
691 | |
692 | /* Default declaration of generated scanner - a define so the user can |
693 | * easily add parameters. |
694 | */ |
695 | #ifndef YY_DECL |
696 | #define YY_DECL_IS_OURS 1 |
697 | |
698 | extern int spec_yylex (void); |
699 | |
700 | #define YY_DECL int spec_yylex (void) |
701 | #endif /* !YY_DECL */ |
702 | |
703 | /* Code executed at the beginning of each rule, after spec_yytext and spec_yyleng |
704 | * have been set up. |
705 | */ |
706 | #ifndef YY_USER_ACTION |
707 | #define YY_USER_ACTION |
708 | #endif |
709 | |
710 | /* Code executed at the end of each rule. */ |
711 | #ifndef YY_BREAK |
712 | #define YY_BREAK /*LINTED*/break; |
713 | #endif |
714 | |
715 | #define YY_RULE_SETUP \ |
716 | YY_USER_ACTION |
717 | |
718 | /** The main scanner function which does all the work. |
719 | */ |
720 | YY_DECL |
721 | { |
722 | yy_state_type yy_current_state; |
723 | char *yy_cp, *yy_bp; |
724 | int yy_act; |
725 | |
726 | if ( !(yy_init) ) |
727 | { |
728 | (yy_init) = 1; |
729 | |
730 | #ifdef YY_USER_INIT |
731 | YY_USER_INIT; |
732 | #endif |
733 | |
734 | if ( ! (yy_start) ) |
735 | (yy_start) = 1; /* first start state */ |
736 | |
737 | if ( ! spec_yyin ) |
738 | spec_yyin = stdin; |
739 | |
740 | if ( ! spec_yyout ) |
741 | spec_yyout = stdout; |
742 | |
743 | if ( ! YY_CURRENT_BUFFER ) { |
744 | spec_yyensure_buffer_stack (); |
745 | YY_CURRENT_BUFFER_LVALUE = |
746 | spec_yy_create_buffer(spec_yyin,YY_BUF_SIZE ); |
747 | } |
748 | |
749 | spec_yy_load_buffer_state( ); |
750 | } |
751 | |
752 | { |
753 | #line 44 "specscanner.l" |
754 | |
755 | |
756 | |
757 | litbuf = pg_malloc(LITBUF_INIT); |
758 | litbufsize = LITBUF_INIT; |
759 | |
760 | |
761 | #line 762 "specscanner.c" |
762 | |
763 | while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ |
764 | { |
765 | yy_cp = (yy_c_buf_p); |
766 | |
767 | /* Support of spec_yytext. */ |
768 | *yy_cp = (yy_hold_char); |
769 | |
770 | /* yy_bp points to the position in yy_ch_buf of the start of |
771 | * the current run. |
772 | */ |
773 | yy_bp = yy_cp; |
774 | |
775 | yy_current_state = (yy_start); |
776 | yy_match: |
777 | do |
778 | { |
779 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
780 | if ( yy_accept[yy_current_state] ) |
781 | { |
782 | (yy_last_accepting_state) = yy_current_state; |
783 | (yy_last_accepting_cpos) = yy_cp; |
784 | } |
785 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
786 | { |
787 | yy_current_state = (int) yy_def[yy_current_state]; |
788 | if ( yy_current_state >= 58 ) |
789 | yy_c = yy_meta[(unsigned int) yy_c]; |
790 | } |
791 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; |
792 | ++yy_cp; |
793 | } |
794 | while ( yy_current_state != 57 ); |
795 | yy_cp = (yy_last_accepting_cpos); |
796 | yy_current_state = (yy_last_accepting_state); |
797 | |
798 | yy_find_action: |
799 | yy_act = yy_accept[yy_current_state]; |
800 | |
801 | YY_DO_BEFORE_ACTION; |
802 | |
803 | do_action: /* This label is used only to access EOF actions. */ |
804 | |
805 | switch ( yy_act ) |
806 | { /* beginning of action switch */ |
807 | case 0: /* must back up */ |
808 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
809 | *yy_cp = (yy_hold_char); |
810 | yy_cp = (yy_last_accepting_cpos); |
811 | yy_current_state = (yy_last_accepting_state); |
812 | goto yy_find_action; |
813 | |
814 | case 1: |
815 | YY_RULE_SETUP |
816 | #line 51 "specscanner.l" |
817 | { return PERMUTATION; } |
818 | YY_BREAK |
819 | case 2: |
820 | YY_RULE_SETUP |
821 | #line 52 "specscanner.l" |
822 | { return SESSION; } |
823 | YY_BREAK |
824 | case 3: |
825 | YY_RULE_SETUP |
826 | #line 53 "specscanner.l" |
827 | { return SETUP; } |
828 | YY_BREAK |
829 | case 4: |
830 | YY_RULE_SETUP |
831 | #line 54 "specscanner.l" |
832 | { return STEP; } |
833 | YY_BREAK |
834 | case 5: |
835 | YY_RULE_SETUP |
836 | #line 55 "specscanner.l" |
837 | { return TEARDOWN; } |
838 | YY_BREAK |
839 | case 6: |
840 | /* rule 6 can match eol */ |
841 | YY_RULE_SETUP |
842 | #line 57 "specscanner.l" |
843 | { yyline++; } |
844 | YY_BREAK |
845 | case 7: |
846 | YY_RULE_SETUP |
847 | #line 58 "specscanner.l" |
848 | { /* ignore */ } |
849 | YY_BREAK |
850 | case 8: |
851 | YY_RULE_SETUP |
852 | #line 59 "specscanner.l" |
853 | { /* ignore */ } |
854 | YY_BREAK |
855 | /* Quoted strings: "foo" */ |
856 | case 9: |
857 | YY_RULE_SETUP |
858 | #line 62 "specscanner.l" |
859 | { |
860 | litbufpos = 0; |
861 | BEGIN(qstr); |
862 | } |
863 | YY_BREAK |
864 | case 10: |
865 | YY_RULE_SETUP |
866 | #line 66 "specscanner.l" |
867 | { |
868 | litbuf[litbufpos] = '\0'; |
869 | yylval.str = pg_strdup(litbuf); |
870 | BEGIN(INITIAL); |
871 | return(string_literal); |
872 | } |
873 | YY_BREAK |
874 | case 11: |
875 | YY_RULE_SETUP |
876 | #line 72 "specscanner.l" |
877 | { addlitchar(spec_yytext[0]); } |
878 | YY_BREAK |
879 | case 12: |
880 | /* rule 12 can match eol */ |
881 | YY_RULE_SETUP |
882 | #line 73 "specscanner.l" |
883 | { yyerror("unexpected newline in quoted string" ); } |
884 | YY_BREAK |
885 | case YY_STATE_EOF(qstr): |
886 | #line 74 "specscanner.l" |
887 | { yyerror("unterminated quoted string" ); } |
888 | YY_BREAK |
889 | /* SQL blocks: { UPDATE ... } */ |
890 | case 13: |
891 | YY_RULE_SETUP |
892 | #line 77 "specscanner.l" |
893 | { |
894 | |
895 | litbufpos = 0; |
896 | BEGIN(sql); |
897 | } |
898 | YY_BREAK |
899 | case 14: |
900 | YY_RULE_SETUP |
901 | #line 82 "specscanner.l" |
902 | { |
903 | litbuf[litbufpos] = '\0'; |
904 | yylval.str = pg_strdup(litbuf); |
905 | BEGIN(INITIAL); |
906 | return(sqlblock); |
907 | } |
908 | YY_BREAK |
909 | case 15: |
910 | YY_RULE_SETUP |
911 | #line 88 "specscanner.l" |
912 | { |
913 | addlitchar(spec_yytext[0]); |
914 | } |
915 | YY_BREAK |
916 | case 16: |
917 | /* rule 16 can match eol */ |
918 | YY_RULE_SETUP |
919 | #line 91 "specscanner.l" |
920 | { |
921 | yyline++; |
922 | addlitchar(spec_yytext[0]); |
923 | } |
924 | YY_BREAK |
925 | case YY_STATE_EOF(sql): |
926 | #line 95 "specscanner.l" |
927 | { |
928 | yyerror("unterminated sql block" ); |
929 | } |
930 | YY_BREAK |
931 | case 17: |
932 | YY_RULE_SETUP |
933 | #line 99 "specscanner.l" |
934 | { |
935 | fprintf(stderr, "syntax error at line %d: unexpected character \"%s\"\n" , yyline, spec_yytext); |
936 | exit(1); |
937 | } |
938 | YY_BREAK |
939 | case 18: |
940 | YY_RULE_SETUP |
941 | #line 103 "specscanner.l" |
942 | YY_FATAL_ERROR( "flex scanner jammed" ); |
943 | YY_BREAK |
944 | #line 945 "specscanner.c" |
945 | case YY_STATE_EOF(INITIAL): |
946 | yyterminate(); |
947 | |
948 | case YY_END_OF_BUFFER: |
949 | { |
950 | /* Amount of text matched not including the EOB char. */ |
951 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; |
952 | |
953 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
954 | *yy_cp = (yy_hold_char); |
955 | YY_RESTORE_YY_MORE_OFFSET |
956 | |
957 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) |
958 | { |
959 | /* We're scanning a new file or input source. It's |
960 | * possible that this happened because the user |
961 | * just pointed spec_yyin at a new source and called |
962 | * spec_yylex(). If so, then we have to assure |
963 | * consistency between YY_CURRENT_BUFFER and our |
964 | * globals. Here is the right place to do so, because |
965 | * this is the first action (other than possibly a |
966 | * back-up) that will match for the new input source. |
967 | */ |
968 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
969 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = spec_yyin; |
970 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
971 | } |
972 | |
973 | /* Note that here we test for yy_c_buf_p "<=" to the position |
974 | * of the first EOB in the buffer, since yy_c_buf_p will |
975 | * already have been incremented past the NUL character |
976 | * (since all states make transitions on EOB to the |
977 | * end-of-buffer state). Contrast this with the test |
978 | * in input(). |
979 | */ |
980 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) |
981 | { /* This was really a NUL. */ |
982 | yy_state_type yy_next_state; |
983 | |
984 | (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; |
985 | |
986 | yy_current_state = yy_get_previous_state( ); |
987 | |
988 | /* Okay, we're now positioned to make the NUL |
989 | * transition. We couldn't have |
990 | * yy_get_previous_state() go ahead and do it |
991 | * for us because it doesn't know how to deal |
992 | * with the possibility of jamming (and we don't |
993 | * want to build jamming into it because then it |
994 | * will run more slowly). |
995 | */ |
996 | |
997 | yy_next_state = yy_try_NUL_trans( yy_current_state ); |
998 | |
999 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; |
1000 | |
1001 | if ( yy_next_state ) |
1002 | { |
1003 | /* Consume the NUL. */ |
1004 | yy_cp = ++(yy_c_buf_p); |
1005 | yy_current_state = yy_next_state; |
1006 | goto yy_match; |
1007 | } |
1008 | |
1009 | else |
1010 | { |
1011 | yy_cp = (yy_last_accepting_cpos); |
1012 | yy_current_state = (yy_last_accepting_state); |
1013 | goto yy_find_action; |
1014 | } |
1015 | } |
1016 | |
1017 | else switch ( yy_get_next_buffer( ) ) |
1018 | { |
1019 | case EOB_ACT_END_OF_FILE: |
1020 | { |
1021 | (yy_did_buffer_switch_on_eof) = 0; |
1022 | |
1023 | if ( spec_yywrap( ) ) |
1024 | { |
1025 | /* Note: because we've taken care in |
1026 | * yy_get_next_buffer() to have set up |
1027 | * spec_yytext, we can now set up |
1028 | * yy_c_buf_p so that if some total |
1029 | * hoser (like flex itself) wants to |
1030 | * call the scanner after we return the |
1031 | * YY_NULL, it'll still work - another |
1032 | * YY_NULL will get returned. |
1033 | */ |
1034 | (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; |
1035 | |
1036 | yy_act = YY_STATE_EOF(YY_START); |
1037 | goto do_action; |
1038 | } |
1039 | |
1040 | else |
1041 | { |
1042 | if ( ! (yy_did_buffer_switch_on_eof) ) |
1043 | YY_NEW_FILE; |
1044 | } |
1045 | break; |
1046 | } |
1047 | |
1048 | case EOB_ACT_CONTINUE_SCAN: |
1049 | (yy_c_buf_p) = |
1050 | (yytext_ptr) + yy_amount_of_matched_text; |
1051 | |
1052 | yy_current_state = yy_get_previous_state( ); |
1053 | |
1054 | yy_cp = (yy_c_buf_p); |
1055 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; |
1056 | goto yy_match; |
1057 | |
1058 | case EOB_ACT_LAST_MATCH: |
1059 | (yy_c_buf_p) = |
1060 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; |
1061 | |
1062 | yy_current_state = yy_get_previous_state( ); |
1063 | |
1064 | yy_cp = (yy_c_buf_p); |
1065 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; |
1066 | goto yy_find_action; |
1067 | } |
1068 | break; |
1069 | } |
1070 | |
1071 | default: |
1072 | YY_FATAL_ERROR( |
1073 | "fatal flex scanner internal error--no action found" ); |
1074 | } /* end of action switch */ |
1075 | } /* end of scanning one token */ |
1076 | } /* end of user's declarations */ |
1077 | } /* end of spec_yylex */ |
1078 | |
1079 | /* yy_get_next_buffer - try to read in a new buffer |
1080 | * |
1081 | * Returns a code representing an action: |
1082 | * EOB_ACT_LAST_MATCH - |
1083 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
1084 | * EOB_ACT_END_OF_FILE - end of file |
1085 | */ |
1086 | static int yy_get_next_buffer (void) |
1087 | { |
1088 | char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
1089 | char *source = (yytext_ptr); |
1090 | int number_to_move, i; |
1091 | int ret_val; |
1092 | |
1093 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) |
1094 | YY_FATAL_ERROR( |
1095 | "fatal flex scanner internal error--end of buffer missed" ); |
1096 | |
1097 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
1098 | { /* Don't try to fill the buffer, so this is an EOF. */ |
1099 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) |
1100 | { |
1101 | /* We matched a single character, the EOB, so |
1102 | * treat this as a final EOF. |
1103 | */ |
1104 | return EOB_ACT_END_OF_FILE; |
1105 | } |
1106 | |
1107 | else |
1108 | { |
1109 | /* We matched some text prior to the EOB, first |
1110 | * process it. |
1111 | */ |
1112 | return EOB_ACT_LAST_MATCH; |
1113 | } |
1114 | } |
1115 | |
1116 | /* Try to read more data. */ |
1117 | |
1118 | /* First move last chars to start of buffer. */ |
1119 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); |
1120 | |
1121 | for ( i = 0; i < number_to_move; ++i ) |
1122 | *(dest++) = *(source++); |
1123 | |
1124 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
1125 | /* don't do the read, it's not guaranteed to return an EOF, |
1126 | * just force an EOF |
1127 | */ |
1128 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; |
1129 | |
1130 | else |
1131 | { |
1132 | int num_to_read = |
1133 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
1134 | |
1135 | while ( num_to_read <= 0 ) |
1136 | { /* Not enough room in the buffer - grow it. */ |
1137 | |
1138 | /* just a shorter name for the current buffer */ |
1139 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
1140 | |
1141 | int yy_c_buf_p_offset = |
1142 | (int) ((yy_c_buf_p) - b->yy_ch_buf); |
1143 | |
1144 | if ( b->yy_is_our_buffer ) |
1145 | { |
1146 | int new_size = b->yy_buf_size * 2; |
1147 | |
1148 | if ( new_size <= 0 ) |
1149 | b->yy_buf_size += b->yy_buf_size / 8; |
1150 | else |
1151 | b->yy_buf_size *= 2; |
1152 | |
1153 | b->yy_ch_buf = (char *) |
1154 | /* Include room in for 2 EOB chars. */ |
1155 | spec_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); |
1156 | } |
1157 | else |
1158 | /* Can't grow it, we don't own it. */ |
1159 | b->yy_ch_buf = NULL; |
1160 | |
1161 | if ( ! b->yy_ch_buf ) |
1162 | YY_FATAL_ERROR( |
1163 | "fatal error - scanner input buffer overflow" ); |
1164 | |
1165 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; |
1166 | |
1167 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - |
1168 | number_to_move - 1; |
1169 | |
1170 | } |
1171 | |
1172 | if ( num_to_read > YY_READ_BUF_SIZE ) |
1173 | num_to_read = YY_READ_BUF_SIZE; |
1174 | |
1175 | /* Read in more data. */ |
1176 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
1177 | (yy_n_chars), num_to_read ); |
1178 | |
1179 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
1180 | } |
1181 | |
1182 | if ( (yy_n_chars) == 0 ) |
1183 | { |
1184 | if ( number_to_move == YY_MORE_ADJ ) |
1185 | { |
1186 | ret_val = EOB_ACT_END_OF_FILE; |
1187 | spec_yyrestart(spec_yyin ); |
1188 | } |
1189 | |
1190 | else |
1191 | { |
1192 | ret_val = EOB_ACT_LAST_MATCH; |
1193 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = |
1194 | YY_BUFFER_EOF_PENDING; |
1195 | } |
1196 | } |
1197 | |
1198 | else |
1199 | ret_val = EOB_ACT_CONTINUE_SCAN; |
1200 | |
1201 | if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { |
1202 | /* Extend the array by 50%, plus the number we really need. */ |
1203 | int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); |
1204 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) spec_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); |
1205 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
1206 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); |
1207 | } |
1208 | |
1209 | (yy_n_chars) += number_to_move; |
1210 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; |
1211 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; |
1212 | |
1213 | (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
1214 | |
1215 | return ret_val; |
1216 | } |
1217 | |
1218 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
1219 | |
1220 | static yy_state_type yy_get_previous_state (void) |
1221 | { |
1222 | yy_state_type yy_current_state; |
1223 | char *yy_cp; |
1224 | |
1225 | yy_current_state = (yy_start); |
1226 | |
1227 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) |
1228 | { |
1229 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
1230 | if ( yy_accept[yy_current_state] ) |
1231 | { |
1232 | (yy_last_accepting_state) = yy_current_state; |
1233 | (yy_last_accepting_cpos) = yy_cp; |
1234 | } |
1235 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1236 | { |
1237 | yy_current_state = (int) yy_def[yy_current_state]; |
1238 | if ( yy_current_state >= 58 ) |
1239 | yy_c = yy_meta[(unsigned int) yy_c]; |
1240 | } |
1241 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; |
1242 | } |
1243 | |
1244 | return yy_current_state; |
1245 | } |
1246 | |
1247 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
1248 | * |
1249 | * synopsis |
1250 | * next_state = yy_try_NUL_trans( current_state ); |
1251 | */ |
1252 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) |
1253 | { |
1254 | int yy_is_jam; |
1255 | char *yy_cp = (yy_c_buf_p); |
1256 | |
1257 | YY_CHAR yy_c = 1; |
1258 | if ( yy_accept[yy_current_state] ) |
1259 | { |
1260 | (yy_last_accepting_state) = yy_current_state; |
1261 | (yy_last_accepting_cpos) = yy_cp; |
1262 | } |
1263 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1264 | { |
1265 | yy_current_state = (int) yy_def[yy_current_state]; |
1266 | if ( yy_current_state >= 58 ) |
1267 | yy_c = yy_meta[(unsigned int) yy_c]; |
1268 | } |
1269 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; |
1270 | yy_is_jam = (yy_current_state == 57); |
1271 | |
1272 | return yy_is_jam ? 0 : yy_current_state; |
1273 | } |
1274 | |
1275 | #ifndef YY_NO_UNPUT |
1276 | |
1277 | #endif |
1278 | |
1279 | #ifndef YY_NO_INPUT |
1280 | #ifdef __cplusplus |
1281 | static int yyinput (void) |
1282 | #else |
1283 | static int input (void) |
1284 | #endif |
1285 | |
1286 | { |
1287 | int c; |
1288 | |
1289 | *(yy_c_buf_p) = (yy_hold_char); |
1290 | |
1291 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) |
1292 | { |
1293 | /* yy_c_buf_p now points to the character we want to return. |
1294 | * If this occurs *before* the EOB characters, then it's a |
1295 | * valid NUL; if not, then we've hit the end of the buffer. |
1296 | */ |
1297 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) |
1298 | /* This was really a NUL. */ |
1299 | *(yy_c_buf_p) = '\0'; |
1300 | |
1301 | else |
1302 | { /* need more input */ |
1303 | int offset = (yy_c_buf_p) - (yytext_ptr); |
1304 | ++(yy_c_buf_p); |
1305 | |
1306 | switch ( yy_get_next_buffer( ) ) |
1307 | { |
1308 | case EOB_ACT_LAST_MATCH: |
1309 | /* This happens because yy_g_n_b() |
1310 | * sees that we've accumulated a |
1311 | * token and flags that we need to |
1312 | * try matching the token before |
1313 | * proceeding. But for input(), |
1314 | * there's no matching to consider. |
1315 | * So convert the EOB_ACT_LAST_MATCH |
1316 | * to EOB_ACT_END_OF_FILE. |
1317 | */ |
1318 | |
1319 | /* Reset buffer status. */ |
1320 | spec_yyrestart(spec_yyin ); |
1321 | |
1322 | /*FALLTHROUGH*/ |
1323 | |
1324 | case EOB_ACT_END_OF_FILE: |
1325 | { |
1326 | if ( spec_yywrap( ) ) |
1327 | return 0; |
1328 | |
1329 | if ( ! (yy_did_buffer_switch_on_eof) ) |
1330 | YY_NEW_FILE; |
1331 | #ifdef __cplusplus |
1332 | return yyinput(); |
1333 | #else |
1334 | return input(); |
1335 | #endif |
1336 | } |
1337 | |
1338 | case EOB_ACT_CONTINUE_SCAN: |
1339 | (yy_c_buf_p) = (yytext_ptr) + offset; |
1340 | break; |
1341 | } |
1342 | } |
1343 | } |
1344 | |
1345 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ |
1346 | *(yy_c_buf_p) = '\0'; /* preserve spec_yytext */ |
1347 | (yy_hold_char) = *++(yy_c_buf_p); |
1348 | |
1349 | return c; |
1350 | } |
1351 | #endif /* ifndef YY_NO_INPUT */ |
1352 | |
1353 | /** Immediately switch to a different input stream. |
1354 | * @param input_file A readable stream. |
1355 | * |
1356 | * @note This function does not reset the start condition to @c INITIAL . |
1357 | */ |
1358 | void spec_yyrestart (FILE * input_file ) |
1359 | { |
1360 | |
1361 | if ( ! YY_CURRENT_BUFFER ){ |
1362 | spec_yyensure_buffer_stack (); |
1363 | YY_CURRENT_BUFFER_LVALUE = |
1364 | spec_yy_create_buffer(spec_yyin,YY_BUF_SIZE ); |
1365 | } |
1366 | |
1367 | spec_yy_init_buffer(YY_CURRENT_BUFFER,input_file ); |
1368 | spec_yy_load_buffer_state( ); |
1369 | } |
1370 | |
1371 | /** Switch to a different input buffer. |
1372 | * @param new_buffer The new input buffer. |
1373 | * |
1374 | */ |
1375 | void spec_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) |
1376 | { |
1377 | |
1378 | /* TODO. We should be able to replace this entire function body |
1379 | * with |
1380 | * spec_yypop_buffer_state(); |
1381 | * spec_yypush_buffer_state(new_buffer); |
1382 | */ |
1383 | spec_yyensure_buffer_stack (); |
1384 | if ( YY_CURRENT_BUFFER == new_buffer ) |
1385 | return; |
1386 | |
1387 | if ( YY_CURRENT_BUFFER ) |
1388 | { |
1389 | /* Flush out information for old buffer. */ |
1390 | *(yy_c_buf_p) = (yy_hold_char); |
1391 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); |
1392 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
1393 | } |
1394 | |
1395 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
1396 | spec_yy_load_buffer_state( ); |
1397 | |
1398 | /* We don't actually know whether we did this switch during |
1399 | * EOF (spec_yywrap()) processing, but the only time this flag |
1400 | * is looked at is after spec_yywrap() is called, so it's safe |
1401 | * to go ahead and always set it. |
1402 | */ |
1403 | (yy_did_buffer_switch_on_eof) = 1; |
1404 | } |
1405 | |
1406 | static void spec_yy_load_buffer_state (void) |
1407 | { |
1408 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
1409 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
1410 | spec_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
1411 | (yy_hold_char) = *(yy_c_buf_p); |
1412 | } |
1413 | |
1414 | /** Allocate and initialize an input buffer state. |
1415 | * @param file A readable stream. |
1416 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
1417 | * |
1418 | * @return the allocated buffer state. |
1419 | */ |
1420 | YY_BUFFER_STATE spec_yy_create_buffer (FILE * file, int size ) |
1421 | { |
1422 | YY_BUFFER_STATE b; |
1423 | |
1424 | b = (YY_BUFFER_STATE) spec_yyalloc(sizeof( struct yy_buffer_state ) ); |
1425 | if ( ! b ) |
1426 | YY_FATAL_ERROR( "out of dynamic memory in spec_yy_create_buffer()" ); |
1427 | |
1428 | b->yy_buf_size = (yy_size_t)size; |
1429 | |
1430 | /* yy_ch_buf has to be 2 characters longer than the size given because |
1431 | * we need to put in 2 end-of-buffer characters. |
1432 | */ |
1433 | b->yy_ch_buf = (char *) spec_yyalloc(b->yy_buf_size + 2 ); |
1434 | if ( ! b->yy_ch_buf ) |
1435 | YY_FATAL_ERROR( "out of dynamic memory in spec_yy_create_buffer()" ); |
1436 | |
1437 | b->yy_is_our_buffer = 1; |
1438 | |
1439 | spec_yy_init_buffer(b,file ); |
1440 | |
1441 | return b; |
1442 | } |
1443 | |
1444 | /** Destroy the buffer. |
1445 | * @param b a buffer created with spec_yy_create_buffer() |
1446 | * |
1447 | */ |
1448 | void spec_yy_delete_buffer (YY_BUFFER_STATE b ) |
1449 | { |
1450 | |
1451 | if ( ! b ) |
1452 | return; |
1453 | |
1454 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ |
1455 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; |
1456 | |
1457 | if ( b->yy_is_our_buffer ) |
1458 | spec_yyfree((void *) b->yy_ch_buf ); |
1459 | |
1460 | spec_yyfree((void *) b ); |
1461 | } |
1462 | |
1463 | /* Initializes or reinitializes a buffer. |
1464 | * This function is sometimes called more than once on the same buffer, |
1465 | * such as during a spec_yyrestart() or at EOF. |
1466 | */ |
1467 | static void spec_yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) |
1468 | |
1469 | { |
1470 | int oerrno = errno; |
1471 | |
1472 | spec_yy_flush_buffer(b ); |
1473 | |
1474 | b->yy_input_file = file; |
1475 | b->yy_fill_buffer = 1; |
1476 | |
1477 | /* If b is the current buffer, then spec_yy_init_buffer was _probably_ |
1478 | * called from spec_yyrestart() or through yy_get_next_buffer. |
1479 | * In that case, we don't want to reset the lineno or column. |
1480 | */ |
1481 | if (b != YY_CURRENT_BUFFER){ |
1482 | b->yy_bs_lineno = 1; |
1483 | b->yy_bs_column = 0; |
1484 | } |
1485 | |
1486 | b->yy_is_interactive = 0; |
1487 | |
1488 | errno = oerrno; |
1489 | } |
1490 | |
1491 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
1492 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
1493 | * |
1494 | */ |
1495 | void spec_yy_flush_buffer (YY_BUFFER_STATE b ) |
1496 | { |
1497 | if ( ! b ) |
1498 | return; |
1499 | |
1500 | b->yy_n_chars = 0; |
1501 | |
1502 | /* We always need two end-of-buffer characters. The first causes |
1503 | * a transition to the end-of-buffer state. The second causes |
1504 | * a jam in that state. |
1505 | */ |
1506 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
1507 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
1508 | |
1509 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
1510 | |
1511 | b->yy_at_bol = 1; |
1512 | b->yy_buffer_status = YY_BUFFER_NEW; |
1513 | |
1514 | if ( b == YY_CURRENT_BUFFER ) |
1515 | spec_yy_load_buffer_state( ); |
1516 | } |
1517 | |
1518 | /** Pushes the new state onto the stack. The new state becomes |
1519 | * the current state. This function will allocate the stack |
1520 | * if necessary. |
1521 | * @param new_buffer The new state. |
1522 | * |
1523 | */ |
1524 | void spec_yypush_buffer_state (YY_BUFFER_STATE new_buffer ) |
1525 | { |
1526 | if (new_buffer == NULL) |
1527 | return; |
1528 | |
1529 | spec_yyensure_buffer_stack(); |
1530 | |
1531 | /* This block is copied from spec_yy_switch_to_buffer. */ |
1532 | if ( YY_CURRENT_BUFFER ) |
1533 | { |
1534 | /* Flush out information for old buffer. */ |
1535 | *(yy_c_buf_p) = (yy_hold_char); |
1536 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); |
1537 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
1538 | } |
1539 | |
1540 | /* Only push if top exists. Otherwise, replace top. */ |
1541 | if (YY_CURRENT_BUFFER) |
1542 | (yy_buffer_stack_top)++; |
1543 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
1544 | |
1545 | /* copied from spec_yy_switch_to_buffer. */ |
1546 | spec_yy_load_buffer_state( ); |
1547 | (yy_did_buffer_switch_on_eof) = 1; |
1548 | } |
1549 | |
1550 | /** Removes and deletes the top of the stack, if present. |
1551 | * The next element becomes the new top. |
1552 | * |
1553 | */ |
1554 | void spec_yypop_buffer_state (void) |
1555 | { |
1556 | if (!YY_CURRENT_BUFFER) |
1557 | return; |
1558 | |
1559 | spec_yy_delete_buffer(YY_CURRENT_BUFFER ); |
1560 | YY_CURRENT_BUFFER_LVALUE = NULL; |
1561 | if ((yy_buffer_stack_top) > 0) |
1562 | --(yy_buffer_stack_top); |
1563 | |
1564 | if (YY_CURRENT_BUFFER) { |
1565 | spec_yy_load_buffer_state( ); |
1566 | (yy_did_buffer_switch_on_eof) = 1; |
1567 | } |
1568 | } |
1569 | |
1570 | /* Allocates the stack if it does not exist. |
1571 | * Guarantees space for at least one push. |
1572 | */ |
1573 | static void spec_yyensure_buffer_stack (void) |
1574 | { |
1575 | int num_to_alloc; |
1576 | |
1577 | if (!(yy_buffer_stack)) { |
1578 | |
1579 | /* First allocation is just for 2 elements, since we don't know if this |
1580 | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
1581 | * immediate realloc on the next call. |
1582 | */ |
1583 | num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ |
1584 | (yy_buffer_stack) = (struct yy_buffer_state**)spec_yyalloc |
1585 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
1586 | ); |
1587 | if ( ! (yy_buffer_stack) ) |
1588 | YY_FATAL_ERROR( "out of dynamic memory in spec_yyensure_buffer_stack()" ); |
1589 | |
1590 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
1591 | |
1592 | (yy_buffer_stack_max) = num_to_alloc; |
1593 | (yy_buffer_stack_top) = 0; |
1594 | return; |
1595 | } |
1596 | |
1597 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ |
1598 | |
1599 | /* Increase the buffer to prepare for a possible push. */ |
1600 | yy_size_t grow_size = 8 /* arbitrary grow size */; |
1601 | |
1602 | num_to_alloc = (yy_buffer_stack_max) + grow_size; |
1603 | (yy_buffer_stack) = (struct yy_buffer_state**)spec_yyrealloc |
1604 | ((yy_buffer_stack), |
1605 | num_to_alloc * sizeof(struct yy_buffer_state*) |
1606 | ); |
1607 | if ( ! (yy_buffer_stack) ) |
1608 | YY_FATAL_ERROR( "out of dynamic memory in spec_yyensure_buffer_stack()" ); |
1609 | |
1610 | /* zero only the new slots.*/ |
1611 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); |
1612 | (yy_buffer_stack_max) = num_to_alloc; |
1613 | } |
1614 | } |
1615 | |
1616 | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
1617 | * @param base the character buffer |
1618 | * @param size the size in bytes of the character buffer |
1619 | * |
1620 | * @return the newly allocated buffer state object. |
1621 | */ |
1622 | YY_BUFFER_STATE spec_yy_scan_buffer (char * base, yy_size_t size ) |
1623 | { |
1624 | YY_BUFFER_STATE b; |
1625 | |
1626 | if ( size < 2 || |
1627 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
1628 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
1629 | /* They forgot to leave room for the EOB's. */ |
1630 | return NULL; |
1631 | |
1632 | b = (YY_BUFFER_STATE) spec_yyalloc(sizeof( struct yy_buffer_state ) ); |
1633 | if ( ! b ) |
1634 | YY_FATAL_ERROR( "out of dynamic memory in spec_yy_scan_buffer()" ); |
1635 | |
1636 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
1637 | b->yy_buf_pos = b->yy_ch_buf = base; |
1638 | b->yy_is_our_buffer = 0; |
1639 | b->yy_input_file = NULL; |
1640 | b->yy_n_chars = b->yy_buf_size; |
1641 | b->yy_is_interactive = 0; |
1642 | b->yy_at_bol = 1; |
1643 | b->yy_fill_buffer = 0; |
1644 | b->yy_buffer_status = YY_BUFFER_NEW; |
1645 | |
1646 | spec_yy_switch_to_buffer(b ); |
1647 | |
1648 | return b; |
1649 | } |
1650 | |
1651 | /** Setup the input buffer state to scan a string. The next call to spec_yylex() will |
1652 | * scan from a @e copy of @a str. |
1653 | * @param yystr a NUL-terminated string to scan |
1654 | * |
1655 | * @return the newly allocated buffer state object. |
1656 | * @note If you want to scan bytes that may contain NUL values, then use |
1657 | * spec_yy_scan_bytes() instead. |
1658 | */ |
1659 | YY_BUFFER_STATE spec_yy_scan_string (yyconst char * yystr ) |
1660 | { |
1661 | |
1662 | return spec_yy_scan_bytes(yystr,(int) strlen(yystr) ); |
1663 | } |
1664 | |
1665 | /** Setup the input buffer state to scan the given bytes. The next call to spec_yylex() will |
1666 | * scan from a @e copy of @a bytes. |
1667 | * @param yybytes the byte buffer to scan |
1668 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
1669 | * |
1670 | * @return the newly allocated buffer state object. |
1671 | */ |
1672 | YY_BUFFER_STATE spec_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) |
1673 | { |
1674 | YY_BUFFER_STATE b; |
1675 | char *buf; |
1676 | yy_size_t n; |
1677 | int i; |
1678 | |
1679 | /* Get memory for full buffer, including space for trailing EOB's. */ |
1680 | n = (yy_size_t) (_yybytes_len + 2); |
1681 | buf = (char *) spec_yyalloc(n ); |
1682 | if ( ! buf ) |
1683 | YY_FATAL_ERROR( "out of dynamic memory in spec_yy_scan_bytes()" ); |
1684 | |
1685 | for ( i = 0; i < _yybytes_len; ++i ) |
1686 | buf[i] = yybytes[i]; |
1687 | |
1688 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
1689 | |
1690 | b = spec_yy_scan_buffer(buf,n ); |
1691 | if ( ! b ) |
1692 | YY_FATAL_ERROR( "bad buffer in spec_yy_scan_bytes()" ); |
1693 | |
1694 | /* It's okay to grow etc. this buffer, and we should throw it |
1695 | * away when we're done. |
1696 | */ |
1697 | b->yy_is_our_buffer = 1; |
1698 | |
1699 | return b; |
1700 | } |
1701 | |
1702 | #ifndef YY_EXIT_FAILURE |
1703 | #define YY_EXIT_FAILURE 2 |
1704 | #endif |
1705 | |
1706 | static void yynoreturn yy_fatal_error (yyconst char* msg ) |
1707 | { |
1708 | (void) fprintf( stderr, "%s\n" , msg ); |
1709 | exit( YY_EXIT_FAILURE ); |
1710 | } |
1711 | |
1712 | /* Redefine yyless() so it works in section 3 code. */ |
1713 | |
1714 | #undef yyless |
1715 | #define yyless(n) \ |
1716 | do \ |
1717 | { \ |
1718 | /* Undo effects of setting up spec_yytext. */ \ |
1719 | int yyless_macro_arg = (n); \ |
1720 | YY_LESS_LINENO(yyless_macro_arg);\ |
1721 | spec_yytext[spec_yyleng] = (yy_hold_char); \ |
1722 | (yy_c_buf_p) = spec_yytext + yyless_macro_arg; \ |
1723 | (yy_hold_char) = *(yy_c_buf_p); \ |
1724 | *(yy_c_buf_p) = '\0'; \ |
1725 | spec_yyleng = yyless_macro_arg; \ |
1726 | } \ |
1727 | while ( 0 ) |
1728 | |
1729 | /* Accessor methods (get/set functions) to struct members. */ |
1730 | |
1731 | /** Get the current line number. |
1732 | * |
1733 | */ |
1734 | int spec_yyget_lineno (void) |
1735 | { |
1736 | |
1737 | return spec_yylineno; |
1738 | } |
1739 | |
1740 | /** Get the input stream. |
1741 | * |
1742 | */ |
1743 | FILE *spec_yyget_in (void) |
1744 | { |
1745 | return spec_yyin; |
1746 | } |
1747 | |
1748 | /** Get the output stream. |
1749 | * |
1750 | */ |
1751 | FILE *spec_yyget_out (void) |
1752 | { |
1753 | return spec_yyout; |
1754 | } |
1755 | |
1756 | /** Get the length of the current token. |
1757 | * |
1758 | */ |
1759 | int spec_yyget_leng (void) |
1760 | { |
1761 | return spec_yyleng; |
1762 | } |
1763 | |
1764 | /** Get the current token. |
1765 | * |
1766 | */ |
1767 | |
1768 | char *spec_yyget_text (void) |
1769 | { |
1770 | return spec_yytext; |
1771 | } |
1772 | |
1773 | /** Set the current line number. |
1774 | * @param _line_number line number |
1775 | * |
1776 | */ |
1777 | void spec_yyset_lineno (int _line_number ) |
1778 | { |
1779 | |
1780 | spec_yylineno = _line_number; |
1781 | } |
1782 | |
1783 | /** Set the input stream. This does not discard the current |
1784 | * input buffer. |
1785 | * @param _in_str A readable stream. |
1786 | * |
1787 | * @see spec_yy_switch_to_buffer |
1788 | */ |
1789 | void spec_yyset_in (FILE * _in_str ) |
1790 | { |
1791 | spec_yyin = _in_str ; |
1792 | } |
1793 | |
1794 | void spec_yyset_out (FILE * _out_str ) |
1795 | { |
1796 | spec_yyout = _out_str ; |
1797 | } |
1798 | |
1799 | int spec_yyget_debug (void) |
1800 | { |
1801 | return spec_yy_flex_debug; |
1802 | } |
1803 | |
1804 | void spec_yyset_debug (int _bdebug ) |
1805 | { |
1806 | spec_yy_flex_debug = _bdebug ; |
1807 | } |
1808 | |
1809 | static int yy_init_globals (void) |
1810 | { |
1811 | /* Initialization is the same as for the non-reentrant scanner. |
1812 | * This function is called from spec_yylex_destroy(), so don't allocate here. |
1813 | */ |
1814 | |
1815 | (yy_buffer_stack) = NULL; |
1816 | (yy_buffer_stack_top) = 0; |
1817 | (yy_buffer_stack_max) = 0; |
1818 | (yy_c_buf_p) = NULL; |
1819 | (yy_init) = 0; |
1820 | (yy_start) = 0; |
1821 | |
1822 | /* Defined in main.c */ |
1823 | #ifdef YY_STDINIT |
1824 | spec_yyin = stdin; |
1825 | spec_yyout = stdout; |
1826 | #else |
1827 | spec_yyin = NULL; |
1828 | spec_yyout = NULL; |
1829 | #endif |
1830 | |
1831 | /* For future reference: Set errno on error, since we are called by |
1832 | * spec_yylex_init() |
1833 | */ |
1834 | return 0; |
1835 | } |
1836 | |
1837 | /* spec_yylex_destroy is for both reentrant and non-reentrant scanners. */ |
1838 | int spec_yylex_destroy (void) |
1839 | { |
1840 | |
1841 | /* Pop the buffer stack, destroying each element. */ |
1842 | while(YY_CURRENT_BUFFER){ |
1843 | spec_yy_delete_buffer(YY_CURRENT_BUFFER ); |
1844 | YY_CURRENT_BUFFER_LVALUE = NULL; |
1845 | spec_yypop_buffer_state(); |
1846 | } |
1847 | |
1848 | /* Destroy the stack itself. */ |
1849 | spec_yyfree((yy_buffer_stack) ); |
1850 | (yy_buffer_stack) = NULL; |
1851 | |
1852 | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
1853 | * spec_yylex() is called, initialization will occur. */ |
1854 | yy_init_globals( ); |
1855 | |
1856 | return 0; |
1857 | } |
1858 | |
1859 | /* |
1860 | * Internal utility routines. |
1861 | */ |
1862 | |
1863 | #ifndef yytext_ptr |
1864 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) |
1865 | { |
1866 | |
1867 | int i; |
1868 | for ( i = 0; i < n; ++i ) |
1869 | s1[i] = s2[i]; |
1870 | } |
1871 | #endif |
1872 | |
1873 | #ifdef YY_NEED_STRLEN |
1874 | static int yy_flex_strlen (yyconst char * s ) |
1875 | { |
1876 | int n; |
1877 | for ( n = 0; s[n]; ++n ) |
1878 | ; |
1879 | |
1880 | return n; |
1881 | } |
1882 | #endif |
1883 | |
1884 | void *spec_yyalloc (yy_size_t size ) |
1885 | { |
1886 | return malloc(size); |
1887 | } |
1888 | |
1889 | void *spec_yyrealloc (void * ptr, yy_size_t size ) |
1890 | { |
1891 | |
1892 | /* The cast to (char *) in the following accommodates both |
1893 | * implementations that use char* generic pointers, and those |
1894 | * that use void* generic pointers. It works with the latter |
1895 | * because both ANSI C and C++ allow castless assignment from |
1896 | * any pointer type to void*, and deal with argument conversions |
1897 | * as though doing an assignment. |
1898 | */ |
1899 | return realloc(ptr, size); |
1900 | } |
1901 | |
1902 | void spec_yyfree (void * ptr ) |
1903 | { |
1904 | free( (char *) ptr ); /* see spec_yyrealloc() for (char *) cast */ |
1905 | } |
1906 | |
1907 | #define YYTABLES_NAME "yytables" |
1908 | |
1909 | #line 103 "specscanner.l" |
1910 | |
1911 | |
1912 | |
1913 | /* LCOV_EXCL_STOP */ |
1914 | |
1915 | static void |
1916 | addlitchar(char c) |
1917 | { |
1918 | /* We must always leave room to add a trailing \0 */ |
1919 | if (litbufpos >= litbufsize - 1) |
1920 | { |
1921 | /* Double the size of litbuf if it gets full */ |
1922 | litbufsize += litbufsize; |
1923 | litbuf = pg_realloc(litbuf, litbufsize); |
1924 | } |
1925 | litbuf[litbufpos++] = c; |
1926 | } |
1927 | |
1928 | void |
1929 | yyerror(const char *message) |
1930 | { |
1931 | fprintf(stderr, "%s at line %d\n" , message, yyline); |
1932 | exit(1); |
1933 | } |
1934 | |
1935 | |