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

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

Errors from parsing the z39.50 config file go to file (etc/recpt/z3950log.txt)
instead of stderr (which might screw up the cgi headers or html).

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