#line 2 "psqlscan.c"
/* A lexical scanner generated by flex */

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

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5

#include <stdio.h>


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


#ifdef __cplusplus

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

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

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

#else	/* ! __cplusplus */

#if __STDC__

#define YY_USE_PROTOS
#define YY_USE_CONST

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

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

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


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

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

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

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

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

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

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

#define YY_END_OF_BUFFER_CHAR 0

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

typedef struct yy_buffer_state *YY_BUFFER_STATE;

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

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

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

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

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

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

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


struct yy_buffer_state
	{
	FILE *yy_input_file;

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

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

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

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

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

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

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

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

static YY_BUFFER_STATE yy_current_buffer = 0;

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


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

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


int yyleng;

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

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

void yyrestart YY_PROTO(( FILE *input_file ));

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

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

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

#define yy_new_buffer yy_create_buffer

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

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

#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)


#define yywrap() 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
extern char *yytext;
#define yytext_ptr yytext
static yyconst short yy_nxt[][38] =
    {
    {
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0
    },

    {
       31,   32,   33,   34,   33,   35,   36,   37,   38,   39,
       40,   41,   38,   38,   42,   43,   44,   45,   46,   46,
       47,   48,   49,   50,   51,   49,   52,   53,   54,   35,
       50,   49,   52,   49,   49,   53,   35,   49
    },

    {
       31,   32,   33,   34,   33,   35,   36,   37,   38,   39,
       40,   41,   38,   38,   42,   43,   44,   45,   46,   46,

       47,   48,   49,   50,   51,   49,   52,   53,   54,   35,
       50,   49,   52,   49,   49,   53,   35,   49
    },

    {
       31,   55,   55,   55,   55,   55,   55,   55,   55,   56,
       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
       55,   55,   55,   55,   55,   55,   55,   55
    },

    {
       31,   55,   55,   55,   55,   55,   55,   55,   55,   56,
       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
       55,   55,   55,   55,   55,   55,   55,   55

    },

    {
       31,   57,   57,   57,   57,   58,   57,   57,   58,   57,
       57,   57,   59,   58,   57,   58,   57,   60,   57,   57,
       57,   57,   57,   57,   57,   57,   57,   57,   57,   58,
       57,   57,   57,   57,   57,   57,   58,   57
    },

    {
       31,   57,   57,   57,   57,   58,   57,   57,   58,   57,
       57,   57,   59,   58,   57,   58,   57,   60,   57,   57,
       57,   57,   57,   57,   57,   57,   57,   57,   57,   58,
       57,   57,   57,   57,   57,   57,   58,   57
    },

    {
       31,   61,   61,   61,   61,   61,   62,   61,   61,   61,
       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,

       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,
       61,   61,   61,   61,   61,   61,   61,   61
    },

    {
       31,   61,   61,   61,   61,   61,   62,   61,   61,   61,
       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,
       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,
       61,   61,   61,   61,   61,   61,   61,   61
    },

    {
       31,   63,   63,   63,   63,   63,   63,   63,   63,   64,
       63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
       63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
       63,   63,   63,   63,   63,   63,   63,   63

    },

    {
       31,   63,   63,   63,   63,   63,   63,   63,   63,   64,
       63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
       63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
       63,   63,   63,   63,   63,   63,   63,   63
    },

    {
       31,   65,   65,   66,   65,   65,   65,   65,   65,   67,
       65,   65,   65,   65,   65,   65,   65,   65,   65,   65,
       65,   65,   65,   65,   65,   65,   65,   65,   68,   65,
       65,   65,   65,   65,   65,   65,   65,   65
    },

    {
       31,   65,   65,   66,   65,   65,   65,   65,   65,   67,
       65,   65,   65,   65,   65,   65,   65,   65,   65,   65,

       65,   65,   65,   65,   65,   65,   65,   65,   68,   65,
       65,   65,   65,   65,   65,   65,   65,   65
    },

    {
       31,   69,   69,   70,   69,   69,   69,   71,   69,   69,
       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
       69,   69,   69,   69,   69,   69,   69,   69
    },

    {
       31,   69,   69,   70,   69,   69,   69,   71,   69,   69,
       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
       69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
       69,   69,   69,   69,   69,   69,   69,   69

    },

    {
       31,   72,   73,   74,   73,   72,   72,   72,   72,   72,
       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
       72,   72,   72,   72,   72,   72,   72,   72,   73,   72,
       72,   72,   72,   72,   72,   72,   72,   72
    },

    {
       31,   72,   73,   74,   73,   72,   72,   72,   72,   72,
       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
       72,   72,   72,   72,   72,   72,   72,   72,   73,   72,
       72,   72,   72,   72,   72,   72,   72,   72
    },

    {
       31,   75,   76,   77,   76,   75,   78,   75,   75,   79,
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,

       80,   75,   75,   75,   75,   75,   75,   75,   81,   82,
       75,   75,   75,   75,   75,   75,   83,   75
    },

    {
       31,   75,   76,   77,   76,   75,   78,   75,   75,   79,
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
       80,   75,   75,   75,   75,   75,   75,   75,   81,   82,
       75,   75,   75,   75,   75,   75,   83,   75
    },

    {
       31,   84,   84,   84,   84,   84,   84,   84,   84,   85,
       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,
       84,   84,   84,   84,   84,   84,   84,   84,   86,   84,
       84,   84,   84,   84,   84,   84,   84,   84

    },

    {
       31,   84,   84,   84,   84,   84,   84,   84,   84,   85,
       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,
       84,   84,   84,   84,   84,   84,   84,   84,   86,   84,
       84,   84,   84,   84,   84,   84,   84,   84
    },

    {
       31,   87,   87,   87,   87,   87,   87,   87,   87,   87,
       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,
       87,   87,   87,   87,   87,   87,   87,   87,   87,   88,
       87,   87,   87,   87,   87,   87,   87,   87
    },

    {
       31,   87,   87,   87,   87,   87,   87,   87,   87,   87,
       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,

       87,   87,   87,   87,   87,   87,   87,   87,   87,   88,
       87,   87,   87,   87,   87,   87,   87,   87
    },

    {
       31,   89,   90,   91,   90,   89,   92,   89,   89,   89,
       89,   89,   89,   89,   89,   89,   89,   89,   89,   89,
       89,   89,   89,   89,   89,   89,   89,   89,   93,   89,
       89,   89,   89,   89,   89,   89,   89,   89
    },

    {
       31,   89,   90,   91,   90,   89,   92,   89,   89,   89,
       89,   89,   89,   89,   89,   89,   89,   89,   89,   89,
       89,   89,   89,   89,   89,   89,   89,   89,   93,   89,
       89,   89,   89,   89,   89,   89,   89,   89

    },

    {
       31,   94,   94,   94,   94,   94,   95,   94,   94,   94,
       94,   94,   94,   94,   94,   94,   94,   94,   94,   94,
       94,   94,   94,   94,   94,   94,   94,   94,   94,   94,
       94,   94,   94,   94,   94,   94,   94,   94
    },

    {
       31,   94,   94,   94,   94,   94,   95,   94,   94,   94,
       94,   94,   94,   94,   94,   94,   94,   94,   94,   94,
       94,   94,   94,   94,   94,   94,   94,   94,   94,   94,
       94,   94,   94,   94,   94,   94,   94,   94
    },

    {
       31,   96,   97,   98,   97,   96,   96,   96,   96,   96,
       96,   96,   96,   96,   96,   96,   96,   96,   96,   96,

       96,   96,   96,   96,   96,   96,   96,   96,   96,   96,
       96,   96,   96,   96,   96,   96,   96,   96
    },

    {
       31,   96,   97,   98,   97,   96,   96,   96,   96,   96,
       96,   96,   96,   96,   96,   96,   96,   96,   96,   96,
       96,   96,   96,   96,   96,   96,   96,   96,   96,   96,
       96,   96,   96,   96,   96,   96,   96,   96
    },

    {
       31,   99,   99,   99,   99,   99,   99,   99,   99,   99,
       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,
       99,   99,   99,   99,   99,   99,   99,   99,  100,   99,
       99,   99,   99,   99,   99,   99,   99,   99

    },

    {
       31,   99,   99,   99,   99,   99,   99,   99,   99,   99,
       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,
       99,   99,   99,   99,   99,   99,   99,   99,  100,   99,
       99,   99,   99,   99,   99,   99,   99,   99
    },

    {
      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31
    },

    {
       31,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,
      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,

      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,
      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32
    },

    {
       31,  -33,  101,  101,  101,  -33,  -33,  -33,  -33,  -33,
      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33
    },

    {
       31,  -34,  101,  101,  101,  -34,  -34,  -34,  -34,  -34,
      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34

    },

    {
       31,  -35,  -35,  -35,  -35,  102,  -35,  -35,  102,  -35,
      -35,  -35,  102,  102,  -35,  102,  -35,  102,  -35,  -35,
      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  102,
      -35,  -35,  -35,  -35,  -35,  -35,  102,  -35
    },

    {
       31,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36
    },

    {
       31,  -37,  -37,  -37,  -37,  -37,  -37,  103,  -37,  -37,
      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  104,  104,

      -37,  -37,  105,  105,  105,  105,  105,  105,  -37,  -37,
      105,  105,  105,  105,  105,  105,  -37,  105
    },

    {
       31,  -38,  -38,  -38,  -38,  102,  -38,  -38,  102,  -38,
      -38,  -38,  102,  102,  -38,  102,  -38,  102,  -38,  -38,
      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  102,
      -38,  -38,  -38,  -38,  -38,  -38,  102,  -38
    },

    {
       31,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39

    },

    {
       31,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40
    },

    {
       31,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41
    },

    {
       31,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,

      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42
    },

    {
       31,  -43,  -43,  -43,  -43,  102,  -43,  -43,  102,  -43,
      -43,  -43,  102,  102,  -43,  106,  -43,  102,  -43,  -43,
      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  102,
      -43,  -43,  -43,  -43,  -43,  -43,  102,  -43
    },

    {
       31,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  107,  107,
      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44

    },

    {
       31,  -45,  -45,  -45,  -45,  102,  -45,  -45,  102,  -45,
      -45,  -45,  108,  102,  -45,  102,  -45,  102,  -45,  -45,
      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  102,
      -45,  -45,  -45,  -45,  -45,  -45,  102,  -45
    },

    {
       31,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
      -46,  -46,  -46,  -46,  -46,  -46,  109,  -46,  110,  110,
      -46,  -46,  -46,  -46,  111,  -46,  -46,  -46,  -46,  -46,
      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46
    },

    {
       31,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  112,  112,

      113,  -47,  112,  112,  112,  112,  112,  112,  -47,  -47,
      112,  112,  112,  112,  112,  112,  -47,  -47
    },

    {
       31,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48
    },

    {
       31,  -49,  -49,  -49,  -49,  -49,  -49,  114,  -49,  -49,
      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  114,  114,
      -49,  -49,  114,  114,  114,  114,  114,  114,  -49,  -49,
      114,  114,  114,  114,  114,  114,  -49,  114

    },

    {
       31,  -50,  -50,  -50,  -50,  -50,  -50,  114,  -50,  115,
      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  114,  114,
      -50,  -50,  114,  114,  114,  114,  114,  114,  -50,  -50,
      114,  114,  114,  114,  114,  114,  -50,  114
    },

    {
       31,  -51,  -51,  -51,  -51,  -51,  -51,  114,  -51,  116,
      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  114,  114,
      -51,  -51,  114,  114,  114,  114,  114,  114,  -51,  -51,
      114,  114,  114,  114,  114,  114,  -51,  114
    },

    {
       31,  -52,  -52,  -52,  -52,  -52,  -52,  114,  -52,  117,
      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  114,  114,

      -52,  -52,  114,  114,  114,  114,  114,  114,  -52,  -52,
      114,  114,  114,  114,  114,  114,  -52,  114
    },

    {
       31,  -53,  -53,  -53,  -53,  -53,  -53,  114,  -53,  118,
      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  114,  114,
      -53,  -53,  114,  114,  114,  114,  114,  114,  -53,  -53,
      114,  114,  114,  114,  114,  114,  -53,  114
    },

    {
       31,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
      119,  119,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54

    },

    {
       31,  120,  120,  120,  120,  120,  120,  120,  120,  -55,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120
    },

    {
       31,  -56,  121,  122,  122,  -56,  -56,  -56,  -56,  -56,
      -56,  -56,  -56,  -56,  -56,  123,  -56,  -56,  -56,  -56,
      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56
    },

    {
       31,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  -57,  124,  124,  124,  124,  -57,  124,  124,

      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124
    },

    {
       31,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  -58,  124,  124,  124,  124,  -58,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124
    },

    {
       31,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
      -59,  -59,  125,  -59,  -59,  -59,  -59,  126,  -59,  -59,
      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59

    },

    {
       31,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
      -60,  -60,  127,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60
    },

    {
       31,  128,  128,  128,  128,  128,  -61,  128,  128,  128,
      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
      128,  128,  128,  128,  128,  128,  128,  128
    },

    {
       31,  -62,  -62,  -62,  -62,  -62,  129,  -62,  -62,  -62,
      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,

      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62
    },

    {
       31,  130,  130,  130,  130,  130,  130,  130,  130,  -63,
      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,
      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,
      130,  130,  130,  130,  130,  130,  130,  130
    },

    {
       31,  -64,  131,  132,  132,  -64,  -64,  -64,  -64,  -64,
      -64,  -64,  -64,  -64,  -64,  133,  -64,  -64,  -64,  -64,
      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,
      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64

    },

    {
       31,  134,  134,  134,  134,  134,  134,  134,  134,  -65,
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
      134,  134,  134,  134,  134,  134,  134,  134,  -65,  134,
      134,  134,  134,  134,  134,  134,  134,  134
    },

    {
       31,  134,  134,  134,  134,  134,  134,  134,  134,  -66,
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
      134,  134,  134,  134,  134,  134,  134,  134,  -66,  134,
      134,  134,  134,  134,  134,  134,  134,  134
    },

    {
       31,  -67,  135,  136,  136,  -67,  -67,  -67,  -67,  137,
      -67,  -67,  -67,  -67,  -67,  138,  -67,  -67,  -67,  -67,

      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,
      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67
    },

    {
       31,  139,  139,  139,  139,  139,  139,  139,  139,  139,
      139,  139,  139,  139,  139,  139,  139,  139,  140,  139,
      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
      139,  139,  139,  139,  139,  141,  139,  139
    },

    {
       31,  142,  142,  142,  142,  142,  142,  -69,  142,  142,
      142,  142,  142,  142,  142,  142,  142,  142,  142,  142,
      142,  142,  142,  142,  142,  142,  142,  142,  142,  142,
      142,  142,  142,  142,  142,  142,  142,  142

    },

    {
       31,  142,  142,  142,  142,  142,  142,  -70,  142,  142,
      142,  142,  142,  142,  142,  142,  142,  142,  142,  142,
      142,  142,  142,  142,  142,  142,  142,  142,  142,  142,
      142,  142,  142,  142,  142,  142,  142,  142
    },

    {
       31,  -71,  -71,  -71,  -71,  -71,  -71,  143,  -71,  -71,
      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,
      -71,  -71,  144,  144,  144,  144,  144,  144,  -71,  -71,
      144,  144,  144,  144,  144,  144,  -71,  144
    },

    {
       31,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,

      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72
    },

    {
       31,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73
    },

    {
       31,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74

    },

    {
       31,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,
      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,
      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,
      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75
    },

    {
       31,  -76,  145,  145,  145,  -76,  -76,  -76,  -76,  -76,
      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,
      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,
      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76
    },

    {
       31,  -77,  145,  145,  145,  -77,  -77,  -77,  -77,  -77,
      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,

      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,
      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77
    },

    {
       31,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78
    },

    {
       31,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79

    },

    {
       31,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,
      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  146,  146,
      -80,  -80,  146,  146,  146,  146,  146,  146,  -80,  -80,
      146,  146,  146,  146,  146,  146,  -80,  -80
    },

    {
       31,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81
    },

    {
       31,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,

      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82
    },

    {
       31,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83
    },

    {
       31,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84

    },

    {
       31,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,
      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,
      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,
      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85
    },

    {
       31,  147,  147,  -86,  147,  147,  147,  147,  147,  147,
      147,  147,  147,  147,  147,  147,  147,  147,  148,  147,
      147,  147,  147,  147,  147,  147,  147,  147,  147,  147,
      149,  150,  151,  152,  153,  154,  147,  147
    },

    {
       31,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,
      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,

      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,
      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87
    },

    {
       31,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88
    },

    {
       31,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89

    },

    {
       31,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,
      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,
      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,
      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90
    },

    {
       31,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91
    },

    {
       31,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,
      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,

      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,
      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92
    },

    {
       31,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93
    },

    {
       31,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94

    },

    {
       31,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95
    },

    {
       31,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96
    },

    {
       31,  -97,  155,  155,  155,  -97,  -97,  -97,  -97,  -97,
      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,

      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,
      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97
    },

    {
       31,  -98,  155,  155,  155,  -98,  -98,  -98,  -98,  -98,
      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98
    },

    {
       31,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,
      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,
      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,
      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99

    },

    {
       31, -100, -100, -100, -100, -100, -100, -100, -100, -100,
     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
     -100, -100, -100, -100, -100, -100, -100, -100,  156, -100,
     -100, -100, -100, -100, -100, -100, -100, -100
    },

    {
       31, -101,  101,  101,  101, -101, -101, -101, -101, -101,
     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
     -101, -101, -101, -101, -101, -101, -101, -101
    },

    {
       31, -102, -102, -102, -102,  102, -102, -102,  102, -102,
     -102, -102,  102,  102, -102,  102, -102,  102, -102, -102,

     -102, -102, -102, -102, -102, -102, -102, -102, -102,  102,
     -102, -102, -102, -102, -102, -102,  102, -102
    },

    {
       31, -103, -103, -103, -103, -103, -103, -103, -103, -103,
     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
     -103, -103, -103, -103, -103, -103, -103, -103
    },

    {
       31, -104, -104, -104, -104, -104, -104, -104, -104, -104,
     -104, -104, -104, -104, -104, -104, -104, -104,  104,  104,
     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
     -104, -104, -104, -104, -104, -104, -104, -104

    },

    {
       31, -105, -105, -105, -105, -105, -105,  103, -105, -105,
     -105, -105, -105, -105, -105, -105, -105, -105,  157,  157,
     -105, -105,  157,  157,  157,  157,  157,  157, -105, -105,
      157,  157,  157,  157,  157,  157, -105,  157
    },

    {
       31,  158,  158, -106, -106,  159,  158,  158,  159,  158,
      158,  158,  159,  159,  158,  159,  158,  159,  158,  158,
      158,  158,  158,  158,  158,  158,  158,  158,  158,  159,
      158,  158,  158,  158,  158,  158,  159,  158
    },

    {
       31, -107, -107, -107, -107, -107, -107, -107, -107, -107,
     -107, -107, -107, -107, -107, -107, -107, -107,  107,  107,

     -107, -107, -107, -107,  111, -107, -107, -107, -107, -107,
     -107, -107, -107, -107, -107, -107, -107, -107
    },

    {
       31, -108, -108, -108, -108,  160, -108, -108,  160, -108,
     -108, -108,  160,  160, -108,  160, -108,  160, -108, -108,
     -108, -108, -108, -108, -108, -108, -108, -108, -108,  160,
     -108, -108, -108, -108, -108, -108,  160, -108
    },

    {
       31, -109, -109, -109, -109, -109, -109, -109, -109, -109,
     -109, -109, -109, -109, -109, -109, -109, -109,  161,  161,
     -109, -109, -109, -109,  111, -109, -109, -109, -109, -109,
     -109, -109, -109, -109, -109, -109, -109, -109

    },

    {
       31, -110, -110, -110, -110, -110, -110, -110, -110, -110,
     -110, -110, -110, -110, -110, -110,  109, -110,  110,  110,
     -110, -110, -110, -110,  111, -110, -110, -110, -110, -110,
     -110, -110, -110, -110, -110, -110, -110, -110
    },

    {
       31, -111, -111, -111, -111, -111, -111, -111, -111, -111,
     -111, -111, -111,  162, -111,  162, -111, -111,  163,  163,
     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
     -111, -111, -111, -111, -111, -111, -111, -111
    },

    {
       31, -112, -112, -112, -112, -112, -112, -112, -112, -112,
     -112, -112, -112, -112, -112, -112, -112, -112,  112,  112,

     -112, -112,  112,  112,  112,  112,  112,  112, -112, -112,
      112,  112,  112,  112,  112,  112, -112, -112
    },

    {
       31, -113, -113, -113, -113, -113, -113, -113, -113, -113,
     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
     -113, -113, -113, -113, -113, -113, -113, -113
    },

    {
       31, -114, -114, -114, -114, -114, -114,  114, -114, -114,
     -114, -114, -114, -114, -114, -114, -114, -114,  114,  114,
     -114, -114,  114,  114,  114,  114,  114,  114, -114, -114,
      114,  114,  114,  114,  114,  114, -114,  114

    },

    {
       31, -115, -115, -115, -115, -115, -115, -115, -115, -115,
     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
     -115, -115, -115, -115, -115, -115, -115, -115
    },

    {
       31, -116, -116, -116, -116, -116, -116, -116, -116, -116,
     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
     -116, -116, -116, -116, -116, -116, -116, -116
    },

    {
       31, -117, -117, -117, -117, -117, -117, -117, -117, -117,
     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,

     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
     -117, -117, -117, -117, -117, -117, -117, -117
    },

    {
       31, -118, -118, -118, -118, -118, -118, -118, -118, -118,
     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
     -118, -118, -118, -118, -118, -118, -118, -118
    },

    {
       31, -119, -119, -119, -119, -119, -119, -119, -119, -119,
     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
     -119, -119, -119, -119, -119, -119, -119, -119

    },

    {
       31,  120,  120,  120,  120,  120,  120,  120,  120, -120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  120,  120,  120,  120,  120,  120,  120
    },

    {
       31, -121,  121,  122,  122, -121, -121, -121, -121, -121,
     -121, -121, -121, -121, -121,  123, -121, -121, -121, -121,
     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
     -121, -121, -121, -121, -121, -121, -121, -121
    },

    {
       31, -122,  164,  164,  164, -122, -122, -122, -122,  165,
     -122, -122, -122, -122, -122,  166, -122, -122, -122, -122,

     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
     -122, -122, -122, -122, -122, -122, -122, -122
    },

    {
       31, -123, -123, -123, -123, -123, -123, -123, -123, -123,
     -123, -123, -123, -123, -123,  167, -123, -123, -123, -123,
     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
     -123, -123, -123, -123, -123, -123, -123, -123
    },

    {
       31,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124, -124,  124,  124,  124,  124, -124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124

    },

    {
       31, -125, -125, -125, -125, -125, -125, -125, -125, -125,
     -125, -125,  125, -125, -125, -125, -125,  126, -125, -125,
     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
     -125, -125, -125, -125, -125, -125, -125, -125
    },

    {
       31, -126, -126, -126, -126, -126, -126, -126, -126, -126,
     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
     -126, -126, -126, -126, -126, -126, -126, -126
    },

    {
       31, -127, -127, -127, -127,  168, -127, -127,  168, -127,
     -127, -127,  168,  168, -127,  168, -127,  168, -127, -127,

     -127, -127, -127, -127, -127, -127, -127, -127, -127,  168,
     -127, -127, -127, -127, -127, -127,  168, -127
    },

    {
       31,  128,  128,  128,  128,  128, -128,  128,  128,  128,
      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
      128,  128,  128,  128,  128,  128,  128,  128
    },

    {
       31, -129, -129, -129, -129, -129, -129, -129, -129, -129,
     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
     -129, -129, -129, -129, -129, -129, -129, -129

    },

    {
       31,  130,  130,  130,  130,  130,  130,  130,  130, -130,
      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,
      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,
      130,  130,  130,  130,  130,  130,  130,  130
    },

    {
       31, -131,  131,  132,  132, -131, -131, -131, -131, -131,
     -131, -131, -131, -131, -131,  133, -131, -131, -131, -131,
     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
     -131, -131, -131, -131, -131, -131, -131, -131
    },

    {
       31, -132,  169,  169,  169, -132, -132, -132, -132,  170,
     -132, -132, -132, -132, -132,  171, -132, -132, -132, -132,

     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
     -132, -132, -132, -132, -132, -132, -132, -132
    },

    {
       31, -133, -133, -133, -133, -133, -133, -133, -133, -133,
     -133, -133, -133, -133, -133,  172, -133, -133, -133, -133,
     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
     -133, -133, -133, -133, -133, -133, -133, -133
    },

    {
       31,  134,  134,  134,  134,  134,  134,  134,  134, -134,
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
      134,  134,  134,  134,  134,  134,  134,  134, -134,  134,
      134,  134,  134,  134,  134,  134,  134,  134

    },

    {
       31, -135,  135,  136,  136, -135, -135, -135, -135, -135,
     -135, -135, -135, -135, -135,  138, -135, -135, -135, -135,
     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
     -135, -135, -135, -135, -135, -135, -135, -135
    },

    {
       31, -136,  173,  173,  173, -136, -136, -136, -136,  174,
     -136, -136, -136, -136, -136,  175, -136, -136, -136, -136,
     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
     -136, -136, -136, -136, -136, -136, -136, -136
    },

    {
       31, -137, -137, -137, -137, -137, -137, -137, -137, -137,
     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,

     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
     -137, -137, -137, -137, -137, -137, -137, -137
    },

    {
       31, -138, -138, -138, -138, -138, -138, -138, -138, -138,
     -138, -138, -138, -138, -138,  176, -138, -138, -138, -138,
     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
     -138, -138, -138, -138, -138, -138, -138, -138
    },

    {
       31, -139, -139, -139, -139, -139, -139, -139, -139, -139,
     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
     -139, -139, -139, -139, -139, -139, -139, -139

    },

    {
       31, -140, -140, -140, -140, -140, -140, -140, -140, -140,
     -140, -140, -140, -140, -140, -140, -140, -140,  177, -140,
     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
     -140, -140, -140, -140, -140, -140, -140, -140
    },

    {
       31, -141, -141, -141, -141, -141, -141, -141, -141, -141,
     -141, -141, -141, -141, -141, -141, -141, -141,  178,  178,
     -141, -141,  178,  178,  178, -141, -141, -141, -141, -141,
      178,  178, -141, -141, -141, -141, -141, -141
    },

    {
       31,  142,  142,  142,  142,  142,  142, -142,  142,  142,
      142,  142,  142,  142,  142,  142,  142,  142,  142,  142,

      142,  142,  142,  142,  142,  142,  142,  142,  142,  142,
      142,  142,  142,  142,  142,  142,  142,  142
    },

    {
       31, -143, -143, -143, -143, -143, -143, -143, -143, -143,
     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
     -143, -143, -143, -143, -143, -143, -143, -143
    },

    {
       31, -144, -144, -144, -144, -144, -144,  143, -144, -144,
     -144, -144, -144, -144, -144, -144, -144, -144,  179,  179,
     -144, -144,  179,  179,  179,  179,  179,  179, -144, -144,
      179,  179,  179,  179,  179,  179, -144,  179

    },

    {
       31, -145,  145,  145,  145, -145, -145, -145, -145, -145,
     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
     -145, -145, -145, -145, -145, -145, -145, -145
    },

    {
       31, -146, -146, -146, -146, -146, -146, -146, -146, -146,
     -146, -146, -146, -146, -146, -146, -146, -146,  146,  146,
     -146, -146,  146,  146,  146,  146,  146,  146, -146, -146,
      146,  146,  146,  146,  146,  146, -146, -146
    },

    {
       31, -147, -147, -147, -147, -147, -147, -147, -147, -147,
     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,

     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
     -147, -147, -147, -147, -147, -147, -147, -147
    },

    {
       31, -148, -148, -148, -148, -148, -148, -148, -148, -148,
     -148, -148, -148, -148, -148, -148, -148, -148,  180, -148,
     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
     -148, -148, -148, -148, -148, -148, -148, -148
    },

    {
       31, -149, -149, -149, -149, -149, -149, -149, -149, -149,
     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
     -149, -149, -149, -149, -149, -149, -149, -149

    },

    {
       31, -150, -150, -150, -150, -150, -150, -150, -150, -150,
     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
     -150, -150, -150, -150, -150, -150, -150, -150
    },

    {
       31, -151, -151, -151, -151, -151, -151, -151, -151, -151,
     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
     -151, -151, -151, -151, -151, -151, -151, -151
    },

    {
       31, -152, -152, -152, -152, -152, -152, -152, -152, -152,
     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,

     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
     -152, -152, -152, -152, -152, -152, -152, -152
    },

    {
       31, -153, -153, -153, -153, -153, -153, -153, -153, -153,
     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
     -153, -153, -153, -153, -153, -153, -153, -153
    },

    {
       31, -154, -154, -154, -154, -154, -154, -154, -154, -154,
     -154, -154, -154, -154, -154, -154, -154, -154,  181,  181,
     -154, -154,  181,  181,  181, -154, -154, -154, -154, -154,
      181,  181, -154, -154, -154, -154, -154, -154

    },

    {
       31, -155,  155,  155,  155, -155, -155, -155, -155, -155,
     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
     -155, -155, -155, -155, -155, -155, -155, -155
    },

    {
       31, -156, -156, -156, -156, -156, -156, -156, -156, -156,
     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
     -156, -156, -156, -156, -156, -156, -156, -156
    },

    {
       31, -157, -157, -157, -157, -157, -157,  103, -157, -157,
     -157, -157, -157, -157, -157, -157, -157, -157,  157,  157,

     -157, -157,  157,  157,  157,  157,  157,  157, -157, -157,
      157,  157,  157,  157,  157,  157, -157,  157
    },

    {
       31,  158,  158, -158, -158,  158,  158,  158,  158,  158,
      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,
      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,
      158,  158,  158,  158,  158,  158,  158,  158
    },

    {
       31,  158,  158, -159, -159,  159,  158,  158,  159,  158,
      158,  158,  159,  159,  158,  159,  158,  159,  158,  158,
      158,  158,  158,  158,  158,  158,  158,  158,  158,  159,
      158,  158,  158,  158,  158,  158,  159,  158

    },

    {
       31, -160, -160, -160, -160,  160, -160, -160,  160, -160,
     -160, -160,  160,  160, -160,  160, -160,  160, -160, -160,
     -160, -160, -160, -160, -160, -160, -160, -160, -160,  160,
     -160, -160, -160, -160, -160, -160,  160, -160
    },

    {
       31, -161, -161, -161, -161, -161, -161, -161, -161, -161,
     -161, -161, -161, -161, -161, -161, -161, -161,  161,  161,
     -161, -161, -161, -161,  111, -161, -161, -161, -161, -161,
     -161, -161, -161, -161, -161, -161, -161, -161
    },

    {
       31, -162, -162, -162, -162, -162, -162, -162, -162, -162,
     -162, -162, -162, -162, -162, -162, -162, -162,  163,  163,

     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
     -162, -162, -162, -162, -162, -162, -162, -162
    },

    {
       31, -163, -163, -163, -163, -163, -163, -163, -163, -163,
     -163, -163, -163, -163, -163, -163, -163, -163,  163,  163,
     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
     -163, -163, -163, -163, -163, -163, -163, -163
    },

    {
       31, -164,  164,  164,  164, -164, -164, -164, -164,  165,
     -164, -164, -164, -164, -164,  166, -164, -164, -164, -164,
     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
     -164, -164, -164, -164, -164, -164, -164, -164

    },

    {
       31, -165, -165, -165, -165, -165, -165, -165, -165, -165,
     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
     -165, -165, -165, -165, -165, -165, -165, -165
    },

    {
       31, -166, -166, -166, -166, -166, -166, -166, -166, -166,
     -166, -166, -166, -166, -166,  182, -166, -166, -166, -166,
     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
     -166, -166, -166, -166, -166, -166, -166, -166
    },

    {
       31,  183,  184,  122,  122,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  185,  183,  183,  183,  183,

      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  183,  183,  183
    },

    {
       31, -168, -168, -168, -168,  168, -168, -168,  168, -168,
     -168, -168,  168,  168, -168,  168, -168,  168, -168, -168,
     -168, -168, -168, -168, -168, -168, -168, -168, -168,  168,
     -168, -168, -168, -168, -168, -168,  168, -168
    },

    {
       31, -169,  169,  169,  169, -169, -169, -169, -169,  170,
     -169, -169, -169, -169, -169,  171, -169, -169, -169, -169,
     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,
     -169, -169, -169, -169, -169, -169, -169, -169

    },

    {
       31, -170, -170, -170, -170, -170, -170, -170, -170, -170,
     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,
     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,
     -170, -170, -170, -170, -170, -170, -170, -170
    },

    {
       31, -171, -171, -171, -171, -171, -171, -171, -171, -171,
     -171, -171, -171, -171, -171,  186, -171, -171, -171, -171,
     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,
     -171, -171, -171, -171, -171, -171, -171, -171
    },

    {
       31,  187,  188,  132,  132,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  189,  187,  187,  187,  187,

      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  187,  187,  187
    },

    {
       31, -173,  173,  173,  173, -173, -173, -173, -173,  174,
     -173, -173, -173, -173, -173,  175, -173, -173, -173, -173,
     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,
     -173, -173, -173, -173, -173, -173, -173, -173
    },

    {
       31, -174, -174, -174, -174, -174, -174, -174, -174, -174,
     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,
     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,
     -174, -174, -174, -174, -174, -174, -174, -174

    },

    {
       31, -175, -175, -175, -175, -175, -175, -175, -175, -175,
     -175, -175, -175, -175, -175,  190, -175, -175, -175, -175,
     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,
     -175, -175, -175, -175, -175, -175, -175, -175
    },

    {
       31,  191,  192,  136,  136,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  193,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  191,  191,  191
    },

    {
       31, -177, -177, -177, -177, -177, -177, -177, -177, -177,
     -177, -177, -177, -177, -177, -177, -177, -177,  194, -177,

     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,
     -177, -177, -177, -177, -177, -177, -177, -177
    },

    {
       31, -178, -178, -178, -178, -178, -178, -178, -178, -178,
     -178, -178, -178, -178, -178, -178, -178, -178,  195,  195,
     -178, -178,  195,  195,  195, -178, -178, -178, -178, -178,
      195,  195, -178, -178, -178, -178, -178, -178
    },

    {
       31, -179, -179, -179, -179, -179, -179,  143, -179, -179,
     -179, -179, -179, -179, -179, -179, -179, -179,  179,  179,
     -179, -179,  179,  179,  179,  179,  179,  179, -179, -179,
      179,  179,  179,  179,  179,  179, -179,  179

    },

    {
       31, -180, -180, -180, -180, -180, -180, -180, -180, -180,
     -180, -180, -180, -180, -180, -180, -180, -180,  196, -180,
     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,
     -180, -180, -180, -180, -180, -180, -180, -180
    },

    {
       31, -181, -181, -181, -181, -181, -181, -181, -181, -181,
     -181, -181, -181, -181, -181, -181, -181, -181,  197,  197,
     -181, -181,  197,  197,  197, -181, -181, -181, -181, -181,
      197,  197, -181, -181, -181, -181, -181, -181
    },

    {
       31,  198,  199,  200,  200,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  201,  198,  198,  198,  198,

      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  198,  198,  198
    },

    {
       31,  183,  184,  122,  122,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  185,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  183,  183,  183
    },

    {
       31,  183,  184,  122,  122,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  185,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  183,  183,  183

    },

    {
       31,  183,  184,  122,  122,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  202,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  183,  183,  183
    },

    {
       31,  203,  204,  205,  205,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  206,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203
    },

    {
       31,  187,  188,  132,  132,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  189,  187,  187,  187,  187,

      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  187,  187,  187
    },

    {
       31,  187,  188,  132,  132,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  189,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  187,  187,  187
    },

    {
       31,  187,  188,  132,  132,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  207,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  187,  187,  187

    },

    {
       31,  208,  209,  210,  210,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  211,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208
    },

    {
       31,  191,  192,  136,  136,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  193,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  191,  191,  191
    },

    {
       31,  191,  192,  136,  136,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  193,  191,  191,  191,  191,

      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  191,  191,  191
    },

    {
       31,  191,  192,  136,  136,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  212,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  191,  191,  191
    },

    {
       31, -194, -194, -194, -194, -194, -194, -194, -194, -194,
     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,
     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,
     -194, -194, -194, -194, -194, -194, -194, -194

    },

    {
       31, -195, -195, -195, -195, -195, -195, -195, -195, -195,
     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,
     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,
     -195, -195, -195, -195, -195, -195, -195, -195
    },

    {
       31, -196, -196, -196, -196, -196, -196, -196, -196, -196,
     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,
     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,
     -196, -196, -196, -196, -196, -196, -196, -196
    },

    {
       31, -197, -197, -197, -197, -197, -197, -197, -197, -197,
     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,

     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,
     -197, -197, -197, -197, -197, -197, -197, -197
    },

    {
       31,  198,  199,  200,  200,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  201,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  198,  198,  198
    },

    {
       31,  198,  199,  200,  200,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  201,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  198,  198,  198

    },

    {
       31, -200,  164,  164,  164, -200, -200, -200, -200,  165,
     -200, -200, -200, -200, -200,  166, -200, -200, -200, -200,
     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,
     -200, -200, -200, -200, -200, -200, -200, -200
    },

    {
       31,  198,  199,  200,  200,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  213,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  198,  198,  198
    },

    {
       31,  183,  184,  122,  122,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  202,  183,  183,  183,  183,

      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,
      183,  183,  183,  183,  183,  183,  183,  183
    },

    {
       31,  203,  204,  205,  205,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  206,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203
    },

    {
       31,  203,  204,  205,  205,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  206,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203

    },

    {
       31, -205,  169,  169,  169, -205, -205, -205, -205,  170,
     -205, -205, -205, -205, -205,  171, -205, -205, -205, -205,
     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,
     -205, -205, -205, -205, -205, -205, -205, -205
    },

    {
       31,  203,  204,  205,  205,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  214,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203
    },

    {
       31,  187,  188,  132,  132,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  207,  187,  187,  187,  187,

      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
      187,  187,  187,  187,  187,  187,  187,  187
    },

    {
       31,  208,  209,  210,  210,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  211,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208
    },

    {
       31,  208,  209,  210,  210,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  211,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208

    },

    {
       31, -210,  173,  173,  173, -210, -210, -210, -210,  174,
     -210, -210, -210, -210, -210,  175, -210, -210, -210, -210,
     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,
     -210, -210, -210, -210, -210, -210, -210, -210
    },

    {
       31,  208,  209,  210,  210,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  215,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208
    },

    {
       31,  191,  192,  136,  136,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  212,  191,  191,  191,  191,

      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  191,  191,  191
    },

    {
       31,  198,  199,  200,  200,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  213,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
      198,  198,  198,  198,  198,  198,  198,  198
    },

    {
       31,  203,  204,  205,  205,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  214,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
      203,  203,  203,  203,  203,  203,  203,  203

    },

    {
       31,  208,  209,  210,  210,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  215,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
      208,  208,  208,  208,  208,  208,  208,  208
    },

    } ;


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

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

#define YY_NUM_RULES 89
#define YY_END_OF_BUFFER 90
static yyconst short int yy_accept[216] =
    {   0,
        0,    0,   12,   12,    0,    0,    0,    0,   11,   11,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
       90,   56,    1,    1,   48,   36,   56,   47,   19,   41,
       42,   47,   47,   47,   47,   50,   47,   43,   55,   55,
       55,   55,   55,   45,   12,    9,    5,    5,    6,    6,
       39,   37,   11,   16,   24,   24,   21,   29,   33,   33,
       35,   58,   57,   57,   66,   59,   59,   65,   61,   63,
       60,   62,   64,   76,   67,   76,   78,   77,   82,   79,
       79,   81,   80,   84,   83,   86,   85,   85,   88,   88,

        1,   48,   30,   49,   31,    1,   51,    2,   51,   50,
       53,   46,   40,   55,    8,   20,   18,   15,   44,   12,
        9,    9,   10,    5,    7,    4,    3,   39,   38,   11,
       16,   16,   17,   24,   21,   21,   23,   22,   25,   26,
       25,   33,   32,   34,   59,   63,   75,   73,   70,   72,
       68,   71,   69,   75,   85,   87,   31,    1,    1,    2,
       51,   54,   52,    9,   14,   10,    9,    3,   16,   13,
       17,   16,   21,   28,   22,   21,   26,   27,   34,   73,
       74,    9,    9,    9,    9,   16,   16,   16,   16,   21,
       21,   21,   21,   26,   27,   73,   74,    9,    9,    9,

        9,    9,   16,   16,   16,   16,   16,   21,   21,   21,
       21,   21,    9,   16,   21
    } ;

static yyconst int yy_ec[256] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
        1,    2,    4,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    5,    6,    5,    7,    8,    5,    9,   10,
       11,   12,   13,   14,   15,   16,   17,   18,   18,   18,
       18,   18,   18,   18,   18,   19,   19,   20,   21,    8,
        8,    8,    5,    5,   22,   23,   22,   22,   24,   22,
       25,   25,   25,   25,   25,   25,   25,   26,   25,   25,
       25,   25,   25,   25,   25,   25,   25,   27,   25,   25,
       14,   28,   14,    8,   25,   29,   22,   30,   22,   22,

       24,   31,   25,   25,   25,   25,   25,   25,   25,   32,
       25,   25,   25,   33,   25,   34,   25,   25,   25,   35,
       25,   25,    1,   36,    1,    5,    1,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,

       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
       37,   37,   37,   37,   37
    } ;

