
#line 3 "<stdout>"

#define  YY_INT_ALIGNED short int

/* A lexical scanner generated by flex */

#define yy_create_buffer vhdlScanYY_create_buffer
#define yy_delete_buffer vhdlScanYY_delete_buffer
#define yy_flex_debug vhdlScanYY_flex_debug
#define yy_init_buffer vhdlScanYY_init_buffer
#define yy_flush_buffer vhdlScanYY_flush_buffer
#define yy_load_buffer_state vhdlScanYY_load_buffer_state
#define yy_switch_to_buffer vhdlScanYY_switch_to_buffer
#define yyin vhdlScanYYin
#define yyleng vhdlScanYYleng
#define yylex vhdlScanYYlex
#define yylineno vhdlScanYYlineno
#define yyout vhdlScanYYout
#define yyrestart vhdlScanYYrestart
#define yytext vhdlScanYYtext
#define yywrap vhdlScanYYwrap
#define yyalloc vhdlScanYYalloc
#define yyrealloc vhdlScanYYrealloc
#define yyfree vhdlScanYYfree

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

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

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

/* end standard C headers. */

/* flex integer type definitions */

#ifndef FLEXINT_H
#define FLEXINT_H

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

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

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

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

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

#endif /* ! FLEXINT_H */

#ifdef __cplusplus

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

#else	/* ! __cplusplus */

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

#define YY_USE_CONST

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

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

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

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

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

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

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

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

#define YY_END_OF_BUFFER_CHAR 0

/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 262144
#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 yy_size_t vhdlScanYYleng;

extern FILE *vhdlScanYYin, *vhdlScanYYout;

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

    #define YY_LESS_LINENO(n)
    
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up vhdlScanYYtext. */ \
        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 vhdlScanYYtext 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.
	 */
	yy_size_t yy_buf_size;

	/* Number of characters read into yy_ch_buf, not including EOB
	 * characters.
	 */
	yy_size_t 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 vhdlScanYYrestart()), so that the user can continue scanning by
	 * just pointing vhdlScanYYin at a new input file.
	 */
#define YY_BUFFER_EOF_PENDING 2

	};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */

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

/* We provide macros for accessing buffer states in case in the
 * future we want to put the buffer states in a more general
 * "scanner state".
 *
 * Returns the top of the stack, or NULL.
 */
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
                          : NULL)

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

/* yy_hold_char holds the character lost when vhdlScanYYtext is formed. */
static char yy_hold_char;
static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
yy_size_t vhdlScanYYleng;

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

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

void vhdlScanYYrestart (FILE *input_file  );
void vhdlScanYY_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
YY_BUFFER_STATE vhdlScanYY_create_buffer (FILE *file,int size  );
void vhdlScanYY_delete_buffer (YY_BUFFER_STATE b  );
void vhdlScanYY_flush_buffer (YY_BUFFER_STATE b  );
void vhdlScanYYpush_buffer_state (YY_BUFFER_STATE new_buffer  );
void vhdlScanYYpop_buffer_state (void );

static void vhdlScanYYensure_buffer_stack (void );
static void vhdlScanYY_load_buffer_state (void );
static void vhdlScanYY_init_buffer (YY_BUFFER_STATE b,FILE *file  );

#define YY_FLUSH_BUFFER vhdlScanYY_flush_buffer(YY_CURRENT_BUFFER )

YY_BUFFER_STATE vhdlScanYY_scan_buffer (char *base,yy_size_t size  );
YY_BUFFER_STATE vhdlScanYY_scan_string (yyconst char *yy_str  );
YY_BUFFER_STATE vhdlScanYY_scan_bytes (yyconst char *bytes,yy_size_t len  );

void *vhdlScanYYalloc (yy_size_t  );
void *vhdlScanYYrealloc (void *,yy_size_t  );
void vhdlScanYYfree (void *  );

#define yy_new_buffer vhdlScanYY_create_buffer

#define yy_set_interactive(is_interactive) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){ \
        vhdlScanYYensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            vhdlScanYY_create_buffer(vhdlScanYYin,YY_BUF_SIZE ); \
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
	}

#define yy_set_bol(at_bol) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){\
        vhdlScanYYensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            vhdlScanYY_create_buffer(vhdlScanYYin,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 vhdlScanYYwrap(n) 1
#define YY_SKIP_YYWRAP

typedef unsigned char YY_CHAR;

FILE *vhdlScanYYin = (FILE *) 0, *vhdlScanYYout = (FILE *) 0;

typedef int yy_state_type;

extern int vhdlScanYYlineno;

int vhdlScanYYlineno = 1;

extern char *vhdlScanYYtext;
#define yytext_ptr vhdlScanYYtext

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

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

#define YY_NUM_RULES 55
#define YY_END_OF_BUFFER 56
/* This struct is not used in this scanner,
   but its presence is necessary. */
struct yy_trans_info
	{
	flex_int32_t yy_verify;
	flex_int32_t yy_nxt;
	};
static yyconst flex_int16_t yy_acclist[231] =
    {   0,
       56,   47,   55,    1,   47,   55,   45,   55,   47,   55,
       47,   55,   47,   55,    2,   47,   55,    3,   47,   55,
        4,   47,   55,    5,   47,   55,    7,   47,   55,    8,
       47,   55,    9,   47,   55,   10,   47,   55,   33,   47,
       55,   34,   47,   55,   40,   47,   55,   12,   47,   55,
       13,   47,   55,   16,   47,   55,   18,   47,   55,   17,
       47,   55,   31,   47,   55,   35,   47,   55,   39,   47,
       55,   39,   47,   55,   39,   47,   55,   39,   47,   55,
       39,   47,   55,   39,   47,   55,   39,   47,   55,   37,
       47,   55,   47,   55,   38,   47,   55,   36,   47,   55,

       47,   55,   32,   47,   55,   50,   55,   50,   55,   50,
       55,   50,   55,   50,   55,   50,   55,   55,   55,   53,
       55,   55,   55,   55,   55,   55,   55,   55,   42,   42,
        6,   46,   52,   19,   40,   11,   22,   14,   21,   20,
       15,   23,   28,   29,   27,   24,   39,   39,   39,   39,
       39,   39,   39,   39,   39,   44,   44,   46,   53,   46,
       52,   53,   54,   41,   46,   46,   51,   40,   40,   40,
       30,   26,   25,   46,   49,   51,   46,   46,   51,   46,
       53,   46,   51,   46,   51,   40,   40,   40,   40,   43,
       49,   46,   49,   51,   46,   49,   51,   46,   51,   46,

       51,   53,   46,   51,   46,   51,16432,   49,   49,   46,
       49,   51,   53,   46,   51,16432,   46,   51,   53,   46,
       51,   53,   40,   40,   49,   53,   40,   40, 8240, 8240
    } ;

static yyconst flex_int16_t yy_accept[223] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
        4,    7,    9,   11,   13,   15,   18,   21,   24,   27,
       30,   33,   36,   39,   42,   45,   48,   51,   54,   57,
       60,   63,   66,   69,   72,   75,   78,   81,   84,   87,
       90,   93,   95,   98,  101,  103,  106,  108,  110,  112,
      114,  116,  118,  119,  120,  122,  123,  124,  125,  126,
      127,  128,  129,  129,  129,  129,  130,  130,  130,  131,
      131,  131,  131,  132,  133,  134,  135,  135,  135,  136,
      136,  136,  136,  136,  136,  136,  136,  136,  136,  137,
      138,  139,  140,  141,  142,  143,  143,  144,  145,  146,

      147,  148,  149,  149,  149,  149,  150,  151,  152,  153,
      154,  155,  155,  155,  156,  157,  158,  158,  158,  159,
      159,  160,  160,  160,  161,  163,  164,  164,  165,  166,
      168,  168,  169,  169,  169,  170,  170,  170,  170,  170,
      170,  170,  171,  172,  173,  174,  174,  174,  174,  177,
      177,  178,  180,  182,  182,  184,  186,  187,  187,  187,
      187,  188,  188,  188,  188,  189,  189,  190,  190,  191,
      191,  191,  191,  191,  192,  195,  198,  198,  200,  203,
      205,  205,  207,  208,  208,  208,  208,  208,  209,  210,
      213,  213,  214,  216,  217,  220,  223,  223,  223,  223,

      223,  224,  224,  224,  224,  224,  224,  225,  226,  226,
      227,  227,  227,  227,  228,  228,  229,  229,  229,  230,
      231,  231
    } ;

