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