/* The intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed.
 */
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "psqlscan.l"
#define INITIAL 0
#line 2 "psqlscan.l"
/*-------------------------------------------------------------------------
 *
 * psqlscan.l
 *	  lexical scanner for psql
 *
 * This code is mainly needed to determine where the end of a SQL statement
 * is: we are looking for semicolons that are not within quotes, comments,
 * or parentheses.  The most reliable way to handle this is to borrow the
 * backend's flex lexer rules, lock, stock, and barrel.  The rules below
 * are (except for a few) the same as the backend's, but their actions are
 * just ECHO whereas the backend's actions generally do other things.
 *
 * XXX The rules in this file must be kept in sync with the backend lexer!!!
 *
 * XXX Avoid creating backtracking cases --- see the backend lexer for info.
 *
 * The most difficult aspect of this code is that we need to work in multibyte
 * encodings that are not ASCII-safe.  A "safe" encoding is one in which each
 * byte of a multibyte character has the high bit set (it's >= 0x80).  Since
 * all our lexing rules treat all high-bit-set characters alike, we don't
 * really need to care whether such a byte is part of a sequence or not.
 * In an "unsafe" encoding, we still expect the first byte of a multibyte
 * sequence to be >= 0x80, but later bytes might not be.  If we scan such
 * a sequence as-is, the lexing rules could easily be fooled into matching
 * such bytes to ordinary ASCII characters.  Our solution for this is to
 * substitute 0xFF for each non-first byte within the data presented to flex.
 * The flex rules will then pass the FF's through unmolested.  The emit()
 * subroutine is responsible for looking back to the original string and
 * replacing FF's with the corresponding original bytes.
 *
 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * IDENTIFICATION
 *	  $PostgreSQL: pgsql/src/bin/psql/psqlscan.l,v 1.15 2005/06/26 19:16:06 tgl Exp $
 *
 *-------------------------------------------------------------------------
 */
