#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 $
 */

#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 96
#define YY_END_OF_BUFFER 97
static yyconst short int yy_accept[381] =
    {   0,
        0,    0,    0,    0,    0,    0,    0,    0,   97,   95,
       78,   78,   95,   95,   84,   95,   95,   95,   76,   95,
        2,   60,   60,   60,   60,   60,   60,   60,   60,   60,
       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
       95,   90,   89,   87,   83,   82,   83,   93,   93,   94,
       78,   77,    0,   60,   91,   68,    0,   79,    3,   80,
       76,    1,    0,   60,    0,    0,   60,   60,    6,   60,
       60,   60,   60,   60,   60,   85,   60,   60,   60,   60,
       60,   60,   60,   26,   27,   31,   60,   60,   60,   60,
       60,   60,   41,   60,   60,   60,   60,   60,   60,   60,

       60,   53,   60,   60,   60,    0,   90,   88,   86,   81,
       93,   92,    0,   60,    0,    0,    0,    0,    0,   79,
        0,    0,    0,    0,   61,   60,   60,   60,   60,   60,
       60,   60,   60,   60,   60,   60,   18,   60,   60,   60,
       60,   23,   60,   25,   60,   60,   60,   32,   60,   60,
       60,    0,   37,   60,   60,   60,   60,   60,   60,   60,
       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
        0,    0,    0,    0,    0,    0,   69,    0,    0,    0,
       61,    0,   61,    0,    0,   60,   60,   60,   60,   60,
       60,   60,   60,   60,   60,   59,   15,   60,   60,   60,

       21,   60,   24,   28,   60,   30,   33,   34,   35,    0,
       60,   39,   40,   60,   60,   60,   60,   60,   60,   60,
       60,   60,   60,   52,   54,   60,   56,   60,    0,    0,
        0,    0,   69,    0,   69,    0,    0,    0,    0,    0,
        0,    0,    0,   62,    4,    5,    7,   60,   60,   60,
       11,   60,   60,   60,   60,   17,   60,   60,   22,   60,
        0,   60,   60,   43,   44,   60,   60,   60,   60,   60,
       60,   60,   60,   57,    0,    0,    0,    0,    0,    0,
        0,   70,    0,   63,    0,    0,    0,   62,    0,   62,
        0,   60,   60,   10,   60,   60,   60,   16,   60,   60,

       29,    0,   38,   60,   45,   60,   47,   60,   60,   50,
       51,   60,    0,    0,   71,    0,    0,    0,   70,    0,
       70,    0,    0,    0,    0,    0,   60,   60,   12,   13,
       60,   60,   20,    0,   42,   60,   48,   60,   55,   58,
        0,    0,    0,    0,    0,    0,   64,    0,    8,    9,
       60,   60,    0,   60,   60,    0,    0,   72,    0,   66,
        0,    0,   60,   19,   36,   60,   49,   74,    0,    0,
        0,   65,   60,   46,    0,   73,   67,   14,   75,    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,
       34,   35,   36,   37,   38,   39,   40,   41,   42,   28,
        1,   17,    1,    1,   18,    1,   19,   20,   21,   22,

       23,   24,   25,   26,   27,   28,   28,   29,   30,   31,
       32,   33,   34,   35,   36,   37,   38,   39,   40,   41,
       42,   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[43] =
    {   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,   11
    } ;

static yyconst short int yy_base[407] =
    {   0,
        0, 1010,   34,   35,   43,   44,   42,   52, 1015, 1160,
       54,   58,   45,   56, 1160, 1003,  988,  989,  984,  981,
     1160,   63,   70,   98,   54,   53,   84,   62,   45,   88,
       56,   85,   91,   99,   61,   67,  112,  115,  116,  124,
      958,    0,  967,    0, 1160, 1160,  957,    0,    0,  952,
      157,  951,  945,  160, 1160,  167,  942,    0, 1160, 1160,
      934, 1160,  174,   95,  114,  185,  157,  160,  132,  168,
      170,  169,  174,  184,  183, 1160,  173,  195,  200,  182,
      197,  199,  191,  206,  220,  207,  213,  211,  217,  261,
      231,  224,  228,  244,  229,  245,  238,  253,  255,  259,

      258,  260,  266,  269,  282,  865,    0, 1160, 1160, 1160,
        0, 1160,  889,  310,  890,  317,  291,  328,  886,    0,
      858,  843,  332,  879,  336,  304,  318,  319,  320,  327,
      268,  324,  335,  326,  341,  344,  265,  336,  349,  342,
      352,  353,  357,  358,  365,  359,  366,  362,  369,  367,
      373,  410,  393,  394,  396,  382,  398,  403,  406,  405,
      411,  408,  414,  419,  431,  421,  418,  434,  436,  439,
      814,  807,  780,  769,  467,  804,  480,  767,  719,  736,
      491,  498,  505,  429,  516,  462,  474,  432,  488,  499,
      491,  504,  505,  511,  508,  509,  513,  514,  512,  519,

      520,  537,  525,  529,  535,  536,  541,  542,  543,  719,
      551,  545,  546,  550,  552,  553,  566,  557,  567,  568,
      577,  578,  583,  574,  582,  588,  589,  590,  711,  697,
      703,  723,  631,  638,  645,  440,  624,  678,  633,  623,
      603,  656,  639,  660,  595,  628,  629,  646,  643,  644,
      631,  649,  652,  655,  653,  657,  659,  666,  660,  667,
      603,  669,  670,  675,  677,  683,  684,  687,  691,  690,
      701,  697,  700,  693,  591,  585,  598,  585,  572,  742,
      576,  746,  502, 1160,  475,  479,  486,  753,  760,  763,
      453,  728,  737,  730,  746,  750,  753,  751,  754,  755,

      757,  457,  759,  760,  761,  768,  762,  771,  777,  775,
      782,  783,  456,  444, 1160,  440,  446,  425,  818,  825,
      828,  366,  360,  315,  294,  274,  811,  793,  795,  815,
      817,  818,  816,  267,  819,  820,  821,  824,  822, 1160,
      252,  209,  212,  166,  150,  125, 1160,  123,  823,  826,
      844,  846,  124,  847,  850,  123,  103, 1160,   95, 1160,
       87,   93,  855,  833, 1160,  857,  849, 1160,   56,   58,
       46, 1160,  858,  859,   41, 1160, 1160,  860, 1160, 1160,
      902,  913,  924,  935,  941,  951,  962,  973,  984,  990,
     1001, 1007, 1018, 1028, 1034, 1044, 1055, 1065, 1076, 1086,

     1096, 1106, 1117, 1127, 1138, 1148
    } ;

static yyconst short int yy_def[407] =
    {   0,
      380,    1,  381,  381,  382,  382,  383,  383,  380,  380,
      380,  380,  384,  385,  380,  380,  380,  380,  380,  380,
      380,  386,  386,  386,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
      380,  387,  380,  388,  380,  380,  380,  389,  389,  390,
      380,  391,  391,  380,  380,  380,  392,  393,  380,  380,
      380,  380,  380,   24,  380,  394,   24,   24,   24,   24,
       24,   24,   24,   24,   24,  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,  380,  387,  380,  380,  380,
      389,  380,  395,  380,  391,  380,  380,  396,  392,  393,
      380,  380,  394,  397,  398,   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,  380,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
      380,  395,  380,  380,  396,  399,  400,  380,  380,  397,
      380,  380,  398,  380,  401,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,

       24,   24,   24,   24,   24,   24,   24,   24,   24,  380,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,  380,  380,
      380,  399,  380,  380,  400,  380,  402,  380,  380,  380,
      380,  401,  403,  404,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
      380,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,  380,  380,  380,  380,  380,  402,
      405,  406,  380,  380,  380,  380,  403,  380,  380,  404,
      380,   24,   24,   24,   24,   24,   24,   24,   24,   24,

       24,  380,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,  380,  380,  380,  380,  380,  405,  380,  380,
      406,  380,  380,  380,  380,  380,   24,   24,   24,   24,
       24,   24,   24,  380,   24,   24,   24,   24,   24,  380,
      380,  380,  380,  380,  380,  380,  380,  380,   24,   24,
       24,   24,  380,   24,   24,  380,  380,  380,  380,  380,
      380,  380,   24,   24,  380,   24,   24,  380,  380,  380,
      380,  380,   24,   24,  380,  380,  380,   24,  380,    0,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,

      380,  380,  380,  380,  380,  380
    } ;

static yyconst short int yy_nxt[1203] =
    {   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,   32,
       33,   34,   35,   36,   37,   38,   39,   22,   22,   40,
       22,   22,   43,   43,   49,   46,   46,   53,   50,   54,
       44,   44,   47,   47,   49,   51,   51,   51,   50,   51,
       51,   51,   55,  379,   63,   63,   63,   83,  377,   56,
       65,   63,   63,   63,   66,   73,   64,   65,   64,   74,
      376,   66,   70,   94,   80,   71,   64,   87,  375,   64,
       75,   72,   76,   81,   64,   64,   82,   64,   67,   63,

       63,   63,   64,   64,   95,   65,   64,   64,   64,   66,
       64,   84,   77,   89,   78,  372,   88,   64,   85,  371,
       68,   64,   90,   86,   79,   64,   64,  370,   91,   64,
       96,   92,   64,   93,   97,   99,   64,   64,   64,   69,
       64,  101,  104,   98,  369,  368,   64,  102,  121,  105,
      122,  100,  365,   64,   64,  362,   64,  103,   51,   51,
       51,   63,   63,   63,  115,   64,  361,   65,  116,  116,
      116,   66,  360,   64,  117,   63,   63,   63,  118,   64,
       56,   65,   64,  126,  127,   66,  123,  123,  123,  124,
       64,   64,   64,  131,  132,   64,   64,  133,   64,  128,

      129,   64,  134,  130,   64,   64,   64,  359,  136,   64,
       64,   64,  135,   64,   64,   64,  137,   64,  141,   64,
      138,   64,  139,   64,   64,   64,  140,  144,   64,   64,
      143,  142,   64,   64,  358,   64,   64,  148,   64,   64,
       64,   64,   64,  145,  149,  357,  155,   64,   64,  150,
       64,  157,   64,   64,   64,  146,  147,  151,   64,  154,
       64,   64,  152,  152,  152,   64,   64,   64,  159,   64,
       64,  158,   64,  160,  161,   64,  162,   64,  156,   64,
      166,   64,   64,   64,  356,   64,   64,   64,   64,  164,
       64,   64,  163,  165,   64,  353,   64,  153,  167,   64,

       64,   64,   64,  168,  169,  192,   64,   64,  170,   64,
       64,   63,   63,   63,  115,  348,  347,   65,  116,  116,
      116,   66,  186,   64,  117,  173,   64,  174,  118,  175,
      175,  175,  176,  123,  123,  123,  124,  182,  182,  182,
       64,   64,   64,  184,  187,   64,   64,  185,   64,   64,
      195,  346,  193,  194,  188,  189,  190,   64,  199,   64,
       64,   64,  191,   64,   64,   64,  197,   64,   64,  200,
      198,   64,  202,  196,   64,   64,   64,   64,  201,   64,
       64,  205,   64,   64,   64,   64,  203,   64,   64,  208,
       64,   64,  345,   64,   64,   64,  204,  206,   64,   64,

       64,  207,  344,   64,   64,  214,   64,   64,   64,  209,
       64,  152,  152,  152,   64,   64,   64,   65,   64,  211,
       64,   66,  212,   64,  217,   64,  213,   64,   64,  319,
      220,  221,  215,   64,   64,   64,   64,   64,  216,   64,
      225,   64,  218,   64,   64,  210,   64,   64,  219,   64,
      222,  224,   64,   64,  247,   64,   64,  223,   64,   64,
       64,   64,   64,  240,  226,  241,  227,  228,  175,  175,
      175,  176,   64,   64,  278,   64,  279,   64,  343,  342,
       64,  234,  234,  234,   64,  341,  340,  236,  334,  326,
      288,  237,  182,  182,  182,  124,   64,  245,  184,  182,

      182,  182,  185,   64,  246,  184,  182,  182,  182,  185,
       64,  325,  184,   64,  324,   64,  185,  242,  242,  242,
      243,   64,  250,  252,  248,  249,   64,   64,  251,   64,
       64,   64,   64,   64,   64,   64,   64,  256,  254,  255,
       64,   64,   64,  323,  257,   64,   64,   64,  253,   64,
       64,   64,   64,   64,   64,   64,  258,   64,   64,   64,
       64,   64,  259,   64,   64,   64,   64,   64,   64,  260,
       64,  262,   64,   64,   64,  265,   64,   64,   64,   64,
      319,  263,   64,   64,   64,  267,   64,   64,   64,   64,
       64,   64,   64,  264,   64,  266,   64,  270,   64,   64,

       64,  268,  269,  272,   64,   64,  271,   64,   64,   64,
       64,   64,  274,  317,  273,   64,  316,   64,   64,   64,
      315,  314,  313,   64,   64,  280,  280,  280,  281,   64,
       64,   64,  234,  234,  234,  176,   64,  302,  236,  234,
      234,  234,  237,  288,  286,  236,  234,  234,  234,  237,
       64,   64,  236,   64,  285,  284,  237,  242,  242,  242,
      243,  289,  289,  289,  292,   64,   64,  291,   64,   64,
       64,   64,   64,  293,   64,   64,  298,   64,  294,   64,
      296,   64,   64,  295,   64,   64,  297,   64,   64,   64,
       64,  303,   64,   64,   64,  299,   64,   64,   64,   64,

       64,   64,  300,  301,  304,  305,   64,   64,   64,   64,
       64,   64,   64,   64,  283,   64,   64,  307,   64,   64,
      306,  309,   64,   64,   64,   64,  308,  233,   64,  310,
      312,   64,   64,  311,   64,  277,  276,  275,   64,  261,
      181,   64,   64,  280,  280,  280,  281,  320,  320,  320,
       64,  239,   64,  322,  289,  289,  289,  243,  327,   64,
      291,  289,  289,  289,  289,  289,  289,  291,  329,   64,
      291,   64,   64,   64,  328,   64,   64,  333,   64,   64,
      332,   64,   64,   64,   64,  336,  330,   64,  331,  335,
       64,   64,   64,  337,   64,   64,   64,   64,   64,   64,

       64,   64,   64,   64,   64,   64,  238,  339,  233,   64,
      231,  230,   64,  112,  338,  350,   64,   64,   64,  320,
      320,  320,  281,   64,   64,  322,  320,  320,  320,  320,
      320,  320,  322,   64,   64,  322,   64,   64,   64,   64,
       64,   64,   64,   64,   64,   64,   64,  349,   64,  352,
      229,  354,   64,  351,  355,   64,   64,   64,   64,   64,
       64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
      363,   64,   64,  366,   64,  373,  364,   64,  374,   64,
       64,   64,   64,  181,  179,   64,  367,   64,   64,  178,
       64,   64,   55,  378,  114,  112,   64,  171,   64,   64,

       64,   64,   42,   42,   42,   42,   42,   42,   42,   42,
       42,   42,   42,   45,   45,   45,   45,   45,   45,   45,
       45,   45,   45,   45,   48,   48,   48,   48,   48,   48,
       48,   48,   48,   48,   48,   52,   52,   52,   52,   52,
       52,   52,   52,   52,   52,   52,   57,   61,   55,  114,
       57,   57,   64,   64,   64,  114,   64,   64,  112,   64,
       64,   64,  107,  107,  107,  107,  107,  107,  107,  110,
      107,  107,  107,  109,  109,  108,  109,  109,  109,  109,
      109,  109,  109,  109,  111,  111,  111,  111,  111,  106,
      111,  111,  111,  111,  111,  113,   62,   61,   60,   59,

      113,   53,   53,   53,   53,   53,   53,   53,   53,   53,
       53,   53,  119,   58,  380,   41,  119,  119,  120,  120,
      380,  380,  120,  120,  120,  120,  120,  120,  120,  125,
      125,  125,  125,  380,  380,  380,  380,  380,  125,  172,
      380,  380,  380,  172,  172,  177,  177,  177,  177,  380,
      380,  380,  380,  380,  177,  180,  180,  180,  180,  180,
      180,  180,  180,  180,  180,  180,  183,  183,  183,  380,
      183,  183,  380,  183,  183,  183,  232,  232,  232,  232,
      232,  232,  232,  232,  232,  232,  232,  235,  235,  235,
      380,  235,  235,  380,  235,  235,  235,  244,  244,  244,

      244,  380,  380,  380,  380,  380,  244,  282,  282,  282,
      282,  380,  380,  380,  380,  380,  282,  287,  287,  287,
      287,  287,  287,  287,  287,  287,  287,  287,  290,  290,
      290,  380,  290,  290,  380,  380,  290,  290,  318,  318,
      318,  318,  318,  318,  318,  318,  318,  318,  318,  321,
      321,  321,  380,  321,  321,  380,  380,  321,  321,    9,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,

      380,  380
    } ;

static yyconst short int yy_chk[1203] =
    {   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,    1,    3,    4,    7,    5,    6,   13,    7,   13,
        3,    4,    5,    6,    8,   11,   11,   11,    8,   12,
       12,   12,   14,  375,   22,   22,   22,   29,  371,   14,
       22,   23,   23,   23,   22,   26,   25,   23,   31,   26,
      370,   23,   25,   35,   28,   25,   29,   31,  369,   36,
       26,   25,   27,   28,   26,   25,   28,   31,   23,   24,

       24,   24,   35,   28,   36,   24,   27,   32,   36,   24,
       30,   30,   27,   33,   27,  362,   32,   64,   30,  361,
       24,   34,   33,   30,   27,   27,   32,  359,   33,   30,
       37,   34,   33,   34,   37,   38,   64,   38,   39,   24,
       34,   39,   40,   37,  357,  356,   40,   39,   65,   40,
       65,   38,  353,   37,   69,  348,   38,   39,   51,   51,
       51,   54,   54,   54,   54,   40,  346,   54,   56,   56,
       56,   54,  345,   69,   56,   63,   63,   63,   56,   67,
       56,   63,   68,   67,   68,   63,   66,   66,   66,   66,
       70,   72,   71,   73,   73,   77,   73,   73,   67,   70,

       71,   68,   74,   72,   80,   75,   74,  344,   77,   70,
       72,   71,   75,   83,   77,   73,   78,   78,   80,   81,
       79,   82,   79,   80,   75,   74,   79,   83,   84,   86,
       82,   81,   83,   88,  343,   87,   78,   87,   81,   89,
       82,   79,   85,   85,   87,  342,   92,   84,   86,   88,
       93,   95,   88,   91,   87,   85,   85,   89,   89,   91,
       97,   85,   90,   90,   90,   92,   94,   96,   97,   93,
       95,   96,   91,   97,   97,   98,   97,   99,   94,   97,
      101,  100,  102,   90,  341,   94,   96,  137,  103,   99,
      131,  104,   98,  100,   98,  334,   99,   90,  103,  101,

      100,  102,   90,  104,  105,  131,  137,  103,  105,  131,
      104,  114,  114,  114,  114,  326,  325,  114,  116,  116,
      116,  114,  126,  105,  116,  117,  126,  117,  116,  118,
      118,  118,  118,  123,  123,  123,  123,  125,  125,  125,
      127,  128,  129,  125,  127,  126,  132,  125,  134,  130,
      134,  324,  132,  133,  128,  129,  129,  133,  138,  127,
      128,  129,  130,  135,  140,  132,  136,  134,  130,  139,
      136,  139,  141,  135,  141,  142,  133,  138,  140,  143,
      144,  146,  135,  140,  148,  136,  143,  145,  147,  150,
      139,  149,  323,  141,  142,  151,  145,  147,  143,  144,

      146,  149,  322,  148,  156,  156,  145,  147,  150,  151,
      149,  152,  152,  152,  151,  153,  154,  152,  155,  153,
      157,  152,  154,  156,  159,  158,  155,  160,  159,  318,
      162,  163,  157,  161,  153,  154,  163,  155,  158,  157,
      167,  164,  160,  166,  158,  152,  160,  159,  161,  162,
      164,  166,  161,  165,  188,  163,  168,  165,  169,  167,
      164,  170,  166,  184,  168,  184,  169,  170,  175,  175,
      175,  175,  165,  188,  236,  168,  236,  169,  317,  316,
      170,  177,  177,  177,  186,  314,  313,  177,  302,  291,
      287,  177,  181,  181,  181,  181,  187,  186,  181,  182,

      182,  182,  181,  186,  187,  182,  183,  183,  183,  182,
      189,  286,  183,  191,  285,  187,  183,  185,  185,  185,
      185,  190,  191,  193,  189,  190,  192,  193,  192,  189,
      195,  196,  191,  194,  199,  197,  198,  198,  195,  197,
      190,  200,  201,  283,  199,  192,  193,  203,  194,  195,
      196,  204,  194,  199,  197,  198,  200,  205,  206,  202,
      200,  201,  202,  207,  208,  209,  203,  212,  213,  205,
      204,  211,  214,  211,  215,  216,  205,  206,  202,  218,
      281,  214,  207,  208,  209,  218,  212,  213,  217,  219,
      220,  214,  211,  215,  216,  217,  224,  221,  218,  221,

      222,  219,  220,  223,  225,  223,  222,  217,  219,  220,
      226,  227,  228,  279,  226,  224,  278,  245,  221,  222,
      277,  276,  275,  225,  223,  237,  237,  237,  237,  226,
      227,  228,  233,  233,  233,  233,  245,  261,  233,  234,
      234,  234,  233,  243,  241,  234,  235,  235,  235,  234,
      246,  247,  235,  251,  240,  239,  235,  242,  242,  242,
      242,  244,  244,  244,  248,  249,  250,  244,  248,  246,
      247,  252,  251,  249,  253,  255,  255,  254,  250,  256,
      253,  257,  259,  252,  249,  250,  254,  248,  258,  260,
      252,  262,  263,  253,  255,  257,  254,  264,  256,  265,

      257,  259,  258,  260,  263,  266,  267,  258,  260,  268,
      262,  263,  270,  269,  238,  274,  264,  268,  265,  272,
      267,  270,  273,  271,  266,  267,  269,  232,  268,  271,
      273,  270,  269,  272,  274,  231,  230,  229,  272,  210,
      180,  273,  271,  280,  280,  280,  280,  282,  282,  282,
      292,  179,  294,  282,  288,  288,  288,  288,  292,  293,
      288,  289,  289,  289,  290,  290,  290,  289,  295,  292,
      290,  294,  296,  298,  293,  297,  299,  300,  293,  301,
      299,  303,  304,  305,  307,  306,  296,  295,  297,  304,
      306,  296,  298,  308,  297,  299,  300,  310,  301,  309,

      303,  304,  305,  307,  311,  312,  178,  312,  176,  306,
      174,  173,  308,  172,  309,  328,  310,  329,  309,  319,
      319,  319,  319,  311,  312,  319,  320,  320,  320,  321,
      321,  321,  320,  327,  328,  321,  329,  330,  333,  331,
      332,  335,  336,  337,  339,  349,  338,  327,  350,  332,
      171,  336,  327,  331,  338,  364,  330,  333,  331,  332,
      335,  336,  337,  339,  349,  338,  351,  350,  352,  354,
      351,  367,  355,  354,  364,  363,  352,  363,  366,  366,
      373,  374,  378,  124,  122,  351,  355,  352,  354,  121,
      367,  355,  119,  373,  115,  113,  363,  106,  366,  373,

      374,  378,  381,  381,  381,  381,  381,  381,  381,  381,
      381,  381,  381,  382,  382,  382,  382,  382,  382,  382,
      382,  382,  382,  382,  383,  383,  383,  383,  383,  383,
      383,  383,  383,  383,  383,  384,  384,  384,  384,  384,
      384,  384,  384,  384,  384,  384,  385,   61,   57,   53,
      385,  385,  386,  386,  386,   52,  386,  386,   50,  386,
      386,  386,  387,  387,  387,  387,  387,  387,  387,   47,
      387,  387,  387,  388,  388,   43,  388,  388,  388,  388,
      388,  388,  388,  388,  389,  389,  389,  389,  389,   41,
      389,  389,  389,  389,  389,  390,   20,   19,   18,   17,

      390,  391,  391,  391,  391,  391,  391,  391,  391,  391,
      391,  391,  392,   16,    9,    2,  392,  392,  393,  393,
        0,    0,  393,  393,  393,  393,  393,  393,  393,  394,
      394,  394,  394,    0,    0,    0,    0,    0,  394,  395,
        0,    0,    0,  395,  395,  396,  396,  396,  396,    0,
        0,    0,    0,    0,  396,  397,  397,  397,  397,  397,
      397,  397,  397,  397,  397,  397,  398,  398,  398,    0,
      398,  398,    0,  398,  398,  398,  399,  399,  399,  399,
      399,  399,  399,  399,  399,  399,  399,  400,  400,  400,
        0,  400,  400,    0,  400,  400,  400,  401,  401,  401,

      401,    0,    0,    0,    0,    0,  401,  402,  402,  402,
      402,    0,    0,    0,    0,    0,  402,  403,  403,  403,
      403,  403,  403,  403,  403,  403,  403,  403,  404,  404,
      404,    0,  404,  404,    0,    0,  404,  404,  405,  405,
      405,  405,  405,  405,  405,  405,  405,  405,  405,  406,
      406,  406,    0,  406,  406,    0,    0,  406,  406,  380,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,
      380,  380,  380,  380,  380,  380,  380,  380,  380,  380,

      380,  380
    } ;

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-2007, 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.58 2007/07/25 04:19:09 neilc 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 835 "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 1021 "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 >= 381 )
					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] != 1160 );

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_MOVE;			}
	YY_BREAK
