
#line 2 "<stdout>"

#define  YY_INT_ALIGNED short int

/* A lexical scanner generated by flex */

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6
#define YY_FLEX_SUBMINOR_VERSION 4
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif

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

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

/* end standard C headers. */

/* flex integer type definitions */

#ifndef FLEXINT_H
#define FLEXINT_H

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

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

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

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

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

#ifndef SIZE_MAX
#define SIZE_MAX               (~(size_t)0)
#endif

#endif /* ! C99 */

#endif /* ! FLEXINT_H */

/* begin standard C++ headers. */

/* TODO: this is always defined, so inline it */
#define yyconst const

#if defined(__GNUC__) && __GNUC__ >= 3
#define yynoreturn __attribute__((__noreturn__))
#else
#define yynoreturn
#endif

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

/* Promotes a possibly negative, possibly signed char to an
 *   integer in range [0..255] for use as an array index.
 */
#define YY_SC_TO_UI(c) ((YY_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. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
 * Ditto for the __ia64__ case accordingly.
 */
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif

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

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

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

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
    
    #define YY_LESS_LINENO(n)
    #define YY_LINENO_REWIND_TO(ptr)
    
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up yytext. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
		*yy_cp = (yy_hold_char); \
		YY_RESTORE_YY_MORE_OFFSET \
		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
		} \
	while ( 0 )
#define unput(c) yyunput( c, (yytext_ptr)  )

#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
	{
	FILE *yy_input_file;

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

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

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

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

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

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

    int yy_bs_lineno; /**< The line count. */
    int yy_bs_column; /**< The column count. */

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

	int yy_buffer_status;

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

	};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */

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

/* We provide macros for accessing buffer states in case in the
 * future we want to put the buffer states in a more general
 * "scanner state".
 *
 * Returns the top of the stack, or NULL.
 */
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
                          : NULL)
/* Same as previous macro, but useful when we know that the buffer stack is not
 * NULL or when we need an lvalue. For internal use only.
 */
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]

/* yy_hold_char holds the character lost when 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 = NULL;
static int yy_init = 0;		/* 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 ( FILE *input_file  );
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer  );
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size  );
void yy_delete_buffer ( YY_BUFFER_STATE b  );
void yy_flush_buffer ( YY_BUFFER_STATE b  );
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer  );
void yypop_buffer_state ( void );

static void yyensure_buffer_stack ( void );
static void yy_load_buffer_state ( void );
static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file  );
#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )

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

void *yyalloc ( yy_size_t  );
void *yyrealloc ( void *, yy_size_t  );
void yyfree ( void *  );

#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){ \
        yyensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            yy_create_buffer( yyin, YY_BUF_SIZE ); \
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
	}
#define yy_set_bol(at_bol) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){\
        yyensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            yy_create_buffer( yyin, YY_BUF_SIZE ); \
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
	}
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

/* Begin user sect3 */

#define yywrap() (/*CONSTCOND*/1)
#define YY_SKIP_YYWRAP
typedef flex_uint8_t YY_CHAR;

FILE *yyin = NULL, *yyout = NULL;

typedef int yy_state_type;

extern int yylineno;
int yylineno = 1;

extern char *yytext;
#ifdef yytext_ptr
#undef yytext_ptr
#endif
#define yytext_ptr yytext

static yy_state_type yy_get_previous_state ( void );
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  );
static int yy_get_next_buffer ( void );
static void yynoreturn yy_fatal_error ( const 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 145
#define YY_END_OF_BUFFER 146
/* This struct is not used in this scanner,
   but its presence is necessary. */
struct yy_trans_info
	{
	flex_int32_t yy_verify;
	flex_int32_t yy_nxt;
	};
static const flex_int16_t yy_acclist[565] =
    {   0,
      143,  143,  146,  138,  145,  141,  145,  142,  145,   23,
      138,  145,  138,  145,  138,  145,  138,  145,  138,  145,
      138,  145,  138,  145,   52,  145,   38,   52,  145,   50,
      145,   51,   52,  145,   52,  145,   52,  145,   52,  145,
       42,  145,   45,  145,   46,  145,   42,  145,   68,  145,
      145,   56,   68,  145,   57,   68,  145,   56,   68,  145,
       56,   68,  145,   56,   68,  145,   56,   68,  145,   56,
       68,  145,   68,  145,   66,   68,  145,   67,  145,   67,
       68,  145,   68,  145,   61,   68,  145,   63,   68,  145,
       62,   68,  145,   69,  145,   70,  145,   70,  145,  117,

      118,  145,  118,  145,  126,  145,  124,  126,  145,  125,
      145,  125,  126,  145,  123,  126,  145,  126,  145,  135,
      145,  130,  135,  145,  134,  145,  134,  135,  145,  128,
      135,  145,  135,  145,  131,  135,  145,  133,  135,  145,
      132,  135,  145,  135,  145,    5,  145,    8,  145,    9,
      145,    5,  145,   88,  145,   91,  145,   92,  145,   88,
      145,   13,  145,   16,  145,   17,  145,   13,  145,   13,
      145,   32,  145,   29,  145,   30,   32,  145,   31,   32,
      145,   32,  145,  143,  145,  144,  145,  144,  145,  101,
      145,  100,  145,  100,  101,  145,   82,  101,  145,  104,

      145,  103,  145,  103,  104,  145,   83,  104,  145,  138,
      145,  138,  145,   94,  145,   97,  145,   98,  145,   94,
      145,   94,  145,   94,  145,  107,  145,  106,  145,  106,
      107,  145,   84,  107,  145,   85,  107,  145,  138,  145,
      138,  145,   94,  145,  139,  140,   12,    4,    3,  121,
      115,  116,  120,  115,  115,  115,  115,  115,  115,  115,
      115,   49,   48,   36,   41,   39,   35,   35,   35,   35,
       35,   35,   43,   44,   47,   56,   56,   55,   56,   56,
       56,   56,   56,   56,   56,   59,   66,   67,   67,   65,
       64,   61,   61,   60,   63,   62,   69,   70,  117,  124,

      125,  125,  137,  136,  130,  134,  134,  128,  127,    6,
        7,   10,   89,   90,   93,   14,   15,   18,   21,   20,
       20,   20,   20,   20,   20,   28,   27,   25,   24,   26,
      143,  144,   82,   83,  115,   95,   96,   87,   86,   84,
       85,  115,   11,    3,  115,  119,  115,  115,  115,  115,
      115,  115,  115,  115,  115,  115,   39,   35,   35,   35,
       35,   35,   35,   35,   35,   55,   56,   56,   56,   56,
       56,   56,   56,   56,   58,   64,   60,   60,  136,  129,
       20,   20,   20,   20,   20,   20,   20,   20,  115,  115,
       86,  115,  122,  119,  115,  115,  115,  115,  115,  115,

      115,  115,  115,  115,  115,   40,   37,   35,   35,   35,
       35,   35,   35,   35,   35,   56,   54,   56,   56,   56,
       56,   56,   56,   56,   58,   22,   20,   20,   20,   20,
       20,   20,   20,   20,  115,  115,  115,  115,  112,  114,
      115,  115,  115,  115,  115,  115,  114,  115,  115,  115,
        1,  114,  115,  115,   35,   34,   35,   35,   35,   35,
       35,   35,   35,   56,   54,   56,   56,   56,   20,   19,
       20,   20,   20,   20,   20,   20,   20,   79,  112,  114,
      115,  115,  115,   81,   80,  110,  112,  114,  115,  115,
      110,  115,  108,  114,  115,  113,  114,  115,  102,  114,

      115,  115,  115,  114,  115,    1,  115,    1,    1,  115,
      115,   35,   35,   35,   56,   20,   20,   20,  108,  114,
      115,   99,  113,  114,  115,   99,  108,  114,  115,  114,
      115,   72,  105,  114,  115,  115,  115,    2,  115,   35,
       20,   76,   78,   74,   77,   53,  111,   73,   71,    2,
       33,  114,  115,    2,    2,  115,   75,  109,  111,   71,
       71,   71,   33,  109
    } ;

static const flex_int16_t yy_accept[502] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    3,    3,    3,    3,    3,    3,    3,    3,
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
        3,    4,    6,    8,   10,   13,   15,   17,   19,   21,
       23,   25,   27,   30,   32,   35,   37,   39,   41,   43,
       45,   47,   49,   51,   52,   55,   58,   61,   64,   67,
       70,   73,   75,   78,   80,   83,   85,   88,   91,   94,
       96,   98,  100,  103,  105,  107,  110,  112,  115,  118,

      120,  122,  125,  127,  130,  133,  135,  138,  141,  144,
      146,  148,  150,  152,  154,  156,  158,  160,  162,  164,
      166,  168,  170,  172,  174,  176,  179,  182,  184,  186,
      188,  190,  192,  194,  197,  200,  202,  204,  207,  210,
      212,  214,  216,  218,  220,  222,  224,  226,  228,  230,
      233,  236,  239,  241,  243,  245,  246,  247,  248,  249,
      250,  251,  252,  253,  254,  255,  256,  257,  258,  259,
      259,  259,  259,  259,  260,  261,  262,  263,  264,  264,
      265,  266,  267,  267,  268,  269,  270,  271,  272,  273,
      274,  275,  276,  277,  278,  279,  280,  281,  282,  283,

      284,  285,  286,  286,  287,  288,  289,  290,  291,  292,
      293,  294,  295,  296,  297,  298,  298,  299,  300,  301,
      302,  303,  304,  305,  306,  307,  308,  309,  310,  310,
      311,  312,  313,  314,  315,  316,  317,  318,  319,  320,
      321,  321,  322,  323,  324,  325,  326,  327,  328,  329,
      330,  331,  332,  333,  334,  335,  336,  337,  338,  339,
      340,  340,  340,  340,  341,  342,  343,  343,  343,  344,
      345,  346,  346,  347,  348,  349,  350,  351,  352,  353,
      354,  354,  354,  354,  355,  356,  357,  357,  357,  358,
      358,  358,  359,  360,  361,  362,  363,  364,  365,  366,

      367,  368,  369,  370,  371,  372,  373,  374,  375,  376,
      377,  378,  379,  380,  381,  382,  382,  383,  384,  385,
      386,  387,  388,  389,  390,  391,  392,  392,  392,  392,
      392,  393,  393,  394,  395,  396,  397,  398,  399,  400,
      401,  402,  403,  403,  403,  403,  404,  405,  406,  407,
      408,  409,  410,  411,  412,  413,  414,  415,  416,  417,
      419,  420,  421,  422,  423,  424,  425,  426,  427,  428,
      429,  430,  431,  432,  433,  434,  435,  436,  437,  437,
      437,  437,  437,  437,  438,  438,  439,  442,  443,  444,
      445,  446,  447,  449,  450,  450,  450,  450,  451,  454,

      455,  456,  458,  459,  460,  461,  462,  463,  464,  465,
      467,  468,  469,  470,  472,  473,  474,  475,  476,  477,
      478,  482,  483,  484,  485,  485,  485,  485,  485,  486,
      486,  490,  491,  492,  492,  493,  496,  499,  502,  503,
      504,  506,  506,  507,  507,  508,  509,  511,  512,  513,
      514,  515,  516,  517,  518,  519,  522,  526,  526,  527,
      527,  527,  527,  530,  530,  532,  532,  533,  536,  537,
      537,  537,  537,  538,  540,  541,  542,  543,  544,  545,
      545,  546,  546,  547,  548,  549,  550,  550,  551,  554,
      555,  557,  558,  559,  560,  561,  562,  563,  564,  565,

      565
    } ;

static const YY_CHAR yy_ec[256] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    2,    3,    4,
        1,    2,    5,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    3,    1,    6,    1,    7,    1,    1,    8,    9,
       10,   11,    1,   12,    1,    1,   13,   14,   14,   14,
       14,   14,   14,   14,   14,   14,   14,    1,    1,    1,
       15,    1,    1,    1,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
        1,   17,    1,    1,   18,   19,   20,   16,   21,   22,

       23,   24,   25,   16,   26,   16,   16,   27,   28,   29,
       16,   30,   16,   31,   32,   16,   33,   16,   16,   16,
       16,   16,   34,    1,   35,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,

        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1
    } ;

static const YY_CHAR yy_meta[36] =
    {   0,
        1,    2,    2,    3,    4,    5,    6,    1,    7,    8,
        1,    8,    1,    9,   10,   11,    1,   12,    1,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
       11,   11,   11,    1,    1
    } ;

static const flex_int16_t yy_base[551] =
    {   0,
        0,   18,   36,   54,    3,    6,   73,    0,   30,   41,
      108,    0,  142,  154,   11,   21,   48,   59,  166,  178,
      190,  224,   25,   43,   61,  173,  200,  202,  144,  168,
       64,   66,  259,    0,  294,    0,  212, 1430,  204,  234,
      236,  238,  329,    0,  349,    0,  381, 1429,  382,  384,
     1447, 1450, 1441, 1441, 1450, 1433,  140,  398,  388,  390,
      218, 1450, 1450, 1438, 1438, 1435,  149,  426, 1450, 1435,
     1435, 1425, 1450, 1450,  396, 1450,  431,  433,  384,  412,
      136,    0,  186,  441,  453,  199,  448,  462,  464, 1432,
     1431,  464,    0, 1450, 1450,  468,  470,  474, 1450,  205,

     1450,  477,  479,  483, 1429,    0, 1450, 1450, 1450,  209,
     1450, 1429, 1429, 1419, 1450, 1426, 1426, 1416, 1450, 1423,
     1423, 1416,  482, 1450, 1420, 1420, 1450,  477,    0, 1418,
     1418, 1450, 1450, 1450,    0, 1450, 1450, 1450,    0, 1398,
      493, 1450, 1415, 1415,  239,  435,  466, 1450, 1450, 1450,
        0,    0, 1395, 1394,  467, 1450, 1450,  515, 1450,    0,
     1450,    0, 1397,    0, 1392,  227,  471, 1388, 1384,  519,
     1386,  524,  502,  506, 1385, 1379, 1450, 1450, 1403, 1450,
     1397,    0, 1388,    0, 1383,  339,  507, 1379, 1375, 1450,
     1450, 1450,  531,  367,  537,  517,  518,  526,  527,  530,

      383,  536,  558,  564,  566,  568,  572, 1450,    0,  574,
      576,  578,  580,  582, 1398, 1397, 1450,    0,  584,  590,
      592, 1450,    0,  594,  596,  598, 1395, 1450, 1383, 1450,
     1450, 1450, 1450, 1450, 1450, 1450, 1450, 1450, 1450,    0,
     1367, 1361,  418,  513, 1357, 1343, 1450, 1450, 1450, 1450,
     1450,    0, 1450,    0,    0,  535, 1450, 1450, 1450,    0,
      561, 1343,  575,    0,    0,  576,  579,  607, 1450,    0,
        0, 1359,    0, 1340, 1328, 1337,  168, 1337, 1328, 1334,
     1326, 1328, 1322, 1328, 1319, 1327, 1335,  600,    0, 1326,
      601,    0, 1320, 1311, 1320,  590, 1317, 1308, 1314,  612,

      595,  600,  604,  605,  613,  589,  614,  621,  636,    0,
      643,  649,    0, 1450,    0, 1329, 1310, 1301, 1310,  625,
     1310, 1291, 1293, 1281, 1290,    0, 1270, 1279,  627, 1264,
     1262, 1261, 1450,    0, 1257,  632, 1256, 1252, 1237, 1231,
     1230, 1221, 1210, 1201, 1199, 1191, 1188, 1184, 1197, 1450,
     1172,  634, 1171, 1169, 1168, 1162, 1162, 1160,  632,  660,
      641,  647,  648,  655,  652,  659,  664, 1450, 1156,  664,
     1152, 1153, 1153, 1144, 1146, 1145,  666, 1132,  668, 1131,
     1123, 1123,  670,  672,  674, 1105,    0, 1109, 1098, 1097,
     1097, 1076,    0, 1078, 1074, 1076, 1073, 1064,  700, 1059,

     1057,    0, 1057, 1055, 1052, 1052, 1041, 1047,  713,  735,
      717,  721, 1041,    0, 1045, 1044, 1043,  815,  754,  738,
        0,  736,  725, 1450,  723,  721,  715,  681, 1450,  675,
        0,  656, 1450,  649,  641,  749,    0,  751,  629,  614,
      753,  592,    0,  544,  530,    0,    0,  504,  478,  473,
      469,  734,  451,  413,  384,  756,    0,  762, 1450,  764,
      378,  766,  768,  770,  772,  774,  776,  778,  362,  780,
      224,  215,  178,  783,  163,  153,  817,  819,  821,  823,
      825,  827,  829,    0,  831,  834,    5,    0,    0,    0,
        0,  868,    0,    0,    0,  870,    0, 1450,    0, 1450,

      873,  885,  897,  909,  921,  933,  945,  957,  969,  981,
      993, 1005, 1017, 1029, 1041, 1053, 1061, 1071, 1083, 1094,
     1106, 1118, 1130, 1142, 1154, 1161, 1168, 1175, 1182, 1194,
     1201, 1203, 1215, 1227, 1239, 1243, 1255, 1267, 1279, 1286,
     1298, 1305, 1317, 1328, 1339, 1350, 1357, 1369, 1376, 1388
    } ;

