/* A Bison parser, made by GNU Bison 3.8.2.  */

/* Bison implementation for Yacc-like parsers in C

   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
   Inc.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 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, see <https://www.gnu.org/licenses/>.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.

   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

/* C LALR(1) parser skeleton written by Richard Stallman, by
   simplifying the original so-called "semantic" parser.  */

/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
   especially those whose name start with YY_ or yy_.  They are
   private implementation details that can be changed or removed.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

/* Identify Bison output, and Bison version.  */
#define YYBISON 30802

/* Bison version string.  */
#define YYBISON_VERSION "3.8.2"

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 0

/* Push parsers.  */
#define YYPUSH 0

/* Pull parsers.  */
#define YYPULL 1




/* First part of user prologue.  */
#line 25 "vhd2vl.y"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <assert.h>
#include "def.h"

#define VHD2VL_VER "3.0"

int yylex(void);
void yyerror(const char *s);

int vlog_ver=2001;

/* You will of course want to tinker with these if you use a debugging
 * malloc(), otherwise all the line numbers will point here.
 */
void *xmalloc(size_t size) {
	void *p = malloc(size);
	if (!p) {
		perror("malloc");
		exit(2);
	}
	return p;
}
void *xrealloc(void *ptr, size_t size) {

	void *p = realloc(ptr, size);
	if (!p) {
		perror("realloc");
		exit(2);
	}
	return p;
}

char *xstrdup(const char *s) {
	size_t l = strlen(s);
	char *x = xmalloc(l+1);
	memcpy(x, s, l+1);
	return x;
}

int skipRem = 0;
int lineno=1;
int timescale_emitted=0;  /* Track if timescale has been output */

sglist *io_list=NULL;
sglist *sig_list=NULL;
sglist *type_list=NULL;
blknamelist *blkname_list=NULL;

/* need a stack of clock-edges because all edges are processed before all processes are processed.
 * Edges are processed in source file order, processes are processed in reverse source file order.
 * The original scheme of just one clkedge variable makes all clocked processes have the edge sensitivity
 * of the last clocked process in the file.
 */
int clkedges[MAXEDGES];
int clkptr = 0;
int delay=1;
int dolist=1;
int np=1;
char wire[]="wire";
char reg[]="reg";
int dowith=0;
int convfunc2_is_port=0;
int convfunc1_sgn=0;
slist *slwith;

/* Indentation variables */
int indent=0;
slist *indents[MAXINDENT];

struct vrange *new_vrange(enum vrangeType t)
{
  struct vrange *v=xmalloc(sizeof(vrange));
  v->vtype=t;
  v->nlo = NULL;
  v->nhi = NULL;
  v->size_expr = NULL;
  v->sizeval = 0;
  v->updown = 0;
  v->xlo = NULL;
  v->xhi = NULL;
  return v;
}

void qindent(int ind){
  int ix;
  for (ix=0; ix<ind; ix++) fputc(' ', stderr);
}

/* Visualize an slist structure as an aid to debugging and development.
 * Will never be used for actual Verilog generation. */
void sldump(int ind, slist *sl){
  if (sl){
    assert(sl != sl->slst);
    qindent(ind);
    fprintf(stderr, "slst:\n");
    sldump(ind + 4, sl->slst);
    qindent(ind);
    switch(sl->type){
    case tSLIST : case tOTHERS :
      assert(sl != sl->data.sl);
      fprintf(stderr, "tSLIST:\n");
      sldump(ind + 4,sl->data.sl);
      break;
    case tTXT :
      fprintf(stderr, "pTXT \"%s\"\n",sl->data.txt);
      break;
    case tVAL :
      fprintf(stderr, "tVAL %d\n",sl->data.val);
      break;
    case tPTXT :
      fprintf(stderr, "pPTXT \"%s\"\n",*(sl->data.ptxt));
      break;
    }
  }
}

/* I'd really rather not write the following astring support routines,
 * it seems like giving up compared to just using the slist structure.
 * But I couldn't find an effective way of comparing two slists without
 * this step.  Thus slist_check_diff() will convert two slists to strings
 * so they can be compared.
 * Keep it short and correct, (almost) forget about efficiency */
#define ASTRING_CHUNK 512
struct astring {
  char *s;
  size_t space, used;
};

void ainit(struct astring *a)
{
  a->used = 0;
  if (!a->s) {
    a->space = ASTRING_CHUNK;
    a->s = xmalloc(a->space);
  }
}

void astring_addc(struct astring *a, char c) {
  if (a->used+1 >= a->space) {
    a->space += ASTRING_CHUNK;
    a->s = xrealloc(a->s, a->space);
  }
  a->s[a->used++] = c;
}

void astring_adds(struct astring *a, char *s) {
  char c;
  while ((c=*s++)) astring_addc(a, c);
}

void sslprint(struct astring *a, slist *sl){
  char decimal[30];
  if(sl){
    assert(sl != sl->slst);
    sslprint(a, sl->slst);
    switch(sl->type){
    case tSLIST : case tOTHERS :
      assert(sl != sl->data.sl);
      sslprint(a, sl->data.sl);
      break;
    case tTXT :
      astring_adds(a, sl->data.txt);
      break;
    case tVAL :
      snprintf(decimal, sizeof(decimal), "%d", sl->data.val);
      astring_adds(a, decimal);
      break;
    case tPTXT :
      astring_adds(a, (sl->data.txt));
      break;
    }
  }
  a->s[a->used] = '\0';
  if (0) fprintf(stderr, "sslprint %lu/%lu \"%s\"\n", a->used, a->space, a->s);
}
/* end astring complaint zone */

void fslprint(FILE *fp,slist *sl){
  if(sl){
    assert(sl != sl->slst);
    fslprint(fp,sl->slst);
    switch(sl->type){
    case tSLIST : case tOTHERS :
      assert(sl != sl->data.sl);
      fslprint(fp,sl->data.sl);
      break;
    case tTXT :
      fprintf(fp,"%s",sl->data.txt);
      break;
    case tVAL :
      fprintf(fp,"%d",sl->data.val);
      break;
    case tPTXT :
      fprintf(fp,"%s",*(sl->data.ptxt));
      break;
    }
  }
}

void slprint(slist *sl){
  fslprint(stdout, sl);
}

slist *copysl(slist *sl){
  if(sl){
    slist *newsl;
    newsl = xmalloc(sizeof(slist));
    *newsl = *sl;
    if (sl->slst != NULL) {
      assert(sl != sl->slst);
      newsl->slst = copysl(sl->slst);
    }
    switch(sl->type){
    case tSLIST : case tOTHERS :
      if (sl->data.sl != NULL) {
        assert(sl != sl->data.sl);
        newsl->data.sl = copysl(sl->data.sl);
      }
      break;
    case tTXT :
      newsl->data.txt = xmalloc(strlen(sl->data.txt) + 1);
      strcpy(newsl->data.txt, sl->data.txt);
      break;
    default :
      /* We really ignore tPTXT here? */
      /* fprintf(stderr, "WARNING (line %d): unexpected slist type in copysl()\n", lineno); */
      break;
    }
    return newsl;
  }
  return NULL;
}

slist *addtxt(slist *sl, const char *s){
  slist *p;

  if(s == NULL)
    return sl;
  p = xmalloc(sizeof *p);
  p->type = tTXT;
  p->slst = sl;
  p->data.txt = xmalloc(strlen(s) + 1);
  strcpy(p->data.txt, s);

  return p;
}

slist *addothers(slist *sl, slist *sl2){
  slist *p;

  if(sl2 == NULL)
    return sl;
  p = xmalloc(sizeof *p);
  p->type = tOTHERS;
  p->slst = sl;
  p->data.sl = sl2;

  return p;
}

slist *addptxt(slist *sl, char **s){
  slist *p;

  if(s == NULL)
    return sl;

  p = xmalloc(sizeof *p);
  p->type = tPTXT;
  p->slst = sl;
  p->data.ptxt = s;

  return p;
}

slist *addval(slist *sl, int val){
  slist *p;

  p = xmalloc(sizeof(slist));
  p->type = tVAL;
  p->slst = sl;
  p->data.val = val;

  return p;
}

slist *addsl(slist *sl, slist *sl2){
  slist *p;
  if(sl2 == NULL) return sl;
  p = xmalloc(sizeof(slist));
  p->type = tSLIST;
  p->slst = sl;
  p->data.sl = sl2;
  return p;
}

slist *addvec(slist *sl, char *s){
  size_t len = strlen(s);
  if (len == 0) {
    /* Avoid emitting zero-width literals like 0'b */
    return sl;
  }
  sl=addval(sl,len);
  sl=addtxt(sl,"'b");
  sl=addtxt(sl,s);
  return sl;
}

slist *addvec_base(slist *sl, char *b, char *s){
  const char *base_str="'b";
  int base_mult=1;
  size_t len = strlen(s);
  if (len == 0) {
    /* Avoid emitting zero-width literals like 0'b */
    return sl;
  }
  if (strcasecmp(b,"B") == 0) {
     /* nothing to do */
  } else if (strcasecmp(b,"X") == 0) {
     base_str="'h"; base_mult=4;
  } else if (strcasecmp(b,"O") == 0) {
     base_str="'o"; base_mult=3;
  } else {
     fprintf(stderr,"WARNING (line %d): NAME STRING rule matched but NAME='%s' is not X or O.\n", lineno, b);
  }
  sl=addval(sl,strlen(s)*base_mult);
  sl=addtxt(sl,base_str);
  sl=addtxt(sl,s);
  return sl;
}

slist *addind(slist *sl){
  if(sl)
    sl=addsl(indents[indent],sl);
  return sl;
}

#define DEBUG_RANGE 0
slist *addpar_snug(slist *sl, vrange *v){
  if (DEBUG_RANGE) {
    fprintf(stderr,"addpar_snug %d: ", v->sizeval);
    fslprint(stderr, v->size_expr);
    fprintf(stderr,"\n");
  }
  /* If width expression is known but bounds are non-constant (e.g. -1+N downto 0),
   * emit width-based range to avoid illegal negative/empty bounds. */
  if (v->size_expr != NULL && v->sizeval <= 0 && v->vtype == tVRANGE && (!v->nlo || !v->nhi)) {
    sl=addtxt(sl,"[");
    sl=addtxt(sl,"(");
    sl=addsl(sl,v->size_expr);
    sl=addtxt(sl,")-1:0]");
    return sl;
  }
  if(v->nlo != NULL) {   /* indexes are simple expressions */
    sl=addtxt(sl,"[");
    if(v->nhi != NULL){
      sl=addsl(sl,v->nhi);
      if(v->updown) sl=addtxt(sl,v->updown==1 ? " +: " : " -: ");
      else sl=addtxt(sl,":");
    }
    if(v->updown){
      sl=addsl(sl,v->size_expr);
      sl=addtxt(sl," + 1");
    } else {
      sl=addsl(sl,v->nlo);
    }
    sl=addtxt(sl,"]");
  }
  return sl;
}

slist *addpar(slist *sl, vrange *v){
  sl=addtxt(sl," ");
  if(v->nlo != NULL) {   /* indexes are simple expressions */
    if (v->updown && v->size_expr) {
      /* Declarations cannot use +:/-: part-select; use width-based range. */
      sl=addtxt(sl,"[(");
      sl=addsl(sl, v->size_expr);
      sl=addtxt(sl,"):0]");
    } else {
      sl=addpar_snug(sl, v);
    }
    sl=addtxt(sl," ");
  }
  return sl;
}

/* This function handles array of vectors in signal lists */
slist *addpar_snug2(slist *sl, vrange *v, vrange *v1){
  if(v->nlo != NULL) {   /* indexes are simple expressions */
    sl=addtxt(sl,"[");
    if(v->nhi != NULL){
      sl=addsl(sl,v->nhi);
      sl=addtxt(sl,":");
    }
    sl=addsl(sl,v->nlo);
    sl=addtxt(sl,"]");
  }
  if(v1->nlo != NULL) {   /* indexes are simple expressions */
    sl=addtxt(sl,"[");
    if(v1->nhi != NULL){
      sl=addsl(sl,v1->nhi);
      sl=addtxt(sl,":");
    }
    sl=addsl(sl,v1->nlo);
    sl=addtxt(sl,"]");
  }
  return sl;
}

slist *addpost(slist *sl, vrange *v){
  if(v->xlo != NULL) {
    sl=addtxt(sl,"[");
    if(v->xhi != NULL){
      sl=addsl(sl,v->xhi);
      sl=addtxt(sl,":");
    }
    sl=addsl(sl,v->xlo);
    sl=addtxt(sl,"]");
  }
  return sl;
}

slist *addwrap(const char *l,slist *sl,const char *r){
slist *s;
  s=addtxt(NULL,l);
  s=addsl(s,sl);
  return addtxt(s,r);
}

static slist *expr_to_sl(expdata *e){
  if (!e) {
    return NULL;
  }
  if (e->op == 'c') {
    return addwrap("{", e->sl, "}");
  }
  return e->sl;
}

static slist *wrap_sgn_expr(expdata *e, int is_signed){
  slist *sl;
  sl=addtxt(NULL, is_signed ? "$signed(" : "$unsigned(");
  sl=addsl(sl,expr_to_sl(e));
  return addtxt(sl,")");
}

static slist *build_dec_lit(int width, slist *width_expr, int value){
  slist *sl;
  if (width_expr == NULL) {
    if (width <= 0) {
      return addval(NULL, value);
    }
    if (value < 0) {
      /* e.g. 8'd(-5) -> -8'd5 */
      unsigned int absval = (unsigned int)(-value);
      sl=addtxt(NULL,"-");
      sl=addval(sl,width);
      sl=addtxt(sl,"'d");
      sl=addval(sl,(int)absval);
      return sl;
    }
    sl=addval(NULL,width);
    sl=addtxt(sl,"'d");
    sl=addval(sl,value);
    return sl;
  }

  if (value < 0) {
    return NULL;
  }

  unsigned int uval = (unsigned int)value;
  unsigned int tmp = uval;
  int minw = 1;
  while (tmp >>= 1) {
    minw++;
  }
  sl=addtxt(NULL,"{{((");
  sl=addsl(sl,width_expr);
  sl=addtxt(sl,")-");
  sl=addval(sl,minw);
  sl=addtxt(sl,"){1'b0}},");
  sl=addval(sl,minw);
  sl=addtxt(sl,"'d");
  sl=addval(sl,(int)uval);
  sl=addtxt(sl,"}");
  return sl;
}

static int expdata_literal_int(expdata *e, int *out){
  slist *sl;
  if (!e || !out) {
    return 0;
  }
  if (e->op == 'n') {
    *out = e->value;
    return 1;
  }
  if (e->op == 't') {
    sl = e->sl;
    if (sl && sl->type == tVAL && sl->slst == NULL) {
      *out = sl->data.val;
      return 1;
    }
    return 0;
  }
  if (e->op != 'm') {
    return 0;
  }
  sl = e->sl;
  if (sl && sl->type == tVAL && sl->slst == NULL) {
    *out = -sl->data.val;
    return 1;
  }
  if (sl && sl->type == tSLIST && sl->slst && sl->slst->type == tTXT && sl->data.sl) {
    if (strcmp(sl->slst->data.txt, " -") == 0 && sl->data.sl->type == tVAL && sl->data.sl->slst == NULL) {
      *out = sl->data.sl->data.val;
      *out = -(*out);
      return 1;
    }
  }
  return 0;
}

static slist *aggregate(expdata *high, expdata *low, expdata *value){
  slist *sl;
  sl=addtxt(NULL,"{(");
  sl=addsl(sl,high->sl);
  sl=addtxt(sl,")-(");
  sl=addsl(sl,low->sl);
  sl=addtxt(sl,")+1{");
  sl=addsl(sl,value->sl);
  sl=addtxt(sl,"}}");
  free(high);
  free(low);
  free(value);
  return sl;
}

expdata *addnest(struct expdata *inner)
{
  expdata *e;
  e=xmalloc(sizeof(expdata));
  if (inner->op == 'c') {
    e->sl=addwrap("{",inner->sl,"}");
  } else {
    e->sl=addsl(NULL,inner->sl);
  }
  e->op='e';
  return e;
}

slist *addrem(slist *sl, slist *rem)
{
  if (rem) {
    sl=addtxt(sl, "  ");
    sl=addsl(sl, rem);
  } else {
    sl=addtxt(sl, "\n");
  }
  return sl;
}

slist *build_compare(expdata*left,const char *op,expdata*right)
{
  slist *sl;
  if(left->op == 'c')
    sl=addwrap("{",left->sl,"}");
  else if(left->op != 't')
    sl=addwrap("(",left->sl,")");
  else
    sl=left->sl;
  sl=addtxt(sl,op);
  if(right->op == 'c')
    sl=addsl(sl,addwrap("{",right->sl,"}"));
  else if(right->op != 't')
    sl=addsl(sl,addwrap("(",right->sl,")"));
  else
    sl=addsl(sl,right->sl);
  free(left);
  free(right);
  return sl;
}

sglist *lookup(sglist *sg,char *s){
  for(;;){
    if(sg == NULL || strcmp(sg->name,s)==0)
      return sg;
    sg=sg->next;
  }
}

char *sbottom(slist *sl){
  while(sl->slst != NULL)
    sl=sl->slst;
  return sl->data.txt;
}

slist *new_signal(const char *s){
  slist *sl;
  /* somewhat boring now, but will get more interesting later */
  sl=addtxt(NULL,s);
  return sl;
}

/* kind of like strdup, but with specified len */
char *strgrab(char*s, size_t len)
{
  char *r = xmalloc(len+1);
  if (r) {
    memcpy(r, s, len);
    r[len] = 0;
  }
  return r;
}

/* s1 is the longer string, s2 is the shorter string */
char *string_check_diff(char *s1, char *s2)
{
  size_t llen = strlen(s1);
  size_t slen = strlen(s2);
  char *rv=0;
  if (memcmp(s1, s2, slen)==0) {
    if (DEBUG_RANGE) fprintf(stderr, "first %lu chars match\n", slen);
    if (llen>slen+3 && memcmp(s1+slen," + ",3)==0) {
      if (DEBUG_RANGE) fprintf(stderr, "followed by valid \" + \"\n");
      rv=strgrab(s1+slen+3,llen-slen-3);
    }
  } else if (memcmp(s1+llen-slen, s2, slen)==0) {
    if (DEBUG_RANGE) fprintf(stderr, "last %lu chars match\n", slen);
    if (llen>slen+3 && memcmp(s1+llen-slen-3," + ",3)==0) {
      if (DEBUG_RANGE) fprintf(stderr, "preceded by valid \" + \"\n");
      rv=strgrab(s1,llen-slen-3);
    }
  }
  return rv;
}

/* Look for common beginning or end of a string,
 * as needed for creating indexed part selects.
 * updown key:  DOWNTO = -1, TO = 1 */
char *slist_check_diff(slist *shi, slist *slo, int updown)
{
  char *diff = 0;
  size_t t1len, t2len;
  static struct astring a1={0,0,0}, a2={0,0,0};
  ainit(&a1);  sslprint(&a1, shi);  t1len = a1.used;
  ainit(&a2);  sslprint(&a2, slo);  t2len = a2.used;
  if (updown == -1 && t2len < t1len) {
    diff = string_check_diff(a1.s, a2.s);
  } else if (updown == 1 && t1len < t2len) {
    diff = string_check_diff(a2.s, a1.s);
  } /* I don't have sane test cases for the other possibilities */
  return diff;
}

const char *inout_string(int type)
{
  const char *name=NULL;
  switch(type) {
    case 0: name="input"  ; break;
    case 1: name="output" ; break;
    case 2: name="inout"  ; break;
    default: break;
  }
  return name;
}

int prec(int op){
  switch(op){
  case 'S': case 'U': /* signed or unsigned */
    return 10;
    break;
  case 'o': /* others */
    return 9;
    break;
  case 't': case 'n': case 's':
    return 8;
    break;
  case '~':
    return 7;
    break;
  case 'p': case 'm':
    return 6;
    break;
  case '*': case '/': case '%':
    return 5;
    break;
  case '+': case '-':
    return 4;
    break;
  case '&':
    return 3;
    break;
  case '^':
    return 2;
    break;
  case '|':
    return 1;
    break;
  default :
    return 0;
    break;
  }
}

expdata *addexpr(expdata *expr1,int op,const char* opstr,expdata *expr2){
slist *sl1,*sl2;
  if(expr1 == NULL)
    sl1=NULL;
  else if(expr1->op == 'c')
    sl1=addwrap("{",expr1->sl,"}");
  else if(prec(expr1->op) < prec(op))
    sl1=addwrap("(",expr1->sl,")");
  else
    sl1=expr1->sl;

  if(expr2->op == 'c')
    sl2=addwrap("{",expr2->sl,"}");
  else if(prec(expr2->op) < prec(op))
    sl2=addwrap("(",expr2->sl,")");
  else
    sl2=expr2->sl;

  if(expr1 == NULL)
    expr1=expr2;
  else
    free(expr2);

  expr1->op=op;
  sl1=addtxt(sl1,opstr);
  sl1=addsl(sl1,sl2);
  expr1->sl=sl1;
  return expr1;
}

void slTxtReplace(slist *sl, const char *match, const char *replace){
  if(sl){
    slTxtReplace(sl->slst, match, replace);
    switch(sl->type) {
    case tSLIST :
      slTxtReplace(sl->data.sl, match, replace);
      break;
    case tTXT :
      if (strcmp(sl->data.txt, match) == 0) {
        sl->data.txt = strdup(replace);
      }
      break;
    case tPTXT :
      if (strcmp(*(sl->data.ptxt), match) == 0) {
        *(sl->data.ptxt) = strdup(replace);
      }
      break;
    default :
      fprintf(stderr, "WARNING (line %d): unexpected slist type in slTxtReplace()\n", lineno);
    }
  }
}


/* XXX todo: runtime engage clkedge debug */
void push_clkedge(int val, const char *comment)
{
  if (0) fprintf(stderr,"clock event push: line=%d clkptr=%d, value=%d (%s)\n",lineno,clkptr,val,comment);
  clkedges[clkptr++]=val;
  assert(clkptr < MAXEDGES);
}

int pull_clkedge(slist *sensitivities)
{
  int clkedge;
  assert(clkptr>0);
  clkedge = clkedges[--clkptr];
  if (0) {
     fprintf(stderr,"clock event pull: value=%d, sensitivity list = ", clkedge);
     fslprint(stderr,sensitivities);
     fprintf(stderr,"\n");
  }
  return clkedge;
}

/* XXX maybe it's a bug that some uses don't munge clocks? */
slist *add_always(slist *sl, slist *sensitivities, slist *decls, int munge)
{
           int clkedge;
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"always @(");
           if (munge) {
             clkedge = pull_clkedge(sensitivities);
             if(clkedge) {
               sl=addtxt(sl,"posedge ");
               /* traverse $4->sl replacing " or " with " or posedge " if there is a clockedge */
               if (vlog_ver == 2001) slTxtReplace(sensitivities,", ", ", posedge ");
               if (vlog_ver == 1995) slTxtReplace(sensitivities," or ", " or posedge ");
             } else {
               sl=addtxt(sl,"negedge ");
               if (vlog_ver == 2001) slTxtReplace(sensitivities,", ", ", negedge ");
               if (vlog_ver == 1995) slTxtReplace(sensitivities," or ", " or negedge ");
             }
           }
           sl=addsl(sl,sensitivities);
           sl=addtxt(sl,") begin");
           if(decls){
             sl=addtxt(sl," : P");
             sl=addval(sl,np++);
             sl=addtxt(sl,"\n");
             sl=addsl(sl,decls);
           }
           sl=addtxt(sl,"\n");
           return sl;
}

void fixothers(slist *size_expr, slist *sl) {
  if(sl) {
    fixothers(size_expr, sl->slst);
    switch(sl->type) {
    case tSLIST :
      fixothers(size_expr,sl->data.sl);
      break;
    case tOTHERS : {
      /* found an (OTHERS => 'x') clause - change to type tSLIST, and insert the
       * size_expr for the corresponding signal */
      slist *p;
      slist *size_copy = xmalloc(sizeof(slist));
      size_copy = copysl(size_expr);
      if (0) {
        fprintf(stderr,"fixothers type 4 size_expr ");
        fslprint(stderr,size_expr);
        fprintf(stderr,"\n");
      }
      p = addwrap("{",sl->data.sl,"}");
      p = addsl(size_copy, p);
      p = addwrap("{",p,"}");
      sl->type=tSLIST;
      sl->slst=p;
      sl->data.sl=NULL;
      break;
    } /* case tOTHERS */
    default :
      /* fprintf(stderr, "WARNING (line %d): unexpected slist type in fixothers()\n", lineno); */
      break; /* no action */
    } /* switch */
  }
}

void findothers(slval *sgin,slist *sl){
  sglist *sg = NULL;
  int size = -1;
  int useExpr=0;
  if (0) {
    fprintf(stderr,"findothers lhs ");
    fslprint(stderr,sgin->sl);
    fprintf(stderr,", sgin->val %d\n", sgin->val);
  }
  if(sgin->val>0) {
    size=sgin->val;
  } else if (sgin->range != NULL) {
    if (sgin->range->vtype != tVRANGE) {
      size=1;
    } else if (sgin->range->sizeval > 0) {
      size=sgin->range->sizeval;
    } else if (sgin->range->size_expr != NULL) {
      useExpr = 1;
      fixothers(sgin->range->size_expr, sl);
    }
  } else {
    if((sg=lookup(io_list,sgin->sl->data.txt))==NULL) {
      sg=lookup(sig_list,sgin->sl->data.txt);
    }
    if(sg) {
      if(sg->range->vtype != tVRANGE) {
        size=1;
      } else {
        if (sg->range->sizeval > 0) {
          size = sg->range->sizeval;
        } else {
          assert (sg->range->size_expr != NULL);
          useExpr = 1;
          fixothers(sg->range->size_expr, sl);
        }
      }
    } else {
      /* lookup failed, there was no vrange or size value in sgin - so just punt, and assign size=1 */
      size=1;
    }  /* if(sg) */
  }
  if (!useExpr) {
    slist *p;
    assert(size>0);
    /* use size */
    p = addval(NULL,size);
    fixothers(p,sl);
  }
}

/* code to find bit number of the msb of n */
int find_msb(int n)
{
    int k=0;
    if(n&0xff00){
        k|=8;
        n&=0xff00;
    }
    if(n&0xf0f0){
        k|=4;
        n&=0xf0f0;
    }
    if(n&0xcccc){
        k|=2;
        n&=0xcccc;
    }
    if(n&0xaaaa){
        k|=1;
        n&=0xaaaa;
    }
    return k;
}

static char time_unit[2]="\0\0", new_unit[2]="\0\0";
static void set_timescale(const char *s)
{
    if (0) fprintf(stderr,"set_timescale (%s)\n", s);
    new_unit[0] = time_unit[0];
         if (strcasecmp(s,"ms") == 0) { new_unit[0] = 'm'; }
    else if (strcasecmp(s,"us") == 0) { new_unit[0] = 'u'; }
    else if (strcasecmp(s,"ns") == 0) { new_unit[0] = 'n'; }
    else if (strcasecmp(s,"ps") == 0) { new_unit[0] = 'p'; }
    else {
        fprintf(stderr,"WARNING (line %d): AFTER NATURAL NAME pattern matched, but NAME='%s' should be a time unit.\n", lineno, s);
    }
    if (new_unit[0] != time_unit[0]) {
        if (time_unit[0] != 0) {
            fprintf(stderr,"WARNING (line %d): inconsistent time unit (%s) ignored.\n", lineno, s);
        } else {
            time_unit[0] = new_unit[0];
        }
    }
}

slist *output_timescale(slist *sl)
{
    if (!timescale_emitted) {
        if (time_unit[0] != 0) {
            sl = addtxt(sl, "`timescale 1 ");
            sl = addtxt(sl, time_unit);
            sl = addtxt(sl, "s / 1 ");
            sl = addtxt(sl, time_unit);
            sl = addtxt(sl, "s\n");
        } else {
            sl = addtxt(sl, "// no timescale needed\n");
        }
        timescale_emitted = 1;
    }
    return sl;
}

slist *setup_port(sglist *s_list, int dir, vrange *type) {
  slist *sl;
  sglist *p;
  if (vlog_ver == 2001) {
    sl=addtxt(NULL,NULL);
  }
  else {
    sl=addtxt(NULL,inout_string(dir));
    sl=addpar(sl,type);
  }
  p=s_list;
  for(;;){
    p->type=wire;
    if (vlog_ver == 2001) p->dir=inout_string(dir);
    p->range=type;
    if (vlog_ver == 1995) sl=addtxt(sl, p->name);
    if(p->next==NULL)
      break;
    p=p->next;
    if (vlog_ver == 1995) sl=addtxt(sl,", ");
  }
  if (vlog_ver == 1995) sl=addtxt(sl,";\n");
  p->next=io_list;
  io_list=s_list;
  return sl;
}

slist *emit_io_list(slist *sl)
{
              sglist *p;
              sl=addtxt(sl,"(\n");
              p=io_list;
              for(;;){
                if (vlog_ver == 2001) {
                  sl=addtxt(sl,p->dir);
                  sl=addtxt(sl," ");
                  sl=addptxt(sl,&(p->type));
                  sl=addpar(sl,p->range);
                }
                sl=addtxt(sl,p->name);
                p=p->next;
                if(p)
                  sl=addtxt(sl,",\n");
                else{
                  sl=addtxt(sl,"\n");
                  break;
                }
              }
              sl=addtxt(sl,");\n\n");
              return sl;
}

#line 1085 "vhd2vl.tab.c"

# ifndef YY_CAST
#  ifdef __cplusplus
#   define YY_CAST(Type, Val) static_cast<Type> (Val)
#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
#  else
#   define YY_CAST(Type, Val) ((Type) (Val))
#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
#  endif
# endif
# ifndef YY_NULLPTR
#  if defined __cplusplus
#   if 201103L <= __cplusplus
#    define YY_NULLPTR nullptr
#   else
#    define YY_NULLPTR 0
#   endif
#  else
#   define YY_NULLPTR ((void*)0)
#  endif
# endif