case 35:
YY_RULE_SETUP
#line 146 "scan.l"
{ return K_NEXT;			}
	YY_BREAK
case 36:
YY_RULE_SETUP
#line 147 "scan.l"
{ return K_NOSCROLL;		}
	YY_BREAK
case 37:
YY_RULE_SETUP
#line 148 "scan.l"
{ return K_NOT;				}
	YY_BREAK
case 38:
YY_RULE_SETUP
#line 149 "scan.l"
{ return K_NOTICE;			}
	YY_BREAK
case 39:
YY_RULE_SETUP
#line 150 "scan.l"
{ return K_NULL;			}
	YY_BREAK
case 40:
YY_RULE_SETUP
#line 151 "scan.l"
{ return K_OPEN;			}
	YY_BREAK
case 41:
YY_RULE_SETUP
#line 152 "scan.l"
{ return K_OR;				}
	YY_BREAK
case 42:
YY_RULE_SETUP
#line 153 "scan.l"
{ return K_PERFORM;			}
	YY_BREAK
case 43:
YY_RULE_SETUP
#line 154 "scan.l"
{ return K_QUERY;			}
	YY_BREAK
case 44:
YY_RULE_SETUP
#line 155 "scan.l"
{ return K_RAISE;			}
	YY_BREAK
case 45:
YY_RULE_SETUP
#line 156 "scan.l"
{ return K_RENAME;			}
	YY_BREAK
