Annotation of capa/capa51/pProj/capaFormulaParser.c, revision 1.1.1.1
1.1 albertel 1: #ifndef lint
2: static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
3: #endif
4: #define YYBYACC 1
5: #define YYMAJOR 1
6: #define YYMINOR 9
7: #define yyclearin (yychar=(-1))
8: #define yyerrok (yyerrflag=0)
9: #define YYRECOVERING (yyerrflag!=0)
10: #define yyparse fml_parse
11: #define yylex fml_lex
12: #define yyerror fml_error
13: #define yychar fml_char
14: #define yyval fml_val
15: #define yylval fml_lval
16: #define yydebug fml_debug
17: #define yynerrs fml_nerrs
18: #define yyerrflag fml_errflag
19: #define yyss fml_ss
20: #define yyssp fml_ssp
21: #define yyvs fml_vs
22: #define yyvsp fml_vsp
23: #define yylhs fml_lhs
24: #define yylen fml_len
25: #define yydefred fml_defred
26: #define yydgoto fml_dgoto
27: #define yysindex fml_sindex
28: #define yyrindex fml_rindex
29: #define yygindex fml_gindex
30: #define yytable fml_table
31: #define yycheck fml_check
32: #define yyname fml_name
33: #define yyrule fml_rule
34: #define YYPREFIX "fml_"
35: #line 8 "capaFormula.y"
36: #include <stdio.h>
37: #include <ctype.h>
38: #include <string.h>
39: #include <math.h>
40: #include "capaParser.h" /* _symbol structure def */
41: #include "capaCommon.h"
42: #include "capaFunction.h"
43: #include "capaToken.h"
44:
45: #ifdef __hpux
46: #include <stdlib.h>
47: #include <alloca.h>
48: #endif
49:
50: #ifdef FML_DBUG
51: #define FMLDBUG_PR1(xx) { printf(xx); fflush(stdout); }
52: #define FMLDBUG_PR2(xx,yy) { printf(xx,yy); fflush(stdout); }
53: #define FMLDBUG_PR3(xx,yy,zz) { printf(xx,yy,zz); fflush(stdout); }
54: #else
55: #define FMLDBUG_PR1(xx) { }
56: #define FMLDBUG_PR2(xx,yy) { }
57: #define FMLDBUG_PR3(xx,yy,zz) { }
58: #endif
59:
60: #define ADD_op 1
61: #define SUB_op 2
62: #define MUL_op 3
63: #define DIV_op 4
64: #define IDIV_op 5
65: #define NOT_DEFINED_op 9
66:
67: #ifdef YYSTYPE
68: #undef YYSTYPE
69: #endif
70: #define YYSTYPE Symbol_p
71:
72: /* =============================================================== */
73:
74: extern int Func_idx;
75: extern Symbol FuncStack[MAX_FUNC_NEST];
76:
77: double FormulaVal;
78: int FormulaParseOK=1;
79:
80: #line 81 "fma.tab.c"
81: #define F_NUMBER 257
82: #define V_ID 258
83: #define F_ID 259
84: #define EoI 260
85: #define F_ERROR 261
86: #define F_PLUS 262
87: #define F_MINUS 263
88: #define F_MULT 264
89: #define F_DIV 265
90: #define F_MOD 266
91: #define F_POW 267
92: #define F_LPAR 268
93: #define F_RPAR 269
94: #define F_COMMA 270
95: #define YYERRCODE 256
96: short fml_lhs[] = { -1,
97: 0, 1, 1, 1, 1, 1, 2, 2, 2, 2,
98: 3, 3, 5, 5, 4, 4, 4, 4, 4, 4,
99: 4,
100: };
101: short fml_len[] = { 2,
102: 1, 3, 3, 1, 1, 1, 3, 3, 3, 1,
103: 3, 1, 3, 1, 3, 4, 1, 2, 2, 1,
104: 3,
105: };
106: short fml_defred[] = { 0,
107: 6, 20, 17, 0, 5, 0, 0, 0, 0, 0,
108: 0, 0, 12, 0, 19, 18, 0, 0, 0, 0,
109: 0, 0, 0, 15, 0, 0, 21, 0, 0, 0,
110: 0, 0, 11, 16, 0, 0,
111: };
112: short fml_dgoto[] = { 9,
113: 10, 11, 12, 13, 26,
114: };
115: short fml_sindex[] = { -227,
116: 0, 0, 0, -266, 0, -219, -219, -227, 0, -241,
117: -218, -262, 0, -245, 0, 0, -254, -219, -219, -219,
118: -219, -219, -219, 0, -241, -244, 0, -218, -218, -262,
119: -262, -262, 0, 0, -227, -241,
120: };
121: short fml_rindex[] = { 0,
122: 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,
123: 33, 1, 0, 0, 0, 0, 0, 0, 0, 0,
124: 0, 0, 0, 0, -216, 0, 0, 37, 42, 10,
125: 19, 28, 0, 0, 0, -214,
126: };
127: short fml_gindex[] = { 0,
128: -8, 39, 30, -3, 0,
129: };
130: #define YYTABLESIZE 312
131: short fml_table[] = { 17,
132: 10, 14, 15, 16, 23, 25, 1, 18, 19, 7,
133: 1, 2, 3, 4, 27, 5, 6, 7, 8, 33,
134: 18, 19, 8, 24, 34, 35, 36, 9, 1, 2,
135: 3, 4, 4, 5, 6, 7, 2, 2, 3, 4,
136: 8, 3, 6, 7, 0, 20, 21, 22, 8, 30,
137: 31, 32, 14, 14, 13, 13, 28, 29, 0, 0,
138: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
139: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
140: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
141: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
142: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
143: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
145: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
146: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
147: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
148: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
149: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
150: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
151: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
152: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
153: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
154: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
155: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
156: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
157: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
158: 0, 0, 10, 10, 10, 10, 10, 0, 0, 10,
159: 10, 7, 7, 7, 7, 7, 0, 0, 7, 7,
160: 8, 8, 8, 8, 8, 0, 0, 8, 8, 9,
161: 9, 9, 9, 9, 4, 4, 9, 9, 2, 2,
162: 0, 4, 4, 3, 3, 2, 2, 0, 0, 0,
163: 3, 3,
164: };
165: short fml_check[] = { 8,
166: 0, 268, 6, 7, 267, 14, 0, 262, 263, 0,
167: 256, 257, 258, 259, 269, 261, 262, 263, 0, 23,
168: 262, 263, 268, 269, 269, 270, 35, 0, 256, 257,
169: 258, 259, 0, 261, 262, 263, 0, 257, 258, 259,
170: 268, 0, 262, 263, -1, 264, 265, 266, 268, 20,
171: 21, 22, 269, 270, 269, 270, 18, 19, -1, -1,
172: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
173: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
174: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
175: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
176: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
177: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
178: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
179: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
180: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
181: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
182: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
183: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
184: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
185: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
186: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
187: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
188: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
189: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
190: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
191: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
192: -1, -1, 262, 263, 264, 265, 266, -1, -1, 269,
193: 270, 262, 263, 264, 265, 266, -1, -1, 269, 270,
194: 262, 263, 264, 265, 266, -1, -1, 269, 270, 262,
195: 263, 264, 265, 266, 262, 263, 269, 270, 262, 263,
196: -1, 269, 270, 262, 263, 269, 270, -1, -1, -1,
197: 269, 270,
198: };
199: #define YYFINAL 9
200: #ifndef YYDEBUG
201: #define YYDEBUG 0
202: #endif
203: #define YYMAXTOKEN 270
204: #if YYDEBUG
205: char *fml_name[] = {
206: "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
207: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
208: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
209: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
210: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
211: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
212: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"F_NUMBER","V_ID","F_ID","EoI",
213: "F_ERROR","F_PLUS","F_MINUS","F_MULT","F_DIV","F_MOD","F_POW","F_LPAR","F_RPAR",
214: "F_COMMA",
215: };
216: char *fml_rule[] = {
217: "$accept : f_expr",
218: "f_expr : block",
219: "block : block F_PLUS term",
220: "block : block F_MINUS term",
221: "block : term",
222: "block : F_ERROR",
223: "block : error",
224: "term : term F_MULT basic_constr",
225: "term : term F_DIV basic_constr",
226: "term : term F_MOD basic_constr",
227: "term : basic_constr",
228: "basic_constr : basic_constr F_POW basic_item",
229: "basic_constr : basic_item",
230: "arg_list : arg_list F_COMMA block",
231: "arg_list : block",
232: "basic_item : F_ID F_LPAR F_RPAR",
233: "basic_item : F_ID F_LPAR arg_list F_RPAR",
234: "basic_item : V_ID",
235: "basic_item : F_MINUS basic_item",
236: "basic_item : F_PLUS basic_item",
237: "basic_item : F_NUMBER",
238: "basic_item : F_LPAR block F_RPAR",
239: };
240: #endif
241: #ifndef YYSTYPE
242: typedef int YYSTYPE;
243: #endif
244: #ifdef YYSTACKSIZE
245: #undef YYMAXDEPTH
246: #define YYMAXDEPTH YYSTACKSIZE
247: #else
248: #ifdef YYMAXDEPTH
249: #define YYSTACKSIZE YYMAXDEPTH
250: #else
251: #define YYSTACKSIZE 500
252: #define YYMAXDEPTH 500
253: #endif
254: #endif
255: int yydebug;
256: int yynerrs;
257: int yyerrflag;
258: int yychar;
259: short *yyssp;
260: YYSTYPE *yyvsp;
261: YYSTYPE yyval;
262: YYSTYPE yylval;
263: short yyss[YYSTACKSIZE];
264: YYSTYPE yyvs[YYSTACKSIZE];
265: #define yystacksize YYSTACKSIZE
266: #line 155 "capaFormula.y"
267: void
268: fml_error(char *msg)
269: {
270: FormulaParseOK=0;
271: printf("Error Parsing: %s\n",msg);
272:
273: }
274: /* ---------------------------------------------------- */
275: Symbol *
276: f_symbol_pow(ap,bp) Symbol *ap; Symbol *bp;
277: {
278: Symbol *cp;
279: double a, b;
280: int error = 0;
281:
282: cp = NULL;
283: switch(ap->s_type) {
284: case I_VAR: a = (double)(ap->s_int);
285: break;
286: case I_CONSTANT: a = (double)(ap->s_int); capa_mfree((char *)ap);
287: break;
288: case R_VAR: a = ap->s_real;
289: break;
290: case R_CONSTANT: a = ap->s_real; capa_mfree((char *)ap);
291: break;
292: case S_VAR:
293: case S_CONSTANT:
294: default: error = 1; break;
295: }
296: switch(bp->s_type) {
297: case I_VAR: b = (double)(bp->s_int);
298: break;
299: case I_CONSTANT: b = (double)(bp->s_int); capa_mfree((char *)bp);
300: break;
301: case R_VAR: b = bp->s_real;
302: break;
303: case R_CONSTANT: b = bp->s_real; capa_mfree((char *)bp);
304: break;
305: case S_VAR:
306: case S_CONSTANT:
307: default: error = 1; break;
308: }
309: if (!error) {
310: cp = (Symbol *)capa_malloc(sizeof(Symbol),1);
311: cp->s_type = R_CONSTANT;
312: cp->s_real = pow(a,b);
313:
314: }
315: return (cp);
316: }
317:
318: /* ============================================================================= */
319: #line 320 "fma.tab.c"
320: #define YYABORT goto yyabort
321: #define YYREJECT goto yyabort
322: #define YYACCEPT goto yyaccept
323: #define YYERROR goto yyerrlab
324: int
325: yyparse()
326: {
327: register int yym, yyn, yystate;
328: #if YYDEBUG
329: register char *yys;
330: extern char *getenv();
331:
332: if (yys = getenv("YYDEBUG"))
333: {
334: yyn = *yys;
335: if (yyn >= '0' && yyn <= '9')
336: yydebug = yyn - '0';
337: }
338: #endif
339:
340: yynerrs = 0;
341: yyerrflag = 0;
342: yychar = (-1);
343:
344: yyssp = yyss;
345: yyvsp = yyvs;
346: *yyssp = yystate = 0;
347:
348: yyloop:
349: if (yyn = yydefred[yystate]) goto yyreduce;
350: if (yychar < 0)
351: {
352: if ((yychar = yylex()) < 0) yychar = 0;
353: #if YYDEBUG
354: if (yydebug)
355: {
356: yys = 0;
357: if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
358: if (!yys) yys = "illegal-symbol";
359: printf("%sdebug: state %d, reading %d (%s)\n",
360: YYPREFIX, yystate, yychar, yys);
361: }
362: #endif
363: }
364: if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
365: yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
366: {
367: #if YYDEBUG
368: if (yydebug)
369: printf("%sdebug: state %d, shifting to state %d\n",
370: YYPREFIX, yystate, yytable[yyn]);
371: #endif
372: if (yyssp >= yyss + yystacksize - 1)
373: {
374: goto yyoverflow;
375: }
376: *++yyssp = yystate = yytable[yyn];
377: *++yyvsp = yylval;
378: yychar = (-1);
379: if (yyerrflag > 0) --yyerrflag;
380: goto yyloop;
381: }
382: if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
383: yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
384: {
385: yyn = yytable[yyn];
386: goto yyreduce;
387: }
388: if (yyerrflag) goto yyinrecovery;
389: #ifdef lint
390: goto yynewerror;
391: #endif
392: yynewerror:
393: yyerror("syntax error");
394: #ifdef lint
395: goto yyerrlab;
396: #endif
397: yyerrlab:
398: ++yynerrs;
399: yyinrecovery:
400: if (yyerrflag < 3)
401: {
402: yyerrflag = 3;
403: for (;;)
404: {
405: if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
406: yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
407: {
408: #if YYDEBUG
409: if (yydebug)
410: printf("%sdebug: state %d, error recovery shifting\
411: to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
412: #endif
413: if (yyssp >= yyss + yystacksize - 1)
414: {
415: goto yyoverflow;
416: }
417: *++yyssp = yystate = yytable[yyn];
418: *++yyvsp = yylval;
419: goto yyloop;
420: }
421: else
422: {
423: #if YYDEBUG
424: if (yydebug)
425: printf("%sdebug: error recovery discarding state %d\n",
426: YYPREFIX, *yyssp);
427: #endif
428: if (yyssp <= yyss) goto yyabort;
429: --yyssp;
430: --yyvsp;
431: }
432: }
433: }
434: else
435: {
436: if (yychar == 0) goto yyabort;
437: #if YYDEBUG
438: if (yydebug)
439: {
440: yys = 0;
441: if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
442: if (!yys) yys = "illegal-symbol";
443: printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
444: YYPREFIX, yystate, yychar, yys);
445: }
446: #endif
447: yychar = (-1);
448: goto yyloop;
449: }
450: yyreduce:
451: #if YYDEBUG
452: if (yydebug)
453: printf("%sdebug: state %d, reducing by rule %d (%s)\n",
454: YYPREFIX, yystate, yyn, yyrule[yyn]);
455: #endif
456: yym = yylen[yyn];
457: yyval = yyvsp[1-yym];
458: switch (yyn)
459: {
460: case 1:
461: #line 66 "capaFormula.y"
462: { switch(yyvsp[0]->s_type) {
463: case I_VAR:
464: case I_CONSTANT: FormulaVal = (double)(yyvsp[0]->s_int);
465: break;
466: case R_VAR:
467: case R_CONSTANT: FormulaVal = yyvsp[0]->s_real;
468: break;
469: case S_VAR:
470: case S_CONSTANT: FormulaParseOK = 0;
471: break;
472: default: FormulaParseOK = 0;
473: break;
474: }
475: capa_mfree((char *)yyvsp[0]);
476: FMLDBUG_PR1("[f_expr <= block ]\n");
477: }
478: break;
479: case 2:
480: #line 84 "capaFormula.y"
481: { yyval = symbols_op(yyvsp[-2], yyvsp[0], ADD_op); }
482: break;
483: case 3:
484: #line 85 "capaFormula.y"
485: { yyval = symbols_op(yyvsp[-2], yyvsp[0], SUB_op); }
486: break;
487: case 4:
488: #line 86 "capaFormula.y"
489: { yyval = yyvsp[0]; }
490: break;
491: case 5:
492: #line 87 "capaFormula.y"
493: { FormulaParseOK = 0; FMLDBUG_PR1("[F_ERROR]\n"); return 0;}
494: break;
495: case 6:
496: #line 88 "capaFormula.y"
497: { FormulaParseOK = 0; FMLDBUG_PR1("[ERROR]\n"); return 0; }
498: break;
499: case 7:
500: #line 91 "capaFormula.y"
501: { yyval = symbols_op(yyvsp[-2], yyvsp[0], MUL_op); }
502: break;
503: case 8:
504: #line 92 "capaFormula.y"
505: { yyval = symbols_op(yyvsp[-2], yyvsp[0], DIV_op); }
506: break;
507: case 9:
508: #line 93 "capaFormula.y"
509: { yyval = symbols_op(yyvsp[-2], yyvsp[0], IDIV_op); }
510: break;
511: case 10:
512: #line 94 "capaFormula.y"
513: { yyval = yyvsp[0]; }
514: break;
515: case 11:
516: #line 97 "capaFormula.y"
517: { yyval = f_symbol_pow(yyvsp[-2],yyvsp[0]);
518: FMLDBUG_PR3("[%.16g ^ %.16g] ",yyvsp[-2]->s_real,yyvsp[0]->s_real); }
519: break;
520: case 12:
521: #line 99 "capaFormula.y"
522: { yyval = yyvsp[0]; }
523: break;
524: case 13:
525: #line 102 "capaFormula.y"
526: { yyval = yyvsp[-2];
527: yyval->s_argc++;
528: yyval->s_argp = addto_arglist(yyvsp[-2]->s_argp, yyvsp[0]);
529: }
530: break;
531: case 14:
532: #line 106 "capaFormula.y"
533: { yyval = yyvsp[0];
534: yyval->s_argc = 1;
535: yyval->s_argp = new_arglist(yyvsp[0]);
536: }
537: break;
538: case 15:
539: #line 112 "capaFormula.y"
540: { int tmp;
541:
542: Func_idx--;
543: if(Func_idx >= 0 ) {
544: tmp = match_function(FuncStack[Func_idx].s_name,0);
545: yyval = do_function(tmp, 0, NULL );
546: capa_mfree(FuncStack[Func_idx].s_name);
547: }
548: }
549: break;
550: case 16:
551: #line 121 "capaFormula.y"
552: { int tmp;
553:
554: Func_idx--;
555: if(Func_idx >= 0 ) {
556: tmp = match_function(FuncStack[Func_idx].s_name,yyvsp[-1]->s_argc);
557: yyval = do_function(tmp, yyvsp[-1]->s_argc, yyvsp[-1]->s_argp);
558: capa_mfree(FuncStack[Func_idx].s_name);
559: free_arglist(yyvsp[-1]->s_argp);
560: }
561: }
562: break;
563: case 17:
564: #line 131 "capaFormula.y"
565: { FMLDBUG_PR3("[V %s = %.16g] ",yyvsp[0]->s_name, yyvsp[0]->s_real);
566: yyval = yyvsp[0];
567: }
568: break;
569: case 18:
570: #line 134 "capaFormula.y"
571: { yyval = yyvsp[0];
572: switch(yyvsp[0]->s_type) {
573: case I_VAR: yyval = (Symbol *)capa_malloc(sizeof(Symbol),1);
574: yyval->s_type = I_CONSTANT;
575: case I_CONSTANT: yyval->s_int = - yyvsp[0]->s_int; break;
576: case R_VAR: yyval = (Symbol *)capa_malloc(sizeof(Symbol),1);
577: yyval->s_type = R_CONSTANT;
578: case R_CONSTANT: yyval->s_real = (-1.0)*(yyvsp[0]->s_real);
579: break;
580: case S_VAR:
581: case S_CONSTANT: break;
582: default: break;
583: }
584: }
585: break;
586: case 19:
587: #line 148 "capaFormula.y"
588: { yyval = yyvsp[0]; }
589: break;
590: case 20:
591: #line 149 "capaFormula.y"
592: { FMLDBUG_PR2("[F %.16g] ",yyvsp[0]->s_real);
593: yyval = yyvsp[0];
594: }
595: break;
596: case 21:
597: #line 152 "capaFormula.y"
598: { yyval = yyvsp[-1]; }
599: break;
600: #line 601 "fma.tab.c"
601: }
602: yyssp -= yym;
603: yystate = *yyssp;
604: yyvsp -= yym;
605: yym = yylhs[yyn];
606: if (yystate == 0 && yym == 0)
607: {
608: #if YYDEBUG
609: if (yydebug)
610: printf("%sdebug: after reduction, shifting from state 0 to\
611: state %d\n", YYPREFIX, YYFINAL);
612: #endif
613: yystate = YYFINAL;
614: *++yyssp = YYFINAL;
615: *++yyvsp = yyval;
616: if (yychar < 0)
617: {
618: if ((yychar = yylex()) < 0) yychar = 0;
619: #if YYDEBUG
620: if (yydebug)
621: {
622: yys = 0;
623: if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
624: if (!yys) yys = "illegal-symbol";
625: printf("%sdebug: state %d, reading %d (%s)\n",
626: YYPREFIX, YYFINAL, yychar, yys);
627: }
628: #endif
629: }
630: if (yychar == 0) goto yyaccept;
631: goto yyloop;
632: }
633: if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
634: yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
635: yystate = yytable[yyn];
636: else
637: yystate = yydgoto[yym];
638: #if YYDEBUG
639: if (yydebug)
640: printf("%sdebug: after reduction, shifting from state %d \
641: to state %d\n", YYPREFIX, *yyssp, yystate);
642: #endif
643: if (yyssp >= yyss + yystacksize - 1)
644: {
645: goto yyoverflow;
646: }
647: *++yyssp = yystate;
648: *++yyvsp = yyval;
649: goto yyloop;
650: yyoverflow:
651: yyerror("yacc stack overflow");
652: yyabort:
653: return (1);
654: yyaccept:
655: return (0);
656: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>