/* original parser id follows */
/* zzsccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
/* (use ZZMAJOR/ZZMINOR for ifdefs dependent on parser version) */

#define ZZBYACC 1
#define ZZMAJOR 2
#define ZZMINOR 0

#define ZZEMPTY        (-1)
#define zzclearin      (zzchar = ZZEMPTY)
#define zzerrok        (zzerrflag = 0)
#define ZZRECOVERING() (zzerrflag != 0)
#define ZZENOMEM       (-2)
#define ZZEOF          0
#undef ZZBTYACC
#define ZZBTYACC 0
#define ZZDEBUGSTR ZZPREFIX "debug"
#define ZZPREFIX "zz"

#define ZZPURE 0

#line 2 "ifyacc.y"
/*************************************************************************

    ifyacc.y	1.9
    yacc parser for #if statements

    Copyright 1997 Willows Software, Inc. 

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.

This library 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
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; see the file COPYING.LIB.  If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.

The maintainer of the Willows TWIN Libraries may be reached (Email) 
at the address twin@willows.com	

**************************************************************************/

#include <stdio.h>
#include "rc.h"
#include "define.h"
#include "buffer.h"

extern int zzerror(char *);
extern int zzlex();

extern int ifResult;

#if defined(TWIN_HAVEALLOCA)
#include <alloca.h>
#endif
#ifdef ZZSTYPE
#undef  ZZSTYPE_IS_DECLARED
#define ZZSTYPE_IS_DECLARED 1
#endif
#ifndef ZZSTYPE_IS_DECLARED
#define ZZSTYPE_IS_DECLARED 1
#line 44 "ifyacc.y"
typedef union
{
  int i;
  char *str;
} ZZSTYPE;
#endif /* !ZZSTYPE_IS_DECLARED */
#line 77 "y.tab.c"

/* compatibility with bison */
#ifdef ZZPARSE_PARAM
/* compatibility with FreeBSD */
# ifdef ZZPARSE_PARAM_TYPE
#  define ZZPARSE_DECL() zzparse(ZZPARSE_PARAM_TYPE ZZPARSE_PARAM)
# else
#  define ZZPARSE_DECL() zzparse(void *ZZPARSE_PARAM)
# endif
#else
# define ZZPARSE_DECL() zzparse(void)
#endif

/* Parameters sent to lex. */
#ifdef ZZLEX_PARAM
# define ZZLEX_DECL() zzlex(void *ZZLEX_PARAM)
# define ZZLEX zzlex(ZZLEX_PARAM)
#else
# define ZZLEX_DECL() zzlex(void)
# define ZZLEX zzlex()
#endif

#if !(defined(zzlex) || defined(ZZSTATE))
int ZZLEX_DECL();
#endif

/* Parameters sent to zzerror. */
#ifndef ZZERROR_DECL
#define ZZERROR_DECL() zzerror(const char *s)
#endif
#ifndef ZZERROR_CALL
#define ZZERROR_CALL(msg) zzerror(msg)
#endif

extern int ZZPARSE_DECL();