case 46:
YY_RULE_SETUP
#line 157 "scan.l"
{ return K_RESULT_OID;		}
	YY_BREAK
case 47:
YY_RULE_SETUP
#line 158 "scan.l"
{ return K_RETURN;			}
	YY_BREAK
case 48:
YY_RULE_SETUP
#line 159 "scan.l"
{ return K_REVERSE;			}
	YY_BREAK
case 49:
YY_RULE_SETUP
#line 160 "scan.l"
{ return K_ROW_COUNT;		}
	YY_BREAK
case 50:
YY_RULE_SETUP
#line 161 "scan.l"
{ return K_SCROLL;			}
	YY_BREAK
case 51:
YY_RULE_SETUP
#line 162 "scan.l"
{ return K_STRICT;	    	}
	YY_BREAK
case 52:
YY_RULE_SETUP
#line 163 "scan.l"
{ return K_THEN;			}
	YY_BREAK
case 53:
YY_RULE_SETUP
#line 164 "scan.l"
{ return K_TO;				}
	YY_BREAK
case 54:
YY_RULE_SETUP
#line 165 "scan.l"
{ return K_TYPE;			}
	YY_BREAK
case 55:
YY_RULE_SETUP
#line 166 "scan.l"
{ return K_WARNING;			}
	YY_BREAK
