ssl_expr_parse.c revision e8f95a682820a599fe41b22977010636be5c2717
#ifndef lint
static char const
ssl_expr_yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28.2.1 2001/07/19 05:46:39 peter Exp $";
#endif
#include <stdlib.h>
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define YYLEX ssl_expr_yylex()
#define YYEMPTY -1
#define ssl_expr_yyerrok (ssl_expr_yyerrflag=0)
#define YYRECOVERING() (ssl_expr_yyerrflag!=0)
#if defined(__cplusplus) || __STDC__
static int ssl_expr_yygrowstack(void);
#else
static int ssl_expr_yygrowstack();
#endif
#define YYPREFIX "ssl_expr_yy"
#include "ssl_private.h"
typedef union {
char *cpVal;
} YYSTYPE;
#define YYERRCODE 256
#define T_TRUE 257
#define T_FALSE 258
#define T_DIGIT 259
#define T_ID 260
#define T_STRING 261
#define T_REGEX 262
#define T_REGEX_I 263
#define T_FUNC_FILE 264
#define T_OP_EQ 265
#define T_OP_NE 266
#define T_OP_LT 267
#define T_OP_LE 268
#define T_OP_GT 269
#define T_OP_GE 270
#define T_OP_REG 271
#define T_OP_NRE 272
#define T_OP_IN 273
#define T_OP_PEEREXTLIST 274
#define T_OP_OR 275
#define T_OP_AND 276
#define T_OP_NOT 277
const short ssl_expr_yylhs[] = { -1,
0, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 2, 2, 2, 6, 6, 5,
5, 7, 7, 7, 7, 4, 4, 3,
};
const short ssl_expr_yylen[] = { 2,
1, 1, 1, 2, 3, 3, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 4, 3, 1,
3, 1, 1, 4, 1, 1, 1, 4,
};
const short ssl_expr_yydefred[] = { 0,
2, 3, 22, 23, 0, 0, 0, 0, 0, 0,
7, 25, 0, 0, 4, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
0, 0, 6, 9, 10, 11, 12, 13, 14, 26,
27, 16, 17, 0, 0, 15, 28, 24, 0, 0,
20, 0, 19, 0, 18, 21,
};
const short ssl_expr_yydgoto[] = { 9,
10, 11, 12, 42, 50, 46, 13,
};
const short ssl_expr_yysindex[] = { -37,
0, 0, 0, 0, -16, -37, -37, -92, 0, -248,
0, 0, -250, -228, 0, -39, -226, -37, -37, -33,
-33, -33, -33, -33, -33, -233, -233, -118, -6, 0,
-88, -238, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, -1, -33, 0, 0, 0, -33, -38,
0, 2, 0, -33, 0, 0,
};
const short ssl_expr_yyrindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 40,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
};
const short ssl_expr_yygindex[] = { 0,
7, 0, 0, 17, 0, 0, -13,
};
#define YYTABLESIZE 276
const short ssl_expr_yytable[] = { 8,
5, 30, 7, 8, 45, 54, 34, 35, 36, 37,
38, 39, 15, 16, 20, 21, 22, 23, 24, 25,
26, 27, 28, 14, 32, 33, 18, 19, 40, 41,
17, 51, 29, 31, 47, 52, 48, 19, 49, 1,
56, 5, 55, 43, 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, 0, 0, 0, 53, 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, 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, 44, 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, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
2, 3, 0, 4, 0, 3, 5, 4, 0, 0,
5, 0, 0, 0, 0, 18, 19, 0, 0, 6,
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, 5,
};
const short ssl_expr_yycheck[] = { 37,
0, 41, 40, 37, 123, 44, 20, 21, 22, 23,
24, 25, 6, 7, 265, 266, 267, 268, 269, 270,
271, 272, 273, 40, 18, 19, 275, 276, 262, 263,
123, 45, 261, 260, 41, 49, 125, 276, 40, 0,
54, 41, 41, 27, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 125, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 274, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 257,
258, 259, -1, 261, -1, 259, 264, 261, -1, -1,
264, -1, -1, -1, -1, 275, 276, -1, -1, 277,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 275,
};
#define YYFINAL 9
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 277
#if YYDEBUG
const char * const ssl_expr_yyname[] = {
"end-of-file",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,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,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"T_TRUE",
"T_FALSE","T_DIGIT","T_ID","T_STRING","T_REGEX","T_REGEX_I","T_FUNC_FILE",
"T_OP_EQ","T_OP_NE","T_OP_LT","T_OP_LE","T_OP_GT","T_OP_GE","T_OP_REG",
"T_OP_NRE","T_OP_IN","T_OP_PEEREXTLIST","T_OP_OR","T_OP_AND","T_OP_NOT",
};
const char * const ssl_expr_yyrule[] = {
"$accept : root",
"root : expr",
"expr : T_TRUE",
"expr : T_FALSE",
"expr : T_OP_NOT expr",
"expr : expr T_OP_OR expr",
"expr : expr T_OP_AND expr",
"expr : comparison",
"expr : '(' expr ')'",
"comparison : word T_OP_EQ word",
"comparison : word T_OP_NE word",
"comparison : word T_OP_LT word",
"comparison : word T_OP_LE word",
"comparison : word T_OP_GT word",
"comparison : word T_OP_GE word",
"comparison : word T_OP_IN wordlist",
"comparison : word T_OP_REG regex",
"comparison : word T_OP_NRE regex",
"wordlist : T_OP_PEEREXTLIST '(' word ')'",
"wordlist : '{' words '}'",
"words : word",
"words : words ',' word",
"word : T_DIGIT",
"word : T_STRING",
"word : '%' '{' T_ID '}'",
"word : funccall",
"regex : T_REGEX",
"regex : T_REGEX_I",
"funccall : T_FUNC_FILE '(' T_STRING ')'",
};
#endif
#if YYDEBUG
#include <stdio.h>
#endif
#ifdef YYSTACKSIZE
#define YYMAXDEPTH YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 10000
#define YYMAXDEPTH 10000
#endif
#endif
#define YYINITSTACKSIZE 200
int ssl_expr_yydebug;
int ssl_expr_yynerrs;
int ssl_expr_yyerrflag;
int ssl_expr_yychar;
short *ssl_expr_yyssp;
short *ssl_expr_yyss;
short *ssl_expr_yysslim;
int ssl_expr_yystacksize;
int ssl_expr_yyerror(char *s)
{
ssl_expr_error = s;
return 2;
}
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int ssl_expr_yygrowstack()
{
int newsize, i;
short *newss;
if ((newsize = ssl_expr_yystacksize) == 0)
else if (newsize >= YYMAXDEPTH)
return -1;
i = ssl_expr_yyssp - ssl_expr_yyss;
return -1;
ssl_expr_yyssp = newss + i;
return -1;
ssl_expr_yyvsp = newvs + i;
return 0;
}
#define YYABORT goto ssl_expr_yyabort
#define YYREJECT goto ssl_expr_yyabort
#define YYACCEPT goto ssl_expr_yyaccept
#define YYERROR goto ssl_expr_yyerrlab
#ifndef YYPARSE_PARAM
#if defined(__cplusplus) || __STDC__
#define YYPARSE_PARAM_ARG void
#define YYPARSE_PARAM_DECL
#else /* ! ANSI-C/C++ */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif /* ANSI-C/C++ */
#else /* YYPARSE_PARAM */
#ifndef YYPARSE_PARAM_TYPE
#define YYPARSE_PARAM_TYPE void *
#endif
#if defined(__cplusplus) || __STDC__
#define YYPARSE_PARAM_DECL
#else /* ! ANSI-C/C++ */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#endif /* ANSI-C/C++ */
#endif /* ! YYPARSE_PARAM */
int
{
#if YYDEBUG
register const char *ssl_expr_yys;
{
}
#endif
ssl_expr_yynerrs = 0;
ssl_expr_yyerrflag = 0;
ssl_expr_yychar = (-1);
*ssl_expr_yyssp = ssl_expr_yystate = 0;
if (ssl_expr_yychar < 0)
{
#if YYDEBUG
if (ssl_expr_yydebug)
{
ssl_expr_yys = 0;
printf("%sdebug: state %d, reading %d (%s)\n",
}
#endif
}
if ((ssl_expr_yyn = ssl_expr_yysindex[ssl_expr_yystate]) && (ssl_expr_yyn += ssl_expr_yychar) >= 0 &&
{
#if YYDEBUG
if (ssl_expr_yydebug)
printf("%sdebug: state %d, shifting to state %d\n",
#endif
{
goto ssl_expr_yyoverflow;
}
ssl_expr_yychar = (-1);
if (ssl_expr_yyerrflag > 0) --ssl_expr_yyerrflag;
goto ssl_expr_yyloop;
}
if ((ssl_expr_yyn = ssl_expr_yyrindex[ssl_expr_yystate]) && (ssl_expr_yyn += ssl_expr_yychar) >= 0 &&
{
goto ssl_expr_yyreduce;
}
if (ssl_expr_yyerrflag) goto ssl_expr_yyinrecovery;
goto ssl_expr_yynewerror;
#endif
ssl_expr_yyerror("syntax error");
goto ssl_expr_yyerrlab;
#endif
if (ssl_expr_yyerrflag < 3)
{
ssl_expr_yyerrflag = 3;
for (;;)
{
{
#if YYDEBUG
if (ssl_expr_yydebug)
printf("%sdebug: state %d, error recovery shifting\
#endif
{
goto ssl_expr_yyoverflow;
}
goto ssl_expr_yyloop;
}
else
{
#if YYDEBUG
if (ssl_expr_yydebug)
printf("%sdebug: error recovery discarding state %d\n",
#endif
}
}
}
else
{
if (ssl_expr_yychar == 0) goto ssl_expr_yyabort;
#if YYDEBUG
if (ssl_expr_yydebug)
{
ssl_expr_yys = 0;
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
}
#endif
ssl_expr_yychar = (-1);
goto ssl_expr_yyloop;
}
#if YYDEBUG
if (ssl_expr_yydebug)
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
#endif
switch (ssl_expr_yyn)
{
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
{ ssl_expr_yyval.exVal = ssl_expr_make(op_And, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); }
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
break;
case 12:
break;
case 13:
break;
case 14:
break;
case 15:
break;
case 16:
{ ssl_expr_yyval.exVal = ssl_expr_make(op_REG, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); }
break;
case 17:
{ ssl_expr_yyval.exVal = ssl_expr_make(op_NRE, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); }
break;
case 18:
break;
case 19:
break;
case 20:
break;
case 21:
{ ssl_expr_yyval.exVal = ssl_expr_make(op_ListElement, ssl_expr_yyvsp[0].exVal, ssl_expr_yyvsp[-2].exVal); }
break;
case 22:
break;
case 23:
break;
case 24:
break;
case 25:
break;
case 26:
{
ssl_expr_error = "Failed to compile regular expression";
}
}
break;
case 27:
{
ssl_expr_error = "Failed to compile regular expression";
}
}
break;
case 28:
{
}
break;
}
if (ssl_expr_yystate == 0 && ssl_expr_yym == 0)
{
#if YYDEBUG
if (ssl_expr_yydebug)
printf("%sdebug: after reduction, shifting from state 0 to\
#endif
*++ssl_expr_yyssp = YYFINAL;
*++ssl_expr_yyvsp = ssl_expr_yyval;
if (ssl_expr_yychar < 0)
{
#if YYDEBUG
if (ssl_expr_yydebug)
{
ssl_expr_yys = 0;
printf("%sdebug: state %d, reading %d (%s)\n",
}
#endif
}
if (ssl_expr_yychar == 0) goto ssl_expr_yyaccept;
goto ssl_expr_yyloop;
}
else
#if YYDEBUG
if (ssl_expr_yydebug)
printf("%sdebug: after reduction, shifting from state %d \
#endif
{
goto ssl_expr_yyoverflow;
}
*++ssl_expr_yyvsp = ssl_expr_yyval;
goto ssl_expr_yyloop;
ssl_expr_yyerror("yacc stack overflow");
return (1);
return (0);
}