/*  A Bison parser, made from lp_rlp.y
    by GNU Bison version 1.28  */

#define YYBISON 1  /* Identify Bison output.  */

#define	VAR	257
#define	CONS	258
#define	INTCONS	259
#define	VARIABLECOLON	260
#define	INF	261
#define	SEC_INT	262
#define	SEC_SEC	263
#define	SEC_SOS	264
#define	SOSDESCR	265
#define	SEC_FREE	266
#define	SIGN	267
#define	AR_M_OP	268
#define	RE_OPLE	269
#define	RE_OPGE	270
#define	END_C	271
#define	COMMA	272
#define	COLON	273
#define	MINIMISE	274
#define	MAXIMISE	275
#define	UNDEFINED	276


#include <string.h>
#include <ctype.h>

#include "lpkit.h"
#include "yacc_read.h"

#ifdef FORTIFY
# include "lp_fortify.h"
#endif

static int HadVar0, HadVar1, HadVar2, HasAR_M_OP, do_add_row, Had_lineair_sum0, HadSign;
static char *Last_var = NULL, *Last_var0 = NULL;
static REAL f, f0, f1;
static int x;
static int state, state0;
static int Sign;
static int isign, isign0;      /* internal_sign variable to make sure nothing goes wrong */
                /* with lookahead */
static int make_neg;   /* is true after the relational operator is seen in order */
                /* to remember if lin_term stands before or after re_op */
static int Within_int_decl = FALSE; /* TRUE when we are within an int declaration */
static int Within_sec_decl = FALSE; /* TRUE when we are within a sec declaration */
static int Within_sos_decl = FALSE; /* TRUE when we are within a sos declaration */
static int Within_sos_decl1;
static int Within_free_decl = FALSE; /* TRUE when we are within a free declaration */
static short SOStype0; /* SOS type */
static short SOStype; /* SOS type */
static int SOSNr;
static int SOSweight = 0; /* SOS weight */

static int HadConstraint;
static int HadVar;
static int Had_lineair_sum;

extern FILE *lp_yyin;

#define YY_FATAL_ERROR lex_fatal_error

/* let's please C++ users */
#ifdef __cplusplus
extern "C" {
#endif

static int wrap(void)
{
  return(1);
}

static int __WINAPI lp_input_lp_yyin(void *fpin, char *buf, int max_size)
{
  int result;

  if ( (result = fread( (char*)buf, sizeof(char), max_size, (FILE *) fpin)) < 0)
    YY_FATAL_ERROR( "read() in flex scanner failed");

  return(result);
}

static read_modeldata_func *lp_input;

#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) result = lp_input((void *) lp_yyin, buf, max_size);

#ifdef __cplusplus
};
#endif

#define lp_yywrap wrap
#define lp_yyerror read_error

#include "lp_rlp.h"

#ifndef YYSTYPE
#define YYSTYPE int
#endif
#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		121
#define	YYFLAG		-32768
#define	YYNTBASE	23

#define YYTRANSLATE(x) ((unsigned)(x) <= 276 ? lp_yytranslate[x] : 78)

static const char lp_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,     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,     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,     3,     4,     5,     6,
     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
    17,    18,    19,    20,    21,    22
};

#if YYDEBUG != 0
static const short lp_yyprhs[] = {     0,
     0,     1,     2,     7,    10,    13,    15,    18,    20,    22,
    24,    26,    28,    31,    33,    34,    38,    39,    40,    41,
    50,    52,    53,    54,    60,    62,    64,    66,    67,    71,
    72,    75,    77,    80,    83,    85,    86,    90,    92,    94,
    97,    99,   101,   103,   105,   107,   109,   111,   113,   115,
   117,   119,   122,   124,   126,   128,   130,   131,   135,   136,
   142,   144,   147,   149,   150,   154,   156,   157,   162,   164,
   167,   169,   171,   173,   177,   179,   181,   183,   184,   186,
   188,   191,   195,   198,   201,   204
};

static const short lp_yyrhs[] = {    -1,
     0,    25,    26,    29,    55,     0,    21,    27,     0,    20,
    27,     0,    27,     0,    28,    17,     0,    23,     0,    43,
     0,    23,     0,    30,     0,    31,     0,    30,    31,     0,
    33,     0,     0,     6,    32,    33,     0,     0,     0,     0,
    40,    34,    49,    35,    41,    36,    37,    17,     0,    23,
     0,     0,     0,    49,    38,    50,    39,    54,     0,    23,
     0,    41,     0,    43,     0,     0,     7,    42,    54,     0,
     0,    44,    45,     0,    46,     0,    45,    46,     0,    52,
    47,     0,    51,     0,     0,    53,    48,     3,     0,    15,
     0,    16,     0,    52,    51,     0,     7,     0,     5,     0,
     4,     0,    23,     0,    13,     0,    23,     0,    14,     0,
    23,     0,    23,     0,    56,     0,    58,     0,    56,    58,
     0,     8,     0,     9,     0,    10,     0,    12,     0,     0,
    57,    59,    62,     0,     0,    61,    63,    68,    65,    17,
     0,    60,     0,    62,    60,     0,    23,     0,     0,    11,
    64,    74,     0,    23,     0,     0,    15,     5,    66,    67,
     0,    23,     0,    19,     5,     0,    23,     0,    69,     0,
    75,     0,    69,    70,    75,     0,    23,     0,    18,     0,
    23,     0,     0,    23,     0,    23,     0,     3,    71,     0,
     6,    72,    76,     0,    51,    73,     0,    74,    77,     0,
     3,    71,     0,     6,    72,    51,    73,     0
};

#endif

