#line 2 "pl_scan.c"

#line 4 "pl_scan.c"

#define  YY_INT_ALIGNED short int

/* A lexical scanner generated by flex */

#define yy_create_buffer plpgsql_base_yy_create_buffer
#define yy_delete_buffer plpgsql_base_yy_delete_buffer
#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 yylineno plpgsql_base_yylineno
#define yyout plpgsql_base_yyout
#define yyrestart plpgsql_base_yyrestart
#define yytext plpgsql_base_yytext
#define yywrap plpgsql_base_yywrap
#define yyalloc plpgsql_base_yyalloc
#define yyrealloc plpgsql_base_yyrealloc
#define yyfree plpgsql_base_yyfree

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif

/* First, we deal with  platform-specific or compiler-specific issues. */

/* begin standard C headers. */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>

/* end standard C headers. */

/* flex integer type definitions */

#ifndef FLEXINT_H
#define FLEXINT_H

/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */

#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L

/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
 * if you want the limit (max/min) macros for int types. 
 */
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif

#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t; 
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */

/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN               (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN              (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN              (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX               (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX              (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX              (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX              (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX             (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX             (4294967295U)
#endif

#endif /* ! FLEXINT_H */

#ifdef __cplusplus

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

#else	/* ! __cplusplus */

/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)

#define YY_USE_CONST

#endif	/* defined (__STDC__) */
#endif	/* ! __cplusplus */

#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#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 plpgsql_base_yyrestart(plpgsql_base_yyin  )

#define YY_END_OF_BUFFER_CHAR 0

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

/* The state buf must be large enough to hold one state per character in the main buffer.
 */
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))

#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif

extern int plpgsql_base_yyleng;

extern FILE *plpgsql_base_yyin, *plpgsql_base_yyout;

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

    #define YY_LESS_LINENO(n)
    
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up plpgsql_base_yytext. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
		*yy_cp = (yy_hold_char); \
		YY_RESTORE_YY_MORE_OFFSET \
		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
		YY_DO_BEFORE_ACTION; /* set up plpgsql_base_yytext again */ \
		} \
	while ( 0 )

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

#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif

#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
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;

    int yy_bs_lineno; /**< The line count. */
    int yy_bs_column; /**< The column count. */
    
	/* 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 plpgsql_base_yyrestart()), so that the user can continue scanning by
	 * just pointing plpgsql_base_yyin at a new input file.
	 */
#define YY_BUFFER_EOF_PENDING 2

	};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */

/* Stack of input buffers. */
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */

/* 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".
 *
 * Returns the top of the stack, or NULL.
 */
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
                          : NULL)

/* Same as previous macro, but useful when we know that the buffer stack is not
 * NULL or when we need an lvalue. For internal use only.
 */
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]

/* yy_hold_char holds the character lost when plpgsql_base_yytext is formed. */
static char yy_hold_char;
static int yy_n_chars;		/* number of characters read into yy_ch_buf */
int plpgsql_base_yyleng;

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

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

void plpgsql_base_yyrestart (FILE *input_file  );
void plpgsql_base_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
YY_BUFFER_STATE plpgsql_base_yy_create_buffer (FILE *file,int size  );
void plpgsql_base_yy_delete_buffer (YY_BUFFER_STATE b  );
void plpgsql_base_yy_flush_buffer (YY_BUFFER_STATE b  );
void plpgsql_base_yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
void plpgsql_base_yypop_buffer_state (void );

static void plpgsql_base_yyensure_buffer_stack (void );
static void plpgsql_base_yy_load_buffer_state (void );
static void plpgsql_base_yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );

#define YY_FLUSH_BUFFER plpgsql_base_yy_flush_buffer(YY_CURRENT_BUFFER )

YY_BUFFER_STATE plpgsql_base_yy_scan_buffer (char *base,yy_size_t size  );
YY_BUFFER_STATE plpgsql_base_yy_scan_string (yyconst char *yy_str  );
YY_BUFFER_STATE plpgsql_base_yy_scan_bytes (yyconst char *bytes,int len  );

void *plpgsql_base_yyalloc (yy_size_t  );
void *plpgsql_base_yyrealloc (void *,yy_size_t  );
void plpgsql_base_yyfree (void *  );

#define yy_new_buffer plpgsql_base_yy_create_buffer

#define yy_set_interactive(is_interactive) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){ \
        plpgsql_base_yyensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            plpgsql_base_yy_create_buffer(plpgsql_base_yyin,YY_BUF_SIZE ); \
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
	}

#define yy_set_bol(at_bol) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){\
        plpgsql_base_yyensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            plpgsql_base_yy_create_buffer(plpgsql_base_yyin,YY_BUF_SIZE ); \
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
	}

#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

/* Begin user sect3 */

#define plpgsql_base_yywrap(n) 1
#define YY_SKIP_YYWRAP

typedef unsigned char YY_CHAR;

FILE *plpgsql_base_yyin = (FILE *) 0, *plpgsql_base_yyout = (FILE *) 0;

typedef int yy_state_type;

extern int plpgsql_base_yylineno;

int plpgsql_base_yylineno = 1;

extern char *plpgsql_base_yytext;
#define yytext_ptr plpgsql_base_yytext

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

/* Done after the current pattern has been matched and before the
 * corresponding action - sets up plpgsql_base_yytext.
 */
#define YY_DO_BEFORE_ACTION \
	(yytext_ptr) = yy_bp; \
	plpgsql_base_yyleng = (size_t) (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
/* This struct is not used in this scanner,
   but its presence is necessary. */
struct yy_trans_info
	{
	flex_int32_t yy_verify;
	flex_int32_t yy_nxt;
	};
static yyconst flex_int16_t 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 flex_int32_t 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,   17,   18,   19,   20,   21,   22,
       23,   24,   25,   26,   26,   27,   28,   29,   30,   31,
       26,   32,   33,   34,   35,   36,   37,   38,   39,   26,
        1,   40,    1,    1,   41,    1,   42,   43,   44,   45,

       46,   47,   48,   49,   50,   26,   26,   51,   52,   53,
       54,   55,   26,   56,   57,   58,   59,   60,   61,   62,
       63,   26,    1,    1,    1,    1,    1,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,

       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
       26,   26,   26,   26,   26
    } ;

