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

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

merged z39.50 receptionist stuff into main trunk (along with the mgpp stuff)

  • Property svn:keywords set to Author Date Id Revision
File size: 30.9 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 */
72extern struct z3950cfg *zservers_cfg_file;
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, 108, 111, 112, 117,
160 118, 121, 122, 125, 126, 127, 132, 134, 135, 137,
161 139, 142, 153, 175, 183, 191, 193, 194, 196, 197
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");exit(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 fprintf(stderr,"malloc failed\n");
803 yyval.cfg->shortname=yyvsp[-7].string;
804 yyval.cfg->hostname=yyvsp[-6].string;
805 yyval.cfg->port=yyvsp[-5].number;
806 yyval.cfg->dbname=yyvsp[-4].string;
807 yyval.cfg->longname=yyvsp[-3].string;
808 yyval.cfg->icon=yyvsp[-2].string;
809 yyval.cfg->smallicon=yyvsp[-1].string;
810 yyval.cfg->about=yyvsp[0].about;
811 }
812 ;
813 break;}
814case 7:
815#line 108 "zparse.y"
816{yyval.cfg=NULL;printf("discarding zserver\n");;
817 break;}
818case 8:
819#line 111 "zparse.y"
820{;;
821 break;}
822case 9:
823#line 112 "zparse.y"
824{errormsg("Database name needs to be followed by a short "
825 "descriptive name (enclosed in \" marks)");
826 yyval.string=NULL;
827 YYRECOVERING=1;;
828 break;}
829case 10:
830#line 117 "zparse.y"
831{yyval.number=atoi(yyvsp[0].string);;
832 break;}
833case 11:
834#line 118 "zparse.y"
835{yyval.number=210;;
836 break;}
837case 12:
838#line 121 "zparse.y"
839{yyval.string=yyvsp[0].string;;
840 break;}
841case 13:
842#line 122 "zparse.y"
843{yyval.string=yyvsp[0].string;
844 errormsg("Icon must be enclosed in quotes");
845 yylex();yylex();;
846 break;}
847case 14:
848#line 125 "zparse.y"
849{yyval.string=NULL;;
850 break;}
851case 15:
852#line 126 "zparse.y"
853{yyval.string=yyvsp[0].string;;
854 break;}
855case 16:
856#line 127 "zparse.y"
857{yyval.string=yyvsp[0].string;
858 /* this is because of the ':' */
859 errormsg("Smallicon must be enclosed in quotes.\n");
860 yylex();yylex();
861 ;
862 break;}
863case 17:
864#line 132 "zparse.y"
865{yyval.string=NULL;;
866 break;}
867case 18:
868#line 134 "zparse.y"
869{defLanguage=0;;
870 break;}
871case 19:
872#line 135 "zparse.y"
873{yyval.about=NULL;;
874 break;}
875case 20:
876#line 137 "zparse.y"
877{;;
878 break;}
879case 21:
880#line 139 "zparse.y"
881{yyval.about=yyvsp[0].about;yyvsp[0].about->next=yyvsp[-1].about;;
882 break;}
883case 22:
884#line 143 "zparse.y"
885{
886 if((yyval.about=malloc(sizeof(struct z3950aboutlist)))
887 ==NULL) {
888 fprintf(stderr,"Malloc failed\n");
889 exit(1);
890 }
891 yyval.about->lang=yyvsp[-1].string;
892 yyval.about->text=yyvsp[0].string;
893 yyval.about->next=NULL;
894 ;
895 break;}
896case 23:
897#line 154 "zparse.y"
898{
899 if (defLanguage)
900 {
901 fprintf(stderr,"warning: (line %d): already have a default language in config file\n",lineno);
902 }
903 else defLanguage=1;
904
905 if((yyval.about=malloc(sizeof(struct z3950aboutlist)))
906 ==NULL) {
907 fprintf(stderr,"Malloc failed\n");
908 exit(1);
909 }
910 yyval.about->lang=NULL; /* default lang... */
911 yyval.about->text=yyvsp[0].string;
912 yyval.about->next=NULL;
913 ;
914 break;}
915case 24:
916#line 176 "zparse.y"
917{
918 yyval.string=malloc(strlen(yyvsp[-2].string)+strlen(yyvsp[0].string)+1);
919 strncpy(yyval.string,yyvsp[-2].string,strlen(yyvsp[-2].string));
920 yyval.string[strlen(yyvsp[-2].string)]='_';
921 strncpy(yyval.string+strlen(yyvsp[-2].string)+1,yyvsp[0].string,strlen(yyvsp[0].string));
922 free(yyvsp[-2].string);free(yyvsp[0].string);
923 ;
924 break;}
925case 25:
926#line 183 "zparse.y"
927{;;
928 break;}
929case 26:
930#line 191 "zparse.y"
931{errormsg("missing language");;
932 break;}
933case 27:
934#line 193 "zparse.y"
935{;;
936 break;}
937case 28:
938#line 194 "zparse.y"
939{;;
940 break;}
941case 29:
942#line 196 "zparse.y"
943{;;
944 break;}
945case 30:
946#line 197 "zparse.y"
947{;;
948 break;}
949}
950 /* the action file gets copied in in place of this dollarsign */
951#line 542 "/usr/share/bison.simple"
952
953
954 yyvsp -= yylen;
955 yyssp -= yylen;
956#ifdef YYLSP_NEEDED
957 yylsp -= yylen;
958#endif
959
960#if YYDEBUG != 0
961 if (yydebug)
962 {
963 short *ssp1 = yyss - 1;
964 fprintf (stderr, "state stack now");
965 while (ssp1 != yyssp)
966 fprintf (stderr, " %d", *++ssp1);
967 fprintf (stderr, "\n");
968 }
969#endif
970
971 *++yyvsp = yyval;
972
973#ifdef YYLSP_NEEDED
974 yylsp++;
975 if (yylen == 0)
976 {
977 yylsp->first_line = yylloc.first_line;
978 yylsp->first_column = yylloc.first_column;
979 yylsp->last_line = (yylsp-1)->last_line;
980 yylsp->last_column = (yylsp-1)->last_column;
981 yylsp->text = 0;
982 }
983 else
984 {
985 yylsp->last_line = (yylsp+yylen-1)->last_line;
986 yylsp->last_column = (yylsp+yylen-1)->last_column;
987 }
988#endif
989
990 /* Now "shift" the result of the reduction.
991 Determine what state that goes to,
992 based on the state we popped back to
993 and the rule number reduced by. */
994
995 yyn = yyr1[yyn];
996
997 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
998 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
999 yystate = yytable[yystate];
1000 else
1001 yystate = yydefgoto[yyn - YYNTBASE];
1002
1003 goto yynewstate;
1004
1005yyerrlab: /* here on detecting error */
1006
1007 if (! yyerrstatus)
1008 /* If not already recovering from an error, report this error. */
1009 {
1010 ++yynerrs;
1011
1012#ifdef YYERROR_VERBOSE
1013 yyn = yypact[yystate];
1014
1015 if (yyn > YYFLAG && yyn < YYLAST)
1016 {
1017 int size = 0;
1018 char *msg;
1019 int x, count;
1020
1021 count = 0;
1022 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1023 for (x = (yyn < 0 ? -yyn : 0);
1024 x < (sizeof(yytname) / sizeof(char *)); x++)
1025 if (yycheck[x + yyn] == x)
1026 size += strlen(yytname[x]) + 15, count++;
1027 msg = (char *) malloc(size + 15);
1028 if (msg != 0)
1029 {
1030 strcpy(msg, "parse error");
1031
1032 if (count < 5)
1033 {
1034 count = 0;
1035 for (x = (yyn < 0 ? -yyn : 0);
1036 x < (sizeof(yytname) / sizeof(char *)); x++)
1037 if (yycheck[x + yyn] == x)
1038 {
1039 strcat(msg, count == 0 ? ", expecting `" : " or `");
1040 strcat(msg, yytname[x]);
1041 strcat(msg, "'");
1042 count++;
1043 }
1044 }
1045 yyerror(msg);
1046 free(msg);
1047 }
1048 else
1049 yyerror ("parse error; also virtual memory exceeded");
1050 }
1051 else
1052#endif /* YYERROR_VERBOSE */
1053 yyerror("parse error");
1054 }
1055
1056 goto yyerrlab1;
1057yyerrlab1: /* here on error raised explicitly by an action */
1058
1059 if (yyerrstatus == 3)
1060 {
1061 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1062
1063 /* return failure if at end of input */
1064 if (yychar == YYEOF)
1065 YYABORT;
1066
1067#if YYDEBUG != 0
1068 if (yydebug)
1069 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1070#endif
1071
1072 yychar = YYEMPTY;
1073 }
1074
1075 /* Else will try to reuse lookahead token
1076 after shifting the error token. */
1077
1078 yyerrstatus = 3; /* Each real token shifted decrements this */
1079
1080 goto yyerrhandle;
1081
1082yyerrdefault: /* current state does not do anything special for the error token. */
1083
1084#if 0
1085 /* This is wrong; only states that explicitly want error tokens
1086 should shift them. */
1087 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1088 if (yyn) goto yydefault;
1089#endif
1090
1091yyerrpop: /* pop the current state because it cannot handle the error token */
1092
1093 if (yyssp == yyss) YYABORT;
1094 yyvsp--;
1095 yystate = *--yyssp;
1096#ifdef YYLSP_NEEDED
1097 yylsp--;
1098#endif
1099
1100#if YYDEBUG != 0
1101 if (yydebug)
1102 {
1103 short *ssp1 = yyss - 1;
1104 fprintf (stderr, "Error: state stack now");
1105 while (ssp1 != yyssp)
1106 fprintf (stderr, " %d", *++ssp1);
1107 fprintf (stderr, "\n");
1108 }
1109#endif
1110
1111yyerrhandle:
1112
1113 yyn = yypact[yystate];
1114 if (yyn == YYFLAG)
1115 goto yyerrdefault;
1116
1117 yyn += YYTERROR;
1118 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1119 goto yyerrdefault;
1120
1121 yyn = yytable[yyn];
1122 if (yyn < 0)
1123 {
1124 if (yyn == YYFLAG)
1125 goto yyerrpop;
1126 yyn = -yyn;
1127 goto yyreduce;
1128 }
1129 else if (yyn == 0)
1130 goto yyerrpop;
1131
1132 if (yyn == YYFINAL)
1133 YYACCEPT;
1134
1135#if YYDEBUG != 0
1136 if (yydebug)
1137 fprintf(stderr, "Shifting error token, ");
1138#endif
1139
1140 *++yyvsp = yylval;
1141#ifdef YYLSP_NEEDED
1142 *++yylsp = yylloc;
1143#endif
1144
1145 yystate = yyn;
1146 goto yynewstate;
1147
1148 yyacceptlab:
1149 /* YYACCEPT comes here. */
1150 if (yyfree_stacks)
1151 {
1152 free (yyss);
1153 free (yyvs);
1154#ifdef YYLSP_NEEDED
1155 free (yyls);
1156#endif
1157 }
1158 return 0;
1159
1160 yyabortlab:
1161 /* YYABORT comes here. */
1162 if (yyfree_stacks)
1163 {
1164 free (yyss);
1165 free (yyvs);
1166#ifdef YYLSP_NEEDED
1167 free (yyls);
1168#endif
1169 }
1170 return 1;
1171}
1172#line 200 "zparse.y"
1173
1174/*int strncasecmp (const char *, const char *,size_t);*/
1175int yyerror(char *string) {
1176 fprintf(stderr,"Parse error (line %d) near \n\"%s\"<---:%s\n",lineno,
1177 yylval.string,string);
1178 return(1);
1179}
1180
1181void errormsg(char *str) {
1182 fprintf(stderr,"Err (line %d, near \"%s\"): %s.\n",lineno,
1183 yylval.string,str);
1184}
1185
1186/* *
1187int main (int argc, char *argv[]) {
1188 if (argc==2)
1189 if (argv[1][0]=='-'&&argv[1][1]=='d')
1190 yydebug=1;
1191
1192 yyparse();
1193 return(0);
1194}
1195* */
Note: See TracBrowser for help on using the repository browser.