#define yy_create_buffer plpgsql_base_yy_create_buffer
#define yy_delete_buffer plpgsql_base_yy_delete_buffer
#define yy_scan_buffer plpgsql_base_yy_scan_buffer
#define yy_scan_string plpgsql_base_yy_scan_string
#define yy_scan_bytes plpgsql_base_yy_scan_bytes
#define yy_flex_debug plpgsql_base_yy_flex_debug
#define yy_init_buffer plpgsql_base_yy_init_buffer
#define yy_flush_buffer plpgsql_base_yy_flush_buffer
#define yy_load_buffer_state plpgsql_base_yy_load_buffer_state
#define yy_switch_to_buffer plpgsql_base_yy_switch_to_buffer
#define yyin plpgsql_base_yyin
#define yyleng plpgsql_base_yyleng
#define yylex plpgsql_base_yylex
#define yyout plpgsql_base_yyout
#define yyrestart plpgsql_base_yyrestart
#define yytext plpgsql_base_yytext

#line 19 "pl_scan.c"
/* A lexical scanner generated by flex */

/* Scanner skeleton version:
 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
 * $FreeBSD: src/usr.bin/lex/flex.skl,v 1.8 2004/01/06 19:03:44 nectar Exp $
 */

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5

#include <stdio.h>


/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif


#ifdef __cplusplus

#include <stdlib.h>
#include <unistd.h>

/* Use prototypes in function declarations. */
#define YY_USE_PROTOS

/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST

#else	/* ! __cplusplus */

#if __STDC__

#define YY_USE_PROTOS
#define YY_USE_CONST

#endif	/* __STDC__ */
#endif	/* ! __cplusplus */

#ifdef __TURBOC__
 #pragma warn -rch
 #pragma warn -use
#include <io.h>
#include <stdlib.h>
#define YY_USE_CONST
#define YY_USE_PROTOS
#endif

#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif


#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
#endif

/* Returned upon end-of-file. */
#define YY_NULL 0

/* Promotes a possibly negative, possibly signed char to an unsigned
 * integer for use as an array index.  If the signed char is negative,
 * we want to instead treat it as an 8-bit unsigned char, hence the
 * double cast.
 */
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)

/* Enter a start condition.  This macro really ought to take a parameter,
 * but we do it the disgusting crufty way forced on us by the ()-less
 * definition of BEGIN.
 */
#define BEGIN yy_start = 1 + 2 *

/* Translate the current start state into a value that can be later handed
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
 * compatibility.
 */
#define YY_START ((yy_start - 1) / 2)
#define YYSTATE YY_START

/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)

/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart( yyin )

#define YY_END_OF_BUFFER_CHAR 0

/* Size of default input buffer. */
#define YY_BUF_SIZE 16384

typedef struct yy_buffer_state *YY_BUFFER_STATE;

extern int yyleng;
extern FILE *yyin, *yyout;

#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2

/* The funky do-while in the following #define is used to turn the definition
 * int a single C statement (which needs a semi-colon terminator).  This
 * avoids problems with code like:
 *
 * 	if ( condition_holds )
 *		yyless( 5 );
 *	else
 *		do_something_else();
 *
 * Prior to using the do-while the compiler would get upset at the
 * "else" because it interpreted the "if" statement as being all
 * done when it reached the ';' after the yyless() call.
 */

/* Return all but the first 'n' matched characters back to the input stream. */

#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up yytext. */ \
		*yy_cp = yy_hold_char; \
		YY_RESTORE_YY_MORE_OFFSET \
		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
		} \
	while ( 0 )

#define unput(c) yyunput( c, yytext_ptr )

/* The following is because we cannot portably get our hands on size_t
 * (without autoconf's help, which isn't available because we want
 * flex-generated scanners to compile on their own).
 */
typedef unsigned int yy_size_t;


struct yy_buffer_state
	{
	FILE *yy_input_file;

	char *yy_ch_buf;		/* input buffer */
	char *yy_buf_pos;		/* current position in input buffer */

	/* Size of input buffer in bytes, not including room for EOB
	 * characters.
	 */
	yy_size_t yy_buf_size;

	/* Number of characters read into yy_ch_buf, not including EOB
	 * characters.
	 */
	int yy_n_chars;

	/* Whether we "own" the buffer - i.e., we know we created it,
	 * and can realloc() it to grow it, and should free() it to
	 * delete it.
	 */
	int yy_is_our_buffer;

	/* Whether this is an "interactive" input source; if so, and
	 * if we're using stdio for input, then we want to use getc()
	 * instead of fread(), to make sure we stop fetching input after
	 * each newline.
	 */
	int yy_is_interactive;

	/* Whether we're considered to be at the beginning of a line.
	 * If so, '^' rules will be active on the next match, otherwise
	 * not.
	 */
	int yy_at_bol;

	/* Whether to try to fill the input buffer when we reach the
	 * end of it.
	 */
	int yy_fill_buffer;

	int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
	/* When an EOF's been seen but there's still some text to process
	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
	 * shouldn't try reading from the input source any more.  We might
	 * still have a bunch of tokens to match, though, because of
	 * possible backing-up.
	 *
	 * When we actually see the EOF, we change the status to "new"
	 * (via yyrestart()), so that the user can continue scanning by
	 * just pointing yyin at a new input file.
	 */
#define YY_BUFFER_EOF_PENDING 2
	};

static YY_BUFFER_STATE yy_current_buffer = 0;

/* We provide macros for accessing buffer states in case in the
 * future we want to put the buffer states in a more general
 * "scanner state".
 */
#define YY_CURRENT_BUFFER yy_current_buffer


/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;

static int yy_n_chars;		/* number of characters read into yy_ch_buf */


int yyleng;

/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 1;		/* whether we need to initialize */
static int yy_start = 0;	/* start state number */

/* Flag which is used to allow yywrap()'s to do buffer switches
 * instead of setting up a fresh yyin.  A bit of a hack ...
 */
static int yy_did_buffer_switch_on_eof;

void yyrestart YY_PROTO(( FILE *input_file ));

void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
void yy_load_buffer_state YY_PROTO(( void ));
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )

YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));

static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
static void yy_flex_free YY_PROTO(( void * ));

#define yy_new_buffer yy_create_buffer

#define yy_set_interactive(is_interactive) \
	{ \
	if ( ! yy_current_buffer ) \
		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
	yy_current_buffer->yy_is_interactive = is_interactive; \
	}

#define yy_set_bol(at_bol) \
	{ \
	if ( ! yy_current_buffer ) \
		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
	yy_current_buffer->yy_at_bol = at_bol; \
	}

#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)


#define yywrap() 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
extern char *yytext;
#define yytext_ptr yytext

static yy_state_type yy_get_previous_state YY_PROTO(( void ));
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
static int yy_get_next_buffer YY_PROTO(( void ));
static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));

/* Done after the current pattern has been matched and before the
 * corresponding action - sets up yytext.
 */
#define YY_DO_BEFORE_ACTION \
	yytext_ptr = yy_bp; \
	yyleng = (int) (yy_cp - yy_bp); \
	yy_hold_char = *yy_cp; \
	*yy_cp = '\0'; \
	yy_c_buf_p = yy_cp;

#define YY_NUM_RULES 92
#define YY_END_OF_BUFFER 93
static yyconst short int yy_accept[360] =
    {   0,
        0,    0,    0,    0,    0,    0,    0,    0,   93,   91,
       74,   74,   91,   91,   80,   91,   91,   91,   72,   91,
        2,   56,   56,   56,   56,   56,   56,   56,   56,   56,
       56,   56,   56,   56,   56,   56,   56,   56,   91,   86,
       85,   83,   79,   78,   79,   89,   89,   90,   74,   73,
        0,   56,   87,   64,    0,   75,    3,   76,   72,    1,
        0,   56,    0,    0,   56,   56,    6,   56,   56,   56,
       56,   56,   56,   81,   56,   56,   56,   56,   56,   56,
       56,   26,   27,   31,   56,   56,   56,   56,   56,   39,
       56,   56,   56,   56,   56,   56,   49,   56,   56,   56,

        0,   86,   84,   82,   77,   89,   88,    0,   56,    0,
        0,    0,    0,    0,   75,    0,    0,    0,    0,   57,
       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,
       56,   18,   56,   56,   56,   56,   23,   56,   25,   56,
       56,   56,   32,   56,   56,   35,   56,   56,   56,   56,
       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,
       56,    0,    0,    0,    0,    0,    0,   65,    0,    0,
        0,   57,    0,   57,    0,    0,   56,   56,   56,   56,
       56,   56,   56,   56,   56,   56,   55,   15,   56,   56,
       56,   21,   56,   24,   28,   56,   30,   33,   34,   56,

       37,   38,   56,   56,   56,   56,   56,   56,   56,   56,
       48,   50,   56,   52,   56,    0,    0,    0,    0,   65,
        0,   65,    0,    0,    0,    0,    0,    0,    0,    0,
       58,    4,    5,    7,   56,   56,   56,   11,   56,   56,
       56,   56,   17,   56,   56,   22,   56,   56,   56,   41,
       56,   56,   56,   56,   56,   56,   56,   53,    0,    0,
        0,    0,    0,    0,    0,   66,    0,   59,    0,    0,
        0,   58,    0,   58,    0,   56,   56,   10,   56,   56,
       56,   16,   56,   56,   29,   36,   56,   42,   56,   44,
       56,   56,   47,   56,    0,    0,   67,    0,    0,    0,

       66,    0,   66,    0,    0,    0,    0,    0,   56,   56,
       12,   13,   56,   56,   20,   40,   56,   45,   56,   51,
       54,    0,    0,    0,    0,    0,    0,   60,    0,    8,
        9,   56,   56,   56,   56,    0,    0,   68,    0,   62,
        0,    0,   56,   19,   56,   46,   70,    0,    0,    0,
       61,   56,   43,    0,   69,   63,   14,   71,    0
    } ;

