#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 88
#define YY_END_OF_BUFFER 89
static yyconst short int yy_accept[349] =
    {   0,
        0,    0,    0,    0,    0,    0,    0,    0,   89,   87,
       71,   71,   87,   87,   77,   87,   87,   87,   69,   87,
        2,   53,   53,   53,   53,   53,   53,   53,   53,   53,
       53,   53,   53,   53,   53,   53,   53,   53,   87,   82,
       81,   79,   76,   75,   76,   85,   85,   86,   71,   70,
        0,   53,   83,   61,    0,   72,    3,   73,   69,    1,
        0,   53,    0,    0,   53,   53,   53,   53,   53,   53,
       53,   53,   53,   53,   53,   53,   53,   53,   53,   24,
       25,   28,   53,   53,   53,   53,   53,   36,   53,   53,
       53,   53,   53,   53,   46,   53,   53,   53,    0,   82,

       80,   78,   74,   85,   84,    0,   53,    0,    0,    0,
        0,    0,   72,    0,    0,    0,    0,   54,   53,   53,
       53,   53,   53,   53,   53,   53,   53,   53,   53,   16,
       53,   53,   53,   53,   21,   53,   23,   53,   53,   29,
       53,   53,   32,   53,   53,   53,   53,   53,   53,   53,
       53,   53,   53,   53,   53,   53,   53,   53,    0,    0,
        0,    0,    0,    0,   62,    0,    0,    0,   54,    0,
       54,    0,    0,   53,   53,   53,   53,   53,   53,   53,
       53,   53,   52,   13,   53,   53,   53,   19,   53,   22,
       26,   27,   30,   31,   53,   34,   35,   53,   53,   53,

       53,   53,   53,   53,   53,   45,   47,   53,   49,   53,
        0,    0,    0,    0,   62,    0,   62,    0,    0,    0,
        0,    0,    0,    0,    0,   55,    4,    5,    6,   53,
       53,    9,   53,   53,   53,   53,   15,   53,   53,   20,
       53,   53,   38,   53,   53,   53,   53,   53,   53,   53,
       50,    0,    0,    0,    0,    0,    0,    0,   63,    0,
       56,    0,    0,    0,   55,    0,   55,    0,   53,    8,
       53,   53,   53,   14,   53,   53,   33,   53,   39,   53,
       41,   53,   53,   44,   53,    0,    0,   64,    0,    0,
        0,   63,    0,   63,    0,    0,    0,    0,    0,   53,

       10,   11,   53,   53,   18,   37,   53,   42,   53,   48,
       51,    0,    0,    0,    0,    0,    0,   57,    0,    7,
       53,   53,   53,   53,    0,    0,   65,    0,   59,    0,
        0,   53,   17,   53,   43,   67,    0,    0,    0,   58,
       53,   40,    0,   66,   60,   12,   68,    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[375] =
    {   0,
        0,  457,   33,   34,   42,   43,   41,   51,  454, 1403,
       53,   57,   44,   55, 1403,  440,  434,  434,  413,  405,
     1403,   62,   69,   76,   98,   60,   76,   80,   53,   91,
       92,  102,  104,  117,  124,  128,  126,  140,  386,    0,
      408,    0, 1403, 1403,  401,    0,    0,  404,   91,  403,
      402,  171, 1403,  178,  386,    0, 1403, 1403,  378, 1403,
      185,  113,  128,  196,  175,  181,  179,  188,  192,  207,
      203,  213,  217,  201,  230,  229,  239,  240,  246,  252,
      256,  258,  269,  267,  273,  271,  288,  284,  290,  299,
      308,  318,  286,  319,  301,  329,  331,  344,  358,    0,

     1403, 1403, 1403,    0, 1403,  382,  375,  383,  382,  134,
      393,  375,    0,  343,  333,  397,  367,  401,  387,  383,
      393,  394,  403,  404,  405,  420,  418,  427,  438,  416,
      439,  437,  448,  457,  450,  461,  463,  467,  473,  474,
      480,  486,  487,  496,  498,  502,  508,  517,  515,  519,
      530,  532,  534,  541,  545,  552,  556,  562,  334,  362,
      332,  318,  593,  349,  598,  314,  319,  344,  609,  616,
      623,  160,  634,  611,  613,  624,  622,  620,  635,  636,
      634,  645,  646,  652,  656,  658,  665,  667,  674,  676,
      678,  680,  687,  689,  693,  691,  700,  702,  704,  713,

      715,  717,  724,  734,  736,  730,  740,  747,  746,  757,
      314,  296,  301,  327,  788,  795,  802,  169,  813,  293,
      291,  280,  256,  817,  286,  601,  794,  795,  796,  810,
      806,  812,  816,  822,  823,  832,  833,  839,  845,  851,
      855,  857,  861,  872,  870,  879,  868,  883,  885,  894,
      895,  254,  243,  251,  238,  223,  931,  258,  935,  219,
     1403,  217,  222,  243,  942,  949,  952,  211,  930,  934,
      941,  940,  950,  951,  957,  967,  963,  973,  969,  979,
      980,  990,  986,  992, 1001,  210,  196, 1403,  195,  182,
      209, 1032, 1039, 1042,  173,  162,  155,  162,  143, 1019,

     1020, 1029, 1031, 1033, 1040, 1042, 1044, 1046, 1053, 1057,
     1403,  145,  135,  125,  103,  109,   78, 1403,   85, 1059,
     1066, 1068, 1075, 1077,   88,   63, 1403,   63, 1403,   58,
       63, 1087, 1086, 1088, 1097, 1403,   42,   45,   44, 1403,
     1098, 1099,   40, 1403, 1403, 1108, 1403, 1403, 1145, 1156,
     1167, 1178, 1184, 1194, 1205, 1216, 1227, 1233, 1244, 1250,
     1261, 1271, 1277, 1287, 1298, 1308, 1319, 1329, 1339, 1349,
     1360, 1370, 1381, 1391
    } ;

static yyconst short int yy_def[375] =
    {   0,
      348,    1,  349,  349,  350,  350,  351,  351,  348,  348,
      348,  348,  352,  353,  348,  348,  348,  348,  348,  348,
      348,  354,  354,  354,  354,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,  348,  355,
      348,  356,  348,  348,  348,  357,  357,  358,  348,  359,
      359,  348,  348,  348,  360,  361,  348,  348,  348,  348,
      348,   25,  348,  362,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,  348,  355,

      348,  348,  348,  357,  348,  363,  348,  359,  348,  348,
      364,  360,  361,  348,  348,  362,  365,  366,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,  348,  363,
      348,  348,  364,  367,  368,  348,  348,  365,  348,  348,
      366,  348,  369,   25,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,

       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
      348,  348,  348,  367,  348,  348,  368,  348,  370,  348,
      348,  348,  348,  369,  371,  372,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
       25,  348,  348,  348,  348,  348,  370,  373,  374,  348,
      348,  348,  348,  371,  348,  348,  372,  348,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
       25,   25,   25,   25,   25,  348,  348,  348,  348,  348,
      373,  348,  348,  374,  348,  348,  348,  348,  348,   25,

       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
      348,  348,  348,  348,  348,  348,  348,  348,  348,   25,
       25,   25,   25,   25,  348,  348,  348,  348,  348,  348,
      348,   25,   25,   25,   25,  348,  348,  348,  348,  348,
       25,   25,  348,  348,  348,   25,  348,    0,  348,  348,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348
    } ;

static yyconst short int yy_nxt[1445] =
    {   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,  347,   61,   61,   61,  345,  344,   54,   63,
       61,   61,   61,   64,  343,   79,   63,   61,   61,   61,
       64,   62,   70,   63,   62,  340,   71,   64,   62,   62,
      339,   62,   49,   49,   49,  338,   72,   65,   66,   61,

       61,   61,   76,  337,   73,   63,   74,   62,   62,   64,
      336,   77,   62,   78,   80,   75,   62,  331,  330,   62,
       62,   81,   62,   83,   84,   82,   67,   62,   62,   68,
       62,  329,   62,   85,   69,   62,   87,   88,   86,   89,
       62,   62,   90,  328,   62,   62,   91,  327,   62,   62,
       93,   94,   62,   62,   62,   92,   62,   95,   97,   62,
       62,  114,   62,  115,   62,   98,   96,  161,   62,  162,
      326,   62,   61,   61,   61,  108,   62,  325,   63,  109,
      109,  109,   64,  319,  318,  110,   61,   61,   61,  111,
      317,   54,   63,  222,  316,  223,   64,  116,  116,  116,

      117,  119,  255,   62,  256,  120,   62,   62,  315,   62,
      121,   62,   62,  292,  314,   62,   62,   62,  122,   62,
       62,  127,  130,   62,   62,  123,  124,  125,   62,   62,
      126,   62,   62,  313,   62,   62,  312,   62,   62,   62,
      311,   62,  128,   62,   62,   62,  299,  265,   62,   62,
      131,  129,  132,   62,  298,  297,  133,   62,   62,  296,
       62,   62,  292,  290,  134,   62,   62,   62,   62,  289,
       62,  136,  135,  288,   62,   62,   62,   62,  287,  138,
       62,  137,   62,   62,   62,  286,   62,   62,   62,   62,
      265,  139,   62,  140,   62,   62,  263,   62,   62,  144,

      141,   62,   62,   62,   62,   62,  142,   62,  143,   62,
      145,  262,   62,  261,  153,   62,   62,   62,   62,   62,
       62,   62,   62,  146,   62,  147,   62,   62,  260,   62,
       62,  215,   62,  254,  253,   62,   62,   62,  148,   62,
      252,  154,  149,  150,   62,  151,   62,   62,  169,   62,
       62,  221,  220,  215,   62,   62,  152,   62,  213,   62,
       62,  155,   62,  212,  156,   62,  157,   62,  105,  211,
      158,  169,   62,  167,  166,   62,   61,   61,   61,  108,
       62,   53,   63,  109,  109,  109,   64,  107,  105,  110,
      159,   59,   53,  111,  163,  163,  163,  164,  116,  116,

      116,  117,  170,  170,  170,  174,  107,  107,  172,  175,
      105,   62,  173,  103,   62,   62,  101,   99,   62,   62,
       60,   62,   62,   62,   62,   62,   59,  176,  177,   62,
       62,   62,   62,  180,   62,   62,   62,  178,  181,   62,
      179,   62,  182,   58,   62,   57,   62,   62,   62,   62,
       56,   62,   62,  348,   62,   62,   62,  187,   62,  183,
      184,  186,   39,   62,  185,   62,   62,   62,   62,   62,
       62,  348,  348,   62,   62,   62,   62,  189,   62,   62,
      348,   62,  348,  188,   62,   62,   62,  348,   62,   62,
      190,   62,   62,   62,   62,   62,  348,   62,  191,   62,

      348,   62,   62,   62,  192,   62,  348,  348,   62,   62,
       62,   62,  193,  195,   62,   62,   62,   62,   62,  348,
      348,  194,   62,   62,  196,  198,   62,   62,  197,   62,
       62,  348,   62,   62,   62,  200,   62,  348,   62,   62,
      348,  348,  199,   62,   62,   62,   62,   62,   62,  204,
       62,  201,  203,   62,  348,  202,  205,  348,   62,  348,
       62,   62,   62,   62,  348,   62,   62,  207,   62,   62,
       62,  206,   62,   62,  348,  348,   62,   62,  348,  348,
       62,   62,  208,   62,   62,  348,  209,   62,   62,  348,
      210,  348,   62,   62,  163,  163,  163,  164,   62,  216,

      216,  216,  266,  266,  266,  218,  348,  348,  268,  219,
      170,  170,  170,  117,  348,  348,  172,  170,  170,  170,
      173,  348,  348,  172,  170,  170,  170,  173,  348,  348,
      172,  348,  348,  348,  173,  224,  224,  224,  225,   62,
      348,   62,   62,  228,   62,  227,  229,   62,   62,   62,
       62,  231,   62,   62,  233,   62,   62,  230,   62,  232,
       62,  348,   62,   62,   62,   62,   62,   62,  348,  348,
      234,   62,   62,   62,   62,  235,   62,   62,  236,  237,
       62,   62,   62,   62,   62,  348,   62,   62,   62,   62,
      238,  348,   62,   62,   62,   62,   62,  348,   62,  240,

      348,  239,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,  241,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,  243,   62,   62,   62,
       62,   62,   62,  242,  348,   62,   62,  348,   62,  348,
       62,   62,  244,  245,   62,   62,   62,  348,   62,   62,
      246,   62,   62,   62,  248,   62,  249,  247,   62,  348,
       62,   62,   62,  348,   62,   62,   62,   62,   62,  348,
       62,   62,   62,  250,   62,   62,   62,   62,   62,  251,
      348,  348,   62,   62,  348,   62,  348,  348,   62,  216,
      216,  216,  164,   62,  348,  218,  216,  216,  216,  219,

      348,  348,  218,  216,  216,  216,  219,  348,  348,  218,
      348,  348,  348,  219,  257,  257,  257,  258,  224,  224,
      224,  225,   62,   62,   62,   62,   62,   62,  269,  348,
       62,   62,   62,  348,   62,  348,  348,   62,   62,  270,
       62,   62,   62,   62,   62,  348,   62,   62,   62,  271,
      272,   62,   62,   62,  273,  274,  348,  348,   62,   62,
       62,   62,  348,   62,   62,  348,  348,   62,   62,   62,
       62,  348,  348,   62,  275,   62,   62,  277,  348,   62,
      276,   62,   62,   62,  348,   62,   62,   62,   62,   62,
      278,   62,   62,   62,  279,  348,   62,   62,   62,   62,

       62,   62,  282,   62,   62,  280,   62,   62,   62,  281,
       62,   62,  348,   62,  283,   62,   62,  348,  348,   62,
      284,   62,   62,   62,  285,   62,   62,  348,  348,  348,
       62,   62,  257,  257,  257,  258,  293,  293,  293,  348,
      348,  348,  295,  266,  266,  266,  225,  348,  348,  268,
      266,  266,  266,  266,  266,  266,  268,  348,   62,  268,
      300,   62,   62,  301,  348,   62,   62,  348,   62,   62,
       62,   62,   62,  348,  348,  302,   62,   62,   62,   62,
      348,   62,   62,  304,  303,   62,   62,   62,   62,  305,
      348,   62,  348,   62,   62,   62,  307,   62,   62,   62,

       62,   62,  306,   62,   62,   62,  348,   62,   62,   62,
       62,   62,  308,  348,   62,   62,   62,   62,   62,  348,
       62,   62,  309,   62,  348,  310,   62,  348,   62,   62,
      348,  348,   62,  293,  293,  293,  258,   62,  348,  295,
      293,  293,  293,  293,  293,  293,  295,   62,   62,  295,
       62,   62,  348,  348,  320,   62,   62,   62,  348,   62,
       62,   62,   62,  348,  322,   62,  321,   62,   62,   62,
       62,   62,   62,   62,   62,  323,   62,   62,   62,  348,
       62,   62,   62,  324,   62,   62,  348,   62,   62,   62,
       62,  348,  332,   62,   62,   62,   62,   62,  333,   62,

      348,  334,   62,   62,   62,   62,   62,  341,   62,  342,
      348,   62,  335,   62,   62,   62,   62,   62,   62,   62,
      348,  348,   62,   62,   62,   62,   62,   62,   62,   62,
       62,  348,  346,   62,   62,   62,   62,  348,  348,   62,
      348,  348,  348,  348,   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,
      348,  348,  348,   55,   55,   62,   62,   62,  348,   62,

       62,  348,   62,   62,   62,  100,  100,  100,  100,  100,
      100,  100,  348,  100,  100,  100,  102,  102,  348,  102,
      102,  102,  102,  102,  102,  102,  102,  104,  104,  104,
      104,  104,  348,  104,  104,  104,  104,  104,  106,  348,
      348,  348,  348,  106,   51,   51,   51,   51,   51,   51,
       51,   51,   51,   51,   51,  112,  348,  348,  348,  112,
      112,  113,  113,  348,  348,  113,  113,  113,  113,  113,
      113,  113,  118,  118,  118,  118,  348,  348,  348,  348,
      348,  118,  160,  348,  348,  348,  160,  160,  165,  165,
      165,  165,  348,  348,  348,  348,  348,  165,  168,  168,

      168,  168,  168,  168,  168,  168,  168,  168,  168,  171,
      171,  171,  348,  171,  171,  348,  171,  171,  171,  214,
      214,  214,  214,  214,  214,  214,  214,  214,  214,  214,
      217,  217,  217,  348,  217,  217,  348,  217,  217,  217,
      226,  226,  226,  226,  348,  348,  348,  348,  348,  226,
      259,  259,  259,  259,  348,  348,  348,  348,  348,  259,
      264,  264,  264,  264,  264,  264,  264,  264,  264,  264,
      264,  267,  267,  267,  348,  267,  267,  348,  348,  267,
      267,  291,  291,  291,  291,  291,  291,  291,  291,  291,
      291,  291,  294,  294,  294,  348,  294,  294,  348,  348,

      294,  294,    9,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348
    } ;

static yyconst short int yy_chk[1445] =
    {   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,  343,   22,   22,   22,  339,  338,   14,   22,
       23,   23,   23,   22,  337,   29,   23,   24,   24,   24,
       23,   29,   26,   24,   29,  331,   26,   24,   26,   29,
      330,   26,   49,   49,   49,  328,   26,   23,   24,   25,

       25,   25,   28,  326,   27,   25,   27,   27,   28,   25,
      325,   28,   27,   28,   30,   27,   28,  319,  317,   30,
       31,   30,   30,   31,   32,   30,   25,   30,   31,   25,
       32,  316,   33,   32,   25,   33,   33,   33,   32,   34,
       33,   62,   35,  315,   62,   34,   35,  314,   34,   62,
       36,   37,   35,   34,   37,   35,   36,   37,   38,   36,
       35,   63,   37,   63,   36,   38,   37,  110,   38,  110,
      313,   38,   52,   52,   52,   52,   38,  312,   52,   54,
       54,   54,   52,  299,  298,   54,   61,   61,   61,   54,
      297,   54,   61,  172,  296,  172,   61,   64,   64,   64,

       64,   65,  218,   65,  218,   66,   65,   67,  295,   66,
       67,   65,   66,  291,  290,   67,   68,   66,   68,   68,
       69,   71,   74,   69,   68,   69,   70,   70,   69,   74,
       70,   71,   74,  289,   71,   70,  287,   74,   70,   71,
      286,   72,   72,   70,   72,   73,  268,  264,   73,   72,
       75,   73,   75,   73,  263,  262,   75,   76,   75,  260,
       76,   75,  258,  256,   76,   76,   75,   77,   78,  255,
       77,   78,   77,  254,   79,   77,   78,   79,  253,   81,
       80,   79,   79,   80,   81,  252,   82,   81,   80,   82,
      225,   81,   81,   83,   82,   84,  223,   83,   84,   86,

       83,   85,   86,   84,   85,   83,   84,   86,   85,   85,
       87,  222,   88,  221,   93,   88,   87,   93,   89,   87,
       88,   89,   93,   89,   87,   90,   89,   90,  220,   95,
       90,  214,   95,  213,  212,   90,   91,   95,   91,   91,
      211,   94,   91,   91,   91,   91,   92,   94,  168,   92,
       94,  167,  166,  164,   92,   94,   92,   96,  162,   97,
       96,   96,   97,  161,   97,   96,   98,   97,  160,  159,
       98,  117,   98,  115,  114,   98,  107,  107,  107,  107,
       98,  112,  107,  109,  109,  109,  107,  108,  106,  109,
       99,   59,   55,  109,  111,  111,  111,  111,  116,  116,

      116,  116,  118,  118,  118,  119,   51,   50,  118,  120,
       48,  120,  118,   45,  120,  119,   41,   39,  119,  120,
       20,  121,  122,  119,  121,  122,   19,  121,  122,  121,
      122,  123,  124,  125,  123,  124,  125,  123,  126,  123,
      124,  125,  127,   18,  130,   17,  127,  130,  126,  127,
       16,  126,  130,    9,  127,  128,  126,  132,  128,  128,
      129,  131,    2,  128,  129,  132,  129,  131,  132,  129,
      131,    0,    0,  132,  129,  131,  133,  134,  135,  133,
        0,  135,    0,  133,  133,  134,  135,    0,  134,  136,
      136,  137,  136,  134,  137,  138,    0,  136,  138,  137,

        0,  139,  140,  138,  139,  140,    0,    0,  141,  139,
      140,  141,  141,  143,  142,  143,  141,  142,  143,    0,
        0,  142,  142,  143,  144,  146,  145,  144,  145,  145,
      146,    0,  144,  146,  145,  148,  147,    0,  146,  147,
        0,    0,  147,  149,  147,  148,  149,  150,  148,  152,
      150,  149,  151,  148,    0,  150,  153,    0,  151,    0,
      152,  151,  153,  152,    0,  153,  151,  155,  152,  154,
      153,  154,  154,  155,    0,    0,  155,  154,    0,    0,
      156,  155,  156,  156,  157,    0,  157,  157,  156,    0,
      158,    0,  157,  158,  163,  163,  163,  163,  158,  165,

      165,  165,  226,  226,  226,  165,    0,    0,  226,  165,
      169,  169,  169,  169,    0,    0,  169,  170,  170,  170,
      169,    0,    0,  170,  171,  171,  171,  170,    0,    0,
      171,    0,    0,    0,  171,  173,  173,  173,  173,  174,
        0,  175,  174,  175,  175,  174,  176,  174,  178,  175,
      177,  178,  176,  177,  180,  176,  178,  177,  177,  179,
      176,    0,  181,  179,  180,  181,  179,  180,    0,    0,
      181,  179,  180,  182,  183,  182,  182,  183,  184,  185,
      184,  182,  183,  184,  185,    0,  186,  185,  184,  186,
      186,    0,  185,  187,  186,  188,  187,    0,  188,  189,

        0,  187,  189,  188,  190,  189,  191,  190,  192,  191,
      189,  192,  190,  195,  191,  193,  192,  194,  193,  196,
      194,  195,  196,  193,  195,  194,  199,  196,  197,  195,
      198,  197,  199,  198,    0,  199,  197,    0,  198,    0,
      199,  200,  200,  201,  200,  202,  201,    0,  202,  200,
      202,  201,  203,  202,  204,  203,  205,  203,  206,    0,
      203,  206,  204,    0,  205,  204,  206,  205,  207,    0,
      204,  207,  205,  208,  209,  208,  207,  209,  208,  210,
        0,    0,  209,  208,    0,  210,    0,    0,  210,  215,
      215,  215,  215,  210,    0,  215,  216,  216,  216,  215,

        0,    0,  216,  217,  217,  217,  216,    0,    0,  217,
        0,    0,    0,  217,  219,  219,  219,  219,  224,  224,
      224,  224,  227,  228,  229,  227,  228,  229,  230,    0,
      227,  228,  229,    0,  231,    0,    0,  231,  230,  231,
      232,  230,  231,  232,  233,    0,  230,  233,  232,  233,
      234,  235,  233,  234,  235,  236,    0,    0,  234,  235,
      236,  237,    0,  236,  237,    0,    0,  238,  236,  237,
      238,    0,    0,  239,  238,  238,  239,  241,    0,  240,
      239,  239,  240,  241,    0,  242,  241,  240,  242,  243,
      242,  241,  243,  242,  244,    0,  247,  243,  245,  247,

      244,  245,  247,  244,  247,  245,  245,  246,  244,  246,
      246,  248,    0,  249,  248,  246,  249,    0,    0,  248,
      249,  249,  250,  251,  250,  250,  251,    0,    0,    0,
      250,  251,  257,  257,  257,  257,  259,  259,  259,    0,
        0,    0,  259,  265,  265,  265,  265,    0,    0,  265,
      266,  266,  266,  267,  267,  267,  266,    0,  269,  267,
      269,  269,  270,  271,    0,  270,  269,    0,  272,  271,
      270,  272,  271,    0,    0,  272,  272,  271,  273,  274,
        0,  273,  274,  275,  273,  275,  273,  274,  275,  276,
        0,  277,    0,  275,  277,  276,  280,  279,  276,  277,

      279,  278,  278,  276,  278,  279,    0,  280,  281,  278,
      280,  281,  282,    0,  283,  280,  281,  283,  282,    0,
      284,  282,  283,  284,    0,  285,  282,    0,  284,  285,
        0,    0,  285,  292,  292,  292,  292,  285,    0,  292,
      293,  293,  293,  294,  294,  294,  293,  300,  301,  294,
      300,  301,    0,    0,  300,  300,  301,  302,    0,  303,
      302,  304,  303,    0,  304,  302,  303,  303,  305,  304,
      306,  305,  307,  306,  308,  307,  305,  308,  306,    0,
      307,  309,  308,  309,  309,  310,    0,  320,  310,  309,
      320,    0,  321,  310,  321,  320,  322,  321,  322,  322,

        0,  323,  321,  323,  322,  324,  323,  332,  324,  334,
        0,  323,  324,  324,  333,  332,  334,  333,  332,  334,
        0,    0,  333,  332,  334,  335,  341,  342,  335,  341,
      342,    0,  341,  335,  341,  342,  346,    0,    0,  346,
        0,    0,    0,    0,  346,  349,  349,  349,  349,  349,
      349,  349,  349,  349,  349,  349,  350,  350,  350,  350,
      350,  350,  350,  350,  350,  350,  350,  351,  351,  351,
      351,  351,  351,  351,  351,  351,  351,  351,  352,  352,
      352,  352,  352,  352,  352,  352,  352,  352,  352,  353,
        0,    0,    0,  353,  353,  354,  354,  354,    0,  354,

      354,    0,  354,  354,  354,  355,  355,  355,  355,  355,
      355,  355,    0,  355,  355,  355,  356,  356,    0,  356,
      356,  356,  356,  356,  356,  356,  356,  357,  357,  357,
      357,  357,    0,  357,  357,  357,  357,  357,  358,    0,
        0,    0,    0,  358,  359,  359,  359,  359,  359,  359,
      359,  359,  359,  359,  359,  360,    0,    0,    0,  360,
      360,  361,  361,    0,    0,  361,  361,  361,  361,  361,
      361,  361,  362,  362,  362,  362,    0,    0,    0,    0,
        0,  362,  363,    0,    0,    0,  363,  363,  364,  364,
      364,  364,    0,    0,    0,    0,    0,  364,  365,  365,

      365,  365,  365,  365,  365,  365,  365,  365,  365,  366,
      366,  366,    0,  366,  366,    0,  366,  366,  366,  367,
      367,  367,  367,  367,  367,  367,  367,  367,  367,  367,
      368,  368,  368,    0,  368,  368,    0,  368,  368,  368,
      369,  369,  369,  369,    0,    0,    0,    0,    0,  369,
      370,  370,  370,  370,    0,    0,    0,    0,    0,  370,
      371,  371,  371,  371,  371,  371,  371,  371,  371,  371,
      371,  372,  372,  372,    0,  372,  372,    0,    0,  372,
      372,  373,  373,  373,  373,  373,  373,  373,  373,  373,
      373,  373,  374,  374,  374,    0,  374,  374,    0,    0,

      374,  374,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348
    } ;

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
 *
 * IDENTIFICATION
 *    $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.38 2004/12/17 03:51:36 neilc Exp $
 *
 *    This software is copyrighted by Jan Wieck - Hamburg.
 *
 *    The author hereby grants permission  to  use,  copy,  modify,
 *    distribute,  and  license this software and its documentation
 *    for any purpose, provided that existing copyright notices are
 *    retained  in  all  copies  and  that  this notice is included
 *    verbatim in any distributions. No written agreement, license,
 *    or  royalty  fee  is required for any of the authorized uses.
 *    Modifications to this software may be  copyrighted  by  their
 *    author  and  need  not  follow  the licensing terms described
 *    here, provided that the new terms are  clearly  indicated  on
 *    the first page of each file where they apply.
 *
 *    IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY
 *    PARTY  FOR  DIRECT,   INDIRECT,   SPECIAL,   INCIDENTAL,   OR
 *    CONSEQUENTIAL   DAMAGES  ARISING  OUT  OF  THE  USE  OF  THIS
 *    SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN
 *    IF  THE  AUTHOR  HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
 *    DAMAGE.
 *
 *    THE  AUTHOR  AND  DISTRIBUTORS  SPECIFICALLY   DISCLAIM   ANY
 *    WARRANTIES,  INCLUDING,  BUT  NOT  LIMITED  TO,  THE  IMPLIED
 *    WARRANTIES  OF  MERCHANTABILITY,  FITNESS  FOR  A  PARTICULAR
 *    PURPOSE,  AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON
 *    AN "AS IS" BASIS, AND THE AUTHOR  AND  DISTRIBUTORS  HAVE  NO
 *    OBLIGATION   TO   PROVIDE   MAINTENANCE,   SUPPORT,  UPDATES,
 *    ENHANCEMENTS, OR MODIFICATIONS.
 *
 **********************************************************************/

#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) */
#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 int	scanner_typereported;
static int	pushback_token;
static bool have_pushback_token;
static int	lookahead_token;	
static bool have_lookahead_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 */

int	plpgsql_SpaceScanned = 0;
#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 900 "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 103 "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 = 0;

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

    /* ----------
     * The keyword rules
     * ----------
     */
#line 1086 "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 >= 349 )
					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] != 1403 );

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 134 "scan.l"
{ return K_ASSIGN;			}
	YY_BREAK