#define ifINT 257
#define ifSTRING 258
#define ifDEFINED 259
#define ifnDEFINED 260
#define ifPREPROCESSORIF 261
#define ZZERRCODE 256
typedef int ZZINT;
static const ZZINT zzlhs[] = {                           -1,
    0,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    1,    1,    1,    1,
};
static const ZZINT zzlen[] = {                            2,
    2,    1,    1,    3,    3,    3,    3,    3,    3,    3,
    4,    4,    3,    2,    3,    3,    4,    4,    4,    4,
    4,    2,    4,    2,
};
static const ZZINT zzdefred[] = {                         0,
    0,    0,    2,    3,    0,    0,    0,    0,    0,   22,
    0,   24,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,   13,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,   21,   23,    0,    0,    0,    0,
    0,    0,
};
#if defined(ZZDESTRUCT_CALL) || defined(ZZSTYPE_TOSTRING)
static const ZZINT zzstos[] = {                           0,
  261,  263,  257,  258,  259,  260,   33,   40,  264,  258,
   40,  258,   40,  264,  264,   33,   43,   45,   42,   47,
   37,   38,  124,   60,   62,   61,  258,  258,   41,   61,
  264,  264,  264,  264,  264,   38,  264,  124,  264,   61,
  264,   61,  264,   61,   41,   41,  264,  264,  264,  264,
  264,  264,
};
#endif /* ZZDESTRUCT_CALL || ZZSTYPE_TOSTRING */
static const ZZINT zzdgoto[] = {                          2,
    9,
};
static const ZZINT zzsindex[] = {                      -258,
  -17,    0,    0,    0,  -39,  -38,  -17,  -17,  234,    0,
 -249,    0, -245,  234,  223,  -47,  -17,  -17,  -17,  -17,
  -17,  -33,  -29,  -25,  -21,  -43,  -20,  -14,    0,  -17,
   77,   77,  -28,  -28,  -28,  -17,  -36,  -17,  -36,  -17,
  -41,  -17,  -41,  -17,    0,    0,  -41,  -36,  -36,  -41,
  -41,  -41,
};
static const ZZINT zzrindex[] = {                         0,
    0,    0,    0,    0,    0,    0,    0,    0,   29,    0,
    0,    0,    0,   22,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  173,  274,   28,  110,  269,    0,  134,    0,  149,    0,
    6,    0,   17,    0,    0,    0,   45,  162,  212,   56,
   84,  123,
};
#if ZZBTYACC
static const ZZINT zzcindex[] = {                         0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,
};
#endif
static const ZZINT zzgindex[] = {                         0,
  321,
};
#define ZZTABLESIZE 365
static const ZZINT zztable[] = {                          7,
   11,   13,    1,    7,   36,   16,    8,    7,   27,   22,
    8,    7,   28,   30,    8,    7,   15,   44,    8,   26,
   45,   14,    8,   24,   26,   25,   46,    6,    1,    0,
    0,   24,   26,   25,    0,   40,    0,    0,   16,   42,
    0,    0,   16,   16,   20,    0,   16,   16,   16,   15,
   16,    0,   16,   15,   15,   18,    0,   15,   15,   15,
    6,   15,   14,   15,    6,   16,    0,   16,    6,    6,
    6,    0,    6,    0,    6,    0,   15,   20,   15,    0,
    0,   20,   20,   17,    0,   20,   20,   20,   18,   20,
    0,   20,   18,   18,   38,   23,   18,   18,   18,    0,
   18,    0,   18,    0,   20,    0,   20,    0,    0,    7,
    0,    0,    0,   21,   22,   18,   17,   18,   19,    0,
   17,   17,   19,   20,   17,   17,   17,    0,   17,   16,
   17,    0,    0,   10,    0,    0,   24,   26,   25,    0,
   15,    0,    7,   17,    0,   17,    7,    0,    9,    0,
    7,    7,    7,    0,    7,   19,    7,    0,    0,   19,
   19,   12,    0,   19,   19,   19,   10,   19,   20,   19,
   10,   10,    4,    0,   10,   10,   10,    0,   10,   18,
   10,    9,   19,    0,   19,    9,    9,    0,    0,    9,
    9,    9,    0,    9,   12,    9,    0,    0,   12,   12,
   23,    0,   12,   12,   12,    4,   12,   17,   12,    0,
    0,   11,    0,    4,    0,    4,    0,    4,   10,   12,
    0,    0,    0,    3,    4,    5,    6,    3,    4,    5,
    6,    3,    4,    5,    6,    3,    4,    5,    6,    3,
    4,    5,    6,    0,   11,    0,   19,    0,   11,   11,
    0,    0,   11,   11,   11,   16,   11,   10,   11,   21,
   22,    0,    0,   29,   19,   17,   16,   18,    8,   20,
   21,   22,    9,    5,    0,   19,   17,    0,   18,    0,
   20,    0,   24,   26,   25,   12,    0,    0,    0,    0,
    0,    0,    0,   24,   26,   25,    0,    0,    0,    0,
    0,    8,    0,    0,    0,    8,    5,    0,    0,    8,
    8,    8,    0,    8,    5,    8,    5,    0,    5,    0,
    0,    0,    0,    0,    0,    0,    0,   14,   15,    0,
    0,    0,    0,    0,    0,   11,    0,   31,   32,   33,
   34,   35,   37,   39,   41,   43,   23,    0,    0,    0,
   47,    0,    0,    0,    0,    0,   48,   23,   49,    0,
   50,    0,   51,    0,   52,
};
static const ZZINT zzcheck[] = {                         33,
   40,   40,  261,   33,   38,    0,   40,   33,  258,   38,
   40,   33,  258,   61,   40,   33,    0,   61,   40,   61,
   41,    0,   40,   60,   61,   62,   41,    0,    0,   -1,
   -1,   60,   61,   62,   -1,   61,   -1,   -1,   33,   61,
   -1,   -1,   37,   38,    0,   -1,   41,   42,   43,   33,
   45,   -1,   47,   37,   38,    0,   -1,   41,   42,   43,
   33,   45,   41,   47,   37,   60,   -1,   62,   41,   42,
   43,   -1,   45,   -1,   47,   -1,   60,   33,   62,   -1,
   -1,   37,   38,    0,   -1,   41,   42,   43,   33,   45,
   -1,   47,   37,   38,  124,  124,   41,   42,   43,   -1,
   45,   -1,   47,   -1,   60,   -1,   62,   -1,   -1,    0,
   -1,   -1,   -1,   37,   38,   60,   33,   62,   42,   -1,
   37,   38,    0,   47,   41,   42,   43,   -1,   45,  124,
   47,   -1,   -1,    0,   -1,   -1,   60,   61,   62,   -1,
  124,   -1,   33,   60,   -1,   62,   37,   -1,    0,   -1,
   41,   42,   43,   -1,   45,   33,   47,   -1,   -1,   37,
   38,    0,   -1,   41,   42,   43,   33,   45,  124,   47,
   37,   38,    0,   -1,   41,   42,   43,   -1,   45,  124,
   47,   33,   60,   -1,   62,   37,   38,   -1,   -1,   41,
   42,   43,   -1,   45,   33,   47,   -1,   -1,   37,   38,
  124,   -1,   41,   42,   43,   33,   45,  124,   47,   -1,
   -1,    0,   -1,   41,   -1,   43,   -1,   45,  258,  258,
   -1,   -1,   -1,  257,  258,  259,  260,  257,  258,  259,
  260,  257,  258,  259,  260,  257,  258,  259,  260,  257,
  258,  259,  260,   -1,   33,   -1,  124,   -1,   37,   38,
   -1,   -1,   41,   42,   43,   33,   45,  124,   47,   37,
   38,   -1,   -1,   41,   42,   43,   33,   45,    0,   47,
   37,   38,  124,    0,   -1,   42,   43,   -1,   45,   -1,
   47,   -1,   60,   61,   62,  124,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   60,   61,   62,   -1,   -1,   -1,   -1,
   -1,   33,   -1,   -1,   -1,   37,   33,   -1,   -1,   41,
   42,   43,   -1,   45,   41,   47,   43,   -1,   45,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,    7,    8,   -1,
   -1,   -1,   -1,   -1,   -1,  124,   -1,   17,   18,   19,
   20,   21,   22,   23,   24,   25,  124,   -1,   -1,   -1,
   30,   -1,   -1,   -1,   -1,   -1,   36,  124,   38,   -1,
   40,   -1,   42,   -1,   44,
};
#if ZZBTYACC
static const ZZINT zzctable[] = {                        -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,
};
#endif
#define ZZFINAL 2
#ifndef ZZDEBUG
#define ZZDEBUG 0
#endif
#define ZZMAXTOKEN 261
#define ZZUNDFTOKEN 265
#define ZZTRANSLATE(a) ((a) > ZZMAXTOKEN ? ZZUNDFTOKEN : (a))
#if ZZDEBUG
static const char *const zzname[] = {

"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'!'",0,
0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,
0,"'<'","'='","'>'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,"error","ifINT","ifSTRING","ifDEFINED","ifnDEFINED",
"ifPREPROCESSORIF","$accept","preprocessorifclause","expr","illegal-symbol",
};
static const char *const zzrule[] = {
"$accept : preprocessorifclause",
"preprocessorifclause : ifPREPROCESSORIF expr",
"expr : ifINT",
"expr : ifSTRING",
"expr : expr '+' expr",
"expr : expr '-' expr",
"expr : expr '*' expr",
"expr : expr '/' expr",
"expr : expr '%' expr",
"expr : expr '|' expr",
"expr : expr '&' expr",
"expr : expr '|' '|' expr",
"expr : expr '&' '&' expr",
"expr : '(' expr ')'",
"expr : '!' expr",
"expr : expr '>' expr",
"expr : expr '<' expr",
"expr : expr '>' '=' expr",
"expr : expr '<' '=' expr",
"expr : expr '=' '=' expr",
"expr : expr '!' '=' expr",
"expr : ifDEFINED '(' ifSTRING ')'",
"expr : ifDEFINED ifSTRING",
"expr : ifnDEFINED '(' ifSTRING ')'",
"expr : ifnDEFINED ifSTRING",

};
#endif

#if ZZDEBUG
int      zzdebug;
#endif

int      zzerrflag;
int      zzchar;
ZZSTYPE  zzval;
ZZSTYPE  zzlval;
int      zznerrs;

#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
ZZLTYPE  zzloc; /* position returned by actions */
ZZLTYPE  zzlloc; /* position from the lexer */
#endif

