/* C:\MKS\BIN\YACC.EXE parse.y */
#define CHAR	257
#define NUMBER	258
#define SECTEND	259
#define SCDECL	260
#define XSCDECL	261
#define WHITESPACE	262
#define NAME	263
#define PREVCCL	264
#line 17 "parse.y"

#include "flexdef.h"

int pat, scnum, eps, headcnt, trailcnt, anyccl, lastchar, i, actvp, rulelen;
int trlcontxt, xcluflg, cclsorted, varlength;
char clower();

static int madeany = false;  /* whether we've made the '.' character class */

extern int yychar, yyerrflag;
#ifndef YYSTYPE
#define YYSTYPE int
#endif
extern YYSTYPE yyval, yylval;
#line 474
/* synerr - report a syntax error
 *
 * synopsis
 *    char str[];
 *    synerr( str );
 */

synerr( str )
char str[];

    {
    syntaxerror = true;
    fprintf( stderr, "Syntax error at line %d:  %s\n", linenum, str );
    }


/* yyerror - eat up an error message from the parser
 *
 * synopsis
 *    char msg[];
 *    yyerror( msg );
 */

yyerror( msg )
char msg[];

    {
    }
static short yydef[] = {
	  -1,   -9,  -13,  -17,   10,    8,  -23,    9,    7,  -27, 
	 -31,   11,    6,  -35
};
static short yyex[] = {
	 259,   52,  260,   52,  261,   52,   -1,    1,    0,    0, 
	  -1,    1,    0,    3,   -1,    4,  257,   14,   93,   14, 
	  -1,    1,   10,    5,   -1,    1,   10,    5,   -1,    1, 
	  10,    5,   -1,    1,   10,    5,   -1,    1
};
static short yyact[] = {
	 -40,  256,  -74,   10,  -77,  -73,  -72,  261,  260,  259, 
	 -37,  262,  -69,  -70,  263,  256,  -76,  -34,  262,   10, 
	 -41,  -33,  -52,  -31,   -4,  -30,  -64,  -47,  -50,  264, 
	 257,  256,   94,   91,   60,   46,   40,   34,  -71,  263, 
	 -43,   94,  -41,  -33,  -52,   -4,  -47,  -50,  264,  257, 
	  91,   46,   40,   34,  -58,  -57,  -56,  -24,  123,   63, 
	  43,   42,  -61,  -62,  263,  256,  -60,  -59,  -22,  124, 
	  47,   36,  -41,  -33,  -52,   -4,  -21,  -47,  -50,  264, 
	 257,   94,   91,   46,   40,   34,  -78,   10,  -46,  -12, 
	 257,   93,  -48,  -59,  -22,  124,   47,   41,  -49,  -42, 
	 257,   34,  -19,  258,  -18,  -80,   62,   44,  -45,  -12, 
	 257,   93,  -17,   45,  -16,  -53,  125,   44,  -63,  263, 
	 -44,  257,  -54,  -15,  258,  125,  -55,  125,   -1
};
static short yypact[] = {
	   1,    2,   16,   41,   58,   48,   69,   58,   48,   69, 
	  69,  113,   48,   69,  127,  124,  121,  119,  116,  110, 
	  48,   48,  106,  103,  100,   95,   90,   87,   79,   48, 
	  64,   48,   48,   39,   29,   18,   14,   11,    7,    3
};
static short yygo[] = {
	  -2,   -1,  -39,  -79,   -3,  -38,  -36,  -35,  -28,  -29, 
	 -14,  -11,  -10,  -26,   -7,   32,   29,   28,   20,  -66, 
	 -67,  -68,  -65,   13,   10,    9,  -23,  -13,   -9,   -6, 
	  31,   21,  -32,   -8,   -8,   -8,   -5,   12,    8,    5, 
	 -51,  -25,  -20,  -27,   42,   -1
};
static short yypgo[] = {
	   0,    0,    0,    0,    7,   22,   14,   14,   14,   29, 
	  29,   43,   41,   41,   43,   43,   40,   40,   36,   36, 
	  36,   36,   36,   36,   36,   36,   36,   36,   36,   36, 
	  32,   22,   26,   26,   26,    8,    8,    8,    8,    8, 
	   6,    6,    6,    5,    5,    2,    1,    2,    3,    4, 
	   4,    9,    2,    0
};
static short yyrlen[] = {
	   0,    0,    0,    4,    0,    0,    3,    2,    1,    2, 
	   1,    2,    0,    2,    0,    4,    4,    3,    1,    3, 
	   3,    1,    1,    1,    4,    5,    6,    2,    2,    2, 
	   2,    1,    1,    1,    3,    1,    2,    3,    3,    4, 
	   1,    1,    3,    1,    1,    2,    0,    5,    1,    4, 
	   0,    3,    0,    2
};
#define YYS0	74
#define YYDELTA	28
#define YYNPACT	40
#define YYNDEF	14

