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