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

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

Fixed up parsing of z39.50 config file, so that errors go to file instead
of stderr, which screws up the cgi headers and page...
Errors goes to etc/recpt/z3950err.txt

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