#define YYr51	0
#define YYr52	1
#define YYr53	2
#define YYr1	3
#define YYr14	4
#define YYr25	5
#define YYr26	6
#define YYr27	7
#define YYr28	8
#define YYr30	9
#define YYr31	10
#define YYr47	11
#define YYr50	12
#define YYr49	13
#define YYr48	14
#define YYr46	15
#define YYr45	16
#define YYr44	17
#define YYr43	18
#define YYr42	19
#define YYr41	20
#define YYr40	21
#define YYr39	22
#define YYr38	23
#define YYr37	24
#define YYr36	25
#define YYr35	26
#define YYr34	27
#define YYr33	28
#define YYr32	29
#define YYr29	30
#define YYr24	31
#define YYr23	32
#define YYr22	33
#define YYr21	34
#define YYr19	35
#define YYr18	36
#define YYr17	37
#define YYr16	38
#define YYr15	39
#define YYr11	40
#define YYr10	41
#define YYr9	42
#define YYr8	43
#define YYr7	44
#define YYr5	45
#define YYr2	46
#define YYrACCEPT	YYr51
#define YYrERROR	YYr52
#define YYrLR2	YYr53
#line 2 "yacc parser: c:\mks/etc/yyparse.c"

/*
 * Automaton to interpret LALR(1) tables.
 *
 *	Macros:
 *		yyclearin - clear the lookahead token.
 *		yyerrok - forgive a pending error
 *		YYERROR - simulate an error
 *		YYACCEPT - halt and return 0
 *		YYABORT - halt and return 1
 *		YYRETURN(value) - halt and return value.  You should use this
 *			instead of return(value).
 *		YYREAD - ensure yychar contains a lookahead token by reading
 *			one if it does not.  See also YYSYNC.
 *
 *	Preprocessor flags:
 *		YYDEBUG - includes debug code.  The parser will print
 *			 a travelogue of the parse if this is defined
 *			 and yydebug is non-zero.
 *		YYSSIZE - size of state and value stacks (default 150).
 *		YYSTATIC - By default, the state stack is an automatic array.
 *			If this is defined, the stack will be static.
 *			In either case, the value stack is static.
 *		YYALLOC - Dynamically allocate both the state and value stacks
 *			by calling malloc() and free().
 *		YYLR2 - defined if lookahead is needed to resolve R/R or S/R conflicts
 *		YYSYNC - if defined, yacc guarantees to fetch a lookahead token
 *			before any action, even if it doesnt need it for a decision.
 *			If YYSYNC is defined, YYREAD will never be necessary unless
 *			the user explicitly sets yychar = -1
 *
 *	Copyright (c) 1983, by the University of Waterloo
 */

#ifndef YYSSIZE
# define YYSSIZE	150
#endif
#ifndef	YYDEBUG
#define	YYDEBUG	0
#endif
#define YYERROR		goto yyerrlabel
#define yyerrok		yyerrflag = 0
#define yyclearin	yychar = -1
#define YYACCEPT	YYRETURN(0)
#define YYABORT		YYRETURN(1)
#ifdef YYALLOC
# define YYRETURN(val)	{ retval = (val); goto yyReturn; }
#else
# define YYRETURN(val)	return(val)
#endif
#if YYDEBUG
/* The if..else makes this macro behave exactly like a statement */
# define YYREAD	if (yychar < 0) {					\
			if ((yychar = yylex()) < 0)			\
				yychar = 0;				\
			if (yydebug)					\
				printf("read %s (%d)\n", yyptok(yychar),\
				yychar);				\
		} else
#else
# define YYREAD	if (yychar < 0) {					\
			if ((yychar = yylex()) < 0)			\
				yychar = 0;				\
		} else