#if YYDEBUG != 0
static const short lp_yyrline[] = { 0,
    87,    90,    99,   113,   117,   121,   124,   135,   136,   166,
   167,   170,   171,   175,   176,   183,   185,   191,   198,   222,
   238,   244,   255,   259,   280,   290,   296,   297,   302,   304,
   309,   323,   324,   328,   364,   368,   376,   381,   381,   384,
   386,   397,   397,   400,   405,   412,   416,   422,   439,   441,
   444,   445,   448,   448,   448,   448,   451,   457,   459,   469,
   481,   483,   486,   487,   493,   495,   502,   516,   518,   522,
   529,   530,   533,   534,   539,   540,   543,   568,   587,   609,
   623,   626,   631,   633,   637,   640
};
#endif


#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)

static const char * const lp_yytname[] = {   "$","error","$undefined.","VAR","CONS",
"INTCONS","VARIABLECOLON","INF","SEC_INT","SEC_SEC","SEC_SOS","SOSDESCR","SEC_FREE",
"SIGN","AR_M_OP","RE_OPLE","RE_OPGE","END_C","COMMA","COLON","MINIMISE","MAXIMISE",
"UNDEFINED","EMPTY","inputfile","@1","objective_function","real_of","lineair_sum",
"constraints","x_constraints","constraint","@2","real_constraint","@3","@4",
"@5","optionalrange","@6","@7","x_lineair_sum2","x_lineair_sum3","@8","x_lineair_sum",
"@9","x_lineair_sum1","x_lineair_term","x_lineair_term1","@10","RE_OP","cons_term",
"REALCONS","x_SIGN","optional_AR_M_OP","RHS_STORE","int_sec_sos_free_declarations",
"real_int_sec_sos_free_decls","SEC_INT_SEC_SOS_FREE","int_sec_sos_free_declaration",
"@11","xx_int_sec_sos_free_declaration","@12","x_int_sec_sos_free_declaration",
"optionalsos","@13","optionalsostype","@14","optionalSOSweight","vars","x_vars",
"optionalcomma","variable","variablecolon","sosweight","sosdescr","onevarwithoptionalweight",
"INTCONSorVARIABLE","x_onevarwithoptionalweight", NULL
};
#endif

static const short lp_yyr1[] = {     0,
    23,    25,    24,    26,    26,    26,    27,    28,    28,    29,
    29,    30,    30,    31,    32,    31,    34,    35,    36,    33,
    37,    38,    39,    37,    40,    40,    41,    42,    41,    44,
    43,    45,    45,    46,    47,    48,    47,    49,    49,    50,
    50,    51,    51,    52,    52,    53,    53,    54,    55,    55,
    56,    56,    57,    57,    57,    57,    59,    58,    61,    60,
    62,    62,    63,    64,    63,    65,    66,    65,    67,    67,
    68,    68,    69,    69,    70,    70,    71,    72,    73,    74,
    75,    75,    76,    76,    77,    77
};

static const short lp_yyr2[] = {     0,
     0,     0,     4,     2,     2,     1,     2,     1,     1,     1,
     1,     1,     2,     1,     0,     3,     0,     0,     0,     8,
     1,     0,     0,     5,     1,     1,     1,     0,     3,     0,
     2,     1,     2,     2,     1,     0,     3,     1,     1,     2,
     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     1,     2,     1,     1,     1,     1,     0,     3,     0,     5,
     1,     2,     1,     0,     3,     1,     0,     4,     1,     2,
     1,     1,     1,     3,     1,     1,     1,     0,     1,     1,
     2,     3,     2,     2,     2,     4
};

static const short lp_yydefact[] = {     2,
    30,    30,    30,     8,     1,     6,     0,     9,     1,     5,
     4,    15,    28,    10,     1,    11,    12,    14,    17,    26,
    27,     7,    45,    44,     1,    32,     1,    30,     1,    53,
    54,    55,    56,    49,     3,    50,    57,    51,    25,    13,
     0,    33,    43,    42,    47,    46,    34,    35,    36,    16,
    48,    29,    52,    59,    38,    39,    18,     0,    61,     1,
    58,    30,    37,    64,    63,     1,    62,    19,     1,     1,
    78,    71,     1,     1,    73,     1,    80,    65,    77,    81,
     1,     0,    66,     0,    76,    75,     0,    21,     0,    22,
     1,     0,    82,    67,    60,    74,    20,     1,    79,    83,
     1,    78,    84,     1,    41,    23,     0,    85,     0,     0,
    69,    68,     1,    40,     1,    70,    24,    86,     0,     0,
     0
};

static const short lp_yydefgoto[] = {     4,
   119,     1,     5,     6,     7,    15,    16,    17,    28,    18,
    41,    62,    76,    89,    98,   113,    19,    20,    29,    21,
     9,    25,    26,    47,    58,    57,   106,    48,    27,    49,
    52,    35,    36,    37,    38,    54,    59,    60,    61,    66,
    69,    84,   104,   112,    73,    74,    87,    80,    81,   100,
    78,    75,    93,   103
};

static const short lp_yypact[] = {-32768,
    42,   -10,   -10,-32768,    32,-32768,    -8,-32768,     3,-32768,
-32768,-32768,-32768,    51,    39,    27,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,    41,-32768,    -2,    -1,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,    39,-32768,-32768,-32768,-32768,
    59,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,    23,-32768,    49,
     2,    75,-32768,-32768,-32768,    15,-32768,-32768,-32768,-32768,
-32768,-32768,    68,    55,-32768,    59,-32768,-32768,-32768,-32768,
    48,    79,-32768,    70,-32768,-32768,    15,-32768,    71,-32768,
-32768,    22,-32768,-32768,-32768,-32768,-32768,    37,-32768,-32768,
-32768,-32768,-32768,    66,-32768,-32768,    48,-32768,    48,    84,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    90,    91,
-32768
};

