]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/backends/bind/bindparser.cc
Initial revision
[thirdparty/pdns.git] / pdns / backends / bind / bindparser.cc
1 /*
2 PowerDNS Versatile Database Driven Nameserver
3 Copyright (C) 2002 PowerDNS.COM BV
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 /* A Bison parser, made from /home/ahu/programming/ahudns/backends/bind/bindparser.yy
20 by GNU bison 1.35. */
21
22 #define YYBISON 1 /* Identify Bison output. */
23
24 # define WORD 257
25 # define QUOTEDWORD 258
26 # define OBRACE 259
27 # define EBRACE 260
28 # define SEMICOLON 261
29 # define ZONETOK 262
30 # define FILETOK 263
31 # define OPTIONSTOK 264
32 # define DIRECTORYTOK 265
33 # define ACLTOK 266
34 # define LOGGINGTOK 267
35 # define CLASSTOK 268
36 # define TYPETOK 269
37 # define MASTERTOK 270
38
39 #line 1 "bindparser.yy"
40
41
42 #define DIRTY_HACK WORD
43 #undef WORD
44
45 #include <stdio.h>
46 #include <string.h>
47 #include <stdlib.h>
48 #include <string>
49 #include <iostream>
50 #include <utility>
51 #include <errno.h>
52 #include "misc.hh"
53 #include "ahuexception.hh"
54 using namespace std;
55 #define YYDEBUG 1
56 extern int yydebug;
57 #include "bindparser.hh"
58
59 #define WORD DIRTY_HACK
60
61 #define YYSTYPE char *
62
63 extern "C"
64 {
65 int yyparse(void);
66 int yylex(void);
67 int yywrap()
68 {
69 return 1;
70 }
71
72 }
73
74 extern int yydebug;
75 const char *bind_directory;
76 extern int linenumber;
77 static void yyerror(const char *str)
78 {
79 extern char *current_filename;
80 throw AhuException("Error in bind configuration '"+string(current_filename)+"' on line "+itoa(linenumber)+": "+str);
81 }
82
83 extern FILE *yyin;
84 static BindParser *parent;
85 BindDomainInfo s_di;
86
87 void BindParser::parse(const string &fname)
88 {
89 yydebug=0;
90 yyin=fopen(fname.c_str(),"r");
91
92 if(!yyin)
93 throw AhuException("Unable to open '"+fname+"': "+strerror(errno));
94
95 linenumber=1;
96 parent=this;
97 extern char *current_filename;
98 extern char *original_filename;
99
100 current_filename=original_filename=(char*)fname.c_str();
101
102 yyparse();
103
104 // cerr<<"Need to parse "<<d_zonedomains.size()<<" zone statements"<<endl;
105 }
106
107 void BindParser::setDirectory(const string &dir)
108 {
109 d_dir=dir;
110 bind_directory=d_dir.c_str();
111 }
112
113 const string &BindParser::getDirectory()
114 {
115 return d_dir;
116 }
117
118 const vector<BindDomainInfo>& BindParser::getDomains()
119 {
120 return d_zonedomains;
121 }
122
123 void BindParser::setVerbose(bool verbose)
124 {
125 d_verbose=verbose;
126 }
127
128 void BindParser::commit(BindDomainInfo DI)
129 {
130 if(DI.filename[0]!='/')
131 DI.filename=d_dir+"/"+DI.filename;
132
133 if(d_verbose)
134 cerr<<"Domain "<<DI.name<<" lives in file '"<<DI.filename<<"'"<<endl;
135
136 d_zonedomains.push_back(DI);
137 }
138
139 #ifndef YYSTYPE
140 # define YYSTYPE int
141 # define YYSTYPE_IS_TRIVIAL 1
142 #endif
143 #ifndef YYDEBUG
144 # define YYDEBUG 1
145 #endif
146
147
148
149 #define YYFINAL 73
150 #define YYFLAG -32768
151 #define YYNTBASE 17
152
153 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
154 #define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 41)
155
156 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
157 static const char yytranslate[] =
158 {
159 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
161 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
162 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
163 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
164 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
165 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
166 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
167 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
168 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
169 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
170 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
171 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
172 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
173 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
174 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
175 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
179 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
180 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
181 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
184 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
185 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
186 16
187 };
188
189 #if YYDEBUG
190 static const short yyprhs[] =
191 {
192 0, 0, 1, 5, 7, 9, 11, 13, 14, 18,
193 20, 24, 29, 34, 39, 43, 47, 51, 52, 56,
194 58, 59, 63, 65, 67, 70, 71, 74, 76, 78,
195 80, 84, 88, 89, 93, 95, 97, 99, 101, 106,
196 107, 111, 113, 116, 119, 121
197 };
198 static const short yyrhs[] =
199 {
200 -1, 17, 18, 7, 0, 20, 0, 23, 0, 21,
201 0, 22, 0, 0, 19, 20, 7, 0, 29, 0,
202 8, 39, 32, 0, 8, 39, 3, 32, 0, 10,
203 5, 27, 6, 0, 13, 5, 27, 6, 0, 12,
204 39, 24, 0, 12, 40, 24, 0, 5, 25, 6,
205 0, 0, 26, 7, 25, 0, 3, 0, 0, 22,
206 7, 27, 0, 20, 0, 28, 0, 11, 39, 0,
207 0, 29, 30, 0, 3, 0, 31, 0, 39, 0,
208 5, 19, 6, 0, 5, 33, 6, 0, 0, 33,
209 21, 7, 0, 20, 0, 37, 0, 38, 0, 34,
210 0, 16, 5, 35, 6, 0, 0, 35, 36, 7,
211 0, 3, 0, 9, 39, 0, 15, 3, 0, 4,
212 0, 3, 0
213 };
214
215 #endif
216
217 #if YYDEBUG
218 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
219 static const short yyrline[] =
220 {
221 0, 107, 108, 112, 112, 112, 112, 115, 116, 120,
222 124, 131, 141, 143, 147, 148, 151, 154, 155, 159,
223 163, 164, 168, 168, 171, 178, 179, 183, 183, 183,
224 185, 189, 193, 194, 198, 198, 198, 198, 201, 204,
225 205, 209, 215, 223, 232, 239
226 };
227 #endif
228
229
230 #if (YYDEBUG) || defined YYERROR_VERBOSE
231
232 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
233 static const char *const yytname[] =
234 {
235 "$", "error", "$undefined.", "WORD", "QUOTEDWORD", "OBRACE", "EBRACE",
236 "SEMICOLON", "ZONETOK", "FILETOK", "OPTIONSTOK", "DIRECTORYTOK",
237 "ACLTOK", "LOGGINGTOK", "CLASSTOK", "TYPETOK", "MASTERTOK",
238 "root_commands", "root_command", "commands", "command", "zone_command",
239 "options_command", "acl_command", "acl_block", "acls", "acl",
240 "options_commands", "options_directory_command", "terms", "term",
241 "block", "zone_block", "zone_commands", "zone_masters_command",
242 "masters", "master", "zone_file_command", "zone_type_command",
243 "quotedname", "filename", 0
244 };
245 #endif
246
247 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
248 static const short yyr1[] =
249 {
250 0, 17, 17, 18, 18, 18, 18, 19, 19, 20,
251 21, 21, 22, 22, 23, 23, 24, 25, 25, 26,
252 27, 27, 22, 22, 28, 29, 29, 30, 30, 30,
253 31, 32, 33, 33, 21, 21, 21, 21, 34, 35,
254 35, 36, 37, 38, 39, 40
255 };
256
257 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
258 static const short yyr2[] =
259 {
260 0, 0, 3, 1, 1, 1, 1, 0, 3, 1,
261 3, 4, 4, 4, 3, 3, 3, 0, 3, 1,
262 0, 3, 1, 1, 2, 0, 2, 1, 1, 1,
263 3, 3, 0, 3, 1, 1, 1, 1, 4, 0,
264 3, 1, 2, 2, 1, 1
265 };
266
267 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
268 doesn't specify something else to do. Zero means the default is an
269 error. */
270 static const short yydefact[] =
271 {
272 1, 25, 0, 0, 0, 0, 0, 0, 0, 0,
273 0, 3, 5, 6, 4, 23, 9, 37, 35, 36,
274 44, 0, 42, 25, 24, 45, 0, 0, 25, 43,
275 39, 2, 27, 7, 26, 28, 29, 0, 32, 10,
276 22, 0, 0, 17, 14, 15, 0, 0, 25, 11,
277 25, 25, 12, 19, 0, 0, 13, 41, 38, 0,
278 30, 0, 31, 34, 0, 21, 16, 17, 40, 8,
279 33, 18, 0, 0
280 };
281
282 static const short yydefgoto[] =
283 {
284 1, 10, 48, 40, 12, 41, 14, 44, 54, 55,
285 42, 15, 16, 34, 35, 39, 50, 17, 47, 59,
286 18, 19, 21, 27
287 };
288
289 static const short yypact[] =
290 {
291 -32768, 2, 16, 16, 18, 16, 5, 27, 34, 33,
292 32,-32768,-32768,-32768,-32768,-32768, 31,-32768,-32768,-32768,
293 -32768, 22,-32768, 20,-32768,-32768, 35, 35, 20,-32768,
294 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 36,-32768,-32768,
295 -32768, 37, 39, 40,-32768,-32768, 42, 1, 44,-32768,
296 13, 20,-32768,-32768, 45, 46,-32768,-32768,-32768, 47,
297 -32768, 48,-32768,-32768, 49,-32768,-32768, 40,-32768,-32768,
298 -32768,-32768, 52,-32768
299 };
300
301 static const short yypgoto[] =
302 {
303 -32768,-32768,-32768, -1, -8, 56,-32768, 19, -9,-32768,
304 -27,-32768,-32768,-32768,-32768, 23,-32768,-32768,-32768,-32768,
305 -32768,-32768, 0,-32768
306 };
307
308
309 #define YYLAST 60
310
311
312 static const short yytable[] =
313 {
314 11, 46, 72, 22, 57, 24, 26, 58, 25, 20,
315 2, 3, 4, 5, 6, 7, 36, 8, 9, 62,
316 20, 2, 3, 23, 65, 37, -20, 38, 8, 9,
317 4, 5, 28, 7, 32, 20, 33, 29, 30, 31,
318 43, 38, 64, 53, 51, 52, 45, 61, 56, 63,
319 60, 66, 73, 67, 68, 69, 70, 13, 71, 0,
320 49
321 };
322
323 static const short yycheck[] =
324 {
325 1, 28, 0, 3, 3, 5, 6, 6, 3, 4,
326 8, 9, 10, 11, 12, 13, 16, 15, 16, 6,
327 4, 8, 9, 5, 51, 3, 6, 5, 15, 16,
328 10, 11, 5, 13, 3, 4, 5, 3, 5, 7,
329 5, 5, 50, 3, 7, 6, 27, 48, 6, 50,
330 6, 6, 0, 7, 7, 7, 7, 1, 67, -1,
331 37
332 };
333 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
334 #line 3 "/usr/share/bison/bison.simple"
335
336 /* Skeleton output parser for bison,
337
338 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
339 Foundation, Inc.
340
341 This program is free software; you can redistribute it and/or modify
342 it under the terms of the GNU General Public License as published by
343 the Free Software Foundation; either version 2, or (at your option)
344 any later version.
345
346 This program is distributed in the hope that it will be useful,
347 but WITHOUT ANY WARRANTY; without even the implied warranty of
348 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
349 GNU General Public License for more details.
350
351 You should have received a copy of the GNU General Public License
352 along with this program; if not, write to the Free Software
353 Foundation, Inc., 59 Temple Place - Suite 330,
354 Boston, MA 02111-1307, USA. */
355
356 /* As a special exception, when this file is copied by Bison into a
357 Bison output file, you may use that output file without restriction.
358 This special exception was added by the Free Software Foundation
359 in version 1.24 of Bison. */
360
361 /* This is the parser code that is written into each bison parser when
362 the %semantic_parser declaration is not specified in the grammar.
363 It was written by Richard Stallman by simplifying the hairy parser
364 used when %semantic_parser is specified. */
365
366 /* All symbols defined below should begin with yy or YY, to avoid
367 infringing on user name space. This should be done even for local
368 variables, as they might otherwise be expanded by user macros.
369 There are some unavoidable exceptions within include files to
370 define necessary library symbols; they are noted "INFRINGES ON
371 USER NAME SPACE" below. */
372
373 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
374
375 /* The parser invokes alloca or malloc; define the necessary symbols. */
376
377 # if YYSTACK_USE_ALLOCA
378 # define YYSTACK_ALLOC alloca
379 # else
380 # ifndef YYSTACK_USE_ALLOCA
381 # if defined (alloca) || defined (_ALLOCA_H)
382 # define YYSTACK_ALLOC alloca
383 # else
384 # ifdef __GNUC__
385 # define YYSTACK_ALLOC __builtin_alloca
386 # endif
387 # endif
388 # endif
389 # endif
390
391 # ifdef YYSTACK_ALLOC
392 /* Pacify GCC's `empty if-body' warning. */
393 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
394 # else
395 # if defined (__STDC__) || defined (__cplusplus)
396 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
397 # define YYSIZE_T size_t
398 # endif
399 # define YYSTACK_ALLOC malloc
400 # define YYSTACK_FREE free
401 # endif
402 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
403
404
405 #if (! defined (yyoverflow) \
406 && (! defined (__cplusplus) \
407 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
408
409 /* A type that is properly aligned for any stack member. */
410 union yyalloc
411 {
412 short yyss;
413 YYSTYPE yyvs;
414 # if YYLSP_NEEDED
415 YYLTYPE yyls;
416 # endif
417 };
418
419 /* The size of the maximum gap between one aligned stack and the next. */
420 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
421
422 /* The size of an array large to enough to hold all stacks, each with
423 N elements. */
424 # if YYLSP_NEEDED
425 # define YYSTACK_BYTES(N) \
426 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
427 + 2 * YYSTACK_GAP_MAX)
428 # else
429 # define YYSTACK_BYTES(N) \
430 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
431 + YYSTACK_GAP_MAX)
432 # endif
433
434 /* Copy COUNT objects from FROM to TO. The source and destination do
435 not overlap. */
436 # ifndef YYCOPY
437 # if 1 < __GNUC__
438 # define YYCOPY(To, From, Count) \
439 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
440 # else
441 # define YYCOPY(To, From, Count) \
442 do \
443 { \
444 register YYSIZE_T yyi; \
445 for (yyi = 0; yyi < (Count); yyi++) \
446 (To)[yyi] = (From)[yyi]; \
447 } \
448 while (0)
449 # endif
450 # endif
451
452 /* Relocate STACK from its old location to the new one. The
453 local variables YYSIZE and YYSTACKSIZE give the old and new number of
454 elements in the stack, and YYPTR gives the new location of the
455 stack. Advance YYPTR to a properly aligned location for the next
456 stack. */
457 # define YYSTACK_RELOCATE(Stack) \
458 do \
459 { \
460 YYSIZE_T yynewbytes; \
461 YYCOPY (&yyptr->Stack, Stack, yysize); \
462 Stack = &yyptr->Stack; \
463 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
464 yyptr += yynewbytes / sizeof (*yyptr); \
465 } \
466 while (0)
467
468 #endif
469
470
471 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
472 # define YYSIZE_T __SIZE_TYPE__
473 #endif
474 #if ! defined (YYSIZE_T) && defined (size_t)
475 # define YYSIZE_T size_t
476 #endif
477 #if ! defined (YYSIZE_T)
478 # if defined (__STDC__) || defined (__cplusplus)
479 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
480 # define YYSIZE_T size_t
481 # endif
482 #endif
483 #if ! defined (YYSIZE_T)
484 # define YYSIZE_T unsigned int
485 #endif
486
487 #define yyerrok (yyerrstatus = 0)
488 #define yyclearin (yychar = YYEMPTY)
489 #define YYEMPTY -2
490 #define YYEOF 0
491 #define YYACCEPT goto yyacceptlab
492 #define YYABORT goto yyabortlab
493 #define YYERROR goto yyerrlab1
494 /* Like YYERROR except do call yyerror. This remains here temporarily
495 to ease the transition to the new meaning of YYERROR, for GCC.
496 Once GCC version 2 has supplanted version 1, this can go. */
497 #define YYFAIL goto yyerrlab
498 #define YYRECOVERING() (!!yyerrstatus)
499 #define YYBACKUP(Token, Value) \
500 do \
501 if (yychar == YYEMPTY && yylen == 1) \
502 { \
503 yychar = (Token); \
504 yylval = (Value); \
505 yychar1 = YYTRANSLATE (yychar); \
506 YYPOPSTACK; \
507 goto yybackup; \
508 } \
509 else \
510 { \
511 yyerror ("syntax error: cannot back up"); \
512 YYERROR; \
513 } \
514 while (0)
515
516 #define YYTERROR 1
517 #define YYERRCODE 256
518
519
520 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
521 are run).
522
523 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
524 first token. By default, to implement support for ranges, extend
525 its range to the last symbol. */
526
527 #ifndef YYLLOC_DEFAULT
528 # define YYLLOC_DEFAULT(Current, Rhs, N) \
529 Current.last_line = Rhs[N].last_line; \
530 Current.last_column = Rhs[N].last_column;
531 #endif
532
533
534 /* YYLEX -- calling `yylex' with the right arguments. */
535
536 #if YYPURE
537 # if YYLSP_NEEDED
538 # ifdef YYLEX_PARAM
539 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
540 # else
541 # define YYLEX yylex (&yylval, &yylloc)
542 # endif
543 # else /* !YYLSP_NEEDED */
544 # ifdef YYLEX_PARAM
545 # define YYLEX yylex (&yylval, YYLEX_PARAM)
546 # else
547 # define YYLEX yylex (&yylval)
548 # endif
549 # endif /* !YYLSP_NEEDED */
550 #else /* !YYPURE */
551 # define YYLEX yylex ()
552 #endif /* !YYPURE */
553
554
555 /* Enable debugging if requested. */
556 #if YYDEBUG
557
558 # ifndef YYFPRINTF
559 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
560 # define YYFPRINTF fprintf
561 # endif
562
563 # define YYDPRINTF(Args) \
564 do { \
565 if (yydebug) \
566 YYFPRINTF Args; \
567 } while (0)
568 /* Nonzero means print parse trace. It is left uninitialized so that
569 multiple parsers can coexist. */
570 int yydebug;
571 #else /* !YYDEBUG */
572 # define YYDPRINTF(Args)
573 #endif /* !YYDEBUG */
574
575 /* YYINITDEPTH -- initial size of the parser's stacks. */
576 #ifndef YYINITDEPTH
577 # define YYINITDEPTH 200
578 #endif
579
580 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
581 if the built-in stack extension method is used).
582
583 Do not make this value too large; the results are undefined if
584 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
585 evaluated with infinite-precision integer arithmetic. */
586
587 #if YYMAXDEPTH == 0
588 # undef YYMAXDEPTH
589 #endif
590
591 #ifndef YYMAXDEPTH
592 # define YYMAXDEPTH 10000
593 #endif
594 \f
595 #ifdef YYERROR_VERBOSE
596
597 # ifndef yystrlen
598 # if defined (__GLIBC__) && defined (_STRING_H)
599 # define yystrlen strlen
600 # else
601 /* Return the length of YYSTR. */
602 static YYSIZE_T
603 # if defined (__STDC__) || defined (__cplusplus)
604 yystrlen (const char *yystr)
605 # else
606 yystrlen (yystr)
607 const char *yystr;
608 # endif
609 {
610 register const char *yys = yystr;
611
612 while (*yys++ != '\0')
613 continue;
614
615 return yys - yystr - 1;
616 }
617 # endif
618 # endif
619
620 # ifndef yystpcpy
621 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
622 # define yystpcpy stpcpy
623 # else
624 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
625 YYDEST. */
626 static char *
627 # if defined (__STDC__) || defined (__cplusplus)
628 yystpcpy (char *yydest, const char *yysrc)
629 # else
630 yystpcpy (yydest, yysrc)
631 char *yydest;
632 const char *yysrc;
633 # endif
634 {
635 register char *yyd = yydest;
636 register const char *yys = yysrc;
637
638 while ((*yyd++ = *yys++) != '\0')
639 continue;
640
641 return yyd - 1;
642 }
643 # endif
644 # endif
645 #endif
646 \f
647 #line 315 "/usr/share/bison/bison.simple"
648
649
650 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
651 into yyparse. The argument should have type void *.
652 It should actually point to an object.
653 Grammar actions can access the variable by casting it
654 to the proper pointer type. */
655
656 #ifdef YYPARSE_PARAM
657 # if defined (__STDC__) || defined (__cplusplus)
658 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
659 # define YYPARSE_PARAM_DECL
660 # else
661 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
662 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
663 # endif
664 #else /* !YYPARSE_PARAM */
665 # define YYPARSE_PARAM_ARG
666 # define YYPARSE_PARAM_DECL
667 #endif /* !YYPARSE_PARAM */
668
669 /* Prevent warning if -Wstrict-prototypes. */
670 #ifdef __GNUC__
671 # ifdef YYPARSE_PARAM
672 int yyparse (void *);
673 # else
674 int yyparse (void);
675 # endif
676 #endif
677
678 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
679 variables are global, or local to YYPARSE. */
680
681 #define YY_DECL_NON_LSP_VARIABLES \
682 /* The lookahead symbol. */ \
683 int yychar; \
684 \
685 /* The semantic value of the lookahead symbol. */ \
686 YYSTYPE yylval; \
687 \
688 /* Number of parse errors so far. */ \
689 int yynerrs;
690
691 #if YYLSP_NEEDED
692 # define YY_DECL_VARIABLES \
693 YY_DECL_NON_LSP_VARIABLES \
694 \
695 /* Location data for the lookahead symbol. */ \
696 YYLTYPE yylloc;
697 #else
698 # define YY_DECL_VARIABLES \
699 YY_DECL_NON_LSP_VARIABLES
700 #endif
701
702
703 /* If nonreentrant, generate the variables here. */
704
705 #if !YYPURE
706 YY_DECL_VARIABLES
707 #endif /* !YYPURE */
708
709 int
710 yyparse (YYPARSE_PARAM_ARG)
711 YYPARSE_PARAM_DECL
712 {
713 /* If reentrant, generate the variables here. */
714 #if YYPURE
715 YY_DECL_VARIABLES
716 #endif /* !YYPURE */
717
718 register int yystate;
719 register int yyn;
720 int yyresult;
721 /* Number of tokens to shift before error messages enabled. */
722 int yyerrstatus;
723 /* Lookahead token as an internal (translated) token number. */
724 int yychar1 = 0;
725
726 /* Three stacks and their tools:
727 `yyss': related to states,
728 `yyvs': related to semantic values,
729 `yyls': related to locations.
730
731 Refer to the stacks thru separate pointers, to allow yyoverflow
732 to reallocate them elsewhere. */
733
734 /* The state stack. */
735 short yyssa[YYINITDEPTH];
736 short *yyss = yyssa;
737 register short *yyssp;
738
739 /* The semantic value stack. */
740 YYSTYPE yyvsa[YYINITDEPTH];
741 YYSTYPE *yyvs = yyvsa;
742 register YYSTYPE *yyvsp;
743
744 #if YYLSP_NEEDED
745 /* The location stack. */
746 YYLTYPE yylsa[YYINITDEPTH];
747 YYLTYPE *yyls = yylsa;
748 YYLTYPE *yylsp;
749 #endif
750
751 #if YYLSP_NEEDED
752 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
753 #else
754 # define YYPOPSTACK (yyvsp--, yyssp--)
755 #endif
756
757 YYSIZE_T yystacksize = YYINITDEPTH;
758
759
760 /* The variables used to return semantic value and location from the
761 action routines. */
762 YYSTYPE yyval;
763 #if YYLSP_NEEDED
764 YYLTYPE yyloc;
765 #endif
766
767 /* When reducing, the number of symbols on the RHS of the reduced
768 rule. */
769 int yylen;
770
771 YYDPRINTF ((stderr, "Starting parse\n"));
772
773 yystate = 0;
774 yyerrstatus = 0;
775 yynerrs = 0;
776 yychar = YYEMPTY; /* Cause a token to be read. */
777
778 /* Initialize stack pointers.
779 Waste one element of value and location stack
780 so that they stay on the same level as the state stack.
781 The wasted elements are never initialized. */
782
783 yyssp = yyss;
784 yyvsp = yyvs;
785 #if YYLSP_NEEDED
786 yylsp = yyls;
787 #endif
788 goto yysetstate;
789
790 /*------------------------------------------------------------.
791 | yynewstate -- Push a new state, which is found in yystate. |
792 `------------------------------------------------------------*/
793 yynewstate:
794 /* In all cases, when you get here, the value and location stacks
795 have just been pushed. so pushing a state here evens the stacks.
796 */
797 yyssp++;
798
799 yysetstate:
800 *yyssp = yystate;
801
802 if (yyssp >= yyss + yystacksize - 1)
803 {
804 /* Get the current used size of the three stacks, in elements. */
805 YYSIZE_T yysize = yyssp - yyss + 1;
806
807 #ifdef yyoverflow
808 {
809 /* Give user a chance to reallocate the stack. Use copies of
810 these so that the &'s don't force the real ones into
811 memory. */
812 YYSTYPE *yyvs1 = yyvs;
813 short *yyss1 = yyss;
814
815 /* Each stack pointer address is followed by the size of the
816 data in use in that stack, in bytes. */
817 # if YYLSP_NEEDED
818 YYLTYPE *yyls1 = yyls;
819 /* This used to be a conditional around just the two extra args,
820 but that might be undefined if yyoverflow is a macro. */
821 yyoverflow ("parser stack overflow",
822 &yyss1, yysize * sizeof (*yyssp),
823 &yyvs1, yysize * sizeof (*yyvsp),
824 &yyls1, yysize * sizeof (*yylsp),
825 &yystacksize);
826 yyls = yyls1;
827 # else
828 yyoverflow ("parser stack overflow",
829 &yyss1, yysize * sizeof (*yyssp),
830 &yyvs1, yysize * sizeof (*yyvsp),
831 &yystacksize);
832 # endif
833 yyss = yyss1;
834 yyvs = yyvs1;
835 }
836 #else /* no yyoverflow */
837 # ifndef YYSTACK_RELOCATE
838 goto yyoverflowlab;
839 # else
840 /* Extend the stack our own way. */
841 if (yystacksize >= YYMAXDEPTH)
842 goto yyoverflowlab;
843 yystacksize *= 2;
844 if (yystacksize > YYMAXDEPTH)
845 yystacksize = YYMAXDEPTH;
846
847 {
848 short *yyss1 = yyss;
849 union yyalloc *yyptr =
850 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
851 if (! yyptr)
852 goto yyoverflowlab;
853 YYSTACK_RELOCATE (yyss);
854 YYSTACK_RELOCATE (yyvs);
855 # if YYLSP_NEEDED
856 YYSTACK_RELOCATE (yyls);
857 # endif
858 # undef YYSTACK_RELOCATE
859 if (yyss1 != yyssa)
860 YYSTACK_FREE (yyss1);
861 }
862 # endif
863 #endif /* no yyoverflow */
864
865 yyssp = yyss + yysize - 1;
866 yyvsp = yyvs + yysize - 1;
867 #if YYLSP_NEEDED
868 yylsp = yyls + yysize - 1;
869 #endif
870
871 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
872 (unsigned long int) yystacksize));
873
874 if (yyssp >= yyss + yystacksize - 1)
875 YYABORT;
876 }
877
878 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
879
880 goto yybackup;
881
882
883 /*-----------.
884 | yybackup. |
885 `-----------*/
886 yybackup:
887
888 /* Do appropriate processing given the current state. */
889 /* Read a lookahead token if we need one and don't already have one. */
890 /* yyresume: */
891
892 /* First try to decide what to do without reference to lookahead token. */
893
894 yyn = yypact[yystate];
895 if (yyn == YYFLAG)
896 goto yydefault;
897
898 /* Not known => get a lookahead token if don't already have one. */
899
900 /* yychar is either YYEMPTY or YYEOF
901 or a valid token in external form. */
902
903 if (yychar == YYEMPTY)
904 {
905 YYDPRINTF ((stderr, "Reading a token: "));
906 yychar = YYLEX;
907 }
908
909 /* Convert token to internal form (in yychar1) for indexing tables with */
910
911 if (yychar <= 0) /* This means end of input. */
912 {
913 yychar1 = 0;
914 yychar = YYEOF; /* Don't call YYLEX any more */
915
916 YYDPRINTF ((stderr, "Now at end of input.\n"));
917 }
918 else
919 {
920 yychar1 = YYTRANSLATE (yychar);
921
922 #if YYDEBUG
923 /* We have to keep this `#if YYDEBUG', since we use variables
924 which are defined only if `YYDEBUG' is set. */
925 if (yydebug)
926 {
927 YYFPRINTF (stderr, "Next token is %d (%s",
928 yychar, yytname[yychar1]);
929 /* Give the individual parser a way to print the precise
930 meaning of a token, for further debugging info. */
931 # ifdef YYPRINT
932 YYPRINT (stderr, yychar, yylval);
933 # endif
934 YYFPRINTF (stderr, ")\n");
935 }
936 #endif
937 }
938
939 yyn += yychar1;
940 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
941 goto yydefault;
942
943 yyn = yytable[yyn];
944
945 /* yyn is what to do for this token type in this state.
946 Negative => reduce, -yyn is rule number.
947 Positive => shift, yyn is new state.
948 New state is final state => don't bother to shift,
949 just return success.
950 0, or most negative number => error. */
951
952 if (yyn < 0)
953 {
954 if (yyn == YYFLAG)
955 goto yyerrlab;
956 yyn = -yyn;
957 goto yyreduce;
958 }
959 else if (yyn == 0)
960 goto yyerrlab;
961
962 if (yyn == YYFINAL)
963 YYACCEPT;
964
965 /* Shift the lookahead token. */
966 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
967 yychar, yytname[yychar1]));
968
969 /* Discard the token being shifted unless it is eof. */
970 if (yychar != YYEOF)
971 yychar = YYEMPTY;
972
973 *++yyvsp = yylval;
974 #if YYLSP_NEEDED
975 *++yylsp = yylloc;
976 #endif
977
978 /* Count tokens shifted since error; after three, turn off error
979 status. */
980 if (yyerrstatus)
981 yyerrstatus--;
982
983 yystate = yyn;
984 goto yynewstate;
985
986
987 /*-----------------------------------------------------------.
988 | yydefault -- do the default action for the current state. |
989 `-----------------------------------------------------------*/
990 yydefault:
991 yyn = yydefact[yystate];
992 if (yyn == 0)
993 goto yyerrlab;
994 goto yyreduce;
995
996
997 /*-----------------------------.
998 | yyreduce -- Do a reduction. |
999 `-----------------------------*/
1000 yyreduce:
1001 /* yyn is the number of a rule to reduce with. */
1002 yylen = yyr2[yyn];
1003
1004 /* If YYLEN is nonzero, implement the default value of the action:
1005 `$$ = $1'.
1006
1007 Otherwise, the following line sets YYVAL to the semantic value of
1008 the lookahead token. This behavior is undocumented and Bison
1009 users should not rely upon it. Assigning to YYVAL
1010 unconditionally makes the parser a bit smaller, and it avoids a
1011 GCC warning that YYVAL may be used uninitialized. */
1012 yyval = yyvsp[1-yylen];
1013
1014 #if YYLSP_NEEDED
1015 /* Similarly for the default location. Let the user run additional
1016 commands if for instance locations are ranges. */
1017 yyloc = yylsp[1-yylen];
1018 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1019 #endif
1020
1021 #if YYDEBUG
1022 /* We have to keep this `#if YYDEBUG', since we use variables which
1023 are defined only if `YYDEBUG' is set. */
1024 if (yydebug)
1025 {
1026 int yyi;
1027
1028 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1029 yyn, yyrline[yyn]);
1030
1031 /* Print the symbols being reduced, and their result. */
1032 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
1033 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1034 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1035 }
1036 #endif
1037
1038 switch (yyn) {
1039
1040 case 10:
1041 #line 126 "bindparser.yy"
1042 {
1043 s_di.name=yyvsp[-1];
1044 parent->commit(s_di);
1045 s_di.clear();
1046 }
1047 break;
1048 case 11:
1049 #line 133 "bindparser.yy"
1050 {
1051 s_di.name=yyvsp[-2];
1052 parent->commit(s_di);
1053 s_di.clear();
1054 }
1055 break;
1056 case 24:
1057 #line 172 "bindparser.yy"
1058 {
1059 parent->setDirectory(yyvsp[0]);
1060 }
1061 break;
1062 case 41:
1063 #line 210 "bindparser.yy"
1064 {
1065 s_di.master=yyvsp[0];
1066 }
1067 break;
1068 case 42:
1069 #line 217 "bindparser.yy"
1070 {
1071 // printf("Found a filename: '%s'\n",$2);
1072 s_di.filename=yyvsp[0];
1073 }
1074 break;
1075 case 43:
1076 #line 225 "bindparser.yy"
1077 {
1078 // printf("Found a filename: '%s'\n",$2);
1079 // ztype=$2;
1080 }
1081 break;
1082 case 44:
1083 #line 234 "bindparser.yy"
1084 {
1085 yyval=yyvsp[0];
1086 }
1087 break;
1088 }
1089
1090 #line 705 "/usr/share/bison/bison.simple"
1091
1092 \f
1093 yyvsp -= yylen;
1094 yyssp -= yylen;
1095 #if YYLSP_NEEDED
1096 yylsp -= yylen;
1097 #endif
1098
1099 #if YYDEBUG
1100 if (yydebug)
1101 {
1102 short *yyssp1 = yyss - 1;
1103 YYFPRINTF (stderr, "state stack now");
1104 while (yyssp1 != yyssp)
1105 YYFPRINTF (stderr, " %d", *++yyssp1);
1106 YYFPRINTF (stderr, "\n");
1107 }
1108 #endif
1109
1110 *++yyvsp = yyval;
1111 #if YYLSP_NEEDED
1112 *++yylsp = yyloc;
1113 #endif
1114
1115 /* Now `shift' the result of the reduction. Determine what state
1116 that goes to, based on the state we popped back to and the rule
1117 number reduced by. */
1118
1119 yyn = yyr1[yyn];
1120
1121 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1122 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1123 yystate = yytable[yystate];
1124 else
1125 yystate = yydefgoto[yyn - YYNTBASE];
1126
1127 goto yynewstate;
1128
1129
1130 /*------------------------------------.
1131 | yyerrlab -- here on detecting error |
1132 `------------------------------------*/
1133 yyerrlab:
1134 /* If not already recovering from an error, report this error. */
1135 if (!yyerrstatus)
1136 {
1137 ++yynerrs;
1138
1139 #ifdef YYERROR_VERBOSE
1140 yyn = yypact[yystate];
1141
1142 if (yyn > YYFLAG && yyn < YYLAST)
1143 {
1144 YYSIZE_T yysize = 0;
1145 char *yymsg;
1146 int yyx, yycount;
1147
1148 yycount = 0;
1149 /* Start YYX at -YYN if negative to avoid negative indexes in
1150 YYCHECK. */
1151 for (yyx = yyn < 0 ? -yyn : 0;
1152 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1153 if (yycheck[yyx + yyn] == yyx)
1154 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1155 yysize += yystrlen ("parse error, unexpected ") + 1;
1156 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1157 yymsg = (char *) YYSTACK_ALLOC (yysize);
1158 if (yymsg != 0)
1159 {
1160 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1161 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1162
1163 if (yycount < 5)
1164 {
1165 yycount = 0;
1166 for (yyx = yyn < 0 ? -yyn : 0;
1167 yyx < (int) (sizeof (yytname) / sizeof (char *));
1168 yyx++)
1169 if (yycheck[yyx + yyn] == yyx)
1170 {
1171 const char *yyq = ! yycount ? ", expecting " : " or ";
1172 yyp = yystpcpy (yyp, yyq);
1173 yyp = yystpcpy (yyp, yytname[yyx]);
1174 yycount++;
1175 }
1176 }
1177 yyerror (yymsg);
1178 YYSTACK_FREE (yymsg);
1179 }
1180 else
1181 yyerror ("parse error; also virtual memory exhausted");
1182 }
1183 else
1184 #endif /* defined (YYERROR_VERBOSE) */
1185 yyerror ("parse error");
1186 }
1187 goto yyerrlab1;
1188
1189
1190 /*--------------------------------------------------.
1191 | yyerrlab1 -- error raised explicitly by an action |
1192 `--------------------------------------------------*/
1193 yyerrlab1:
1194 if (yyerrstatus == 3)
1195 {
1196 /* If just tried and failed to reuse lookahead token after an
1197 error, discard it. */
1198
1199 /* return failure if at end of input */
1200 if (yychar == YYEOF)
1201 YYABORT;
1202 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1203 yychar, yytname[yychar1]));
1204 yychar = YYEMPTY;
1205 }
1206
1207 /* Else will try to reuse lookahead token after shifting the error
1208 token. */
1209
1210 yyerrstatus = 3; /* Each real token shifted decrements this */
1211
1212 goto yyerrhandle;
1213
1214
1215 /*-------------------------------------------------------------------.
1216 | yyerrdefault -- current state does not do anything special for the |
1217 | error token. |
1218 `-------------------------------------------------------------------*/
1219 yyerrdefault:
1220 #if 0
1221 /* This is wrong; only states that explicitly want error tokens
1222 should shift them. */
1223
1224 /* If its default is to accept any token, ok. Otherwise pop it. */
1225 yyn = yydefact[yystate];
1226 if (yyn)
1227 goto yydefault;
1228 #endif
1229
1230
1231 /*---------------------------------------------------------------.
1232 | yyerrpop -- pop the current state because it cannot handle the |
1233 | error token |
1234 `---------------------------------------------------------------*/
1235 yyerrpop:
1236 if (yyssp == yyss)
1237 YYABORT;
1238 yyvsp--;
1239 yystate = *--yyssp;
1240 #if YYLSP_NEEDED
1241 yylsp--;
1242 #endif
1243
1244 #if YYDEBUG
1245 if (yydebug)
1246 {
1247 short *yyssp1 = yyss - 1;
1248 YYFPRINTF (stderr, "Error: state stack now");
1249 while (yyssp1 != yyssp)
1250 YYFPRINTF (stderr, " %d", *++yyssp1);
1251 YYFPRINTF (stderr, "\n");
1252 }
1253 #endif
1254
1255 /*--------------.
1256 | yyerrhandle. |
1257 `--------------*/
1258 yyerrhandle:
1259 yyn = yypact[yystate];
1260 if (yyn == YYFLAG)
1261 goto yyerrdefault;
1262
1263 yyn += YYTERROR;
1264 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1265 goto yyerrdefault;
1266
1267 yyn = yytable[yyn];
1268 if (yyn < 0)
1269 {
1270 if (yyn == YYFLAG)
1271 goto yyerrpop;
1272 yyn = -yyn;
1273 goto yyreduce;
1274 }
1275 else if (yyn == 0)
1276 goto yyerrpop;
1277
1278 if (yyn == YYFINAL)
1279 YYACCEPT;
1280
1281 YYDPRINTF ((stderr, "Shifting error token, "));
1282
1283 *++yyvsp = yylval;
1284 #if YYLSP_NEEDED
1285 *++yylsp = yylloc;
1286 #endif
1287
1288 yystate = yyn;
1289 goto yynewstate;
1290
1291
1292 /*-------------------------------------.
1293 | yyacceptlab -- YYACCEPT comes here. |
1294 `-------------------------------------*/
1295 yyacceptlab:
1296 yyresult = 0;
1297 goto yyreturn;
1298
1299 /*-----------------------------------.
1300 | yyabortlab -- YYABORT comes here. |
1301 `-----------------------------------*/
1302 yyabortlab:
1303 yyresult = 1;
1304 goto yyreturn;
1305
1306 /*---------------------------------------------.
1307 | yyoverflowab -- parser overflow comes here. |
1308 `---------------------------------------------*/
1309 yyoverflowlab:
1310 yyerror ("parser stack overflow");
1311 yyresult = 2;
1312 /* Fall through. */
1313
1314 yyreturn:
1315 #ifndef yyoverflow
1316 if (yyss != yyssa)
1317 YYSTACK_FREE (yyss);
1318 #endif
1319 return yyresult;
1320 }
1321 #line 240 "bindparser.yy"