1 /* A lexical scanner generated by flex */
3 /* Scanner skeleton version:
4 * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.15 1998/02/21 06:31:52 scrappy Exp $
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
14 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
27 /* Use prototypes in function declarations. */
30 /* The "const" storage-class-modifier is valid. */
33 #else /* ! __cplusplus */
41 #endif /* ! __cplusplus */
60 #define YY_PROTO(proto) proto
62 #define YY_PROTO(proto) ()
65 /* Returned upon end-of-file. */
68 /* Promotes a possibly negative, possibly signed char to an unsigned
69 * integer for use as an array index. If the signed char is negative,
70 * we want to instead treat it as an 8-bit unsigned char, hence the
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
75 /* Enter a start condition. This macro really ought to take a parameter,
76 * but we do it the disgusting crufty way forced on us by the ()-less
77 * definition of BEGIN.
79 #define BEGIN yy_start = 1 + 2 *
81 /* Translate the current start state into a value that can be later handed
82 * to BEGIN to return to the state. The YYSTATE alias is for lex
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
94 #define YY_END_OF_BUFFER_CHAR 0
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
102 extern FILE *yyin, *yyout;
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
108 /* The funky do-while in the following #define is used to turn the definition
109 * int a single C statement (which needs a semi-colon terminator). This
110 * avoids problems with code like:
112 * if ( condition_holds )
115 * do_something_else();
117 * Prior to using the do-while the compiler would get upset at the
118 * "else" because it interpreted the "if" statement as being all
119 * done when it reached the ';' after the yyless() call.
122 /* Return all but the first 'n' matched characters back to the input stream. */
127 /* Undo effects of setting up yytext. */ \
128 *yy_cp = yy_hold_char; \
129 YY_RESTORE_YY_MORE_OFFSET \
130 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
131 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
135 #define unput(c) yyunput( c, yytext_ptr )
137 /* The following is because we cannot portably get our hands on size_t
138 * (without autoconf's help, which isn't available because we want
139 * flex-generated scanners to compile on their own).
141 typedef unsigned int yy_size_t;
144 struct yy_buffer_state
148 char *yy_ch_buf; /* input buffer */
149 char *yy_buf_pos; /* current position in input buffer */
151 /* Size of input buffer in bytes, not including room for EOB
154 yy_size_t yy_buf_size;
156 /* Number of characters read into yy_ch_buf, not including EOB
161 /* Whether we "own" the buffer - i.e., we know we created it,
162 * and can realloc() it to grow it, and should free() it to
165 int yy_is_our_buffer;
167 /* Whether this is an "interactive" input source; if so, and
168 * if we're using stdio for input, then we want to use getc()
169 * instead of fread(), to make sure we stop fetching input after
172 int yy_is_interactive;
174 /* Whether we're considered to be at the beginning of a line.
175 * If so, '^' rules will be active on the next match, otherwise
180 /* Whether to try to fill the input buffer when we reach the
185 int yy_buffer_status;
186 #define YY_BUFFER_NEW 0
187 #define YY_BUFFER_NORMAL 1
188 /* When an EOF's been seen but there's still some text to process
189 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
190 * shouldn't try reading from the input source any more. We might
191 * still have a bunch of tokens to match, though, because of
192 * possible backing-up.
194 * When we actually see the EOF, we change the status to "new"
195 * (via yyrestart()), so that the user can continue scanning by
196 * just pointing yyin at a new input file.
198 #define YY_BUFFER_EOF_PENDING 2
201 static YY_BUFFER_STATE yy_current_buffer = 0;
203 /* We provide macros for accessing buffer states in case in the
204 * future we want to put the buffer states in a more general
207 #define YY_CURRENT_BUFFER yy_current_buffer
210 /* yy_hold_char holds the character lost when yytext is formed. */
211 static char yy_hold_char;
213 static int yy_n_chars; /* number of characters read into yy_ch_buf */
218 /* Points to current character in buffer. */
219 static char *yy_c_buf_p = (char *) 0;
220 static int yy_init = 1; /* whether we need to initialize */
221 static int yy_start = 0; /* start state number */
223 /* Flag which is used to allow yywrap()'s to do buffer switches
224 * instead of setting up a fresh yyin. A bit of a hack ...
226 static int yy_did_buffer_switch_on_eof;
228 void yyrestart YY_PROTO(( FILE *input_file ));
230 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
231 void yy_load_buffer_state YY_PROTO(( void ));
232 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
233 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
234 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
235 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
236 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
238 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
239 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
240 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
242 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
243 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
244 static void yy_flex_free YY_PROTO(( void * ));
246 #define yy_new_buffer yy_create_buffer
248 #define yy_set_interactive(is_interactive) \
250 if ( ! yy_current_buffer ) \
251 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
252 yy_current_buffer->yy_is_interactive = is_interactive; \
255 #define yy_set_bol(at_bol) \
257 if ( ! yy_current_buffer ) \
258 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
259 yy_current_buffer->yy_at_bol = at_bol; \
262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
265 #define YY_USES_REJECT
266 typedef unsigned char YY_CHAR;
267 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
268 typedef int yy_state_type;
270 #define yytext_ptr yytext
272 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
273 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
274 static int yy_get_next_buffer YY_PROTO(( void ));
275 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
277 /* Done after the current pattern has been matched and before the
278 * corresponding action - sets up yytext.
280 #define YY_DO_BEFORE_ACTION \
281 yytext_ptr = yy_bp; \
282 yyleng = (int) (yy_cp - yy_bp); \
283 yy_hold_char = *yy_cp; \
287 #define YY_NUM_RULES 41
288 #define YY_END_OF_BUFFER 42
289 static yyconst short int yy_acclist[168] =
291 10, 10, 6, 6, 24, 24, 9, 9, 25, 25,
292 18, 18, 42, 40, 41, 39, 40, 41, 39, 41,
293 31, 40, 41, 22, 40, 41, 29, 31, 40, 41,
294 15, 40, 41, 29, 40, 41, 29, 31, 40, 41,
295 29, 31, 40, 41, 29, 31, 40, 41, 36, 40,
296 41,16418, 29, 31, 40, 41, 38, 40, 41,16417,
297 38, 40, 41,16417, 38, 40, 41,16417, 10, 41,
298 8, 41, 3, 6, 41, 3, 6, 41, 3, 41,
299 6, 41, 24, 41, 23, 41, 9, 41, 14, 41,
300 41, 25, 41, 26, 41, 18, 41, 16, 41, 41,
302 31, 31, 31, 32, 31, 31, 36,16418, 4, 31,
303 31, 27, 31, 38,16417, 7, 13, 10, 6, 6,
304 5, 24, 9, 25, 18, 17, 20, 19, 20, 30,
305 28, 30, 28, 30, 32, 28, 1, 31, 31, 28,
306 30, 4, 31, 4, 31, 4, 31, 8226, 37,16419,
307 8225, 12, 5, 11, 21, 30, 2, 4, 31, 30,
308 2, 2, 2, 8227, 37,16419, 2
311 static yyconst short int yy_accept[128] =
313 1, 1, 1, 2, 3, 4, 5, 6, 7, 8,
314 9, 10, 11, 12, 13, 14, 16, 19, 21, 24,
315 27, 31, 34, 37, 41, 45, 49, 53, 57, 61,
316 65, 69, 71, 73, 76, 79, 81, 83, 85, 87,
317 89, 91, 92, 94, 96, 98, 100, 101, 102, 103,
318 104, 105, 105, 106, 107, 109, 111, 112, 112, 112,
319 112, 114, 114, 114, 116, 117, 118, 119, 119, 119,
320 120, 121, 121, 121, 122, 123, 124, 124, 124, 125,
321 126, 126, 126, 127, 128, 130, 131, 133, 136, 137,
322 137, 138, 139, 140, 142, 142, 144, 146, 148, 149,
324 151, 152, 152, 152, 153, 154, 154, 154, 155, 155,
325 155, 156, 157, 157, 160, 161, 161, 161, 161, 162,
326 163, 164, 165, 165, 167, 168, 168
329 static yyconst int yy_ec[256] =
331 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
332 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
333 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
334 1, 2, 4, 5, 4, 6, 4, 4, 7, 8,
335 8, 9, 10, 8, 11, 12, 13, 14, 14, 14,
336 14, 14, 14, 14, 14, 14, 14, 15, 8, 16,
337 16, 16, 4, 4, 17, 18, 17, 17, 19, 17,
338 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
339 17, 17, 17, 17, 17, 17, 17, 20, 17, 17,
340 8, 21, 8, 4, 17, 4, 17, 18, 17, 17,
342 19, 17, 17, 17, 17, 17, 17, 17, 17, 17,
343 17, 17, 17, 17, 17, 17, 17, 17, 17, 20,
344 17, 17, 1, 16, 1, 4, 1, 17, 17, 17,
345 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
346 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
347 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
348 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
349 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
350 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
351 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
353 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
354 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
355 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
356 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
357 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
361 static yyconst int yy_meta[22] =
363 1, 2, 3, 4, 5, 4, 6, 1, 7, 8,
364 9, 10, 4, 11, 4, 4, 2, 2, 11, 2,
368 static yyconst short int yy_base[146] =
370 0, 0, 332, 325, 18, 31, 325, 324, 321, 320,
371 46, 48, 18, 31, 326, 435, 435, 435, 309, 435,
372 12, 435, 308, 213, 42, 49, 61, 21, 63, 74,
373 209, 0, 52, 0, 82, 58, 0, 0, 435, 0,
374 66, 435, 76, 435, 0, 80, 206, 198, 88, 31,
375 188, 82, 179, 102, 0, 120, 113, 135, 0, 175,
376 169, 137, 0, 149, 435, 435, 0, 87, 140, 0,
377 0, 71, 132, 142, 0, 0, 147, 150, 152, 0,
378 156, 158, 435, 435, 435, 435, 435, 114, 435, 162,
379 435, 175, 120, 0, 92, 188, 57, 150, 435, 203,
381 435, 180, 193, 435, 167, 205, 208, 435, 216, 218,
382 435, 0, 154, 224, 52, 226, 0, 220, 230, 233,
383 238, 435, 16, 224, 242, 435, 245, 257, 269, 281,
384 293, 305, 314, 322, 333, 345, 354, 363, 375, 387,
385 398, 410, 415, 419, 423
388 static yyconst short int yy_def[146] =
390 126, 1, 127, 127, 128, 128, 129, 129, 130, 130,
391 131, 131, 132, 132, 126, 126, 126, 126, 133, 126,
392 133, 126, 126, 133, 133, 133, 126, 133, 134, 134,
393 30, 135, 126, 136, 136, 137, 35, 138, 126, 139,
394 126, 126, 126, 126, 140, 126, 141, 133, 133, 49,
395 126, 126, 50, 126, 27, 142, 54, 126, 143, 126,
396 133, 126, 144, 30, 126, 126, 135, 126, 126, 136,
397 35, 137, 137, 137, 138, 139, 126, 126, 126, 140,
398 126, 126, 126, 126, 126, 126, 126, 126, 126, 54,
399 126, 90, 92, 90, 142, 142, 96, 96, 126, 126,
401 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
402 126, 90, 142, 96, 142, 126, 145, 126, 142, 142,
403 126, 126, 126, 100, 126, 0, 126, 126, 126, 126,
404 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
405 126, 126, 126, 126, 126
408 static yyconst short int yy_nxt[457] =
410 16, 17, 18, 19, 20, 21, 22, 23, 24, 24,
411 25, 23, 26, 27, 28, 24, 29, 30, 29, 31,
412 16, 35, 50, 35, 46, 51, 36, 35, 35, 124,
413 37, 53, 35, 35, 35, 61, 35, 46, 47, 36,
414 35, 35, 87, 37, 88, 35, 35, 43, 43, 43,
415 43, 47, 54, 68, 69, 55, 44, 56, 44, 53,
416 113, 57, 58, 58, 62, 62, 72, 77, 78, 114,
417 74, 59, 60, 63, 55, 62, 62, 79, 79, 72,
418 65, 81, 82, 74, 63, 71, 83, 71, 68, 69,
419 72, 71, 71, 89, 71, 89, 71, 71, 49, 86,
421 113, 86, 90, 90, 91, 92, 90, 92, 90, 90,
422 92, 92, 93, 94, 92, 94, 92, 92, 90, 90,
423 90, 90, 90, 96, 90, 96, 90, 51, 97, 96,
424 98, 112, 96, 112, 96, 96, 58, 58, 62, 62,
425 72, 102, 103, 105, 105, 59, 104, 63, 77, 78,
426 72, 106, 107, 79, 79, 126, 108, 81, 82, 109,
427 110, 115, 113, 115, 111, 90, 119, 90, 105, 105,
428 90, 90, 90, 90, 90, 90, 90, 90, 92, 49,
429 92, 102, 103, 92, 92, 93, 104, 92, 100, 92,
430 92, 96, 87, 96, 102, 103, 97, 96, 98, 104,
432 96, 51, 96, 96, 116, 116, 106, 107, 49, 106,
433 107, 108, 85, 117, 108, 66, 100, 109, 110, 109,
434 110, 118, 111, 53, 111, 120, 121, 116, 116, 123,
435 123, 120, 121, 124, 120, 121, 117, 124, 113, 125,
436 121, 113, 126, 125, 121, 32, 32, 32, 32, 32,
437 32, 32, 32, 32, 32, 32, 32, 34, 34, 34,
438 34, 34, 34, 34, 34, 34, 34, 34, 34, 38,
439 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
440 38, 40, 40, 40, 40, 40, 40, 40, 40, 40,
441 40, 40, 40, 42, 42, 42, 42, 42, 42, 42,
443 42, 42, 42, 42, 42, 45, 45, 45, 45, 45,
444 45, 45, 45, 45, 45, 45, 45, 48, 52, 49,
445 48, 48, 48, 64, 64, 126, 41, 41, 39, 39,
446 64, 33, 64, 67, 67, 67, 67, 67, 33, 67,
447 67, 67, 67, 67, 67, 70, 70, 70, 70, 70,
448 70, 126, 70, 70, 70, 70, 70, 73, 126, 126,
449 73, 73, 73, 75, 75, 75, 75, 126, 75, 75,
450 75, 75, 75, 75, 75, 76, 76, 76, 76, 76,
451 126, 76, 76, 76, 76, 76, 76, 80, 80, 80,
452 80, 80, 126, 80, 80, 80, 80, 80, 84, 84,
454 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
455 95, 95, 126, 95, 95, 95, 95, 95, 95, 95,
456 95, 95, 99, 99, 99, 99, 101, 101, 101, 101,
457 122, 122, 122, 122, 15, 126, 126, 126, 126, 126,
458 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
459 126, 126, 126, 126, 126, 126
462 static yyconst short int yy_chk[457] =
464 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
465 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
466 1, 5, 21, 5, 13, 21, 5, 5, 5, 123,
467 5, 28, 5, 5, 6, 28, 6, 14, 13, 6,
468 6, 6, 50, 6, 50, 6, 6, 11, 11, 12,
469 12, 14, 25, 33, 33, 25, 11, 26, 12, 26,
470 115, 26, 27, 27, 29, 29, 36, 41, 41, 97,
471 36, 27, 27, 29, 27, 30, 30, 43, 43, 72,
472 30, 46, 46, 72, 30, 35, 46, 35, 68, 68,
473 35, 35, 35, 52, 35, 52, 35, 35, 49, 49,
475 95, 49, 54, 54, 54, 54, 54, 54, 54, 54,
476 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
477 54, 54, 54, 56, 57, 56, 57, 88, 56, 56,
478 56, 93, 56, 93, 56, 56, 58, 58, 62, 62,
479 73, 69, 69, 74, 74, 58, 69, 62, 77, 77,
480 74, 78, 78, 79, 79, 64, 78, 81, 81, 82,
481 82, 98, 113, 98, 82, 90, 113, 90, 105, 105,
482 90, 90, 90, 90, 90, 90, 90, 90, 92, 61,
483 92, 102, 102, 92, 92, 92, 102, 92, 60, 92,
484 92, 96, 53, 96, 103, 103, 96, 96, 96, 103,
486 96, 51, 96, 96, 100, 100, 106, 106, 48, 107,
487 107, 106, 47, 100, 107, 31, 100, 109, 109, 110,
488 110, 100, 109, 24, 110, 114, 114, 116, 116, 118,
489 118, 119, 119, 118, 120, 120, 116, 124, 119, 121,
490 121, 120, 124, 125, 125, 127, 127, 127, 127, 127,
491 127, 127, 127, 127, 127, 127, 127, 128, 128, 128,
492 128, 128, 128, 128, 128, 128, 128, 128, 128, 129,
493 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
494 129, 130, 130, 130, 130, 130, 130, 130, 130, 130,
495 130, 130, 130, 131, 131, 131, 131, 131, 131, 131,
497 131, 131, 131, 131, 131, 132, 132, 132, 132, 132,
498 132, 132, 132, 132, 132, 132, 132, 133, 23, 19,
499 133, 133, 133, 134, 134, 15, 10, 9, 8, 7,
500 134, 4, 134, 135, 135, 135, 135, 135, 3, 135,
501 135, 135, 135, 135, 135, 136, 136, 136, 136, 136,
502 136, 0, 136, 136, 136, 136, 136, 137, 0, 0,
503 137, 137, 137, 138, 138, 138, 138, 0, 138, 138,
504 138, 138, 138, 138, 138, 139, 139, 139, 139, 139,
505 0, 139, 139, 139, 139, 139, 139, 140, 140, 140,
506 140, 140, 0, 140, 140, 140, 140, 140, 141, 141,
508 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
509 142, 142, 0, 142, 142, 142, 142, 142, 142, 142,
510 142, 142, 143, 143, 143, 143, 144, 144, 144, 144,
511 145, 145, 145, 145, 126, 126, 126, 126, 126, 126,
512 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
513 126, 126, 126, 126, 126, 126
516 static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
517 static char *yy_full_match;
519 static int yy_looking_for_trail_begin = 0;
520 static int yy_full_lp;
521 static int *yy_full_state;
522 #define YY_TRAILING_MASK 0x2000
523 #define YY_TRAILING_HEAD_MASK 0x4000
526 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
527 yy_cp = yy_full_match; /* restore poss. backed-over text */ \
528 yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \
529 yy_state_ptr = yy_full_state; /* restore orig. state */ \
530 yy_current_state = *yy_state_ptr; /* restore curr. state */ \
534 #define yymore() yymore_used_but_not_detected
535 #define YY_MORE_ADJ 0
536 #define YY_RESTORE_YY_MORE_OFFSET
541 /*-------------------------------------------------------------------------
544 * lexical scanner for POSTGRES
546 * Copyright (c) 1994, Regents of the University of California
550 * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.15 1998/02/21 06:31:52 scrappy Exp $
552 *-------------------------------------------------------------------------
560 #endif /* __linux__ */
564 #include "postgres.h"
565 #include "miscadmin.h"
566 #include "nodes/pg_list.h"
567 #include "nodes/parsenodes.h"
568 #include "parser/gramparse.h"
569 #include "parser/keywords.h"
570 #include "parser/scansup.h"
572 #include "utils/builtins.h"
574 extern char *parseString;
575 static char *parseCh;
577 /* some versions of lex define this as a macro */
582 #if defined(FLEX_SCANNER)
583 /* MAX_PARSE_BUFFER is defined in miscadmin.h */
584 #define YYLMAX MAX_PARSE_BUFFER
586 extern int myinput(char* buf, int max);
588 #define YY_INPUT(buf,result,max) {result = myinput(buf,max);}
594 #endif /* FLEX_SCANNER */
596 extern YYSTYPE yylval;
599 char literal[MAX_PARSE_BUFFER];
601 /* OK, here is a short description of lex/flex rules behavior.
602 * The longest pattern which matches an input string is always chosen.
603 * For equal-length patterns, the first occurring in the rules list is chosen.
604 * INITIAL is the starting condition, to which all non-conditional rules apply.
605 * When in an exclusive condition, only those rules defined for that condition apply.
607 * Exclusive states change parsing rules while the state is active.
608 * There are exclusive states for quoted strings, extended comments,
609 * and to eliminate parsing troubles for numeric strings.
611 * <xb> binary numeric string - thomas 1997-11-16
612 * <xc> extended C-style comments - tgl 1997-07-12
613 * <xd> delimited identifiers (double-quoted identifiers) - tgl 1997-10-27
614 * <xh> hexadecimal numeric string - thomas 1997-11-16
615 * <xm> numeric strings with embedded minus sign - tgl 1997-09-05
616 * <xq> quoted strings - tgl 1997-07-30
618 * The "extended comment" syntax closely resembles allowable operator syntax.
619 * So, when in condition <xc>, only strings which would terminate the
620 * "extended comment" trigger any action other than "ignore".
621 * Be sure to match _any_ candidate comment, including those with appended
622 * operator-like symbols. - thomas 1997-07-14
638 /* Hexadecimal number
641 * xqdouble implements SQL92 embedded quote
642 * xqcat allows strings to cross input lines
645 * Allows embedded spaces and other special characters into identifiers.
648 * Ignored by the scanner and parser.
650 /* DO NOT PUT ANY COMMENTS IN THE FOLLOWING SECTION.
651 * AT&T lex does not properly handle C-style comments in this second lex block.
652 * So, put comments here. tgl - 1997-09-08
654 * Quoted strings must allow some special characters such as single-quote
656 * Embedded single-quotes are implemented both in the SQL/92-standard
657 * style of two adjacent single quotes "''" and in the Postgres/Java style
658 * of escaped-quote "\'".
659 * Other embedded escaped characters are matched explicitly and the leading
660 * backslash is dropped from the string. - thomas 1997-09-24
664 /* Macros after this point can all be overridden by user definitions in
668 #ifndef YY_SKIP_YYWRAP
670 extern "C" int yywrap YY_PROTO(( void ));
672 extern int yywrap YY_PROTO(( void ));
677 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
681 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
684 #ifdef YY_NEED_STRLEN
685 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
690 static int yyinput YY_PROTO(( void ));
692 static int input YY_PROTO(( void ));
697 static int yy_start_stack_ptr = 0;
698 static int yy_start_stack_depth = 0;
699 static int *yy_start_stack = 0;
700 #ifndef YY_NO_PUSH_STATE
701 static void yy_push_state YY_PROTO(( int new_state ));
703 #ifndef YY_NO_POP_STATE
704 static void yy_pop_state YY_PROTO(( void ));
706 #ifndef YY_NO_TOP_STATE
707 static int yy_top_state YY_PROTO(( void ));
711 #define YY_NO_PUSH_STATE 1
712 #define YY_NO_POP_STATE 1
713 #define YY_NO_TOP_STATE 1
716 #ifdef YY_MALLOC_DECL
724 /* Just try to get by without declaring the routines. This will fail
725 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
726 * or sizeof(void*) != sizeof(int).
731 /* Amount of stuff to slurp up with each read. */
732 #ifndef YY_READ_BUF_SIZE
733 #define YY_READ_BUF_SIZE 8192
736 /* Copy whatever the last rule matched to the standard output. */
739 /* This used to be an fputs(), but since the string might contain NUL's,
740 * we now use fwrite().
742 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
745 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
746 * is returned in "result".
749 #define YY_INPUT(buf,result,max_size) \
750 if ( yy_current_buffer->yy_is_interactive ) \
753 for ( n = 0; n < max_size && \
754 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
757 buf[n++] = (char) c; \
758 if ( c == EOF && ferror( yyin ) ) \
759 YY_FATAL_ERROR( "input in flex scanner failed" ); \
762 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
763 && ferror( yyin ) ) \
764 YY_FATAL_ERROR( "input in flex scanner failed" );
767 /* No semi-colon after return; correct usage is to write "yyterminate();" -
768 * we don't want an extra ';' after the "return" because that will cause
769 * some compilers to complain about unreachable statements.
772 #define yyterminate() return YY_NULL
775 /* Number of entries by which start-condition stack grows. */
776 #ifndef YY_START_STACK_INCR
777 #define YY_START_STACK_INCR 25
780 /* Report a fatal error. */
781 #ifndef YY_FATAL_ERROR
782 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
785 /* Default declaration of generated scanner - a define so the user can
786 * easily add parameters.
789 #define YY_DECL int yylex YY_PROTO(( void ))
792 /* Code executed at the beginning of each rule, after yytext and yyleng
795 #ifndef YY_USER_ACTION
796 #define YY_USER_ACTION
799 /* Code executed at the end of each rule. */
801 #define YY_BREAK break;
804 #define YY_RULE_SETUP \
809 register yy_state_type yy_current_state;
810 register char *yy_cp, *yy_bp;
826 yy_start = 1; /* first start state */
834 if ( ! yy_current_buffer )
836 yy_create_buffer( yyin, YY_BUF_SIZE );
838 yy_load_buffer_state();
841 while ( 1 ) /* loops until end-of-file is reached */
845 /* Support of yytext. */
846 *yy_cp = yy_hold_char;
848 /* yy_bp points to the position in yy_ch_buf of the start of
853 yy_current_state = yy_start;
854 yy_state_ptr = yy_state_buf;
855 *yy_state_ptr++ = yy_current_state;
859 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
860 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
862 yy_current_state = (int) yy_def[yy_current_state];
863 if ( yy_current_state >= 127 )
864 yy_c = yy_meta[(unsigned int) yy_c];
866 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
867 *yy_state_ptr++ = yy_current_state;
870 while ( yy_base[yy_current_state] != 435 );
873 yy_current_state = *--yy_state_ptr;
874 yy_lp = yy_accept[yy_current_state];
875 find_rule: /* we branch to this label when backing up */
876 for ( ; ; ) /* until we find what rule we matched */
878 if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
880 yy_act = yy_acclist[yy_lp];
881 if ( yy_act & YY_TRAILING_HEAD_MASK ||
882 yy_looking_for_trail_begin )
884 if ( yy_act == yy_looking_for_trail_begin )
886 yy_looking_for_trail_begin = 0;
887 yy_act &= ~YY_TRAILING_HEAD_MASK;
891 else if ( yy_act & YY_TRAILING_MASK )
893 yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
894 yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
898 yy_full_match = yy_cp;
899 yy_full_state = yy_state_ptr;
907 yy_current_state = *--yy_state_ptr;
908 yy_lp = yy_accept[yy_current_state];
914 do_action: /* This label is used only to access EOF actions. */
918 { /* beginning of action switch */
963 yylval.ival = strtol((char *)literal,&endptr,2);
964 if (*endptr != '\0' || errno == ERANGE)
965 elog(ERROR,"Bad binary integer input '%s'",literal);
975 if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
976 elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
977 memcpy(literal+llen, yytext, yyleng+1);
1006 yylval.ival = strtol((char *)literal,&endptr,16);
1007 if (*endptr != '\0' || errno == ERANGE)
1008 elog(ERROR,"Bad hexadecimal integer input '%s'",literal);
1026 yylval.str = pstrdup(scanstr(literal));
1036 if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
1037 elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
1038 memcpy(literal+llen, yytext, yyleng+1);
1046 if ((llen+yyleng-1) > (MAX_PARSE_BUFFER - 1))
1047 elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
1048 memcpy(literal+llen, yytext, yyleng+1);
1049 *(literal+llen) = '\'';
1057 if ((llen+yyleng-1) > (MAX_PARSE_BUFFER - 1))
1058 elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
1059 memcpy(literal+llen, yytext, yyleng+1);
1083 yylval.str = pstrdup(literal);
1091 if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
1092 elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
1093 memcpy(literal+llen, yytext, yyleng+1);
1113 { return TYPECAST; }
1116 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
1117 yy_c_buf_p = yy_cp = yy_bp + 1;
1118 YY_DO_BEFORE_ACTION; /* set up yytext again */
1128 { return (yytext[0]); }
1131 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
1132 yy_c_buf_p = yy_cp -= 2;
1133 YY_DO_BEFORE_ACTION; /* set up yytext again */
1137 yylval.str = pstrdup((char*)yytext);
1145 if (strcmp((char*)yytext,"!=") == 0)
1146 yylval.str = pstrdup("<>"); /* compatability */
1148 yylval.str = pstrdup((char*)yytext);
1156 yylval.ival = atoi((char*)&yytext[1]);
1165 ScanKeyword *keyword;
1168 for(i = 0; yytext[i]; i++)
1169 if (isupper(yytext[i]))
1170 yytext[i] = tolower(yytext[i]);
1172 keyword = ScanKeywordLookup((char*)yytext);
1173 if (keyword != NULL) {
1174 return (keyword->value);
1178 yylval.str = pstrdup((char*)yytext);
1191 yylval.ival = strtol((char *)yytext,&endptr,10);
1192 if (*endptr != '\0' || errno == ERANGE)
1195 yylval.dval = strtod(((char *)yytext),&endptr);
1196 if (*endptr != '\0' || errno == ERANGE)
1197 elog(ERROR,"Bad integer input '%s'",yytext);
1198 CheckFloat8Val(yylval.dval);
1199 elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
1213 yylval.dval = strtod(((char *)yytext),&endptr);
1214 if (*endptr != '\0' || errno == ERANGE)
1215 elog(ERROR,"Bad float8 input '%s'",yytext);
1216 CheckFloat8Val(yylval.dval);
1227 yylval.ival = strtol((char *)yytext,&endptr,10);
1228 if (*endptr != '\0' || errno == ERANGE)
1231 yylval.dval = strtod(((char *)yytext),&endptr);
1232 if (*endptr != '\0' || errno == ERANGE)
1233 elog(ERROR,"Bad integer input '%s'",yytext);
1234 CheckFloat8Val(yylval.dval);
1235 elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
1248 yylval.dval = strtod((char *)yytext,&endptr);
1249 if (*endptr != '\0' || errno == ERANGE)
1250 elog(ERROR,"Bad float input '%s'",yytext);
1251 CheckFloat8Val(yylval.dval);
1260 ScanKeyword *keyword;
1262 for(i = 0; yytext[i]; i++)
1263 if (isupper(yytext[i]))
1264 yytext[i] = tolower(yytext[i]);
1266 keyword = ScanKeywordLookup((char*)yytext);
1267 if (keyword != NULL) {
1268 return (keyword->value);
1272 yylval.str = pstrdup((char*)yytext);
1285 { return (yytext[0]); }
1292 #line 1293 "lex.yy.c"
1293 case YY_STATE_EOF(INITIAL):
1294 case YY_STATE_EOF(xb):
1295 case YY_STATE_EOF(xc):
1296 case YY_STATE_EOF(xd):
1297 case YY_STATE_EOF(xh):
1298 case YY_STATE_EOF(xm):
1299 case YY_STATE_EOF(xq):
1302 case YY_END_OF_BUFFER:
1304 /* Amount of text matched not including the EOB char. */
1305 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1307 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1308 *yy_cp = yy_hold_char;
1309 YY_RESTORE_YY_MORE_OFFSET
1311 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1313 /* We're scanning a new file or input source. It's
1314 * possible that this happened because the user
1315 * just pointed yyin at a new source and called
1316 * yylex(). If so, then we have to assure
1317 * consistency between yy_current_buffer and our
1318 * globals. Here is the right place to do so, because
1319 * this is the first action (other than possibly a
1320 * back-up) that will match for the new input source.
1322 yy_n_chars = yy_current_buffer->yy_n_chars;
1323 yy_current_buffer->yy_input_file = yyin;
1324 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1327 /* Note that here we test for yy_c_buf_p "<=" to the position
1328 * of the first EOB in the buffer, since yy_c_buf_p will
1329 * already have been incremented past the NUL character
1330 * (since all states make transitions on EOB to the
1331 * end-of-buffer state). Contrast this with the test
1334 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1335 { /* This was really a NUL. */
1336 yy_state_type yy_next_state;
1338 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1340 yy_current_state = yy_get_previous_state();
1342 /* Okay, we're now positioned to make the NUL
1343 * transition. We couldn't have
1344 * yy_get_previous_state() go ahead and do it
1345 * for us because it doesn't know how to deal
1346 * with the possibility of jamming (and we don't
1347 * want to build jamming into it because then it
1348 * will run more slowly).
1351 yy_next_state = yy_try_NUL_trans( yy_current_state );
1353 yy_bp = yytext_ptr + YY_MORE_ADJ;
1355 if ( yy_next_state )
1357 /* Consume the NUL. */
1358 yy_cp = ++yy_c_buf_p;
1359 yy_current_state = yy_next_state;
1366 goto yy_find_action;
1370 else switch ( yy_get_next_buffer() )
1372 case EOB_ACT_END_OF_FILE:
1374 yy_did_buffer_switch_on_eof = 0;
1378 /* Note: because we've taken care in
1379 * yy_get_next_buffer() to have set up
1380 * yytext, we can now set up
1381 * yy_c_buf_p so that if some total
1382 * hoser (like flex itself) wants to
1383 * call the scanner after we return the
1384 * YY_NULL, it'll still work - another
1385 * YY_NULL will get returned.
1387 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1389 yy_act = YY_STATE_EOF(YY_START);
1395 if ( ! yy_did_buffer_switch_on_eof )
1401 case EOB_ACT_CONTINUE_SCAN:
1403 yytext_ptr + yy_amount_of_matched_text;
1405 yy_current_state = yy_get_previous_state();
1408 yy_bp = yytext_ptr + YY_MORE_ADJ;
1411 case EOB_ACT_LAST_MATCH:
1413 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1415 yy_current_state = yy_get_previous_state();
1418 yy_bp = yytext_ptr + YY_MORE_ADJ;
1419 goto yy_find_action;
1426 "fatal flex scanner internal error--no action found" );
1427 } /* end of action switch */
1428 } /* end of scanning one token */
1429 } /* end of yylex */
1432 /* yy_get_next_buffer - try to read in a new buffer
1434 * Returns a code representing an action:
1435 * EOB_ACT_LAST_MATCH -
1436 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1437 * EOB_ACT_END_OF_FILE - end of file
1440 static int yy_get_next_buffer()
1442 register char *dest = yy_current_buffer->yy_ch_buf;
1443 register char *source = yytext_ptr;
1444 register int number_to_move, i;
1447 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1449 "fatal flex scanner internal error--end of buffer missed" );
1451 if ( yy_current_buffer->yy_fill_buffer == 0 )
1452 { /* Don't try to fill the buffer, so this is an EOF. */
1453 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1455 /* We matched a single character, the EOB, so
1456 * treat this as a final EOF.
1458 return EOB_ACT_END_OF_FILE;
1463 /* We matched some text prior to the EOB, first
1466 return EOB_ACT_LAST_MATCH;
1470 /* Try to read more data. */
1472 /* First move last chars to start of buffer. */
1473 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1475 for ( i = 0; i < number_to_move; ++i )
1476 *(dest++) = *(source++);
1478 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1479 /* don't do the read, it's not guaranteed to return an EOF,
1482 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1487 yy_current_buffer->yy_buf_size - number_to_move - 1;
1489 while ( num_to_read <= 0 )
1490 { /* Not enough room in the buffer - grow it. */
1491 #ifdef YY_USES_REJECT
1493 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1496 /* just a shorter name for the current buffer */
1497 YY_BUFFER_STATE b = yy_current_buffer;
1499 int yy_c_buf_p_offset =
1500 (int) (yy_c_buf_p - b->yy_ch_buf);
1502 if ( b->yy_is_our_buffer )
1504 int new_size = b->yy_buf_size * 2;
1506 if ( new_size <= 0 )
1507 b->yy_buf_size += b->yy_buf_size / 8;
1509 b->yy_buf_size *= 2;
1511 b->yy_ch_buf = (char *)
1512 /* Include room in for 2 EOB chars. */
1513 yy_flex_realloc( (void *) b->yy_ch_buf,
1514 b->yy_buf_size + 2 );
1517 /* Can't grow it, we don't own it. */
1520 if ( ! b->yy_ch_buf )
1522 "fatal error - scanner input buffer overflow" );
1524 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1526 num_to_read = yy_current_buffer->yy_buf_size -
1531 if ( num_to_read > YY_READ_BUF_SIZE )
1532 num_to_read = YY_READ_BUF_SIZE;
1534 /* Read in more data. */
1535 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1536 yy_n_chars, num_to_read );
1538 yy_current_buffer->yy_n_chars = yy_n_chars;
1541 if ( yy_n_chars == 0 )
1543 if ( number_to_move == YY_MORE_ADJ )
1545 ret_val = EOB_ACT_END_OF_FILE;
1551 ret_val = EOB_ACT_LAST_MATCH;
1552 yy_current_buffer->yy_buffer_status =
1553 YY_BUFFER_EOF_PENDING;
1558 ret_val = EOB_ACT_CONTINUE_SCAN;
1560 yy_n_chars += number_to_move;
1561 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1562 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1564 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1570 /* yy_get_previous_state - get the state just before the EOB char was reached */
1572 static yy_state_type yy_get_previous_state()
1574 register yy_state_type yy_current_state;
1575 register char *yy_cp;
1577 yy_current_state = yy_start;
1578 yy_state_ptr = yy_state_buf;
1579 *yy_state_ptr++ = yy_current_state;
1581 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1583 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1584 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1586 yy_current_state = (int) yy_def[yy_current_state];
1587 if ( yy_current_state >= 127 )
1588 yy_c = yy_meta[(unsigned int) yy_c];
1590 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1591 *yy_state_ptr++ = yy_current_state;
1594 return yy_current_state;
1598 /* yy_try_NUL_trans - try to make a transition on the NUL character
1601 * next_state = yy_try_NUL_trans( current_state );
1604 #ifdef YY_USE_PROTOS
1605 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1607 static yy_state_type yy_try_NUL_trans( yy_current_state )
1608 yy_state_type yy_current_state;
1611 register int yy_is_jam;
1613 register YY_CHAR yy_c = 1;
1614 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1616 yy_current_state = (int) yy_def[yy_current_state];
1617 if ( yy_current_state >= 127 )
1618 yy_c = yy_meta[(unsigned int) yy_c];
1620 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1621 yy_is_jam = (yy_current_state == 126);
1623 *yy_state_ptr++ = yy_current_state;
1625 return yy_is_jam ? 0 : yy_current_state;
1630 #ifdef YY_USE_PROTOS
1631 static void yyunput( int c, register char *yy_bp )
1633 static void yyunput( c, yy_bp )
1635 register char *yy_bp;
1638 register char *yy_cp = yy_c_buf_p;
1640 /* undo effects of setting up yytext */
1641 *yy_cp = yy_hold_char;
1643 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1644 { /* need to shift things up to make room */
1645 /* +2 for EOB chars. */
1646 register int number_to_move = yy_n_chars + 2;
1647 register char *dest = &yy_current_buffer->yy_ch_buf[
1648 yy_current_buffer->yy_buf_size + 2];
1649 register char *source =
1650 &yy_current_buffer->yy_ch_buf[number_to_move];
1652 while ( source > yy_current_buffer->yy_ch_buf )
1653 *--dest = *--source;
1655 yy_cp += (int) (dest - source);
1656 yy_bp += (int) (dest - source);
1657 yy_current_buffer->yy_n_chars =
1658 yy_n_chars = yy_current_buffer->yy_buf_size;
1660 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1661 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1664 *--yy_cp = (char) c;
1668 yy_hold_char = *yy_cp;
1671 #endif /* ifndef YY_NO_UNPUT */
1675 static int yyinput()
1682 *yy_c_buf_p = yy_hold_char;
1684 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1686 /* yy_c_buf_p now points to the character we want to return.
1687 * If this occurs *before* the EOB characters, then it's a
1688 * valid NUL; if not, then we've hit the end of the buffer.
1690 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1691 /* This was really a NUL. */
1695 { /* need more input */
1696 int offset = yy_c_buf_p - yytext_ptr;
1699 switch ( yy_get_next_buffer() )
1701 case EOB_ACT_LAST_MATCH:
1702 /* This happens because yy_g_n_b()
1703 * sees that we've accumulated a
1704 * token and flags that we need to
1705 * try matching the token before
1706 * proceeding. But for input(),
1707 * there's no matching to consider.
1708 * So convert the EOB_ACT_LAST_MATCH
1709 * to EOB_ACT_END_OF_FILE.
1712 /* Reset buffer status. */
1717 case EOB_ACT_END_OF_FILE:
1722 if ( ! yy_did_buffer_switch_on_eof )
1731 case EOB_ACT_CONTINUE_SCAN:
1732 yy_c_buf_p = yytext_ptr + offset;
1738 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1739 *yy_c_buf_p = '\0'; /* preserve yytext */
1740 yy_hold_char = *++yy_c_buf_p;
1747 #ifdef YY_USE_PROTOS
1748 void yyrestart( FILE *input_file )
1750 void yyrestart( input_file )
1754 if ( ! yy_current_buffer )
1755 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1757 yy_init_buffer( yy_current_buffer, input_file );
1758 yy_load_buffer_state();
1762 #ifdef YY_USE_PROTOS
1763 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1765 void yy_switch_to_buffer( new_buffer )
1766 YY_BUFFER_STATE new_buffer;
1769 if ( yy_current_buffer == new_buffer )
1772 if ( yy_current_buffer )
1774 /* Flush out information for old buffer. */
1775 *yy_c_buf_p = yy_hold_char;
1776 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1777 yy_current_buffer->yy_n_chars = yy_n_chars;
1780 yy_current_buffer = new_buffer;
1781 yy_load_buffer_state();
1783 /* We don't actually know whether we did this switch during
1784 * EOF (yywrap()) processing, but the only time this flag
1785 * is looked at is after yywrap() is called, so it's safe
1786 * to go ahead and always set it.
1788 yy_did_buffer_switch_on_eof = 1;
1792 #ifdef YY_USE_PROTOS
1793 void yy_load_buffer_state( void )
1795 void yy_load_buffer_state()
1798 yy_n_chars = yy_current_buffer->yy_n_chars;
1799 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1800 yyin = yy_current_buffer->yy_input_file;
1801 yy_hold_char = *yy_c_buf_p;
1805 #ifdef YY_USE_PROTOS
1806 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1808 YY_BUFFER_STATE yy_create_buffer( file, size )
1815 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1817 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1819 b->yy_buf_size = size;
1821 /* yy_ch_buf has to be 2 characters longer than the size given because
1822 * we need to put in 2 end-of-buffer characters.
1824 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1825 if ( ! b->yy_ch_buf )
1826 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1828 b->yy_is_our_buffer = 1;
1830 yy_init_buffer( b, file );
1836 #ifdef YY_USE_PROTOS
1837 void yy_delete_buffer( YY_BUFFER_STATE b )
1839 void yy_delete_buffer( b )
1846 if ( b == yy_current_buffer )
1847 yy_current_buffer = (YY_BUFFER_STATE) 0;
1849 if ( b->yy_is_our_buffer )
1850 yy_flex_free( (void *) b->yy_ch_buf );
1852 yy_flex_free( (void *) b );
1856 #ifndef YY_ALWAYS_INTERACTIVE
1857 #ifndef YY_NEVER_INTERACTIVE
1858 extern int isatty YY_PROTO(( int ));
1862 #ifdef YY_USE_PROTOS
1863 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1865 void yy_init_buffer( b, file )
1872 yy_flush_buffer( b );
1874 b->yy_input_file = file;
1875 b->yy_fill_buffer = 1;
1877 #if YY_ALWAYS_INTERACTIVE
1878 b->yy_is_interactive = 1;
1880 #if YY_NEVER_INTERACTIVE
1881 b->yy_is_interactive = 0;
1883 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1889 #ifdef YY_USE_PROTOS
1890 void yy_flush_buffer( YY_BUFFER_STATE b )
1892 void yy_flush_buffer( b )
1902 /* We always need two end-of-buffer characters. The first causes
1903 * a transition to the end-of-buffer state. The second causes
1904 * a jam in that state.
1906 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1907 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1909 b->yy_buf_pos = &b->yy_ch_buf[0];
1912 b->yy_buffer_status = YY_BUFFER_NEW;
1914 if ( b == yy_current_buffer )
1915 yy_load_buffer_state();
1919 #ifndef YY_NO_SCAN_BUFFER
1920 #ifdef YY_USE_PROTOS
1921 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1923 YY_BUFFER_STATE yy_scan_buffer( base, size )
1931 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1932 base[size-1] != YY_END_OF_BUFFER_CHAR )
1933 /* They forgot to leave room for the EOB's. */
1936 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1938 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1940 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1941 b->yy_buf_pos = b->yy_ch_buf = base;
1942 b->yy_is_our_buffer = 0;
1943 b->yy_input_file = 0;
1944 b->yy_n_chars = b->yy_buf_size;
1945 b->yy_is_interactive = 0;
1947 b->yy_fill_buffer = 0;
1948 b->yy_buffer_status = YY_BUFFER_NEW;
1950 yy_switch_to_buffer( b );
1957 #ifndef YY_NO_SCAN_STRING
1958 #ifdef YY_USE_PROTOS
1959 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1961 YY_BUFFER_STATE yy_scan_string( yy_str )
1962 yyconst char *yy_str;
1966 for ( len = 0; yy_str[len]; ++len )
1969 return yy_scan_bytes( yy_str, len );
1974 #ifndef YY_NO_SCAN_BYTES
1975 #ifdef YY_USE_PROTOS
1976 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1978 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1979 yyconst char *bytes;
1988 /* Get memory for full buffer, including space for trailing EOB's. */
1990 buf = (char *) yy_flex_alloc( n );
1992 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1994 for ( i = 0; i < len; ++i )
1997 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1999 b = yy_scan_buffer( buf, n );
2001 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2003 /* It's okay to grow etc. this buffer, and we should throw it
2004 * away when we're done.
2006 b->yy_is_our_buffer = 1;
2013 #ifndef YY_NO_PUSH_STATE
2014 #ifdef YY_USE_PROTOS
2015 static void yy_push_state( int new_state )
2017 static void yy_push_state( new_state )
2021 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2025 yy_start_stack_depth += YY_START_STACK_INCR;
2026 new_size = yy_start_stack_depth * sizeof( int );
2028 if ( ! yy_start_stack )
2029 yy_start_stack = (int *) yy_flex_alloc( new_size );
2032 yy_start_stack = (int *) yy_flex_realloc(
2033 (void *) yy_start_stack, new_size );
2035 if ( ! yy_start_stack )
2037 "out of memory expanding start-condition stack" );
2040 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2047 #ifndef YY_NO_POP_STATE
2048 static void yy_pop_state()
2050 if ( --yy_start_stack_ptr < 0 )
2051 YY_FATAL_ERROR( "start-condition stack underflow" );
2053 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2058 #ifndef YY_NO_TOP_STATE
2059 static int yy_top_state()
2061 return yy_start_stack[yy_start_stack_ptr - 1];
2065 #ifndef YY_EXIT_FAILURE
2066 #define YY_EXIT_FAILURE 2
2069 #ifdef YY_USE_PROTOS
2070 static void yy_fatal_error( yyconst char msg[] )
2072 static void yy_fatal_error( msg )
2076 (void) fprintf( stderr, "%s\n", msg );
2077 exit( YY_EXIT_FAILURE );
2082 /* Redefine yyless() so it works in section 3 code. */
2088 /* Undo effects of setting up yytext. */ \
2089 yytext[yyleng] = yy_hold_char; \
2090 yy_c_buf_p = yytext + n; \
2091 yy_hold_char = *yy_c_buf_p; \
2092 *yy_c_buf_p = '\0'; \
2098 /* Internal utility routines. */
2101 #ifdef YY_USE_PROTOS
2102 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2104 static void yy_flex_strncpy( s1, s2, n )
2111 for ( i = 0; i < n; ++i )
2116 #ifdef YY_NEED_STRLEN
2117 #ifdef YY_USE_PROTOS
2118 static int yy_flex_strlen( yyconst char *s )
2120 static int yy_flex_strlen( s )
2125 for ( n = 0; s[n]; ++n )
2133 #ifdef YY_USE_PROTOS
2134 static void *yy_flex_alloc( yy_size_t size )
2136 static void *yy_flex_alloc( size )
2140 return (void *) malloc( size );
2143 #ifdef YY_USE_PROTOS
2144 static void *yy_flex_realloc( void *ptr, yy_size_t size )
2146 static void *yy_flex_realloc( ptr, size )
2151 /* The cast to (char *) in the following accommodates both
2152 * implementations that use char* generic pointers, and those
2153 * that use void* generic pointers. It works with the latter
2154 * because both ANSI C and C++ allow castless assignment from
2155 * any pointer type to void*, and deal with argument conversions
2156 * as though doing an assignment.
2158 return (void *) realloc( (char *) ptr, size );
2161 #ifdef YY_USE_PROTOS
2162 static void yy_flex_free( void *ptr )
2164 static void yy_flex_free( ptr )
2181 void yyerror(char message[])
2183 elog(ERROR, "parser: %s at or near \"%s\"", message, yytext);
2193 called by postgres before any actual parsing is done
2198 /* it's important to set this to NULL
2199 because input()/myinput() checks the non-nullness of parseCh
2200 to know when to pass the string to lex/flex */
2202 #if defined(FLEX_SCANNER)
2203 if (YY_CURRENT_BUFFER)
2204 yy_flush_buffer(YY_CURRENT_BUFFER);
2205 #endif /* FLEX_SCANNER */
2209 #if !defined(FLEX_SCANNER)
2210 /* get lex input from a string instead of from stdin */
2214 if (parseCh == NULL)
2216 parseCh = parseString;
2219 else if (*parseCh == '\0')
2225 /* undo lex input from a string instead of from stdin */
2229 if (parseCh == NULL)
2230 elog(FATAL, "Unput() failed.\n");
2234 #endif /* !defined(FLEX_SCANNER) */
2237 /* input routine for flex to read input from a string instead of a file */
2239 myinput(char* buf, int max)
2243 if (parseCh == NULL)
2245 len = strlen(parseString);
2251 memcpy(buf, parseString, copylen);
2252 buf[copylen] = '\0';
2253 parseCh = parseString;
2257 return 0; /* end of string */
2259 #endif /* FLEX_SCANNER */