#include "postgres_fe.h"

#include "psqlscan.h"

#include <ctype.h>

#include "mb/pg_wchar.h"

#include "common.h"
#include "settings.h"
#include "variables.h"


/*
 * We use a stack of flex buffers to handle substitution of psql variables.
 * Each stacked buffer contains the as-yet-unread text from one psql variable.
 * When we pop the stack all the way, we resume reading from the outer buffer
 * identified by scanbufhandle.
 */
typedef struct StackElem
{
	YY_BUFFER_STATE buf;		/* flex input control structure */
	char	   *bufstring;		/* data actually being scanned by flex */
	char	   *origstring;		/* copy of original data, if needed */
	struct StackElem *next;
} StackElem;

/*
 * All working state of the lexer must be stored in PsqlScanStateData
 * between calls.  This allows us to have multiple open lexer operations,
 * which is needed for nested include files.  The lexer itself is not
 * recursive, but it must be re-entrant.
 */
typedef struct PsqlScanStateData
{
	StackElem  *buffer_stack;	/* stack of variable expansion buffers */
	/*
	 * These variables always refer to the outer buffer, never to any
	 * stacked variable-expansion buffer.
	 */
	YY_BUFFER_STATE scanbufhandle;
	char	   *scanbuf;		/* start of outer-level input buffer */
	const char *scanline;		/* current input line at outer level */

	/* safe_encoding, curline, refline are used by emit() to replace FFs */
	int			encoding;		/* encoding being used now */
	bool		safe_encoding;	/* is current encoding "safe"? */
	const char *curline;		/* actual flex input string for cur buf */
	const char *refline;		/* original data for cur buffer */

	/*
	 * All this state lives across successive input lines, until explicitly
	 * reset by psql_scan_reset.
	 */
	int			start_state;	/* saved YY_START */
	int			paren_depth;	/* depth of nesting in parentheses */
	int			xcdepth;		/* depth of nesting in slash-star comments */
	char	   *dolqstart;		/* current $foo$ quote start string */
} PsqlScanStateData;