static const flex_int16_t yy_def[551] =
    {   0,
      501,  501,  502,  502,  503,  503,  500,    7,  504,  504,
      500,   11,  505,  505,  506,  506,  507,  507,  508,  508,
      509,  509,  510,  510,  511,  511,  512,  512,  513,  513,
      514,  514,  500,   33,  500,   35,    2,    2,  515,  515,
      515,  515,  500,   43,   43,   45,    2,    2,  515,  515,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
       58,  500,  500,  500,  500,  516,  500,  517,  500,  500,
      500,  500,  500,  500,  518,  500,  518,  518,   78,   78,
       78,  519,  500,  500,  500,  500,  520,  500,  500,  521,
      500,  521,  522,  500,  500,  500,  500,  500,  500,  500,

      500,  500,  500,  500,  523,  524,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  525,  500,
      500,  500,  500,  500,  526,  500,  500,  500,  527,   58,
       58,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      528,  529,   58,  141,  500,  500,  500,  500,  500,  530,
      500,  531,  500,  532,  531,  531,  531,  531,  531,  500,
      500,  500,  500,  531,  531,  531,  500,  500,  516,  500,
      533,  534,  535,  536,  536,  536,  536,  536,  536,  500,
      500,  500,  500,   78,  500,   78,   78,   78,   78,   78,

       78,   78,  519,  500,  500,  500,  500,  500,  537,  500,
      520,  538,  500,  500,  521,  521,  500,  522,  500,  500,
      500,  500,  539,  500,  500,  500,  523,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  540,
      500,  540,  540,  540,  540,  540,  500,  500,  500,  500,
      500,  525,  500,  526,  527,  531,  500,  500,  500,  541,
      500,  500,  500,  528,  529,  531,  500,  500,  500,  530,
      531,  500,  542,  531,  531,  531,  531,  531,  531,  531,
      500,  500,  500,  531,  531,  531,  533,  533,  534,  535,
      535,  536,  536,  536,  536,  536,  536,  536,  536,  500,

       78,   78,   78,   78,   78,   78,   78,   78,  500,  537,
      538,  538,  539,  500,  540,  500,  540,  540,  540,  540,
      540,  540,  540,  531,  531,  541,  500,  500,  500,  500,
      531,  500,  500,  542,  531,  531,  531,  531,  531,  531,
      531,  531,  500,  500,  500,  531,  531,  531,  533,  500,
      536,  536,  536,  536,  536,  536,  536,  536,   78,  518,
       78,   78,   78,   78,   78,   78,  500,  500,  540,  540,
      540,  540,  540,  540,  540,  540,  531,  531,  500,  500,
      500,  500,  500,  531,  500,  531,  531,  531,  531,  531,
      531,  531,  531,  531,  500,  500,  500,  531,  500,  531,

      536,  536,  536,  536,  536,  536,  536,  536,   78,  500,
       78,   78,  540,  540,  540,  540,  540,  540,  540,  540,
      531,  531,  531,  500,  500,  500,  500,  500,  500,  500,
      531,  531,  500,  500,  531,  531,  531,  531,  531,  531,
      531,  500,  543,  500,  531,  543,  399,  531,  536,  536,
      536,   78,  540,  540,  540,  531,  531,  500,  500,  500,
      500,  500,  531,  500,  531,  544,  500,  531,  531,  545,
      500,  500,  531,  500,  536,  540,  500,  500,  500,  500,
      500,  546,  500,  547,  500,  500,  500,  548,  531,  548,
      474,  500,  549,  547,  550,  550,  486,  500,  549,    0,

      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500
    } ;

static const flex_int16_t yy_nxt[1486] =
    {   0,
      500,  204,  204,   53,   54,   55,   70,   71,   56,   70,
       71,  500,   57,   72,   91,   92,   72,  500,   58,   59,
       60,   53,   54,   55,   91,   92,   56,  498,  112,  113,
       57,   73,   73,   74,   73,  114,   61,   63,   63,   64,
       65,   66,   73,   73,   74,   73,  112,  113,   67,   94,
       94,   74,   94,  114,   68,   63,   63,   64,   65,   66,
       94,   94,   74,   94,  116,  117,   67,  130,  131,  130,
      131,  118,   68,   73,   73,   73,   74,   73,   73,   73,
       73,   73,   73,   73,   73,   73,   73,   73,   75,   76,
       75,   73,   75,   75,   77,   78,   75,   75,   79,   80,

       75,   75,   75,   75,   75,   81,   73,   73,   73,   83,
       83,   84,   85,   73,   73,   73,   73,   73,   73,   73,
       86,   73,   73,   87,   73,   87,   73,   87,   87,   87,
       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,
       87,   73,   73,   83,   83,   84,   85,  125,  126,  127,
      159,   88,  160,   89,   86,   83,   83,   84,   85,  181,
      128,  182,  194,   88,  202,   89,   86,   96,   96,   97,
       98,  125,  126,  127,   99,  414,  116,  117,  100,   96,
       96,   97,   98,  118,  128,  402,   99,  205,  205,  338,
      100,  102,  102,  103,  104,  105,  339,  106,  107,  108,

      489,  109,  110,  120,  121,  120,  121,  143,  144,  208,
      122,  209,  122,   52,   52,  222,  145,  223,  123,  222,
      123,  223,  146,  107,  108,  102,  102,  103,  104,  105,
      140,  106,  107,  108,  488,  109,  110,  143,  144,  143,
      144,  143,  144,  174,  175,  487,  145,  176,  145,  259,
      145,  260,  146,  275,  147,  276,  147,  107,  108,  132,
      132,  132,  133,  134,  132,  132,  132,  132,  132,  132,
      132,  132,  132,  132,  135,  132,  135,  132,  135,  135,
      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
      135,  135,  132,  132,  136,  136,  136,  137,  138,  136,

      136,  136,  136,  136,  136,  136,  136,  136,  136,  139,
      136,  139,  136,  139,  139,  139,  139,  139,  139,  139,
      139,  139,  139,  139,  139,  139,  139,  136,  136,  148,
      148,  148,  149,  150,  148,  148,  148,  148,  148,  148,
      148,  148,  148,  148,  151,  148,  151,  148,  151,  151,
      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
      151,  151,  148,  148,  152,  294,  152,  295,  152,  152,
      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,
      152,  152,   52,   52,  393,  143,  144,  143,  144,  170,
      170,  170,  172,  194,  145,  194,  145,  193,  193,  153,

      155,  480,  155,  161,  195,  476,  171,  199,  173,  194,
      194,  307,  200,  162,  163,  162,  164,  162,  162,  165,
      166,  162,  162,  167,  168,  162,  162,  162,  162,  162,
      169,  183,  193,  193,  193,  193,  414,  201,  194,  195,
      194,  195,  206,  206,  318,  207,  319,  185,  186,  210,
      210,  187,  188,  196,  206,  206,  207,  261,  189,  197,
      262,  198,  212,  213,  213,  214,  214,  217,  216,  219,
      219,  220,  220,  414,  221,  220,  220,  221,  224,  224,
      225,  225,  249,  226,  225,  225,  226,  239,  263,  267,
      475,  262,  262,  250,  277,  251,  402,  240,  241,  278,

      402,  240,  240,  242,  243,  240,  240,  244,  245,  240,
      240,  240,  240,  240,  246,  256,  268,  268,  174,  175,
      170,  170,  176,  474,  269,  170,  172,  281,  282,  277,
      296,  283,  193,  193,  284,  297,  320,  171,  300,  300,
      301,  321,  173,  194,  194,  194,  194,  303,  304,  302,
      306,  473,  194,  194,  194,  305,  194,  308,  194,  204,
      204,  324,  194,  325,  194,  204,  204,  205,  205,  206,
      206,  472,  309,  206,  206,  210,  210,  210,  210,  312,
      312,  213,  213,  214,  214,  219,  219,  327,  212,  328,
      212,  220,  220,  220,  220,  224,  224,  225,  225,  225,

      225,  330,  331,  328,  325,  332,  350,  328,  268,  268,
      288,  354,  349,  300,  300,  365,  269,  194,  355,  291,
      359,  194,  360,  194,  471,  361,  194,  363,  194,  362,
      194,  194,  194,  194,  364,  469,  360,  367,  367,  194,
      194,  194,  194,  366,  312,  312,  372,  194,  381,  194,
      312,  312,  468,  373,  387,  382,  402,  388,  194,  403,
      409,  410,  410,  465,  360,  367,  367,  194,  195,  194,
      360,  360,  464,  194,  194,  194,  194,  411,  194,  463,
      194,  194,  360,  194,  412,  194,  414,  194,  421,  415,
      424,  422,  429,  425,  431,  430,  433,  432,  462,  434,

      446,  446,  446,  461,  446,  446,  447,  446,  446,  446,
      446,  446,  446,  447,  446,  447,  446,  447,  446,  447,
      447,  447,  447,  447,  447,  447,  447,  447,  447,  447,
      447,  447,  447,  446,  446,  360,  410,  410,  460,  194,
      360,  194,  452,  194,  459,  194,  458,  194,  457,  194,
      466,  466,  467,  467,  470,  470,  360,  477,  477,  456,
      194,  414,  194,  478,  478,  479,  479,  481,  481,  482,
      482,  482,  482,  483,  483,  466,  466,  467,  467,  485,
      485,  470,  470,  490,  490,  490,  455,  490,  490,  491,
      490,  490,  490,  490,  490,  490,  491,  490,  491,  490,

      491,  490,  491,  491,  491,  491,  491,  491,  491,  491,
      491,  491,  491,  491,  491,  491,  490,  490,  477,  477,
      478,  478,  479,  479,  492,  492,  481,  481,  482,  482,
      483,  483,  485,  485,  495,  496,  496,  454,  495,  495,
      497,  495,  495,  495,  495,  495,  495,  497,  495,  497,
      495,  497,  495,  497,  497,  497,  497,  497,  497,  497,
      497,  497,  497,  497,  497,  497,  497,  495,  495,  492,
      492,  496,  496,   52,   52,   52,   52,   52,   52,   52,
       52,   52,   52,   52,   52,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   69,   69,   69,

       69,   69,   69,   69,   69,   69,   69,   69,   69,   82,
       82,   82,   82,   82,   82,   82,   82,   82,   82,   82,
       82,   73,   73,   73,   73,   73,   73,   73,   73,   73,
       73,   73,   73,   90,   90,   90,   90,   90,   90,   90,
       90,   90,   90,   90,   90,   93,   93,   93,   93,   93,
       93,   93,   93,   93,   93,   93,   93,   95,   95,   95,
       95,   95,   95,   95,   95,   95,   95,   95,   95,  101,
      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,
      101,  111,  111,  111,  111,  111,  111,  111,  111,  111,
      111,  111,  111,  115,  115,  115,  115,  115,  115,  115,

      115,  115,  115,  115,  115,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  124,  124,  124,
      124,  124,  124,  124,  124,  124,  124,  124,  124,  129,
      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
      129,  142,  142,  142,  142,  142,  142,  142,  142,  142,
      142,  142,  142,  179,  179,  179,  179,  179,  179,  179,
      179,  179,  179,  179,  179,  184,  414,  414,  414,  453,
      402,  184,  194,  451,  450,  402,  194,  194,  402,  194,
      402,  194,  194,  203,  203,  449,  448,  203,  203,  203,
      203,  203,  203,  203,  203,  211,  445,  444,  443,  211,

      442,  441,  211,  211,  211,  211,  215,  215,  440,  215,
      215,  215,  215,  215,  215,  215,  215,  215,  218,  439,
      438,  437,  218,  218,  218,  218,  218,  218,  218,  218,
      227,  227,  436,  435,  227,  227,  227,  227,  227,  227,
      227,  227,  229,  229,  428,  427,  229,  229,  229,  229,
      229,  229,  229,  229,  252,  252,  426,  423,  252,  252,
      252,  252,  252,  252,  252,  252,  254,  420,  414,  254,
      419,  254,  254,  255,  418,  417,  255,  416,  255,  255,
      264,  413,  408,  264,  402,  264,  264,  265,  407,  406,
      265,  405,  265,  265,  270,  270,  404,  401,  270,  270,

      270,  270,  270,  270,  270,  270,  271,  288,  400,  271,
      399,  271,  271,  273,  273,  287,  287,  398,  397,  287,
      287,  287,  287,  287,  287,  287,  287,  289,  289,  396,
      395,  289,  289,  289,  289,  289,  289,  289,  289,  290,
      290,  290,  290,  394,  290,  290,  290,  290,  290,  290,
      290,  292,  393,  292,  292,  310,  310,  392,  391,  310,
      310,  310,  310,  310,  310,  310,  310,  311,  311,  311,
      311,  311,  311,  311,  390,  311,  311,  311,  311,  313,
      313,  389,  386,  313,  313,  313,  313,  313,  313,  313,
      313,  315,  385,  384,  315,  383,  315,  315,  326,  326,

      380,  379,  326,  326,  326,  326,  326,  326,  326,  326,
      334,  378,  377,  334,  376,  334,  334,  446,  446,  375,
      446,  446,  446,  446,  446,  446,  446,  446,  446,  484,
      374,  371,  370,  369,  368,  358,  357,  356,  484,  484,
      486,  353,  352,  351,  291,  288,  348,  347,  346,  486,
      486,  493,  345,  344,  343,  342,  341,  340,  337,  336,
      493,  493,  494,  335,  333,  494,  329,  494,  494,  490,
      490,  323,  490,  490,  490,  490,  490,  490,  490,  490,
      490,  499,  322,  317,  499,  316,  499,  499,  495,  495,
      314,  495,  495,  495,  495,  495,  495,  495,  495,  495,

      228,  216,  216,  299,  298,  293,  291,  288,  180,  286,
      285,  281,  280,  279,  274,  272,  266,  266,  258,  257,
      256,  253,  253,  248,  247,  238,  237,  236,  235,  234,
      233,  232,  231,  230,  228,  217,  216,  192,  191,  190,
      180,  178,  177,  158,  157,  156,  500,  154,  141,   51,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500
    } ;