case 2:
YY_RULE_SETUP
#line 135 "scan.l"
{ return K_ASSIGN;			}
	YY_BREAK
case 3:
YY_RULE_SETUP
#line 136 "scan.l"
{ return K_DOTDOT;			}
	YY_BREAK
case 4:
YY_RULE_SETUP
#line 137 "scan.l"
{ return K_ALIAS;			}
	YY_BREAK
case 5:
YY_RULE_SETUP
#line 138 "scan.l"
{ return K_BEGIN;			}
	YY_BREAK
case 6:
YY_RULE_SETUP
#line 139 "scan.l"
{ return K_CLOSE;			}
	YY_BREAK
case 7:
YY_RULE_SETUP
#line 140 "scan.l"
{ return K_CONSTANT;		}
	YY_BREAK
case 8:
YY_RULE_SETUP
#line 141 "scan.l"
{ return K_CURSOR;			}
	YY_BREAK
case 9:
YY_RULE_SETUP
#line 142 "scan.l"
{ return K_DEBUG;			}
	YY_BREAK
case 10:
YY_RULE_SETUP
#line 143 "scan.l"
{ return K_DECLARE;			}
	YY_BREAK
case 11:
YY_RULE_SETUP
#line 144 "scan.l"
{ return K_DEFAULT;			}
	YY_BREAK