#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
#ifndef ZZLLOC_DEFAULT
#define ZZLLOC_DEFAULT(loc, rhs, n) \
do \
{ \
    if (n == 0) \
    { \
        (loc).first_line   = ZZRHSLOC(rhs, 0).last_line; \
        (loc).first_column = ZZRHSLOC(rhs, 0).last_column; \
        (loc).last_line    = ZZRHSLOC(rhs, 0).last_line; \
        (loc).last_column  = ZZRHSLOC(rhs, 0).last_column; \
    } \
    else \
    { \
        (loc).first_line   = ZZRHSLOC(rhs, 1).first_line; \
        (loc).first_column = ZZRHSLOC(rhs, 1).first_column; \
        (loc).last_line    = ZZRHSLOC(rhs, n).last_line; \
        (loc).last_column  = ZZRHSLOC(rhs, n).last_column; \
    } \
} while (0)
#endif /* ZZLLOC_DEFAULT */
#endif /* defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED) */
#if ZZBTYACC

#ifndef ZZLVQUEUEGROWTH
#define ZZLVQUEUEGROWTH 32
#endif
#endif /* ZZBTYACC */

/* define the initial stack-sizes */
#ifdef ZZSTACKSIZE
#undef ZZMAXDEPTH
#define ZZMAXDEPTH  ZZSTACKSIZE
#else
#ifdef ZZMAXDEPTH
#define ZZSTACKSIZE ZZMAXDEPTH
#else
#define ZZSTACKSIZE 10000
#define ZZMAXDEPTH  10000
#endif
#endif

#ifndef ZZINITSTACKSIZE
#define ZZINITSTACKSIZE 200
#endif

typedef struct {
    unsigned stacksize;
    ZZINT    *s_base;
    ZZINT    *s_mark;
    ZZINT    *s_last;
    ZZSTYPE  *l_base;
    ZZSTYPE  *l_mark;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    ZZLTYPE  *p_base;
    ZZLTYPE  *p_mark;
#endif
} ZZSTACKDATA;
#if ZZBTYACC

struct ZZParseState_s
{
    struct ZZParseState_s *save;    /* Previously saved parser state */
    ZZSTACKDATA            zzstack; /* saved parser stack */
    int                    state;   /* saved parser state */
    int                    errflag; /* saved error recovery status */
    int                    lexeme;  /* saved index of the conflict lexeme in the lexical queue */
    ZZINT                  ctry;    /* saved index in zzctable[] for this conflict */
};
typedef struct ZZParseState_s ZZParseState;
#endif /* ZZBTYACC */
/* variables for the parser stack */
static ZZSTACKDATA zzstack;
#if ZZBTYACC

/* Current parser state */
static ZZParseState *zzps = 0;

/* zzpath != NULL: do the full parse, starting at *zzpath parser state. */
static ZZParseState *zzpath = 0;

/* Base of the lexical value queue */
static ZZSTYPE *zzlvals = 0;

/* Current position at lexical value queue */
static ZZSTYPE *zzlvp = 0;

/* End position of lexical value queue */
static ZZSTYPE *zzlve = 0;

/* The last allocated position at the lexical value queue */
static ZZSTYPE *zzlvlim = 0;

#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
/* Base of the lexical position queue */
static ZZLTYPE *zzlpsns = 0;

/* Current position at lexical position queue */
static ZZLTYPE *zzlpp = 0;

/* End position of lexical position queue */
static ZZLTYPE *zzlpe = 0;

/* The last allocated position at the lexical position queue */
static ZZLTYPE *zzlplim = 0;
#endif

/* Current position at lexical token queue */
static ZZINT  *zzlexp = 0;

static ZZINT  *zzlexemes = 0;
#endif /* ZZBTYACC */
#line 94 "ifyacc.y"

int zzerror(char *str)
{
  CERROR(("%s", str));
  return 0;
}
#line 485 "y.tab.c"

/* For use in generated program */
#define zzdepth (int)(zzstack.s_mark - zzstack.s_base)
#if ZZBTYACC
#define zztrial (zzps->save)
#endif /* ZZBTYACC */

#if ZZDEBUG
#include <stdio.h>	/* needed for printf */
#endif

#include <stdlib.h>	/* needed for malloc, etc */
#include <string.h>	/* needed for memset */

/* allocate initial stack or double stack size, up to ZZMAXDEPTH */
static int zzgrowstack(ZZSTACKDATA *data)
{
    int i;
    unsigned newsize;
    ZZINT *newss;
    ZZSTYPE *newvs;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    ZZLTYPE *newps;
#endif

    if ((newsize = data->stacksize) == 0)
        newsize = ZZINITSTACKSIZE;
    else if (newsize >= ZZMAXDEPTH)
        return ZZENOMEM;
    else if ((newsize *= 2) > ZZMAXDEPTH)
        newsize = ZZMAXDEPTH;

    i = (int) (data->s_mark - data->s_base);
    newss = (ZZINT *)realloc(data->s_base, newsize * sizeof(*newss));
    if (newss == 0)
        return ZZENOMEM;

    data->s_base = newss;
    data->s_mark = newss + i;

    newvs = (ZZSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
    if (newvs == 0)
        return ZZENOMEM;

    data->l_base = newvs;
    data->l_mark = newvs + i;

#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    newps = (ZZLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
    if (newps == 0)
        return ZZENOMEM;

    data->p_base = newps;
    data->p_mark = newps + i;
#endif

    data->stacksize = newsize;
    data->s_last = data->s_base + newsize - 1;

#if ZZDEBUG
    if (zzdebug)
        fprintf(stderr, "%sdebug: stack size increased to %d\n", ZZPREFIX, newsize);
#endif
    return 0;
}

#if ZZPURE || defined(ZZ_NO_LEAKS)
static void zzfreestack(ZZSTACKDATA *data)
{
    free(data->s_base);
    free(data->l_base);
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    free(data->p_base);
#endif
    memset(data, 0, sizeof(*data));
}
#else
#define zzfreestack(data) /* nothing */
#endif /* ZZPURE || defined(ZZ_NO_LEAKS) */
#if ZZBTYACC

static ZZParseState *
zzNewState(unsigned size)
{
    ZZParseState *p = (ZZParseState *) malloc(sizeof(ZZParseState));
    if (p == NULL) return NULL;

    p->zzstack.stacksize = size;
    if (size == 0)
    {
        p->zzstack.s_base = NULL;
        p->zzstack.l_base = NULL;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
        p->zzstack.p_base = NULL;
#endif
        return p;
    }
    p->zzstack.s_base    = (ZZINT *) malloc(size * sizeof(ZZINT));
    if (p->zzstack.s_base == NULL) return NULL;
    p->zzstack.l_base    = (ZZSTYPE *) malloc(size * sizeof(ZZSTYPE));
    if (p->zzstack.l_base == NULL) return NULL;
    memset(p->zzstack.l_base, 0, size * sizeof(ZZSTYPE));
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    p->zzstack.p_base    = (ZZLTYPE *) malloc(size * sizeof(ZZLTYPE));
    if (p->zzstack.p_base == NULL) return NULL;
    memset(p->zzstack.p_base, 0, size * sizeof(ZZLTYPE));
#endif

    return p;
}

static void
zzFreeState(ZZParseState *p)
{
    zzfreestack(&p->zzstack);
    free(p);
}
#endif /* ZZBTYACC */

#define ZZABORT  goto zzabort
#define ZZREJECT goto zzabort
#define ZZACCEPT goto zzaccept
#define ZZERROR  goto zzerrlab
#if ZZBTYACC
#define ZZVALID        do { if (zzps->save)            goto zzvalid; } while(0)
#define ZZVALID_NESTED do { if (zzps->save && \
                                zzps->save->save == 0) goto zzvalid; } while(0)
