File:  [CSRG BSD Unix] / 43BSDReno / contrib / isode-beta / others / quipu / uips / sd / y.tab.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:56 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno


# line 2 "conf_read.y"
#ifndef lint
static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/others/quipu/uips/sd/y.tab.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $";
#endif

/*
 * $Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/others/quipu/uips/sd/y.tab.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $
 */

/*
 * $Log: y.tab.c,v $
 * Revision 1.1.1.1  2018/04/24 16:12:56  root
 * BSD 4.3reno
 *
 * Revision 7.0  90/06/12  13:14:08  mrose
 * *** empty log message ***
 * 
 * Revision 1.6  90/04/26  10:36:54  emsrdsm
 * *** empty log message ***
 * 
 * Revision 1.5  90/04/25  15:08:06  emsrdsm
 * i) lint'ed
 * 
 * Revision 1.4  90/04/20  17:58:22  emsrdsm
 * i) no more freeing
 * 
 * Revision 1.3  90/04/18  18:28:39  emsrdsm
 * fixed i) does not move to leaves
 *       ii) added default mechanism described using "typeDefaults" file.
 * 	 iii) added 'sorting' to attribute display
 * 
 * Revision 1.2  90/03/15  16:34:20  emsrdsm
 * *** empty log message ***
 * 
 * Revision 1.1  90/03/09  17:58:22  emsrdsm
 * Initial revision
 * 
 */

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

#include "filt.h"
#include "symtab.h"

extern make_type();
extern filt_struct *make_item_filter();
extern filt_struct *link_filters();
extern filt_struct *make_parent_filter();
extern put_symbol_value();

extern FILE *file;
extern int curr_filt;
extern char **file_names;
extern table_entry symtab;

# line 54 "conf_read.y"
typedef union  {
  	filt_struct *filt;
	char strval[255];
	int symbol;
} YYSTYPE;
# define NUMBER 257
# define NAME 258
# define DEFAULT 259
# define STRING 260
# define OID 261
# define AND 262
# define OR 263
# define NOT 264
# define APPROX 265
# define EQUAL 266
# define ITEM 267
# define SUBSTRING 268
#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 105 "conf_read.y"


yylex()
{
	int c, count = 0;
	char lexeme[255];

	while(iswspace(c = getc(file)))
	  	if (c == EOF) return(0);

        lexeme[count++] = c;
	
	switch(c) {
	      case '#':
	  	while (getc(file) != '\n');
		return(yylex());
              case '"':
		count = 0;
		while ((c = getc(file)) != '"')
		  	lexeme[count++] = c;
		lexeme[count] = '\0';
		(void) strcpy(yylval.strval, lexeme);
		return STRING;
	      case '$':
		while (!iswspace((c = getc(file))) && !issymbol(c))
		  	lexeme[count++] = c;
		lexeme[count] = '\0';
		put_symbol_value(symtab, lexeme+1, (char *) 0);
		(void) strcpy(yylval.strval, lexeme);
                return STRING;
	      case '(':
		return (int) c;
	      case ')':
		return (int) c;
	      case ':':
		return (int) c;
	      case '&':
		yylval.symbol = AND;
		return AND;
	      case '|':
		yylval.symbol = OR;
		return OR;
	      case '!':
		yylval.symbol = NOT;
		return NOT;
	      case '*':
		lexeme[count] = '\0';
		(void) strcpy(yylval.strval, lexeme);
		return STRING;
	      case '~':
		if((lexeme[count] = getc(file)) == '=') {
		  	yylval.symbol = APPROX;
			return APPROX;
		      }		  	
		break;
	      case '%':
		if((lexeme[count] = getc(file)) == '=') {
                        yylval.symbol = SUBSTRING;
			return SUBSTRING;
		      }
		break;
	      case '=':
		yylval.symbol = EQUAL;
		return EQUAL;
	      }

  	while(!iswspace(c = getc(file)) && c != '\0' && !issymbol(c))
	  	if (c != EOF)
		  	lexeme[count++] = c;
		else
	  		return(0);

	(void) fseek(file,(long) -1, 1);

	lexeme[count] = '\0';
	switch(*lexeme) {
	      case 'd':
	      case 'D':
		if(!strcmp(lexeme, "default") || !strcmp(lexeme, "DEFAULT"))
			return DEFAULT;
		else {
		        (void) strcpy(yylval.strval, lexeme);
			return STRING;
		}
	      case 'n':
	      case 'N':
		if(!strcmp(lexeme, "name") || !strcmp(lexeme, "NAME"))
		  	return NAME;
		else {
                        (void) strcpy(yylval.strval, lexeme);
		  	return STRING;
		}
	      case '0':
	      case '1':
	      case '2':
	      case '3':
	      case '4':
	      case '5':
	      case '6':
	      case '7':
	      case '8':
	      case '9':
		count = 0;
		while (isdigit(lexeme[count]) || lexeme[count] == '.') count++;
		if (lexeme[count] == '\0') {
		  	(void) strcpy(yylval.strval, lexeme);
			return OID;
		} else {
		  	(void) strcpy(yylval.strval, lexeme);
			return STRING;
		}
	      default:
		(void) strcpy(yylval.strval, lexeme);
		return STRING;
	}
}