static const flex_int16_t yy_chk[1486] =
    {   0,
        0,   82,   82,    1,    1,    1,    5,    5,    1,    6,
        6,    0,    1,    5,   15,   15,    6,    0,    1,    2,
        2,    2,    2,    2,   16,   16,    2,  487,   23,   23,
        2,    9,    9,    9,    9,   23,    2,    3,    3,    3,
        3,    3,   10,   10,   10,   10,   24,   24,    3,   17,
       17,   17,   17,   24,    3,    4,    4,    4,    4,    4,
       18,   18,   18,   18,   25,   25,    4,   31,   31,   32,
       32,   25,    4,    7,    7,    7,    7,    7,    7,    7,
        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,

        7,    7,    7,    7,    7,    7,    7,    7,   11,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
       11,   11,   11,   13,   13,   13,   13,   29,   29,   29,
       57,   13,   57,   13,   13,   14,   14,   14,   14,   67,
       29,   67,   81,   14,   81,   14,   14,   19,   19,   19,
       19,   30,   30,   30,   19,  476,   26,   26,   19,   20,
       20,   20,   20,   26,   30,  475,   20,   83,   83,  277,
       20,   21,   21,   21,   21,   21,  277,   21,   21,   21,

      473,   21,   21,   27,   27,   28,   28,   39,   39,   86,
       27,   86,   28,   37,   37,  100,   39,  100,   27,  110,
       28,  110,   39,   21,   21,   22,   22,   22,   22,   22,
       37,   22,   22,   22,  472,   22,   22,   40,   40,   41,
       41,   42,   42,   61,   61,  471,   40,   61,   41,  145,
       42,  145,   40,  166,   41,  166,   42,   22,   22,   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,   33,   33,   35,   35,   35,   35,   35,   35,

       35,   35,   35,   35,   35,   35,   35,   35,   35,   35,
       35,   35,   35,   35,   35,   35,   35,   35,   35,   35,
       35,   35,   35,   35,   35,   35,   35,   35,   35,   43,
       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
       43,   43,   43,   43,   45,  186,   45,  186,   45,   45,
       45,   45,   45,   45,   45,   45,   45,   45,   45,   45,
       45,   45,   47,   47,  469,   49,   49,   50,   50,   59,
       59,   60,   60,  194,   49,  194,   50,   75,   75,   47,

       49,  461,   50,   58,   75,  455,   59,   79,   60,  201,
       79,  201,   79,   58,   58,   58,   58,   58,   58,   58,
       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,
       58,   68,   77,   77,   78,   78,  454,   80,   80,   77,
       80,   78,   84,   84,  243,   84,  243,   68,   68,   87,
       87,   68,   68,   77,   85,   85,   85,  146,   68,   78,
      146,   78,   87,   88,   88,   89,   89,   92,   92,   96,
       96,   97,   97,  453,   97,   98,   98,   98,  102,  102,
      103,  103,  128,  103,  104,  104,  104,  123,  147,  155,
      451,  147,  155,  128,  167,  128,  450,  123,  123,  167,

      449,  123,  123,  123,  123,  123,  123,  123,  123,  123,
      123,  123,  123,  123,  123,  141,  158,  158,  141,  141,
      170,  170,  141,  448,  158,  172,  172,  173,  173,  174,
      187,  173,  193,  193,  174,  187,  244,  170,  195,  195,
      196,  244,  172,  196,  197,  196,  197,  198,  199,  197,
      200,  445,  198,  199,  198,  199,  200,  202,  200,  203,
      203,  256,  202,  256,  202,  204,  204,  205,  205,  206,
      206,  444,  204,  207,  207,  210,  210,  211,  211,  212,
      212,  213,  213,  214,  214,  219,  219,  261,  210,  261,
      211,  220,  220,  221,  221,  224,  224,  225,  225,  226,

      226,  263,  266,  263,  266,  267,  291,  267,  268,  268,
      288,  296,  288,  300,  300,  306,  268,  306,  296,  291,
      301,  301,  302,  301,  442,  302,  302,  304,  302,  303,
      303,  304,  303,  304,  305,  440,  307,  309,  309,  305,
      307,  305,  307,  308,  311,  311,  320,  308,  329,  308,
      312,  312,  439,  320,  336,  329,  352,  336,  359,  352,
      359,  360,  360,  435,  361,  367,  367,  361,  360,  361,
      362,  363,  434,  362,  363,  362,  363,  364,  365,  432,
      365,  364,  366,  364,  365,  366,  370,  366,  377,  370,
      379,  377,  383,  379,  384,  383,  385,  384,  430,  385,

      399,  399,  399,  428,  399,  399,  399,  399,  399,  399,
      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
      399,  399,  399,  399,  399,  409,  410,  410,  427,  409,
      411,  409,  412,  411,  426,  411,  425,  412,  423,  412,
      436,  436,  438,  438,  441,  441,  452,  456,  456,  422,
      452,  420,  452,  458,  458,  460,  460,  462,  462,  463,
      463,  464,  464,  465,  465,  466,  466,  467,  467,  468,
      468,  470,  470,  474,  474,  474,  419,  474,  474,  474,
      474,  474,  474,  474,  474,  474,  474,  474,  474,  474,

      474,  474,  474,  474,  474,  474,  474,  474,  474,  474,
      474,  474,  474,  474,  474,  474,  474,  474,  477,  477,
      478,  478,  479,  479,  480,  480,  481,  481,  482,  482,
      483,  483,  485,  485,  486,  486,  486,  418,  486,  486,
      486,  486,  486,  486,  486,  486,  486,  486,  486,  486,
      486,  486,  486,  486,  486,  486,  486,  486,  486,  486,
      486,  486,  486,  486,  486,  486,  486,  486,  486,  492,
      492,  496,  496,  501,  501,  501,  501,  501,  501,  501,
      501,  501,  501,  501,  501,  502,  502,  502,  502,  502,
      502,  502,  502,  502,  502,  502,  502,  503,  503,  503,

      503,  503,  503,  503,  503,  503,  503,  503,  503,  504,
      504,  504,  504,  504,  504,  504,  504,  504,  504,  504,
      504,  505,  505,  505,  505,  505,  505,  505,  505,  505,
      505,  505,  505,  506,  506,  506,  506,  506,  506,  506,
      506,  506,  506,  506,  506,  507,  507,  507,  507,  507,
      507,  507,  507,  507,  507,  507,  507,  508,  508,  508,
      508,  508,  508,  508,  508,  508,  508,  508,  508,  509,
      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
      509,  510,  510,  510,  510,  510,  510,  510,  510,  510,
      510,  510,  510,  511,  511,  511,  511,  511,  511,  511,

      511,  511,  511,  511,  511,  512,  512,  512,  512,  512,
      512,  512,  512,  512,  512,  512,  512,  513,  513,  513,
      513,  513,  513,  513,  513,  513,  513,  513,  513,  514,
      514,  514,  514,  514,  514,  514,  514,  514,  514,  514,
      514,  515,  515,  515,  515,  515,  515,  515,  515,  515,
      515,  515,  515,  516,  516,  516,  516,  516,  516,  516,
      516,  516,  516,  516,  516,  517,  417,  416,  415,  413,
      408,  517,  518,  407,  406,  405,  518,  518,  404,  518,
      403,  518,  518,  519,  519,  401,  400,  519,  519,  519,
      519,  519,  519,  519,  519,  520,  398,  397,  396,  520,

      395,  394,  520,  520,  520,  520,  521,  521,  392,  521,
      521,  521,  521,  521,  521,  521,  521,  521,  522,  391,
      390,  389,  522,  522,  522,  522,  522,  522,  522,  522,
      523,  523,  388,  386,  523,  523,  523,  523,  523,  523,
      523,  523,  524,  524,  382,  381,  524,  524,  524,  524,
      524,  524,  524,  524,  525,  525,  380,  378,  525,  525,
      525,  525,  525,  525,  525,  525,  526,  376,  375,  526,
      374,  526,  526,  527,  373,  372,  527,  371,  527,  527,
      528,  369,  358,  528,  357,  528,  528,  529,  356,  355,
      529,  354,  529,  529,  530,  530,  353,  351,  530,  530,

      530,  530,  530,  530,  530,  530,  531,  349,  348,  531,
      347,  531,  531,  532,  532,  533,  533,  346,  345,  533,
      533,  533,  533,  533,  533,  533,  533,  534,  534,  344,
      343,  534,  534,  534,  534,  534,  534,  534,  534,  535,
      535,  535,  535,  342,  535,  535,  535,  535,  535,  535,
      535,  536,  341,  536,  536,  537,  537,  340,  339,  537,
      537,  537,  537,  537,  537,  537,  537,  538,  538,  538,
      538,  538,  538,  538,  338,  538,  538,  538,  538,  539,
      539,  337,  335,  539,  539,  539,  539,  539,  539,  539,
      539,  540,  332,  331,  540,  330,  540,  540,  541,  541,

      328,  327,  541,  541,  541,  541,  541,  541,  541,  541,
      542,  325,  324,  542,  323,  542,  542,  543,  543,  322,
      543,  543,  543,  543,  543,  543,  543,  543,  543,  544,
      321,  319,  318,  317,  316,  299,  298,  297,  544,  544,
      545,  295,  294,  293,  290,  287,  286,  285,  284,  545,
      545,  546,  283,  282,  281,  280,  279,  278,  276,  275,
      546,  546,  547,  274,  272,  547,  262,  547,  547,  548,
      548,  246,  548,  548,  548,  548,  548,  548,  548,  548,
      548,  549,  245,  242,  549,  241,  549,  549,  550,  550,
      229,  550,  550,  550,  550,  550,  550,  550,  550,  550,

      227,  216,  215,  189,  188,  185,  183,  181,  179,  176,
      175,  171,  169,  168,  165,  163,  154,  153,  144,  143,
      140,  131,  130,  126,  125,  122,  121,  120,  118,  117,
      116,  114,  113,  112,  105,   91,   90,   72,   71,   70,
       66,   65,   64,   56,   54,   53,   51,   48,   38,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500,  500,  500,  500,  500,  500,
      500,  500,  500,  500,  500
    } ;

extern int yy_flex_debug;
int yy_flex_debug = 0;

static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
static char *yy_full_match;
static int yy_lp;
#define REJECT \
{ \
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
++(yy_lp); \
goto find_rule; \
}

#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "lexor.lex"
#line 3 "lexor.lex"
/*
 * Copyright (c) 1999-2026 Stephen Williams (steve@icarus.com)
 *
 *    This source code is free software; you can redistribute it
 *    and/or modify it in source code form under the terms of the GNU
 *    General Public License as published by the Free Software
 *    Foundation; either version 2 of the License, or (at your option)
 *    any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

# include "config.h"

# include  <stdio.h>
# include  <stdlib.h>
# include  <string.h>
# include  <ctype.h>
# include  <assert.h>

# include  "globals.h"
# include  "ivl_alloc.h"

static void output_init(void);
#define YY_USER_INIT output_init()

static void  handle_line_directive(void);
static void  handle_pragma_directive(void);

static void  def_start(void);
static void  def_add_arg(void);
static void  def_finish(void);
static void  def_undefine(void);
static void  do_define(void);
static int   def_is_done(void);
static void  def_continue(void);
static int   is_defined(const char*name);

static int   macro_needs_args(const char*name);
static void  macro_start_args(void);
static void  macro_add_to_arg(int is_whitespace);
static void  macro_finish_arg(void);
static void  do_expand(int use_args);
static const char* do_magic(const char*name);
static const char* macro_name(void);

static void include_filename(int macro_str);
static void do_include(void);

static int load_next_input(void);

struct include_stack_t
{
    char* path;

    /* If the current input is from a file, this member is set. */
    FILE* file;
    int (*file_close)(FILE*);

    /* If we are reparsing a macro expansion, file is 0 and this
     * member points to the string in progress
     */
    char* str;
    char* orig_str;

    int stringify_flag;

    unsigned lineno;
    YY_BUFFER_STATE yybs;

    struct include_stack_t* next;

    /* A single line comment can be associated with this include. */
    char* comment;
};

static unsigned get_line(struct include_stack_t* isp);
static const char *get_path(struct include_stack_t* isp);
static void emit_pathline(struct include_stack_t* isp);

/*
 * The file_queue is a singly-linked list of the files that were
 * listed on the command line/file list.
 */
static struct include_stack_t* file_queue = 0;

static int do_expand_stringify_flag = 0;

/*
 * The istack is the inclusion stack.
 */
static struct include_stack_t* istack  = 0;
static struct include_stack_t* standby = 0;

/*
 * Keep a stack of active ifdef, so that I can report errors
 * when there are missing endifs.
 */
struct ifdef_stack_t
{
    char*    path;
    unsigned lineno;

    struct ifdef_stack_t* next;
};

static struct ifdef_stack_t* ifdef_stack = 0;

static void ifdef_enter(void)
{
    struct ifdef_stack_t*cur;

    cur = (struct ifdef_stack_t*) calloc(1, sizeof(struct ifdef_stack_t));
    if (istack->path) cur->path = strdup(istack->path);
    cur->lineno = istack->lineno;
    cur->next = ifdef_stack;

    ifdef_stack = cur;
}

static void ifdef_leave(void)
{
    struct ifdef_stack_t* cur;

    assert(ifdef_stack);

    cur = ifdef_stack;
    ifdef_stack = cur->next;

    /* If either path is from a non-file context e.g.(macro expansion)
     * we assume that the non-file part is from this file. */
    if (istack->path != NULL && cur->path != NULL &&
	strcmp(istack->path,cur->path) != 0) {
	fprintf(stderr, "%s:%u: warning: This `endif matches an ifdef "
	                "in another file.\n", istack->path, istack->lineno+1);

	fprintf(stderr, "%s:%u: This is the odd matched `ifdef.\n",
	                cur->path, cur->lineno+1);
    }

    free(cur->path);
    free(cur);
}

#define YY_INPUT(buf,result,max_size) do {                              \
    if (istack->file) {                                                 \
	size_t rc = fread(buf, 1, max_size, istack->file);              \
	result = (rc == 0) ? YY_NULL : rc;                              \
    } else {                                                            \
	/* We are expanding a macro. Handle the SV `` delimiter.        \
	   If the delimiter terminates a defined macro usage, leave     \
	   it in place, otherwise remove it now. */                     \
	if (!(yytext[0] == '`' && is_defined(yytext+1))) {              \
	    while ((istack->str[0] == '`') &&                           \
	           (istack->str[1] == '`')) {                           \
	        istack->str += 2;                                       \
	    }                                                           \
	}                                                               \
	if (*istack->str == 0) {                                        \
	    result = YY_NULL;                                           \
	} else {                                                        \
	    buf[0] = *istack->str++;                                    \
	    result = 1;                                                 \
	}                                                               \
    }                                                                   \
} while (0)

static int comment_enter = 0;
static int pragma_enter = 0;
static int string_enter = 0;
static int prev_state = 0;

static int ma_parenthesis_level = 0;
#line 1194 "<stdout>"
#define YY_NO_INPUT 1

/* The grouping parentheses are necessary for compatibility with
 * older versions of flex (at least 2.5.31); they are supposed to
 * be implied, according to the flex manual.
 */
#line 1201 "<stdout>"

#define INITIAL 0
#define PPINCLUDE 1
#define PPCCOMMENT 2
#define DEF_NAME 3
#define DEF_ESC 4
#define DEF_ARG 5
#define DEF_SEP 6
#define DEF_TXT 7
#define MN_ESC 8
#define MA_START 9
#define MA_ADD 10
#define CCOMMENT 11
#define IFCCOMMENT 12
#define PCOMENT 13
#define CSTRING 14
#define ERROR_LINE 15
#define IFDEF_NAME 16
#define IFNDEF_NAME 17
#define IFDEF_TRUE 18
#define IFDEF_FALSE 19
#define IFDEF_SUPR 20
#define ELSIF_NAME 21
#define ELSIF_SUPR 22
#define ELSE_TRUE 23
#define ELSE_SUPR 24

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

#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif

static int yy_init_globals ( void );

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

int yylex_destroy ( void );

int yyget_debug ( void );

void yyset_debug ( int debug_flag  );

YY_EXTRA_TYPE yyget_extra ( void );

void yyset_extra ( YY_EXTRA_TYPE user_defined  );

FILE *yyget_in ( void );

void yyset_in  ( FILE * _in_str  );

FILE *yyget_out ( void );

void yyset_out  ( FILE * _out_str  );

			int yyget_leng ( void );

char *yyget_text ( void );

int yyget_lineno ( void );

void yyset_lineno ( int _line_number  );

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

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

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

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

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

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

#endif

        static int yy_start_stack_ptr = 0;
        static int yy_start_stack_depth = 0;
        static int *yy_start_stack = NULL;
    
    static void yy_push_state ( int _new_state );
    
    static void yy_pop_state ( void );
    
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#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 do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
#endif

