1    | 
2    | /*  A Bison parser, made from er.yacc
3    |     by GNU Bison version 1.28  */
4    | 
5    | #define YYBISON 1  /* Identify Bison output.  */
6    | 
7    | #define yyparse er_yyparse
8    | #define yylex er_yylex
9    | #define yyerror er_yyerror
10   | #define yylval er_yylval
11   | #define yychar er_yychar
12   | #define yydebug er_yydebug
13   | #define yynerrs er_yynerrs
14   | #define	EOL	257
15   | #define	K_SOCK	258
16   | #define	K_NAME	259
17   | #define	K_FAC	260
18   | #define	K_ADD	261
19   | #define	K_RM	262
20   | #define	K_CREATE	263
21   | #define	K_DELETE	264
22   | #define	K_MODIFY	265
23   | #define	K_AUTO	266
24   | #define	K_ASP	267
25   | #define	K_SEV	268
26   | #define	K_THR	269
27   | #define	K_FORMAT	270
28   | #define	K_SELF	271
29   | #define	K_DATE	272
30   | #define	K_ALL	273
31   | #define	K_EXEC	274
32   | #define	K_PATH	275
33   | #define	STRING	276
34   | #define	NUMBER	277
35   | #define	HEXNUM	278
36   | 
37   | 
38   | #include "erroutines.h"
39   | #include <stdlib.h> 
40   | #include <string.h>
41   | #include "bitmask.h"
42   | #include "er_yacc_helper.h"
43   | #include "er_arrays.h"
44   | 
45   | #include "er_macro.h"
46   | #include "er_paths.h"
47   | 
48   | #define YYPARSE_PARAM ypar
49   | #define YYLEX_PARAM   ypar
50   | #define YYDEBUG 0
51   | /* #define YYERROR_VERBOSE  */
52   | 
53   | #define er_yyerror(a) myerror(ypar,a)
54   | 
55   | #define adderr(a,b) {strcat(a->errtxt,b);}
56   | 
57   | #define myfree(mem) {lexerr_t *erst = ypar; free(mem); erst->token = NULL} 
58   | 
59   | #define MYABORT { mycleanup(ypar); YYABORT; }
60   | 
61   | 
62   | typedef union {
63   |       int inum;
64   |       char *text;
65   | } YYSTYPE;
66   | #include <stdio.h>
67   | 
68   | #ifndef __cplusplus
69   | #ifndef __STDC__
70   | #define const
71   | #endif
72   | #endif
73   | 
74   | 
75   | 
76   | #define	YYFINAL		86
77   | #define	YYFLAG		-32768
78   | #define	YYNTBASE	31
79   | 
80   | #define YYTRANSLATE(x) ((unsigned)(x) <= 278 ? yytranslate[x] : 62)
81   | 
82   | static const char yytranslate[] = {     0,
83   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
84   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
85   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
86   |      2,     2,     2,     2,     2,     2,     2,     2,     2,    28,
87   |     29,     2,     2,     2,    30,     2,     2,     2,     2,     2,
88   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
89   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
90   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
91   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
92   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
93   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
94   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
95   |      2,     2,    25,    27,    26,     2,     2,     2,     2,     2,
96   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
97   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
98   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
99   |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
100  |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
101  |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
102  |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
103  |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
104  |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
105  |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
106  |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
107  |      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
108  |      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
109  |      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
110  |     17,    18,    19,    20,    21,    22,    23,    24
111  | };
112  | 
113  | #if YYDEBUG != 0
114  | static const short yyprhs[] = {     0,
115  |      0,     2,     5,     7,     8,    14,    17,    21,    26,    31,
116  |     33,    35,    40,    42,    44,    46,    48,    51,    53,    55,
117  |     59,    61,    64,    68,    71,    72,    74,    78,    79,    81,
118  |     83,    86,    88,    90,    93,    97,   102,   104,   107,   110,
119  |    111,   114,   115,   118,   121,   123,   127,   129,   131,   135,
120  |    137,   138,   140,   141,   143,   145,   147,   151,   153
121  | };
122  | 
123  | static const short yyrhs[] = {    32,
124  |      0,    32,     3,     0,     1,     0,     0,     9,    34,    33,
125  |     35,    47,     0,    10,    34,     0,    11,    34,    35,     0,
126  |     11,    34,     8,    46,     0,    11,    34,     7,    47,     0,
127  |     22,     0,    12,     0,    25,    37,    36,    26,     0,    40,
128  |      0,    41,     0,    43,     0,     1,     0,    16,    38,     0,
129  |      1,     0,    39,     0,    38,    27,    39,     0,    22,     0,
130  |      4,    23,     0,     5,    22,    42,     0,     5,     1,     0,
131  |      0,    18,     0,    20,    44,    45,     0,     0,    21,     0,
132  |     22,     0,    45,    22,     0,    23,     0,    48,     0,    47,
133  |     48,     0,    28,    49,    29,     0,    50,    52,    51,    53,
134  |      0,     1,     0,     6,    54,     0,    14,    56,     0,     0,
135  |     13,    60,     0,     0,    15,    17,     0,    15,    23,     0,
136  |     55,     0,    54,    27,    55,     0,    19,     0,    22,     0,
137  |     57,    30,    58,     0,    59,     0,     0,    22,     0,     0,
138  |     22,     0,    22,     0,    61,     0,    60,    27,    61,     0,
139  |     22,     0,    24,     0
140  | };
141  | 
142  | #endif
143  | 
144  | #if YYDEBUG != 0
145  | static const short yyrline[] = { 0,
146  |     76,    77,    78,    83,    88,   117,   130,   145,   161,   177,
147  |    178,   183,   188,   189,   190,   191,   196,   197,   202,   203,
148  |    206,   223,   231,   238,   243,   243,   249,   255,   255,   261,
149  |    266,   274,   277,   278,   281,   290,   291,   298,   300,   302,
150  |    303,   305,   306,   310,   318,   319,   324,   328,   345,   346,
151  |    349,   352,   358,   361,   367,   380,   381,   386,   401
152  | };
153  | #endif
154  | 
155  | 
156  | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
157  | 
158  | static const char * const yytname[] = {   "$","error","$undefined.","EOL","K_SOCK",
159  | "K_NAME","K_FAC","K_ADD","K_RM","K_CREATE","K_DELETE","K_MODIFY","K_AUTO","K_ASP",
160  | "K_SEV","K_THR","K_FORMAT","K_SELF","K_DATE","K_ALL","K_EXEC","K_PATH","STRING",
161  | "NUMBER","HEXNUM","'{'","'}'","'|'","'('","')'","'-'","fullline","stmt","@1",
162  | "pathid","path","pathspec","formatspec","formlist","oneform","sockspec","namespec",
163  | "nameoptions","execspec","opt_path","execwords","filterid","filters","filter",
164  | "filtspec","mand_fac","mand_sev","opt_asp","opt_thr","facspec","onefac","sevspec",
165  | "sevmin","sevmax","seveql","aspspec","oneasp", NULL
166  | };
167  | #endif
168  | 
169  | static const short yyr1[] = {     0,
170  |     31,    31,    31,    33,    32,    32,    32,    32,    32,    34,
171  |     34,    35,    36,    36,    36,    36,    37,    37,    38,    38,
172  |     39,    40,    41,    41,    42,    42,    43,    44,    44,    45,
173  |     45,    46,    47,    47,    48,    49,    49,    50,    51,    52,
174  |     52,    53,    53,    53,    54,    54,    55,    55,    56,    56,
175  |     57,    57,    58,    58,    59,    60,    60,    61,    61
176  | };
177  | 
178  | static const short yyr2[] = {     0,
179  |      1,     2,     1,     0,     5,     2,     3,     4,     4,     1,
180  |      1,     4,     1,     1,     1,     1,     2,     1,     1,     3,
181  |      1,     2,     3,     2,     0,     1,     3,     0,     1,     1,
182  |      2,     1,     1,     2,     3,     4,     1,     2,     2,     0,
183  |      2,     0,     2,     2,     1,     3,     1,     1,     3,     1,
184  |      0,     1,     0,     1,     1,     1,     3,     1,     1
185  | };
186  | 
187  | static const short yydefact[] = {     0,
188  |      3,     0,     0,     0,     1,    11,    10,     4,     6,     0,
189  |      2,     0,     0,     0,     0,     7,     0,     0,     9,    33,
190  |     32,     8,    18,     0,     0,     5,    37,     0,     0,    40,
191  |     34,    21,    17,    19,    16,     0,     0,    28,     0,    13,
192  |     14,    15,    47,    48,    38,    45,    35,     0,     0,     0,
193  |     22,    24,    25,    29,     0,    12,     0,    58,    59,    41,
194  |     56,    51,    42,    20,    26,    23,    30,    27,    46,     0,
195  |     55,    39,     0,    50,     0,    36,    31,    57,    53,    43,
196  |     44,    54,    49,     0,     0,     0
197  | };
198  | 
199  | static const short yydefgoto[] = {    84,
200  |      5,    12,     8,    16,    39,    25,    33,    34,    40,    41,
201  |     66,    42,    55,    68,    22,    19,    20,    29,    30,    63,
202  |     49,    76,    45,    46,    72,    73,    83,    74,    60,    61
203  | };
204  | 
205  | static const short yypact[] = {     5,
206  | -32768,   -10,   -10,   -10,     4,-32768,-32768,-32768,-32768,     1,
207  | -32768,   -14,     8,     9,     2,-32768,     8,    21,     8,-32768,
208  | -32768,-32768,-32768,    11,     0,     8,-32768,     6,    10,    17,
209  | -32768,-32768,    13,-32768,-32768,    12,    -1,    16,    15,-32768,
210  | -32768,-32768,-32768,-32768,    18,-32768,-32768,     7,    24,    11,
211  | -32768,-32768,    25,-32768,    22,-32768,     6,-32768,-32768,    19,
212  | -32768,    26,    27,-32768,-32768,-32768,-32768,    28,-32768,     7,
213  |     23,-32768,    29,-32768,    -4,-32768,-32768,-32768,    30,-32768,
214  | -32768,-32768,-32768,    34,    47,-32768
215  | };
216  | 
217  | static const short yypgoto[] = {-32768,
218  | -32768,-32768,    20,    37,-32768,-32768,-32768,    14,-32768,-32768,
219  | -32768,-32768,-32768,-32768,-32768,    38,    -9,-32768,-32768,-32768,
220  | -32768,-32768,-32768,    -6,-32768,-32768,-32768,-32768,-32768,   -16
221  | };
222  | 
223  | 
224  | #define	YYLAST		64
225  | 
226  | 
227  | static const short yytable[] = {    52,
228  |     35,     6,    23,    36,    37,     1,    11,    13,    14,    31,
229  |     15,     7,    80,     2,     3,     4,    31,    24,    81,    38,
230  |     53,    27,     9,    10,    43,    15,    28,    44,    58,    48,
231  |     59,    21,    32,    85,    51,    18,    54,    62,    47,    50,
232  |     56,    75,    65,    67,    57,    70,    86,    71,    17,    77,
233  |     69,    82,   -52,    78,    26,     0,     0,     0,    79,     0,
234  |      0,     0,     0,    64
235  | };
236  | 
237  | static const short yycheck[] = {     1,
238  |      1,    12,     1,     4,     5,     1,     3,     7,     8,    19,
239  |     25,    22,    17,     9,    10,    11,    26,    16,    23,    20,
240  |     22,     1,     3,     4,    19,    25,     6,    22,    22,    13,
241  |     24,    23,    22,     0,    23,    28,    21,    14,    29,    27,
242  |     26,    15,    18,    22,    27,    27,     0,    22,    12,    22,
243  |     57,    22,    30,    70,    17,    -1,    -1,    -1,    30,    -1,
244  |     -1,    -1,    -1,    50
245  | };
246  | #define YYPURE 1
247  | 
248  | /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
249  | 
250  | /* This file comes from bison-1.28.  */
251  | 
252  | /* Skeleton output parser for bison,
253  |    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
254  | 
255  |    This program is free software; you can redistribute it and/or modify
256  |    it under the terms of the GNU General Public License as published by
257  |    the Free Software Foundation; either version 2, or (at your option)
258  |    any later version.
259  | 
260  |    This program is distributed in the hope that it will be useful,
261  |    but WITHOUT ANY WARRANTY; without even the implied warranty of
262  |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
263  |    GNU General Public License for more details.
264  | 
265  |    You should have received a copy of the GNU General Public License
266  |    along with this program; if not, write to the Free Software
267  |    Foundation, Inc., 59 Temple Place - Suite 330,
268  |    Boston, MA 02111-1307, USA.  */
269  | 
270  | /* As a special exception, when this file is copied by Bison into a
271  |    Bison output file, you may use that output file without restriction.
272  |    This special exception was added by the Free Software Foundation
273  |    in version 1.24 of Bison.  */
274  | 
275  | /* This is the parser code that is written into each bison parser
276  |   when the %semantic_parser declaration is not specified in the grammar.
277  |   It was written by Richard Stallman by simplifying the hairy parser
278  |   used when %semantic_parser is specified.  */
279  | 
280  | #ifndef YYSTACK_USE_ALLOCA
281  | #ifdef alloca
282  | #define YYSTACK_USE_ALLOCA
283  | #else /* alloca not defined */
284  | #ifdef __GNUC__
285  | #define YYSTACK_USE_ALLOCA
286  | #define alloca __builtin_alloca
287  | #else /* not GNU C.  */
288  | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
289  | #define YYSTACK_USE_ALLOCA
290  | #include <alloca.h>
291  | #else /* not sparc */
292  | /* We think this test detects Watcom and Microsoft C.  */
293  | /* This used to test MSDOS, but that is a bad idea
294  |    since that symbol is in the user namespace.  */
295  | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
296  | #if 0 /* No need for malloc.h, which pollutes the namespace;
297  | 	 instead, just don't use alloca.  */
298  | #include <malloc.h>
299  | #endif
300  | #else /* not MSDOS, or __TURBOC__ */
301  | #if defined(_AIX)
302  | /* I don't know what this was needed for, but it pollutes the namespace.
303  |    So I turned it off.   rms, 2 May 1997.  */
304  | /* #include <malloc.h>  */
305  |  #pragma alloca
306  | #define YYSTACK_USE_ALLOCA
307  | #else /* not MSDOS, or __TURBOC__, or _AIX */
308  | #if 0
309  | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
310  | 		 and on HPUX 10.  Eventually we can turn this on.  */
311  | #define YYSTACK_USE_ALLOCA
312  | #define alloca __builtin_alloca
313  | #endif /* __hpux */
314  | #endif
315  | #endif /* not _AIX */
316  | #endif /* not MSDOS, or __TURBOC__ */
317  | #endif /* not sparc */
318  | #endif /* not GNU C */
319  | #endif /* alloca not defined */
320  | #endif /* YYSTACK_USE_ALLOCA not defined */
321  | 
322  | #ifdef YYSTACK_USE_ALLOCA
323  | #define YYSTACK_ALLOC alloca
324  | #else
325  | #define YYSTACK_ALLOC malloc
326  | #endif
327  | 
328  | /* Note: there must be only one dollar sign in this file.
329  |    It is replaced by the list of actions, each action
330  |    as one case of the switch.  */
331  | 
332  | #define yyerrok		(yyerrstatus = 0)
333  | #define yyclearin	(yychar = YYEMPTY)
334  | #define YYEMPTY		-2
335  | #define YYEOF		0
336  | #define YYACCEPT	goto yyacceptlab
337  | #define YYABORT 	goto yyabortlab
338  | #define YYERROR		goto yyerrlab1
339  | /* Like YYERROR except do call yyerror.
340  |    This remains here temporarily to ease the
341  |    transition to the new meaning of YYERROR, for GCC.
342  |    Once GCC version 2 has supplanted version 1, this can go.  */
343  | #define YYFAIL		goto yyerrlab
344  | #define YYRECOVERING()  (!!yyerrstatus)
345  | #define YYBACKUP(token, value) \
346  | do								\
347  |   if (yychar == YYEMPTY && yylen == 1)				\
348  |     { yychar = (token), yylval = (value);			\
349  |       yychar1 = YYTRANSLATE (yychar);				\
350  |       YYPOPSTACK;						\
351  |       goto yybackup;						\
352  |     }								\
353  |   else								\
354  |     { yyerror ("syntax error: cannot back up"); YYERROR; }	\
355  | while (0)
356  | 
357  | #define YYTERROR	1
358  | #define YYERRCODE	256
359  | 
360  | #ifndef YYPURE
361  | #define YYLEX		yylex()
362  | #endif
363  | 
364  | #ifdef YYPURE
365  | #ifdef YYLSP_NEEDED
366  | #ifdef YYLEX_PARAM
367  | #define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
368  | #else
369  | #define YYLEX		yylex(&yylval, &yylloc)
370  | #endif
371  | #else /* not YYLSP_NEEDED */
372  | #ifdef YYLEX_PARAM
373  | #define YYLEX		yylex(&yylval, YYLEX_PARAM)
374  | #else
375  | #define YYLEX		yylex(&yylval)
376  | #endif
377  | #endif /* not YYLSP_NEEDED */
378  | #endif
379  | 
380  | /* If nonreentrant, generate the variables here */
381  | 
382  | #ifndef YYPURE
383  | 
384  | int	yychar;			/*  the lookahead symbol		*/
385  | YYSTYPE	yylval;			/*  the semantic value of the		*/
386  | 				/*  lookahead symbol			*/
387  | 
388  | #ifdef YYLSP_NEEDED
389  | YYLTYPE yylloc;			/*  location data for the lookahead	*/
390  | 				/*  symbol				*/
391  | #endif
392  | 
393  | int yynerrs;			/*  number of parse errors so far       */
394  | #endif  /* not YYPURE */
395  | 
396  | #if YYDEBUG != 0
397  | int yydebug;			/*  nonzero means print parse trace	*/
398  | /* Since this is uninitialized, it does not stop multiple parsers
399  |    from coexisting.  */
400  | #endif
401  | 
402  | /*  YYINITDEPTH indicates the initial size of the parser's stacks	*/
403  | 
404  | #ifndef	YYINITDEPTH
405  | #define YYINITDEPTH 200
406  | #endif
407  | 
408  | /*  YYMAXDEPTH is the maximum size the stacks can grow to
409  |     (effective only if the built-in stack extension method is used).  */
410  | 
411  | #if YYMAXDEPTH == 0
412  | #undef YYMAXDEPTH
413  | #endif
414  | 
415  | #ifndef YYMAXDEPTH
416  | #define YYMAXDEPTH 10000
417  | #endif
418  | 
419  | /* Define __yy_memcpy.  Note that the size argument
420  |    should be passed with type unsigned int, because that is what the non-GCC
421  |    definitions require.  With GCC, __builtin_memcpy takes an arg
422  |    of type size_t, but it can handle unsigned int.  */
423  | 
424  | #if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
425  | #define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
426  | #else				/* not GNU C or C++ */
427  | #ifndef __cplusplus
428  | 
429  | /* This is the most reliable way to avoid incompatibilities
430  |    in available built-in functions on various systems.  */
431  | static void
432  | __yy_memcpy (to, from, count)
433  |      char *to;
434  |      char *from;
435  |      unsigned int count;
436  | {
437  |   register char *f = from;
438  |   register char *t = to;
439  |   register int i = count;
440  | 
441  |   while (i-- > 0)
442  |     *t++ = *f++;
443  | }
444  | 
445  | #else /* __cplusplus */
446  | 
447  | /* This is the most reliable way to avoid incompatibilities
448  |    in available built-in functions on various systems.  */
449  | static void
450  | __yy_memcpy (char *to, char *from, unsigned int count)
451  | {
452  |   register char *t = to;
453  |   register char *f = from;
454  |   register int i = count;
455  | 
456  |   while (i-- > 0)
457  |     *t++ = *f++;
458  | }
459  | 
460  | #endif
461  | #endif
462  | 
463  | 
464  | 
465  | /* The user can define YYPARSE_PARAM as the name of an argument to be passed
466  |    into yyparse.  The argument should have type void *.
467  |    It should actually point to an object.
468  |    Grammar actions can access the variable by casting it
469  |    to the proper pointer type.  */
470  | 
471  | #ifdef YYPARSE_PARAM
472  | #ifdef __cplusplus
473  | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
474  | #define YYPARSE_PARAM_DECL
475  | #else /* not __cplusplus */
476  | #define YYPARSE_PARAM_ARG YYPARSE_PARAM
477  | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
478  | #endif /* not __cplusplus */
479  | #else /* not YYPARSE_PARAM */
480  | #define YYPARSE_PARAM_ARG
481  | #define YYPARSE_PARAM_DECL
482  | #endif /* not YYPARSE_PARAM */
483  | 
484  | /* Prevent warning if -Wstrict-prototypes.  */
485  | #ifdef __GNUC__
486  | #ifdef YYPARSE_PARAM
487  | int yyparse (void *);
488  | #else
489  | int yyparse (void);
490  | #endif
491  | #endif
492  | 
493  | int
494  | yyparse(YYPARSE_PARAM_ARG)
495  |      YYPARSE_PARAM_DECL
496  | {
497  |   register int yystate;
498  |   register int yyn;
499  |   register short *yyssp;
500  |   register YYSTYPE *yyvsp;
501  |   int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
502  |   int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */
503  | 
504  |   short	yyssa[YYINITDEPTH];	/*  the state stack			*/
505  |   YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/
506  | 
507  |   short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
508  |   YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */
509  | 
510  | #ifdef YYLSP_NEEDED
511  |   YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
512  |   YYLTYPE *yyls = yylsa;
513  |   YYLTYPE *yylsp;
514  | 
515  | #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
516  | #else
517  | #define YYPOPSTACK   (yyvsp--, yyssp--)
518  | #endif
519  | 
520  |   int yystacksize = YYINITDEPTH;
521  |   int yyfree_stacks = 0;
522  | 
523  | #ifdef YYPURE
524  |   int yychar;
525  |   YYSTYPE yylval;
526  |   int yynerrs;
527  | #ifdef YYLSP_NEEDED
528  |   YYLTYPE yylloc;
529  | #endif
530  | #endif
531  | 
532  |   YYSTYPE yyval;		/*  the variable used to return		*/
533  | 				/*  semantic values from the action	*/
534  | 				/*  routines				*/
535  | 
536  |   int yylen;
537  | 
538  | #if YYDEBUG != 0
539  |   if (yydebug)
540  |     fprintf(stderr, "Starting parse\n");
541  | #endif
542  | 
543  |   yystate = 0;
544  |   yyerrstatus = 0;
545  |   yynerrs = 0;
546  |   yychar = YYEMPTY;		/* Cause a token to be read.  */
547  | 
548  |   /* Initialize stack pointers.
549  |      Waste one element of value and location stack
550  |      so that they stay on the same level as the state stack.
551  |      The wasted elements are never initialized.  */
552  | 
553  |   yyssp = yyss - 1;
554  |   yyvsp = yyvs;
555  | #ifdef YYLSP_NEEDED
556  |   yylsp = yyls;
557  | #endif
558  | 
559  | /* Push a new state, which is found in  yystate  .  */
560  | /* In all cases, when you get here, the value and location stacks
561  |    have just been pushed. so pushing a state here evens the stacks.  */
562  | yynewstate:
563  | 
564  |   *++yyssp = yystate;
565  | 
566  |   if (yyssp >= yyss + yystacksize - 1)
567  |     {
568  |       /* Give user a chance to reallocate the stack */
569  |       /* Use copies of these so that the &'s don't force the real ones into memory. */
570  |       YYSTYPE *yyvs1 = yyvs;
571  |       short *yyss1 = yyss;
572  | #ifdef YYLSP_NEEDED
573  |       YYLTYPE *yyls1 = yyls;
574  | #endif
575  | 
576  |       /* Get the current used size of the three stacks, in elements.  */
577  |       int size = yyssp - yyss + 1;
578  | 
579  | #ifdef yyoverflow
580  |       /* Each stack pointer address is followed by the size of
581  | 	 the data in use in that stack, in bytes.  */
582  | #ifdef YYLSP_NEEDED
583  |       /* This used to be a conditional around just the two extra args,
584  | 	 but that might be undefined if yyoverflow is a macro.  */
585  |       yyoverflow("parser stack overflow",
586  | 		 &yyss1, size * sizeof (*yyssp),
587  | 		 &yyvs1, size * sizeof (*yyvsp),
588  | 		 &yyls1, size * sizeof (*yylsp),
589  | 		 &yystacksize);
590  | #else
591  |       yyoverflow("parser stack overflow",
592  | 		 &yyss1, size * sizeof (*yyssp),
593  | 		 &yyvs1, size * sizeof (*yyvsp),
594  | 		 &yystacksize);
595  | #endif
596  | 
597  |       yyss = yyss1; yyvs = yyvs1;
598  | #ifdef YYLSP_NEEDED
599  |       yyls = yyls1;
600  | #endif
601  | #else /* no yyoverflow */
602  |       /* Extend the stack our own way.  */
603  |       if (yystacksize >= YYMAXDEPTH)
604  | 	{
605  | 	  yyerror("parser stack overflow");
606  | 	  if (yyfree_stacks)
607  | 	    {
608  | 	      free (yyss);
609  | 	      free (yyvs);
610  | #ifdef YYLSP_NEEDED
611  | 	      free (yyls);
612  | #endif
613  | 	    }
614  | 	  return 2;
615  | 	}
616  |       yystacksize *= 2;
617  |       if (yystacksize > YYMAXDEPTH)
618  | 	yystacksize = YYMAXDEPTH;
619  | #ifndef YYSTACK_USE_ALLOCA
620  |       yyfree_stacks = 1;
621  | #endif
622  |       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
623  |       __yy_memcpy ((char *)yyss, (char *)yyss1,
624  | 		   size * (unsigned int) sizeof (*yyssp));
625  |       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
626  |       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
627  | 		   size * (unsigned int) sizeof (*yyvsp));
628  | #ifdef YYLSP_NEEDED
629  |       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
630  |       __yy_memcpy ((char *)yyls, (char *)yyls1,
631  | 		   size * (unsigned int) sizeof (*yylsp));
632  | #endif
633  | #endif /* no yyoverflow */
634  | 
635  |       yyssp = yyss + size - 1;
636  |       yyvsp = yyvs + size - 1;
637  | #ifdef YYLSP_NEEDED
638  |       yylsp = yyls + size - 1;
639  | #endif
640  | 
641  | #if YYDEBUG != 0
642  |       if (yydebug)
643  | 	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
644  | #endif
645  | 
646  |       if (yyssp >= yyss + yystacksize - 1)
647  | 	YYABORT;
648  |     }
649  | 
650  | #if YYDEBUG != 0
651  |   if (yydebug)
652  |     fprintf(stderr, "Entering state %d\n", yystate);
653  | #endif
654  | 
655  |   goto yybackup;
656  |  yybackup:
657  | 
658  | /* Do appropriate processing given the current state.  */
659  | /* Read a lookahead token if we need one and don't already have one.  */
660  | /* yyresume: */
661  | 
662  |   /* First try to decide what to do without reference to lookahead token.  */
663  | 
664  |   yyn = yypact[yystate];
665  |   if (yyn == YYFLAG)
666  |     goto yydefault;
667  | 
668  |   /* Not known => get a lookahead token if don't already have one.  */
669  | 
670  |   /* yychar is either YYEMPTY or YYEOF
671  |      or a valid token in external form.  */
672  | 
673  |   if (yychar == YYEMPTY)
674  |     {
675  | #if YYDEBUG != 0
676  |       if (yydebug)
677  | 	fprintf(stderr, "Reading a token: ");
678  | #endif
679  |       yychar = YYLEX;
680  |     }
681  | 
682  |   /* Convert token to internal form (in yychar1) for indexing tables with */
683  | 
684  |   if (yychar <= 0)		/* This means end of input. */
685  |     {
686  |       yychar1 = 0;
687  |       yychar = YYEOF;		/* Don't call YYLEX any more */
688  | 
689  | #if YYDEBUG != 0
690  |       if (yydebug)
691  | 	fprintf(stderr, "Now at end of input.\n");
692  | #endif
693  |     }
694  |   else
695  |     {
696  |       yychar1 = YYTRANSLATE(yychar);
697  | 
698  | #if YYDEBUG != 0
699  |       if (yydebug)
700  | 	{
701  | 	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
702  | 	  /* Give the individual parser a way to print the precise meaning
703  | 	     of a token, for further debugging info.  */
704  | #ifdef YYPRINT
705  | 	  YYPRINT (stderr, yychar, yylval);
706  | #endif
707  | 	  fprintf (stderr, ")\n");
708  | 	}
709  | #endif
710  |     }
711  | 
712  |   yyn += yychar1;
713  |   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
714  |     goto yydefault;
715  | 
716  |   yyn = yytable[yyn];
717  | 
718  |   /* yyn is what to do for this token type in this state.
719  |      Negative => reduce, -yyn is rule number.
720  |      Positive => shift, yyn is new state.
721  |        New state is final state => don't bother to shift,
722  |        just return success.
723  |      0, or most negative number => error.  */
724  | 
725  |   if (yyn < 0)
726  |     {
727  |       if (yyn == YYFLAG)
728  | 	goto yyerrlab;
729  |       yyn = -yyn;
730  |       goto yyreduce;
731  |     }
732  |   else if (yyn == 0)
733  |     goto yyerrlab;
734  | 
735  |   if (yyn == YYFINAL)
736  |     YYACCEPT;
737  | 
738  |   /* Shift the lookahead token.  */
739  | 
740  | #if YYDEBUG != 0
741  |   if (yydebug)
742  |     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
743  | #endif
744  | 
745  |   /* Discard the token being shifted unless it is eof.  */
746  |   if (yychar != YYEOF)
747  |     yychar = YYEMPTY;
748  | 
749  |   *++yyvsp = yylval;
750  | #ifdef YYLSP_NEEDED
751  |   *++yylsp = yylloc;
752  | #endif
753  | 
754  |   /* count tokens shifted since error; after three, turn off error status.  */
755  |   if (yyerrstatus) yyerrstatus--;
756  | 
757  |   yystate = yyn;
758  |   goto yynewstate;
759  | 
760  | /* Do the default action for the current state.  */
761  | yydefault:
762  | 
763  |   yyn = yydefact[yystate];
764  |   if (yyn == 0)
765  |     goto yyerrlab;
766  | 
767  | /* Do a reduction.  yyn is the number of a rule to reduce with.  */
768  | yyreduce:
769  |   yylen = yyr2[yyn];
770  |   if (yylen > 0)
771  |     yyval = yyvsp[1-yylen]; /* implement default value of the action */
772  | 
773  | #if YYDEBUG != 0
774  |   if (yydebug)
775  |     {
776  |       int i;
777  | 
778  |       fprintf (stderr, "Reducing via rule %d (line %d), ",
779  | 	       yyn, yyrline[yyn]);
780  | 
781  |       /* Print the symbols being reduced, and their result.  */
782  |       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
783  | 	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
784  |       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
785  |     }
786  | #endif
787  | 
788  | 
789  |   switch (yyn) {
790  | 
791  | case 2:
792  | { er_yy_tracelog("parsed something\n"); ;
793  |     break;}
794  | case 3:
795  | {
796  | 		  MYABORT;
797  |  		;
798  |     break;}
799  | case 4:
800  | {	
801  | 			lexerr_t *erst = ypar;
802  | 			strncpy(erst->path.name, yyvsp[0].text, 31);
803  | 			mycleanup(ypar);
804  | 			;
805  |     break;}
806  | case 5:
807  | { 
808  | 			lexerr_t *erst = ypar;
809  | 			er_ret_t err;
810  | 
811  | 			erst->path.active = 1;
812  | 			err=er_register_path(&(erst->path), erst->path.name);
813  | 			mycleanup(ypar);
814  | 
815  | 			if( NOERR(err)) {
816  | 				adderr(erst, "created path ");
817  | 				adderr(erst, erst->path.name); 
818  | 			
819  | 			} 
820  | 			else {
821  | 				adderr(erst, "COULD NOT create path ");
822  | 				adderr(erst, erst->path.name);
823  | 				switch( err ) {
824  | 				    case ER_DUPENT:
825  | 					adderr(erst, " - duplicate entry");
826  | 					break;
827  | 				    case ER_INSANE:
828  | 					adderr(erst, " - sanity check not passed");
829  | 					break;
830  | 				}
831  | 				mycleanup(ypar);
832  | 				MYABORT;
833  | 			}
834  | 		     ;
835  |     break;}
836  | case 6:
837  | { 
838  | 			lexerr_t *erst = ypar;
839  | 	
840  | 			if( NOERR(er_delete_path(yyvsp[0].text)) ) {
841  | 			  adderr(erst, " path removed");
842  | 			  mycleanup(ypar);	
843  | 			}
844  | 			else {
845  | 			  adderr(erst, " COULD NOT remove path ");
846  | 			  MYABORT;
847  | 			}
848  | 				
849  | 		      ;
850  |     break;}
851  | case 7:
852  | {
853  | 		lexerr_t *erst = ypar;
854  | 
855  | 		erst->path.active = 1;
856  | 		if( NOERR(er_modify_path(&(erst->path), yyvsp[-1].text))) {
857  | 				adderr(erst, "modified path ");
858  | 				adderr(erst, yyvsp[-1].text); 
859  | 				mycleanup(ypar);
860  | 			} 
861  | 			else {
862  | 				adderr(erst, " COULD NOT modify path ");
863  | 				adderr(erst, yyvsp[-1].text);
864  | 				MYABORT;
865  | 			}
866  | 		;
867  |     break;}
868  | case 8:
869  | { 
870  | 			lexerr_t *erst = ypar;
871  | 			
872  | 			if( NOERR(er_delete_filter(yyvsp[-2].text, (unsigned) yyvsp[0].inum))) {	
873  | 				adderr(erst, "modified path ");
874  | 				adderr(erst, yyvsp[-2].text); 
875  | 				mycleanup(ypar);
876  | 			}
877  | 			else {
878  | 				adderr(erst, " COULD NOT remove filter ");
879  | 				adderr(erst, "from path ");
880  | 				adderr(erst, yyvsp[-2].text);
881  | 				MYABORT;	
882  | 			}
883  | 
884  | 		 ;
885  |     break;}
886  | case 9:
887  | {
888  | 	lexerr_t *erst = ypar;
889  | 			
890  | 	if( NOERR(er_attach_filter_chain(yyvsp[-2].text, erst->path.filters ))) {	
891  | 			adderr(erst, "modified path ");
892  | 			adderr(erst, yyvsp[-2].text); 
893  | 			mycleanup(ypar);
894  | 		}
895  | 	else {
896  | 	 		adderr(erst, " COULD NOT attach filters to path ");
897  | 			adderr(erst, yyvsp[-2].text);
898  | 			MYABORT;	
899  | 	}
900  |     ;
901  |     break;}
902  | case 10:
903  | { yyval.text = yyvsp[0].text; ;
904  |     break;}
905  | case 11:
906  | { yyval.text = "AUTO"/* if AUTO then generate a new one */ ;
907  |     break;}
908  | case 12:
909  | {
910  | 			 	  er_yy_tracelog("set path");
911  | 		                  ;
912  |     break;}
913  | case 13:
914  | { ;
915  |     break;}
916  | case 14:
917  | { ;
918  |     break;}
919  | case 15:
920  | { ;
921  |     break;}
922  | case 16:
923  | { lexerr_t *erst = ypar; 
924  | 			  adderr(erst, " - wrong PATH keyword"); 
925  | 			  MYABORT; ;
926  |     break;}
927  | case 18:
928  | { lexerr_t *erst = ypar;
929  | 			adderr(erst, " - format spec missing"); 
930  | 			MYABORT; ;
931  |     break;}
932  | case 21:
933  | { 
934  | 		lexerr_t *erst = ypar;
935  | 		int mod = er_getformatval(yyvsp[0].text); 
936  | 
937  | 		if( mod ) {
938  | 			erst->path.format |= mod;
939  | 			er_yy_tracelog("mode %s = 0x%x\n", yyvsp[0].text, mod); 
940  | 			mycleanup(ypar);
941  | 		} else {
942  | 			adderr(erst, " incorrect mode specification: ");
943  | 			adderr(erst, yyvsp[0].text);
944  | 			mycleanup(ypar);
945  | 			MYABORT; 
946  | 		}
947  | 	   ;
948  |     break;}
949  | case 22:
950  | { 
951  | 		lexerr_t *erst = ypar;
952  | 		erst->path.type = ER_PATH_SOCK;
953  | 		erst->path.descr.sock.fd = yyvsp[0].inum;
954  | 		er_yy_tracelog("socket. Now check the associated socket\n"); 
955  | 	;
956  |     break;}
957  | case 23:
958  | {
959  | 			lexerr_t *erst = ypar;
960  | 			erst->path.type = ER_PATH_NAME;
961  | 			er_yy_tracelog("namespec is %s\n", yyvsp[-1].text); 
962  | 			strcpy(erst->path.descr.name.filename, yyvsp[-1].text);
963  | 			mycleanup(ypar); 
964  | 			;
965  |     break;}
966  | case 24:
967  | { lexerr_t *erst = ypar;
968  | 				adderr(erst, " - filename missing"); 
969  | 				MYABORT; ;
970  |     break;}
971  | case 26:
972  | {
973  | 			lexerr_t *erst = ypar;
974  | 			erst->path.descr.name.date = 1;
975  | 		;
976  |     break;}
977  | case 27:
978  | {
979  | 			lexerr_t *erst = ypar;
980  | 			erst->path.type = ER_PATH_EXEC;	
981  | 		 ;
982  |     break;}
983  | case 29:
984  | {
985  | 			lexerr_t *erst = ypar;
986  | 			erst->path.descr.exec.usepath = 1;
987  | 			;
988  |     break;}
989  | case 30:
990  | { /* first element */
991  | 		  lexerr_t *erst = ypar;
992  | 		  er_add_exec_arg( &(erst->path), erst->token);
993  | 		  mycleanup(ypar); 
994  | 		  ;
995  |     break;}
996  | case 31:
997  | { /* next elements */
998  | 		  lexerr_t *erst = ypar;
999  | 		  er_add_exec_arg( &(erst->path), erst->token);
1000 | 		  mycleanup(ypar);
1001 | 		  ;
1002 |     break;}
1003 | case 34:
1004 | { er_yy_tracelog("one more filter done\n"); ;
1005 |     break;}
1006 | case 35:
1007 | { 
1008 | 			lexerr_t *erst = ypar;
1009 | 			/* add to list */
1010 | 			er_add_filter( &erst->path,  &(erst->curfilt)); 
1011 | 			er_yy_tracelog("added a filter\n"); 	
1012 | 			memset( &(erst->curfilt), 0, sizeof(er_filter_t) );
1013 | 			;
1014 |     break;}
1015 | case 36:
1016 | {;
1017 |     break;}
1018 | case 37:
1019 | { lexerr_t *erst = ypar;
1020 | 			adderr(erst, " - bad filter spec"); 
1021 | 			MYABORT; 
1022 | 		;
1023 |     break;}
1024 | case 38:
1025 | {;
1026 |     break;}
1027 | case 39:
1028 | {;
1029 |     break;}
1030 | case 41:
1031 | {;
1032 |     break;}
1033 | case 43:
1034 | {
1035 | 			lexerr_t *erst = ypar;
1036 | 			erst->curfilt.thr_id = pthread_self();
1037 | 			;
1038 |     break;}
1039 | case 44:
1040 | {
1041 | 			lexerr_t *erst = ypar;
1042 | 			erst->curfilt.thr_id = yyvsp[0].inum;
1043 | 			mycleanup(ypar);
1044 | 			;
1045 |     break;}
1046 | case 46:
1047 | { 
1048 | 		er_yy_tracelog("added fac to mask\n"); 
1049 | 		;
1050 |     break;}
1051 | case 47:
1052 | {   
1053 | 		  lexerr_t *erst = ypar;
1054 | 		  erst->curfilt.fac_mask = er_getfacallmask();
1055 | 		;
1056 |     break;}
1057 | case 48:
1058 | { 
1059 | 		lexerr_t *erst = ypar;
1060 | 		er_ret_t ef = er_getfacval(yyvsp[0].text); 
1061 | 
1062 | 		if( ef ) {
1063 | 			MA_set( &(erst->curfilt.fac_mask), (unsigned) ef, 1);
1064 | 			er_yy_tracelog("fac %s = %x\n", yyvsp[0].text, ef);
1065 | 			mycleanup(ypar);
1066 | 		} else {
1067 | 			adderr(erst, " incorrect fac specification: ");
1068 | 			adderr(erst, yyvsp[0].text);
1069 | 			mycleanup(ypar);
1070 | 			MYABORT; 
1071 | 		}
1072 | 	   ;
1073 |     break;}
1074 | case 51:
1075 | {
1076 | 			mysetsev(ypar, 0, "D")
1077 | 			;
1078 |     break;}
1079 | case 52:
1080 | { if( mysetsev(ypar, 0, yyvsp[0].text) == 0 ) {
1081 | 			MYABORT; 
1082 | 		   }
1083 | 		 ;
1084 |     break;}
1085 | case 53:
1086 | {
1087 | 			mysetsev(ypar, 1, "F")
1088 |          		;
1089 |     break;}
1090 | case 54:
1091 | { if( mysetsev(ypar, 1, yyvsp[0].text) == 0 ) {
1092 | 			MYABORT; 	
1093 | 		   } 
1094 | 		 ;
1095 |     break;}
1096 | case 55:
1097 | {
1098 | 		  char *cp = strdup(yyvsp[0].text);
1099 | 		  if( mysetsev(ypar, 0, yyvsp[0].text) != 0 ) {
1100 | 		      mysetsev(ypar, 1, cp);
1101 | 		      mycleanup(ypar);	
1102 | 		  }
1103 | 		  else {
1104 | 			free(cp);
1105 | 			MYABORT; 	
1106 | 		   } 
1107 | 		;
1108 |     break;}
1109 | case 57:
1110 | { 
1111 | 			er_yy_tracelog("added onefac\n");
1112 | 			;
1113 |     break;}
1114 | case 58:
1115 | { lexerr_t *erst = ypar;
1116 | 		 er_mask_t em = er_getaspval(yyvsp[0].text);
1117 | 
1118 | 		 if(em != 0) {
1119 | 			erst->curfilt.asp_mask |= em;
1120 | 			er_yy_tracelog("asp %s = %x\n", yyvsp[0].text, em);
1121 | 			mycleanup(ypar);
1122 | 		 } 
1123 | 		 else {
1124 | 			adderr(erst, " incorrect asp specification: ");
1125 | 			adderr(erst, yyvsp[0].text);
1126 | 			mycleanup(ypar);
1127 | 			MYABORT; 
1128 | 		      }
1129 | 		;
1130 |     break;}
1131 | case 59:
1132 | {
1133 | 		lexerr_t *erst = ypar;
1134 | 		erst->curfilt.asp_mask |= yyvsp[0].inum;
1135 | 		mycleanup(ypar);
1136 | 		;
1137 |     break;}
1138 | }
1139 |    /* the action file gets copied in in place of this dollarsign */
1140 | 
1141 | 
1142 |   yyvsp -= yylen;
1143 |   yyssp -= yylen;
1144 | #ifdef YYLSP_NEEDED
1145 |   yylsp -= yylen;
1146 | #endif
1147 | 
1148 | #if YYDEBUG != 0
1149 |   if (yydebug)
1150 |     {
1151 |       short *ssp1 = yyss - 1;
1152 |       fprintf (stderr, "state stack now");
1153 |       while (ssp1 != yyssp)
1154 | 	fprintf (stderr, " %d", *++ssp1);
1155 |       fprintf (stderr, "\n");
1156 |     }
1157 | #endif
1158 | 
1159 |   *++yyvsp = yyval;
1160 | 
1161 | #ifdef YYLSP_NEEDED
1162 |   yylsp++;
1163 |   if (yylen == 0)
1164 |     {
1165 |       yylsp->first_line = yylloc.first_line;
1166 |       yylsp->first_column = yylloc.first_column;
1167 |       yylsp->last_line = (yylsp-1)->last_line;
1168 |       yylsp->last_column = (yylsp-1)->last_column;
1169 |       yylsp->text = 0;
1170 |     }
1171 |   else
1172 |     {
1173 |       yylsp->last_line = (yylsp+yylen-1)->last_line;
1174 |       yylsp->last_column = (yylsp+yylen-1)->last_column;
1175 |     }
1176 | #endif
1177 | 
1178 |   /* Now "shift" the result of the reduction.
1179 |      Determine what state that goes to,
1180 |      based on the state we popped back to
1181 |      and the rule number reduced by.  */
1182 | 
1183 |   yyn = yyr1[yyn];
1184 | 
1185 |   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1186 |   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1187 |     yystate = yytable[yystate];
1188 |   else
1189 |     yystate = yydefgoto[yyn - YYNTBASE];
1190 | 
1191 |   goto yynewstate;
1192 | 
1193 | yyerrlab:   /* here on detecting error */
1194 | 
1195 |   if (! yyerrstatus)
1196 |     /* If not already recovering from an error, report this error.  */
1197 |     {
1198 |       ++yynerrs;
1199 | 
1200 | #ifdef YYERROR_VERBOSE
1201 |       yyn = yypact[yystate];
1202 | 
1203 |       if (yyn > YYFLAG && yyn < YYLAST)
1204 | 	{
1205 | 	  int size = 0;
1206 | 	  char *msg;
1207 | 	  int x, count;
1208 | 
1209 | 	  count = 0;
1210 | 	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
1211 | 	  for (x = (yyn < 0 ? -yyn : 0);
1212 | 	       x < (sizeof(yytname) / sizeof(char *)); x++)
1213 | 	    if (yycheck[x + yyn] == x)
1214 | 	      size += strlen(yytname[x]) + 15, count++;
1215 | 	  msg = (char *) malloc(size + 15);
1216 | 	  if (msg != 0)
1217 | 	    {
1218 | 	      strcpy(msg, "parse error");
1219 | 
1220 | 	      if (count < 5)
1221 | 		{
1222 | 		  count = 0;
1223 | 		  for (x = (yyn < 0 ? -yyn : 0);
1224 | 		       x < (sizeof(yytname) / sizeof(char *)); x++)
1225 | 		    if (yycheck[x + yyn] == x)
1226 | 		      {
1227 | 			strcat(msg, count == 0 ? ", expecting `" : " or `");
1228 | 			strcat(msg, yytname[x]);
1229 | 			strcat(msg, "'");
1230 | 			count++;
1231 | 		      }
1232 | 		}
1233 | 	      yyerror(msg);
1234 | 	      free(msg);
1235 | 	    }
1236 | 	  else
1237 | 	    yyerror ("parse error; also virtual memory exceeded");
1238 | 	}
1239 |       else
1240 | #endif /* YYERROR_VERBOSE */
1241 | 	yyerror("parse error");
1242 |     }
1243 | 
1244 |   goto yyerrlab1;
1245 | yyerrlab1:   /* here on error raised explicitly by an action */
1246 | 
1247 |   if (yyerrstatus == 3)
1248 |     {
1249 |       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
1250 | 
1251 |       /* return failure if at end of input */
1252 |       if (yychar == YYEOF)
1253 | 	YYABORT;
1254 | 
1255 | #if YYDEBUG != 0
1256 |       if (yydebug)
1257 | 	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1258 | #endif
1259 | 
1260 |       yychar = YYEMPTY;
1261 |     }
1262 | 
1263 |   /* Else will try to reuse lookahead token
1264 |      after shifting the error token.  */
1265 | 
1266 |   yyerrstatus = 3;		/* Each real token shifted decrements this */
1267 | 
1268 |   goto yyerrhandle;
1269 | 
1270 | yyerrdefault:  /* current state does not do anything special for the error token. */
1271 | 
1272 | #if 0
1273 |   /* This is wrong; only states that explicitly want error tokens
1274 |      should shift them.  */
1275 |   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
1276 |   if (yyn) goto yydefault;
1277 | #endif
1278 | 
1279 | yyerrpop:   /* pop the current state because it cannot handle the error token */
1280 | 
1281 |   if (yyssp == yyss) YYABORT;
1282 |   yyvsp--;
1283 |   yystate = *--yyssp;
1284 | #ifdef YYLSP_NEEDED
1285 |   yylsp--;
1286 | #endif
1287 | 
1288 | #if YYDEBUG != 0
1289 |   if (yydebug)
1290 |     {
1291 |       short *ssp1 = yyss - 1;
1292 |       fprintf (stderr, "Error: state stack now");
1293 |       while (ssp1 != yyssp)
1294 | 	fprintf (stderr, " %d", *++ssp1);
1295 |       fprintf (stderr, "\n");
1296 |     }
1297 | #endif
1298 | 
1299 | yyerrhandle:
1300 | 
1301 |   yyn = yypact[yystate];
1302 |   if (yyn == YYFLAG)
1303 |     goto yyerrdefault;
1304 | 
1305 |   yyn += YYTERROR;
1306 |   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1307 |     goto yyerrdefault;
1308 | 
1309 |   yyn = yytable[yyn];
1310 |   if (yyn < 0)
1311 |     {
1312 |       if (yyn == YYFLAG)
1313 | 	goto yyerrpop;
1314 |       yyn = -yyn;
1315 |       goto yyreduce;
1316 |     }
1317 |   else if (yyn == 0)
1318 |     goto yyerrpop;
1319 | 
1320 |   if (yyn == YYFINAL)
1321 |     YYACCEPT;
1322 | 
1323 | #if YYDEBUG != 0
1324 |   if (yydebug)
1325 |     fprintf(stderr, "Shifting error token, ");
1326 | #endif
1327 | 
1328 |   *++yyvsp = yylval;
1329 | #ifdef YYLSP_NEEDED
1330 |   *++yylsp = yylloc;
1331 | #endif
1332 | 
1333 |   yystate = yyn;
1334 |   goto yynewstate;
1335 | 
1336 |  yyacceptlab:
1337 |   /* YYACCEPT comes here.  */
1338 |   if (yyfree_stacks)
1339 |     {
1340 |       free (yyss);
1341 |       free (yyvs);
1342 | #ifdef YYLSP_NEEDED
1343 |       free (yyls);
1344 | #endif
1345 |     }
1346 |   return 0;
1347 | 
1348 |  yyabortlab:
1349 |   /* YYABORT comes here.  */
1350 |   if (yyfree_stacks)
1351 |     {
1352 |       free (yyss);
1353 |       free (yyvs);
1354 | #ifdef YYLSP_NEEDED
1355 |       free (yyls);
1356 | #endif
1357 |     }
1358 |   return 1;
1359 | }
1360 | 
1361 | 
1362 | #include "er_yacc_helper.inc"