case 12:
YY_RULE_SETUP
#line 145 "scan.l"
{ return K_DIAGNOSTICS;		}
	YY_BREAK
case 13:
YY_RULE_SETUP
#line 146 "scan.l"
{ return K_ELSE;			}
	YY_BREAK
case 14:
YY_RULE_SETUP
#line 147 "scan.l"
{ return K_ELSIF;           }
	YY_BREAK
case 15:
YY_RULE_SETUP
#line 148 "scan.l"
{ return K_ELSIF;           }
	YY_BREAK
case 16:
YY_RULE_SETUP
#line 149 "scan.l"
{ return K_END;				}
	YY_BREAK
case 17:
YY_RULE_SETUP
#line 150 "scan.l"
{ return K_EXCEPTION;		}
	YY_BREAK
case 18:
YY_RULE_SETUP
#line 151 "scan.l"
{ return K_EXECUTE;			}
	YY_BREAK
case 19:
YY_RULE_SETUP
#line 152 "scan.l"
{ return K_EXIT;			}
	YY_BREAK
case 20:
YY_RULE_SETUP
#line 153 "scan.l"
{ return K_FETCH;			}
	YY_BREAK
case 21:
YY_RULE_SETUP
#line 154 "scan.l"
{ return K_FOR;				}
	YY_BREAK
