varsyntax_calc1.tab.c revision 1.6 1 1.4 christos /* $NetBSD: varsyntax_calc1.tab.c,v 1.6 2026/01/18 16:41:31 christos Exp $ */
2 1.1 christos
3 1.1 christos /* original parser id follows */
4 1.1 christos /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
5 1.1 christos /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
6 1.1 christos
7 1.1 christos #define YYBYACC 1
8 1.4 christos #define YYMAJOR 2
9 1.4 christos #define YYMINOR 0
10 1.1 christos #define YYCHECK "yyyymmdd"
11 1.1 christos
12 1.1 christos #define YYEMPTY (-1)
13 1.1 christos #define yyclearin (yychar = YYEMPTY)
14 1.1 christos #define yyerrok (yyerrflag = 0)
15 1.1 christos #define YYRECOVERING() (yyerrflag != 0)
16 1.1 christos #define YYENOMEM (-2)
17 1.1 christos #define YYEOF 0
18 1.1 christos #ident "check variant syntax features"
19 1.1 christos
20 1.1 christos #ifndef yyparse
21 1.1 christos #define yyparse varsyntax_calc1_parse
22 1.1 christos #endif /* yyparse */
23 1.1 christos
24 1.1 christos #ifndef yylex
25 1.1 christos #define yylex varsyntax_calc1_lex
26 1.1 christos #endif /* yylex */
27 1.1 christos
28 1.1 christos #ifndef yyerror
29 1.1 christos #define yyerror varsyntax_calc1_error
30 1.1 christos #endif /* yyerror */
31 1.1 christos
32 1.1 christos #ifndef yychar
33 1.1 christos #define yychar varsyntax_calc1_char
34 1.1 christos #endif /* yychar */
35 1.1 christos
36 1.1 christos #ifndef yyval
37 1.1 christos #define yyval varsyntax_calc1_val
38 1.1 christos #endif /* yyval */
39 1.1 christos
40 1.1 christos #ifndef yylval
41 1.1 christos #define yylval varsyntax_calc1_lval
42 1.1 christos #endif /* yylval */
43 1.1 christos
44 1.1 christos #ifndef yydebug
45 1.1 christos #define yydebug varsyntax_calc1_debug
46 1.1 christos #endif /* yydebug */
47 1.1 christos
48 1.1 christos #ifndef yynerrs
49 1.1 christos #define yynerrs varsyntax_calc1_nerrs
50 1.1 christos #endif /* yynerrs */
51 1.1 christos
52 1.1 christos #ifndef yyerrflag
53 1.1 christos #define yyerrflag varsyntax_calc1_errflag
54 1.1 christos #endif /* yyerrflag */
55 1.1 christos
56 1.1 christos #ifndef yylhs
57 1.1 christos #define yylhs varsyntax_calc1_lhs
58 1.1 christos #endif /* yylhs */
59 1.1 christos
60 1.1 christos #ifndef yylen
61 1.1 christos #define yylen varsyntax_calc1_len
62 1.1 christos #endif /* yylen */
63 1.1 christos
64 1.1 christos #ifndef yydefred
65 1.1 christos #define yydefred varsyntax_calc1_defred
66 1.1 christos #endif /* yydefred */
67 1.1 christos
68 1.1 christos #ifndef yydgoto
69 1.1 christos #define yydgoto varsyntax_calc1_dgoto
70 1.1 christos #endif /* yydgoto */
71 1.1 christos
72 1.1 christos #ifndef yysindex
73 1.1 christos #define yysindex varsyntax_calc1_sindex
74 1.1 christos #endif /* yysindex */
75 1.1 christos
76 1.1 christos #ifndef yyrindex
77 1.1 christos #define yyrindex varsyntax_calc1_rindex
78 1.1 christos #endif /* yyrindex */
79 1.1 christos
80 1.1 christos #ifndef yygindex
81 1.1 christos #define yygindex varsyntax_calc1_gindex
82 1.1 christos #endif /* yygindex */
83 1.1 christos
84 1.1 christos #ifndef yytable
85 1.1 christos #define yytable varsyntax_calc1_table
86 1.1 christos #endif /* yytable */
87 1.1 christos
88 1.1 christos #ifndef yycheck
89 1.1 christos #define yycheck varsyntax_calc1_check
90 1.1 christos #endif /* yycheck */
91 1.1 christos
92 1.1 christos #ifndef yyname
93 1.1 christos #define yyname varsyntax_calc1_name
94 1.1 christos #endif /* yyname */
95 1.1 christos
96 1.1 christos #ifndef yyrule
97 1.1 christos #define yyrule varsyntax_calc1_rule
98 1.1 christos #endif /* yyrule */
99 1.1 christos #define YYPREFIX "varsyntax_calc1_"
100 1.1 christos
101 1.1 christos #define YYPURE 0
102 1.1 christos
103 1.1 christos #line 3 "varsyntax_calc1.y"
104 1.1 christos
105 1.1 christos /* http://dinosaur.compilertools.net/yacc/index.html * /*/
106 1.1 christos
107 1.1 christos #include <stdlib.h>
108 1.1 christos #include <stdio.h>
109 1.1 christos #include <ctype.h>
110 1.1 christos #include <math.h>
111 1.1 christos
112 1.1 christos typedef struct interval
113 1.1 christos {
114 1.1 christos double lo, hi;
115 1.1 christos }
116 1.1 christos INTERVAL;
117 1.1 christos
118 1.1 christos INTERVAL vmul(double, double, INTERVAL);
119 1.1 christos INTERVAL vdiv(double, double, INTERVAL);
120 1.1 christos
121 1.1 christos extern int yylex(void);
122 1.1 christos static void yyerror(const char *s);
123 1.1 christos
124 1.1 christos int dcheck(INTERVAL);
125 1.1 christos
126 1.1 christos double dreg[26];
127 1.1 christos INTERVAL vreg[26];
128 1.1 christos
129 1.1 christos #ifdef YYSTYPE
130 1.1 christos #undef YYSTYPE_IS_DECLARED
131 1.1 christos #define YYSTYPE_IS_DECLARED 1
132 1.1 christos #endif
133 1.1 christos #ifndef YYSTYPE_IS_DECLARED
134 1.1 christos #define YYSTYPE_IS_DECLARED 1
135 1.2 christos #line 32 "varsyntax_calc1.y"
136 1.5 christos typedef union YYSTYPE
137 1.1 christos {
138 1.1 christos int ival; /* dreg & vreg array index values*/
139 1.1 christos double dval; /* floating point values*/
140 1.1 christos INTERVAL vval; /* interval values*/
141 1.1 christos } YYSTYPE;
142 1.1 christos #endif /* !YYSTYPE_IS_DECLARED */
143 1.1 christos #line 142 "varsyntax_calc1.tab.c"
144 1.1 christos
145 1.1 christos /* compatibility with bison */
146 1.1 christos #ifdef YYPARSE_PARAM
147 1.1 christos /* compatibility with FreeBSD */
148 1.1 christos # ifdef YYPARSE_PARAM_TYPE
149 1.1 christos # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
150 1.1 christos # else
151 1.1 christos # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
152 1.1 christos # endif
153 1.1 christos #else
154 1.1 christos # define YYPARSE_DECL() yyparse(void)
155 1.1 christos #endif
156 1.1 christos
157 1.1 christos /* Parameters sent to lex. */
158 1.1 christos #ifdef YYLEX_PARAM
159 1.1 christos # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
160 1.1 christos # define YYLEX yylex(YYLEX_PARAM)
161 1.1 christos #else
162 1.1 christos # define YYLEX_DECL() yylex(void)
163 1.1 christos # define YYLEX yylex()
164 1.1 christos #endif
165 1.1 christos
166 1.1 christos /* Parameters sent to yyerror. */
167 1.1 christos #ifndef YYERROR_DECL
168 1.1 christos #define YYERROR_DECL() yyerror(const char *s)
169 1.1 christos #endif
170 1.1 christos #ifndef YYERROR_CALL
171 1.1 christos #define YYERROR_CALL(msg) yyerror(msg)
172 1.1 christos #endif
173 1.1 christos
174 1.1 christos extern int YYPARSE_DECL();
175 1.1 christos
176 1.1 christos #define DREG 257
177 1.1 christos #define VREG 258
178 1.1 christos #define CONST 259
179 1.1 christos #define UMINUS 260
180 1.1 christos #define YYERRCODE 256
181 1.5 christos typedef int YYINT;
182 1.1 christos static const YYINT varsyntax_calc1_lhs[] = { -1,
183 1.1 christos 3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
184 1.1 christos 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
185 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2,
186 1.1 christos };
187 1.1 christos static const YYINT varsyntax_calc1_len[] = { 2,
188 1.1 christos 0, 2, 2, 2, 4, 4, 2, 1, 1, 3,
189 1.1 christos 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
190 1.1 christos 3, 3, 3, 3, 3, 3, 2, 3,
191 1.1 christos };
192 1.1 christos static const YYINT varsyntax_calc1_defred[] = { 0,
193 1.1 christos 0, 0, 0, 8, 0, 0, 0, 0, 0, 7,
194 1.1 christos 0, 0, 9, 18, 14, 27, 0, 0, 0, 0,
195 1.1 christos 0, 0, 3, 0, 0, 0, 0, 4, 0, 0,
196 1.1 christos 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
197 1.1 christos 12, 24, 13, 26, 0, 0, 23, 25, 14, 0,
198 1.1 christos 0, 0, 0, 0, 5, 6, 0, 0, 0, 12,
199 1.1 christos 13, 17,
200 1.1 christos };
201 1.1 christos static const YYINT varsyntax_calc1_dgoto[] = { 7,
202 1.1 christos 32, 9, 0,
203 1.1 christos };
204 1.1 christos static const YYINT varsyntax_calc1_sindex[] = { -40,
205 1.1 christos -8, -48, -47, 0, -37, -37, 0, 2, 17, 0,
206 1.1 christos -34, -37, 0, 0, 0, 0, -25, 90, -37, -37,
207 1.1 christos -37, -37, 0, -37, -37, -37, -37, 0, -34, -34,
208 1.1 christos 25, 125, 31, 0, -34, 0, -11, 37, -11, 37,
209 1.1 christos 0, 0, 0, 0, 37, 37, 0, 0, 0, 111,
210 1.1 christos -34, -34, -34, -34, 0, 0, 118, 69, 69, 0,
211 1.1 christos 0, 0,
212 1.1 christos };
213 1.1 christos static const YYINT varsyntax_calc1_rindex[] = { 0,
214 1.1 christos 0, 38, 44, 0, 0, 0, 0, 0, 0, 0,
215 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
216 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
217 1.1 christos 0, -9, 0, 0, 0, 0, 51, -3, 56, 61,
218 1.1 christos 0, 0, 0, 0, 67, 72, 0, 0, 0, 0,
219 1.1 christos 0, 0, 0, 0, 0, 0, 0, 78, 83, 0,
220 1.1 christos 0, 0,
221 1.1 christos };
222 1.1 christos static const YYINT varsyntax_calc1_gindex[] = { 0,
223 1.1 christos 4, 124, 0,
224 1.1 christos };
225 1.1 christos #define YYTABLESIZE 225
226 1.1 christos static const YYINT varsyntax_calc1_table[] = { 6,
227 1.1 christos 16, 10, 6, 8, 5, 30, 20, 5, 15, 17,
228 1.1 christos 29, 23, 11, 12, 31, 34, 21, 19, 35, 20,
229 1.1 christos 0, 22, 37, 39, 41, 43, 28, 0, 0, 0,
230 1.1 christos 21, 16, 49, 50, 55, 22, 0, 20, 57, 20,
231 1.1 christos 56, 20, 0, 21, 19, 0, 20, 9, 22, 0,
232 1.1 christos 0, 0, 0, 18, 58, 59, 60, 61, 26, 24,
233 1.1 christos 10, 25, 0, 27, 0, 11, 53, 51, 0, 52,
234 1.1 christos 22, 54, 26, 24, 0, 25, 19, 27, 26, 9,
235 1.1 christos 9, 21, 9, 27, 9, 18, 18, 10, 18, 0,
236 1.1 christos 18, 10, 11, 10, 10, 10, 11, 0, 11, 11,
237 1.1 christos 11, 22, 0, 22, 0, 22, 0, 19, 0, 19,
238 1.1 christos 53, 19, 21, 0, 21, 54, 21, 0, 10, 0,
239 1.1 christos 10, 0, 10, 11, 0, 11, 0, 11, 16, 18,
240 1.1 christos 36, 26, 24, 0, 25, 33, 27, 0, 0, 0,
241 1.1 christos 0, 0, 38, 40, 42, 44, 0, 45, 46, 47,
242 1.1 christos 48, 34, 53, 51, 0, 52, 0, 54, 62, 53,
243 1.1 christos 51, 0, 52, 0, 54, 0, 21, 19, 0, 20,
244 1.1 christos 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
245 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
246 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
247 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
248 1.1 christos 0, 0, 0, 0, 0, 1, 2, 3, 4, 13,
249 1.1 christos 14, 4, 13, 0, 4,
250 1.1 christos };
251 1.1 christos static const YYINT varsyntax_calc1_check[] = { 40,
252 1.1 christos 10, 10, 40, 0, 45, 40, 10, 45, 5, 6,
253 1.1 christos 45, 10, 61, 61, 11, 41, 42, 43, 44, 45,
254 1.1 christos -1, 47, 19, 20, 21, 22, 10, -1, -1, -1,
255 1.1 christos 42, 41, 29, 30, 10, 47, -1, 41, 35, 43,
256 1.1 christos 10, 45, -1, 42, 43, -1, 45, 10, 47, -1,
257 1.1 christos -1, -1, -1, 10, 51, 52, 53, 54, 42, 43,
258 1.1 christos 10, 45, -1, 47, -1, 10, 42, 43, -1, 45,
259 1.1 christos 10, 47, 42, 43, -1, 45, 10, 47, 42, 42,
260 1.1 christos 43, 10, 45, 47, 47, 42, 43, 10, 45, -1,
261 1.1 christos 47, 41, 10, 43, 44, 45, 41, -1, 43, 44,
262 1.1 christos 45, 41, -1, 43, -1, 45, -1, 41, -1, 43,
263 1.1 christos 42, 45, 41, -1, 43, 47, 45, -1, 41, -1,
264 1.1 christos 43, -1, 45, 41, -1, 43, -1, 45, 5, 6,
265 1.1 christos 41, 42, 43, -1, 45, 12, 47, -1, -1, -1,
266 1.1 christos -1, -1, 19, 20, 21, 22, -1, 24, 25, 26,
267 1.1 christos 27, 41, 42, 43, -1, 45, -1, 47, 41, 42,
268 1.1 christos 43, -1, 45, -1, 47, -1, 42, 43, -1, 45,
269 1.1 christos -1, 47, -1, -1, -1, -1, -1, -1, -1, -1,
270 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
271 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
272 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
273 1.1 christos -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
274 1.1 christos 258, 259, 257, -1, 259,
275 1.1 christos };
276 1.1 christos #define YYFINAL 7
277 1.1 christos #ifndef YYDEBUG
278 1.1 christos #define YYDEBUG 0
279 1.1 christos #endif
280 1.1 christos #define YYMAXTOKEN 260
281 1.1 christos #define YYUNDFTOKEN 266
282 1.1 christos #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
283 1.1 christos #if YYDEBUG
284 1.6 christos #ifndef NULL
285 1.6 christos #define NULL (void*)0
286 1.6 christos #endif
287 1.1 christos static const char *const varsyntax_calc1_name[] = {
288 1.1 christos
289 1.6 christos "end-of-file",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"'\\n'",NULL,NULL,
290 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
291 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"'('","')'","'*'","'+'",
292 1.6 christos "','","'-'",NULL,"'/'",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
293 1.6 christos NULL,NULL,"'='",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
294 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
295 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
296 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
297 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
298 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
299 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
300 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
301 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
302 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
303 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
304 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
305 1.6 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,"DREG","VREG","CONST","UMINUS",NULL,NULL,
306 1.6 christos NULL,NULL,NULL,"illegal-symbol",
307 1.1 christos };
308 1.1 christos static const char *const varsyntax_calc1_rule[] = {
309 1.1 christos "$accept : line",
310 1.1 christos "lines :",
311 1.1 christos "lines : lines line",
312 1.1 christos "line : dexp '\\n'",
313 1.1 christos "line : vexp '\\n'",
314 1.1 christos "line : DREG '=' dexp '\\n'",
315 1.1 christos "line : VREG '=' vexp '\\n'",
316 1.1 christos "line : error '\\n'",
317 1.1 christos "dexp : CONST",
318 1.1 christos "dexp : DREG",
319 1.1 christos "dexp : dexp '+' dexp",
320 1.1 christos "dexp : dexp '-' dexp",
321 1.1 christos "dexp : dexp '*' dexp",
322 1.1 christos "dexp : dexp '/' dexp",
323 1.1 christos "dexp : '-' dexp",
324 1.1 christos "dexp : '(' dexp ')'",
325 1.1 christos "vexp : dexp",
326 1.1 christos "vexp : '(' dexp ',' dexp ')'",
327 1.1 christos "vexp : VREG",
328 1.1 christos "vexp : vexp '+' vexp",
329 1.1 christos "vexp : dexp '+' vexp",
330 1.1 christos "vexp : vexp '-' vexp",
331 1.1 christos "vexp : dexp '-' vexp",
332 1.1 christos "vexp : vexp '*' vexp",
333 1.1 christos "vexp : dexp '*' vexp",
334 1.1 christos "vexp : vexp '/' vexp",
335 1.1 christos "vexp : dexp '/' vexp",
336 1.1 christos "vexp : '-' vexp",
337 1.1 christos "vexp : '(' vexp ')'",
338 1.1 christos
339 1.1 christos };
340 1.1 christos #endif
341 1.1 christos
342 1.3 christos #if YYDEBUG
343 1.1 christos int yydebug;
344 1.3 christos #endif
345 1.1 christos
346 1.1 christos int yyerrflag;
347 1.1 christos int yychar;
348 1.1 christos YYSTYPE yyval;
349 1.1 christos YYSTYPE yylval;
350 1.3 christos int yynerrs;
351 1.1 christos
352 1.1 christos /* define the initial stack-sizes */
353 1.1 christos #ifdef YYSTACKSIZE
354 1.1 christos #undef YYMAXDEPTH
355 1.1 christos #define YYMAXDEPTH YYSTACKSIZE
356 1.1 christos #else
357 1.1 christos #ifdef YYMAXDEPTH
358 1.1 christos #define YYSTACKSIZE YYMAXDEPTH
359 1.1 christos #else
360 1.1 christos #define YYSTACKSIZE 10000
361 1.1 christos #define YYMAXDEPTH 10000
362 1.1 christos #endif
363 1.1 christos #endif
364 1.1 christos
365 1.1 christos #define YYINITSTACKSIZE 200
366 1.1 christos
367 1.1 christos typedef struct {
368 1.1 christos unsigned stacksize;
369 1.1 christos YYINT *s_base;
370 1.1 christos YYINT *s_mark;
371 1.1 christos YYINT *s_last;
372 1.1 christos YYSTYPE *l_base;
373 1.1 christos YYSTYPE *l_mark;
374 1.1 christos } YYSTACKDATA;
375 1.1 christos /* variables for the parser stack */
376 1.1 christos static YYSTACKDATA yystack;
377 1.1 christos #line 178 "varsyntax_calc1.y"
378 1.1 christos /* beginning of subroutines section */
379 1.1 christos
380 1.1 christos #define BSZ 50 /* buffer size for floating point numbers */
381 1.1 christos
382 1.1 christos /* lexical analysis */
383 1.1 christos
384 1.1 christos static void
385 1.1 christos yyerror(const char *s)
386 1.1 christos {
387 1.1 christos fprintf(stderr, "%s\n", s);
388 1.1 christos }
389 1.1 christos
390 1.1 christos int
391 1.1 christos yylex(void)
392 1.1 christos {
393 1.1 christos int c;
394 1.1 christos
395 1.1 christos while ((c = getchar()) == ' ')
396 1.1 christos { /* skip over blanks */
397 1.1 christos }
398 1.1 christos
399 1.1 christos if (isupper(c))
400 1.1 christos {
401 1.1 christos yylval.ival = c - 'A';
402 1.1 christos return (VREG);
403 1.1 christos }
404 1.1 christos if (islower(c))
405 1.1 christos {
406 1.1 christos yylval.ival = c - 'a';
407 1.1 christos return (DREG);
408 1.1 christos }
409 1.1 christos
410 1.1 christos if (isdigit(c) || c == '.')
411 1.1 christos {
412 1.1 christos /* gobble up digits, points, exponents */
413 1.1 christos char buf[BSZ + 1], *cp = buf;
414 1.1 christos int dot = 0, expr = 0;
415 1.1 christos
416 1.1 christos for (; (cp - buf) < BSZ; ++cp, c = getchar())
417 1.1 christos {
418 1.1 christos
419 1.1 christos *cp = (char) c;
420 1.1 christos if (isdigit(c))
421 1.1 christos continue;
422 1.1 christos if (c == '.')
423 1.1 christos {
424 1.1 christos if (dot++ || expr)
425 1.1 christos return ('.'); /* will cause syntax error */
426 1.1 christos continue;
427 1.1 christos }
428 1.1 christos
429 1.1 christos if (c == 'e')
430 1.1 christos {
431 1.1 christos if (expr++)
432 1.1 christos return ('e'); /* will cause syntax error */
433 1.1 christos continue;
434 1.1 christos }
435 1.1 christos
436 1.1 christos /* end of number */
437 1.1 christos break;
438 1.1 christos }
439 1.1 christos *cp = '\0';
440 1.1 christos
441 1.1 christos if ((cp - buf) >= BSZ)
442 1.1 christos printf("constant too long: truncated\n");
443 1.1 christos else
444 1.1 christos ungetc(c, stdin); /* push back last char read */
445 1.1 christos yylval.dval = atof(buf);
446 1.1 christos return (CONST);
447 1.1 christos }
448 1.1 christos return (c);
449 1.1 christos }
450 1.1 christos
451 1.1 christos static INTERVAL
452 1.1 christos hilo(double a, double b, double c, double d)
453 1.1 christos {
454 1.1 christos /* returns the smallest interval containing a, b, c, and d */
455 1.1 christos /* used by *, / routines */
456 1.1 christos INTERVAL v;
457 1.1 christos
458 1.1 christos if (a > b)
459 1.1 christos {
460 1.1 christos v.hi = a;
461 1.1 christos v.lo = b;
462 1.1 christos }
463 1.1 christos else
464 1.1 christos {
465 1.1 christos v.hi = b;
466 1.1 christos v.lo = a;
467 1.1 christos }
468 1.1 christos
469 1.1 christos if (c > d)
470 1.1 christos {
471 1.1 christos if (c > v.hi)
472 1.1 christos v.hi = c;
473 1.1 christos if (d < v.lo)
474 1.1 christos v.lo = d;
475 1.1 christos }
476 1.1 christos else
477 1.1 christos {
478 1.1 christos if (d > v.hi)
479 1.1 christos v.hi = d;
480 1.1 christos if (c < v.lo)
481 1.1 christos v.lo = c;
482 1.1 christos }
483 1.1 christos return (v);
484 1.1 christos }
485 1.1 christos
486 1.1 christos INTERVAL
487 1.1 christos vmul(double a, double b, INTERVAL v)
488 1.1 christos {
489 1.1 christos return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
490 1.1 christos }
491 1.1 christos
492 1.1 christos int
493 1.1 christos dcheck(INTERVAL v)
494 1.1 christos {
495 1.1 christos if (v.hi >= 0. && v.lo <= 0.)
496 1.1 christos {
497 1.1 christos printf("divisor interval contains 0.\n");
498 1.1 christos return (1);
499 1.1 christos }
500 1.1 christos return (0);
501 1.1 christos }
502 1.1 christos
503 1.1 christos INTERVAL
504 1.1 christos vdiv(double a, double b, INTERVAL v)
505 1.1 christos {
506 1.1 christos return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
507 1.1 christos }
508 1.6 christos #line 507 "varsyntax_calc1.tab.c"
509 1.1 christos
510 1.1 christos #if YYDEBUG
511 1.2 christos #include <stdio.h> /* needed for printf */
512 1.1 christos #endif
513 1.1 christos
514 1.1 christos #include <stdlib.h> /* needed for malloc, etc */
515 1.1 christos #include <string.h> /* needed for memset */
516 1.1 christos
517 1.1 christos /* allocate initial stack or double stack size, up to YYMAXDEPTH */
518 1.1 christos static int yygrowstack(YYSTACKDATA *data)
519 1.1 christos {
520 1.1 christos int i;
521 1.1 christos unsigned newsize;
522 1.1 christos YYINT *newss;
523 1.1 christos YYSTYPE *newvs;
524 1.1 christos
525 1.1 christos if ((newsize = data->stacksize) == 0)
526 1.1 christos newsize = YYINITSTACKSIZE;
527 1.1 christos else if (newsize >= YYMAXDEPTH)
528 1.1 christos return YYENOMEM;
529 1.1 christos else if ((newsize *= 2) > YYMAXDEPTH)
530 1.1 christos newsize = YYMAXDEPTH;
531 1.1 christos
532 1.1 christos i = (int) (data->s_mark - data->s_base);
533 1.1 christos newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
534 1.6 christos if (newss == NULL)
535 1.1 christos return YYENOMEM;
536 1.1 christos
537 1.1 christos data->s_base = newss;
538 1.1 christos data->s_mark = newss + i;
539 1.1 christos
540 1.1 christos newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
541 1.6 christos if (newvs == NULL)
542 1.1 christos return YYENOMEM;
543 1.1 christos
544 1.1 christos data->l_base = newvs;
545 1.1 christos data->l_mark = newvs + i;
546 1.1 christos
547 1.1 christos data->stacksize = newsize;
548 1.1 christos data->s_last = data->s_base + newsize - 1;
549 1.1 christos return 0;
550 1.1 christos }
551 1.1 christos
552 1.1 christos #if YYPURE || defined(YY_NO_LEAKS)
553 1.1 christos static void yyfreestack(YYSTACKDATA *data)
554 1.1 christos {
555 1.1 christos free(data->s_base);
556 1.1 christos free(data->l_base);
557 1.1 christos memset(data, 0, sizeof(*data));
558 1.1 christos }
559 1.1 christos #else
560 1.1 christos #define yyfreestack(data) /* nothing */
561 1.1 christos #endif
562 1.1 christos
563 1.1 christos #define YYABORT goto yyabort
564 1.1 christos #define YYREJECT goto yyabort
565 1.1 christos #define YYACCEPT goto yyaccept
566 1.1 christos #define YYERROR goto yyerrlab
567 1.1 christos
568 1.1 christos int
569 1.1 christos YYPARSE_DECL()
570 1.1 christos {
571 1.1 christos int yym, yyn, yystate;
572 1.1 christos #if YYDEBUG
573 1.1 christos const char *yys;
574 1.1 christos
575 1.6 christos if ((yys = getenv("YYDEBUG")) != NULL)
576 1.1 christos {
577 1.1 christos yyn = *yys;
578 1.1 christos if (yyn >= '0' && yyn <= '9')
579 1.1 christos yydebug = yyn - '0';
580 1.1 christos }
581 1.1 christos #endif
582 1.1 christos
583 1.5 christos /* yym is set below */
584 1.5 christos /* yyn is set below */
585 1.1 christos yynerrs = 0;
586 1.1 christos yyerrflag = 0;
587 1.1 christos yychar = YYEMPTY;
588 1.1 christos yystate = 0;
589 1.1 christos
590 1.1 christos #if YYPURE
591 1.1 christos memset(&yystack, 0, sizeof(yystack));
592 1.1 christos #endif
593 1.1 christos
594 1.1 christos if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
595 1.1 christos yystack.s_mark = yystack.s_base;
596 1.1 christos yystack.l_mark = yystack.l_base;
597 1.1 christos yystate = 0;
598 1.1 christos *yystack.s_mark = 0;
599 1.1 christos
600 1.1 christos yyloop:
601 1.1 christos if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
602 1.1 christos if (yychar < 0)
603 1.1 christos {
604 1.2 christos yychar = YYLEX;
605 1.2 christos if (yychar < 0) yychar = YYEOF;
606 1.1 christos #if YYDEBUG
607 1.1 christos if (yydebug)
608 1.1 christos {
609 1.2 christos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
610 1.1 christos printf("%sdebug: state %d, reading %d (%s)\n",
611 1.1 christos YYPREFIX, yystate, yychar, yys);
612 1.1 christos }
613 1.1 christos #endif
614 1.1 christos }
615 1.2 christos if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
616 1.2 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
617 1.1 christos {
618 1.1 christos #if YYDEBUG
619 1.1 christos if (yydebug)
620 1.1 christos printf("%sdebug: state %d, shifting to state %d\n",
621 1.1 christos YYPREFIX, yystate, yytable[yyn]);
622 1.1 christos #endif
623 1.2 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
624 1.1 christos yystate = yytable[yyn];
625 1.1 christos *++yystack.s_mark = yytable[yyn];
626 1.1 christos *++yystack.l_mark = yylval;
627 1.1 christos yychar = YYEMPTY;
628 1.1 christos if (yyerrflag > 0) --yyerrflag;
629 1.1 christos goto yyloop;
630 1.1 christos }
631 1.2 christos if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
632 1.2 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
633 1.1 christos {
634 1.1 christos yyn = yytable[yyn];
635 1.1 christos goto yyreduce;
636 1.1 christos }
637 1.2 christos if (yyerrflag != 0) goto yyinrecovery;
638 1.1 christos
639 1.1 christos YYERROR_CALL("syntax error");
640 1.1 christos
641 1.2 christos goto yyerrlab; /* redundant goto avoids 'unused label' warning */
642 1.1 christos yyerrlab:
643 1.1 christos ++yynerrs;
644 1.1 christos
645 1.1 christos yyinrecovery:
646 1.1 christos if (yyerrflag < 3)
647 1.1 christos {
648 1.1 christos yyerrflag = 3;
649 1.1 christos for (;;)
650 1.1 christos {
651 1.2 christos if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
652 1.2 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
653 1.1 christos {
654 1.1 christos #if YYDEBUG
655 1.1 christos if (yydebug)
656 1.1 christos printf("%sdebug: state %d, error recovery shifting\
657 1.1 christos to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
658 1.1 christos #endif
659 1.2 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
660 1.1 christos yystate = yytable[yyn];
661 1.1 christos *++yystack.s_mark = yytable[yyn];
662 1.1 christos *++yystack.l_mark = yylval;
663 1.1 christos goto yyloop;
664 1.1 christos }
665 1.1 christos else
666 1.1 christos {
667 1.1 christos #if YYDEBUG
668 1.1 christos if (yydebug)
669 1.1 christos printf("%sdebug: error recovery discarding state %d\n",
670 1.1 christos YYPREFIX, *yystack.s_mark);
671 1.1 christos #endif
672 1.1 christos if (yystack.s_mark <= yystack.s_base) goto yyabort;
673 1.1 christos --yystack.s_mark;
674 1.1 christos --yystack.l_mark;
675 1.1 christos }
676 1.1 christos }
677 1.1 christos }
678 1.1 christos else
679 1.1 christos {
680 1.1 christos if (yychar == YYEOF) goto yyabort;
681 1.1 christos #if YYDEBUG
682 1.1 christos if (yydebug)
683 1.1 christos {
684 1.2 christos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
685 1.1 christos printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
686 1.1 christos YYPREFIX, yystate, yychar, yys);
687 1.1 christos }
688 1.1 christos #endif
689 1.1 christos yychar = YYEMPTY;
690 1.1 christos goto yyloop;
691 1.1 christos }
692 1.1 christos
693 1.1 christos yyreduce:
694 1.1 christos #if YYDEBUG
695 1.1 christos if (yydebug)
696 1.1 christos printf("%sdebug: state %d, reducing by rule %d (%s)\n",
697 1.1 christos YYPREFIX, yystate, yyn, yyrule[yyn]);
698 1.1 christos #endif
699 1.1 christos yym = yylen[yyn];
700 1.2 christos if (yym > 0)
701 1.1 christos yyval = yystack.l_mark[1-yym];
702 1.1 christos else
703 1.1 christos memset(&yyval, 0, sizeof yyval);
704 1.2 christos
705 1.1 christos switch (yyn)
706 1.1 christos {
707 1.1 christos case 3:
708 1.1 christos #line 59 "varsyntax_calc1.y"
709 1.1 christos {
710 1.1 christos (void) printf("%15.8f\n", yystack.l_mark[-1].dval);
711 1.1 christos }
712 1.6 christos #line 711 "varsyntax_calc1.tab.c"
713 1.1 christos break;
714 1.1 christos case 4:
715 1.1 christos #line 63 "varsyntax_calc1.y"
716 1.1 christos {
717 1.1 christos (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
718 1.1 christos }
719 1.6 christos #line 718 "varsyntax_calc1.tab.c"
720 1.1 christos break;
721 1.1 christos case 5:
722 1.1 christos #line 67 "varsyntax_calc1.y"
723 1.1 christos {
724 1.1 christos dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
725 1.1 christos }
726 1.6 christos #line 725 "varsyntax_calc1.tab.c"
727 1.1 christos break;
728 1.1 christos case 6:
729 1.1 christos #line 71 "varsyntax_calc1.y"
730 1.1 christos {
731 1.1 christos vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
732 1.1 christos }
733 1.6 christos #line 732 "varsyntax_calc1.tab.c"
734 1.1 christos break;
735 1.1 christos case 7:
736 1.1 christos #line 75 "varsyntax_calc1.y"
737 1.1 christos {
738 1.1 christos yyerrok;
739 1.1 christos }
740 1.6 christos #line 739 "varsyntax_calc1.tab.c"
741 1.1 christos break;
742 1.1 christos case 9:
743 1.1 christos #line 82 "varsyntax_calc1.y"
744 1.1 christos {
745 1.1 christos yyval.dval = dreg[yystack.l_mark[0].ival]; /* $$ & $1 are sufficient here*/
746 1.1 christos }
747 1.6 christos #line 746 "varsyntax_calc1.tab.c"
748 1.1 christos break;
749 1.1 christos case 10:
750 1.1 christos #line 86 "varsyntax_calc1.y"
751 1.1 christos {
752 1.1 christos yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
753 1.1 christos }
754 1.6 christos #line 753 "varsyntax_calc1.tab.c"
755 1.1 christos break;
756 1.1 christos case 11:
757 1.1 christos #line 90 "varsyntax_calc1.y"
758 1.1 christos {
759 1.1 christos yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
760 1.1 christos }
761 1.6 christos #line 760 "varsyntax_calc1.tab.c"
762 1.1 christos break;
763 1.1 christos case 12:
764 1.1 christos #line 94 "varsyntax_calc1.y"
765 1.1 christos {
766 1.1 christos yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
767 1.1 christos }
768 1.6 christos #line 767 "varsyntax_calc1.tab.c"
769 1.1 christos break;
770 1.1 christos case 13:
771 1.1 christos #line 98 "varsyntax_calc1.y"
772 1.1 christos {
773 1.1 christos yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
774 1.1 christos }
775 1.6 christos #line 774 "varsyntax_calc1.tab.c"
776 1.1 christos break;
777 1.1 christos case 14:
778 1.1 christos #line 102 "varsyntax_calc1.y"
779 1.1 christos {
780 1.1 christos yyval.dval = -yystack.l_mark[0].dval;
781 1.1 christos }
782 1.6 christos #line 781 "varsyntax_calc1.tab.c"
783 1.1 christos break;
784 1.1 christos case 15:
785 1.1 christos #line 106 "varsyntax_calc1.y"
786 1.1 christos {
787 1.1 christos yyval.dval = yystack.l_mark[-1].dval;
788 1.1 christos }
789 1.6 christos #line 788 "varsyntax_calc1.tab.c"
790 1.1 christos break;
791 1.1 christos case 16:
792 1.1 christos #line 112 "varsyntax_calc1.y"
793 1.1 christos {
794 1.1 christos yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
795 1.1 christos }
796 1.6 christos #line 795 "varsyntax_calc1.tab.c"
797 1.1 christos break;
798 1.1 christos case 17:
799 1.1 christos #line 116 "varsyntax_calc1.y"
800 1.1 christos {
801 1.1 christos yyval.vval.lo = yystack.l_mark[-3].dval;
802 1.1 christos yyval.vval.hi = yystack.l_mark[-1].dval;
803 1.6 christos if ( yyval.vval.lo > yyval.vval.hi )
804 1.1 christos {
805 1.1 christos (void) printf("interval out of order\n");
806 1.1 christos YYERROR;
807 1.1 christos }
808 1.1 christos }
809 1.6 christos #line 808 "varsyntax_calc1.tab.c"
810 1.1 christos break;
811 1.1 christos case 18:
812 1.1 christos #line 126 "varsyntax_calc1.y"
813 1.1 christos {
814 1.1 christos yyval.vval = vreg[yystack.l_mark[0].ival];
815 1.1 christos }
816 1.6 christos #line 815 "varsyntax_calc1.tab.c"
817 1.1 christos break;
818 1.1 christos case 19:
819 1.1 christos #line 130 "varsyntax_calc1.y"
820 1.1 christos {
821 1.1 christos yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
822 1.1 christos yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
823 1.1 christos }
824 1.6 christos #line 823 "varsyntax_calc1.tab.c"
825 1.1 christos break;
826 1.1 christos case 20:
827 1.1 christos #line 135 "varsyntax_calc1.y"
828 1.1 christos {
829 1.1 christos yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
830 1.1 christos yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
831 1.1 christos }
832 1.6 christos #line 831 "varsyntax_calc1.tab.c"
833 1.1 christos break;
834 1.1 christos case 21:
835 1.1 christos #line 140 "varsyntax_calc1.y"
836 1.1 christos {
837 1.1 christos yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
838 1.1 christos yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
839 1.1 christos }
840 1.6 christos #line 839 "varsyntax_calc1.tab.c"
841 1.1 christos break;
842 1.1 christos case 22:
843 1.1 christos #line 145 "varsyntax_calc1.y"
844 1.1 christos {
845 1.1 christos yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
846 1.1 christos yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
847 1.1 christos }
848 1.6 christos #line 847 "varsyntax_calc1.tab.c"
849 1.1 christos break;
850 1.1 christos case 23:
851 1.1 christos #line 150 "varsyntax_calc1.y"
852 1.1 christos {
853 1.1 christos yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
854 1.1 christos }
855 1.6 christos #line 854 "varsyntax_calc1.tab.c"
856 1.1 christos break;
857 1.1 christos case 24:
858 1.1 christos #line 154 "varsyntax_calc1.y"
859 1.1 christos {
860 1.1 christos yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
861 1.1 christos }
862 1.6 christos #line 861 "varsyntax_calc1.tab.c"
863 1.1 christos break;
864 1.1 christos case 25:
865 1.1 christos #line 158 "varsyntax_calc1.y"
866 1.1 christos {
867 1.1 christos if (dcheck(yystack.l_mark[0].vval)) YYERROR;
868 1.1 christos yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
869 1.1 christos }
870 1.6 christos #line 869 "varsyntax_calc1.tab.c"
871 1.1 christos break;
872 1.1 christos case 26:
873 1.1 christos #line 163 "varsyntax_calc1.y"
874 1.1 christos {
875 1.1 christos if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
876 1.1 christos yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
877 1.1 christos }
878 1.6 christos #line 877 "varsyntax_calc1.tab.c"
879 1.1 christos break;
880 1.1 christos case 27:
881 1.1 christos #line 168 "varsyntax_calc1.y"
882 1.1 christos {
883 1.1 christos yyval.vval.hi = -yystack.l_mark[0].vval.lo;
884 1.1 christos yyval.vval.lo = -yystack.l_mark[0].vval.hi;
885 1.1 christos }
886 1.6 christos #line 885 "varsyntax_calc1.tab.c"
887 1.1 christos break;
888 1.1 christos case 28:
889 1.1 christos #line 173 "varsyntax_calc1.y"
890 1.1 christos {
891 1.1 christos yyval.vval = yystack.l_mark[-1].vval;
892 1.1 christos }
893 1.6 christos #line 892 "varsyntax_calc1.tab.c"
894 1.1 christos break;
895 1.6 christos #line 894 "varsyntax_calc1.tab.c"
896 1.1 christos }
897 1.1 christos yystack.s_mark -= yym;
898 1.1 christos yystate = *yystack.s_mark;
899 1.1 christos yystack.l_mark -= yym;
900 1.1 christos yym = yylhs[yyn];
901 1.1 christos if (yystate == 0 && yym == 0)
902 1.1 christos {
903 1.1 christos #if YYDEBUG
904 1.1 christos if (yydebug)
905 1.1 christos printf("%sdebug: after reduction, shifting from state 0 to\
906 1.1 christos state %d\n", YYPREFIX, YYFINAL);
907 1.1 christos #endif
908 1.1 christos yystate = YYFINAL;
909 1.1 christos *++yystack.s_mark = YYFINAL;
910 1.1 christos *++yystack.l_mark = yyval;
911 1.1 christos if (yychar < 0)
912 1.1 christos {
913 1.2 christos yychar = YYLEX;
914 1.2 christos if (yychar < 0) yychar = YYEOF;
915 1.1 christos #if YYDEBUG
916 1.1 christos if (yydebug)
917 1.1 christos {
918 1.2 christos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
919 1.1 christos printf("%sdebug: state %d, reading %d (%s)\n",
920 1.1 christos YYPREFIX, YYFINAL, yychar, yys);
921 1.1 christos }
922 1.1 christos #endif
923 1.1 christos }
924 1.1 christos if (yychar == YYEOF) goto yyaccept;
925 1.1 christos goto yyloop;
926 1.1 christos }
927 1.2 christos if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
928 1.2 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
929 1.1 christos yystate = yytable[yyn];
930 1.1 christos else
931 1.1 christos yystate = yydgoto[yym];
932 1.1 christos #if YYDEBUG
933 1.1 christos if (yydebug)
934 1.1 christos printf("%sdebug: after reduction, shifting from state %d \
935 1.1 christos to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
936 1.1 christos #endif
937 1.2 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
938 1.1 christos *++yystack.s_mark = (YYINT) yystate;
939 1.1 christos *++yystack.l_mark = yyval;
940 1.1 christos goto yyloop;
941 1.1 christos
942 1.1 christos yyoverflow:
943 1.1 christos YYERROR_CALL("yacc stack overflow");
944 1.1 christos
945 1.1 christos yyabort:
946 1.1 christos yyfreestack(&yystack);
947 1.1 christos return (1);
948 1.1 christos
949 1.1 christos yyaccept:
950 1.1 christos yyfreestack(&yystack);
951 1.1 christos return (0);
952 1.1 christos }
953