#include "vhd2vl.tab.h"
/* Symbol kind.  */
enum yysymbol_kind_t
{
  YYSYMBOL_YYEMPTY = -2,
  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
  YYSYMBOL_YYerror = 1,                    /* error  */
  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
  YYSYMBOL_ABS = 3,                        /* ABS  */
  YYSYMBOL_REM = 4,                        /* REM  */
  YYSYMBOL_ENTITY = 5,                     /* ENTITY  */
  YYSYMBOL_IS = 6,                         /* IS  */
  YYSYMBOL_PORT = 7,                       /* PORT  */
  YYSYMBOL_GENERIC = 8,                    /* GENERIC  */
  YYSYMBOL_IN = 9,                         /* IN  */
  YYSYMBOL_OUT = 10,                       /* OUT  */
  YYSYMBOL_INOUT = 11,                     /* INOUT  */
  YYSYMBOL_MAP = 12,                       /* MAP  */
  YYSYMBOL_INTEGER = 13,                   /* INTEGER  */
  YYSYMBOL_BIT = 14,                       /* BIT  */
  YYSYMBOL_BITVECT = 15,                   /* BITVECT  */
  YYSYMBOL_DOWNTO = 16,                    /* DOWNTO  */
  YYSYMBOL_TO = 17,                        /* TO  */
  YYSYMBOL_TYPE = 18,                      /* TYPE  */
  YYSYMBOL_END = 19,                       /* END  */
  YYSYMBOL_ARCHITECTURE = 20,              /* ARCHITECTURE  */
  YYSYMBOL_COMPONENT = 21,                 /* COMPONENT  */
  YYSYMBOL_OF = 22,                        /* OF  */
  YYSYMBOL_ARRAY = 23,                     /* ARRAY  */
  YYSYMBOL_SIGNAL = 24,                    /* SIGNAL  */
  YYSYMBOL_BEGN = 25,                      /* BEGN  */
  YYSYMBOL_NOT = 26,                       /* NOT  */
  YYSYMBOL_WHEN = 27,                      /* WHEN  */
  YYSYMBOL_WITH = 28,                      /* WITH  */
  YYSYMBOL_EXIT = 29,                      /* EXIT  */
  YYSYMBOL_SELECT = 30,                    /* SELECT  */
  YYSYMBOL_OTHERS = 31,                    /* OTHERS  */
  YYSYMBOL_PROCESS = 32,                   /* PROCESS  */
  YYSYMBOL_VARIABLE = 33,                  /* VARIABLE  */
  YYSYMBOL_CONSTANT = 34,                  /* CONSTANT  */
  YYSYMBOL_IF = 35,                        /* IF  */
  YYSYMBOL_THEN = 36,                      /* THEN  */
  YYSYMBOL_ELSIF = 37,                     /* ELSIF  */
  YYSYMBOL_ELSE = 38,                      /* ELSE  */
  YYSYMBOL_CASE = 39,                      /* CASE  */
  YYSYMBOL_WHILE = 40,                     /* WHILE  */
  YYSYMBOL_FOR = 41,                       /* FOR  */
  YYSYMBOL_LOOP = 42,                      /* LOOP  */
  YYSYMBOL_GENERATE = 43,                  /* GENERATE  */
  YYSYMBOL_AFTER = 44,                     /* AFTER  */
  YYSYMBOL_AND = 45,                       /* AND  */
  YYSYMBOL_OR = 46,                        /* OR  */
  YYSYMBOL_NAND = 47,                      /* NAND  */
  YYSYMBOL_NOR = 48,                       /* NOR  */
  YYSYMBOL_XOR = 49,                       /* XOR  */
  YYSYMBOL_XNOR = 50,                      /* XNOR  */
  YYSYMBOL_MOD = 51,                       /* MOD  */
  YYSYMBOL_RW_REM = 52,                    /* RW_REM  */
  YYSYMBOL_POW = 53,                       /* POW  */
  YYSYMBOL_LASTVALUE = 54,                 /* LASTVALUE  */
  YYSYMBOL_EVENT = 55,                     /* EVENT  */
  YYSYMBOL_POSEDGE = 56,                   /* POSEDGE  */
  YYSYMBOL_NEGEDGE = 57,                   /* NEGEDGE  */
  YYSYMBOL_STRING = 58,                    /* STRING  */
  YYSYMBOL_NAME = 59,                      /* NAME  */
  YYSYMBOL_RANGE = 60,                     /* RANGE  */
  YYSYMBOL_NULLV = 61,                     /* NULLV  */
  YYSYMBOL_OPEN = 62,                      /* OPEN  */
  YYSYMBOL_CONVFUNC_1 = 63,                /* CONVFUNC_1  */
  YYSYMBOL_CONVFUNC_2 = 64,                /* CONVFUNC_2  */
  YYSYMBOL_BASED = 65,                     /* BASED  */
  YYSYMBOL_FLOAT = 66,                     /* FLOAT  */
  YYSYMBOL_LEFT = 67,                      /* LEFT  */
  YYSYMBOL_SCIENTIFIC = 68,                /* SCIENTIFIC  */
  YYSYMBOL_REAL = 69,                      /* REAL  */
  YYSYMBOL_ASSERT = 70,                    /* ASSERT  */
  YYSYMBOL_REPORT = 71,                    /* REPORT  */
  YYSYMBOL_SEVERITY = 72,                  /* SEVERITY  */
  YYSYMBOL_WARNING = 73,                   /* WARNING  */
  YYSYMBOL_ERROR = 74,                     /* ERROR  */
  YYSYMBOL_FAILURE = 75,                   /* FAILURE  */
  YYSYMBOL_NOTE = 76,                      /* NOTE  */
  YYSYMBOL_ROL = 77,                       /* ROL  */
  YYSYMBOL_ROR = 78,                       /* ROR  */
  YYSYMBOL_SLA = 79,                       /* SLA  */
  YYSYMBOL_SLL = 80,                       /* SLL  */
  YYSYMBOL_SRA = 81,                       /* SRA  */
  YYSYMBOL_SRL = 82,                       /* SRL  */
  YYSYMBOL_ROTATE_LEFT = 83,               /* ROTATE_LEFT  */
  YYSYMBOL_ROTATE_RIGHT = 84,              /* ROTATE_RIGHT  */
  YYSYMBOL_SHIFT_LEFT = 85,                /* SHIFT_LEFT  */
  YYSYMBOL_SHIFT_RIGHT = 86,               /* SHIFT_RIGHT  */
  YYSYMBOL_NATURAL = 87,                   /* NATURAL  */
  YYSYMBOL_88_ = 88,                       /* '='  */
  YYSYMBOL_ORL = 89,                       /* ORL  */
  YYSYMBOL_NORL = 90,                      /* NORL  */
  YYSYMBOL_ANDL = 91,                      /* ANDL  */
  YYSYMBOL_NANDL = 92,                     /* NANDL  */
  YYSYMBOL_93_ = 93,                       /* '<'  */
  YYSYMBOL_94_ = 94,                       /* '>'  */
  YYSYMBOL_BIGEQ = 95,                     /* BIGEQ  */
  YYSYMBOL_LESSEQ = 96,                    /* LESSEQ  */
  YYSYMBOL_NOTEQ = 97,                     /* NOTEQ  */
  YYSYMBOL_EQUAL = 98,                     /* EQUAL  */
  YYSYMBOL_99_ = 99,                       /* '+'  */
  YYSYMBOL_100_ = 100,                     /* '-'  */
  YYSYMBOL_101_ = 101,                     /* '&'  */
  YYSYMBOL_102_ = 102,                     /* '*'  */
  YYSYMBOL_103_ = 103,                     /* '/'  */
  YYSYMBOL_UMINUS = 104,                   /* UMINUS  */
  YYSYMBOL_UPLUS = 105,                    /* UPLUS  */
  YYSYMBOL_NOTL = 106,                     /* NOTL  */
  YYSYMBOL_107_ = 107,                     /* ';'  */
  YYSYMBOL_108_ = 108,                     /* '('  */
  YYSYMBOL_109_ = 109,                     /* ')'  */
  YYSYMBOL_110_ = 110,                     /* ':'  */
  YYSYMBOL_111_ = 111,                     /* '\''  */
  YYSYMBOL_112_ = 112,                     /* ','  */
  YYSYMBOL_113_ = 113,                     /* '|'  */
  YYSYMBOL_YYACCEPT = 114,                 /* $accept  */
  YYSYMBOL_trad = 115,                     /* trad  */
  YYSYMBOL_design_units = 116,             /* design_units  */
  YYSYMBOL_design_unit = 117,              /* design_unit  */
  YYSYMBOL_rem = 118,                      /* rem  */
  YYSYMBOL_remlist = 119,                  /* remlist  */
  YYSYMBOL_opt_is = 120,                   /* opt_is  */
  YYSYMBOL_opt_entity = 121,               /* opt_entity  */
  YYSYMBOL_opt_architecture = 122,         /* opt_architecture  */
  YYSYMBOL_opt_begin = 123,                /* opt_begin  */
  YYSYMBOL_generate = 124,                 /* generate  */
  YYSYMBOL_endgenerate = 125,              /* endgenerate  */
  YYSYMBOL_norem = 126,                    /* norem  */
  YYSYMBOL_yesrem = 127,                   /* yesrem  */
  YYSYMBOL_vhdassert = 128,                /* vhdassert  */
  YYSYMBOL_sevlevel = 129,                 /* sevlevel  */
  YYSYMBOL_entity = 130,                   /* entity  */
  YYSYMBOL_genlist = 131,                  /* genlist  */
  YYSYMBOL_portlist = 132,                 /* portlist  */
  YYSYMBOL_dir = 133,                      /* dir  */
  YYSYMBOL_type = 134,                     /* type  */
  YYSYMBOL_vec_range = 135,                /* vec_range  */
  YYSYMBOL_updown = 136,                   /* updown  */
  YYSYMBOL_architecture = 137,             /* architecture  */
  YYSYMBOL_doindent = 138,                 /* doindent  */
  YYSYMBOL_unindent = 139,                 /* unindent  */
  YYSYMBOL_a_decl = 140,                   /* a_decl  */
  YYSYMBOL_opt_generic = 141,              /* opt_generic  */
  YYSYMBOL_nolist = 142,                   /* nolist  */
  YYSYMBOL_yeslist = 143,                  /* yeslist  */
  YYSYMBOL_s_list = 144,                   /* s_list  */
  YYSYMBOL_a_body = 145,                   /* a_body  */
  YYSYMBOL_oname = 146,                    /* oname  */
  YYSYMBOL_optname = 147,                  /* optname  */
  YYSYMBOL_gen_optname = 148,              /* gen_optname  */
  YYSYMBOL_edge = 149,                     /* edge  */
  YYSYMBOL_yeswith = 150,                  /* yeswith  */
  YYSYMBOL_with_list = 151,                /* with_list  */
  YYSYMBOL_with_item = 152,                /* with_item  */
  YYSYMBOL_p_decl = 153,                   /* p_decl  */
  YYSYMBOL_p_body = 154,                   /* p_body  */
  YYSYMBOL_elsepart = 155,                 /* elsepart  */
  YYSYMBOL_cases = 156,                    /* cases  */
  YYSYMBOL_wlist = 157,                    /* wlist  */
  YYSYMBOL_wvalue = 158,                   /* wvalue  */
  YYSYMBOL_sign_list = 159,                /* sign_list  */
  YYSYMBOL_sigvalue = 160,                 /* sigvalue  */
  YYSYMBOL_nodelay = 161,                  /* nodelay  */
  YYSYMBOL_delay = 162,                    /* delay  */
  YYSYMBOL_map_list = 163,                 /* map_list  */
  YYSYMBOL_map_item = 164,                 /* map_item  */
  YYSYMBOL_mvalue = 165,                   /* mvalue  */
  YYSYMBOL_166_1 = 166,                    /* $@1  */
  YYSYMBOL_167_2 = 167,                    /* $@2  */
  YYSYMBOL_generic_map_list = 168,         /* generic_map_list  */
  YYSYMBOL_generic_map_item = 169,         /* generic_map_item  */
  YYSYMBOL_signal = 170,                   /* signal  */
  YYSYMBOL_expr = 171,                     /* expr  */
  YYSYMBOL_172_3 = 172,                    /* $@3  */
  YYSYMBOL_aggregate_item = 173,           /* aggregate_item  */
  YYSYMBOL_aggregate_list = 174,           /* aggregate_list  */
  YYSYMBOL_exprc = 175,                    /* exprc  */
  YYSYMBOL_conf = 176,                     /* conf  */
  YYSYMBOL_simple_expr = 177,              /* simple_expr  */
  YYSYMBOL_178_4 = 178                     /* $@4  */
};
typedef enum yysymbol_kind_t yysymbol_kind_t;




#ifdef short
# undef short
#endif

/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
   <limits.h> and (if available) <stdint.h> are included
   so that the code can choose integer types of a good width.  */

#ifndef __PTRDIFF_MAX__
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
#  define YY_STDINT_H
# endif
#endif

/* Narrow types that promote to a signed type and that can represent a
   signed or unsigned integer of at least N bits.  In tables they can
   save space and decrease cache pressure.  Promoting to a signed type
   helps avoid bugs in integer arithmetic.  */

#ifdef __INT_LEAST8_MAX__
typedef __INT_LEAST8_TYPE__ yytype_int8;
#elif defined YY_STDINT_H
typedef int_least8_t yytype_int8;
#else
typedef signed char yytype_int8;
#endif

#ifdef __INT_LEAST16_MAX__
typedef __INT_LEAST16_TYPE__ yytype_int16;
#elif defined YY_STDINT_H
typedef int_least16_t yytype_int16;
#else
typedef short yytype_int16;
#endif

/* Work around bug in HP-UX 11.23, which defines these macros
   incorrectly for preprocessor constants.  This workaround can likely
   be removed in 2023, as HPE has promised support for HP-UX 11.23
   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
#ifdef __hpux
# undef UINT_LEAST8_MAX
# undef UINT_LEAST16_MAX
# define UINT_LEAST8_MAX 255
# define UINT_LEAST16_MAX 65535
#endif

#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
       && UINT_LEAST8_MAX <= INT_MAX)
typedef uint_least8_t yytype_uint8;
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
typedef unsigned char yytype_uint8;
#else
typedef short yytype_uint8;
#endif

#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
       && UINT_LEAST16_MAX <= INT_MAX)
typedef uint_least16_t yytype_uint16;
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
typedef unsigned short yytype_uint16;
#else
typedef int yytype_uint16;
#endif

#ifndef YYPTRDIFF_T
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
#  define YYPTRDIFF_T __PTRDIFF_TYPE__
#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
# elif defined PTRDIFF_MAX
#  ifndef ptrdiff_t
#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  endif
#  define YYPTRDIFF_T ptrdiff_t
#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
# else
#  define YYPTRDIFF_T long
#  define YYPTRDIFF_MAXIMUM LONG_MAX
# endif
#endif

#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
#  define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
#  define YYSIZE_T size_t
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# else
#  define YYSIZE_T unsigned
# endif
#endif

#define YYSIZE_MAXIMUM                                  \
  YY_CAST (YYPTRDIFF_T,                                 \
           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
            ? YYPTRDIFF_MAXIMUM                         \
            : YY_CAST (YYSIZE_T, -1)))

#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))


/* Stored state numbers (used for stacks). */
typedef yytype_int16 yy_state_t;

/* State numbers in computations.  */
typedef int yy_state_fast_t;

#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(Msgid) Msgid
# endif
#endif


#ifndef YY_ATTRIBUTE_PURE
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
#  define YY_ATTRIBUTE_PURE
# endif
#endif

#ifndef YY_ATTRIBUTE_UNUSED
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# else
#  define YY_ATTRIBUTE_UNUSED
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#if ! defined lint || defined __GNUC__
# define YY_USE(E) ((void) (E))
#else
# define YY_USE(E) /* empty */
#endif

/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
    _Pragma ("GCC diagnostic push")                                     \
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
# else
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
    _Pragma ("GCC diagnostic push")                                     \
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# endif
# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
    _Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif

#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
# define YY_IGNORE_USELESS_CAST_BEGIN                          \
    _Pragma ("GCC diagnostic push")                            \
    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
# define YY_IGNORE_USELESS_CAST_END            \
    _Pragma ("GCC diagnostic pop")
#endif
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_END
#endif


#define YY_ASSERT(E) ((void) (0 && (E)))

#if 1

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   elif defined __BUILTIN_VA_ARG_INCR
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
#   elif defined _AIX
#    define YYSTACK_ALLOC __alloca
#   elif defined _MSC_VER
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
#    define alloca _alloca
#   else
#    define YYSTACK_ALLOC alloca
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
#     ifndef EXIT_SUCCESS
#      define EXIT_SUCCESS 0
#     endif
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's 'empty if-body' warning.  */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
#  ifndef YYSTACK_ALLOC_MAXIMUM
    /* The OS might guarantee only one guard page at the bottom of the stack,
       and a page size can be as small as 4096 bytes.  So we cannot safely
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
       to allow for a few compiler-allocated temporary stack slots.  */
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
#  endif
# else
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
#  ifndef YYSTACK_ALLOC_MAXIMUM
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
#  endif
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
       && ! ((defined YYMALLOC || defined malloc) \
             && (defined YYFREE || defined free)))
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   ifndef EXIT_SUCCESS
#    define EXIT_SUCCESS 0
#   endif
#  endif
#  ifndef YYMALLOC
#   define YYMALLOC malloc
#   if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
#  ifndef YYFREE
#   define YYFREE free
#   if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
# endif
#endif /* 1 */

#if (! defined yyoverflow \
     && (! defined __cplusplus \
         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  yy_state_t yyss_alloc;
  YYSTYPE yyvs_alloc;
};

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
      + YYSTACK_GAP_MAXIMUM)

# define YYCOPY_NEEDED 1

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
    do                                                                  \
      {                                                                 \
        YYPTRDIFF_T yynewbytes;                                         \
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
        Stack = &yyptr->Stack_alloc;                                    \
        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
      }                                                                 \
    while (0)

#endif

#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if defined __GNUC__ && 1 < __GNUC__
#   define YYCOPY(Dst, Src, Count) \
      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
#  else
#   define YYCOPY(Dst, Src, Count)              \
      do                                        \
        {                                       \
          YYPTRDIFF_T yyi;                      \
          for (yyi = 0; yyi < (Count); yyi++)   \
            (Dst)[yyi] = (Src)[yyi];            \
        }                                       \
      while (0)
#  endif
# endif
#endif /* !YYCOPY_NEEDED */

/* YYFINAL -- State number of the termination state.  */
#define YYFINAL  8
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   2803

/* YYNTOKENS -- Number of terminals.  */
#define YYNTOKENS  114
/* YYNNTS -- Number of nonterminals.  */
#define YYNNTS  65
/* YYNRULES -- Number of rules.  */
#define YYNRULES  225
/* YYNSTATES -- Number of states.  */
#define YYNSTATES  774

/* YYMAXUTOK -- Last valid token kind.  */
#define YYMAXUTOK   353


/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex, with out-of-bounds checking.  */
#define YYTRANSLATE(YYX)                                \
  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
   : YYSYMBOL_YYUNDEF)

/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex.  */
static const yytype_int8 yytranslate[] =
{
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,   101,   111,
     108,   109,   102,    99,   112,   100,     2,   103,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,   110,   107,
      93,    88,    94,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,   113,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
      85,    86,    87,    89,    90,    91,    92,    95,    96,    97,
      98,   104,   105,   106
};

#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
static const yytype_int16 yyrline[] =
{
       0,  1124,  1124,  1132,  1135,  1144,  1151,  1160,  1172,  1173,
    1176,  1177,  1183,  1183,  1185,  1185,  1187,  1187,  1189,  1189,
    1191,  1193,  1196,  1197,  1200,  1205,  1205,  1205,  1205,  1211,
    1238,  1269,  1290,  1312,  1332,  1353,  1366,  1379,  1392,  1406,
    1407,  1408,  1411,  1414,  1420,  1425,  1428,  1429,  1443,  1523,
    1527,  1542,  1543,  1547,  1557,  1560,  1563,  1564,  1587,  1612,
    1621,  1661,  1674,  1682,  1683,  1691,  1692,  1695,  1708,  1723,
    1725,  1738,  1751,  1779,  1791,  1809,  1818,  1833,  1860,  1889,
    1913,  1951,  1988,  1995,  1996,  1999,  2000,  2002,  2003,  2015,
    2016,  2019,  2022,  2025,  2030,  2032,  2033,  2041,  2060,  2081,
    2082,  2102,  2126,  2128,  2142,  2160,  2173,  2195,  2217,  2230,
    2245,  2251,  2261,  2262,  2272,  2281,  2290,  2297,  2300,  2301,
    2308,  2309,  2310,  2313,  2314,  2327,  2343,  2347,  2360,  2363,
    2364,  2370,  2374,  2383,  2384,  2394,  2395,  2396,  2397,  2398,
    2399,  2405,  2405,  2411,  2411,  2417,  2451,  2455,  2462,  2467,
    2477,  2492,  2517,  2540,  2548,  2555,  2561,  2567,  2573,  2599,
    2605,  2608,  2633,  2634,  2635,  2636,  2637,  2638,  2639,  2640,
    2644,  2645,  2646,  2658,  2659,  2660,  2661,  2662,  2663,  2664,
    2669,  2674,  2679,  2684,  2689,  2694,  2698,  2702,  2706,  2710,
    2738,  2738,  2743,  2815,  2820,  2823,  2828,  2835,  2842,  2854,
    2855,  2858,  2863,  2871,  2876,  2884,  2892,  2895,  2898,  2901,
    2904,  2907,  2912,  2920,  2947,  2962,  2970,  2983,  3000,  3003,
    3006,  3009,  3012,  3015,  3015,  3025
};
#endif

/** Accessing symbol of state STATE.  */
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])

#if 1
/* The user-facing name of the symbol whose (internal) number is
   YYSYMBOL.  No bounds checking.  */
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;

/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
static const char *const yytname[] =
{
  "\"end of file\"", "error", "\"invalid token\"", "ABS", "REM", "ENTITY",
  "IS", "PORT", "GENERIC", "IN", "OUT", "INOUT", "MAP", "INTEGER", "BIT",
  "BITVECT", "DOWNTO", "TO", "TYPE", "END", "ARCHITECTURE", "COMPONENT",
  "OF", "ARRAY", "SIGNAL", "BEGN", "NOT", "WHEN", "WITH", "EXIT", "SELECT",
  "OTHERS", "PROCESS", "VARIABLE", "CONSTANT", "IF", "THEN", "ELSIF",
  "ELSE", "CASE", "WHILE", "FOR", "LOOP", "GENERATE", "AFTER", "AND", "OR",
  "NAND", "NOR", "XOR", "XNOR", "MOD", "RW_REM", "POW", "LASTVALUE",
  "EVENT", "POSEDGE", "NEGEDGE", "STRING", "NAME", "RANGE", "NULLV",
  "OPEN", "CONVFUNC_1", "CONVFUNC_2", "BASED", "FLOAT", "LEFT",
  "SCIENTIFIC", "REAL", "ASSERT", "REPORT", "SEVERITY", "WARNING", "ERROR",
  "FAILURE", "NOTE", "ROL", "ROR", "SLA", "SLL", "SRA", "SRL",
  "ROTATE_LEFT", "ROTATE_RIGHT", "SHIFT_LEFT", "SHIFT_RIGHT", "NATURAL",
  "'='", "ORL", "NORL", "ANDL", "NANDL", "'<'", "'>'", "BIGEQ", "LESSEQ",
  "NOTEQ", "EQUAL", "'+'", "'-'", "'&'", "'*'", "'/'", "UMINUS", "UPLUS",
  "NOTL", "';'", "'('", "')'", "':'", "'\\''", "','", "'|'", "$accept",
  "trad", "design_units", "design_unit", "rem", "remlist", "opt_is",
  "opt_entity", "opt_architecture", "opt_begin", "generate", "endgenerate",
  "norem", "yesrem", "vhdassert", "sevlevel", "entity", "genlist",
  "portlist", "dir", "type", "vec_range", "updown", "architecture",
  "doindent", "unindent", "a_decl", "opt_generic", "nolist", "yeslist",
  "s_list", "a_body", "oname", "optname", "gen_optname", "edge", "yeswith",
  "with_list", "with_item", "p_decl", "p_body", "elsepart", "cases",
  "wlist", "wvalue", "sign_list", "sigvalue", "nodelay", "delay",
  "map_list", "map_item", "mvalue", "$@1", "$@2", "generic_map_list",
  "generic_map_item", "signal", "expr", "$@3", "aggregate_item",
  "aggregate_list", "exprc", "conf", "simple_expr", "$@4", YY_NULLPTR
};

static const char *
yysymbol_name (yysymbol_kind_t yysymbol)
{
  return yytname[yysymbol];
}
#endif

#define YYPACT_NINF (-516)

#define yypact_value_is_default(Yyn) \
  ((Yyn) == YYPACT_NINF)

#define YYTABLE_NINF (-87)

#define yytable_value_is_error(Yyn) \
  0

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
static const yytype_int16 yypact[] =
{
      39,    39,    72,    39,  -516,    75,  -516,  -516,  -516,  -516,
      94,    45,    58,    70,  -516,    39,   123,   115,   140,   194,
      87,  -516,  -516,   181,   189,   103,   107,    39,    39,    39,
    -516,   163,   163,   306,    21,   120,   121,   149,   153,   207,
     210,   163,  -516,   212,    39,  -516,   168,   211,   170,   302,
     273,   282,   192,    39,   195,   163,    39,   241,  -516,   200,
    -516,  -516,    28,    39,  -516,  -516,  -516,   211,     8,  -516,
      39,   211,   138,   290,   283,    11,   211,  -516,   316,  1132,
     109,    39,   245,  -516,   310,    29,   226,   163,   343,    83,
     295,  1132,    97,  1184,    39,   263,   339,   260,  1184,   295,
     267,  -516,  1132,   270,  1132,  -516,    17,   272,   274,  -516,
    -516,   280,   281,   285,   287,   325,  1132,  1132,   840,  -516,
    1590,   299,  -516,   130,   312,  -516,   191,   191,   294,  -516,
     165,   163,  1132,   424,    39,   344,  -516,   109,   331,  -516,
     434,    39,   358,   341,   359,  1599,   109,    25,  1184,   887,
    2570,   296,  -516,  -516,   363,  -516,   394,   295,   433,   446,
     372,   348,  -516,  1132,  -516,  -516,  -516,  1132,  1132,  1132,
    1132,  1132,  -516,  -516,  -516,   374,  1451,   361,   373,  1132,
    1132,  1132,  1132,  1132,  1132,  1132,  1132,  1132,  1132,  1132,
    1132,  1132,  1132,  1132,  1132,  1132,  1132,  1132,  1132,  1132,
     191,   -25,  -516,   137,  -516,   101,  -516,  -516,  -516,   191,
     191,   191,   191,   191,   191,  -516,  1307,  -516,   394,   163,
    1132,   375,   370,   386,  -516,  -516,  1132,   400,    39,   388,
      39,  -516,  -516,  1384,     3,  1132,   939,   991,  1080,  1184,
    1184,  1184,  1184,   441,    39,  -516,   391,   393,   397,   486,
    -516,  1132,  1132,    39,  1904,  1132,  1658,  1672,  1740,  1754,
    1822,   426,  1132,  1132,  -516,   840,  -516,  2689,   413,   440,
     413,   440,   334,   559,   219,   219,  -516,   930,   930,   930,
     930,   930,   930,   -15,   -15,   -15,   465,   465,   261,  -516,
    -516,   191,   454,  -516,  -516,    89,    89,   472,   472,   190,
      39,  -516,   429,  -516,  1346,   509,    39,    39,   430,  2284,
      39,  -516,   438,   213,  -516,  2700,  1132,  2700,  1132,  2700,
    1132,   300,   300,   300,   300,   490,  -516,  -516,    39,   295,
    -516,  -516,    39,  1463,  2293,   163,  -516,  1915,  1132,  1132,
    1132,  1132,  1132,  1132,  2629,  2645,  1522,  -516,  -516,   297,
     163,  -516,    39,  -516,   211,  -516,   163,    39,    39,  -516,
     295,   109,   546,   551,  2700,  2700,  2700,   335,  1132,  -516,
     534,   282,  -516,  -516,  1132,  1132,    39,   460,  -516,  1980,
    1991,  2056,  2067,  2132,  2689,   474,   476,  -516,  -516,   163,
     464,   463,   163,  -516,  1132,   480,   466,   475,   477,  -516,
    -516,  -516,  -516,   467,  -516,  2511,   163,   562,   569,  2501,
    2501,  -516,   484,  -516,  -516,  -516,  -516,  -516,  1132,  1132,
    -516,    39,   488,   485,  -516,   508,  -516,  -516,  -516,  -516,
      39,   511,    14,   489,  -516,   557,   394,  -516,  -516,    39,
    2689,  2689,  -516,    39,   496,    39,  1132,    39,    39,  -516,
     548,  1184,  -516,   211,    39,  -516,   501,    39,    39,   590,
    -516,    39,   595,    39,   -14,  2511,    56,    39,  1223,   504,
    -516,    20,   150,   383,   598,    39,  -516,  -516,   424,   599,
     560,  -516,  -516,    39,   597,   514,  -516,   -19,  -516,   517,
     518,  -516,   596,   516,  -516,  -516,   520,   111,   519,  2689,
      39,  -516,  -516,    39,   542,   528,   631,   295,  1184,   295,
     529,   522,   605,  -516,   569,   569,   394,   617,   532,  1132,
     100,  -516,  -516,   549,  -516,  1132,   552,    39,   540,   555,
      39,  -516,  1132,  -516,  1132,    39,   543,   547,   -11,   493,
     614,   368,   650,   327,   656,    39,   578,   575,   394,   394,
     394,   563,   394,  -516,  -516,   564,  -516,   616,   565,  -516,
    1132,    86,  1132,  1836,   582,  -516,  -516,  1132,  -516,   665,
    -516,  2356,   525,  -516,   618,   623,   628,   577,    31,    39,
    -516,  1262,    39,  -516,  1132,  -516,  -516,   603,   585,   586,
     593,  -516,   600,  -516,  -516,    24,  2143,   126,  -516,  2208,
    1132,   626,    39,  2689,   689,    39,  1184,   604,   610,   657,
    -516,   684,    39,    15,   677,    39,  1531,  1132,  1132,  -516,
      39,    39,  -516,  -516,  -516,  -516,  2219,   611,  -516,   601,
    -516,   423,  -516,  -516,  1184,   670,  -516,   651,   154,   702,
    -516,  1132,  1132,  2365,  -516,    39,  -516,  -516,    39,  -516,
    -516,  -516,  -516,   300,   615,   214,  -516,   620,   -52,   685,
     704,  2428,  2440,  -516,    39,  -516,  -516,    39,    39,    39,
     631,   692,   709,   635,   639,   627,   693,  -516,  -516,    39,
    -516,   629,  -516,   717,   701,   459,   631,    39,   705,  -516,
    -516,    39,   634,    39,    39,  -516,   638,   244,   714,  -516,
    -516,   711,   380,  -516,   641,    39,    39,  -516,    39,  -516,
    -516,  -516,  1184,  -516,   394,    39,    39,  -516,  -516,    39,
    -516,  -516,  -516,   731,   732,    39,   487,   645,  -516,  -516,
      39,  -516,  -516,   677,   712,   716,  -516,  -516,   737,   244,
    -516,  -516,   652,   653,    39,   733,  -516,   747,    39,    39,
    -516,   662,   735,  -516,  -516,    39,   664,   775,   777,   765,
     763,   394,   694,   695,   780,  -516,   768,    39,   394,  -516,
     696,  -516,    39,  -516
};