static yyconst int yy_ec[256] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
        1,    2,    4,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    1,    5,    6,    7,    8,    1,    9,    1,
        1,   10,    1,    1,   11,   12,   13,   14,   14,   14,
       14,   14,   14,   14,   14,   14,   14,   15,    1,    1,
       16,    1,    1,    1,   19,   20,   21,   22,   23,   24,
       25,   26,   27,   28,   28,   29,   30,   31,   32,   33,
       28,   34,   35,   36,   37,   38,   39,   40,   41,   28,
        1,   17,    1,    1,   18,    1,   19,   20,   21,   22,

       23,   24,   25,   26,   27,   28,   28,   29,   30,   31,
       32,   33,   28,   34,   35,   36,   37,   38,   39,   40,
       41,   28,    1,    1,    1,    1,    1,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,

       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
       28,   28,   28,   28,   28
    } ;

static yyconst int yy_meta[42] =
    {   0,
        1,    2,    3,    4,    5,    1,    6,    7,    8,    1,
        1,    9,    1,   10,    1,    1,    8,   11,   11,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
       11
    } ;

static yyconst short int yy_base[386] =
    {   0,
        0,  926,   33,   34,   42,   43,   41,   51,  926, 1116,
       53,   57,   44,   55, 1116,  904,  900,  896,  891,  888,
     1116,   62,   69,   97,   53,   52,   83,   63,   55,   84,
       90,   95,  106,   61,  111,   80,  118,  123,  822,    0,
      844,    0, 1116, 1116,  836,    0,    0,  841,  151,  840,
      838,  158, 1116,  165,  827,    0, 1116, 1116,  798, 1116,
      172,   87,   99,  183,  155,  158,  148,  168,  167,  169,
      181,  174,  183, 1116,  184,  189,  193,  195,  194,  200,
      203,  204,  214,  206,  228,  217,  220,  223,  225,  231,
      236,  240,  248,  239,  251,  250,  252,  264,  265,  267,

      774,    0, 1116, 1116, 1116,    0, 1116,  765,  299,  764,
      310,  122,  321,  761,    0,  734,  720,  325,  707,  329,
      297,  294,  311,  313,  316,  259,  321,  324,  317,  322,
      333,  330,  336,  343,  344,  347,  338,  346,  349,  350,
      352,  360,  355,  366,  372,  371,  374,  379,  381,  383,
      398,  386,  388,  391,  408,  407,  405,  396,  410,  412,
      415,  670,  698,  664,  650,  455,  685,  459,  631,  581,
      595,  470,  477,  484,  406,  495,  429,  424,  427,  454,
      478,  461,  481,  484,  471,  486,  487,  488,  490,  493,
      495,  497,  498,  500,  507,  510,  512,  514,  517,  522,

      519,  523,  524,  526,  527,  543,  536,  539,  548,  553,
      538,  552,  555,  558,  560,  571,  558,  557,  486,  583,
      600,  603,  518,  614,  447,  453,  437,  425,  618,  449,
      622,  569,  586,  590,  609,  606,  610,  611,  612,  613,
      616,  617,  615,  626,  632,  620,  636,  622,  637,  641,
      642,  643,  657,  646,  653,  663,  666,  651,  413,  380,
      377,  354,  340,  698,  314,  706,  274, 1116,  271,  276,
      293,  713,  720,  723,  259,  688,  697,  652,  672,  707,
      709,  710,  712,  713,  714,  717,  719,  718,  729,  722,
      723,  734,  733,  742,  245,  227, 1116,  226,  209,  228,

      774,  782,  785,  185,  162,  158,  149,  124,  758,  739,
      750,  769,  772,  773,  774,  775,  777,  778,  780,  779,
     1116,  124,  115,  125,  104,  114,   85, 1116,   84,  781,
      783,  800,  794,  803,  806,   88,   50, 1116,   55, 1116,
       54,   60,  810,  805,  814,  809, 1116,   47,   45,   44,
     1116,  817,  815,   40, 1116, 1116,  816, 1116, 1116,  858,
      869,  880,  891,  897,  907,  918,  929,  940,  946,  957,
      963,  974,  984,  990, 1000, 1011, 1021, 1032, 1042, 1052,
     1062, 1073, 1083, 1094, 1104
    } ;

static yyconst short int yy_def[386] =
    {   0,
      359,    1,  360,  360,  361,  361,  362,  362,  359,  359,
      359,  359,  363,  364,  359,  359,  359,  359,  359,  359,
      359,  365,  365,  365,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,  359,  366,
      359,  367,  359,  359,  359,  368,  368,  369,  359,  370,
      370,  359,  359,  359,  371,  372,  359,  359,  359,  359,
      359,   24,  359,  373,   24,   24,   24,   24,   24,   24,
       24,   24,   24,  359,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,

      359,  366,  359,  359,  359,  368,  359,  374,  359,  370,
      359,  359,  375,  371,  372,  359,  359,  373,  376,  377,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,  359,  374,  359,  359,  375,  378,  379,  359,  359,
      376,  359,  359,  377,  359,  380,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,

       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,  359,  359,  359,  378,  359,
      359,  379,  359,  381,  359,  359,  359,  359,  380,  382,
      383,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,  359,  359,
      359,  359,  359,  381,  384,  385,  359,  359,  359,  359,
      382,  359,  359,  383,  359,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,  359,  359,  359,  359,  359,  384,

      359,  359,  385,  359,  359,  359,  359,  359,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
      359,  359,  359,  359,  359,  359,  359,  359,  359,   24,
       24,   24,   24,   24,   24,  359,  359,  359,  359,  359,
      359,  359,   24,   24,   24,   24,  359,  359,  359,  359,
      359,   24,   24,  359,  359,  359,   24,  359,    0,  359,
      359,  359,  359,  359,  359,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359
    } ;

static yyconst short int yy_nxt[1158] =
    {   0,
       10,   11,   12,   11,   13,   10,   14,   10,   15,   10,
       16,   17,   18,   19,   20,   21,   10,   22,   23,   24,
       25,   26,   27,   28,   29,   22,   30,   22,   31,   22,
       32,   33,   34,   35,   36,   37,   22,   22,   38,   22,
       22,   41,   41,   47,   44,   44,   51,   48,   52,   42,
       42,   45,   45,   47,   49,   49,   49,   48,   49,   49,
       49,   53,  358,   61,   61,   61,  356,  355,   54,   63,
       61,   61,   61,   64,   71,   62,   63,   81,   72,  354,
       64,   68,  351,   91,   69,   78,  350,  349,   73,   70,
      348,   74,   62,   62,   79,   62,   80,   65,   61,   61,

       61,   62,   62,   62,   63,   62,   62,   82,   64,   62,
      347,   75,   62,   76,   83,   95,  342,   86,   84,   66,
       62,   85,   77,   62,   62,  341,   87,   62,   62,   92,
       62,   88,  116,   93,  117,   62,  340,   67,   89,   90,
       62,   99,   94,   96,  339,   62,   62,  338,  100,   97,
      337,   62,   49,   49,   49,  164,  336,  165,   98,   61,
       61,   61,  110,   62,  329,   63,  111,  111,  111,   64,
       62,  328,  112,   61,   61,   61,  113,   62,   54,   63,
       62,  121,  122,   64,  118,  118,  118,  119,   62,   62,
       62,   62,  129,  327,  326,   62,   62,  124,   62,  123,

      126,  127,  125,   62,  128,   62,   62,   62,   62,   62,
      132,   62,  130,  133,   62,  134,   62,   62,  131,  135,
      325,   62,   62,   62,   62,   62,   62,  137,   62,   62,
      136,  138,  301,   62,   62,   62,   62,  140,  139,   62,
       62,  324,   62,   62,   62,   62,   62,  148,  141,  142,
       62,  147,  143,   62,   62,  146,  145,   62,   62,  144,
       62,   62,   62,   62,  323,   62,  150,  322,   62,  149,
       62,   62,  157,   62,   62,  321,   62,  155,  151,   62,
       62,   62,  152,  153,  156,  154,   62,   62,   62,  160,
       62,   62,   62,  161,  308,  183,  158,  272,  159,   62,

       61,   61,   61,  110,   62,   62,   63,   62,  307,  306,
       64,  111,  111,  111,  305,  177,   62,  112,  301,   62,
      178,  113,  166,  166,  166,  167,  118,  118,  118,  119,
      173,  173,  173,   62,   62,   62,  175,   62,   62,   62,
      176,  186,  185,   62,   62,  179,   62,  180,  181,  184,
      182,   62,   62,   62,  187,  188,   62,   62,  190,  189,
       62,   62,   62,  191,   62,   62,   62,  193,   62,   62,
       62,   62,   62,   62,  196,  194,   62,   62,   62,  192,
      299,  195,   62,   62,   62,  298,   62,   62,   62,   62,
       62,  197,   62,   62,   62,   62,   62,  200,  198,  297,

       62,   62,  201,   62,  203,   62,   62,  199,   62,  202,
       62,   62,   62,  208,   62,  296,  205,  204,  212,   62,
       62,   62,  206,   62,  207,  209,   62,   62,   62,   62,
       62,   62,   62,  210,   62,  211,   62,   62,   62,  227,
      213,  228,  214,  215,  295,   62,   62,   62,   62,  234,
       62,   62,   62,  272,  233,   62,  166,  166,  166,  167,
      221,  221,  221,  232,   62,  270,  223,   62,  269,   62,
      224,  173,  173,  173,  119,  268,   62,  175,  173,  173,
      173,  176,  267,   62,  175,  173,  173,  173,  176,  235,
      220,  175,  237,   62,   62,  176,  229,  229,  229,  230,

       62,   62,  239,   62,  236,  238,   62,  240,   62,   62,
       62,   62,   62,  243,  242,   62,  241,   62,   62,   62,
       62,   62,   62,  246,   62,  244,   62,   62,   62,   62,
       62,  245,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,  248,  247,   62,   62,   62,   62,  250,   62,
       62,  262,   62,  263,   62,  249,  251,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,  255,  253,
       62,  252,  254,  256,   62,   62,   62,   62,   62,   62,
       62,  257,  258,   62,  221,  221,  221,  167,   62,  261,
      223,   62,   62,   62,  224,   62,  260,  259,   62,  172,

       62,  221,  221,  221,  221,  221,  221,  223,   62,   62,
      223,  224,   62,  226,  224,  264,  264,  264,  265,  229,
      229,  229,  230,  273,  273,  273,   62,  276,   62,  275,
       62,   62,   62,   62,   62,   62,  277,   62,   62,   62,
      282,  280,   62,  278,  286,  279,   62,  281,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
       62,  283,   62,   62,  288,   62,   62,  284,   62,  225,
      287,  285,   62,   62,   62,   62,   62,   62,  289,   62,
      291,   62,   62,   62,  292,   62,   62,  290,   62,  220,
      218,   62,   62,   62,  311,  217,  294,   62,  293,  264,

      264,  264,  265,   62,  107,  216,   62,  302,  302,  302,
       62,  172,   62,  304,  273,  273,  273,  230,  309,   62,
      275,  273,  273,  273,  273,  273,  273,  275,   62,   62,
      275,   62,   62,  310,   62,  315,   62,   62,  314,   62,
       62,   62,  312,  313,   62,  318,  317,   62,  316,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
      170,  331,   62,   62,   62,  169,  320,   53,  109,   62,
      319,  107,   62,   62,   62,  302,  302,  302,  265,   62,
       62,  304,   62,  302,  302,  302,  302,  302,  302,  304,
       62,   62,  304,  330,   62,   62,   62,   62,   62,   62,

       62,   62,   62,   62,  333,   62,  162,  332,  334,   62,
      335,   59,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,  344,   62,  343,   62,   62,  345,
      352,   62,   62,   53,   62,  353,   62,   62,   62,   62,
       62,  346,  109,   62,  109,   62,   62,  107,  105,   62,
       62,  357,  103,  101,   62,   62,   62,   62,   40,   40,
       40,   40,   40,   40,   40,   40,   40,   40,   40,   43,
       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
       46,   50,   50,   50,   50,   50,   50,   50,   50,   50,

       50,   50,   55,   60,   59,   58,   55,   55,   62,   62,
       62,   57,   62,   62,   56,   62,   62,   62,  102,  102,
      102,  102,  102,  102,  102,  359,  102,  102,  102,  104,
      104,   39,  104,  104,  104,  104,  104,  104,  104,  104,
      106,  106,  106,  106,  106,  359,  106,  106,  106,  106,
      106,  108,  359,  359,  359,  359,  108,   51,   51,   51,
       51,   51,   51,   51,   51,   51,   51,   51,  114,  359,
      359,  359,  114,  114,  115,  115,  359,  359,  115,  115,
      115,  115,  115,  115,  115,  120,  120,  120,  120,  359,
      359,  359,  359,  359,  120,  163,  359,  359,  359,  163,

      163,  168,  168,  168,  168,  359,  359,  359,  359,  359,
      168,  171,  171,  171,  171,  171,  171,  171,  171,  171,
      171,  171,  174,  174,  174,  359,  174,  174,  359,  174,
      174,  174,  219,  219,  219,  219,  219,  219,  219,  219,
      219,  219,  219,  222,  222,  222,  359,  222,  222,  359,
      222,  222,  222,  231,  231,  231,  231,  359,  359,  359,
      359,  359,  231,  266,  266,  266,  266,  359,  359,  359,
      359,  359,  266,  271,  271,  271,  271,  271,  271,  271,
      271,  271,  271,  271,  274,  274,  274,  359,  274,  274,
      359,  359,  274,  274,  300,  300,  300,  300,  300,  300,

      300,  300,  300,  300,  300,  303,  303,  303,  359,  303,
      303,  359,  359,  303,  303,    9,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  359,  359
    } ;