static const short lp_yypgoto[] = {    -5,
-32768,-32768,-32768,    78,-32768,-32768,-32768,    81,-32768,    64,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,    33,-32768,    76,
-32768,-32768,    69,-32768,-32768,    24,-32768,   -80,     0,-32768,
   -12,-32768,-32768,-32768,    67,-32768,    43,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,     1,     4,    -6,
    26,    18,-32768,-32768
};


#define	YYLAST		110


static const short lp_yytable[] = {    14,
    91,    43,    44,    24,   -59,    13,    -1,   -59,    22,    34,
    39,    45,   -59,    -1,    -1,    23,   -59,    70,   -59,    24,
    71,    46,    39,    51,   101,    63,   114,   102,   115,   -30,
   -30,   -30,    12,    13,   -30,   -30,   -30,    12,    13,   -30,
   -30,    -1,    -1,   105,   -30,   -30,    30,    31,    32,    23,
    33,    43,    44,    23,    65,   -31,   -31,   -31,    -1,    64,
    72,     2,     3,    77,    79,   -25,   -25,    83,    86,   -72,
    88,   -72,    85,    55,    56,    77,     8,     8,     8,    10,
    11,    13,    82,    94,   110,    99,    95,    97,   116,   120,
   121,    50,    24,    42,    68,    79,    40,   107,   111,    90,
   117,   108,    53,    67,    96,   109,    92,    51,   118,    99
};

