1    | 
2    | /*  A Bison parser, made from peer.y
3    |     by GNU Bison version 1.28  */
4    | 
5    | #define YYBISON 1  /* Identify Bison output.  */
6    | 
7    | #define yyparse peerparse
8    | #define yylex peerlex
9    | #define yyerror peererror
10   | #define yylval peerlval
11   | #define yychar peerchar
12   | #define yydebug peerdebug
13   | #define yynerrs peernerrs
14   | #define	TKN_SIMPLE_PROTOCOL	257
15   | #define	TKN_BGP4	258
16   | #define	TKN_IPV4	259
17   | #define	TKN_RTRSNAME	260
18   | #define	TKN_PRNGNAME	261
19   | #define	TKN_ASNO	262
20   | #define	TKN_SMALLINT	263
21   | #define	KEYW_ASNO	264
22   | #define	KEYW_FLAP_DAMP	265
23   | #define	TKN_DNS	266
24   | 
25   | #line 1 "peer.y"
26   | 
27   | /*
28   |   filename: peer.y
29   | 
30   |   description:
31   |     Defines the grammar for an RPSL peer attribute.
32   | 
33   |   notes:
34   |     Defines tokens for the associated lexer, peer.l.
35   | */
36   | 
37   | /******************
38   |   Copyright (c) 2002                                        RIPE NCC
39   | 
40   |   All Rights Reserved
41   | 
42   |   Permission to use, copy, modify, and distribute this software and its
43   |   documentation for any purpose and without fee is hereby granted,
44   |   provided that the above copyright notice appear in all copies and that
45   |   both that copyright notice and this permission notice appear in
46   |   supporting documentation, and that the name of the author not be
47   |   used in advertising or publicity pertaining to distribution of the
48   |   software without specific, written prior permission.
49   | 
50   |   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
51   |   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
52   |   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
53   |   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
54   |   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
55   |   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
56   |   ***************************************/
57   | 
58   | #include <stdlib.h>
59   | 
60   | int yyerror(const char *s);
61   | 
62   | #line 38 "peer.y"
63   | typedef union {
64   |     char *sval;
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		47
77   | #define	YYFLAG		-32768
78   | #define	YYNTBASE	17
79   | 
80   | #define YYTRANSLATE(x) ((unsigned)(x) <= 266 ? yytranslate[x] : 21)
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,    14,
87   |     15,     2,     2,    16,     2,    13,     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,     2,     2,     2,     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
110  | };
111  | 
112  | #if YYDEBUG != 0
113  | static const short yyprhs[] = {     0,
114  |      0,     3,     6,     9,    12,    16,    20,    24,    28,    30,
115  |     34,    39,    46,    53,    57
116  | };
117  | 
118  | static const short yyrhs[] = {     3,
119  |      5,     0,     3,    18,     0,     3,     6,     0,     3,     7,
120  |      0,     4,     5,    19,     0,     4,    18,    19,     0,     4,
121  |      6,    19,     0,     4,     7,    19,     0,    12,     0,    18,
122  |     13,    12,     0,    10,    14,     8,    15,     0,    20,    16,
123  |     10,    14,     8,    15,     0,    10,    14,     8,    15,    16,
124  |     20,     0,    11,    14,    15,     0,    11,    14,     9,    16,
125  |      9,    16,     9,    16,     9,    16,     9,    16,     9,    15,
126  |      0
127  | };
128  | 
129  | #endif
130  | 
131  | #if YYDEBUG != 0
132  | static const short yyrline[] = { 0,
133  |     51,    52,    57,    58,    59,    60,    65,    66,    69,    70,
134  |     73,    74,    75,    78,    79
135  | };
136  | #endif
137  | 
138  | 
139  | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
140  | 
141  | static const char * const yytname[] = {   "$","error","$undefined.","TKN_SIMPLE_PROTOCOL",
142  | "TKN_BGP4","TKN_IPV4","TKN_RTRSNAME","TKN_PRNGNAME","TKN_ASNO","TKN_SMALLINT",
143  | "KEYW_ASNO","KEYW_FLAP_DAMP","TKN_DNS","'.'","'('","')'","','","peer","domain_name",
144  | "bgp_opt","flap_damp", NULL
145  | };
146  | #endif
147  | 
148  | static const short yyr1[] = {     0,
149  |     17,    17,    17,    17,    17,    17,    17,    17,    18,    18,
150  |     19,    19,    19,    20,    20
151  | };
152  | 
153  | static const short yyr2[] = {     0,
154  |      2,     2,     2,     2,     3,     3,     3,     3,     1,     3,
155  |      4,     6,     6,     3,    14
156  | };
157  | 
158  | static const short yydefact[] = {     0,
159  |      0,     0,     1,     3,     4,     9,     2,     0,     0,     0,
160  |      0,     0,     0,     0,     5,     0,     7,     8,     6,    10,
161  |      0,     0,     0,     0,     0,    14,     0,    11,     0,     0,
162  |      0,     0,     0,    13,     0,    12,     0,     0,     0,     0,
163  |      0,     0,     0,    15,     0,     0,     0
164  | };
165  | 
166  | static const short yydefgoto[] = {    45,
167  |      7,    15,    16
168  | };
169  | 
170  | static const short yypact[] = {     5,
171  |     -5,    -2,-32768,-32768,-32768,-32768,     2,    10,    10,    10,
172  |      3,    -1,     9,    11,-32768,     6,-32768,-32768,-32768,-32768,
173  |     16,    -3,    17,    13,    14,-32768,    12,    15,    20,    24,
174  |     22,    18,    21,-32768,    26,-32768,    23,    28,    25,    29,
175  |     27,    31,    30,-32768,    42,    44,-32768
176  | };
177  | 
178  | static const short yypgoto[] = {-32768,
179  |     45,     8,    19
180  | };
181  | 
182  | 
183  | #define	YYLAST		50
184  | 
185  | 
186  | static const short yytable[] = {     3,
187  |      4,     5,     8,     9,    10,    25,     6,     1,     2,     6,
188  |     20,    26,    13,    14,    12,    12,    17,    18,    19,    13,
189  |     14,    23,    21,    24,    22,    30,    27,    28,    32,    29,
190  |     31,    33,    14,    35,    37,    36,    39,    41,    38,    43,
191  |     40,    46,    42,    47,    44,     0,    11,     0,     0,    34
192  | };
193  | 
194  | static const short yycheck[] = {     5,
195  |      6,     7,     5,     6,     7,     9,    12,     3,     4,    12,
196  |     12,    15,    10,    11,    13,    13,     9,    10,    11,    10,
197  |     11,    16,    14,     8,    14,    14,    10,    15,     9,    16,
198  |     16,     8,    11,    16,     9,    15,     9,     9,    16,     9,
199  |     16,     0,    16,     0,    15,    -1,     2,    -1,    -1,    31
200  | };
201  | /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
202  | #line 3 "/usr/share/bison.simple"
203  | /* This file comes from bison-1.28.  */
204  | 
205  | /* Skeleton output parser for bison,
206  |    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
207  | 
208  |    This program is free software; you can redistribute it and/or modify
209  |    it under the terms of the GNU General Public License as published by
210  |    the Free Software Foundation; either version 2, or (at your option)
211  |    any later version.
212  | 
213  |    This program is distributed in the hope that it will be useful,
214  |    but WITHOUT ANY WARRANTY; without even the implied warranty of
215  |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
216  |    GNU General Public License for more details.
217  | 
218  |    You should have received a copy of the GNU General Public License
219  |    along with this program; if not, write to the Free Software
220  |    Foundation, Inc., 59 Temple Place - Suite 330,
221  |    Boston, MA 02111-1307, USA.  */
222  | 
223  | /* As a special exception, when this file is copied by Bison into a
224  |    Bison output file, you may use that output file without restriction.
225  |    This special exception was added by the Free Software Foundation
226  |    in version 1.24 of Bison.  */
227  | 
228  | /* This is the parser code that is written into each bison parser
229  |   when the %semantic_parser declaration is not specified in the grammar.
230  |   It was written by Richard Stallman by simplifying the hairy parser
231  |   used when %semantic_parser is specified.  */
232  | 
233  | #ifndef YYSTACK_USE_ALLOCA
234  | #ifdef alloca
235  | #define YYSTACK_USE_ALLOCA
236  | #else /* alloca not defined */
237  | #ifdef __GNUC__
238  | #define YYSTACK_USE_ALLOCA
239  | #define alloca __builtin_alloca
240  | #else /* not GNU C.  */
241  | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
242  | #define YYSTACK_USE_ALLOCA
243  | #include <alloca.h>
244  | #else /* not sparc */
245  | /* We think this test detects Watcom and Microsoft C.  */
246  | /* This used to test MSDOS, but that is a bad idea
247  |    since that symbol is in the user namespace.  */
248  | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
249  | #if 0 /* No need for malloc.h, which pollutes the namespace;
250  | 	 instead, just don't use alloca.  */
251  | #include <malloc.h>
252  | #endif
253  | #else /* not MSDOS, or __TURBOC__ */
254  | #if defined(_AIX)
255  | /* I don't know what this was needed for, but it pollutes the namespace.
256  |    So I turned it off.   rms, 2 May 1997.  */
257  | /* #include <malloc.h>  */
258  |  #pragma alloca
259  | #define YYSTACK_USE_ALLOCA
260  | #else /* not MSDOS, or __TURBOC__, or _AIX */
261  | #if 0
262  | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
263  | 		 and on HPUX 10.  Eventually we can turn this on.  */
264  | #define YYSTACK_USE_ALLOCA
265  | #define alloca __builtin_alloca
266  | #endif /* __hpux */
267  | #endif
268  | #endif /* not _AIX */
269  | #endif /* not MSDOS, or __TURBOC__ */
270  | #endif /* not sparc */
271  | #endif /* not GNU C */
272  | #endif /* alloca not defined */
273  | #endif /* YYSTACK_USE_ALLOCA not defined */
274  | 
275  | #ifdef YYSTACK_USE_ALLOCA
276  | #define YYSTACK_ALLOC alloca
277  | #else
278  | #define YYSTACK_ALLOC malloc
279  | #endif
280  | 
281  | /* Note: there must be only one dollar sign in this file.
282  |    It is replaced by the list of actions, each action
283  |    as one case of the switch.  */
284  | 
285  | #define yyerrok		(yyerrstatus = 0)
286  | #define yyclearin	(yychar = YYEMPTY)
287  | #define YYEMPTY		-2
288  | #define YYEOF		0
289  | #define YYACCEPT	goto yyacceptlab
290  | #define YYABORT 	goto yyabortlab
291  | #define YYERROR		goto yyerrlab1
292  | /* Like YYERROR except do call yyerror.
293  |    This remains here temporarily to ease the
294  |    transition to the new meaning of YYERROR, for GCC.
295  |    Once GCC version 2 has supplanted version 1, this can go.  */
296  | #define YYFAIL		goto yyerrlab
297  | #define YYRECOVERING()  (!!yyerrstatus)
298  | #define YYBACKUP(token, value) \
299  | do								\
300  |   if (yychar == YYEMPTY && yylen == 1)				\
301  |     { yychar = (token), yylval = (value);			\
302  |       yychar1 = YYTRANSLATE (yychar);				\
303  |       YYPOPSTACK;						\
304  |       goto yybackup;						\
305  |     }								\
306  |   else								\
307  |     { yyerror ("syntax error: cannot back up"); YYERROR; }	\
308  | while (0)
309  | 
310  | #define YYTERROR	1
311  | #define YYERRCODE	256
312  | 
313  | #ifndef YYPURE
314  | #define YYLEX		yylex()
315  | #endif
316  | 
317  | #ifdef YYPURE
318  | #ifdef YYLSP_NEEDED
319  | #ifdef YYLEX_PARAM
320  | #define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
321  | #else
322  | #define YYLEX		yylex(&yylval, &yylloc)
323  | #endif
324  | #else /* not YYLSP_NEEDED */
325  | #ifdef YYLEX_PARAM
326  | #define YYLEX		yylex(&yylval, YYLEX_PARAM)
327  | #else
328  | #define YYLEX		yylex(&yylval)
329  | #endif
330  | #endif /* not YYLSP_NEEDED */
331  | #endif
332  | 
333  | /* If nonreentrant, generate the variables here */
334  | 
335  | #ifndef YYPURE
336  | 
337  | int	yychar;			/*  the lookahead symbol		*/
338  | YYSTYPE	yylval;			/*  the semantic value of the		*/
339  | 				/*  lookahead symbol			*/
340  | 
341  | #ifdef YYLSP_NEEDED
342  | YYLTYPE yylloc;			/*  location data for the lookahead	*/
343  | 				/*  symbol				*/
344  | #endif
345  | 
346  | int yynerrs;			/*  number of parse errors so far       */
347  | #endif  /* not YYPURE */
348  | 
349  | #if YYDEBUG != 0
350  | int yydebug;			/*  nonzero means print parse trace	*/
351  | /* Since this is uninitialized, it does not stop multiple parsers
352  |    from coexisting.  */
353  | #endif
354  | 
355  | /*  YYINITDEPTH indicates the initial size of the parser's stacks	*/
356  | 
357  | #ifndef	YYINITDEPTH
358  | #define YYINITDEPTH 200
359  | #endif
360  | 
361  | /*  YYMAXDEPTH is the maximum size the stacks can grow to
362  |     (effective only if the built-in stack extension method is used).  */
363  | 
364  | #if YYMAXDEPTH == 0
365  | #undef YYMAXDEPTH
366  | #endif
367  | 
368  | #ifndef YYMAXDEPTH
369  | #define YYMAXDEPTH 10000
370  | #endif
371  | 
372  | /* Define __yy_memcpy.  Note that the size argument
373  |    should be passed with type unsigned int, because that is what the non-GCC
374  |    definitions require.  With GCC, __builtin_memcpy takes an arg
375  |    of type size_t, but it can handle unsigned int.  */
376  | 
377  | #if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
378  | #define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
379  | #else				/* not GNU C or C++ */
380  | #ifndef __cplusplus
381  | 
382  | /* This is the most reliable way to avoid incompatibilities
383  |    in available built-in functions on various systems.  */
384  | static void
385  | __yy_memcpy (to, from, count)
386  |      char *to;
387  |      char *from;
388  |      unsigned int count;
389  | {
390  |   register char *f = from;
391  |   register char *t = to;
392  |   register int i = count;
393  | 
394  |   while (i-- > 0)
395  |     *t++ = *f++;
396  | }
397  | 
398  | #else /* __cplusplus */
399  | 
400  | /* This is the most reliable way to avoid incompatibilities
401  |    in available built-in functions on various systems.  */
402  | static void
403  | __yy_memcpy (char *to, char *from, unsigned int count)
404  | {
405  |   register char *t = to;
406  |   register char *f = from;
407  |   register int i = count;
408  | 
409  |   while (i-- > 0)
410  |     *t++ = *f++;
411  | }
412  | 
413  | #endif
414  | #endif
415  | 
416  | #line 217 "/usr/share/bison.simple"
417  | 
418  | /* The user can define YYPARSE_PARAM as the name of an argument to be passed
419  |    into yyparse.  The argument should have type void *.
420  |    It should actually point to an object.
421  |    Grammar actions can access the variable by casting it
422  |    to the proper pointer type.  */
423  | 
424  | #ifdef YYPARSE_PARAM
425  | #ifdef __cplusplus
426  | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
427  | #define YYPARSE_PARAM_DECL
428  | #else /* not __cplusplus */
429  | #define YYPARSE_PARAM_ARG YYPARSE_PARAM
430  | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
431  | #endif /* not __cplusplus */
432  | #else /* not YYPARSE_PARAM */
433  | #define YYPARSE_PARAM_ARG
434  | #define YYPARSE_PARAM_DECL
435  | #endif /* not YYPARSE_PARAM */
436  | 
437  | /* Prevent warning if -Wstrict-prototypes.  */
438  | #ifdef __GNUC__
439  | #ifdef YYPARSE_PARAM
440  | int yyparse (void *);
441  | #else
442  | int yyparse (void);
443  | #endif
444  | #endif
445  | 
446  | int
447  | yyparse(YYPARSE_PARAM_ARG)
448  |      YYPARSE_PARAM_DECL
449  | {
450  |   register int yystate;
451  |   register int yyn;
452  |   register short *yyssp;
453  |   register YYSTYPE *yyvsp;
454  |   int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
455  |   int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */
456  | 
457  |   short	yyssa[YYINITDEPTH];	/*  the state stack			*/
458  |   YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/
459  | 
460  |   short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
461  |   YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */
462  | 
463  | #ifdef YYLSP_NEEDED
464  |   YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
465  |   YYLTYPE *yyls = yylsa;
466  |   YYLTYPE *yylsp;
467  | 
468  | #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
469  | #else
470  | #define YYPOPSTACK   (yyvsp--, yyssp--)
471  | #endif
472  | 
473  |   int yystacksize = YYINITDEPTH;
474  |   int yyfree_stacks = 0;
475  | 
476  | #ifdef YYPURE
477  |   int yychar;
478  |   YYSTYPE yylval;
479  |   int yynerrs;
480  | #ifdef YYLSP_NEEDED
481  |   YYLTYPE yylloc;
482  | #endif
483  | #endif
484  | 
485  |   YYSTYPE yyval;		/*  the variable used to return		*/
486  | 				/*  semantic values from the action	*/
487  | 				/*  routines				*/
488  | 
489  |   int yylen;
490  | 
491  | #if YYDEBUG != 0
492  |   if (yydebug)
493  |     fprintf(stderr, "Starting parse\n");
494  | #endif
495  | 
496  |   yystate = 0;
497  |   yyerrstatus = 0;
498  |   yynerrs = 0;
499  |   yychar = YYEMPTY;		/* Cause a token to be read.  */
500  | 
501  |   /* Initialize stack pointers.
502  |      Waste one element of value and location stack
503  |      so that they stay on the same level as the state stack.
504  |      The wasted elements are never initialized.  */
505  | 
506  |   yyssp = yyss - 1;
507  |   yyvsp = yyvs;
508  | #ifdef YYLSP_NEEDED
509  |   yylsp = yyls;
510  | #endif
511  | 
512  | /* Push a new state, which is found in  yystate  .  */
513  | /* In all cases, when you get here, the value and location stacks
514  |    have just been pushed. so pushing a state here evens the stacks.  */
515  | yynewstate:
516  | 
517  |   *++yyssp = yystate;
518  | 
519  |   if (yyssp >= yyss + yystacksize - 1)
520  |     {
521  |       /* Give user a chance to reallocate the stack */
522  |       /* Use copies of these so that the &'s don't force the real ones into memory. */
523  |       YYSTYPE *yyvs1 = yyvs;
524  |       short *yyss1 = yyss;
525  | #ifdef YYLSP_NEEDED
526  |       YYLTYPE *yyls1 = yyls;
527  | #endif
528  | 
529  |       /* Get the current used size of the three stacks, in elements.  */
530  |       int size = yyssp - yyss + 1;
531  | 
532  | #ifdef yyoverflow
533  |       /* Each stack pointer address is followed by the size of
534  | 	 the data in use in that stack, in bytes.  */
535  | #ifdef YYLSP_NEEDED
536  |       /* This used to be a conditional around just the two extra args,
537  | 	 but that might be undefined if yyoverflow is a macro.  */
538  |       yyoverflow("parser stack overflow",
539  | 		 &yyss1, size * sizeof (*yyssp),
540  | 		 &yyvs1, size * sizeof (*yyvsp),
541  | 		 &yyls1, size * sizeof (*yylsp),
542  | 		 &yystacksize);
543  | #else
544  |       yyoverflow("parser stack overflow",
545  | 		 &yyss1, size * sizeof (*yyssp),
546  | 		 &yyvs1, size * sizeof (*yyvsp),
547  | 		 &yystacksize);
548  | #endif
549  | 
550  |       yyss = yyss1; yyvs = yyvs1;
551  | #ifdef YYLSP_NEEDED
552  |       yyls = yyls1;
553  | #endif
554  | #else /* no yyoverflow */
555  |       /* Extend the stack our own way.  */
556  |       if (yystacksize >= YYMAXDEPTH)
557  | 	{
558  | 	  yyerror("parser stack overflow");
559  | 	  if (yyfree_stacks)
560  | 	    {
561  | 	      free (yyss);
562  | 	      free (yyvs);
563  | #ifdef YYLSP_NEEDED
564  | 	      free (yyls);
565  | #endif
566  | 	    }
567  | 	  return 2;
568  | 	}
569  |       yystacksize *= 2;
570  |       if (yystacksize > YYMAXDEPTH)
571  | 	yystacksize = YYMAXDEPTH;
572  | #ifndef YYSTACK_USE_ALLOCA
573  |       yyfree_stacks = 1;
574  | #endif
575  |       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
576  |       __yy_memcpy ((char *)yyss, (char *)yyss1,
577  | 		   size * (unsigned int) sizeof (*yyssp));
578  |       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
579  |       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
580  | 		   size * (unsigned int) sizeof (*yyvsp));
581  | #ifdef YYLSP_NEEDED
582  |       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
583  |       __yy_memcpy ((char *)yyls, (char *)yyls1,
584  | 		   size * (unsigned int) sizeof (*yylsp));
585  | #endif
586  | #endif /* no yyoverflow */
587  | 
588  |       yyssp = yyss + size - 1;
589  |       yyvsp = yyvs + size - 1;
590  | #ifdef YYLSP_NEEDED
591  |       yylsp = yyls + size - 1;
592  | #endif
593  | 
594  | #if YYDEBUG != 0
595  |       if (yydebug)
596  | 	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
597  | #endif
598  | 
599  |       if (yyssp >= yyss + yystacksize - 1)
600  | 	YYABORT;
601  |     }
602  | 
603  | #if YYDEBUG != 0
604  |   if (yydebug)
605  |     fprintf(stderr, "Entering state %d\n", yystate);
606  | #endif
607  | 
608  |   goto yybackup;
609  |  yybackup:
610  | 
611  | /* Do appropriate processing given the current state.  */
612  | /* Read a lookahead token if we need one and don't already have one.  */
613  | /* yyresume: */
614  | 
615  |   /* First try to decide what to do without reference to lookahead token.  */
616  | 
617  |   yyn = yypact[yystate];
618  |   if (yyn == YYFLAG)
619  |     goto yydefault;
620  | 
621  |   /* Not known => get a lookahead token if don't already have one.  */
622  | 
623  |   /* yychar is either YYEMPTY or YYEOF
624  |      or a valid token in external form.  */
625  | 
626  |   if (yychar == YYEMPTY)
627  |     {
628  | #if YYDEBUG != 0
629  |       if (yydebug)
630  | 	fprintf(stderr, "Reading a token: ");
631  | #endif
632  |       yychar = YYLEX;
633  |     }
634  | 
635  |   /* Convert token to internal form (in yychar1) for indexing tables with */
636  | 
637  |   if (yychar <= 0)		/* This means end of input. */
638  |     {
639  |       yychar1 = 0;
640  |       yychar = YYEOF;		/* Don't call YYLEX any more */
641  | 
642  | #if YYDEBUG != 0
643  |       if (yydebug)
644  | 	fprintf(stderr, "Now at end of input.\n");
645  | #endif
646  |     }
647  |   else
648  |     {
649  |       yychar1 = YYTRANSLATE(yychar);
650  | 
651  | #if YYDEBUG != 0
652  |       if (yydebug)
653  | 	{
654  | 	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
655  | 	  /* Give the individual parser a way to print the precise meaning
656  | 	     of a token, for further debugging info.  */
657  | #ifdef YYPRINT
658  | 	  YYPRINT (stderr, yychar, yylval);
659  | #endif
660  | 	  fprintf (stderr, ")\n");
661  | 	}
662  | #endif
663  |     }
664  | 
665  |   yyn += yychar1;
666  |   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
667  |     goto yydefault;
668  | 
669  |   yyn = yytable[yyn];
670  | 
671  |   /* yyn is what to do for this token type in this state.
672  |      Negative => reduce, -yyn is rule number.
673  |      Positive => shift, yyn is new state.
674  |        New state is final state => don't bother to shift,
675  |        just return success.
676  |      0, or most negative number => error.  */
677  | 
678  |   if (yyn < 0)
679  |     {
680  |       if (yyn == YYFLAG)
681  | 	goto yyerrlab;
682  |       yyn = -yyn;
683  |       goto yyreduce;
684  |     }
685  |   else if (yyn == 0)
686  |     goto yyerrlab;
687  | 
688  |   if (yyn == YYFINAL)
689  |     YYACCEPT;
690  | 
691  |   /* Shift the lookahead token.  */
692  | 
693  | #if YYDEBUG != 0
694  |   if (yydebug)
695  |     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
696  | #endif
697  | 
698  |   /* Discard the token being shifted unless it is eof.  */
699  |   if (yychar != YYEOF)
700  |     yychar = YYEMPTY;
701  | 
702  |   *++yyvsp = yylval;
703  | #ifdef YYLSP_NEEDED
704  |   *++yylsp = yylloc;
705  | #endif
706  | 
707  |   /* count tokens shifted since error; after three, turn off error status.  */
708  |   if (yyerrstatus) yyerrstatus--;
709  | 
710  |   yystate = yyn;
711  |   goto yynewstate;
712  | 
713  | /* Do the default action for the current state.  */
714  | yydefault:
715  | 
716  |   yyn = yydefact[yystate];
717  |   if (yyn == 0)
718  |     goto yyerrlab;
719  | 
720  | /* Do a reduction.  yyn is the number of a rule to reduce with.  */
721  | yyreduce:
722  |   yylen = yyr2[yyn];
723  |   if (yylen > 0)
724  |     yyval = yyvsp[1-yylen]; /* implement default value of the action */
725  | 
726  | #if YYDEBUG != 0
727  |   if (yydebug)
728  |     {
729  |       int i;
730  | 
731  |       fprintf (stderr, "Reducing via rule %d (line %d), ",
732  | 	       yyn, yyrline[yyn]);
733  | 
734  |       /* Print the symbols being reduced, and their result.  */
735  |       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
736  | 	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
737  |       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
738  |     }
739  | #endif
740  | 
741  | 
742  |   switch (yyn) {
743  | 
744  | case 2:
745  | #line 52 "peer.y"
746  | {
747  |     if (strlen(yyvsp[0].sval) > 255) {
748  |         syntax_error("Domain name \"%s\" is longer than 255 characters", yyvsp[0].sval);
749  |     }
750  | ;
751  |     break;}
752  | case 6:
753  | #line 60 "peer.y"
754  | {
755  |     if (strlen(yyvsp[-1].sval) > 255) {
756  |         syntax_error("Domain name \"%s\" is longer than 255 characters", yyvsp[-1].sval);
757  |     }
758  | ;
759  |     break;}
760  | }
761  |    /* the action file gets copied in in place of this dollarsign */
762  | #line 543 "/usr/share/bison.simple"
763  | 
764  |   yyvsp -= yylen;
765  |   yyssp -= yylen;
766  | #ifdef YYLSP_NEEDED
767  |   yylsp -= yylen;
768  | #endif
769  | 
770  | #if YYDEBUG != 0
771  |   if (yydebug)
772  |     {
773  |       short *ssp1 = yyss - 1;
774  |       fprintf (stderr, "state stack now");
775  |       while (ssp1 != yyssp)
776  | 	fprintf (stderr, " %d", *++ssp1);
777  |       fprintf (stderr, "\n");
778  |     }
779  | #endif
780  | 
781  |   *++yyvsp = yyval;
782  | 
783  | #ifdef YYLSP_NEEDED
784  |   yylsp++;
785  |   if (yylen == 0)
786  |     {
787  |       yylsp->first_line = yylloc.first_line;
788  |       yylsp->first_column = yylloc.first_column;
789  |       yylsp->last_line = (yylsp-1)->last_line;
790  |       yylsp->last_column = (yylsp-1)->last_column;
791  |       yylsp->text = 0;
792  |     }
793  |   else
794  |     {
795  |       yylsp->last_line = (yylsp+yylen-1)->last_line;
796  |       yylsp->last_column = (yylsp+yylen-1)->last_column;
797  |     }
798  | #endif
799  | 
800  |   /* Now "shift" the result of the reduction.
801  |      Determine what state that goes to,
802  |      based on the state we popped back to
803  |      and the rule number reduced by.  */
804  | 
805  |   yyn = yyr1[yyn];
806  | 
807  |   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
808  |   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
809  |     yystate = yytable[yystate];
810  |   else
811  |     yystate = yydefgoto[yyn - YYNTBASE];
812  | 
813  |   goto yynewstate;
814  | 
815  | yyerrlab:   /* here on detecting error */
816  | 
817  |   if (! yyerrstatus)
818  |     /* If not already recovering from an error, report this error.  */
819  |     {
820  |       ++yynerrs;
821  | 
822  | #ifdef YYERROR_VERBOSE
823  |       yyn = yypact[yystate];
824  | 
825  |       if (yyn > YYFLAG && yyn < YYLAST)
826  | 	{
827  | 	  int size = 0;
828  | 	  char *msg;
829  | 	  int x, count;
830  | 
831  | 	  count = 0;
832  | 	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
833  | 	  for (x = (yyn < 0 ? -yyn : 0);
834  | 	       x < (sizeof(yytname) / sizeof(char *)); x++)
835  | 	    if (yycheck[x + yyn] == x)
836  | 	      size += strlen(yytname[x]) + 15, count++;
837  | 	  msg = (char *) malloc(size + 15);
838  | 	  if (msg != 0)
839  | 	    {
840  | 	      strcpy(msg, "parse error");
841  | 
842  | 	      if (count < 5)
843  | 		{
844  | 		  count = 0;
845  | 		  for (x = (yyn < 0 ? -yyn : 0);
846  | 		       x < (sizeof(yytname) / sizeof(char *)); x++)
847  | 		    if (yycheck[x + yyn] == x)
848  | 		      {
849  | 			strcat(msg, count == 0 ? ", expecting `" : " or `");
850  | 			strcat(msg, yytname[x]);
851  | 			strcat(msg, "'");
852  | 			count++;
853  | 		      }
854  | 		}
855  | 	      yyerror(msg);
856  | 	      free(msg);
857  | 	    }
858  | 	  else
859  | 	    yyerror ("parse error; also virtual memory exceeded");
860  | 	}
861  |       else
862  | #endif /* YYERROR_VERBOSE */
863  | 	yyerror("parse error");
864  |     }
865  | 
866  |   goto yyerrlab1;
867  | yyerrlab1:   /* here on error raised explicitly by an action */
868  | 
869  |   if (yyerrstatus == 3)
870  |     {
871  |       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
872  | 
873  |       /* return failure if at end of input */
874  |       if (yychar == YYEOF)
875  | 	YYABORT;
876  | 
877  | #if YYDEBUG != 0
878  |       if (yydebug)
879  | 	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
880  | #endif
881  | 
882  |       yychar = YYEMPTY;
883  |     }
884  | 
885  |   /* Else will try to reuse lookahead token
886  |      after shifting the error token.  */
887  | 
888  |   yyerrstatus = 3;		/* Each real token shifted decrements this */
889  | 
890  |   goto yyerrhandle;
891  | 
892  | yyerrdefault:  /* current state does not do anything special for the error token. */
893  | 
894  | #if 0
895  |   /* This is wrong; only states that explicitly want error tokens
896  |      should shift them.  */
897  |   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
898  |   if (yyn) goto yydefault;
899  | #endif
900  | 
901  | yyerrpop:   /* pop the current state because it cannot handle the error token */
902  | 
903  |   if (yyssp == yyss) YYABORT;
904  |   yyvsp--;
905  |   yystate = *--yyssp;
906  | #ifdef YYLSP_NEEDED
907  |   yylsp--;
908  | #endif
909  | 
910  | #if YYDEBUG != 0
911  |   if (yydebug)
912  |     {
913  |       short *ssp1 = yyss - 1;
914  |       fprintf (stderr, "Error: state stack now");
915  |       while (ssp1 != yyssp)
916  | 	fprintf (stderr, " %d", *++ssp1);
917  |       fprintf (stderr, "\n");
918  |     }
919  | #endif
920  | 
921  | yyerrhandle:
922  | 
923  |   yyn = yypact[yystate];
924  |   if (yyn == YYFLAG)
925  |     goto yyerrdefault;
926  | 
927  |   yyn += YYTERROR;
928  |   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
929  |     goto yyerrdefault;
930  | 
931  |   yyn = yytable[yyn];
932  |   if (yyn < 0)
933  |     {
934  |       if (yyn == YYFLAG)
935  | 	goto yyerrpop;
936  |       yyn = -yyn;
937  |       goto yyreduce;
938  |     }
939  |   else if (yyn == 0)
940  |     goto yyerrpop;
941  | 
942  |   if (yyn == YYFINAL)
943  |     YYACCEPT;
944  | 
945  | #if YYDEBUG != 0
946  |   if (yydebug)
947  |     fprintf(stderr, "Shifting error token, ");
948  | #endif
949  | 
950  |   *++yyvsp = yylval;
951  | #ifdef YYLSP_NEEDED
952  |   *++yylsp = yylloc;
953  | #endif
954  | 
955  |   yystate = yyn;
956  |   goto yynewstate;
957  | 
958  |  yyacceptlab:
959  |   /* YYACCEPT comes here.  */
960  |   if (yyfree_stacks)
961  |     {
962  |       free (yyss);
963  |       free (yyvs);
964  | #ifdef YYLSP_NEEDED
965  |       free (yyls);
966  | #endif
967  |     }
968  |   return 0;
969  | 
970  |  yyabortlab:
971  |   /* YYABORT comes here.  */
972  |   if (yyfree_stacks)
973  |     {
974  |       free (yyss);
975  |       free (yyvs);
976  | #ifdef YYLSP_NEEDED
977  |       free (yyls);
978  | #endif
979  |     }
980  |   return 1;
981  | }
982  | #line 88 "peer.y"
983  | 
984  | 
985  | #undef peererror
986  | #undef yyerror
987  | 
988  | int
989  | peererror (const char *s)
990  | {
991  |     yyerror(s);
992  |     return 0;
993  | }
994  |