static yyconst short int yy_chk[1158] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    3,    4,    7,    5,    6,   13,    7,   13,    3,
        4,    5,    6,    8,   11,   11,   11,    8,   12,   12,
       12,   14,  354,   22,   22,   22,  350,  349,   14,   22,
       23,   23,   23,   22,   26,   25,   23,   29,   26,  348,
       23,   25,  342,   34,   25,   28,  341,  339,   26,   25,
      337,   27,   26,   25,   28,   29,   28,   23,   24,   24,

       24,   34,   36,   28,   24,   27,   30,   30,   24,   62,
      336,   27,   31,   27,   30,   36,  329,   32,   30,   24,
       36,   31,   27,   27,   30,  327,   32,   62,   33,   35,
       31,   32,   63,   35,   63,   32,  326,   24,   33,   33,
       37,   38,   35,   37,  325,   38,   33,  324,   38,   37,
      323,   35,   49,   49,   49,  112,  322,  112,   37,   52,
       52,   52,   52,   38,  308,   52,   54,   54,   54,   52,
       67,  307,   54,   61,   61,   61,   54,   65,   54,   61,
       66,   65,   66,   61,   64,   64,   64,   64,   67,   69,
       68,   70,   72,  306,  305,   65,   72,   69,   66,   68,

       71,   71,   70,   71,   71,   73,   75,   69,   68,   70,
       76,   76,   73,   77,   72,   77,   79,   78,   75,   77,
      304,   71,   80,   73,   75,   81,   82,   79,   84,   76,
       78,   80,  300,   77,   79,   78,   83,   83,   81,   86,
       80,  299,   87,   81,   82,   88,   84,   89,   83,   83,
       85,   88,   85,   90,   83,   87,   86,   86,   91,   85,
       87,   94,   92,   88,  298,   89,   92,  296,   85,   91,
       93,   90,   96,   95,   97,  295,   91,   94,   93,   94,
       92,  126,   93,   93,   95,   93,   98,   99,   93,  100,
       96,   95,   97,  100,  275,  126,   98,  271,   99,  126,

      109,  109,  109,  109,   98,   99,  109,  100,  270,  269,
      109,  111,  111,  111,  267,  121,  122,  111,  265,  121,
      122,  111,  113,  113,  113,  113,  118,  118,  118,  118,
      120,  120,  120,  123,  122,  124,  120,  121,  125,  129,
      120,  129,  128,  127,  130,  123,  128,  124,  124,  127,
      125,  123,  132,  124,  130,  131,  125,  129,  133,  131,
      137,  127,  130,  134,  128,  134,  135,  136,  138,  136,
      132,  139,  140,  131,  141,  138,  133,  143,  137,  135,
      263,  140,  142,  134,  135,  262,  138,  136,  144,  139,
      140,  142,  141,  146,  145,  143,  147,  146,  144,  261,

      142,  148,  147,  149,  149,  150,  144,  145,  152,  148,
      153,  146,  145,  154,  147,  260,  151,  150,  158,  148,
      151,  149,  152,  150,  153,  155,  152,  157,  153,  156,
      155,  154,  159,  156,  160,  157,  158,  161,  151,  175,
      159,  175,  160,  161,  259,  157,  178,  156,  155,  179,
      159,  177,  160,  230,  178,  161,  166,  166,  166,  166,
      168,  168,  168,  177,  178,  228,  168,  179,  227,  177,
      168,  172,  172,  172,  172,  226,  180,  172,  173,  173,
      173,  172,  225,  182,  173,  174,  174,  174,  173,  180,
      219,  174,  182,  185,  180,  174,  176,  176,  176,  176,

      181,  182,  184,  183,  181,  183,  184,  185,  186,  187,
      188,  185,  189,  189,  188,  190,  186,  191,  181,  192,
      193,  183,  194,  193,  184,  190,  186,  187,  188,  195,
      189,  191,  196,  190,  197,  191,  198,  192,  193,  199,
      194,  201,  200,  196,  200,  202,  203,  195,  204,  205,
      196,  223,  197,  223,  198,  203,  205,  199,  207,  201,
      211,  208,  200,  202,  203,  206,  204,  205,  209,  207,
      209,  206,  208,  210,  212,  210,  207,  213,  211,  208,
      214,  213,  215,  206,  220,  220,  220,  220,  209,  218,
      220,  232,  212,  210,  220,  213,  217,  216,  214,  171,

      215,  221,  221,  221,  222,  222,  222,  221,  233,  232,
      222,  221,  234,  170,  222,  224,  224,  224,  224,  229,
      229,  229,  229,  231,  231,  231,  233,  235,  236,  231,
      234,  235,  237,  238,  239,  240,  236,  243,  241,  242,
      242,  240,  246,  237,  248,  239,  236,  241,  244,  235,
      237,  238,  239,  240,  245,  243,  241,  242,  247,  249,
      246,  244,  248,  250,  251,  252,  244,  245,  254,  169,
      249,  247,  245,  258,  278,  255,  247,  249,  252,  253,
      254,  250,  251,  252,  255,  256,  254,  253,  257,  167,
      165,  258,  278,  255,  279,  164,  257,  253,  256,  264,

      264,  264,  264,  256,  163,  162,  257,  266,  266,  266,
      276,  119,  279,  266,  272,  272,  272,  272,  276,  277,
      272,  273,  273,  273,  274,  274,  274,  273,  276,  280,
      274,  281,  282,  277,  283,  284,  285,  277,  283,  286,
      288,  287,  280,  281,  290,  291,  289,  280,  287,  281,
      282,  289,  283,  284,  285,  293,  292,  286,  288,  287,
      117,  310,  290,  291,  294,  116,  294,  114,  110,  289,
      292,  108,  311,  293,  292,  301,  301,  301,  301,  310,
      309,  301,  294,  302,  302,  302,  303,  303,  303,  302,
      311,  312,  303,  309,  313,  314,  315,  316,  309,  317,

      318,  320,  319,  330,  314,  331,  101,  313,  317,  312,
      319,   59,  313,  314,  315,  316,  333,  317,  318,  320,
      319,  330,  332,  331,  333,  334,  332,  344,  335,  334,
      343,  346,  343,   55,  333,  345,  345,  353,  357,  352,
      332,  335,   51,  334,   50,  344,  335,   48,   45,  346,
      343,  352,   41,   39,  345,  353,  357,  352,  360,  360,
      360,  360,  360,  360,  360,  360,  360,  360,  360,  361,
      361,  361,  361,  361,  361,  361,  361,  361,  361,  361,
      362,  362,  362,  362,  362,  362,  362,  362,  362,  362,
      362,  363,  363,  363,  363,  363,  363,  363,  363,  363,

      363,  363,  364,   20,   19,   18,  364,  364,  365,  365,
      365,   17,  365,  365,   16,  365,  365,  365,  366,  366,
      366,  366,  366,  366,  366,    9,  366,  366,  366,  367,
      367,    2,  367,  367,  367,  367,  367,  367,  367,  367,
      368,  368,  368,  368,  368,    0,  368,  368,  368,  368,
      368,  369,    0,    0,    0,    0,  369,  370,  370,  370,
      370,  370,  370,  370,  370,  370,  370,  370,  371,    0,
        0,    0,  371,  371,  372,  372,    0,    0,  372,  372,
      372,  372,  372,  372,  372,  373,  373,  373,  373,    0,
        0,    0,    0,    0,  373,  374,    0,    0,    0,  374,

      374,  375,  375,  375,  375,    0,    0,    0,    0,    0,
      375,  376,  376,  376,  376,  376,  376,  376,  376,  376,
      376,  376,  377,  377,  377,    0,  377,  377,    0,  377,
      377,  377,  378,  378,  378,  378,  378,  378,  378,  378,
      378,  378,  378,  379,  379,  379,    0,  379,  379,    0,
      379,  379,  379,  380,  380,  380,  380,    0,    0,    0,
        0,    0,  380,  381,  381,  381,  381,    0,    0,    0,
        0,    0,  381,  382,  382,  382,  382,  382,  382,  382,
      382,  382,  382,  382,  383,  383,  383,    0,  383,  383,
        0,    0,  383,  383,  384,  384,  384,  384,  384,  384,

      384,  384,  384,  384,  384,  385,  385,  385,    0,  385,
      385,    0,    0,  385,  385,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  359,  359
    } ;