#endif
#define YYERRCODE	256		/* value of `error' */
#if __TURBOC__&&__SMALL__
#define	YYQYYP	*(int *)((int)yyq + ((int)yyq-(int)yyp))
#else
#define	YYQYYP	yyq[yyq-yyp]
#endif

YYSTYPE	yyval,				/* $$ */
	*yypvt,				/* $n */
	yylval;				/* yylex() sets this */

int	yychar,				/* current token */
	yyerrflag,			/* error flag */
	yynerrs;			/* error count */

#if YYDEBUG
int yydebug = YYDEBUG-0;		/* debug flag & tables */
extern char	*yysvar[], *yystoken[], *yyptok();
extern short	yyrmap[], yysmap[];
extern int	yynstate, yynvar, yyntoken, yynrule;
# define yyassert(condition, msg, arg) \
	if (!(condition)) { printf("\nyacc bug: "); printf(msg, arg); YYABORT; }
#else /* !YYDEBUG */
# define yyassert(condition, msg, arg)
#endif

yyparse()
{

	register short		yyi, *yyp;	/* for table lookup */
	register short		*yyps;		/* top of state stack */
	register short		yystate;	/* current state */
	register YYSTYPE	*yypv;		/* top of value stack */
	register short		*yyq;
	register int		yyj;

#ifdef YYSTATIC
	static short	yys[YYSSIZE + 1];
	static YYSTYPE	yyv[YYSSIZE + 1];
#else
#ifdef YYALLOC
	YYSTYPE *yyv;
	short	*yys;
	YYSTYPE save_yylval, save_yyval, *save_yypvt;
	int save_yychar, save_yyerrflag, save_yynerrs;
	int retval;
#if 0	/* defined in <stdlib.h>*/
	extern char	*malloc();
#endif 0
#else
	short		yys[YYSSIZE + 1];
	static YYSTYPE	yyv[YYSSIZE + 1];	/* historically static */
#endif
#endif

#ifdef YYALLOC
	yys = (short *) malloc((YYSSIZE + 1) * sizeof(short));
	yyv = (YYSTYPE *) malloc((YYSSIZE + 1) * sizeof(YYSTYPE));
	if (yys == (short *)0 || yyv == (YYSTYPE *)0) {
		yyerror("Not enough space for parser stacks");
		return 1;
	}
	save_yylval = yylval;
	save_yyval = yyval;
	save_yypvt = yypvt;
	save_yychar = yychar;
	save_yyerrflag = yyerrflag;
	save_yynerrs = yynerrs;
#endif

	yynerrs = 0;
	yyerrflag = 0;
	yychar = -1;
	yyps = yys;
	yypv = yyv;
	yystate = YYS0;		/* start state */

yyStack:
	yyassert((unsigned)yystate < yynstate, "state %d\n", yystate);
	if (++yyps > &yys[YYSSIZE]) {
		yyerror("Parser stack overflow");
		YYABORT;
	}
	*yyps = yystate;	/* stack current state */
	*++yypv = yyval;	/* ... and value */

#if YYDEBUG
	if (yydebug)
		printf("state %d (%d), char %s (%d)\n", yysmap[yystate],
			yystate, yyptok(yychar), yychar);
#endif

	/*
	 *	Look up next action in action table.
	 */
yyEncore:
#ifdef YYSYNC
	YYREAD;
#endif
	if (yystate >= sizeof yypact/sizeof yypact[0]) 	/* simple state */
		yyi = yystate - YYDELTA;	/* reduce in any case */
	else {
		if(*(yyp = &yyact[yypact[yystate]]) >= 0) {
			/* Look for a shift on yychar */
#ifndef YYSYNC
			YYREAD;
#endif
			yyq = yyp;
			yyi = yychar;
#if __TURBOC__&&__SMALL__
			/* yyi is in di, yyp is in si */
		L01:
			asm lodsw	/* ax = *yyp++; */
			asm cmp yyi, ax
			asm jl L01
#else
			while (yyi < *yyp++)
				;
#endif
			if (yyi == yyp[-1]) {
				yystate = ~YYQYYP;
#if YYDEBUG
				if (yydebug)
					printf("shift %d (%d)\n", yysmap[yystate], yystate);
#endif
				yyval = yylval;		/* stack what yylex() set */
				yychar = -1;		/* clear token */
				if (yyerrflag)
					yyerrflag--;	/* successful shift */
				goto yyStack;
			}
		}

		/*
	 	 *	Fell through - take default action
	 	 */

		if (yystate >= sizeof yydef /sizeof yydef[0])
			goto yyError;
		if ((yyi = yydef[yystate]) < 0)	 { /* default == reduce? */
											/* Search exception table */
			yyassert((unsigned)~yyi < sizeof yyex/sizeof yyex[0],
				"exception %d\n", yystate);
			yyp = &yyex[~yyi];
#ifndef YYSYNC
			YYREAD;
#endif
			while((yyi = *yyp) >= 0 && yyi != yychar)
				yyp += 2;
			yyi = yyp[1];
			yyassert(yyi >= 0,"Ex table not reduce %d\n", yyi);
		}
	}

#ifdef YYLR2
yyReduce:	/* reduce yyi */
#endif
	yyassert((unsigned)yyi < yynrule, "reduce %d\n", yyi);
	yyj = yyrlen[yyi];
#if YYDEBUG
	if (yydebug) printf("reduce %d (%d), pops %d (%d)\n", yyrmap[yyi],
		yyi, yysmap[yyps[-yyj]], yyps[-yyj]);
#endif
	yyps -= yyj;		/* pop stacks */
	yypvt = yypv;		/* save top */
	yypv -= yyj;
	yyval = yypv[1];	/* default action $$ = $1 */
	switch (yyi) {		/* perform semantic action */
		
case YYr1: {	/* goal :  initlex sect1 sect1end sect2 */
#line 30 "parse.y"
 
			int def_rule;

			pat = cclinit();
			cclnegate( pat );

			def_rule = mkstate( -pat );

			add_accept( def_rule, 0, 0 );

			for ( i = 1; i <= lastsc; ++i )
			    scset[i] = mkbranch( scset[i], def_rule );

			fputs( "YY_DEFAULT_ACTION;\n\tYY_BREAK\n",
			       temp_action_file );
			
} break;

case YYr2: {	/* initlex :  */
#line 49

			

			
			scinstal( "INITIAL", false );
			
} break;

case YYr5: {	/* sect1 :  error '\n' */
#line 60
 synerr( "unknown error processing section 1" ); 
} break;

case YYr7: {	/* startconddecl :  SCDECL */
#line 67

			

			xcluflg = false;
			
} break;

case YYr8: {	/* startconddecl :  XSCDECL */
#line 77
 xcluflg = true; 
} break;

case YYr9: {	/* namelist1 :  namelist1 WHITESPACE NAME */
#line 81
 scinstal( nmstr, xcluflg ); 
} break;

case YYr10: {	/* namelist1 :  NAME */
#line 84
 scinstal( nmstr, xcluflg ); 
} break;

case YYr11: {	/* namelist1 :  error */
#line 87
 synerr( "bad start condition list" ); 
} break;

case YYr14: {	/* initforrule :  */
#line 95

			
			trlcontxt = varlength = false;
			trailcnt = headcnt = rulelen = 0;
			
} break;

case YYr15: {	/* flexrule :  scon '^' re eol */
#line 103

			pat = link_machines( yypvt[-1], yypvt[0] );
			add_accept( pat, headcnt, trailcnt );

			for ( i = 1; i <= actvp; ++i )
			    scbol[actvsc[i]] = mkbranch( scbol[actvsc[i]], pat );
			
} break;

case YYr16: {	/* flexrule :  scon re eol */
#line 112

			pat = link_machines( yypvt[-1], yypvt[0] );
			add_accept( pat, headcnt, trailcnt );

			for ( i = 1; i <= actvp; ++i )
			    scset[actvsc[i]] = mkbranch( scset[actvsc[i]], pat );
			
} break;

case YYr17: {	/* flexrule :  '^' re eol */
#line 121

			pat = link_machines( yypvt[-1], yypvt[0] );
			add_accept( pat, headcnt, trailcnt );

			

			for ( i = 1; i <= lastsc; ++i )
			    if ( ! scxclu[i] )
				scbol[i] = mkbranch( scbol[i], pat );
			
} break;

case YYr18: {	/* flexrule :  re eol */
#line 135

			pat = link_machines( yypvt[-1], yypvt[0] );
			add_accept( pat, headcnt, trailcnt );

			for ( i = 1; i <= lastsc; ++i )
			    if ( ! scxclu[i] )
				scset[i] = mkbranch( scset[i], pat );
			
} break;

case YYr19: {	/* flexrule :  error */
#line 145
 synerr( "unrecognized rule" ); 
} break;

case YYr21: {	/* namelist2 :  namelist2 ',' NAME */
#line 152

			if ( (scnum = sclookup( nmstr )) == 0 )
			    synerr( "undeclared start condition" );

			else
			    actvsc[++actvp] = scnum;
			
} break;

case YYr22: {	/* namelist2 :  NAME */
#line 161

			if ( (scnum = sclookup( nmstr )) == 0 )
			    synerr( "undeclared start condition" );
			else
			    actvsc[actvp = 1] = scnum;
			
} break;

case YYr23: {	/* namelist2 :  error */
#line 169
 synerr( "bad start condition list" ); 
} break;

case YYr24: {	/* eol :  '$' */
#line 173

			if ( trlcontxt )
			    {
			    synerr( "trailing context used twice" );
			    yyval = mkstate( SYM_EPSILON );
			    }
			else
			    {
			    trlcontxt = true;

			    if ( ! varlength )
				headcnt = rulelen;

			    ++rulelen;
			    trailcnt = 1;

			    eps = mkstate( SYM_EPSILON );
			    yyval = link_machines( eps, mkstate( '\n' ) );
			    }
			
} break;

case YYr25: {	/* eol :  */
#line 195

		        yyval = mkstate( SYM_EPSILON );

			if ( trlcontxt )
			    {
			    if ( varlength && headcnt == 0 )
				
				synerr( "illegal trailing context" );

			    else
				trailcnt = rulelen;
			    }
		        
} break;

case YYr26: {	/* re :  re '|' series */
#line 211

			varlength = true;

			yyval = mkor( yypvt[-2], yypvt[0] );
			
} break;

case YYr27: {	/* re :  re2 series */
#line 218
 yyval = link_machines( yypvt[-1], yypvt[0] ); 
} break;

case YYr28: {	/* re :  series */
#line 221
 yyval = yypvt[0]; 
} break;

case YYr29: {	/* re2 :  re '/' */
#line 226

			

			if ( trlcontxt )
			    synerr( "trailing context used twice" );
			else
			    trlcontxt = true;

			if ( varlength )
			    
			    varlength = false;
			else
			    headcnt = rulelen;

			rulelen = 0;
			yyval = yypvt[-1];
			
} break;

case YYr30: {	/* series :  series singleton */
#line 249

			
			yyval = link_machines( yypvt[-1], yypvt[0] );
			
} break;

case YYr31: {	/* series :  singleton */
#line 257
 yyval = yypvt[0]; 
} break;

case YYr32: {	/* singleton :  singleton '*' */
#line 261

			varlength = true;

			yyval = mkclos( yypvt[-1] );
			
} break;

case YYr33: {	/* singleton :  singleton '+' */
#line 268

			varlength = true;

			yyval = mkposcl( yypvt[-1] );
			
} break;

case YYr34: {	/* singleton :  singleton '?' */
#line 275

			varlength = true;

			yyval = mkopt( yypvt[-1] );
			
} break;

case YYr35: {	/* singleton :  singleton '{' NUMBER ',' NUMBER '}' */
#line 282

			varlength = true;

			if ( yypvt[-3] > yypvt[-1] || yypvt[-3] <= 0 )
			    {
			    synerr( "bad iteration values" );
			    yyval = yypvt[-5];
			    }
			else
			    yyval = mkrep( yypvt[-5], yypvt[-3], yypvt[-1] );
			
} break;

case YYr36: {	/* singleton :  singleton '{' NUMBER ',' '}' */
#line 295

			varlength = true;

			if ( yypvt[-2] <= 0 )
			    {
			    synerr( "iteration value must be positive" );
			    yyval = yypvt[-4];
			    }

			else
			    yyval = mkrep( yypvt[-4], yypvt[-2], INFINITY );
			
} break;

case YYr37: {	/* singleton :  singleton '{' NUMBER '}' */
#line 309

			
			varlength = true;

			if ( yypvt[-1] <= 0 )
			    {
			    synerr( "iteration value must be positive" );
			    yyval = yypvt[-3];
			    }

			else
			    yyval = link_machines( yypvt[-3], copysingl( yypvt[-3], yypvt[-1] - 1 ) );
			
} break;

case YYr38: {	/* singleton :  '.' */
#line 327

			if ( ! madeany )
			    {
			    
			    anyccl = cclinit();
			    ccladd( anyccl, '\n' );
			    cclnegate( anyccl );

			    if ( useecs )
				mkeccl( ccltbl + cclmap[anyccl],
					ccllen[anyccl], nextecm,
					ecgroup, CSIZE );
			    
			    madeany = true;
			    }

			++rulelen;

			yyval = mkstate( -anyccl );
			
} break;

case YYr39: {	/* singleton :  fullccl */
#line 349

			if ( ! cclsorted )
			    
			    cshell( ccltbl + cclmap[yypvt[0]], ccllen[yypvt[0]] );

			if ( useecs )
			    mkeccl( ccltbl + cclmap[yypvt[0]], ccllen[yypvt[0]],
				    nextecm, ecgroup, CSIZE );
				     
			++rulelen;

			yyval = mkstate( -yypvt[0] );
			
} break;

case YYr40: {	/* singleton :  PREVCCL */
#line 366

			++rulelen;

			yyval = mkstate( -yypvt[0] );
			
} break;

case YYr41: {	/* singleton :  '"' string '"' */
#line 373
 yyval = yypvt[-1]; 
} break;

case YYr42: {	/* singleton :  '(' re ')' */
#line 376
 yyval = yypvt[-1]; 
} break;

case YYr43: {	/* singleton :  CHAR */
#line 379

			++rulelen;

			if ( yypvt[0] == '\0' )
			    synerr( "null in rule" );

			if ( caseins && yypvt[0] >= 'A' && yypvt[0] <= 'Z' )
			    yypvt[0] = clower( yypvt[0] );

			yyval = mkstate( yypvt[0] );
			
} break;

case YYr44: {	/* fullccl :  '[' ccl ']' */
#line 393
 yyval = yypvt[-1]; 
} break;

case YYr45: {	/* fullccl :  '[' '^' ccl ']' */
#line 396

			
#ifdef NOTDEF
			ccladd( yypvt[-1], '\n' ); 
			cclsorted = false; 
#endif
			cclnegate( yypvt[-1] );
			yyval = yypvt[-1];
			
} break;

case YYr46: {	/* ccl :  ccl CHAR '-' CHAR */
#line 410

			if ( yypvt[-2] > yypvt[0] )
			    synerr( "negative range in character class" );

			else
			    {
			    if ( caseins )
				{
				if ( yypvt[-2] >= 'A' && yypvt[-2] <= 'Z' )
				    yypvt[-2] = clower( yypvt[-2] );
				if ( yypvt[0] >= 'A' && yypvt[0] <= 'Z' )
				    yypvt[0] = clower( yypvt[0] );
				}

			    for ( i = yypvt[-2]; i <= yypvt[0]; ++i )
			        ccladd( yypvt[-3], i );

			    
			    cclsorted = cclsorted && (yypvt[-2] > lastchar);
			    lastchar = yypvt[0];
			    }
			
			yyval = yypvt[-3];
			
} break;

case YYr47: {	/* ccl :  ccl CHAR */
#line 438

			if ( caseins )
			    if ( yypvt[0] >= 'A' && yypvt[0] <= 'Z' )
				yypvt[0] = clower( yypvt[0] );

			ccladd( yypvt[-1], yypvt[0] );
			cclsorted = cclsorted && (yypvt[0] > lastchar);
			lastchar = yypvt[0];
			yyval = yypvt[-1];
			
} break;

case YYr48: {	/* ccl :  */
#line 450

			cclsorted = true;
			lastchar = 0;
			yyval = cclinit();
			
} break;

case YYr49: {	/* string :  string CHAR */
#line 458

			if ( caseins )
			    if ( yypvt[0] >= 'A' && yypvt[0] <= 'Z' )
				yypvt[0] = clower( yypvt[0] );

			++rulelen;

			yyval = link_machines( yypvt[-1], mkstate( yypvt[0] ) );
			
} break;

case YYr50: {	/* string :  */
#line 469
 yyval = mkstate( SYM_EPSILON ); 
} break;
#line 237 "yacc parser: c:\mks/etc/yyparse.c"
	case YYrACCEPT:
		YYACCEPT;
	case YYrERROR:
		goto yyError;
#ifdef YYLR2
	case YYrLR2:
#ifndef YYSYNC
		YYREAD;
#endif
		yyj = 0;
		while(yylr2[yyj] >= 0) {
			if(yylr2[yyj] == yystate && yylr2[yyj+1] == yychar
			&& yylook(yys+1,yyps,yystate,yychar,yy2lex(),yylr2[yyj+2]))
					break;
			yyj += 3;
		}
		if(yylr2[yyj] < 0)
			goto yyError;
		if(yylr2[yyj+2] < 0) {
			yystate = ~ yylr2[yyj+2];
			goto yyStack;
		}
		yyi = yylr2[yyj+2];
		goto yyReduce;
#endif
	}

	/*
	 *	Look up next state in goto table.
	 */

	yyp = &yygo[yypgo[yyi]];
	yyq = yyp++;
	yyi = *yyps;
#if	__TURBOC__ && __SMALL__
	/* yyi is in di, yyp is in si */
L02:
	asm lodsw		/* ax = *yyp++; */
	asm cmp yyi, ax
	asm jl L02
#else
	while (yyi < *yyp++)
		;
#endif
	yystate = ~(yyi == *--yyp? YYQYYP: *yyq);
	goto yyStack;

yyerrlabel:	;		/* come here from YYERROR	*/
/*
#pragma used yyerrlabel
 */
	yyerrflag = 1;
	yyps--, yypv--;
	
yyError:
	switch (yyerrflag) {

	case 0:		/* new error */
		yynerrs++;
		yyi = yychar;
		yyerror("Syntax error");
		if (yyi != yychar) {
			/* user has changed the current token */
			/* try again */
			yyerrflag++;	/* avoid loops */
			goto yyEncore;
		}

	case 1:		/* partially recovered */
	case 2:
		yyerrflag = 3;	/* need 3 valid shifts to recover */
			
		/*
		 *	Pop states, looking for a
		 *	shift on `error'.
		 */

		for ( ; yyps > yys; yyps--, yypv--) {
			if (*yyps >= sizeof yypact/sizeof yypact[0])
				continue;
			yyp = &yyact[yypact[*yyps]];
			yyq = yyp;
			do
				;
			while (YYERRCODE < *yyp++);
			if (YYERRCODE == yyp[-1]) {
				yystate = ~YYQYYP;
				goto yyStack;
			}
				
			/* no shift in this state */
#if YYDEBUG
			if (yydebug && yyps > yys+1)
				printf("Error recovery pops state %d (%d), uncovers %d (%d)\n",
					yysmap[yyps[0]], yyps[0],
					yysmap[yyps[-1]], yyps[-1]);
#endif
			/* pop stacks; try again */
		}
		/* no shift on error - abort */
		break;

	case 3:
		/*
		 *	Erroneous token after
		 *	an error - discard it.
		 */

		if (yychar == 0)  /* but not EOF */
			break;
#if YYDEBUG
		if (yydebug)
			printf("Error recovery discards %s (%d), ",
				yyptok(yychar), yychar);
#endif
		yyclearin;
		goto yyEncore;	/* try again in same state */
	}
	YYABORT;

#ifdef YYALLOC
yyReturn:
	yylval = save_yylval;
	yyval = save_yyval;
	yypvt = save_yypvt;
	yychar = save_yychar;
	yyerrflag = save_yyerrflag;
	yynerrs = save_yynerrs;
	free((char *)yys);
	free((char *)yyv);
	return(retval);
#endif
}

