2 static const char yysccsid
[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
8 #define YYPATCH 20101229
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
28 #undef YYSTYPE_IS_DECLARED
29 #define YYSTYPE_IS_DECLARED 1
31 #ifndef YYSTYPE_IS_DECLARED
32 #define YYSTYPE_IS_DECLARED 1
37 #endif /* !YYSTYPE_IS_DECLARED */
38 /* compatibility with bison */
40 /* compatibility with FreeBSD */
41 # ifdef YYPARSE_PARAM_TYPE
42 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
44 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
47 # define YYPARSE_DECL() yyparse(void)
50 /* Parameters sent to lex. */
52 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
53 # define YYLEX yylex(YYLEX_PARAM)
55 # define YYLEX_DECL() yylex(void)
56 # define YYLEX yylex()
59 /* Parameters sent to yyerror. */
60 #define YYERROR_DECL() yyerror(const char *s)
61 #define YYERROR_CALL(msg) yyerror(msg)
63 extern int YYPARSE_DECL();
70 #define kw_TAILMATCH 262
73 #define IDENTIFIER 265
75 static const short yylhs
[] = { -1,
76 0, 1, 1, 1, 1, 1, 1, 1, 4, 4,
77 2, 2, 2, 2, 2, 3, 3, 3, 3, 5,
80 static const short yylen
[] = { 2,
81 1, 1, 1, 2, 3, 3, 3, 1, 1, 3,
82 4, 4, 3, 5, 3, 1, 1, 1, 1, 1,
85 static const short yydefred
[] = { 0,
86 2, 3, 20, 21, 0, 0, 0, 0, 0, 0,
87 8, 0, 16, 17, 18, 19, 0, 0, 0, 0,
88 0, 0, 0, 0, 0, 0, 0, 0, 7, 0,
89 0, 0, 0, 0, 15, 13, 0, 0, 0, 22,
90 0, 23, 0, 12, 11, 10, 24, 14,
92 static const short yydgoto
[] = { 9,
93 10, 11, 12, 28, 13, 14, 15, 16, 31,
95 static const short yysindex
[] = { -33,
96 0, 0, 0, 0, -23, -33, -33, -105, 0, -247,
97 0, -28, 0, 0, 0, 0, -36, -247, -39, -244,
98 -33, -33, -26, -36, -38, -37, -22, -16, 0, -19,
99 -97, -247, -247, -36, 0, 0, -36, -36, -36, 0,
100 -244, 0, -9, 0, 0, 0, 0, 0,
102 static const short yyrindex
[] = { 0,
103 0, 0, 0, 0, 0, 0, 0, 0, 0, 36,
104 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
105 0, 0, 0, 0, 0, 0, -4, 0, 0, -87,
106 0, 6, 8, 0, 0, 0, 0, 0, 0, 0,
107 0, 0, 0, 0, 0, 0, 0, 0,
109 static const short yygindex
[] = { 0,
110 13, 0, -8, -24, 0, 0, 0, 16, -1,
112 #define YYTABLESIZE 234
113 static const short yytable
[] = { 6,
114 8, 29, 4, 8, 25, 5, 7, 6, 27, 43,
115 8, 21, 22, 34, 46, 36, 17, 20, 18, 19,
116 30, 39, 37, 38, 40, 27, 41, 42, 44, 45,
117 27, 48, 26, 32, 33, 1, 9, 25, 35, 47,
118 0, 0, 0, 4, 0, 0, 5, 0, 6, 0,
119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
120 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
121 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
126 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
127 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
128 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
129 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
130 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
132 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
134 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
135 0, 0, 0, 0, 0, 0, 0, 0, 0, 21,
136 22, 0, 0, 1, 2, 0, 3, 4, 5, 3,
139 static const short yycheck
[] = { 33,
140 37, 41, 0, 37, 33, 0, 40, 0, 17, 34,
141 37, 259, 260, 40, 39, 24, 40, 123, 6, 7,
142 265, 44, 61, 61, 41, 34, 46, 125, 37, 38,
143 39, 41, 61, 21, 22, 0, 41, 125, 23, 41,
144 -1, -1, -1, 41, -1, -1, 41, -1, 41, -1,
145 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
146 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
147 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
148 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
149 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
150 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
151 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
152 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
153 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
154 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
155 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
156 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
157 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
158 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
159 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
160 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
161 -1, -1, -1, -1, -1, -1, -1, -1, -1, 259,
162 260, -1, -1, 257, 258, -1, 263, 264, 265, 263,
169 #define YYMAXTOKEN 265
171 static const char *yyname
[] = {
173 "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,
174 "'!'",0,0,0,"'%'",0,0,"'('","')'",0,0,"','",0,"'.'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,
175 "'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
176 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,
177 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
178 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
179 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
180 0,0,"kw_TRUE","kw_FALSE","kw_AND","kw_OR","kw_IN","kw_TAILMATCH","NUMBER",
181 "STRING","IDENTIFIER",
183 static const char *yyrule
[] = {
189 "expr : expr kw_AND expr",
190 "expr : expr kw_OR expr",
191 "expr : '(' expr ')'",
194 "words : word ',' words",
195 "comp : word '=' '=' word",
196 "comp : word '!' '=' word",
197 "comp : word kw_TAILMATCH word",
198 "comp : word kw_IN '(' words ')'",
199 "comp : word kw_IN variable",
206 "function : IDENTIFIER '(' words ')'",
207 "variable : '%' '{' variables '}'",
208 "variables : IDENTIFIER '.' variables",
209 "variables : IDENTIFIER",
213 /* define the initial stack-sizes */
216 #define YYMAXDEPTH YYSTACKSIZE
219 #define YYSTACKSIZE YYMAXDEPTH
221 #define YYSTACKSIZE 500
222 #define YYMAXDEPTH 500
226 #define YYINITSTACKSIZE 500
244 /* variables for the parser stack */
245 static YYSTACKDATA yystack
;
248 #include <stdio.h> /* needed for printf */
251 #include <stdlib.h> /* needed for malloc, etc */
252 #include <string.h> /* needed for memset */
254 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
255 static int yygrowstack(YYSTACKDATA
*data
)
262 if ((newsize
= data
->stacksize
) == 0)
263 newsize
= YYINITSTACKSIZE
;
264 else if (newsize
>= YYMAXDEPTH
)
266 else if ((newsize
*= 2) > YYMAXDEPTH
)
267 newsize
= YYMAXDEPTH
;
269 i
= data
->s_mark
- data
->s_base
;
270 newss
= (short *)realloc(data
->s_base
, newsize
* sizeof(*newss
));
274 data
->s_base
= newss
;
275 data
->s_mark
= newss
+ i
;
277 newvs
= (YYSTYPE
*)realloc(data
->l_base
, newsize
* sizeof(*newvs
));
281 data
->l_base
= newvs
;
282 data
->l_mark
= newvs
+ i
;
284 data
->stacksize
= newsize
;
285 data
->s_last
= data
->s_base
+ newsize
- 1;
289 #if YYPURE || defined(YY_NO_LEAKS)
290 static void yyfreestack(YYSTACKDATA
*data
)
294 memset(data
, 0, sizeof(*data
));
297 #define yyfreestack(data) /* nothing */
300 #define YYABORT goto yyabort
301 #define YYREJECT goto yyabort
302 #define YYACCEPT goto yyaccept
303 #define YYERROR goto yyerrlab
308 int yym
, yyn
, yystate
;
312 if ((yys
= getenv("YYDEBUG")) != 0)
315 if (yyn
>= '0' && yyn
<= '9')
326 memset(&yystack
, 0, sizeof(yystack
));
329 if (yystack
.s_base
== NULL
&& yygrowstack(&yystack
)) goto yyoverflow
;
330 yystack
.s_mark
= yystack
.s_base
;
331 yystack
.l_mark
= yystack
.l_base
;
336 if ((yyn
= yydefred
[yystate
]) != 0) goto yyreduce
;
339 if ((yychar
= YYLEX
) < 0) yychar
= 0;
344 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
345 if (!yys
) yys
= "illegal-symbol";
346 printf("%sdebug: state %d, reading %d (%s)\n",
347 YYPREFIX
, yystate
, yychar
, yys
);
351 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
352 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
356 printf("%sdebug: state %d, shifting to state %d\n",
357 YYPREFIX
, yystate
, yytable
[yyn
]);
359 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
363 yystate
= yytable
[yyn
];
364 *++yystack
.s_mark
= yytable
[yyn
];
365 *++yystack
.l_mark
= yylval
;
367 if (yyerrflag
> 0) --yyerrflag
;
370 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
371 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
376 if (yyerrflag
) goto yyinrecovery
;
378 yyerror("syntax error");
391 if ((yyn
= yysindex
[*yystack
.s_mark
]) && (yyn
+= YYERRCODE
) >= 0 &&
392 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
396 printf("%sdebug: state %d, error recovery shifting\
397 to state %d\n", YYPREFIX
, *yystack
.s_mark
, yytable
[yyn
]);
399 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
403 yystate
= yytable
[yyn
];
404 *++yystack
.s_mark
= yytable
[yyn
];
405 *++yystack
.l_mark
= yylval
;
412 printf("%sdebug: error recovery discarding state %d\n",
413 YYPREFIX
, *yystack
.s_mark
);
415 if (yystack
.s_mark
<= yystack
.s_base
) goto yyabort
;
423 if (yychar
== 0) goto yyabort
;
428 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
429 if (!yys
) yys
= "illegal-symbol";
430 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
431 YYPREFIX
, yystate
, yychar
, yys
);
441 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
442 YYPREFIX
, yystate
, yyn
, yyrule
[yyn
]);
446 yyval
= yystack
.l_mark
[1-yym
];
448 memset(&yyval
, 0, sizeof yyval
);
452 { _hx509_expr_input
.expr
= yystack
.l_mark
[0].expr
; }
455 { yyval
.expr
= _hx509_make_expr(op_TRUE
, NULL
, NULL
); }
458 { yyval
.expr
= _hx509_make_expr(op_FALSE
, NULL
, NULL
); }
461 { yyval
.expr
= _hx509_make_expr(op_NOT
, yystack
.l_mark
[0].expr
, NULL
); }
464 { yyval
.expr
= _hx509_make_expr(op_AND
, yystack
.l_mark
[-2].expr
, yystack
.l_mark
[0].expr
); }
467 { yyval
.expr
= _hx509_make_expr(op_OR
, yystack
.l_mark
[-2].expr
, yystack
.l_mark
[0].expr
); }
470 { yyval
.expr
= yystack
.l_mark
[-1].expr
; }
473 { yyval
.expr
= _hx509_make_expr(op_COMP
, yystack
.l_mark
[0].expr
, NULL
); }
476 { yyval
.expr
= _hx509_make_expr(expr_WORDS
, yystack
.l_mark
[0].expr
, NULL
); }
479 { yyval
.expr
= _hx509_make_expr(expr_WORDS
, yystack
.l_mark
[-2].expr
, yystack
.l_mark
[0].expr
); }
482 { yyval
.expr
= _hx509_make_expr(comp_EQ
, yystack
.l_mark
[-3].expr
, yystack
.l_mark
[0].expr
); }
485 { yyval
.expr
= _hx509_make_expr(comp_NE
, yystack
.l_mark
[-3].expr
, yystack
.l_mark
[0].expr
); }
488 { yyval
.expr
= _hx509_make_expr(comp_TAILEQ
, yystack
.l_mark
[-2].expr
, yystack
.l_mark
[0].expr
); }
491 { yyval
.expr
= _hx509_make_expr(comp_IN
, yystack
.l_mark
[-4].expr
, yystack
.l_mark
[-1].expr
); }
494 { yyval
.expr
= _hx509_make_expr(comp_IN
, yystack
.l_mark
[-2].expr
, yystack
.l_mark
[0].expr
); }
497 { yyval
.expr
= yystack
.l_mark
[0].expr
; }
500 { yyval
.expr
= yystack
.l_mark
[0].expr
; }
503 { yyval
.expr
= yystack
.l_mark
[0].expr
; }
506 { yyval
.expr
= yystack
.l_mark
[0].expr
; }
509 { yyval
.expr
= _hx509_make_expr(expr_NUMBER
, yystack
.l_mark
[0].string
, NULL
); }
512 { yyval
.expr
= _hx509_make_expr(expr_STRING
, yystack
.l_mark
[0].string
, NULL
); }
516 yyval
.expr
= _hx509_make_expr(expr_FUNCTION
, yystack
.l_mark
[-3].string
, yystack
.l_mark
[-1].expr
); }
519 { yyval
.expr
= yystack
.l_mark
[-1].expr
; }
523 yyval
.expr
= _hx509_make_expr(expr_VAR
, yystack
.l_mark
[-2].string
, yystack
.l_mark
[0].expr
); }
527 yyval
.expr
= _hx509_make_expr(expr_VAR
, yystack
.l_mark
[0].string
, NULL
); }
530 yystack
.s_mark
-= yym
;
531 yystate
= *yystack
.s_mark
;
532 yystack
.l_mark
-= yym
;
534 if (yystate
== 0 && yym
== 0)
538 printf("%sdebug: after reduction, shifting from state 0 to\
539 state %d\n", YYPREFIX
, YYFINAL
);
542 *++yystack
.s_mark
= YYFINAL
;
543 *++yystack
.l_mark
= yyval
;
546 if ((yychar
= YYLEX
) < 0) yychar
= 0;
551 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
552 if (!yys
) yys
= "illegal-symbol";
553 printf("%sdebug: state %d, reading %d (%s)\n",
554 YYPREFIX
, YYFINAL
, yychar
, yys
);
558 if (yychar
== 0) goto yyaccept
;
561 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
562 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
563 yystate
= yytable
[yyn
];
565 yystate
= yydgoto
[yym
];
568 printf("%sdebug: after reduction, shifting from state %d \
569 to state %d\n", YYPREFIX
, *yystack
.s_mark
, yystate
);
571 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
575 *++yystack
.s_mark
= (short) yystate
;
576 *++yystack
.l_mark
= yyval
;
580 yyerror("yacc stack overflow");
583 yyfreestack(&yystack
);
587 yyfreestack(&yystack
);