static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;

/* The intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed.
 */
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "scan.l"
#define INITIAL 0
#line 2 "scan.l"
/*-------------------------------------------------------------------------
 *
 * scan.l		- Scanner for the PL/pgSQL
 *			  procedural language
 *
 * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *	  $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.54 2006/08/14 21:14:42 tgl Exp $
 *
 *-------------------------------------------------------------------------
 */

#include "plpgsql.h"

#include "mb/pg_wchar.h"


/* No reason to constrain amount of data slurped */
#define YY_READ_BUF_SIZE 16777216

/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
#undef fprintf
#define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))

/* Handles to the buffer that the lexer uses internally */
static YY_BUFFER_STATE scanbufhandle;
static char *scanbuf;

static const char *scanstr;		/* original input string */

static int	scanner_functype;
static bool	scanner_typereported;
static int	pushback_token;
static bool have_pushback_token;
static const char *cur_line_start;
static int	cur_line_num;
static char    *dolqstart;      /* current $foo$ quote start string */
static int	dolqlen;			/* signal to plpgsql_get_string_value */

bool plpgsql_SpaceScanned = false;
#define YY_NEVER_INTERACTIVE 1
#define YY_NO_UNPUT 1
#define IN_STRING 1

#define IN_COMMENT 2

#define IN_DOLLARQUOTE 3

/* $foo$ style quotes ("dollar quoting")
 * copied straight from the backend SQL parser
 */
#line 816 "pl_scan.c"

/* Macros after this point can all be overridden by user definitions in
 * section 1.
 */

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap YY_PROTO(( void ));
#else
extern int yywrap YY_PROTO(( void ));
#endif
#endif

#ifndef YY_NO_UNPUT
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif

#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif

#ifdef YY_NEED_STRLEN
static int yy_flex_strlen YY_PROTO(( yyconst char * ));
#endif

#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif

#if YY_STACK_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state YY_PROTO(( void ));
#endif

#else
#define YY_NO_PUSH_STATE 1
#define YY_NO_POP_STATE 1
#define YY_NO_TOP_STATE 1
#endif

#ifdef YY_MALLOC_DECL
YY_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines.  This will fail
 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
 * or sizeof(void*) != sizeof(int).
 */
#endif
#endif

/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif

/* Copy whatever the last rule matched to the standard output. */

#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite().
 */
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif

/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
	if ( yy_current_buffer->yy_is_interactive ) \
		{ \
		int c = '*', n; \
		for ( n = 0; n < max_size && \
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( yyin ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
		  && ferror( yyin ) ) \
		YY_FATAL_ERROR( "input in flex scanner failed" );
#endif

/* No semi-colon after return; correct usage is to write "yyterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif

/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif

/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif

/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef YY_DECL
#define YY_DECL int yylex YY_PROTO(( void ))
#endif

/* Code executed at the beginning of each rule, after yytext and yyleng
 * have been set up.
 */
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif

#define YY_RULE_SETUP \
	if ( yyleng > 0 ) \
		yy_current_buffer->yy_at_bol = \
				(yytext[yyleng - 1] == '\n'); \
	YY_USER_ACTION

YY_DECL
	{
	register yy_state_type yy_current_state;
	register char *yy_cp, *yy_bp;
	register int yy_act;

#line 81 "scan.l"

    /* ----------
     * Local variables in scanner to remember where
     * a string or comment started
     * ----------
     */
    int	start_lineno = 0;
	char *start_charpos = NULL;

    /* ----------
     * Reset the state when entering the scanner
     * ----------
     */
    BEGIN(INITIAL);
    plpgsql_SpaceScanned = false;

    /* ----------
     * On the first call to a new source report the
     * function's type (T_FUNCTION or T_TRIGGER)
     * ----------
     */
	if (!scanner_typereported)
	{
		scanner_typereported = true;
		return scanner_functype;
	}

    /* ----------
     * The keyword rules
     * ----------
     */
#line 1002 "pl_scan.c"

	if ( yy_init )
		{
		yy_init = 0;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

		if ( ! yy_start )
			yy_start = 1;	/* first start state */

		if ( ! yyin )
			yyin = stdin;

		if ( ! yyout )
			yyout = stdout;

		if ( ! yy_current_buffer )
			yy_current_buffer =
				yy_create_buffer( yyin, YY_BUF_SIZE );

		yy_load_buffer_state();
		}

	while ( 1 )		/* loops until end-of-file is reached */
		{
		yy_cp = yy_c_buf_p;

		/* Support of yytext. */
		*yy_cp = yy_hold_char;

		/* yy_bp points to the position in yy_ch_buf of the start of
		 * the current run.
		 */
		yy_bp = yy_cp;

		yy_current_state = yy_start;
		yy_current_state += YY_AT_BOL();
yy_match:
		do
			{
			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
			if ( yy_accept[yy_current_state] )
				{
				yy_last_accepting_state = yy_current_state;
				yy_last_accepting_cpos = yy_cp;
				}
			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
				{
				yy_current_state = (int) yy_def[yy_current_state];
				if ( yy_current_state >= 360 )
					yy_c = yy_meta[(unsigned int) yy_c];
				}
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
			++yy_cp;
			}
		while ( yy_base[yy_current_state] != 1116 );

yy_find_action:
		yy_act = yy_accept[yy_current_state];
		if ( yy_act == 0 )
			{ /* have to back up */
			yy_cp = yy_last_accepting_cpos;
			yy_current_state = yy_last_accepting_state;
			yy_act = yy_accept[yy_current_state];
			}

		YY_DO_BEFORE_ACTION;


do_action:	/* This label is used only to access EOF actions. */


		switch ( yy_act )
	{ /* beginning of action switch */
			case 0: /* must back up */
			/* undo the effects of YY_DO_BEFORE_ACTION */
			*yy_cp = yy_hold_char;
			yy_cp = yy_last_accepting_cpos;
			yy_current_state = yy_last_accepting_state;
			goto yy_find_action;

case 1:
YY_RULE_SETUP
#line 112 "scan.l"
{ return K_ASSIGN;			}
	YY_BREAK
case 2:
YY_RULE_SETUP
#line 113 "scan.l"
{ return K_ASSIGN;			}
	YY_BREAK
case 3:
YY_RULE_SETUP
#line 114 "scan.l"
{ return K_DOTDOT;			}
	YY_BREAK
case 4:
YY_RULE_SETUP
#line 115 "scan.l"
{ return K_ALIAS;			}
	YY_BREAK
case 5:
YY_RULE_SETUP
#line 116 "scan.l"
{ return K_BEGIN;			}
	YY_BREAK
case 6:
YY_RULE_SETUP
#line 117 "scan.l"
{ return K_BY;   			}
	YY_BREAK
case 7:
YY_RULE_SETUP
#line 118 "scan.l"
{ return K_CLOSE;			}
	YY_BREAK
case 8:
YY_RULE_SETUP
#line 119 "scan.l"
{ return K_CONSTANT;		}
	YY_BREAK
case 9:
YY_RULE_SETUP
#line 120 "scan.l"
{ return K_CONTINUE;		}
	YY_BREAK
case 10:
YY_RULE_SETUP
#line 121 "scan.l"
{ return K_CURSOR;			}
	YY_BREAK
case 11:
YY_RULE_SETUP
#line 122 "scan.l"
{ return K_DEBUG;			}
	YY_BREAK
case 12:
YY_RULE_SETUP
#line 123 "scan.l"
{ return K_DECLARE;			}
	YY_BREAK
case 13:
YY_RULE_SETUP
#line 124 "scan.l"
{ return K_DEFAULT;			}
	YY_BREAK
case 14:
YY_RULE_SETUP
#line 125 "scan.l"
{ return K_DIAGNOSTICS;		}
	YY_BREAK
case 15:
YY_RULE_SETUP
#line 126 "scan.l"
{ return K_ELSE;			}
	YY_BREAK
case 16:
YY_RULE_SETUP
#line 127 "scan.l"
{ return K_ELSIF;           }
	YY_BREAK
case 17:
YY_RULE_SETUP
#line 128 "scan.l"
{ return K_ELSIF;           }
	YY_BREAK
case 18:
YY_RULE_SETUP
#line 129 "scan.l"
{ return K_END;				}
	YY_BREAK
case 19:
YY_RULE_SETUP
#line 130 "scan.l"
{ return K_EXCEPTION;		}
	YY_BREAK
case 20:
YY_RULE_SETUP
#line 131 "scan.l"
{ return K_EXECUTE;			}
	YY_BREAK
case 21:
YY_RULE_SETUP
#line 132 "scan.l"
{ return K_EXIT;			}
	YY_BREAK
case 22:
YY_RULE_SETUP
#line 133 "scan.l"
{ return K_FETCH;			}
	YY_BREAK
case 23:
YY_RULE_SETUP
#line 134 "scan.l"
{ return K_FOR;				}
	YY_BREAK
case 24:
YY_RULE_SETUP
#line 135 "scan.l"
{ return K_FROM;			}
	YY_BREAK
case 25:
YY_RULE_SETUP
#line 136 "scan.l"
{ return K_GET;				}
	YY_BREAK
case 26:
YY_RULE_SETUP
#line 137 "scan.l"
{ return K_IF;				}
	YY_BREAK
case 27:
YY_RULE_SETUP
#line 138 "scan.l"
{ return K_IN;				}
	YY_BREAK
case 28:
YY_RULE_SETUP
#line 139 "scan.l"
{ return K_INFO;			}
	YY_BREAK
case 29:
YY_RULE_SETUP
#line 140 "scan.l"
{ return K_INSERT;			}
	YY_BREAK
case 30:
YY_RULE_SETUP
#line 141 "scan.l"
{ return K_INTO;			}
	YY_BREAK
case 31:
YY_RULE_SETUP
#line 142 "scan.l"
{ return K_IS;				}
	YY_BREAK
case 32:
YY_RULE_SETUP
#line 143 "scan.l"
{ return K_LOG;				}
	YY_BREAK
case 33:
YY_RULE_SETUP
#line 144 "scan.l"
{ return K_LOOP;			}
	YY_BREAK
case 34:
YY_RULE_SETUP
#line 145 "scan.l"
{ return K_NEXT;			}
	YY_BREAK
case 35:
YY_RULE_SETUP
#line 146 "scan.l"
{ return K_NOT;				}
	YY_BREAK
case 36:
YY_RULE_SETUP
#line 147 "scan.l"
{ return K_NOTICE;			}
	YY_BREAK
case 37:
YY_RULE_SETUP
#line 148 "scan.l"
{ return K_NULL;			}
	YY_BREAK
case 38:
YY_RULE_SETUP
#line 149 "scan.l"
{ return K_OPEN;			}
	YY_BREAK
case 39:
YY_RULE_SETUP
#line 150 "scan.l"
{ return K_OR;				}
	YY_BREAK
case 40:
YY_RULE_SETUP
#line 151 "scan.l"
{ return K_PERFORM;			}
	YY_BREAK
case 41:
YY_RULE_SETUP
#line 152 "scan.l"
{ return K_RAISE;			}
	YY_BREAK
case 42:
YY_RULE_SETUP
#line 153 "scan.l"
{ return K_RENAME;			}
	YY_BREAK
case 43:
YY_RULE_SETUP
#line 154 "scan.l"
{ return K_RESULT_OID;		}
	YY_BREAK
case 44:
YY_RULE_SETUP
#line 155 "scan.l"
{ return K_RETURN;			}
	YY_BREAK
case 45:
YY_RULE_SETUP
#line 156 "scan.l"
{ return K_REVERSE;			}
	YY_BREAK
case 46:
YY_RULE_SETUP
#line 157 "scan.l"
{ return K_ROW_COUNT;		}
	YY_BREAK
case 47:
YY_RULE_SETUP
#line 158 "scan.l"
{ return K_STRICT;	    	}
	YY_BREAK
case 48:
YY_RULE_SETUP
#line 159 "scan.l"
{ return K_THEN;			}
	YY_BREAK
case 49:
YY_RULE_SETUP
#line 160 "scan.l"
{ return K_TO;				}
	YY_BREAK
case 50:
YY_RULE_SETUP
#line 161 "scan.l"
{ return K_TYPE;			}
	YY_BREAK
case 51:
YY_RULE_SETUP
#line 162 "scan.l"
{ return K_WARNING;			}
	YY_BREAK
case 52:
YY_RULE_SETUP
#line 163 "scan.l"
{ return K_WHEN;			}
	YY_BREAK
case 53:
YY_RULE_SETUP
#line 164 "scan.l"
{ return K_WHILE;			}
	YY_BREAK
case 54:
YY_RULE_SETUP
#line 166 "scan.l"
{ return O_OPTION;			}
	YY_BREAK
case 55:
YY_RULE_SETUP
#line 167 "scan.l"
{ return O_DUMP;			}
	YY_BREAK
/* ----------
     * Special word rules
	 *
	 * We set plpgsql_error_lineno in each rule so that errors reported
	 * in the pl_comp.c subroutines will point to the right place.
     * ----------
     */
case 56:
YY_RULE_SETUP
#line 177 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_word(yytext); }
	YY_BREAK
case 57:
YY_RULE_SETUP
#line 180 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblword(yytext); }
	YY_BREAK
case 58:
YY_RULE_SETUP
#line 183 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripword(yytext); }
	YY_BREAK
case 59:
YY_RULE_SETUP
#line 186 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordtype(yytext); }
	YY_BREAK
case 60:
YY_RULE_SETUP
#line 189 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordtype(yytext); }
	YY_BREAK
case 61:
YY_RULE_SETUP
#line 192 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripwordtype(yytext); }
	YY_BREAK
case 62:
YY_RULE_SETUP
#line 195 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordrowtype(yytext); }
	YY_BREAK
case 63:
YY_RULE_SETUP
#line 198 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordrowtype(yytext); }
	YY_BREAK
case 64:
YY_RULE_SETUP
#line 201 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_word(yytext); }
	YY_BREAK
case 65:
YY_RULE_SETUP
#line 204 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblword(yytext); }
	YY_BREAK
case 66:
YY_RULE_SETUP
#line 207 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripword(yytext); }
	YY_BREAK
case 67:
YY_RULE_SETUP
#line 210 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordtype(yytext); }
	YY_BREAK
case 68:
YY_RULE_SETUP
#line 213 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordtype(yytext); }
	YY_BREAK
case 69:
YY_RULE_SETUP
#line 216 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripwordtype(yytext); }
	YY_BREAK
case 70:
YY_RULE_SETUP
#line 219 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordrowtype(yytext); }
	YY_BREAK
case 71:
YY_RULE_SETUP
#line 222 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordrowtype(yytext); }
	YY_BREAK
case 72:
YY_RULE_SETUP
#line 226 "scan.l"
{ return T_NUMBER;			}
	YY_BREAK
case 73:
YY_RULE_SETUP
#line 228 "scan.l"
{
				plpgsql_error_lineno = plpgsql_scanner_lineno();
				ereport(ERROR,
						(errcode(ERRCODE_DATATYPE_MISMATCH),
						 errmsg("unterminated quoted identifier")));
			}
	YY_BREAK
/* ----------
     * Ignore whitespaces but remember this happened
     * ----------
     */
case 74:
YY_RULE_SETUP
#line 239 "scan.l"
{ plpgsql_SpaceScanned = true;		}
	YY_BREAK
/* ----------
     * Eat up comments
     * ----------
     */
case 75:
YY_RULE_SETUP
#line 245 "scan.l"
;
	YY_BREAK
case 76:
YY_RULE_SETUP
#line 247 "scan.l"
{ start_lineno = plpgsql_scanner_lineno();
			  BEGIN(IN_COMMENT);
			}
	YY_BREAK
case 77:
YY_RULE_SETUP
#line 250 "scan.l"
{ BEGIN(INITIAL); plpgsql_SpaceScanned = true; }
	YY_BREAK
case 78:
YY_RULE_SETUP
#line 251 "scan.l"
;
	YY_BREAK
case 79:
YY_RULE_SETUP
#line 252 "scan.l"
;
	YY_BREAK
case YY_STATE_EOF(IN_COMMENT):
#line 253 "scan.l"
{
				plpgsql_error_lineno = start_lineno;
				ereport(ERROR,
						(errcode(ERRCODE_DATATYPE_MISMATCH),
						 errmsg("unterminated comment")));
			}
	YY_BREAK
/* ----------
     * Collect anything inside of ''s and return one STRING token
	 *
	 * Hacking yytext/yyleng here lets us avoid using yymore(), which is
	 * a win for performance.  It's safe because we know the underlying
	 * input buffer is not changing.
     * ----------
     */
case 80:
YY_RULE_SETUP
#line 268 "scan.l"
{
			  start_lineno = plpgsql_scanner_lineno();
			  start_charpos = yytext;
			  BEGIN(IN_STRING);
			}
	YY_BREAK
case 81:
YY_RULE_SETUP
#line 273 "scan.l"
{
			  /* for now, treat the same as a regular literal */
			  start_lineno = plpgsql_scanner_lineno();
			  start_charpos = yytext;
			  BEGIN(IN_STRING);
			}
	YY_BREAK
case 82:
YY_RULE_SETUP
#line 279 "scan.l"
{ }
	YY_BREAK
case 83:
YY_RULE_SETUP
#line 280 "scan.l"
{ /* can only happen with \ at EOF */ }
	YY_BREAK
case 84:
YY_RULE_SETUP
#line 281 "scan.l"
{ }
	YY_BREAK
case 85:
YY_RULE_SETUP
#line 282 "scan.l"
{
			  /* tell plpgsql_get_string_value it's not a dollar quote */
			  dolqlen = 0;
			  /* adjust yytext/yyleng to describe whole string token */
			  yyleng += (yytext - start_charpos);
			  yytext = start_charpos;
			  BEGIN(INITIAL);
			  return T_STRING;
			}
	YY_BREAK
case 86:
YY_RULE_SETUP
#line 291 "scan.l"
{ }
	YY_BREAK
case YY_STATE_EOF(IN_STRING):
#line 292 "scan.l"
{
				plpgsql_error_lineno = start_lineno;
				ereport(ERROR,
						(errcode(ERRCODE_DATATYPE_MISMATCH),
						 errmsg("unterminated string")));
			}
	YY_BREAK
case 87:
YY_RULE_SETUP
#line 299 "scan.l"
{
			  start_lineno = plpgsql_scanner_lineno();
			  start_charpos = yytext;
			  dolqstart = pstrdup(yytext);
			  BEGIN(IN_DOLLARQUOTE);
			}
	YY_BREAK
case 88:
YY_RULE_SETUP
#line 305 "scan.l"
{
			  if (strcmp(yytext, dolqstart) == 0)
			  {
					pfree(dolqstart);
					/* tell plpgsql_get_string_value it is a dollar quote */
					dolqlen = yyleng;
					/* adjust yytext/yyleng to describe whole string token */
					yyleng += (yytext - start_charpos);
					yytext = start_charpos;
					BEGIN(INITIAL);
					return T_STRING;
			  }
			  else
			  {
					/*
					 * When we fail to match $...$ to dolqstart, transfer
					 * the $... part to the output, but put back the final
					 * $ for rescanning.  Consider $delim$...$junk$delim$
					 */
					yyless(yyleng-1);
			  }
			}
	YY_BREAK
case 89:
YY_RULE_SETUP
#line 327 "scan.l"
{ }
	YY_BREAK
case 90:
YY_RULE_SETUP
#line 328 "scan.l"
{ /* needed for $ inside the quoted text */ }
	YY_BREAK
case YY_STATE_EOF(IN_DOLLARQUOTE):
#line 329 "scan.l"
{ 
				plpgsql_error_lineno = start_lineno;
				ereport(ERROR,
						(errcode(ERRCODE_DATATYPE_MISMATCH),
						 errmsg("unterminated dollar-quoted string")));
			}
	YY_BREAK
/* ----------
     * Any unmatched character is returned as is
     * ----------
     */
case 91:
YY_RULE_SETUP
#line 340 "scan.l"
{ return yytext[0];			}
	YY_BREAK
case 92:
YY_RULE_SETUP
#line 342 "scan.l"
YY_FATAL_ERROR( "flex scanner jammed" );
	YY_BREAK
#line 1682 "pl_scan.c"
case YY_STATE_EOF(INITIAL):
	yyterminate();

	case YY_END_OF_BUFFER:
		{
		/* Amount of text matched not including the EOB char. */
		int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;

		/* Undo the effects of YY_DO_BEFORE_ACTION. */
		*yy_cp = yy_hold_char;
		YY_RESTORE_YY_MORE_OFFSET

		if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed yyin at a new source and called
			 * yylex().  If so, then we have to assure
			 * consistency between yy_current_buffer and our
			 * globals.  Here is the right place to do so, because
			 * this is the first action (other than possibly a
			 * back-up) that will match for the new input source.
			 */
			yy_n_chars = yy_current_buffer->yy_n_chars;
			yy_current_buffer->yy_input_file = yyin;
			yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
			}

		/* Note that here we test for yy_c_buf_p "<=" to the position
		 * of the first EOB in the buffer, since yy_c_buf_p will
		 * already have been incremented past the NUL character
		 * (since all states make transitions on EOB to the
		 * end-of-buffer state).  Contrast this with the test
		 * in input().
		 */
		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
			{ /* This was really a NUL. */
			yy_state_type yy_next_state;

			yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state();

			/* Okay, we're now positioned to make the NUL
			 * transition.  We couldn't have
			 * yy_get_previous_state() go ahead and do it
			 * for us because it doesn't know how to deal
			 * with the possibility of jamming (and we don't
			 * want to build jamming into it because then it
			 * will run more slowly).
			 */

			yy_next_state = yy_try_NUL_trans( yy_current_state );

			yy_bp = yytext_ptr + YY_MORE_ADJ;

			if ( yy_next_state )
				{
				/* Consume the NUL. */
				yy_cp = ++yy_c_buf_p;
				yy_current_state = yy_next_state;
				goto yy_match;
				}

			else
				{
				yy_cp = yy_c_buf_p;
				goto yy_find_action;
				}
			}

		else switch ( yy_get_next_buffer() )
			{
			case EOB_ACT_END_OF_FILE:
				{
				yy_did_buffer_switch_on_eof = 0;

				if ( yywrap() )
					{
					/* Note: because we've taken care in
					 * yy_get_next_buffer() to have set up
					 * yytext, we can now set up
					 * yy_c_buf_p so that if some total
					 * hoser (like flex itself) wants to
					 * call the scanner after we return the
					 * YY_NULL, it'll still work - another
					 * YY_NULL will get returned.
					 */
					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;

					yy_act = YY_STATE_EOF(YY_START);
					goto do_action;
					}

				else
					{
					if ( ! yy_did_buffer_switch_on_eof )
						YY_NEW_FILE;
					}
				break;
				}

			case EOB_ACT_CONTINUE_SCAN:
				yy_c_buf_p =
					yytext_ptr + yy_amount_of_matched_text;

				yy_current_state = yy_get_previous_state();

				yy_cp = yy_c_buf_p;
				yy_bp = yytext_ptr + YY_MORE_ADJ;
				goto yy_match;

			case EOB_ACT_LAST_MATCH:
				yy_c_buf_p =
				&yy_current_buffer->yy_ch_buf[yy_n_chars];

				yy_current_state = yy_get_previous_state();

				yy_cp = yy_c_buf_p;
				yy_bp = yytext_ptr + YY_MORE_ADJ;
				goto yy_find_action;
			}
		break;
		}

	default:
		YY_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	} /* end of action switch */
		} /* end of scanning one token */
	} /* end of yylex */


/* yy_get_next_buffer - try to read in a new buffer
 *
 * Returns a code representing an action:
 *	EOB_ACT_LAST_MATCH -
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *	EOB_ACT_END_OF_FILE - end of file
 */

static int yy_get_next_buffer()
	{
	register char *dest = yy_current_buffer->yy_ch_buf;
	register char *source = yytext_ptr;
	register int number_to_move, i;
	int ret_val;

	if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
		YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( yy_current_buffer->yy_fill_buffer == 0 )
		{ /* Don't try to fill the buffer, so this is an EOF. */
		if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
			{
			/* We matched a single character, the EOB, so
			 * treat this as a final EOF.
			 */
			return EOB_ACT_END_OF_FILE;
			}

		else
			{
			/* We matched some text prior to the EOB, first
			 * process it.
			 */
			return EOB_ACT_LAST_MATCH;
			}
		}

	/* Try to read more data. */

	/* First move last chars to start of buffer. */
	number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;

	for ( i = 0; i < number_to_move; ++i )
		*(dest++) = *(source++);

	if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
		/* don't do the read, it's not guaranteed to return an EOF,
		 * just force an EOF
		 */
		yy_current_buffer->yy_n_chars = yy_n_chars = 0;

	else
		{
		int num_to_read =
			yy_current_buffer->yy_buf_size - number_to_move - 1;

		while ( num_to_read <= 0 )
			{ /* Not enough room in the buffer - grow it. */
#ifdef YY_USES_REJECT
			YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else

			/* just a shorter name for the current buffer */
			YY_BUFFER_STATE b = yy_current_buffer;

			int yy_c_buf_p_offset =
				(int) (yy_c_buf_p - b->yy_ch_buf);

			if ( b->yy_is_our_buffer )
				{
				int new_size = b->yy_buf_size * 2;

				if ( new_size <= 0 )
					b->yy_buf_size += b->yy_buf_size / 8;
				else
					b->yy_buf_size *= 2;

				b->yy_ch_buf = (char *)
					/* Include room in for 2 EOB chars. */
					yy_flex_realloc( (void *) b->yy_ch_buf,
							 b->yy_buf_size + 2 );
				}
			else
				/* Can't grow it, we don't own it. */
				b->yy_ch_buf = 0;

			if ( ! b->yy_ch_buf )
				YY_FATAL_ERROR(
				"fatal error - scanner input buffer overflow" );

			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];

			num_to_read = yy_current_buffer->yy_buf_size -
						number_to_move - 1;
#endif
			}

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

		/* Read in more data. */
		YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
			yy_n_chars, num_to_read );

		yy_current_buffer->yy_n_chars = yy_n_chars;
		}

	if ( yy_n_chars == 0 )
		{
		if ( number_to_move == YY_MORE_ADJ )
			{
			ret_val = EOB_ACT_END_OF_FILE;
			yyrestart( yyin );
			}

		else
			{
			ret_val = EOB_ACT_LAST_MATCH;
			yy_current_buffer->yy_buffer_status =
				YY_BUFFER_EOF_PENDING;
			}
		}

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

	yy_n_chars += number_to_move;
	yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
	yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;

	yytext_ptr = &yy_current_buffer->yy_ch_buf[0];

	return ret_val;
	}