#ifdef YYLR2
yylook(s,rsp,state,c1,c2,i)
short *s;		/* stack		*/
short *rsp;		/* real top of stack	*/
int state;		/* current state	*/
int c1;			/* current char		*/
int c2;			/* next char		*/
int i;			/* action S < 0, R >= 0	*/
{
	int j;
	short *p,*q;
	short *sb,*st;
#if YYDEBUG
	if(yydebug) {
		printf("LR2 state %d (%d) char %s (%d) lookahead %s (%d)",
			yysmap[state],state,yyptok(c1),c1,yyptok(c2),c2);
		if(i > 0)
			printf("reduce %d (%d)\n", yyrmap[i], i);
		else
			printf("shift %d (%d)\n", yysmap[i], i);
	}
#endif
	st = sb = rsp+1;
	if(i >= 0)
		goto reduce;
  shift:
	state = ~i;
	c1 = c2;
	if(c1 < 0)
		return 1;
	c2 = -1;

  stack:
  	if(++st >= &s[YYSSIZE]) {
		yyerror("Parser Stack Overflow");
		return 0;
	}
	*st = state;
	if(state >= sizeof yypact/sizeof yypact[0])
		i = state- YYDELTA;
	else {
		p = &yyact[yypact[state]];
		q = p;
		i = c1;
		while(i < *p++)
			;
		if(i == p[-1]) {
			state = ~q[q-p];
			c1 = c2;
			if(c1 < 0)
				return 1;
			c2 = -1;
			goto stack;
		}
		if(state >= sizeof yydef/sizeof yydef[0])
			return 0
		if((i = yydef[state]) < 0) {
			p = &yyex[~i];
			while((i = *p) >= 0 && i != c1)
				p += 2;
			i = p[1];
		}
	}
  reduce:
  	j = yyrlen[i];
	if(st-sb >= j)
		st -= j;
	else {
		rsp -= j+st-sb;
		st = sb;
	}
	switch(i) {
	case YYrERROR:
		return 0;
	case YYrACCEPT:
		return 1;
	case YYrLR2:
		j = 0;
		while(yylr2[j] >= 0) {
			if(yylr2[j] == state && yylr2[j+1] == c1)
				if((i = yylr2[j+2]) < 0)
					goto shift;
				else
					goto reduce;
		}
		return 0;
	}
	p = &yygo[yypgo[i]];
	q = p++;
	i = st==sb ? *rsp : *st;
	while(i < *p++);
	state = ~(i == *--p? q[q-p]: *q);
	goto stack;
}
#endif
		