case 56:
YY_RULE_SETUP
#line 167 "scan.l"
{ return K_WHEN;			}
	YY_BREAK
case 57:
YY_RULE_SETUP
#line 168 "scan.l"
{ return K_WHILE;			}
	YY_BREAK
case 58:
YY_RULE_SETUP
#line 170 "scan.l"
{ return O_OPTION;			}
	YY_BREAK
case 59:
YY_RULE_SETUP
#line 171 "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 60:
YY_RULE_SETUP
#line 181 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_word(yytext); }
	YY_BREAK
case 61:
YY_RULE_SETUP
#line 184 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblword(yytext); }
	YY_BREAK
case 62:
YY_RULE_SETUP
#line 187 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripword(yytext); }
	YY_BREAK
case 63:
YY_RULE_SETUP
#line 190 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordtype(yytext); }
	YY_BREAK
case 64:
YY_RULE_SETUP
#line 193 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordtype(yytext); }
	YY_BREAK
case 65:
YY_RULE_SETUP
#line 196 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripwordtype(yytext); }
	YY_BREAK
case 66:
YY_RULE_SETUP
#line 199 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordrowtype(yytext); }
	YY_BREAK
case 67:
YY_RULE_SETUP
#line 202 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordrowtype(yytext); }
	YY_BREAK