/* yy_get_previous_state - get the state just before the EOB char was reached */

static yy_state_type yy_get_previous_state()
	{
	register yy_state_type yy_current_state;
	register char *yy_cp;

	yy_current_state = yy_start;
	yy_current_state += YY_AT_BOL();

	for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
		{
		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
		if ( yy_accept[yy_current_state] )
			{
			yy_last_accepting_state = yy_current_state;
			yy_last_accepting_cpos = yy_cp;
			}
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
			{
			yy_current_state = (int) yy_def[yy_current_state];
			if ( yy_current_state >= 360 )
				yy_c = yy_meta[(unsigned int) yy_c];
			}
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
		}

	return yy_current_state;
	}


/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *	next_state = yy_try_NUL_trans( current_state );
 */

#ifdef YY_USE_PROTOS
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
yy_state_type yy_current_state;
#endif
	{
	register int yy_is_jam;
	register char *yy_cp = yy_c_buf_p;

	register YY_CHAR yy_c = 1;
	if ( yy_accept[yy_current_state] )
		{
		yy_last_accepting_state = yy_current_state;
		yy_last_accepting_cpos = yy_cp;
		}
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
		{
		yy_current_state = (int) yy_def[yy_current_state];
		if ( yy_current_state >= 360 )
			yy_c = yy_meta[(unsigned int) yy_c];
		}
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
	yy_is_jam = (yy_current_state == 359);

	return yy_is_jam ? 0 : yy_current_state;
	}