#endif /* ZZBTYACC */

int
ZZPARSE_DECL()
{
    int zzm, zzn, zzstate, zzresult;
#if ZZBTYACC
    int zznewerrflag;
    ZZParseState *zzerrctx = NULL;
#endif /* ZZBTYACC */
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    ZZLTYPE  zzerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if ZZDEBUG
    const char *zzs;

    if ((zzs = getenv("ZZDEBUG")) != 0)
    {
        zzn = *zzs;
        if (zzn >= '0' && zzn <= '9')
            zzdebug = zzn - '0';
    }
    if (zzdebug)
        fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", ZZPREFIX);
#endif
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    memset(zzerror_loc_range, 0, sizeof(zzerror_loc_range));
#endif

#if ZZBTYACC
    zzps = zzNewState(0); if (zzps == 0) goto zzenomem;
    zzps->save = 0;
#endif /* ZZBTYACC */
    zzm = 0;
    zzn = 0;
    zznerrs = 0;
    zzerrflag = 0;
    zzchar = ZZEMPTY;
    zzstate = 0;

#if ZZPURE
    memset(&zzstack, 0, sizeof(zzstack));
#endif

    if (zzstack.s_base == NULL && zzgrowstack(&zzstack) == ZZENOMEM) goto zzoverflow;
    zzstack.s_mark = zzstack.s_base;
    zzstack.l_mark = zzstack.l_base;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    zzstack.p_mark = zzstack.p_base;
#endif
    zzstate = 0;
    *zzstack.s_mark = 0;

zzloop:
    if ((zzn = zzdefred[zzstate]) != 0) goto zzreduce;
    if (zzchar < 0)
    {
#if ZZBTYACC
        do {
        if (zzlvp < zzlve)
        {
            /* we're currently re-reading tokens */
            zzlval = *zzlvp++;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
            zzlloc = *zzlpp++;
#endif
            zzchar = *zzlexp++;
            break;
        }
        if (zzps->save)
        {
            /* in trial mode; save scanner results for future parse attempts */
            if (zzlvp == zzlvlim)
            {   /* Enlarge lexical value queue */
                size_t p = (size_t) (zzlvp - zzlvals);
                size_t s = (size_t) (zzlvlim - zzlvals);

                s += ZZLVQUEUEGROWTH;
                if ((zzlexemes = (ZZINT *)realloc(zzlexemes, s * sizeof(ZZINT))) == NULL) goto zzenomem;
                if ((zzlvals   = (ZZSTYPE *)realloc(zzlvals, s * sizeof(ZZSTYPE))) == NULL) goto zzenomem;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                if ((zzlpsns   = (ZZLTYPE *)realloc(zzlpsns, s * sizeof(ZZLTYPE))) == NULL) goto zzenomem;
#endif
                zzlvp   = zzlve = zzlvals + p;
                zzlvlim = zzlvals + s;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                zzlpp   = zzlpe = zzlpsns + p;
                zzlplim = zzlpsns + s;
#endif
                zzlexp  = zzlexemes + p;
            }
            *zzlexp = (ZZINT) ZZLEX;
            *zzlvp++ = zzlval;
            zzlve++;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
            *zzlpp++ = zzlloc;
            zzlpe++;
#endif
            zzchar = *zzlexp++;
            break;
        }
        /* normal operation, no conflict encountered */
#endif /* ZZBTYACC */
        zzchar = ZZLEX;
#if ZZBTYACC
        } while (0);
#endif /* ZZBTYACC */
        if (zzchar < 0) zzchar = ZZEOF;
#if ZZDEBUG
        if (zzdebug)
        {
            if ((zzs = zzname[ZZTRANSLATE(zzchar)]) == NULL) zzs = zzname[ZZUNDFTOKEN];
            fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
                            ZZDEBUGSTR, zzdepth, zzstate, zzchar, zzs);
#ifdef ZZSTYPE_TOSTRING
#if ZZBTYACC
            if (!zztrial)
#endif /* ZZBTYACC */
                fprintf(stderr, " <%s>", ZZSTYPE_TOSTRING(zzchar, zzlval));
#endif
            fputc('\n', stderr);
        }
#endif
    }