/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
		{ \
		int c = '*'; \
		int n; \
		for ( n = 0; n < max_size && \
			     (c = getc( 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 \
		{ \
		errno=0; \
		while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
			{ \
			if( errno != EINTR) \
				{ \
				YY_FATAL_ERROR( "input in flex scanner failed" ); \
				break; \
				} \
			errno=0; \
			clearerr(yyin); \
			} \
		}\
\

#endif

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

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

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

/* end tables serialization structures and prototypes */

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

extern int yylex (void);

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

/* 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 /*LINTED*/break;
#endif

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

/** The main scanner function which does all the work.
 */
YY_DECL
{
	yy_state_type yy_current_state;
	char *yy_cp, *yy_bp;
	int yy_act;
    
	if ( !(yy_init) )
		{
		(yy_init) = 1;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

        /* Create the reject buffer large enough to save one state per allowed character. */
        if ( ! (yy_state_buf) )
            (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE  );
            if ( ! (yy_state_buf) )
                YY_FATAL_ERROR( "out of dynamic memory in yylex()" );

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

		if ( ! yyin )
			yyin = stdin;

		if ( ! yyout )
			yyout = stdout;

		if ( ! YY_CURRENT_BUFFER ) {
			yyensure_buffer_stack ();
			YY_CURRENT_BUFFER_LVALUE =
				yy_create_buffer( yyin, YY_BUF_SIZE );
		}

		yy_load_buffer_state(  );
		}

	{
#line 224 "lexor.lex"


#line 227 "lexor.lex"
 /* Recognize and handle the `line directive. Also pass it through to
  * the output so the main compiler is aware of the change.
  */
#line 1466 "<stdout>"

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

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

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

		yy_current_state = (yy_start);
		yy_current_state += YY_AT_BOL();

		(yy_state_ptr) = (yy_state_buf);
		*(yy_state_ptr)++ = yy_current_state;

yy_match:
		do
			{
			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
				{
				yy_current_state = (int) yy_def[yy_current_state];
				if ( yy_current_state >= 501 )
					yy_c = yy_meta[yy_c];
				}
			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
			*(yy_state_ptr)++ = yy_current_state;
			++yy_cp;
			}
		while ( yy_base[yy_current_state] != 1450 );

yy_find_action:
		yy_current_state = *--(yy_state_ptr);
		(yy_lp) = yy_accept[yy_current_state];

find_rule: /* we branch to this label when backing up */

		for ( ; ; ) /* until we find what rule we matched */
			{
			if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
				{
				yy_act = yy_acclist[(yy_lp)];
					{
					(yy_full_match) = yy_cp;
					break;
					}
				}
			--yy_cp;
			yy_current_state = *--(yy_state_ptr);
			(yy_lp) = 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 230 "lexor.lex"
{ handle_line_directive(); ECHO; }
	YY_BREAK
/* Recognize and handle the `pragma directive and pass it through to
  * the main compiler.
  */
case 2:
YY_RULE_SETUP
#line 235 "lexor.lex"
{ handle_pragma_directive(); ECHO; }
	YY_BREAK
/* Detect single line comments, passing them directly to the output.
  */
case 3:
YY_RULE_SETUP
#line 239 "lexor.lex"
{ ECHO; }
	YY_BREAK
/* detect multiline, c-style comments, passing them directly to the
  * output. This is necessary to allow for ignoring directives that
  * are included within the comments.
  */
case 4:
YY_RULE_SETUP
#line 246 "lexor.lex"
{ comment_enter = YY_START; BEGIN(CCOMMENT); ECHO; }
	YY_BREAK
case 5:
YY_RULE_SETUP
#line 247 "lexor.lex"
{ ECHO; }
	YY_BREAK
case 6:
/* rule 6 can match eol */
#line 249 "lexor.lex"
case 7:
/* rule 7 can match eol */
#line 250 "lexor.lex"
case 8:
/* rule 8 can match eol */
#line 251 "lexor.lex"
case 9:
/* rule 9 can match eol */
YY_RULE_SETUP
#line 251 "lexor.lex"
{ istack->lineno += 1; fputc('\n', yyout); }
	YY_BREAK
case 10:
YY_RULE_SETUP
#line 252 "lexor.lex"
{ BEGIN(comment_enter); ECHO; }
	YY_BREAK
/* Detect and pass multiline pragma comments. As with C-style
  * comments, pragma comments are passed through, and preprocessor
  * directives contained within are ignored. Contains macros are
  * expanded, however.
  */
case 11:
YY_RULE_SETUP
#line 259 "lexor.lex"
{ ECHO; }
	YY_BREAK
case 12:
YY_RULE_SETUP
#line 260 "lexor.lex"
{ pragma_enter = YY_START; BEGIN(PCOMENT); ECHO; }
	YY_BREAK
case 13:
YY_RULE_SETUP
#line 261 "lexor.lex"
{ ECHO; }
	YY_BREAK
case 14:
/* rule 14 can match eol */
#line 263 "lexor.lex"
case 15:
/* rule 15 can match eol */
#line 264 "lexor.lex"
case 16:
/* rule 16 can match eol */
#line 265 "lexor.lex"
case 17:
/* rule 17 can match eol */
YY_RULE_SETUP
#line 265 "lexor.lex"
{ istack->lineno += 1; fputc('\n', yyout); }
	YY_BREAK
case 18:
YY_RULE_SETUP
#line 266 "lexor.lex"
{ BEGIN(pragma_enter); ECHO; }
	YY_BREAK
case 19:
YY_RULE_SETUP
#line 268 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: macro expansion cannot be directive keywords "
                    "('%s').\n", yytext);
    error_count += 1;
}
	YY_BREAK
case 20:
YY_RULE_SETUP
#line 275 "lexor.lex"
{
    if (macro_needs_args(yytext+1)) yy_push_state(MA_START); else do_expand(0);
}
	YY_BREAK
case 21:
YY_RULE_SETUP
#line 278 "lexor.lex"
{ if (!istack->file) fputc('"', yyout); else REJECT; }
	YY_BREAK
case 22:
YY_RULE_SETUP
#line 279 "lexor.lex"
{ if (!istack->file) fputs("\\\"", yyout); else REJECT; }
	YY_BREAK
/* Strings do not contain preprocessor directives or macro expansions.
  */
case 23:
YY_RULE_SETUP
#line 283 "lexor.lex"
{ string_enter = YY_START; BEGIN(CSTRING); ECHO; }
	YY_BREAK
case 24:
#line 285 "lexor.lex"
case 25:
#line 286 "lexor.lex"
case 26:
YY_RULE_SETUP
#line 286 "lexor.lex"
{ ECHO; }
	YY_BREAK
case 27:
/* rule 27 can match eol */
#line 288 "lexor.lex"
case 28:
/* rule 28 can match eol */
#line 289 "lexor.lex"
case 29:
/* rule 29 can match eol */
#line 290 "lexor.lex"
case 30:
/* rule 30 can match eol */
YY_RULE_SETUP
#line 290 "lexor.lex"
{ fputc('\n', yyout); }
	YY_BREAK
case 31:
YY_RULE_SETUP
#line 291 "lexor.lex"
{ BEGIN(string_enter);  ECHO; }
	YY_BREAK
case 32:
YY_RULE_SETUP
#line 292 "lexor.lex"
{ ECHO; }
	YY_BREAK
/* This set of patterns matches the include directive and the name
  * that follows it. when the directive ends, the do_include function
  * performs the include operation.
  */
case 33:
YY_RULE_SETUP
#line 298 "lexor.lex"
{ yy_push_state(PPINCLUDE); }
	YY_BREAK
case 34:
YY_RULE_SETUP
#line 300 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: macro expansion cannot be directive keywords "
                    "('%s').\n", yytext);
    error_count += 1;
    BEGIN(ERROR_LINE);
}
	YY_BREAK
case 35:
YY_RULE_SETUP
#line 308 "lexor.lex"
{
    if (macro_needs_args(yytext+1)) yy_push_state(MA_START); else do_expand(0);
}
	YY_BREAK
case 36:
/* rule 36 can match eol */
YY_RULE_SETUP
#line 312 "lexor.lex"
{ include_filename(0); }  /* A normal (") string */
	YY_BREAK
case 37:
/* rule 37 can match eol */
YY_RULE_SETUP
#line 313 "lexor.lex"
{ include_filename(1); }  /* A macro (`") string */
	YY_BREAK
case 38:
YY_RULE_SETUP
#line 315 "lexor.lex"
{ ; }
	YY_BREAK
/* Catch single-line comments that share the line with an include
   * directive. And while I'm at it, I might as well preserve the
   * comment in the output stream. This will be printed after the
   * file has been included. For simplicity, if there is more than
   * one comment on the line, only the first one will be preserved.
   */
case 39:
#line 324 "lexor.lex"
case 40:
YY_RULE_SETUP
#line 324 "lexor.lex"
{ if (!standby->comment) standby->comment = strdup(yytext); }
	YY_BREAK
/* Now catch the start of a multi-line comment. In this case we
   * discard the comment then execute the inclusion.
   */
case 41:
YY_RULE_SETUP
#line 329 "lexor.lex"
{ BEGIN(PPCCOMMENT); }
	YY_BREAK
case 42:
YY_RULE_SETUP
#line 331 "lexor.lex"
{}
	YY_BREAK
case 43:
/* rule 43 can match eol */
#line 333 "lexor.lex"
case 44:
/* rule 44 can match eol */
#line 334 "lexor.lex"
case 45:
/* rule 45 can match eol */
#line 335 "lexor.lex"
case 46:
/* rule 46 can match eol */
YY_RULE_SETUP
#line 335 "lexor.lex"
{ istack->lineno += 1; }
	YY_BREAK
case 47:
YY_RULE_SETUP
#line 336 "lexor.lex"
{ yy_pop_state(); do_include(); }
	YY_BREAK
/* These finish the include directive (EOF or EOL) so I revert the
  * lexor state and execute the inclusion.
  */
/* There is a bug in flex <= 2.5.34 that prevents the continued action '|'
  * from working properly when the final action is associated with <<EOF>>.
  * Therefore, the action is repeated. */
case 48:
/* rule 48 can match eol */
#line 347 "lexor.lex"
case 49:
/* rule 49 can match eol */
#line 348 "lexor.lex"
case 50:
/* rule 50 can match eol */
#line 349 "lexor.lex"
case 51:
/* rule 51 can match eol */
YY_RULE_SETUP
#line 349 "lexor.lex"
{ istack->lineno += 1; yy_pop_state(); do_include(); }
	YY_BREAK
case YY_STATE_EOF(PPINCLUDE):
#line 350 "lexor.lex"
{ istack->lineno += 1; yy_pop_state(); do_include(); }
	YY_BREAK
/* Anything that is not matched by the above is an error of some
  * sort. Print an error message and absorb the rest of the line.
  */
case 52:
YY_RULE_SETUP
#line 355 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: malformed `include directive. Did you quote the file name?\n");
    error_count += 1;
    BEGIN(ERROR_LINE);
}
	YY_BREAK
/* Detect the define directive, and match the name. If followed by a
   * '(', collect the formal arguments. Consume any white space, then
   * go into DEF_TXT mode and collect the defined value.
   */
case 53:
YY_RULE_SETUP
#line 366 "lexor.lex"
{ yy_push_state(DEF_NAME); }
	YY_BREAK
case 54:
YY_RULE_SETUP
#line 368 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: malformed `define directive: macro names "
                    "cannot be directive keywords ('%s')\n", yytext);
    error_count += 1;
    BEGIN(ERROR_LINE);
}
	YY_BREAK
case 55:
YY_RULE_SETUP
#line 376 "lexor.lex"
{ BEGIN(DEF_ARG); def_start(); }
	YY_BREAK
case 56:
YY_RULE_SETUP
#line 377 "lexor.lex"
{ BEGIN(DEF_TXT); def_start(); }
	YY_BREAK
case 57:
YY_RULE_SETUP
#line 379 "lexor.lex"
{ BEGIN(DEF_ESC); }
	YY_BREAK
case 58:
YY_RULE_SETUP
#line 381 "lexor.lex"
{ BEGIN(DEF_ARG); def_start(); }
	YY_BREAK
case 59:
YY_RULE_SETUP
#line 382 "lexor.lex"
{ BEGIN(DEF_TXT); def_start(); }
	YY_BREAK
/* define arg: <name> = <text> */
case 60:
/* rule 60 can match eol */
YY_RULE_SETUP
#line 385 "lexor.lex"
{ BEGIN(DEF_SEP); def_add_arg(); }
	YY_BREAK
/* define arg: <name> */
case 61:
YY_RULE_SETUP
#line 387 "lexor.lex"
{ BEGIN(DEF_SEP); def_add_arg(); }
	YY_BREAK
case 62:
YY_RULE_SETUP
#line 389 "lexor.lex"
{ BEGIN(DEF_ARG); }
	YY_BREAK
case 63:
YY_RULE_SETUP
#line 390 "lexor.lex"
{ BEGIN(DEF_TXT); }
	YY_BREAK
case 64:
YY_RULE_SETUP
#line 392 "lexor.lex"
{ ECHO; }
	YY_BREAK
case 65:
YY_RULE_SETUP
#line 393 "lexor.lex"
{ comment_enter = YY_START; BEGIN(CCOMMENT); ECHO; }
	YY_BREAK
case 66:
YY_RULE_SETUP
#line 394 "lexor.lex"
{}
	YY_BREAK
case 67:
/* rule 67 can match eol */
YY_RULE_SETUP
#line 396 "lexor.lex"
{ istack->lineno += 1; fputc('\n', yyout); }
	YY_BREAK
case 68:
YY_RULE_SETUP
#line 398 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: malformed `define directive ('%s').\n", yytext);
    error_count += 1;
    BEGIN(ERROR_LINE);
}
	YY_BREAK
case 69:
YY_RULE_SETUP
#line 405 "lexor.lex"
{ do_define(); }
	YY_BREAK
case 70:
/* rule 70 can match eol */
YY_RULE_SETUP
#line 407 "lexor.lex"
{
    if (def_is_done()) {
	def_finish();
	yy_pop_state();
    } else {
	def_continue();
    }

    istack->lineno += 1;
    fputc('\n', yyout);
}
	YY_BREAK
/* If the define is terminated by an EOF, then finish the define
  * whether there was a continuation or not.
  */
case YY_STATE_EOF(DEF_TXT):
#line 422 "lexor.lex"
{
    def_finish();

    istack->lineno += 1;
    fputc('\n', yyout);

    yy_pop_state();

    if (!load_next_input())
	yyterminate();
}
	YY_BREAK
case 71:
YY_RULE_SETUP
#line 434 "lexor.lex"
{ def_undefine(); }
	YY_BREAK
/* Detect conditional compilation directives, and parse them. If I
   * find the name defined, switch to the IFDEF_TRUE state and stay
   * there until I get an `else or `endif. Otherwise, switch to the
   * IFDEF_FALSE state and start tossing data.
   *
   * Handle suppressed `ifdef with an additional suppress start
   * condition that stacks on top of the IFDEF_FALSE so that output is
   * not accidentally turned on within nested ifdefs.
   */
case 72:
YY_RULE_SETUP
#line 445 "lexor.lex"
{
    ifdef_enter();
    yy_push_state(IFDEF_NAME);
}
	YY_BREAK
case 73:
YY_RULE_SETUP
#line 450 "lexor.lex"
{
    ifdef_enter();
    yy_push_state(IFNDEF_NAME);
}
	YY_BREAK
case 74:
#line 456 "lexor.lex"
case 75:
YY_RULE_SETUP
#line 456 "lexor.lex"
{ ifdef_enter(); yy_push_state(IFDEF_SUPR); }
	YY_BREAK
case 76:
#line 459 "lexor.lex"
case 77:
YY_RULE_SETUP
#line 459 "lexor.lex"
{ prev_state = YYSTATE; BEGIN(ELSIF_SUPR); }
	YY_BREAK
case 78:
YY_RULE_SETUP
#line 460 "lexor.lex"
{ prev_state = YYSTATE; BEGIN(ELSIF_NAME); }
	YY_BREAK
case 79:
#line 463 "lexor.lex"
case 80:
YY_RULE_SETUP
#line 463 "lexor.lex"
{ BEGIN(ELSE_SUPR); }
	YY_BREAK
case 81:
YY_RULE_SETUP
#line 464 "lexor.lex"
{ BEGIN(ELSE_TRUE); }
	YY_BREAK
