
# line 2 "parse.y"
/* pathalias -- by steve bellovin, as told to peter honeyman */
#ifndef lint
static char	*sccsid = "@(#)parse.y	9.10 88/09/07";
#endif /* lint */

#include "def.h"

/* scanner states (yylex, parse) */
#define OTHER		0
#define COSTING		1
#define NEWLINE		2
#define FILENAME	3

/* exports */
long Tcount;
extern void yyerror();

/* imports */
extern node *addnode(), *addprivate();
extern void fixprivate(), alias(), deadlink(), deletelink();
extern link *addlink();
extern int strcmp();
extern char *strsave();
extern int optind;
extern char *Cfile, *Netchars, **Argv;
extern int Lineno, Argc;

/* privates */
STATIC void fixnet(), adjust();
STATIC int yylex(), yywrap(), getword();
static int Scanstate = NEWLINE;	/* scanner (yylex) state */

/* flags for ys_flags */
#define TERMINAL 1

# line 38 "parse.y"
typedef union  {
	node	*y_node;
	Cost	y_cost;
	char	y_net;
	char	*y_name;
	struct {
		node *ys_node;
		Cost ys_cost;
		short ys_flag;
		char ys_net;
		char ys_dir;
	} y_s;
} YYSTYPE;
# define SITE 257
# define HOST 258
# define STRING 259
# define COST 260
# define NET 261
# define EOL 262
# define PRIVATE 263
# define DEAD 264
# define DELETE 265
# define FILETOK 266
# define ADJUST 267
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
extern short yyerrflag;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
YYSTYPE yylval, yyval;
# define YYERRCODE 256

# line 234 "parse.y"


void
#ifdef YYDEBUG
/*VARARGS1*/
yyerror(fmt, arg)
	char *fmt, *arg;
#else
yyerror(s)
	char *s;
#endif
{
	/* a concession to bsd error(1) */
	fprintf(stderr, "\"%s\", ", Cfile);
#ifdef YYDEBUG
	fprintf(stderr, "line %d: ", Lineno);
	fprintf(stderr, fmt, arg);
	putc('\n', stderr);
#else
	fprintf(stderr, "line %d: %s\n", Lineno, s);
#endif
}

/*
 * patch in the costs of getting on/off the network.
 *
 * for each network member on netlist, add links:
 *	network -> member	cost = 0;
 *	member -> network	cost = parameter.
 *
 * if network and member both require gateways, assume network
 * is a gateway to member (but not v.v., to avoid such travesties
 * as topaz!seismo.css.gov.edu.rutgers).
 *
 * note that members can have varying costs to a network, by suitable
 * multiple declarations.  this is a feechur, albeit a useless one.
 */
STATIC void
fixnet(network, nlist, cost, netchar, netdir)
	register node *network;
	node *nlist;
	Cost cost;
	char netchar, netdir;
{	register node *member, *nextnet;
	link *l;
	static int netanon = 0;
	char anon[25];

	if (network == 0) {
		sprintf(anon, "[unnamed net %d]", netanon++);
		network = addnode(anon);
	}
	network->n_flag |= NNET;

	/* insert the links */
	for (member = nlist ; member; member = nextnet) {

		/* network -> member, cost is 0 */
		l = addlink(network, member, (Cost) 0, netchar, netdir);
		if (GATEWAYED(network) && GATEWAYED(member))
			l->l_flag |= LGATEWAY;

		/* member -> network, cost is parameter */
		/* never ever ever crawl up from a domain*/
		if (!ISADOMAIN(network))
			(void) addlink(member, network, cost, netchar, netdir);

		nextnet = member->n_net;
		member->n_net = 0;	/* clear for later use */
	}
}

/* scanner */

#define QUOTE '"'
#define STR_EQ(s1, s2) (s1[2] == s2[2] && strcmp(s1, s2) == 0)
#define NLRETURN() {Scanstate = NEWLINE; return EOL;}

static struct ctable {
	char *cname;
	Cost cval;
} ctable[] = {
	/* ordered by frequency of appearance in a "typical" dataset */
	{"DIRECT", 200},
	{"DEMAND", 300},
	{"DAILY", 5000},
	{"HOURLY", 500},
	{"DEDICATED", 100},
	{"EVENING", 2000},
	{"LOCAL", 25},
	{"LOW", 5},	/* baud rate, quality penalty */
	{"DEAD", MILLION},
	{"POLLED", 5000},
	{"WEEKLY", 30000},
	{"HIGH", -5},	/* baud rate, quality bonus */
	{"FAST", -80},	/* high speed (>= 9.6 kbps) modem */
	/* deprecated */
	{"ARPA", 100},
	{"DIALED", 300},
	{0, 0}
};