#if YYDEBUG
	
/*
 *	Print a token legibly.
 *	This won't work if you roll your own token numbers,
 *	but I've found it useful.
 */
char *
yyptok(i)
{
	static char	buf[10];

	if (i >= YYERRCODE)
		return yystoken[i-YYERRCODE];
	if (i < 0)
		return "";
	if (i == 0)
		return "$end";
	if (i < ' ')
		sprintf(buf, "'^%c'", i+'@');
	else
		sprintf(buf, "'%c'", i);
	return buf;
}
#endif
#ifdef YYDEBUG
char * yystoken[] = {
	"error",
	"CHAR",
	"NUMBER",
	"SECTEND",
	"SCDECL",
	"XSCDECL",
	"WHITESPACE",
	"NAME",
	"PREVCCL",
	0
};
char * yysvar[] = {
	"$accept",
	"goal",
	"initlex",
	"sect1",
	"sect1end",
	"sect2",
	"startconddecl",
	"namelist1",
	"initforrule",
	"flexrule",
	"scon",
	"re",
	"eol",
	"namelist2",
	"series",
	"re2",
	"singleton",
	"fullccl",
	"string",
	"ccl",
	0
};
short yyrmap[] = {
	  51,   52,   53,    1,   14,   25,   26,   27,   28,   30, 
	  31,   47,   50,   49,   48,   46,   45,   44,   43,   42, 
	  41,   40,   39,   38,   37,   36,   35,   34,   33,   32, 
	  29,   24,   23,   22,   21,   19,   18,   17,   16,   15, 
	  11,   10,    9,    8,    7,    5,    2,    3,    6,   12, 
	  13,   20,    4,    0
};
short yysmap[] = {
	   1,    2,   12,   19,   26,   27,   31,   44,   45,   53, 
	  54,   58,   66,   69,   78,   73,   71,   64,   63,   57, 
	  55,   50,   48,   40,   39,   38,   37,   34,   33,   32, 
	  29,   28,   21,   17,   16,   15,   11,    9,    4,    3, 
	  22,   61,   36,   76,   70,   59,   20,   60,   62,   23, 
	  24,   25,   72,   77,   79,   41,   42,   43,   49,   51, 
	  46,   47,   74,   30,   52,   67,   68,   75,   13,   14, 
	  35,    6,    7,    5,    0,   18,    8,   56,   10,   65
};
int yyntoken = 30, yynvar = 20, yynstate = 80, yynrule = 54;
#endif