/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
   Performed when YYTABLE does not specify something else to do.  Zero
   means the default is an error.  */
static const yytype_uint8 yydefact[] =
{
       8,    10,     0,     8,     3,     0,     9,    11,     1,     4,
       2,     0,     0,     5,     6,     8,     0,     0,     0,     8,
       0,     7,    66,     0,     0,     0,     0,     8,     8,     8,
      56,     0,     0,     0,     8,     0,     0,     0,     0,     0,
       0,     0,    54,     0,     8,    67,     0,     0,     0,     0,
       0,    12,     0,     8,     0,     0,     8,    44,    42,     0,
      47,    45,     8,     8,    39,    40,    41,     0,     0,    13,
       8,     0,    87,     0,     0,     0,     0,    68,     0,     0,
       0,     8,     0,    34,     0,     8,     0,     0,    63,     0,
       0,     0,   150,     0,     8,     0,    16,     0,     0,     0,
       0,    66,     0,     0,     0,   154,   150,     0,     0,   156,
     155,     0,     0,     0,     0,   157,     0,     0,     0,   153,
       0,     0,   214,   150,     0,   215,     0,     0,     0,   212,
      49,     0,     0,    14,     8,     0,    35,     0,     0,    65,
       0,     8,     0,   150,     0,     0,     0,    88,     0,     0,
       0,     0,   199,    82,     0,    17,    83,     0,     0,     0,
       0,     0,   172,     0,   171,   159,   190,     0,     0,     0,
       0,     0,   158,   163,   162,     0,     0,   197,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,   223,   150,   216,     0,    46,    51,    52,     0,
       0,     0,     0,     0,     0,    33,     8,    15,    83,     0,
       0,     0,     0,     0,    65,    57,     0,     0,     8,     0,
       8,   171,   205,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     8,    84,     0,     0,   123,    18,
      54,     0,     0,     8,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,   193,     0,   160,    43,   173,   174,
     175,   176,   177,   178,   169,   170,   166,   187,   185,   183,
     179,   184,   181,   164,   165,   161,   167,   168,     0,    50,
     217,     0,     0,   225,   220,   218,   219,   221,   222,    48,
       8,    31,     0,    36,     8,     0,     8,     8,     0,     0,
       8,    94,   151,     0,   200,   206,     0,   209,     0,   207,
       0,   201,   203,   202,   204,     0,    22,    55,     8,     0,
      19,    20,     8,     0,     0,     0,   189,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,   198,   213,     0,
       0,    29,     8,    37,     0,    60,     0,     8,     8,    22,
       0,     0,     0,     0,   210,   208,   211,     0,     0,    53,
      99,    12,   124,    55,     0,     0,     8,     0,   191,     0,
       0,     0,     0,     0,   194,     0,     0,   224,    32,     0,
       0,     0,     0,    58,     0,     0,     0,     0,     0,    25,
      26,    27,    28,     0,    23,   129,     0,     0,     0,     0,
       0,    59,     0,   192,   188,   186,   180,   182,     0,     0,
      38,     8,     0,     0,    23,     0,   152,    54,    54,    24,
       8,     0,     0,     0,    54,     0,    83,    54,    54,     8,
     195,   196,    61,     8,     0,     8,     0,     8,     8,    70,
       0,     0,   125,     0,     8,    21,     0,     8,     8,     0,
      64,     8,     0,     8,     0,   129,     0,     8,     0,     0,
     130,     0,     0,   102,     0,     8,    55,    55,    14,     0,
       0,    72,    95,     8,     0,     0,   135,   150,   139,     0,
       0,   137,     0,   131,   133,   136,     0,   150,   146,   148,
       8,   128,   126,     8,     0,     0,     0,     0,     0,     0,
       0,    22,     0,    79,     0,     0,    83,     0,     0,     0,
       0,   141,   138,     0,   143,     0,     0,     8,     0,     0,
       8,    55,     0,   100,     0,     8,     0,     0,   150,     0,
       0,     0,     0,     0,     0,     8,     0,     0,    83,    83,
      83,     0,    83,    71,    96,     0,   120,   122,    98,   118,
       0,     0,     0,     0,     0,   132,    55,     0,   147,     0,
     127,     0,   102,   110,     0,     0,     0,     0,     0,     8,
      54,     0,     8,    54,     0,   111,    22,     0,     0,     0,
       0,    30,     0,    97,   121,     0,     0,   150,   134,     0,
       0,     0,     8,   149,     0,     8,     0,     0,     0,     0,
      89,     0,     8,   150,   117,     8,     0,     0,     0,    55,
       8,     8,    66,   119,   142,   144,     0,     0,    73,     0,
     101,     0,    92,    93,     0,     0,    55,     0,     0,     0,
      55,     0,     0,     0,    23,     8,    81,    80,     8,   145,
     140,    54,    54,    90,     0,   112,    91,     0,     0,     0,
       0,     0,     0,    23,     8,    75,    62,     8,     8,     8,
       0,    54,     0,     0,     0,     0,     0,    54,    54,     8,
     104,     0,    55,     0,     0,     0,     0,     8,     0,    54,
      54,     8,     0,     8,     8,   103,     0,   112,     0,    54,
      54,     0,     0,    55,     0,     8,     8,   109,     8,    55,
      55,    55,     0,    54,    83,     8,     8,    54,   114,     8,
      55,    55,   108,     0,     0,     8,     0,     0,    55,    55,
       8,   105,   116,   117,     0,     0,    74,    55,     0,   112,
      55,   115,     0,     0,     8,     0,   113,     0,     8,     8,
      76,     0,     0,   107,   106,     8,     0,     0,     0,     0,
       0,    83,     0,     0,     0,    55,     0,     8,    83,    77,
       0,    55,     8,    78
};

/* YYPGOTO[NTERM-NUM].  */
static const yytype_int16 yypgoto[] =
{
    -516,  -516,  -516,   801,     0,   804,   435,   329,  -516,  -516,
    -124,  -218,  -349,  -417,  -516,  -516,   798,  -117,  -203,  -516,
     -59,  -126,  -516,   791,   -36,   113,  -516,  -516,   587,  -100,
      -1,   -92,  -213,  -516,  -516,  -515,  -516,   291,  -516,  -477,
    -432,    73,    80,   177,   222,   492,  -376,  -516,   353,  -506,
    -516,   258,  -516,  -516,   298,  -516,   -35,   594,  -516,  -516,
     561,   -89,  -516,  -104,  -516
};

/* YYDEFGOTO[NTERM-NUM].  */
static const yytype_int16 yydefgoto[] =
{
       0,     2,     3,     4,   572,     6,    70,   218,   156,   331,
     250,   436,   368,   430,    94,   403,    13,    35,    37,    67,
      62,   128,   214,    14,   687,   369,    33,   140,   223,    25,
      38,    73,   246,    74,    75,   540,   360,   463,   464,   371,
     474,   672,   639,   558,   559,   247,   404,   532,   432,   467,
     493,   494,   560,   562,   469,   498,   119,   150,   255,   177,
     178,   321,   152,   130,   291
};

/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule whose
   number is the opposite.  If YYTABLE_NINF, syntax error.  */
static const yytype_int16 yytable[] =
{
       5,   161,   153,    10,   151,   302,    53,   445,    85,   158,
     394,   221,    89,    18,   215,    18,   303,   100,   424,    23,
     229,   565,   204,   205,   577,     1,   533,    30,    31,    32,
      36,    86,     1,     1,    45,   289,   674,    95,   188,   522,
      52,   451,   290,     1,    55,   129,    98,   165,   239,   240,
     241,   242,    99,    72,    77,   144,    78,   -86,   501,   232,
     234,   595,    83,    84,   159,   239,   240,   241,   242,   523,
      88,   485,     8,   165,     1,   165,   581,   240,   241,   242,
      11,   131,   556,   557,   230,   136,   138,   198,   199,   146,
      -8,   129,   129,   482,    72,    12,   288,   146,   483,    11,
     576,   485,   129,   573,    16,   294,   295,   296,   297,   298,
     299,   129,   314,   585,   486,   487,    87,    17,   488,   489,
     490,   452,   248,   146,   121,   146,   637,   502,   630,    19,
      36,   555,   377,    44,   219,    81,   134,    20,    82,   135,
     314,   225,   209,   491,   486,   597,    24,   611,   488,   489,
     490,   322,   323,   324,   209,   684,   570,   -69,   556,   557,
      12,   681,   547,    90,   492,   129,    91,   122,   123,   165,
     -85,   701,   124,   491,   129,   129,   129,   129,   129,   129,
     636,   207,   208,   640,   522,   657,   420,   349,    26,   423,
     141,   212,   213,   142,   492,    27,   125,    92,     1,   529,
     210,   211,    22,   212,   213,   146,   121,   147,    93,   126,
     293,    28,   556,   557,   332,    29,   301,   127,   209,   146,
     362,   363,    34,   456,    57,    58,    59,   664,   311,    46,
     313,    47,   680,   388,   146,   396,   682,   617,   146,   391,
     373,   201,   644,   209,   326,   146,   679,   695,   292,   122,
     203,   670,   671,   335,   124,   703,   129,   503,    48,   707,
     504,   709,   710,    49,   210,   211,    50,   212,   213,    51,
      60,    54,   188,   720,   721,    56,   722,    63,   125,    68,
      61,   712,   713,   728,   729,   437,   438,   731,    69,   210,
     211,   126,   212,   213,   248,   390,   549,   550,   740,   127,
     350,    79,    71,   551,   353,    76,   355,   356,    80,    96,
     359,    64,    65,    66,   209,    97,   753,   754,   195,   196,
     197,   198,   199,   101,    39,   395,   129,    40,   370,   133,
      41,    42,    72,   132,   137,   588,   589,   590,   449,   592,
      43,   239,   240,   241,   242,   239,   240,   241,   242,    36,
     209,   139,   389,   462,   143,    36,   154,   392,   393,   155,
     210,   211,   471,   212,   213,   476,   477,   243,   157,   583,
     348,   481,   239,   240,   241,   242,   411,   160,   163,   180,
     166,   182,   167,   513,   185,   186,   187,   188,   168,   169,
     172,   447,   448,   170,   472,   171,   210,   211,   454,   212,
     213,   457,   458,   206,   580,   433,   387,   200,   399,   400,
     401,   402,   505,   581,   240,   241,   242,   541,   506,   543,
     202,   442,   507,   508,   509,   581,   240,   241,   242,   217,
      72,   495,   220,   195,   196,   197,   198,   199,   511,   459,
     222,   224,   143,   460,   510,    72,   226,   466,   468,   146,
     578,   244,   227,   245,   473,   251,   253,    72,    72,   652,
     252,   479,   261,    72,   186,   187,   188,   496,   239,   240,
     241,   242,   542,   265,   544,    72,   249,   306,   239,   240,
     241,   242,   266,   519,   305,   180,   408,   182,   310,   184,
     185,   186,   187,   188,   307,   700,   102,   312,   327,   325,
     531,   727,   328,   370,   581,   240,   241,   242,   103,   329,
     628,   330,   195,   196,   197,   198,   199,   631,   188,   148,
     343,   290,   648,   700,   175,   209,   495,   466,   646,   647,
     468,   354,   239,   240,   241,   242,   351,   511,   357,   195,
     196,   197,   198,   199,   612,   653,   361,   615,   763,   536,
     537,   105,   538,   665,   505,   770,   107,   108,   397,   109,
     606,   110,   367,   398,   507,   508,   509,   406,   418,   412,
     419,   421,   422,   425,   429,   426,   111,   112,   113,   114,
     115,   685,   614,   427,   143,   428,   510,   434,   435,   514,
     515,   439,   116,   117,   444,   443,   446,   702,   450,   453,
     455,   539,    72,   461,   180,   370,   182,   470,   475,   478,
     186,   187,   188,   500,   480,   667,   668,   512,   517,   518,
      72,    72,   521,   726,   520,   524,   525,   526,   527,   528,
     534,   530,   546,   736,   102,   535,   545,   548,   552,   553,
     564,   693,   694,   561,   569,    72,   103,   566,   666,   567,
     579,   574,   750,   705,   706,   575,   582,   148,   195,   196,
     197,   198,   199,   715,   716,   584,   586,   466,   587,   683,
     591,   593,   604,   120,   594,   769,   601,   607,   595,   602,
     773,   730,   608,   609,   627,   145,   610,   536,   537,   105,
     538,   618,   619,   620,   107,   108,   162,   109,   164,   110,
     621,   629,   634,   635,   638,   654,   656,   622,   673,   651,
     173,   174,   176,   632,   111,   112,   113,   114,   115,   633,
     650,   659,   669,   676,   675,    72,   216,   686,   688,   689,
     116,   117,   645,   690,   691,   692,   698,   699,   696,   539,
     704,   708,   231,   233,    72,   711,   714,   717,   719,   655,
     734,   735,   737,   660,   742,   757,   745,   254,   743,   748,
     749,   256,   257,   258,   259,   260,   752,    72,   751,   755,
     756,   758,    72,   267,   268,   269,   270,   271,   272,   273,
     274,   275,   276,   277,   278,   279,   280,   281,   282,   283,
     284,   285,   286,   287,   759,   697,   760,   761,   762,   766,
     768,   764,   765,   771,     9,     7,   407,   516,    15,    21,
     554,   308,   746,   741,   304,   658,   718,   623,   484,   598,
     309,   372,   723,   724,   725,     0,   347,     0,   568,   315,
     317,   319,   287,   732,   733,     0,     0,     0,     0,     0,
       0,   738,   739,   102,     0,   333,   334,     0,     0,   337,
     744,     0,     0,   747,     0,   103,   344,   345,     0,   346,
       0,     0,     0,     0,     0,     0,   104,     0,     0,     0,
       0,   175,     0,     0,     0,     0,     0,     0,   767,     0,
       0,     0,     0,     0,   772,     0,     0,     0,     0,     0,
     102,     0,     0,     0,     0,     0,     0,     0,   105,   106,
       0,     0,   103,   107,   108,     0,   109,     0,   110,     0,
     364,     0,   365,   148,   366,     0,     0,     0,   175,     0,
       0,     0,     0,   111,   112,   113,   114,   115,     0,     0,
       0,     0,   379,   380,   381,   382,   383,   384,     0,   116,
     117,     0,   102,     0,     0,   105,   106,     0,   118,     0,
     107,   108,     0,   109,   103,   110,     0,     0,     0,     0,
       0,     0,   405,     0,     0,   104,     0,     0,   409,   410,
     111,   112,   113,   114,   115,   180,   181,   182,   183,   184,
     185,   186,   187,   188,     0,     0,   116,   117,   405,     0,
       0,     0,     0,     0,   102,   149,     0,   105,   106,     0,
       0,     0,   107,   108,     0,   109,   103,   110,     0,     0,
       0,     0,   440,   441,     0,     0,     0,   104,     0,     0,
       0,     0,   111,   112,   113,   114,   115,   316,     0,   195,
     196,   197,   198,   199,     0,     0,     0,     0,   116,   117,
     465,     0,     0,     0,     0,     0,     0,   118,     0,   105,
     106,     0,     0,     0,   107,   108,     0,   109,     0,   110,
       0,     0,   499,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,   111,   112,   113,   114,   115,   318,
       0,     0,     0,   102,     0,     0,     0,     0,     0,     0,
     116,   117,     0,     0,     0,   103,     0,     0,     0,   118,
       0,     0,     0,     0,     0,     0,   104,     0,     0,     0,
       0,     0,     0,   465,     0,     0,     0,     0,     0,   563,
       0,     0,     0,     0,     0,     0,   405,     0,   571,     0,
       0,     0,     0,   233,     0,   102,     0,     0,   105,   106,
       0,     0,     0,   107,   108,     0,   109,   103,   110,     0,
       0,     0,     0,     0,   596,     0,   599,     0,   104,     0,
       0,   603,     0,   111,   112,   113,   114,   115,   320,     0,
       0,     0,     0,     0,     0,     0,     0,     0,   616,   116,
     117,     0,     0,     0,     0,     0,     0,   102,   118,     0,
     105,   106,     0,     0,   626,   107,   108,     0,   109,   103,
     110,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     148,   643,   405,     0,     0,   111,   112,   113,   114,   115,
       0,     0,     0,     0,     0,     0,   102,     0,     0,     0,
       0,   116,   117,     0,     0,   661,   662,     0,   103,     0,
     118,     0,   105,   106,     0,     0,     0,   107,   108,   104,
     109,     0,   110,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,   102,     0,   111,   112,   113,
     114,   115,     0,     0,     0,     0,     0,   103,     0,     0,
       0,   105,   497,   116,   117,     0,   107,   108,   148,   109,
       0,   110,   149,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,   111,   112,   113,   114,
     115,     1,     0,     0,     0,     0,     0,     0,     0,     0,
     105,   613,   116,   117,     0,   107,   108,     0,   109,     0,
     110,   118,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,   111,   112,   113,   114,   115,
       1,     0,   180,   181,   182,   183,   184,   185,   186,   187,
     188,   116,   117,     0,     0,     0,     0,     0,     0,     0,
     149,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,   189,   190,   191,   192,   193,   194,
       0,   180,   181,   182,   183,   184,   185,   186,   187,   188,
     262,   263,     0,     0,     0,     0,   195,   196,   197,   198,
     199,     0,     0,     0,   300,     0,     0,     0,     0,     0,
       0,     0,     0,   189,   190,   191,   192,   193,   194,   180,
     181,   182,   183,   184,   185,   186,   187,   188,     0,     0,
       0,     0,     0,     0,     0,   195,   196,   197,   198,   199,
       0,     0,     0,   352,     0,     0,     0,     0,     0,     0,
       0,   189,   190,   191,   192,   193,   194,   262,   263,     0,
       0,     0,   235,     0,     0,     0,     0,   236,   237,   374,
     375,     0,     0,   195,   196,   197,   198,   238,     0,     0,
       0,     0,     0,   264,     0,     0,   180,   181,   182,   183,
     184,   185,   186,   187,   188,     0,     0,     0,   180,   181,
     182,   183,   184,   185,   186,   187,   188,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,   189,   190,
     191,   192,   193,   194,     0,     0,     0,     0,   262,   263,
     189,   190,   191,   192,   193,   194,     0,   641,   642,     0,
     195,   196,   197,   198,   199,     0,     0,     0,     0,     0,
     264,     0,   195,   196,   197,   198,   199,   180,   181,   182,
     183,   184,   185,   186,   187,   188,   180,   181,   182,   183,
     184,   185,   186,   187,   188,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,   189,
     190,   191,   192,   193,   194,     0,     0,   179,   189,   190,
     191,   192,   193,   194,     0,     0,     0,     0,     0,     0,
       0,   195,   196,   197,   198,   199,     0,     0,     0,   228,
     195,   196,   197,   198,   199,   180,   181,   182,   183,   184,
     185,   186,   187,   188,   180,   181,   182,   183,   184,   185,
     186,   187,   188,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,   189,   190,   191,
     192,   193,   194,     0,     0,     0,   189,   190,   191,   192,
     193,   194,     0,     0,     0,     0,     0,     0,     0,   195,
     196,   197,   198,   199,     0,     0,     0,     0,   195,   196,
     197,   198,   199,   180,   181,   182,   183,   184,   185,   186,
     187,   188,     0,     0,     0,     0,     0,   180,   181,   182,
     183,   184,   185,   186,   187,   188,     0,     0,     0,     0,
       0,     0,     0,     0,     0,   189,   190,   191,   192,   193,
     194,     0,     0,     0,     0,     0,     0,     0,     0,   189,
     190,   191,   192,   193,   194,     0,     0,   195,   196,   197,
     198,   199,     0,     0,     0,     0,     0,     0,     0,     0,
     338,   195,   196,   197,   198,   199,     0,     0,     0,     0,
       0,     0,     0,     0,   339,   180,   181,   182,   183,   184,
     185,   186,   187,   188,     0,     0,     0,     0,     0,   180,
     181,   182,   183,   184,   185,   186,   187,   188,     0,     0,
       0,     0,     0,     0,     0,     0,     0,   189,   190,   191,
     192,   193,   194,     0,     0,     0,     0,     0,     0,     0,
       0,   189,   190,   191,   192,   193,   194,     0,     0,   195,
     196,   197,   198,   199,     0,     0,     0,     0,     0,     0,
       0,     0,   340,   195,   196,   197,   198,   199,     0,     0,
       0,     0,     0,     0,     0,     0,   341,   180,   181,   182,
     183,   184,   185,   186,   187,   188,     0,     0,     0,     0,
       0,   180,   181,   182,   183,   184,   185,   186,   187,   188,
       0,     0,     0,     0,     0,     0,     0,     0,     0,   189,
     190,   191,   192,   193,   194,     0,     0,     0,     0,     0,
       0,     0,     0,   189,   190,   191,   192,   193,   194,     0,
       0,   195,   196,   197,   198,   199,     0,     0,     0,     0,
       0,     0,     0,     0,   342,   195,   196,   197,   198,   199,
       0,     0,     0,     0,     0,     0,     0,     0,   600,   180,
     181,   182,   183,   184,   185,   186,   187,   188,     0,     0,
     180,   181,   182,   183,   184,   185,   186,   187,   188,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,   189,   190,   191,   192,   193,   194,     0,     0,     0,
       0,     0,   189,   190,   191,   192,   193,   194,     0,     0,
       0,     0,     0,   195,   196,   197,   198,   199,     0,     0,
       0,     0,     0,   336,   195,   196,   197,   198,   199,     0,
       0,     0,     0,     0,   378,   180,   181,   182,   183,   184,
     185,   186,   187,   188,     0,     0,   180,   181,   182,   183,
     184,   185,   186,   187,   188,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,   189,   190,   191,
     192,   193,   194,     0,     0,     0,     0,     0,   189,   190,
     191,   192,   193,   194,     0,     0,     0,     0,     0,   195,
     196,   197,   198,   199,     0,     0,     0,     0,     0,   413,
     195,   196,   197,   198,   199,     0,     0,     0,     0,     0,
     414,   180,   181,   182,   183,   184,   185,   186,   187,   188,
       0,     0,   180,   181,   182,   183,   184,   185,   186,   187,
     188,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,   189,   190,   191,   192,   193,   194,     0,
       0,     0,     0,     0,   189,   190,   191,   192,   193,   194,
       0,     0,     0,     0,     0,   195,   196,   197,   198,   199,
       0,     0,     0,     0,     0,   415,   195,   196,   197,   198,
     199,     0,     0,     0,     0,     0,   416,   180,   181,   182,
     183,   184,   185,   186,   187,   188,     0,     0,   180,   181,
     182,   183,   184,   185,   186,   187,   188,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,   189,
     190,   191,   192,   193,   194,     0,     0,     0,     0,     0,
     189,   190,   191,   192,   193,   194,     0,     0,     0,     0,
       0,   195,   196,   197,   198,   199,     0,     0,     0,     0,
       0,   417,   195,   196,   197,   198,   199,     0,     0,     0,
       0,     0,   624,   180,   181,   182,   183,   184,   185,   186,
     187,   188,     0,     0,   180,   181,   182,   183,   184,   185,
     186,   187,   188,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,   189,   190,   191,   192,   193,
     194,     0,     0,     0,     0,     0,   189,   190,   191,   192,
     193,   194,     0,     0,     0,     0,     0,   195,   196,   197,
     198,   199,     0,     0,     0,     0,     0,   625,   195,   196,
     197,   198,   199,     0,     0,     0,     0,     0,   649,   180,
     181,   182,   183,   184,   185,   186,   187,   188,   180,   181,
     182,   183,   184,   185,   186,   187,   188,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,   189,   190,   191,   192,   193,   194,     0,     0,     0,
     189,   190,   191,   192,   193,   194,     0,     0,     0,     0,
       0,     0,     0,   195,   196,   197,   198,   199,     0,     0,
       0,   358,   195,   196,   197,   198,   199,     0,     0,     0,
     376,   180,   181,   182,   183,   184,   185,   186,   187,   188,
     180,   181,   182,   183,   184,   185,   186,   187,   188,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,   189,   190,   191,   192,   193,   194,     0,
       0,     0,   189,   190,   191,   192,   193,   194,     0,     0,
       0,     0,     0,     0,     0,   195,   196,   197,   198,   199,
       0,     0,     0,   605,   195,   196,   197,   198,   199,     0,
     677,     0,   663,   180,   181,   182,   183,   184,   185,   186,
     187,   188,   678,     0,     0,   180,   181,   182,   183,   184,
     185,   186,   187,   188,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,   189,   190,   191,   192,   193,
     194,     0,     0,     0,     0,     0,     0,   189,   190,   191,
     192,   193,   194,     0,     0,     0,     0,   195,   196,   197,
     198,   199,     0,     0,     0,     0,     0,     0,     0,   195,
     196,   197,   198,   199,   249,     0,   180,   181,   182,   183,
     184,   185,   186,   187,   188,   431,   180,   181,   182,   183,
     184,   185,   186,   187,   188,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,   189,   190,
     191,   192,   193,   194,     0,     0,     0,     0,   189,   190,
     191,   192,   193,   194,     0,     0,     0,     0,     0,     0,
     195,   196,   197,   198,   199,     0,     0,     0,     0,     0,
     195,   196,   197,   198,   199,   180,   181,   182,   183,   184,
     185,   186,   187,   188,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,   189,   190,   191,
     192,   193,   194,     0,     0,     0,     0,     0,   235,     0,
       0,     0,     0,   236,   237,     0,     0,     0,     0,   195,
     196,   197,   198,   238,   180,   181,   182,   183,   184,   185,
     186,   187,   188,     0,     0,     0,     0,     0,     0,     0,
     180,   181,   182,   183,   184,   185,   186,   187,   188,     0,
       0,     0,     0,     0,     0,     0,   189,   190,   191,   192,
     193,   194,     0,     0,     0,     0,     0,   385,     0,     0,
       0,     0,   189,   190,   191,   192,   193,   194,   195,   196,
     197,   198,   199,   386,   180,   181,   182,   183,   184,   185,
     186,   187,   188,     0,   195,   196,   197,   198,   199,   184,
     185,   186,   187,   188,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,   189,   190,   191,   192,
     193,   194,     0,     0,     0,     0,     0,   189,   190,   191,
     192,   193,   194,     0,     0,     0,     0,     0,   195,   196,
     197,   198,   199,     0,     0,     0,     0,     0,     0,   195,
     196,   197,   198,   199
};

