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