case 22:
YY_RULE_SETUP
#line 155 "scan.l"
{ return K_FROM;			}
	YY_BREAK
case 23:
YY_RULE_SETUP
#line 156 "scan.l"
{ return K_GET;				}
	YY_BREAK
case 24:
YY_RULE_SETUP
#line 157 "scan.l"
{ return K_IF;				}
	YY_BREAK
case 25:
YY_RULE_SETUP
#line 158 "scan.l"
{ return K_IN;				}
	YY_BREAK
case 26:
YY_RULE_SETUP
#line 159 "scan.l"
{ return K_INFO;			}
	YY_BREAK
case 27:
YY_RULE_SETUP
#line 160 "scan.l"
{ return K_INTO;			}
	YY_BREAK
case 28:
YY_RULE_SETUP
#line 161 "scan.l"
{ return K_IS;				}
	YY_BREAK
case 29:
YY_RULE_SETUP
#line 162 "scan.l"
{ return K_LOG;				}
	YY_BREAK
case 30:
YY_RULE_SETUP
#line 163 "scan.l"
{ return K_LOOP;			}
	YY_BREAK
case 31:
YY_RULE_SETUP
#line 164 "scan.l"
{ return K_NEXT;			}
	YY_BREAK
case 32:
YY_RULE_SETUP
#line 165 "scan.l"
{ return K_NOT;				}
	YY_BREAK
