]> granicus.if.org Git - postgresql/blob - src/backend/parser/scan.c
4fda82c9550e0f9ce02712f449fae24475bf6e13
[postgresql] / src / backend / parser / scan.c
1 /* A lexical scanner generated by flex */
2
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 $
5  */
6
7 #define FLEX_SCANNER
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
10
11 #include <stdio.h>
12
13
14 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
15 #ifdef c_plusplus
16 #ifndef __cplusplus
17 #define __cplusplus
18 #endif
19 #endif
20
21
22 #ifdef __cplusplus
23
24 #include <stdlib.h>
25 #include <unistd.h>
26
27 /* Use prototypes in function declarations. */
28 #define YY_USE_PROTOS
29
30 /* The "const" storage-class-modifier is valid. */
31 #define YY_USE_CONST
32
33 #else   /* ! __cplusplus */
34
35 #if __STDC__
36
37 #define YY_USE_PROTOS
38 #define YY_USE_CONST
39
40 #endif  /* __STDC__ */
41 #endif  /* ! __cplusplus */
42
43 #ifdef __TURBOC__
44  #pragma warn -rch
45  #pragma warn -use
46 #include <io.h>
47 #include <stdlib.h>
48 #define YY_USE_CONST
49 #define YY_USE_PROTOS
50 #endif
51
52 #ifdef YY_USE_CONST
53 #define yyconst const
54 #else
55 #define yyconst
56 #endif
57
58
59 #ifdef YY_USE_PROTOS
60 #define YY_PROTO(proto) proto
61 #else
62 #define YY_PROTO(proto) ()
63 #endif
64
65 /* Returned upon end-of-file. */
66 #define YY_NULL 0
67
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
71  * double cast.
72  */
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
74
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.
78  */
79 #define BEGIN yy_start = 1 + 2 *
80
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
83  * compatibility.
84  */
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
87
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
90
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
93
94 #define YY_END_OF_BUFFER_CHAR 0
95
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
98
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
100
101 extern int yyleng;
102 extern FILE *yyin, *yyout;
103
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
107
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:
111  *
112  *      if ( condition_holds )
113  *              yyless( 5 );
114  *      else
115  *              do_something_else();
116  *
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.
120  */
121
122 /* Return all but the first 'n' matched characters back to the input stream. */
123
124 #define yyless(n) \
125         do \
126                 { \
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 */ \
132                 } \
133         while ( 0 )
134
135 #define unput(c) yyunput( c, yytext_ptr )
136
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).
140  */
141 typedef unsigned int yy_size_t;
142
143
144 struct yy_buffer_state
145         {
146         FILE *yy_input_file;
147
148         char *yy_ch_buf;                /* input buffer */
149         char *yy_buf_pos;               /* current position in input buffer */
150
151         /* Size of input buffer in bytes, not including room for EOB
152          * characters.
153          */
154         yy_size_t yy_buf_size;
155
156         /* Number of characters read into yy_ch_buf, not including EOB
157          * characters.
158          */
159         int yy_n_chars;
160
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
163          * delete it.
164          */
165         int yy_is_our_buffer;
166
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
170          * each newline.
171          */
172         int yy_is_interactive;
173
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
176          * not.
177          */
178         int yy_at_bol;
179
180         /* Whether to try to fill the input buffer when we reach the
181          * end of it.
182          */
183         int yy_fill_buffer;
184
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.
193          *
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.
197          */
198 #define YY_BUFFER_EOF_PENDING 2
199         };
200
201 static YY_BUFFER_STATE yy_current_buffer = 0;
202
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
205  * "scanner state".
206  */
207 #define YY_CURRENT_BUFFER yy_current_buffer
208
209
210 /* yy_hold_char holds the character lost when yytext is formed. */
211 static char yy_hold_char;
212
213 static int yy_n_chars;          /* number of characters read into yy_ch_buf */
214
215
216 int yyleng;
217
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 */
222
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 ...
225  */
226 static int yy_did_buffer_switch_on_eof;
227
228 void yyrestart YY_PROTO(( FILE *input_file ));
229
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 )
237
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 ));
241
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 * ));
245
246 #define yy_new_buffer yy_create_buffer
247
248 #define yy_set_interactive(is_interactive) \
249         { \
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; \
253         }
254
255 #define yy_set_bol(at_bol) \
256         { \
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; \
260         }
261
262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
263
264
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;
269 extern char *yytext;
270 #define yytext_ptr yytext
271
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[] ));
276
277 /* Done after the current pattern has been matched and before the
278  * corresponding action - sets up yytext.
279  */
280 #define YY_DO_BEFORE_ACTION \
281         yytext_ptr = yy_bp; \
282         yyleng = (int) (yy_cp - yy_bp); \
283         yy_hold_char = *yy_cp; \
284         *yy_cp = '\0'; \
285         yy_c_buf_p = yy_cp;
286
287 #define YY_NUM_RULES 41
288 #define YY_END_OF_BUFFER 42
289 static yyconst short int yy_acclist[168] =
290     {   0,
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,
301
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
309     } ;
310
311 static yyconst short int yy_accept[128] =
312     {   0,
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,
323
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
327     } ;
328
329 static yyconst int yy_ec[256] =
330     {   0,
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,
341
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,
352
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,
358        17,   17,   17,   17,   17
359     } ;
360
361 static yyconst int yy_meta[22] =
362     {   0,
363         1,    2,    3,    4,    5,    4,    6,    1,    7,    8,
364         9,   10,    4,   11,    4,    4,    2,    2,   11,    2,
365        12
366     } ;
367
368 static yyconst short int yy_base[146] =
369     {   0,
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,
380
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
386     } ;
387
388 static yyconst short int yy_def[146] =
389     {   0,
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,
400
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
406     } ;
407
408 static yyconst short int yy_nxt[457] =
409     {   0,
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,
420
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,
431
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,
442
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,
453
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
460     } ;
461
462 static yyconst short int yy_chk[457] =
463     {   0,
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,
474
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,
485
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,
496
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,
507
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
514     } ;
515
516 static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
517 static char *yy_full_match;
518 static int yy_lp;
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
524 #define REJECT \
525 { \
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 */ \
531 ++yy_lp; \
532 goto find_rule; \
533 }
534 #define yymore() yymore_used_but_not_detected
535 #define YY_MORE_ADJ 0
536 #define YY_RESTORE_YY_MORE_OFFSET
537 char *yytext;
538 #line 1 "scan.l"
539 #define INITIAL 0
540 #line 2 "scan.l"
541 /*-------------------------------------------------------------------------
542  *
543  * scan.l--
544  *        lexical scanner for POSTGRES
545  *
546  * Copyright (c) 1994, Regents of the University of California
547  *
548  *
549  * IDENTIFICATION
550  *        $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.15 1998/02/21 06:31:52 scrappy Exp $
551  *
552  *-------------------------------------------------------------------------
553  */
554 #include <ctype.h>
555 #include <unistd.h>
556 #ifndef __linux__
557 #include <math.h>
558 #else
559 #include <stdlib.h>
560 #endif /* __linux__ */
561 #include <string.h>
562 #include <errno.h>
563
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"
571 #include "parse.h"
572 #include "utils/builtins.h"
573
574 extern char *parseString;
575 static char *parseCh;
576
577 /* some versions of lex define this as a macro */
578 #if defined(yywrap)
579 #undef yywrap
580 #endif /* yywrap */
581
582 #if defined(FLEX_SCANNER)
583 /* MAX_PARSE_BUFFER is defined in miscadmin.h */
584 #define YYLMAX MAX_PARSE_BUFFER
585 #define YY_NO_UNPUT
586 extern int myinput(char* buf, int max);
587 #undef YY_INPUT
588 #define YY_INPUT(buf,result,max) {result = myinput(buf,max);}
589 #else
590 #undef input
591 int input();
592 #undef unput
593 void unput(char);
594 #endif /* FLEX_SCANNER */
595
596 extern YYSTYPE yylval;
597
598 int llen;
599 char literal[MAX_PARSE_BUFFER];
600
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.
606  *
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.
610  * Exclusive states:
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
617  *
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
623  */
624 #define xb 1
625
626 #define xc 2
627
628 #define xd 3
629
630 #define xh 4
631
632 #define xm 5
633
634 #define xq 6
635
636 /* Binary number
637  */
638 /* Hexadecimal number
639  */
640 /* Extended quote
641  * xqdouble implements SQL92 embedded quote
642  * xqcat allows strings to cross input lines
643  */
644 /* Delimited quote
645  * Allows embedded spaces and other special characters into identifiers.
646  */
647 /* Comments
648  * Ignored by the scanner and parser.
649  */
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
653  *
654  * Quoted strings must allow some special characters such as single-quote
655  *  and newline.
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
661  */
662 #line 663 "lex.yy.c"
663
664 /* Macros after this point can all be overridden by user definitions in
665  * section 1.
666  */
667
668 #ifndef YY_SKIP_YYWRAP
669 #ifdef __cplusplus
670 extern "C" int yywrap YY_PROTO(( void ));
671 #else
672 extern int yywrap YY_PROTO(( void ));
673 #endif
674 #endif
675
676 #ifndef YY_NO_UNPUT
677 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
678 #endif
679
680 #ifndef yytext_ptr
681 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
682 #endif
683
684 #ifdef YY_NEED_STRLEN
685 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
686 #endif
687
688 #ifndef YY_NO_INPUT
689 #ifdef __cplusplus
690 static int yyinput YY_PROTO(( void ));
691 #else
692 static int input YY_PROTO(( void ));
693 #endif
694 #endif
695
696 #if YY_STACK_USED
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 ));
702 #endif
703 #ifndef YY_NO_POP_STATE
704 static void yy_pop_state YY_PROTO(( void ));
705 #endif
706 #ifndef YY_NO_TOP_STATE
707 static int yy_top_state YY_PROTO(( void ));
708 #endif
709
710 #else
711 #define YY_NO_PUSH_STATE 1
712 #define YY_NO_POP_STATE 1
713 #define YY_NO_TOP_STATE 1
714 #endif
715
716 #ifdef YY_MALLOC_DECL
717 YY_MALLOC_DECL
718 #else
719 #if __STDC__
720 #ifndef __cplusplus
721 #include <stdlib.h>
722 #endif
723 #else
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).
727  */
728 #endif
729 #endif
730
731 /* Amount of stuff to slurp up with each read. */
732 #ifndef YY_READ_BUF_SIZE
733 #define YY_READ_BUF_SIZE 8192
734 #endif
735
736 /* Copy whatever the last rule matched to the standard output. */
737
738 #ifndef ECHO
739 /* This used to be an fputs(), but since the string might contain NUL's,
740  * we now use fwrite().
741  */
742 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
743 #endif
744
745 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
746  * is returned in "result".
747  */
748 #ifndef YY_INPUT
749 #define YY_INPUT(buf,result,max_size) \
750         if ( yy_current_buffer->yy_is_interactive ) \
751                 { \
752                 int c = '*', n; \
753                 for ( n = 0; n < max_size && \
754                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
755                         buf[n] = (char) c; \
756                 if ( c == '\n' ) \
757                         buf[n++] = (char) c; \
758                 if ( c == EOF && ferror( yyin ) ) \
759                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
760                 result = n; \
761                 } \
762         else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
763                   && ferror( yyin ) ) \
764                 YY_FATAL_ERROR( "input in flex scanner failed" );
765 #endif
766
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.
770  */
771 #ifndef yyterminate
772 #define yyterminate() return YY_NULL
773 #endif
774
775 /* Number of entries by which start-condition stack grows. */
776 #ifndef YY_START_STACK_INCR
777 #define YY_START_STACK_INCR 25
778 #endif
779
780 /* Report a fatal error. */
781 #ifndef YY_FATAL_ERROR
782 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
783 #endif
784
785 /* Default declaration of generated scanner - a define so the user can
786  * easily add parameters.
787  */
788 #ifndef YY_DECL
789 #define YY_DECL int yylex YY_PROTO(( void ))
790 #endif
791
792 /* Code executed at the beginning of each rule, after yytext and yyleng
793  * have been set up.
794  */
795 #ifndef YY_USER_ACTION
796 #define YY_USER_ACTION
797 #endif
798
799 /* Code executed at the end of each rule. */
800 #ifndef YY_BREAK
801 #define YY_BREAK break;
802 #endif
803
804 #define YY_RULE_SETUP \
805         YY_USER_ACTION
806
807 YY_DECL
808         {
809         register yy_state_type yy_current_state;
810         register char *yy_cp, *yy_bp;
811         register int yy_act;
812
813 #line 178 "scan.l"
814
815 #line 816 "lex.yy.c"
816
817         if ( yy_init )
818                 {
819                 yy_init = 0;
820
821 #ifdef YY_USER_INIT
822                 YY_USER_INIT;
823 #endif
824
825                 if ( ! yy_start )
826                         yy_start = 1;   /* first start state */
827
828                 if ( ! yyin )
829                         yyin = stdin;
830
831                 if ( ! yyout )
832                         yyout = stdout;
833
834                 if ( ! yy_current_buffer )
835                         yy_current_buffer =
836                                 yy_create_buffer( yyin, YY_BUF_SIZE );
837
838                 yy_load_buffer_state();
839                 }
840
841         while ( 1 )             /* loops until end-of-file is reached */
842                 {
843                 yy_cp = yy_c_buf_p;
844
845                 /* Support of yytext. */
846                 *yy_cp = yy_hold_char;
847
848                 /* yy_bp points to the position in yy_ch_buf of the start of
849                  * the current run.
850                  */
851                 yy_bp = yy_cp;
852
853                 yy_current_state = yy_start;
854                 yy_state_ptr = yy_state_buf;
855                 *yy_state_ptr++ = yy_current_state;
856 yy_match:
857                 do
858                         {
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 )
861                                 {
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];
865                                 }
866                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
867                         *yy_state_ptr++ = yy_current_state;
868                         ++yy_cp;
869                         }
870                 while ( yy_base[yy_current_state] != 435 );
871
872 yy_find_action:
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 */
877                         {
878                         if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
879                                 {
880                                 yy_act = yy_acclist[yy_lp];
881                                 if ( yy_act & YY_TRAILING_HEAD_MASK ||
882                                      yy_looking_for_trail_begin )
883                                         {
884                                         if ( yy_act == yy_looking_for_trail_begin )
885                                                 {
886                                                 yy_looking_for_trail_begin = 0;
887                                                 yy_act &= ~YY_TRAILING_HEAD_MASK;
888                                                 break;
889                                                 }
890                                         }
891                                 else if ( yy_act & YY_TRAILING_MASK )
892                                         {
893                                         yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
894                                         yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
895                                         }
896                                 else
897                                         {
898                                         yy_full_match = yy_cp;
899                                         yy_full_state = yy_state_ptr;
900                                         yy_full_lp = yy_lp;
901                                         break;
902                                         }
903                                 ++yy_lp;
904                                 goto find_rule;
905                                 }
906                         --yy_cp;
907                         yy_current_state = *--yy_state_ptr;
908                         yy_lp = yy_accept[yy_current_state];
909                         }
910
911                 YY_DO_BEFORE_ACTION;
912
913
914 do_action:      /* This label is used only to access EOF actions. */
915
916
917                 switch ( yy_act )
918         { /* beginning of action switch */
919 case 1:
920 YY_RULE_SETUP
921 #line 179 "scan.l"
922 { /* ignore */ }
923         YY_BREAK
924 case 2:
925 YY_RULE_SETUP
926 #line 181 "scan.l"
927 { /* ignore */ }
928         YY_BREAK
929 case 3:
930 #line 184 "scan.l"
931 case 4:
932 YY_RULE_SETUP
933 #line 184 "scan.l"
934 { BEGIN(xc); }
935         YY_BREAK
936 case 5:
937 YY_RULE_SETUP
938 #line 186 "scan.l"
939 { BEGIN(INITIAL); }
940         YY_BREAK
941 case 6:
942 YY_RULE_SETUP
943 #line 188 "scan.l"
944 { /* ignore */ }
945         YY_BREAK
946 case 7:
947 YY_RULE_SETUP
948 #line 190 "scan.l"
949 {
950                                         BEGIN(xb);
951                                         llen = 0;
952                                         *literal = '\0';
953                                 }
954         YY_BREAK
955 case 8:
956 YY_RULE_SETUP
957 #line 195 "scan.l"
958 {
959                                         char* endptr;
960
961                                         BEGIN(INITIAL);
962                                         errno = 0;
963                                         yylval.ival = strtol((char *)literal,&endptr,2);
964                                         if (*endptr != '\0' || errno == ERANGE)
965                                                 elog(ERROR,"Bad binary integer input '%s'",literal);
966                                         return (ICONST);
967                                 }
968         YY_BREAK
969 case 9:
970 #line 206 "scan.l"
971 case 10:
972 YY_RULE_SETUP
973 #line 206 "scan.l"
974 {
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);
978                                         llen += yyleng;
979                                 }
980         YY_BREAK
981 case 11:
982 #line 213 "scan.l"
983 case 12:
984 YY_RULE_SETUP
985 #line 213 "scan.l"
986 {
987                                 }
988         YY_BREAK
989 case 13:
990 YY_RULE_SETUP
991 #line 216 "scan.l"
992 {
993                                         BEGIN(xh);
994                                         llen = 0;
995                                         *literal = '\0';
996                                 }
997         YY_BREAK
998 case 14:
999 YY_RULE_SETUP
1000 #line 221 "scan.l"
1001 {
1002                                         char* endptr;
1003
1004                                         BEGIN(INITIAL);
1005                                         errno = 0;
1006                                         yylval.ival = strtol((char *)literal,&endptr,16);
1007                                         if (*endptr != '\0' || errno == ERANGE)
1008                                                 elog(ERROR,"Bad hexadecimal integer input '%s'",literal);
1009                                         return (ICONST);
1010                                 }
1011         YY_BREAK
1012 case 15:
1013 YY_RULE_SETUP
1014 #line 232 "scan.l"
1015 {
1016                                         BEGIN(xq);
1017                                         llen = 0;
1018                                         *literal = '\0';
1019                                 }
1020         YY_BREAK
1021 case 16:
1022 YY_RULE_SETUP
1023 #line 237 "scan.l"
1024 {
1025                                         BEGIN(INITIAL);
1026                                         yylval.str = pstrdup(scanstr(literal));
1027                                         return (SCONST);
1028                                 }
1029         YY_BREAK
1030 case 17:
1031 #line 243 "scan.l"
1032 case 18:
1033 YY_RULE_SETUP
1034 #line 243 "scan.l"
1035 {
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);
1039                                         llen += yyleng;
1040                                 }
1041         YY_BREAK
1042 case 19:
1043 YY_RULE_SETUP
1044 #line 249 "scan.l"
1045 {
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) = '\'';
1050                                         llen += yyleng;
1051                                 }
1052         YY_BREAK
1053 case 20:
1054 YY_RULE_SETUP
1055 #line 257 "scan.l"
1056 {
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);
1060                                         llen += yyleng;
1061                                 }
1062         YY_BREAK
1063 case 21:
1064 YY_RULE_SETUP
1065 #line 263 "scan.l"
1066 {
1067                                 }
1068         YY_BREAK
1069 case 22:
1070 YY_RULE_SETUP
1071 #line 267 "scan.l"
1072 {
1073                                         BEGIN(xd);
1074                                         llen = 0;
1075                                         *literal = '\0';
1076                                 }
1077         YY_BREAK
1078 case 23:
1079 YY_RULE_SETUP
1080 #line 272 "scan.l"
1081 {
1082                                         BEGIN(INITIAL);
1083                                         yylval.str = pstrdup(literal);
1084                                         return (IDENT);
1085                                 }
1086         YY_BREAK
1087 case 24:
1088 YY_RULE_SETUP
1089 #line 277 "scan.l"
1090 {
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);
1094                                         llen += yyleng;
1095                                 }
1096         YY_BREAK
1097 case 25:
1098 YY_RULE_SETUP
1099 #line 285 "scan.l"
1100 { /* ignore */ }
1101         YY_BREAK
1102 case 26:
1103 YY_RULE_SETUP
1104 #line 286 "scan.l"
1105 {
1106                                         BEGIN(INITIAL);
1107                                         return (yytext[0]);
1108                                 }
1109         YY_BREAK
1110 case 27:
1111 YY_RULE_SETUP
1112 #line 292 "scan.l"
1113 { return TYPECAST; }
1114         YY_BREAK
1115 case 28:
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 */
1119 YY_RULE_SETUP
1120 #line 294 "scan.l"
1121 {
1122                                         return (yytext[0]);
1123                                 }
1124         YY_BREAK
1125 case 29:
1126 YY_RULE_SETUP
1127 #line 297 "scan.l"
1128 {       return (yytext[0]); }
1129         YY_BREAK
1130 case 30:
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 */
1134 YY_RULE_SETUP
1135 #line 298 "scan.l"
1136 {
1137                                         yylval.str = pstrdup((char*)yytext);
1138                                         return (Op);
1139                                 }
1140         YY_BREAK
1141 case 31:
1142 YY_RULE_SETUP
1143 #line 302 "scan.l"
1144 {
1145                                         if (strcmp((char*)yytext,"!=") == 0)
1146                                                 yylval.str = pstrdup("<>"); /* compatability */
1147                                         else
1148                                                 yylval.str = pstrdup((char*)yytext);
1149                                         return (Op);
1150                                 }
1151         YY_BREAK
1152 case 32:
1153 YY_RULE_SETUP
1154 #line 309 "scan.l"
1155 {
1156                                         yylval.ival = atoi((char*)&yytext[1]);
1157                                         return (PARAM);
1158                                 }
1159         YY_BREAK
1160 case 33:
1161 YY_RULE_SETUP
1162 #line 314 "scan.l"
1163 {
1164                                         int i;
1165                                         ScanKeyword             *keyword;
1166
1167                                         BEGIN(xm);
1168                                         for(i = 0; yytext[i]; i++)
1169                                                 if (isupper(yytext[i]))
1170                                                         yytext[i] = tolower(yytext[i]);
1171
1172                                         keyword = ScanKeywordLookup((char*)yytext);
1173                                         if (keyword != NULL) {
1174                                                 return (keyword->value);
1175                                         }
1176                                         else
1177                                         {
1178                                                 yylval.str = pstrdup((char*)yytext);
1179                                                 return (IDENT);
1180                                         }
1181                                 }
1182         YY_BREAK
1183 case 34:
1184 YY_RULE_SETUP
1185 #line 333 "scan.l"
1186 {
1187                                         char* endptr;
1188
1189                                         BEGIN(xm);
1190                                         errno = 0;
1191                                         yylval.ival = strtol((char *)yytext,&endptr,10);
1192                                         if (*endptr != '\0' || errno == ERANGE)
1193                                         {
1194                                                 errno = 0;
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);
1200                                                 return (FCONST);
1201                                         }
1202                                         return (ICONST);
1203                                 }
1204         YY_BREAK
1205 case 35:
1206 YY_RULE_SETUP
1207 #line 351 "scan.l"
1208 {
1209                                         char* endptr;
1210
1211                                         BEGIN(xm);
1212                                         errno = 0;
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);
1217                                         return (FCONST);
1218                                 }
1219         YY_BREAK
1220 case 36:
1221 YY_RULE_SETUP
1222 #line 362 "scan.l"
1223 {
1224                                         char* endptr;
1225
1226                                         errno = 0;
1227                                         yylval.ival = strtol((char *)yytext,&endptr,10);
1228                                         if (*endptr != '\0' || errno == ERANGE)
1229                                         {
1230                                                 errno = 0;
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);
1236                                                 return (FCONST);
1237                                         }
1238                                         return (ICONST);
1239                                 }
1240         YY_BREAK
1241 case 37:
1242 YY_RULE_SETUP
1243 #line 379 "scan.l"
1244 {
1245                                         char* endptr;
1246
1247                                         errno = 0;
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);
1252                                         return (FCONST);
1253                                 }
1254         YY_BREAK
1255 case 38:
1256 YY_RULE_SETUP
1257 #line 389 "scan.l"
1258 {
1259                                         int i;
1260                                         ScanKeyword             *keyword;
1261
1262                                         for(i = 0; yytext[i]; i++)
1263                                                 if (isupper(yytext[i]))
1264                                                         yytext[i] = tolower(yytext[i]);
1265
1266                                         keyword = ScanKeywordLookup((char*)yytext);
1267                                         if (keyword != NULL) {
1268                                                 return (keyword->value);
1269                                         }
1270                                         else
1271                                         {
1272                                                 yylval.str = pstrdup((char*)yytext);
1273                                                 return (IDENT);
1274                                         }
1275                                 }
1276         YY_BREAK
1277 case 39:
1278 YY_RULE_SETUP
1279 #line 407 "scan.l"
1280 { /* ignore */ }
1281         YY_BREAK
1282 case 40:
1283 YY_RULE_SETUP
1284 #line 409 "scan.l"
1285 { return (yytext[0]); }
1286         YY_BREAK
1287 case 41:
1288 YY_RULE_SETUP
1289 #line 411 "scan.l"
1290 ECHO;
1291         YY_BREAK
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):
1300                                 yyterminate();
1301
1302         case YY_END_OF_BUFFER:
1303                 {
1304                 /* Amount of text matched not including the EOB char. */
1305                 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1306
1307                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1308                 *yy_cp = yy_hold_char;
1309                 YY_RESTORE_YY_MORE_OFFSET
1310
1311                 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1312                         {
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.
1321                          */
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;
1325                         }
1326
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
1332                  * in input().
1333                  */
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;
1337
1338                         yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1339
1340                         yy_current_state = yy_get_previous_state();
1341
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).
1349                          */
1350
1351                         yy_next_state = yy_try_NUL_trans( yy_current_state );
1352
1353                         yy_bp = yytext_ptr + YY_MORE_ADJ;
1354
1355                         if ( yy_next_state )
1356                                 {
1357                                 /* Consume the NUL. */
1358                                 yy_cp = ++yy_c_buf_p;
1359                                 yy_current_state = yy_next_state;
1360                                 goto yy_match;
1361                                 }
1362
1363                         else
1364                                 {
1365                                 yy_cp = yy_c_buf_p;
1366                                 goto yy_find_action;
1367                                 }
1368                         }
1369
1370                 else switch ( yy_get_next_buffer() )
1371                         {
1372                         case EOB_ACT_END_OF_FILE:
1373                                 {
1374                                 yy_did_buffer_switch_on_eof = 0;
1375
1376                                 if ( yywrap() )
1377                                         {
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.
1386                                          */
1387                                         yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1388
1389                                         yy_act = YY_STATE_EOF(YY_START);
1390                                         goto do_action;
1391                                         }
1392
1393                                 else
1394                                         {
1395                                         if ( ! yy_did_buffer_switch_on_eof )
1396                                                 YY_NEW_FILE;
1397                                         }
1398                                 break;
1399                                 }
1400
1401                         case EOB_ACT_CONTINUE_SCAN:
1402                                 yy_c_buf_p =
1403                                         yytext_ptr + yy_amount_of_matched_text;
1404
1405                                 yy_current_state = yy_get_previous_state();
1406
1407                                 yy_cp = yy_c_buf_p;
1408                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
1409                                 goto yy_match;
1410
1411                         case EOB_ACT_LAST_MATCH:
1412                                 yy_c_buf_p =
1413                                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1414
1415                                 yy_current_state = yy_get_previous_state();
1416
1417                                 yy_cp = yy_c_buf_p;
1418                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
1419                                 goto yy_find_action;
1420                         }
1421                 break;
1422                 }
1423
1424         default:
1425                 YY_FATAL_ERROR(
1426                         "fatal flex scanner internal error--no action found" );
1427         } /* end of action switch */
1428                 } /* end of scanning one token */
1429         } /* end of yylex */
1430
1431
1432 /* yy_get_next_buffer - try to read in a new buffer
1433  *
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
1438  */
1439
1440 static int yy_get_next_buffer()
1441         {
1442         register char *dest = yy_current_buffer->yy_ch_buf;
1443         register char *source = yytext_ptr;
1444         register int number_to_move, i;
1445         int ret_val;
1446
1447         if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1448                 YY_FATAL_ERROR(
1449                 "fatal flex scanner internal error--end of buffer missed" );
1450
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 )
1454                         {
1455                         /* We matched a single character, the EOB, so
1456                          * treat this as a final EOF.
1457                          */
1458                         return EOB_ACT_END_OF_FILE;
1459                         }
1460
1461                 else
1462                         {
1463                         /* We matched some text prior to the EOB, first
1464                          * process it.
1465                          */
1466                         return EOB_ACT_LAST_MATCH;
1467                         }
1468                 }
1469
1470         /* Try to read more data. */
1471
1472         /* First move last chars to start of buffer. */
1473         number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1474
1475         for ( i = 0; i < number_to_move; ++i )
1476                 *(dest++) = *(source++);
1477
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,
1480                  * just force an EOF
1481                  */
1482                 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1483
1484         else
1485                 {
1486                 int num_to_read =
1487                         yy_current_buffer->yy_buf_size - number_to_move - 1;
1488
1489                 while ( num_to_read <= 0 )
1490                         { /* Not enough room in the buffer - grow it. */
1491 #ifdef YY_USES_REJECT
1492                         YY_FATAL_ERROR(
1493 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1494 #else
1495
1496                         /* just a shorter name for the current buffer */
1497                         YY_BUFFER_STATE b = yy_current_buffer;
1498
1499                         int yy_c_buf_p_offset =
1500                                 (int) (yy_c_buf_p - b->yy_ch_buf);
1501
1502                         if ( b->yy_is_our_buffer )
1503                                 {
1504                                 int new_size = b->yy_buf_size * 2;
1505
1506                                 if ( new_size <= 0 )
1507                                         b->yy_buf_size += b->yy_buf_size / 8;
1508                                 else
1509                                         b->yy_buf_size *= 2;
1510
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 );
1515                                 }
1516                         else
1517                                 /* Can't grow it, we don't own it. */
1518                                 b->yy_ch_buf = 0;
1519
1520                         if ( ! b->yy_ch_buf )
1521                                 YY_FATAL_ERROR(
1522                                 "fatal error - scanner input buffer overflow" );
1523
1524                         yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1525
1526                         num_to_read = yy_current_buffer->yy_buf_size -
1527                                                 number_to_move - 1;
1528 #endif
1529                         }
1530
1531                 if ( num_to_read > YY_READ_BUF_SIZE )
1532                         num_to_read = YY_READ_BUF_SIZE;
1533
1534                 /* Read in more data. */
1535                 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1536                         yy_n_chars, num_to_read );
1537
1538                 yy_current_buffer->yy_n_chars = yy_n_chars;
1539                 }
1540
1541         if ( yy_n_chars == 0 )
1542                 {
1543                 if ( number_to_move == YY_MORE_ADJ )
1544                         {
1545                         ret_val = EOB_ACT_END_OF_FILE;
1546                         yyrestart( yyin );
1547                         }
1548
1549                 else
1550                         {
1551                         ret_val = EOB_ACT_LAST_MATCH;
1552                         yy_current_buffer->yy_buffer_status =
1553                                 YY_BUFFER_EOF_PENDING;
1554                         }
1555                 }
1556
1557         else
1558                 ret_val = EOB_ACT_CONTINUE_SCAN;
1559
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;
1563
1564         yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1565
1566         return ret_val;
1567         }
1568
1569
1570 /* yy_get_previous_state - get the state just before the EOB char was reached */
1571
1572 static yy_state_type yy_get_previous_state()
1573         {
1574         register yy_state_type yy_current_state;
1575         register char *yy_cp;
1576
1577         yy_current_state = yy_start;
1578         yy_state_ptr = yy_state_buf;
1579         *yy_state_ptr++ = yy_current_state;
1580
1581         for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1582                 {
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 )
1585                         {
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];
1589                         }
1590                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1591                 *yy_state_ptr++ = yy_current_state;
1592                 }
1593
1594         return yy_current_state;
1595         }
1596
1597
1598 /* yy_try_NUL_trans - try to make a transition on the NUL character
1599  *
1600  * synopsis
1601  *      next_state = yy_try_NUL_trans( current_state );
1602  */
1603
1604 #ifdef YY_USE_PROTOS
1605 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1606 #else
1607 static yy_state_type yy_try_NUL_trans( yy_current_state )
1608 yy_state_type yy_current_state;
1609 #endif
1610         {
1611         register int yy_is_jam;
1612
1613         register YY_CHAR yy_c = 1;
1614         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1615                 {
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];
1619                 }
1620         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1621         yy_is_jam = (yy_current_state == 126);
1622         if ( ! yy_is_jam )
1623                 *yy_state_ptr++ = yy_current_state;
1624
1625         return yy_is_jam ? 0 : yy_current_state;
1626         }
1627
1628
1629 #ifndef YY_NO_UNPUT
1630 #ifdef YY_USE_PROTOS
1631 static void yyunput( int c, register char *yy_bp )
1632 #else
1633 static void yyunput( c, yy_bp )
1634 int c;
1635 register char *yy_bp;
1636 #endif
1637         {
1638         register char *yy_cp = yy_c_buf_p;
1639
1640         /* undo effects of setting up yytext */
1641         *yy_cp = yy_hold_char;
1642
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];
1651
1652                 while ( source > yy_current_buffer->yy_ch_buf )
1653                         *--dest = *--source;
1654
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;
1659
1660                 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1661                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
1662                 }
1663
1664         *--yy_cp = (char) c;
1665
1666
1667         yytext_ptr = yy_bp;
1668         yy_hold_char = *yy_cp;
1669         yy_c_buf_p = yy_cp;
1670         }
1671 #endif  /* ifndef YY_NO_UNPUT */
1672
1673
1674 #ifdef __cplusplus
1675 static int yyinput()
1676 #else
1677 static int input()
1678 #endif
1679         {
1680         int c;
1681
1682         *yy_c_buf_p = yy_hold_char;
1683
1684         if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1685                 {
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.
1689                  */
1690                 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1691                         /* This was really a NUL. */
1692                         *yy_c_buf_p = '\0';
1693
1694                 else
1695                         { /* need more input */
1696                         int offset = yy_c_buf_p - yytext_ptr;
1697                         ++yy_c_buf_p;
1698
1699                         switch ( yy_get_next_buffer() )
1700                                 {
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.
1710                                          */
1711
1712                                         /* Reset buffer status. */
1713                                         yyrestart( yyin );
1714
1715                                         /* fall through */
1716
1717                                 case EOB_ACT_END_OF_FILE:
1718                                         {
1719                                         if ( yywrap() )
1720                                                 return EOF;
1721
1722                                         if ( ! yy_did_buffer_switch_on_eof )
1723                                                 YY_NEW_FILE;
1724 #ifdef __cplusplus
1725                                         return yyinput();
1726 #else
1727                                         return input();
1728 #endif
1729                                         }
1730
1731                                 case EOB_ACT_CONTINUE_SCAN:
1732                                         yy_c_buf_p = yytext_ptr + offset;
1733                                         break;
1734                                 }
1735                         }
1736                 }
1737
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;
1741
1742
1743         return c;
1744         }
1745
1746
1747 #ifdef YY_USE_PROTOS
1748 void yyrestart( FILE *input_file )
1749 #else
1750 void yyrestart( input_file )
1751 FILE *input_file;
1752 #endif
1753         {
1754         if ( ! yy_current_buffer )
1755                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1756
1757         yy_init_buffer( yy_current_buffer, input_file );
1758         yy_load_buffer_state();
1759         }
1760
1761
1762 #ifdef YY_USE_PROTOS
1763 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1764 #else
1765 void yy_switch_to_buffer( new_buffer )
1766 YY_BUFFER_STATE new_buffer;
1767 #endif
1768         {
1769         if ( yy_current_buffer == new_buffer )
1770                 return;
1771
1772         if ( yy_current_buffer )
1773                 {
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;
1778                 }
1779
1780         yy_current_buffer = new_buffer;
1781         yy_load_buffer_state();
1782
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.
1787          */
1788         yy_did_buffer_switch_on_eof = 1;
1789         }
1790
1791
1792 #ifdef YY_USE_PROTOS
1793 void yy_load_buffer_state( void )
1794 #else
1795 void yy_load_buffer_state()
1796 #endif
1797         {
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;
1802         }
1803
1804
1805 #ifdef YY_USE_PROTOS
1806 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1807 #else
1808 YY_BUFFER_STATE yy_create_buffer( file, size )
1809 FILE *file;
1810 int size;
1811 #endif
1812         {
1813         YY_BUFFER_STATE b;
1814
1815         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1816         if ( ! b )
1817                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1818
1819         b->yy_buf_size = size;
1820
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.
1823          */
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()" );
1827
1828         b->yy_is_our_buffer = 1;
1829
1830         yy_init_buffer( b, file );
1831
1832         return b;
1833         }
1834
1835
1836 #ifdef YY_USE_PROTOS
1837 void yy_delete_buffer( YY_BUFFER_STATE b )
1838 #else
1839 void yy_delete_buffer( b )
1840 YY_BUFFER_STATE b;
1841 #endif
1842         {
1843         if ( ! b )
1844                 return;
1845
1846         if ( b == yy_current_buffer )
1847                 yy_current_buffer = (YY_BUFFER_STATE) 0;
1848
1849         if ( b->yy_is_our_buffer )
1850                 yy_flex_free( (void *) b->yy_ch_buf );
1851
1852         yy_flex_free( (void *) b );
1853         }
1854
1855
1856 #ifndef YY_ALWAYS_INTERACTIVE
1857 #ifndef YY_NEVER_INTERACTIVE
1858 extern int isatty YY_PROTO(( int ));
1859 #endif
1860 #endif
1861
1862 #ifdef YY_USE_PROTOS
1863 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1864 #else
1865 void yy_init_buffer( b, file )
1866 YY_BUFFER_STATE b;
1867 FILE *file;
1868 #endif
1869
1870
1871         {
1872         yy_flush_buffer( b );
1873
1874         b->yy_input_file = file;
1875         b->yy_fill_buffer = 1;
1876
1877 #if YY_ALWAYS_INTERACTIVE
1878         b->yy_is_interactive = 1;
1879 #else
1880 #if YY_NEVER_INTERACTIVE
1881         b->yy_is_interactive = 0;
1882 #else
1883         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1884 #endif
1885 #endif
1886         }
1887
1888
1889 #ifdef YY_USE_PROTOS
1890 void yy_flush_buffer( YY_BUFFER_STATE b )
1891 #else
1892 void yy_flush_buffer( b )
1893 YY_BUFFER_STATE b;
1894 #endif
1895
1896         {
1897         if ( ! b )
1898                 return;
1899
1900         b->yy_n_chars = 0;
1901
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.
1905          */
1906         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1907         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1908
1909         b->yy_buf_pos = &b->yy_ch_buf[0];
1910
1911         b->yy_at_bol = 1;
1912         b->yy_buffer_status = YY_BUFFER_NEW;
1913
1914         if ( b == yy_current_buffer )
1915                 yy_load_buffer_state();
1916         }
1917
1918
1919 #ifndef YY_NO_SCAN_BUFFER
1920 #ifdef YY_USE_PROTOS
1921 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1922 #else
1923 YY_BUFFER_STATE yy_scan_buffer( base, size )
1924 char *base;
1925 yy_size_t size;
1926 #endif
1927         {
1928         YY_BUFFER_STATE b;
1929
1930         if ( size < 2 ||
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. */
1934                 return 0;
1935
1936         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1937         if ( ! b )
1938                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1939
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;
1946         b->yy_at_bol = 1;
1947         b->yy_fill_buffer = 0;
1948         b->yy_buffer_status = YY_BUFFER_NEW;
1949
1950         yy_switch_to_buffer( b );
1951
1952         return b;
1953         }
1954 #endif
1955
1956
1957 #ifndef YY_NO_SCAN_STRING
1958 #ifdef YY_USE_PROTOS
1959 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1960 #else
1961 YY_BUFFER_STATE yy_scan_string( yy_str )
1962 yyconst char *yy_str;
1963 #endif
1964         {
1965         int len;
1966         for ( len = 0; yy_str[len]; ++len )
1967                 ;
1968
1969         return yy_scan_bytes( yy_str, len );
1970         }
1971 #endif
1972
1973
1974 #ifndef YY_NO_SCAN_BYTES
1975 #ifdef YY_USE_PROTOS
1976 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1977 #else
1978 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1979 yyconst char *bytes;
1980 int len;
1981 #endif
1982         {
1983         YY_BUFFER_STATE b;
1984         char *buf;
1985         yy_size_t n;
1986         int i;
1987
1988         /* Get memory for full buffer, including space for trailing EOB's. */
1989         n = len + 2;
1990         buf = (char *) yy_flex_alloc( n );
1991         if ( ! buf )
1992                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1993
1994         for ( i = 0; i < len; ++i )
1995                 buf[i] = bytes[i];
1996
1997         buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1998
1999         b = yy_scan_buffer( buf, n );
2000         if ( ! b )
2001                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2002
2003         /* It's okay to grow etc. this buffer, and we should throw it
2004          * away when we're done.
2005          */
2006         b->yy_is_our_buffer = 1;
2007
2008         return b;
2009         }
2010 #endif
2011
2012
2013 #ifndef YY_NO_PUSH_STATE
2014 #ifdef YY_USE_PROTOS
2015 static void yy_push_state( int new_state )
2016 #else
2017 static void yy_push_state( new_state )
2018 int new_state;
2019 #endif
2020         {
2021         if ( yy_start_stack_ptr >= yy_start_stack_depth )
2022                 {
2023                 yy_size_t new_size;
2024
2025                 yy_start_stack_depth += YY_START_STACK_INCR;
2026                 new_size = yy_start_stack_depth * sizeof( int );
2027
2028                 if ( ! yy_start_stack )
2029                         yy_start_stack = (int *) yy_flex_alloc( new_size );
2030
2031                 else
2032                         yy_start_stack = (int *) yy_flex_realloc(
2033                                         (void *) yy_start_stack, new_size );
2034
2035                 if ( ! yy_start_stack )
2036                         YY_FATAL_ERROR(
2037                         "out of memory expanding start-condition stack" );
2038                 }
2039
2040         yy_start_stack[yy_start_stack_ptr++] = YY_START;
2041
2042         BEGIN(new_state);
2043         }
2044 #endif
2045
2046
2047 #ifndef YY_NO_POP_STATE
2048 static void yy_pop_state()
2049         {
2050         if ( --yy_start_stack_ptr < 0 )
2051                 YY_FATAL_ERROR( "start-condition stack underflow" );
2052
2053         BEGIN(yy_start_stack[yy_start_stack_ptr]);
2054         }
2055 #endif
2056
2057
2058 #ifndef YY_NO_TOP_STATE
2059 static int yy_top_state()
2060         {
2061         return yy_start_stack[yy_start_stack_ptr - 1];
2062         }
2063 #endif
2064
2065 #ifndef YY_EXIT_FAILURE
2066 #define YY_EXIT_FAILURE 2
2067 #endif
2068
2069 #ifdef YY_USE_PROTOS
2070 static void yy_fatal_error( yyconst char msg[] )
2071 #else
2072 static void yy_fatal_error( msg )
2073 char msg[];
2074 #endif
2075         {
2076         (void) fprintf( stderr, "%s\n", msg );
2077         exit( YY_EXIT_FAILURE );
2078         }
2079
2080
2081
2082 /* Redefine yyless() so it works in section 3 code. */
2083
2084 #undef yyless
2085 #define yyless(n) \
2086         do \
2087                 { \
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'; \
2093                 yyleng = n; \
2094                 } \
2095         while ( 0 )
2096
2097
2098 /* Internal utility routines. */
2099
2100 #ifndef yytext_ptr
2101 #ifdef YY_USE_PROTOS
2102 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2103 #else
2104 static void yy_flex_strncpy( s1, s2, n )
2105 char *s1;
2106 yyconst char *s2;
2107 int n;
2108 #endif
2109         {
2110         register int i;
2111         for ( i = 0; i < n; ++i )
2112                 s1[i] = s2[i];
2113         }
2114 #endif
2115
2116 #ifdef YY_NEED_STRLEN
2117 #ifdef YY_USE_PROTOS
2118 static int yy_flex_strlen( yyconst char *s )
2119 #else
2120 static int yy_flex_strlen( s )
2121 yyconst char *s;
2122 #endif
2123         {
2124         register int n;
2125         for ( n = 0; s[n]; ++n )
2126                 ;
2127
2128         return n;
2129         }
2130 #endif
2131
2132
2133 #ifdef YY_USE_PROTOS
2134 static void *yy_flex_alloc( yy_size_t size )
2135 #else
2136 static void *yy_flex_alloc( size )
2137 yy_size_t size;
2138 #endif
2139         {
2140         return (void *) malloc( size );
2141         }
2142
2143 #ifdef YY_USE_PROTOS
2144 static void *yy_flex_realloc( void *ptr, yy_size_t size )
2145 #else
2146 static void *yy_flex_realloc( ptr, size )
2147 void *ptr;
2148 yy_size_t size;
2149 #endif
2150         {
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.
2157          */
2158         return (void *) realloc( (char *) ptr, size );
2159         }
2160
2161 #ifdef YY_USE_PROTOS
2162 static void yy_flex_free( void *ptr )
2163 #else
2164 static void yy_flex_free( ptr )
2165 void *ptr;
2166 #endif
2167         {
2168         free( ptr );
2169         }
2170
2171 #if YY_MAIN
2172 int main()
2173         {
2174         yylex();
2175         return 0;
2176         }
2177 #endif
2178 #line 411 "scan.l"
2179
2180
2181 void yyerror(char message[])
2182 {
2183         elog(ERROR, "parser: %s at or near \"%s\"", message, yytext);
2184 }
2185
2186 int yywrap()
2187 {
2188         return(1);
2189 }
2190
2191 /*
2192  init_io:
2193         called by postgres before any actual parsing is done
2194 */
2195 void
2196 init_io()
2197 {
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 */
2201         parseCh = NULL;
2202 #if defined(FLEX_SCANNER)
2203         if (YY_CURRENT_BUFFER)
2204                 yy_flush_buffer(YY_CURRENT_BUFFER);
2205 #endif /* FLEX_SCANNER */
2206         BEGIN INITIAL;
2207 }
2208
2209 #if !defined(FLEX_SCANNER)
2210 /* get lex input from a string instead of from stdin */
2211 int
2212 input()
2213 {
2214         if (parseCh == NULL)
2215         {
2216                 parseCh = parseString;
2217                 return(*parseCh++);
2218         }
2219         else if (*parseCh == '\0')
2220                 return(0);
2221         else
2222                 return(*parseCh++);
2223 }
2224
2225 /* undo lex input from a string instead of from stdin */
2226 void
2227 unput(char c)
2228 {
2229         if (parseCh == NULL)
2230                 elog(FATAL, "Unput() failed.\n");
2231         else if (c != 0)
2232                 *--parseCh = c;
2233 }
2234 #endif /* !defined(FLEX_SCANNER) */
2235
2236 #ifdef FLEX_SCANNER
2237 /* input routine for flex to read input from a string instead of a file */
2238 int
2239 myinput(char* buf, int max)
2240 {
2241         int len, copylen;
2242
2243         if (parseCh == NULL)
2244         {
2245                 len = strlen(parseString);
2246                 if (len >= max)
2247                         copylen = max - 1;
2248                 else
2249                         copylen = len;
2250                 if (copylen > 0)
2251                         memcpy(buf, parseString, copylen);
2252                 buf[copylen] = '\0';
2253                 parseCh = parseString;
2254                 return copylen;
2255         }
2256         else
2257                 return 0; /* end of string */
2258 }
2259 #endif /* FLEX_SCANNER */
2260