static PsqlScanState cur_state;	/* current state while active */

static PQExpBuffer output_buf;	/* current output buffer */

/* these variables do not need to be saved across calls */
static enum slash_option_type option_type;
static char *option_quote;


/* Return values from yylex() */
#define LEXRES_EOL			0	/* end of input */
#define LEXRES_SEMI			1	/* command-terminating semicolon found */
#define LEXRES_BACKSLASH	2	/* backslash command start */
#define LEXRES_OK			3	/* OK completion of backslash argument */


int	yylex(void);

static void push_new_buffer(const char *newstr);
static YY_BUFFER_STATE prepare_buffer(const char *txt, int len,
									  char **txtcopy);
static void emit(const char *txt, int len);

#define ECHO emit(yytext, yyleng)

#define YY_NEVER_INTERACTIVE 1
#define YY_NO_UNPUT 1
/*
 * All of the following definitions and rules should exactly match
 * src/backend/parser/scan.l so far as the flex patterns are concerned.
 * The rule bodies are just ECHO as opposed to what the backend does,
 * however.  (But be sure to duplicate code that affects the lexing process,
 * such as BEGIN().)  Also, psqlscan uses a single <<EOF>> rule whereas
 * scan.l has a separate one for each exclusive state.
 */
/*
 * OK, here is a short description of lex/flex rules behavior.
 * The longest pattern which matches an input string is always chosen.
 * For equal-length patterns, the first occurring in the rules list is chosen.
 * INITIAL is the starting state, to which all non-conditional rules apply.
 * Exclusive states change parsing rules while the state is active.  When in
 * an exclusive state, only those rules defined for that state apply.
 *
 * We use exclusive states for quoted strings, extended comments,
 * and to eliminate parsing troubles for numeric strings.
 * Exclusive states:
 *  <xb> bit string literal
 *  <xc> extended C-style comments
 *  <xd> delimited identifiers (double-quoted identifiers)
 *  <xh> hexadecimal numeric string
 *  <xq> quoted strings
 *  <xdolq> $foo$ quoted strings
 */