case 33:
YY_RULE_SETUP
#line 166 "scan.l"
{ return K_NOTICE;			}
	YY_BREAK
case 34:
YY_RULE_SETUP
#line 167 "scan.l"
{ return K_NULL;			}
	YY_BREAK
case 35:
YY_RULE_SETUP
#line 168 "scan.l"
{ return K_OPEN;			}
	YY_BREAK
case 36:
YY_RULE_SETUP
#line 169 "scan.l"
{ return K_OR;				}
	YY_BREAK
case 37:
YY_RULE_SETUP
#line 170 "scan.l"
{ return K_PERFORM;			}
	YY_BREAK
case 38:
YY_RULE_SETUP
#line 171 "scan.l"
{ return K_RAISE;			}
	YY_BREAK
case 39:
YY_RULE_SETUP
#line 172 "scan.l"
{ return K_RENAME;			}
	YY_BREAK
case 40:
YY_RULE_SETUP
#line 173 "scan.l"
{ return K_RESULT_OID;		}
	YY_BREAK
case 41:
YY_RULE_SETUP
#line 174 "scan.l"
{ return K_RETURN;			}
	YY_BREAK
case 42:
YY_RULE_SETUP
#line 175 "scan.l"
{ return K_REVERSE;			}
	YY_BREAK