static const short lp_yycheck[] = {     5,
    81,     4,     5,     9,     3,     7,    17,     6,    17,    15,
    16,    14,    11,    15,    16,    13,    15,     3,    17,    25,
     6,    27,    28,    29,     3,     3,   107,     6,   109,     3,
     4,     5,     6,     7,     3,     4,     5,     6,     7,    13,
    14,    15,    16,     7,    13,    14,     8,     9,    10,    13,
    12,     4,     5,    13,    60,    15,    16,    17,    17,    11,
    66,    20,    21,    69,    70,    15,    16,    73,    74,    15,
    76,    17,    18,    15,    16,    81,     1,     2,     3,     2,
     3,     7,    15,     5,    19,    91,    17,    17,     5,     0,
     0,    28,    98,    25,    62,   101,    16,    98,   104,    76,
   113,   101,    36,    61,    87,   102,    81,   113,   115,   115
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */

/* This file comes from bison-1.28.  */

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 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 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

#ifndef YYSTACK_USE_ALLOCA
#ifdef alloca
#define YYSTACK_USE_ALLOCA
#else /* alloca not defined */
#ifdef __GNUC__
#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
#define YYSTACK_USE_ALLOCA
#include <alloca.h>
#else /* not sparc */
/* We think this test detects Watcom and Microsoft C.  */
/* This used to test MSDOS, but that is a bad idea
   since that symbol is in the user namespace.  */
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
#if 0 /* No need for malloc.h, which pollutes the namespace;
	 instead, just don't use alloca.  */
#include <malloc.h>
#endif
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
/* I don't know what this was needed for, but it pollutes the namespace.
   So I turned it off.   rms, 2 May 1997.  */
/* #include <malloc.h>  */
 #pragma alloca
#define YYSTACK_USE_ALLOCA
#else /* not MSDOS, or __TURBOC__, or _AIX */
#if 0
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
		 and on HPUX 10.  Eventually we can turn this on.  */
#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#endif /* __hpux */
#endif
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc */
#endif /* not GNU C */
#endif /* alloca not defined */
#endif /* YYSTACK_USE_ALLOCA not defined */

#ifdef YYSTACK_USE_ALLOCA
#define YYSTACK_ALLOC alloca
#else
#define YYSTACK_ALLOC malloc
#endif

/* Note: there must be only one dollar sign in this file.
   It is replaced by the list of actions, each action
   as one case of the switch.  */

#define lp_yyerrok		(lp_yyerrstatus = 0)
#define lp_yyclearin	(lp_yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYACCEPT	goto lp_yyacceptlab
#define YYABORT 	goto lp_yyabortlab
#define YYERROR		goto lp_yyerrlab1
/* Like YYERROR except do call lp_yyerror.
   This remains here temporarily to ease the
   transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL		goto lp_yyerrlab
#define YYRECOVERING()  (!!lp_yyerrstatus)
#define YYBACKUP(token, value) \
do								\
  if (lp_yychar == YYEMPTY && lp_yylen == 1)				\
    { lp_yychar = (token), lp_yylval = (value);			\
      lp_yychar1 = YYTRANSLATE (lp_yychar);				\
      YYPOPSTACK;						\
      goto lp_yybackup;						\
    }								\
  else								\
    { lp_yyerror ("syntax error: cannot back up"); YYERROR; }	\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

#ifndef YYPURE
#define YYLEX		lp_yylex()
#endif

#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX		lp_yylex(&lp_yylval, &lp_yylloc, YYLEX_PARAM)
#else
#define YYLEX		lp_yylex(&lp_yylval, &lp_yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX		lp_yylex(&lp_yylval, YYLEX_PARAM)
#else
#define YYLEX		lp_yylex(&lp_yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYPURE

int	lp_yychar;			/*  the lookahead symbol		*/
YYSTYPE	lp_yylval;			/*  the semantic value of the		*/
				/*  lookahead symbol			*/

#ifdef YYLSP_NEEDED
YYLTYPE lp_yylloc;			/*  location data for the lookahead	*/
				/*  symbol				*/
#endif

int lp_yynerrs;			/*  number of parse errors so far       */
#endif  /* not YYPURE */

#if YYDEBUG != 0
int lp_yydebug;			/*  nonzero means print parse trace	*/
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif

/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/

#ifndef	YYINITDEPTH
#define YYINITDEPTH 200
#endif

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

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif

/* Define __lp_yy_memcpy.  Note that the size argument
   should be passed with type unsigned int, because that is what the non-GCC
   definitions require.  With GCC, __builtin_memcpy takes an arg
   of type size_t, but it can handle unsigned int.  */

#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
#define __lp_yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
#else				/* not GNU C or C++ */
#ifndef __cplusplus

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__lp_yy_memcpy (to, from, count)
     char *to;
     char *from;
     unsigned int count;
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#else /* __cplusplus */

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__lp_yy_memcpy (char *to, char *from, unsigned int count)
{
  register char *t = to;
  register char *f = from;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#endif
#endif



/* The user can define YYPARSE_PARAM as the name of an argument to be passed
   into lp_yyparse.  The argument should have type void *.
   It should actually point to an object.
   Grammar actions can access the variable by casting it
   to the proper pointer type.  */

#ifdef YYPARSE_PARAM
#ifdef __cplusplus
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else /* not __cplusplus */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
#endif /* not __cplusplus */
#else /* not YYPARSE_PARAM */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
#ifdef YYPARSE_PARAM
int lp_yyparse (void *);
#else
int lp_yyparse (void);
#endif
#endif

int
lp_yyparse(YYPARSE_PARAM_ARG)
     YYPARSE_PARAM_DECL
{
  register int lp_yystate;
  register int lp_yyn;
  register short *lp_yyssp;
  register YYSTYPE *lp_yyvsp;
  int lp_yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int lp_yychar1 = 0;		/*  lookahead token as an internal (translated) token number */

  short	lp_yyssa[YYINITDEPTH];	/*  the state stack			*/
  YYSTYPE lp_yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/

  short *lp_yyss = lp_yyssa;		/*  refer to the stacks thru separate pointers */
  YYSTYPE *lp_yyvs = lp_yyvsa;	/*  to allow lp_yyoverflow to reallocate them elsewhere */

#ifdef YYLSP_NEEDED
  YYLTYPE lp_yylsa[YYINITDEPTH];	/*  the location stack			*/
  YYLTYPE *lp_yyls = lp_yylsa;
  YYLTYPE *lp_yylsp;

#define YYPOPSTACK   (lp_yyvsp--, lp_yyssp--, lp_yylsp--)
#else
#define YYPOPSTACK   (lp_yyvsp--, lp_yyssp--)
#endif

  int lp_yystacksize = YYINITDEPTH;
  int lp_yyfree_stacks = 0;

#ifdef YYPURE
  int lp_yychar;
  YYSTYPE lp_yylval;
  int lp_yynerrs;
#ifdef YYLSP_NEEDED
  YYLTYPE lp_yylloc;
#endif
#endif

  YYSTYPE lp_yyval = 0;		/*  the variable used to return		*/
				/*  semantic values from the action	*/
				/*  routines				*/

  int lp_yylen;

#if YYDEBUG != 0
  if (lp_yydebug)
    fprintf(stderr, "Starting parse\n");
#endif

  lp_yystate = 0;
  lp_yyerrstatus = 0;
  lp_yynerrs = 0;
  lp_yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  lp_yyssp = lp_yyss - 1;
  lp_yyvsp = lp_yyvs;
#ifdef YYLSP_NEEDED
  lp_yylsp = lp_yyls;
#endif

/* Push a new state, which is found in  lp_yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
lp_yynewstate:

  *++lp_yyssp = lp_yystate;

  if (lp_yyssp >= lp_yyss + lp_yystacksize - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YYSTYPE *lp_yyvs1 = lp_yyvs;
      short *lp_yyss1 = lp_yyss;
#ifdef YYLSP_NEEDED
      YYLTYPE *lp_yyls1 = lp_yyls;
#endif

      /* Get the current used size of the three stacks, in elements.  */
      int size = lp_yyssp - lp_yyss + 1;

#ifdef lp_yyoverflow
      /* Each stack pointer address is followed by the size of
	 the data in use in that stack, in bytes.  */
#ifdef YYLSP_NEEDED
      /* This used to be a conditional around just the two extra args,
	 but that might be undefined if lp_yyoverflow is a macro.  */
      lp_yyoverflow("parser stack overflow",
		 &lp_yyss1, size * sizeof (*lp_yyssp),
		 &lp_yyvs1, size * sizeof (*lp_yyvsp),
		 &lp_yyls1, size * sizeof (*lp_yylsp),
		 &lp_yystacksize);
#else
      lp_yyoverflow("parser stack overflow",
		 &lp_yyss1, size * sizeof (*lp_yyssp),
		 &lp_yyvs1, size * sizeof (*lp_yyvsp),
		 &lp_yystacksize);
#endif

      lp_yyss = lp_yyss1; lp_yyvs = lp_yyvs1;
#ifdef YYLSP_NEEDED
      lp_yyls = lp_yyls1;
#endif
#else /* no lp_yyoverflow */
      /* Extend the stack our own way.  */
      if (lp_yystacksize >= YYMAXDEPTH)
	{
	  lp_yyerror("parser stack overflow");
	  if (lp_yyfree_stacks)
	    {
	      free (lp_yyss);
	      free (lp_yyvs);
#ifdef YYLSP_NEEDED
	      free (lp_yyls);
#endif
	    }
	  return 2;
	}
      lp_yystacksize *= 2;
      if (lp_yystacksize > YYMAXDEPTH)
	lp_yystacksize = YYMAXDEPTH;
#ifndef YYSTACK_USE_ALLOCA
      lp_yyfree_stacks = 1;
#endif
      lp_yyss = (short *) YYSTACK_ALLOC (lp_yystacksize * sizeof (*lp_yyssp));
      __lp_yy_memcpy ((char *)lp_yyss, (char *)lp_yyss1,
		   size * (unsigned int) sizeof (*lp_yyssp));
      lp_yyvs = (YYSTYPE *) YYSTACK_ALLOC (lp_yystacksize * sizeof (*lp_yyvsp));
      __lp_yy_memcpy ((char *)lp_yyvs, (char *)lp_yyvs1,
		   size * (unsigned int) sizeof (*lp_yyvsp));
#ifdef YYLSP_NEEDED
      lp_yyls = (YYLTYPE *) YYSTACK_ALLOC (lp_yystacksize * sizeof (*lp_yylsp));
      __lp_yy_memcpy ((char *)lp_yyls, (char *)lp_yyls1,
		   size * (unsigned int) sizeof (*lp_yylsp));
#endif
#endif /* no lp_yyoverflow */

      lp_yyssp = lp_yyss + size - 1;
      lp_yyvsp = lp_yyvs + size - 1;
#ifdef YYLSP_NEEDED
      lp_yylsp = lp_yyls + size - 1;
#endif

#if YYDEBUG != 0
      if (lp_yydebug)
	fprintf(stderr, "Stack size increased to %d\n", lp_yystacksize);
#endif

      if (lp_yyssp >= lp_yyss + lp_yystacksize - 1)
	YYABORT;
    }

#if YYDEBUG != 0
  if (lp_yydebug)
    fprintf(stderr, "Entering state %d\n", lp_yystate);
#endif

  goto lp_yybackup;
 lp_yybackup:

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

  /* First try to decide what to do without reference to lookahead token.  */

  lp_yyn = lp_yypact[lp_yystate];
  if (lp_yyn == YYFLAG)
    goto lp_yydefault;

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

  /* lp_yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (lp_yychar == YYEMPTY)
    {
#if YYDEBUG != 0
      if (lp_yydebug)
	fprintf(stderr, "Reading a token: ");
#endif
      lp_yychar = YYLEX;
    }

  /* Convert token to internal form (in lp_yychar1) for indexing tables with */

  if (lp_yychar <= 0)		/* This means end of input. */
    {
      lp_yychar1 = 0;
      lp_yychar = YYEOF;		/* Don't call YYLEX any more */

#if YYDEBUG != 0
      if (lp_yydebug)
	fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      lp_yychar1 = YYTRANSLATE(lp_yychar);

#if YYDEBUG != 0
      if (lp_yydebug)
	{
	  fprintf (stderr, "Next token is %d (%s", lp_yychar, lp_yytname[lp_yychar1]);
	  /* Give the individual parser a way to print the precise meaning
	     of a token, for further debugging info.  */
#ifdef YYPRINT
	  YYPRINT (stderr, lp_yychar, lp_yylval);
#endif
	  fprintf (stderr, ")\n");
	}
#endif
    }

  lp_yyn += lp_yychar1;
  if (lp_yyn < 0 || lp_yyn > YYLAST || lp_yycheck[lp_yyn] != lp_yychar1)
    goto lp_yydefault;

  lp_yyn = lp_yytable[lp_yyn];

  /* lp_yyn is what to do for this token type in this state.
     Negative => reduce, -lp_yyn is rule number.
     Positive => shift, lp_yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (lp_yyn < 0)
    {
      if (lp_yyn == YYFLAG)
	goto lp_yyerrlab;
      lp_yyn = -lp_yyn;
      goto lp_yyreduce;
    }
  else if (lp_yyn == 0)
    goto lp_yyerrlab;

  if (lp_yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YYDEBUG != 0
  if (lp_yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", lp_yychar, lp_yytname[lp_yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (lp_yychar != YYEOF)
    lp_yychar = YYEMPTY;

  *++lp_yyvsp = lp_yylval;
#ifdef YYLSP_NEEDED
  *++lp_yylsp = lp_yylloc;
#endif

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

  lp_yystate = lp_yyn;
  goto lp_yynewstate;

/* Do the default action for the current state.  */
lp_yydefault:

  lp_yyn = lp_yydefact[lp_yystate];
  if (lp_yyn == 0)
    goto lp_yyerrlab;

/* Do a reduction.  lp_yyn is the number of a rule to reduce with.  */
lp_yyreduce:
  lp_yylen = lp_yyr2[lp_yyn];
  if (lp_yylen > 0)
    lp_yyval = lp_yyvsp[1-lp_yylen]; /* implement default value of the action */

#if YYDEBUG != 0
  if (lp_yydebug)
    {
      int i;

      fprintf (stderr, "Reducing via rule %d (line %d), ",
	       lp_yyn, lp_yyrline[lp_yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (i = lp_yyprhs[lp_yyn]; lp_yyrhs[i] > 0; i++)
	fprintf (stderr, "%s ", lp_yytname[lp_yyrhs[i]]);
      fprintf (stderr, " -> %s\n", lp_yytname[lp_yyr1[lp_yyn]]);
    }
#endif


  switch (lp_yyn) {

case 2:
{
  isign = 0;
  make_neg = 0;
  Sign = 0;
  HadConstraint = FALSE;
  HadVar = HadVar0 = FALSE;
;
    break;}
case 4:
{
  set_obj_dir(TRUE);
;
    break;}
case 5:
{
  set_obj_dir(FALSE);
;
    break;}
case 7:
{
  add_row();
  HadConstraint = FALSE;
  HadVar = HadVar0 = FALSE;
  isign = 0;
  make_neg = 0;
;
    break;}
case 15:
{
  if(!add_constraint_name(Last_var))
    YYABORT;
  HadConstraint = TRUE;
;
    break;}
case 17:
{
  HadVar1 = HadVar0;
  HadVar0 = FALSE;
;
    break;}
case 18:
{
  if(!store_re_op((char *) lp_yytext, HadConstraint, HadVar, Had_lineair_sum))
    YYABORT;
  make_neg = 1;
  f1 = 0;
;
    break;}
case 19:
{
  Had_lineair_sum0 = Had_lineair_sum;
  Had_lineair_sum = TRUE;
  HadVar2 = HadVar0;
  HadVar0 = FALSE;
  do_add_row = FALSE;
  if(HadConstraint && !HadVar ) {
    /* it is a range */
    /* already handled */
  }
  else if(!HadConstraint && HadVar) {
    /* it is a bound */

    if(!store_bounds(TRUE))
      YYABORT;
  }
  else {
    /* it is a row restriction */
    if(HadConstraint && HadVar)
      store_re_op("", HadConstraint, HadVar, Had_lineair_sum); /* makes sure that data stored in temporary buffers is treated correctly */
    do_add_row = TRUE;
  }
;
    break;}
case 20:
{
  if((!HadVar) && (!HadConstraint)) {
    lp_yyerror("parse error");
    YYABORT;
  }
  if(do_add_row)
    add_row();
  HadConstraint = FALSE;
  HadVar = HadVar0 = FALSE;
  isign = 0;
  make_neg = 0;
  null_tmp_store(TRUE);
;
    break;}
case 21:
{
  if((!HadVar1) && (Had_lineair_sum0))
    if(!negate_constraint())
      YYABORT;
;
    break;}
case 22:
{
  make_neg = 0;
  isign = 0;
  if(HadConstraint)
    HadVar = Had_lineair_sum = FALSE;
  HadVar0 = FALSE;
  if(!store_re_op((char *) ((*lp_yytext == '<') ? ">" : (*lp_yytext == '>') ? "<" : lp_yytext), HadConstraint, HadVar, Had_lineair_sum))
    YYABORT;
;
    break;}
case 23:
{
  f -= f1;
;
    break;}
case 24:
{
  if((HadVar1) || (!HadVar2) || (HadVar0)) {
    lp_yyerror("parse error");
    YYABORT;
  }

  if(HadConstraint && !HadVar ) {
    /* it is a range */
    /* already handled */
    if(!negate_constraint())
      YYABORT;
  }
  else if(!HadConstraint && HadVar) {
    /* it is a bound */

    if(!store_bounds(TRUE))
      YYABORT;
  }
;
    break;}
case 25:
{
  /* to allow a range */
  /* constraint: < max */
  if(!HadConstraint) {
    lp_yyerror("parse error");
    YYABORT;
  }
  Had_lineair_sum = FALSE;
;
    break;}
case 26:
{
  Had_lineair_sum = TRUE;
;
    break;}
case 28:
{
  isign = Sign;
;
    break;}
case 30:
{
  state = state0 = 0;
;
    break;}
case 31:
{
  if (state == 1) {
    /* RHS_STORE */
    if (    (isign0 || !make_neg)
        && !(isign0 && !make_neg)) /* but not both! */
      f0 = -f0;
    if(make_neg)
      f1 += f0;
    if(!rhs_store(f0, HadConstraint, HadVar, Had_lineair_sum))
      YYABORT;
  }
;
    break;}
case 34:
{
  if ((HadSign || state == 1) && (state0 == 1)) {
    /* RHS_STORE */
    if (    (isign0 || !make_neg)
        && !(isign0 && !make_neg)) /* but not both! */
      f0 = -f0;
    if(make_neg)
      f1 += f0;
    if(!rhs_store(f0, HadConstraint, HadVar, Had_lineair_sum))
      YYABORT;
  }
  if (state == 1) {
    f0 = f;
    isign0 = isign;
  }
  if (state == 2) {
    if((HadSign) || (state0 != 1)) {
     isign0 = isign;
     f0 = 1.0;
    }
    if (    (isign0 || make_neg)
        && !(isign0 && make_neg)) /* but not both! */
      f0 = -f0;
    if(!var_store(Last_var, f0, HadConstraint, HadVar, Had_lineair_sum)) {
      lp_yyerror("var_store failed");
      YYABORT;
    }
    HadConstraint |= HadVar;
    HadVar = HadVar0 = TRUE;
  }
  state0 = state;
;
    break;}
case 35:
{
  state = 1;
;
    break;}
case 36:
{
  if ((HasAR_M_OP) && (state != 1)) {
    lp_yyerror("parse error");
    YYABORT;
  }
;
    break;}
case 37:
{
  state = 2;
;
    break;}
case 41:
{
  isign = Sign;
;
    break;}
case 44:
{
  isign = 0;
  HadSign = FALSE;
;
    break;}
case 45:
{
  isign = Sign;
  HadSign = TRUE;
;
    break;}
case 46:
{
  HasAR_M_OP = FALSE;
;
    break;}
case 47:
{
  HasAR_M_OP = TRUE;
;
    break;}
case 48:
{
  if (    (isign || !make_neg)
      && !(isign && !make_neg)) /* but not both! */
    f = -f;
  if(!rhs_store(f, HadConstraint, HadVar, Had_lineair_sum))
    YYABORT;
  isign = 0;
;
    break;}
case 57:
{
  Within_sos_decl1 = Within_sos_decl;
;
    break;}
case 59:
{
  if((!Within_int_decl) && (!Within_sec_decl) && (!Within_sos_decl1) && (!Within_free_decl)) {
    lp_yyerror("parse error");
    YYABORT;
  }
  SOStype = SOStype0;
  check_int_sec_sos_free_decl(Within_int_decl, Within_sec_decl, Within_sos_decl1 = (Within_sos_decl1 ? 1 : 0), Within_free_decl);
;
    break;}
case 60:
{
  if((Within_sos_decl1) && (SOStype == 0))
  {
    lp_yyerror("Unsupported SOS type (0)");
    YYABORT;
  }
;
    break;}
case 64:
{
  FREE(Last_var0);
  Last_var0 = strdup(Last_var);
;
    break;}
case 66:
{
  if(Within_sos_decl1) {
    set_sos_type(SOStype);
    set_sos_weight((double) SOSweight, 1);
  }
;
    break;}
case 67:
{
  if((Within_sos_decl1) && (!SOStype))
  {
    set_sos_type(SOStype = (short) (f + .1));
  }
  else
  {
    lp_yyerror("SOS type not expected");
    YYABORT;
  }
;
    break;}
case 69:
{
  set_sos_weight((double) SOSweight, 1);
;
    break;}
case 70:
{
  set_sos_weight(f, 1);
;
    break;}
case 77:
{
  if(Within_sos_decl1 == 1)
  {
    char buf[16];

    SOSweight++;
    sprintf(buf, "SOS%d", SOSweight);
    storevarandweight(buf);

    check_int_sec_sos_free_decl(Within_int_decl, Within_sec_decl, 2, Within_free_decl);
    Within_sos_decl1 = 2;
    SOSNr = 0;
  }

  storevarandweight(Last_var);

  if(Within_sos_decl1 == 2)
  {
    SOSNr++;
    set_sos_weight((double) SOSNr, 2);
  }
;
    break;}
case 78:
{
  if(!Within_sos_decl1) {
    lp_yyerror("parse error");
    YYABORT;
  }
  if(Within_sos_decl1 == 1) {
    FREE(Last_var0);
    Last_var0 = strdup(Last_var);
  }
  if(Within_sos_decl1 == 2)
  {
    storevarandweight(Last_var);
    SOSNr++;
    set_sos_weight((double) SOSNr, 2);
  }
;
    break;}
case 79:
{
  if(Within_sos_decl1 == 1)
  {
    char buf[16];

    SOSweight++;
    sprintf(buf, "SOS%d", SOSweight);
    storevarandweight(buf);

    check_int_sec_sos_free_decl(Within_int_decl, Within_sec_decl, 2, Within_free_decl);
    Within_sos_decl1 = 2;
    SOSNr = 0;

    storevarandweight(Last_var0);
    SOSNr++;
  }

  set_sos_weight(f, 2);
;
    break;}
case 80:
{ /* SOS name */
  if(Within_sos_decl1 == 1)
  {
    storevarandweight(Last_var0);
    set_sos_type(SOStype);
    check_int_sec_sos_free_decl(Within_int_decl, Within_sec_decl, 2, Within_free_decl);
    Within_sos_decl1 = 2;
    SOSNr = 0;
    SOSweight++;
  }
;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */


  lp_yyvsp -= lp_yylen;
  lp_yyssp -= lp_yylen;
#ifdef YYLSP_NEEDED
  lp_yylsp -= lp_yylen;
#endif

#if YYDEBUG != 0
  if (lp_yydebug)
    {
      short *ssp1 = lp_yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != lp_yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++lp_yyvsp = lp_yyval;

#ifdef YYLSP_NEEDED
  lp_yylsp++;
  if (lp_yylen == 0)
    {
      lp_yylsp->first_line = lp_yylloc.first_line;
      lp_yylsp->first_column = lp_yylloc.first_column;
      lp_yylsp->last_line = (lp_yylsp-1)->last_line;
      lp_yylsp->last_column = (lp_yylsp-1)->last_column;
      lp_yylsp->text = 0;
    }
  else
    {
      lp_yylsp->last_line = (lp_yylsp+lp_yylen-1)->last_line;
      lp_yylsp->last_column = (lp_yylsp+lp_yylen-1)->last_column;
    }
#endif

  /* 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.  */

  lp_yyn = lp_yyr1[lp_yyn];

  lp_yystate = lp_yypgoto[lp_yyn - YYNTBASE] + *lp_yyssp;
  if (lp_yystate >= 0 && lp_yystate <= YYLAST && lp_yycheck[lp_yystate] == *lp_yyssp)
    lp_yystate = lp_yytable[lp_yystate];
  else
    lp_yystate = lp_yydefgoto[lp_yyn - YYNTBASE];

  goto lp_yynewstate;

lp_yyerrlab:   /* here on detecting error */

  if (! lp_yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++lp_yynerrs;

#ifdef YYERROR_VERBOSE
      lp_yyn = lp_yypact[lp_yystate];

      if (lp_yyn > YYFLAG && lp_yyn < YYLAST)
	{
	  int size = 0;
	  char *msg;
	  int x, count;

	  count = 0;
	  /* Start X at -lp_yyn if nec to avoid negative indexes in lp_yycheck.  */
	  for (x = (lp_yyn < 0 ? -lp_yyn : 0);
	       x < (sizeof(lp_yytname) / sizeof(char *)); x++)
	    if (lp_yycheck[x + lp_yyn] == x)
	      size += strlen(lp_yytname[x]) + 15, count++;
	  msg = (char *) malloc(size + 15);
	  if (msg != 0)
	    {
	      strcpy(msg, "parse error");

	      if (count < 5)
		{
		  count = 0;
		  for (x = (lp_yyn < 0 ? -lp_yyn : 0);
		       x < (sizeof(lp_yytname) / sizeof(char *)); x++)
		    if (lp_yycheck[x + lp_yyn] == x)
		      {
			strcat(msg, count == 0 ? ", expecting `" : " or `");
			strcat(msg, lp_yytname[x]);
			strcat(msg, "'");
			count++;
		      }
		}
	      lp_yyerror(msg);
	      free(msg);
	    }
	  else
	    lp_yyerror ("parse error; also virtual memory exceeded");
	}
      else
#endif /* YYERROR_VERBOSE */
	lp_yyerror("parse error");
    }

  goto lp_yyerrlab1;
lp_yyerrlab1:   /* here on error raised explicitly by an action */

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

      /* return failure if at end of input */
      if (lp_yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (lp_yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", lp_yychar, lp_yytname[lp_yychar1]);
#endif

      lp_yychar = YYEMPTY;
    }

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

  lp_yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto lp_yyerrhandle;

lp_yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  lp_yyn = lp_yydefact[lp_yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (lp_yyn) goto lp_yydefault;
#endif

lp_yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (lp_yyssp == lp_yyss) YYABORT;
  lp_yyvsp--;
  lp_yystate = *--lp_yyssp;
#ifdef YYLSP_NEEDED
  lp_yylsp--;
#endif

#if YYDEBUG != 0
  if (lp_yydebug)
    {
      short *ssp1 = lp_yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != lp_yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

lp_yyerrhandle:

  lp_yyn = lp_yypact[lp_yystate];
  if (lp_yyn == YYFLAG)
    goto lp_yyerrdefault;

  lp_yyn += YYTERROR;
  if (lp_yyn < 0 || lp_yyn > YYLAST || lp_yycheck[lp_yyn] != YYTERROR)
    goto lp_yyerrdefault;

  lp_yyn = lp_yytable[lp_yyn];
  if (lp_yyn < 0)
    {
      if (lp_yyn == YYFLAG)
	goto lp_yyerrpop;
      lp_yyn = -lp_yyn;
      goto lp_yyreduce;
    }
  else if (lp_yyn == 0)
    goto lp_yyerrpop;

  if (lp_yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (lp_yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++lp_yyvsp = lp_yylval;
#ifdef YYLSP_NEEDED
  *++lp_yylsp = lp_yylloc;
#endif

  lp_yystate = lp_yyn;
  goto lp_yynewstate;

 lp_yyacceptlab:
  /* YYACCEPT comes here.  */
  if (lp_yyfree_stacks)
    {
      free (lp_yyss);
      free (lp_yyvs);
#ifdef YYLSP_NEEDED
      free (lp_yyls);
#endif
    }
  return 0;

 lp_yyabortlab:
  /* YYABORT comes here.  */
  if (lp_yyfree_stacks)
    {
      free (lp_yyss);
      free (lp_yyvs);
#ifdef YYLSP_NEEDED
      free (lp_yyls);
#endif
    }
  return 1;
}


static void lp_yy_delete_allocated_memory(void)
{
  /* free memory allocated by flex. Otherwise some memory is not freed.
     This is a bit tricky. There is not much documentation about this, but a lot of
     reports of memory that keeps allocated */

  /* If you get errors on this function call, just comment it. This will only result
     in some memory that is not being freed. */

# if defined YY_CURRENT_BUFFER
    /* flex defines the macro YY_CURRENT_BUFFER, so you should only get here if lp_rlp.h is
       generated by flex */
    /* lex doesn't define this macro and thus should not come here, but lex doesn't has
       this memory leak also ...*/

    lp_yy_delete_buffer(YY_CURRENT_BUFFER); /* comment this line if you have problems with it */
    lp_yy_init = 1; /* make sure that the next time memory is allocated again */
    lp_yy_start = 0;
# endif

  FREE(Last_var);
  FREE(Last_var0);
}

static int parse(void)
{
  return(lp_yyparse());
}

lprec *read_lp1(lprec *lp, void *userhandle, read_modeldata_func read_modeldata, int verbose, char *lp_name)
{
  lp_yyin = (FILE *) userhandle;
  lp_yyout = NULL;
  lp_yylineno = 1;
  lp_input = read_modeldata;
  return(yacc_read(lp, verbose, lp_name, &lp_yylineno, parse, lp_yy_delete_allocated_memory));
}

lprec * __WINAPI read_lp(FILE *filename, int verbose, char *lp_name)
{
  return(read_lp1(NULL, filename, lp_input_lp_yyin, verbose, lp_name));
}

lprec * __WINAPI read_lpex(void *userhandle, read_modeldata_func read_modeldata, int verbose, char *lp_name)
{
  return(read_lp1(NULL, userhandle, read_modeldata, verbose, lp_name));
}

lprec *read_LP1(lprec *lp, char *filename, int verbose, char *lp_name)
{
  FILE *fpin;

  if((fpin = fopen(filename, "r")) != NULL) {
    lp = read_lp1(lp, fpin, lp_input_lp_yyin, verbose, lp_name);
    fclose(fpin);
  }
  else
    lp = NULL;
  return(lp);
}

lprec * __WINAPI read_LP(char *filename, int verbose, char *lp_name)
{
  return(read_LP1(NULL, filename, verbose, lp_name));
}

MYBOOL __WINAPI LP_readhandle(lprec **lp, FILE *filename, int verbose, char *lp_name)
{
  if(lp != NULL)
    *lp = read_lp1(*lp, filename, lp_input_lp_yyin, verbose, lp_name);

  return((lp != NULL) && (*lp != NULL));
}


syntax highlighted by Code2HTML, v. 0.9.1