static yyconst flex_int32_t yy_meta[64] =
    {   0,
        1,    2,    3,    4,    5,    1,    6,    7,    8,    1,
        1,    9,    1,   10,    1,    1,   11,   11,   11,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,    8,
       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 flex_int16_t yy_base[375] =
    {   0,
        0,  255,   55,   56,   63,   64,   65,   68,  258, 2281,
       74,   77,   79,   76, 2281,  227,  223,  219,  211,  178,
     2281,   85,   96,  141,  180,  213,  255,  111,   99,  313,
      100,  104,  158,  170,  354,  200,  390,  220,   40,    0,
      179,    0, 2281, 2281,  173,    0,    0,  177,  118,  178,
      175,  251, 2281,  290,  172,    0, 2281, 2281,  163, 2281,
      144,  276,  153,  194,  324,  335,  206,  312,  360,  436,
      395,  349,  389,  458,  502,  473,  484,  397,  516,  383,
      479,  531,  524,  553,  565,  536,  560,  590,  605,  595,
      640,  622,  592,  610,  645,  663,  676,  670,   54,    0,

     2281, 2281, 2281,    0, 2281,  168,  699,  162,  719,  215,
      215,  131,    0,   56,   53,  469,  132,  722,  733,  694,
      611,  720,  725,  725,  729,  783,  790,  802,  778,  815,
      790,  810,  839,  825,  860,  874,  877,  857,  861,  891,
      902,  915,  888,  894,  908,  913,  921,  973,  929,  952,
      970,  990,  980,  975,  998,  996, 1005, 1006,   71,  126,
      110,  102,  495,  123, 1043,  132,  219,  121, 1064, 1071,
     1078,  249,  766, 1055, 1056, 1072, 1092, 1080, 1117, 1134,
     1118, 1127, 1155, 1143, 1149, 1195, 1165, 1206, 1209, 1226,
     1233, 1240, 1251, 1258, 1246, 1270, 1273, 1253, 1270, 1297,

     1267, 1320, 1327, 1292, 1322, 1342, 1353, 1348, 1376, 1356,
      156,  249,  258,  119, 1405, 1383, 1412,  322, 1423,  261,
      206,  266,  260, 1427,  113, 1431, 1434, 1441, 1448, 1455,
     1462, 1473, 1476, 1456, 1460, 1470, 1518, 1531, 1534, 1545,
     1531, 1558, 1570, 1566, 1591, 1575, 1576, 1591, 1632, 1584,
     1644,  270,  297,  224,  352,  363, 1655,  101, 1498,  365,
     2281,  372,  379,   86, 1659, 1666, 1669,  385, 1653, 1676,
     1668, 1693, 1669, 1705, 1700, 1709, 1729, 1754, 1761, 1768,
     1775, 1767, 1764, 1793, 1817,  392,  384, 2281,  398,  409,
       64, 1828, 1800, 1835,  433,  486,  491,  276,  490, 1842,

     1845, 1856, 1859, 1843, 1877, 1880, 1860, 1901, 1682, 1904,
     2281,  507,  524,  287,  521,  327,  525, 2281,  545, 1918,
     1904, 1902, 1917, 1954,  369,  558, 2281,  581, 2281,  587,
      417, 1926, 1971, 1978, 1989, 2281,  597,  436,  463, 2281,
     1956, 1992,  469, 2281, 2281, 2003, 2281, 2281, 2023, 2034,
     2045, 2056, 2062, 2072, 2083, 2094, 2105, 2111, 2122, 2128,
     2139, 2149, 2155, 2165, 2176, 2186, 2197, 2207, 2217, 2227,
     2238, 2248, 2259, 2269
    } ;

static yyconst flex_int16_t 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,   24,   24,   24,  354,  354,  354,
       24,   24,  354,  354,   24,  354,   24,  354,  348,  355,
      348,  356,  348,  348,  348,  357,  357,  358,  348,  359,
      359,  348,  348,  348,  360,  361,  348,  348,  348,  348,
      348,  354,  348,  362,  354,  354,   24,   30,  354,   30,
      354,  354,   30,  354,  354,  354,  354,   24,  354,  354,
       30,  354,   24,  354,  354,   24,   75,  354,  354,   75,
       30,  354,   24,   75,  354,  354,  354,   75,  348,  355,

      348,  348,  348,  357,  348,  363,  348,  359,  348,  348,
      364,  360,  361,  348,  348,  362,  365,  366,  354,   75,
       30,   30,   30,   24,   24,  354,  354,  354,   75,  354,
       75,   75,  354,   75,  354,  354,  354,   24,   24,  354,
      354,  354,   75,   24,   30,   30,   30,  354,   24,   24,
       75,  354,   75,   30,   75,   30,   30,   24,  348,  363,
      348,  348,  364,  367,  368,  348,  348,  365,  348,  348,
      366,  348,  369,   30,   30,   75,  354,   24,  354,  354,
       24,   30,  354,   75,   30,  354,   24,  354,  354,  354,
      354,  354,  354,  354,   75,  354,  354,   24,   75,  354,

       24,  354,  354,   75,   75,  354,  354,   75,  354,   75,
      348,  348,  348,  367,  348,  348,  368,  348,  370,  348,
      348,  348,  348,  369,  371,  372,  354,  354,  354,  354,
      354,  354,  354,   24,   24,   30,  354,  354,  354,  354,
       75,  354,  354,   75,  354,   30,   30,   24,  354,   30,
      354,  348,  348,  348,  348,  348,  370,  373,  374,  348,
      348,  348,  348,  371,  348,  348,  372,  348,   30,  354,
       75,  354,   30,  354,   75,   75,  354,  354,  354,  354,
      354,   75,   24,  354,  354,  348,  348,  348,  348,  348,
      373,  348,  348,  374,  348,  348,  348,  348,  348,  354,

      354,  354,  354,   24,  354,  354,   24,  354,   30,  354,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  354,
       75,   30,   75,  354,  348,  348,  348,  348,  348,  348,
      348,   75,  354,  354,  354,  348,  348,  348,  348,  348,
       30,  354,  348,  348,  348,  354,  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 flex_int16_t yy_nxt[2345] =
    {   0,
       10,   11,   12,   11,   13,   10,   14,   10,   15,   10,
       16,   17,   18,   19,   20,   21,   22,   23,   24,   25,
       26,   27,   28,   29,   30,   29,   31,   29,   32,   33,
       34,   35,   36,   37,   29,   29,   38,   29,   29,   10,
       29,   22,   23,   24,   25,   26,   27,   28,   29,   30,
       31,   29,   32,   33,   34,   35,   36,   37,   29,   29,
       38,   29,   29,   41,   41,   44,   44,   47,  292,   99,
       47,   48,   45,   45,   48,   49,   49,   49,   49,   49,
       49,   51,   53,   52,  159,  166,   61,   61,   61,   54,
      265,  167,   63,   99,   42,   42,   64,   61,   61,   61,

       61,   61,   61,   63,  211,  292,   63,   64,  159,  166,
       64,   65,   61,   61,   61,  167,   66,  265,   63,   49,
       49,   49,   64,  215,   84,  169,   62,  215,  211,   83,
       62,   79,  105,   85,   62,   65,  169,   53,   86,  212,
      213,   66,   61,   61,   61,   61,   61,   61,   63,   84,
       62,   63,   64,   83,   62,   64,   79,   85,   62,   61,
       61,   61,   86,  212,  213,   63,  107,   67,  220,   64,
       68,   61,   61,   61,  105,   69,   59,   63,   53,  107,
      252,   64,  107,  105,  114,  103,  115,  101,   87,   88,
       89,   67,  220,   60,   68,  116,  116,  116,  117,   69,

       70,   61,   61,   61,   71,  252,   62,   63,  114,   62,
      115,   64,   87,   88,   72,   89,  163,  163,  163,  164,
       93,   61,   61,   61,   59,   70,  261,   63,   58,   71,
       62,   64,   62,   62,   57,  121,   97,   56,   72,   73,
       62,   74,   62,   98,  288,   93,  161,   62,  162,  221,
       75,  261,   61,   61,   61,  108,   62,  348,   63,  121,
       39,   97,   64,   73,   62,   74,   62,  348,   98,  288,
      161,   62,  162,  221,   75,   76,  348,   61,   61,   61,
      222,   62,  223,   63,   77,  253,   78,   64,  254,   62,
      348,  109,  109,  109,  260,  262,  318,  110,  263,  286,

       76,  111,  348,   54,  222,   62,  223,  327,   77,  253,
       78,  348,  254,   62,   61,   61,   61,  348,  260,  262,
       63,  318,  263,  286,   64,   61,   61,   61,  348,  348,
      287,   63,  327,   62,   80,   64,   61,   61,   61,  348,
      122,   81,   63,  348,   62,   82,   64,  329,  119,  348,
       61,   61,   61,  255,  287,  256,   63,  120,   62,   80,
       64,   61,   61,   61,  122,   81,  348,   63,   62,   82,
       90,   64,  329,  119,   91,  348,  128,  255,  348,  256,
       62,  289,  120,   92,   61,   61,   61,  348,   62,  336,
       63,  123,  348,  348,   64,   90,   61,   61,   61,   91,

      128,  290,   63,  296,   62,  289,   64,   92,  297,  298,
       62,  127,   62,   94,  336,  123,   62,   62,  299,   95,
      311,  129,  312,   62,   62,  290,  136,  296,   96,  348,
      348,   62,  297,  298,  313,   62,  127,  340,   94,  314,
       62,   62,  299,   95,  311,  129,  312,   62,   62,  348,
      136,  348,   96,  124,  125,   62,  344,  126,  313,   61,
       61,   61,  340,  314,   62,   63,  315,  348,   62,   64,
      116,  116,  116,  117,   61,   61,   61,  130,  124,  125,
       63,  344,  126,  345,   64,   61,   61,   61,   62,  347,
      315,   63,   62,  348,  348,   64,  163,  163,  163,  164,

      138,  348,  130,   61,   61,   61,  134,   62,  345,   63,
      348,   62,  139,   64,  347,  135,  316,   61,   61,   61,
      131,  348,  132,   63,  317,  138,  133,   64,  319,  348,
      134,   62,   61,   61,   61,   62,  139,  325,   63,  135,
      316,  348,   64,  348,  348,  131,  140,  132,  317,  137,
       62,  133,  319,  141,   61,   61,   61,  326,   62,  328,
       63,  325,  144,  330,   64,   62,   61,   61,   61,  348,
       62,  140,   63,  137,   62,  331,   64,  141,   62,  348,
      145,  326,   62,  328,   62,  348,  144,  330,  348,   62,
      142,   61,   61,   61,   62,  348,  337,   63,  143,  331,

      348,   64,  348,   62,  348,  145,   61,   61,   61,   62,
      348,  338,   63,   62,  142,   62,   64,  339,  153,  147,
      337,   62,  143,   61,   61,   61,   62,  343,   62,   63,
      154,  348,   62,   64,   62,  338,  146,  348,   62,   62,
       62,  339,  153,  176,  147,   62,   61,   61,   61,  348,
       62,  343,   63,   62,  348,  154,   64,   62,  152,   62,
      146,   62,  348,   62,   61,   61,   61,  176,  148,  348,
       63,  348,  149,  150,   64,  151,  348,   61,   61,   61,
      348,  348,  152,   63,  348,  348,   62,   64,   62,  348,
      157,  348,  148,  155,  158,  348,  149,  150,  348,  151,

       61,   61,   61,  108,  348,  348,   63,  156,  348,  348,
       64,  348,   62,   62,   62,  157,  348,  155,  175,  158,
      109,  109,  109,  170,  170,  170,  110,  348,  348,  172,
      111,  156,  348,  173,   61,   61,   61,   62,  348,   62,
       63,   62,  348,  175,   64,  348,   62,  348,   62,  174,
      348,   62,  177,   62,   62,  180,  348,  178,   62,  179,
      348,  348,  348,   62,  348,  348,   62,  224,  224,  224,
      225,   62,   62,  348,  174,   62,  177,   62,   62,  180,
      348,  178,   62,  179,   61,   61,   61,   62,  348,  348,
       63,   61,   61,   61,   64,  348,   62,   63,  184,  181,

      348,   64,  185,   61,   61,   61,  348,  348,   62,   63,
      186,  348,  182,   64,   62,  348,   61,   61,   61,  348,
      348,   62,   63,  184,  181,  348,   64,  185,  187,  348,
       62,  348,  183,   62,   62,  186,  348,  182,  348,   62,
       61,   61,   61,  189,  348,   62,   63,  348,  348,   62,
       64,  348,  348,  187,  348,   62,  183,  348,  348,   62,
      348,   61,   61,   61,  348,  348,  348,   63,  189,  348,
       62,   64,  188,  348,   62,   61,   61,   61,   61,   61,
       61,   63,  348,   62,   63,   64,  191,   62,   64,  348,
      192,   62,   61,   61,   61,   62,  188,  348,   63,  348,

      348,  190,   64,   61,   61,   61,   62,   62,   62,   63,
      191,   62,  195,   64,  192,   62,   61,   61,   61,   62,
      196,  348,   63,   62,  348,  190,   64,  348,   62,   62,
      348,   62,  193,   62,  198,  348,  197,  195,  348,  348,
       62,   62,   62,  348,  196,   62,  348,   62,  194,   62,
      348,  348,   62,  199,   62,   62,  193,  348,   62,  198,
      197,  348,  348,  201,   62,   62,  348,   62,  348,   62,
      348,  348,  194,   62,   61,   61,   61,  199,   62,   62,
       63,   62,   62,  348,   64,  348,  202,  201,   62,  200,
      203,   61,   61,   61,   62,  348,   62,   63,   62,  348,

      205,   64,   62,  206,   62,   62,  348,   62,  348,  348,
      202,  348,  348,   62,  200,  203,   62,   62,  207,   62,
      348,   62,   62,   62,  208,  205,   62,  206,   62,   62,
      204,   62,  210,  209,  348,   62,  348,   62,  348,  348,
       62,   62,   62,  207,  216,  216,  216,   62,  208,  348,
      218,   62,   62,  348,  219,  348,  210,  209,  348,   62,
      348,   62,  348,  348,   62,  170,  170,  170,  117,  348,
      348,  172,  170,  170,  170,  173,   62,   62,  172,  170,
      170,  170,  173,   62,  228,  172,  348,  227,   62,  173,
       62,  348,  229,   61,   61,   61,   62,  348,  348,   63,

      348,   62,   62,   64,  348,  348,   62,   62,  228,  231,
      348,  227,   62,  348,   62,   62,  348,  229,   61,   61,
       61,   62,  348,  348,   63,  230,  348,  348,   64,  348,
       62,  348,  348,  231,  348,   61,   61,   61,   62,  232,
      348,   63,  348,  348,   62,   64,  348,   62,   62,  230,
      233,  348,  234,  348,  348,  235,   61,   61,   61,   62,
      348,   62,   63,   62,  232,  348,   64,  236,   62,  348,
      237,   62,  348,   62,  348,  233,  234,   62,  348,  235,
      348,   62,  348,   62,  348,  348,   62,  348,   62,  348,
      348,   62,  236,  348,   62,  237,   61,   61,   61,  239,

      348,   62,   63,  348,  348,   62,   64,   61,   61,   61,
       61,   61,   61,   63,  348,   62,   63,   64,   62,  348,
       64,  348,  348,  239,  348,  238,  348,   61,   61,   61,
      348,  348,  240,   63,   61,   61,   61,   64,  348,  348,
       63,   61,   61,   61,   64,  348,  348,   63,  348,  238,
      348,   64,   61,   61,   61,  348,  348,  240,   63,   61,
       61,   61,   64,  348,  241,   63,   62,  348,  348,   64,
       62,   61,   61,   61,   61,   61,   61,   63,  348,   62,
       63,   64,  242,  348,   64,  348,  348,   62,   62,  241,
      243,   62,  348,  245,   62,   62,   62,  348,   61,   61,

       61,   62,  348,   62,   63,  348,  242,  348,   64,  348,
      248,   62,   62,   62,  348,  243,   62,  245,  348,   62,
       62,   61,   61,   61,  244,   62,  348,   63,   61,   61,
       61,   64,  348,  348,   63,  248,  348,   62,   64,  348,
      249,   62,   62,   61,   61,   61,   62,  348,  244,   63,
      348,  246,  348,   64,   61,   61,   61,  348,  247,  348,
       63,  348,  348,  348,   64,  249,   62,   62,   62,  348,
      348,   62,  250,  348,   62,  246,  251,   61,   61,   61,
       62,  348,  247,   63,  216,  216,  216,   64,  348,  348,
      218,   62,  348,   62,  219,  348,  348,  250,  348,   62,

      348,  251,  348,  348,  348,   62,  216,  216,  216,  164,
      348,  348,  218,  216,  216,  216,  219,  348,  348,  218,
      348,  348,  348,  219,  257,  257,  257,  258,  224,  224,
      224,  225,  266,  266,  266,   61,   61,   61,  268,  348,
      348,   63,   61,   61,   61,   64,  348,  348,   63,   61,
       61,   61,   64,  348,  348,   63,   61,   61,   61,   64,
      348,  348,   63,   61,   61,   61,   64,  348,  348,   63,
      348,  269,  348,   64,   61,   61,   61,   61,   61,   61,
       63,  348,  272,   63,   64,   62,   62,   64,  348,  273,
       62,  274,  348,  270,   62,  348,  269,  348,   62,  293,

      293,  293,   62,  348,  348,  295,  272,  271,  348,   62,
       62,  348,  348,  273,   62,  348,  274,  270,   62,   61,
       61,   61,   62,  348,  348,   63,   62,  348,  348,   64,
      348,  271,   61,   61,   61,   61,   61,   61,   63,  348,
      348,   63,   64,  348,  348,   64,   61,   61,   61,   62,
      348,  277,   63,  348,  348,   62,   64,  348,  348,   61,
       61,   61,  348,  348,  275,   63,  348,  276,  348,   64,
      348,   61,   61,   61,   62,  348,  277,   63,  348,  348,
       62,   64,  348,  348,   62,  348,  279,  348,  275,  278,
       62,  276,   61,   61,   61,  348,   62,   62,   63,  348,

      348,  348,   64,  281,   62,   62,  348,   62,  282,   62,
      348,  279,  285,  278,  348,   62,   62,   62,  348,  348,
      283,   62,   62,  348,  280,   62,  348,  281,   62,  348,
       62,   62,  282,   61,   61,   61,  285,  348,  348,   63,
       62,   62,  348,   64,  283,   61,   61,   61,  280,   62,
      348,   63,  348,  348,  348,   64,  257,  257,  257,  258,
      266,  266,  266,  225,  348,  284,  268,  266,  266,  266,
      266,  266,  266,  268,   62,  348,  268,   61,   61,   61,
      348,  300,  348,   63,  348,   62,   62,   64,  301,  284,
       62,  348,   62,  348,   61,   61,   61,   62,  348,   62,

       63,  303,  348,   62,   64,  300,   61,   61,   61,   62,
      324,   62,   63,  301,   62,   62,   64,   62,   62,  348,
       62,   62,  348,  348,  304,  303,  302,   62,   62,  305,
       61,   61,   61,   62,  324,  348,   63,  348,   62,  348,
       64,  348,  348,   62,  348,   62,  348,  348,  348,  304,
      302,  348,   62,  348,  305,   61,   61,   61,   62,  348,
      348,   63,   61,   61,   61,   64,  348,  348,   63,   61,
       61,   61,   64,  348,  348,   63,   61,   61,   61,   64,
      348,  306,   63,  348,  348,   62,   64,  308,  348,  348,
       62,   62,  348,   62,   61,   61,   61,  348,  309,  348,

       63,  293,  293,  293,   64,  306,  348,  295,  307,  348,
       62,  348,  308,  348,   62,  348,   62,   62,   61,   61,
       61,  348,  309,  348,   63,  348,  348,  348,   64,  293,
      293,  293,  258,  348,  348,  295,  293,  293,  293,  310,
      348,  348,  295,   61,   61,   61,   61,   61,   61,   63,
      348,  348,   63,   64,  348,  348,   64,   61,   61,   61,
       61,   61,   61,   63,  310,  348,   63,   64,  348,   62,
       64,  348,  322,  348,  348,  320,  348,   62,   61,   61,
       61,   61,   61,   61,   63,  348,   62,   63,   64,  323,
      348,   64,  321,   62,   62,  348,  322,  348,  348,  320,

      348,   62,   61,   61,   61,   61,   61,   61,   63,  348,
       62,   63,   64,  323,  348,   64,  321,  348,   62,   61,
       61,   61,   62,   62,   62,   63,  348,  348,  332,   64,
      333,  348,  348,  348,   62,   62,  348,   62,  348,  348,
      348,  334,  348,  348,  341,  348,   62,   62,   62,   62,
       62,  348,  348,  332,  333,   61,   61,   61,   62,  348,
       62,   63,   62,  348,  348,   64,  334,  348,  348,  341,
      348,   62,   61,   61,   61,   62,  348,   62,   63,   61,
       61,   61,   64,  348,   62,   63,  348,  335,  346,   64,
       61,   61,   61,   61,   61,   61,   63,  342,  348,   63,

       64,  348,   62,   64,   61,   61,   61,  348,   62,  348,
       63,  335,  346,  348,   64,  348,  348,  348,  348,  348,
      348,  348,  342,   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,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348,  348,  348,  348,  348,  348,  348,
      348,  348,  348,  348
    } ;

static yyconst flex_int16_t yy_chk[2345] =
    {   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,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    3,    4,    5,    6,    7,  291,   39,
        8,    7,    5,    6,    8,   11,   11,   11,   12,   12,
       12,   13,   14,   13,   99,  114,   22,   22,   22,   14,
      264,  115,   22,   39,    3,    4,   22,   23,   23,   23,

       29,   29,   29,   23,  159,  258,   29,   23,   99,  114,
       29,   22,   28,   28,   28,  115,   23,  225,   28,   49,
       49,   49,   28,  214,   32,  168,   31,  164,  159,   31,
       32,   28,  160,   32,   31,   22,  117,  112,   32,  161,
      162,   23,   24,   24,   24,   61,   61,   61,   24,   32,
       31,   61,   24,   31,   32,   61,   28,   32,   31,   33,
       33,   33,   32,  161,  162,   33,  108,   24,  166,   33,
       24,   34,   34,   34,  106,   24,   59,   34,   55,   51,
      211,   34,   50,   48,   63,   45,   63,   41,   33,   33,
       34,   24,  166,   20,   24,   64,   64,   64,   64,   24,

       25,   36,   36,   36,   25,  211,   25,   36,   63,   25,
       63,   36,   33,   33,   25,   34,  111,  111,  111,  111,
       36,   38,   38,   38,   19,   25,  221,   38,   18,   25,
       25,   38,   67,   25,   17,   67,   38,   16,   25,   26,
       67,   26,   26,   38,  254,   36,  110,   26,  110,  167,
       26,  221,   52,   52,   52,   52,   67,    9,   52,   67,
        2,   38,   52,   26,   67,   26,   26,    0,   38,  254,
      110,   26,  110,  167,   26,   27,    0,   62,   62,   62,
      172,   27,  172,   62,   27,  212,   27,   62,  213,   27,
        0,   54,   54,   54,  220,  222,  298,   54,  223,  252,

       27,   54,    0,   54,  172,   27,  172,  314,   27,  212,
       27,    0,  213,   27,   30,   30,   30,    0,  220,  222,
       30,  298,  223,  252,   30,   65,   65,   65,    0,    0,
      253,   65,  314,   68,   30,   65,   66,   66,   66,    0,
       68,   30,   66,    0,   68,   30,   66,  316,   65,    0,
       72,   72,   72,  218,  253,  218,   72,   66,   68,   30,
       72,   69,   69,   69,   68,   30,    0,   69,   68,   30,
       35,   69,  316,   65,   35,    0,   72,  218,    0,  218,
       35,  255,   66,   35,   80,   80,   80,    0,   35,  325,
       80,   69,    0,    0,   80,   35,   71,   71,   71,   35,

       72,  256,   71,  260,   35,  255,   71,   35,  262,  263,
       73,   71,   35,   37,  325,   69,   37,   73,  268,   37,
      286,   73,  287,   78,   37,  256,   78,  260,   37,    0,
        0,   78,  262,  263,  289,   73,   71,  331,   37,  290,
       37,   73,  268,   37,  286,   73,  287,   78,   37,    0,
       78,    0,   37,   70,   70,   78,  338,   70,  289,   74,
       74,   74,  331,  290,   70,   74,  295,    0,   70,   74,
      116,  116,  116,  116,   76,   76,   76,   74,   70,   70,
       76,  338,   70,  339,   76,   77,   77,   77,   70,  343,
      295,   77,   70,    0,    0,   77,  163,  163,  163,  163,

       81,    0,   74,   75,   75,   75,   76,   81,  339,   75,
        0,   81,   81,   75,  343,   77,  296,   79,   79,   79,
       75,    0,   75,   79,  297,   81,   75,   79,  299,    0,
       76,   81,   82,   82,   82,   81,   81,  312,   82,   77,
      296,    0,   82,    0,    0,   75,   83,   75,  297,   79,
       83,   75,  299,   83,   84,   84,   84,  313,   83,  315,
       84,  312,   86,  317,   84,   86,   85,   85,   85,    0,
       86,   83,   85,   79,   83,  319,   85,   83,   87,    0,
       87,  313,   83,  315,   87,    0,   86,  317,    0,   86,
       84,   88,   88,   88,   86,    0,  326,   88,   85,  319,

        0,   88,    0,   87,    0,   87,   89,   89,   89,   87,
        0,  328,   89,   90,   84,   90,   89,  330,   93,   90,
      326,   93,   85,   92,   92,   92,   93,  337,   94,   92,
       94,    0,  121,   92,   94,  328,   89,    0,   90,  121,
       90,  330,   93,  121,   90,   93,   95,   95,   95,    0,
       93,  337,   95,   94,    0,   94,   95,  121,   92,   94,
       89,   91,    0,  121,   96,   96,   96,  121,   91,    0,
       96,    0,   91,   91,   96,   91,    0,   97,   97,   97,
        0,    0,   92,   97,    0,    0,   91,   97,   98,    0,
       98,    0,   91,   96,   98,    0,   91,   91,    0,   91,

      107,  107,  107,  107,    0,    0,  107,   97,    0,    0,
      107,    0,  120,   98,  120,   98,    0,   96,  120,   98,
      109,  109,  109,  118,  118,  118,  109,    0,    0,  118,
      109,   97,    0,  118,  119,  119,  119,  120,    0,  120,
      119,  122,    0,  120,  119,    0,  123,    0,  122,  119,
        0,  124,  122,  123,  124,  125,    0,  123,  125,  124,
        0,    0,    0,  125,    0,    0,  122,  173,  173,  173,
      173,  123,  122,    0,  119,  124,  122,  123,  124,  125,
        0,  123,  125,  124,  126,  126,  126,  125,    0,    0,
      126,  127,  127,  127,  126,    0,  129,  127,  129,  126,

        0,  127,  129,  128,  128,  128,    0,    0,  131,  128,
      131,    0,  127,  128,  131,    0,  130,  130,  130,    0,
        0,  129,  130,  129,  126,    0,  130,  129,  132,    0,
      132,    0,  128,  131,  132,  131,    0,  127,    0,  131,
      133,  133,  133,  134,    0,  134,  133,    0,    0,  134,
      133,    0,    0,  132,    0,  132,  128,    0,    0,  132,
        0,  135,  135,  135,    0,    0,    0,  135,  134,    0,
      134,  135,  133,    0,  134,  136,  136,  136,  137,  137,
      137,  136,    0,  138,  137,  136,  138,  139,  137,    0,
      139,  138,  140,  140,  140,  139,  133,    0,  140,    0,

        0,  136,  140,  141,  141,  141,  143,  138,  143,  141,
      138,  139,  143,  141,  139,  138,  142,  142,  142,  139,
      144,    0,  142,  144,    0,  136,  142,    0,  144,  145,
        0,  143,  141,  143,  146,    0,  145,  143,    0,    0,
      145,  146,  147,    0,  144,  146,    0,  144,  142,  147,
        0,    0,  144,  147,  145,  149,  141,    0,  149,  146,
      145,    0,    0,  149,  145,  146,    0,  147,    0,  146,
        0,    0,  142,  147,  148,  148,  148,  147,  150,  149,
      148,  150,  149,    0,  148,    0,  150,  149,  151,  148,
      151,  152,  152,  152,  151,    0,  154,  152,  153,    0,

      153,  152,  150,  154,  153,  150,    0,  154,    0,    0,
      150,    0,    0,  151,  148,  151,  155,  156,  155,  151,
        0,  154,  155,  153,  156,  153,  157,  154,  156,  153,
      152,  154,  158,  157,    0,  158,    0,  157,    0,    0,
      158,  155,  156,  155,  165,  165,  165,  155,  156,    0,
      165,  157,  156,    0,  165,    0,  158,  157,    0,  158,
        0,  157,    0,    0,  158,  169,  169,  169,  169,    0,
        0,  169,  170,  170,  170,  169,  174,  175,  170,  171,
      171,  171,  170,  174,  175,  171,    0,  174,  175,  171,
      176,    0,  176,  177,  177,  177,  176,    0,    0,  177,

        0,  174,  175,  177,    0,    0,  178,  174,  175,  178,
        0,  174,  175,    0,  178,  176,    0,  176,  179,  179,
      179,  176,    0,    0,  179,  177,    0,    0,  179,    0,
      178,    0,    0,  178,    0,  180,  180,  180,  178,  179,
        0,  180,    0,    0,  181,  180,    0,  181,  182,  177,
      180,    0,  181,    0,    0,  182,  183,  183,  183,  182,
        0,  184,  183,  184,  179,    0,  183,  184,  181,    0,
      185,  181,    0,  182,    0,  180,  181,  185,    0,  182,
        0,  185,    0,  182,    0,    0,  184,    0,  184,    0,
        0,  187,  184,    0,  187,  185,  186,  186,  186,  187,

        0,  185,  186,    0,    0,  185,  186,  188,  188,  188,
      189,  189,  189,  188,    0,  187,  189,  188,  187,    0,
      189,    0,    0,  187,    0,  186,    0,  190,  190,  190,
        0,    0,  189,  190,  191,  191,  191,  190,    0,    0,
      191,  192,  192,  192,  191,    0,    0,  192,    0,  186,
        0,  192,  193,  193,  193,    0,    0,  189,  193,  194,
      194,  194,  193,    0,  195,  194,  195,    0,    0,  194,
      195,  196,  196,  196,  197,  197,  197,  196,    0,  198,
      197,  196,  198,    0,  197,    0,    0,  198,  199,  195,
      199,  195,    0,  201,  199,  195,  201,    0,  200,  200,

      200,  201,    0,  198,  200,    0,  198,    0,  200,    0,
      204,  198,  204,  199,    0,  199,  204,  201,    0,  199,
      201,  202,  202,  202,  200,  201,    0,  202,  203,  203,
      203,  202,    0,    0,  203,  204,    0,  204,  203,    0,
      205,  204,  205,  206,  206,  206,  205,    0,  200,  206,
        0,  202,    0,  206,  207,  207,  207,    0,  203,    0,
      207,    0,    0,    0,  207,  205,  208,  205,  208,    0,
        0,  205,  208,    0,  210,  202,  210,  209,  209,  209,
      210,    0,  203,  209,  216,  216,  216,  209,    0,    0,
      216,  208,    0,  208,  216,    0,    0,  208,    0,  210,

        0,  210,    0,    0,    0,  210,  215,  215,  215,  215,
        0,    0,  215,  217,  217,  217,  215,    0,    0,  217,
        0,    0,    0,  217,  219,  219,  219,  219,  224,  224,
      224,  224,  226,  226,  226,  227,  227,  227,  226,    0,
        0,  227,  228,  228,  228,  227,    0,    0,  228,  229,
      229,  229,  228,    0,    0,  229,  230,  230,  230,  229,
        0,    0,  230,  231,  231,  231,  230,    0,    0,  231,
        0,  230,    0,  231,  232,  232,  232,  233,  233,  233,
      232,    0,  234,  233,  232,  234,  235,  233,    0,  235,
      234,  236,    0,  231,  235,    0,  230,    0,  236,  259,

      259,  259,  236,    0,    0,  259,  234,  233,    0,  234,
      235,    0,    0,  235,  234,    0,  236,  231,  235,  237,
      237,  237,  236,    0,    0,  237,  236,    0,    0,  237,
        0,  233,  238,  238,  238,  239,  239,  239,  238,    0,
        0,  239,  238,    0,    0,  239,  240,  240,  240,  241,
        0,  241,  240,    0,    0,  241,  240,    0,    0,  242,
      242,  242,    0,    0,  238,  242,    0,  239,    0,  242,
        0,  243,  243,  243,  241,    0,  241,  243,    0,    0,
      241,  243,    0,    0,  244,    0,  244,    0,  238,  242,
      244,  239,  245,  245,  245,    0,  246,  247,  245,    0,

        0,    0,  245,  246,  247,  250,    0,  246,  247,  244,
        0,  244,  250,  242,    0,  244,  250,  248,    0,    0,
      248,  246,  247,    0,  245,  248,    0,  246,  247,    0,
      250,  246,  247,  249,  249,  249,  250,    0,    0,  249,
      250,  248,    0,  249,  248,  251,  251,  251,  245,  248,
        0,  251,    0,    0,    0,  251,  257,  257,  257,  257,
      265,  265,  265,  265,    0,  249,  265,  266,  266,  266,
      267,  267,  267,  266,  269,    0,  267,  270,  270,  270,
        0,  269,    0,  270,    0,  269,  271,  270,  271,  249,
      273,    0,  271,    0,  272,  272,  272,  273,    0,  269,

      272,  273,    0,  309,  272,  269,  274,  274,  274,  269,
      309,  271,  274,  271,  309,  273,  274,  271,  275,    0,
      275,  273,    0,    0,  275,  273,  272,  276,  309,  276,
      277,  277,  277,  276,  309,    0,  277,    0,  309,    0,
      277,    0,    0,  275,    0,  275,    0,    0,    0,  275,
      272,    0,  276,    0,  276,  278,  278,  278,  276,    0,
        0,  278,  279,  279,  279,  278,    0,    0,  279,  280,
      280,  280,  279,    0,    0,  280,  281,  281,  281,  280,
        0,  278,  281,    0,    0,  282,  281,  282,    0,    0,
      283,  282,    0,  283,  284,  284,  284,    0,  283,    0,

      284,  293,  293,  293,  284,  278,    0,  293,  280,    0,
      282,    0,  282,    0,  283,    0,  282,  283,  285,  285,
      285,    0,  283,    0,  285,    0,    0,    0,  285,  292,
      292,  292,  292,    0,    0,  292,  294,  294,  294,  285,
        0,    0,  294,  300,  300,  300,  301,  301,  301,  300,
        0,    0,  301,  300,    0,    0,  301,  302,  302,  302,
      303,  303,  303,  302,  285,    0,  303,  302,    0,  304,
      303,    0,  304,    0,    0,  300,    0,  304,  305,  305,
      305,  306,  306,  306,  305,    0,  307,  306,  305,  307,
        0,  306,  303,  304,  307,    0,  304,    0,    0,  300,

        0,  304,  308,  308,  308,  310,  310,  310,  308,    0,
      307,  310,  308,  307,    0,  310,  303,    0,  307,  320,
      320,  320,  321,  322,  321,  320,    0,    0,  321,  320,
      322,    0,    0,    0,  322,  323,    0,  323,    0,    0,
        0,  323,    0,    0,  332,    0,  332,  321,  322,  321,
      332,    0,    0,  321,  322,  324,  324,  324,  322,    0,
      323,  324,  323,    0,    0,  324,  323,    0,    0,  332,
        0,  332,  333,  333,  333,  332,    0,  341,  333,  334,
      334,  334,  333,    0,  341,  334,    0,  324,  341,  334,
      335,  335,  335,  342,  342,  342,  335,  334,    0,  342,

      335,    0,  341,  342,  346,  346,  346,    0,  341,    0,
      346,  324,  341,    0,  346,    0,    0,    0,    0,    0,
        0,    0,  334,  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,  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;

extern int plpgsql_base_yy_flex_debug;
int plpgsql_base_yy_flex_debug = 0;

/* 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 *plpgsql_base_yytext;
#line 1 "scan.l"
#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;



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

#define INITIAL 0
#define IN_STRING 1
#define IN_COMMENT 2
#define IN_DOLLARQUOTE 3

#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 * down here because we want the user's section 1 to have been scanned first.
 * The user has a chance to override it with an option.
 */
#include <unistd.h>
#endif

#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif

static int yy_init_globals (void );

/* Accessor methods to globals.
   These are made visible to non-reentrant scanners for convenience. */

int plpgsql_base_yylex_destroy (void );

int plpgsql_base_yyget_debug (void );

void plpgsql_base_yyset_debug (int debug_flag  );

YY_EXTRA_TYPE plpgsql_base_yyget_extra (void );

void plpgsql_base_yyset_extra (YY_EXTRA_TYPE user_defined  );

FILE *plpgsql_base_yyget_in (void );

void plpgsql_base_yyset_in  (FILE * in_str  );

FILE *plpgsql_base_yyget_out (void );

void plpgsql_base_yyset_out  (FILE * out_str  );

int plpgsql_base_yyget_leng (void );

char *plpgsql_base_yyget_text (void );

int plpgsql_base_yyget_lineno (void );

void plpgsql_base_yyset_lineno (int line_number  );

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

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

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

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

#ifndef YY_NO_INPUT

#ifdef __cplusplus
static int yyinput (void );
#else
static int input (void );
#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 fwrite( plpgsql_base_yytext, plpgsql_base_yyleng, 1, plpgsql_base_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_LVALUE->yy_is_interactive ) \
		{ \
		int c = '*'; \
		int n; \
		for ( n = 0; n < max_size && \
			     (c = getc( plpgsql_base_yyin )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( plpgsql_base_yyin ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else \
		{ \
		errno=0; \
		while ( (result = fread(buf, 1, max_size, plpgsql_base_yyin))==0 && ferror(plpgsql_base_yyin)) \
			{ \
			if( errno != EINTR) \
				{ \
				YY_FATAL_ERROR( "input in flex scanner failed" ); \
				break; \
				} \
			errno=0; \
			clearerr(plpgsql_base_yyin); \
			} \
		}\
\

#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

/* end tables serialization structures and prototypes */

/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1

extern int plpgsql_base_yylex (void);

#define YY_DECL int plpgsql_base_yylex (void)
#endif /* !YY_DECL */

/* Code executed at the beginning of each rule, after plpgsql_base_yytext and plpgsql_base_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 ( plpgsql_base_yyleng > 0 ) \
		YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
				(plpgsql_base_yytext[plpgsql_base_yyleng - 1] == '\n'); \
	YY_USER_ACTION

/** The main scanner function which does all the work.
 */
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 1400 "pl_scan.c"

	if ( !(yy_init) )
		{
		(yy_init) = 1;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

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

		if ( ! plpgsql_base_yyin )
			plpgsql_base_yyin = stdin;

		if ( ! plpgsql_base_yyout )
			plpgsql_base_yyout = stdout;

		if ( ! YY_CURRENT_BUFFER ) {
			plpgsql_base_yyensure_buffer_stack ();
			YY_CURRENT_BUFFER_LVALUE =
				plpgsql_base_yy_create_buffer(plpgsql_base_yyin,YY_BUF_SIZE );
		}

		plpgsql_base_yy_load_buffer_state( );
		}

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

		/* Support of plpgsql_base_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_current_state != 348 );
		yy_cp = (yy_last_accepting_cpos);
		yy_current_state = (yy_last_accepting_state);

yy_find_action:
		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:
/* rule 53 can match eol */
YY_RULE_SETUP
#line 196 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_word(plpgsql_base_yytext); }
	YY_BREAK
case 54:
/* rule 54 can match eol */
YY_RULE_SETUP
#line 199 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblword(plpgsql_base_yytext); }
	YY_BREAK
case 55:
/* rule 55 can match eol */
YY_RULE_SETUP
#line 202 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripword(plpgsql_base_yytext); }
	YY_BREAK
case 56:
/* rule 56 can match eol */
YY_RULE_SETUP
#line 205 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordtype(plpgsql_base_yytext); }
	YY_BREAK
case 57:
/* rule 57 can match eol */
YY_RULE_SETUP
#line 208 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordtype(plpgsql_base_yytext); }
	YY_BREAK
case 58:
/* rule 58 can match eol */
YY_RULE_SETUP
#line 211 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripwordtype(plpgsql_base_yytext); }
	YY_BREAK
case 59:
/* rule 59 can match eol */
YY_RULE_SETUP
#line 214 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordrowtype(plpgsql_base_yytext); }
	YY_BREAK
case 60:
/* rule 60 can match eol */
YY_RULE_SETUP
#line 217 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordrowtype(plpgsql_base_yytext); }
	YY_BREAK
case 61:
YY_RULE_SETUP
#line 220 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_word(plpgsql_base_yytext); }
	YY_BREAK
case 62:
/* rule 62 can match eol */
YY_RULE_SETUP
#line 223 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblword(plpgsql_base_yytext); }
	YY_BREAK
case 63:
/* rule 63 can match eol */
YY_RULE_SETUP
#line 226 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripword(plpgsql_base_yytext); }
	YY_BREAK
case 64:
/* rule 64 can match eol */
YY_RULE_SETUP
#line 229 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordtype(plpgsql_base_yytext); }
	YY_BREAK
case 65:
/* rule 65 can match eol */
YY_RULE_SETUP
#line 232 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordtype(plpgsql_base_yytext); }
	YY_BREAK
case 66:
/* rule 66 can match eol */
YY_RULE_SETUP
#line 235 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_tripwordtype(plpgsql_base_yytext); }
	YY_BREAK
case 67:
/* rule 67 can match eol */
YY_RULE_SETUP
#line 238 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_wordrowtype(plpgsql_base_yytext); }
	YY_BREAK
case 68:
/* rule 68 can match eol */
YY_RULE_SETUP
#line 241 "scan.l"
{
	plpgsql_error_lineno = plpgsql_scanner_lineno();
	return plpgsql_parse_dblwordrowtype(plpgsql_base_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:
/* rule 71 can match eol */
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:
/* rule 75 can match eol */
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 plpgsql_base_yytext/plpgsql_base_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 = plpgsql_base_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 plpgsql_base_yytext/plpgsql_base_yyleng to describe whole string token */
			  plpgsql_base_yyleng += (plpgsql_base_yytext - start_charpos);
			  plpgsql_base_yytext = start_charpos;
			  BEGIN(INITIAL);
			  return T_STRING;
			}
	YY_BREAK
case 82:
/* rule 82 can match eol */
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 = plpgsql_base_yytext;
			  dolqstart = pstrdup(plpgsql_base_yytext);
			  BEGIN(IN_DOLLARQUOTE);
			}
	YY_BREAK
case 84:
YY_RULE_SETUP
#line 318 "scan.l"
{
			  if (strcmp(plpgsql_base_yytext, dolqstart) == 0)
			  {
					pfree(dolqstart);
					/* tell plpgsql_get_string_value it is a dollar quote */
					dolqlen = plpgsql_base_yyleng;
					/* adjust plpgsql_base_yytext/plpgsql_base_yyleng to describe whole string token */
					plpgsql_base_yyleng += (plpgsql_base_yytext - start_charpos);
					plpgsql_base_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(plpgsql_base_yyleng-1);
			  }
			}
	YY_BREAK
case 85:
/* rule 85 can match eol */
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 plpgsql_base_yytext[0];			}
	YY_BREAK
case 88:
YY_RULE_SETUP
#line 355 "scan.l"
YY_FATAL_ERROR( "flex scanner jammed" );
	YY_BREAK
#line 2070 "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_LVALUE->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 plpgsql_base_yyin at a new source and called
			 * plpgsql_base_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_LVALUE->yy_n_chars;
			YY_CURRENT_BUFFER_LVALUE->yy_input_file = plpgsql_base_yyin;
			YY_CURRENT_BUFFER_LVALUE->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_LVALUE->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_last_accepting_cpos);
				yy_current_state = (yy_last_accepting_state);
				goto yy_find_action;
				}
			}

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

				if ( plpgsql_base_yywrap( ) )
					{
					/* Note: because we've taken care in
					 * yy_get_next_buffer() to have set up
					 * plpgsql_base_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_LVALUE->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 plpgsql_base_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 (void)
{
    	register char *dest = YY_CURRENT_BUFFER_LVALUE->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_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
		YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( YY_CURRENT_BUFFER_LVALUE->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_LVALUE->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_LVALUE->yy_n_chars = (yy_n_chars) = 0;

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

		while ( num_to_read <= 0 )
			{ /* Not enough room in the buffer - grow it. */

			/* 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. */
					plpgsql_base_yyrealloc((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_LVALUE->yy_buf_size -
						number_to_move - 1;

			}

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

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

		YY_CURRENT_BUFFER_LVALUE->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;
			plpgsql_base_yyrestart(plpgsql_base_yyin  );
			}

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

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
		/* Extend the array by 50%, plus the number we really need. */
		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) plpgsql_base_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
	}

	(yy_n_chars) += number_to_move;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;

	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->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 (void)
{
	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 );
 */
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
{
	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_INPUT
#ifdef __cplusplus
    static int yyinput (void)
#else
    static int input  (void)
#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_LVALUE->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. */
					plpgsql_base_yyrestart(plpgsql_base_yyin );

					/*FALLTHROUGH*/

				case EOB_ACT_END_OF_FILE:
					{
					if ( plpgsql_base_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 plpgsql_base_yytext */
	(yy_hold_char) = *++(yy_c_buf_p);

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

	return c;
}
#endif	/* ifndef YY_NO_INPUT */

/** Immediately switch to a different input stream.
 * @param input_file A readable stream.
 * 
 * @note This function does not reset the start condition to @c INITIAL .
 */
    void plpgsql_base_yyrestart  (FILE * input_file )
{
    
	if ( ! YY_CURRENT_BUFFER ){
        plpgsql_base_yyensure_buffer_stack ();
		YY_CURRENT_BUFFER_LVALUE =
            plpgsql_base_yy_create_buffer(plpgsql_base_yyin,YY_BUF_SIZE );
	}

	plpgsql_base_yy_init_buffer(YY_CURRENT_BUFFER,input_file );
	plpgsql_base_yy_load_buffer_state( );
}

/** Switch to a different input buffer.
 * @param new_buffer The new input buffer.
 * 
 */
    void plpgsql_base_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
{
    
	/* TODO. We should be able to replace this entire function body
	 * with
	 *		plpgsql_base_yypop_buffer_state();
	 *		plpgsql_base_yypush_buffer_state(new_buffer);
     */
	plpgsql_base_yyensure_buffer_stack ();
	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_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	YY_CURRENT_BUFFER_LVALUE = new_buffer;
	plpgsql_base_yy_load_buffer_state( );

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

static void plpgsql_base_yy_load_buffer_state  (void)
{
    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
	plpgsql_base_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
	(yy_hold_char) = *(yy_c_buf_p);
}

/** Allocate and initialize an input buffer state.
 * @param file A readable stream.
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 * 
 * @return the allocated buffer state.
 */
    YY_BUFFER_STATE plpgsql_base_yy_create_buffer  (FILE * file, int  size )
{
	YY_BUFFER_STATE b;
    
	b = (YY_BUFFER_STATE) plpgsql_base_yyalloc(sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in plpgsql_base_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 *) plpgsql_base_yyalloc(b->yy_buf_size + 2  );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in plpgsql_base_yy_create_buffer()" );

	b->yy_is_our_buffer = 1;

	plpgsql_base_yy_init_buffer(b,file );

	return b;
}

/** Destroy the buffer.
 * @param b a buffer created with plpgsql_base_yy_create_buffer()
 * 
 */
    void plpgsql_base_yy_delete_buffer (YY_BUFFER_STATE  b )
{
    
	if ( ! b )
		return;

	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;

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

	plpgsql_base_yyfree((void *) b  );
}

/* Initializes or reinitializes a buffer.
 * This function is sometimes called more than once on the same buffer,
 * such as during a plpgsql_base_yyrestart() or at EOF.
 */
    static void plpgsql_base_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )

{
	int oerrno = errno;
    
	plpgsql_base_yy_flush_buffer(b );

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

    /* If b is the current buffer, then plpgsql_base_yy_init_buffer was _probably_
     * called from plpgsql_base_yyrestart() or through yy_get_next_buffer.
     * In that case, we don't want to reset the lineno or column.
     */
    if (b != YY_CURRENT_BUFFER){
        b->yy_bs_lineno = 1;
        b->yy_bs_column = 0;
    }

        b->yy_is_interactive = 0;
    
	errno = oerrno;
}

/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 * 
 */
    void plpgsql_base_yy_flush_buffer (YY_BUFFER_STATE  b )
{
    	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 )
		plpgsql_base_yy_load_buffer_state( );
}

/** Pushes the new state onto the stack. The new state becomes
 *  the current state. This function will allocate the stack
 *  if necessary.
 *  @param new_buffer The new state.
 *  
 */
void plpgsql_base_yypush_buffer_state (YY_BUFFER_STATE new_buffer )
{
    	if (new_buffer == NULL)
		return;

	plpgsql_base_yyensure_buffer_stack();

	/* This block is copied from plpgsql_base_yy_switch_to_buffer. */
	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	/* Only push if top exists. Otherwise, replace top. */
	if (YY_CURRENT_BUFFER)
		(yy_buffer_stack_top)++;
	YY_CURRENT_BUFFER_LVALUE = new_buffer;

	/* copied from plpgsql_base_yy_switch_to_buffer. */
	plpgsql_base_yy_load_buffer_state( );
	(yy_did_buffer_switch_on_eof) = 1;
}

/** Removes and deletes the top of the stack, if present.
 *  The next element becomes the new top.
 *  
 */
void plpgsql_base_yypop_buffer_state (void)
{
    	if (!YY_CURRENT_BUFFER)
		return;

	plpgsql_base_yy_delete_buffer(YY_CURRENT_BUFFER );
	YY_CURRENT_BUFFER_LVALUE = NULL;
	if ((yy_buffer_stack_top) > 0)
		--(yy_buffer_stack_top);

	if (YY_CURRENT_BUFFER) {
		plpgsql_base_yy_load_buffer_state( );
		(yy_did_buffer_switch_on_eof) = 1;
	}
}

/* Allocates the stack if it does not exist.
 *  Guarantees space for at least one push.
 */
static void plpgsql_base_yyensure_buffer_stack (void)
{
	int num_to_alloc;
    
	if (!(yy_buffer_stack)) {

		/* First allocation is just for 2 elements, since we don't know if this
		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
		 * immediate realloc on the next call.
         */
		num_to_alloc = 1;
		(yy_buffer_stack) = (struct yy_buffer_state**)plpgsql_base_yyalloc
								(num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		if ( ! (yy_buffer_stack) )
			YY_FATAL_ERROR( "out of dynamic memory in plpgsql_base_yyensure_buffer_stack()" );
								  
		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
				
		(yy_buffer_stack_max) = num_to_alloc;
		(yy_buffer_stack_top) = 0;
		return;
	}

	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){

		/* Increase the buffer to prepare for a possible push. */
		int grow_size = 8 /* arbitrary grow size */;

		num_to_alloc = (yy_buffer_stack_max) + grow_size;
		(yy_buffer_stack) = (struct yy_buffer_state**)plpgsql_base_yyrealloc
								((yy_buffer_stack),
								num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		if ( ! (yy_buffer_stack) )
			YY_FATAL_ERROR( "out of dynamic memory in plpgsql_base_yyensure_buffer_stack()" );

		/* zero only the new slots.*/
		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
		(yy_buffer_stack_max) = num_to_alloc;
	}
}

/** Setup the input buffer state to scan directly from a user-specified character buffer.
 * @param base the character buffer
 * @param size the size in bytes of the character buffer
 * 
 * @return the newly allocated buffer state object. 
 */
YY_BUFFER_STATE plpgsql_base_yy_scan_buffer  (char * base, yy_size_t  size )
{
	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) plpgsql_base_yyalloc(sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in plpgsql_base_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;

	plpgsql_base_yy_switch_to_buffer(b  );

	return b;
}

/** Setup the input buffer state to scan a string. The next call to plpgsql_base_yylex() will
 * scan from a @e copy of @a str.
 * @param yystr a NUL-terminated string to scan
 * 
 * @return the newly allocated buffer state object.
 * @note If you want to scan bytes that may contain NUL values, then use
 *       plpgsql_base_yy_scan_bytes() instead.
 */
YY_BUFFER_STATE plpgsql_base_yy_scan_string (yyconst char * yystr )
{
    
	return plpgsql_base_yy_scan_bytes(yystr,strlen(yystr) );
}

/** Setup the input buffer state to scan the given bytes. The next call to plpgsql_base_yylex() will
 * scan from a @e copy of @a bytes.
 * @param bytes the byte buffer to scan
 * @param len the number of bytes in the buffer pointed to by @a bytes.
 * 
 * @return the newly allocated buffer state object.
 */
YY_BUFFER_STATE plpgsql_base_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
{
	YY_BUFFER_STATE b;
	char *buf;
	yy_size_t n;
	int i;
    
	/* Get memory for full buffer, including space for trailing EOB's. */
	n = _yybytes_len + 2;
	buf = (char *) plpgsql_base_yyalloc(n  );
	if ( ! buf )
		YY_FATAL_ERROR( "out of dynamic memory in plpgsql_base_yy_scan_bytes()" );

	for ( i = 0; i < _yybytes_len; ++i )
		buf[i] = yybytes[i];

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

	b = plpgsql_base_yy_scan_buffer(buf,n );
	if ( ! b )
		YY_FATAL_ERROR( "bad buffer in plpgsql_base_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;
}

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

static void yy_fatal_error (yyconst char* msg )
{
    	(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 plpgsql_base_yytext. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
		plpgsql_base_yytext[plpgsql_base_yyleng] = (yy_hold_char); \
		(yy_c_buf_p) = plpgsql_base_yytext + yyless_macro_arg; \
		(yy_hold_char) = *(yy_c_buf_p); \
		*(yy_c_buf_p) = '\0'; \
		plpgsql_base_yyleng = yyless_macro_arg; \
		} \
	while ( 0 )

/* Accessor  methods (get/set functions) to struct members. */

/** Get the current line number.
 * 
 */
int plpgsql_base_yyget_lineno  (void)
{
        
    return plpgsql_base_yylineno;
}

/** Get the input stream.
 * 
 */
FILE *plpgsql_base_yyget_in  (void)
{
        return plpgsql_base_yyin;
}

/** Get the output stream.
 * 
 */
FILE *plpgsql_base_yyget_out  (void)
{
        return plpgsql_base_yyout;
}

/** Get the length of the current token.
 * 
 */
int plpgsql_base_yyget_leng  (void)
{
        return plpgsql_base_yyleng;
}

/** Get the current token.
 * 
 */

char *plpgsql_base_yyget_text  (void)
{
        return plpgsql_base_yytext;
}

/** Set the current line number.
 * @param line_number
 * 
 */
void plpgsql_base_yyset_lineno (int  line_number )
{
    
    plpgsql_base_yylineno = line_number;
}

/** Set the input stream. This does not discard the current
 * input buffer.
 * @param in_str A readable stream.
 * 
 * @see plpgsql_base_yy_switch_to_buffer
 */
void plpgsql_base_yyset_in (FILE *  in_str )
{
        plpgsql_base_yyin = in_str ;
}

void plpgsql_base_yyset_out (FILE *  out_str )
{
        plpgsql_base_yyout = out_str ;
}

int plpgsql_base_yyget_debug  (void)
{
        return plpgsql_base_yy_flex_debug;
}

void plpgsql_base_yyset_debug (int  bdebug )
{
        plpgsql_base_yy_flex_debug = bdebug ;
}

static int yy_init_globals (void)
{
        /* Initialization is the same as for the non-reentrant scanner.
     * This function is called from plpgsql_base_yylex_destroy(), so don't allocate here.
     */

    (yy_buffer_stack) = 0;
    (yy_buffer_stack_top) = 0;
    (yy_buffer_stack_max) = 0;
    (yy_c_buf_p) = (char *) 0;
    (yy_init) = 0;
    (yy_start) = 0;

/* Defined in main.c */
#ifdef YY_STDINIT
    plpgsql_base_yyin = stdin;
    plpgsql_base_yyout = stdout;
#else
    plpgsql_base_yyin = (FILE *) 0;
    plpgsql_base_yyout = (FILE *) 0;
#endif

    /* For future reference: Set errno on error, since we are called by
     * plpgsql_base_yylex_init()
     */
    return 0;
}

/* plpgsql_base_yylex_destroy is for both reentrant and non-reentrant scanners. */
int plpgsql_base_yylex_destroy  (void)
{
    
    /* Pop the buffer stack, destroying each element. */
	while(YY_CURRENT_BUFFER){
		plpgsql_base_yy_delete_buffer(YY_CURRENT_BUFFER  );
		YY_CURRENT_BUFFER_LVALUE = NULL;
		plpgsql_base_yypop_buffer_state();
	}

	/* Destroy the stack itself. */
	plpgsql_base_yyfree((yy_buffer_stack) );
	(yy_buffer_stack) = NULL;

    /* Reset the globals. This is important in a non-reentrant scanner so the next time
     * plpgsql_base_yylex() is called, initialization will occur. */
    yy_init_globals( );

    return 0;
}

/*
 * Internal utility routines.
 */

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

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

	return n;
}
#endif

void *plpgsql_base_yyalloc (yy_size_t  size )
{
	return (void *) malloc( size );
}

void *plpgsql_base_yyrealloc  (void * ptr, yy_size_t  size )
{
	/* 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 );
}

void plpgsql_base_yyfree (void * ptr )
{
	free( (char *) ptr );	/* see plpgsql_base_yyrealloc() for (char *) cast */
}

#define YYTABLES_NAME "yytables"

#line 355 "scan.l"




/*
 * This is the plpgsql_base_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 = plpgsql_base_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 = plpgsql_base_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 = plpgsql_base_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 plpgsql_base_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)
		plpgsql_base_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 = plpgsql_base_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)
{
	plpgsql_base_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 = plpgsql_base_yyleng - 2 * dolqlen;
		Assert(len >= 0);
		result = (char *) malloc(len + 1);
		memcpy(result, plpgsql_base_yytext + dolqlen, len);
		result[len] = '\0';
	}
	else
	{
		/* Token is a '...' string */
		result = (char *) malloc(plpgsql_base_yyleng + 1);	/* more than enough room */
		len = 0;
		for (cp = plpgsql_base_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;
}