case 43:
YY_RULE_SETUP
#line 176 "scan.l"
{ return K_ROW_COUNT;		}
	YY_BREAK
case 44:
YY_RULE_SETUP
#line 177 "scan.l"
{ return K_SELECT;			}
	YY_BREAK
case 45:
YY_RULE_SETUP
#line 178 "scan.l"
{ return K_THEN;			}
	YY_BREAK
case 46:
YY_RULE_SETUP
#line 179 "scan.l"
{ return K_TO;				}
	YY_BREAK
case 47:
YY_RULE_SETUP
#line 180 "scan.l"
{ return K_TYPE;			}
	YY_BREAK
case 48:
YY_RULE_SETUP
#line 181 "scan.l"
{ return K_WARNING;			}
	YY_BREAK
case 49:
YY_RULE_SETUP
#line 182 "scan.l"
{ return K_WHEN;			}
	YY_BREAK
case 50:
YY_RULE_SETUP
#line 183 "scan.l"
{ return K_WHILE;			}
	YY_BREAK
case 51:
YY_RULE_SETUP
#line 185 "scan.l"
{ return O_OPTION;			}
	YY_BREAK
case 52:
YY_RULE_SETUP
#line 186 "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 53:
YY_RULE_SETUP
#line 196 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_word(yytext); }
	YY_BREAK