static const yytype_int16 yycheck[] =
{
       0,   101,    94,     3,    93,   218,    42,   424,    67,    98,
     359,   137,    71,    13,   131,    15,   219,    76,   394,    19,
     146,   527,   126,   127,   539,     4,   503,    27,    28,    29,
      31,    23,     4,     4,    34,    60,    88,    72,    53,    58,
      41,    27,    67,     4,    44,    80,    35,    58,    45,    46,
      47,    48,    41,    53,    55,    90,    56,    32,    38,   148,
     149,   113,    62,    63,    99,    45,    46,    47,    48,    88,
      70,    15,     0,    58,     4,    58,    45,    46,    47,    48,
       5,    81,    58,    59,    59,    85,    87,   102,   103,   108,
      20,   126,   127,   107,    94,    20,   200,   108,   112,     5,
     111,    15,   137,   535,    59,   209,   210,   211,   212,   213,
     214,   146,   109,   545,    58,    59,   108,    59,    62,    63,
      64,   107,   157,   108,    15,   108,   111,   107,   605,     6,
     131,    31,   335,   112,   134,   107,   107,    22,   110,   110,
     109,   141,    53,    87,    58,    59,    59,   579,    62,    63,
      64,   240,   241,   242,    53,   670,   532,    19,    58,    59,
      20,   667,   511,    25,   108,   200,    28,    58,    59,    58,
      32,   686,    63,    87,   209,   210,   211,   212,   213,   214,
     612,    16,    17,   615,    58,    31,   389,   291,     7,   392,
     107,   102,   103,   110,   108,     6,    87,    59,     4,    88,
      99,   100,     8,   102,   103,   108,    15,   110,    70,   100,
     109,   108,    58,    59,   250,   108,   216,   108,    53,   108,
       7,     8,    59,   436,    13,    14,    15,   644,   228,   109,
     230,   110,   664,   350,   108,   361,   668,   586,   108,   356,
     332,   111,   618,    53,   244,   108,   663,   679,   111,    58,
      59,    37,    38,   253,    63,   687,   291,   107,   109,   691,
     110,   693,   694,   110,    99,   100,    59,   102,   103,    59,
      59,    59,    53,   705,   706,   107,   708,   107,    87,     6,
      69,    37,    38,   715,   716,   409,   410,   719,     6,    99,
     100,   100,   102,   103,   329,   354,   514,   515,   730,   108,
     300,    60,   110,   516,   304,   110,   306,   307,   108,    19,
     310,     9,    10,    11,    53,    32,   748,   749,    99,   100,
     101,   102,   103,     7,    18,   360,   361,    21,   328,    19,
      24,    25,   332,    88,   108,   548,   549,   550,   430,   552,
      34,    45,    46,    47,    48,    45,    46,    47,    48,   350,
      53,     8,   352,   445,    59,   356,    93,   357,   358,    20,
      99,   100,   451,   102,   103,   457,   458,    71,   108,    42,
     109,   463,    45,    46,    47,    48,   376,   110,   108,    45,
     108,    47,   108,   475,    50,    51,    52,    53,   108,   108,
      65,   427,   428,   108,   453,   108,    99,   100,   434,   102,
     103,   437,   438,   109,    36,   406,   109,   108,    73,    74,
      75,    76,    29,    45,    46,    47,    48,   506,    35,   508,
     108,   421,    39,    40,    41,    45,    46,    47,    48,     5,
     430,   466,    88,    99,   100,   101,   102,   103,   473,   439,
     109,     7,    59,   443,    61,   445,    88,   447,   448,   108,
     539,    88,    93,    59,   454,     9,   108,   457,   458,    36,
      88,   461,    88,   463,    51,    52,    53,   467,    45,    46,
      47,    48,   507,   112,   509,   475,    43,   107,    45,    46,
      47,    48,   109,   483,   109,    45,   373,    47,    88,    49,
      50,    51,    52,    53,   108,    36,     3,   109,   107,    58,
     500,   714,   109,   503,    45,    46,    47,    48,    15,   112,
     602,    25,    99,   100,   101,   102,   103,   606,    53,    26,
      94,    67,   622,    36,    31,    53,   561,   527,   620,   621,
     530,    22,    45,    46,    47,    48,   107,   572,   108,    99,
     100,   101,   102,   103,   580,   634,   108,   583,   761,    56,
      57,    58,    59,   645,    29,   768,    63,    64,    12,    66,
      35,    68,    72,    12,    39,    40,    41,    33,    94,   109,
      94,   107,   109,    93,   107,   109,    83,    84,    85,    86,
      87,   670,   582,   108,    59,   108,    61,    25,    19,   476,
     477,   107,    99,   100,   109,   107,    88,   686,    87,   110,
      43,   108,   602,   107,    45,   605,    47,    59,   107,    19,
      51,    52,    53,   109,    19,   651,   652,    19,    19,    59,
     620,   621,   108,   712,    27,   108,   108,    31,   112,   109,
      88,   112,   110,   725,     3,   107,   107,    32,    21,   107,
      88,   677,   678,    94,   531,   645,    15,   107,   648,    94,
      36,   108,   744,   689,   690,   108,     6,    26,    99,   100,
     101,   102,   103,   699,   700,     9,    88,   667,    93,   669,
     107,   107,     7,    79,    58,   767,    94,    59,   113,   566,
     772,   717,    59,    55,    58,    91,   109,    56,    57,    58,
      59,    88,   107,   107,    63,    64,   102,    66,   104,    68,
     107,    12,    45,    19,    27,    35,    55,   107,    88,   108,
     116,   117,   118,   109,    83,    84,    85,    86,    87,   109,
     109,    19,   107,    19,    39,   725,   132,    35,    19,    94,
      99,   100,   619,    94,   107,    42,    19,    36,   109,   108,
      35,   107,   148,   149,   744,   107,    32,    36,   107,   636,
      19,    19,   107,   640,    42,   755,    19,   163,    42,   107,
     107,   167,   168,   169,   170,   171,    19,   767,    35,   107,
      35,   107,   772,   179,   180,   181,   182,   183,   184,   185,
     186,   187,   188,   189,   190,   191,   192,   193,   194,   195,
     196,   197,   198,   199,    19,   682,    19,    32,    35,    19,
      32,   107,   107,   107,     3,     1,   371,   478,    10,    18,
     519,   224,   739,   733,   220,   638,   703,   595,   465,   561,
     226,   329,   709,   710,   711,    -1,   265,    -1,   530,   235,
     236,   237,   238,   720,   721,    -1,    -1,    -1,    -1,    -1,
      -1,   728,   729,     3,    -1,   251,   252,    -1,    -1,   255,
     737,    -1,    -1,   740,    -1,    15,   262,   263,    -1,   265,
      -1,    -1,    -1,    -1,    -1,    -1,    26,    -1,    -1,    -1,
      -1,    31,    -1,    -1,    -1,    -1,    -1,    -1,   765,    -1,
      -1,    -1,    -1,    -1,   771,    -1,    -1,    -1,    -1,    -1,
       3,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    58,    59,
      -1,    -1,    15,    63,    64,    -1,    66,    -1,    68,    -1,
     316,    -1,   318,    26,   320,    -1,    -1,    -1,    31,    -1,
      -1,    -1,    -1,    83,    84,    85,    86,    87,    -1,    -1,
      -1,    -1,   338,   339,   340,   341,   342,   343,    -1,    99,
     100,    -1,     3,    -1,    -1,    58,    59,    -1,   108,    -1,
      63,    64,    -1,    66,    15,    68,    -1,    -1,    -1,    -1,
      -1,    -1,   368,    -1,    -1,    26,    -1,    -1,   374,   375,
      83,    84,    85,    86,    87,    45,    46,    47,    48,    49,
      50,    51,    52,    53,    -1,    -1,    99,   100,   394,    -1,
      -1,    -1,    -1,    -1,     3,   108,    -1,    58,    59,    -1,
      -1,    -1,    63,    64,    -1,    66,    15,    68,    -1,    -1,
      -1,    -1,   418,   419,    -1,    -1,    -1,    26,    -1,    -1,
      -1,    -1,    83,    84,    85,    86,    87,    88,    -1,    99,
     100,   101,   102,   103,    -1,    -1,    -1,    -1,    99,   100,
     446,    -1,    -1,    -1,    -1,    -1,    -1,   108,    -1,    58,
      59,    -1,    -1,    -1,    63,    64,    -1,    66,    -1,    68,
      -1,    -1,   468,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    83,    84,    85,    86,    87,    88,
      -1,    -1,    -1,     3,    -1,    -1,    -1,    -1,    -1,    -1,
      99,   100,    -1,    -1,    -1,    15,    -1,    -1,    -1,   108,
      -1,    -1,    -1,    -1,    -1,    -1,    26,    -1,    -1,    -1,
      -1,    -1,    -1,   519,    -1,    -1,    -1,    -1,    -1,   525,
      -1,    -1,    -1,    -1,    -1,    -1,   532,    -1,   534,    -1,
      -1,    -1,    -1,   539,    -1,     3,    -1,    -1,    58,    59,
      -1,    -1,    -1,    63,    64,    -1,    66,    15,    68,    -1,
      -1,    -1,    -1,    -1,   560,    -1,   562,    -1,    26,    -1,
      -1,   567,    -1,    83,    84,    85,    86,    87,    88,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   584,    99,
     100,    -1,    -1,    -1,    -1,    -1,    -1,     3,   108,    -1,
      58,    59,    -1,    -1,   600,    63,    64,    -1,    66,    15,
      68,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      26,   617,   618,    -1,    -1,    83,    84,    85,    86,    87,
      -1,    -1,    -1,    -1,    -1,    -1,     3,    -1,    -1,    -1,
      -1,    99,   100,    -1,    -1,   641,   642,    -1,    15,    -1,
     108,    -1,    58,    59,    -1,    -1,    -1,    63,    64,    26,
      66,    -1,    68,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,     3,    -1,    83,    84,    85,
      86,    87,    -1,    -1,    -1,    -1,    -1,    15,    -1,    -1,
      -1,    58,    59,    99,   100,    -1,    63,    64,    26,    66,
      -1,    68,   108,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    83,    84,    85,    86,
      87,     4,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      58,    59,    99,   100,    -1,    63,    64,    -1,    66,    -1,
      68,   108,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    83,    84,    85,    86,    87,
       4,    -1,    45,    46,    47,    48,    49,    50,    51,    52,
      53,    99,   100,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     108,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    77,    78,    79,    80,    81,    82,
      -1,    45,    46,    47,    48,    49,    50,    51,    52,    53,
      16,    17,    -1,    -1,    -1,    -1,    99,   100,   101,   102,
     103,    -1,    -1,    -1,   107,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    77,    78,    79,    80,    81,    82,    45,
      46,    47,    48,    49,    50,    51,    52,    53,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    99,   100,   101,   102,   103,
      -1,    -1,    -1,   107,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    77,    78,    79,    80,    81,    82,    16,    17,    -1,
      -1,    -1,    88,    -1,    -1,    -1,    -1,    93,    94,    16,
      17,    -1,    -1,    99,   100,   101,   102,   103,    -1,    -1,
      -1,    -1,    -1,   109,    -1,    -1,    45,    46,    47,    48,
      49,    50,    51,    52,    53,    -1,    -1,    -1,    45,    46,
      47,    48,    49,    50,    51,    52,    53,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,    78,
      79,    80,    81,    82,    -1,    -1,    -1,    -1,    16,    17,
      77,    78,    79,    80,    81,    82,    -1,    16,    17,    -1,
      99,   100,   101,   102,   103,    -1,    -1,    -1,    -1,    -1,
     109,    -1,    99,   100,   101,   102,   103,    45,    46,    47,
      48,    49,    50,    51,    52,    53,    45,    46,    47,    48,
      49,    50,    51,    52,    53,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,
      78,    79,    80,    81,    82,    -1,    -1,    17,    77,    78,
      79,    80,    81,    82,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    99,   100,   101,   102,   103,    -1,    -1,    -1,    30,
      99,   100,   101,   102,   103,    45,    46,    47,    48,    49,
      50,    51,    52,    53,    45,    46,    47,    48,    49,    50,
      51,    52,    53,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,    78,    79,
      80,    81,    82,    -1,    -1,    -1,    77,    78,    79,    80,
      81,    82,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    99,
     100,   101,   102,   103,    -1,    -1,    -1,    -1,    99,   100,
     101,   102,   103,    45,    46,    47,    48,    49,    50,    51,
      52,    53,    -1,    -1,    -1,    -1,    -1,    45,    46,    47,
      48,    49,    50,    51,    52,    53,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    77,    78,    79,    80,    81,
      82,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,
      78,    79,    80,    81,    82,    -1,    -1,    99,   100,   101,
     102,   103,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     112,    99,   100,   101,   102,   103,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,   112,    45,    46,    47,    48,    49,
      50,    51,    52,    53,    -1,    -1,    -1,    -1,    -1,    45,
      46,    47,    48,    49,    50,    51,    52,    53,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,    78,    79,
      80,    81,    82,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    77,    78,    79,    80,    81,    82,    -1,    -1,    99,
     100,   101,   102,   103,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,   112,    99,   100,   101,   102,   103,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,   112,    45,    46,    47,
      48,    49,    50,    51,    52,    53,    -1,    -1,    -1,    -1,
      -1,    45,    46,    47,    48,    49,    50,    51,    52,    53,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,
      78,    79,    80,    81,    82,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    77,    78,    79,    80,    81,    82,    -1,
      -1,    99,   100,   101,   102,   103,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,   112,    99,   100,   101,   102,   103,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   112,    45,
      46,    47,    48,    49,    50,    51,    52,    53,    -1,    -1,
      45,    46,    47,    48,    49,    50,    51,    52,    53,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    77,    78,    79,    80,    81,    82,    -1,    -1,    -1,
      -1,    -1,    77,    78,    79,    80,    81,    82,    -1,    -1,
      -1,    -1,    -1,    99,   100,   101,   102,   103,    -1,    -1,
      -1,    -1,    -1,   109,    99,   100,   101,   102,   103,    -1,
      -1,    -1,    -1,    -1,   109,    45,    46,    47,    48,    49,
      50,    51,    52,    53,    -1,    -1,    45,    46,    47,    48,
      49,    50,    51,    52,    53,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,    78,    79,
      80,    81,    82,    -1,    -1,    -1,    -1,    -1,    77,    78,
      79,    80,    81,    82,    -1,    -1,    -1,    -1,    -1,    99,
     100,   101,   102,   103,    -1,    -1,    -1,    -1,    -1,   109,
      99,   100,   101,   102,   103,    -1,    -1,    -1,    -1,    -1,
     109,    45,    46,    47,    48,    49,    50,    51,    52,    53,
      -1,    -1,    45,    46,    47,    48,    49,    50,    51,    52,
      53,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    77,    78,    79,    80,    81,    82,    -1,
      -1,    -1,    -1,    -1,    77,    78,    79,    80,    81,    82,
      -1,    -1,    -1,    -1,    -1,    99,   100,   101,   102,   103,
      -1,    -1,    -1,    -1,    -1,   109,    99,   100,   101,   102,
     103,    -1,    -1,    -1,    -1,    -1,   109,    45,    46,    47,
      48,    49,    50,    51,    52,    53,    -1,    -1,    45,    46,
      47,    48,    49,    50,    51,    52,    53,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,
      78,    79,    80,    81,    82,    -1,    -1,    -1,    -1,    -1,
      77,    78,    79,    80,    81,    82,    -1,    -1,    -1,    -1,
      -1,    99,   100,   101,   102,   103,    -1,    -1,    -1,    -1,
      -1,   109,    99,   100,   101,   102,   103,    -1,    -1,    -1,
      -1,    -1,   109,    45,    46,    47,    48,    49,    50,    51,
      52,    53,    -1,    -1,    45,    46,    47,    48,    49,    50,
      51,    52,    53,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    77,    78,    79,    80,    81,
      82,    -1,    -1,    -1,    -1,    -1,    77,    78,    79,    80,
      81,    82,    -1,    -1,    -1,    -1,    -1,    99,   100,   101,
     102,   103,    -1,    -1,    -1,    -1,    -1,   109,    99,   100,
     101,   102,   103,    -1,    -1,    -1,    -1,    -1,   109,    45,
      46,    47,    48,    49,    50,    51,    52,    53,    45,    46,
      47,    48,    49,    50,    51,    52,    53,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    77,    78,    79,    80,    81,    82,    -1,    -1,    -1,
      77,    78,    79,    80,    81,    82,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    99,   100,   101,   102,   103,    -1,    -1,
      -1,   107,    99,   100,   101,   102,   103,    -1,    -1,    -1,
     107,    45,    46,    47,    48,    49,    50,    51,    52,    53,
      45,    46,    47,    48,    49,    50,    51,    52,    53,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    77,    78,    79,    80,    81,    82,    -1,
      -1,    -1,    77,    78,    79,    80,    81,    82,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    99,   100,   101,   102,   103,
      -1,    -1,    -1,   107,    99,   100,   101,   102,   103,    -1,
      42,    -1,   107,    45,    46,    47,    48,    49,    50,    51,
      52,    53,    42,    -1,    -1,    45,    46,    47,    48,    49,
      50,    51,    52,    53,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    77,    78,    79,    80,    81,
      82,    -1,    -1,    -1,    -1,    -1,    -1,    77,    78,    79,
      80,    81,    82,    -1,    -1,    -1,    -1,    99,   100,   101,
     102,   103,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    99,
     100,   101,   102,   103,    43,    -1,    45,    46,    47,    48,
      49,    50,    51,    52,    53,    44,    45,    46,    47,    48,
      49,    50,    51,    52,    53,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,    78,
      79,    80,    81,    82,    -1,    -1,    -1,    -1,    77,    78,
      79,    80,    81,    82,    -1,    -1,    -1,    -1,    -1,    -1,
      99,   100,   101,   102,   103,    -1,    -1,    -1,    -1,    -1,
      99,   100,   101,   102,   103,    45,    46,    47,    48,    49,
      50,    51,    52,    53,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    77,    78,    79,
      80,    81,    82,    -1,    -1,    -1,    -1,    -1,    88,    -1,
      -1,    -1,    -1,    93,    94,    -1,    -1,    -1,    -1,    99,
     100,   101,   102,   103,    45,    46,    47,    48,    49,    50,
      51,    52,    53,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      45,    46,    47,    48,    49,    50,    51,    52,    53,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    77,    78,    79,    80,
      81,    82,    -1,    -1,    -1,    -1,    -1,    88,    -1,    -1,
      -1,    -1,    77,    78,    79,    80,    81,    82,    99,   100,
     101,   102,   103,    88,    45,    46,    47,    48,    49,    50,
      51,    52,    53,    -1,    99,   100,   101,   102,   103,    49,
      50,    51,    52,    53,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    77,    78,    79,    80,
      81,    82,    -1,    -1,    -1,    -1,    -1,    77,    78,    79,
      80,    81,    82,    -1,    -1,    -1,    -1,    -1,    99,   100,
     101,   102,   103,    -1,    -1,    -1,    -1,    -1,    -1,    99,
     100,   101,   102,   103
};

/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
   state STATE-NUM.  */
static const yytype_uint8 yystos[] =
{
       0,     4,   115,   116,   117,   118,   119,   119,     0,   117,
     118,     5,    20,   130,   137,   130,    59,    59,   118,     6,
      22,   137,     8,   118,    59,   143,     7,     6,   108,   108,
     118,   118,   118,   140,    59,   131,   144,   132,   144,    18,
      21,    24,    25,    34,   112,   118,   109,   110,   109,   110,
      59,    59,   144,   138,    59,   118,   107,    13,    14,    15,
      59,    69,   134,   107,     9,    10,    11,   133,     6,     6,
     120,   110,   118,   145,   147,   148,   110,   144,   118,    60,
     108,   107,   110,   118,   118,   134,    23,   108,   118,   134,
      25,    28,    59,    70,   128,   170,    19,    32,    35,    41,
     134,     7,     3,    15,    26,    58,    59,    63,    64,    66,
      68,    83,    84,    85,    86,    87,    99,   100,   108,   170,
     171,    15,    58,    59,    63,    87,   100,   108,   135,   170,
     177,   118,    88,    19,   107,   110,   118,   108,   144,     8,
     141,   107,   110,    59,   170,   171,   108,   110,    26,   108,
     171,   175,   176,   145,    93,    20,   122,   108,   175,   170,
     110,   143,   171,   108,   171,    58,   108,   108,   108,   108,
     108,   108,    65,   171,   171,    31,   171,   173,   174,    17,
      45,    46,    47,    48,    49,    50,    51,    52,    53,    77,
      78,    79,    80,    81,    82,    99,   100,   101,   102,   103,
     108,   111,   108,    59,   177,   177,   109,    16,    17,    53,
      99,   100,   102,   103,   136,   131,   171,     5,   121,   118,
      88,   135,   109,   142,     7,   118,    88,    93,    30,   135,
      59,   171,   175,   171,   175,    88,    93,    94,   103,    45,
      46,    47,    48,    71,    88,    59,   146,   159,   170,    43,
     124,     9,    88,   108,   171,   172,   171,   171,   171,   171,
     171,    88,    16,    17,   109,   112,   109,   171,   171,   171,
     171,   171,   171,   171,   171,   171,   171,   171,   171,   171,
     171,   171,   171,   171,   171,   171,   171,   171,   177,    60,
      67,   178,   111,   109,   177,   177,   177,   177,   177,   177,
     107,   118,   146,   132,   171,   109,   107,   108,   142,   171,
      88,   118,   109,   118,   109,   171,    88,   171,    88,   171,
      88,   175,   175,   175,   175,    58,   118,   107,   109,   112,
      25,   123,   138,   171,   171,   118,   109,   171,   112,   112,
     112,   112,   112,    94,   171,   171,   171,   174,   109,   177,
     118,   107,   107,   118,    22,   118,   118,   108,   107,   118,
     150,   108,     7,     8,   171,   171,   171,    72,   126,   139,
     118,   153,   159,   145,    16,    17,   107,   132,   109,   171,
     171,   171,   171,   171,   171,    88,    88,   109,   131,   118,
     134,   131,   118,   118,   126,   170,   135,    12,    12,    73,
      74,    75,    76,   129,   160,   171,    33,   120,   139,   171,
     171,   118,   109,   109,   109,   109,   109,   109,    94,    94,
     132,   107,   109,   132,   160,    93,   109,   108,   108,   107,
     127,    44,   162,   144,    25,    19,   125,   124,   124,   107,
     171,   171,   118,   107,   109,   127,    88,   138,   138,   145,
      87,    27,   107,   110,   138,    43,   146,   138,   138,   118,
     118,   107,   145,   151,   152,   171,   118,   163,   118,   168,
      59,   175,   134,   118,   154,   107,   145,   145,    19,   118,
      19,   145,   107,   112,   162,    15,    58,    59,    62,    63,
      64,    87,   108,   164,   165,   170,   118,    59,   169,   171,
     109,    38,   107,   107,   110,    29,    35,    39,    40,    41,
      61,   170,    19,   145,   139,   139,   121,    19,    59,   118,
      27,   108,    58,    88,   108,   108,    31,   112,   109,    88,
     112,   118,   161,   153,    88,   107,    56,    57,    59,   108,
     149,   175,   170,   175,   170,   107,   110,   126,    32,   125,
     125,   146,    21,   107,   151,    31,    58,    59,   157,   158,
     166,    94,   167,   171,    88,   163,   107,    94,   168,   139,
     160,   171,   118,   154,   108,   108,   111,   149,   175,    36,
      36,    45,     6,    42,     9,   154,    88,    93,   146,   146,
     146,   107,   146,   107,    58,   113,   171,    59,   165,   171,
     112,    94,   139,   171,     7,   107,    35,    59,    59,    55,
     109,   154,   138,    59,   118,   138,   171,   126,    88,   107,
     107,   107,   107,   158,   109,   109,   171,    58,   145,    12,
     153,   175,   109,   109,    45,    19,   154,   111,    27,   156,
     154,    16,    17,   171,   160,   139,   145,   145,   143,   109,
     109,   108,    36,   175,    35,   139,    55,    31,   157,    19,
     139,   171,   171,   107,   127,   145,   118,   138,   138,   107,
      37,    38,   155,    88,    88,    39,    19,    42,    42,   127,
     154,   163,   154,   118,   149,   175,    35,   138,    19,    94,
      94,   107,    42,   138,   138,   154,   109,   139,    19,    36,
      36,   149,   175,   154,    35,   138,   138,   154,   107,   154,
     154,   107,    37,    38,    32,   138,   138,    36,   139,   107,
     154,   154,   154,   139,   139,   139,   175,   146,   154,   154,
     138,   154,   139,   139,    19,    19,   145,   107,   139,   139,
     154,   156,    42,    42,   139,    19,   155,   139,   107,   107,
     145,    35,    19,   154,   154,   107,    35,   118,   107,    19,
      19,    32,    35,   146,   107,   107,    19,   139,    32,   145,
     146,   107,   139,   145
};

/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
static const yytype_uint8 yyr1[] =
{
       0,   114,   115,   116,   116,   116,   116,   117,   118,   118,
     119,   119,   120,   120,   121,   121,   122,   122,   123,   123,
     124,   125,   126,   127,   128,   129,   129,   129,   129,   130,
     130,   131,   131,   131,   131,   132,   132,   132,   132,   133,
     133,   133,   134,   134,   134,   134,   134,   134,   135,   135,
     135,   136,   136,   137,   138,   139,   140,   140,   140,   140,
     140,   140,   140,   141,   141,   142,   143,   144,   144,   145,
     145,   145,   145,   145,   145,   145,   145,   145,   145,   145,
     145,   145,   145,   146,   146,   147,   147,   148,   148,   149,
     149,   149,   149,   149,   150,   151,   151,   151,   152,   153,
     153,   153,   154,   154,   154,   154,   154,   154,   154,   154,
     154,   154,   155,   155,   155,   156,   156,   156,   157,   157,
     158,   158,   158,   159,   159,   160,   160,   160,   161,   162,
     162,   163,   163,   164,   164,   165,   165,   165,   165,   165,
     165,   166,   165,   167,   165,   165,   168,   168,   168,   169,
     170,   170,   170,   171,   171,   171,   171,   171,   171,   171,
     171,   171,   171,   171,   171,   171,   171,   171,   171,   171,
     171,   171,   171,   171,   171,   171,   171,   171,   171,   171,
     171,   171,   171,   171,   171,   171,   171,   171,   171,   171,
     172,   171,   171,   171,   173,   173,   173,   174,   174,   175,
     175,   175,   175,   175,   175,   175,   176,   176,   176,   176,
     176,   176,   177,   177,   177,   177,   177,   177,   177,   177,
     177,   177,   177,   178,   177,   177
};

/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
static const yytype_int8 yyr2[] =
{
       0,     2,     2,     1,     2,     2,     2,     4,     0,     1,
       1,     2,     0,     1,     0,     1,     0,     1,     0,     1,
       2,     2,     0,     0,     7,     1,     1,     1,     1,    15,
      23,     7,     9,     6,     4,     5,     7,     8,    10,     1,
       1,     1,     1,     5,     1,     1,     4,     1,     3,     1,
       3,     1,     1,    15,     0,     0,     0,     7,    10,    10,
       9,    12,    20,     0,     8,     0,     0,     2,     4,     1,
       9,    13,    11,    15,    22,    16,    24,    32,    35,    11,
      15,    15,     3,     0,     1,     1,     3,     1,     3,     3,
       5,     5,     4,     4,     0,     2,     4,     5,     4,     1,
       7,    10,     1,     9,     8,    12,    15,    15,    11,    10,
       4,     4,     0,     7,     4,     8,     7,     0,     1,     3,
       1,     2,     1,     1,     3,     3,     5,     7,     0,     0,
       3,     2,     4,     1,     4,     1,     1,     1,     2,     1,
       6,     0,     5,     0,     5,     6,     2,     4,     2,     4,
       1,     4,     7,     1,     1,     1,     1,     1,     2,     2,
       3,     3,     2,     2,     3,     3,     3,     3,     3,     3,
       3,     2,     2,     3,     3,     3,     3,     3,     3,     3,
       6,     3,     6,     3,     3,     3,     6,     3,     6,     4,
       0,     5,     6,     3,     4,     6,     6,     1,     3,     1,
       3,     3,     3,     3,     3,     2,     3,     3,     4,     3,
       4,     4,     1,     4,     1,     1,     2,     3,     3,     3,
       3,     3,     3,     0,     5,     3
};


enum { YYENOMEM = -2 };

#define yyerrok         (yyerrstatus = 0)
#define yyclearin       (yychar = YYEMPTY)

#define YYACCEPT        goto yyacceptlab
#define YYABORT         goto yyabortlab
#define YYERROR         goto yyerrorlab
#define YYNOMEM         goto yyexhaustedlab


#define YYRECOVERING()  (!!yyerrstatus)

#define YYBACKUP(Token, Value)                                    \
  do                                                              \
    if (yychar == YYEMPTY)                                        \
      {                                                           \
        yychar = (Token);                                         \
        yylval = (Value);                                         \
        YYPOPSTACK (yylen);                                       \
        yystate = *yyssp;                                         \
        goto yybackup;                                            \
      }                                                           \
    else                                                          \
      {                                                           \
        yyerror (YY_("syntax error: cannot back up")); \
        YYERROR;                                                  \
      }                                                           \
  while (0)

/* Backward compatibility with an undocumented macro.
   Use YYerror or YYUNDEF. */
#define YYERRCODE YYUNDEF


/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)                        \
do {                                            \
  if (yydebug)                                  \
    YYFPRINTF Args;                             \
} while (0)




# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
do {                                                                      \
  if (yydebug)                                                            \
    {                                                                     \
      YYFPRINTF (stderr, "%s ", Title);                                   \
      yy_symbol_print (stderr,                                            \
                  Kind, Value); \
      YYFPRINTF (stderr, "\n");                                           \
    }                                                                     \
} while (0)


/*-----------------------------------.
| Print this symbol's value on YYO.  |
`-----------------------------------*/

static void
yy_symbol_value_print (FILE *yyo,
                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
  FILE *yyoutput = yyo;
  YY_USE (yyoutput);
  if (!yyvaluep)
    return;
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  YY_USE (yykind);
  YY_IGNORE_MAYBE_UNINITIALIZED_END
}


/*---------------------------.
| Print this symbol on YYO.  |
`---------------------------*/