static yyconst flex_int32_t yy_ec[256] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    5,    6,    7,    8,    9,   10,   11,   12,
       13,   14,   15,   16,   17,   18,   19,   20,   20,   20,
       20,   20,   20,   20,   20,   20,   20,   21,   22,   23,
       24,   25,   26,   27,   28,   29,   28,   30,   31,   28,
       32,   32,   32,   32,   32,   32,   32,   32,   33,   32,
       32,   32,   34,   32,   35,   32,   32,   36,   32,   32,
       37,   38,   39,   40,   41,   42,   28,   43,   28,   44,

       31,   28,   32,   32,   32,   32,   32,   32,   32,   32,
       45,   32,   32,   32,   46,   32,   47,   32,   32,   48,
       32,   32,   49,   50,   49,    8,    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 yyconst flex_int32_t yy_meta[51] =
    {   0,
        1,    2,    3,    1,    2,    4,    5,    2,    6,    2,
        2,    2,    2,    2,    2,    2,    2,    7,    2,    8,
        9,    2,    2,    2,    2,    2,    2,    8,    8,    8,
        8,   10,   10,   10,   10,   10,    2,    2,    2,    2,
        8,    2,    8,    8,   10,   10,   10,   10,   11,    2
    } ;

static yyconst flex_int16_t yy_base[252] =
    {   0,
        0,    0,   49,   52,   56,   60,   78,   82,  937,  938,
       85,  101,  104,  120,  169,  938,  218,  938,  938,  922,
      938,  938,  918,  938,   43,  262,  910,  938,   86,  908,
       66,  251,  938,   52,  279,    0,    0,  315,  282,    0,
      938,  362,  938,  938,  385,  938,  938,  269,  915,  917,
      329,  913,  896,  333,  879,   98,  878,  938,  336,  819,
      799,  791,  339,  767,    0,  756,    0,    0,  749,    0,
      744,  743,  938,  748,  938,  938,  406,  726,    0,  423,
      107,  108,  264,  114,  412,  429,  281,  716,  938,  938,
      938,  938,  938,  938,  938,  690,  671,  938,  669,  938,

      295,  307,   78,  450,  455,    0,    0,    0,    0,    0,
        0,    0,    0,    0,  472,    0,  421,  675,  684,  639,
      636,  507,  300,  352,  632,  938,  640,  938,    0,  595,
      271,  451,  308,  621,  282,  313,  353,  359,  433,  438,
      450,  505,  938,  938,  938,   59,  454,  635,  588,  340,
       80,  473,  608,    0,  618,    0,  587,  509,  523,  514,
      528,  597,  542,  510,  557,  546,  420,  562,  938,  491,
      563,  455,  567,  531,  552,    0,  551,  546,  547,  553,
      524,  488,   59,  564,  287,  447,  584,  486,    0,  470,
      599,  600,  602,  606,  612,  432,  424,  561,  405,  351,

      449,  293,  599,  492,  604,  202,  494,  218,  622,  635,
      637,  595,  168,  527,  152,  611,  104,  347,  938,   64,
      938,  654,  665,  676,  680,  689,  700,  711,  722,  733,
      740,  742,  748,  751,  759,  770,  781,  791,  802,  813,
      824,  835,  846,  857,  868,  879,  886,  887,  896,  907,
      918
    } ;

static yyconst flex_int16_t yy_def[252] =
    {   0,
      221,    1,  222,  222,  223,  223,  224,  224,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  225,  225,   35,   35,   35,   38,   35,
      221,  221,  221,  221,  226,  221,  221,  221,  221,  221,
      221,  221,  227,  227,  221,  227,  227,  221,  221,  221,
      221,  221,  221,  221,   14,  221,   14,   15,  221,   15,
      221,  221,  221,  228,  221,  221,  221,  221,   26,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,

       35,   35,  225,  221,  221,   35,   35,   35,   35,   35,
       35,   42,   42,   42,  226,  115,  221,  221,  228,  227,
      221,  227,  227,  229,  221,  221,  221,  221,  228,  230,
      231,  221,  232,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  233,  234,  221,  235,  227,
      229,  236,  228,  237,  238,  239,  221,  221,  231,  221,
      221,  221,  221,  232,  221,  221,  221,  221,  221,  233,
      221,  234,  221,  240,  241,  242,  243,  244,  238,  245,
      246,  238,  221,  221,  247,  248,  221,  249,  250,  241,
      251,  246,  244,  227,  238,  239,  246,  221,  221,  221,

      221,  247,  221,  248,  221,  221,  221,  249,  251,  246,
      227,  227,  221,  221,  221,  221,  221,  227,  221,  227,
        0,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221
    } ;

static yyconst flex_int16_t yy_nxt[989] =
    {   0,
       10,   11,   12,   13,   10,   14,   10,   10,   15,   16,
       17,   18,   19,   20,   21,   22,   23,   24,   25,   26,
       27,   28,   29,   30,   31,   32,   33,   34,   35,   36,
       34,   34,   37,   38,   39,   40,   41,   42,   43,   44,
       10,   45,   35,   36,   37,   38,   39,   40,   10,   46,
       48,   48,   48,   51,   48,   48,   75,   54,   54,   54,
      198,   54,   54,   54,  169,   49,   76,   50,   52,   55,
       50,  101,   56,   55,   57,  199,   56,  121,   57,   59,
       59,   59,  120,   59,   59,   59,   63,   63,   63,   94,
       95,   60,  103,  153,   61,   60,   62,  101,   61,  171,

       62,   64,   63,   63,   63,   63,   63,   63,   90,   91,
       92,  121,  104,  104,  124,  105,  105,   64,  221,  104,
       64,   65,  105,  216,   65,   66,   65,   65,   65,   65,
       65,   65,   65,   65,   65,   65,   65,   65,   65,   65,
       65,   65,   65,   65,   65,   65,   65,   67,   67,   67,
       67,   67,   67,   67,   67,   67,   65,   65,   65,   65,
       65,   65,   67,   67,   67,   67,   67,   67,   65,   65,
       68,  214,  219,   68,   68,   68,   68,   69,   68,   68,
       68,   68,   68,   68,   68,   68,   68,   68,   68,   68,
       68,   68,   68,   68,   68,   68,   70,   70,   70,   70,

       70,   70,   70,   70,   70,   68,   68,   68,   68,   68,
       68,   70,   70,   70,   70,   70,   70,   68,   68,   71,
      183,  207,   71,   71,   71,   71,   71,   71,   71,   71,
       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
       71,   71,   71,   71,   71,   72,   72,   72,   72,   72,
       72,   72,   72,   72,   71,   71,   71,   71,   71,   71,
       72,   72,   72,   72,   72,   72,   71,   71,   77,   96,
       63,   63,   63,   97,   98,   99,  100,  157,  134,   78,
      134,   79,   80,  135,  104,   64,  104,  105,  158,  105,
       81,   82,   83,  157,   84,   85,   86,   87,  101,  157,

      221,  167,   88,  221,   81,   82,   84,   85,   86,   87,
      109,  160,  221,  121,  110,  221,  150,  111,  104,  103,
      221,  105,  168,  221,  109,  163,  110,  203,  165,  111,
      117,   63,   63,  203,  122,  122,  122,   63,   63,   63,
       63,   63,   63,  106,  177,  118,  121,  107,  166,  123,
      108,  220,   64,  121,  120,   64,  152,  106,  104,  107,
      121,  105,  108,  112,  104,  153,  112,  105,  112,  112,
      201,  112,  112,  112,  112,  112,  112,  112,  112,  112,
      112,  112,  112,  112,  112,  112,  112,  112,  112,  113,
      113,  113,  113,  113,  113,  113,  113,  113,  112,  114,

      112,  112,  112,  112,  113,  113,  113,  113,  113,  113,
      112,  112,  116,  116,  116,  116,  116,  116,  116,  116,
      116,  213,  117,   63,   63,  131,  183,  116,  116,  116,
      116,  116,  116,  131,  131,  131,  131,  118,  104,  167,
      136,  105,  133,  104,  137,  196,  105,  138,  131,  131,
      133,  133,  133,  133,  136,  104,  137,  139,  105,  138,
      168,  140,  169,  169,  141,  133,  133,  165,  214,  146,
      161,  139,  183,  140,  147,  120,  141,  146,  146,  146,
      146,   83,  147,  147,  147,  147,  179,  205,  183,  215,
      183,  162,  146,  146,  173,  173,  169,  147,  147,  116,

      116,  116,  116,  116,  116,  116,  116,  116,  122,  122,
      122,   77,  165,  216,  116,  116,  116,  116,  116,  116,
      121,  180,   78,  123,  142,   80,  183,  163,  185,  157,
      165,  171,  205,  159,  217,   83,  185,  185,  185,  185,
      158,  159,  159,  159,  159,   88,  214,  161,  194,  183,
      166,  185,  185,  120,  183,  120,  159,  159,   83,  195,
      195,  186,  198,  160,  192,  164,  196,  215,  162,  186,
      186,  186,  186,  164,  164,  164,  164,  199,  200,  189,
      200,  167,  170,  201,  186,  186,  172,  187,  164,  164,
      170,  170,  170,  170,  172,  172,  172,  172,  206,  120,

      206,  194,  183,  207,  194,  170,  170,  211,  121,  172,
      172,  218,  210,  210,  183,  195,  161,  184,  202,  121,
      183,  153,  212,  204,  194,  195,  202,  202,  202,  202,
      216,  204,  204,  204,  204,  210,  176,  183,  211,  174,
      135,  202,  202,  156,  154,  121,  204,  204,  210,  121,
      121,  217,  121,  212,   47,   47,   47,   47,   47,   47,
       47,   47,   47,   47,   47,   53,   53,   53,   53,   53,
       53,   53,   53,   53,   53,   53,   58,   58,   58,   58,
       58,   58,   58,   58,   58,   58,   58,  102,  149,  102,
      115,  148,  145,  115,  144,  115,  115,  115,  115,  115,

      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
      120,  129,  129,  143,  129,  129,  129,  129,  129,  129,
      129,  129,  151,  151,  151,  151,  151,  151,  151,  151,
      151,  151,  151,  155,  155,  142,  155,  155,  155,  155,
      155,  155,  155,  155,  159,  132,  159,  159,  164,  164,
      164,  170,  130,  128,  128,  170,  172,   68,  172,  175,
      175,   65,  175,  175,  175,  175,  175,  175,  175,  175,
      178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
      178,  181,  181,  127,  181,  181,  181,  181,  181,  181,
      181,  182,  182,  182,  182,  182,  182,  182,  182,  182,

      182,  182,  156,  156,   75,  156,  156,  156,  156,  156,
      156,  156,  156,  188,  188,   74,  188,  188,  188,  188,
      188,  188,  188,  188,  190,  190,  190,  190,  190,  190,
      190,  190,  190,  190,  190,  176,  176,  126,  176,  176,
      176,  176,  176,  176,  176,  176,  191,  191,  191,  191,
      191,  191,  191,  191,  191,  191,  191,  193,  193,  193,
      193,  193,  193,  193,  193,  193,  193,  193,  180,  180,
      180,  180,  180,  180,  180,  180,  180,  180,  180,  197,
      197,  197,  197,  197,  197,  197,  197,  197,  197,  197,
      202,  125,  121,  202,  204,  204,  208,  208,  208,  208,

      208,  208,  208,  208,  208,  208,  208,  189,  189,  121,
      189,  189,  189,  189,  189,  189,  189,  189,  209,  209,
      209,  209,  209,  209,  209,  209,  209,  209,  209,  119,
       75,   74,   93,   89,   74,   73,  221,    9,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221
    } ;