STATIC int
yylex()
{	static char retbuf[128];	/* for return to yacc part */
	register int c;
	register char *buf = retbuf;
	register struct ctable *ct;
	register Cost cost;
	char errbuf[128];

	if (feof(stdin) && yywrap())
		return EOF;

	/* count lines, skip over space and comments */
	if ((c = getchar()) == EOF)
		NLRETURN();

continuation:
	while (c == ' ' || c == '\t')
		if ((c = getchar()) == EOF)
			NLRETURN();

	if (c == '#')
		while ((c = getchar()) != '\n')
			if (c == EOF)
				NLRETURN();

	/* scan token */
	if (c == '\n') {
		Lineno++;
		if ((c = getchar()) != EOF) {
			if (c == ' ' || c == '\t')
				goto continuation;
			ungetc(c, stdin);
		}
		NLRETURN();
	}

	switch(Scanstate) {
	case COSTING:
		if (isdigit(c)) {
			cost = c - '0';
			for (c = getchar(); isdigit(c); c = getchar())
				cost = (cost * 10) + c - '0';
			ungetc(c, stdin);
			yylval.y_cost = cost;
			return COST;
		}

		if (getword(buf, c) == 0) {
			for (ct = ctable; ct->cname; ct++)
				if (STR_EQ(buf, ct->cname)) {
					yylval.y_cost = ct->cval;
					return COST;
				}
			sprintf(errbuf, "unknown cost (%s), using default", buf);
			yyerror(errbuf);
			yylval.y_cost = DEFCOST;
			return COST;
		}

		return c;	/* pass the buck */

	case NEWLINE:
		Scanstate = OTHER;
		if (getword(buf, c) != 0)
			return c;
		/*
		 * special purpose tokens.
		 *
		 * the "switch" serves the dual-purpose of recognizing
		 * unquoted tokens only.
		 */
		switch(c) {
		case 'p':
			if (STR_EQ(buf, "private"))
				return PRIVATE;
			break;
		case 'd':
			if (STR_EQ(buf, "dead"))
				return DEAD;
			if (STR_EQ(buf, "delete"))
				return DELETE;
			break;
		case 'f':
			if (STR_EQ(buf, "file"))
				return FILETOK;
			break;
		case 'a':
			if (STR_EQ(buf, "adjust"))
				return ADJUST;
			break;
		}

		yylval.y_name = buf;
		return HOST;

	case FILENAME:
		while (c != EOF && isprint(c)) {
			if (c == ' ' || c == '\t' || c == '\n' || c == '}')
				break;
			*buf++ = c;
			c = getchar();
		}
		if (c != EOF)
			ungetc(c, stdin);
		*buf = 0;
		yylval.y_name = retbuf;
		return STRING;
	}

	if (getword(buf, c) == 0) {
		yylval.y_name = buf;
		return SITE;
	}

	if (index(Netchars, c)) {
		yylval.y_net = c;
		return NET;
	}

	return c;
}

/*
 * fill str with the next word in [0-9A-Za-z][-._0-9A-Za-z]+ or a quoted
 * string that contains no newline.  return -1 on failure or EOF, 0 o.w.
 */
STATIC int
getword(str, c)
	register char *str;
	register int c;
{
	if (c == QUOTE) {
		while ((c = getchar()) != QUOTE) {
			if (c == '\n') {
				yyerror("newline in quoted string\n");
				ungetc(c, stdin);
				return -1;
			}
			if (c == EOF) {
				yyerror("EOF in quoted string\n");
				return -1;
			}
			*str++ = c;
		}
		*str = 0;
		return 0;
	}

	/* host name must start with alphanumeric or `.' */
	if (!isalnum(c) && c != '.')
		return -1;

yymore:
	do {
		*str++ = c;
		c = getchar();
	} while (isalnum(c) || c == '.' || c == '_');

	if (c == '-' && Scanstate != COSTING)
		goto yymore;

	ungetc(c, stdin);
	*str = 0;
	return 0;
}

STATIC int
yywrap()
{	char errbuf[100];

	fixprivate();	/* munge private host definitions */
	Lineno = 1;
	while (optind < Argc) {
		if (freopen((Cfile = Argv[optind++]), "r", stdin) != 0)
			return 0;
		sprintf(errbuf, "%s: %s", Argv[0], Cfile);
		perror(errbuf);
	}
	freopen(NULL_DEVICE, "r", stdin);
	return -1;
}

