param: Rename variable used for lp_dnsdomain szRealm_lower
[Samba.git] / source4 / heimdal / lib / hx509 / sel-gram.c
blob73859af1473874a556986f6fd4cf8ada12e106b5
1 #ifndef lint
2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
3 #endif
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8 #define YYPATCH 20101229
10 #define YYEMPTY (-1)
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
15 #define YYPREFIX "yy"
17 #define YYPURE 0
19 #ifdef HAVE_CONFIG_H
20 #include <config.h>
21 #endif
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <hx_locl.h>
27 #ifdef YYSTYPE
28 #undef YYSTYPE_IS_DECLARED
29 #define YYSTYPE_IS_DECLARED 1
30 #endif
31 #ifndef YYSTYPE_IS_DECLARED
32 #define YYSTYPE_IS_DECLARED 1
33 typedef union {
34 char *string;
35 struct hx_expr *expr;
36 } YYSTYPE;
37 #endif /* !YYSTYPE_IS_DECLARED */
38 /* compatibility with bison */
39 #ifdef YYPARSE_PARAM
40 /* compatibility with FreeBSD */
41 # ifdef YYPARSE_PARAM_TYPE
42 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
43 # else
44 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
45 # endif
46 #else
47 # define YYPARSE_DECL() yyparse(void)
48 #endif
50 /* Parameters sent to lex. */
51 #ifdef YYLEX_PARAM
52 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
53 # define YYLEX yylex(YYLEX_PARAM)
54 #else
55 # define YYLEX_DECL() yylex(void)
56 # define YYLEX yylex()
57 #endif
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();
65 #define kw_TRUE 257
66 #define kw_FALSE 258
67 #define kw_AND 259
68 #define kw_OR 260
69 #define kw_IN 261
70 #define kw_TAILMATCH 262
71 #define NUMBER 263
72 #define STRING 264
73 #define IDENTIFIER 265
74 #define YYERRCODE 256
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,
78 6, 7, 8, 9, 9,
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,
83 1, 4, 4, 3, 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,
137 4, 5, 23, 24,
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,
163 264, 265, 261, 262,
165 #define YYFINAL 9
166 #ifndef YYDEBUG
167 #define YYDEBUG 0
168 #endif
169 #define YYMAXTOKEN 265
170 #if YYDEBUG
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[] = {
184 "$accept : start",
185 "start : expr",
186 "expr : kw_TRUE",
187 "expr : kw_FALSE",
188 "expr : '!' expr",
189 "expr : expr kw_AND expr",
190 "expr : expr kw_OR expr",
191 "expr : '(' expr ')'",
192 "expr : comp",
193 "words : word",
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",
200 "word : number",
201 "word : string",
202 "word : function",
203 "word : variable",
204 "number : NUMBER",
205 "string : STRING",
206 "function : IDENTIFIER '(' words ')'",
207 "variable : '%' '{' variables '}'",
208 "variables : IDENTIFIER '.' variables",
209 "variables : IDENTIFIER",
212 #endif
213 /* define the initial stack-sizes */
214 #ifdef YYSTACKSIZE
215 #undef YYMAXDEPTH
216 #define YYMAXDEPTH YYSTACKSIZE
217 #else
218 #ifdef YYMAXDEPTH
219 #define YYSTACKSIZE YYMAXDEPTH
220 #else
221 #define YYSTACKSIZE 500
222 #define YYMAXDEPTH 500
223 #endif
224 #endif
226 #define YYINITSTACKSIZE 500
228 int yydebug;
229 int yynerrs;
231 typedef struct {
232 unsigned stacksize;
233 short *s_base;
234 short *s_mark;
235 short *s_last;
236 YYSTYPE *l_base;
237 YYSTYPE *l_mark;
238 } YYSTACKDATA;
239 int yyerrflag;
240 int yychar;
241 YYSTYPE yyval;
242 YYSTYPE yylval;
244 /* variables for the parser stack */
245 static YYSTACKDATA yystack;
247 #if YYDEBUG
248 #include <stdio.h> /* needed for printf */
249 #endif
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)
257 int i;
258 unsigned newsize;
259 short *newss;
260 YYSTYPE *newvs;
262 if ((newsize = data->stacksize) == 0)
263 newsize = YYINITSTACKSIZE;
264 else if (newsize >= YYMAXDEPTH)
265 return -1;
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));
271 if (newss == 0)
272 return -1;
274 data->s_base = newss;
275 data->s_mark = newss + i;
277 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
278 if (newvs == 0)
279 return -1;
281 data->l_base = newvs;
282 data->l_mark = newvs + i;
284 data->stacksize = newsize;
285 data->s_last = data->s_base + newsize - 1;
286 return 0;
289 #if YYPURE || defined(YY_NO_LEAKS)
290 static void yyfreestack(YYSTACKDATA *data)
292 free(data->s_base);
293 free(data->l_base);
294 memset(data, 0, sizeof(*data));
296 #else
297 #define yyfreestack(data) /* nothing */
298 #endif
300 #define YYABORT goto yyabort
301 #define YYREJECT goto yyabort
302 #define YYACCEPT goto yyaccept
303 #define YYERROR goto yyerrlab
306 YYPARSE_DECL()
308 int yym, yyn, yystate;
309 #if YYDEBUG
310 const char *yys;
312 if ((yys = getenv("YYDEBUG")) != 0)
314 yyn = *yys;
315 if (yyn >= '0' && yyn <= '9')
316 yydebug = yyn - '0';
318 #endif
320 yynerrs = 0;
321 yyerrflag = 0;
322 yychar = YYEMPTY;
323 yystate = 0;
325 #if YYPURE
326 memset(&yystack, 0, sizeof(yystack));
327 #endif
329 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
330 yystack.s_mark = yystack.s_base;
331 yystack.l_mark = yystack.l_base;
332 yystate = 0;
333 *yystack.s_mark = 0;
335 yyloop:
336 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
337 if (yychar < 0)
339 if ((yychar = YYLEX) < 0) yychar = 0;
340 #if YYDEBUG
341 if (yydebug)
343 yys = 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);
349 #endif
351 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
352 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
354 #if YYDEBUG
355 if (yydebug)
356 printf("%sdebug: state %d, shifting to state %d\n",
357 YYPREFIX, yystate, yytable[yyn]);
358 #endif
359 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
361 goto yyoverflow;
363 yystate = yytable[yyn];
364 *++yystack.s_mark = yytable[yyn];
365 *++yystack.l_mark = yylval;
366 yychar = YYEMPTY;
367 if (yyerrflag > 0) --yyerrflag;
368 goto yyloop;
370 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
371 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
373 yyn = yytable[yyn];
374 goto yyreduce;
376 if (yyerrflag) goto yyinrecovery;
378 yyerror("syntax error");
380 goto yyerrlab;
382 yyerrlab:
383 ++yynerrs;
385 yyinrecovery:
386 if (yyerrflag < 3)
388 yyerrflag = 3;
389 for (;;)
391 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
392 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
394 #if YYDEBUG
395 if (yydebug)
396 printf("%sdebug: state %d, error recovery shifting\
397 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
398 #endif
399 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
401 goto yyoverflow;
403 yystate = yytable[yyn];
404 *++yystack.s_mark = yytable[yyn];
405 *++yystack.l_mark = yylval;
406 goto yyloop;
408 else
410 #if YYDEBUG
411 if (yydebug)
412 printf("%sdebug: error recovery discarding state %d\n",
413 YYPREFIX, *yystack.s_mark);
414 #endif
415 if (yystack.s_mark <= yystack.s_base) goto yyabort;
416 --yystack.s_mark;
417 --yystack.l_mark;
421 else
423 if (yychar == 0) goto yyabort;
424 #if YYDEBUG
425 if (yydebug)
427 yys = 0;
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);
433 #endif
434 yychar = YYEMPTY;
435 goto yyloop;
438 yyreduce:
439 #if YYDEBUG
440 if (yydebug)
441 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
442 YYPREFIX, yystate, yyn, yyrule[yyn]);
443 #endif
444 yym = yylen[yyn];
445 if (yym)
446 yyval = yystack.l_mark[1-yym];
447 else
448 memset(&yyval, 0, sizeof yyval);
449 switch (yyn)
451 case 1:
452 { _hx509_expr_input.expr = yystack.l_mark[0].expr; }
453 break;
454 case 2:
455 { yyval.expr = _hx509_make_expr(op_TRUE, NULL, NULL); }
456 break;
457 case 3:
458 { yyval.expr = _hx509_make_expr(op_FALSE, NULL, NULL); }
459 break;
460 case 4:
461 { yyval.expr = _hx509_make_expr(op_NOT, yystack.l_mark[0].expr, NULL); }
462 break;
463 case 5:
464 { yyval.expr = _hx509_make_expr(op_AND, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
465 break;
466 case 6:
467 { yyval.expr = _hx509_make_expr(op_OR, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
468 break;
469 case 7:
470 { yyval.expr = yystack.l_mark[-1].expr; }
471 break;
472 case 8:
473 { yyval.expr = _hx509_make_expr(op_COMP, yystack.l_mark[0].expr, NULL); }
474 break;
475 case 9:
476 { yyval.expr = _hx509_make_expr(expr_WORDS, yystack.l_mark[0].expr, NULL); }
477 break;
478 case 10:
479 { yyval.expr = _hx509_make_expr(expr_WORDS, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
480 break;
481 case 11:
482 { yyval.expr = _hx509_make_expr(comp_EQ, yystack.l_mark[-3].expr, yystack.l_mark[0].expr); }
483 break;
484 case 12:
485 { yyval.expr = _hx509_make_expr(comp_NE, yystack.l_mark[-3].expr, yystack.l_mark[0].expr); }
486 break;
487 case 13:
488 { yyval.expr = _hx509_make_expr(comp_TAILEQ, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
489 break;
490 case 14:
491 { yyval.expr = _hx509_make_expr(comp_IN, yystack.l_mark[-4].expr, yystack.l_mark[-1].expr); }
492 break;
493 case 15:
494 { yyval.expr = _hx509_make_expr(comp_IN, yystack.l_mark[-2].expr, yystack.l_mark[0].expr); }
495 break;
496 case 16:
497 { yyval.expr = yystack.l_mark[0].expr; }
498 break;
499 case 17:
500 { yyval.expr = yystack.l_mark[0].expr; }
501 break;
502 case 18:
503 { yyval.expr = yystack.l_mark[0].expr; }
504 break;
505 case 19:
506 { yyval.expr = yystack.l_mark[0].expr; }
507 break;
508 case 20:
509 { yyval.expr = _hx509_make_expr(expr_NUMBER, yystack.l_mark[0].string, NULL); }
510 break;
511 case 21:
512 { yyval.expr = _hx509_make_expr(expr_STRING, yystack.l_mark[0].string, NULL); }
513 break;
514 case 22:
516 yyval.expr = _hx509_make_expr(expr_FUNCTION, yystack.l_mark[-3].string, yystack.l_mark[-1].expr); }
517 break;
518 case 23:
519 { yyval.expr = yystack.l_mark[-1].expr; }
520 break;
521 case 24:
523 yyval.expr = _hx509_make_expr(expr_VAR, yystack.l_mark[-2].string, yystack.l_mark[0].expr); }
524 break;
525 case 25:
527 yyval.expr = _hx509_make_expr(expr_VAR, yystack.l_mark[0].string, NULL); }
528 break;
530 yystack.s_mark -= yym;
531 yystate = *yystack.s_mark;
532 yystack.l_mark -= yym;
533 yym = yylhs[yyn];
534 if (yystate == 0 && yym == 0)
536 #if YYDEBUG
537 if (yydebug)
538 printf("%sdebug: after reduction, shifting from state 0 to\
539 state %d\n", YYPREFIX, YYFINAL);
540 #endif
541 yystate = YYFINAL;
542 *++yystack.s_mark = YYFINAL;
543 *++yystack.l_mark = yyval;
544 if (yychar < 0)
546 if ((yychar = YYLEX) < 0) yychar = 0;
547 #if YYDEBUG
548 if (yydebug)
550 yys = 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);
556 #endif
558 if (yychar == 0) goto yyaccept;
559 goto yyloop;
561 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
562 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
563 yystate = yytable[yyn];
564 else
565 yystate = yydgoto[yym];
566 #if YYDEBUG
567 if (yydebug)
568 printf("%sdebug: after reduction, shifting from state %d \
569 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
570 #endif
571 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
573 goto yyoverflow;
575 *++yystack.s_mark = (short) yystate;
576 *++yystack.l_mark = yyval;
577 goto yyloop;
579 yyoverflow:
580 yyerror("yacc stack overflow");
582 yyabort:
583 yyfreestack(&yystack);
584 return (1);
586 yyaccept:
587 yyfreestack(&yystack);
588 return (0);