#if ZZBTYACC

    /* Do we have a conflict? */
    if (((zzn = zzcindex[zzstate]) != 0) && (zzn += zzchar) >= 0 &&
        zzn <= ZZTABLESIZE && zzcheck[zzn] == (ZZINT) zzchar)
    {
        ZZINT ctry;

        if (zzpath)
        {
            ZZParseState *save;
#if ZZDEBUG
            if (zzdebug)
                fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
                                ZZDEBUGSTR, zzdepth, zzstate);
#endif
            /* Switch to the next conflict context */
            save = zzpath;
            zzpath = save->save;
            save->save = NULL;
            ctry = save->ctry;
            if (save->state != zzstate) ZZABORT;
            zzFreeState(save);

        }
        else
        {

            /* Unresolved conflict - start/continue trial parse */
            ZZParseState *save;
#if ZZDEBUG
            if (zzdebug)
            {
                fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", ZZDEBUGSTR, zzdepth, zzstate);
                if (zzps->save)
                    fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
                else
                    fputs("Starting trial parse.\n", stderr);
            }
#endif
            save                  = zzNewState((unsigned)(zzstack.s_mark - zzstack.s_base + 1));
            if (save == NULL) goto zzenomem;
            save->save            = zzps->save;
            save->state           = zzstate;
            save->errflag         = zzerrflag;
            save->zzstack.s_mark  = save->zzstack.s_base + (zzstack.s_mark - zzstack.s_base);
            memcpy (save->zzstack.s_base, zzstack.s_base, (size_t) (zzstack.s_mark - zzstack.s_base + 1) * sizeof(ZZINT));
            save->zzstack.l_mark  = save->zzstack.l_base + (zzstack.l_mark - zzstack.l_base);
            memcpy (save->zzstack.l_base, zzstack.l_base, (size_t) (zzstack.l_mark - zzstack.l_base + 1) * sizeof(ZZSTYPE));
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
            save->zzstack.p_mark  = save->zzstack.p_base + (zzstack.p_mark - zzstack.p_base);
            memcpy (save->zzstack.p_base, zzstack.p_base, (size_t) (zzstack.p_mark - zzstack.p_base + 1) * sizeof(ZZLTYPE));
#endif
            ctry                  = zztable[zzn];
            if (zzctable[ctry] == -1)
            {
#if ZZDEBUG
                if (zzdebug && zzchar >= ZZEOF)
                    fprintf(stderr, "%s[%d]: backtracking 1 token\n", ZZDEBUGSTR, zzdepth);
#endif
                ctry++;
            }
            save->ctry = ctry;
            if (zzps->save == NULL)
            {
                /* If this is a first conflict in the stack, start saving lexemes */
                if (!zzlexemes)
                {
                    zzlexemes = (ZZINT *) malloc((ZZLVQUEUEGROWTH) * sizeof(ZZINT));
                    if (zzlexemes == NULL) goto zzenomem;
                    zzlvals   = (ZZSTYPE *) malloc((ZZLVQUEUEGROWTH) * sizeof(ZZSTYPE));
                    if (zzlvals == NULL) goto zzenomem;
                    zzlvlim   = zzlvals + ZZLVQUEUEGROWTH;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                    zzlpsns   = (ZZLTYPE *) malloc((ZZLVQUEUEGROWTH) * sizeof(ZZLTYPE));
                    if (zzlpsns == NULL) goto zzenomem;
                    zzlplim   = zzlpsns + ZZLVQUEUEGROWTH;
#endif
                }
                if (zzlvp == zzlve)
                {
                    zzlvp  = zzlve = zzlvals;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                    zzlpp  = zzlpe = zzlpsns;
#endif
                    zzlexp = zzlexemes;
                    if (zzchar >= ZZEOF)
                    {
                        *zzlve++ = zzlval;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                        *zzlpe++ = zzlloc;
#endif
                        *zzlexp  = (ZZINT) zzchar;
                        zzchar   = ZZEMPTY;
                    }
                }
            }
            if (zzchar >= ZZEOF)
            {
                zzlvp--;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                zzlpp--;
#endif
                zzlexp--;
                zzchar = ZZEMPTY;
            }
            save->lexeme = (int) (zzlvp - zzlvals);
            zzps->save   = save;
        }
        if (zztable[zzn] == ctry)
        {
#if ZZDEBUG
            if (zzdebug)
                fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
                                ZZDEBUGSTR, zzdepth, zzstate, zzctable[ctry]);
#endif
            if (zzchar < 0)
            {
                zzlvp++;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                zzlpp++;
#endif
                zzlexp++;
            }
            if (zzstack.s_mark >= zzstack.s_last && zzgrowstack(&zzstack) == ZZENOMEM)
                goto zzoverflow;
            zzstate = zzctable[ctry];
            *++zzstack.s_mark = (ZZINT) zzstate;
            *++zzstack.l_mark = zzlval;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
            *++zzstack.p_mark = zzlloc;
#endif
            zzchar  = ZZEMPTY;
            if (zzerrflag > 0) --zzerrflag;
            goto zzloop;
        }
        else
        {
            zzn = zzctable[ctry];
            goto zzreduce;
        }
    } /* End of code dealing with conflicts */
#endif /* ZZBTYACC */
    if (((zzn = zzsindex[zzstate]) != 0) && (zzn += zzchar) >= 0 &&
            zzn <= ZZTABLESIZE && zzcheck[zzn] == (ZZINT) zzchar)
    {
#if ZZDEBUG
        if (zzdebug)
            fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
                            ZZDEBUGSTR, zzdepth, zzstate, zztable[zzn]);
#endif
        if (zzstack.s_mark >= zzstack.s_last && zzgrowstack(&zzstack) == ZZENOMEM) goto zzoverflow;
        zzstate = zztable[zzn];
        *++zzstack.s_mark = zztable[zzn];
        *++zzstack.l_mark = zzlval;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
        *++zzstack.p_mark = zzlloc;
#endif
        zzchar = ZZEMPTY;
        if (zzerrflag > 0)  --zzerrflag;
        goto zzloop;
    }
    if (((zzn = zzrindex[zzstate]) != 0) && (zzn += zzchar) >= 0 &&
            zzn <= ZZTABLESIZE && zzcheck[zzn] == (ZZINT) zzchar)
    {
        zzn = zztable[zzn];
        goto zzreduce;
    }
    if (zzerrflag != 0) goto zzinrecovery;
#if ZZBTYACC

    zznewerrflag = 1;
    goto zzerrhandler;
    goto zzerrlab; /* redundant goto avoids 'unused label' warning */

zzerrlab:
    /* explicit ZZERROR from an action -- pop the rhs of the rule reduced
     * before looking for error recovery */
    zzstack.s_mark -= zzm;
    zzstate = *zzstack.s_mark;
    zzstack.l_mark -= zzm;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    zzstack.p_mark -= zzm;
#endif

    zznewerrflag = 0;
zzerrhandler:
    while (zzps->save)
    {
        int ctry;
        ZZParseState *save = zzps->save;
#if ZZDEBUG
        if (zzdebug)
            fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
                            ZZDEBUGSTR, zzdepth, zzstate, zzps->save->state,
                    (int)(zzlvp - zzlvals - zzps->save->lexeme));
#endif
        /* Memorize most forward-looking error state in case it's really an error. */
        if (zzerrctx == NULL || zzerrctx->lexeme < zzlvp - zzlvals)
        {
            /* Free old saved error context state */
            if (zzerrctx) zzFreeState(zzerrctx);
            /* Create and fill out new saved error context state */
            zzerrctx                 = zzNewState((unsigned)(zzstack.s_mark - zzstack.s_base + 1));
            if (zzerrctx == NULL) goto zzenomem;
            zzerrctx->save           = zzps->save;
            zzerrctx->state          = zzstate;
            zzerrctx->errflag        = zzerrflag;
            zzerrctx->zzstack.s_mark = zzerrctx->zzstack.s_base + (zzstack.s_mark - zzstack.s_base);
            memcpy (zzerrctx->zzstack.s_base, zzstack.s_base, (size_t) (zzstack.s_mark - zzstack.s_base + 1) * sizeof(ZZINT));
            zzerrctx->zzstack.l_mark = zzerrctx->zzstack.l_base + (zzstack.l_mark - zzstack.l_base);
            memcpy (zzerrctx->zzstack.l_base, zzstack.l_base, (size_t) (zzstack.l_mark - zzstack.l_base + 1) * sizeof(ZZSTYPE));
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
            zzerrctx->zzstack.p_mark = zzerrctx->zzstack.p_base + (zzstack.p_mark - zzstack.p_base);
            memcpy (zzerrctx->zzstack.p_base, zzstack.p_base, (size_t) (zzstack.p_mark - zzstack.p_base + 1) * sizeof(ZZLTYPE));
#endif
            zzerrctx->lexeme         = (int) (zzlvp - zzlvals);
        }
        zzlvp          = zzlvals   + save->lexeme;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
        zzlpp          = zzlpsns   + save->lexeme;