static yyconst flex_int16_t yy_chk[989] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        3,    3,    3,    4,    4,    4,   25,    5,    5,    5,
      183,    6,    6,    6,  146,    3,   25,    3,    4,    5,
        4,   34,    5,    6,    5,  183,    6,  220,    6,    7,
        7,    7,  151,    8,    8,    8,   11,   11,   11,   31,
       31,    7,   34,  151,    7,    8,    7,  103,    8,  146,

        8,   11,   12,   12,   12,   13,   13,   13,   29,   29,
       29,   56,   81,   82,   56,   81,   82,   12,  103,   84,
       13,   14,   84,  217,   14,   14,   14,   14,   14,   14,
       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
       15,  215,  213,   15,   15,   15,   15,   15,   15,   15,
       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,

       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
       15,   15,   15,   15,   15,   15,   15,   15,   15,   17,
      208,  206,   17,   17,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   17,   17,   17,   17,   17,   26,   32,
       48,   48,   48,   32,   32,   32,   32,  131,   83,   26,
       83,   26,   26,   83,   35,   48,   87,   35,  131,   87,
       26,   26,   26,  185,   26,   26,   26,   26,   35,  202,

      101,  135,   26,  101,   26,   26,   26,   26,   26,   26,
       39,  131,  102,  123,   39,  102,  123,   39,  136,   35,
       38,  136,  135,   38,   39,  133,   39,  185,  133,   39,
       51,   51,   51,  202,   54,   54,   54,   59,   59,   59,
       63,   63,   63,   38,  150,   51,   54,   38,  133,   54,
       38,  218,   59,  150,  124,   63,  124,   38,  137,   38,
      218,  137,   38,   42,  138,  124,   42,  138,   42,   42,
      200,   42,   42,   42,   42,   42,   42,   42,   42,   42,
       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,

       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
       42,   42,   45,   45,   45,   45,   45,   45,   45,   45,
       45,  199,  117,  117,  117,   77,  197,   45,   45,   45,
       45,   45,   45,   77,   77,   77,   77,  117,  139,  167,
       85,  139,   80,  140,   85,  196,  140,   85,   77,   77,
       80,   80,   80,   80,   85,  141,   85,   86,  141,   85,
      167,   86,  147,  172,   86,   80,   80,  186,  201,  104,
      132,   86,  190,   86,  105,  152,   86,  104,  104,  104,
      104,  132,  105,  105,  105,  105,  152,  186,  188,  201,
      182,  132,  104,  104,  147,  172,  170,  105,  105,  115,

      115,  115,  115,  115,  115,  115,  115,  115,  122,  122,
      122,  142,  204,  207,  115,  115,  115,  115,  115,  115,
      122,  152,  142,  122,  142,  142,  181,  164,  158,  159,
      164,  170,  204,  160,  207,  142,  158,  158,  158,  158,
      159,  160,  160,  160,  160,  142,  214,  161,  178,  179,
      164,  158,  158,  177,  175,  180,  160,  160,  161,  178,
      179,  163,  198,  159,  177,  166,  180,  214,  161,  163,
      163,  163,  163,  166,  166,  166,  166,  198,  184,  174,
      184,  168,  171,  184,  163,  163,  173,  165,  166,  166,
      171,  171,  171,  171,  173,  173,  173,  173,  187,  177,

      187,  191,  192,  187,  193,  171,  171,  194,  212,  173,
      173,  212,  191,  192,  195,  193,  162,  157,  203,  194,
      155,  153,  194,  205,  209,  195,  203,  203,  203,  203,
      216,  205,  205,  205,  205,  209,  149,  210,  211,  148,
      134,  203,  203,  130,  127,  125,  205,  205,  210,  121,
      211,  216,  120,  211,  222,  222,  222,  222,  222,  222,
      222,  222,  222,  222,  222,  223,  223,  223,  223,  223,
      223,  223,  223,  223,  223,  223,  224,  224,  224,  224,
      224,  224,  224,  224,  224,  224,  224,  225,  119,  225,
      226,  118,   99,  226,   97,  226,  226,  226,  226,  226,

      227,  227,  227,  227,  227,  227,  227,  227,  227,  227,
      227,  228,  228,   96,  228,  228,  228,  228,  228,  228,
      228,  228,  229,  229,  229,  229,  229,  229,  229,  229,
      229,  229,  229,  230,  230,   88,  230,  230,  230,  230,
      230,  230,  230,  230,  231,   78,  231,  231,  232,  232,
      232,  233,   74,   72,   71,  233,  234,   69,  234,  235,
      235,   66,  235,  235,  235,  235,  235,  235,  235,  235,
      236,  236,  236,  236,  236,  236,  236,  236,  236,  236,
      236,  237,  237,   64,  237,  237,  237,  237,  237,  237,
      237,  238,  238,  238,  238,  238,  238,  238,  238,  238,

      238,  238,  239,  239,   62,  239,  239,  239,  239,  239,
      239,  239,  239,  240,  240,   61,  240,  240,  240,  240,
      240,  240,  240,  240,  241,  241,  241,  241,  241,  241,
      241,  241,  241,  241,  241,  242,  242,   60,  242,  242,
      242,  242,  242,  242,  242,  242,  243,  243,  243,  243,
      243,  243,  243,  243,  243,  243,  243,  244,  244,  244,
      244,  244,  244,  244,  244,  244,  244,  244,  245,  245,
      245,  245,  245,  245,  245,  245,  245,  245,  245,  246,
      246,  246,  246,  246,  246,  246,  246,  246,  246,  246,
      247,   57,   55,  247,  248,  248,  249,  249,  249,  249,

      249,  249,  249,  249,  249,  249,  249,  250,  250,   53,
      250,  250,  250,  250,  250,  250,  250,  250,  251,  251,
      251,  251,  251,  251,  251,  251,  251,  251,  251,   52,
       50,   49,   30,   27,   23,   20,    9,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
      221,  221,  221,  221,  221,  221,  221,  221
    } ;

extern int vhdlScanYY_flex_debug;
int vhdlScanYY_flex_debug = 0;