case 68:
YY_RULE_SETUP
#line 205 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_word(yytext); }
	YY_BREAK
case 69:
YY_RULE_SETUP
#line 208 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblword(yytext); }
	YY_BREAK
case 70:
YY_RULE_SETUP
#line 211 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripword(yytext); }
	YY_BREAK
case 71:
YY_RULE_SETUP
#line 214 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordtype(yytext); }
	YY_BREAK
case 72:
YY_RULE_SETUP
#line 217 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordtype(yytext); }
	YY_BREAK
case 73:
YY_RULE_SETUP
#line 220 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripwordtype(yytext); }
	YY_BREAK
case 74:
YY_RULE_SETUP
#line 223 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordrowtype(yytext); }
	YY_BREAK
case 75:
YY_RULE_SETUP
#line 226 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordrowtype(yytext); }
	YY_BREAK
case 76:
YY_RULE_SETUP
#line 230 "scan.l"
{ return T_NUMBER;			}
	YY_BREAK
case 77:
YY_RULE_SETUP
#line 232 "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 78:
YY_RULE_SETUP
#line 243 "scan.l"
{ plpgsql_SpaceScanned = true;		}
	YY_BREAK
/* ----------
     * Eat up comments
     * ----------
     */
case 79:
YY_RULE_SETUP
#line 249 "scan.l"
;
	YY_BREAK