case 82:
YY_RULE_SETUP
#line 466 "lexor.lex"
{
    if (is_defined(yytext))
	BEGIN(IFDEF_TRUE);
    else
	BEGIN(IFDEF_FALSE);
}
	YY_BREAK
case 83:
YY_RULE_SETUP
#line 473 "lexor.lex"
{
    if (!is_defined(yytext))
	BEGIN(IFDEF_TRUE);
    else
	BEGIN(IFDEF_FALSE);
}
	YY_BREAK
case 84:
YY_RULE_SETUP
#line 480 "lexor.lex"
{
    if (is_defined(yytext))
	BEGIN(IFDEF_TRUE);
    else
	BEGIN(IFDEF_FALSE);
}
	YY_BREAK
case 85:
YY_RULE_SETUP
#line 487 "lexor.lex"
{
    BEGIN(IFDEF_SUPR);
}
	YY_BREAK
case 86:
YY_RULE_SETUP
#line 491 "lexor.lex"
{}
	YY_BREAK
case 87:
YY_RULE_SETUP
#line 493 "lexor.lex"
{ comment_enter = YY_START; BEGIN(IFCCOMMENT); }
	YY_BREAK
case 88:
YY_RULE_SETUP
#line 495 "lexor.lex"
{}
	YY_BREAK
case 89:
/* rule 89 can match eol */
#line 497 "lexor.lex"
case 90:
/* rule 90 can match eol */
#line 498 "lexor.lex"
case 91:
/* rule 91 can match eol */
#line 499 "lexor.lex"
case 92:
/* rule 92 can match eol */
YY_RULE_SETUP
#line 499 "lexor.lex"
{ istack->lineno += 1; fputc('\n', yyout); }
	YY_BREAK
case 93:
YY_RULE_SETUP
#line 500 "lexor.lex"
{ BEGIN(comment_enter); }
	YY_BREAK
case 94:
YY_RULE_SETUP
#line 502 "lexor.lex"
{  }
	YY_BREAK
case 95:
/* rule 95 can match eol */
#line 504 "lexor.lex"
case 96:
/* rule 96 can match eol */
#line 505 "lexor.lex"
case 97:
/* rule 97 can match eol */
#line 506 "lexor.lex"
case 98:
/* rule 98 can match eol */
YY_RULE_SETUP
#line 506 "lexor.lex"
{ istack->lineno += 1; fputc('\n', yyout); }
	YY_BREAK
case 99:
YY_RULE_SETUP
#line 508 "lexor.lex"
{ ifdef_leave(); yy_pop_state(); }
	YY_BREAK
case 100:
/* rule 100 can match eol */
#line 511 "lexor.lex"
case 101:
/* rule 101 can match eol */
#line 512 "lexor.lex"
case 102:
/* rule 102 can match eol */
YY_RULE_SETUP
#line 512 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: `ifdef without a macro name.\n");
    error_count += 1;
    if (YY_START == IFDEF_NAME) {
	ifdef_leave();
	yy_pop_state();
	unput(yytext[0]);
    }
}
	YY_BREAK
case 103:
/* rule 103 can match eol */
#line 524 "lexor.lex"
case 104:
/* rule 104 can match eol */
#line 525 "lexor.lex"
case 105:
/* rule 105 can match eol */
YY_RULE_SETUP
#line 525 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: `ifndef without a macro name.\n");
    error_count += 1;
    if (YY_START == IFNDEF_NAME) {
	ifdef_leave();
	yy_pop_state();
	unput(yytext[0]);
    }
}
	YY_BREAK
case 106:
/* rule 106 can match eol */
#line 537 "lexor.lex"
case 107:
/* rule 107 can match eol */
#line 538 "lexor.lex"
case 108:
/* rule 108 can match eol */
YY_RULE_SETUP
#line 538 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: `elsif without a macro name.\n");
    error_count += 1;
    if (YY_START != INITIAL) {
	BEGIN(prev_state);
	unput(yytext[0]);
    }
}
	YY_BREAK
case 109:
YY_RULE_SETUP
#line 548 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: `elsif after a matching `else.\n");
    error_count += 1;
    BEGIN(ELSE_SUPR);
}
	YY_BREAK
case 110:
YY_RULE_SETUP
#line 555 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: `else after a matching `else.\n");
    error_count += 1;
    BEGIN(ELSE_SUPR);
}
	YY_BREAK
case 111:
YY_RULE_SETUP
#line 562 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: `elsif without a matching `ifdef.\n");
    error_count += 1;
}
	YY_BREAK
case 112:
YY_RULE_SETUP
#line 568 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: `else without a matching `ifdef.\n");
    error_count += 1;
}
	YY_BREAK
case 113:
YY_RULE_SETUP
#line 574 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: `endif without a matching `ifdef.\n");
    error_count += 1;
}
	YY_BREAK
case 114:
YY_RULE_SETUP
#line 580 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: macro expansion cannot be directive keywords "
                    "('%s').\n", yytext);
    error_count += 1;
}
	YY_BREAK
/* This pattern notices macros and arranges for them to be replaced. */
case 115:
YY_RULE_SETUP
#line 588 "lexor.lex"
{
    if (macro_needs_args(yytext+1))
	yy_push_state(MA_START);
    else
	do_expand(0);
}
	YY_BREAK
case 116:
YY_RULE_SETUP
#line 595 "lexor.lex"
{ yy_push_state(MN_ESC); }
	YY_BREAK
case 117:
YY_RULE_SETUP
#line 597 "lexor.lex"
{
    yy_pop_state();
    if (macro_needs_args(yytext))
	yy_push_state(MA_START);
    else
	do_expand(0);
}
	YY_BREAK
case 118:
YY_RULE_SETUP
#line 605 "lexor.lex"
{
    yy_pop_state();
    unput(yytext[0]);
    emit_pathline(istack);
    fprintf(stderr, "error: malformed macro name.\n");
    error_count += 1;
}
	YY_BREAK
/* Stringified version of macro expansion. This is an Icarus extension.
     When expanding macro text, the SV usage of `` takes precedence. */
case 119:
YY_RULE_SETUP
#line 615 "lexor.lex"
{
    if (istack->file) {
	assert(do_expand_stringify_flag == 0);
	do_expand_stringify_flag = 1;
	fputc('"', yyout);
	if (macro_needs_args(yytext+2))
	    yy_push_state(MA_START);
	else
	    do_expand(0);
    } else {
	REJECT;
    }
}
	YY_BREAK
/* If we are expanding a macro, remove the SV `` delimiter, otherwise
   * leave it to be handled by the normal rules.
   */
case 120:
YY_RULE_SETUP
#line 632 "lexor.lex"
{ if (istack->file) REJECT; }
	YY_BREAK
/* If we are expanding a macro, handle the SV `" override. This avoids
   * entering CSTRING state, thus allowing nested macro expansions.
   */
case 121:
YY_RULE_SETUP
#line 637 "lexor.lex"
{ if (!istack->file) fputc('"', yyout); else REJECT; }
	YY_BREAK
/* If we are expanding a macro, handle the SV `\`" escape sequence.
   */
case 122:
YY_RULE_SETUP
#line 641 "lexor.lex"
{ if (!istack->file) fputs("\\\"", yyout); else REJECT; }
	YY_BREAK
case 123:
YY_RULE_SETUP
#line 643 "lexor.lex"
{ BEGIN(MA_ADD); macro_start_args(); }
	YY_BREAK
case 124:
YY_RULE_SETUP
#line 645 "lexor.lex"
{}
	YY_BREAK
case 125:
/* rule 125 can match eol */
YY_RULE_SETUP
#line 647 "lexor.lex"
{
    istack->lineno += 1;
    fputc('\n', yyout);
}
	YY_BREAK
case 126:
YY_RULE_SETUP
#line 652 "lexor.lex"
{
    emit_pathline(istack);
    fprintf(stderr, "error: missing argument list for `%s.\n", macro_name());
    error_count += 1;

    yy_pop_state();
    yyless(0);
}
	YY_BREAK
case 127:
YY_RULE_SETUP
#line 661 "lexor.lex"
{ macro_add_to_arg(0); }
	YY_BREAK
case 128:
YY_RULE_SETUP
#line 663 "lexor.lex"
{
    emit_pathline(istack);

    fprintf(stderr, "error: unterminated string.\n");
    error_count += 1;

    BEGIN(ERROR_LINE);
}
	YY_BREAK
case 129:
YY_RULE_SETUP
#line 672 "lexor.lex"
{ macro_add_to_arg(0); }
	YY_BREAK
case 130:
YY_RULE_SETUP
#line 674 "lexor.lex"
{ macro_add_to_arg(1); }
	YY_BREAK
case 131:
YY_RULE_SETUP
#line 676 "lexor.lex"
{ macro_add_to_arg(0); ma_parenthesis_level++; }
	YY_BREAK
case 132:
YY_RULE_SETUP
#line 678 "lexor.lex"
{
    if (ma_parenthesis_level > 0)
	macro_add_to_arg(0);
    else
	macro_finish_arg();
}
	YY_BREAK
case 133:
YY_RULE_SETUP
#line 685 "lexor.lex"
{
    if (ma_parenthesis_level > 0) {
	macro_add_to_arg(0);
	ma_parenthesis_level--;
    } else {
	macro_finish_arg();
	yy_pop_state();
	do_expand(1);
    }
}
	YY_BREAK
case 134:
/* rule 134 can match eol */
YY_RULE_SETUP
#line 696 "lexor.lex"
{
    macro_add_to_arg(1);
    istack->lineno += 1;
    fputc('\n', yyout);
}
	YY_BREAK
case 135:
YY_RULE_SETUP
#line 702 "lexor.lex"
{ macro_add_to_arg(0); }
	YY_BREAK
case 136:
YY_RULE_SETUP
#line 704 "lexor.lex"
{ ECHO; }
	YY_BREAK
case 137:
YY_RULE_SETUP
#line 706 "lexor.lex"
{ comment_enter = YY_START; BEGIN(CCOMMENT); ECHO; }
	YY_BREAK
/* Any text that is not a directive just gets passed through to the
  * output. Very easy.
  */
case 138:
YY_RULE_SETUP
#line 711 "lexor.lex"
{ ECHO; }
	YY_BREAK
case 139:
/* rule 139 can match eol */
#line 713 "lexor.lex"
case 140:
/* rule 140 can match eol */
#line 714 "lexor.lex"
case 141:
/* rule 141 can match eol */
#line 715 "lexor.lex"
case 142:
/* rule 142 can match eol */
YY_RULE_SETUP
#line 715 "lexor.lex"
{ istack->lineno += 1; fputc('\n', yyout); }
	YY_BREAK
/* Absorb the rest of the line when a broken directive is detected. */
case 143:
YY_RULE_SETUP
#line 718 "lexor.lex"
{ yy_pop_state(); }
	YY_BREAK
case 144:
/* rule 144 can match eol */
YY_RULE_SETUP
#line 720 "lexor.lex"
{
    yy_pop_state();
    istack->lineno += 1;
    fputc('\n', yyout);
}
	YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(PPCCOMMENT):
case YY_STATE_EOF(DEF_NAME):
case YY_STATE_EOF(DEF_ESC):
case YY_STATE_EOF(DEF_ARG):
case YY_STATE_EOF(DEF_SEP):
case YY_STATE_EOF(MN_ESC):
case YY_STATE_EOF(MA_START):
case YY_STATE_EOF(MA_ADD):
case YY_STATE_EOF(CCOMMENT):
case YY_STATE_EOF(IFCCOMMENT):
case YY_STATE_EOF(PCOMENT):
case YY_STATE_EOF(CSTRING):
case YY_STATE_EOF(ERROR_LINE):
case YY_STATE_EOF(IFDEF_NAME):
case YY_STATE_EOF(IFNDEF_NAME):
case YY_STATE_EOF(IFDEF_TRUE):
case YY_STATE_EOF(IFDEF_FALSE):
case YY_STATE_EOF(IFDEF_SUPR):
case YY_STATE_EOF(ELSIF_NAME):
case YY_STATE_EOF(ELSIF_SUPR):
case YY_STATE_EOF(ELSE_TRUE):
case YY_STATE_EOF(ELSE_SUPR):
#line 726 "lexor.lex"
{ if (!load_next_input()) yyterminate(); }
	YY_BREAK
case 145:
YY_RULE_SETUP
#line 728 "lexor.lex"
ECHO;
	YY_BREAK
#line 2495 "<stdout>"

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

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

		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed 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_LVALUE->yy_n_chars;
			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
			}

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

			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state(  );

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

			yy_next_state = yy_try_NUL_trans( yy_current_state );

			yy_bp = (yytext_ptr) + YY_MORE_ADJ;

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

			else
				{
				yy_cp = (yy_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_LVALUE->yy_ch_buf[(yy_n_chars)];

				yy_current_state = yy_get_previous_state(  );

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

	default:
		YY_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	} /* end of action switch */
		} /* end of scanning one token */
	} /* end of user's declarations */
} /* 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 (void)
{
    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
	char *source = (yytext_ptr);
	int number_to_move, i;
	int ret_val;

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

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

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

	/* Try to read more data. */

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

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

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

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

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

			YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );

			}

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

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

		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

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

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

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

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

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

	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];

	return ret_val;
}

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

    static yy_state_type yy_get_previous_state (void)
{
	yy_state_type yy_current_state;
	char *yy_cp;
    
	yy_current_state = (yy_start);
	yy_current_state += YY_AT_BOL();

	(yy_state_ptr) = (yy_state_buf);
	*(yy_state_ptr)++ = yy_current_state;

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

	return yy_current_state;
}

/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *	next_state = yy_try_NUL_trans( current_state );
 */
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
{
	int yy_is_jam;
    
	YY_CHAR yy_c = 1;
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
		{
		yy_current_state = (int) yy_def[yy_current_state];
		if ( yy_current_state >= 501 )
			yy_c = yy_meta[yy_c];
		}
	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
	yy_is_jam = (yy_current_state == 500);
	if ( ! yy_is_jam )
		*(yy_state_ptr)++ = yy_current_state;

		return yy_is_jam ? 0 : yy_current_state;
}