#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
static void yyunput( int c, register char *yy_bp )
#else
static void yyunput( c, yy_bp )
int c;
register char *yy_bp;
#endif
	{
	register char *yy_cp = yy_c_buf_p;

	/* undo effects of setting up yytext */
	*yy_cp = yy_hold_char;

	if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
		{ /* need to shift things up to make room */
		/* +2 for EOB chars. */
		register int number_to_move = yy_n_chars + 2;
		register char *dest = &yy_current_buffer->yy_ch_buf[
					yy_current_buffer->yy_buf_size + 2];
		register char *source =
				&yy_current_buffer->yy_ch_buf[number_to_move];

		while ( source > yy_current_buffer->yy_ch_buf )
			*--dest = *--source;

		yy_cp += (int) (dest - source);
		yy_bp += (int) (dest - source);
		yy_current_buffer->yy_n_chars =
			yy_n_chars = yy_current_buffer->yy_buf_size;

		if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
			YY_FATAL_ERROR( "flex scanner push-back overflow" );
		}

	*--yy_cp = (char) c;


	yytext_ptr = yy_bp;
	yy_hold_char = *yy_cp;
	yy_c_buf_p = yy_cp;
	}
#endif	/* ifndef YY_NO_UNPUT */


#ifdef __cplusplus
static int yyinput()
#else
static int input()
#endif
	{
	int c;

	*yy_c_buf_p = yy_hold_char;

	if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
		{
		/* yy_c_buf_p now points to the character we want to return.
		 * If this occurs *before* the EOB characters, then it's a
		 * valid NUL; if not, then we've hit the end of the buffer.
		 */
		if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
			/* This was really a NUL. */
			*yy_c_buf_p = '\0';

		else
			{ /* need more input */
			int offset = yy_c_buf_p - yytext_ptr;
			++yy_c_buf_p;

			switch ( yy_get_next_buffer() )
				{
				case EOB_ACT_LAST_MATCH:
					/* This happens because yy_g_n_b()
					 * sees that we've accumulated a
					 * token and flags that we need to
					 * try matching the token before
					 * proceeding.  But for input(),
					 * there's no matching to consider.
					 * So convert the EOB_ACT_LAST_MATCH
					 * to EOB_ACT_END_OF_FILE.
					 */

					/* Reset buffer status. */
					yyrestart( yyin );

					/* fall through */

				case EOB_ACT_END_OF_FILE:
					{
					if ( yywrap() )
						return EOF;

					if ( ! yy_did_buffer_switch_on_eof )
						YY_NEW_FILE;
#ifdef __cplusplus
					return yyinput();
#else
					return input();
#endif
					}

				case EOB_ACT_CONTINUE_SCAN:
					yy_c_buf_p = yytext_ptr + offset;
					break;
				}
			}
		}

	c = *(unsigned char *) yy_c_buf_p;	/* cast for 8-bit char's */
	*yy_c_buf_p = '\0';	/* preserve yytext */
	yy_hold_char = *++yy_c_buf_p;

	yy_current_buffer->yy_at_bol = (c == '\n');

	return c;
	}


#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
void yyrestart( input_file )
FILE *input_file;
#endif
	{
	if ( ! yy_current_buffer )
		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );

	yy_init_buffer( yy_current_buffer, input_file );
	yy_load_buffer_state();
	}


#ifdef YY_USE_PROTOS
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
#else
void yy_switch_to_buffer( new_buffer )
YY_BUFFER_STATE new_buffer;
#endif
	{
	if ( yy_current_buffer == new_buffer )
		return;

	if ( yy_current_buffer )
		{
		/* Flush out information for old buffer. */
		*yy_c_buf_p = yy_hold_char;
		yy_current_buffer->yy_buf_pos = yy_c_buf_p;
		yy_current_buffer->yy_n_chars = yy_n_chars;
		}

	yy_current_buffer = new_buffer;
	yy_load_buffer_state();

	/* We don't actually know whether we did this switch during
	 * EOF (yywrap()) processing, but the only time this flag
	 * is looked at is after yywrap() is called, so it's safe
	 * to go ahead and always set it.
	 */
	yy_did_buffer_switch_on_eof = 1;
	}


#ifdef YY_USE_PROTOS
void yy_load_buffer_state( void )
#else
void yy_load_buffer_state()
#endif
	{
	yy_n_chars = yy_current_buffer->yy_n_chars;
	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
	yyin = yy_current_buffer->yy_input_file;
	yy_hold_char = *yy_c_buf_p;
	}


#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
#else
YY_BUFFER_STATE yy_create_buffer( file, size )
FILE *file;
int size;
#endif
	{
	YY_BUFFER_STATE b;

	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

	b->yy_buf_size = size;

	/* yy_ch_buf has to be 2 characters longer than the size given because
	 * we need to put in 2 end-of-buffer characters.
	 */
	b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

	b->yy_is_our_buffer = 1;

	yy_init_buffer( b, file );

	return b;
	}


#ifdef YY_USE_PROTOS
void yy_delete_buffer( YY_BUFFER_STATE b )
#else
void yy_delete_buffer( b )
YY_BUFFER_STATE b;
#endif
	{
	if ( ! b )
		return;

	if ( b == yy_current_buffer )
		yy_current_buffer = (YY_BUFFER_STATE) 0;

	if ( b->yy_is_our_buffer )
		yy_flex_free( (void *) b->yy_ch_buf );

	yy_flex_free( (void *) b );
	}


#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
extern int isatty YY_PROTO(( int ));
#endif
#endif

#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
#else
void yy_init_buffer( b, file )
YY_BUFFER_STATE b;
FILE *file;
#endif


	{
	yy_flush_buffer( b );

	b->yy_input_file = file;
	b->yy_fill_buffer = 1;

#if YY_ALWAYS_INTERACTIVE
	b->yy_is_interactive = 1;
#else
#if YY_NEVER_INTERACTIVE
	b->yy_is_interactive = 0;
#else
	b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
#endif
	}


#ifdef YY_USE_PROTOS
void yy_flush_buffer( YY_BUFFER_STATE b )
#else
void yy_flush_buffer( b )
YY_BUFFER_STATE b;
#endif

	{
	if ( ! b )
		return;

	b->yy_n_chars = 0;

	/* We always need two end-of-buffer characters.  The first causes
	 * a transition to the end-of-buffer state.  The second causes
	 * a jam in that state.
	 */
	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;

	b->yy_buf_pos = &b->yy_ch_buf[0];

	b->yy_at_bol = 1;
	b->yy_buffer_status = YY_BUFFER_NEW;

	if ( b == yy_current_buffer )
		yy_load_buffer_state();
	}


#ifndef YY_NO_SCAN_BUFFER
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
#else
YY_BUFFER_STATE yy_scan_buffer( base, size )
char *base;
yy_size_t size;
#endif
	{
	YY_BUFFER_STATE b;

	if ( size < 2 ||
	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
	     base[size-1] != YY_END_OF_BUFFER_CHAR )
		/* They forgot to leave room for the EOB's. */
		return 0;

	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );

	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
	b->yy_buf_pos = b->yy_ch_buf = base;
	b->yy_is_our_buffer = 0;
	b->yy_input_file = 0;
	b->yy_n_chars = b->yy_buf_size;
	b->yy_is_interactive = 0;
	b->yy_at_bol = 1;
	b->yy_fill_buffer = 0;
	b->yy_buffer_status = YY_BUFFER_NEW;

	yy_switch_to_buffer( b );

	return b;
	}
#endif


#ifndef YY_NO_SCAN_STRING
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
#else
YY_BUFFER_STATE yy_scan_string( yy_str )
yyconst char *yy_str;
#endif
	{
	int len;
	for ( len = 0; yy_str[len]; ++len )
		;

	return yy_scan_bytes( yy_str, len );
	}
#endif


#ifndef YY_NO_SCAN_BYTES
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
#else
YY_BUFFER_STATE yy_scan_bytes( bytes, len )
yyconst char *bytes;
int len;
#endif
	{
	YY_BUFFER_STATE b;
	char *buf;
	yy_size_t n;
	int i;

	/* Get memory for full buffer, including space for trailing EOB's. */
	n = len + 2;
	buf = (char *) yy_flex_alloc( n );
	if ( ! buf )
		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );

	for ( i = 0; i < len; ++i )
		buf[i] = bytes[i];

	buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;

	b = yy_scan_buffer( buf, n );
	if ( ! b )
		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );

	/* It's okay to grow etc. this buffer, and we should throw it
	 * away when we're done.
	 */
	b->yy_is_our_buffer = 1;

	return b;
	}