case 80:
YY_RULE_SETUP
#line 251 "scan.l"
{ start_lineno = plpgsql_scanner_lineno();
			  BEGIN(IN_COMMENT);
			}
	YY_BREAK
case 81:
YY_RULE_SETUP
#line 254 "scan.l"
{ BEGIN(INITIAL); plpgsql_SpaceScanned = true; }
	YY_BREAK
case 82:
YY_RULE_SETUP
#line 255 "scan.l"
;
	YY_BREAK
case 83:
YY_RULE_SETUP
#line 256 "scan.l"
;
	YY_BREAK
case YY_STATE_EOF(IN_COMMENT):
#line 257 "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 84:
YY_RULE_SETUP
#line 272 "scan.l"
{
			  start_lineno = plpgsql_scanner_lineno();
			  start_charpos = yytext;
			  BEGIN(IN_STRING);
			}
	YY_BREAK
case 85:
YY_RULE_SETUP
#line 277 "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 86:
YY_RULE_SETUP
#line 283 "scan.l"
{ }
	YY_BREAK
case 87:
YY_RULE_SETUP
#line 284 "scan.l"
{ /* can only happen with \ at EOF */ }
	YY_BREAK
case 88:
YY_RULE_SETUP
#line 285 "scan.l"
{ }
	YY_BREAK