STATIC void
adjust(n, cost)
	node *n;
	Cost cost;
{	link *l;

	n->n_cost += cost;	/* cumulative */

	/* hit existing links */
	for (l = n->n_link; l; l = l->l_next) {
		if ((l->l_cost += cost) < 0) {
			char buf[100];

			l->l_flag |= LDEAD;
			sprintf(buf, "link to %s deleted with negative cost",
							l->l_to->n_name);
			yyerror(buf);
		}
	}
}
short yyexca[] ={
-1, 1,
	0, -1,
	-2, 0,
-1, 61,
	261, 48,
	-2, 46,
-1, 65,
	261, 48,
	-2, 53,
	};
# define YYNPROD 74
# define YYLAST 226
short yyact[]={

  20,  25,  23,  93,  48,  38,  31,  30,  92,  29,
  37,  33,  37,  28,  27,  26,  21,  85,  82,  50,
  86,  57,  71,  65,  61,  37,  98,  96,  54,  52,
  49,  46,   2,  76,  88,  84,  81,  79,  76, 114,
  55,  44,  43,  42,  41,  40,  62,  90,  69,  47,
  74,  64,  60,  53, 120, 108, 106, 115, 107,  32,
 109, 108, 106, 108, 107,  48, 109,  34, 109, 105,
  73,  68, 103,  67,  63,  11,  10,   9,   8,   7,
   1,  59,  13,  45,  12,   6,  56,   5,   4,  66,
   0,  70,   0,   0,   0,  72,   0,   0,   0,   0,
   0,   0,   0,  51,   0,   0,   0,   0,   0,  77,
   0,   0,   0,   0,  97,  87,  83,  80,  78,  75,
  89,   0,   0,   0,   0,  94,   0,   0,   0, 100,
   0,  66, 102,   0,  99,  70, 101, 104,   0,   0,
 110, 111,   0,  39,   0, 112,   0, 113,   0,   0,
   0,   0,   0,  58, 116, 117, 118, 119,   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,  19,   0,   0,
   0,   3,  14,  15,  16,  17,  18,  36,   0,  36,
   0,  35,   0,  35,   0,   0,   0,   0,   0,  24,
  22,   0,  36,  91,   0,  95 };
short yypact[]={

-224, -61,-246,-1000, -42, -43,-247,-248,-249,-253,
-255,-256, -50,-118, -78, -79, -80, -81, -82,-1000,
-1000,-1000,-1000, -48,-1000,-226,-1000,-1000,-1000,-1000,
-1000,-1000,  25,-227,-242, -35,-1000,-228,-229, -83,
-104,-233,-234,-1000,-235,  25,-1000,-1000,-1000,-1000,
-1000,-1000, -12,  -6,-1000,-229,  -7,-1000,-1000,  -8,
-1000,-1000,-243,  -9,-1000,-1000,-244,-239, -10,-1000,
  25,-1000,-1000, -37,-1000, -36,-230, -11,-1000,-231,
-1000,-233,-235,-1000,-234,-235,-1000,-1000,-235,-1000,
  19,-1000, -37, -37,-1000,  25,-1000,  25,-1000,-1000,
-1000,-1000,-1000, -86,-1000,  16, -37, -37, -37, -37,
  21,  13,-1000,-1000,-1000,-1000,  21,  21,-1000,-1000,
-1000 };
short yypgo[]={

   0,  59,  67,  88,  87,  86,  85,  53,  84,  82,
  46,  52,  81,  49,  47,  80,  79,  78,  77,  76,
  75,  74,  51,  73,  72,  71,  48,  70,  69 };
short yyr1[]={

   0,  15,  15,  15,  15,  15,  15,  15,  15,  15,
  15,  15,   3,   3,   3,   8,   8,   8,   8,   8,
   8,   1,   1,   1,   2,   2,   4,   4,   4,   6,
   6,   6,   9,   9,   7,   7,   7,  16,  16,   5,
   5,   5,  17,  12,  12,  12,  11,  11,  10,  18,
  21,  21,  21,  22,  22,  23,  24,  19,  20,  25,
  25,  25,  26,  13,  27,  28,  13,  14,  14,  14,
  14,  14,  14,  14 };
short yyr2[]={

   0,   0,   2,   3,   3,   3,   3,   3,   3,   3,
   3,   2,   3,   4,   2,   1,   1,   1,   1,   1,
   1,   1,   2,   2,   1,   3,   3,   3,   2,   5,
   6,   6,   1,   2,   1,   3,   2,   4,   3,   1,
   3,   2,   4,   1,   3,   2,   1,   3,   1,   4,
   1,   3,   2,   1,   3,   0,   0,   6,   4,   1,
   3,   2,   2,   0,   0,   0,   5,   1,   2,   3,
   3,   3,   3,   3 };