#endif
        zzlexp         = zzlexemes + save->lexeme;
        zzchar         = ZZEMPTY;
        zzstack.s_mark = zzstack.s_base + (save->zzstack.s_mark - save->zzstack.s_base);
        memcpy (zzstack.s_base, save->zzstack.s_base, (size_t) (zzstack.s_mark - zzstack.s_base + 1) * sizeof(ZZINT));
        zzstack.l_mark = zzstack.l_base + (save->zzstack.l_mark - save->zzstack.l_base);
        memcpy (zzstack.l_base, save->zzstack.l_base, (size_t) (zzstack.l_mark - zzstack.l_base + 1) * sizeof(ZZSTYPE));
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
        zzstack.p_mark = zzstack.p_base + (save->zzstack.p_mark - save->zzstack.p_base);
        memcpy (zzstack.p_base, save->zzstack.p_base, (size_t) (zzstack.p_mark - zzstack.p_base + 1) * sizeof(ZZLTYPE));
#endif
        ctry           = ++save->ctry;
        zzstate        = save->state;
        /* We tried shift, try reduce now */
        if ((zzn = zzctable[ctry]) >= 0) goto zzreduce;
        zzps->save     = save->save;
        save->save     = NULL;
        zzFreeState(save);

        /* Nothing left on the stack -- error */
        if (!zzps->save)
        {
#if ZZDEBUG
            if (zzdebug)
                fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
                                ZZPREFIX, zzdepth);
#endif
            /* Restore state as it was in the most forward-advanced error */
            zzlvp          = zzlvals   + zzerrctx->lexeme;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
            zzlpp          = zzlpsns   + zzerrctx->lexeme;
#endif
            zzlexp         = zzlexemes + zzerrctx->lexeme;
            zzchar         = zzlexp[-1];
            zzlval         = zzlvp[-1];
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
            zzlloc         = zzlpp[-1];
#endif
            zzstack.s_mark = zzstack.s_base + (zzerrctx->zzstack.s_mark - zzerrctx->zzstack.s_base);
            memcpy (zzstack.s_base, zzerrctx->zzstack.s_base, (size_t) (zzstack.s_mark - zzstack.s_base + 1) * sizeof(ZZINT));
            zzstack.l_mark = zzstack.l_base + (zzerrctx->zzstack.l_mark - zzerrctx->zzstack.l_base);
            memcpy (zzstack.l_base, zzerrctx->zzstack.l_base, (size_t) (zzstack.l_mark - zzstack.l_base + 1) * sizeof(ZZSTYPE));
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
            zzstack.p_mark = zzstack.p_base + (zzerrctx->zzstack.p_mark - zzerrctx->zzstack.p_base);
            memcpy (zzstack.p_base, zzerrctx->zzstack.p_base, (size_t) (zzstack.p_mark - zzstack.p_base + 1) * sizeof(ZZLTYPE));
#endif
            zzstate        = zzerrctx->state;
            zzFreeState(zzerrctx);
            zzerrctx       = NULL;
        }
        zznewerrflag = 1;
    }
    if (zznewerrflag == 0) goto zzinrecovery;
#endif /* ZZBTYACC */

    ZZERROR_CALL("syntax error");
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    zzerror_loc_range[1] = zzlloc; /* lookahead position is error start position */
#endif

#if !ZZBTYACC
    goto zzerrlab; /* redundant goto avoids 'unused label' warning */
zzerrlab:
#endif
    ++zznerrs;

zzinrecovery:
    if (zzerrflag < 3)
    {
        zzerrflag = 3;
        for (;;)
        {
            if (((zzn = zzsindex[*zzstack.s_mark]) != 0) && (zzn += ZZERRCODE) >= 0 &&
                    zzn <= ZZTABLESIZE && zzcheck[zzn] == (ZZINT) ZZERRCODE)
            {
#if ZZDEBUG
                if (zzdebug)
                    fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
                                    ZZDEBUGSTR, zzdepth, *zzstack.s_mark, zztable[zzn]);
#endif
                if (zzstack.s_mark >= zzstack.s_last && zzgrowstack(&zzstack) == ZZENOMEM) goto zzoverflow;
                zzstate = zztable[zzn];
                *++zzstack.s_mark = zztable[zzn];
                *++zzstack.l_mark = zzlval;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                /* lookahead position is error end position */
                zzerror_loc_range[2] = zzlloc;
                ZZLLOC_DEFAULT(zzloc, zzerror_loc_range, 2); /* position of error span */
                *++zzstack.p_mark = zzloc;
#endif
                goto zzloop;
            }
            else
            {
#if ZZDEBUG
                if (zzdebug)
                    fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
                                    ZZDEBUGSTR, zzdepth, *zzstack.s_mark);
#endif
                if (zzstack.s_mark <= zzstack.s_base) goto zzabort;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                /* the current TOS position is the error start position */
                zzerror_loc_range[1] = *zzstack.p_mark;
#endif
#if defined(ZZDESTRUCT_CALL)
#if ZZBTYACC
                if (!zztrial)
#endif /* ZZBTYACC */
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                    ZZDESTRUCT_CALL("error: discarding state",
                                    zzstos[*zzstack.s_mark], zzstack.l_mark, zzstack.p_mark);
#else
                    ZZDESTRUCT_CALL("error: discarding state",
                                    zzstos[*zzstack.s_mark], zzstack.l_mark);
#endif /* defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED) */
#endif /* defined(ZZDESTRUCT_CALL) */
                --zzstack.s_mark;
                --zzstack.l_mark;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                --zzstack.p_mark;
#endif
            }
        }
    }
    else
    {
        if (zzchar == ZZEOF) goto zzabort;
#if ZZDEBUG
        if (zzdebug)
        {
            if ((zzs = zzname[ZZTRANSLATE(zzchar)]) == NULL) zzs = zzname[ZZUNDFTOKEN];
            fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
                            ZZDEBUGSTR, zzdepth, zzstate, zzchar, zzs);
        }
#endif
#if defined(ZZDESTRUCT_CALL)
#if ZZBTYACC
        if (!zztrial)
#endif /* ZZBTYACC */
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
            ZZDESTRUCT_CALL("error: discarding token", zzchar, &zzlval, &zzlloc);
#else
            ZZDESTRUCT_CALL("error: discarding token", zzchar, &zzlval);
#endif /* defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED) */
#endif /* defined(ZZDESTRUCT_CALL) */
        zzchar = ZZEMPTY;
        goto zzloop;
    }

zzreduce:
    zzm = zzlen[zzn];
#if ZZDEBUG
    if (zzdebug)
    {
        fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
                        ZZDEBUGSTR, zzdepth, zzstate, zzn, zzrule[zzn]);
#ifdef ZZSTYPE_TOSTRING
#if ZZBTYACC
        if (!zztrial)