static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
static char *yy_full_match;
static int yy_lp;
static int yy_looking_for_trail_begin = 0;
static int yy_full_lp;
static int *yy_full_state;
#define YY_TRAILING_MASK 0x2000
#define YY_TRAILING_HEAD_MASK 0x4000
#define REJECT \
{ \
*yy_cp = (yy_hold_char); /* undo effects of setting up vhdlScanYYtext */ \
yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
(yy_lp) = (yy_full_lp); /* restore orig. accepting pos. */ \
(yy_state_ptr) = (yy_full_state); /* restore orig. state */ \
yy_current_state = *(yy_state_ptr); /* restore curr. state */ \
++(yy_lp); \
goto find_rule; \
}

#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *vhdlScanYYtext;
#line 1 "vhdlscanner.l"
/************** VHDL scanner in LEX format **********
 *
 * Version 0.2 Wed Aug 11, 1993
 *
 * This scanner is derived from a scanner of the ALLIANCE CAD toolset,
 * release 1.1. That toolset was written from:
 *   MASI/CAO-VLSI CAD Team
 *   Laboratoire MASI/CAO-VLSI
 *   Tour 55-65, 2eme etage, Porte 13
 *   Universite Pierre et Marie Curie (PARIS VI)
 *   4, place Jussieu 75252 PARIS Cedex 05, FRANCE
 * The ALLIANCE CAD Toolset can be obtained from ftp site : ftp-masi.ibp.fr    
 *
 * This scanner is avail at: ftp.cs.utwente.nl in pub/src/VHDL/Grammar
 * A corresponding Yacc grammar is available at the same site
 *
 * author of this derived scanner version:
 * Thomas Dettmer
 * Dortmund University
 * Dept. of Computer Scienc, LS1
 * PB 500 500
 * D-44221 Dortmund (Germany)
 * Phone: +49-231-755-6464
 * e-mail: dettmer@ls1.informatik.uni-dortmund.de
 *
 *
 ****************************************************************
 * 
 * This file is intended not to be used for commercial purposes
 * without permission of the University of Dortmund
 *
 * NOTE THAT THERE IS NO WARRANTY FOR CORRECTNES, COMPLETENESS, SUPPORT
 * OR ANYTHING ELSE.
 *******************************************************/
/******************************************************************************
 * modified for doxygen by M. Kreis
 * extended to VHDL 93/2002/2008 
 ******************************************************************************/
#line 40 "vhdlscanner.l"

#ifndef YYSTYPE
	typedef int YYSTYPE;
#endif

#include <ctype.h>
#include <search.h>

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include "commentscan.h"
#include "vhdlparser.h"
#include "vhdlscanner.h"

#include "doxygen.h"
#include "searchindex.h"
#include <ctype.h>
#include "scanner.h"
#include "vhdldocgen.h"
#include "util.h"
#include "bufstr.h"
#include "message.h"
#include "vhdlcode.h"
#include <qmap.h>
#include "entry.h"

static MyParserVhdl *pconv;

static bool          g_lexInit = FALSE;
static ParserInterface *g_thisParser;
static struct s_contVhdl* yycont=NULL;
static Entry* current_root;
static Entry   gBlock;

static int yyLineNr =1;
//static int yyPrevLine=1;
//static int yyEndLine=1;
static int   g_lastCommentContext;
static int              inputPosition;
//static int defineLineContinue=0;
static int startComment;
//static int iSize=0;
static QCString inputVhdlString;
static QFile            inputFile;
static QCString         yyFileName;
static QList<QCString> qlist;

static QCString lastLetter;
//static int totLines=0;

//static bool multLineComment=FALSE;
static bool doxComment=FALSE; // doxygen comment ? 
static QCString strComment;
static int iDocLine=-1;
static int* lineIndex=NULL;
static int num_chars;
static  int prevToken;
static int iCodeLen;

//static const char *  g_inputString;       //!< the    code fragment as text
//static int           g_inputLines=0;      //!<number of line in the code fragment
//static bool          g_needsTermination;
static	QMap<QCString, int> keyMap;

static void handleCommentBlock(const QCString &doc,bool brief);
static void mapLibPackage(const Entry* ce);
static Entry* getEntryAtLine(const Entry* ce,int line);


#define YY_NEVER_INTERACTIVE 1
#define YY_USER_ACTION num_chars += vhdlScanYYleng;

#define MAX_KEYWORD_LEN 20

typedef struct 
{
  char nom[MAX_KEYWORD_LEN];
  int kval;
} el_mc;

static el_mc tab_mc []=
{
    { "abs",                t_ABS                },
    { "access",             t_ACCESS             },
    { "after",              t_AFTER              },
    { "alias",              t_ALIAS              },
    { "all",                t_ALL                },
    { "and",                t_AND                },
    { "architecture",       t_ARCHITECTURE       },
    { "array",              t_ARRAY              },
    { "assert",             t_ASSERT             },
    { "assume",             t_ASSUME             },
    { "assume_guarantee",   t_ASSUME_GUARANTEE   },
    { "attribute",          t_ATTRIBUTE          },

    { "begin",              t_BEGIN              },
    { "block",              t_BLOCK              },
    { "body",               t_BODY               },
    { "buffer",             t_BUFFER             },
    { "bus",                t_BUS                },

    { "case",               t_CASE               },
    { "component",          t_COMPONENT          },
    { "configuration",      t_CONFIGURATION      },
    { "constant",           t_CONSTANT           },
    { "context",            t_CONTEXT            },
    { "cover",              t_COVER              },

    { "default",            t_DEFAULT            },
    { "disconnect",         t_DISCONNECT         },
    { "downto",             t_DOWNTO             },

    { "else",               t_ELSE               },
    { "elsif",              t_ELSIF              },
    { "end",                t_END                },
    { "entity",             t_ENTITY             },
    { "exit",               t_EXIT               },

    { "fairness",           t_FAIRNESS           },
    { "file",               t_FILE               },
    { "for",                t_FOR                },
    { "force",              t_FORCE              },
    { "function",           t_FUNCTION           },

    { "generate",           t_GENERATE           },
    { "generic",            t_GENERIC            },
    { "group",              t_GROUP              },
    { "guarded",            t_GUARDED            },

    { "if",                 t_IF                 },
    { "impure",             t_IMPURE             },
    { "in",                 t_IN                 },
    { "inertial",           t_INERTIAL           },
    { "inout",              t_INOUT              },
    { "is",                 t_IS                 },
  
    { "label",              t_LABEL              },
    { "library",            t_LIBRARY            },
    { "linkage",            t_LINKAGE            },
    { "literal",            t_LITERAL            },
    { "loop",               t_LOOP               },

    { "map",                t_MAP                },
    { "mod",                t_MOD                },

    { "nand",               t_NAND               },
    { "new",                t_NEW                },
    { "next",               t_NEXT               },
    { "nor",                t_NOR                },
    { "not",                t_NOT                },
    { "null",               t_NULL               },

    { "of",                 t_OF                 },
    { "on",                 t_ON                 },
    { "open",               t_OPEN               },
    { "or",                 t_OR                 },
    { "others",             t_OTHERS             },
    { "out",                t_OUT                },

    { "package",            t_PACKAGE            },
    { "parameter",          t_PARAMETER          },
    { "port",               t_PORT               },
    { "postponed",          t_POSTPONED          },
    { "procedure",          t_PROCEDURE          },
    { "process",            t_PROCESS            },
    { "property",           t_PROPERTY           },
    { "protected",          t_PROTECTED          },
    { "pure",               t_PURE               },
  
    { "range",              t_RANGE              },
    { "record",             t_RECORD             },
    { "register",           t_REGISTER           },
    { "reject",             t_REJECT             },
    { "release",            t_RELEASE            },
    { "restrict",           t_RESTRICT           },
    { "restrict_guarantee", t_RESTRICT_GUARANTEE },
    { "rem",                t_REM                },
    { "report",             t_REPORT             },
    { "rol",                t_ROL                },
    { "ror",                t_ROR                },
    { "return",             t_RETURN             },

    { "select",             t_SELECT             },
    { "sequence",           t_SEQUENCE           },
    { "severity",           t_SEVERITY           },
    { "signal",             t_SIGNAL             },
    { "shared",             t_SHARED             },
    { "sla",                t_SLA                },
    { "sll",                t_SLL                },
    { "sra",                t_SRA                },
    { "srl",                t_SRL                },
    { "strong",             t_STRONG             },
    { "subtype",            t_SUBTYPE            },

    { "then",               t_THEN               },
    { "to",                 t_TO                 },
    { "transport",          t_TRANSPORT          },
    { "type",               t_TYPE               },

    { "unaffected",         t_UNAFFECTED         },
    { "units",              t_UNITS              },
    { "until",              t_UNTIL              },
    { "use",                t_USE                },

    { "variable",           t_VARIABLE           },
    { "vmode",              t_VMODE              },
    { "vprop",              t_VPROP              },
    { "vunit",              t_VUNIT              },

    { "wait",               t_WAIT               },
    { "when",               t_WHEN               },
    { "while",              t_WHILE              },
    { "with",               t_WITH               },

    { "xor",                t_XOR                },
    { "xnor",               t_XNOR               },
    { "zz",                 -1                   } // list end
};

   
static int find_keyword(char *s)
{
  QCString word(s);
  // keyword ?
  if (word.length() >  MAX_KEYWORD_LEN) 
	return -1;

  word=word.lower();
  QMap<QCString, int>::Iterator it = keyMap.find(word);
  if (it.key())
	return it.data();

  return -1;
}