short yychk[]={

-1000, -15, 256, 262,  -3,  -4,  -6, -16, -17, -18,
 -19, -20,  -8,  -9, 263, 264, 265, 266, 267, 258,
  61, 262, 262,  44, 262,  44, 262, 262, 262, 262,
 262, 262,  -1,  61,  -2, 261, 257,  60, 123, 261,
 123, 123, 123, 123, 123,  -1, 257, -13,  40, 257,
 261,  -2, 257,  -7, 257, 123,  -5, 125, 257, -12,
 -11, 257, -10, -21, -22, 257, -10, -23, -25, -26,
 -10, 257, -13, -27,  62, 125,  44,  -7, 125,  44,
 125,  44, 261, 125,  44, 261, 259, 125,  44, -13,
 -14, 260,  45,  40, -13, 261, 257, 125, 257, -11,
 -10, -22, -10, -24, -26, -28,  43,  45,  42,  47,
 -14, -14, -13, -13, 125,  41, -14, -14, -14, -14,
  41 };
short yydef[]={

   1,  -2,   0,   2,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,  16,  17,  18,  19,  20,  15,
  32,  11,   3,  14,   4,  28,   5,   6,   7,   8,
   9,  10,  63,  33,  21,   0,  24,   0,   0,   0,
   0,   0,   0,  55,   0,  63,  27,  12,  64,  26,
  23,  22,   0,   0,  34,   0,   0,  38,  39,   0,
  43,  -2,   0,   0,  50,  -2,   0,   0,   0,  59,
  63,  48,  13,   0,  25,  63,  36,   0,  37,  41,
  42,  45,   0,  49,  52,   0,  56,  58,  61,  62,
  65,  67,   0,   0,  29,  63,  35,  63,  40,  44,
  47,  51,  54,   0,  60,   0,   0,   0,   0,   0,
  68,   0,  31,  30,  57,  66,  70,  71,  72,  73,
  69 };
#ifndef lint
static	char yaccpar_sccsid[] = "@(#)yaccpar 1.6 88/02/08 SMI"; /* from UCB 4.1 83/02/11 */
#endif

#
# 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 12:
# line 79 "parse.y"
{
		struct link *l;

		l = addlink(yypvt[-2].y_node, yypvt[-1].y_s.ys_node, yypvt[-0].y_cost, yypvt[-1].y_s.ys_net, yypvt[-1].y_s.ys_dir);
		if (GATEWAYED(yypvt[-1].y_s.ys_node))
			l->l_flag |= LGATEWAY;
		if (yypvt[-1].y_s.ys_flag & TERMINAL)
			l->l_flag |= LTERMINAL;
	  } break;
case 13:
# line 88 "parse.y"
{
		struct link *l;

		l = addlink(yypvt[-3].y_node, yypvt[-1].y_s.ys_node, yypvt[-0].y_cost, yypvt[-1].y_s.ys_net, yypvt[-1].y_s.ys_dir);
		if (GATEWAYED(yypvt[-1].y_s.ys_node))
			l->l_flag |= LGATEWAY;
		if (yypvt[-1].y_s.ys_flag & TERMINAL)
			l->l_flag |= LTERMINAL;
	  } break;
case 15:
# line 100 "parse.y"
{yyval.y_node = addnode(yypvt[-0].y_name);} break;
case 16:
# line 101 "parse.y"
{yyval.y_node = addnode("private");} break;
case 17:
# line 102 "parse.y"
{yyval.y_node = addnode("dead");} break;
case 18:
# line 103 "parse.y"
{yyval.y_node = addnode("delete");} break;
case 19:
# line 104 "parse.y"
{yyval.y_node = addnode("file");} break;
case 20:
# line 105 "parse.y"
{yyval.y_node = addnode("adjust");} break;
case 21:
# line 108 "parse.y"
{
		yyval.y_s = yypvt[-0].y_s;
		yyval.y_s.ys_net = DEFNET;
		yyval.y_s.ys_dir = DEFDIR;
	  } break;
case 22:
# line 113 "parse.y"
{
		yyval.y_s = yypvt[-0].y_s;
		yyval.y_s.ys_net = yypvt[-1].y_net;
		yyval.y_s.ys_dir = LRIGHT;
	  } break;
case 23:
# line 118 "parse.y"
{
		yyval.y_s = yypvt[-1].y_s;
		yyval.y_s.ys_net = yypvt[-0].y_net;
		yyval.y_s.ys_dir = LLEFT;
	  } break;
case 24:
# line 125 "parse.y"
{
		yyval.y_s.ys_node = addnode(yypvt[-0].y_name);
		yyval.y_s.ys_flag = 0;
	  } break;