case 89:
YY_RULE_SETUP
#line 286 "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 90:
YY_RULE_SETUP
#line 295 "scan.l"
{ }
	YY_BREAK
case YY_STATE_EOF(IN_STRING):
#line 296 "scan.l"
{
				plpgsql_error_lineno = start_lineno;
				ereport(ERROR,
						(errcode(ERRCODE_DATATYPE_MISMATCH),
						 errmsg("unterminated string")));
			}
	YY_BREAK
case 91:
YY_RULE_SETUP
#line 303 "scan.l"
{
			  start_lineno = plpgsql_scanner_lineno();
			  start_charpos = yytext;
			  dolqstart = pstrdup(yytext);
			  BEGIN(IN_DOLLARQUOTE);
			}
	YY_BREAK
case 92:
YY_RULE_SETUP
#line 309 "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 93:
YY_RULE_SETUP
#line 331 "scan.l"
{ }
	YY_BREAK
case 94:
YY_RULE_SETUP
#line 332 "scan.l"
{ /* needed for $ inside the quoted text */ }
	YY_BREAK
case YY_STATE_EOF(IN_DOLLARQUOTE):
#line 333 "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 95:
YY_RULE_SETUP
#line 344 "scan.l"
{ return yytext[0];			}
	YY_BREAK
case 96:
YY_RULE_SETUP
#line 346 "scan.l"
YY_FATAL_ERROR( "flex scanner jammed" );
	YY_BREAK
#line 1721 "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 >= 381 )
				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 >= 381 )
			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 == 380);

	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 346 "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;
}