// update current line
static void lineCount()
{
  for (const char* c=vhdlScanYYtext ; *c ; ++c )
  {
    yyLineNr += (*c == '\n') ;
  }
}


static void makeInlineDoc(int endCode)
{
  int len=endCode-iCodeLen;
  QCString par=inputVhdlString.mid(iCodeLen,len);
  gBlock.doc=par;
  gBlock.inbodyDocs=par;
  gBlock.section=Entry::VARIABLE_SEC;
  gBlock.spec=VhdlDocGen::MISCELLANEOUS;
  gBlock.fileName = yyFileName;
  gBlock.endBodyLine=yyLineNr-1;
  gBlock.lang=SrcLangExt_VHDL;
  Entry *temp=new Entry(gBlock);

  Entry* compound=getVhdlCompound();

  if (compound)
  {
	compound->addSubEntry(temp);
  }
  else
  {
	temp->type="misc"; // global code like library ieee...
	current_root->addSubEntry(temp);
  }

  gBlock.reset();


}// makeInlineDoc

static bool isConstraintFile(const QCString &fileName,const QCString &ext)
{
  return fileName.right(ext.length())==ext;
}

//static void resetScanner(const char* s,MyParserVhdl* parse);

#undef  YY_INPUT
#define	YY_INPUT(buf,result,max_size) result=vhdlScanYYread(buf,max_size);


static int vhdlScanYYread(char *buf,int max_size)
{
  int c=0;
  while ( c < max_size && inputVhdlString.at(inputPosition) )
  {
	*buf = inputVhdlString.at(inputPosition++) ;
	c++; buf++;
  }
  return c;
}




#line 1150 "<stdout>"

#define INITIAL 0
#define Comment 1
#define Vhdl2008Comment 2
#define EndVhdl2008Comment 3

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

#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif

static int yy_init_globals (void );

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

int vhdlScanYYlex_destroy (void );

int vhdlScanYYget_debug (void );

void vhdlScanYYset_debug (int debug_flag  );

YY_EXTRA_TYPE vhdlScanYYget_extra (void );

void vhdlScanYYset_extra (YY_EXTRA_TYPE user_defined  );

FILE *vhdlScanYYget_in (void );

void vhdlScanYYset_in  (FILE * in_str  );

FILE *vhdlScanYYget_out (void );

void vhdlScanYYset_out  (FILE * out_str  );

yy_size_t vhdlScanYYget_leng (void );

char *vhdlScanYYget_text (void );

int vhdlScanYYget_lineno (void );

void vhdlScanYYset_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 vhdlScanYYwrap (void );
#else
extern int vhdlScanYYwrap (void );
#endif
#endif

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

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

#ifndef YY_NO_INPUT

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

#endif

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

/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite().
 */
#define ECHO fwrite( vhdlScanYYtext, vhdlScanYYleng, 1, vhdlScanYYout )
#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 = '*'; \
		yy_size_t n; \
		for ( n = 0; n < max_size && \
			     (c = getc( vhdlScanYYin )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( vhdlScanYYin ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else \
		{ \
		errno=0; \
		while ( (result = fread(buf, 1, max_size, vhdlScanYYin))==0 && ferror(vhdlScanYYin)) \
			{ \
			if( errno != EINTR) \
				{ \
				YY_FATAL_ERROR( "input in flex scanner failed" ); \
				break; \
				} \
			errno=0; \
			clearerr(vhdlScanYYin); \
			} \
		}\
\

#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 vhdlScanYYlex (void);

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

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

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

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

/** The main scanner function which does all the work.
 */
YY_DECL
{
	register yy_state_type yy_current_state;
	register char *yy_cp, *yy_bp;
	register int yy_act;
    
#line 376 "vhdlscanner.l"


#line 1341 "<stdout>"

	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 *)vhdlScanYYalloc(YY_STATE_BUF_SIZE  );
            if ( ! (yy_state_buf) )
                YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYYlex()" );

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

		if ( ! vhdlScanYYin )
			vhdlScanYYin = stdin;

		if ( ! vhdlScanYYout )
			vhdlScanYYout = stdout;

		if ( ! YY_CURRENT_BUFFER ) {
			vhdlScanYYensure_buffer_stack ();
			YY_CURRENT_BUFFER_LVALUE =
				vhdlScanYY_create_buffer(vhdlScanYYin,YY_BUF_SIZE );
		}

		vhdlScanYY_load_buffer_state( );
		}

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

		/* Support of vhdlScanYYtext. */
		*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
			{
			register 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 >= 222 )
					yy_c = yy_meta[(unsigned int) yy_c];
				}
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
			*(yy_state_ptr)++ = yy_current_state;
			++yy_cp;
			}
		while ( yy_base[yy_current_state] != 938 );

yy_find_action:
		yy_current_state = *--(yy_state_ptr);
		(yy_lp) = yy_accept[yy_current_state];