yyerror(err)
char *err;
{
  /* Sorry */
  (void) fprintf(stderr, "Parse error in 'filterTypes' dir: ");
  (void) fprintf(stderr, err);
  (void) fprintf(stderr, "\n");
}

int
issymbol(c)
char c;
{
	switch(c) {
	      case '#':
                return 1;
              case '"':
                return 1;
	      case '(':
		return 1;
	      case ')':
		return 1;
	      case ':':
		return 1;
	      case '&':
		return 1;
	      case '|':
		return 1;
	      case '!':
		return 1;
	      case '*':
		return 1;
	      case '~':
		return 1;
	      case '=':
		return 1;
	      case '$':
		return 1;
	      case '%':
		return 1;
	}
	return 0;
}

int
iswspace(c)
char c;
{
  	switch(c) {
	      case ' ':
	  	return 1;
	      case '\n':
		return 1;
	      case '\t':
		return 1;
	}
	return 0;
}



short yyexca[] ={
-1, 1,
	0, -1,
	-2, 0,
	};
# define YYNPROD 19
# define YYLAST 42
short yyact[]={

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

-249,-1000, -26, -48,-1000,-1000,-1000,-257,-252, -26,
 -26,-265,-1000,-1000,-1000, -26, -28,-258,-1000,-1000,
-1000, -26,-1000, -29, -30, -26,-1000,-1000,-1000 };
short yypgo[]={

   0,  24,  16,  15,  23,  22,  21,  20,  18,  17 };
short yyr1[]={

   0,   1,   8,   9,   9,   4,   4,   4,   3,   3,
   3,   2,   2,   5,   7,   7,   7,   6,   6 };
short yyr2[]={

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

-1000,  -1,  -8, 258,  -2,  -5,  -4,  40,  58,  -6,
 264, 261, 262, 263, 260,  -2,  -2,  -7, 265, 266,
 268,  -2,  41, 260,  -3,  -2,  41,  41,  -3 };
short yydef[]={

   0,  -2,   0,   0,   1,   7,  12,   0,   0,   0,
   0,   0,  17,  18,   2,   0,   0,   0,  14,  15,
  16,  10,   6,   0,   0,   9,  13,   5,   8 };
#ifndef lint
static	char yaccpar_sccsid[] = "@(#)yaccpar 1.3 86/10/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 1:
# line 70 "conf_read.y"
{make_type(yypvt[-1].strval, yypvt[-0].filt);} break;
case 2:
# line 73 "conf_read.y"
{(void) strcpy(yyval.strval, yypvt[-0].strval);} break;
case 3:
# line 76 "conf_read.y"
{(void) strcpy(yyval.strval, yypvt[-0].strval);} break;
case 4:
# line 77 "conf_read.y"
{(void) strcpy(yyval.strval, "\0");} break;
case 5:
# line 80 "conf_read.y"
{yyval.filt = make_parent_filter(yypvt[-4].symbol, yypvt[-3].filt, yypvt[-2].filt, yypvt[-1].filt);} break;
case 6:
# line 81 "conf_read.y"
{yyval.filt = make_parent_filter(yypvt[-2].symbol, yypvt[-1].filt, (filt_struct *) 0,(filt_struct *) 0);} break;
case 7:
# line 82 "conf_read.y"
{yyval.filt = yypvt[-0].filt;} break;
case 8:
# line 85 "conf_read.y"
{yyval.filt = link_filters(yypvt[-1].filt, yypvt[-0].filt);} break;
case 9:
# line 86 "conf_read.y"
{yyval.filt = yypvt[-0].filt;} break;
case 10:
# line 87 "conf_read.y"
{yyval.filt = (filt_struct *) 0;} break;
case 11:
# line 90 "conf_read.y"
{yyval.filt = yypvt[-0].filt;} break;
case 12:
# line 91 "conf_read.y"
{yyval.filt = yypvt[-0].filt;} break;
case 13:
# line 94 "conf_read.y"
{yyval.filt = make_item_filter(yypvt[-3].strval, yypvt[-2].symbol, yypvt[-1].strval);} break;
case 14:
# line 97 "conf_read.y"
{yyval.symbol = yypvt[-0].symbol;} break;
case 15:
# line 98 "conf_read.y"
{yyval.symbol = yypvt[-0].symbol;} break;
case 16:
# line 99 "conf_read.y"
{yyval.symbol = yypvt[-0].symbol;} break;
case 17:
# line 102 "conf_read.y"
{yyval.symbol = yypvt[-0].symbol;} break;
case 18:
# line 103 "conf_read.y"
{yyval.symbol = yypvt[-0].symbol;} break;
		}
		goto yystack;  /* stack new state and value */

	}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.