#define xb 1

#define xc 2

#define xd 3

#define xh 4

#define xq 5

#define xdolq 6

/* Additional exclusive states for psql only: lex backslash commands */
#define xslashcmd 7

#define xslasharg 8

#define xslashquote 9

#define xslashbackquote 10

#define xslashdefaultarg 11

#define xslashquotedarg 12

#define xslashwholeline 13

#define xslashend 14

/*
 * In order to make the world safe for Windows and Mac clients as well as
 * Unix ones, we accept either \n or \r as a newline.  A DOS-style \r\n
 * sequence will be seen as two successive newlines, but that doesn't cause
 * any problems.  Comments that start with -- and extend to the next
 * newline are treated as equivalent to a single whitespace character.
 *
 * NOTE a fine point: if there is no newline following --, we will absorb
 * everything to the end of the input as a comment.  This is correct.  Older
 * versions of Postgres failed to recognize -- as a comment if the input
 * did not end with a newline.
 *
 * XXX perhaps \f (formfeed) should be treated as a newline as well?
 */
/*
 * SQL requires at least one newline in the whitespace separating
 * string literals that are to be concatenated.  Silly, but who are we
 * to argue?  Note that {whitespace_with_newline} should not have * after
 * it, whereas {whitespace} should generally have a * after it...
 */
/*
 * To ensure that {quotecontinue} can be scanned without having to back up
 * if the full pattern isn't matched, we include trailing whitespace in
 * {quotestop}.  This matches all cases where {quotecontinue} fails to match,
 * except for {quote} followed by whitespace and just one "-" (not two,
 * which would start a {comment}).  To cover that we have {quotefail}.
 * The actions for {quotestop} and {quotefail} must throw back characters
 * beyond the quote proper.
 */
/* Bit string
 * It is tempting to scan the string for only those characters
 * which are allowed. However, this leads to silently swallowed
 * characters if illegal characters are included in the string.
 * For example, if xbinside is [01] then B'ABCD' is interpreted
 * as a zero-length string, and the ABCD' is lost!
 * Better to pass the string forward and let the input routines
 * validate the contents.
 */
/* Hexadecimal number */
/* National character */
/* Quoted string that allows backslash escapes */
/* Extended quote
 * xqdouble implements embedded quote, ''''
 */
/* $foo$ style quotes ("dollar quoting")
 * The quoted string starts with $foo$ where "foo" is an optional string
 * in the form of an identifier, except that it may not contain "$", 
 * and extends to the first occurrence of an identical string.  
 * There is *no* processing of the quoted text.
 *
 * {dolqfailed} is an error rule to avoid scanner backup when {dolqdelim}
 * fails to match its trailing "$".
 */
/* Double quote
 * Allows embedded spaces and other special characters into identifiers.
 */
/* C-style comments
 *
 * The "extended comment" syntax closely resembles allowable operator syntax.
 * The tricky part here is to get lex to recognize a string starting with
 * slash-star as a comment, when interpreting it as an operator would produce
 * a longer match --- remember lex will prefer a longer match!  Also, if we
 * have something like plus-slash-star, lex will think this is a 3-character
 * operator whereas we want to see it as a + operator and a comment start.
 * The solution is two-fold:
 * 1. append {op_chars}* to xcstart so that it matches as much text as
 *    {operator} would. Then the tie-breaker (first matching rule of same
 *    length) ensures xcstart wins.  We put back the extra stuff with yyless()
 *    in case it contains a star-slash that should terminate the comment.
 * 2. In the operator rule, check for slash-star within the operator, and
 *    if found throw it back with yyless().  This handles the plus-slash-star
 *    problem.
 * Dash-dash comments have similar interactions with the operator rule.
 */
/*
 * "self" is the set of chars that should be returned as single-character
 * tokens.  "op_chars" is the set of chars that can make up "Op" tokens,
 * which can be one or more characters long (but if a single-char token
 * appears in the "self" set, it is not to be returned as an Op).  Note
 * that the sets overlap, but each has some chars that are not in the other.
 *
 * If you change either set, adjust the character lists appearing in the
 * rule for "operator"!
 */
/* we no longer allow unary minus in numbers. 
 * instead we pass it separately to parser. there it gets
 * coerced via doNegate() -- Leon aug 20 1999
 *
 * {realfail1} and {realfail2} are added to prevent the need for scanner
 * backup when the {real} rule fails to match completely.
 */
/*
 * Dollar quoted strings are totally opaque, and no escaping is done on them.
 * Other quoted strings must allow some special characters such as single-quote
 *  and newline.
 * Embedded single-quotes are implemented both in the SQL standard
 *  style of two adjacent single quotes "''" and in the Postgres/Java style
 *  of escaped-quote "\'".
 * Other embedded escaped characters are matched explicitly and the leading
 *  backslash is dropped from the string.
 * Note that xcstart must appear before operator, as explained above!
 *  Also whitespace (comment) must appear before operator.
 */
#line 2249 "psqlscan.c"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#define YY_RULE_SETUP \
	YY_USER_ACTION

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

#line 357 "psqlscan.l"


#line 2403 "psqlscan.c"

	if ( yy_init )
		{
		yy_init = 0;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

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

		if ( ! yyin )
			yyin = stdin;

		if ( ! yyout )
			yyout = stdout;

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

		yy_load_buffer_state();
		}

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

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

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

		yy_current_state = yy_start;
yy_match:
		while ( (yy_current_state = yy_nxt[yy_current_state][yy_ec[YY_SC_TO_UI(*yy_cp)]]) > 0 )
			++yy_cp;

		yy_current_state = -yy_current_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 1:
YY_RULE_SETUP
#line 359 "psqlscan.l"
{
					/*
					 * Note that the whitespace rule includes both true
					 * whitespace and single-line ("--" style) comments.
					 * We suppress whitespace at the start of the query
					 * buffer.  We also suppress all single-line comments,
					 * which is pretty dubious but is the historical
					 * behavior.
					 */
					if (!(output_buf->len == 0 || yytext[0] == '-'))
						ECHO;
				}
	YY_BREAK
case 2:
YY_RULE_SETUP
#line 372 "psqlscan.l"
{
					cur_state->xcdepth = 0;
					BEGIN(xc);
					/* Put back any characters past slash-star; see above */
					yyless(2);
					ECHO;
				}
	YY_BREAK
case 3:
YY_RULE_SETUP
#line 380 "psqlscan.l"
{
					cur_state->xcdepth++;
					/* Put back any characters past slash-star; see above */
					yyless(2);
					ECHO;
				}
	YY_BREAK
case 4:
YY_RULE_SETUP
#line 387 "psqlscan.l"
{
					if (cur_state->xcdepth <= 0)
					{
						BEGIN(INITIAL);
					}
					else
						cur_state->xcdepth--;
					ECHO;
				}
	YY_BREAK
case 5:
YY_RULE_SETUP
#line 397 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 6:
YY_RULE_SETUP
#line 401 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 7:
YY_RULE_SETUP
#line 405 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 8:
YY_RULE_SETUP
#line 409 "psqlscan.l"
{
					BEGIN(xb);
					ECHO;
				}
	YY_BREAK
case 9:
#line 414 "psqlscan.l"
case 10:
YY_RULE_SETUP
#line 414 "psqlscan.l"
{
					yyless(1);
					BEGIN(INITIAL);
					ECHO;
				}
	YY_BREAK
case 11:
#line 420 "psqlscan.l"
case 12:
YY_RULE_SETUP
#line 420 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 13:
#line 424 "psqlscan.l"
case 14:
YY_RULE_SETUP
#line 424 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 15:
YY_RULE_SETUP
#line 428 "psqlscan.l"
{
					/* Hexadecimal bit type.
					 * At some point we should simply pass the string
					 * forward to the parser and label it there.
					 * In the meantime, place a leading "x" on the string
					 * to mark it for the input routine as a hex string.
					 */
					BEGIN(xh);
					ECHO;
				}
	YY_BREAK
case 16:
#line 439 "psqlscan.l"
case 17:
YY_RULE_SETUP
#line 439 "psqlscan.l"
{
					yyless(1);
					BEGIN(INITIAL);
					ECHO;
				}
	YY_BREAK
case 18:
YY_RULE_SETUP
#line 445 "psqlscan.l"
{
					yyless(1);				/* eat only 'n' this time */
					ECHO;
				}
	YY_BREAK
case 19:
YY_RULE_SETUP
#line 450 "psqlscan.l"
{
					BEGIN(xq);
					ECHO;
				}
	YY_BREAK
case 20:
YY_RULE_SETUP
#line 454 "psqlscan.l"
{
					BEGIN(xq);
					ECHO;
				}
	YY_BREAK
case 21:
#line 459 "psqlscan.l"
case 22:
YY_RULE_SETUP
#line 459 "psqlscan.l"
{
					yyless(1);
					BEGIN(INITIAL);
					ECHO;
				}
	YY_BREAK
case 23:
YY_RULE_SETUP
#line 464 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 24:
YY_RULE_SETUP
#line 467 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 25:
YY_RULE_SETUP
#line 470 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 26:
YY_RULE_SETUP
#line 473 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 27:
YY_RULE_SETUP
#line 476 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 28:
YY_RULE_SETUP
#line 479 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 29:
YY_RULE_SETUP
#line 482 "psqlscan.l"
{
					/* This is only needed for \ just before EOF */
					ECHO;
				}
	YY_BREAK
case 30:
YY_RULE_SETUP
#line 487 "psqlscan.l"
{
					cur_state->dolqstart = pg_strdup(yytext);
					BEGIN(xdolq);
					ECHO;
				}
	YY_BREAK
case 31:
YY_RULE_SETUP
#line 492 "psqlscan.l"
{
					/* throw back all but the initial "$" */
					yyless(1);
					ECHO;
				}
	YY_BREAK
case 32:
YY_RULE_SETUP
#line 497 "psqlscan.l"
{
					if (strcmp(yytext, cur_state->dolqstart) == 0)
					{
						free(cur_state->dolqstart);
						cur_state->dolqstart = NULL;
						BEGIN(INITIAL);
					}
					else
					{
						/*
						 * When we fail to match $...$ to dolqstart, transfer
						 * the $... part to the output, but put back the final
						 * $ for rescanning.  Consider $delim$...$junk$delim$
						 */
						yyless(yyleng-1);
					}
					ECHO;
				}
	YY_BREAK
case 33:
YY_RULE_SETUP
#line 515 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 34:
YY_RULE_SETUP
#line 518 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 35:
YY_RULE_SETUP
#line 521 "psqlscan.l"
{
					/* This is only needed for $ inside the quoted text */
					ECHO;
				}
	YY_BREAK