goto find_rule; /* Shut up GCC warning -Wall */
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)];
				if ( yy_act & YY_TRAILING_HEAD_MASK ||
				     (yy_looking_for_trail_begin) )
					{
					if ( yy_act == (yy_looking_for_trail_begin) )
						{
						(yy_looking_for_trail_begin) = 0;
						yy_act &= ~YY_TRAILING_HEAD_MASK;
						break;
						}
					}
				else if ( yy_act & YY_TRAILING_MASK )
					{
					(yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK;
					(yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK;
					(yy_full_match) = yy_cp;
					(yy_full_state) = (yy_state_ptr);
					(yy_full_lp) = (yy_lp);
					}
				else
					{
					(yy_full_match) = yy_cp;
					(yy_full_state) = (yy_state_ptr);
					(yy_full_lp) = (yy_lp);
					break;
					}
				++(yy_lp);
				goto find_rule;
				}
			--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 378 "vhdlscanner.l"
{ /* nothing */ }
	YY_BREAK
case 2:
YY_RULE_SETUP
#line 379 "vhdlscanner.l"
{ return(t_Ampersand); }
	YY_BREAK
case 3:
YY_RULE_SETUP
#line 380 "vhdlscanner.l"
{ return(t_Apostrophe); }
	YY_BREAK
case 4:
YY_RULE_SETUP
#line 381 "vhdlscanner.l"
{ return(t_LeftParen); }
	YY_BREAK
case 5:
YY_RULE_SETUP
#line 382 "vhdlscanner.l"
{ return(t_RightParen); }
	YY_BREAK
case 6:
YY_RULE_SETUP
#line 383 "vhdlscanner.l"
{ return(t_DoubleStar); }
	YY_BREAK
case 7:
YY_RULE_SETUP
#line 384 "vhdlscanner.l"
{ return(t_Star); }
	YY_BREAK
case 8:
YY_RULE_SETUP
#line 385 "vhdlscanner.l"
{ return(t_Plus); }
	YY_BREAK
case 9:
YY_RULE_SETUP
#line 386 "vhdlscanner.l"
{ return(t_Comma); }
	YY_BREAK
case 10:
YY_RULE_SETUP
#line 387 "vhdlscanner.l"
{ return(t_Minus); }
	YY_BREAK
case 11:
YY_RULE_SETUP
#line 388 "vhdlscanner.l"
{ return(t_VarAsgn); }
	YY_BREAK
case 12:
YY_RULE_SETUP
#line 389 "vhdlscanner.l"
{ return(t_Colon); }
	YY_BREAK
case 13:
YY_RULE_SETUP
#line 390 "vhdlscanner.l"
{ return(t_Semicolon); }
	YY_BREAK
case 14:
YY_RULE_SETUP
#line 391 "vhdlscanner.l"
{ return(t_LESym); }
	YY_BREAK
case 15:
YY_RULE_SETUP
#line 392 "vhdlscanner.l"
{ return(t_GESym); }
	YY_BREAK
case 16:
YY_RULE_SETUP
#line 393 "vhdlscanner.l"
{ return(t_LTSym); }
	YY_BREAK
case 17:
YY_RULE_SETUP
#line 394 "vhdlscanner.l"
{ return(t_GTSym); }
	YY_BREAK
case 18:
YY_RULE_SETUP
#line 395 "vhdlscanner.l"
{ return(t_EQSym); }
	YY_BREAK
case 19:
YY_RULE_SETUP
#line 396 "vhdlscanner.l"
{ return(t_NESym); }
	YY_BREAK
case 20:
YY_RULE_SETUP
#line 397 "vhdlscanner.l"
{ return(t_Arrow); }
	YY_BREAK
case 21:
YY_RULE_SETUP
#line 398 "vhdlscanner.l"
{ return(t_Box); }
	YY_BREAK
case 22:
YY_RULE_SETUP
#line 399 "vhdlscanner.l"
{ return(t_SLSL); }
	YY_BREAK
case 23:
YY_RULE_SETUP
#line 400 "vhdlscanner.l"
{ return(t_SRSR); }
	YY_BREAK
case 24:
YY_RULE_SETUP
#line 401 "vhdlscanner.l"
{ return(t_QQ); }
	YY_BREAK
case 25:
YY_RULE_SETUP
#line 402 "vhdlscanner.l"
{ return(t_QGT); }
	YY_BREAK
case 26:
YY_RULE_SETUP
#line 403 "vhdlscanner.l"
{ return(t_QLT); }
	YY_BREAK
case 27:
YY_RULE_SETUP
#line 404 "vhdlscanner.l"
{ return(t_QG); }
	YY_BREAK
case 28:
YY_RULE_SETUP
#line 405 "vhdlscanner.l"
{ return(t_QL); }
	YY_BREAK
case 29:
YY_RULE_SETUP
#line 406 "vhdlscanner.l"
{ return(t_QEQU); }
	YY_BREAK
case 30:
YY_RULE_SETUP
#line 407 "vhdlscanner.l"
{ return(t_QNEQU); }
	YY_BREAK
case 31:
YY_RULE_SETUP
#line 408 "vhdlscanner.l"
{ return(t_Q); }
	YY_BREAK
case 32:
YY_RULE_SETUP
#line 409 "vhdlscanner.l"
{ return(t_Bar); }
	YY_BREAK
case 33:
YY_RULE_SETUP
#line 410 "vhdlscanner.l"
{ return(t_Dot); }
	YY_BREAK
case 34:
YY_RULE_SETUP
#line 411 "vhdlscanner.l"
{ return(t_Slash); }
	YY_BREAK
case 35:
YY_RULE_SETUP
#line 412 "vhdlscanner.l"
{ return(t_At); }
	YY_BREAK
case 36:
YY_RULE_SETUP
#line 413 "vhdlscanner.l"
{ return(t_Neg); }
	YY_BREAK
case 37:
YY_RULE_SETUP
#line 414 "vhdlscanner.l"
{ return(t_LEFTBR); }
	YY_BREAK
case 38:
YY_RULE_SETUP
#line 415 "vhdlscanner.l"
{ return(t_RIGHTBR); }
	YY_BREAK
case 39:
YY_RULE_SETUP
#line 418 "vhdlscanner.l"
{
          int itoken=find_keyword(vhdlScanYYtext);
        
          //	fprintf(stderr,"\n <<<< search tok:  %s %d %d>>>\n",vhdlScanYYtext,itoken,yyLineNr);
        
          // tokens in vhdlparser.hpp 258..412
	  if (itoken>200  && itoken<500 && prevToken!=t_END)
	  {
	    //  	printf("\n <<<< insert tok:  %s %d %d>>>\n",vhdlScanYYtext,itoken,yyLineNr);
	    lineIndex[itoken]=yyLineNr;
	  }
	  prevToken=itoken;
        
          yycont->qstr=vhdlScanYYtext;
          yycont->yyLineNr=yyLineNr;
          if (itoken== -1)  
          {
            yycont->iLine=yyLineNr;
            return ( t_LETTER );
          }
          else 
          {
            return ( itoken );
          }
        }
	YY_BREAK
case 40:
YY_RULE_SETUP
#line 444 "vhdlscanner.l"
{
          yycont->qstr=vhdlScanYYtext;
          return ( t_ABSTRLIST );
        }
	YY_BREAK
case 41:
YY_RULE_SETUP
#line 449 "vhdlscanner.l"
{
          QCString q(vhdlScanYYtext);	       
          yycont->qstr=vhdlScanYYtext; 
        
          if (q=="'('") // std_logic'('1') ?
          {
            char c=yy_hold_char;
            if (isalpha(c) || isdigit(c))
            {
              unput('\'');
              unput('(');
              return(t_Apostrophe);
            }
            else
	    {
              return ( t_CHARLIST );
	    }
          }
          return ( t_CHARLIST );
        }
	YY_BREAK
case 42:
YY_RULE_SETUP
#line 470 "vhdlscanner.l"
{
          yycont->qstr=vhdlScanYYtext;
          yycont->iLine=yyLineNr;
	  return ( t_STRING );
        } 
	YY_BREAK
case 43:
YY_RULE_SETUP
#line 476 "vhdlscanner.l"
{
	  yycont->qstr=vhdlScanYYtext;
	  yycont->iLine=yyLineNr;
	  return ( t_DIGIT );
        }
	YY_BREAK
case 44:
YY_RULE_SETUP
#line 482 "vhdlscanner.l"
{
	  yycont->qstr=vhdlScanYYtext;
	  yycont->iLine=yyLineNr;
	  return(t_ToolDir);
        }	
	YY_BREAK
case 45:
/* rule 45 can match eol */
YY_RULE_SETUP
#line 488 "vhdlscanner.l"
{
	  yyLineNr++;
          yycont->yyLineNr=yyLineNr;
        }
	YY_BREAK
case 46:
YY_RULE_SETUP
#line 493 "vhdlscanner.l"
{
          /* comment */
	  QCString qcs(vhdlScanYYtext);
	  //  vhdl comment ?
	  if (qcs.stripPrefix("--!"))
	  {
	    REJECT;
	  }
        }               
	YY_BREAK
case 47:
YY_RULE_SETUP
#line 502 "vhdlscanner.l"
{ /* unknown characters */ }
	YY_BREAK
case 48:
/* rule 48 can match eol */
YY_RULE_SETUP
#line 505 "vhdlscanner.l"
{ // multi line comment
  if (iDocLine==-1) iDocLine=yyLineNr;
  QCString qc(vhdlScanYYtext);
  int len=qc.contains('\n')+yyLineNr-1;
  if (YY_START!=Comment) // Start of the comment block
  {
    startComment=yyLineNr;
    g_lastCommentContext=YY_START;
  }

  Entry* pTemp=getEntryAtLine(current_root,len);
  if (pTemp)
  { // found one line comment, add it to the entry on this line
    pTemp->briefLine=yyLineNr;
    pTemp->brief+=vhdlScanYYtext;
    pTemp->briefFile=yyFileName;
    VhdlDocGen::prepareComment(pTemp->brief);
  }
  else 
  {
    strComment+=vhdlScanYYtext;
  }
  lineCount();
  BEGIN(Comment);
}
	YY_BREAK
case 49:
YY_RULE_SETUP
#line 531 "vhdlscanner.l"
{
  if (iDocLine==-1) iDocLine=yyLineNr;
  strComment+=vhdlScanYYtext;
      
  lineCount();
}
	YY_BREAK
case 50:
/* rule 50 can match eol */
YY_RULE_SETUP
#line 538 "vhdlscanner.l"
{
          // found end of comment block
          
          int index =strComment.find("\\code");
          if (index>0)
          {
            int ll=strComment.length();
            iCodeLen=inputVhdlString.findRev(strComment.data(),num_chars)+ll;
        
            gBlock.reset();
            int len=strComment.length();
            QCString name=strComment.right(len-index);// 
            name=VhdlDocGen::getIndexWord(name.data(),1);
            if (!name)
              gBlock.name="misc"+ VhdlDocGen::getRecordNumber(); 
            else
              gBlock.name=name;
            strComment=strComment.left(index);
            gBlock.startLine=yyLineNr+1;
            gBlock.bodyLine=yyLineNr+1;
            VhdlDocGen::prepareComment(strComment);
            gBlock.brief+=strComment;
          }
        
          VhdlDocGen::prepareComment(strComment);
        
        
          if (index==-1) 
            handleCommentBlock(strComment,FALSE);
          strComment.resize(0);;
          unput(*vhdlScanYYtext);
          BEGIN(g_lastCommentContext);
        }
	YY_BREAK
case 51:
YY_RULE_SETUP
#line 572 "vhdlscanner.l"
{ // one line comment
          if (iDocLine==-1) iDocLine=yyLineNr;
          QCString qcs(vhdlScanYYtext);

	  bool isEndCode=qcs.contains("\\endcode");

	  if (isEndCode)
	  {
	    int end=inputVhdlString.find(qcs.data(),iCodeLen);
	    makeInlineDoc(end);
	  }

	  //printf("--> handleCommentBlock line %d\n",yyLineNr);
	  Entry* pTemp=getEntryAtLine(current_root,yyLineNr);

	  if (!isEndCode)
	  {
	    int j=qcs.find("--!");
	    qcs=qcs.right(qcs.length()-3-j);

	    if (pTemp)
	    {
	      pTemp->briefLine=yyLineNr;
	      qcs=qcs.stripWhiteSpace();
	      pTemp->brief+=qcs;

	      pTemp->briefFile=yyFileName;
	      iDocLine=-1;
	    }
	    else
	    {
	      handleCommentBlock(qcs,TRUE);
	    }
	  }//endcode
        }
	YY_BREAK
case 52:
YY_RULE_SETUP
#line 608 "vhdlscanner.l"
{
	  strComment+=vhdlScanYYtext;
	  if (yy_hold_char=='!') // found  comment starting with "/*!"
  	  {
	    doxComment=TRUE;
	  }
	  BEGIN(Vhdl2008Comment); 
        }
	YY_BREAK
case 53:
/* rule 53 can match eol */
YY_RULE_SETUP
#line 617 "vhdlscanner.l"
{
    	  QCString tt(vhdlScanYYtext);
	  int len=tt.length();
	  yyLineNr+=tt.contains('\n');

	  // delete * from comments 
	  // /*! 
	  // *   see vim !
	  // */

	  if (vhdlScanYYtext[len-1]=='*' && tt.contains('\n'))
	  {
	    QCString ss=tt;
	    VhdlDocGen::deleteAllChars(ss,' ');
	    VhdlDocGen::deleteAllChars(ss,'\t');
	    if (ss.data()  && ss.at(ss.length()-2)=='\n')
	    {
	      tt=tt.left(len-1);
	      len--;
	    }
	  }

	  //	   fprintf(stderr,"\n << %s  >>",tt.data());
	  strComment+=tt;
	  char c=yy_hold_char;
	  if (c =='/')
	  {
	    unput('*');
	    BEGIN(Vhdl2008Comment);
	  }
	  else 
	  {
	    BEGIN(EndVhdl2008Comment);
	  }
        }
	YY_BREAK
case 54:
YY_RULE_SETUP
#line 653 "vhdlscanner.l"
{	 
          if (doxComment)
          {  
            strComment.stripPrefix("/*!");
            strComment= strComment.left(  strComment.length()-1);
            handleCommentBlock( strComment,TRUE);
          }
          doxComment=FALSE;
          strComment.resize(0);
          BEGIN(INITIAL);
        }
	YY_BREAK
case 55:
YY_RULE_SETUP
#line 666 "vhdlscanner.l"
ECHO;
	YY_BREAK
#line 1952 "<stdout>"
			case YY_STATE_EOF(INITIAL):
			case YY_STATE_EOF(Comment):
			case YY_STATE_EOF(Vhdl2008Comment):
			case YY_STATE_EOF(EndVhdl2008Comment):
				yyterminate();

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

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

		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed vhdlScanYYin at a new source and called
			 * vhdlScanYYlex().  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 = vhdlScanYYin;
			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 ( vhdlScanYYwrap( ) )
					{
					/* Note: because we've taken care in
					 * yy_get_next_buffer() to have set up
					 * vhdlScanYYtext, 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 vhdlScanYYlex */

/* yy_get_next_buffer - try to read in a new buffer
 *
 * Returns a code representing an action:
 *	EOB_ACT_LAST_MATCH -
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *	EOB_ACT_END_OF_FILE - end of file
 */
static int yy_get_next_buffer (void)
{
    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
	register char *source = (yytext_ptr);
	register int number_to_move, i;
	int ret_val;

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

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

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

	/* Try to read more data. */

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

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

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

	else
		{
			yy_size_t 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;
			vhdlScanYYrestart(vhdlScanYYin  );
			}

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

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

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

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

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

	return ret_val;
}

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

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

	(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 )
		{
		register 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 >= 222 )
				yy_c = yy_meta[(unsigned int) yy_c];
			}
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) 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 )
{
	register int yy_is_jam;
    
	register 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 >= 222 )
			yy_c = yy_meta[(unsigned int) yy_c];
		}
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
	yy_is_jam = (yy_current_state == 221);
	if ( ! yy_is_jam )
		*(yy_state_ptr)++ = yy_current_state;

	return yy_is_jam ? 0 : yy_current_state;
}

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

	/* undo effects of setting up vhdlScanYYtext */
	*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. */
		register yy_size_t number_to_move = (yy_n_chars) + 2;
		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
		register 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) = 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;
}