case 54:
YY_RULE_SETUP
#line 199 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblword(yytext); }
	YY_BREAK
case 55:
YY_RULE_SETUP
#line 202 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripword(yytext); }
	YY_BREAK
case 56:
YY_RULE_SETUP
#line 205 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordtype(yytext); }
	YY_BREAK
case 57:
YY_RULE_SETUP
#line 208 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordtype(yytext); }
	YY_BREAK
case 58:
YY_RULE_SETUP
#line 211 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripwordtype(yytext); }
	YY_BREAK
case 59:
YY_RULE_SETUP
#line 214 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordrowtype(yytext); }
	YY_BREAK
case 60:
YY_RULE_SETUP
#line 217 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordrowtype(yytext); }
	YY_BREAK
case 61:
YY_RULE_SETUP
#line 220 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_word(yytext); }
	YY_BREAK
case 62:
YY_RULE_SETUP
#line 223 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblword(yytext); }
	YY_BREAK
case 63:
YY_RULE_SETUP
#line 226 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripword(yytext); }
	YY_BREAK
case 64:
YY_RULE_SETUP
#line 229 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordtype(yytext); }
	YY_BREAK
case 65:
YY_RULE_SETUP
#line 232 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordtype(yytext); }
	YY_BREAK
