err_syntax11.tab.c revision 1.1 1 1.1 christos /* $NetBSD: err_syntax11.tab.c,v 1.1 2015/01/03 22:58:25 christos Exp $ */
2 1.1 christos
3 1.1 christos /* original parser id follows */
4 1.1 christos /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
5 1.1 christos /* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */
6 1.1 christos
7 1.1 christos #define YYBYACC 1
8 1.1 christos #define YYMAJOR 1
9 1.1 christos #define YYMINOR 9
10 1.1 christos #define YYCHECK "yyyymmdd"
11 1.1 christos
12 1.1 christos #define YYEMPTY (-1)
13 1.1 christos #define yyclearin (yychar = YYEMPTY)
14 1.1 christos #define yyerrok (yyerrflag = 0)
15 1.1 christos #define YYRECOVERING() (yyerrflag != 0)
16 1.1 christos #define YYENOMEM (-2)
17 1.1 christos #define YYEOF 0
18 1.1 christos #undef YYBTYACC
19 1.1 christos #define YYBTYACC 0
20 1.1 christos #define YYDEBUGSTR YYPREFIX "debug"
21 1.1 christos
22 1.1 christos #ifndef yyparse
23 1.1 christos #define yyparse err_syntax11_parse
24 1.1 christos #endif /* yyparse */
25 1.1 christos
26 1.1 christos #ifndef yylex
27 1.1 christos #define yylex err_syntax11_lex
28 1.1 christos #endif /* yylex */
29 1.1 christos
30 1.1 christos #ifndef yyerror
31 1.1 christos #define yyerror err_syntax11_error
32 1.1 christos #endif /* yyerror */
33 1.1 christos
34 1.1 christos #ifndef yychar
35 1.1 christos #define yychar err_syntax11_char
36 1.1 christos #endif /* yychar */
37 1.1 christos
38 1.1 christos #ifndef yyval
39 1.1 christos #define yyval err_syntax11_val
40 1.1 christos #endif /* yyval */
41 1.1 christos
42 1.1 christos #ifndef yylval
43 1.1 christos #define yylval err_syntax11_lval
44 1.1 christos #endif /* yylval */
45 1.1 christos
46 1.1 christos #ifndef yydebug
47 1.1 christos #define yydebug err_syntax11_debug
48 1.1 christos #endif /* yydebug */
49 1.1 christos
50 1.1 christos #ifndef yynerrs
51 1.1 christos #define yynerrs err_syntax11_nerrs
52 1.1 christos #endif /* yynerrs */
53 1.1 christos
54 1.1 christos #ifndef yyerrflag
55 1.1 christos #define yyerrflag err_syntax11_errflag
56 1.1 christos #endif /* yyerrflag */
57 1.1 christos
58 1.1 christos #ifndef yylhs
59 1.1 christos #define yylhs err_syntax11_lhs
60 1.1 christos #endif /* yylhs */
61 1.1 christos
62 1.1 christos #ifndef yylen
63 1.1 christos #define yylen err_syntax11_len
64 1.1 christos #endif /* yylen */
65 1.1 christos
66 1.1 christos #ifndef yydefred
67 1.1 christos #define yydefred err_syntax11_defred
68 1.1 christos #endif /* yydefred */
69 1.1 christos
70 1.1 christos #ifndef yystos
71 1.1 christos #define yystos err_syntax11_stos
72 1.1 christos #endif /* yystos */
73 1.1 christos
74 1.1 christos #ifndef yydgoto
75 1.1 christos #define yydgoto err_syntax11_dgoto
76 1.1 christos #endif /* yydgoto */
77 1.1 christos
78 1.1 christos #ifndef yysindex
79 1.1 christos #define yysindex err_syntax11_sindex
80 1.1 christos #endif /* yysindex */
81 1.1 christos
82 1.1 christos #ifndef yyrindex
83 1.1 christos #define yyrindex err_syntax11_rindex
84 1.1 christos #endif /* yyrindex */
85 1.1 christos
86 1.1 christos #ifndef yygindex
87 1.1 christos #define yygindex err_syntax11_gindex
88 1.1 christos #endif /* yygindex */
89 1.1 christos
90 1.1 christos #ifndef yytable
91 1.1 christos #define yytable err_syntax11_table
92 1.1 christos #endif /* yytable */
93 1.1 christos
94 1.1 christos #ifndef yycheck
95 1.1 christos #define yycheck err_syntax11_check
96 1.1 christos #endif /* yycheck */
97 1.1 christos
98 1.1 christos #ifndef yyname
99 1.1 christos #define yyname err_syntax11_name
100 1.1 christos #endif /* yyname */
101 1.1 christos
102 1.1 christos #ifndef yyrule
103 1.1 christos #define yyrule err_syntax11_rule
104 1.1 christos #endif /* yyrule */
105 1.1 christos
106 1.1 christos #if YYBTYACC
107 1.1 christos
108 1.1 christos #ifndef yycindex
109 1.1 christos #define yycindex err_syntax11_cindex
110 1.1 christos #endif /* yycindex */
111 1.1 christos
112 1.1 christos #ifndef yyctable
113 1.1 christos #define yyctable err_syntax11_ctable
114 1.1 christos #endif /* yyctable */
115 1.1 christos
116 1.1 christos #endif /* YYBTYACC */
117 1.1 christos
118 1.1 christos #define YYPREFIX "err_syntax11_"
119 1.1 christos
120 1.1 christos #define YYPURE 0
121 1.1 christos
122 1.1 christos #line 2 "err_syntax11.y"
123 1.1 christos int yylex(void);
124 1.1 christos static void yyerror(const char *);
125 1.1 christos #line 124 "err_syntax11.tab.c"
126 1.1 christos
127 1.1 christos #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
128 1.1 christos /* Default: YYSTYPE is the semantic value type. */
129 1.1 christos typedef int YYSTYPE;
130 1.1 christos # define YYSTYPE_IS_DECLARED 1
131 1.1 christos #endif
132 1.1 christos
133 1.1 christos /* compatibility with bison */
134 1.1 christos #ifdef YYPARSE_PARAM
135 1.1 christos /* compatibility with FreeBSD */
136 1.1 christos # ifdef YYPARSE_PARAM_TYPE
137 1.1 christos # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
138 1.1 christos # else
139 1.1 christos # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
140 1.1 christos # endif
141 1.1 christos #else
142 1.1 christos # define YYPARSE_DECL() yyparse(void)
143 1.1 christos #endif
144 1.1 christos
145 1.1 christos /* Parameters sent to lex. */
146 1.1 christos #ifdef YYLEX_PARAM
147 1.1 christos # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
148 1.1 christos # define YYLEX yylex(YYLEX_PARAM)
149 1.1 christos #else
150 1.1 christos # define YYLEX_DECL() yylex(void)
151 1.1 christos # define YYLEX yylex()
152 1.1 christos #endif
153 1.1 christos
154 1.1 christos /* Parameters sent to yyerror. */
155 1.1 christos #ifndef YYERROR_DECL
156 1.1 christos #define YYERROR_DECL() yyerror(const char *s)
157 1.1 christos #endif
158 1.1 christos #ifndef YYERROR_CALL
159 1.1 christos #define YYERROR_CALL(msg) yyerror(msg)
160 1.1 christos #endif
161 1.1 christos
162 1.1 christos extern int YYPARSE_DECL();
163 1.1 christos
164 1.1 christos #define YYERRCODE 256
165 1.1 christos typedef short YYINT;
166 1.1 christos static const YYINT err_syntax11_lhs[] = { -1,
167 1.1 christos 0,
168 1.1 christos };
169 1.1 christos static const YYINT err_syntax11_len[] = { 2,
170 1.1 christos 1,
171 1.1 christos };
172 1.1 christos static const YYINT err_syntax11_defred[] = { 0,
173 1.1 christos 1, 0,
174 1.1 christos };
175 1.1 christos static const YYINT err_syntax11_stos[] = { 0,
176 1.1 christos 256, 258,
177 1.1 christos };
178 1.1 christos static const YYINT err_syntax11_dgoto[] = { 2,
179 1.1 christos };
180 1.1 christos static const YYINT err_syntax11_sindex[] = { -256,
181 1.1 christos 0, 0,
182 1.1 christos };
183 1.1 christos static const YYINT err_syntax11_rindex[] = { 0,
184 1.1 christos 0, 0,
185 1.1 christos };
186 1.1 christos #if YYBTYACC
187 1.1 christos static const YYINT err_syntax11_cindex[] = { 0,
188 1.1 christos 0, 0,
189 1.1 christos };
190 1.1 christos #endif
191 1.1 christos static const YYINT err_syntax11_gindex[] = { 0,
192 1.1 christos };
193 1.1 christos #define YYTABLESIZE 0
194 1.1 christos static const YYINT err_syntax11_table[] = { 1,
195 1.1 christos };
196 1.1 christos static const YYINT err_syntax11_check[] = { 256,
197 1.1 christos };
198 1.1 christos #if YYBTYACC
199 1.1 christos static const YYINT err_syntax11_ctable[] = { -1,
200 1.1 christos };
201 1.1 christos #endif
202 1.1 christos #define YYFINAL 2
203 1.1 christos #ifndef YYDEBUG
204 1.1 christos #define YYDEBUG 0
205 1.1 christos #endif
206 1.1 christos #define YYMAXTOKEN 256
207 1.1 christos #define YYUNDFTOKEN 259
208 1.1 christos #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
209 1.1 christos #if YYDEBUG
210 1.1 christos static const char *const err_syntax11_name[] = {
211 1.1 christos
212 1.1 christos "$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
213 1.1 christos 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
214 1.1 christos 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
215 1.1 christos 0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
216 1.1 christos 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
217 1.1 christos 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
218 1.1 christos 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S",
219 1.1 christos "illegal-symbol",
220 1.1 christos };
221 1.1 christos static const char *const err_syntax11_rule[] = {
222 1.1 christos "$accept : S",
223 1.1 christos "S : error",
224 1.1 christos
225 1.1 christos };
226 1.1 christos #endif
227 1.1 christos
228 1.1 christos int yydebug;
229 1.1 christos int yynerrs;
230 1.1 christos
231 1.1 christos int yyerrflag;
232 1.1 christos int yychar;
233 1.1 christos YYSTYPE yyval;
234 1.1 christos YYSTYPE yylval;
235 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
236 1.1 christos YYLTYPE yyloc; /* position returned by actions */
237 1.1 christos YYLTYPE yylloc; /* position from the lexer */
238 1.1 christos #endif
239 1.1 christos
240 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
241 1.1 christos #ifndef YYLLOC_DEFAULT
242 1.1 christos #define YYLLOC_DEFAULT(loc, rhs, n) \
243 1.1 christos do \
244 1.1 christos { \
245 1.1 christos if (n == 0) \
246 1.1 christos { \
247 1.1 christos (loc).first_line = ((rhs)[-1]).last_line; \
248 1.1 christos (loc).first_column = ((rhs)[-1]).last_column; \
249 1.1 christos (loc).last_line = ((rhs)[-1]).last_line; \
250 1.1 christos (loc).last_column = ((rhs)[-1]).last_column; \
251 1.1 christos } \
252 1.1 christos else \
253 1.1 christos { \
254 1.1 christos (loc).first_line = ((rhs)[ 0 ]).first_line; \
255 1.1 christos (loc).first_column = ((rhs)[ 0 ]).first_column; \
256 1.1 christos (loc).last_line = ((rhs)[n-1]).last_line; \
257 1.1 christos (loc).last_column = ((rhs)[n-1]).last_column; \
258 1.1 christos } \
259 1.1 christos } while (0)
260 1.1 christos #endif /* YYLLOC_DEFAULT */
261 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
262 1.1 christos #if YYBTYACC
263 1.1 christos
264 1.1 christos #ifndef YYLVQUEUEGROWTH
265 1.1 christos #define YYLVQUEUEGROWTH 32
266 1.1 christos #endif
267 1.1 christos #endif /* YYBTYACC */
268 1.1 christos
269 1.1 christos /* define the initial stack-sizes */
270 1.1 christos #ifdef YYSTACKSIZE
271 1.1 christos #undef YYMAXDEPTH
272 1.1 christos #define YYMAXDEPTH YYSTACKSIZE
273 1.1 christos #else
274 1.1 christos #ifdef YYMAXDEPTH
275 1.1 christos #define YYSTACKSIZE YYMAXDEPTH
276 1.1 christos #else
277 1.1 christos #define YYSTACKSIZE 10000
278 1.1 christos #define YYMAXDEPTH 10000
279 1.1 christos #endif
280 1.1 christos #endif
281 1.1 christos
282 1.1 christos #ifndef YYINITSTACKSIZE
283 1.1 christos #define YYINITSTACKSIZE 200
284 1.1 christos #endif
285 1.1 christos
286 1.1 christos typedef struct {
287 1.1 christos unsigned stacksize;
288 1.1 christos short *s_base;
289 1.1 christos short *s_mark;
290 1.1 christos short *s_last;
291 1.1 christos YYSTYPE *l_base;
292 1.1 christos YYSTYPE *l_mark;
293 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
294 1.1 christos YYLTYPE *p_base;
295 1.1 christos YYLTYPE *p_mark;
296 1.1 christos #endif
297 1.1 christos } YYSTACKDATA;
298 1.1 christos #if YYBTYACC
299 1.1 christos
300 1.1 christos struct YYParseState_s
301 1.1 christos {
302 1.1 christos struct YYParseState_s *save; /* Previously saved parser state */
303 1.1 christos YYSTACKDATA yystack; /* saved parser stack */
304 1.1 christos int state; /* saved parser state */
305 1.1 christos int errflag; /* saved error recovery status */
306 1.1 christos int lexeme; /* saved index of the conflict lexeme in the lexical queue */
307 1.1 christos YYINT ctry; /* saved index in yyctable[] for this conflict */
308 1.1 christos };
309 1.1 christos typedef struct YYParseState_s YYParseState;
310 1.1 christos #endif /* YYBTYACC */
311 1.1 christos /* variables for the parser stack */
312 1.1 christos static YYSTACKDATA yystack;
313 1.1 christos #if YYBTYACC
314 1.1 christos
315 1.1 christos /* Current parser state */
316 1.1 christos static YYParseState *yyps = 0;
317 1.1 christos
318 1.1 christos /* yypath != NULL: do the full parse, starting at *yypath parser state. */
319 1.1 christos static YYParseState *yypath = 0;
320 1.1 christos
321 1.1 christos /* Base of the lexical value queue */
322 1.1 christos static YYSTYPE *yylvals = 0;
323 1.1 christos
324 1.1 christos /* Current position at lexical value queue */
325 1.1 christos static YYSTYPE *yylvp = 0;
326 1.1 christos
327 1.1 christos /* End position of lexical value queue */
328 1.1 christos static YYSTYPE *yylve = 0;
329 1.1 christos
330 1.1 christos /* The last allocated position at the lexical value queue */
331 1.1 christos static YYSTYPE *yylvlim = 0;
332 1.1 christos
333 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
334 1.1 christos /* Base of the lexical position queue */
335 1.1 christos static YYLTYPE *yylpsns = 0;
336 1.1 christos
337 1.1 christos /* Current position at lexical position queue */
338 1.1 christos static YYLTYPE *yylpp = 0;
339 1.1 christos
340 1.1 christos /* End position of lexical position queue */
341 1.1 christos static YYLTYPE *yylpe = 0;
342 1.1 christos
343 1.1 christos /* The last allocated position at the lexical position queue */
344 1.1 christos static YYLTYPE *yylplim = 0;
345 1.1 christos #endif
346 1.1 christos
347 1.1 christos /* Current position at lexical token queue */
348 1.1 christos static short *yylexp = 0;
349 1.1 christos
350 1.1 christos static short *yylexemes = 0;
351 1.1 christos #endif /* YYBTYACC */
352 1.1 christos #line 12 "err_syntax11.y"
353 1.1 christos
354 1.1 christos #include <stdio.h>
355 1.1 christos
356 1.1 christos int
357 1.1 christos main(void)
358 1.1 christos {
359 1.1 christos printf("yyparse() = %d\n", yyparse());
360 1.1 christos return 0;
361 1.1 christos }
362 1.1 christos
363 1.1 christos int
364 1.1 christos yylex(void)
365 1.1 christos {
366 1.1 christos return -1;
367 1.1 christos }
368 1.1 christos
369 1.1 christos static void
370 1.1 christos yyerror(const char* s)
371 1.1 christos {
372 1.1 christos printf("%s\n", s);
373 1.1 christos }
374 1.1 christos #line 373 "err_syntax11.tab.c"
375 1.1 christos
376 1.1 christos /* For use in generated program */
377 1.1 christos #define yydepth (int)(yystack.s_mark - yystack.s_base)
378 1.1 christos #if YYBTYACC
379 1.1 christos #define yytrial (yyps->save)
380 1.1 christos #endif /* YYBTYACC */
381 1.1 christos
382 1.1 christos #if YYDEBUG
383 1.1 christos #include <stdio.h> /* needed for printf */
384 1.1 christos #endif
385 1.1 christos
386 1.1 christos #include <stdlib.h> /* needed for malloc, etc */
387 1.1 christos #include <string.h> /* needed for memset */
388 1.1 christos
389 1.1 christos /* allocate initial stack or double stack size, up to YYMAXDEPTH */
390 1.1 christos static int yygrowstack(YYSTACKDATA *data)
391 1.1 christos {
392 1.1 christos int i;
393 1.1 christos unsigned newsize;
394 1.1 christos short *newss;
395 1.1 christos YYSTYPE *newvs;
396 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
397 1.1 christos YYLTYPE *newps;
398 1.1 christos #endif
399 1.1 christos
400 1.1 christos if ((newsize = data->stacksize) == 0)
401 1.1 christos newsize = YYINITSTACKSIZE;
402 1.1 christos else if (newsize >= YYMAXDEPTH)
403 1.1 christos return YYENOMEM;
404 1.1 christos else if ((newsize *= 2) > YYMAXDEPTH)
405 1.1 christos newsize = YYMAXDEPTH;
406 1.1 christos
407 1.1 christos i = (int) (data->s_mark - data->s_base);
408 1.1 christos newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
409 1.1 christos if (newss == 0)
410 1.1 christos return YYENOMEM;
411 1.1 christos
412 1.1 christos data->s_base = newss;
413 1.1 christos data->s_mark = newss + i;
414 1.1 christos
415 1.1 christos newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
416 1.1 christos if (newvs == 0)
417 1.1 christos return YYENOMEM;
418 1.1 christos
419 1.1 christos data->l_base = newvs;
420 1.1 christos data->l_mark = newvs + i;
421 1.1 christos
422 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
423 1.1 christos newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
424 1.1 christos if (newps == 0)
425 1.1 christos return YYENOMEM;
426 1.1 christos
427 1.1 christos data->p_base = newps;
428 1.1 christos data->p_mark = newps + i;
429 1.1 christos #endif
430 1.1 christos
431 1.1 christos data->stacksize = newsize;
432 1.1 christos data->s_last = data->s_base + newsize - 1;
433 1.1 christos
434 1.1 christos #if YYDEBUG
435 1.1 christos if (yydebug)
436 1.1 christos fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
437 1.1 christos #endif
438 1.1 christos return 0;
439 1.1 christos }
440 1.1 christos
441 1.1 christos #if YYPURE || defined(YY_NO_LEAKS)
442 1.1 christos static void yyfreestack(YYSTACKDATA *data)
443 1.1 christos {
444 1.1 christos free(data->s_base);
445 1.1 christos free(data->l_base);
446 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
447 1.1 christos free(data->p_base);
448 1.1 christos #endif
449 1.1 christos memset(data, 0, sizeof(*data));
450 1.1 christos }
451 1.1 christos #else
452 1.1 christos #define yyfreestack(data) /* nothing */
453 1.1 christos #endif /* YYPURE || defined(YY_NO_LEAKS) */
454 1.1 christos #if YYBTYACC
455 1.1 christos
456 1.1 christos static YYParseState *
457 1.1 christos yyNewState(unsigned size)
458 1.1 christos {
459 1.1 christos YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
460 1.1 christos if (p == NULL) return NULL;
461 1.1 christos
462 1.1 christos p->yystack.stacksize = size;
463 1.1 christos if (size == 0)
464 1.1 christos {
465 1.1 christos p->yystack.s_base = NULL;
466 1.1 christos p->yystack.l_base = NULL;
467 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
468 1.1 christos p->yystack.p_base = NULL;
469 1.1 christos #endif
470 1.1 christos return p;
471 1.1 christos }
472 1.1 christos p->yystack.s_base = (short *) malloc(size * sizeof(short));
473 1.1 christos if (p->yystack.s_base == NULL) return NULL;
474 1.1 christos p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
475 1.1 christos if (p->yystack.l_base == NULL) return NULL;
476 1.1 christos memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
477 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
478 1.1 christos p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
479 1.1 christos if (p->yystack.p_base == NULL) return NULL;
480 1.1 christos memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
481 1.1 christos #endif
482 1.1 christos
483 1.1 christos return p;
484 1.1 christos }
485 1.1 christos
486 1.1 christos static void
487 1.1 christos yyFreeState(YYParseState *p)
488 1.1 christos {
489 1.1 christos yyfreestack(&p->yystack);
490 1.1 christos free(p);
491 1.1 christos }
492 1.1 christos #endif /* YYBTYACC */
493 1.1 christos
494 1.1 christos #define YYABORT goto yyabort
495 1.1 christos #define YYREJECT goto yyabort
496 1.1 christos #define YYACCEPT goto yyaccept
497 1.1 christos #define YYERROR goto yyerrlab
498 1.1 christos #if YYBTYACC
499 1.1 christos #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
500 1.1 christos #define YYVALID_NESTED do { if (yyps->save && \
501 1.1 christos yyps->save->save == 0) goto yyvalid; } while(0)
502 1.1 christos #endif /* YYBTYACC */
503 1.1 christos
504 1.1 christos int
505 1.1 christos YYPARSE_DECL()
506 1.1 christos {
507 1.1 christos int yym, yyn, yystate, yyresult;
508 1.1 christos #if YYBTYACC
509 1.1 christos int yynewerrflag;
510 1.1 christos YYParseState *yyerrctx = NULL;
511 1.1 christos #endif /* YYBTYACC */
512 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
513 1.1 christos YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
514 1.1 christos #endif
515 1.1 christos #if YYDEBUG
516 1.1 christos const char *yys;
517 1.1 christos
518 1.1 christos if ((yys = getenv("YYDEBUG")) != 0)
519 1.1 christos {
520 1.1 christos yyn = *yys;
521 1.1 christos if (yyn >= '0' && yyn <= '9')
522 1.1 christos yydebug = yyn - '0';
523 1.1 christos }
524 1.1 christos if (yydebug)
525 1.1 christos fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
526 1.1 christos #endif
527 1.1 christos
528 1.1 christos #if YYBTYACC
529 1.1 christos yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
530 1.1 christos yyps->save = 0;
531 1.1 christos #endif /* YYBTYACC */
532 1.1 christos yynerrs = 0;
533 1.1 christos yyerrflag = 0;
534 1.1 christos yychar = YYEMPTY;
535 1.1 christos yystate = 0;
536 1.1 christos
537 1.1 christos #if YYPURE
538 1.1 christos memset(&yystack, 0, sizeof(yystack));
539 1.1 christos #endif
540 1.1 christos
541 1.1 christos if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
542 1.1 christos yystack.s_mark = yystack.s_base;
543 1.1 christos yystack.l_mark = yystack.l_base;
544 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
545 1.1 christos yystack.p_mark = yystack.p_base;
546 1.1 christos #endif
547 1.1 christos yystate = 0;
548 1.1 christos *yystack.s_mark = 0;
549 1.1 christos
550 1.1 christos yyloop:
551 1.1 christos if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
552 1.1 christos if (yychar < 0)
553 1.1 christos {
554 1.1 christos #if YYBTYACC
555 1.1 christos do {
556 1.1 christos if (yylvp < yylve)
557 1.1 christos {
558 1.1 christos /* we're currently re-reading tokens */
559 1.1 christos yylval = *yylvp++;
560 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
561 1.1 christos yylloc = *yylpp++;
562 1.1 christos #endif
563 1.1 christos yychar = *yylexp++;
564 1.1 christos break;
565 1.1 christos }
566 1.1 christos if (yyps->save)
567 1.1 christos {
568 1.1 christos /* in trial mode; save scanner results for future parse attempts */
569 1.1 christos if (yylvp == yylvlim)
570 1.1 christos { /* Enlarge lexical value queue */
571 1.1 christos size_t p = (size_t) (yylvp - yylvals);
572 1.1 christos size_t s = (size_t) (yylvlim - yylvals);
573 1.1 christos
574 1.1 christos s += YYLVQUEUEGROWTH;
575 1.1 christos if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
576 1.1 christos if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
577 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
578 1.1 christos if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
579 1.1 christos #endif
580 1.1 christos yylvp = yylve = yylvals + p;
581 1.1 christos yylvlim = yylvals + s;
582 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
583 1.1 christos yylpp = yylpe = yylpsns + p;
584 1.1 christos yylplim = yylpsns + s;
585 1.1 christos #endif
586 1.1 christos yylexp = yylexemes + p;
587 1.1 christos }
588 1.1 christos *yylexp = (short) YYLEX;
589 1.1 christos *yylvp++ = yylval;
590 1.1 christos yylve++;
591 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
592 1.1 christos *yylpp++ = yylloc;
593 1.1 christos yylpe++;
594 1.1 christos #endif
595 1.1 christos yychar = *yylexp++;
596 1.1 christos break;
597 1.1 christos }
598 1.1 christos /* normal operation, no conflict encountered */
599 1.1 christos #endif /* YYBTYACC */
600 1.1 christos yychar = YYLEX;
601 1.1 christos #if YYBTYACC
602 1.1 christos } while (0);
603 1.1 christos #endif /* YYBTYACC */
604 1.1 christos if (yychar < 0) yychar = YYEOF;
605 1.1 christos /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
606 1.1 christos #if YYDEBUG
607 1.1 christos if (yydebug)
608 1.1 christos {
609 1.1 christos yys = yyname[YYTRANSLATE(yychar)];
610 1.1 christos fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
611 1.1 christos YYDEBUGSTR, yydepth, yystate, yychar, yys);
612 1.1 christos #ifdef YYSTYPE_TOSTRING
613 1.1 christos #if YYBTYACC
614 1.1 christos if (!yytrial)
615 1.1 christos #endif /* YYBTYACC */
616 1.1 christos fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
617 1.1 christos #endif
618 1.1 christos fputc('\n', stderr);
619 1.1 christos }
620 1.1 christos #endif
621 1.1 christos }
622 1.1 christos #if YYBTYACC
623 1.1 christos
624 1.1 christos /* Do we have a conflict? */
625 1.1 christos if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
626 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
627 1.1 christos {
628 1.1 christos YYINT ctry;
629 1.1 christos
630 1.1 christos if (yypath)
631 1.1 christos {
632 1.1 christos YYParseState *save;
633 1.1 christos #if YYDEBUG
634 1.1 christos if (yydebug)
635 1.1 christos fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
636 1.1 christos YYDEBUGSTR, yydepth, yystate);
637 1.1 christos #endif
638 1.1 christos /* Switch to the next conflict context */
639 1.1 christos save = yypath;
640 1.1 christos yypath = save->save;
641 1.1 christos save->save = NULL;
642 1.1 christos ctry = save->ctry;
643 1.1 christos if (save->state != yystate) YYABORT;
644 1.1 christos yyFreeState(save);
645 1.1 christos
646 1.1 christos }
647 1.1 christos else
648 1.1 christos {
649 1.1 christos
650 1.1 christos /* Unresolved conflict - start/continue trial parse */
651 1.1 christos YYParseState *save;
652 1.1 christos #if YYDEBUG
653 1.1 christos if (yydebug)
654 1.1 christos {
655 1.1 christos fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
656 1.1 christos if (yyps->save)
657 1.1 christos fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
658 1.1 christos else
659 1.1 christos fputs("Starting trial parse.\n", stderr);
660 1.1 christos }
661 1.1 christos #endif
662 1.1 christos save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
663 1.1 christos if (save == NULL) goto yyenomem;
664 1.1 christos save->save = yyps->save;
665 1.1 christos save->state = yystate;
666 1.1 christos save->errflag = yyerrflag;
667 1.1 christos save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
668 1.1 christos memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
669 1.1 christos save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
670 1.1 christos memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
671 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
672 1.1 christos save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
673 1.1 christos memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
674 1.1 christos #endif
675 1.1 christos ctry = yytable[yyn];
676 1.1 christos if (yyctable[ctry] == -1)
677 1.1 christos {
678 1.1 christos #if YYDEBUG
679 1.1 christos if (yydebug && yychar >= YYEOF)
680 1.1 christos fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
681 1.1 christos #endif
682 1.1 christos ctry++;
683 1.1 christos }
684 1.1 christos save->ctry = ctry;
685 1.1 christos if (yyps->save == NULL)
686 1.1 christos {
687 1.1 christos /* If this is a first conflict in the stack, start saving lexemes */
688 1.1 christos if (!yylexemes)
689 1.1 christos {
690 1.1 christos yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
691 1.1 christos if (yylexemes == NULL) goto yyenomem;
692 1.1 christos yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
693 1.1 christos if (yylvals == NULL) goto yyenomem;
694 1.1 christos yylvlim = yylvals + YYLVQUEUEGROWTH;
695 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
696 1.1 christos yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
697 1.1 christos if (yylpsns == NULL) goto yyenomem;
698 1.1 christos yylplim = yylpsns + YYLVQUEUEGROWTH;
699 1.1 christos #endif
700 1.1 christos }
701 1.1 christos if (yylvp == yylve)
702 1.1 christos {
703 1.1 christos yylvp = yylve = yylvals;
704 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
705 1.1 christos yylpp = yylpe = yylpsns;
706 1.1 christos #endif
707 1.1 christos yylexp = yylexemes;
708 1.1 christos if (yychar >= YYEOF)
709 1.1 christos {
710 1.1 christos *yylve++ = yylval;
711 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
712 1.1 christos *yylpe++ = yylloc;
713 1.1 christos #endif
714 1.1 christos *yylexp = (short) yychar;
715 1.1 christos yychar = YYEMPTY;
716 1.1 christos }
717 1.1 christos }
718 1.1 christos }
719 1.1 christos if (yychar >= YYEOF)
720 1.1 christos {
721 1.1 christos yylvp--;
722 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
723 1.1 christos yylpp--;
724 1.1 christos #endif
725 1.1 christos yylexp--;
726 1.1 christos yychar = YYEMPTY;
727 1.1 christos }
728 1.1 christos save->lexeme = (int) (yylvp - yylvals);
729 1.1 christos yyps->save = save;
730 1.1 christos }
731 1.1 christos if (yytable[yyn] == ctry)
732 1.1 christos {
733 1.1 christos #if YYDEBUG
734 1.1 christos if (yydebug)
735 1.1 christos fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
736 1.1 christos YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
737 1.1 christos #endif
738 1.1 christos if (yychar < 0)
739 1.1 christos {
740 1.1 christos yylvp++;
741 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
742 1.1 christos yylpp++;
743 1.1 christos #endif
744 1.1 christos yylexp++;
745 1.1 christos }
746 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
747 1.1 christos goto yyoverflow;
748 1.1 christos yystate = yyctable[ctry];
749 1.1 christos *++yystack.s_mark = (short) yystate;
750 1.1 christos *++yystack.l_mark = yylval;
751 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
752 1.1 christos *++yystack.p_mark = yylloc;
753 1.1 christos #endif
754 1.1 christos yychar = YYEMPTY;
755 1.1 christos if (yyerrflag > 0) --yyerrflag;
756 1.1 christos goto yyloop;
757 1.1 christos }
758 1.1 christos else
759 1.1 christos {
760 1.1 christos yyn = yyctable[ctry];
761 1.1 christos goto yyreduce;
762 1.1 christos }
763 1.1 christos } /* End of code dealing with conflicts */
764 1.1 christos #endif /* YYBTYACC */
765 1.1 christos if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
766 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
767 1.1 christos {
768 1.1 christos #if YYDEBUG
769 1.1 christos if (yydebug)
770 1.1 christos fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
771 1.1 christos YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
772 1.1 christos #endif
773 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
774 1.1 christos yystate = yytable[yyn];
775 1.1 christos *++yystack.s_mark = yytable[yyn];
776 1.1 christos *++yystack.l_mark = yylval;
777 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
778 1.1 christos *++yystack.p_mark = yylloc;
779 1.1 christos #endif
780 1.1 christos yychar = YYEMPTY;
781 1.1 christos if (yyerrflag > 0) --yyerrflag;
782 1.1 christos goto yyloop;
783 1.1 christos }
784 1.1 christos if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
785 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
786 1.1 christos {
787 1.1 christos yyn = yytable[yyn];
788 1.1 christos goto yyreduce;
789 1.1 christos }
790 1.1 christos if (yyerrflag != 0) goto yyinrecovery;
791 1.1 christos #if YYBTYACC
792 1.1 christos
793 1.1 christos yynewerrflag = 1;
794 1.1 christos goto yyerrhandler;
795 1.1 christos goto yyerrlab;
796 1.1 christos
797 1.1 christos yyerrlab:
798 1.1 christos yynewerrflag = 0;
799 1.1 christos yyerrhandler:
800 1.1 christos while (yyps->save)
801 1.1 christos {
802 1.1 christos int ctry;
803 1.1 christos YYParseState *save = yyps->save;
804 1.1 christos #if YYDEBUG
805 1.1 christos if (yydebug)
806 1.1 christos fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
807 1.1 christos YYDEBUGSTR, yydepth, yystate, yyps->save->state,
808 1.1 christos (int)(yylvp - yylvals - yyps->save->lexeme));
809 1.1 christos #endif
810 1.1 christos /* Memorize most forward-looking error state in case it's really an error. */
811 1.1 christos if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
812 1.1 christos {
813 1.1 christos /* Free old saved error context state */
814 1.1 christos if (yyerrctx) yyFreeState(yyerrctx);
815 1.1 christos /* Create and fill out new saved error context state */
816 1.1 christos yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
817 1.1 christos if (yyerrctx == NULL) goto yyenomem;
818 1.1 christos yyerrctx->save = yyps->save;
819 1.1 christos yyerrctx->state = yystate;
820 1.1 christos yyerrctx->errflag = yyerrflag;
821 1.1 christos yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
822 1.1 christos memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
823 1.1 christos yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
824 1.1 christos memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
825 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
826 1.1 christos yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
827 1.1 christos memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
828 1.1 christos #endif
829 1.1 christos yyerrctx->lexeme = (int) (yylvp - yylvals);
830 1.1 christos }
831 1.1 christos yylvp = yylvals + save->lexeme;
832 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
833 1.1 christos yylpp = yylpsns + save->lexeme;
834 1.1 christos #endif
835 1.1 christos yylexp = yylexemes + save->lexeme;
836 1.1 christos yychar = YYEMPTY;
837 1.1 christos yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
838 1.1 christos memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
839 1.1 christos yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
840 1.1 christos memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
841 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
842 1.1 christos yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
843 1.1 christos memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
844 1.1 christos #endif
845 1.1 christos ctry = ++save->ctry;
846 1.1 christos yystate = save->state;
847 1.1 christos /* We tried shift, try reduce now */
848 1.1 christos if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
849 1.1 christos yyps->save = save->save;
850 1.1 christos save->save = NULL;
851 1.1 christos yyFreeState(save);
852 1.1 christos
853 1.1 christos /* Nothing left on the stack -- error */
854 1.1 christos if (!yyps->save)
855 1.1 christos {
856 1.1 christos #if YYDEBUG
857 1.1 christos if (yydebug)
858 1.1 christos fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
859 1.1 christos YYPREFIX, yydepth);
860 1.1 christos #endif
861 1.1 christos /* Restore state as it was in the most forward-advanced error */
862 1.1 christos yylvp = yylvals + yyerrctx->lexeme;
863 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 1.1 christos yylpp = yylpsns + yyerrctx->lexeme;
865 1.1 christos #endif
866 1.1 christos yylexp = yylexemes + yyerrctx->lexeme;
867 1.1 christos yychar = yylexp[-1];
868 1.1 christos yylval = yylvp[-1];
869 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
870 1.1 christos yylloc = yylpp[-1];
871 1.1 christos #endif
872 1.1 christos yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
873 1.1 christos memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
874 1.1 christos yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
875 1.1 christos memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
876 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
877 1.1 christos yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
878 1.1 christos memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
879 1.1 christos #endif
880 1.1 christos yystate = yyerrctx->state;
881 1.1 christos yyFreeState(yyerrctx);
882 1.1 christos yyerrctx = NULL;
883 1.1 christos }
884 1.1 christos yynewerrflag = 1;
885 1.1 christos }
886 1.1 christos if (yynewerrflag == 0) goto yyinrecovery;
887 1.1 christos #endif /* YYBTYACC */
888 1.1 christos
889 1.1 christos YYERROR_CALL("syntax error");
890 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
891 1.1 christos yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
892 1.1 christos #endif
893 1.1 christos
894 1.1 christos #if !YYBTYACC
895 1.1 christos goto yyerrlab;
896 1.1 christos yyerrlab:
897 1.1 christos #endif
898 1.1 christos ++yynerrs;
899 1.1 christos
900 1.1 christos yyinrecovery:
901 1.1 christos if (yyerrflag < 3)
902 1.1 christos {
903 1.1 christos yyerrflag = 3;
904 1.1 christos for (;;)
905 1.1 christos {
906 1.1 christos if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
907 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
908 1.1 christos {
909 1.1 christos #if YYDEBUG
910 1.1 christos if (yydebug)
911 1.1 christos fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
912 1.1 christos YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
913 1.1 christos #endif
914 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
915 1.1 christos yystate = yytable[yyn];
916 1.1 christos *++yystack.s_mark = yytable[yyn];
917 1.1 christos *++yystack.l_mark = yylval;
918 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
919 1.1 christos /* lookahead position is error end position */
920 1.1 christos yyerror_loc_range[1] = yylloc;
921 1.1 christos YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
922 1.1 christos *++yystack.p_mark = yyloc;
923 1.1 christos #endif
924 1.1 christos goto yyloop;
925 1.1 christos }
926 1.1 christos else
927 1.1 christos {
928 1.1 christos #if YYDEBUG
929 1.1 christos if (yydebug)
930 1.1 christos fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
931 1.1 christos YYDEBUGSTR, yydepth, *yystack.s_mark);
932 1.1 christos #endif
933 1.1 christos if (yystack.s_mark <= yystack.s_base) goto yyabort;
934 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
935 1.1 christos /* the current TOS position is the error start position */
936 1.1 christos yyerror_loc_range[0] = *yystack.p_mark;
937 1.1 christos #endif
938 1.1 christos #if defined(YYDESTRUCT_CALL)
939 1.1 christos #if YYBTYACC
940 1.1 christos if (!yytrial)
941 1.1 christos #endif /* YYBTYACC */
942 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
943 1.1 christos YYDESTRUCT_CALL("error: discarding state",
944 1.1 christos yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
945 1.1 christos #else
946 1.1 christos YYDESTRUCT_CALL("error: discarding state",
947 1.1 christos yystos[*yystack.s_mark], yystack.l_mark);
948 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
949 1.1 christos #endif /* defined(YYDESTRUCT_CALL) */
950 1.1 christos --yystack.s_mark;
951 1.1 christos --yystack.l_mark;
952 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
953 1.1 christos --yystack.p_mark;
954 1.1 christos #endif
955 1.1 christos }
956 1.1 christos }
957 1.1 christos }
958 1.1 christos else
959 1.1 christos {
960 1.1 christos if (yychar == YYEOF) goto yyabort;
961 1.1 christos #if YYDEBUG
962 1.1 christos if (yydebug)
963 1.1 christos {
964 1.1 christos yys = yyname[YYTRANSLATE(yychar)];
965 1.1 christos fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
966 1.1 christos YYDEBUGSTR, yydepth, yystate, yychar, yys);
967 1.1 christos }
968 1.1 christos #endif
969 1.1 christos #if defined(YYDESTRUCT_CALL)
970 1.1 christos #if YYBTYACC
971 1.1 christos if (!yytrial)
972 1.1 christos #endif /* YYBTYACC */
973 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
974 1.1 christos YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
975 1.1 christos #else
976 1.1 christos YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
977 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
978 1.1 christos #endif /* defined(YYDESTRUCT_CALL) */
979 1.1 christos yychar = YYEMPTY;
980 1.1 christos goto yyloop;
981 1.1 christos }
982 1.1 christos
983 1.1 christos yyreduce:
984 1.1 christos yym = yylen[yyn];
985 1.1 christos #if YYDEBUG
986 1.1 christos if (yydebug)
987 1.1 christos {
988 1.1 christos fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
989 1.1 christos YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
990 1.1 christos #ifdef YYSTYPE_TOSTRING
991 1.1 christos #if YYBTYACC
992 1.1 christos if (!yytrial)
993 1.1 christos #endif /* YYBTYACC */
994 1.1 christos if (yym > 0)
995 1.1 christos {
996 1.1 christos int i;
997 1.1 christos fputc('<', stderr);
998 1.1 christos for (i = yym; i > 0; i--)
999 1.1 christos {
1000 1.1 christos if (i != yym) fputs(", ", stderr);
1001 1.1 christos fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1002 1.1 christos yystack.l_mark[1-i]), stderr);
1003 1.1 christos }
1004 1.1 christos fputc('>', stderr);
1005 1.1 christos }
1006 1.1 christos #endif
1007 1.1 christos fputc('\n', stderr);
1008 1.1 christos }
1009 1.1 christos #endif
1010 1.1 christos if (yym > 0)
1011 1.1 christos yyval = yystack.l_mark[1-yym];
1012 1.1 christos else
1013 1.1 christos memset(&yyval, 0, sizeof yyval);
1014 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1015 1.1 christos
1016 1.1 christos /* Perform position reduction */
1017 1.1 christos memset(&yyloc, 0, sizeof(yyloc));
1018 1.1 christos #if YYBTYACC
1019 1.1 christos if (!yytrial)
1020 1.1 christos #endif /* YYBTYACC */
1021 1.1 christos {
1022 1.1 christos YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1023 1.1 christos /* just in case YYERROR is invoked within the action, save
1024 1.1 christos the start of the rhs as the error start position */
1025 1.1 christos yyerror_loc_range[0] = yystack.p_mark[1-yym];
1026 1.1 christos }
1027 1.1 christos #endif
1028 1.1 christos
1029 1.1 christos switch (yyn)
1030 1.1 christos {
1031 1.1 christos default:
1032 1.1 christos break;
1033 1.1 christos }
1034 1.1 christos yystack.s_mark -= yym;
1035 1.1 christos yystate = *yystack.s_mark;
1036 1.1 christos yystack.l_mark -= yym;
1037 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1038 1.1 christos yystack.p_mark -= yym;
1039 1.1 christos #endif
1040 1.1 christos yym = yylhs[yyn];
1041 1.1 christos if (yystate == 0 && yym == 0)
1042 1.1 christos {
1043 1.1 christos #if YYDEBUG
1044 1.1 christos if (yydebug)
1045 1.1 christos {
1046 1.1 christos fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1047 1.1 christos #ifdef YYSTYPE_TOSTRING
1048 1.1 christos #if YYBTYACC
1049 1.1 christos if (!yytrial)
1050 1.1 christos #endif /* YYBTYACC */
1051 1.1 christos fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1052 1.1 christos #endif
1053 1.1 christos fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1054 1.1 christos }
1055 1.1 christos #endif
1056 1.1 christos yystate = YYFINAL;
1057 1.1 christos *++yystack.s_mark = YYFINAL;
1058 1.1 christos *++yystack.l_mark = yyval;
1059 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1060 1.1 christos *++yystack.p_mark = yyloc;
1061 1.1 christos #endif
1062 1.1 christos if (yychar < 0)
1063 1.1 christos {
1064 1.1 christos #if YYBTYACC
1065 1.1 christos do {
1066 1.1 christos if (yylvp < yylve)
1067 1.1 christos {
1068 1.1 christos /* we're currently re-reading tokens */
1069 1.1 christos yylval = *yylvp++;
1070 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1071 1.1 christos yylloc = *yylpp++;
1072 1.1 christos #endif
1073 1.1 christos yychar = *yylexp++;
1074 1.1 christos break;
1075 1.1 christos }
1076 1.1 christos if (yyps->save)
1077 1.1 christos {
1078 1.1 christos /* in trial mode; save scanner results for future parse attempts */
1079 1.1 christos if (yylvp == yylvlim)
1080 1.1 christos { /* Enlarge lexical value queue */
1081 1.1 christos size_t p = (size_t) (yylvp - yylvals);
1082 1.1 christos size_t s = (size_t) (yylvlim - yylvals);
1083 1.1 christos
1084 1.1 christos s += YYLVQUEUEGROWTH;
1085 1.1 christos if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1086 1.1 christos goto yyenomem;
1087 1.1 christos if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1088 1.1 christos goto yyenomem;
1089 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1090 1.1 christos if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1091 1.1 christos goto yyenomem;
1092 1.1 christos #endif
1093 1.1 christos yylvp = yylve = yylvals + p;
1094 1.1 christos yylvlim = yylvals + s;
1095 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1096 1.1 christos yylpp = yylpe = yylpsns + p;
1097 1.1 christos yylplim = yylpsns + s;
1098 1.1 christos #endif
1099 1.1 christos yylexp = yylexemes + p;
1100 1.1 christos }
1101 1.1 christos *yylexp = (short) YYLEX;
1102 1.1 christos *yylvp++ = yylval;
1103 1.1 christos yylve++;
1104 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1105 1.1 christos *yylpp++ = yylloc;
1106 1.1 christos yylpe++;
1107 1.1 christos #endif
1108 1.1 christos yychar = *yylexp++;
1109 1.1 christos break;
1110 1.1 christos }
1111 1.1 christos /* normal operation, no conflict encountered */
1112 1.1 christos #endif /* YYBTYACC */
1113 1.1 christos yychar = YYLEX;
1114 1.1 christos #if YYBTYACC
1115 1.1 christos } while (0);
1116 1.1 christos #endif /* YYBTYACC */
1117 1.1 christos if (yychar < 0) yychar = YYEOF;
1118 1.1 christos /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1119 1.1 christos #if YYDEBUG
1120 1.1 christos if (yydebug)
1121 1.1 christos {
1122 1.1 christos yys = yyname[YYTRANSLATE(yychar)];
1123 1.1 christos fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1124 1.1 christos YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1125 1.1 christos }
1126 1.1 christos #endif
1127 1.1 christos }
1128 1.1 christos if (yychar == YYEOF) goto yyaccept;
1129 1.1 christos goto yyloop;
1130 1.1 christos }
1131 1.1 christos if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1132 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1133 1.1 christos yystate = yytable[yyn];
1134 1.1 christos else
1135 1.1 christos yystate = yydgoto[yym];
1136 1.1 christos #if YYDEBUG
1137 1.1 christos if (yydebug)
1138 1.1 christos {
1139 1.1 christos fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1140 1.1 christos #ifdef YYSTYPE_TOSTRING
1141 1.1 christos #if YYBTYACC
1142 1.1 christos if (!yytrial)
1143 1.1 christos #endif /* YYBTYACC */
1144 1.1 christos fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1145 1.1 christos #endif
1146 1.1 christos fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1147 1.1 christos }
1148 1.1 christos #endif
1149 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1150 1.1 christos *++yystack.s_mark = (short) yystate;
1151 1.1 christos *++yystack.l_mark = yyval;
1152 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1153 1.1 christos *++yystack.p_mark = yyloc;
1154 1.1 christos #endif
1155 1.1 christos goto yyloop;
1156 1.1 christos #if YYBTYACC
1157 1.1 christos
1158 1.1 christos /* Reduction declares that this path is valid. Set yypath and do a full parse */
1159 1.1 christos yyvalid:
1160 1.1 christos if (yypath) YYABORT;
1161 1.1 christos while (yyps->save)
1162 1.1 christos {
1163 1.1 christos YYParseState *save = yyps->save;
1164 1.1 christos yyps->save = save->save;
1165 1.1 christos save->save = yypath;
1166 1.1 christos yypath = save;
1167 1.1 christos }
1168 1.1 christos #if YYDEBUG
1169 1.1 christos if (yydebug)
1170 1.1 christos fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1171 1.1 christos YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1172 1.1 christos #endif
1173 1.1 christos if (yyerrctx)
1174 1.1 christos {
1175 1.1 christos yyFreeState(yyerrctx);
1176 1.1 christos yyerrctx = NULL;
1177 1.1 christos }
1178 1.1 christos yylvp = yylvals + yypath->lexeme;
1179 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1180 1.1 christos yylpp = yylpsns + yypath->lexeme;
1181 1.1 christos #endif
1182 1.1 christos yylexp = yylexemes + yypath->lexeme;
1183 1.1 christos yychar = YYEMPTY;
1184 1.1 christos yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1185 1.1 christos memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1186 1.1 christos yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1187 1.1 christos memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1188 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1189 1.1 christos yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1190 1.1 christos memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1191 1.1 christos #endif
1192 1.1 christos yystate = yypath->state;
1193 1.1 christos goto yyloop;
1194 1.1 christos #endif /* YYBTYACC */
1195 1.1 christos
1196 1.1 christos yyoverflow:
1197 1.1 christos YYERROR_CALL("yacc stack overflow");
1198 1.1 christos #if YYBTYACC
1199 1.1 christos goto yyabort_nomem;
1200 1.1 christos yyenomem:
1201 1.1 christos YYERROR_CALL("memory exhausted");
1202 1.1 christos yyabort_nomem:
1203 1.1 christos #endif /* YYBTYACC */
1204 1.1 christos yyresult = 2;
1205 1.1 christos goto yyreturn;
1206 1.1 christos
1207 1.1 christos yyabort:
1208 1.1 christos yyresult = 1;
1209 1.1 christos goto yyreturn;
1210 1.1 christos
1211 1.1 christos yyaccept:
1212 1.1 christos #if YYBTYACC
1213 1.1 christos if (yyps->save) goto yyvalid;
1214 1.1 christos #endif /* YYBTYACC */
1215 1.1 christos yyresult = 0;
1216 1.1 christos
1217 1.1 christos yyreturn:
1218 1.1 christos #if defined(YYDESTRUCT_CALL)
1219 1.1 christos if (yychar != YYEOF && yychar != YYEMPTY)
1220 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1221 1.1 christos YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1222 1.1 christos #else
1223 1.1 christos YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1224 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1225 1.1 christos
1226 1.1 christos {
1227 1.1 christos YYSTYPE *pv;
1228 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1229 1.1 christos YYLTYPE *pp;
1230 1.1 christos
1231 1.1 christos for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1232 1.1 christos YYDESTRUCT_CALL("cleanup: discarding state",
1233 1.1 christos yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1234 1.1 christos #else
1235 1.1 christos for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1236 1.1 christos YYDESTRUCT_CALL("cleanup: discarding state",
1237 1.1 christos yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1238 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1239 1.1 christos }
1240 1.1 christos #endif /* defined(YYDESTRUCT_CALL) */
1241 1.1 christos
1242 1.1 christos #if YYBTYACC
1243 1.1 christos if (yyerrctx)
1244 1.1 christos {
1245 1.1 christos yyFreeState(yyerrctx);
1246 1.1 christos yyerrctx = NULL;
1247 1.1 christos }
1248 1.1 christos while (yyps)
1249 1.1 christos {
1250 1.1 christos YYParseState *save = yyps;
1251 1.1 christos yyps = save->save;
1252 1.1 christos save->save = NULL;
1253 1.1 christos yyFreeState(save);
1254 1.1 christos }
1255 1.1 christos while (yypath)
1256 1.1 christos {
1257 1.1 christos YYParseState *save = yypath;
1258 1.1 christos yypath = save->save;
1259 1.1 christos save->save = NULL;
1260 1.1 christos yyFreeState(save);
1261 1.1 christos }
1262 1.1 christos #endif /* YYBTYACC */
1263 1.1 christos yyfreestack(&yystack);
1264 1.1 christos return (yyresult);
1265 1.1 christos }
1266