#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 */
			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
			++(yy_c_buf_p);

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

					/* Reset buffer status. */
					vhdlScanYYrestart(vhdlScanYYin );

					/*FALLTHROUGH*/

				case EOB_ACT_END_OF_FILE:
					{
					if ( vhdlScanYYwrap( ) )
						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 vhdlScanYYtext */
	(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 vhdlScanYYrestart  (FILE * input_file )
{
    
	if ( ! YY_CURRENT_BUFFER ){
        vhdlScanYYensure_buffer_stack ();
		YY_CURRENT_BUFFER_LVALUE =
            vhdlScanYY_create_buffer(vhdlScanYYin,YY_BUF_SIZE );
	}

	vhdlScanYY_init_buffer(YY_CURRENT_BUFFER,input_file );
	vhdlScanYY_load_buffer_state( );
}

/** Switch to a different input buffer.
 * @param new_buffer The new input buffer.
 * 
 */
    void vhdlScanYY_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
{
    
	/* TODO. We should be able to replace this entire function body
	 * with
	 *		vhdlScanYYpop_buffer_state();
	 *		vhdlScanYYpush_buffer_state(new_buffer);
     */
	vhdlScanYYensure_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;
	vhdlScanYY_load_buffer_state( );

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

static void vhdlScanYY_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;
	vhdlScanYYin = 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 vhdlScanYY_create_buffer  (FILE * file, int  size )
{
	YY_BUFFER_STATE b;
    
	b = (YY_BUFFER_STATE) vhdlScanYYalloc(sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYY_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 *) vhdlScanYYalloc(b->yy_buf_size + 2  );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYY_create_buffer()" );

	b->yy_is_our_buffer = 1;

	vhdlScanYY_init_buffer(b,file );

	return b;
}

/** Destroy the buffer.
 * @param b a buffer created with vhdlScanYY_create_buffer()
 * 
 */
    void vhdlScanYY_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 )
		vhdlScanYYfree((void *) b->yy_ch_buf  );

	vhdlScanYYfree((void *) b  );
}

#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
    
/* Initializes or reinitializes a buffer.
 * This function is sometimes called more than once on the same buffer,
 * such as during a vhdlScanYYrestart() or at EOF.
 */
    static void vhdlScanYY_init_buffer  (YY_BUFFER_STATE  b, FILE * file )

{
	int oerrno = errno;
    
	vhdlScanYY_flush_buffer(b );

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

    /* If b is the current buffer, then vhdlScanYY_init_buffer was _probably_
     * called from vhdlScanYYrestart() 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 vhdlScanYY_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 )
		vhdlScanYY_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 vhdlScanYYpush_buffer_state (YY_BUFFER_STATE new_buffer )
{
    	if (new_buffer == NULL)
		return;

	vhdlScanYYensure_buffer_stack();

	/* This block is copied from vhdlScanYY_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 vhdlScanYY_switch_to_buffer. */
	vhdlScanYY_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 vhdlScanYYpop_buffer_state (void)
{
    	if (!YY_CURRENT_BUFFER)
		return;

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

	if (YY_CURRENT_BUFFER) {
		vhdlScanYY_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 vhdlScanYYensure_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;
		(yy_buffer_stack) = (struct yy_buffer_state**)vhdlScanYYalloc
								(num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		if ( ! (yy_buffer_stack) )
			YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYYensure_buffer_stack()" );
								  
		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
				
		(yy_buffer_stack_max) = num_to_alloc;
		(yy_buffer_stack_top) = 0;
		return;
	}

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

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

		num_to_alloc = (yy_buffer_stack_max) + grow_size;
		(yy_buffer_stack) = (struct yy_buffer_state**)vhdlScanYYrealloc
								((yy_buffer_stack),
								num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		if ( ! (yy_buffer_stack) )
			YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYYensure_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 vhdlScanYY_scan_buffer  (char * base, yy_size_t  size )
{
	YY_BUFFER_STATE b;
    
	if ( size < 2 ||
	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
	     base[size-1] != YY_END_OF_BUFFER_CHAR )
		/* They forgot to leave room for the EOB's. */
		return 0;

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

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

	vhdlScanYY_switch_to_buffer(b  );

	return b;
}

/** Setup the input buffer state to scan a string. The next call to vhdlScanYYlex() 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
 *       vhdlScanYY_scan_bytes() instead.
 */
YY_BUFFER_STATE vhdlScanYY_scan_string (yyconst char * yystr )
{
    
	return vhdlScanYY_scan_bytes(yystr,strlen(yystr) );
}

/** Setup the input buffer state to scan the given bytes. The next call to vhdlScanYYlex() will
 * scan from a @e copy of @a bytes.
 * @param bytes the byte buffer to scan
 * @param len the number of bytes in the buffer pointed to by @a bytes.
 * 
 * @return the newly allocated buffer state object.
 */
YY_BUFFER_STATE vhdlScanYY_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
{
	YY_BUFFER_STATE b;
	char *buf;
	yy_size_t n, i;
    
	/* Get memory for full buffer, including space for trailing EOB's. */
	n = _yybytes_len + 2;
	buf = (char *) vhdlScanYYalloc(n  );
	if ( ! buf )
		YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYY_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 = vhdlScanYY_scan_buffer(buf,n );
	if ( ! b )
		YY_FATAL_ERROR( "bad buffer in vhdlScanYY_scan_bytes()" );

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

	return b;
}

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

static void yy_fatal_error (yyconst char* msg )
{
    	(void) fprintf( stderr, "%s\n", msg );
	exit( YY_EXIT_FAILURE );
}

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

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

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

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

/** Get the input stream.
 * 
 */
FILE *vhdlScanYYget_in  (void)
{
        return vhdlScanYYin;
}

/** Get the output stream.
 * 
 */
FILE *vhdlScanYYget_out  (void)
{
        return vhdlScanYYout;
}

/** Get the length of the current token.
 * 
 */
yy_size_t vhdlScanYYget_leng  (void)
{
        return vhdlScanYYleng;
}

/** Get the current token.
 * 
 */

char *vhdlScanYYget_text  (void)
{
        return vhdlScanYYtext;
}

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

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

void vhdlScanYYset_out (FILE *  out_str )
{
        vhdlScanYYout = out_str ;
}

int vhdlScanYYget_debug  (void)
{
        return vhdlScanYY_flex_debug;
}

void vhdlScanYYset_debug (int  bdebug )
{
        vhdlScanYY_flex_debug = bdebug ;
}

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

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

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

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

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

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

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

    vhdlScanYYfree ( (yy_state_buf) );
    (yy_state_buf)  = NULL;

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

    return 0;
}

/*
 * Internal utility routines.
 */

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

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

	return n;
}
#endif

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

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

void vhdlScanYYfree (void * ptr )
{
	free( (char *) ptr );	/* see vhdlScanYYrealloc() for (char *) cast */
}

#define YYTABLES_NAME "yytables"

#line 666 "vhdlscanner.l"



static void parserInit()
{
  num_chars=0;
  lineIndex=(int*)malloc(500*sizeof(int));

  if (!g_lexInit) 
  {
    VhdlDocGen::init();
    el_mc oop;
    int p=0;
    while ((oop=tab_mc[p++]).kval!=-1)
    {
      QCString q(&oop.nom[0]);
      keyMap.insert(q,oop.kval);
    }
  }
}

void vhdlscanFreeScanner()
{
#if defined(YY_FLEX_SUBMINOR_VERSION)
  if (g_lexInit)
  {
    vhdlScanYYlex_destroy();
  }
#endif
}

void VHDLLanguageScanner::resetCodeParserState()
{
}

bool VHDLLanguageScanner::needsPreprocessing(const QCString & /*extension*/)
{ 
  return TRUE; 
}

void VHDLLanguageScanner::parsePrototype(const char * /*text*/)
{ 
  assert(FALSE); 
}

// do parsing
int MyParserVhdl::doLex()
{
  int token=vhdlScanYYlex();
  //fprintf(stderr,"\ntoken: %d at line: %d",token,yyLineNr);
  return token;
}

void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root)
{
  yyFileName=QCString(fileName);

  bool xilinx_ucf=isConstraintFile(yyFileName,".ucf");
  bool altera_qsf=isConstraintFile(yyFileName,".qsf");

  // support XILINX(ucf) and ALTERA (qsf) file

  if (xilinx_ucf) 
  { 
    VhdlDocGen::parseUCF(fileBuf,root,yyFileName,FALSE);  
    return; 
  }
  if (altera_qsf) 
  { 
    VhdlDocGen::parseUCF(fileBuf,root,yyFileName,TRUE); 
    return; 
  }

  ::parserInit();
  yycont=getVhdlCont();
  yycont->root=root;
  yycont->fileName=fileName;
  initVhdlParser();
  QCString pPuffer(" ");
  pPuffer+=fileBuf;

  inputFile.setName(fileName);
  if (g_lexInit)
  {
    vhdlScanYYrestart( vhdlScanYYin );
  }
  g_lexInit=TRUE;
  g_thisParser=this;
  inputPosition=0;
  inputVhdlString=fileBuf;
  yyLineNr=1;
  current_root=root;
  pconv=new MyParserVhdl();
  groupEnterFile(fileName,yyLineNr);
  pconv->parse(pconv);
  //    resetScanner(NULL,pconv);
  delete pconv;	  	  
  Entry* curr=getCurrentVhdlEntry(); // delete last current
  delete curr;
  curr=0;
  free(lineIndex);
  inputFile.close();
  mapLibPackage(root);
}

void VHDLLanguageScanner::parseCode(CodeOutputInterface &codeOutIntf,
    const char *scopeName,
    const QCString &input,
    bool isExampleBlock,
    const char *exampleName,
    FileDef *fileDef,
    int startLine,
    int endLine,
    bool inlineFragment,
    MemberDef *memberDef,
    bool showLineNumbers
    )
{
  ::parseVhdlCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
                  fileDef,startLine,endLine,inlineFragment,memberDef,
                  showLineNumbers);
}

/*
 * adds the library|use statements to the next class (entity|package|architecture|package body
 * library ieee
 * entity xxx
 * .....
 * library
 * package
 * enity zzz
 * .....
 * and so on..
 */
static void mapLibPackage(const Entry* ce)
{
  Entry *lastComp=0;
  while (TRUE)
  {
    bool found = FALSE;
    Entry *rt=0;
    //const QList<Entry> *epp=ce->children();
    EntryListIterator eli(*ce->children());
    EntryListIterator eli1=eli;
    for (;(rt=eli.current()),eli1=eli;++eli)
    {
      if (rt->spec==VhdlDocGen::LIBRARY || rt->spec==VhdlDocGen::USE)
	// top level library or use statement
      {
	Entry *temp=0;
	for (;(temp=eli1.current());++eli1) // find next entity
	{
	  if (temp->spec==VhdlDocGen::ENTITY || temp->spec==VhdlDocGen::PACKAGE || temp->spec==VhdlDocGen::ARCHITECTURE || temp->spec==VhdlDocGen::PACKAGE_BODY)
	  {
	    Entry *ee=new Entry(*rt); //append a copy to entries sublist
	    temp->addSubEntry(ee);
	    found=TRUE;
	    rt->spec=-1; //nullify entry
	    rt->section=0;
	    lastComp=temp;
	    break;
	  }
	}//for
	if (lastComp && rt->spec!=-1)
	{
	  Entry *ee=new Entry(*rt); //append a copy to entries sublist
	  lastComp->addSubEntry(ee);
	  found=TRUE;
	  rt->spec=-1; //nullify entry
	  rt->section=0;
	}
      }//if
    }//for
    if (!found) // nothing left to do
    {
      return; 
    }
  }//while
}//MapLib

static void handleCommentBlock(const QCString &doc,bool brief)
{
  int position=0;
  bool needsEntry=FALSE;
  Protection protection=Public;
  int lineNr = iDocLine;

  Entry* current=getCurrentVhdlEntry();

  if (brief) 
    current->briefLine = iDocLine; 
  else 
    current->docLine = iDocLine;

  //printf("parseCommentBlock %p [%s]\n",current,doc.data());
  while (parseCommentBlock(
	g_thisParser,
	current,
	doc,        // text
	yyFileName, // file
	lineNr,     // line of block start
	brief, 
	0,
	FALSE,
	protection,
        position,
        needsEntry
        )
     ) 
  {
 //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position);
    if (needsEntry) newVhdlEntry();
  }
  if (needsEntry)
  {
    newVhdlEntry();
  }
  iDocLine=-1;
  strComment.resize(0);
}

// returns the vhdl type parsed at line xxx
static Entry* getEntryAtLine(const Entry* ce,int line)
{
  EntryListIterator eli(*ce->children());
  Entry *found=0;
  Entry *rt;
  for (;(rt=eli.current());++eli)
  {
    if (rt->bodyLine==line)
    {
      found=rt;
    } // if
    if (!found) 
    {
      found=getEntryAtLine(rt,line);
    }
  }
  return found;
}// getEntryAtLine

// token index in vhdlparser.hpp 258..416
int getParsedLine(int object)
{
  //assert(object>254 && object <416);
  return lineIndex [object];
}