case 36:
YY_RULE_SETUP
#line 526 "psqlscan.l"
{
					BEGIN(xd);
					ECHO;
				}
	YY_BREAK
case 37:
YY_RULE_SETUP
#line 530 "psqlscan.l"
{
					BEGIN(INITIAL);
					ECHO;
				}
	YY_BREAK
case 38:
YY_RULE_SETUP
#line 534 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 39:
YY_RULE_SETUP
#line 537 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 40:
YY_RULE_SETUP
#line 541 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
/*
	 * These rules are specific to psql --- they implement parenthesis
	 * counting and detection of command-ending semicolon.  These must
	 * appear before the {self} rule so that they take precedence over it.
	 */
case 41:
YY_RULE_SETUP
#line 551 "psqlscan.l"
{
					cur_state->paren_depth++;
					ECHO;
				}
	YY_BREAK
case 42:
YY_RULE_SETUP
#line 556 "psqlscan.l"
{
					if (cur_state->paren_depth > 0)
						cur_state->paren_depth--;
					ECHO;
				}
	YY_BREAK
case 43:
YY_RULE_SETUP
#line 562 "psqlscan.l"
{
					ECHO;
					if (cur_state->paren_depth == 0)
					{
						/* Terminate lexing temporarily */
						return LEXRES_SEMI;
					}
				}
	YY_BREAK
/*
	 * psql-specific rules to handle backslash commands and variable
	 * substitution.  We want these before {self}, also.
	 */
case 44:
YY_RULE_SETUP
#line 576 "psqlscan.l"
{
					/* Force a semicolon or colon into the query buffer */
					emit(yytext + 1, 1);
				}
	YY_BREAK
case 45:
YY_RULE_SETUP
#line 581 "psqlscan.l"
{
					/* Terminate lexing temporarily */
					return LEXRES_BACKSLASH;
				}
	YY_BREAK
case 46:
YY_RULE_SETUP
#line 586 "psqlscan.l"
{
					/* Possible psql variable substitution */
					const char *value;

					value = GetVariable(pset.vars, yytext + 1);

					if (value)
					{
						/* It is a variable, perform substitution */
						push_new_buffer(value);
						/* yy_scan_string already made buffer active */
					}
					else
					{
						/*
						 * if the variable doesn't exist we'll copy the
						 * string as is
						 */
						ECHO;
					}
				}
	YY_BREAK
/*
	 * Back to backend-compatible rules.
	 */
case 47:
YY_RULE_SETUP
#line 612 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 48:
YY_RULE_SETUP
#line 616 "psqlscan.l"
{
					/*
					 * Check for embedded slash-star or dash-dash; those
					 * are comment starts, so operator must stop there.
					 * Note that slash-star or dash-dash at the first
					 * character will match a prior rule, not this one.
					 */
					int		nchars = yyleng;
					char   *slashstar = strstr(yytext, "/*");
					char   *dashdash = strstr(yytext, "--");

					if (slashstar && dashdash)
					{
						/* if both appear, take the first one */
						if (slashstar > dashdash)
							slashstar = dashdash;
					}
					else if (!slashstar)
						slashstar = dashdash;
					if (slashstar)
						nchars = slashstar - yytext;

					/*
					 * For SQL compatibility, '+' and '-' cannot be the
					 * last char of a multi-char operator unless the operator
					 * contains chars that are not in SQL operators.
					 * The idea is to lex '=-' as two operators, but not
					 * to forbid operator names like '?-' that could not be
					 * sequences of SQL operators.
					 */
					while (nchars > 1 &&
						   (yytext[nchars-1] == '+' ||
							yytext[nchars-1] == '-'))
					{
						int		ic;

						for (ic = nchars-2; ic >= 0; ic--)
						{
							if (strchr("~!@#^&|`?%", yytext[ic]))
								break;
						}
						if (ic >= 0)
							break; /* found a char that makes it OK */
						nchars--; /* else remove the +/-, and check again */
					}

					if (nchars < yyleng)
					{
						/* Strip the unwanted chars from the token */
						yyless(nchars);
					}
					ECHO;
				}
	YY_BREAK
case 49:
YY_RULE_SETUP
#line 670 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 50:
YY_RULE_SETUP
#line 674 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 51:
YY_RULE_SETUP
#line 677 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 52:
YY_RULE_SETUP
#line 680 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 53:
YY_RULE_SETUP
#line 683 "psqlscan.l"
{
					/*
					 * throw back the [Ee], and treat as {decimal}.  Note
					 * that it is possible the input is actually {integer},
					 * but since this case will almost certainly lead to a
					 * syntax error anyway, we don't bother to distinguish.
					 */
					yyless(yyleng-1);
					ECHO;
				}
	YY_BREAK
case 54:
YY_RULE_SETUP
#line 693 "psqlscan.l"
{
					/* throw back the [Ee][+-], and proceed as above */
					yyless(yyleng-2);
					ECHO;
				}
	YY_BREAK
case 55:
YY_RULE_SETUP
#line 700 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
case 56:
YY_RULE_SETUP
#line 704 "psqlscan.l"
{
					ECHO;
				}
	YY_BREAK
/*
	 * Everything from here down is psql-specific.
	 */
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(xb):
case YY_STATE_EOF(xc):
case YY_STATE_EOF(xd):
case YY_STATE_EOF(xh):
case YY_STATE_EOF(xq):
case YY_STATE_EOF(xdolq):
case YY_STATE_EOF(xslashcmd):
case YY_STATE_EOF(xslasharg):
case YY_STATE_EOF(xslashquote):
case YY_STATE_EOF(xslashbackquote):
case YY_STATE_EOF(xslashdefaultarg):
case YY_STATE_EOF(xslashquotedarg):
case YY_STATE_EOF(xslashwholeline):
case YY_STATE_EOF(xslashend):
#line 713 "psqlscan.l"
{
					StackElem  *stackelem = cur_state->buffer_stack;

					if (stackelem == NULL)
						return LEXRES_EOL; /* end of input reached */

					/*
					 * We were expanding a variable, so pop the inclusion
					 * stack and keep lexing
					 */
					cur_state->buffer_stack = stackelem->next;
					yy_delete_buffer(stackelem->buf);
					free(stackelem->bufstring);
					if (stackelem->origstring)
						free(stackelem->origstring);
					free(stackelem);

					stackelem = cur_state->buffer_stack;
					if (stackelem != NULL)
					{
						yy_switch_to_buffer(stackelem->buf);
						cur_state->curline = stackelem->bufstring;
						cur_state->refline = stackelem->origstring ? stackelem->origstring : stackelem->bufstring;
					}
					else
					{
						yy_switch_to_buffer(cur_state->scanbufhandle);
						cur_state->curline = cur_state->scanbuf;
						cur_state->refline = cur_state->scanline;
					}
				}
	YY_BREAK
/*
	 * Exclusive lexer states to handle backslash command lexing
	 */

/* command name ends at whitespace or backslash; eat all else */
case 57:
YY_RULE_SETUP
#line 752 "psqlscan.l"
{
					yyless(0);
					return LEXRES_OK;
				}
	YY_BREAK
case 58:
YY_RULE_SETUP
#line 757 "psqlscan.l"
{ ECHO; }
	YY_BREAK


/* eat any whitespace, then decide what to do at first nonblank */
case 59:
YY_RULE_SETUP
#line 764 "psqlscan.l"
{ }
	YY_BREAK
case 60:
YY_RULE_SETUP
#line 766 "psqlscan.l"
{
					/*
					 * backslash is end of command or next command, do not eat
					 *
					 * XXX this means we can't conveniently accept options
					 * that start with a backslash; therefore, option
					 * processing that encourages use of backslashes is rather
					 * broken.
					 */
					yyless(0);
					return LEXRES_OK;
				}
	YY_BREAK
case 61:
YY_RULE_SETUP
#line 779 "psqlscan.l"
{
					*option_quote = '\'';
					BEGIN(xslashquote);
				}
	YY_BREAK
case 62:
YY_RULE_SETUP
#line 784 "psqlscan.l"
{
					if (option_type == OT_VERBATIM)
					{
						/* in verbatim mode, backquote is not special */
						ECHO;
						BEGIN(xslashdefaultarg);
					}
					else
					{
						*option_quote = '`';
						BEGIN(xslashbackquote);
					}
				}
	YY_BREAK
case 63:
YY_RULE_SETUP
#line 798 "psqlscan.l"
{
					/* Possible psql variable substitution */
					if (option_type == OT_VERBATIM)
						ECHO;
					else
					{
						const char *value;

						value = GetVariable(pset.vars, yytext + 1);

						/*
						 * The variable value is just emitted without any
						 * further examination.  This is consistent with the
						 * pre-8.0 code behavior, if not with the way that
						 * variables are handled outside backslash commands.
						 */
						if (value)
							appendPQExpBufferStr(output_buf, value);
					}

					*option_quote = ':';

					return LEXRES_OK;
				}
	YY_BREAK
case 64:
YY_RULE_SETUP
#line 823 "psqlscan.l"
{
					ECHO;
					if (option_type == OT_FILEPIPE)
					{
						/* treat like whole-string case */
						BEGIN(xslashwholeline);
					}
					else
					{
						/* treat like default case */
						BEGIN(xslashdefaultarg);
					}
				}
	YY_BREAK
case 65:
YY_RULE_SETUP
#line 837 "psqlscan.l"
{
					*option_quote = '"';
					ECHO;
					BEGIN(xslashquotedarg);
				}
	YY_BREAK
case 66:
YY_RULE_SETUP
#line 843 "psqlscan.l"
{
					ECHO;
					BEGIN(xslashdefaultarg);
				}
	YY_BREAK


/* single-quoted text: copy literally except for backslash sequences */
case 67:
YY_RULE_SETUP
#line 853 "psqlscan.l"
{ return LEXRES_OK; }
	YY_BREAK
case 68:
YY_RULE_SETUP
#line 855 "psqlscan.l"
{ appendPQExpBufferChar(output_buf, '\n'); }
	YY_BREAK
case 69:
YY_RULE_SETUP
#line 856 "psqlscan.l"
{ appendPQExpBufferChar(output_buf, '\t'); }
	YY_BREAK
case 70:
YY_RULE_SETUP
#line 857 "psqlscan.l"
{ appendPQExpBufferChar(output_buf, '\b'); }
	YY_BREAK
case 71:
YY_RULE_SETUP
#line 858 "psqlscan.l"
{ appendPQExpBufferChar(output_buf, '\r'); }
	YY_BREAK
case 72:
YY_RULE_SETUP
#line 859 "psqlscan.l"
{ appendPQExpBufferChar(output_buf, '\f'); }
	YY_BREAK
case 73:
YY_RULE_SETUP
#line 861 "psqlscan.l"
{
					/* octal case */
					appendPQExpBufferChar(output_buf,
										  (char) strtol(yytext + 1, NULL, 8));
				}
	YY_BREAK
case 74:
YY_RULE_SETUP
#line 867 "psqlscan.l"
{
					/* hex case */
					appendPQExpBufferChar(output_buf,
										  (char) strtol(yytext + 2, NULL, 16));
				}
	YY_BREAK
case 75:
YY_RULE_SETUP
#line 873 "psqlscan.l"
{ emit(yytext + 1, 1); }
	YY_BREAK
case 76:
YY_RULE_SETUP
#line 875 "psqlscan.l"
{ ECHO; }
	YY_BREAK


/*
	 * backticked text: copy everything until next backquote or end of line.
	 * Invocation of the command will happen in psql_scan_slash_option.
	 */
case 77:
YY_RULE_SETUP
#line 885 "psqlscan.l"
{ return LEXRES_OK; }
	YY_BREAK
case 78:
YY_RULE_SETUP
#line 887 "psqlscan.l"
{ ECHO; }
	YY_BREAK