#ifndef YY_NO_UNPUT

    static void yyunput (int c, char * yy_bp )
{
	char *yy_cp;
    
    yy_cp = (yy_c_buf_p);

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

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

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

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

		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->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_INPUT
#ifdef __cplusplus
    static int yyinput (void)
#else
    static int input  (void)
#endif

{
	int c;
    
	*(yy_c_buf_p) = (yy_hold_char);

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

		else
			{ /* need more input */
			int offset = (int) ((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 );

					/*FALLTHROUGH*/

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

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

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

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

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

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

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

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

/** Switch to a different input buffer.
 * @param new_buffer The new input buffer.
 * 
 */
    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
{
    
	/* TODO. We should be able to replace this entire function body
	 * with
	 *		yypop_buffer_state();
	 *		yypush_buffer_state(new_buffer);
     */
	yyensure_buffer_stack ();
	if ( YY_CURRENT_BUFFER == new_buffer )
		return;

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

	YY_CURRENT_BUFFER_LVALUE = new_buffer;
	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;
}

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

/** Allocate and initialize an input buffer state.
 * @param file A readable stream.
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 * 
 * @return the allocated buffer state.
 */
    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
{
	YY_BUFFER_STATE b;
    
	b = (YY_BUFFER_STATE) yyalloc( 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 *) yyalloc( (yy_size_t) (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;
}

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

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

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

	yyfree( (void *) b  );
}

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

{
	int oerrno = errno;
    
	yy_flush_buffer( b );

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

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

        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
    
	errno = oerrno;
}

/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 * 
 */
    void yy_flush_buffer (YY_BUFFER_STATE  b )
{
    	if ( ! b )
		return;

	b->yy_n_chars = 0;

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

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

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

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

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

	yyensure_buffer_stack();

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

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

	/* copied from yy_switch_to_buffer. */
	yy_load_buffer_state(  );
	(yy_did_buffer_switch_on_eof) = 1;
}

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

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

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

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

		/* First allocation is just for 2 elements, since we don't know if this
		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
		 * immediate realloc on the next call.
         */
      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
								(num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		if ( ! (yy_buffer_stack) )
			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );

		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));

		(yy_buffer_stack_max) = num_to_alloc;
		(yy_buffer_stack_top) = 0;
		return;
	}

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

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

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

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

/** Setup the input buffer state to scan directly from a user-specified character buffer.
 * @param base the character buffer
 * @param size the size in bytes of the character buffer
 * 
 * @return the newly allocated buffer state object.
 */
YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
{
	YY_BUFFER_STATE b;
    
	if ( size < 2 ||
	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
	     base[size-1] != YY_END_OF_BUFFER_CHAR )
		/* They forgot to leave room for the EOB's. */
		return NULL;

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

	b->yy_buf_size = (int) (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 = NULL;
	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;
}

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

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

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

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

	b = 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;
}

    static void yy_push_state (int  _new_state )
{
    	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_size_t) (yy_start_stack_depth) * sizeof( int );

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

		else
			(yy_start_stack) = (int *) yyrealloc(
					(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);
}

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

	BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
}

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

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

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

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

/** Get the input stream.
 * 
 */
FILE *yyget_in  (void)
{
        return yyin;
}

/** Get the output stream.
 * 
 */
FILE *yyget_out  (void)
{
        return yyout;
}

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

/** Get the current token.
 * 
 */

char *yyget_text  (void)
{
        return yytext;
}

/** Set the current line number.
 * @param _line_number line number
 * 
 */
void yyset_lineno (int  _line_number )
{
    
    yylineno = _line_number;
}

/** Set the input stream. This does not discard the current
 * input buffer.
 * @param _in_str A readable stream.
 * 
 * @see yy_switch_to_buffer
 */
void yyset_in (FILE *  _in_str )
{
        yyin = _in_str ;
}

void yyset_out (FILE *  _out_str )
{
        yyout = _out_str ;
}

int yyget_debug  (void)
{
        return yy_flex_debug;
}

void yyset_debug (int  _bdebug )
{
        yy_flex_debug = _bdebug ;
}

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

    (yy_buffer_stack) = NULL;
    (yy_buffer_stack_top) = 0;
    (yy_buffer_stack_max) = 0;
    (yy_c_buf_p) = NULL;
    (yy_init) = 0;
    (yy_start) = 0;

    (yy_start_stack_ptr) = 0;
    (yy_start_stack_depth) = 0;
    (yy_start_stack) =  NULL;

    (yy_state_buf) = 0;
    (yy_state_ptr) = 0;
    (yy_full_match) = 0;
    (yy_lp) = 0;

/* Defined in main.c */
#ifdef YY_STDINIT
    yyin = stdin;
    yyout = stdout;
#else
    yyin = NULL;
    yyout = NULL;
#endif

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

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

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

    /* Destroy the start condition stack. */
        yyfree( (yy_start_stack)  );
        (yy_start_stack) = NULL;

    yyfree ( (yy_state_buf) );
    (yy_state_buf)  = NULL;

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

    return 0;
}

/*
 * Internal utility routines.
 */

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

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

	return n;
}
#endif

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

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

void yyfree (void * ptr )
{
			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
}

#define YYTABLES_NAME "yytables"

#line 728 "lexor.lex"

/*
 * Parse a `line directive and set the current file name and line
 * number accordingly. This ensures we restore the correct name
 * and line number when returning from an include file or macro
 * expansion. Ignore an invalid directive - the main compiler
 * will report the error.
 */
static void handle_line_directive(void)
{
    char *cpr;
      /* Skip any leading space. */
    char *cp = strchr(yytext, '`');
      /* Skip the `line directive. */
    assert(strncmp(cp, "`line", 5) == 0);
    cp += 5;

      /* strtol skips leading space. */
    long lineno = strtol(cp, &cpr, 10);
    if (cp == cpr || lineno == 0) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid line number for `line directive.\n");
	error_count += 1;
	return;
    }
    if (lineno < 1) {
	emit_pathline(istack);
	fprintf(stderr, "error: Line number for `line directive most be greater than zero.\n");
	error_count += 1;
	return;
    }
    cp = cpr;

      /* Skip the space between the line number and the file name. */
    cpr += strspn(cp, " \t");
    if (cp == cpr) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid `line directive (missing space "
	                "after line number).\n");
	error_count += 1;
	return;
    }
    cp = cpr;

      /* Find the starting " and skip it. */
    char *fn_start = strchr(cp, '"');
    if (cp != fn_start) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid `line directive (file name start).\n");
	error_count += 1;
	return;
    }
    fn_start += 1;

      /* Find the last ". */
    char *fn_end = strrchr(fn_start, '"');
    if (!fn_end) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid `line directive (file name end).\n");
	error_count += 1;
	return;
    }

      /* Skip the space after the file name. */
    cp = fn_end + 1;
    cpr = cp;
    cpr += strspn(cp, " \t");
    if (cp == cpr) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid `line directive (missing space "
	                "after file name).\n");
	error_count += 1;
	return;
    }
    cp = cpr;

      /* Check that the level is correct, we do not need the level. */
    if (strspn(cp, "012") != 1) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid level for `line directive\n");
	error_count += 1;
	return;
    }
    cp += 1;

      /* Verify that only space is left. */
    cp += strspn(cp, " \t");
    if (strncmp(cp, "//", 2) != 0 &&
	(size_t)(cp-yytext) != strlen(yytext)) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid `line directive (extra garbage "
	                "after level).\n");
	error_count += 1;
	return;
    }

      /* Update the current file name and line number. Subtract 1 from
         the line number because `line sets the number for the next
         line, and 1 because our line numbers are zero-based. This
         will underflow on line 1, but that's OK because we are using
         unsigned arithmetic. */
    assert(istack);
    istack->path = realloc(istack->path, fn_end-fn_start+1);
    strncpy(istack->path, fn_start, fn_end-fn_start);
    istack->path[fn_end-fn_start] = '\0';
    istack->lineno = lineno - 2;
}

/*
 * Parse a `pragma directive to make sure it has a name.
 */
static void handle_pragma_directive(void)
{
    char *cpr;
      /* Skip any leading space. */
    char *cp = strchr(yytext, '`');
      /* Skip the `pragma directive. */
    assert(strncmp(cp, "`pragma", 7) == 0);
    cp += 7;

      /* Skip the space between the pragma directive and the name. */
    cpr = cp;
    cpr += strspn(cp, " \t");
    if (cp == cpr) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid `pragma directive (missing space "
	                "between the directive and name).\n");
	error_count += 1;
	return;
    }
    cp = cpr;

      /* Check that there is a pragma name. */
    if (!(isalpha((int)*cp) || *cp == '_')) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid `pragma directive (invalid or "
	                "missing name).\n");
	error_count += 1;
	return;
    }
    ++cp;
    while (isalnum((int)*cp) || *cp == '_' || *cp == '$') ++cp;

      /* Verify that space, a comment or EOL is next. */
    cpr = cp;
    cpr += strspn(cp, " \t");
    if (cp == cpr && strncmp(cp, "//", 2) != 0 &&
	(size_t)(cp-yytext) != strlen(yytext)) {
	emit_pathline(istack);
	fprintf(stderr, "error: Invalid `pragma directive (invalid name or "
	                "missing space between name and expression).\n");
	error_count += 1;
	return;
    }
}

 /* Defined macros are kept in this table for convenient lookup. As
  * `define directives are matched (and the do_define() function
  * called) the tree is built up to match names with values. If a
  * define redefines an existing name, the new value it taken.
  */
struct define_t
{
    char*   name;
    char*   value;
    int     keyword; /* keywords don't get rescanned for fresh values. */
    int     argc;
    char**  defaults;
    int     magic; /* 1 for 'magic' macros like __FILE__ and __LINE__. magic
                    * macros cannot be undefined. magic macros are expanded
                    * by do_magic. N.B. DON'T set a magic macro with
                    * argc > 1 or with keyword true. */

    struct define_t*    left;
    struct define_t*    right;
    struct define_t*    up;
};

static struct define_t* def_table = 0;

/*
 * magic macros
 */
static struct define_t def_FILE;
static struct define_t def_LINE =
{
    .name       = "__LINE__",
    .value      = "__LINE__",
    .keyword    = 0,
    .argc       = 1,
    .magic      = 1,
    .left       = &def_FILE,
    .right      = 0,
    .up         = 0
};
static struct define_t def_FILE =
{
    .name       = "__FILE__",
    .value      = "__FILE__",
    .keyword    = 0,
    .argc       = 1,
    .magic      = 1,
    .left       = 0,
    .right      = 0,
    .up         = &def_LINE
};
static struct define_t* magic_table = &def_LINE;


/*
 * helper function for def_lookup
 */
static struct define_t* def_lookup_internal(const char*name, struct define_t*cur)
{
    if (cur == 0) return 0;

    assert(cur->up == 0);

    while (cur) {
	int cmp = strcmp(name, cur->name);

	if (cmp == 0) return cur;

	cur = (cmp < 0) ? cur->left : cur->right;
    }

    return 0;
}

static struct define_t* def_lookup(const char*name)
{
    // first, try a magic macro
    if(name[0] == '_' && name[1] == '_' && name[2] != '\0') {
	struct define_t* result = def_lookup_internal(name, magic_table);
	if(result) {
	    return result;
	}
    }

    // either there was no matching magic macro, or we didn't try looking
    // look for a normal macro
    return def_lookup_internal(name, def_table);
}


static int is_defined(const char*name)
{
    return def_lookup(name) != 0;
}

/*
 * The following variables are used to temporarily hold the name and
 * formal arguments of a macro definition as it is being parsed. As
 * for C program arguments, def_argc counts the arguments (including
 * the macro name), the value returned by def_argv(0) points to the
 * macro name, the value returned by def_argv(1) points to the first
 * argument, and so on.
 *
 * These variables are also used for storing the actual arguments when
 * a macro is instantiated.
 */
#define MAX_DEF_ARG 256 /* allows argument IDs to be stored in a single char */

#define DEF_BUF_CHUNK 256

/*
 * During parse of macro definitions, and the name/arguments in
 * particular, keep the names and name lengths in a compact stretch of
 * memory. Note that we do not keep the argument names once the
 * definition is fully processed, because arguments are always
 * positional and the definition string is replaced with position
 * tokens.
 */
static char* def_buf = 0;
static int   def_buf_size = 0;
static int   def_buf_free = 0;

static int   def_argc = 0;
static int   def_argo[MAX_DEF_ARG];  /* offset of first character of arg name */
static int   def_argl[MAX_DEF_ARG];  /* lengths of arg names. */
static int   def_argd[MAX_DEF_ARG];  /* Offset of default value */

/*
 * Return a pointer to the start of argument 'arg'. Returned pointers
 * may go stale after a call to def_buf_grow_to_fit.
 */
static /* inline */ char* def_argv(int arg)
{
    return def_buf + def_argo[arg];
}

static void early_exit(void)
{
    fprintf(yyout, "// Icarus preprocessor had (%u) errors.\n", error_count);
    exit(1);
}

static void check_for_max_args(void)
{
    if (def_argc == MAX_DEF_ARG) {
	emit_pathline(istack);
	fprintf(stderr, "error: too many macro arguments - aborting\n");
	error_count += 1;
	early_exit();
    }
}

static void def_buf_grow_to_fit(int length)
{
    while (length >= def_buf_free)
    {
	def_buf_size += DEF_BUF_CHUNK;
	def_buf_free += DEF_BUF_CHUNK;
	def_buf = realloc(def_buf, def_buf_size);
	assert(def_buf != 0);
    }
}

static void def_start(void)
{
    def_buf_free = def_buf_size;
    def_argc = 0;
    def_add_arg();
}

static void def_add_arg(void)
{
    int length = yyleng;

    check_for_max_args();

    /* Remove trailing white space and, if necessary, opening brace. */
    while (isspace((int)yytext[length - 1])) length--;

      /* This can happen because we are also processing "argv[0]", the
	 macro name, as a pseudo-argument. The lexor will match that
	 as name(, so chop off the ( here. If we have an escaped name,
	 we also need to strip off the white space that terminates the
	 name. */
    if (yytext[length -  1] == '(') {
	length--;
	while (isspace((int)yytext[length - 1])) length--;
    }

    yytext[length] = 0;

    char*arg = yytext;
    char*val;
    int  val_length = 0;

      /* Break into ARG = value. This happens if the source specifies
	 a default value for the formal argument. In that case, the
	 lexor will match the whole thing as the argument and it is up
	 to us to chop it up to name and value. */
    if ( (val=strchr(arg,'=')) ) {
	  *val++ = 0;
	  while (*val && isspace((int)*val)) val += 1;

	  val_length = strlen(val);
	  while (val_length>0 && isspace((int)val[val_length-1])) {
		val_length -= 1;
		val[val_length] = 0;
	  }

	    /* Strip white space from between arg and "=". */
	  length = strlen(arg);
	  while (length>0 && isspace((int)arg[length-1])) {
		length -= 1;
		arg[length] = 0;
	  }
    }

    /* Make sure there's room in the buffer for the new argument. */
    def_buf_grow_to_fit(length);

    /* Store the new argument name. */
    def_argl[def_argc] = length;
    def_argo[def_argc] = def_buf_size - def_buf_free;
    strcpy(def_argv(def_argc), arg);
    def_buf_free -= length + 1;

      /* If there is a default text, then stash it away as well. */
    if (val) {
	  def_buf_grow_to_fit(val_length);
	  def_argd[def_argc] = def_buf_size - def_buf_free;
	  strcpy(def_buf+def_argd[def_argc], val);
	  def_buf_free -= val_length + 1;
    } else {
	  def_argd[def_argc] = 0;
    }

    def_argc += 1;
}

void define_macro(const char* name, const char* value, int keyword, int argc)
{
    int idx;
    struct define_t* def;

    /* Verilog has a very nasty system of macros jumping from
     * file to file, resulting in a global macro scope. Here
     * we optionally warn about any redefinitions.
     *
     * If istack is empty, we are processing a configuration
     * or precompiled macro file, so don't want to check for
     * redefinitions - when a precompiled macro file is used,
     * it will contain copies of any predefined macros.
     */
    if (warn_redef && istack) {
	const struct define_t* prev = def_lookup(name);
	if (prev && (warn_redef_all || (strcmp(prev->value, value) != 0))) {
	    emit_pathline(istack);
	    fprintf(stderr, "warning: redefinition of macro %s from value '%s' to '%s'\n",
	    name, prev->value, value);
	}
    }

    def = malloc(sizeof(struct define_t));
    def->name = strdup(name);
    def->value = strdup(value);
    def->keyword = keyword;
    def->argc = argc;
    def->magic = 0;
    def->left = 0;
    def->right = 0;
    def->up = 0;
    def->defaults = calloc(argc, sizeof(char*));
    for (idx = 0 ; idx < argc ; idx += 1) {
	  if (def_argd[idx] == 0) {
		def->defaults[idx] = 0;
	  } else {
		def->defaults[idx] = strdup(def_buf+def_argd[idx]);
	  }
    }

    if (def_table == 0) {
	def_table = def;
    } else {
	struct define_t* cur = def_table;

	while (1) {
	    int cmp = strcmp(def->name, cur->name);

	    if (cmp == 0) {
		free(cur->value);
		cur->value = def->value;
		free(def->name);
		free(def);
		break;
	    } else if (cmp < 0) {
		if (cur->left != 0) {
		    cur = cur->left;
		} else {
		    cur->left = def;
		    def->up = cur;
		    break;
		}
	    } else {
		if (cur->right != 0) {
		    cur = cur->right;
		} else {
		    cur->right = def;
		    def->up = cur;
		    break;
		}
	    }
	}
    }
}

static void free_macro(struct define_t* def)
{
    int idx;
    if (def == 0) return;
    free_macro(def->left);
    free_macro(def->right);
    free(def->name);
    free(def->value);
    for (idx = 0 ; idx < def->argc ; idx += 1) free(def->defaults[idx]);
    free(def->defaults);
    free(def);
}

void free_macros(void)
{
    free_macro(def_table);
}

