This is y.tab.c in view mode; [Download] [Up]
# define VAR 257
# define CONS 258
# define SIGN 259
# define AR_M_OP 260
# define RE_OP 261
# define END_C 262
# define COMMA 263
# define COLON 264
# define MINIMISE 265
# define MAXIMISE 266
# line 10 "lp.y"
#include "lpkit.h"
#include "lpglob.h"
#include "read.h"
/* globals */
char Last_var[NAMELEN];
char Constraint_name[NAMELEN];
int Lin_term_count;
REAL f;
int x;
int Sign;
int isign; /* internal_sign variable to make sure nothing goes wrong */
/* with lookahead */
int make_neg; /* is true after the relational operator is seen in order */
/* to remember if lin_term stands before or after re_op */
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
extern short yyerrflag;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
#ifndef YYSTYPE
#define YYSTYPE int
#endif
YYSTYPE yylval, yyval;
# define YYERRCODE 256
# line 195 "lp.y"
#include "lex.c"
short yyexca[] ={
-1, 1,
0, -1,
-2, 0,
-1, 31,
257, 15,
-2, 31,
};
# define YYNPROD 38
# define YYLAST 87
short yyact[]={
10, 11, 9, 34, 36, 51, 56, 57, 5, 4,
50, 52, 23, 44, 36, 24, 35, 10, 20, 18,
26, 10, 20, 27, 31, 20, 18, 10, 11, 9,
15, 20, 18, 10, 11, 42, 40, 17, 14, 16,
19, 32, 13, 8, 6, 8, 8, 38, 25, 21,
22, 7, 47, 37, 43, 29, 33, 30, 46, 45,
28, 12, 3, 2, 1, 0, 39, 0, 0, 0,
0, 0, 41, 0, 0, 48, 0, 0, 0, 49,
0, 0, 0, 0, 53, 55, 54 };
short yypact[]={
-1000,-1000,-257,-227,-230,-230,-1000,-247,-1000,-1000,
-1000,-237,-233,-1000,-1000,-261,-245,-1000,-1000,-1000,
-237,-1000,-1000,-1000,-1000,-224,-1000,-221,-1000,-1000,
-222,-261,-1000,-244,-1000,-1000,-1000,-236,-224,-1000,
-1000,-1000,-1000,-252,-1000,-240,-240,-236,-1000,-1000,
-1000,-1000,-251,-1000,-255,-1000,-1000,-1000 };
short yypgo[]={
0, 64, 63, 62, 61, 60, 42, 38, 59, 39,
58, 57, 41, 56, 54, 37, 53, 52, 40, 51,
48, 47, 44 };
short yyr1[]={
0, 2, 1, 4, 4, 6, 8, 6, 10, 7,
5, 5, 11, 11, 12, 13, 14, 14, 14, 9,
16, 9, 17, 9, 15, 15, 19, 20, 19, 21,
19, 18, 18, 18, 3, 3, 3, 22 };
short yyr2[]={
0, 0, 4, 1, 2, 1, 0, 4, 0, 5,
0, 1, 1, 2, 3, 1, 1, 2, 3, 1,
0, 3, 0, 4, 1, 1, 1, 0, 3, 0,
4, 1, 2, 3, 2, 2, 1, 2 };
short yychk[]={
-1000, -1, -2, -3, 266, 265, -22, -19, -18, 259,
257, 258, -4, -6, -7, 257, -9, -15, 259, -18,
258, -22, -22, 259, 262, -20, 257, 260, -5, -6,
-11, 257, -12, -13, 264, 261, 259, -16, -21, -18,
257, -12, 257, -14, 257, -8, -10, -17, -15, -18,
262, 257, 263, -7, -9, -15, 257, 262 };
short yydef[]={
1, -2, 0, 0, 0, 0, 36, 0, 26, 27,
31, 0, 10, 3, 5, 31, 0, 19, 20, 24,
25, 34, 35, 29, 37, 0, 32, 0, 2, 4,
11, -2, 12, 0, 6, 8, 22, 0, 0, 28,
33, 13, 15, 0, 16, 0, 0, 0, 21, 30,
14, 17, 0, 7, 0, 23, 18, 9 };
# line 1 "/usr/lib/yaccpar"
#ifndef lint
static char yaccpar_sccsid[] = "@(#)yaccpar 4.1 (Berkeley) 2/11/83";
#endif not lint
# define YYFLAG -1000
# define YYERROR goto yyerrlab
# define YYACCEPT return(0)
# define YYABORT return(1)
/* parser for yacc output */
#ifdef YYDEBUG
int yydebug = 0; /* 1 for debugging */
#endif
YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
int yychar = -1; /* current input token number */
int yynerrs = 0; /* number of errors */
short yyerrflag = 0; /* error recovery flag */
yyparse() {
short yys[YYMAXDEPTH];
short yyj, yym;
register YYSTYPE *yypvt;
register short yystate, *yyps, yyn;
register YYSTYPE *yypv;
register short *yyxi;
yystate = 0;
yychar = -1;
yynerrs = 0;
yyerrflag = 0;
yyps= &yys[-1];
yypv= &yyv[-1];
yystack: /* put a state and value onto the stack */
#ifdef YYDEBUG
if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar );
#endif
if( ++yyps>= &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
*yyps = yystate;
++yypv;
*yypv = yyval;
yynewstate:
yyn = yypact[yystate];
if( yyn<= YYFLAG ) goto yydefault; /* simple state */
if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
yychar = -1;
yyval = yylval;
yystate = yyn;
if( yyerrflag > 0 ) --yyerrflag;
goto yystack;
}
yydefault:
/* default state action */
if( (yyn=yydef[yystate]) == -2 ) {
if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
/* look through exception table */
for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
while( *(yyxi+=2) >= 0 ){
if( *yyxi == yychar ) break;
}
if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */
}
if( yyn == 0 ){ /* error */
/* error ... attempt to resume parsing */
switch( yyerrflag ){
case 0: /* brand new error */
yyerror( "syntax error" );
yyerrlab:
++yynerrs;
case 1:
case 2: /* incompletely recovered error ... try again */
yyerrflag = 3;
/* find a state where "error" is a legal shift action */
while ( yyps >= yys ) {
yyn = yypact[*yyps] + YYERRCODE;
if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
yystate = yyact[yyn]; /* simulate a shift of "error" */
goto yystack;
}
yyn = yypact[*yyps];
/* the current yyps has no shift onn "error", pop stack */
#ifdef YYDEBUG
if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
#endif
--yyps;
--yypv;
}
/* there is no state on the stack with an error shift ... abort */
yyabort:
return(1);
case 3: /* no shift yet; clobber input char */
#ifdef YYDEBUG
if( yydebug ) printf( "error recovery discards char %d\n", yychar );
#endif
if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
yychar = -1;
goto yynewstate; /* try again in the same state */
}
}
/* reduction by production yyn */
#ifdef YYDEBUG
if( yydebug ) printf("reduce %d\n",yyn);
#endif
yyps -= yyr2[yyn];
yypvt = yypv;
yypv -= yyr2[yyn];
yyval = yypv[1];
yym=yyn;
/* consult goto table to find next state */
yyn = yyr1[yyn];
yyj = yypgo[yyn] + *yyps + 1;
if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
switch(yym){
case 1:
# line 33 "lp.y"
{
init_read();
isign = 0;
make_neg = 0;
Sign = 0;
} break;
case 6:
# line 51 "lp.y"
{
add_constraint_name(Last_var, Rows);
} break;
case 8:
# line 60 "lp.y"
{
store_re_op();
make_neg = 1;
} break;
case 9:
# line 66 "lp.y"
{
if(Lin_term_count == 0)
{
fprintf(stderr, "WARNING line %d: constraint contains no variables\n",
yylineno);
null_tmp_store();
}
if(Lin_term_count > 1)
Rows++;
if(Lin_term_count == 1)
store_bounds();
Lin_term_count = 0;
isign = 0 ;
make_neg = 0;
Constraint_name[0] = '\0';
} break;
case 15:
# line 98 "lp.y"
{/* check_decl(yytext);*/} break;
case 16:
# line 101 "lp.y"
{add_int_var((char *)yytext);} break;
case 17:
# line 102 "lp.y"
{add_int_var((char *)yytext);} break;
case 18:
# line 103 "lp.y"
{add_int_var((char *)yytext);} break;
case 20:
# line 108 "lp.y"
{
isign = Sign;
} break;
case 22:
# line 114 "lp.y"
{
isign = Sign;
} break;
case 25:
# line 122 "lp.y"
{
if ( (isign || !make_neg)
&& !(isign && !make_neg)) /* but not both! */
f = -f;
rhs_store(f);
isign = 0;
} break;
case 27:
# line 133 "lp.y"
{
isign = Sign;
} break;
case 29:
# line 139 "lp.y"
{
isign = Sign;
} break;
case 31:
# line 146 "lp.y"
{
if ( (isign || make_neg)
&& !(isign && make_neg)) /* but not both! */
var_store(Last_var, Rows, (REAL) - 1);
else
var_store(Last_var, Rows, (REAL)1);
isign = 0;
} break;
case 32:
# line 156 "lp.y"
{
if ( (isign || make_neg)
&& !(isign && make_neg)) /* but not both! */
f = -f;
var_store(Last_var, Rows, f);
isign = 0;
} break;
case 33:
# line 166 "lp.y"
{
if ( (isign || make_neg)
&& !(isign && make_neg)) /* but not both! */
f = -f;
var_store(Last_var, Rows, f);
isign = 0;
} break;
case 34:
# line 176 "lp.y"
{
Maximise = TRUE;
} break;
case 35:
# line 180 "lp.y"
{
Maximise = FALSE;
} break;
case 37:
# line 188 "lp.y"
{
Rows++;
Lin_term_count = 0;
isign = 0;
make_neg = 0;
} break;
# line 148 "/usr/lib/yaccpar"
}
goto yystack; /* stack new state and value */
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.