1 #line 1 "sqlscan.c"
2 
3 #line 3 "sqlscan.c"
4 
5 #define  YY_INT_ALIGNED short int
6 
7 /* A lexical scanner generated by flex */
8 
9 #define yy_create_buffer orafce_sql_yy_create_buffer
10 #define yy_delete_buffer orafce_sql_yy_delete_buffer
11 #define yy_scan_buffer orafce_sql_yy_scan_buffer
12 #define yy_scan_string orafce_sql_yy_scan_string
13 #define yy_scan_bytes orafce_sql_yy_scan_bytes
14 #define yy_init_buffer orafce_sql_yy_init_buffer
15 #define yy_flush_buffer orafce_sql_yy_flush_buffer
16 #define yy_load_buffer_state orafce_sql_yy_load_buffer_state
17 #define yy_switch_to_buffer orafce_sql_yy_switch_to_buffer
18 #define yypush_buffer_state orafce_sql_yypush_buffer_state
19 #define yypop_buffer_state orafce_sql_yypop_buffer_state
20 #define yyensure_buffer_stack orafce_sql_yyensure_buffer_stack
21 #define yy_flex_debug orafce_sql_yy_flex_debug
22 #define yyin orafce_sql_yyin
23 #define yyleng orafce_sql_yyleng
24 #define yylex orafce_sql_yylex
25 #define yylineno orafce_sql_yylineno
26 #define yyout orafce_sql_yyout
27 #define yyrestart orafce_sql_yyrestart
28 #define yytext orafce_sql_yytext
29 #define yywrap orafce_sql_yywrap
30 #define yyalloc orafce_sql_yyalloc
31 #define yyrealloc orafce_sql_yyrealloc
32 #define yyfree orafce_sql_yyfree
33 
34 #define FLEX_SCANNER
35 #define YY_FLEX_MAJOR_VERSION 2
36 #define YY_FLEX_MINOR_VERSION 6
37 #define YY_FLEX_SUBMINOR_VERSION 4
38 #if YY_FLEX_SUBMINOR_VERSION > 0
39 #define FLEX_BETA
40 #endif
41 
42 #ifdef yy_create_buffer
43 #define orafce_sql_yy_create_buffer_ALREADY_DEFINED
44 #else
45 #define yy_create_buffer orafce_sql_yy_create_buffer
46 #endif
47 
48 #ifdef yy_delete_buffer
49 #define orafce_sql_yy_delete_buffer_ALREADY_DEFINED
50 #else
51 #define yy_delete_buffer orafce_sql_yy_delete_buffer
52 #endif
53 
54 #ifdef yy_scan_buffer
55 #define orafce_sql_yy_scan_buffer_ALREADY_DEFINED
56 #else
57 #define yy_scan_buffer orafce_sql_yy_scan_buffer
58 #endif
59 
60 #ifdef yy_scan_string
61 #define orafce_sql_yy_scan_string_ALREADY_DEFINED
62 #else
63 #define yy_scan_string orafce_sql_yy_scan_string
64 #endif
65 
66 #ifdef yy_scan_bytes
67 #define orafce_sql_yy_scan_bytes_ALREADY_DEFINED
68 #else
69 #define yy_scan_bytes orafce_sql_yy_scan_bytes
70 #endif
71 
72 #ifdef yy_init_buffer
73 #define orafce_sql_yy_init_buffer_ALREADY_DEFINED
74 #else
75 #define yy_init_buffer orafce_sql_yy_init_buffer
76 #endif
77 
78 #ifdef yy_flush_buffer
79 #define orafce_sql_yy_flush_buffer_ALREADY_DEFINED
80 #else
81 #define yy_flush_buffer orafce_sql_yy_flush_buffer
82 #endif
83 
84 #ifdef yy_load_buffer_state
85 #define orafce_sql_yy_load_buffer_state_ALREADY_DEFINED
86 #else
87 #define yy_load_buffer_state orafce_sql_yy_load_buffer_state
88 #endif
89 
90 #ifdef yy_switch_to_buffer
91 #define orafce_sql_yy_switch_to_buffer_ALREADY_DEFINED
92 #else
93 #define yy_switch_to_buffer orafce_sql_yy_switch_to_buffer
94 #endif
95 
96 #ifdef yypush_buffer_state
97 #define orafce_sql_yypush_buffer_state_ALREADY_DEFINED
98 #else
99 #define yypush_buffer_state orafce_sql_yypush_buffer_state
100 #endif
101 
102 #ifdef yypop_buffer_state
103 #define orafce_sql_yypop_buffer_state_ALREADY_DEFINED
104 #else
105 #define yypop_buffer_state orafce_sql_yypop_buffer_state
106 #endif
107 
108 #ifdef yyensure_buffer_stack
109 #define orafce_sql_yyensure_buffer_stack_ALREADY_DEFINED
110 #else
111 #define yyensure_buffer_stack orafce_sql_yyensure_buffer_stack
112 #endif
113 
114 #ifdef yylex
115 #define orafce_sql_yylex_ALREADY_DEFINED
116 #else
117 #define yylex orafce_sql_yylex
118 #endif
119 
120 #ifdef yyrestart
121 #define orafce_sql_yyrestart_ALREADY_DEFINED
122 #else
123 #define yyrestart orafce_sql_yyrestart
124 #endif
125 
126 #ifdef yylex_init
127 #define orafce_sql_yylex_init_ALREADY_DEFINED
128 #else
129 #define yylex_init orafce_sql_yylex_init
130 #endif
131 
132 #ifdef yylex_init_extra
133 #define orafce_sql_yylex_init_extra_ALREADY_DEFINED
134 #else
135 #define yylex_init_extra orafce_sql_yylex_init_extra
136 #endif
137 
138 #ifdef yylex_destroy
139 #define orafce_sql_yylex_destroy_ALREADY_DEFINED
140 #else
141 #define yylex_destroy orafce_sql_yylex_destroy
142 #endif
143 
144 #ifdef yyget_debug
145 #define orafce_sql_yyget_debug_ALREADY_DEFINED
146 #else
147 #define yyget_debug orafce_sql_yyget_debug
148 #endif
149 
150 #ifdef yyset_debug
151 #define orafce_sql_yyset_debug_ALREADY_DEFINED
152 #else
153 #define yyset_debug orafce_sql_yyset_debug
154 #endif
155 
156 #ifdef yyget_extra
157 #define orafce_sql_yyget_extra_ALREADY_DEFINED
158 #else
159 #define yyget_extra orafce_sql_yyget_extra
160 #endif
161 
162 #ifdef yyset_extra
163 #define orafce_sql_yyset_extra_ALREADY_DEFINED
164 #else
165 #define yyset_extra orafce_sql_yyset_extra
166 #endif
167 
168 #ifdef yyget_in
169 #define orafce_sql_yyget_in_ALREADY_DEFINED
170 #else
171 #define yyget_in orafce_sql_yyget_in
172 #endif
173 
174 #ifdef yyset_in
175 #define orafce_sql_yyset_in_ALREADY_DEFINED
176 #else
177 #define yyset_in orafce_sql_yyset_in
178 #endif
179 
180 #ifdef yyget_out
181 #define orafce_sql_yyget_out_ALREADY_DEFINED
182 #else
183 #define yyget_out orafce_sql_yyget_out
184 #endif
185 
186 #ifdef yyset_out
187 #define orafce_sql_yyset_out_ALREADY_DEFINED
188 #else
189 #define yyset_out orafce_sql_yyset_out
190 #endif
191 
192 #ifdef yyget_leng
193 #define orafce_sql_yyget_leng_ALREADY_DEFINED
194 #else
195 #define yyget_leng orafce_sql_yyget_leng
196 #endif
197 
198 #ifdef yyget_text
199 #define orafce_sql_yyget_text_ALREADY_DEFINED
200 #else
201 #define yyget_text orafce_sql_yyget_text
202 #endif
203 
204 #ifdef yyget_lineno
205 #define orafce_sql_yyget_lineno_ALREADY_DEFINED
206 #else
207 #define yyget_lineno orafce_sql_yyget_lineno
208 #endif
209 
210 #ifdef yyset_lineno
211 #define orafce_sql_yyset_lineno_ALREADY_DEFINED
212 #else
213 #define yyset_lineno orafce_sql_yyset_lineno
214 #endif
215 
216 #ifdef yywrap
217 #define orafce_sql_yywrap_ALREADY_DEFINED
218 #else
219 #define yywrap orafce_sql_yywrap
220 #endif
221 
222 #ifdef yyalloc
223 #define orafce_sql_yyalloc_ALREADY_DEFINED
224 #else
225 #define yyalloc orafce_sql_yyalloc
226 #endif
227 
228 #ifdef yyrealloc
229 #define orafce_sql_yyrealloc_ALREADY_DEFINED
230 #else
231 #define yyrealloc orafce_sql_yyrealloc
232 #endif
233 
234 #ifdef yyfree
235 #define orafce_sql_yyfree_ALREADY_DEFINED
236 #else
237 #define yyfree orafce_sql_yyfree
238 #endif
239 
240 #ifdef yytext
241 #define orafce_sql_yytext_ALREADY_DEFINED
242 #else
243 #define yytext orafce_sql_yytext
244 #endif
245 
246 #ifdef yyleng
247 #define orafce_sql_yyleng_ALREADY_DEFINED
248 #else
249 #define yyleng orafce_sql_yyleng
250 #endif
251 
252 #ifdef yyin
253 #define orafce_sql_yyin_ALREADY_DEFINED
254 #else
255 #define yyin orafce_sql_yyin
256 #endif
257 
258 #ifdef yyout
259 #define orafce_sql_yyout_ALREADY_DEFINED
260 #else
261 #define yyout orafce_sql_yyout
262 #endif
263 
264 #ifdef yy_flex_debug
265 #define orafce_sql_yy_flex_debug_ALREADY_DEFINED
266 #else
267 #define yy_flex_debug orafce_sql_yy_flex_debug
268 #endif
269 
270 #ifdef yylineno
271 #define orafce_sql_yylineno_ALREADY_DEFINED
272 #else
273 #define yylineno orafce_sql_yylineno
274 #endif
275 
276 /* First, we deal with  platform-specific or compiler-specific issues. */
277 
278 /* begin standard C headers. */
279 #include <stdio.h>
280 #include <string.h>
281 #include <errno.h>
282 #include <stdlib.h>
283 
284 /* end standard C headers. */
285 
286 /* flex integer type definitions */
287 
288 #ifndef FLEXINT_H
289 #define FLEXINT_H
290 
291 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
292 
293 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
294 
295 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
296  * if you want the limit (max/min) macros for int types.
297  */
298 #ifndef __STDC_LIMIT_MACROS
299 #define __STDC_LIMIT_MACROS 1
300 #endif
301 
302 #include <inttypes.h>
303 typedef int8_t flex_int8_t;
304 typedef uint8_t flex_uint8_t;
305 typedef int16_t flex_int16_t;
306 typedef uint16_t flex_uint16_t;
307 typedef int32_t flex_int32_t;
308 typedef uint32_t flex_uint32_t;
309 #else
310 typedef signed char flex_int8_t;
311 typedef short int flex_int16_t;
312 typedef int flex_int32_t;
313 typedef unsigned char flex_uint8_t;
314 typedef unsigned short int flex_uint16_t;
315 typedef unsigned int flex_uint32_t;
316 
317 /* Limits of integral types. */
318 #ifndef INT8_MIN
319 #define INT8_MIN               (-128)
320 #endif
321 #ifndef INT16_MIN
322 #define INT16_MIN              (-32767-1)
323 #endif
324 #ifndef INT32_MIN
325 #define INT32_MIN              (-2147483647-1)
326 #endif
327 #ifndef INT8_MAX
328 #define INT8_MAX               (127)
329 #endif
330 #ifndef INT16_MAX
331 #define INT16_MAX              (32767)
332 #endif
333 #ifndef INT32_MAX
334 #define INT32_MAX              (2147483647)
335 #endif
336 #ifndef UINT8_MAX
337 #define UINT8_MAX              (255U)
338 #endif
339 #ifndef UINT16_MAX
340 #define UINT16_MAX             (65535U)
341 #endif
342 #ifndef UINT32_MAX
343 #define UINT32_MAX             (4294967295U)
344 #endif
345 
346 #ifndef SIZE_MAX
347 #define SIZE_MAX               (~(size_t)0)
348 #endif
349 
350 #endif /* ! C99 */
351 
352 #endif /* ! FLEXINT_H */
353 
354 /* begin standard C++ headers. */
355 
356 /* TODO: this is always defined, so inline it */
357 #define yyconst const
358 
359 #if defined(__GNUC__) && __GNUC__ >= 3
360 #define yynoreturn __attribute__((__noreturn__))
361 #else
362 #define yynoreturn
363 #endif
364 
365 /* Returned upon end-of-file. */
366 #define YY_NULL 0
367 
368 /* Promotes a possibly negative, possibly signed char to an
369  *   integer in range [0..255] for use as an array index.
370  */
371 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
372 
373 /* Enter a start condition.  This macro really ought to take a parameter,
374  * but we do it the disgusting crufty way forced on us by the ()-less
375  * definition of BEGIN.
376  */
377 #define BEGIN (yy_start) = 1 + 2 *
378 /* Translate the current start state into a value that can be later handed
379  * to BEGIN to return to the state.  The YYSTATE alias is for lex
380  * compatibility.
381  */
382 #define YY_START (((yy_start) - 1) / 2)
383 #define YYSTATE YY_START
384 /* Action number for EOF rule of a given start state. */
385 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
386 /* Special action meaning "start processing a new file". */
387 #define YY_NEW_FILE yyrestart( yyin  )
388 #define YY_END_OF_BUFFER_CHAR 0
389 
390 /* Size of default input buffer. */
391 #ifndef YY_BUF_SIZE
392 #ifdef __ia64__
393 /* On IA-64, the buffer size is 16k, not 8k.
394  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
395  * Ditto for the __ia64__ case accordingly.
396  */
397 #define YY_BUF_SIZE 32768
398 #else
399 #define YY_BUF_SIZE 16384
400 #endif /* __ia64__ */
401 #endif
402 
403 /* The state buf must be large enough to hold one state per character in the main buffer.
404  */
405 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
406 
407 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
408 #define YY_TYPEDEF_YY_BUFFER_STATE
409 typedef struct yy_buffer_state *YY_BUFFER_STATE;
410 #endif
411 
412 #ifndef YY_TYPEDEF_YY_SIZE_T
413 #define YY_TYPEDEF_YY_SIZE_T
414 typedef size_t yy_size_t;
415 #endif
416 
417 extern int yyleng;
418 
419 extern FILE *yyin, *yyout;
420 
421 #define EOB_ACT_CONTINUE_SCAN 0
422 #define EOB_ACT_END_OF_FILE 1
423 #define EOB_ACT_LAST_MATCH 2
424 
425     #define YY_LESS_LINENO(n)
426     #define YY_LINENO_REWIND_TO(ptr)
427 
428 /* Return all but the first "n" matched characters back to the input stream. */
429 #define yyless(n) \
430 	do \
431 		{ \
432 		/* Undo effects of setting up yytext. */ \
433         int yyless_macro_arg = (n); \
434         YY_LESS_LINENO(yyless_macro_arg);\
435 		*yy_cp = (yy_hold_char); \
436 		YY_RESTORE_YY_MORE_OFFSET \
437 		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
438 		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
439 		} \
440 	while ( 0 )
441 #define unput(c) yyunput( c, (yytext_ptr)  )
442 
443 #ifndef YY_STRUCT_YY_BUFFER_STATE
444 #define YY_STRUCT_YY_BUFFER_STATE
445 struct yy_buffer_state
446 	{
447 	FILE *yy_input_file;
448 
449 	char *yy_ch_buf;		/* input buffer */
450 	char *yy_buf_pos;		/* current position in input buffer */
451 
452 	/* Size of input buffer in bytes, not including room for EOB
453 	 * characters.
454 	 */
455 	int yy_buf_size;
456 
457 	/* Number of characters read into yy_ch_buf, not including EOB
458 	 * characters.
459 	 */
460 	int yy_n_chars;
461 
462 	/* Whether we "own" the buffer - i.e., we know we created it,
463 	 * and can realloc() it to grow it, and should free() it to
464 	 * delete it.
465 	 */
466 	int yy_is_our_buffer;
467 
468 	/* Whether this is an "interactive" input source; if so, and
469 	 * if we're using stdio for input, then we want to use getc()
470 	 * instead of fread(), to make sure we stop fetching input after
471 	 * each newline.
472 	 */
473 	int yy_is_interactive;
474 
475 	/* Whether we're considered to be at the beginning of a line.
476 	 * If so, '^' rules will be active on the next match, otherwise
477 	 * not.
478 	 */
479 	int yy_at_bol;
480 
481     int yy_bs_lineno; /**< The line count. */
482     int yy_bs_column; /**< The column count. */
483 
484 	/* Whether to try to fill the input buffer when we reach the
485 	 * end of it.
486 	 */
487 	int yy_fill_buffer;
488 
489 	int yy_buffer_status;
490 
491 #define YY_BUFFER_NEW 0
492 #define YY_BUFFER_NORMAL 1
493 	/* When an EOF's been seen but there's still some text to process
494 	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
495 	 * shouldn't try reading from the input source any more.  We might
496 	 * still have a bunch of tokens to match, though, because of
497 	 * possible backing-up.
498 	 *
499 	 * When we actually see the EOF, we change the status to "new"
500 	 * (via yyrestart()), so that the user can continue scanning by
501 	 * just pointing yyin at a new input file.
502 	 */
503 #define YY_BUFFER_EOF_PENDING 2
504 
505 	};
506 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
507 
508 /* Stack of input buffers. */
509 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
510 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
511 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
512 
513 /* We provide macros for accessing buffer states in case in the
514  * future we want to put the buffer states in a more general
515  * "scanner state".
516  *
517  * Returns the top of the stack, or NULL.
518  */
519 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
520                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
521                           : NULL)
522 /* Same as previous macro, but useful when we know that the buffer stack is not
523  * NULL or when we need an lvalue. For internal use only.
524  */
525 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
526 
527 /* yy_hold_char holds the character lost when yytext is formed. */
528 static char yy_hold_char;
529 static int yy_n_chars;		/* number of characters read into yy_ch_buf */
530 int yyleng;
531 
532 /* Points to current character in buffer. */
533 static char *yy_c_buf_p = NULL;
534 static int yy_init = 0;		/* whether we need to initialize */
535 static int yy_start = 0;	/* start state number */
536 
537 /* Flag which is used to allow yywrap()'s to do buffer switches
538  * instead of setting up a fresh yyin.  A bit of a hack ...
539  */
540 static int yy_did_buffer_switch_on_eof;
541 
542 void yyrestart ( FILE *input_file  );
543 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer  );
544 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size  );
545 void yy_delete_buffer ( YY_BUFFER_STATE b  );
546 void yy_flush_buffer ( YY_BUFFER_STATE b  );
547 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer  );
548 void yypop_buffer_state ( void );
549 
550 static void yyensure_buffer_stack ( void );
551 static void yy_load_buffer_state ( void );
552 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file  );
553 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
554 
555 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size  );
556 YY_BUFFER_STATE yy_scan_string ( const char *yy_str  );
557 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len  );
558 
559 void *yyalloc ( yy_size_t  );
560 void *yyrealloc ( void *, yy_size_t  );
561 void yyfree ( void *  );
562 
563 #define yy_new_buffer yy_create_buffer
564 #define yy_set_interactive(is_interactive) \
565 	{ \
566 	if ( ! YY_CURRENT_BUFFER ){ \
567         yyensure_buffer_stack (); \
568 		YY_CURRENT_BUFFER_LVALUE =    \
569             yy_create_buffer( yyin, YY_BUF_SIZE ); \
570 	} \
571 	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
572 	}
573 #define yy_set_bol(at_bol) \
574 	{ \
575 	if ( ! YY_CURRENT_BUFFER ){\
576         yyensure_buffer_stack (); \
577 		YY_CURRENT_BUFFER_LVALUE =    \
578             yy_create_buffer( yyin, YY_BUF_SIZE ); \
579 	} \
580 	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
581 	}
582 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
583 
584 /* Begin user sect3 */
585 
586 #define orafce_sql_yywrap() (/*CONSTCOND*/1)
587 #define YY_SKIP_YYWRAP
588 typedef flex_uint8_t YY_CHAR;
589 
590 FILE *yyin = NULL, *yyout = NULL;
591 
592 typedef int yy_state_type;
593 
594 extern int yylineno;
595 int yylineno = 1;
596 
597 extern char *yytext;
598 #ifdef yytext_ptr
599 #undef yytext_ptr
600 #endif
601 #define yytext_ptr yytext
602 
603 static yy_state_type yy_get_previous_state ( void );
604 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  );
605 static int yy_get_next_buffer ( void );
606 static void yynoreturn yy_fatal_error ( const char* msg  );
607 
608 /* Done after the current pattern has been matched and before the
609  * corresponding action - sets up yytext.
610  */
611 #define YY_DO_BEFORE_ACTION \
612 	(yytext_ptr) = yy_bp; \
613 	yyleng = (int) (yy_cp - yy_bp); \
614 	(yy_hold_char) = *yy_cp; \
615 	*yy_cp = '\0'; \
616 	(yy_c_buf_p) = yy_cp;
617 #define YY_NUM_RULES 53
618 #define YY_END_OF_BUFFER 54
619 /* This struct is not used in this scanner,
620    but its presence is necessary. */
621 struct yy_trans_info
622 	{
623 	flex_int32_t yy_verify;
624 	flex_int32_t yy_nxt;
625 	};
626 static const flex_int16_t yy_accept[155] =
627     {   0,
628         0,    0,   13,   13,    0,    0,    0,    0,   12,   12,
629         0,    0,    0,    0,    0,    0,   54,   52,    1,    1,
630        44,   38,   52,   43,   20,   43,   43,   43,   43,   46,
631        43,   51,   51,   51,   51,   51,   13,   10,    6,    6,
632         7,    7,   41,   39,   12,   17,   26,   26,   22,   31,
633        25,   22,   35,   35,   37,    1,   44,   32,   45,   33,
634         2,   47,    3,   47,   46,   49,   42,   51,    9,   21,
635        19,   16,   13,   10,   10,   11,    6,    8,    5,    4,
636        41,   40,   12,   17,   17,   18,   26,   22,   22,   24,
637        23,   27,   28,   27,   25,   35,   34,   36,   33,    2,
638 
639         2,    3,   47,   50,   48,   10,   15,   11,    0,    4,
640        17,   14,   18,    0,   22,   30,   23,    0,   28,   29,
641        36,    0,    0,    0,    0,    0,    0,    0,    0,    0,
642         0,    0,    0,    0,    0,    0,   28,   29,    0,    0,
643         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
644         0,    0,    0,    0
645     } ;
646 
647 static const YY_CHAR yy_ec[256] =
648     {   0,
649         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
650         1,    2,    4,    1,    1,    1,    1,    1,    1,    1,
651         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
652         1,    2,    5,    6,    5,    7,    8,    5,    9,   10,
653        10,   11,   12,   10,   13,   14,   15,   16,   16,   16,
654        16,   16,   16,   16,   16,   17,   17,   18,   10,    8,
655         8,    8,    5,    5,   19,   20,   19,   19,   21,   19,
656        22,   22,   22,   22,   22,   22,   22,   23,   22,   22,
657        22,   22,   22,   22,   22,   22,   22,   24,   22,   22,
658        10,   25,   10,    8,   22,    5,   19,   20,   19,   19,
659 
660        21,   19,   22,   22,   22,   22,   22,   22,   22,   23,
661        22,   22,   22,   22,   22,   22,   22,   22,   22,   26,
662        22,   22,    1,    5,    1,    5,    1,   22,   22,   22,
663        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
664        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
665        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
666        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
667        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
668        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
669        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
670 
671        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
672        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
673        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
674        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
675        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
676        22,   22,   22,   22,   22
677     } ;
678 
679 static const YY_CHAR yy_meta[27] =
680     {   0,
681         1,    2,    3,    3,    4,    5,    6,    4,    7,    1,
682         8,    4,    9,    1,    8,   10,   10,    1,   11,   11,
683        11,   12,   12,   12,   13,   12
684     } ;
685 
686 static const flex_int16_t yy_base[193] =
687     {   0,
688         0,    0,  201,  200,   22,   33,  202,  201,  197,  196,
689        33,   40,  195,  190,   25,   44,  198,  711,   50,   53,
690         0,  711,   43,    0,  711,  711,  184,   23,  185,   52,
691       177,    0,  185,  184,  183,  178,    0,   72,    0,    0,
692        52,  175,    0,  179,    0,   84,    0,    0,   96,   45,
693         0,    0,    0,    0,  177,   75,    0,  711,   64,  176,
694       105,   73,    0,   75,    0,  109,  711,    0,  711,  711,
695       711,  711,    0,    0,   93,  169,    0,   92,  711,    0,
696         0,  711,    0,    0,   95,  116,    0,  110,  102,  711,
697       101,  711,   96,    0,    0,    0,  711,   94,   88,    0,
698 
699       122,    0,  107,   66,  115,  127,  711,   80,  139,    0,
700       135,  711,   71,  151,  136,  711,   59,  163,   54,    0,
701        57,  135,  175,  187,  137,  199,  153,  211,  223,  138,
702       235,  155,  247,  259,  159,  271,  711,  711,  157,  160,
703         0,   49,  283,  159,  161,    0,   18,  295,  177,  162,
704         0,   16,  307,  711,  320,  333,  346,  359,  372,  385,
705       398,  408,  412,  419,  431,  444,  457,  470,  483,  495,
706       508,  521,  529,  536,  548,  558,  566,  572,  580,  588,
707       588,  594,  606,  619,  632,  636,  647,  659,  668,  680,
708       689,  701
709 
710     } ;
711 
712 static const flex_int16_t yy_def[193] =
713     {   0,
714       154,    1,  155,  155,  156,  156,  157,  157,  158,  158,
715       159,  159,  160,  160,  161,  161,  154,  154,  154,  154,
716       162,  154,  163,  162,  154,  154,  162,  154,  162,  154,
717       154,  164,  164,  164,  164,  164,  165,  154,  166,  166,
718       154,  154,  167,  154,  168,  154,  169,  169,  154,  170,
719       171,   49,  172,  172,  173,  154,  162,  154,  154,  174,
720       175,  154,  176,  154,   30,  154,  154,  164,  154,  154,
721       154,  154,  165,   38,  177,  154,  166,  154,  154,  178,
722       167,  154,  168,   46,  179,  154,  169,   49,  180,  154,
723       154,  154,  154,  181,  171,  172,  154,  182,  174,  175,
724 
725       175,  176,  154,  154,  154,  177,  154,  154,  183,  178,
726       179,  154,  154,  184,  180,  154,  154,  185,  154,  186,
727       182,  187,  183,  183,  188,  183,  189,  184,  184,  190,
728       184,  191,  185,  185,  192,  185,  154,  154,  187,  188,
729       140,  154,  183,  189,  190,  145,  154,  184,  191,  192,
730       150,  154,  185,    0,  154,  154,  154,  154,  154,  154,
731       154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
732       154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
733       154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
734       154,  154
735 
736     } ;
737 
738 static const flex_int16_t yy_nxt[738] =
739     {   0,
740        18,   19,   20,   19,   21,   22,   23,   24,   25,   26,
741        24,   24,   27,   28,   29,   30,   30,   31,   32,   33,
742        34,   32,   35,   36,   18,   36,   40,   54,  132,   40,
743       127,   55,   41,   40,   40,   48,   42,   40,   62,   62,
744        40,   49,   48,   41,   40,   40,   54,   42,   49,   58,
745        55,   56,   56,   56,   56,   56,   56,   50,   59,   59,
746        93,  122,   78,   97,   50,   64,   79,   65,   65,  137,
747        94,  132,   66,   74,   75,   75,   56,   56,   56,   59,
748        59,  105,  105,  127,   76,   84,   85,   85,   62,   62,
749       103,  103,  122,   66,   58,   66,   86,   88,   89,   89,
750 
751        97,  107,   78,  112,   90,  108,   79,  113,   91,  101,
752       116,  119,  101,  118,  117,  101,  101,  101,  154,  101,
753       104,  104,  103,  103,  105,  105,  101,   66,  114,  101,
754       105,  105,  101,  101,  101,  107,  101,  140,  140,  108,
755       124,  125,  125,  112,  116,  107,  112,  113,  117,  142,
756       147,  126,  129,  130,  130,  145,  145,  150,  150,  140,
757       140,  145,  145,  131,  134,  135,  135,  116,  107,  112,
758       116,  152,  142,  147,  152,  136,  124,  125,  125,  150,
759       150,  109,   58,   97,   82,   80,   72,  126,  124,  125,
760       125,   71,   70,   69,   67,   63,   61,  154,   52,  126,
761 
762       124,  125,  125,   52,   46,   46,   44,   44,   38,   38,
763       154,  143,  129,  130,  130,  154,  154,  154,  154,  154,
764       154,  154,  154,  131,  129,  130,  130,  154,  154,  154,
765       154,  154,  154,  154,  154,  131,  129,  130,  130,  154,
766       154,  154,  154,  154,  154,  154,  154,  148,  134,  135,
767       135,  154,  154,  154,  154,  154,  154,  154,  154,  136,
768       134,  135,  135,  154,  154,  154,  154,  154,  154,  154,
769       154,  136,  134,  135,  135,  154,  154,  154,  154,  154,
770       154,  154,  154,  153,  124,  125,  125,  154,  154,  154,
771       154,  154,  154,  154,  154,  143,  129,  130,  130,  154,
772 
773       154,  154,  154,  154,  154,  154,  154,  148,  134,  135,
774       135,  154,  154,  154,  154,  154,  154,  154,  154,  153,
775        37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
776        37,   37,   37,   39,   39,   39,   39,   39,   39,   39,
777        39,   39,   39,   39,   39,   39,   43,   43,   43,   43,
778        43,   43,   43,   43,   43,   43,   43,   43,   43,   45,
779        45,   45,   45,   45,   45,   45,   45,   45,   45,   45,
780        45,   45,   47,   47,   47,   47,   47,   47,   47,   47,
781        47,   47,   47,   47,   47,   51,   51,   51,   51,   51,
782        51,   51,   51,   51,   51,   51,   51,   51,   53,   53,
783 
784        53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
785        53,   57,  154,  154,  154,   57,   57,   60,  154,  154,
786       154,   60,   60,   60,   68,  154,  154,  154,   68,   68,
787        68,   73,   73,   73,   73,   73,   73,  154,   73,   73,
788        73,   73,   73,   73,   77,   77,   77,   77,   77,   77,
789        77,  154,   77,   77,   77,   77,   77,   81,   81,   81,
790        81,  154,   81,   81,   81,   81,   81,   81,   81,   81,
791        83,   83,   83,   83,   83,   83,  154,   83,   83,   83,
792        83,   83,   83,   87,   87,   87,   87,   87,   87,  154,
793        87,   87,   87,   87,   87,   92,   92,   92,   92,   92,
794 
795        92,   92,   92,   92,   92,   92,   92,   92,   95,   95,
796        95,   95,   95,   95,  154,   95,   95,   95,   95,   95,
797        95,   96,   96,   96,   96,   96,  154,   96,   96,   96,
798        96,   96,   96,   96,   98,  154,  154,  154,  154,   98,
799        98,   99,  154,  154,  154,   99,   99,   99,  100,  100,
800       154,  100,  100,  100,  100,  100,  100,  100,  100,  100,
801       100,  102,  154,  154,  154,  102,  102,  106,  106,  154,
802       154,  154,  106,  154,  106,  110,  154,  154,  154,  110,
803       110,  111,  111,  154,  154,  154,  111,  154,  111,  115,
804       115,  154,  154,  154,  115,  154,  115,  120,  120,  121,
805 
806       154,  154,  154,  121,  121,  121,  123,  123,  123,  123,
807       123,  123,  123,  123,  123,  123,  123,  123,  123,  128,
808       128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
809       128,  128,  133,  133,  133,  133,  133,  133,  133,  133,
810       133,  133,  133,  133,  133,  138,  138,  139,  139,  139,
811       139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
812       141,  141,  154,  154,  154,  141,  154,  141,  144,  144,
813       144,  144,  144,  144,  144,  144,  144,  144,  144,  144,
814       144,  146,  146,  154,  154,  154,  146,  154,  146,  149,
815       149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
816 
817       149,  149,  151,  151,  154,  154,  154,  151,  154,  151,
818        17,  154,  154,  154,  154,  154,  154,  154,  154,  154,
819       154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
820       154,  154,  154,  154,  154,  154,  154
821     } ;
822 
823 static const flex_int16_t yy_chk[738] =
824     {   0,
825         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
826         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
827         1,    1,    1,    1,    1,    1,    5,   15,  152,    5,
828       147,   15,    5,    5,    5,   11,    5,    6,   28,   28,
829         6,   11,   12,    6,    6,    6,   16,    6,   12,   23,
830        16,   19,   19,   19,   20,   20,   20,   11,   23,   23,
831        50,  142,   41,  121,   12,   30,   41,   30,   30,  119,
832        50,  117,   30,   38,   38,   38,   56,   56,   56,   59,
833        59,  104,  104,  113,   38,   46,   46,   46,   62,   62,
834        64,   64,  108,   62,   99,   64,   46,   49,   49,   49,
835 
836        98,   75,   78,   85,   49,   75,   78,   85,   49,   61,
837        89,   93,   61,   91,   89,   61,   61,   61,   88,   61,
838        66,   66,  103,  103,   66,   66,  101,  103,   86,  101,
839       105,  105,  101,  101,  101,  106,  101,  122,  122,  106,
840       109,  109,  109,  111,  115,  125,  130,  111,  115,  125,
841       130,  109,  114,  114,  114,  127,  127,  132,  132,  139,
842       139,  144,  144,  114,  118,  118,  118,  135,  140,  145,
843       150,  135,  140,  145,  150,  118,  123,  123,  123,  149,
844       149,   76,   60,   55,   44,   42,   36,  123,  124,  124,
845       124,   35,   34,   33,   31,   29,   27,   17,   14,  124,
846 
847       126,  126,  126,   13,   10,    9,    8,    7,    4,    3,
848         0,  126,  128,  128,  128,    0,    0,    0,    0,    0,
849         0,    0,    0,  128,  129,  129,  129,    0,    0,    0,
850         0,    0,    0,    0,    0,  129,  131,  131,  131,    0,
851         0,    0,    0,    0,    0,    0,    0,  131,  133,  133,
852       133,    0,    0,    0,    0,    0,    0,    0,    0,  133,
853       134,  134,  134,    0,    0,    0,    0,    0,    0,    0,
854         0,  134,  136,  136,  136,    0,    0,    0,    0,    0,
855         0,    0,    0,  136,  143,  143,  143,    0,    0,    0,
856         0,    0,    0,    0,    0,  143,  148,  148,  148,    0,
857 
858         0,    0,    0,    0,    0,    0,    0,  148,  153,  153,
859       153,    0,    0,    0,    0,    0,    0,    0,    0,  153,
860       155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
861       155,  155,  155,  156,  156,  156,  156,  156,  156,  156,
862       156,  156,  156,  156,  156,  156,  157,  157,  157,  157,
863       157,  157,  157,  157,  157,  157,  157,  157,  157,  158,
864       158,  158,  158,  158,  158,  158,  158,  158,  158,  158,
865       158,  158,  159,  159,  159,  159,  159,  159,  159,  159,
866       159,  159,  159,  159,  159,  160,  160,  160,  160,  160,
867       160,  160,  160,  160,  160,  160,  160,  160,  161,  161,
868 
869       161,  161,  161,  161,  161,  161,  161,  161,  161,  161,
870       161,  162,    0,    0,    0,  162,  162,  163,    0,    0,
871         0,  163,  163,  163,  164,    0,    0,    0,  164,  164,
872       164,  165,  165,  165,  165,  165,  165,    0,  165,  165,
873       165,  165,  165,  165,  166,  166,  166,  166,  166,  166,
874       166,    0,  166,  166,  166,  166,  166,  167,  167,  167,
875       167,    0,  167,  167,  167,  167,  167,  167,  167,  167,
876       168,  168,  168,  168,  168,  168,    0,  168,  168,  168,
877       168,  168,  168,  169,  169,  169,  169,  169,  169,    0,
878       169,  169,  169,  169,  169,  170,  170,  170,  170,  170,
879 
880       170,  170,  170,  170,  170,  170,  170,  170,  171,  171,
881       171,  171,  171,  171,    0,  171,  171,  171,  171,  171,
882       171,  172,  172,  172,  172,  172,    0,  172,  172,  172,
883       172,  172,  172,  172,  173,    0,    0,    0,    0,  173,
884       173,  174,    0,    0,    0,  174,  174,  174,  175,  175,
885         0,  175,  175,  175,  175,  175,  175,  175,  175,  175,
886       175,  176,    0,    0,    0,  176,  176,  177,  177,    0,
887         0,    0,  177,    0,  177,  178,    0,    0,    0,  178,
888       178,  179,  179,    0,    0,    0,  179,    0,  179,  180,
889       180,    0,    0,    0,  180,    0,  180,  181,  181,  182,
890 
891         0,    0,    0,  182,  182,  182,  183,  183,  183,  183,
892       183,  183,  183,  183,  183,  183,  183,  183,  183,  184,
893       184,  184,  184,  184,  184,  184,  184,  184,  184,  184,
894       184,  184,  185,  185,  185,  185,  185,  185,  185,  185,
895       185,  185,  185,  185,  185,  186,  186,  187,  187,  187,
896       187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
897       188,  188,    0,    0,    0,  188,    0,  188,  189,  189,
898       189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
899       189,  190,  190,    0,    0,    0,  190,    0,  190,  191,
900       191,  191,  191,  191,  191,  191,  191,  191,  191,  191,
901 
902       191,  191,  192,  192,    0,    0,    0,  192,    0,  192,
903       154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
904       154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
905       154,  154,  154,  154,  154,  154,  154
906     } ;
907 
908 static yy_state_type yy_last_accepting_state;
909 static char *yy_last_accepting_cpos;
910 
911 extern int yy_flex_debug;
912 int yy_flex_debug = 0;
913 
914 /* The intent behind this definition is that it'll catch
915  * any uses of REJECT which flex missed.
916  */
917 #define REJECT reject_used_but_not_detected
918 #define yymore() yymore_used_but_not_detected
919 #define YY_MORE_ADJ 0
920 #define YY_RESTORE_YY_MORE_OFFSET
921 char *yytext;
922 #line 1 "sqlscan.l"
923 #line 2 "sqlscan.l"
924 /*
925 ** A scanner for EMP-style numeric ranges
926 */
927 
928 #include "postgres.h"
929 
930 #include "parser/gramparse.h"
931 /* Not needed now that this file is compiled as part of gram.y */
932 /* #include "parser/parse.h" */
933 #include "parser/scansup.h"
934 #include "mb/pg_wchar.h"
935 
936 #include "parse_keyword.h"
937 
938 /* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
939 #undef fprintf
940 #define fprintf(file, fmt, msg)  fprintf_to_ereport(fmt, msg)
941 
942 static void
fprintf_to_ereport(const char * fmt,const char * msg)943 fprintf_to_ereport(const char *fmt, const char *msg)
944 {
945 	ereport(ERROR, (errmsg_internal("%s", msg)));
946 }
947 
948 static int		xcdepth = 0;	/* depth of nesting in slash-star comments */
949 static char    *dolqstart;      /* current $foo$ quote start string */
950 static bool extended_string = false;
951 
952 
953 /* No reason to constrain amount of data slurped */
954 #define YY_READ_BUF_SIZE 16777216
955 
956 /* Handles to the buffer that the lexer uses internally */
957 
958 
959 static YY_BUFFER_STATE scanbufhandle;
960 
961 #define SET_YYLLOC()  (orafce_sql_yylval.val.lloc = yytext - scanbuf)
962 
963 /* Handles to the buffer that the lexer uses internally */
964 static char *scanbuf;
965 
966 /* flex 2.5.4 doesn't bother with a decl for this */
967 
968 int orafce_sql_yylex(void);
969 
970 void orafce_sql_scanner_init(const char *str);
971 void orafce_sql_scanner_finish(void);
972 
973 /*
974  * literalbuf is used to accumulate literal values when multiple rules
975  * are needed to parse a single literal.  Call startlit to reset buffer
976  * to empty, addlit to add text.  Note that the buffer is palloc'd and
977  * starts life afresh on every parse cycle.
978  */
979 static char	   *literalbuf;		/* expandable buffer */
980 static int		literallen;		/* actual current length */
981 static int		literalalloc;	/* current allocated buffer size */
982 
983 #define startlit()  (literalbuf[0] = '\0', literallen = 0)
984 static void addlit(char *ytext, int yleng);
985 static void addlitchar(unsigned char ychar);
986 static char *litbufdup(void);
987 
988 static int	lexer_errposition(void);
989 
990 /*
991  * Each call to yylex must set yylloc to the location of the found token
992  * (expressed as a byte offset from the start of the input text).
993  * When we parse a token that requires multiple lexer rules to process,
994  * this should be done in the first such rule, else yylloc will point
995  * into the middle of the token.
996  */
997 
998 /* Handles to the buffer that the lexer uses internally */
999 static char *scanbuf;
1000 
1001 static unsigned char unescape_single_char(unsigned char c);
1002 
1003 #ifndef _pg_mbstrlen_with_len
1004 #define _pg_mbstrlen_with_len(buf,loc) 	pg_mbstrlen_with_len(buf,loc)
1005 #endif
1006 
1007 #line 1007 "sqlscan.c"
1008 #define YY_NO_INPUT 1
1009 /*
1010  * OK, here is a short description of lex/flex rules behavior.
1011  * The longest pattern which matches an input string is always chosen.
1012  * For equal-length patterns, the first occurring in the rules list is chosen.
1013  * INITIAL is the starting state, to which all non-conditional rules apply.
1014  * Exclusive states change parsing rules while the state is active.  When in
1015  * an exclusive state, only those rules defined for that state apply.
1016  *
1017  * We use exclusive states for quoted strings, extended comments,
1018  * and to eliminate parsing troubles for numeric strings.
1019  * Exclusive states:
1020  *  <xb> bit string literal
1021  *  <xc> extended C-style comments
1022  *  <xd> delimited identifiers (double-quoted identifiers)
1023  *  <xh> hexadecimal numeric string
1024  *  <xq> standard quoted strings
1025  *  <xe> extended quoted strings (support backslash escape sequences)
1026  *  <xdolq> $foo$ quoted strings
1027  */
1028 
1029 /*
1030  * In order to make the world safe for Windows and Mac clients as well as
1031  * Unix ones, we accept either \n or \r as a newline.  A DOS-style \r\n
1032  * sequence will be seen as two successive newlines, but that doesn't cause
1033  * any problems.  Comments that start with -- and extend to the next
1034  * newline are treated as equivalent to a single whitespace character.
1035  *
1036  * NOTE a fine point: if there is no newline following --, we will absorb
1037  * everything to the end of the input as a comment.  This is correct.  Older
1038  * versions of Postgres failed to recognize -- as a comment if the input
1039  * did not end with a newline.
1040  *
1041  * XXX perhaps \f (formfeed) should be treated as a newline as well?
1042  *
1043  * XXX if you change the set of whitespace characters, fix scanner_isspace()
1044  * to agree, and see also the plpgsql lexer.
1045  */
1046 /*
1047  * SQL requires at least one newline in the whitespace separating
1048  * string literals that are to be concatenated.  Silly, but who are we
1049  * to argue?  Note that {whitespace_with_newline} should not have * after
1050  * it, whereas {whitespace} should generally have a * after it...
1051  */
1052 /*
1053  * To ensure that {quotecontinue} can be scanned without having to back up
1054  * if the full pattern isn't matched, we include trailing whitespace in
1055  * {quotestop}.  This matches all cases where {quotecontinue} fails to match,
1056  * except for {quote} followed by whitespace and just one "-" (not two,
1057  * which would start a {comment}).  To cover that we have {quotefail}.
1058  * The actions for {quotestop} and {quotefail} must throw back characters
1059  * beyond the quote proper.
1060  */
1061 /* Bit string
1062  * It is tempting to scan the string for only those characters
1063  * which are allowed. However, this leads to silently swallowed
1064  * characters if illegal characters are included in the string.
1065  * For example, if xbinside is [01] then B'ABCD' is interpreted
1066  * as a zero-length string, and the ABCD' is lost!
1067  * Better to pass the string forward and let the input routines
1068  * validate the contents.
1069  */
1070 /* Hexadecimal number */
1071 /* National character */
1072 /* Quoted string that allows backslash escapes */
1073 /* Extended quote
1074  * xqdouble implements embedded quote, ''''
1075  */
1076 /* $foo$ style quotes ("dollar quoting")
1077  * The quoted string starts with $foo$ where "foo" is an optional string
1078  * in the form of an identifier, except that it may not contain "$",
1079  * and extends to the first occurrence of an identical string.
1080  * There is *no* processing of the quoted text.
1081  *
1082  * {dolqfailed} is an error rule to avoid scanner backup when {dolqdelim}
1083  * fails to match its trailing "$".
1084  */
1085 /* Double quote
1086  * Allows embedded spaces and other special characters into identifiers.
1087  */
1088 /* C-style comments
1089  *
1090  * The "extended comment" syntax closely resembles allowable operator syntax.
1091  * The tricky part here is to get lex to recognize a string starting with
1092  * slash-star as a comment, when interpreting it as an operator would produce
1093  * a longer match --- remember lex will prefer a longer match!  Also, if we
1094  * have something like plus-slash-star, lex will think this is a 3-character
1095  * operator whereas we want to see it as a + operator and a comment start.
1096  * The solution is two-fold:
1097  * 1. append {op_chars}* to xcstart so that it matches as much text as
1098  *    {operator} would. Then the tie-breaker (first matching rule of same
1099  *    length) ensures xcstart wins.  We put back the extra stuff with yyless()
1100  *    in case it contains a star-slash that should terminate the comment.
1101  * 2. In the operator rule, check for slash-star within the operator, and
1102  *    if found throw it back with yyless().  This handles the plus-slash-star
1103  *    problem.
1104  * Dash-dash comments have similar interactions with the operator rule.
1105  */
1106 /*
1107  * "self" is the set of chars that should be returned as single-character
1108  * tokens.  "op_chars" is the set of chars that can make up "Op" tokens,
1109  * which can be one or more characters long (but if a single-char token
1110  * appears in the "self" set, it is not to be returned as an Op).  Note
1111  * that the sets overlap, but each has some chars that are not in the other.
1112  *
1113  * If you change either set, adjust the character lists appearing in the
1114  * rule for "operator"!
1115  */
1116 /* we no longer allow unary minus in numbers.
1117  * instead we pass it separately to parser. there it gets
1118  * coerced via doNegate() -- Leon aug 20 1999
1119  *
1120  * {realfail1} and {realfail2} are added to prevent the need for scanner
1121  * backup when the {real} rule fails to match completely.
1122  */
1123 /*
1124  * Dollar quoted strings are totally opaque, and no escaping is done on them.
1125  * Other quoted strings must allow some special characters such as single-quote
1126  *  and newline.
1127  * Embedded single-quotes are implemented both in the SQL standard
1128  *  style of two adjacent single quotes "''" and in the Postgres/Java style
1129  *  of escaped-quote "\'".
1130  * Other embedded escaped characters are matched explicitly and the leading
1131  *  backslash is dropped from the string.
1132  * Note that xcstart must appear before operator, as explained above!
1133  *  Also whitespace (comment) must appear before operator.
1134  */
1135 #line 1135 "sqlscan.c"
1136 
1137 #define INITIAL 0
1138 #define xb 1
1139 #define xc 2
1140 #define xd 3
1141 #define xh 4
1142 #define xe 5
1143 #define xq 6
1144 #define xdolq 7
1145 
1146 #ifndef YY_NO_UNISTD_H
1147 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1148  * down here because we want the user's section 1 to have been scanned first.
1149  * The user has a chance to override it with an option.
1150  */
1151 #include <unistd.h>
1152 #endif
1153 
1154 #ifndef YY_EXTRA_TYPE
1155 #define YY_EXTRA_TYPE void *
1156 #endif
1157 
1158 static int yy_init_globals ( void );
1159 
1160 /* Accessor methods to globals.
1161    These are made visible to non-reentrant scanners for convenience. */
1162 
1163 int yylex_destroy ( void );
1164 
1165 int yyget_debug ( void );
1166 
1167 void yyset_debug ( int debug_flag  );
1168 
1169 YY_EXTRA_TYPE yyget_extra ( void );
1170 
1171 void yyset_extra ( YY_EXTRA_TYPE user_defined  );
1172 
1173 FILE *yyget_in ( void );
1174 
1175 void yyset_in  ( FILE * _in_str  );
1176 
1177 FILE *yyget_out ( void );
1178 
1179 void yyset_out  ( FILE * _out_str  );
1180 
1181 			int yyget_leng ( void );
1182 
1183 char *yyget_text ( void );
1184 
1185 int yyget_lineno ( void );
1186 
1187 void yyset_lineno ( int _line_number  );
1188 
1189 /* Macros after this point can all be overridden by user definitions in
1190  * section 1.
1191  */
1192 
1193 #ifndef YY_SKIP_YYWRAP
1194 #ifdef __cplusplus
1195 extern "C" int yywrap ( void );
1196 #else
1197 extern int yywrap ( void );
1198 #endif
1199 #endif
1200 
1201 #ifndef YY_NO_UNPUT
1202 
1203 #endif
1204 
1205 #ifndef yytext_ptr
1206 static void yy_flex_strncpy ( char *, const char *, int );
1207 #endif
1208 
1209 #ifdef YY_NEED_STRLEN
1210 static int yy_flex_strlen ( const char * );
1211 #endif
1212 
1213 #ifndef YY_NO_INPUT
1214 #ifdef __cplusplus
1215 static int yyinput ( void );
1216 #else
1217 static int input ( void );
1218 #endif
1219 
1220 #endif
1221 
1222 /* Amount of stuff to slurp up with each read. */
1223 #ifndef YY_READ_BUF_SIZE
1224 #ifdef __ia64__
1225 /* On IA-64, the buffer size is 16k, not 8k */
1226 #define YY_READ_BUF_SIZE 16384
1227 #else
1228 #define YY_READ_BUF_SIZE 8192
1229 #endif /* __ia64__ */
1230 #endif
1231 
1232 /* Copy whatever the last rule matched to the standard output. */
1233 #ifndef ECHO
1234 /* This used to be an fputs(), but since the string might contain NUL's,
1235  * we now use fwrite().
1236  */
1237 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
1238 #endif
1239 
1240 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
1241  * is returned in "result".
1242  */
1243 #ifndef YY_INPUT
1244 #define YY_INPUT(buf,result,max_size) \
1245 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1246 		{ \
1247 		int c = '*'; \
1248 		int n; \
1249 		for ( n = 0; n < max_size && \
1250 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1251 			buf[n] = (char) c; \
1252 		if ( c == '\n' ) \
1253 			buf[n++] = (char) c; \
1254 		if ( c == EOF && ferror( yyin ) ) \
1255 			YY_FATAL_ERROR( "input in flex scanner failed" ); \
1256 		result = n; \
1257 		} \
1258 	else \
1259 		{ \
1260 		errno=0; \
1261 		while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
1262 			{ \
1263 			if( errno != EINTR) \
1264 				{ \
1265 				YY_FATAL_ERROR( "input in flex scanner failed" ); \
1266 				break; \
1267 				} \
1268 			errno=0; \
1269 			clearerr(yyin); \
1270 			} \
1271 		}\
1272 \
1273 
1274 #endif
1275 
1276 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1277  * we don't want an extra ';' after the "return" because that will cause
1278  * some compilers to complain about unreachable statements.
1279  */
1280 #ifndef yyterminate
1281 #define yyterminate() return YY_NULL
1282 #endif
1283 
1284 /* Number of entries by which start-condition stack grows. */
1285 #ifndef YY_START_STACK_INCR
1286 #define YY_START_STACK_INCR 25
1287 #endif
1288 
1289 /* Report a fatal error. */
1290 #ifndef YY_FATAL_ERROR
1291 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1292 #endif
1293 
1294 /* end tables serialization structures and prototypes */
1295 
1296 /* Default declaration of generated scanner - a define so the user can
1297  * easily add parameters.
1298  */
1299 #ifndef YY_DECL
1300 #define YY_DECL_IS_OURS 1
1301 
1302 extern int yylex (void);
1303 
1304 #define YY_DECL int yylex (void)
1305 #endif /* !YY_DECL */
1306 
1307 /* Code executed at the beginning of each rule, after yytext and yyleng
1308  * have been set up.
1309  */
1310 #ifndef YY_USER_ACTION
1311 #define YY_USER_ACTION
1312 #endif
1313 
1314 /* Code executed at the end of each rule. */
1315 #ifndef YY_BREAK
1316 #define YY_BREAK /*LINTED*/break;
1317 #endif
1318 
1319 #define YY_RULE_SETUP \
1320 	YY_USER_ACTION
1321 
1322 /** The main scanner function which does all the work.
1323  */
1324 YY_DECL
1325 {
1326 	yy_state_type yy_current_state;
1327 	char *yy_cp, *yy_bp;
1328 	int yy_act;
1329 
1330 	if ( !(yy_init) )
1331 		{
1332 		(yy_init) = 1;
1333 
1334 #ifdef YY_USER_INIT
1335 		YY_USER_INIT;
1336 #endif
1337 
1338 		if ( ! (yy_start) )
1339 			(yy_start) = 1;	/* first start state */
1340 
1341 		if ( ! yyin )
1342 			yyin = stdin;
1343 
1344 		if ( ! yyout )
1345 			yyout = stdout;
1346 
1347 		if ( ! YY_CURRENT_BUFFER ) {
1348 			yyensure_buffer_stack ();
1349 			YY_CURRENT_BUFFER_LVALUE =
1350 				yy_create_buffer( yyin, YY_BUF_SIZE );
1351 		}
1352 
1353 		yy_load_buffer_state(  );
1354 		}
1355 
1356 	{
1357 #line 308 "sqlscan.l"
1358 
1359 
1360 #line 1360 "sqlscan.c"
1361 
1362 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
1363 		{
1364 		yy_cp = (yy_c_buf_p);
1365 
1366 		/* Support of yytext. */
1367 		*yy_cp = (yy_hold_char);
1368 
1369 		/* yy_bp points to the position in yy_ch_buf of the start of
1370 		 * the current run.
1371 		 */
1372 		yy_bp = yy_cp;
1373 
1374 		yy_current_state = (yy_start);
1375 yy_match:
1376 		do
1377 			{
1378 			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1379 			if ( yy_accept[yy_current_state] )
1380 				{
1381 				(yy_last_accepting_state) = yy_current_state;
1382 				(yy_last_accepting_cpos) = yy_cp;
1383 				}
1384 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1385 				{
1386 				yy_current_state = (int) yy_def[yy_current_state];
1387 				if ( yy_current_state >= 155 )
1388 					yy_c = yy_meta[yy_c];
1389 				}
1390 			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1391 			++yy_cp;
1392 			}
1393 		while ( yy_current_state != 154 );
1394 		yy_cp = (yy_last_accepting_cpos);
1395 		yy_current_state = (yy_last_accepting_state);
1396 
1397 yy_find_action:
1398 		yy_act = yy_accept[yy_current_state];
1399 
1400 		YY_DO_BEFORE_ACTION;
1401 
1402 do_action:	/* This label is used only to access EOF actions. */
1403 
1404 		switch ( yy_act )
1405 	{ /* beginning of action switch */
1406 			case 0: /* must back up */
1407 			/* undo the effects of YY_DO_BEFORE_ACTION */
1408 			*yy_cp = (yy_hold_char);
1409 			yy_cp = (yy_last_accepting_cpos);
1410 			yy_current_state = (yy_last_accepting_state);
1411 			goto yy_find_action;
1412 
1413 case 1:
1414 /* rule 1 can match eol */
1415 YY_RULE_SETUP
1416 #line 310 "sqlscan.l"
1417 {
1418 					SET_YYLLOC();
1419 					yylval.val.str = yytext;
1420 					yylval.val.modificator = NULL;
1421 					yylval.val.keycode = -1;
1422 					yylval.val.sep = NULL;
1423 					return X_WHITESPACE;
1424 				}
1425 	YY_BREAK
1426 case 2:
1427 YY_RULE_SETUP
1428 #line 319 "sqlscan.l"
1429 {
1430 					SET_YYLLOC();
1431 					yylval.val.str = yytext;
1432 					yylval.val.modificator = "sc";
1433 					yylval.val.keycode = -1;
1434 					yylval.val.sep = NULL;
1435 					return X_COMMENT;
1436 				}
1437 	YY_BREAK
1438 case 3:
1439 YY_RULE_SETUP
1440 #line 329 "sqlscan.l"
1441 {
1442 					/* Set location in case of syntax error in comment */
1443 					SET_YYLLOC();
1444 					xcdepth = 0;
1445 					BEGIN(xc);
1446 					/* Put back any characters past slash-star; see above */
1447 					startlit();
1448 					addlitchar('/');
1449 					addlitchar('*');
1450 
1451 					yyless(2);
1452 				}
1453 	YY_BREAK
1454 case 4:
1455 YY_RULE_SETUP
1456 #line 342 "sqlscan.l"
1457 {
1458 					xcdepth++;
1459 					/* Put back any characters past slash-star; see above */
1460 					addlitchar('/');
1461 					addlitchar('*');
1462 
1463 					yyless(2);
1464 				}
1465 	YY_BREAK
1466 case 5:
1467 YY_RULE_SETUP
1468 #line 351 "sqlscan.l"
1469 {
1470 					if (xcdepth <= 0)
1471 					{
1472 						BEGIN(INITIAL);
1473 						addlitchar('*');
1474 						addlitchar('/');
1475 
1476 						yylval.val.str = litbufdup();
1477 						yylval.val.modificator = "ec";
1478 						yylval.val.keycode = -1;
1479 						yylval.val.sep = NULL;
1480 						return X_COMMENT;
1481 					}
1482 					else
1483 					{
1484 						xcdepth--;
1485 						addlitchar('*');
1486 						addlitchar('/');
1487 					}
1488 
1489 				}
1490 	YY_BREAK
1491 case 6:
1492 /* rule 6 can match eol */
1493 YY_RULE_SETUP
1494 #line 373 "sqlscan.l"
1495 {
1496 					addlit(yytext, yyleng);
1497 				}
1498 	YY_BREAK
1499 case 7:
1500 YY_RULE_SETUP
1501 #line 377 "sqlscan.l"
1502 {
1503 					addlit(yytext, yyleng);
1504 				}
1505 	YY_BREAK
1506 case 8:
1507 YY_RULE_SETUP
1508 #line 381 "sqlscan.l"
1509 {
1510 					addlit(yytext, yyleng);
1511 				}
1512 	YY_BREAK
1513 case YY_STATE_EOF(xc):
1514 #line 385 "sqlscan.l"
1515 {
1516 					yylval.val.str = litbufdup();
1517 					yylval.val.modificator = "ecu";
1518 					yylval.val.keycode = -1;
1519 					yylval.val.sep = NULL;
1520 					return X_COMMENT;
1521 
1522 				}
1523 	YY_BREAK
1524 case 9:
1525 YY_RULE_SETUP
1526 #line 394 "sqlscan.l"
1527 {
1528 					/* Binary bit type.
1529 					 * At some point we should simply pass the string
1530 					 * forward to the parser and label it there.
1531 					 * In the meantime, place a leading "b" on the string
1532 					 * to mark it for the input routine as a binary string.
1533 					 */
1534 					SET_YYLLOC();
1535 					BEGIN(xb);
1536 					startlit();
1537 					addlitchar('b');
1538 				}
1539 	YY_BREAK
1540 case 10:
1541 /* rule 10 can match eol */
1542 #line 407 "sqlscan.l"
1543 case 11:
1544 /* rule 11 can match eol */
1545 YY_RULE_SETUP
1546 #line 407 "sqlscan.l"
1547 {
1548 					yyless(1);
1549 					BEGIN(INITIAL);
1550 					yylval.val.str = litbufdup();
1551 					yylval.val.modificator = "b";
1552 					yylval.val.keycode = -1;
1553 					yylval.val.sep = NULL;
1554 					return X_NCONST;
1555 				}
1556 	YY_BREAK
1557 case 12:
1558 /* rule 12 can match eol */
1559 #line 417 "sqlscan.l"
1560 case 13:
1561 /* rule 13 can match eol */
1562 YY_RULE_SETUP
1563 #line 417 "sqlscan.l"
1564 {
1565 					addlit(yytext, yyleng);
1566 				}
1567 	YY_BREAK
1568 case 14:
1569 /* rule 14 can match eol */
1570 #line 421 "sqlscan.l"
1571 case 15:
1572 /* rule 15 can match eol */
1573 YY_RULE_SETUP
1574 #line 421 "sqlscan.l"
1575 {
1576 					/* ignore */
1577 				}
1578 	YY_BREAK
1579 case YY_STATE_EOF(xb):
1580 #line 424 "sqlscan.l"
1581 {
1582 					yylval.val.str = litbufdup();
1583 					yylval.val.modificator = "bu";
1584 					yylval.val.keycode = -1;
1585 					yylval.val.sep = NULL;
1586 					return X_NCONST;
1587 				}
1588 	YY_BREAK
1589 case 16:
1590 YY_RULE_SETUP
1591 #line 432 "sqlscan.l"
1592 {
1593 					/* Hexadecimal bit type.
1594 					 * At some point we should simply pass the string
1595 					 * forward to the parser and label it there.
1596 					 * In the meantime, place a leading "x" on the string
1597 					 * to mark it for the input routine as a hex string.
1598 					 */
1599 					SET_YYLLOC();
1600 					BEGIN(xh);
1601 					startlit();
1602 					addlitchar('x');
1603 				}
1604 	YY_BREAK
1605 case 17:
1606 /* rule 17 can match eol */
1607 #line 445 "sqlscan.l"
1608 case 18:
1609 /* rule 18 can match eol */
1610 YY_RULE_SETUP
1611 #line 445 "sqlscan.l"
1612 {
1613 					yyless(1);
1614 					BEGIN(INITIAL);
1615 					yylval.val.str = litbufdup();
1616 					yylval.val.modificator = "x";
1617 					yylval.val.keycode = -1;
1618 					yylval.val.sep = NULL;
1619 					return X_NCONST;
1620 				}
1621 	YY_BREAK
1622 case YY_STATE_EOF(xh):
1623 #line 454 "sqlscan.l"
1624 {
1625 					yylval.val.str = litbufdup();
1626 					yylval.val.modificator = "xu";
1627 					yylval.val.keycode = -1;
1628 					yylval.val.sep = NULL;
1629 					return X_NCONST;
1630 				}
1631 	YY_BREAK
1632 case 19:
1633 YY_RULE_SETUP
1634 #line 462 "sqlscan.l"
1635 {
1636 					/* National character.
1637 					 * We will pass this along as a normal character string,
1638 					 * but preceded with an internally-generated "NCHAR".
1639 					 */
1640 					const char *keyword;
1641 					int		keycode;
1642 
1643 					SET_YYLLOC();
1644 					yyless(1);				/* eat only 'n' this time */
1645 					/* nchar had better be a keyword! */
1646 					keyword = orafce_scan_keyword("nchar", &keycode);
1647 					Assert(keyword != NULL);
1648 					yylval.val.str = (char*) keyword;
1649 					yylval.val.keycode = keycode;
1650 					yylval.val.modificator = NULL;
1651 					yylval.val.sep = NULL;
1652 					return X_KEYWORD;
1653 				}
1654 	YY_BREAK
1655 case 20:
1656 YY_RULE_SETUP
1657 #line 482 "sqlscan.l"
1658 {
1659 					SET_YYLLOC();
1660 					BEGIN(xq);
1661 					extended_string = false;
1662 					startlit();
1663 				}
1664 	YY_BREAK
1665 case 21:
1666 YY_RULE_SETUP
1667 #line 488 "sqlscan.l"
1668 {
1669 					SET_YYLLOC();
1670 					BEGIN(xe);
1671 					extended_string = true;
1672 					startlit();
1673 				}
1674 	YY_BREAK
1675 case 22:
1676 /* rule 22 can match eol */
1677 #line 495 "sqlscan.l"
1678 case 23:
1679 /* rule 23 can match eol */
1680 YY_RULE_SETUP
1681 #line 495 "sqlscan.l"
1682 {
1683 					yyless(1);
1684 					BEGIN(INITIAL);
1685 					yylval.val.str = litbufdup();
1686 					yylval.val.modificator = extended_string ? "es" : "qs";
1687 					yylval.val.keycode = -1;
1688 					yylval.val.sep = NULL;
1689 					return X_SCONST;
1690 				}
1691 	YY_BREAK
1692 case 24:
1693 YY_RULE_SETUP
1694 #line 504 "sqlscan.l"
1695 {
1696 					addlitchar('\'');
1697 				}
1698 	YY_BREAK
1699 case 25:
1700 /* rule 25 can match eol */
1701 YY_RULE_SETUP
1702 #line 507 "sqlscan.l"
1703 {
1704 					addlit(yytext, yyleng);
1705 				}
1706 	YY_BREAK
1707 case 26:
1708 /* rule 26 can match eol */
1709 YY_RULE_SETUP
1710 #line 510 "sqlscan.l"
1711 {
1712 					addlit(yytext, yyleng);
1713 				}
1714 	YY_BREAK
1715 case 27:
1716 /* rule 27 can match eol */
1717 YY_RULE_SETUP
1718 #line 513 "sqlscan.l"
1719 {
1720 					addlitchar(unescape_single_char(yytext[1]));
1721 				}
1722 	YY_BREAK
1723 case 28:
1724 YY_RULE_SETUP
1725 #line 516 "sqlscan.l"
1726 {
1727 					unsigned char c = strtoul(yytext+1, NULL, 8);
1728 
1729 					addlitchar(c);
1730 				}
1731 	YY_BREAK
1732 case 29:
1733 YY_RULE_SETUP
1734 #line 521 "sqlscan.l"
1735 {
1736 					unsigned char c = strtoul(yytext+2, NULL, 16);
1737 
1738 					addlitchar(c);
1739 				}
1740 	YY_BREAK
1741 case 30:
1742 /* rule 30 can match eol */
1743 YY_RULE_SETUP
1744 #line 526 "sqlscan.l"
1745 {
1746 					/* ignore */
1747 				}
1748 	YY_BREAK
1749 case 31:
1750 YY_RULE_SETUP
1751 #line 529 "sqlscan.l"
1752 {
1753 					/* This is only needed for \ just before EOF */
1754 					addlitchar(yytext[0]);
1755 				}
1756 	YY_BREAK
1757 case YY_STATE_EOF(xq):
1758 case YY_STATE_EOF(xe):
1759 #line 533 "sqlscan.l"
1760 {
1761 					yylval.val.str = litbufdup();
1762 					yylval.val.modificator = extended_string ? "esu" : "qsu";
1763 					yylval.val.keycode = -1;
1764 					yylval.val.sep = NULL;
1765 					return X_SCONST;
1766 				}
1767 	YY_BREAK
1768 case 32:
1769 YY_RULE_SETUP
1770 #line 541 "sqlscan.l"
1771 {
1772 					SET_YYLLOC();
1773 					dolqstart = pstrdup(yytext);
1774 					BEGIN(xdolq);
1775 					startlit();
1776 				}
1777 	YY_BREAK
1778 case 33:
1779 YY_RULE_SETUP
1780 #line 547 "sqlscan.l"
1781 {
1782 					/* throw back all but the initial "$" */
1783 					yyless(1);
1784 					/* and treat it as {other} */
1785 					yylval.val.str = yytext;
1786 					yylval.val.modificator = "dolqf";
1787 					yylval.val.keycode = -1;
1788 					yylval.val.sep = NULL;
1789 					return X_OTHERS;
1790 				}
1791 	YY_BREAK
1792 case 34:
1793 YY_RULE_SETUP
1794 #line 557 "sqlscan.l"
1795 {
1796 					if (strcmp(yytext, dolqstart) == 0)
1797 					{
1798 						yylval.val.sep = dolqstart;
1799 						yylval.val.modificator = "dolq";
1800 						BEGIN(INITIAL);
1801 						yylval.val.str = litbufdup();
1802 						yylval.val.keycode = -1;
1803 						return X_SCONST;
1804 					}
1805 					else
1806 					{
1807 						/*
1808 						 * When we fail to match $...$ to dolqstart, transfer
1809 						 * the $... part to the output, but put back the final
1810 						 * $ for rescanning.  Consider $delim$...$junk$delim$
1811 						 */
1812 						addlit(yytext, yyleng-1);
1813 						yyless(yyleng-1);
1814 					}
1815 				}
1816 	YY_BREAK
1817 case 35:
1818 /* rule 35 can match eol */
1819 YY_RULE_SETUP
1820 #line 578 "sqlscan.l"
1821 {
1822 					addlit(yytext, yyleng);
1823 				}
1824 	YY_BREAK
1825 case 36:
1826 YY_RULE_SETUP
1827 #line 581 "sqlscan.l"
1828 {
1829 					addlit(yytext, yyleng);
1830 				}
1831 	YY_BREAK
1832 case 37:
1833 YY_RULE_SETUP
1834 #line 584 "sqlscan.l"
1835 {
1836 					/* This is only needed for inside the quoted text */
1837 					addlitchar(yytext[0]);
1838 				}
1839 	YY_BREAK
1840 case YY_STATE_EOF(xdolq):
1841 #line 588 "sqlscan.l"
1842 {
1843 					yylval.val.sep = dolqstart;
1844 					yylval.val.modificator = "dolqu";
1845 					yylval.val.str = litbufdup();
1846 					yylval.val.keycode = -1;
1847 					yylval.val.sep = NULL;
1848 					return X_SCONST;
1849 				}
1850 	YY_BREAK
1851 case 38:
1852 YY_RULE_SETUP
1853 #line 597 "sqlscan.l"
1854 {
1855 					SET_YYLLOC();
1856 					BEGIN(xd);
1857 					startlit();
1858 				}
1859 	YY_BREAK
1860 case 39:
1861 YY_RULE_SETUP
1862 #line 602 "sqlscan.l"
1863 {
1864 					char		   *ident;
1865 
1866 					BEGIN(INITIAL);
1867 					if (literallen == 0)
1868 						yyerror(NULL, "zero-length delimited identifier");
1869 					ident = litbufdup();
1870 					if (literallen >= NAMEDATALEN)
1871 						truncate_identifier(ident, literallen, true);
1872 					yylval.val.modificator = "dq";
1873 					yylval.val.str = ident;
1874 					yylval.val.keycode = -1;
1875 					yylval.val.sep = NULL;
1876 					return X_IDENT;
1877 				}
1878 	YY_BREAK
1879 case 40:
1880 YY_RULE_SETUP
1881 #line 617 "sqlscan.l"
1882 {
1883 					addlitchar('"');
1884 				}
1885 	YY_BREAK
1886 case 41:
1887 /* rule 41 can match eol */
1888 YY_RULE_SETUP
1889 #line 620 "sqlscan.l"
1890 {
1891 					addlit(yytext, yyleng);
1892 				}
1893 	YY_BREAK
1894 case YY_STATE_EOF(xd):
1895 #line 623 "sqlscan.l"
1896 {
1897 					yylval.val.modificator = "dqu";
1898 					yylval.val.str = litbufdup();
1899 					yylval.val.keycode = -1;
1900 					yylval.val.sep = NULL;
1901 					return X_IDENT;
1902 				}
1903 	YY_BREAK
1904 case 42:
1905 YY_RULE_SETUP
1906 #line 630 "sqlscan.l"
1907 {
1908 					SET_YYLLOC();
1909 					yylval.val.modificator = "typecast";
1910 					yylval.val.keycode = X_TYPECAST;
1911 					yylval.val.sep = NULL;
1912 					return X_OTHERS;
1913 				}
1914 	YY_BREAK
1915 case 43:
1916 YY_RULE_SETUP
1917 #line 638 "sqlscan.l"
1918 {
1919 					SET_YYLLOC();
1920 					yylval.val.str = yytext;
1921 					yylval.val.modificator = "self";
1922 					yylval.val.keycode = yytext[0];
1923 					yylval.val.sep = NULL;
1924 					return X_OTHERS;
1925 				}
1926 	YY_BREAK
1927 case 44:
1928 YY_RULE_SETUP
1929 #line 647 "sqlscan.l"
1930 {
1931 					/*
1932 					 * Check for embedded slash-star or dash-dash; those
1933 					 * are comment starts, so operator must stop there.
1934 					 * Note that slash-star or dash-dash at the first
1935 					 * character will match a prior rule, not this one.
1936 					 */
1937 					int		nchars = yyleng;
1938 					char   *slashstar = strstr(yytext, "/*");
1939 					char   *dashdash = strstr(yytext, "--");
1940 
1941 					if (slashstar && dashdash)
1942 					{
1943 						/* if both appear, take the first one */
1944 						if (slashstar > dashdash)
1945 							slashstar = dashdash;
1946 					}
1947 					else if (!slashstar)
1948 						slashstar = dashdash;
1949 					if (slashstar)
1950 						nchars = slashstar - yytext;
1951 
1952 					/*
1953 					 * For SQL compatibility, '+' and '-' cannot be the
1954 					 * last char of a multi-char operator unless the operator
1955 					 * contains chars that are not in SQL operators.
1956 					 * The idea is to lex '=-' as two operators, but not
1957 					 * to forbid operator names like '?-' that could not be
1958 					 * sequences of SQL operators.
1959 					 */
1960 					while (nchars > 1 &&
1961 						   (yytext[nchars-1] == '+' ||
1962 							yytext[nchars-1] == '-'))
1963 					{
1964 						int		ic;
1965 
1966 						for (ic = nchars-2; ic >= 0; ic--)
1967 						{
1968 							if (strchr("~!@#^&|`?%", yytext[ic]))
1969 								break;
1970 						}
1971 						if (ic >= 0)
1972 							break; /* found a char that makes it OK */
1973 						nchars--; /* else remove the +/-, and check again */
1974 					}
1975 
1976 					SET_YYLLOC();
1977 
1978 					if (nchars < yyleng)
1979 					{
1980 						/* Strip the unwanted chars from the token */
1981 						yyless(nchars);
1982 						/*
1983 						 * If what we have left is only one char, and it's
1984 						 * one of the characters matching "self", then
1985 						 * return it as a character token the same way
1986 						 * that the "self" rule would have.
1987 						 */
1988 						if (nchars == 1 &&
1989 							strchr(",()[].;:+-*/%^<>=", yytext[0]))
1990 						{
1991 							yylval.val.str = yytext;
1992 							yylval.val.modificator = NULL;
1993 							yylval.val.keycode = yytext[0];
1994 							yylval.val.sep = NULL;
1995 							return X_OTHERS;
1996 						}
1997 					}
1998 
1999 					/*
2000 					 * Complain if operator is too long.  Unlike the case
2001 					 * for identifiers, we make this an error not a notice-
2002 					 * and-truncate, because the odds are we are looking at
2003 					 * a syntactic mistake anyway.
2004 					 */
2005 					if (nchars >= NAMEDATALEN)
2006 						yyerror(NULL, "operator too long");
2007 
2008 					/* Convert "!=" operator to "<>" for compatibility */
2009 					yylval.val.modificator = NULL;
2010 					if (strcmp(yytext, "!=") == 0)
2011 						yylval.val.str = pstrdup("<>");
2012 					else
2013 						yylval.val.str = pstrdup(yytext);
2014 					yylval.val.keycode = -1;
2015 					yylval.val.sep = NULL;
2016 					return X_OP;
2017 				}
2018 	YY_BREAK
2019 case 45:
2020 YY_RULE_SETUP
2021 #line 736 "sqlscan.l"
2022 {
2023 					SET_YYLLOC();
2024 					yylval.val.modificator = NULL;
2025 					yylval.val.str = yytext;
2026 					yylval.val.keycode = -1;
2027 					yylval.val.sep = NULL;
2028 					return X_PARAM;
2029 				}
2030 	YY_BREAK
2031 case 46:
2032 YY_RULE_SETUP
2033 #line 745 "sqlscan.l"
2034 {
2035 					long val;
2036 					char* endptr;
2037 
2038 					SET_YYLLOC();
2039 					errno = 0;
2040 					val = strtol(yytext, &endptr, 10);
2041 					if (*endptr != '\0' || errno == ERANGE
2042 #ifdef HAVE_LONG_INT_64
2043 						/* if long > 32 bits, check for overflow of int4 */
2044 						|| val != (long) ((int32) val)
2045 #endif
2046 						)
2047 					{
2048 						/* integer too large, treat it as a float */
2049 						yylval.val.str = pstrdup(yytext);
2050 						yylval.val.modificator = "f";
2051 						yylval.val.keycode = -1;
2052 						yylval.val.sep = NULL;
2053 						return X_NCONST;
2054 					}
2055 					yylval.val.str = yytext;
2056 					yylval.val.modificator = "i";
2057 					yylval.val.keycode = -1;
2058 					yylval.val.sep = NULL;
2059 					return X_NCONST;
2060 				}
2061 	YY_BREAK
2062 case 47:
2063 YY_RULE_SETUP
2064 #line 772 "sqlscan.l"
2065 {
2066 					SET_YYLLOC();
2067 					yylval.val.str = pstrdup(yytext);
2068 					yylval.val.modificator = "f";
2069 					yylval.val.keycode = -1;
2070 					yylval.val.sep = NULL;
2071 					return X_NCONST;
2072 				}
2073 	YY_BREAK
2074 case 48:
2075 YY_RULE_SETUP
2076 #line 780 "sqlscan.l"
2077 {
2078 					SET_YYLLOC();
2079 					yylval.val.str = pstrdup(yytext);
2080 					yylval.val.modificator = "f";
2081 					yylval.val.keycode = -1;
2082 					yylval.val.sep = NULL;
2083 					return X_NCONST;
2084 				}
2085 	YY_BREAK
2086 case 49:
2087 YY_RULE_SETUP
2088 #line 788 "sqlscan.l"
2089 {
2090 					/*
2091 					 * throw back the [Ee], and treat as {decimal}.  Note
2092 					 * that it is possible the input is actually {integer},
2093 					 * but since this case will almost certainly lead to a
2094 					 * syntax error anyway, we don't bother to distinguish.
2095 					 */
2096 					yyless(yyleng-1);
2097 					SET_YYLLOC();
2098 					yylval.val.str = pstrdup(yytext);
2099 					yylval.val.modificator = "f";
2100 					yylval.val.keycode = -1;
2101 					yylval.val.sep = NULL;
2102 					return X_NCONST;
2103 				}
2104 	YY_BREAK
2105 case 50:
2106 YY_RULE_SETUP
2107 #line 803 "sqlscan.l"
2108 {
2109 					/* throw back the [Ee][+-], and proceed as above */
2110 					yyless(yyleng-2);
2111 					SET_YYLLOC();
2112 					yylval.val.str = pstrdup(yytext);
2113 					yylval.val.modificator = "f";
2114 					yylval.val.keycode = -1;
2115 					yylval.val.sep = NULL;
2116 					return X_NCONST;
2117 				}
2118 	YY_BREAK
2119 case 51:
2120 YY_RULE_SETUP
2121 #line 815 "sqlscan.l"
2122 {
2123 					char		   *ident;
2124 					const char *keyword;
2125 					int		keycode;
2126 
2127 					SET_YYLLOC();
2128 
2129 					/* nchar had better be a keyword! */
2130 					keyword = orafce_scan_keyword("nchar", &keycode);
2131 
2132 					/* Is it a keyword? */
2133 					keyword = orafce_scan_keyword(yytext, &keycode);
2134 					if (keyword != NULL)
2135 					{
2136 						yylval.val.str = (char*) keyword;
2137 						yylval.val.keycode = keycode;
2138 						yylval.val.modificator = NULL;
2139 						yylval.val.sep = NULL;
2140 						return X_KEYWORD;
2141 					}
2142 
2143 					/*
2144 					 * No.  Convert the identifier to lower case, and truncate
2145 					 * if necessary.
2146 					 */
2147 					ident = downcase_truncate_identifier(yytext, yyleng, true);
2148 					yylval.val.str = ident;
2149 					yylval.val.modificator = NULL;
2150 					yylval.val.keycode = -1;
2151 					yylval.val.sep = NULL;
2152 					return X_IDENT;
2153 				}
2154 	YY_BREAK
2155 case 52:
2156 YY_RULE_SETUP
2157 #line 848 "sqlscan.l"
2158 {
2159 					SET_YYLLOC();
2160 					yylval.val.str = yytext;
2161 					yylval.val.modificator = NULL;
2162 					yylval.val.keycode = yytext[0];
2163 					yylval.val.sep = NULL;
2164 					return X_OTHERS;
2165 				}
2166 	YY_BREAK
2167 case YY_STATE_EOF(INITIAL):
2168 #line 857 "sqlscan.l"
2169 {
2170 					SET_YYLLOC();
2171 					yyterminate();
2172 				}
2173 	YY_BREAK
2174 case 53:
2175 YY_RULE_SETUP
2176 #line 862 "sqlscan.l"
2177 YY_FATAL_ERROR( "flex scanner jammed" );
2178 	YY_BREAK
2179 #line 2179 "sqlscan.c"
2180 
2181 	case YY_END_OF_BUFFER:
2182 		{
2183 		/* Amount of text matched not including the EOB char. */
2184 		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
2185 
2186 		/* Undo the effects of YY_DO_BEFORE_ACTION. */
2187 		*yy_cp = (yy_hold_char);
2188 		YY_RESTORE_YY_MORE_OFFSET
2189 
2190 		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2191 			{
2192 			/* We're scanning a new file or input source.  It's
2193 			 * possible that this happened because the user
2194 			 * just pointed yyin at a new source and called
2195 			 * yylex().  If so, then we have to assure
2196 			 * consistency between YY_CURRENT_BUFFER and our
2197 			 * globals.  Here is the right place to do so, because
2198 			 * this is the first action (other than possibly a
2199 			 * back-up) that will match for the new input source.
2200 			 */
2201 			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2202 			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
2203 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2204 			}
2205 
2206 		/* Note that here we test for yy_c_buf_p "<=" to the position
2207 		 * of the first EOB in the buffer, since yy_c_buf_p will
2208 		 * already have been incremented past the NUL character
2209 		 * (since all states make transitions on EOB to the
2210 		 * end-of-buffer state).  Contrast this with the test
2211 		 * in input().
2212 		 */
2213 		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2214 			{ /* This was really a NUL. */
2215 			yy_state_type yy_next_state;
2216 
2217 			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2218 
2219 			yy_current_state = yy_get_previous_state(  );
2220 
2221 			/* Okay, we're now positioned to make the NUL
2222 			 * transition.  We couldn't have
2223 			 * yy_get_previous_state() go ahead and do it
2224 			 * for us because it doesn't know how to deal
2225 			 * with the possibility of jamming (and we don't
2226 			 * want to build jamming into it because then it
2227 			 * will run more slowly).
2228 			 */
2229 
2230 			yy_next_state = yy_try_NUL_trans( yy_current_state );
2231 
2232 			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2233 
2234 			if ( yy_next_state )
2235 				{
2236 				/* Consume the NUL. */
2237 				yy_cp = ++(yy_c_buf_p);
2238 				yy_current_state = yy_next_state;
2239 				goto yy_match;
2240 				}
2241 
2242 			else
2243 				{
2244 				yy_cp = (yy_last_accepting_cpos);
2245 				yy_current_state = (yy_last_accepting_state);
2246 				goto yy_find_action;
2247 				}
2248 			}
2249 
2250 		else switch ( yy_get_next_buffer(  ) )
2251 			{
2252 			case EOB_ACT_END_OF_FILE:
2253 				{
2254 				(yy_did_buffer_switch_on_eof) = 0;
2255 
2256 				if ( yywrap(  ) )
2257 					{
2258 					/* Note: because we've taken care in
2259 					 * yy_get_next_buffer() to have set up
2260 					 * yytext, we can now set up
2261 					 * yy_c_buf_p so that if some total
2262 					 * hoser (like flex itself) wants to
2263 					 * call the scanner after we return the
2264 					 * YY_NULL, it'll still work - another
2265 					 * YY_NULL will get returned.
2266 					 */
2267 					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
2268 
2269 					yy_act = YY_STATE_EOF(YY_START);
2270 					goto do_action;
2271 					}
2272 
2273 				else
2274 					{
2275 					if ( ! (yy_did_buffer_switch_on_eof) )
2276 						YY_NEW_FILE;
2277 					}
2278 				break;
2279 				}
2280 
2281 			case EOB_ACT_CONTINUE_SCAN:
2282 				(yy_c_buf_p) =
2283 					(yytext_ptr) + yy_amount_of_matched_text;
2284 
2285 				yy_current_state = yy_get_previous_state(  );
2286 
2287 				yy_cp = (yy_c_buf_p);
2288 				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2289 				goto yy_match;
2290 
2291 			case EOB_ACT_LAST_MATCH:
2292 				(yy_c_buf_p) =
2293 				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
2294 
2295 				yy_current_state = yy_get_previous_state(  );
2296 
2297 				yy_cp = (yy_c_buf_p);
2298 				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2299 				goto yy_find_action;
2300 			}
2301 		break;
2302 		}
2303 
2304 	default:
2305 		YY_FATAL_ERROR(
2306 			"fatal flex scanner internal error--no action found" );
2307 	} /* end of action switch */
2308 		} /* end of scanning one token */
2309 	} /* end of user's declarations */
2310 } /* end of yylex */
2311 
2312 /* yy_get_next_buffer - try to read in a new buffer
2313  *
2314  * Returns a code representing an action:
2315  *	EOB_ACT_LAST_MATCH -
2316  *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2317  *	EOB_ACT_END_OF_FILE - end of file
2318  */
yy_get_next_buffer(void)2319 static int yy_get_next_buffer (void)
2320 {
2321     	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2322 	char *source = (yytext_ptr);
2323 	int number_to_move, i;
2324 	int ret_val;
2325 
2326 	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2327 		YY_FATAL_ERROR(
2328 		"fatal flex scanner internal error--end of buffer missed" );
2329 
2330 	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2331 		{ /* Don't try to fill the buffer, so this is an EOF. */
2332 		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2333 			{
2334 			/* We matched a single character, the EOB, so
2335 			 * treat this as a final EOF.
2336 			 */
2337 			return EOB_ACT_END_OF_FILE;
2338 			}
2339 
2340 		else
2341 			{
2342 			/* We matched some text prior to the EOB, first
2343 			 * process it.
2344 			 */
2345 			return EOB_ACT_LAST_MATCH;
2346 			}
2347 		}
2348 
2349 	/* Try to read more data. */
2350 
2351 	/* First move last chars to start of buffer. */
2352 	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
2353 
2354 	for ( i = 0; i < number_to_move; ++i )
2355 		*(dest++) = *(source++);
2356 
2357 	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2358 		/* don't do the read, it's not guaranteed to return an EOF,
2359 		 * just force an EOF
2360 		 */
2361 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2362 
2363 	else
2364 		{
2365 			int num_to_read =
2366 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2367 
2368 		while ( num_to_read <= 0 )
2369 			{ /* Not enough room in the buffer - grow it. */
2370 
2371 			/* just a shorter name for the current buffer */
2372 			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
2373 
2374 			int yy_c_buf_p_offset =
2375 				(int) ((yy_c_buf_p) - b->yy_ch_buf);
2376 
2377 			if ( b->yy_is_our_buffer )
2378 				{
2379 				int new_size = b->yy_buf_size * 2;
2380 
2381 				if ( new_size <= 0 )
2382 					b->yy_buf_size += b->yy_buf_size / 8;
2383 				else
2384 					b->yy_buf_size *= 2;
2385 
2386 				b->yy_ch_buf = (char *)
2387 					/* Include room in for 2 EOB chars. */
2388 					yyrealloc( (void *) b->yy_ch_buf,
2389 							 (yy_size_t) (b->yy_buf_size + 2)  );
2390 				}
2391 			else
2392 				/* Can't grow it, we don't own it. */
2393 				b->yy_ch_buf = NULL;
2394 
2395 			if ( ! b->yy_ch_buf )
2396 				YY_FATAL_ERROR(
2397 				"fatal error - scanner input buffer overflow" );
2398 
2399 			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2400 
2401 			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2402 						number_to_move - 1;
2403 
2404 			}
2405 
2406 		if ( num_to_read > YY_READ_BUF_SIZE )
2407 			num_to_read = YY_READ_BUF_SIZE;
2408 
2409 		/* Read in more data. */
2410 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2411 			(yy_n_chars), num_to_read );
2412 
2413 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2414 		}
2415 
2416 	if ( (yy_n_chars) == 0 )
2417 		{
2418 		if ( number_to_move == YY_MORE_ADJ )
2419 			{
2420 			ret_val = EOB_ACT_END_OF_FILE;
2421 			yyrestart( yyin  );
2422 			}
2423 
2424 		else
2425 			{
2426 			ret_val = EOB_ACT_LAST_MATCH;
2427 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2428 				YY_BUFFER_EOF_PENDING;
2429 			}
2430 		}
2431 
2432 	else
2433 		ret_val = EOB_ACT_CONTINUE_SCAN;
2434 
2435 	if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
2436 		/* Extend the array by 50%, plus the number we really need. */
2437 		int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
2438 		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
2439 			(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size  );
2440 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2441 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2442 		/* "- 2" to take care of EOB's */
2443 		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
2444 	}
2445 
2446 	(yy_n_chars) += number_to_move;
2447 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
2448 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
2449 
2450 	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2451 
2452 	return ret_val;
2453 }
2454 
2455 /* yy_get_previous_state - get the state just before the EOB char was reached */
2456 
yy_get_previous_state(void)2457     static yy_state_type yy_get_previous_state (void)
2458 {
2459 	yy_state_type yy_current_state;
2460 	char *yy_cp;
2461 
2462 	yy_current_state = (yy_start);
2463 
2464 	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2465 		{
2466 		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2467 		if ( yy_accept[yy_current_state] )
2468 			{
2469 			(yy_last_accepting_state) = yy_current_state;
2470 			(yy_last_accepting_cpos) = yy_cp;
2471 			}
2472 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2473 			{
2474 			yy_current_state = (int) yy_def[yy_current_state];
2475 			if ( yy_current_state >= 155 )
2476 				yy_c = yy_meta[yy_c];
2477 			}
2478 		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2479 		}
2480 
2481 	return yy_current_state;
2482 }
2483 
2484 /* yy_try_NUL_trans - try to make a transition on the NUL character
2485  *
2486  * synopsis
2487  *	next_state = yy_try_NUL_trans( current_state );
2488  */
yy_try_NUL_trans(yy_state_type yy_current_state)2489     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
2490 {
2491 	int yy_is_jam;
2492     	char *yy_cp = (yy_c_buf_p);
2493 
2494 	YY_CHAR yy_c = 1;
2495 	if ( yy_accept[yy_current_state] )
2496 		{
2497 		(yy_last_accepting_state) = yy_current_state;
2498 		(yy_last_accepting_cpos) = yy_cp;
2499 		}
2500 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2501 		{
2502 		yy_current_state = (int) yy_def[yy_current_state];
2503 		if ( yy_current_state >= 155 )
2504 			yy_c = yy_meta[yy_c];
2505 		}
2506 	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2507 	yy_is_jam = (yy_current_state == 154);
2508 
2509 		return yy_is_jam ? 0 : yy_current_state;
2510 }
2511 
2512 #ifndef YY_NO_UNPUT
2513 
2514 #endif
2515 
2516 #ifndef YY_NO_INPUT
2517 #ifdef __cplusplus
yyinput(void)2518     static int yyinput (void)
2519 #else
2520     static int input  (void)
2521 #endif
2522 
2523 {
2524 	int c;
2525 
2526 	*(yy_c_buf_p) = (yy_hold_char);
2527 
2528 	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2529 		{
2530 		/* yy_c_buf_p now points to the character we want to return.
2531 		 * If this occurs *before* the EOB characters, then it's a
2532 		 * valid NUL; if not, then we've hit the end of the buffer.
2533 		 */
2534 		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2535 			/* This was really a NUL. */
2536 			*(yy_c_buf_p) = '\0';
2537 
2538 		else
2539 			{ /* need more input */
2540 			int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
2541 			++(yy_c_buf_p);
2542 
2543 			switch ( yy_get_next_buffer(  ) )
2544 				{
2545 				case EOB_ACT_LAST_MATCH:
2546 					/* This happens because yy_g_n_b()
2547 					 * sees that we've accumulated a
2548 					 * token and flags that we need to
2549 					 * try matching the token before
2550 					 * proceeding.  But for input(),
2551 					 * there's no matching to consider.
2552 					 * So convert the EOB_ACT_LAST_MATCH
2553 					 * to EOB_ACT_END_OF_FILE.
2554 					 */
2555 
2556 					/* Reset buffer status. */
2557 					yyrestart( yyin );
2558 
2559 					/*FALLTHROUGH*/
2560 
2561 				case EOB_ACT_END_OF_FILE:
2562 					{
2563 					if ( yywrap(  ) )
2564 						return 0;
2565 
2566 					if ( ! (yy_did_buffer_switch_on_eof) )
2567 						YY_NEW_FILE;
2568 #ifdef __cplusplus
2569 					return yyinput();
2570 #else
2571 					return input();
2572 #endif
2573 					}
2574 
2575 				case EOB_ACT_CONTINUE_SCAN:
2576 					(yy_c_buf_p) = (yytext_ptr) + offset;
2577 					break;
2578 				}
2579 			}
2580 		}
2581 
2582 	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
2583 	*(yy_c_buf_p) = '\0';	/* preserve yytext */
2584 	(yy_hold_char) = *++(yy_c_buf_p);
2585 
2586 	return c;
2587 }
2588 #endif	/* ifndef YY_NO_INPUT */
2589 
2590 /** Immediately switch to a different input stream.
2591  * @param input_file A readable stream.
2592  *
2593  * @note This function does not reset the start condition to @c INITIAL .
2594  */
yyrestart(FILE * input_file)2595     void yyrestart  (FILE * input_file )
2596 {
2597 
2598 	if ( ! YY_CURRENT_BUFFER ){
2599         yyensure_buffer_stack ();
2600 		YY_CURRENT_BUFFER_LVALUE =
2601             yy_create_buffer( yyin, YY_BUF_SIZE );
2602 	}
2603 
2604 	yy_init_buffer( YY_CURRENT_BUFFER, input_file );
2605 	yy_load_buffer_state(  );
2606 }
2607 
2608 /** Switch to a different input buffer.
2609  * @param new_buffer The new input buffer.
2610  *
2611  */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)2612     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
2613 {
2614 
2615 	/* TODO. We should be able to replace this entire function body
2616 	 * with
2617 	 *		yypop_buffer_state();
2618 	 *		yypush_buffer_state(new_buffer);
2619      */
2620 	yyensure_buffer_stack ();
2621 	if ( YY_CURRENT_BUFFER == new_buffer )
2622 		return;
2623 
2624 	if ( YY_CURRENT_BUFFER )
2625 		{
2626 		/* Flush out information for old buffer. */
2627 		*(yy_c_buf_p) = (yy_hold_char);
2628 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2629 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2630 		}
2631 
2632 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
2633 	yy_load_buffer_state(  );
2634 
2635 	/* We don't actually know whether we did this switch during
2636 	 * EOF (yywrap()) processing, but the only time this flag
2637 	 * is looked at is after yywrap() is called, so it's safe
2638 	 * to go ahead and always set it.
2639 	 */
2640 	(yy_did_buffer_switch_on_eof) = 1;
2641 }
2642 
yy_load_buffer_state(void)2643 static void yy_load_buffer_state  (void)
2644 {
2645     	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2646 	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2647 	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2648 	(yy_hold_char) = *(yy_c_buf_p);
2649 }
2650 
2651 /** Allocate and initialize an input buffer state.
2652  * @param file A readable stream.
2653  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2654  *
2655  * @return the allocated buffer state.
2656  */
yy_create_buffer(FILE * file,int size)2657     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
2658 {
2659 	YY_BUFFER_STATE b;
2660 
2661 	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
2662 	if ( ! b )
2663 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2664 
2665 	b->yy_buf_size = size;
2666 
2667 	/* yy_ch_buf has to be 2 characters longer than the size given because
2668 	 * we need to put in 2 end-of-buffer characters.
2669 	 */
2670 	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
2671 	if ( ! b->yy_ch_buf )
2672 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2673 
2674 	b->yy_is_our_buffer = 1;
2675 
2676 	yy_init_buffer( b, file );
2677 
2678 	return b;
2679 }
2680 
2681 /** Destroy the buffer.
2682  * @param b a buffer created with yy_create_buffer()
2683  *
2684  */
yy_delete_buffer(YY_BUFFER_STATE b)2685     void yy_delete_buffer (YY_BUFFER_STATE  b )
2686 {
2687 
2688 	if ( ! b )
2689 		return;
2690 
2691 	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2692 		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2693 
2694 	if ( b->yy_is_our_buffer )
2695 		yyfree( (void *) b->yy_ch_buf  );
2696 
2697 	yyfree( (void *) b  );
2698 }
2699 
2700 /* Initializes or reinitializes a buffer.
2701  * This function is sometimes called more than once on the same buffer,
2702  * such as during a yyrestart() or at EOF.
2703  */
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)2704     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
2705 
2706 {
2707 	int oerrno = errno;
2708 
2709 	yy_flush_buffer( b );
2710 
2711 	b->yy_input_file = file;
2712 	b->yy_fill_buffer = 1;
2713 
2714     /* If b is the current buffer, then yy_init_buffer was _probably_
2715      * called from yyrestart() or through yy_get_next_buffer.
2716      * In that case, we don't want to reset the lineno or column.
2717      */
2718     if (b != YY_CURRENT_BUFFER){
2719         b->yy_bs_lineno = 1;
2720         b->yy_bs_column = 0;
2721     }
2722 
2723         b->yy_is_interactive = 0;
2724 
2725 	errno = oerrno;
2726 }
2727 
2728 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2729  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2730  *
2731  */
yy_flush_buffer(YY_BUFFER_STATE b)2732     void yy_flush_buffer (YY_BUFFER_STATE  b )
2733 {
2734     	if ( ! b )
2735 		return;
2736 
2737 	b->yy_n_chars = 0;
2738 
2739 	/* We always need two end-of-buffer characters.  The first causes
2740 	 * a transition to the end-of-buffer state.  The second causes
2741 	 * a jam in that state.
2742 	 */
2743 	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2744 	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2745 
2746 	b->yy_buf_pos = &b->yy_ch_buf[0];
2747 
2748 	b->yy_at_bol = 1;
2749 	b->yy_buffer_status = YY_BUFFER_NEW;
2750 
2751 	if ( b == YY_CURRENT_BUFFER )
2752 		yy_load_buffer_state(  );
2753 }
2754 
2755 /** Pushes the new state onto the stack. The new state becomes
2756  *  the current state. This function will allocate the stack
2757  *  if necessary.
2758  *  @param new_buffer The new state.
2759  *
2760  */
yypush_buffer_state(YY_BUFFER_STATE new_buffer)2761 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
2762 {
2763     	if (new_buffer == NULL)
2764 		return;
2765 
2766 	yyensure_buffer_stack();
2767 
2768 	/* This block is copied from yy_switch_to_buffer. */
2769 	if ( YY_CURRENT_BUFFER )
2770 		{
2771 		/* Flush out information for old buffer. */
2772 		*(yy_c_buf_p) = (yy_hold_char);
2773 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2774 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2775 		}
2776 
2777 	/* Only push if top exists. Otherwise, replace top. */
2778 	if (YY_CURRENT_BUFFER)
2779 		(yy_buffer_stack_top)++;
2780 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
2781 
2782 	/* copied from yy_switch_to_buffer. */
2783 	yy_load_buffer_state(  );
2784 	(yy_did_buffer_switch_on_eof) = 1;
2785 }
2786 
2787 /** Removes and deletes the top of the stack, if present.
2788  *  The next element becomes the new top.
2789  *
2790  */
yypop_buffer_state(void)2791 void yypop_buffer_state (void)
2792 {
2793     	if (!YY_CURRENT_BUFFER)
2794 		return;
2795 
2796 	yy_delete_buffer(YY_CURRENT_BUFFER );
2797 	YY_CURRENT_BUFFER_LVALUE = NULL;
2798 	if ((yy_buffer_stack_top) > 0)
2799 		--(yy_buffer_stack_top);
2800 
2801 	if (YY_CURRENT_BUFFER) {
2802 		yy_load_buffer_state(  );
2803 		(yy_did_buffer_switch_on_eof) = 1;
2804 	}
2805 }
2806 
2807 /* Allocates the stack if it does not exist.
2808  *  Guarantees space for at least one push.
2809  */
yyensure_buffer_stack(void)2810 static void yyensure_buffer_stack (void)
2811 {
2812 	yy_size_t num_to_alloc;
2813 
2814 	if (!(yy_buffer_stack)) {
2815 
2816 		/* First allocation is just for 2 elements, since we don't know if this
2817 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2818 		 * immediate realloc on the next call.
2819          */
2820       num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2821 		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2822 								(num_to_alloc * sizeof(struct yy_buffer_state*)
2823 								);
2824 		if ( ! (yy_buffer_stack) )
2825 			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2826 
2827 		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2828 
2829 		(yy_buffer_stack_max) = num_to_alloc;
2830 		(yy_buffer_stack_top) = 0;
2831 		return;
2832 	}
2833 
2834 	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2835 
2836 		/* Increase the buffer to prepare for a possible push. */
2837 		yy_size_t grow_size = 8 /* arbitrary grow size */;
2838 
2839 		num_to_alloc = (yy_buffer_stack_max) + grow_size;
2840 		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2841 								((yy_buffer_stack),
2842 								num_to_alloc * sizeof(struct yy_buffer_state*)
2843 								);
2844 		if ( ! (yy_buffer_stack) )
2845 			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2846 
2847 		/* zero only the new slots.*/
2848 		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2849 		(yy_buffer_stack_max) = num_to_alloc;
2850 	}
2851 }
2852 
2853 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2854  * @param base the character buffer
2855  * @param size the size in bytes of the character buffer
2856  *
2857  * @return the newly allocated buffer state object.
2858  */
yy_scan_buffer(char * base,yy_size_t size)2859 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
2860 {
2861 	YY_BUFFER_STATE b;
2862 
2863 	if ( size < 2 ||
2864 	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
2865 	     base[size-1] != YY_END_OF_BUFFER_CHAR )
2866 		/* They forgot to leave room for the EOB's. */
2867 		return NULL;
2868 
2869 	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
2870 	if ( ! b )
2871 		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2872 
2873 	b->yy_buf_size = (int) (size - 2);	/* "- 2" to take care of EOB's */
2874 	b->yy_buf_pos = b->yy_ch_buf = base;
2875 	b->yy_is_our_buffer = 0;
2876 	b->yy_input_file = NULL;
2877 	b->yy_n_chars = b->yy_buf_size;
2878 	b->yy_is_interactive = 0;
2879 	b->yy_at_bol = 1;
2880 	b->yy_fill_buffer = 0;
2881 	b->yy_buffer_status = YY_BUFFER_NEW;
2882 
2883 	yy_switch_to_buffer( b  );
2884 
2885 	return b;
2886 }
2887 
2888 /** Setup the input buffer state to scan a string. The next call to yylex() will
2889  * scan from a @e copy of @a str.
2890  * @param yystr a NUL-terminated string to scan
2891  *
2892  * @return the newly allocated buffer state object.
2893  * @note If you want to scan bytes that may contain NUL values, then use
2894  *       yy_scan_bytes() instead.
2895  */
yy_scan_string(const char * yystr)2896 YY_BUFFER_STATE yy_scan_string (const char * yystr )
2897 {
2898 
2899 	return yy_scan_bytes( yystr, (int) strlen(yystr) );
2900 }
2901 
2902 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2903  * scan from a @e copy of @a bytes.
2904  * @param yybytes the byte buffer to scan
2905  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2906  *
2907  * @return the newly allocated buffer state object.
2908  */
yy_scan_bytes(const char * yybytes,int _yybytes_len)2909 YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
2910 {
2911 	YY_BUFFER_STATE b;
2912 	char *buf;
2913 	yy_size_t n;
2914 	int i;
2915 
2916 	/* Get memory for full buffer, including space for trailing EOB's. */
2917 	n = (yy_size_t) (_yybytes_len + 2);
2918 	buf = (char *) yyalloc( n  );
2919 	if ( ! buf )
2920 		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2921 
2922 	for ( i = 0; i < _yybytes_len; ++i )
2923 		buf[i] = yybytes[i];
2924 
2925 	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2926 
2927 	b = yy_scan_buffer( buf, n );
2928 	if ( ! b )
2929 		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2930 
2931 	/* It's okay to grow etc. this buffer, and we should throw it
2932 	 * away when we're done.
2933 	 */
2934 	b->yy_is_our_buffer = 1;
2935 
2936 	return b;
2937 }
2938 
2939 #ifndef YY_EXIT_FAILURE
2940 #define YY_EXIT_FAILURE 2
2941 #endif
2942 
yy_fatal_error(const char * msg)2943 static void yynoreturn yy_fatal_error (const char* msg )
2944 {
2945 			fprintf( stderr, "%s\n", msg );
2946 	exit( YY_EXIT_FAILURE );
2947 }
2948 
2949 /* Redefine yyless() so it works in section 3 code. */
2950 
2951 #undef yyless
2952 #define yyless(n) \
2953 	do \
2954 		{ \
2955 		/* Undo effects of setting up yytext. */ \
2956         int yyless_macro_arg = (n); \
2957         YY_LESS_LINENO(yyless_macro_arg);\
2958 		yytext[yyleng] = (yy_hold_char); \
2959 		(yy_c_buf_p) = yytext + yyless_macro_arg; \
2960 		(yy_hold_char) = *(yy_c_buf_p); \
2961 		*(yy_c_buf_p) = '\0'; \
2962 		yyleng = yyless_macro_arg; \
2963 		} \
2964 	while ( 0 )
2965 
2966 /* Accessor  methods (get/set functions) to struct members. */
2967 
2968 /** Get the current line number.
2969  *
2970  */
yyget_lineno(void)2971 int yyget_lineno  (void)
2972 {
2973 
2974     return yylineno;
2975 }
2976 
2977 /** Get the input stream.
2978  *
2979  */
yyget_in(void)2980 FILE *yyget_in  (void)
2981 {
2982         return yyin;
2983 }
2984 
2985 /** Get the output stream.
2986  *
2987  */
yyget_out(void)2988 FILE *yyget_out  (void)
2989 {
2990         return yyout;
2991 }
2992 
2993 /** Get the length of the current token.
2994  *
2995  */
yyget_leng(void)2996 int yyget_leng  (void)
2997 {
2998         return yyleng;
2999 }
3000 
3001 /** Get the current token.
3002  *
3003  */
3004 
yyget_text(void)3005 char *yyget_text  (void)
3006 {
3007         return yytext;
3008 }
3009 
3010 /** Set the current line number.
3011  * @param _line_number line number
3012  *
3013  */
yyset_lineno(int _line_number)3014 void yyset_lineno (int  _line_number )
3015 {
3016 
3017     yylineno = _line_number;
3018 }
3019 
3020 /** Set the input stream. This does not discard the current
3021  * input buffer.
3022  * @param _in_str A readable stream.
3023  *
3024  * @see yy_switch_to_buffer
3025  */
yyset_in(FILE * _in_str)3026 void yyset_in (FILE *  _in_str )
3027 {
3028         yyin = _in_str ;
3029 }
3030 
yyset_out(FILE * _out_str)3031 void yyset_out (FILE *  _out_str )
3032 {
3033         yyout = _out_str ;
3034 }
3035 
yyget_debug(void)3036 int yyget_debug  (void)
3037 {
3038         return yy_flex_debug;
3039 }
3040 
yyset_debug(int _bdebug)3041 void yyset_debug (int  _bdebug )
3042 {
3043         yy_flex_debug = _bdebug ;
3044 }
3045 
yy_init_globals(void)3046 static int yy_init_globals (void)
3047 {
3048         /* Initialization is the same as for the non-reentrant scanner.
3049      * This function is called from yylex_destroy(), so don't allocate here.
3050      */
3051 
3052     (yy_buffer_stack) = NULL;
3053     (yy_buffer_stack_top) = 0;
3054     (yy_buffer_stack_max) = 0;
3055     (yy_c_buf_p) = NULL;
3056     (yy_init) = 0;
3057     (yy_start) = 0;
3058 
3059 /* Defined in main.c */
3060 #ifdef YY_STDINIT
3061     yyin = stdin;
3062     yyout = stdout;
3063 #else
3064     yyin = NULL;
3065     yyout = NULL;
3066 #endif
3067 
3068     /* For future reference: Set errno on error, since we are called by
3069      * yylex_init()
3070      */
3071     return 0;
3072 }
3073 
3074 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy(void)3075 int yylex_destroy  (void)
3076 {
3077 
3078     /* Pop the buffer stack, destroying each element. */
3079 	while(YY_CURRENT_BUFFER){
3080 		yy_delete_buffer( YY_CURRENT_BUFFER  );
3081 		YY_CURRENT_BUFFER_LVALUE = NULL;
3082 		yypop_buffer_state();
3083 	}
3084 
3085 	/* Destroy the stack itself. */
3086 	yyfree((yy_buffer_stack) );
3087 	(yy_buffer_stack) = NULL;
3088 
3089     /* Reset the globals. This is important in a non-reentrant scanner so the next time
3090      * yylex() is called, initialization will occur. */
3091     yy_init_globals( );
3092 
3093     return 0;
3094 }
3095 
3096 /*
3097  * Internal utility routines.
3098  */
3099 
3100 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,const char * s2,int n)3101 static void yy_flex_strncpy (char* s1, const char * s2, int n )
3102 {
3103 
3104 	int i;
3105 	for ( i = 0; i < n; ++i )
3106 		s1[i] = s2[i];
3107 }
3108 #endif
3109 
3110 #ifdef YY_NEED_STRLEN
yy_flex_strlen(const char * s)3111 static int yy_flex_strlen (const char * s )
3112 {
3113 	int n;
3114 	for ( n = 0; s[n]; ++n )
3115 		;
3116 
3117 	return n;
3118 }
3119 #endif
3120 
yyalloc(yy_size_t size)3121 void *yyalloc (yy_size_t  size )
3122 {
3123 			return malloc(size);
3124 }
3125 
yyrealloc(void * ptr,yy_size_t size)3126 void *yyrealloc  (void * ptr, yy_size_t  size )
3127 {
3128 
3129 	/* The cast to (char *) in the following accommodates both
3130 	 * implementations that use char* generic pointers, and those
3131 	 * that use void* generic pointers.  It works with the latter
3132 	 * because both ANSI C and C++ allow castless assignment from
3133 	 * any pointer type to void*, and deal with argument conversions
3134 	 * as though doing an assignment.
3135 	 */
3136 	return realloc(ptr, size);
3137 }
3138 
yyfree(void * ptr)3139 void yyfree (void * ptr )
3140 {
3141 			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
3142 }
3143 
3144 #define YYTABLES_NAME "yytables"
3145 
3146 #line 862 "sqlscan.l"
3147 
3148 
3149 /*
3150  * lexer_errposition
3151  *		Report a lexical-analysis-time cursor position, if possible.
3152  *
3153  * This is expected to be used within an ereport() call.  The return value
3154  * is a dummy (always 0, in fact).
3155  *
3156  * Note that this can only be used for messages from the lexer itself,
3157  * since it depends on scanbuf to still be valid.
3158  */
3159 static int
lexer_errposition(void)3160 lexer_errposition(void)
3161 {
3162 	int		pos;
3163 
3164 	/* Convert byte offset to character number */
3165 	pos = _pg_mbstrlen_with_len(scanbuf, orafce_sql_yylval.val.lloc) + 1;
3166 	/* And pass it to the ereport mechanism */
3167 
3168 #if PG_VERSION_NUM >= 130000
3169 
3170 	errposition(pos);
3171 
3172 	return pos;
3173 
3174 #else
3175 
3176 	return errposition(pos);
3177 
3178 #endif
3179 
3180 }
3181 
3182 /*
3183  * yyerror
3184  *		Report a lexer or grammar error.
3185  *
3186  * The message's cursor position identifies the most recently lexed token.
3187  * This is OK for syntax error messages from the Bison parser, because Bison
3188  * parsers report error as soon as the first unparsable token is reached.
3189  * Beware of using yyerror for other purposes, as the cursor position might
3190  * be misleading!
3191  */
3192 void
orafce_sql_yyerror(List ** result,const char * message)3193 orafce_sql_yyerror(List **result, const char *message)
3194 {
3195 	const char *loc = scanbuf + orafce_sql_yylval.val.lloc;
3196 
3197 	if (*loc == YY_END_OF_BUFFER_CHAR)
3198 	{
3199 		ereport(ERROR,
3200 				(errcode(ERRCODE_SYNTAX_ERROR),
3201 				 errmsg("%s at end of input", message),
3202 				 lexer_errposition()));
3203 	}
3204 	else
3205 	{
3206 		ereport(ERROR,
3207 				(errcode(ERRCODE_SYNTAX_ERROR),
3208 				 errmsg("%s at or near \"%s\"", message, loc),
3209 				 lexer_errposition()));
3210 	}
3211 }
3212 
3213 
3214 /*
3215  * Called before any actual parsing is done
3216  */
3217 void
orafce_sql_scanner_init(const char * str)3218 orafce_sql_scanner_init(const char *str)
3219 {
3220 	Size	slen = strlen(str);
3221 
3222 	/*
3223 	 * Might be left over after ereport()
3224 	 */
3225 	if (YY_CURRENT_BUFFER)
3226 		yy_delete_buffer(YY_CURRENT_BUFFER);
3227 
3228 	/*
3229 	 * Make a scan buffer with special termination needed by flex.
3230 	 */
3231 	scanbuflen = slen;
3232 	scanbuf = palloc(slen + 2);
3233 	memcpy(scanbuf, str, slen);
3234 	scanbuf[slen] = scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR;
3235 	scanbufhandle = yy_scan_buffer(scanbuf, slen + 2);
3236 
3237 	/* initialize literal buffer to a reasonable but expansible size */
3238 	literalalloc = 128;
3239 	literalbuf = (char *) palloc(literalalloc);
3240 	startlit();
3241 
3242 	BEGIN(INITIAL);
3243 }
3244 
3245 
3246 /*
3247  * Called after parsing is done to clean up after fdate_scanner_init()
3248  */
3249 void
orafce_sql_scanner_finish(void)3250 orafce_sql_scanner_finish(void)
3251 {
3252 	yy_delete_buffer(scanbufhandle);
3253 	pfree(scanbuf);
3254 }
3255 
3256 static void
addlit(char * ytext,int yleng)3257 addlit(char *ytext, int yleng)
3258 {
3259 	/* enlarge buffer if needed */
3260 	if ((literallen+yleng) >= literalalloc)
3261 	{
3262 		do {
3263 			literalalloc *= 2;
3264 		} while ((literallen+yleng) >= literalalloc);
3265 		literalbuf = (char *) repalloc(literalbuf, literalalloc);
3266 	}
3267 	/* append new data, add trailing null */
3268 	memcpy(literalbuf+literallen, ytext, yleng);
3269 	literallen += yleng;
3270 	literalbuf[literallen] = '\0';
3271 }
3272 
3273 
3274 static void
addlitchar(unsigned char ychar)3275 addlitchar(unsigned char ychar)
3276 {
3277 	/* enlarge buffer if needed */
3278 	if ((literallen+1) >= literalalloc)
3279 	{
3280 		literalalloc *= 2;
3281 		literalbuf = (char *) repalloc(literalbuf, literalalloc);
3282 	}
3283 	/* append new data, add trailing null */
3284 	literalbuf[literallen] = ychar;
3285 	literallen += 1;
3286 	literalbuf[literallen] = '\0';
3287 }
3288 
3289 
3290 /*
3291  * One might be tempted to write pstrdup(literalbuf) instead of this,
3292  * but for long literals this is much faster because the length is
3293  * already known.
3294  */
3295 static char *
litbufdup(void)3296 litbufdup(void)
3297 {
3298 	char *new;
3299 
3300 	new = palloc(literallen + 1);
3301 	memcpy(new, literalbuf, literallen+1);
3302 	return new;
3303 }
3304 
3305 
3306 static unsigned char
unescape_single_char(unsigned char c)3307 unescape_single_char(unsigned char c)
3308 {
3309 	switch (c)
3310 	{
3311 		case 'b':
3312 			return '\b';
3313 		case 'f':
3314 			return '\f';
3315 		case 'n':
3316 			return '\n';
3317 		case 'r':
3318 			return '\r';
3319 		case 't':
3320 			return '\t';
3321 		default:
3322 			return c;
3323 	}
3324 }
3325 
3326 
3327 
3328