#endif /* ZZBTYACC */
            if (zzm > 0)
            {
                int i;
                fputc('<', stderr);
                for (i = zzm; i > 0; i--)
                {
                    if (i != zzm) fputs(", ", stderr);
                    fputs(ZZSTYPE_TOSTRING(zzstos[zzstack.s_mark[1-i]],
                                           zzstack.l_mark[1-i]), stderr);
                }
                fputc('>', stderr);
            }
#endif
        fputc('\n', stderr);
    }
#endif
    if (zzm > 0)
        zzval = zzstack.l_mark[1-zzm];
    else
        memset(&zzval, 0, sizeof zzval);
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)

    /* Perform position reduction */
    memset(&zzloc, 0, sizeof(zzloc));
#if ZZBTYACC
    if (!zztrial)
#endif /* ZZBTYACC */
    {
        ZZLLOC_DEFAULT(zzloc, &zzstack.p_mark[-zzm], zzm);
        /* just in case ZZERROR is invoked within the action, save
           the start of the rhs as the error start position */
        zzerror_loc_range[1] = zzstack.p_mark[1-zzm];
    }
#endif

    switch (zzn)
    {
case 1:
#line 67 "ifyacc.y"
	{ifResult = zzstack.l_mark[0].i; }
#line 1 ""
break;
case 3:
#line 70 "ifyacc.y"
	{ LOG(("Undefined constant %s", zzstack.l_mark[0].str)); zzval.i = 0; }
#line 1 ""
break;
case 4:
#line 71 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-2].i + zzstack.l_mark[0].i; }
#line 1 ""
break;
case 5:
#line 72 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-2].i - zzstack.l_mark[0].i; }
#line 1 ""
break;
case 6:
#line 73 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-2].i * zzstack.l_mark[0].i; }
#line 1 ""
break;
case 7:
#line 74 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-2].i / zzstack.l_mark[0].i; }
#line 1 ""
break;
case 8:
#line 75 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-2].i % zzstack.l_mark[0].i; }
#line 1 ""
break;
case 9:
#line 76 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-2].i | zzstack.l_mark[0].i; }
#line 1 ""
break;
case 10:
#line 77 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-2].i & zzstack.l_mark[0].i; }
#line 1 ""
break;
case 11:
#line 78 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-3].i || zzstack.l_mark[0].i; }
#line 1 ""
break;
case 12:
#line 79 "ifyacc.y"
	{zzval.i = zzstack.l_mark[-3].i && zzstack.l_mark[0].i; }
#line 1 ""
break;
case 13:
#line 80 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-1].i; }
#line 1 ""
break;
case 14:
#line 81 "ifyacc.y"
	{zzval.i = !zzstack.l_mark[0].i; }
#line 1 ""
break;
case 15:
#line 82 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-2].i > zzstack.l_mark[0].i; }
#line 1 ""
break;
case 16:
#line 83 "ifyacc.y"
	{ zzval.i = zzstack.l_mark[-2].i < zzstack.l_mark[0].i; }
#line 1 ""
break;
case 17:
#line 84 "ifyacc.y"
	{ zzval.i = (zzstack.l_mark[-3].i >= zzstack.l_mark[0].i); }
#line 1 ""
break;
case 18:
#line 85 "ifyacc.y"
	{ zzval.i = (zzstack.l_mark[-3].i <= zzstack.l_mark[0].i); }
#line 1 ""
break;
case 19:
#line 86 "ifyacc.y"
	{ zzval.i = (zzstack.l_mark[-3].i == zzstack.l_mark[0].i); }
#line 1 ""
break;
case 20:
#line 87 "ifyacc.y"
	{ zzval.i = (zzstack.l_mark[-3].i != zzstack.l_mark[0].i); }
#line 1 ""
break;
case 21:
#line 88 "ifyacc.y"
	{ LOG(("%s is%s defined", zzstack.l_mark[-1].str, match_define(zzstack.l_mark[-1].str) ? "" : " not")); zzval.i = match_define(zzstack.l_mark[-1].str) ? 1 : 0; str_free(zzstack.l_mark[-1].str); }
#line 1 ""
break;
case 22:
#line 89 "ifyacc.y"
	{ LOG(("%s is%s defined", zzstack.l_mark[0].str, match_define(zzstack.l_mark[0].str) ? "" : " not")); zzval.i = match_define(zzstack.l_mark[0].str) ? 1 : 0; str_free(zzstack.l_mark[0].str); }
#line 1 ""
break;
case 23:
#line 90 "ifyacc.y"
	{ LOG(("%s is%s defined", zzstack.l_mark[-1].str, match_define(zzstack.l_mark[-1].str) ? "" : " not")); zzval.i = !match_define(zzstack.l_mark[-1].str) ? 1 : 0; str_free(zzstack.l_mark[-1].str); }
#line 1 ""
break;
case 24:
#line 91 "ifyacc.y"
	{ LOG(("%s is%s defined", zzstack.l_mark[0].str, match_define(zzstack.l_mark[0].str) ? "" : " not")); zzval.i = !match_define(zzstack.l_mark[0].str) ? 1 : 0; str_free(zzstack.l_mark[0].str); }
#line 1 ""
break;
#line 1270 "y.tab.c"
    default:
        break;
    }
    zzstack.s_mark -= zzm;
    zzstate = *zzstack.s_mark;
    zzstack.l_mark -= zzm;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    zzstack.p_mark -= zzm;