static void
yy_symbol_print (FILE *yyo,
                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
  YYFPRINTF (yyo, "%s %s (",
             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));

  yy_symbol_value_print (yyo, yykind, yyvaluep);
  YYFPRINTF (yyo, ")");
}

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included).                                                   |
`------------------------------------------------------------------*/

static void
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
{
  YYFPRINTF (stderr, "Stack now");
  for (; yybottom <= yytop; yybottom++)
    {
      int yybot = *yybottom;
      YYFPRINTF (stderr, " %d", yybot);
    }
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)                            \
do {                                                            \
  if (yydebug)                                                  \
    yy_stack_print ((Bottom), (Top));                           \
} while (0)


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

static void
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
                 int yyrule)
{
  int yylno = yyrline[yyrule];
  int yynrhs = yyr2[yyrule];
  int yyi;
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
             yyrule - 1, yylno);
  /* The symbols being reduced.  */
  for (yyi = 0; yyi < yynrhs; yyi++)
    {
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
      yy_symbol_print (stderr,
                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
                       &yyvsp[(yyi + 1) - (yynrhs)]);
      YYFPRINTF (stderr, "\n");
    }
}

# define YY_REDUCE_PRINT(Rule)          \
do {                                    \
  if (yydebug)                          \
    yy_reduce_print (yyssp, yyvsp, Rule); \
} while (0)

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args) ((void) 0)
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif

/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   if the built-in stack extension method is used).

   Do not make this value too large; the results are undefined if
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif


/* Context of a parse error.  */
typedef struct
{
  yy_state_t *yyssp;
  yysymbol_kind_t yytoken;
} yypcontext_t;

/* Put in YYARG at most YYARGN of the expected tokens given the
   current YYCTX, and return the number of tokens stored in YYARG.  If
   YYARG is null, return the number of expected tokens (guaranteed to
   be less than YYNTOKENS).  Return YYENOMEM on memory exhaustion.
   Return 0 if there are more than YYARGN expected tokens, yet fill
   YYARG up to YYARGN. */
static int
yypcontext_expected_tokens (const yypcontext_t *yyctx,
                            yysymbol_kind_t yyarg[], int yyargn)
{
  /* Actual size of YYARG. */
  int yycount = 0;
  int yyn = yypact[+*yyctx->yyssp];
  if (!yypact_value_is_default (yyn))
    {
      /* Start YYX at -YYN if negative to avoid negative indexes in
         YYCHECK.  In other words, skip the first -YYN actions for
         this state because they are default actions.  */
      int yyxbegin = yyn < 0 ? -yyn : 0;
      /* Stay within bounds of both yycheck and yytname.  */
      int yychecklim = YYLAST - yyn + 1;
      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
      int yyx;
      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
        if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
            && !yytable_value_is_error (yytable[yyx + yyn]))
          {
            if (!yyarg)
              ++yycount;
            else if (yycount == yyargn)
              return 0;
            else
              yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
          }
    }
  if (yyarg && yycount == 0 && 0 < yyargn)
    yyarg[0] = YYSYMBOL_YYEMPTY;
  return yycount;
}




#ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
#  define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
# else
/* Return the length of YYSTR.  */
static YYPTRDIFF_T
yystrlen (const char *yystr)
{
  YYPTRDIFF_T yylen;
  for (yylen = 0; yystr[yylen]; yylen++)
    continue;
  return yylen;
}
# endif
#endif

#ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
#  define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
yystpcpy (char *yydest, const char *yysrc)
{
  char *yyd = yydest;
  const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
# endif
#endif

#ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
   quotes and backslashes, so that it's suitable for yyerror.  The
   heuristic is that double-quoting is unnecessary unless the string
   contains an apostrophe, a comma, or backslash (other than
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
   null, do not copy; instead, return the length of what the result
   would have been.  */
static YYPTRDIFF_T
yytnamerr (char *yyres, const char *yystr)
{
  if (*yystr == '"')
    {
      YYPTRDIFF_T yyn = 0;
      char const *yyp = yystr;
      for (;;)
        switch (*++yyp)
          {
          case '\'':
          case ',':
            goto do_not_strip_quotes;

          case '\\':
            if (*++yyp != '\\')
              goto do_not_strip_quotes;
            else
              goto append;

          append:
          default:
            if (yyres)
              yyres[yyn] = *yyp;
            yyn++;
            break;

          case '"':
            if (yyres)
              yyres[yyn] = '\0';
            return yyn;
          }
    do_not_strip_quotes: ;
    }

  if (yyres)
    return yystpcpy (yyres, yystr) - yyres;
  else
    return yystrlen (yystr);
}
#endif


static int
yy_syntax_error_arguments (const yypcontext_t *yyctx,
                           yysymbol_kind_t yyarg[], int yyargn)
{
  /* Actual size of YYARG. */
  int yycount = 0;
  /* There are many possibilities here to consider:
     - If this state is a consistent state with a default action, then
       the only way this function was invoked is if the default action
       is an error action.  In that case, don't check for expected
       tokens because there are none.
     - The only way there can be no lookahead present (in yychar) is if
       this state is a consistent state with a default action.  Thus,
       detecting the absence of a lookahead is sufficient to determine
       that there is no unexpected or expected token to report.  In that
       case, just report a simple "syntax error".
     - Don't assume there isn't a lookahead just because this state is a
       consistent state with a default action.  There might have been a
       previous inconsistent state, consistent state with a non-default
       action, or user semantic action that manipulated yychar.
     - Of course, the expected token list depends on states to have
       correct lookahead information, and it depends on the parser not
       to perform extra reductions after fetching a lookahead from the
       scanner and before detecting a syntax error.  Thus, state merging
       (from LALR or IELR) and default reductions corrupt the expected
       token list.  However, the list is correct for canonical LR with
       one exception: it will still contain any token that will not be
       accepted due to an error action in a later state.
  */
  if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
    {
      int yyn;
      if (yyarg)
        yyarg[yycount] = yyctx->yytoken;
      ++yycount;
      yyn = yypcontext_expected_tokens (yyctx,
                                        yyarg ? yyarg + 1 : yyarg, yyargn - 1);
      if (yyn == YYENOMEM)
        return YYENOMEM;
      else
        yycount += yyn;
    }
  return yycount;
}

/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
   about the unexpected token YYTOKEN for the state stack whose top is
   YYSSP.

   Return 0 if *YYMSG was successfully written.  Return -1 if *YYMSG is
   not large enough to hold the message.  In that case, also set
   *YYMSG_ALLOC to the required number of bytes.  Return YYENOMEM if the
   required number of bytes is too large to store.  */
static int
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
                const yypcontext_t *yyctx)
{
  enum { YYARGS_MAX = 5 };
  /* Internationalized format string. */
  const char *yyformat = YY_NULLPTR;
  /* Arguments of yyformat: reported tokens (one for the "unexpected",
     one per "expected"). */
  yysymbol_kind_t yyarg[YYARGS_MAX];
  /* Cumulated lengths of YYARG.  */
  YYPTRDIFF_T yysize = 0;

  /* Actual size of YYARG. */
  int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
  if (yycount == YYENOMEM)
    return YYENOMEM;

  switch (yycount)
    {
#define YYCASE_(N, S)                       \
      case N:                               \
        yyformat = S;                       \
        break
    default: /* Avoid compiler warnings. */
      YYCASE_(0, YY_("syntax error"));
      YYCASE_(1, YY_("syntax error, unexpected %s"));
      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
#undef YYCASE_
    }

  /* Compute error message size.  Don't count the "%s"s, but reserve
     room for the terminator.  */
  yysize = yystrlen (yyformat) - 2 * yycount + 1;
  {
    int yyi;
    for (yyi = 0; yyi < yycount; ++yyi)
      {
        YYPTRDIFF_T yysize1
          = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
        if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
          yysize = yysize1;
        else
          return YYENOMEM;
      }
  }

  if (*yymsg_alloc < yysize)
    {
      *yymsg_alloc = 2 * yysize;
      if (! (yysize <= *yymsg_alloc
             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
      return -1;
    }

  /* Avoid sprintf, as that infringes on the user's name space.
     Don't have undefined behavior even if the translation
     produced a string with the wrong number of "%s"s.  */
  {
    char *yyp = *yymsg;
    int yyi = 0;
    while ((*yyp = *yyformat) != '\0')
      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
        {
          yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
          yyformat += 2;
        }
      else
        {
          ++yyp;
          ++yyformat;
        }
  }
  return 0;
}


/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

static void
yydestruct (const char *yymsg,
            yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
{
  YY_USE (yyvaluep);
  if (!yymsg)
    yymsg = "Deleting";
  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  YY_USE (yykind);
  YY_IGNORE_MAYBE_UNINITIALIZED_END
}


/* Lookahead token kind.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;
/* Number of syntax errors so far.  */
int yynerrs;




/*----------.
| yyparse.  |
`----------*/

int
yyparse (void)
{
    yy_state_fast_t yystate = 0;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus = 0;

    /* Refer to the stacks through separate pointers, to allow yyoverflow
       to reallocate them elsewhere.  */

    /* Their size.  */
    YYPTRDIFF_T yystacksize = YYINITDEPTH;

    /* The state stack: array, bottom, top.  */
    yy_state_t yyssa[YYINITDEPTH];
    yy_state_t *yyss = yyssa;
    yy_state_t *yyssp = yyss;

    /* The semantic value stack: array, bottom, top.  */
    YYSTYPE yyvsa[YYINITDEPTH];
    YYSTYPE *yyvs = yyvsa;
    YYSTYPE *yyvsp = yyvs;

  int yyn;
  /* The return value of yyparse.  */
  int yyresult;
  /* Lookahead symbol kind.  */
  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;

  /* Buffer for error messages, and its allocated size.  */
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;

#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yychar = YYEMPTY; /* Cause a token to be read.  */

  goto yysetstate;


/*------------------------------------------------------------.
| yynewstate -- push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed.  So pushing a state here evens the stacks.  */
  yyssp++;


/*--------------------------------------------------------------------.
| yysetstate -- set current state (the top of the stack) to yystate.  |
`--------------------------------------------------------------------*/
yysetstate:
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
  YY_IGNORE_USELESS_CAST_BEGIN
  *yyssp = YY_CAST (yy_state_t, yystate);
  YY_IGNORE_USELESS_CAST_END
  YY_STACK_PRINT (yyss, yyssp);

  if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
    YYNOMEM;
#else
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYPTRDIFF_T yysize = yyssp - yyss + 1;

# if defined yyoverflow
      {
        /* Give user a chance to reallocate the stack.  Use copies of
           these so that the &'s don't force the real ones into
           memory.  */
        yy_state_t *yyss1 = yyss;
        YYSTYPE *yyvs1 = yyvs;

        /* Each stack pointer address is followed by the size of the
           data in use in that stack, in bytes.  This used to be a
           conditional around just the two extra args, but that might
           be undefined if yyoverflow is a macro.  */
        yyoverflow (YY_("memory exhausted"),
                    &yyss1, yysize * YYSIZEOF (*yyssp),
                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
                    &yystacksize);
        yyss = yyss1;
        yyvs = yyvs1;
      }
# else /* defined YYSTACK_RELOCATE */
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
        YYNOMEM;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
        yystacksize = YYMAXDEPTH;

      {
        yy_state_t *yyss1 = yyss;
        union yyalloc *yyptr =
          YY_CAST (union yyalloc *,
                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
        if (! yyptr)
          YYNOMEM;
        YYSTACK_RELOCATE (yyss_alloc, yyss);
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
#  undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
      }
# endif

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;

      YY_IGNORE_USELESS_CAST_BEGIN
      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
                  YY_CAST (long, yystacksize)));
      YY_IGNORE_USELESS_CAST_END

      if (yyss + yystacksize - 1 <= yyssp)
        YYABORT;
    }
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */


  if (yystate == YYFINAL)
    YYACCEPT;

  goto yybackup;


/*-----------.
| yybackup.  |
`-----------*/
yybackup:
  /* Do appropriate processing given the current state.  Read a
     lookahead token if we need one and don't already have one.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yypact_value_is_default (yyn))
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token\n"));
      yychar = yylex ();
    }

  if (yychar <= YYEOF)
    {
      yychar = YYEOF;
      yytoken = YYSYMBOL_YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else if (yychar == YYerror)
    {
      /* The scanner already issued an error message, process directly
         to error recovery.  But do not keep the error token as
         lookahead, it is too special and may lead us to an endless
         loop in error recovery. */
      yychar = YYUNDEF;
      yytoken = YYSYMBOL_YYerror;
      goto yyerrlab1;
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yytable_value_is_error (yyn))
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  yystate = yyn;
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END

  /* Discard the shifted token.  */
  yychar = YYEMPTY;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     '$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
  case 2: /* trad: design_units rem  */
#line 1124 "vhd2vl.y"
                        {
        slist *sl;
          sl=addsl((yyvsp[-1].sl),(yyvsp[0].sl));
          slprint(sl);
          (yyval.n)=0;
        }
#line 3414 "vhd2vl.tab.c"
    break;

  case 3: /* design_units: design_unit  */
#line 1132 "vhd2vl.y"
                           {
          (yyval.sl)=(yyvsp[0].sl);
        }
#line 3422 "vhd2vl.tab.c"
    break;

  case 4: /* design_units: design_units design_unit  */
#line 1135 "vhd2vl.y"
                                 {
        slist *sl;
          sl=addsl((yyvsp[-1].sl),(yyvsp[0].sl));
          (yyval.sl)=sl;
        }
#line 3432 "vhd2vl.tab.c"
    break;

  case 5: /* design_units: rem entity  */
#line 1144 "vhd2vl.y"
                   {
        slist *sl;
          sl=output_timescale((yyvsp[-1].sl));
          sl=addsl(sl,(yyvsp[0].sl));
          sl=addtxt(sl,"\nendmodule  // incomplete: entity-only\n");
          (yyval.sl)=sl;
        }
#line 3444 "vhd2vl.tab.c"
    break;

  case 6: /* design_units: rem architecture  */
#line 1151 "vhd2vl.y"
                         {
        slist *sl;
          sl=output_timescale((yyvsp[-1].sl));
          sl=addsl(sl,(yyvsp[0].sl));
          sl=addtxt(sl,"\nendmodule  // incomplete: architecture-only\n");
          (yyval.sl)=sl;
        }
#line 3456 "vhd2vl.tab.c"
    break;

  case 7: /* design_unit: rem entity rem architecture  */
#line 1160 "vhd2vl.y"
                                          {
        slist *sl;
          sl=output_timescale((yyvsp[-3].sl));
          sl=addsl(sl,(yyvsp[-2].sl));
          sl=addsl(sl,(yyvsp[-1].sl));
          sl=addsl(sl,(yyvsp[0].sl));
          sl=addtxt(sl,"\nendmodule\n");
          (yyval.sl)=sl;
        }
#line 3470 "vhd2vl.tab.c"
    break;

  case 8: /* rem: %empty  */
#line 1172 "vhd2vl.y"
                       {(yyval.sl)=NULL; }
#line 3476 "vhd2vl.tab.c"
    break;

  case 9: /* rem: remlist  */
#line 1173 "vhd2vl.y"
                   {(yyval.sl)=(yyvsp[0].sl); }
#line 3482 "vhd2vl.tab.c"
    break;

  case 10: /* remlist: REM  */
#line 1176 "vhd2vl.y"
               {(yyval.sl)=addtxt(indents[indent],(yyvsp[0].txt));}
#line 3488 "vhd2vl.tab.c"
    break;

  case 11: /* remlist: REM remlist  */
#line 1177 "vhd2vl.y"
                       {
           slist *sl;
           sl=addtxt(indents[indent],(yyvsp[-1].txt));
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));}
#line 3497 "vhd2vl.tab.c"
    break;

  case 12: /* opt_is: %empty  */
#line 1183 "vhd2vl.y"
                       {(yyval.txt)=NULL;}
#line 3503 "vhd2vl.tab.c"
    break;

  case 14: /* opt_entity: %empty  */
#line 1185 "vhd2vl.y"
                           {(yyval.txt)=NULL;}
#line 3509 "vhd2vl.tab.c"
    break;

  case 16: /* opt_architecture: %empty  */
#line 1187 "vhd2vl.y"
                                 {(yyval.txt)=NULL;}
#line 3515 "vhd2vl.tab.c"
    break;

  case 18: /* opt_begin: %empty  */
#line 1189 "vhd2vl.y"
                           {(yyval.txt)=NULL;}
#line 3521 "vhd2vl.tab.c"
    break;

  case 22: /* norem: %empty  */
#line 1196 "vhd2vl.y"
                  {skipRem = 1;}
#line 3527 "vhd2vl.tab.c"
    break;

  case 23: /* yesrem: %empty  */
#line 1197 "vhd2vl.y"
                   {skipRem = 0;}
#line 3533 "vhd2vl.tab.c"
    break;

  case 24: /* vhdassert: ASSERT exprc REPORT STRING SEVERITY sevlevel ';'  */
#line 1200 "vhd2vl.y"
                                                             {
              fprintf(stderr,"WARNING (line %d): assertion ignored.\n",lineno);
              (yyval.sl)=NULL;
            }
#line 3542 "vhd2vl.tab.c"
    break;

  case 28: /* sevlevel: NOTE  */
#line 1205 "vhd2vl.y"
                                             {
               (yyval.txt)=NULL;
            }
#line 3550 "vhd2vl.tab.c"
    break;

  case 29: /* entity: ENTITY NAME IS rem PORT '(' rem portlist ')' ';' rem END opt_entity oname ';'  */
#line 1211 "vhd2vl.y"
                                                                                          {
            slist *sl;
            sglist *p;
              sl=addtxt(NULL,"\nmodule ");
              sl=addtxt(sl,(yyvsp[-13].txt)); /* NAME */
              /* Add the signal list */
              sl=emit_io_list(sl);
              sl=addsl(sl,(yyvsp[-8].sl)); /* rem */
              sl=addsl(sl,(yyvsp[-7].sl)); /* portlist */
              sl=addtxt(sl,"\n");
              p=io_list;
              if (vlog_ver == 1995) {
                do{
                sl=addptxt(sl,&(p->type));
                /*sl=addtxt(sl,p->type);*/
                sl=addpar(sl,p->range);
                sl=addtxt(sl,p->name);
                /* sl=addpost(sl,p->range); */
                sl=addtxt(sl,";\n");
                p=p->next;
                } while(p!=NULL);
              }
              sl=addtxt(sl,"\n");
              sl=addsl(sl,(yyvsp[-4].sl)); /* rem2 */
              (yyval.sl)=addtxt(sl,"\n");
            }
#line 3581 "vhd2vl.tab.c"
    break;

  case 30: /* entity: ENTITY NAME IS GENERIC yeslist '(' rem genlist ')' ';' rem PORT yeslist '(' rem portlist ')' ';' rem END opt_entity oname ';'  */
#line 1238 "vhd2vl.y"
                                                                                                                                           {
            slist *sl;
            sglist *p;
              if (0) fprintf(stderr,"matched ENTITY GENERIC\n");
              sl=addtxt(NULL,"\nmodule ");
              sl=addtxt(sl,(yyvsp[-21].txt)); /* NAME */
              sl=emit_io_list(sl);
              sl=addsl(sl,(yyvsp[-16].sl));  /* rem */
              sl=addsl(sl,(yyvsp[-15].sl));  /* genlist */
              sl=addsl(sl,(yyvsp[-12].sl)); /* rem */
              sl=addsl(sl,(yyvsp[-8].sl)); /* rem */
              sl=addsl(sl,(yyvsp[-7].sl)); /* portlist */
              sl=addtxt(sl,"\n");
              p=io_list;
              if (vlog_ver == 1995) {
                do{
                sl=addptxt(sl,&(p->type));
                /*sl=addtxt(sl,p->type);*/
                sl=addpar(sl,p->range);
                sl=addtxt(sl,p->name);
                sl=addtxt(sl,";\n");
                p=p->next;
                } while(p!=NULL);
              }
              sl=addtxt(sl,"\n");
              sl=addsl(sl,(yyvsp[-4].sl)); /* rem2 */
              (yyval.sl)=addtxt(sl,"\n");
            }
#line 3614 "vhd2vl.tab.c"
    break;

  case 31: /* genlist: s_list ':' type ':' '=' expr rem  */
#line 1269 "vhd2vl.y"
                                            {
          if(dolist){
            slist *sl;
            sglist *p;
            sl=addtxt(NULL,"parameter");
            sl=addpar(sl,(yyvsp[-4].v)); /* type */
            p=(yyvsp[-6].sg);
            for(;;){
              sl=addtxt(sl,p->name);
              sl=addtxt(sl,"=");
              sl=addsl(sl, addnest((yyvsp[-1].e))->sl); /* expr */
              sl=addtxt(sl,";\n");
              p=p->next;
              if(p==NULL) break;
            }
            (yyval.sl)=addsl(sl,(yyvsp[0].sl)); /* rem */
          } else {
            (yyval.sl)=NULL;
          }
         }
#line 3639 "vhd2vl.tab.c"
    break;

  case 32: /* genlist: s_list ':' type ':' '=' expr ';' rem genlist  */
#line 1290 "vhd2vl.y"
                                                        {
          if(dolist){
            slist *sl;
            sglist *p;
            sl=addtxt(NULL,"parameter");
            sl=addpar(sl,(yyvsp[-6].v)); /* type */
            p=(yyvsp[-8].sg);
            for(;;){
              sl=addtxt(sl,p->name);
              sl=addtxt(sl,"=");
              sl=addsl(sl, addnest((yyvsp[-3].e))->sl); /* expr */
              sl=addtxt(sl,";\n");
              p=p->next;
              if(p==NULL) break;
            }
            (yyval.sl)=addsl(sl,(yyvsp[-1].sl)); /* rem */
            (yyval.sl)=addsl(sl,(yyvsp[0].sl)); /* genlist */
          } else {
            (yyval.sl)=NULL;
          }
         }
#line 3665 "vhd2vl.tab.c"
    break;

  case 33: /* genlist: s_list ':' type ';' rem genlist  */
#line 1312 "vhd2vl.y"
                                           {
          if(dolist){
            slist *sl;
            sglist *p;
            sl=addtxt(NULL,"parameter");
            sl=addpar(sl,(yyvsp[-3].v)); /* type */
            p=(yyvsp[-5].sg);
            for(;;){
              sl=addtxt(sl,p->name);
              sl=addtxt(sl,";\n");
              p=p->next;
              if(p==NULL) break;
            }
            (yyval.sl)=addsl(sl,(yyvsp[-1].sl)); /* rem */
            (yyval.sl)=addsl(sl,(yyvsp[0].sl)); /* genlist */
          } else {
            (yyval.sl)=NULL;
          }
         }
#line 3689 "vhd2vl.tab.c"
    break;

  case 34: /* genlist: s_list ':' type rem  */
#line 1332 "vhd2vl.y"
                                {
          if(dolist){
            slist *sl;
            sglist *p;
            sl=addtxt(NULL,"parameter");
            sl=addpar(sl,(yyvsp[-1].v)); /* type */
            p=(yyvsp[-3].sg);
            for(;;){
              sl=addtxt(sl,p->name);
              sl=addtxt(sl,";\n");
              p=p->next;
              if(p==NULL) break;
            }
            (yyval.sl)=addsl(sl,(yyvsp[0].sl)); /* rem */
          } else {
            (yyval.sl)=NULL;
          }
         }
#line 3712 "vhd2vl.tab.c"
    break;

  case 35: /* portlist: s_list ':' dir type rem  */
#line 1353 "vhd2vl.y"
                                    {
            slist *sl;

              if(dolist){
                io_list=NULL;
                sl=setup_port((yyvsp[-4].sg),(yyvsp[-2].n),(yyvsp[-1].v));  /* modifies io_list global */
                (yyval.sl)=addsl(sl,(yyvsp[0].sl));
              } else{
                free((yyvsp[0].sl));
                free((yyvsp[-1].v));
              }
            }
#line 3729 "vhd2vl.tab.c"
    break;

  case 36: /* portlist: s_list ':' dir type ';' rem portlist  */
#line 1366 "vhd2vl.y"
                                                 {
            slist *sl;

              if(dolist){
                sl=setup_port((yyvsp[-6].sg),(yyvsp[-4].n),(yyvsp[-3].v));  /* modifies io_list global */
                sl=addsl(sl,(yyvsp[-1].sl));
                (yyval.sl)=addsl(sl,(yyvsp[0].sl));
              } else{
                free((yyvsp[-1].sl));
                free((yyvsp[-3].v));
              }
            }
#line 3746 "vhd2vl.tab.c"
    break;

  case 37: /* portlist: s_list ':' dir type ':' '=' expr rem  */
#line 1379 "vhd2vl.y"
                                                 {
            slist *sl;
              fprintf(stderr,"WARNING (line %d): port default initialization ignored.\n",lineno);
              if(dolist){
                io_list=NULL;
                sl=setup_port((yyvsp[-7].sg),(yyvsp[-5].n),(yyvsp[-4].v));  /* modifies io_list global */
                (yyval.sl)=addsl(sl,(yyvsp[0].sl));
              } else{
                free((yyvsp[0].sl));
                free((yyvsp[-4].v));
              }
            }
#line 3763 "vhd2vl.tab.c"
    break;

  case 38: /* portlist: s_list ':' dir type ':' '=' expr ';' rem portlist  */
#line 1392 "vhd2vl.y"
                                                              {
            slist *sl;
              fprintf(stderr,"WARNING (line %d): port default initialization ignored.\n",lineno);
              if(dolist){
                sl=setup_port((yyvsp[-9].sg),(yyvsp[-7].n),(yyvsp[-6].v));  /* modifies io_list global */
                sl=addsl(sl,(yyvsp[-1].sl));
                (yyval.sl)=addsl(sl,(yyvsp[0].sl));
              } else{
                free((yyvsp[-1].sl));
                free((yyvsp[-6].v));
              }
            }
#line 3780 "vhd2vl.tab.c"
    break;

  case 39: /* dir: IN  */
#line 1406 "vhd2vl.y"
                 { (yyval.n)=0;}
#line 3786 "vhd2vl.tab.c"
    break;

  case 40: /* dir: OUT  */
#line 1407 "vhd2vl.y"
                  { (yyval.n)=1; }
#line 3792 "vhd2vl.tab.c"
    break;

  case 41: /* dir: INOUT  */
#line 1408 "vhd2vl.y"
                    { (yyval.n)=2; }
#line 3798 "vhd2vl.tab.c"
    break;

  case 42: /* type: BIT  */
#line 1411 "vhd2vl.y"
                  {
                (yyval.v)=new_vrange(tSCALAR);
              }
#line 3806 "vhd2vl.tab.c"
    break;

  case 43: /* type: INTEGER RANGE expr TO expr  */
#line 1414 "vhd2vl.y"
                                         {
                fprintf(stderr,"WARNING (line %d): integer range ignored.\n",lineno);
                (yyval.v)=new_vrange(tSCALAR);
                (yyval.v)->nlo = addtxt(NULL,"0");
                (yyval.v)->nhi = addtxt(NULL,"31");
              }
#line 3817 "vhd2vl.tab.c"
    break;

  case 44: /* type: INTEGER  */
#line 1420 "vhd2vl.y"
                      {
                (yyval.v)=new_vrange(tSCALAR);
                (yyval.v)->nlo = addtxt(NULL,"0");
                (yyval.v)->nhi = addtxt(NULL,"31");
              }
#line 3827 "vhd2vl.tab.c"
    break;

  case 45: /* type: REAL  */
#line 1425 "vhd2vl.y"
                   {
                (yyval.v)=new_vrange(tSCALAR);
              }
#line 3835 "vhd2vl.tab.c"
    break;

  case 46: /* type: BITVECT '(' vec_range ')'  */
#line 1428 "vhd2vl.y"
                                        {(yyval.v)=(yyvsp[-1].v); free((yyvsp[-3].txt));}
#line 3841 "vhd2vl.tab.c"
    break;

  case 47: /* type: NAME  */
#line 1429 "vhd2vl.y"
                   {
              sglist *sg;

                sg=lookup(type_list,(yyvsp[0].txt));
                if(sg)
                  (yyval.v)=sg->range;
                else{
                  fprintf(stderr,"ERROR (line %d): undefined type '%s'.\n", lineno, (yyvsp[0].txt));
                  YYABORT;
                }
              }
#line 3857 "vhd2vl.tab.c"
    break;

  case 48: /* vec_range: simple_expr updown simple_expr  */
#line 1443 "vhd2vl.y"
                                           {
              char *range_diff = 0;
              (yyval.v)=new_vrange(tVRANGE);
              (yyval.v)->nhi=(yyvsp[-2].e)->sl;
              (yyval.v)->nlo=(yyvsp[0].e)->sl;
              (yyval.v)->sizeval = -1; /* undefined size */
              (yyval.v)->updown = 0; /* not relevant */
              if ((yyvsp[-2].e)->op == 'n' && (yyvsp[0].e)->op == 'n' && (yyvsp[-2].e)->value < (yyvsp[0].e)->value && (yyvsp[-1].n) == -1) {
                /* Avoid negative width like (-1+23 downto 0): clamp to scalar */
                (yyval.v)->vtype = tSCALAR;
                (yyval.v)->nhi = NULL;
                (yyval.v)->nlo = NULL;
                (yyval.v)->sizeval = 1;
                (yyval.v)->size_expr = NULL;
                (yyval.v)->updown = 0;
              } else if ((yyvsp[-2].e)->op == 'n' && (yyvsp[0].e)->op == 'n' && (yyvsp[0].e)->value < (yyvsp[-2].e)->value && (yyvsp[-1].n) == 1) {
                /* Avoid negative width for TO with low>high: clamp to scalar */
                (yyval.v)->vtype = tSCALAR;
                (yyval.v)->nhi = NULL;
                (yyval.v)->nlo = NULL;
                (yyval.v)->sizeval = 1;
                (yyval.v)->size_expr = NULL;
                (yyval.v)->updown = 0;
              }
              /* slist_check_diff() is where we analyze the two expressions
               * to see if they have a simple (possibly constant) difference.
               * Start with an option to visualize their data structures.
               */
              if (DEBUG_RANGE) {
                fprintf(stderr, "debug width hi: ");
                fslprint(stderr, (yyval.v)->nhi);
                fprintf(stderr, "\n");
                if (0) sldump(4, (yyval.v)->nhi);
                fprintf(stderr, "debug width lo: ");
                fslprint(stderr, (yyval.v)->nlo);
                fprintf(stderr, "\n");
                if (0) sldump(4, (yyval.v)->nlo);
              }
              /* calculate the width of this vrange */
              if ((yyval.v)->vtype != tVRANGE) {
                /* already clamped to scalar, skip width analysis */
              } else if ((yyvsp[-2].e)->op == 'n' && (yyvsp[0].e)->op == 'n') {
                if ((yyvsp[-1].n)==-1) { /* (nhi:natural downto nlo:natural) */
                  (yyval.v)->sizeval = (yyvsp[-2].e)->value - (yyvsp[0].e)->value + 1;
                } else {      /* (nhi:natural to     nlo:natural) */
                  (yyval.v)->sizeval = (yyvsp[0].e)->value - (yyvsp[-2].e)->value + 1;
                }
              } else if ((range_diff = slist_check_diff((yyval.v)->nhi, (yyval.v)->nlo, (yyvsp[-1].n)))) {
                if (DEBUG_RANGE) fprintf(stderr, "difference: %s\n", range_diff);
                (yyval.v)->updown = (yyvsp[-1].n);  /* triggers use of range_diff in addpar_snug */
                (yyval.v)->size_expr = addtxt(NULL, range_diff);
              } else {
                /* make an expression to calculate the width of this vrange:
                 * create an expression that calculates:
                 *   size expr = (simple_expr1) - (simple_expr2) + 1
                 */
                expdata *size_expr1  = xmalloc(sizeof(expdata));
                expdata *size_expr2  = xmalloc(sizeof(expdata));
                expdata *diff12  = xmalloc(sizeof(expdata));
                expdata *plusone = xmalloc(sizeof(expdata));
                expdata *finalexpr = xmalloc(sizeof(expdata));
                size_expr1->sl = addwrap("(",(yyvsp[-2].e)->sl,")");
                size_expr1->op = 't';
                size_expr2->sl = addwrap("(",(yyvsp[0].e)->sl,")");
                size_expr2->op = 't';
                plusone->op='t';
                plusone->sl=addtxt(NULL,"1");
                if ((yyvsp[-1].n)==-1) {
                  /* (simple_expr1 downto simple_expr1) */
                  diff12 = addexpr(size_expr1,'-',"-",size_expr2);
                } else {
                  /* (simple_expr1   to   simple_expr1) */
                  diff12 = addexpr(size_expr2,'-',"-",size_expr1);
                }
                finalexpr = addexpr(diff12,'+',"+",plusone);
                finalexpr->sl = addwrap("(",finalexpr->sl,")");
                (yyval.v)->size_expr = finalexpr->sl;
              }
              if (DEBUG_RANGE) fprintf(stderr, "\n");
            }
#line 3942 "vhd2vl.tab.c"
    break;

  case 49: /* vec_range: simple_expr  */