/*
	 * Copy everything until unquoted whitespace or end of line.  Quotes
	 * do not get stripped yet.
	 */
case 79:
YY_RULE_SETUP
#line 897 "psqlscan.l"
{
					yyless(0);
					return LEXRES_OK;
				}
	YY_BREAK
case 80:
YY_RULE_SETUP
#line 902 "psqlscan.l"
{
					/*
					 * unquoted backslash is end of command or next command,
					 * do not eat
					 *
					 * (this was not the behavior pre-8.0, but it seems
					 * consistent)
					 */
					yyless(0);
					return LEXRES_OK;
				}
	YY_BREAK
case 81:
YY_RULE_SETUP
#line 914 "psqlscan.l"
{
					*option_quote = '"';
					ECHO;
					BEGIN(xslashquotedarg);
				}
	YY_BREAK
case 82:
YY_RULE_SETUP
#line 920 "psqlscan.l"
{ ECHO; }
	YY_BREAK


/* double-quoted text within a default-type argument: copy */
case 83:
YY_RULE_SETUP
#line 927 "psqlscan.l"
{
					ECHO;
					BEGIN(xslashdefaultarg);
				}
	YY_BREAK
case 84:
YY_RULE_SETUP
#line 932 "psqlscan.l"
{ ECHO; }
	YY_BREAK


/* copy everything until end of input line */
/* but suppress leading whitespace */
case 85:
YY_RULE_SETUP
#line 940 "psqlscan.l"
{
					if (output_buf->len > 0)
						ECHO;
				}
	YY_BREAK
case 86:
YY_RULE_SETUP
#line 945 "psqlscan.l"
{ ECHO; }
	YY_BREAK


/* at end of command, eat a double backslash, but not anything else */
case 87:
YY_RULE_SETUP
#line 952 "psqlscan.l"
{ return LEXRES_OK; }
	YY_BREAK
case 88:
YY_RULE_SETUP
#line 954 "psqlscan.l"
{
					yyless(0);
					return LEXRES_OK;
				}
	YY_BREAK

case 89:
YY_RULE_SETUP
#line 961 "psqlscan.l"
YY_FATAL_ERROR( "flex scanner jammed" );
	YY_BREAK
#line 3342 "psqlscan.c"

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

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

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

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

			yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state();

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

			yy_next_state = yy_try_NUL_trans( yy_current_state );

			yy_bp = yytext_ptr + YY_MORE_ADJ;

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

			else
				{
				yy_cp = yy_c_buf_p;
				goto yy_find_action;
				}
			}

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

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

					yy_act = YY_STATE_EOF(YY_START);
					goto do_action;
					}

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

			case EOB_ACT_CONTINUE_SCAN:
				yy_c_buf_p =
					yytext_ptr + yy_amount_of_matched_text;

				yy_current_state = yy_get_previous_state();

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

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

				yy_current_state = yy_get_previous_state();

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

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


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

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

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

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

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

	/* Try to read more data. */

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

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

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

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

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

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

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

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

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

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

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

			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];

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

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

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

		yy_current_buffer->yy_n_chars = yy_n_chars;
		}

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

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

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

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

	yytext_ptr = &yy_current_buffer->yy_ch_buf[0];

	return ret_val;
	}


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

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

	yy_current_state = yy_start;

	for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
		{
		yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
		}

	return yy_current_state;
	}


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

#ifdef YY_USE_PROTOS
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
yy_state_type yy_current_state;
#endif
	{
	register int yy_is_jam;

	yy_current_state = yy_nxt[yy_current_state][1];
	yy_is_jam = (yy_current_state <= 0);

	return yy_is_jam ? 0 : yy_current_state;
	}


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

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

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

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

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

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

	*--yy_cp = (char) c;


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


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

	*yy_c_buf_p = yy_hold_char;

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

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

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

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

					/* fall through */

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

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

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

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


	return c;
	}


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

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


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

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

	yy_current_buffer = new_buffer;
	yy_load_buffer_state();

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


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


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

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

	b->yy_buf_size = size;

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

	b->yy_is_our_buffer = 1;

	yy_init_buffer( b, file );

	return b;
	}


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

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

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

	yy_flex_free( (void *) b );
	}


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

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


	{
	yy_flush_buffer( b );

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

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


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

	{
	if ( ! b )
		return;

	b->yy_n_chars = 0;

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

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

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

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


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

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

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

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

	yy_switch_to_buffer( b );

	return b;
	}
#endif


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

	return yy_scan_bytes( yy_str, len );
	}
#endif


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

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

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

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

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

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

	return b;
	}
#endif


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

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

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

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

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

	yy_start_stack[yy_start_stack_ptr++] = YY_START;

	BEGIN(new_state);
	}
#endif


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

	BEGIN(yy_start_stack[yy_start_stack_ptr]);
	}
#endif


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

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

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



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

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


/* Internal utility routines. */

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

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

	return n;
	}
#endif


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

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

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

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


/*
 * Create a lexer working state struct.
 */
PsqlScanState
psql_scan_create(void)
{
	PsqlScanState state;

	state = (PsqlScanStateData *) pg_malloc_zero(sizeof(PsqlScanStateData));

	psql_scan_reset(state);

	return state;
}

/*
 * Destroy a lexer working state struct, releasing all resources.
 */
void
psql_scan_destroy(PsqlScanState state)
{
	psql_scan_finish(state);

	psql_scan_reset(state);

	free(state);
}

/*
 * Set up to perform lexing of the given input line.
 *
 * The text at *line, extending for line_len bytes, will be scanned by
 * subsequent calls to the psql_scan routines.  psql_scan_finish should
 * be called when scanning is complete.  Note that the lexer retains
 * a pointer to the storage at *line --- this string must not be altered
 * or freed until after psql_scan_finish is called.
 */
void
psql_scan_setup(PsqlScanState state,
				const char *line, int line_len)
{
	/* Mustn't be scanning already */
	psql_assert(state->scanbufhandle == NULL);
	psql_assert(state->buffer_stack == NULL);

	/* Do we need to hack the character set encoding? */
	state->encoding = pset.encoding;
	state->safe_encoding = PG_VALID_BE_ENCODING(state->encoding);

	/* needed for prepare_buffer */
	cur_state = state;

	/* Set up flex input buffer with appropriate translation and padding */
	state->scanbufhandle = prepare_buffer(line, line_len,
										  &state->scanbuf);
	state->scanline = line;

	/* Set lookaside data in case we have to map unsafe encoding */
	state->curline = state->scanbuf;
	state->refline = state->scanline;
}

/*
 * Do lexical analysis of SQL command text.
 *
 * The text previously passed to psql_scan_setup is scanned, and appended
 * (possibly with transformation) to query_buf.
 *
 * The return value indicates the condition that stopped scanning:
 *
 * PSCAN_SEMICOLON: found a command-ending semicolon.  (The semicolon is
 * transferred to query_buf.)  The command accumulated in query_buf should
 * be executed, then clear query_buf and call again to scan the remainder
 * of the line.
 *
 * PSCAN_BACKSLASH: found a backslash that starts a psql special command.
 * Any previous data on the line has been transferred to query_buf.
 * The caller will typically next call psql_scan_slash_command(),
 * perhaps psql_scan_slash_option(), and psql_scan_slash_command_end().
 *
 * PSCAN_INCOMPLETE: the end of the line was reached, but we have an
 * incomplete SQL command.  *prompt is set to the appropriate prompt type.
 *
 * PSCAN_EOL: the end of the line was reached, and there is no lexical
 * reason to consider the command incomplete.  The caller may or may not
 * choose to send it.  *prompt is set to the appropriate prompt type if
 * the caller chooses to collect more input.
 *
 * In the PSCAN_INCOMPLETE and PSCAN_EOL cases, psql_scan_finish() should
 * be called next, then the cycle may be repeated with a fresh input line.
 *
 * In all cases, *prompt is set to an appropriate prompt type code for the
 * next line-input operation.
 */
PsqlScanResult
psql_scan(PsqlScanState state,
		  PQExpBuffer query_buf,
		  promptStatus_t *prompt)
{
	PsqlScanResult result;
	int			lexresult;

	/* Must be scanning already */
	psql_assert(state->scanbufhandle);

	/* Set up static variables that will be used by yylex */
	cur_state = state;
	output_buf = query_buf;

	if (state->buffer_stack != NULL)
		yy_switch_to_buffer(state->buffer_stack->buf);
	else
		yy_switch_to_buffer(state->scanbufhandle);

	BEGIN(state->start_state);

	/* And lex. */
	lexresult = yylex();

	/* Update static vars back to the state struct */
	state->start_state = YY_START;

	/*
	 * Check termination state and return appropriate result info.
	 */
	switch (lexresult)
	{
		case LEXRES_EOL:		/* end of input */
			switch (state->start_state)
			{
				case INITIAL:
					if (state->paren_depth > 0)
					{
						result = PSCAN_INCOMPLETE;
						*prompt = PROMPT_PAREN;
					}
					else if (query_buf->len > 0)
					{
						result = PSCAN_EOL;
						*prompt = PROMPT_CONTINUE;
					}
					else
					{
						/* never bother to send an empty buffer */
						result = PSCAN_INCOMPLETE;
						*prompt = PROMPT_READY;
					}
					break;
				case xb:
					result = PSCAN_INCOMPLETE;
					*prompt = PROMPT_SINGLEQUOTE;
					break;
				case xc:
					result = PSCAN_INCOMPLETE;
					*prompt = PROMPT_COMMENT;
					break;
				case xd:
					result = PSCAN_INCOMPLETE;
					*prompt = PROMPT_DOUBLEQUOTE;
					break;
				case xh:
					result = PSCAN_INCOMPLETE;
					*prompt = PROMPT_SINGLEQUOTE;
					break;
				case xq:
					result = PSCAN_INCOMPLETE;
					*prompt = PROMPT_SINGLEQUOTE;
					break;
				case xdolq:
					result = PSCAN_INCOMPLETE;
					*prompt = PROMPT_DOLLARQUOTE;
					break;
				default:
					/* can't get here */
					fprintf(stderr, "invalid YY_START\n");
					exit(1);
			}
			break;
		case LEXRES_SEMI:		/* semicolon */
			result = PSCAN_SEMICOLON;
			*prompt = PROMPT_READY;
			break;
		case LEXRES_BACKSLASH:	/* backslash */
			result = PSCAN_BACKSLASH;
			*prompt = PROMPT_READY;
			break;
		default:
			/* can't get here */
			fprintf(stderr, "invalid yylex result\n");
			exit(1);
	}

	return result;
}

/*
 * Clean up after scanning a string.  This flushes any unread input and
 * releases resources (but not the PsqlScanState itself).  Note however
 * that this does not reset the lexer scan state; that can be done by
 * psql_scan_reset(), which is an orthogonal operation.
 *
 * It is legal to call this when not scanning anything (makes it easier
 * to deal with error recovery).
 */
void
psql_scan_finish(PsqlScanState state)
{
	/* Drop any incomplete variable expansions. */
	while (state->buffer_stack != NULL)
	{
		StackElem  *stackelem = state->buffer_stack;

		state->buffer_stack = stackelem->next;
		yy_delete_buffer(stackelem->buf);
		free(stackelem->bufstring);
		if (stackelem->origstring)
			free(stackelem->origstring);
		free(stackelem);
	}

	/* Done with the outer scan buffer, too */
	if (state->scanbufhandle)
		yy_delete_buffer(state->scanbufhandle);
	state->scanbufhandle = NULL;
	if (state->scanbuf)
		free(state->scanbuf);
	state->scanbuf = NULL;
}