#endif
    zzm = zzlhs[zzn];
    if (zzstate == 0 && zzm == 0)
    {
#if ZZDEBUG
        if (zzdebug)
        {
            fprintf(stderr, "%s[%d]: after reduction, ", ZZDEBUGSTR, zzdepth);
#ifdef ZZSTYPE_TOSTRING
#if ZZBTYACC
            if (!zztrial)
#endif /* ZZBTYACC */
                fprintf(stderr, "result is <%s>, ", ZZSTYPE_TOSTRING(zzstos[ZZFINAL], zzval));
#endif
            fprintf(stderr, "shifting from state 0 to final state %d\n", ZZFINAL);
        }
#endif
        zzstate = ZZFINAL;
        *++zzstack.s_mark = ZZFINAL;
        *++zzstack.l_mark = zzval;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
        *++zzstack.p_mark = zzloc;
#endif
        if (zzchar < 0)
        {
#if ZZBTYACC
            do {
            if (zzlvp < zzlve)
            {
                /* we're currently re-reading tokens */
                zzlval = *zzlvp++;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                zzlloc = *zzlpp++;
#endif
                zzchar = *zzlexp++;
                break;
            }
            if (zzps->save)
            {
                /* in trial mode; save scanner results for future parse attempts */
                if (zzlvp == zzlvlim)
                {   /* Enlarge lexical value queue */
                    size_t p = (size_t) (zzlvp - zzlvals);
                    size_t s = (size_t) (zzlvlim - zzlvals);

                    s += ZZLVQUEUEGROWTH;
                    if ((zzlexemes = (ZZINT *)realloc(zzlexemes, s * sizeof(ZZINT))) == NULL)
                        goto zzenomem;
                    if ((zzlvals   = (ZZSTYPE *)realloc(zzlvals, s * sizeof(ZZSTYPE))) == NULL)
                        goto zzenomem;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                    if ((zzlpsns   = (ZZLTYPE *)realloc(zzlpsns, s * sizeof(ZZLTYPE))) == NULL)
                        goto zzenomem;
#endif
                    zzlvp   = zzlve = zzlvals + p;
                    zzlvlim = zzlvals + s;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                    zzlpp   = zzlpe = zzlpsns + p;
                    zzlplim = zzlpsns + s;
#endif
                    zzlexp  = zzlexemes + p;
                }
                *zzlexp = (ZZINT) ZZLEX;
                *zzlvp++ = zzlval;
                zzlve++;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
                *zzlpp++ = zzlloc;
                zzlpe++;
#endif
                zzchar = *zzlexp++;
                break;
            }
            /* normal operation, no conflict encountered */
#endif /* ZZBTYACC */
            zzchar = ZZLEX;
#if ZZBTYACC
            } while (0);
#endif /* ZZBTYACC */
            if (zzchar < 0) zzchar = ZZEOF;
#if ZZDEBUG
            if (zzdebug)
            {
                if ((zzs = zzname[ZZTRANSLATE(zzchar)]) == NULL) zzs = zzname[ZZUNDFTOKEN];
                fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
                                ZZDEBUGSTR, zzdepth, ZZFINAL, zzchar, zzs);
            }
#endif
        }
        if (zzchar == ZZEOF) goto zzaccept;
        goto zzloop;
    }
    if (((zzn = zzgindex[zzm]) != 0) && (zzn += zzstate) >= 0 &&
            zzn <= ZZTABLESIZE && zzcheck[zzn] == (ZZINT) zzstate)
        zzstate = zztable[zzn];
    else
        zzstate = zzdgoto[zzm];
#if ZZDEBUG
    if (zzdebug)
    {
        fprintf(stderr, "%s[%d]: after reduction, ", ZZDEBUGSTR, zzdepth);
#ifdef ZZSTYPE_TOSTRING
#if ZZBTYACC
        if (!zztrial)
#endif /* ZZBTYACC */
            fprintf(stderr, "result is <%s>, ", ZZSTYPE_TOSTRING(zzstos[zzstate], zzval));
#endif
        fprintf(stderr, "shifting from state %d to state %d\n", *zzstack.s_mark, zzstate);
    }
#endif
    if (zzstack.s_mark >= zzstack.s_last && zzgrowstack(&zzstack) == ZZENOMEM) goto zzoverflow;
    *++zzstack.s_mark = (ZZINT) zzstate;
    *++zzstack.l_mark = zzval;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    *++zzstack.p_mark = zzloc;
#endif
    goto zzloop;
#if ZZBTYACC

    /* Reduction declares that this path is valid. Set zzpath and do a full parse */
zzvalid:
    if (zzpath) ZZABORT;
    while (zzps->save)
    {
        ZZParseState *save = zzps->save;
        zzps->save = save->save;
        save->save = zzpath;
        zzpath = save;
    }
#if ZZDEBUG
    if (zzdebug)
        fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
                        ZZDEBUGSTR, zzdepth, zzstate, zzpath->state, (int)(zzlvp - zzlvals - zzpath->lexeme));
#endif
    if (zzerrctx)
    {
        zzFreeState(zzerrctx);
        zzerrctx = NULL;
    }
    zzlvp          = zzlvals + zzpath->lexeme;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    zzlpp          = zzlpsns + zzpath->lexeme;
#endif
    zzlexp         = zzlexemes + zzpath->lexeme;
    zzchar         = ZZEMPTY;
    zzstack.s_mark = zzstack.s_base + (zzpath->zzstack.s_mark - zzpath->zzstack.s_base);
    memcpy (zzstack.s_base, zzpath->zzstack.s_base, (size_t) (zzstack.s_mark - zzstack.s_base + 1) * sizeof(ZZINT));
    zzstack.l_mark = zzstack.l_base + (zzpath->zzstack.l_mark - zzpath->zzstack.l_base);
    memcpy (zzstack.l_base, zzpath->zzstack.l_base, (size_t) (zzstack.l_mark - zzstack.l_base + 1) * sizeof(ZZSTYPE));
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
    zzstack.p_mark = zzstack.p_base + (zzpath->zzstack.p_mark - zzpath->zzstack.p_base);
    memcpy (zzstack.p_base, zzpath->zzstack.p_base, (size_t) (zzstack.p_mark - zzstack.p_base + 1) * sizeof(ZZLTYPE));
#endif
    zzstate        = zzpath->state;
    goto zzloop;
#endif /* ZZBTYACC */

zzoverflow:
    ZZERROR_CALL("yacc stack overflow");
#if ZZBTYACC
    goto zzabort_nomem;
zzenomem:
    ZZERROR_CALL("memory exhausted");
zzabort_nomem:
#endif /* ZZBTYACC */
    zzresult = 2;
    goto zzreturn;

zzabort:
    zzresult = 1;
    goto zzreturn;

zzaccept:
#if ZZBTYACC
    if (zzps->save) goto zzvalid;
#endif /* ZZBTYACC */
    zzresult = 0;

zzreturn:
#if defined(ZZDESTRUCT_CALL)
    if (zzchar != ZZEOF && zzchar != ZZEMPTY)
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
        ZZDESTRUCT_CALL("cleanup: discarding token", zzchar, &zzlval, &zzlloc);
#else
        ZZDESTRUCT_CALL("cleanup: discarding token", zzchar, &zzlval);
#endif /* defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED) */

    {
        ZZSTYPE *pv;
#if defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED)
        ZZLTYPE *pp;

        for (pv = zzstack.l_base, pp = zzstack.p_base; pv <= zzstack.l_mark; ++pv, ++pp)
             ZZDESTRUCT_CALL("cleanup: discarding state",
                             zzstos[*(zzstack.s_base + (pv - zzstack.l_base))], pv, pp);
#else
        for (pv = zzstack.l_base; pv <= zzstack.l_mark; ++pv)
             ZZDESTRUCT_CALL("cleanup: discarding state",
                             zzstos[*(zzstack.s_base + (pv - zzstack.l_base))], pv);
#endif /* defined(ZZLTYPE) || defined(ZZLTYPE_IS_DECLARED) */
    }
#endif /* defined(ZZDESTRUCT_CALL) */

#if ZZBTYACC
    if (zzerrctx)
    {
        zzFreeState(zzerrctx);
        zzerrctx = NULL;
    }
    while (zzps)
    {
        ZZParseState *save = zzps;
        zzps = save->save;
        save->save = NULL;
        zzFreeState(save);
    }
    while (zzpath)
    {
        ZZParseState *save = zzpath;
        zzpath = save->save;
        save->save = NULL;
        zzFreeState(save);
    }
#endif /* ZZBTYACC */
    zzfreestack(&zzstack);
    return (zzresult);
}
