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