#endif


#ifndef YY_NO_PUSH_STATE
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
static void yy_push_state( new_state )
int new_state;
#endif
	{
	if ( yy_start_stack_ptr >= yy_start_stack_depth )
		{
		yy_size_t new_size;

		yy_start_stack_depth += YY_START_STACK_INCR;
		new_size = yy_start_stack_depth * sizeof( int );

		if ( ! yy_start_stack )
			yy_start_stack = (int *) yy_flex_alloc( new_size );

		else
			yy_start_stack = (int *) yy_flex_realloc(
					(void *) yy_start_stack, new_size );

		if ( ! yy_start_stack )
			YY_FATAL_ERROR(
			"out of memory expanding start-condition stack" );
		}

	yy_start_stack[yy_start_stack_ptr++] = YY_START;

	BEGIN(new_state);
	}
#endif


#ifndef YY_NO_POP_STATE
static void yy_pop_state()
	{
	if ( --yy_start_stack_ptr < 0 )
		YY_FATAL_ERROR( "start-condition stack underflow" );

	BEGIN(yy_start_stack[yy_start_stack_ptr]);
	}
#endif


#ifndef YY_NO_TOP_STATE
static int yy_top_state()
	{
	return yy_start_stack[yy_start_stack_ptr - 1];
	}
#endif

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

#ifdef YY_USE_PROTOS
static void yy_fatal_error( yyconst char msg[] )
#else
static void yy_fatal_error( msg )
char msg[];
#endif
	{
	(void) fprintf( stderr, "%s\n", msg );
	exit( YY_EXIT_FAILURE );
	}



/* Redefine yyless() so it works in section 3 code. */

#undef yyless
#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up yytext. */ \
		yytext[yyleng] = yy_hold_char; \
		yy_c_buf_p = yytext + n; \
		yy_hold_char = *yy_c_buf_p; \
		*yy_c_buf_p = '\0'; \
		yyleng = n; \
		} \
	while ( 0 )


/* Internal utility routines. */

#ifndef yytext_ptr
#ifdef YY_USE_PROTOS
static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
#else
static void yy_flex_strncpy( s1, s2, n )
char *s1;
yyconst char *s2;
int n;
#endif
	{
	register int i;
	for ( i = 0; i < n; ++i )
		s1[i] = s2[i];
	}
#endif

#ifdef YY_NEED_STRLEN
#ifdef YY_USE_PROTOS
static int yy_flex_strlen( yyconst char *s )
#else
static int yy_flex_strlen( s )
yyconst char *s;
#endif
	{
	register int n;
	for ( n = 0; s[n]; ++n )
		;

	return n;
	}
#endif


#ifdef YY_USE_PROTOS
static void *yy_flex_alloc( yy_size_t size )
#else
static void *yy_flex_alloc( size )
yy_size_t size;
#endif
	{
	return (void *) malloc( size );
	}

#ifdef YY_USE_PROTOS
static void *yy_flex_realloc( void *ptr, yy_size_t size )
#else
static void *yy_flex_realloc( ptr, size )
void *ptr;
yy_size_t size;
#endif
	{
	/* The cast to (char *) in the following accommodates both
	 * implementations that use char* generic pointers, and those
	 * that use void* generic pointers.  It works with the latter
	 * because both ANSI C and C++ allow castless assignment from
	 * any pointer type to void*, and deal with argument conversions
	 * as though doing an assignment.
	 */
	return (void *) realloc( (char *) ptr, size );
	}

#ifdef YY_USE_PROTOS
static void yy_flex_free( void *ptr )
#else
static void yy_flex_free( ptr )
void *ptr;
#endif
	{
	free( ptr );
	}

#if YY_MAIN
int main()
	{
	yylex();
	return 0;
	}
#endif
#line 342 "scan.l"



/*
 * This is the yylex routine called from outside. It exists to provide
 * a one-token pushback facility.  Beware of trying to make it do more:
 * for the most part, plpgsql's gram.y assumes that yytext is in step
 * with the "current token".
 */
int
plpgsql_yylex(void)
{
	if (have_pushback_token)
	{
		have_pushback_token = false;
		return pushback_token;
	}
	return yylex();
}

/*
 * Push back a single token to be re-read by next plpgsql_yylex() call.
 *
 * NOTE: this does not cause yytext to "back up".
 */
void
plpgsql_push_back_token(int token)
{
	if (have_pushback_token)
		elog(ERROR, "cannot push back multiple tokens");
	pushback_token = token;
	have_pushback_token = true;
}

/*
 * Report a syntax error.
 */
void
plpgsql_yyerror(const char *message)
{
	const char *loc = yytext;
	int			cursorpos;

	plpgsql_error_lineno = plpgsql_scanner_lineno();

	/* in multibyte encodings, return index in characters not bytes */
	cursorpos = pg_mbstrlen_with_len(scanbuf, loc - scanbuf) + 1;

	if (*loc == YY_END_OF_BUFFER_CHAR)
	{
		ereport(ERROR,
				(errcode(ERRCODE_SYNTAX_ERROR),
				 /* translator: %s is typically "syntax error" */
				 errmsg("%s at end of input", message),
				 internalerrposition(cursorpos),
				 internalerrquery(scanstr)));
	}
	else
	{
		ereport(ERROR,
				(errcode(ERRCODE_SYNTAX_ERROR),
				 /* translator: first %s is typically "syntax error" */
				 errmsg("%s at or near \"%s\"", message, loc),
				 internalerrposition(cursorpos),
				 internalerrquery(scanstr)));
	}
}

/*
 * Get the line number at which the current token ends.  This substitutes
 * for flex's very poorly implemented yylineno facility.
 *
 * We assume that flex has written a '\0' over the character following the
 * current token in scanbuf.  So, we just have to count the '\n' characters
 * before that.  We optimize this a little by keeping track of the last
 * '\n' seen so far.
 */
int
plpgsql_scanner_lineno(void)
{
	const char *c;

	while ((c = strchr(cur_line_start, '\n')) != NULL)
	{
		cur_line_start = c + 1;
		cur_line_num++;
	}
	return cur_line_num;
}

/*
 * Called before any actual parsing is done
 *
 * Note: the passed "str" must remain valid until plpgsql_scanner_finish().
 * Although it is not fed directly to flex, we need the original string
 * to cite in error messages.
 */
void
plpgsql_scanner_init(const char *str, int functype)
{
	Size	slen;

	slen = strlen(str);

	/*
	 * Might be left over after ereport()
	 */
	if (YY_CURRENT_BUFFER)
		yy_delete_buffer(YY_CURRENT_BUFFER);

	/*
	 * Make a scan buffer with special termination needed by flex.
	 */
	scanbuf = palloc(slen + 2);
	memcpy(scanbuf, str, slen);
	scanbuf[slen] = scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR;
	scanbufhandle = yy_scan_buffer(scanbuf, slen + 2);

	/* Other setup */
	scanstr = str;

    scanner_functype = functype;
    scanner_typereported = false;

	have_pushback_token = false;

	cur_line_start = scanbuf;
	cur_line_num = 1;

	/*----------
	 * Hack: skip any initial newline, so that in the common coding layout
	 *		CREATE FUNCTION ... AS '
	 *			code body
	 *		' LANGUAGE plpgsql;
	 * we will think "line 1" is what the programmer thinks of as line 1.
	 *----------
	 */
    if (*cur_line_start == '\r')
        cur_line_start++;
    if (*cur_line_start == '\n')
        cur_line_start++;

	BEGIN(INITIAL);
}

/*
 * Called after parsing is done to clean up after plpgsql_scanner_init()
 */
void
plpgsql_scanner_finish(void)
{
	yy_delete_buffer(scanbufhandle);
	pfree(scanbuf);
}

/*
 * Called after a T_STRING token is read to get the string literal's value
 * as a palloc'd string.  (We make this a separate call because in many
 * scenarios there's no need to get the decoded value.)
 *
 * Note: we expect the literal to be the most recently lexed token.  This
 * would not work well if we supported multiple-token pushback or if 
 * plpgsql_yylex() wanted to read ahead beyond a T_STRING token.
 */
char *
plpgsql_get_string_value(void)
{
	char	   *result;
	const char *cp;
	int			len;

	if (dolqlen > 0)
	{
		/* Token is a $foo$...$foo$ string */
		len = yyleng - 2 * dolqlen;
		Assert(len >= 0);
		result = (char *) palloc(len + 1);
		memcpy(result, yytext + dolqlen, len);
		result[len] = '\0';
	}
	else if (*yytext == 'E' || *yytext == 'e')
	{
		/* Token is an E'...' string */
		result = (char *) palloc(yyleng + 1);	/* more than enough room */
		len = 0;
		for (cp = yytext + 2; *cp; cp++)
		{
			if (*cp == '\'')
			{
				if (cp[1] == '\'')
					result[len++] = *cp++;
				/* else it must be string end quote */
			}
			else if (*cp == '\\')
			{
				if (cp[1] != '\0')	/* just a paranoid check */
					result[len++] = *(++cp);
			}
			else
				result[len++] = *cp;
		}
		result[len] = '\0';
	}
	else
	{
		/* Token is a '...' string */
		result = (char *) palloc(yyleng + 1);	/* more than enough room */
		len = 0;
		for (cp = yytext + 1; *cp; cp++)
		{
			if (*cp == '\'')
			{
				if (cp[1] == '\'')
					result[len++] = *cp++;
				/* else it must be string end quote */
			}
			else if (*cp == '\\')
			{
				if (cp[1] != '\0')	/* just a paranoid check */
					result[len++] = *(++cp);
			}
			else
				result[len++] = *cp;
		}
		result[len] = '\0';
	}
	return result;
}