case 66:
YY_RULE_SETUP
#line 235 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripwordtype(yytext); }
	YY_BREAK
case 67:
YY_RULE_SETUP
#line 238 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordrowtype(yytext); }
	YY_BREAK
case 68:
YY_RULE_SETUP
#line 241 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordrowtype(yytext); }
	YY_BREAK
case 69:
YY_RULE_SETUP
#line 245 "scan.l"
{ return T_NUMBER;			}
	YY_BREAK
case 70:
YY_RULE_SETUP
#line 247 "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 71:
YY_RULE_SETUP
#line 258 "scan.l"
{ plpgsql_SpaceScanned = 1;		}
	YY_BREAK
/* ----------
     * Eat up comments
     * ----------
     */
case 72:
YY_RULE_SETUP
#line 264 "scan.l"
;
	YY_BREAK
case 73:
YY_RULE_SETUP
#line 266 "scan.l"
{ start_lineno = plpgsql_scanner_lineno();
			  BEGIN(IN_COMMENT);
			}
	YY_BREAK
case 74:
YY_RULE_SETUP
#line 269 "scan.l"
{ BEGIN(INITIAL); plpgsql_SpaceScanned = 1; }
	YY_BREAK
case 75:
YY_RULE_SETUP
#line 270 "scan.l"
;
	YY_BREAK
case 76:
YY_RULE_SETUP
#line 271 "scan.l"
;
	YY_BREAK
case YY_STATE_EOF(IN_COMMENT):
#line 272 "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 77:
YY_RULE_SETUP
#line 287 "scan.l"
{
			  start_lineno = plpgsql_scanner_lineno();
			  start_charpos = yytext;
			  BEGIN(IN_STRING);
			}
	YY_BREAK
case 78:
YY_RULE_SETUP
#line 292 "scan.l"
{ }
	YY_BREAK
case 79:
YY_RULE_SETUP
#line 293 "scan.l"
{ /* can only happen with \ at EOF */ }
	YY_BREAK
case 80:
YY_RULE_SETUP
#line 294 "scan.l"
{ }
	YY_BREAK
case 81:
YY_RULE_SETUP
#line 295 "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 82:
YY_RULE_SETUP
#line 304 "scan.l"
{ }
	YY_BREAK
case YY_STATE_EOF(IN_STRING):
#line 305 "scan.l"
{
				plpgsql_error_lineno = start_lineno;
				ereport(ERROR,
						(errcode(ERRCODE_DATATYPE_MISMATCH),
						 errmsg("unterminated string")));
			}
	YY_BREAK
case 83:
YY_RULE_SETUP
#line 312 "scan.l"
{
			  start_lineno = plpgsql_scanner_lineno();
			  start_charpos = yytext;
			  dolqstart = pstrdup(yytext);
			  BEGIN(IN_DOLLARQUOTE);
			}
	YY_BREAK
case 84:
YY_RULE_SETUP
#line 318 "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 85:
YY_RULE_SETUP
#line 340 "scan.l"
{ }
	YY_BREAK
case 86:
YY_RULE_SETUP
#line 341 "scan.l"
{ /* needed for $ inside the quoted text */ }
	YY_BREAK
case YY_STATE_EOF(IN_DOLLARQUOTE):
#line 342 "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 87:
YY_RULE_SETUP
#line 353 "scan.l"
{ return yytext[0];			}
	YY_BREAK
case 88:
YY_RULE_SETUP
#line 355 "scan.l"
YY_FATAL_ERROR( "flex scanner jammed" );
	YY_BREAK
#line 1741 "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 >= 349 )
				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 >= 349 )
			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 == 348);

	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 355 "scan.l"



/*
 * This is the yylex routine called from outside. It exists to provide
 * a pushback facility, as well as to allow us to parse syntax that
 * requires more than one token of lookahead.
 */
int
plpgsql_yylex(void)
{
	int cur_token;

	if (have_pushback_token)
	{
		have_pushback_token = false;
		cur_token = pushback_token;
	}
	else if (have_lookahead_token)
	{
		have_lookahead_token = false;
		cur_token = lookahead_token;
	}
	else
		cur_token = yylex();

	/* Do we need to look ahead for a possible multiword token? */
	switch (cur_token)
	{
		/* RETURN NEXT must be reduced to a single token */
		case K_RETURN:
			if (!have_lookahead_token)
			{
				lookahead_token = yylex();
				have_lookahead_token = true;
			}
			if (lookahead_token == K_NEXT)
			{
				have_lookahead_token = false;
				cur_token = K_RETURN_NEXT;
			}
			break;

		default:
			break;
	}

	return cur_token;
}

/*
 * Push back a single token to be re-read by next plpgsql_yylex() call.
 */
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 = 0;

	have_pushback_token = false;
	have_lookahead_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 malloc'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 *) malloc(len + 1);
		memcpy(result, yytext + dolqlen, len);
		result[len] = '\0';
	}
	else
	{
		/* Token is a '...' string */
		result = (char *) malloc(yyleng + 1);	/* more than enough room */
		len = 0;
		for (cp = yytext; *cp; cp++)
		{
			if (*cp == '\'')
			{
				if (cp[1] == '\'')
					result[len++] = *cp++;
				/* else it must be string start or 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;
}
