source: trunk/gsdl/src/recpt/zparse.tab.c@ 1372

Last change on this file since 1372 was 1372, checked in by jrm21, 24 years ago

Moved definition of FILE *errfile from z3950proto.cpp to zparse.y for
portability reasons. (linking C++ to C)

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