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