case 25:
# line 129 "parse.y"
{
		Tcount++;
		yyval.y_s.ys_node = addnode(yypvt[-1].y_name);
		yyval.y_s.ys_flag = TERMINAL;
	  } break;
case 26:
# line 136 "parse.y"
{alias(yypvt[-2].y_node, addnode(yypvt[-0].y_name));} break;
case 27:
# line 137 "parse.y"
{alias(yypvt[-2].y_node, addnode(yypvt[-0].y_name));} break;
case 29:
# line 141 "parse.y"
{fixnet(yypvt[-4].y_node, yypvt[-2].y_node, yypvt[-0].y_cost, DEFNET, DEFDIR);} break;
case 30:
# line 142 "parse.y"
{fixnet(yypvt[-5].y_node, yypvt[-2].y_node, yypvt[-0].y_cost, yypvt[-4].y_net, LRIGHT);} break;
case 31:
# line 143 "parse.y"
{fixnet(yypvt[-5].y_node, yypvt[-3].y_node, yypvt[-0].y_cost, yypvt[-1].y_net, LLEFT);} break;
case 32:
# line 146 "parse.y"
{yyval.y_node = 0;	/* anonymous net */} break;
case 33:
# line 147 "parse.y"
{yyval.y_node = yypvt[-1].y_node;	/* named net */} break;
case 34:
# line 150 "parse.y"
{yyval.y_node = addnode(yypvt[-0].y_name);} break;
case 35:
# line 151 "parse.y"
{
		node *n;

		n = addnode(yypvt[-0].y_name);
		if (n->n_net == 0) {
			n->n_net = yypvt[-2].y_node;
			yyval.y_node = n;
		}
	  } break;
case 38:
# line 164 "parse.y"
{fixprivate();} break;
case 39:
# line 167 "parse.y"
{addprivate(yypvt[-0].y_name)->n_flag |= ISPRIVATE;} break;
case 40:
# line 168 "parse.y"
{addprivate(yypvt[-0].y_name)->n_flag |= ISPRIVATE;} break;
case 46:
# line 179 "parse.y"
{deadlink(addnode(yypvt[-0].y_name), (node *) 0);} break;
case 47:
# line 180 "parse.y"
{deadlink(yypvt[-2].y_node, yypvt[-0].y_node);} break;
case 48:
# line 183 "parse.y"
{yyval.y_node = addnode(yypvt[-0].y_name);} break;
case 53:
# line 192 "parse.y"
{
		node *n;

		n = addnode(yypvt[-0].y_name);
		deletelink(n, (node *) 0);
		n->n_flag |= ISPRIVATE;
	  } break;
case 54:
# line 199 "parse.y"
{deletelink(yypvt[-2].y_node, yypvt[-0].y_node);} break;
case 55:
# line 202 "parse.y"
{Scanstate = FILENAME;} break;
case 56:
# line 202 "parse.y"
{Scanstate = OTHER;} break;
case 57:
# line 202 "parse.y"
{
		Lineno = 0;
		Cfile = strsave(yypvt[-2].y_name);
	} break;
case 62:
# line 214 "parse.y"
{adjust(yypvt[-1].y_node, yypvt[-0].y_cost);} break;
case 63:
# line 216 "parse.y"
{yyval.y_cost = DEFCOST;	/* empty -- cost is always optional */} break;
case 64:
# line 217 "parse.y"
{Scanstate = COSTING;} break;
case 65:
# line 217 "parse.y"
{Scanstate = OTHER;} break;
case 66:
# line 218 "parse.y"
{yyval.y_cost = yypvt[-2].y_cost;} break;
case 68:
# line 222 "parse.y"
{yyval.y_cost = -yypvt[-0].y_cost;} break;
case 69:
# line 223 "parse.y"
{yyval.y_cost = yypvt[-1].y_cost;} break;
case 70:
# line 224 "parse.y"
{yyval.y_cost = yypvt[-2].y_cost + yypvt[-0].y_cost;} break;
case 71:
# line 225 "parse.y"
{yyval.y_cost = yypvt[-2].y_cost - yypvt[-0].y_cost;} break;
case 72:
# line 226 "parse.y"
{yyval.y_cost = yypvt[-2].y_cost * yypvt[-0].y_cost;} break;
case 73:
# line 227 "parse.y"
{
		if (yypvt[-0].y_cost == 0)
			yyerror("zero divisor\n");
		else
			yyval.y_cost = yypvt[-2].y_cost / yypvt[-0].y_cost;
	  } break;
		}
		goto yystack;  /* stack new state and value */

	}
