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