#line 1523 "vhd2vl.y"
                        {
              (yyval.v)=new_vrange(tSUBSCRIPT);
              (yyval.v)->nlo=(yyvsp[0].e)->sl;
          }
#line 3951 "vhd2vl.tab.c"
    break;

  case 50: /* vec_range: NAME '\'' RANGE  */
#line 1527 "vhd2vl.y"
                            {
              /* lookup NAME and copy its vrange */
              sglist *sg = NULL;
              if((sg=lookup(io_list,(yyvsp[-2].txt)))==NULL) {
                sg=lookup(sig_list,(yyvsp[-2].txt));
              }
              if(sg) {
                (yyval.v) = sg->range;
              } else {
                fprintf(stderr,"ERROR (line %d): undefined range \"%s'range\".\n", lineno, (yyvsp[-2].txt));
                YYABORT;
              }
          }
#line 3969 "vhd2vl.tab.c"
    break;

  case 51: /* updown: DOWNTO  */
#line 1542 "vhd2vl.y"
                {(yyval.n)=-1;}
#line 3975 "vhd2vl.tab.c"
    break;

  case 52: /* updown: TO  */
#line 1543 "vhd2vl.y"
            {(yyval.n)=1;}
#line 3981 "vhd2vl.tab.c"
    break;

  case 53: /* architecture: ARCHITECTURE NAME OF NAME IS rem a_decl BEGN doindent a_body END opt_architecture oname ';' unindent  */
#line 1548 "vhd2vl.y"
                                                                            {
               slist *sl;
                 sl=addsl((yyvsp[-9].sl),(yyvsp[-8].sl));
                 sl=addtxt(sl,"\n");
                 (yyval.sl)=addsl(sl,(yyvsp[-5].sl));
               }
#line 3992 "vhd2vl.tab.c"
    break;

  case 54: /* doindent: %empty  */
#line 1557 "vhd2vl.y"
                       {indent= indent < MAXINDENT ? indent + 1 : indent;}
#line 3998 "vhd2vl.tab.c"
    break;

  case 55: /* unindent: %empty  */
#line 1560 "vhd2vl.y"
                       {indent= indent > 0 ? indent - 1 : indent;}
#line 4004 "vhd2vl.tab.c"
    break;

  case 56: /* a_decl: %empty  */
#line 1563 "vhd2vl.y"
            {(yyval.sl)=NULL;}
#line 4010 "vhd2vl.tab.c"
    break;

  case 57: /* a_decl: a_decl SIGNAL s_list ':' type ';' rem  */
#line 1564 "vhd2vl.y"
                                                  {
            sglist *sg;
            slist *sl;

              sl=(yyvsp[-6].sl);
              sg=(yyvsp[-4].sg);
              for(;;){
                sg->type=wire;
                sg->range=(yyvsp[-2].v);
                sl=addptxt(sl,&(sg->type));
                sl=addpar(sl,(yyvsp[-2].v));
                sl=addtxt(sl,sg->name);
                sl=addpost(sl,(yyvsp[-2].v));
                sl=addtxt(sl,";");
                if(sg->next == NULL)
                  break;
                sl=addtxt(sl," ");
                sg=sg->next;
              }
              sg->next=sig_list;
              sig_list=(yyvsp[-4].sg);
              (yyval.sl)=addrem(sl,(yyvsp[0].sl));
            }
#line 4038 "vhd2vl.tab.c"
    break;

  case 58: /* a_decl: a_decl SIGNAL s_list ':' type ':' '=' expr ';' rem  */
#line 1587 "vhd2vl.y"
                                                               {
            sglist *sg;
            slist *sl;

              sl=(yyvsp[-9].sl);
              sg=(yyvsp[-7].sg);
              for(;;){
                sg->type=wire;
                sg->range=(yyvsp[-5].v);
                sl=addptxt(sl,&(sg->type));
                sl=addpar(sl,(yyvsp[-5].v));
                sl=addtxt(sl,sg->name);
                sl=addpost(sl,(yyvsp[-5].v));
                sl=addtxt(sl," = ");
                sl=addsl(sl,(yyvsp[-2].e)->sl);
                sl=addtxt(sl,";");
                if(sg->next == NULL)
                  break;
                sl=addtxt(sl," ");
                sg=sg->next;
              }
              sg->next=sig_list;
              sig_list=(yyvsp[-7].sg);
              (yyval.sl)=addrem(sl,(yyvsp[0].sl));
            }
#line 4068 "vhd2vl.tab.c"
    break;

  case 59: /* a_decl: a_decl CONSTANT NAME ':' type ':' '=' expr ';' rem  */
#line 1612 "vhd2vl.y"
                                                               {
            slist * sl;
              sl=addtxt((yyvsp[-9].sl),"parameter ");
              sl=addtxt(sl,(yyvsp[-7].txt));
              sl=addtxt(sl," = ");
              sl=addsl(sl,(yyvsp[-2].e)->sl);
              sl=addtxt(sl,";");
              (yyval.sl)=addrem(sl,(yyvsp[0].sl));
            }
#line 4082 "vhd2vl.tab.c"
    break;

  case 60: /* a_decl: a_decl TYPE NAME IS '(' s_list ')' ';' rem  */
#line 1621 "vhd2vl.y"
                                                       {
            slist *sl, *sl2;
            sglist *p;
            int n,k;
              n=0;
              sl=NULL;
              p=(yyvsp[-3].sg);
              for(;;){
                sl=addtxt(sl,"  ");
                sl=addtxt(sl,p->name);
                sl=addtxt(sl," = ");
                sl=addval(sl,n++);
                p=p->next;
                if(p==NULL){
                  sl=addtxt(sl,";\n");
                  break;
                } else
                  sl=addtxt(sl,",\n");
              }
              n--;
              k=find_msb(n);
              sl2=addtxt(NULL,"parameter [");
              sl2=addval(sl2,k);
              sl2=addtxt(sl2,":0]\n");
              sl=addsl(sl2,sl);
              sl=addsl((yyvsp[-8].sl),sl);
              (yyval.sl)=addrem(sl,(yyvsp[0].sl));
              p=xmalloc(sizeof(sglist));
              p->name=(yyvsp[-6].txt);
              if(k>0) {
                p->range=new_vrange(tVRANGE);
                p->range->sizeval = k+1;
                p->range->nhi=addval(NULL,k);
                p->range->nlo=addtxt(NULL,"0");
              } else {
                p->range=new_vrange(tSCALAR);
              }
              p->next=type_list;
              type_list=p;
            }
#line 4127 "vhd2vl.tab.c"
    break;

  case 61: /* a_decl: a_decl TYPE NAME IS ARRAY '(' vec_range ')' OF type ';' rem  */
#line 1661 "vhd2vl.y"
                                                                        {
            slist *sl=(yyvsp[-11].sl);
            sglist *p;
              (yyval.sl)=addrem(sl,(yyvsp[0].sl));
              p=xmalloc(sizeof(sglist));
              p->name=(yyvsp[-9].txt);
              p->range=(yyvsp[-2].v);
              p->range->xhi=(yyvsp[-5].v)->nhi;
              p->range->xlo=(yyvsp[-5].v)->nlo;
              p->next=type_list;
              type_list=p;
            }
#line 4144 "vhd2vl.tab.c"
    break;

  case 62: /* a_decl: a_decl COMPONENT NAME opt_is rem opt_generic PORT nolist '(' rem portlist ')' ';' rem END COMPONENT oname ';' yeslist rem  */
#line 1674 "vhd2vl.y"
                                                                                                                                       {
              (yyval.sl)=addsl((yyvsp[-19].sl),(yyvsp[0].sl)); /* a_decl, rem4 */
              free((yyvsp[-17].txt)); /* NAME */
              free((yyvsp[-10].sl)); /* rem2 */
              free((yyvsp[-6].sl)); /* rem3 */
            }
#line 4155 "vhd2vl.tab.c"
    break;

  case 63: /* opt_generic: %empty  */
#line 1682 "vhd2vl.y"
                          {(yyval.txt)=NULL;}
#line 4161 "vhd2vl.tab.c"
    break;

  case 64: /* opt_generic: GENERIC nolist '(' rem genlist ')' ';' rem  */
#line 1683 "vhd2vl.y"
                                                       {
             if (0) fprintf(stderr,"matched opt_generic\n");
             free((yyvsp[-4].sl));  /* rem */
             free((yyvsp[0].sl));  /* rem */
             (yyval.txt)=NULL;
            }
#line 4172 "vhd2vl.tab.c"
    break;

  case 65: /* nolist: %empty  */
#line 1691 "vhd2vl.y"
                   {dolist = 0;}
#line 4178 "vhd2vl.tab.c"
    break;

  case 66: /* yeslist: %empty  */
#line 1692 "vhd2vl.y"
                    {dolist = 1;}
#line 4184 "vhd2vl.tab.c"
    break;

  case 67: /* s_list: NAME rem  */
#line 1695 "vhd2vl.y"
                  {
         sglist * sg;
           if(dolist){
             sg=xmalloc(sizeof(sglist));
             sg->name=(yyvsp[-1].txt);
             sg->next=NULL;
             (yyval.sg)=sg;
           } else{
             free((yyvsp[-1].txt));
             (yyval.sg)=NULL;
           }
           free((yyvsp[0].sl));
         }
#line 4202 "vhd2vl.tab.c"
    break;

  case 68: /* s_list: NAME ',' rem s_list  */
#line 1708 "vhd2vl.y"
                             {
         sglist * sg;
           if(dolist){
             sg=xmalloc(sizeof(sglist));
             sg->name=(yyvsp[-3].txt);
             sg->next=(yyvsp[0].sg);
             (yyval.sg)=sg;
           } else{
             free((yyvsp[-3].txt));
             (yyval.sg)=NULL;
           }
           free((yyvsp[-1].sl));
         }
#line 4220 "vhd2vl.tab.c"
    break;

  case 69: /* a_body: rem  */
#line 1723 "vhd2vl.y"
             {(yyval.sl)=addind((yyvsp[0].sl));}
#line 4226 "vhd2vl.tab.c"
    break;

  case 70: /* a_body: rem signal '<' '=' rem norem sigvalue yesrem a_body  */
#line 1725 "vhd2vl.y"
                                                             {
         slist *sl;
           sl=addsl((yyvsp[-8].sl),indents[indent]);
           sl=addtxt(sl,"assign ");
           sl=addsl(sl,(yyvsp[-7].ss)->sl);
           findothers((yyvsp[-7].ss),(yyvsp[-2].sl));
           free((yyvsp[-7].ss));
           sl=addtxt(sl," = ");
           sl=addsl(sl,(yyvsp[-2].sl));
           sl=addtxt(sl,";\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4243 "vhd2vl.tab.c"
    break;

  case 71: /* a_body: rem BEGN signal '<' '=' rem norem sigvalue yesrem a_body END NAME ';'  */
#line 1738 "vhd2vl.y"
                                                                               {
         slist *sl;
           sl=addsl((yyvsp[-12].sl),indents[indent]);
           sl=addtxt(sl,"assign ");
           sl=addsl(sl,(yyvsp[-10].ss)->sl);
           findothers((yyvsp[-10].ss),(yyvsp[-5].sl));
           free((yyvsp[-10].ss));
           sl=addtxt(sl," = ");
           sl=addsl(sl,(yyvsp[-5].sl));
           sl=addtxt(sl,";\n");
           (yyval.sl)=addsl(sl,(yyvsp[-3].sl));
         }
#line 4260 "vhd2vl.tab.c"
    break;

  case 72: /* a_body: rem WITH expr SELECT rem yeswith signal '<' '=' with_list a_body  */
#line 1751 "vhd2vl.y"
                                                                          {
         slist *sl;
         sglist *sg;
         char *s;
           sl=addsl((yyvsp[-10].sl),indents[indent]);
           sl=addtxt(sl,"always @(*) begin\n");
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"  case(");
           sl=addsl(sl,expr_to_sl((yyvsp[-8].e)));
           free((yyvsp[-8].e));
           sl=addtxt(sl,")\n");
           if((yyvsp[-6].sl))
             sl=addsl(sl,(yyvsp[-6].sl));
           s=sbottom((yyvsp[-4].ss)->sl);
           if((sg=lookup(io_list,s))==NULL)
             sg=lookup(sig_list,s);
           if(sg)
             sg->type=reg;
           findothers((yyvsp[-4].ss),(yyvsp[-1].sl));
           free((yyvsp[-4].ss));
           sl=addsl(sl,(yyvsp[-1].sl));
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"  endcase\n");
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"end\n\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4292 "vhd2vl.tab.c"
    break;

  case 73: /* a_body: rem NAME ':' NAME rem PORT MAP '(' doindent map_list rem ')' ';' unindent a_body  */
#line 1779 "vhd2vl.y"
                                                                                          {
         slist *sl;
           sl=addsl((yyvsp[-14].sl),indents[indent]);
           sl=addtxt(sl,(yyvsp[-11].txt)); /* NAME2 */
           sl=addtxt(sl," ");
           sl=addtxt(sl,(yyvsp[-13].txt)); /* NAME1 */
           sl=addtxt(sl,"(\n");
           sl=addsl(sl,(yyvsp[-5].sl));  /* map_list */
           sl=addtxt(sl,");\n\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl)); /* a_body */
         }
#line 4308 "vhd2vl.tab.c"
    break;

  case 74: /* a_body: rem NAME ':' NAME rem GENERIC MAP '(' doindent generic_map_list ')' rem unindent PORT MAP '(' doindent map_list ')' ';' unindent a_body  */
#line 1791 "vhd2vl.y"
                                                                                                                                                 {
         slist *sl;
           sl=addsl((yyvsp[-21].sl),indents[indent]);
           sl=addtxt(sl,(yyvsp[-18].txt)); /* NAME2 (component name) */
           if ((yyvsp[-17].sl)) {
             sl=addsl(sl,(yyvsp[-17].sl));
             sl=addsl(sl,indents[indent]);
           }
           sl=addtxt(sl," #(\n");
           sl=addsl(sl,(yyvsp[-12].sl)); /* (generic) map_list */
           sl=addtxt(sl,")\n");
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,(yyvsp[-20].txt)); /* NAME1 (instance name) */
           sl=addtxt(sl,"(\n");
           sl=addsl(sl,(yyvsp[-4].sl)); /* map_list */
           sl=addtxt(sl,");\n\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl)); /* a_body */
         }
#line 4331 "vhd2vl.tab.c"
    break;

  case 75: /* a_body: optname PROCESS '(' sign_list ')' p_decl opt_is BEGN doindent p_body END PROCESS oname ';' unindent a_body  */
#line 1809 "vhd2vl.y"
                                                                                                                    {
         slist *sl;
           if (0) fprintf(stderr,"process style 1\n");
           sl=add_always((yyvsp[-15].sl),(yyvsp[-12].sl),(yyvsp[-10].sl),0);
           sl=addsl(sl,(yyvsp[-6].sl));
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"end\n\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4345 "vhd2vl.tab.c"
    break;

  case 76: /* a_body: optname PROCESS '(' sign_list ')' p_decl opt_is BEGN doindent rem IF edge THEN p_body END IF ';' rem END PROCESS oname ';' unindent a_body  */
#line 1819 "vhd2vl.y"
                                                                                        {
           slist *sl;
             if (0) fprintf(stderr,"process style 2: if then end if\n");
             sl=add_always((yyvsp[-23].sl),(yyvsp[-20].sl),(yyvsp[-18].sl),1);
             if((yyvsp[-14].sl)){
               sl=addsl(sl,indents[indent]);
               sl=addsl(sl,(yyvsp[-14].sl));
             }
             sl=addsl(sl,(yyvsp[-10].sl));
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"end\n\n");
             (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4363 "vhd2vl.tab.c"
    break;

  case 77: /* a_body: optname PROCESS '(' sign_list ')' p_decl opt_is BEGN doindent rem IF exprc THEN doindent p_body unindent ELSIF edge THEN doindent p_body unindent END IF ';' rem END PROCESS oname ';' unindent a_body  */
#line 1837 "vhd2vl.y"
                                                     {
           slist *sl;
             if (0) fprintf(stderr,"process style 3: if then elsif then end if\n");
             sl=add_always((yyvsp[-31].sl),(yyvsp[-28].sl),(yyvsp[-26].sl),1);
             if((yyvsp[-22].sl)){
               sl=addsl(sl,indents[indent]);
               sl=addsl(sl,(yyvsp[-22].sl));
             }
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"  if(");
             sl=addsl(sl,(yyvsp[-20].sl));
             sl=addtxt(sl,") begin\n");
             sl=addsl(sl,(yyvsp[-17].sl));
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"  end else begin\n");
             sl=addsl(sl,(yyvsp[-11].sl));
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"  end\n");
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"end\n\n");
             (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4390 "vhd2vl.tab.c"
    break;

  case 78: /* a_body: optname PROCESS '(' sign_list ')' p_decl opt_is BEGN doindent rem IF exprc THEN doindent p_body unindent ELSE IF edge THEN doindent p_body unindent END IF ';' END IF ';' END PROCESS oname ';' unindent a_body  */
#line 1864 "vhd2vl.y"
                                                 {
           slist *sl;
             if (0) fprintf(stderr,"process style 4: if then else if then end if\n");
             sl=add_always((yyvsp[-34].sl),(yyvsp[-31].sl),(yyvsp[-29].sl),1);
             if((yyvsp[-25].sl)){
               sl=addsl(sl,indents[indent]);
               sl=addsl(sl,(yyvsp[-25].sl));
             }
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"  if(");
             sl=addsl(sl,(yyvsp[-23].sl)); /* exprc */
             sl=addtxt(sl,") begin\n");
             sl=addsl(sl,(yyvsp[-20].sl)); /* p_body:1 */
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"  end else begin\n");
             sl=addsl(sl,(yyvsp[-13].sl)); /* p_body:2 */
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"  end\n");
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"end\n\n");
             (yyval.sl)=addsl(sl,(yyvsp[0].sl)); /* a_body */
         }
#line 4417 "vhd2vl.tab.c"
    break;

  case 79: /* a_body: gen_optname IF exprc generate doindent a_body unindent endgenerate oname ';' a_body  */
#line 1889 "vhd2vl.y"
                                                                                               {
         slist *sl;
         blknamelist *tname_list;
           sl=addsl((yyvsp[-10].sl),indents[indent]);
           sl=addtxt(sl,"generate ");
           sl=addtxt(sl,"if (");
           sl=addsl(sl,(yyvsp[-8].sl)); /* exprc */
           sl=addtxt(sl,") begin: ");
           tname_list=blkname_list;
           sl=addtxt(sl,tname_list->name);
           blkname_list=blkname_list->next;
           if (tname_list!=NULL) {
           free(tname_list->name);
           free(tname_list);
           }
           sl=addtxt(sl,"\n");
           sl=addsl(sl,(yyvsp[-5].sl));   /* a_body:1 */
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"end\n");
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"endgenerate\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));    /* a_body:2 */
         }
#line 4445 "vhd2vl.tab.c"
    break;

  case 80: /* a_body: gen_optname FOR signal IN expr TO expr generate doindent a_body unindent endgenerate oname ';' a_body  */
#line 1913 "vhd2vl.y"
                                                                                                                 {
         slist *sl;
         blknamelist *tname_list;
           sl=addsl((yyvsp[-14].sl),indents[indent]);
           sl=addtxt(sl,"genvar ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl,";\n");
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"generate ");
           sl=addtxt(sl,"for (");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl,"=");
           sl=addsl(sl,(yyvsp[-10].e)->sl); /* expr:1 */
           sl=addtxt(sl,"; ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," <= ");
           sl=addsl(sl,(yyvsp[-8].e)->sl); /* expr:2 */
           sl=addtxt(sl,"; ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," = ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," + 1) begin: ");
           tname_list=blkname_list;
           sl=addtxt(sl,tname_list->name);
           blkname_list=blkname_list->next;
           if (tname_list!=NULL) {
           free(tname_list->name);
           free(tname_list);
           }
           sl=addtxt(sl,"\n");
           sl=addsl(sl,(yyvsp[-5].sl));   /* a_body:1 */
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"end\n");
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"endgenerate\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));    /* a_body:2 */
         }
#line 4487 "vhd2vl.tab.c"
    break;

  case 81: /* a_body: gen_optname FOR signal IN expr DOWNTO expr generate doindent a_body unindent endgenerate oname ';' a_body  */
#line 1951 "vhd2vl.y"
                                                                                                                     {
         slist *sl;
           blknamelist* tname_list;
           sl=addsl((yyvsp[-14].sl),indents[indent]);
           sl=addtxt(sl,"genvar ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl,";\n");
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"generate ");
           sl=addtxt(sl,"for (");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl,"=");
           sl=addsl(sl,(yyvsp[-10].e)->sl); /* expr:1 */
           sl=addtxt(sl,"; ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," >= ");
           sl=addsl(sl,(yyvsp[-8].e)->sl); /* expr:2 */
           sl=addtxt(sl,"; ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," = ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," - 1) begin: ");
           tname_list=blkname_list;
           sl=addtxt(sl,tname_list->name);
           blkname_list=blkname_list->next;
           if (tname_list!=NULL) {
           free(tname_list->name);
           free(tname_list);
           }
           sl=addtxt(sl,"\n");
           sl=addsl(sl,(yyvsp[-5].sl));   /* a_body:1 */
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"end\n");
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"endgenerate\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));    /* a_body:2 */
         }
#line 4529 "vhd2vl.tab.c"
    break;

  case 82: /* a_body: rem vhdassert a_body  */
#line 1988 "vhd2vl.y"
                               {
           slist *sl;
           sl=addsl((yyvsp[-2].sl),(yyvsp[-1].sl));
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
        }
#line 4539 "vhd2vl.tab.c"
    break;

  case 83: /* oname: %empty  */
#line 1995 "vhd2vl.y"
        {(yyval.sl)=NULL;}
#line 4545 "vhd2vl.tab.c"
    break;

  case 84: /* oname: NAME  */
#line 1996 "vhd2vl.y"
             {free((yyvsp[0].txt)); (yyval.sl)=NULL;}
#line 4551 "vhd2vl.tab.c"
    break;

  case 85: /* optname: rem  */
#line 1999 "vhd2vl.y"
              {(yyval.sl)=(yyvsp[0].sl);}
#line 4557 "vhd2vl.tab.c"
    break;

  case 86: /* optname: rem NAME ':'  */
#line 2000 "vhd2vl.y"
                       {(yyval.sl)=(yyvsp[-2].sl); free((yyvsp[-1].txt));}
#line 4563 "vhd2vl.tab.c"
    break;

  case 87: /* gen_optname: rem  */
#line 2002 "vhd2vl.y"
                  {(yyval.sl)=(yyvsp[0].sl);}
#line 4569 "vhd2vl.tab.c"
    break;

  case 88: /* gen_optname: rem NAME ':'  */
#line 2003 "vhd2vl.y"
                       {
           blknamelist *tname_list;
           tname_list = xmalloc (sizeof(blknamelist));
           tname_list->name = xmalloc(strlen((yyvsp[-1].txt)) + 1);
           strcpy(tname_list->name, (yyvsp[-1].txt));
           tname_list->next = blkname_list;
           blkname_list=tname_list;
           (yyval.sl)=(yyvsp[-2].sl);
           free((yyvsp[-1].txt));
         }
#line 4584 "vhd2vl.tab.c"
    break;

  case 89: /* edge: '(' edge ')'  */
#line 2015 "vhd2vl.y"
                    {(yyval.sl)=addwrap("(",(yyvsp[-1].sl),")");}
#line 4590 "vhd2vl.tab.c"
    break;

  case 90: /* edge: NAME '\'' EVENT AND exprc  */
#line 2016 "vhd2vl.y"
                                 {
         push_clkedge((yyvsp[0].sl)->data.sl->data.txt[0]-'0', "name'event and exprc");
       }
#line 4598 "vhd2vl.tab.c"
    break;

  case 91: /* edge: exprc AND NAME '\'' EVENT  */
#line 2019 "vhd2vl.y"
                                 {
         push_clkedge((yyvsp[-4].sl)->data.sl->data.txt[0]-'0', "exprc and name'event");
       }
#line 4606 "vhd2vl.tab.c"
    break;

  case 92: /* edge: POSEDGE '(' NAME ')'  */
#line 2022 "vhd2vl.y"
                            {
         push_clkedge(1, "explicit");
       }
#line 4614 "vhd2vl.tab.c"
    break;

  case 93: /* edge: NEGEDGE '(' NAME ')'  */
#line 2025 "vhd2vl.y"
                            {
         push_clkedge(0, "explicit");
       }
#line 4622 "vhd2vl.tab.c"
    break;

  case 94: /* yeswith: %empty  */
#line 2030 "vhd2vl.y"
          {dowith=1;}
#line 4628 "vhd2vl.tab.c"
    break;

  case 95: /* with_list: with_item ';'  */
#line 2032 "vhd2vl.y"
                          {(yyval.sl)=(yyvsp[-1].sl);}
#line 4634 "vhd2vl.tab.c"
    break;

  case 96: /* with_list: with_item ',' rem with_list  */
#line 2033 "vhd2vl.y"
                                        {
            slist *sl;
              if((yyvsp[-1].sl)){
                sl=addsl((yyvsp[-3].sl),(yyvsp[-1].sl));
                (yyval.sl)=addsl(sl,(yyvsp[0].sl));
              } else
                (yyval.sl)=addsl((yyvsp[-3].sl),(yyvsp[0].sl));
            }
#line 4647 "vhd2vl.tab.c"
    break;

  case 97: /* with_list: expr delay WHEN OTHERS ';'  */
#line 2041 "vhd2vl.y"
                                       {
            slist *sl;
              sl=addtxt(indents[indent],"    default : ");
              sl=addsl(sl,slwith);
              sl=addtxt(sl," <= ");
              if(delay && (yyvsp[-3].n)){
                sl=addtxt(sl,"# ");
                sl=addval(sl,(yyvsp[-3].n));
                sl=addtxt(sl," ");
              }
              if((yyvsp[-4].e)->op == 'c')
                sl=addsl(sl,addwrap("{",(yyvsp[-4].e)->sl,"}"));
              else
                sl=addsl(sl,(yyvsp[-4].e)->sl);
              free((yyvsp[-4].e));
              delay=1;
              (yyval.sl)=addtxt(sl,";\n");
            }
#line 4670 "vhd2vl.tab.c"
    break;

  case 98: /* with_item: expr delay WHEN wlist  */
#line 2060 "vhd2vl.y"
                                  {
            slist *sl;
              sl=addtxt(indents[indent],"    ");
              sl=addsl(sl,(yyvsp[0].sl));
              sl=addtxt(sl," : ");
              sl=addsl(sl,slwith);
              sl=addtxt(sl," <= ");
              if(delay && (yyvsp[-2].n)){
                sl=addtxt(sl,"# ");
                sl=addval(sl,(yyvsp[-2].n));
                sl=addtxt(sl," ");
              }
              if((yyvsp[-3].e)->op == 'c')
                sl=addsl(sl,addwrap("{",(yyvsp[-3].e)->sl,"}"));
              else
                sl=addsl(sl,(yyvsp[-3].e)->sl);
              free((yyvsp[-3].e));
              delay=1;
              (yyval.sl)=addtxt(sl,";\n");
            }
#line 4695 "vhd2vl.tab.c"
    break;

  case 99: /* p_decl: rem  */
#line 2081 "vhd2vl.y"
             {(yyval.sl)=(yyvsp[0].sl);}
#line 4701 "vhd2vl.tab.c"
    break;

  case 100: /* p_decl: rem VARIABLE s_list ':' type ';' p_decl  */
