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