/*
 * The do_define function accumulates the defined value in these
 * variables. When the define is over, the def_finish() function
 * executes the define and clears this text. The define_continue_flag
 * is set if do_define detects that the definition is to be continued
 * on the next line. The define_comment_flag is set when a multi-line comment is
 * active in a define.
 */
static char*  define_text = 0;
static size_t define_cnt = 0;

static int define_continue_flag = 0;
static int define_comment_flag = 0;

/*
 * The do_magic function puts the expansions of magic macros into
 * this buffer and returns its address. It reallocs as needed to
 * fit its whole expansion. Because of this, do_magic is
 * -NOT REENTRANT-. It is called from do_expand, which strdups
 * or otherwise copies the result before doing any recursion, so
 * I don't anticipate any problems.
 */
static char* magic_text = 0;
static size_t magic_cnt = 0;

/*
 * Define a special character code used to mark the insertion point
 * for arguments in the macro text. This should be a character that
 * will not occur in the Verilog source code.
 */
#define ARG_MARK '\a'

#define _STR1(x) #x
#define _STR2(x) _STR1(x)

static int is_id_char(char c)
{
    return isalnum((int)c) || c == '_' || c == '$';
}

/*
 * Find an argument, but only if it is not directly preceded by something
 * that would make it part of another simple identifier ([a-zA-Z0-9_$]).
 */
static char *find_arg(char*ptr, const char*head, const char*arg)
{
    char *cp = ptr;
    size_t len = strlen(arg);

    while (1) {
	/* Look for a candidate match, just return if none is found. */
	cp = strstr(cp, arg);
	if (!cp) break;

	/* Verify that this match is not in the middle of another identifier. */
	if ((cp != head && is_id_char(cp[-1])) || is_id_char(cp[len])) {
	    cp++;
	    continue;
	}

	break;
    }

    return cp;
}

/*
 * Returns 1 if the comment continues on the next line
 */
static int do_define_multiline_comment(char *replace_start,
				       const char *search_start)
{
    char *tail = strstr(search_start, "*/");

    if (!tail) {
	if (search_start[strlen(search_start) - 1] == '\\') {
	    define_continue_flag = 1;
	    define_comment_flag = 1;
	    *replace_start++ = '\\';
	} else {
	    define_comment_flag = 0;
	    fprintf(stderr, "%s:%u: Unterminated comment in define\n",
	                    istack->path, istack->lineno+1);
	}
	*replace_start = '\0';
	return 1;
    }
    define_comment_flag = 0;
    tail += 2;
    memmove(replace_start, tail, strlen(tail) + 1);
    return 0;
}

/*
 * Collect the definition. Normally, this returns 0. If there is a
 * continuation, then return 1 and this function may be called again
 * to collect another line of the definition.
 */
static void do_define(void)
{
    char* cp;
    char* head;
    char* tail;
    int added_cnt;
    int arg;

    define_continue_flag = 0;

    /* Are we in an multi-line comment? Look for the end */
    if (define_comment_flag) {
	if (do_define_multiline_comment(yytext, yytext))
	    return;
    }

    /* Look for comments in the definition, and remove them. */
    cp = strchr(yytext, '/');

    while (cp && *cp) {
	if (cp[1] == '/') {
	    if (cp[strlen(cp) - 1] == '\\') {
		define_continue_flag = 1;
		*cp++ = '\\';
	    }
	    *cp = 0;
	    break;
	} else if (cp[1] == '*') {
	    if (do_define_multiline_comment(cp, cp + 2))
		break;
	} else {
	    cp++;
	}

	cp = strchr(cp, '/');
    }

    /* Trim trailing white space. */
    cp = yytext + strlen(yytext);
    while (cp > yytext) {
	if (!isspace((int)cp[-1])) break;

	cp -= 1;
	*cp = 0;
    }

    /* Detect the continuation sequence. If I find it, remove it
     * and the white space that precedes it, then replace all that
     * with a single newline.
     */
    if ((cp > yytext) && (cp[-1] == '\\')) {
	cp -= 1;
	cp[0] = 0;

	while ((cp > yytext) && isspace((int)cp[-1])) {
	    cp -= 1;
	    *cp = 0;
	}

	*cp++ = '\n';
	*cp = 0;

	define_continue_flag = 1;
    }

    /* Accumulate this text into the define_text string. */
    define_text = realloc(define_text, define_cnt + (cp-yytext) + 1);

    head = &define_text[define_cnt];
    strcpy(head, yytext);

    define_cnt += cp-yytext;

    tail = &define_text[define_cnt];

    /* If the text for a macro with arguments contains occurrences
     * of ARG_MARK, issue an error message and suppress the macro.
     */
    if ((def_argc > 1) && strchr(head, ARG_MARK)) {
	emit_pathline(istack);
	def_argc = 0;

	fprintf(stderr, "error: implementation restriction - "
	                "macro text may not contain a %s character\n",
	                _STR2(ARG_MARK));
	error_count += 1;
    }

    /* Look for formal argument names in the definition, and replace
     * each occurrence with the sequence ARG_MARK,'\ddd' where ddd is
     * the  formal argument index number.
     */
    added_cnt = 0;
    for (arg = 1; arg < def_argc; arg++) {
	int argl = def_argl[arg];

	cp = find_arg(head, head, def_argv(arg));

	while (cp && *cp) {
	    added_cnt += 2 - argl;

	    if (added_cnt > 0) {
		size_t head_idx = head - define_text;
		size_t tail_idx = tail - define_text;
		size_t cp_idx   = cp   - define_text;

		define_cnt += added_cnt;
		define_text = realloc(define_text, define_cnt + 1);

		head = &define_text[head_idx];
		tail = &define_text[tail_idx];
		cp   = &define_text[cp_idx];

		added_cnt = 0;
	    }

	    memmove(cp+2, cp+argl, tail-(cp+argl)+1);

	    tail += 2 - argl;

	    *cp++ = ARG_MARK;
	    *cp++ = arg;
	    cp = find_arg(cp, head, def_argv(arg));
	}
    }
    define_cnt += added_cnt;
}

/*
 * Return true if the definition text is done. This is the opposite of
 * the define_continue_flag.
 */
static int def_is_done(void)
{
    return !define_continue_flag;
}

/*
 * Reset the define_continue_flag.
 */
static void def_continue(void)
{
    define_continue_flag = 0;
}

/*
 * After some number of calls to do_define, this function is called to
 * assigned value to the parsed name. If there is no value, then
 * assign the string "" (empty string.)
 */
static void def_finish(void)
{
    define_continue_flag = 0;

    if (def_argc <= 0) return;

    if (!define_text) {
	define_macro(def_argv(0), "", 0, def_argc);
    } else {
	define_macro(def_argv(0), define_text, 0, def_argc);

	free(define_text);

	define_text = 0;
	define_cnt = 0;
    }

    def_argc = 0;
}

static void def_undefine(void)
{
    struct define_t* cur;
    struct define_t* tail;
    int idx;

    /* def_buf is used to store the macro name. Make sure there is
     * enough space.
     */
    def_buf_grow_to_fit(yyleng);

    sscanf(yytext, "`undef %s", def_buf);

    cur = def_lookup(def_buf);
    if (cur == 0) return;
    if (cur->magic) return;

    if (cur->up == 0) {
	if ((cur->left == 0) && (cur->right == 0)) {
	    def_table = 0;
	} else if (cur->left == 0) {
	    def_table = cur->right;
	    if (cur->right)
	    cur->right->up = 0;
	} else if (cur->right == 0) {
	    assert(cur->left);
	    def_table = cur->left;
	    def_table->up = 0;
	} else {
	    tail = cur->left;
	    while (tail->right)
		tail = tail->right;

	    tail->right = cur->right;
	    tail->right->up = tail;

	    def_table = cur->left;
	    def_table->up = 0;
	}
    } else if (cur->left == 0) {
	if (cur->up->left == cur) {
	    cur->up->left = cur->right;
	} else {
	    assert(cur->up->right == cur);
	    cur->up->right = cur->right;
	}

	if (cur->right) cur->right->up = cur->up;
    }
    else if (cur->right == 0) {
	assert(cur->left);

	if (cur->up->left == cur) {
	    cur->up->left = cur->left;
	} else {
	    assert(cur->up->right == cur);
	    cur->up->right = cur->left;
	}

	cur->left->up = cur->up;
    } else {
	tail = cur->left;

	assert(cur->left && cur->right);

	while (tail->right) tail = tail->right;

	tail->right = cur->right;
	tail->right->up = tail;

	if (cur->up->left == cur) {
	    cur->up->left = cur->left;
	} else {
	    assert(cur->up->right == cur);
	    cur->up->right = cur->left;
	}

	cur->left->up = cur->up;
    }

    free(cur->name);
    free(cur->value);
    for (idx = 0 ; idx < cur->argc ; idx += 1) free(cur->defaults[idx]);
    free(cur->defaults);
    free(cur);
}

/*
 * When a macro is instantiated in the source, macro_needs_args() is
 * used to look up the name and return whether it is a macro that
 * takes arguments. A pointer to the macro descriptor is stored in
 * cur_macro so that do_expand() doesn't need to look it up again.
 */
static struct define_t* cur_macro = 0;

static int macro_needs_args(const char*text)
{
    cur_macro = def_lookup(text);

    if (cur_macro) {
	return (cur_macro->argc > 1);
    } else {
	emit_pathline(istack);
	fprintf(stderr, "warning: macro %s undefined (and assumed null) at this point.\n", text);
	return 0;
    }
}

static const char* macro_name(void)
{
    return cur_macro ? cur_macro->name : "";
}

static void macro_start_args(void)
{
    /* The macro name can be found via cur_macro, so create a null
     * entry for arg 0. This will be used by macro_finish_arg() to
     * calculate the buffer location for arg 1.
     */
    if (def_buf) {
      def_buf_free = def_buf_size - 1;
      def_buf[0] = 0;
    }
    def_argo[0] = 0;
    def_argl[0] = 0;
    def_argc = 1;
}

static void macro_add_to_arg(int is_white_space)
{
    char* tail;
    int   length = yyleng;

    check_for_max_args();

    /* Replace any run of white space with a single space */
    if (is_white_space) {
	yytext[0] = ' ';
	yytext[1] = 0;
	length = 1;
    }

    /* Make sure there's room in the buffer for the new argument. */
    def_buf_grow_to_fit(length);

    /* Store the new text. */
    tail = &def_buf[def_buf_size - def_buf_free];
    strcpy(tail, yytext);
    def_buf_free -= length;
}

static void macro_finish_arg(void)
{
    int   offs;
    const char* head;
    char* tail;

    check_for_max_args();

    offs = def_argo[def_argc-1] + def_argl[def_argc-1] + 1;
    head = &def_buf[offs];
    tail = &def_buf[def_buf_size - def_buf_free];

    /* Eat any leading and trailing white space. */
    if ((head < tail) && (*head == ' ')) {
	offs++;
	head++;
    }
    if ((tail > head) && (*(tail-1) == ' ')) {
	def_buf_free++;
	tail--;
    }

    *tail = 0;

    def_argo[def_argc] = offs;
    def_argl[def_argc] = tail - head;

    def_buf_free -= 1;
    def_argc++;
}

/*
 * The following variables are used to hold macro expansions that are
 * built dynamically using supplied arguments. Buffer space is allocated
 * as the macro is expanded, and is only released once the expansion has
 * been reparsed. This means that the buffer acts as a stack for nested
 * macro expansions.
 *
 * The expansion buffer is only used for macros with arguments - the
 * text for simple macros can be taken directly from the macro table.
 */
#define EXP_BUF_CHUNK 256

static char*exp_buf = 0;
static int  exp_buf_size = 0;
static int  exp_buf_free = 0;

static void exp_buf_grow_to_fit(int length)
{
    while (length >= exp_buf_free) {
	exp_buf_size += EXP_BUF_CHUNK;
	exp_buf_free += EXP_BUF_CHUNK;
	exp_buf = realloc(exp_buf, exp_buf_size);
    }
}

static void expand_using_args(void)
{
    char* head;
    char* tail;
    char* dest;
    int arg;
    int length;

    if (def_argc > cur_macro->argc) {
	emit_pathline(istack);
	fprintf(stderr, "error: too many arguments for `%s\n", cur_macro->name);
	error_count += 1;
	return;
    }
    while (def_argc < cur_macro->argc) {
	if (cur_macro->defaults[def_argc]) {
	    def_argl[def_argc] = 0;
	    def_argc += 1;
	    continue;
	}
	emit_pathline(istack);
	fprintf(stderr, "error: too few arguments for `%s\n", cur_macro->name);
	error_count += 1;
	return;
    }
    assert(def_argc == cur_macro->argc);

    head = cur_macro->value;
    tail = head;

    while (*tail) {
	if (*tail != ARG_MARK) {
	    tail++;
	} else {
	    arg = tail[1]; assert(arg < def_argc);

	    const char*use_argv;
	    int  use_argl;
	    if (def_argl[arg] == 0 && cur_macro->defaults[arg]) {
		  use_argv = cur_macro->defaults[arg];
		  use_argl = strlen(use_argv);
	    } else {
		  use_argv = def_argv(arg);
		  use_argl = def_argl[arg];
	    }
	    length = (tail - head) + use_argl;
	    exp_buf_grow_to_fit(length);

	    dest = &exp_buf[exp_buf_size - exp_buf_free];
	    memcpy(dest, head, tail - head);
	    dest += tail - head;
	    memcpy(dest, use_argv, use_argl);

	    exp_buf_free -= length;

	    head = tail + 2;
	    tail = head;
	}
    }

    length = tail - head;
    exp_buf_grow_to_fit(length);

    dest = &exp_buf[exp_buf_size - exp_buf_free];
    memcpy(dest, head, length + 1);

    exp_buf_free -= length + 1;
}

/*
 * When a macro use is discovered in the source, this function is
 * used to emit the substitution in its place.
 */
static void do_expand(int use_args)
{
    if (cur_macro) {
	struct include_stack_t*isp;
	int head = 0;
	const char *cp;
	unsigned escapes = 0;

	if (cur_macro->keyword) {
	    fprintf(yyout, "%s", cur_macro->value);
	    if (do_expand_stringify_flag) {
		do_expand_stringify_flag = 0;
		fputc('"', yyout);
	    }
	    return;
	}

	if (use_args) {
	    int tail = 0;
	    head = exp_buf_size - exp_buf_free;
	    expand_using_args();
	    tail = exp_buf_size - exp_buf_free;
	    exp_buf_free += tail - head;

	    if (tail == head) return;
	}

	isp = (struct include_stack_t*) calloc(1, sizeof(struct include_stack_t));

	isp->stringify_flag = do_expand_stringify_flag;
	do_expand_stringify_flag = 0;
	if (use_args) {
	    isp->str = &exp_buf[head];
	} else if(cur_macro->magic) {
	    // cast const char * to char * to suppress warning, since we won't
	    // be modifying isp->str in place.
	    isp->str = (char*)do_magic(cur_macro->name);
	} else {
	    isp->str = cur_macro->value;
	}

	/* Escape some characters if we are making a string version. */
	for (cp = isp->str; (cp = strpbrk(cp, "\"\\")); cp += 1, escapes += 1);
	if (escapes && isp->stringify_flag) {
	    unsigned idx = 0;
	    char *str_buf;
	    str_buf = (char *) malloc(strlen(isp->str)+3*escapes+1);
	    for (cp = isp->str; *cp; cp += 1) {
		if (*cp == '"') {
		    str_buf[idx] = '\\';
		    str_buf[idx+1] = '0';
		    str_buf[idx+2] = '4';
		    str_buf[idx+3] = '2';
		    idx += 4;
		    continue;
		}
		if (*cp == '\\') {
		    str_buf[idx] = '\\';
		    str_buf[idx+1] = '1';
		    str_buf[idx+2] = '3';
		    str_buf[idx+3] = '4';
		    idx += 4;
		    continue;
		}
		str_buf[idx] = *cp;
		idx += 1;
	    }
	    str_buf[idx] = 0;
	    idx += 1;

	    exp_buf_free -= idx;

	    isp->str = str_buf;
	} else isp->str = strdup(isp->str);

	isp->orig_str = isp->str;
	isp->next = istack;
	istack->yybs = YY_CURRENT_BUFFER;
	istack = isp;

	yy_switch_to_buffer(yy_create_buffer(istack->file, YY_BUF_SIZE));
    } else {
	  if (do_expand_stringify_flag) {
		do_expand_stringify_flag = 0;
		fputc('"', yyout);
	  }
    }
}