#line 2082 "vhd2vl.y"
                                                 {
         slist *sl;
         sglist *sg, *p;
           sl=addtxt((yyvsp[-6].sl),"    reg");
           sl=addpar(sl,(yyvsp[-2].v));
           free((yyvsp[-2].v));
           sg=(yyvsp[-4].sg);
           for(;;){
             sl=addtxt(sl,sg->name);
             p=sg;
             sg=sg->next;
             free(p);
             if(sg)
               sl=addtxt(sl,", ");
             else
               break;
           }
           sl=addtxt(sl,";\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4726 "vhd2vl.tab.c"
    break;

  case 101: /* p_decl: rem VARIABLE s_list ':' type ':' '=' expr ';' p_decl  */
#line 2102 "vhd2vl.y"
                                                              {
         slist *sl;
         sglist *sg, *p;
           sl=addtxt((yyvsp[-9].sl),"    reg");
           sl=addpar(sl,(yyvsp[-5].v));
           free((yyvsp[-5].v));
           sg=(yyvsp[-7].sg);
           for(;;){
             sl=addtxt(sl,sg->name);
             p=sg;
             sg=sg->next;
             free(p);
             if(sg)
               sl=addtxt(sl,", ");
             else
               break;
           }
           sl=addtxt(sl," = ");
           sl=addsl(sl,(yyvsp[-2].e)->sl);
           sl=addtxt(sl,";\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4753 "vhd2vl.tab.c"
    break;

  case 102: /* p_body: rem  */
#line 2126 "vhd2vl.y"
             {(yyval.sl)=(yyvsp[0].sl);}
#line 4759 "vhd2vl.tab.c"
    break;

  case 103: /* p_body: rem signal ':' '=' norem expr ';' yesrem p_body  */
#line 2128 "vhd2vl.y"
                                                          {
         slist *sl;
           sl=addsl((yyvsp[-8].sl),indents[indent]);
           sl=addsl(sl,(yyvsp[-7].ss)->sl);
           findothers((yyvsp[-7].ss),(yyvsp[-3].e)->sl);
           sl=addtxt(sl," = ");
           if((yyvsp[-3].e)->op == 'c')
             sl=addsl(sl,addwrap("{",(yyvsp[-3].e)->sl,"}"));
           else
             sl=addsl(sl,(yyvsp[-3].e)->sl);
           sl=addtxt(sl,";\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4777 "vhd2vl.tab.c"
    break;

  case 104: /* p_body: rem signal norem '<' '=' sigvalue yesrem p_body  */
#line 2142 "vhd2vl.y"
                                                          {
         slist *sl;
         sglist *sg;
         char *s;
           s=sbottom((yyvsp[-6].ss)->sl);
           if((sg=lookup(io_list,s))==NULL)
             sg=lookup(sig_list,s);
           if(sg)
             sg->type=reg;
           sl=addsl((yyvsp[-7].sl),indents[indent]);
           sl=addsl(sl,(yyvsp[-6].ss)->sl);
           findothers((yyvsp[-6].ss),(yyvsp[-2].sl));
           sl=addtxt(sl," <= ");
           sl=addsl(sl,(yyvsp[-2].sl));
           sl=addtxt(sl,";\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4799 "vhd2vl.tab.c"
    break;

  case 105: /* p_body: rem IF exprc THEN doindent p_body unindent elsepart END IF ';' p_body  */
#line 2160 "vhd2vl.y"
                                                                               {
         slist *sl;
           sl=addsl((yyvsp[-11].sl),indents[indent]);
           sl=addtxt(sl,"if(");
           sl=addsl(sl,(yyvsp[-9].sl));
           sl=addtxt(sl,") begin\n");
           sl=addsl(sl,(yyvsp[-6].sl));
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"end\n");
           sl=addsl(sl,(yyvsp[-4].sl));
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4816 "vhd2vl.tab.c"
    break;

  case 106: /* p_body: rem FOR signal IN expr TO expr LOOP doindent p_body unindent END LOOP ';' p_body  */
#line 2173 "vhd2vl.y"
                                                                                           {
         slist *sl;
           sl=addsl((yyvsp[-14].sl),indents[indent]);
           sl=addtxt(sl,"for (");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl,"=");
           sl=addsl(sl,(yyvsp[-10].e)->sl); /* expr:1 */
           sl=addtxt(sl,"; ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," <= ");
           sl=addsl(sl,(yyvsp[-8].e)->sl); /* expr:2 */
           sl=addtxt(sl,"; ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," = ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," + 1) begin\n");
           sl=addsl(sl,(yyvsp[-5].sl));    /* p_body:1 */
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"end\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));    /* p_body:2 */
         }
#line 4842 "vhd2vl.tab.c"
    break;

  case 107: /* p_body: rem FOR signal IN expr DOWNTO expr LOOP doindent p_body unindent END LOOP ';' p_body  */
#line 2195 "vhd2vl.y"
                                                                                               {
         slist *sl;
           sl=addsl((yyvsp[-14].sl),indents[indent]);
           sl=addtxt(sl,"for (");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl,"=");
           sl=addsl(sl,(yyvsp[-10].e)->sl); /* expr:1 */
           sl=addtxt(sl,"; ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," >= ");
           sl=addsl(sl,(yyvsp[-8].e)->sl); /* expr:2 */
           sl=addtxt(sl,"; ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," = ");
           sl=addsl(sl,(yyvsp[-12].ss)->sl); /* signal */
           sl=addtxt(sl," - 1) begin\n");
           sl=addsl(sl,(yyvsp[-5].sl));    /* p_body:1 */
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"end\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));    /* p_body:2 */
         }
#line 4868 "vhd2vl.tab.c"
    break;

  case 108: /* p_body: rem WHILE exprc LOOP doindent p_body unindent END LOOP ';' p_body  */
#line 2217 "vhd2vl.y"
                                                                           {
         slist *sl;
           sl=addsl((yyvsp[-10].sl),indents[indent]);
           sl=addtxt(sl,"while ");
           sl=addtxt(sl,"(");
           sl=addsl(sl,(yyvsp[-8].sl)); /* exprc */
           sl=addtxt(sl,") begin\n");
           sl=addsl(sl,(yyvsp[-5].sl));    /* p_body:1 */
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"end\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));    /* p_body:2 */
         }
#line 4885 "vhd2vl.tab.c"
    break;

  case 109: /* p_body: rem CASE signal IS rem cases END CASE ';' p_body  */
#line 2230 "vhd2vl.y"
                                                          {
         slist *sl;
           sl=addsl((yyvsp[-9].sl),indents[indent]);
           sl=addtxt(sl,"case(");
           sl=addsl(sl,(yyvsp[-7].ss)->sl); /* signal */
           sl=addtxt(sl,")\n");
           if((yyvsp[-5].sl)){
             sl=addsl(sl,indents[indent]);
             sl=addsl(sl,(yyvsp[-5].sl));
           }
           sl=addsl(sl,(yyvsp[-4].sl));
           sl=addsl(sl,indents[indent]);
           sl=addtxt(sl,"endcase\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4905 "vhd2vl.tab.c"
    break;

  case 110: /* p_body: rem EXIT ';' p_body  */
#line 2245 "vhd2vl.y"
                             {
         slist *sl;
           sl=addsl((yyvsp[-3].sl),indents[indent]);
           sl=addtxt(sl,"disable;  //VHD2VL: add block name here\n");
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));
         }
#line 4916 "vhd2vl.tab.c"
    break;

  case 111: /* p_body: rem NULLV ';' p_body  */
#line 2251 "vhd2vl.y"
                              {
         slist *sl;
           if((yyvsp[-3].sl)){
             sl=addsl((yyvsp[-3].sl),indents[indent]);
             (yyval.sl)=addsl(sl,(yyvsp[0].sl));
           }else
             (yyval.sl)=(yyvsp[0].sl);
         }
#line 4929 "vhd2vl.tab.c"
    break;

  case 112: /* elsepart: %empty  */
#line 2261 "vhd2vl.y"
           {(yyval.sl)=NULL;}
#line 4935 "vhd2vl.tab.c"
    break;

  case 113: /* elsepart: ELSIF exprc THEN doindent p_body unindent elsepart  */
#line 2262 "vhd2vl.y"
                                                              {
           slist *sl;
             sl=addtxt(indents[indent],"else if(");
             sl=addsl(sl,(yyvsp[-5].sl));
             sl=addtxt(sl,") begin\n");
             sl=addsl(sl,(yyvsp[-2].sl));
             sl=addsl(sl,indents[indent]);
             sl=addtxt(sl,"end\n");
             (yyval.sl)=addsl(sl,(yyvsp[0].sl));
           }
#line 4950 "vhd2vl.tab.c"
    break;

  case 114: /* elsepart: ELSE doindent p_body unindent  */
#line 2272 "vhd2vl.y"
                                         {
           slist *sl;
             sl=addtxt(indents[indent],"else begin\n");
             sl=addsl(sl,(yyvsp[-1].sl));
             sl=addsl(sl,indents[indent]);
             (yyval.sl)=addtxt(sl,"end\n");
           }
#line 4962 "vhd2vl.tab.c"
    break;

  case 115: /* cases: WHEN wlist '=' '>' doindent p_body unindent cases  */
#line 2281 "vhd2vl.y"
                                                         {
        slist *sl;
          sl=addsl(indents[indent],(yyvsp[-6].sl));
          sl=addtxt(sl," : begin\n");
          sl=addsl(sl,(yyvsp[-2].sl));
          sl=addsl(sl,indents[indent]);
          sl=addtxt(sl,"end\n");
          (yyval.sl)=addsl(sl,(yyvsp[0].sl));
        }
#line 4976 "vhd2vl.tab.c"
    break;

  case 116: /* cases: WHEN OTHERS '=' '>' doindent p_body unindent  */
#line 2290 "vhd2vl.y"
                                                     {
        slist *sl;
          sl=addtxt(indents[indent],"default : begin\n");
          sl=addsl(sl,(yyvsp[-1].sl));
          sl=addsl(sl,indents[indent]);
          (yyval.sl)=addtxt(sl,"end\n");
        }
#line 4988 "vhd2vl.tab.c"
    break;

  case 117: /* cases: %empty  */
#line 2297 "vhd2vl.y"
                    { (yyval.sl)=NULL; }
#line 4994 "vhd2vl.tab.c"
    break;

  case 118: /* wlist: wvalue  */
#line 2300 "vhd2vl.y"
               {(yyval.sl)=(yyvsp[0].sl);}
#line 5000 "vhd2vl.tab.c"
    break;

  case 119: /* wlist: wlist '|' wvalue  */
#line 2301 "vhd2vl.y"
                         {
        slist *sl;
          sl=addtxt((yyvsp[-2].sl),",");
          (yyval.sl)=addsl(sl,(yyvsp[0].sl));
        }
#line 5010 "vhd2vl.tab.c"
    break;

  case 120: /* wvalue: STRING  */
#line 2308 "vhd2vl.y"
                {(yyval.sl)=addvec(NULL,(yyvsp[0].txt));}
#line 5016 "vhd2vl.tab.c"
    break;

  case 121: /* wvalue: NAME STRING  */
#line 2309 "vhd2vl.y"
                     {(yyval.sl)=addvec_base(NULL,(yyvsp[-1].txt),(yyvsp[0].txt));}
#line 5022 "vhd2vl.tab.c"
    break;

  case 122: /* wvalue: NAME  */
#line 2310 "vhd2vl.y"
              {(yyval.sl)=addtxt(NULL,(yyvsp[0].txt));}
#line 5028 "vhd2vl.tab.c"
    break;

  case 123: /* sign_list: signal  */
#line 2313 "vhd2vl.y"
                   {(yyval.sl)=(yyvsp[0].ss)->sl; free((yyvsp[0].ss));}
#line 5034 "vhd2vl.tab.c"
    break;

  case 124: /* sign_list: signal ',' sign_list  */
#line 2314 "vhd2vl.y"
                                 {
            slist *sl;
              if (vlog_ver == 2001)
                 sl=addtxt((yyvsp[-2].ss)->sl,", ");
              else if (vlog_ver == 1995)
                 sl=addtxt((yyvsp[-2].ss)->sl," or ");
              else
                 sl=0;
              free((yyvsp[-2].ss));
              (yyval.sl)=addsl(sl,(yyvsp[0].sl));
            }
#line 5050 "vhd2vl.tab.c"
    break;

  case 125: /* sigvalue: expr delay ';'  */
#line 2327 "vhd2vl.y"
                          {
           slist *sl;
             if(delay && (yyvsp[-1].n)){
               sl=addtxt(NULL,"# ");
               sl=addval(sl,(yyvsp[-1].n));
               sl=addtxt(sl," ");
             } else
               sl=NULL;
             if((yyvsp[-2].e)->op == 'c')
               sl=addsl(sl,addwrap("{",(yyvsp[-2].e)->sl,"}"));
             else
               sl=addsl(sl,(yyvsp[-2].e)->sl);
             free((yyvsp[-2].e));
             delay=1;
             (yyval.sl)=sl;
           }
#line 5071 "vhd2vl.tab.c"
    break;

  case 126: /* sigvalue: expr delay WHEN exprc ';'  */
#line 2343 "vhd2vl.y"
                                     {
             fprintf(stderr,"WARNING (line %d): Can't translate 'expr delay WHEN exprc;' expressions.\n",lineno);
             (yyval.sl)=NULL;
           }
#line 5080 "vhd2vl.tab.c"
    break;

  case 127: /* sigvalue: expr delay WHEN exprc ELSE nodelay sigvalue  */
#line 2347 "vhd2vl.y"
                                                       {
           slist *sl;
             sl=addtxt((yyvsp[-3].sl)," ? ");
             if((yyvsp[-6].e)->op == 'c')
               sl=addsl(sl,addwrap("{",(yyvsp[-6].e)->sl,"}"));
             else
               sl=addsl(sl,(yyvsp[-6].e)->sl);
             free((yyvsp[-6].e));
             sl=addtxt(sl," : ");
             (yyval.sl)=addsl(sl,(yyvsp[0].sl));
           }
#line 5096 "vhd2vl.tab.c"
    break;

  case 128: /* nodelay: %empty  */
#line 2360 "vhd2vl.y"
                       {delay=0;}
#line 5102 "vhd2vl.tab.c"
    break;

  case 129: /* delay: %empty  */
#line 2363 "vhd2vl.y"
                       {(yyval.n)=0;}
#line 5108 "vhd2vl.tab.c"
    break;

  case 130: /* delay: AFTER NATURAL NAME  */
#line 2364 "vhd2vl.y"
                              {
             set_timescale((yyvsp[0].txt));
             (yyval.n)=(yyvsp[-1].n);
           }
#line 5117 "vhd2vl.tab.c"
    break;

  case 131: /* map_list: rem map_item  */
#line 2370 "vhd2vl.y"
                        {
           slist *sl;
           sl=addsl((yyvsp[-1].sl),indents[indent]);
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));}
#line 5126 "vhd2vl.tab.c"
    break;

  case 132: /* map_list: rem map_item ',' map_list  */
#line 2374 "vhd2vl.y"
                                     {
           slist *sl;
             sl=addsl((yyvsp[-3].sl),indents[indent]);
             sl=addsl(sl,(yyvsp[-2].sl));
             sl=addtxt(sl,",\n");
             (yyval.sl)=addsl(sl,(yyvsp[0].sl));
           }
#line 5138 "vhd2vl.tab.c"
    break;

  case 133: /* map_item: mvalue  */
#line 2383 "vhd2vl.y"
                  {(yyval.sl)=(yyvsp[0].sl);}
#line 5144 "vhd2vl.tab.c"
    break;

  case 134: /* map_item: NAME '=' '>' mvalue  */
#line 2384 "vhd2vl.y"
                               {
           slist *sl;
             sl=addtxt(NULL,".");
             sl=addtxt(sl,(yyvsp[-3].txt));
             sl=addtxt(sl,"(");
             sl=addsl(sl,(yyvsp[0].sl));
             (yyval.sl)=addtxt(sl,")");
           }
#line 5157 "vhd2vl.tab.c"
    break;

  case 135: /* mvalue: STRING  */
#line 2394 "vhd2vl.y"
                {(yyval.sl)=addvec(NULL,(yyvsp[0].txt));}
#line 5163 "vhd2vl.tab.c"
    break;

  case 136: /* mvalue: signal  */
#line 2395 "vhd2vl.y"
                {(yyval.sl)=addsl(NULL,(yyvsp[0].ss)->sl);}
#line 5169 "vhd2vl.tab.c"
    break;

  case 137: /* mvalue: NATURAL  */
#line 2396 "vhd2vl.y"
                 {(yyval.sl)=addval(NULL,(yyvsp[0].n));}
#line 5175 "vhd2vl.tab.c"
    break;

  case 138: /* mvalue: NAME STRING  */
#line 2397 "vhd2vl.y"
                     {(yyval.sl)=addvec_base(NULL,(yyvsp[-1].txt),(yyvsp[0].txt));}
#line 5181 "vhd2vl.tab.c"
    break;

  case 139: /* mvalue: OPEN  */
#line 2398 "vhd2vl.y"
              {(yyval.sl)=addtxt(NULL,"/* open */");}
#line 5187 "vhd2vl.tab.c"
    break;

  case 140: /* mvalue: '(' OTHERS '=' '>' STRING ')'  */
#line 2399 "vhd2vl.y"
                                       {
             (yyval.sl)=addtxt(NULL,"{broken{");
             (yyval.sl)=addtxt((yyval.sl),(yyvsp[-1].txt));
             (yyval.sl)=addtxt((yyval.sl),"}}");
             fprintf(stderr,"WARNING (line %d): broken width on port with OTHERS.\n",lineno);
           }
#line 5198 "vhd2vl.tab.c"
    break;

  case 141: /* $@1: %empty  */
#line 2405 "vhd2vl.y"
                     {convfunc2_is_port++;}
#line 5204 "vhd2vl.tab.c"
    break;

  case 142: /* mvalue: BITVECT '(' $@1 expr ')'  */
#line 2405 "vhd2vl.y"
                                                     {
             /* Type conversion function in port map */
             convfunc2_is_port--;
             (yyval.sl)=addsl(NULL,expr_to_sl((yyvsp[-1].e)));
             free((yyvsp[-4].txt));
           }
#line 5215 "vhd2vl.tab.c"
    break;

  case 143: /* $@2: %empty  */
#line 2411 "vhd2vl.y"
                        {convfunc1_sgn++;}
#line 5221 "vhd2vl.tab.c"
    break;

  case 144: /* mvalue: CONVFUNC_1 '(' $@2 expr ')'  */
#line 2411 "vhd2vl.y"
                                                    {
             /* Type conversion function in port map */
             convfunc1_sgn--;
             (yyval.sl)=addsl(NULL,expr_to_sl((yyvsp[-1].e)));
             free((yyvsp[-4].txt));
           }
#line 5232 "vhd2vl.tab.c"
    break;

  case 145: /* mvalue: CONVFUNC_2 '(' expr ',' expr ')'  */
#line 2417 "vhd2vl.y"
                                          {
             /* Two-argument type conversion in port map */
             int width_val = 0;
             int literal_val = 0;
             slist *lit;
             if (!(expdata_literal_int((yyvsp[-3].e), &literal_val))) {
               (yyval.sl)=addsl(NULL,expr_to_sl((yyvsp[-3].e)));
             } else if (expdata_literal_int((yyvsp[-1].e), &width_val)) {
               if (width_val > 0) {
                 if (literal_val == 0) {
                   lit=addval(NULL,width_val);
                   lit=addtxt(lit,"'b0");
                   (yyval.sl)=lit;
                 } else {
                   lit=build_dec_lit(width_val, NULL, literal_val);
                   (yyval.sl)=lit ? lit : addsl(NULL,expr_to_sl((yyvsp[-3].e)));
                 }
               } else if (width_val == 0 && literal_val == 0) {
                 free((yyvsp[-3].e));
                 free((yyvsp[-1].e));
                 (yyval.sl)=NULL; /* zero-width: drop from concat */
               } else {
                 (yyval.sl)=addsl(NULL,expr_to_sl((yyvsp[-3].e)));
               }
             } else if (literal_val >= 0) {
               lit=build_dec_lit(0, (yyvsp[-1].e)->sl, literal_val);
               (yyval.sl)=lit ? lit : addsl(NULL,expr_to_sl((yyvsp[-3].e)));
             } else {
               (yyval.sl)=addsl(NULL,expr_to_sl((yyvsp[-3].e)));
             }
           }
#line 5268 "vhd2vl.tab.c"
    break;

  case 146: /* generic_map_list: rem generic_map_item  */
#line 2451 "vhd2vl.y"
                                        {
           slist *sl;
           sl=addsl((yyvsp[-1].sl),indents[indent]);
           (yyval.sl)=addsl(sl,(yyvsp[0].sl));}
#line 5277 "vhd2vl.tab.c"
    break;

  case 147: /* generic_map_list: rem generic_map_item ',' generic_map_list  */
#line 2455 "vhd2vl.y"
                                                     {
           slist *sl;
             sl=addsl((yyvsp[-3].sl),indents[indent]);
             sl=addsl(sl,(yyvsp[-2].sl));
             sl=addtxt(sl,",\n");
             (yyval.sl)=addsl(sl,(yyvsp[0].sl));
           }
#line 5289 "vhd2vl.tab.c"
    break;

  case 148: /* generic_map_list: rem expr  */
#line 2462 "vhd2vl.y"
                    {  /* only allow a single un-named map item */
             (yyval.sl)=addsl(NULL,expr_to_sl((yyvsp[0].e)));
           }
#line 5297 "vhd2vl.tab.c"
    break;

  case 149: /* generic_map_item: NAME '=' '>' expr  */
#line 2467 "vhd2vl.y"
                                     {
           slist *sl;
             sl=addtxt(NULL,".");
             sl=addtxt(sl,(yyvsp[-3].txt));
             sl=addtxt(sl,"(");
             sl=addsl(sl,expr_to_sl((yyvsp[0].e)));
             (yyval.sl)=addtxt(sl,")");
           }
#line 5310 "vhd2vl.tab.c"
    break;

  case 150: /* signal: NAME  */
#line 2477 "vhd2vl.y"
              {
         slist *sl;
         slval *ss;
           ss=xmalloc(sizeof(slval));
           sl=new_signal((yyvsp[0].txt));
           if (!sl) YYABORT;
           if(dowith){
             slwith=sl;
             dowith=0;
           }
           ss->sl=sl;
           ss->val=-1;
           ss->range=NULL;
           (yyval.ss)=ss;
         }
#line 5330 "vhd2vl.tab.c"
    break;

  case 151: /* signal: NAME '(' vec_range ')'  */
#line 2492 "vhd2vl.y"
                                {
         slval *ss;
         slist *sl;
           ss=xmalloc(sizeof(slval));
           sl=new_signal((yyvsp[-3].txt));
           if (!sl) YYABORT;
           sl=addpar_snug(sl,(yyvsp[-1].v));
           if(dowith){
             slwith=sl;
             dowith=0;
           }
           ss->sl=sl;
           ss->range=(yyvsp[-1].v);
           if((yyvsp[-1].v)->vtype==tVRANGE) {
             if (0) {
               fprintf(stderr,"ss->val set to 1 for ");
               fslprint(stderr,ss->sl);
               fprintf(stderr,", why?\n");
             }
             ss->val = -1; /* width is in the vrange */
           } else {
             ss->val = 1;
           }
           (yyval.ss)=ss;
         }
#line 5360 "vhd2vl.tab.c"
    break;

  case 152: /* signal: NAME '(' vec_range ')' '(' vec_range ')'  */
#line 2517 "vhd2vl.y"
                                                  {
         slval *ss;
         slist *sl;
           ss=xmalloc(sizeof(slval));
           sl=new_signal((yyvsp[-6].txt));
           if (!sl) YYABORT;
           sl=addpar_snug2(sl,(yyvsp[-4].v), (yyvsp[-1].v));
           if(dowith){
             slwith=sl;
             dowith=0;
           }
           ss->sl=sl;
           ss->range=(yyvsp[-4].v);
           if((yyvsp[-4].v)->vtype==tVRANGE) {
             ss->val = -1; /* width is in the vrange */
           } else {
             ss->val = 1;
           }
           (yyval.ss)=ss;
         }
#line 5385 "vhd2vl.tab.c"
    break;

  case 153: /* expr: signal  */
#line 2540 "vhd2vl.y"
              {
         expdata *e;
           e=xmalloc(sizeof(expdata));
           e->op='t'; /* Terminal symbol */
           e->sl=(yyvsp[0].ss)->sl;
           free((yyvsp[0].ss));
           (yyval.e)=e;
         }
#line 5398 "vhd2vl.tab.c"
    break;

  case 154: /* expr: STRING  */
#line 2548 "vhd2vl.y"
              {
         expdata *e;
           e=xmalloc(sizeof(expdata));
           e->op='t'; /* Terminal symbol */
           e->sl=addvec(NULL,(yyvsp[0].txt));
           (yyval.e)=e;
         }
#line 5410 "vhd2vl.tab.c"
    break;

  case 155: /* expr: SCIENTIFIC  */
#line 2555 "vhd2vl.y"
                  {
         expdata *e=xmalloc(sizeof(expdata));
           e->op='t'; /* Terminal symbol */
           e->sl=addtxt(NULL,(yyvsp[0].txt));
           (yyval.e)=e;
         }
#line 5421 "vhd2vl.tab.c"
    break;

  case 156: /* expr: FLOAT  */
#line 2561 "vhd2vl.y"
             {
         expdata *e=xmalloc(sizeof(expdata));
           e->op='t'; /* Terminal symbol */
           e->sl=addtxt(NULL,(yyvsp[0].txt));
           (yyval.e)=e;
         }
#line 5432 "vhd2vl.tab.c"
    break;

  case 157: /* expr: NATURAL  */
#line 2567 "vhd2vl.y"
               {
         expdata *e=xmalloc(sizeof(expdata));
           e->op='t'; /* Terminal symbol */
           e->sl=addval(NULL,(yyvsp[0].n));
           (yyval.e)=e;
         }
#line 5443 "vhd2vl.tab.c"
    break;

  case 158: /* expr: NATURAL BASED  */
#line 2573 "vhd2vl.y"
                     {  /* e.g. 16#55aa# */
         /* XXX unify this code with addvec_base */
         expdata *e=xmalloc(sizeof(expdata));
         char *natval = xmalloc(strlen((yyvsp[0].txt))+34);
           e->op='t'; /* Terminal symbol */
           switch((yyvsp[-1].n)) {
           case  2:
             sprintf(natval, "'b%s",(yyvsp[0].txt));
             break;
           case  8:
             sprintf(natval, "'o%s",(yyvsp[0].txt));
             break;
           case 10:
             sprintf(natval, "'d%s",(yyvsp[0].txt));
             break;
           case 16:
             sprintf(natval, "'h%s",(yyvsp[0].txt));
             break;
           default:
             sprintf(natval,"%d#%s#",(yyvsp[-1].n),(yyvsp[0].txt));
             fprintf(stderr,"ERROR (line %d): can't translate based number %s (only bases of 2, 8, 10, and 16 are translatable).\n", lineno, natval);
             YYABORT;
           }
           e->sl=addtxt(NULL,natval);
           (yyval.e)=e;
         }
#line 5474 "vhd2vl.tab.c"
    break;

  case 159: /* expr: NAME STRING  */
#line 2599 "vhd2vl.y"
                   {
         expdata *e=xmalloc(sizeof(expdata));
           e->op='t'; /* Terminal symbol */
           e->sl=addvec_base(NULL,(yyvsp[-1].txt),(yyvsp[0].txt));
           (yyval.e)=e;
         }
#line 5485 "vhd2vl.tab.c"
    break;

  case 160: /* expr: '(' aggregate_list ')'  */
#line 2605 "vhd2vl.y"
                              {
          (yyval.e)=(yyvsp[-1].e);
        }
#line 5493 "vhd2vl.tab.c"
    break;

  case 161: /* expr: expr '&' expr  */
#line 2608 "vhd2vl.y"
                     { /* Vector chaining a.k.a. bit concatenation */
         slist *sl;
         int lhsw = ((yyvsp[-2].e)->op == 's' || (yyvsp[-2].e)->op == 'n') ? (yyvsp[-2].e)->value : -1;
         int rhsw = ((yyvsp[0].e)->op == 's' || (yyvsp[0].e)->op == 'n') ? (yyvsp[0].e)->value : -1;
         /* Drop zero-width literal side to avoid "{,x}" concat syntax. */
         if ((yyvsp[-2].e)->sl == NULL || ((yyvsp[-2].e)->op == 's' && (yyvsp[-2].e)->value == 0)) {
           free((yyvsp[-2].e));
           (yyval.e)=(yyvsp[0].e);
         } else if ((yyvsp[0].e)->sl == NULL || ((yyvsp[0].e)->op == 's' && (yyvsp[0].e)->value == 0)) {
           free((yyvsp[0].e));
           (yyval.e)=(yyvsp[-2].e);
         } else {
           sl=addtxt((yyvsp[-2].e)->sl,",");
           sl=addsl(sl,(yyvsp[0].e)->sl);
           free((yyvsp[0].e));
           (yyvsp[-2].e)->op='c';
           (yyvsp[-2].e)->sl=sl;
           if (lhsw > 0 && rhsw > 0) {
             (yyvsp[-2].e)->value = lhsw + rhsw;
           } else {
             (yyvsp[-2].e)->value = 0; /* unknown width */
           }
           (yyval.e)=(yyvsp[-2].e);
         }
       }
#line 5523 "vhd2vl.tab.c"
    break;

  case 162: /* expr: '-' expr  */
#line 2633 "vhd2vl.y"
                             {(yyval.e)=addexpr(NULL,'m'," -",(yyvsp[0].e));}
#line 5529 "vhd2vl.tab.c"
    break;

  case 163: /* expr: '+' expr  */
#line 2634 "vhd2vl.y"
                            {(yyval.e)=addexpr(NULL,'p'," +",(yyvsp[0].e));}
#line 5535 "vhd2vl.tab.c"
    break;

  case 164: /* expr: expr '+' expr  */
#line 2635 "vhd2vl.y"
                     {(yyval.e)=addexpr((yyvsp[-2].e),'+'," + ",(yyvsp[0].e));}
#line 5541 "vhd2vl.tab.c"
    break;

  case 165: /* expr: expr '-' expr  */
#line 2636 "vhd2vl.y"
                     {(yyval.e)=addexpr((yyvsp[-2].e),'-'," - ",(yyvsp[0].e));}
#line 5547 "vhd2vl.tab.c"
    break;

  case 166: /* expr: expr POW expr  */
#line 2637 "vhd2vl.y"
                     {(yyval.e)=addexpr((yyvsp[-2].e),'*'," ** ",(yyvsp[0].e));}
#line 5553 "vhd2vl.tab.c"
    break;

  case 167: /* expr: expr '*' expr  */
#line 2638 "vhd2vl.y"
                     {(yyval.e)=addexpr((yyvsp[-2].e),'*'," * ",(yyvsp[0].e));}
#line 5559 "vhd2vl.tab.c"
    break;

  case 168: /* expr: expr '/' expr  */
#line 2639 "vhd2vl.y"
                     {(yyval.e)=addexpr((yyvsp[-2].e),'/'," / ",(yyvsp[0].e));}
#line 5565 "vhd2vl.tab.c"
    break;

  case 169: /* expr: expr MOD expr  */
#line 2640 "vhd2vl.y"
                     {
         (yyval.e)=addexpr((yyvsp[-2].e),'%'," % ",(yyvsp[0].e));
         fprintf(stderr,"WARNING (line %d): MOD translation as %% is wrong when args have different signs.\n", lineno);
       }
#line 5574 "vhd2vl.tab.c"
    break;

  case 170: /* expr: expr RW_REM expr  */
#line 2644 "vhd2vl.y"
                        {(yyval.e)=addexpr((yyvsp[-2].e),'%'," % ",(yyvsp[0].e));}
#line 5580 "vhd2vl.tab.c"
    break;

  case 171: /* expr: NOT expr  */
#line 2645 "vhd2vl.y"
                {(yyval.e)=addexpr(NULL,'~'," ~",(yyvsp[0].e));}
#line 5586 "vhd2vl.tab.c"
    break;

  case 172: /* expr: ABS expr  */
#line 2646 "vhd2vl.y"
                {
        slist *sl;
          sl=addtxt(NULL,"( ( $signed(");
          sl= addsl(sl,(yyvsp[0].e)->sl);
          sl=addtxt(sl,") < 0 ) ? -$signed(");
          sl= addsl(sl,(yyvsp[0].e)->sl);
          sl=addtxt(sl,") : ");
          sl= addsl(sl,(yyvsp[0].e)->sl);
          sl=addtxt(sl," )");
          (yyvsp[0].e)->sl=sl;
          (yyval.e)=(yyvsp[0].e);
       }
#line 5603 "vhd2vl.tab.c"
    break;

  case 173: /* expr: expr AND expr  */
#line 2658 "vhd2vl.y"
                     {(yyval.e)=addexpr((yyvsp[-2].e),'&'," & ",(yyvsp[0].e));}
#line 5609 "vhd2vl.tab.c"
    break;

  case 174: /* expr: expr OR expr  */
#line 2659 "vhd2vl.y"
                    {(yyval.e)=addexpr((yyvsp[-2].e),'|'," | ",(yyvsp[0].e));}
#line 5615 "vhd2vl.tab.c"
    break;

  case 175: /* expr: expr NAND expr  */
#line 2660 "vhd2vl.y"
                      {(yyval.e)=addexpr(NULL,'~'," ~",addexpr((yyvsp[-2].e),'&'," & ",(yyvsp[0].e)));}
#line 5621 "vhd2vl.tab.c"
    break;

  case 176: /* expr: expr NOR expr  */
#line 2661 "vhd2vl.y"
                     {(yyval.e)=addexpr(NULL,'~'," ~",addexpr((yyvsp[-2].e),'|'," | ",(yyvsp[0].e)));}
#line 5627 "vhd2vl.tab.c"
    break;

  case 177: /* expr: expr XOR expr  */
#line 2662 "vhd2vl.y"
                     {(yyval.e)=addexpr((yyvsp[-2].e),'^'," ^ ",(yyvsp[0].e));}
#line 5633 "vhd2vl.tab.c"
    break;

  case 178: /* expr: expr XNOR expr  */
#line 2663 "vhd2vl.y"
                      {(yyval.e)=addexpr(NULL,'~'," ~",addexpr((yyvsp[-2].e),'^'," ^ ",(yyvsp[0].e)));}
#line 5639 "vhd2vl.tab.c"
    break;

  case 179: /* expr: expr SLL expr  */
#line 2664 "vhd2vl.y"
                     {
         (yyval.e)=addexpr((yyvsp[-2].e),'*'," << ",(yyvsp[0].e));
         fprintf(stderr,"WARNING (line %d): SLL translated as logical shift.\n", lineno);
         fprintf(stderr," Replace << by <<< in the resulting Verilog for the arithmetic version.\n");
       }
#line 5649 "vhd2vl.tab.c"
    break;

  case 180: /* expr: SHIFT_LEFT '(' expr ',' expr ')'  */
#line 2669 "vhd2vl.y"
                                        {
         (yyval.e)=addexpr((yyvsp[-3].e),'*'," << ",(yyvsp[-1].e));
         fprintf(stderr,"WARNING (line %d): SHIFT_LEFT() translated as logical shift.\n", lineno);
         fprintf(stderr," Replace << by <<< in the resulting Verilog for the arithmetic version.\n");
       }
#line 5659 "vhd2vl.tab.c"
    break;

  case 181: /* expr: expr SRL expr  */
#line 2674 "vhd2vl.y"
                     {
         (yyval.e)=addexpr((yyvsp[-2].e),'*'," >> ",(yyvsp[0].e));
         fprintf(stderr,"WARNING (line %d): SRL translated as logical shift.\n", lineno);
         fprintf(stderr," Replace >> by >>> in the resulting Verilog for the arithmetic version.\n");
       }
#line 5669 "vhd2vl.tab.c"
    break;

  case 182: /* expr: SHIFT_RIGHT '(' expr ',' expr ')'  */
#line 2679 "vhd2vl.y"
                                         {
         (yyval.e)=addexpr((yyvsp[-3].e),'*'," >> ",(yyvsp[-1].e));
         fprintf(stderr,"WARNING (line %d): SHIFT_RIGHT() translated as logical shift.\n", lineno);
         fprintf(stderr," Replace >> by >>> in the resulting Verilog for the arithmetic version.\n");
       }
#line 5679 "vhd2vl.tab.c"
    break;

  case 183: /* expr: expr SLA expr  */
#line 2684 "vhd2vl.y"
                     {
         fprintf(stderr,"ERROR (line %d): SLA must not be used.\n", lineno);
         fprintf(stderr,"Use SHIFT_LEFT/SLL from NUMERIC_STD with type SIGNED.\n");
         YYABORT;
       }
#line 5689 "vhd2vl.tab.c"
    break;

  case 184: /* expr: expr SRA expr  */
#line 2689 "vhd2vl.y"
                     {
         fprintf(stderr,"ERROR (line %d): SRA must not be used.\n", lineno);
         fprintf(stderr," Use SHIFT_RIGHT/SRL from NUMERIC_STD with type SIGNED.\n");
         YYABORT;
       }
#line 5699 "vhd2vl.tab.c"
    break;

  case 185: /* expr: expr ROR expr  */
#line 2694 "vhd2vl.y"
                     {
         fprintf(stderr,"ERROR (line %d): ROR is not implemented yet.\n", lineno);
         YYABORT;
       }
#line 5708 "vhd2vl.tab.c"
    break;

  case 186: /* expr: ROTATE_RIGHT '(' expr ',' expr ')'  */
#line 2698 "vhd2vl.y"
                                          {
         fprintf(stderr,"ERROR (line %d): ROTATE_RIGHT is not implemented yet.\n", lineno);
         YYABORT;
       }
#line 5717 "vhd2vl.tab.c"
    break;

  case 187: /* expr: expr ROL expr  */
#line 2702 "vhd2vl.y"
                     {
         fprintf(stderr,"ERROR (line %d): ROL is not implemented yet.\n", lineno);
         YYABORT;
       }
#line 5726 "vhd2vl.tab.c"
    break;

  case 188: /* expr: ROTATE_LEFT '(' expr ',' expr ')'  */
#line 2706 "vhd2vl.y"
                                         {
         fprintf(stderr,"ERROR (line %d): ROTATE_LEFT is not implemented yet.\n", lineno);
         YYABORT;
       }
#line 5735 "vhd2vl.tab.c"
    break;

  case 189: /* expr: BITVECT '(' expr ')'  */
#line 2710 "vhd2vl.y"
                            {
       /* single argument type conversion function e.g. std_logic_vector(x) */
       /* signed and unsigned are preserved as expr */
       if ((yyvsp[-3].txt) && strcmp((yyvsp[-3].txt), "signed") == 0) {
         if (convfunc1_sgn) {
           expdata *e=xmalloc(sizeof(expdata));
           e->op='S';
           e->sl=wrap_sgn_expr((yyvsp[-1].e),1);
           free((yyvsp[-1].e));
           (yyval.e)=e;
         } else {
           (yyval.e) = addnest((yyvsp[-1].e));
         }
       } else if ((yyvsp[-3].txt) && strcmp((yyvsp[-3].txt), "unsigned") == 0) {
         if (convfunc1_sgn) {
           expdata *e=xmalloc(sizeof(expdata));
           e->op='U';
           e->sl=wrap_sgn_expr((yyvsp[-1].e),0);
           free((yyvsp[-1].e));
           (yyval.e)=e;
         } else {
           (yyval.e) = addnest((yyvsp[-1].e));
         }
       } else {
         (yyval.e) = addnest((yyvsp[-1].e));
       }
       free((yyvsp[-3].txt));
      }
#line 5768 "vhd2vl.tab.c"
    break;

  case 190: /* $@3: %empty  */
#line 2738 "vhd2vl.y"
                      {convfunc1_sgn++;}
#line 5774 "vhd2vl.tab.c"
    break;

  case 191: /* expr: CONVFUNC_1 '(' $@3 expr ')'  */
#line 2738 "vhd2vl.y"
                                                  {
       convfunc1_sgn--;
       (yyval.e) = addnest((yyvsp[-1].e));
       free((yyvsp[-4].txt));
      }
#line 5784 "vhd2vl.tab.c"
    break;

  case 192: /* expr: CONVFUNC_2 '(' expr ',' expr ')'  */
#line 2743 "vhd2vl.y"
                                        {
       /* two argument type conversion e.g. to_signed(x, 3) */
       int width_val = 0;
       int literal_val = 0;

       if (!(expdata_literal_int((yyvsp[-3].e), &literal_val))) {
         (yyval.e) = addnest((yyvsp[-3].e));
         free((yyvsp[-1].e));
       } else if (expdata_literal_int((yyvsp[-1].e), &width_val)) {
         if (literal_val < 0) {
           if (width_val > 0) {
             expdata *e=xmalloc(sizeof(expdata));
             e->op='t';
             e->sl=build_dec_lit(width_val, NULL, literal_val);
             free((yyvsp[-3].e));
             free((yyvsp[-1].e));
             (yyval.e)=e;
           } else {
             (yyval.e) = addnest((yyvsp[-3].e));
             free((yyvsp[-1].e));
           }
         } else if (width_val == 0 && literal_val == 0) {
           expdata *e=xmalloc(sizeof(expdata));
           e->op='s';
           e->value=0;  /* width zero: let concat prune */
           e->sl=NULL;
           free((yyvsp[-3].e));
           free((yyvsp[-1].e));
           (yyval.e)=e;
         } else if (width_val > 0) {
           if (literal_val == 0 || convfunc2_is_port) {
             expdata *e=xmalloc(sizeof(expdata));
             slist *lit;
             if (literal_val == 0) {
               lit=addval(NULL,width_val);
               lit=addtxt(lit,"'b0");
             } else {
               lit=build_dec_lit(width_val, NULL, literal_val);
             }
             e->op='s';
             e->value=width_val;
             e->sl=lit;
             free((yyvsp[-3].e));
             free((yyvsp[-1].e));
             (yyval.e)=e;
           } else {
             (yyval.e) = addnest((yyvsp[-3].e));
             free((yyvsp[-1].e));
           }
         } else {
           (yyval.e) = addnest((yyvsp[-3].e));
           free((yyvsp[-1].e));
         }
       } else if (literal_val >= 0) {
         expdata *e=xmalloc(sizeof(expdata));
         slist *lit = build_dec_lit(0, (yyvsp[-1].e)->sl, literal_val);
         if (lit) {
           e->op='t';
           e->sl=lit;
           free((yyvsp[-3].e));
           free((yyvsp[-1].e));
           (yyval.e)=e;
         } else {
           free(e);
           (yyval.e) = addnest((yyvsp[-3].e));
           free((yyvsp[-1].e));
         }
       } else {
         (yyval.e) = addnest((yyvsp[-3].e));
         free((yyvsp[-1].e));
       }
      }
#line 5861 "vhd2vl.tab.c"
    break;

  case 193: /* expr: '(' expr ')'  */
#line 2815 "vhd2vl.y"
                    {
       (yyval.e) = addnest((yyvsp[-1].e));
      }
#line 5869 "vhd2vl.tab.c"
    break;

  case 194: /* aggregate_item: OTHERS '=' '>' expr  */
#line 2820 "vhd2vl.y"
                                     {
        (yyval.sl)=addothers(NULL,(yyvsp[0].e)->sl);
      }
#line 5877 "vhd2vl.tab.c"
    break;

  case 195: /* aggregate_item: expr DOWNTO expr '=' '>' expr  */
#line 2823 "vhd2vl.y"
                                    {
        /* Aggregate expression: (high downto low => value) */
        /* Translates to Verilog: {width{value}} */
        (yyval.sl)=aggregate((yyvsp[-5].e),(yyvsp[-3].e),(yyvsp[0].e));
      }
#line 5887 "vhd2vl.tab.c"
    break;

  case 196: /* aggregate_item: expr TO expr '=' '>' expr  */
#line 2828 "vhd2vl.y"
                                {
        /* Aggregate expression: (low to high => value) */
        /* Translates to Verilog: {width{value}} */
        (yyval.sl)=aggregate((yyvsp[-3].e),(yyvsp[-5].e),(yyvsp[0].e));
      }
#line 5897 "vhd2vl.tab.c"
    break;

  case 197: /* aggregate_list: aggregate_item  */
#line 2835 "vhd2vl.y"
                                {
      expdata *e;
        e=xmalloc(sizeof(expdata));
        e->op='t';  /* Terminal symbol */
        e->sl=(yyvsp[0].sl);
        (yyval.e)=e;
      }
#line 5909 "vhd2vl.tab.c"
    break;

  case 198: /* aggregate_list: aggregate_item ',' aggregate_list  */
#line 2842 "vhd2vl.y"
                                        {
        slist *sl;
        sl=addsl(NULL,(yyvsp[-2].sl));
        sl=addtxt(sl,",");
        sl=addsl(sl,(yyvsp[0].e)->sl);
        (yyvsp[0].e)->sl=sl;
        (yyvsp[0].e)->op='c';  /* Chain */
        (yyval.e)=(yyvsp[0].e);
      }
#line 5923 "vhd2vl.tab.c"
    break;

  case 199: /* exprc: conf  */
#line 2854 "vhd2vl.y"
             { (yyval.sl)=(yyvsp[0].sl); }
#line 5929 "vhd2vl.tab.c"
    break;

  case 200: /* exprc: '(' exprc ')'  */
#line 2855 "vhd2vl.y"
                      {
         (yyval.sl)=addwrap("(",(yyvsp[-1].sl),")");
      }
#line 5937 "vhd2vl.tab.c"
    break;

  case 201: /* exprc: exprc AND exprc  */
#line 2858 "vhd2vl.y"
                                   {
        slist *sl;
          sl=addtxt((yyvsp[-2].sl)," && ");
          (yyval.sl)=addsl(sl,(yyvsp[0].sl));
        }
#line 5947 "vhd2vl.tab.c"
    break;

  case 202: /* exprc: exprc NAND exprc  */
#line 2863 "vhd2vl.y"
                                     {
        slist *sl;
          sl=addtxt(NULL,"!(");
          sl= addsl(sl,(yyvsp[-2].sl));
          sl=addtxt(sl," && ");
          sl= addsl(sl,(yyvsp[0].sl));
          (yyval.sl)=addtxt(sl,")");
        }
#line 5960 "vhd2vl.tab.c"
    break;

  case 203: /* exprc: exprc OR exprc  */
#line 2871 "vhd2vl.y"
                                 {
        slist *sl;
          sl=addtxt((yyvsp[-2].sl)," || ");
          (yyval.sl)=addsl(sl,(yyvsp[0].sl));
        }
#line 5970 "vhd2vl.tab.c"
    break;

  case 204: /* exprc: exprc NOR exprc  */
#line 2876 "vhd2vl.y"
                                   {
        slist *sl;
          sl=addtxt(NULL,"!(");
          sl= addsl(sl,(yyvsp[-2].sl));
          sl=addtxt(sl," || ");
          sl= addsl(sl,(yyvsp[0].sl));
          (yyval.sl)=addtxt(sl,")");
        }
#line 5983 "vhd2vl.tab.c"
    break;

  case 205: /* exprc: NOT exprc  */
#line 2884 "vhd2vl.y"
                             {
        slist *sl;
          sl=addtxt(NULL,"!");
          (yyval.sl)=addsl(sl,(yyvsp[0].sl));
        }
#line 5993 "vhd2vl.tab.c"
    break;

  case 206: /* conf: expr '=' expr  */
#line 2892 "vhd2vl.y"
                                 {
       (yyval.sl)=build_compare((yyvsp[-2].e)," == ",(yyvsp[0].e));
       }
#line 6001 "vhd2vl.tab.c"
    break;

  case 207: /* conf: expr '>' expr  */
#line 2895 "vhd2vl.y"
                     {
       (yyval.sl)=build_compare((yyvsp[-2].e)," > ",(yyvsp[0].e));
       }
#line 6009 "vhd2vl.tab.c"
    break;

  case 208: /* conf: expr '>' '=' expr  */
#line 2898 "vhd2vl.y"
                                     {
       (yyval.sl)=build_compare((yyvsp[-3].e)," >= ",(yyvsp[0].e));
       }
#line 6017 "vhd2vl.tab.c"
    break;

  case 209: /* conf: expr '<' expr  */
#line 2901 "vhd2vl.y"
                     {
       (yyval.sl)=build_compare((yyvsp[-2].e)," < ",(yyvsp[0].e));
       }
#line 6025 "vhd2vl.tab.c"
    break;

  case 210: /* conf: expr '<' '=' expr  */
#line 2904 "vhd2vl.y"
                                      {
       (yyval.sl)=build_compare((yyvsp[-3].e)," <= ",(yyvsp[0].e));
       }
#line 6033 "vhd2vl.tab.c"
    break;

  case 211: /* conf: expr '/' '=' expr  */
#line 2907 "vhd2vl.y"
                                     {
       (yyval.sl)=build_compare((yyvsp[-3].e)," != ",(yyvsp[0].e));
       }
#line 6041 "vhd2vl.tab.c"
    break;

  case 212: /* simple_expr: signal  */
#line 2912 "vhd2vl.y"
                     {
         expdata *e;
         e=xmalloc(sizeof(expdata));
         e->op='t'; /* Terminal symbol */
         e->sl=(yyvsp[0].ss)->sl;
         free((yyvsp[0].ss));
         (yyval.e)=e;
      }
#line 6054 "vhd2vl.tab.c"
    break;

  case 213: /* simple_expr: BITVECT '(' simple_expr ')'  */
#line 2920 "vhd2vl.y"
                                   {
         /* signed/unsigned type conversions inside simple_expr */
         if ((yyvsp[-3].txt) && strcmp((yyvsp[-3].txt), "signed") == 0) {
           if (convfunc1_sgn) {
             expdata *e=xmalloc(sizeof(expdata));
             e->op='S';
             e->sl=wrap_sgn_expr((yyvsp[-1].e),1);
             free((yyvsp[-1].e));
             (yyval.e)=e;
           } else {
             (yyval.e) = addnest((yyvsp[-1].e));
           }
         } else if ((yyvsp[-3].txt) && strcmp((yyvsp[-3].txt), "unsigned") == 0) {
           if (convfunc1_sgn) {
             expdata *e=xmalloc(sizeof(expdata));
             e->op='U';
             e->sl=wrap_sgn_expr((yyvsp[-1].e),0);
             free((yyvsp[-1].e));
             (yyval.e)=e;
           } else {
             (yyval.e) = addnest((yyvsp[-1].e));
           }
         } else {
           (yyval.e) = addnest((yyvsp[-1].e));
         }
         free((yyvsp[-3].txt));
      }
#line 6086 "vhd2vl.tab.c"
    break;

  case 214: /* simple_expr: STRING  */
#line 2947 "vhd2vl.y"
              {
         expdata *e;
         size_t len = strlen((yyvsp[0].txt));
         e=xmalloc(sizeof(expdata));
         if (len == 0) {
           e->op='s';
           e->value=0;
           e->sl=NULL; /* zero-width literal: drop in concatenation */
         } else {
           e->op='s';
           e->value=len;
           e->sl=addvec(NULL,(yyvsp[0].txt));
         }
         (yyval.e)=e;
      }
#line 6106 "vhd2vl.tab.c"
    break;

  case 215: /* simple_expr: NATURAL  */
#line 2962 "vhd2vl.y"
               {
         expdata *e;
         e=xmalloc(sizeof(expdata));
         e->op='n'; /* natural */
         e->value=(yyvsp[0].n);
         e->sl=addval(NULL,(yyvsp[0].n));
         (yyval.e)=e;
      }
#line 6119 "vhd2vl.tab.c"
    break;

  case 216: /* simple_expr: '-' simple_expr  */
#line 2970 "vhd2vl.y"
                                    {
         /* Unary minus for simple_expr (needed for ranges like -1+23 downto 0) */
        if ((yyvsp[0].e)->op == 'n') {
          expdata *e=xmalloc(sizeof(expdata));
          e->op='n';
          e->value = -(yyvsp[0].e)->value;
          e->sl=addval(NULL,e->value);
          free((yyvsp[0].e));
          (yyval.e)=e;
        } else {
          (yyval.e)=addexpr(NULL,'m'," -",(yyvsp[0].e));
        }
      }
#line 6137 "vhd2vl.tab.c"
    break;

  case 217: /* simple_expr: NAME '\'' LEFT  */
#line 2983 "vhd2vl.y"
                      {
	      /* lookup NAME and get its left */
              sglist *sg = NULL;
              if((sg=lookup(io_list,(yyvsp[-2].txt)))==NULL) {
                sg=lookup(sig_list,(yyvsp[-2].txt));
              }
              if(sg) {
                expdata *e;
                e=xmalloc(sizeof(expdata));
                e->sl=addwrap("(",sg->range->nhi,")");  /* XXX left vs. high? */
                e->op='t';
                (yyval.e)=e;
              } else {
                fprintf(stderr,"ERROR (line %d): undefined left \"%s'left\".\n", lineno, (yyvsp[-2].txt));
                YYABORT;
              }
      }
#line 6159 "vhd2vl.tab.c"
    break;

  case 218: /* simple_expr: simple_expr '+' simple_expr  */
#line 3000 "vhd2vl.y"
                                   {
       (yyval.e)=addexpr((yyvsp[-2].e),'+'," + ",(yyvsp[0].e));
      }
#line 6167 "vhd2vl.tab.c"
    break;

  case 219: /* simple_expr: simple_expr '-' simple_expr  */
#line 3003 "vhd2vl.y"
                                   {
       (yyval.e)=addexpr((yyvsp[-2].e),'-'," - ",(yyvsp[0].e));
      }
#line 6175 "vhd2vl.tab.c"
    break;

  case 220: /* simple_expr: simple_expr POW simple_expr  */
#line 3006 "vhd2vl.y"
                                   {
       (yyval.e)=addexpr((yyvsp[-2].e),'*'," ** ",(yyvsp[0].e));
      }
#line 6183 "vhd2vl.tab.c"
    break;

  case 221: /* simple_expr: simple_expr '*' simple_expr  */
#line 3009 "vhd2vl.y"
                                   {
       (yyval.e)=addexpr((yyvsp[-2].e),'*'," * ",(yyvsp[0].e));
      }
#line 6191 "vhd2vl.tab.c"
    break;

  case 222: /* simple_expr: simple_expr '/' simple_expr  */
#line 3012 "vhd2vl.y"
                                   {
       (yyval.e)=addexpr((yyvsp[-2].e),'/'," / ",(yyvsp[0].e));
      }
#line 6199 "vhd2vl.tab.c"
    break;

  case 223: /* $@4: %empty  */
#line 3015 "vhd2vl.y"
                      {convfunc1_sgn++;}
#line 6205 "vhd2vl.tab.c"
    break;

  case 224: /* simple_expr: CONVFUNC_1 '(' $@4 simple_expr ')'  */
#line 3015 "vhd2vl.y"
                                                         {
       /* one argument type conversion e.g. to_integer(x) */
       expdata *e;
       e=xmalloc(sizeof(expdata));
       convfunc1_sgn--;
       e->sl=addsl(NULL,(yyvsp[-1].e)->sl);
       e->op='e';
       (yyval.e)=e;
       free((yyvsp[-4].txt));
      }
#line 6220 "vhd2vl.tab.c"
    break;

  case 225: /* simple_expr: '(' simple_expr ')'  */
#line 3025 "vhd2vl.y"
                           {
       expdata *e;
       e=xmalloc(sizeof(expdata));
       /* e->sl=addwrap("(",$2->sl,")"); */
       e->sl=addsl(NULL,(yyvsp[-1].e)->sl);
       e->op='e';
       (yyval.e)=e;
      }
#line 6233 "vhd2vl.tab.c"
    break;


#line 6237 "vhd2vl.tab.c"

      default: break;
    }
  /* User semantic actions sometimes alter yychar, and that requires
     that yytoken be updated with the new translation.  We take the
     approach of translating immediately before every use of yytoken.
     One alternative is translating here after every semantic action,
     but that translation would be missed if the semantic action invokes
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
     incorrect destructor might then be invoked immediately.  In the
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
     to an incorrect destructor call or verbose syntax error message
     before the lookahead is translated.  */
  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;

  *++yyvsp = yyval;

  /* Now 'shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */
  {
    const int yylhs = yyr1[yyn] - YYNTOKENS;
    const int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }

  goto yynewstate;


/*--------------------------------------.
| yyerrlab -- here on detecting error.  |
`--------------------------------------*/
yyerrlab:
  /* Make sure we have latest lookahead translation.  See comments at
     user semantic actions for why this is necessary.  */
  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
      {
        yypcontext_t yyctx
          = {yyssp, yytoken};
        char const *yymsgp = YY_("syntax error");
        int yysyntax_error_status;
        yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
        if (yysyntax_error_status == 0)
          yymsgp = yymsg;
        else if (yysyntax_error_status == -1)
          {
            if (yymsg != yymsgbuf)
              YYSTACK_FREE (yymsg);
            yymsg = YY_CAST (char *,
                             YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
            if (yymsg)
              {
                yysyntax_error_status
                  = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
                yymsgp = yymsg;
              }
            else
              {
                yymsg = yymsgbuf;
                yymsg_alloc = sizeof yymsgbuf;
                yysyntax_error_status = YYENOMEM;
              }
          }
        yyerror (yymsgp);
        if (yysyntax_error_status == YYENOMEM)
          YYNOMEM;
      }
    }

  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
         error, discard it.  */

      if (yychar <= YYEOF)
        {
          /* Return failure if at end of input.  */
          if (yychar == YYEOF)
            YYABORT;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = YYEMPTY;
        }
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:
  /* Pacify compilers when the user code never invokes YYERROR and the
     label yyerrorlab therefore never appears in user code.  */
  if (0)
    YYERROR;
  ++yynerrs;

  /* Do not reclaim the symbols of the rule whose action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */

  /* Pop stack until we find a state that shifts the error token.  */
  for (;;)
    {
      yyn = yypact[yystate];
      if (!yypact_value_is_default (yyn))
        {
          yyn += YYSYMBOL_YYerror;
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
        YYABORT;


      yydestruct ("Error: popping",
                  YY_ACCESSING_SYMBOL (yystate), yyvsp);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END


  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturnlab;


/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturnlab;


/*-----------------------------------------------------------.
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
`-----------------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  goto yyreturnlab;


/*----------------------------------------------------------.
| yyreturnlab -- parsing is finished, clean up and return.  |
`----------------------------------------------------------*/
yyreturnlab:
  if (yychar != YYEMPTY)
    {
      /* Make sure we have latest lookahead translation.  See comments at
         user semantic actions for why this is necessary.  */
      yytoken = YYTRANSLATE (yychar);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  /* Do not reclaim the symbols of the rule whose action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
  return yyresult;
}

#line 3035 "vhd2vl.y"


const char *outfile;    /* Output file */
const char *sourcefile; /* Input file */

void print_usage(void) {
   printf(
      "Usage: vhd2vl [--debug] [--quiet] [--std 1995|2001] [--version] source_file.vhd > target_file.v\n"
      "   or  vhd2vl [--debug] [--quiet] [--std 1995|2001] [--version] source_file.vhd target_file.v\n"
   );
}

int main(int argc, char **argv){
int i,j;
char *s;
slist *sl;
int status;
int opt;
static int quiet;

  static struct option options[] = {
    {"debug",     no_argument,       &yydebug,  1  },
    {"quiet",     no_argument,       &quiet,    1  },
    {"std",       required_argument, 0,        's' },
    {"help",      no_argument,       0,        'h' },
    {"version",   no_argument,       0,        'v' },
    {0,           0,                 0,         0  }
  };

  /* Init the indentation variables */
  indents[0]=NULL;
  for(i=1;i<MAXINDENT;i++){
    indents[i]=sl=xmalloc(sizeof(slist));
    sl->data.txt=s=xmalloc(sizeof(char) *((i<<1)+1));
    for(j=0;j<(i<<1);j++)
      *s++=' ';
    *s=0;
    sl->type=tTXT;
    sl->slst=NULL;
  }

  while ((opt = getopt_long(argc, argv,"s:h", options, 0 )) != -1) {
    switch (opt) {
      case 0:
         break;
      case 's':
        vlog_ver = atoi(optarg);
        if (vlog_ver != 1995 && vlog_ver != 2001) {
           print_usage();
           exit(EXIT_FAILURE);
        }
        break;
      case 'v':
#ifdef GIT_BASED_VERS
        printf("vhd2vl version " VHD2VL_VER " (git commit " GIT_BASED_VERS ")\n");
#else
        printf("vhd2vl version " VHD2VL_VER "\n");
#endif
        exit(EXIT_SUCCESS);
      default:
        print_usage();
        exit(EXIT_SUCCESS);
    }
  }

  sourcefile = "-";
  outfile    = "-";
  if (optind < argc) {
     sourcefile = argv[optind++];
     if (strcmp(sourcefile,"-")!=0 && !freopen(sourcefile, "r", stdin)) {
        fprintf(stderr, "ERROR: Can't open input file '%s'.\n", sourcefile);
        return(1);
     }
  } else {
    print_usage();
    exit(EXIT_FAILURE);
  }
  if (optind < argc) {
     outfile = argv[optind++];
     if (strcmp(outfile,"-")!=0 && !freopen(outfile, "w", stdout)) {
        fprintf(stderr, "ERROR: Can't open output file '%s'.\n", outfile);
        return(1);
     }
  }
  if (optind < argc) {
     print_usage();
     exit(EXIT_FAILURE);
  }

  if (!quiet) {
     printf("// File %s translated with vhd2vl " VHD2VL_VER " VHDL to Verilog RTL translator\n", sourcefile);
     printf("// vhd2vl settings:\n"
            "//  * Verilog Module Declaration Style: %d\n\n", vlog_ver);
     fputs(
"// vhd2vl is Free (libre) Software:\n"
"//   Copyright (C) 2001-2023 Vincenzo Liguori - Ocean Logic Pty Ltd\n"
"//     http://www.ocean-logic.com\n"
"//   Modifications Copyright (C) 2006 Mark Gonzales - PMC Sierra Inc\n"
"//   Modifications (C) 2010 Shankar Giri\n"
"//   Modifications Copyright (C) 2002-2023 Larry Doolittle\n"
"//     http://doolittle.icarus.com/~larry/vhd2vl/\n"
"//   Modifications (C) 2017 Rodrigo A. Melo\n"
"//\n", stdout);
     fputs(
"//   vhd2vl comes with ABSOLUTELY NO WARRANTY.  Always check the resulting\n"
"//   Verilog for correctness, ideally with a formal verification tool.\n"
"//\n"
"//   You are welcome to redistribute vhd2vl under certain conditions.\n"
"//   See the license (GPLv2) file included with the source for details.\n\n"
"// The result of translation follows.  Its copyright status should be\n"
"// considered unchanged from the original VHDL.\n\n"
     , stdout);
  }
  status = yyparse();
  fclose(stdout);
  fclose(stdin);
  if (status != 0 && strcmp(outfile,"-")!=0) unlink(outfile);
  return status;
}