/*
 * Reset lexer scanning state to start conditions.  This is appropriate
 * for executing \r psql commands (or any other time that we discard the
 * prior contents of query_buf).  It is not, however, necessary to do this
 * when we execute and clear the buffer after getting a PSCAN_SEMICOLON or
 * PSCAN_EOL scan result, because the scan state must be INITIAL when those
 * conditions are returned.
 *
 * Note that this is unrelated to flushing unread input; that task is
 * done by psql_scan_finish().
 */
void
psql_scan_reset(PsqlScanState state)
{
	state->start_state = INITIAL;
	state->paren_depth = 0;
	state->xcdepth = 0;			/* not really necessary */
	if (state->dolqstart)
		free(state->dolqstart);
	state->dolqstart = NULL;
}

/*
 * Return true if lexer is currently in an "inside quotes" state.
 *
 * This is pretty grotty but is needed to preserve the old behavior
 * that mainloop.c drops blank lines not inside quotes without even
 * echoing them.
 */
bool
psql_scan_in_quote(PsqlScanState state)
{
	return state->start_state != INITIAL;
}

/*
 * Scan the command name of a psql backslash command.  This should be called
 * after psql_scan() returns PSCAN_BACKSLASH.  It is assumed that the input
 * has been consumed through the leading backslash.
 *
 * The return value is a malloc'd copy of the command name, as parsed off
 * from the input.
 */
char *
psql_scan_slash_command(PsqlScanState state)
{
	PQExpBufferData mybuf;
	int			lexresult;

	/* Must be scanning already */
	psql_assert(state->scanbufhandle);

	/* Build a local buffer that we'll return the data of */
	initPQExpBuffer(&mybuf);

	/* Set up static variables that will be used by yylex */
	cur_state = state;
	output_buf = &mybuf;

	if (state->buffer_stack != NULL)
		yy_switch_to_buffer(state->buffer_stack->buf);
	else
		yy_switch_to_buffer(state->scanbufhandle);

	BEGIN(xslashcmd);

	/* And lex. */
	lexresult = yylex();

	/* There are no possible errors in this lex state... */

	return mybuf.data;
}

/*
 * Parse off the next argument for a backslash command, and return it as a
 * malloc'd string.  If there are no more arguments, returns NULL.
 *
 * type tells what processing, if any, to perform on the option string;
 * for example, if it's a SQL identifier, we want to downcase any unquoted
 * letters.
 *
 * if quote is not NULL, *quote is set to 0 if no quoting was found, else
 * the quote symbol.
 *
 * if semicolon is true, unquoted trailing semicolon(s) that would otherwise
 * be taken as part of the option string will be stripped.
 *
 * NOTE: the only possible syntax errors for backslash options are unmatched
 * quotes, which are detected when we run out of input.  Therefore, on a
 * syntax error we just throw away the string and return NULL; there is no
 * need to worry about flushing remaining input.
 */
char *
psql_scan_slash_option(PsqlScanState state,
					   enum slash_option_type type,
					   char *quote,
					   bool semicolon)
{
	PQExpBufferData mybuf;
	int			lexresult;
	char		local_quote;
	bool		badarg;

	/* Must be scanning already */
	psql_assert(state->scanbufhandle);

	if (quote == NULL)
		quote = &local_quote;
	*quote = 0;

	/* Build a local buffer that we'll return the data of */
	initPQExpBuffer(&mybuf);

	/* Set up static variables that will be used by yylex */
	cur_state = state;
	output_buf = &mybuf;
	option_type = type;
	option_quote = quote;

	if (state->buffer_stack != NULL)
		yy_switch_to_buffer(state->buffer_stack->buf);
	else
		yy_switch_to_buffer(state->scanbufhandle);

	if (type == OT_WHOLE_LINE)
		BEGIN(xslashwholeline);
	else
		BEGIN(xslasharg);

	/* And lex. */
	lexresult = yylex();

	/*
	 * Check the lex result: we should have gotten back either LEXRES_OK
	 * or LEXRES_EOL (the latter indicating end of string).  If we were inside
	 * a quoted string, as indicated by YY_START, EOL is an error.
	 */
	psql_assert(lexresult == LEXRES_EOL || lexresult == LEXRES_OK);
	badarg = false;
	switch (YY_START)
	{
		case xslasharg:
			/* empty arg, or possibly a psql variable substitution */
			break;
		case xslashquote:
			if (lexresult != LEXRES_OK)
				badarg = true;		/* hit EOL not ending quote */
			break;
		case xslashbackquote:
			if (lexresult != LEXRES_OK)
				badarg = true;		/* hit EOL not ending quote */
			else
			{
				/* Perform evaluation of backticked command */
				char	   *cmd = mybuf.data;
				FILE	   *fd;
				bool		error = false;
				PQExpBufferData output;
				char		buf[512];
				size_t		result;

				fd = popen(cmd, PG_BINARY_R);
				if (!fd)
				{
					psql_error("%s: %s\n", cmd, strerror(errno));
					error = true;
				}

				initPQExpBuffer(&output);

				if (!error)
				{
					do
					{
						result = fread(buf, 1, sizeof(buf), fd);
						if (ferror(fd))
						{
							psql_error("%s: %s\n", cmd, strerror(errno));
							error = true;
							break;
						}
						appendBinaryPQExpBuffer(&output, buf, result);
					} while (!feof(fd));
				}

				if (fd && pclose(fd) == -1)
				{
					psql_error("%s: %s\n", cmd, strerror(errno));
					error = true;
				}

				/* Now done with cmd, transfer result to mybuf */
				resetPQExpBuffer(&mybuf);

				if (!error)
				{
					/* strip any trailing newline */
					if (output.len > 0 &&
						output.data[output.len - 1] == '\n')
						output.len--;
					appendBinaryPQExpBuffer(&mybuf, output.data, output.len);
				}

				termPQExpBuffer(&output);
			}
			break;
		case xslashdefaultarg:
			/* Strip any trailing semi-colons if requested */
			if (semicolon)
			{
				while (mybuf.len > 0 &&
					   mybuf.data[mybuf.len - 1] == ';')
				{
					mybuf.data[--mybuf.len] = '\0';
				}
			}

			/*
			 * If SQL identifier processing was requested, then we strip out
			 * excess double quotes and downcase unquoted letters.
			 * Doubled double-quotes become output double-quotes, per spec.
			 *
			 * Note that a string like FOO"BAR"BAZ will be converted to
			 * fooBARbaz; this is somewhat inconsistent with the SQL spec,
			 * which would have us parse it as several identifiers.  But
			 * for psql's purposes, we want a string like "foo"."bar" to
			 * be treated as one option, so there's little choice.
			 */
			if (type == OT_SQLID || type == OT_SQLIDHACK)
			{
				bool		inquotes = false;
				char	   *cp = mybuf.data;

				while (*cp)
				{
					if (*cp == '"')
					{
						if (inquotes && cp[1] == '"')
						{
							/* Keep the first quote, remove the second */
							cp++;
						}
						inquotes = !inquotes;
						/* Collapse out quote at *cp */
						memmove(cp, cp + 1, strlen(cp));
						mybuf.len--;
						/* do not advance cp */
					}
					else
					{
						if (!inquotes && type == OT_SQLID)
							*cp = pg_tolower((unsigned char) *cp);
						cp += PQmblen(cp, pset.encoding);
					}
				}
			}
			break;
		case xslashquotedarg:
			/* must have hit EOL inside double quotes */
			badarg = true;
			break;
		case xslashwholeline:
			/* always okay */
			break;
		default:
			/* can't get here */
			fprintf(stderr, "invalid YY_START\n");
			exit(1);
	}

	if (badarg)
	{
		psql_error("unterminated quoted string\n");
		termPQExpBuffer(&mybuf);
		return NULL;
	}

	/*
	 * An unquoted empty argument isn't possible unless we are at end of
	 * command.  Return NULL instead.
	 */
	if (mybuf.len == 0 && *quote == 0)
	{
		termPQExpBuffer(&mybuf);
		return NULL;
	}

	/* Else return the completed string. */
	return mybuf.data;
}

/*
 * Eat up any unused \\ to complete a backslash command.
 */
void
psql_scan_slash_command_end(PsqlScanState state)
{
	int			lexresult;

	/* Must be scanning already */
	psql_assert(state->scanbufhandle);

	/* Set up static variables that will be used by yylex */
	cur_state = state;
	output_buf = NULL;

	if (state->buffer_stack != NULL)
		yy_switch_to_buffer(state->buffer_stack->buf);
	else
		yy_switch_to_buffer(state->scanbufhandle);

	BEGIN(xslashend);

	/* And lex. */
	lexresult = yylex();

	/* There are no possible errors in this lex state... */
}

/*
 * "Push back" the passed string so that it will be rescanned by subsequent
 * psql_scan_slash_option calls.  This is presently only used in the case
 * where a single-letter command has been concatenated with its argument.
 *
 * We use the same buffer stack mechanism as for variable expansion.
 */
void
psql_scan_slash_pushback(PsqlScanState state, const char *str)
{
	/* needed for push_new_buffer */
	cur_state = state;

	push_new_buffer(str);
}


/*
 * Push the given string onto the stack of stuff to scan.
 *
 * cur_state must point to the active PsqlScanState.
 *
 * NOTE SIDE EFFECT: the new buffer is made the active flex input buffer.
 */
static void
push_new_buffer(const char *newstr)
{
	StackElem  *stackelem;

	stackelem = (StackElem *) pg_malloc(sizeof(StackElem));
	stackelem->buf = prepare_buffer(newstr, strlen(newstr),
									&stackelem->bufstring);
	cur_state->curline = stackelem->bufstring;
	if (cur_state->safe_encoding)
	{
		stackelem->origstring = NULL;
		cur_state->refline = stackelem->bufstring;
	}
	else
	{
		stackelem->origstring = pg_strdup(newstr);
		cur_state->refline = stackelem->origstring;
	}
	stackelem->next = cur_state->buffer_stack;
	cur_state->buffer_stack = stackelem;
}

/*
 * Set up a flex input buffer to scan the given data.  We always make a
 * copy of the data.  If working in an unsafe encoding, the copy has
 * multibyte sequences replaced by FFs to avoid fooling the lexer rules.
 *
 * cur_state must point to the active PsqlScanState.
 *
 * NOTE SIDE EFFECT: the new buffer is made the active flex input buffer.
 */
static YY_BUFFER_STATE
prepare_buffer(const char *txt, int len, char **txtcopy)
{
	char	   *newtxt;

	/* Flex wants two \0 characters after the actual data */
	newtxt = pg_malloc(len + 2);
	*txtcopy = newtxt;
	newtxt[len] = newtxt[len + 1] = YY_END_OF_BUFFER_CHAR;

	if (cur_state->safe_encoding)
		memcpy(newtxt, txt, len);
	else
	{
		/* Gotta do it the hard way */
		int		i = 0;

		while (i < len)
		{
			int		thislen = PQmblen(txt + i, cur_state->encoding);

			/* first byte should always be okay... */
			newtxt[i] = txt[i];
			i++;
			while (--thislen > 0)
				newtxt[i++] = (char) 0xFF;
		}
	}

	return yy_scan_buffer(newtxt, len + 2);
}

/*
 * emit() --- body for ECHO macro
 *
 * NB: this must be used for ALL and ONLY the text copied from the flex
 * input data.  If you pass it something that is not part of the yytext
 * string, you are making a mistake.  Internally generated text can be
 * appended directly to output_buf.
 */
static void
emit(const char *txt, int len)
{
	if (cur_state->safe_encoding)
		appendBinaryPQExpBuffer(output_buf, txt, len);
	else
	{
		/* Gotta do it the hard way */
		const char *reference = cur_state->refline;
		int		i;

		reference += (txt - cur_state->curline);

		for (i = 0; i < len; i++)
		{
			char	ch = txt[i];

			if (ch == (char) 0xFF)
				ch = reference[i];
			appendPQExpBufferChar(output_buf, ch);
		}
	}
}