/*
 * Expand the magic macro named name. Return a buffer containing the expansion.
 */
static const char* do_magic(const char*name)
{
    size_t desired_cnt;

    if(!magic_text) magic_text = malloc(24); // unimportant initial size

    if(!strcmp(name, "__LINE__")) {
	// istack->lineno is unsigned. the largest it could be is 64 bits.
	// 2^64 is between 10^19 and 10^20. So the decimal representation of
	// lineno can't possibly be longer than 23 bytes. I'm generous but
	// bytes are cheap and this is nobody's critical path.
	desired_cnt = 24;

	if(magic_cnt < desired_cnt) {
	    magic_text = realloc(magic_text, desired_cnt);
	    assert(magic_text);
	    magic_cnt = desired_cnt;
	}

	int actual_len = snprintf(magic_text, desired_cnt,
	                          "%u", get_line(istack));
	assert(actual_len >= 0);
	assert((unsigned) actual_len < desired_cnt);
	return magic_text;
    } else if(!strcmp(name, "__FILE__")) {
	const char *path = get_path(istack);
	if(path) {
	    desired_cnt = strlen(path)+2+1; // two quotes and a null

	    if(magic_cnt < desired_cnt) {
		magic_text = realloc(magic_text, desired_cnt);
		assert(magic_text);
		magic_cnt = desired_cnt;
	    }

	    int actual_len = snprintf(magic_text, desired_cnt,
	                              "\"%s\"", path);

	    assert(actual_len >= 0);
	    assert((unsigned) actual_len < (unsigned)desired_cnt);
	    return magic_text;
	}
    }

    // if we get here, then either there was no magic macro with the requested
    // name, or for some reason (an error?) we want to return an empty string
    assert(magic_cnt > 0);
    magic_text[0] = '\0';
    return magic_text;
}


/*
 * Include file handling works by keeping an include stack of the
 * files that are opened and being processed. The first item on the
 * stack is the current file being scanned. If I get to an include
 * statement,
 *
 *    open the new file,
 *    save the current buffer context,
 *    create a new buffer context,
 *    and push the new file information.
 *
 * When the file runs out, it is closed and the buffer is deleted
 * If after popping the current file information there is another
 * file on the stack, that file's buffer context is restored and
 * parsing resumes.
 */

static void output_init(void)
{
    if (line_direct_flag) {
	fprintf(yyout, "`line 1 \"%s\" 0\n", istack->path);
    }
}

static void include_filename(int macro_str)
{
    if(standby) {
	emit_pathline(istack);
	fprintf(stderr,
	        "error: malformed `include directive. Extra junk on line?\n");
	error_count += 1;
	early_exit();
    }

    standby = malloc(sizeof(struct include_stack_t));
    standby->path = strdup(yytext+1+macro_str);
    standby->path[strlen(standby->path)-1-macro_str] = 0;
    standby->lineno = 0;
    standby->comment = NULL;
}

static void do_include(void)
{
    /* standby is defined by include_filename() */
    if (standby->path[0] == '/') {
	if ((standby->file = fopen(standby->path, "r"))) {
	    standby->file_close = fclose;
	    goto code_that_switches_buffers;
	}
    } else {
	unsigned idx, start = 1;
	char path[4096];
	char *cp;
	struct include_stack_t* isp;

	/* Add the current path to the start of the include_dir list. */
	isp = istack;
	while(isp && (isp->path == NULL)) isp = isp->next;

	assert(isp);

	strcpy(path, isp->path);
	cp = strrchr(path, '/');

	/* I may need the relative path for a planned warning even when
	 * we are not in relative mode, so for now keep it around. */
	if (cp != 0) {
	    *cp = '\0';
	    include_dir[0] = strdup(path);
	    if (relative_include) start = 0;
	}

	for (idx = start ;  idx < include_cnt ;  idx += 1) {
	    snprintf(path, sizeof(path), "%s/%s",
	             include_dir[idx], standby->path);

	    if ((standby->file = fopen(path, "r"))) {
		standby->file_close = fclose;
		/* Free the original path before we overwrite it. */
		free(standby->path);
		standby->path = strdup(path);
		goto code_that_switches_buffers;
	    }
	}
    }

    emit_pathline(istack);
    fprintf(stderr, "Include file %s not found\n", standby->path);
    error_count += 1;
    early_exit();

code_that_switches_buffers:

    /* Clear the current files path from the search list. */
    free(include_dir[0]);
    include_dir[0] = 0;

    if (depend_file) {
	if (dep_mode == 'p') {
	    fprintf(depend_file, "I %s\n", standby->path);
	} else if (dep_mode != 'm') {
	    fprintf(depend_file, "%s\n", standby->path);
	}
    }

    if (line_direct_flag) {
	fprintf(yyout, "\n`line 1 \"%s\" 1\n", standby->path);
    }

    standby->next = istack;
    standby->stringify_flag = 0;

    istack->yybs = YY_CURRENT_BUFFER;
    istack = standby;

    standby = 0;

    yy_switch_to_buffer(yy_create_buffer(istack->file, YY_BUF_SIZE));
}

/*
 * walk the include stack until we find an entry with a valid pathname,
 * and return the line from that entry for use in an error message.
 * This is the real file and line in which the outermost macro was used.
 */
static unsigned get_line(struct include_stack_t* isp)
{
    while(isp && (isp->path == NULL)) isp = isp->next;

    assert(isp);

    return isp->lineno+1;
}

/*
 * walk the include stack until we find an entry with a valid pathname,
 * and return the path from that entry for use in an error message.
 * This is the real file and line in which the outermost macro was used.
 */
static const char* get_path(struct include_stack_t* isp)
{
    while(isp && (isp->path == NULL)) isp = isp->next;

    assert(isp);

    return isp->path;
}

/* walk the include stack until we find an entry with a valid pathname,
 * and print the file and line from that entry for use in an error message.
 * The istack entries created by do_expand() for macro expansions do not
 * contain pathnames. This finds instead the real file in which the outermost
 * macro was used.
 */
static void emit_pathline(struct include_stack_t* isp)
{
    while(isp && (isp->path == NULL)) isp = isp->next;

    assert(isp);

    fprintf(stderr, "%s:%u: ", isp->path, isp->lineno+1);
}

static void lexor_done(void)
{
    while (ifdef_stack) {
	struct ifdef_stack_t*cur = ifdef_stack;
	ifdef_stack = cur->next;

	fprintf(stderr, "%s:%u: error: This `ifdef lacks an `endif.\n",
	                cur->path, cur->lineno+1);
	error_count += 1;

	free(cur->path);
	free(cur);
    }
}

/*
 * Use this function to open a source file that is to be
 * processed. Do NOT use this function for opening include files,
 * instead only use this file for opening base source files.
 */
static void open_input_file(struct include_stack_t*isp)
{
      const char*cp;
      int is_vhdl = 0;
      unsigned idx;

      isp->file = 0;

	/* look for a suffix for the input file. If the suffix
	   indicates that this is a VHDL source file, then invoke
	   vhdlpp to get a data stream. */
      cp = strrchr(isp->path, '.');
      if (cp && vhdlpp_path) {
	    if (strcmp(cp, ".vhd") == 0) {
		  is_vhdl = 1;
	    } else if (strcmp(cp, ".vhdl") == 0) {
		  is_vhdl = 1;
	    }
      }

      if (is_vhdl == 0) {
	    isp->file = fopen(isp->path, "r");
	    isp->file_close = fclose;
	    return;
      }

      size_t cmdlen = strlen(vhdlpp_path);
      cmdlen += strlen(isp->path);
      cmdlen += 8+strlen(vhdlpp_work);

      size_t liblen = 1;
      char*libs = strdup("");
      for (idx = 0 ; idx < vhdlpp_libdir_cnt ; idx += 1) {
	    size_t next_len = 6 + strlen(vhdlpp_libdir[idx]);
	    libs = realloc(libs, liblen+next_len);
	    snprintf(libs+liblen-1, next_len, " -L\"%s\"", vhdlpp_libdir[idx]);
	    liblen = strlen(libs) + 1;
      }

      cmdlen += liblen;

      char*cmd = malloc(cmdlen);
      snprintf(cmd, cmdlen, "%s -w\"%s\"%s %s", vhdlpp_path, vhdlpp_work, libs, isp->path);

      if (verbose_flag) fprintf(stderr, "Invoke vhdlpp: %s\n", cmd);

      isp->file = popen(cmd, "r");
      isp->file_close = pclose;

      free(libs);
      free(cmd);
      return;
}

/*
 * The load_next_input() function is called by the lexical analyzer
 * when the current file runs out. When the EOF of the current input
 * file is matched, this function figures out if this is the end of an
 * included file (in which case the including file is resumed) or the
 * end of a base file, in which case the next base source file is
 * opened.
 */
static int load_next_input(void)
{
    int line_mask_flag = 0;
    struct include_stack_t* isp = istack;
    istack = isp->next;

    /* Delete the current input buffers, and free the cell. */
    yy_delete_buffer(YY_CURRENT_BUFFER);

    /* If there was a comment for this include print it before we
     * return to the previous input stream. This technically belongs
     * to the previous stream, but it should not create any problems
     * since it is only a comment.
     */
    if (isp->comment) {
	fprintf(yyout, "%s\n", isp->comment);
	free(isp->comment);
	isp->comment = NULL;
    }

    if (isp->file) {
	free(isp->path);
	assert(isp->file_close);
	isp->file_close(isp->file);
    } else {
	/* If I am printing line directives and I just finished
	 * macro substitution, I should terminate the line and
	 * arrange for a new directive to be printed.
	 */
	if (line_direct_flag && istack && istack->path && isp->lineno) {
	    fprintf(yyout, "\n");
	} else line_mask_flag = 1;

	free(isp->orig_str);
    }

    if (isp->stringify_flag) fputc('"', yyout);

    free(isp);

    /* If I am out of include stack, the main input is
     * done. Look for another file to process in the input
     * queue. If none are there, give up. Otherwise, open the file
     * and continue parsing.
     */
    if (istack == 0) {
	if (file_queue == 0) {
	    lexor_done();
	    return 0;
	}

	istack = file_queue;
	file_queue = file_queue->next;

	istack->next = 0;
	istack->lineno = 0;
	open_input_file(istack);

	if (istack->file == 0) {
	    perror(istack->path);
	    error_count += 1;
	    return 0;
	}

	if (line_direct_flag) {
	    fprintf(yyout, "\n`line 1 \"%s\" 0\n", istack->path);
	}

	if (depend_file) {
	    if (dep_mode == 'p') {
		fprintf(depend_file, "M %s\n", istack->path);
	    } else if (dep_mode != 'i') {
		fprintf(depend_file, "%s\n", istack->path);
	    }
	}

	/* This works around an issue in flex yyrestart() where it
	 * uses yyin to create a new buffer when one does not exist.
	 * I would have assumed that it would use the file argument.
	 * The problem is that we have deleted the buffer and freed
	 * yyin (isp->file) above. */
	yyin = 0;
	yyrestart(istack->file);
	return 1;
    }

    /* Otherwise, resume the input buffer that is the new stack
     * top. If I need to print a line directive, do so.
     */
    yy_switch_to_buffer(istack->yybs);

    if (line_direct_flag && istack->path && !line_mask_flag) {
	fprintf(yyout, "\n`line %u \"%s\" 2\n", istack->lineno+1, istack->path);
    }

    return 1;
}

/*
 * The dump_precompiled_defines() and load_precompiled_defines()
 * functions dump/load macro definitions to/from a file. The defines
 * are in the form:
 *
 *       <name>:<argc>:<len>:<value>
 *
 * for easy extraction. The value is already precompiled to handle
 * macro substitution. The <len> is the number of bytes in the
 * <value>. This is necessary because the value may contain arbitrary
 * text, including ':' and \n characters.
 *
 * Each record is terminated by a \n character.
 */
static void do_dump_precompiled_defines(FILE* out, struct define_t* table)
{
    if (!table->keyword)
	fprintf(out, "%s:%d:%zu:%s\n", table->name, table->argc, strlen(table->value), table->value);

    if (table->left) do_dump_precompiled_defines(out, table->left);

    if (table->right) do_dump_precompiled_defines(out, table->right);
}

void dump_precompiled_defines(FILE* out)
{
    if (def_table) do_dump_precompiled_defines(out, def_table);
}

void load_precompiled_defines(FILE* src)
{
    char*buf = malloc(4096);
    size_t buf_len = 4096;
    int ch;

    while ((ch = fgetc(src)) != EOF) {
	char* cp = buf;
	char* name = 0;

	int argc = 0;
	size_t len = 0;

	*cp++ = ch;

	while ((ch = fgetc(src)) != EOF && ch != ':') {
	    *cp++ = ch;
	    assert( (size_t)(cp-buf) < buf_len );
	}

	if (ch != ':') return;

	/* Terminate the name string. */
	*cp++ = 0;
	assert( (size_t)(cp-buf) < buf_len );

	/* Read the argc number. (this doesn't need buffer space) */
	while (isdigit(ch = fgetc(src))) argc = 10*argc + ch-'0';

	if (ch != ':') return;

	  /* Read the value len (this doesn't need buffer space) */
	while (isdigit(ch = fgetc(src))) len = 10*len + ch-'0';

	if (ch != ':') return;

	  /* Save the name, and start the buffer over. */
	name = strdup(buf);

	  /* We now know how big the value should be, so if necessary,
	     reallocate the buffer to be sure we can hold it. */
	if ((len+4) >= buf_len) {
	      buf = realloc(buf, len+8);
	      assert(buf);
	}

	cp = buf;

	while (len > 0) {
	    ch = fgetc(src);
	    if (ch == EOF) {
		free(name);
		return;
	    }

	    *cp++ = ch;
	    len -= 1;
	}

	*cp++ = 0;

	ch = fgetc(src);
	if (ch != '\n') {
	      free(name);
	      free(buf);
	      return;
	}

	define_macro(name, buf, 0, argc);
	free(name);
    }
}

/*
 * This function initializes the whole process. The first file is
 * opened, and the lexor is initialized. The include stack is cleared
 * and ready to go.
 */
void reset_lexor(FILE* out, char* paths[])
{
    unsigned idx;
    struct include_stack_t* isp;
    struct include_stack_t* tail = 0;

    isp = malloc(sizeof(struct include_stack_t));
    isp->next = 0;
    isp->path = strdup(paths[0]);
    open_input_file(isp);
    isp->str = 0;
    isp->lineno = 0;
    isp->stringify_flag = 0;
    isp->comment = NULL;

    if (isp->file == 0) {
	perror(paths[0]);
	error_count += 1;
	early_exit();
    }

    if (depend_file) {
	if (dep_mode == 'p') {
	    fprintf(depend_file, "M %s\n", paths[0]);
	} else if (dep_mode != 'i') {
	    fprintf(depend_file, "%s\n", paths[0]);
	}
    }

    yyout = out;

    yyrestart(isp->file);

    assert(istack == 0);
    istack = isp;

    /* Now build up a queue of all the remaining file names, so
     * that load_next_input() can pull them when needed.
     */
    for (idx = 1 ; paths[idx] ; idx += 1) {
	isp = malloc(sizeof(struct include_stack_t));
	isp->path = strdup(paths[idx]);
	isp->file = 0;
	isp->str = 0;
	isp->next = 0;
	isp->lineno = 0;
	isp->stringify_flag = 0;
	isp->comment = NULL;

	if (tail) tail->next = isp;
	else file_queue = isp;

	tail = isp;
    }
}

/*
 * Modern version of flex (>=2.5.9) can clean up the scanner data.
 */
void destroy_lexor(void)
{
# ifdef FLEX_SCANNER
#   if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
#     if YY_FLEX_MINOR_VERSION > 5 || defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
    yylex_destroy();
#     endif
#   endif
# endif
    free(def_buf);
    free(exp_buf);
}

