|
|
1.1 root 1: # define xxif 300
2: # define xxelse 301
3: # define xxwhile 302
4: # define xxrept 303
5: # define xxdo 304
6: # define xxrb 305
7: # define xxpred 306
8: # define xxident 307
9: # define xxle 308
10: # define xxge 309
11: # define xxne 310
12: # define xxnum 311
13: # define xxcom 312
14: # define xxstring 313
15: # define xxexplist 314
16: # define xxidpar 315
17: # define xxelseif 316
18: # define xxlb 318
19: # define xxend 319
20: # define xxcase 320
21: # define xxswitch 321
22: # define xxuntil 322
23: # define xxdefault 323
24: # define xxeq 324
25: # define xxuminus 281
26:
27: # line 17 "beauty.y"
28: #include "b.h"
29: #include <stdio.h>
30: #define yyclearin yychar = -1
31: #define yyerrok yyerrflag = 0
32: extern int yychar;
33: extern short yyerrflag;
34: #ifndef YYMAXDEPTH
35: #define YYMAXDEPTH 150
36: #endif
37: #ifndef YYSTYPE
38: #define YYSTYPE int
39: #endif
40: YYSTYPE yylval, yyval;
41:
42: # line 23 "beauty.y"
43: struct node *t;
44: # define YYERRCODE 256
45:
46: # line 229 "beauty.y"
47:
48: #define ASSERT(X,Y) if (!(X)) error("struct bug: assertion 'X' invalid in routine Y","","");
49:
50: yyerror(s)
51: char *s;
52: {
53: extern int yychar;
54: fprintf(stderr,"\n%s",s);
55: fprintf(stderr," in beautifying, output line %d,",xxlineno + 1);
56: fprintf(stderr," on input: ");
57: switch (yychar) {
58: case '\t': fprintf(stderr,"\\t\n"); return;
59: case '\n': fprintf(stderr,"\\n\n"); return;
60: case '\0': fprintf(stderr,"$end\n"); return;
61: default: fprintf(stderr,"%c\n",yychar); return;
62: }
63: }
64:
65: yyinit(argc, argv) /* initialize pushdown store */
66: int argc;
67: char *argv[];
68: {
69: xxindent = 0;
70: xxbpertab = 8;
71: xxmaxchars = 120;
72: }
73:
74:
75: #include <signal.h>
76: main()
77: {
78: int exit();
79: if ( signal(SIGINT, SIG_IGN) != SIG_IGN)
80: signal(SIGINT, exit);
81: yyinit();
82: yyparse();
83: }
84:
85:
86: putout(type,string) /* output string with proper indentation */
87: int type;
88: char *string;
89: {
90: static int lasttype;
91: if ( (lasttype != 0) && (lasttype != '\n') && (lasttype != ' ') && (lasttype != '\t') && (type == xxcom))
92: accum("\t");
93: else if (lasttype == xxcom && type != '\n')
94: tab(xxindent);
95: else
96: if (lasttype == xxif ||
97: lasttype == xxwhile ||
98: lasttype == xxdo ||
99: type == '=' ||
100: lasttype == '=' ||
101: (lasttype == xxident && (type == xxident || type == xxnum) ) ||
102: (lasttype == xxnum && type == xxnum) )
103: accum(" ");
104: accum(string);
105: lasttype = type;
106: }
107:
108:
109: accum(token) /* fill output buffer, generate continuation lines */
110: char *token;
111: {
112: static char *buffer;
113: static int lstatus,llen,bufind;
114: int tstatus,tlen,i;
115:
116: #define NEW 0
117: #define MID 1
118: #define CONT 2
119:
120: if (buffer == 0)
121: {
122: buffer = malloc(xxmaxchars);
123: if (buffer == 0) error("malloc out of space","","");
124: }
125: tlen = slength(token);
126: if (tlen == 0) return;
127: for (i = 0; i < tlen; ++i)
128: ASSERT(token[i] != '\n' || tlen == 1,accum);
129: switch(token[tlen-1])
130: {
131: case '\n': tstatus = NEW;
132: break;
133: case '+':
134: case '-':
135: case '*':
136: case ',':
137: case '|':
138: case '&':
139: case '(': tstatus = CONT;
140: break;
141: default: tstatus = MID;
142: }
143: if (llen + bufind + tlen > xxmaxchars && lstatus == CONT && tstatus != NEW)
144: {
145: putchar('\n');
146: ++xxlineno;
147: for (i = 0; i < xxindent; ++i)
148: putchar('\t');
149: putchar(' ');putchar(' ');
150: llen = 2 + xxindent * xxbpertab;
151: lstatus = NEW;
152: }
153: if (lstatus == CONT && tstatus == MID)
154: { /* store in buffer in case need \n after last CONT char */
155: ASSERT(bufind + tlen < xxmaxchars,accum);
156: for (i = 0; i < tlen; ++i)
157: buffer[bufind++] = token[i];
158: }
159: else
160: {
161: for (i = 0; i < bufind; ++i)
162: putchar(buffer[i]);
163: llen += bufind;
164: bufind = 0;
165: for (i = 0; i < tlen; ++i)
166: putchar(token[i]);
167: if (tstatus == NEW) ++xxlineno;
168: llen = (tstatus == NEW) ? 0 : llen + tlen;
169: lstatus = tstatus;
170: }
171: }
172:
173: tab(n)
174: int n;
175: {
176: int i;
177: newline();
178: for ( i = 0; i < n; ++i)
179: putout('\t',"\t");
180: }
181:
182: newline()
183: {
184: static int already;
185: if (already)
186: putout('\n',"\n");
187: else
188: already = 1;
189: }
190:
191: error(mess1, mess2, mess3)
192: char *mess1, *mess2, *mess3;
193: {
194: fprintf(stderr,"\nerror in beautifying, output line %d: %s %s %s \n",
195: xxlineno, mess1, mess2, mess3);
196: exit(1);
197: }
198:
199:
200:
201:
202:
203:
204:
205: push(type)
206: int type;
207: {
208: if (++xxstind > xxtop)
209: error("nesting too deep, stack overflow","","");
210: xxstack[xxstind] = type;
211: }
212:
213: pop()
214: {
215: if (xxstind <= 0)
216: error("stack exhausted, can't be popped as requested","","");
217: --xxstind;
218: }
219:
220:
221: forst()
222: {
223: while( (xxval = yylex()) != '\n')
224: {
225: putout(xxval, yylval);
226: free(yylval);
227: }
228: free(yylval);
229: }
230: short yyexca[] ={
231: -1, 0,
232: 312, 17,
233: -2, 16,
234: -1, 1,
235: 0, -1,
236: -2, 0,
237: -1, 2,
238: 0, 18,
239: 312, 17,
240: -2, 16,
241: -1, 6,
242: 312, 17,
243: -2, 16,
244: -1, 7,
245: 312, 17,
246: -2, 16,
247: -1, 29,
248: 312, 17,
249: -2, 16,
250: -1, 36,
251: 312, 17,
252: -2, 16,
253: -1, 47,
254: 322, 16,
255: -2, 66,
256: -1, 95,
257: 308, 0,
258: 309, 0,
259: 310, 0,
260: 324, 0,
261: 60, 0,
262: 62, 0,
263: -2, 52,
264: -1, 96,
265: 308, 0,
266: 309, 0,
267: 310, 0,
268: 324, 0,
269: 60, 0,
270: 62, 0,
271: -2, 53,
272: -1, 97,
273: 308, 0,
274: 309, 0,
275: 310, 0,
276: 324, 0,
277: 60, 0,
278: 62, 0,
279: -2, 54,
280: -1, 98,
281: 308, 0,
282: 309, 0,
283: 310, 0,
284: 324, 0,
285: 60, 0,
286: 62, 0,
287: -2, 55,
288: -1, 99,
289: 308, 0,
290: 309, 0,
291: 310, 0,
292: 324, 0,
293: 60, 0,
294: 62, 0,
295: -2, 56,
296: -1, 100,
297: 308, 0,
298: 309, 0,
299: 310, 0,
300: 324, 0,
301: 60, 0,
302: 62, 0,
303: -2, 57,
304: -1, 106,
305: 312, 17,
306: -2, 16,
307: -1, 112,
308: 312, 17,
309: 125, 23,
310: -2, 16,
311: -1, 128,
312: 312, 17,
313: -2, 16,
314: -1, 132,
315: 312, 17,
316: 320, 21,
317: 323, 21,
318: 125, 21,
319: -2, 16,
320: -1, 134,
321: 312, 17,
322: 320, 21,
323: 323, 21,
324: 125, 21,
325: -2, 16,
326: -1, 135,
327: 312, 17,
328: 320, 21,
329: 323, 21,
330: 125, 21,
331: -2, 16,
332: };
333: # define YYNPROD 77
334: # define YYLAST 384
335: short yyact[]={
336:
337: 67, 31, 105, 56, 63, 61, 115, 62, 67, 64,
338: 11, 41, 63, 61, 109, 62, 121, 64, 38, 122,
339: 34, 40, 69, 39, 68, 11, 11, 31, 45, 58,
340: 69, 67, 68, 8, 101, 63, 61, 87, 62, 67,
341: 64, 36, 60, 63, 61, 31, 62, 112, 64, 11,
342: 33, 111, 2, 69, 65, 68, 65, 102, 6, 29,
343: 84, 69, 5, 68, 65, 133, 67, 129, 52, 16,
344: 63, 61, 108, 62, 67, 64, 51, 78, 63, 61,
345: 24, 62, 30, 64, 63, 104, 66, 65, 69, 64,
346: 68, 82, 54, 120, 66, 65, 69, 3, 68, 42,
347: 14, 63, 61, 126, 62, 32, 64, 22, 23, 28,
348: 81, 119, 27, 7, 15, 21, 49, 66, 20, 69,
349: 19, 68, 65, 80, 26, 66, 25, 14, 53, 18,
350: 65, 55, 46, 17, 59, 50, 65, 85, 57, 4,
351: 114, 106, 13, 9, 63, 61, 114, 62, 1, 64,
352: 0, 0, 66, 65, 0, 0, 0, 114, 9, 9,
353: 0, 0, 128, 131, 118, 123, 0, 116, 132, 113,
354: 136, 130, 137, 138, 117, 113, 103, 127, 22, 23,
355: 28, 134, 0, 27, 0, 135, 113, 10, 0, 0,
356: 0, 0, 0, 37, 0, 26, 65, 25, 12, 56,
357: 125, 0, 10, 10, 35, 0, 0, 0, 0, 0,
358: 0, 0, 0, 12, 12, 74, 75, 76, 77, 110,
359: 0, 0, 0, 47, 48, 0, 0, 0, 0, 83,
360: 0, 0, 14, 14, 0, 0, 0, 0, 88, 89,
361: 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
362: 100, 79, 0, 0, 0, 0, 0, 0, 0, 0,
363: 0, 107, 86, 0, 0, 0, 0, 0, 0, 0,
364: 71, 72, 73, 0, 0, 0, 0, 0, 71, 72,
365: 73, 0, 0, 0, 0, 45, 70, 0, 0, 43,
366: 0, 44, 124, 0, 70, 0, 0, 0, 0, 0,
367: 0, 71, 72, 73, 0, 0, 0, 0, 0, 71,
368: 72, 73, 0, 0, 0, 0, 0, 70, 0, 0,
369: 0, 0, 0, 0, 0, 70, 0, 0, 0, 0,
370: 0, 0, 0, 0, 0, 0, 71, 72, 73, 0,
371: 0, 0, 0, 0, 71, 72, 73, 0, 0, 0,
372: 0, 0, 70, 0, 0, 0, 0, 0, 0, 0,
373: 70, 0, 0, 0, 0, 0, 0, 71, 72, 73,
374: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
375: 0, 0, 0, 70 };
376: short yypact[]={
377:
378: -97,-1000, -97,-1000, 29,-195, -98, -97,-292,-1000,
379: -1000,-1000,-1000,-1000,-1000,-1000, -22, 29,-1000,-1000,
380: 29,-1000,-1000,-1000, 24,-1000,-1000,-1000,-279, -97,
381: -1000,-1000,-1000,-113,-1000,-272, -97, 1, -22, -22,
382: -22, -22,-1000,-1000,-1000, 37,-1000,-1000,-1000,-1000,
383: -1000,-1000, -22, -1,-124,-1000,-1000,-1000,-1000,-1000,
384: -1000, -22, -22, -22, -22, -22, -22, -22, -22, -22,
385: -22, -22, -22, -22, -7, -40, -40, 59, -22,-1000,
386: -1000,-320, -74, 28, -22,-1000,-1000,-1000, 42, 42,
387: -40, -40, -40, 36, 59, 102, 102, 102, 102, 102,
388: 102,-1000, 31, -30, 29,-1000,-1000, -38,-1000, -22,
389: -1000,-1000,-1000,-304,-292, -22,-1000, -80,-1000, -22,
390: -1000,-1000, 9,-309, 28,-1000,-1000, 7, -97,-1000,
391: -1000,-1000, -97,-1000, -97, -97,-1000,-1000,-1000 };
392: short yypgo[]={
393:
394: 0, 148, 52, 142, 97, 139, 114, 204, 138, 62,
395: 133, 129, 123, 120, 118, 116, 41, 58, 51, 82,
396: 37, 115, 113, 33, 50, 47, 111, 103, 93, 99,
397: 57, 176, 85, 80, 76 };
398: short yyr1[]={
399:
400: 0, 1, 2, 2, 4, 4, 4, 4, 4, 4,
401: 4, 4, 4, 4, 4, 4, 9, 23, 3, 7,
402: 16, 20, 18, 18, 25, 25, 25, 25, 26, 28,
403: 14, 21, 21, 29, 29, 27, 30, 30, 15, 15,
404: 6, 31, 31, 31, 31, 31, 31, 31, 31, 31,
405: 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
406: 31, 5, 8, 10, 11, 12, 12, 32, 13, 33,
407: 34, 34, 17, 19, 22, 24, 24 };
408: short yyr2[]={
409:
410: 0, 2, 1, 2, 5, 3, 4, 4, 3, 9,
411: 2, 4, 2, 2, 3, 1, 0, 0, 0, 3,
412: 0, 0, 2, 1, 6, 5, 5, 3, 1, 2,
413: 1, 1, 1, 4, 1, 2, 3, 1, 1, 0,
414: 3, 3, 2, 2, 2, 3, 3, 3, 3, 3,
415: 3, 3, 3, 3, 3, 3, 3, 3, 1, 1,
416: 1, 1, 1, 1, 1, 3, 0, 1, 2, 6,
417: 2, 0, 1, 1, 1, 1, 2 };
418: short yychk[]={
419:
420: -1000, -1, -2, -4, -5, -9, -17, -22, -23, 256,
421: 300, 123, 311, -3, -4, -6, 40, -10, -11, -13,
422: -14, -21, 302, 303, -33, 321, 319, 307, 304, -2,
423: -19, 125, -4, -24, 312, -7, -16, -31, 40, 45,
424: 43, 33, -29, 311, 313, 307, -6, -7, -7, -15,
425: -6, -34, 44, -29, -9, -4, 312, -8, 301, -4,
426: 41, 43, 45, 42, 47, 94, 124, 38, 62, 60,
427: 324, 308, 309, 310, -31, -31, -31, -31, 40, -7,
428: -12, -9, -16, -31, 61, -19, -7, -20, -31, -31,
429: -31, -31, -31, -31, -31, -31, -31, -31, -31, -31,
430: -31, 41, -30, -31, -32, 322, -17, -31, 41, 44,
431: -6, -18, -25, -9, -23, 44, -30, -9, -18, -26,
432: -28, 320, 323, -24, -31, -19, -27, -30, -16, 58,
433: -25, -20, -16, 58, -2, -2, -20, -20, -20 };
434: short yydef[]={
435:
436: -2, -2, -2, 2, 0, 0, -2, -2, 0, 15,
437: 61, 72, 74, 1, 3, 20, 0, 0, 20, 20,
438: 39, 10, 63, 64, 71, 30, 31, 32, 0, -2,
439: 12, 73, 13, 16, 75, 5, -2, 0, 0, 0,
440: 0, 0, 58, 59, 60, 34, 20, -2, 8, 20,
441: 38, 68, 0, 0, 0, 14, 76, 20, 62, 21,
442: 40, 0, 0, 0, 0, 0, 0, 0, 0, 0,
443: 0, 0, 0, 0, 0, 42, 43, 44, 0, 6,
444: 7, 0, 0, 70, 0, 11, 4, 19, 45, 46,
445: 47, 48, 49, 50, 51, -2, -2, -2, -2, -2,
446: -2, 41, 0, 37, 0, 67, -2, 0, 33, 0,
447: 65, 16, -2, 0, 0, 0, 36, 0, 22, 0,
448: 20, 28, 0, 16, 69, 21, 20, 0, -2, 29,
449: 27, 9, -2, 35, -2, -2, 25, 26, 24 };
450: #
451: # define YYFLAG -1000
452: # define YYERROR goto yyerrlab
453: # define YYACCEPT return(0)
454: # define YYABORT return(1)
455:
456: /* parser for yacc output */
457:
458: #ifdef YYDEBUG
459: int yydebug = 0; /* 1 for debugging */
460: #endif
461: YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
462: int yychar = -1; /* current input token number */
463: int yynerrs = 0; /* number of errors */
464: short yyerrflag = 0; /* error recovery flag */
465:
466: yyparse() {
467:
468: short yys[YYMAXDEPTH];
469: short yyj, yym;
470: register YYSTYPE *yypvt;
471: register short yystate, *yyps, yyn;
472: register YYSTYPE *yypv;
473: register short *yyxi;
474:
475: yystate = 0;
476: yychar = -1;
477: yynerrs = 0;
478: yyerrflag = 0;
479: yyps= &yys[-1];
480: yypv= &yyv[-1];
481:
482: yystack: /* put a state and value onto the stack */
483:
484: #ifdef YYDEBUG
485: if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar );
486: #endif
487: if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
488: *yyps = yystate;
489: ++yypv;
490: *yypv = yyval;
491:
492: yynewstate:
493:
494: yyn = yypact[yystate];
495:
496: if( yyn<= YYFLAG ) goto yydefault; /* simple state */
497:
498: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
499: if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
500:
501: if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
502: yychar = -1;
503: yyval = yylval;
504: yystate = yyn;
505: if( yyerrflag > 0 ) --yyerrflag;
506: goto yystack;
507: }
508:
509: yydefault:
510: /* default state action */
511:
512: if( (yyn=yydef[yystate]) == -2 ) {
513: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
514: /* look through exception table */
515:
516: for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
517:
518: while( *(yyxi+=2) >= 0 ){
519: if( *yyxi == yychar ) break;
520: }
521: if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */
522: }
523:
524: if( yyn == 0 ){ /* error */
525: /* error ... attempt to resume parsing */
526:
527: switch( yyerrflag ){
528:
529: case 0: /* brand new error */
530:
531: yyerror( "syntax error" );
532: yyerrlab:
533: ++yynerrs;
534:
535: case 1:
536: case 2: /* incompletely recovered error ... try again */
537:
538: yyerrflag = 3;
539:
540: /* find a state where "error" is a legal shift action */
541:
542: while ( yyps >= yys ) {
543: yyn = yypact[*yyps] + YYERRCODE;
544: if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
545: yystate = yyact[yyn]; /* simulate a shift of "error" */
546: goto yystack;
547: }
548: yyn = yypact[*yyps];
549:
550: /* the current yyps has no shift onn "error", pop stack */
551:
552: #ifdef YYDEBUG
553: if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
554: #endif
555: --yyps;
556: --yypv;
557: }
558:
559: /* there is no state on the stack with an error shift ... abort */
560:
561: yyabort:
562: return(1);
563:
564:
565: case 3: /* no shift yet; clobber input char */
566:
567: #ifdef YYDEBUG
568: if( yydebug ) printf( "error recovery discards char %d\n", yychar );
569: #endif
570:
571: if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
572: yychar = -1;
573: goto yynewstate; /* try again in the same state */
574:
575: }
576:
577: }
578:
579: /* reduction by production yyn */
580:
581: #ifdef YYDEBUG
582: if( yydebug ) printf("reduce %d\n",yyn);
583: #endif
584: yyps -= yyr2[yyn];
585: yypvt = yypv;
586: yypv -= yyr2[yyn];
587: yyval = yypv[1];
588: yym=yyn;
589: /* consult goto table to find next state */
590: yyn = yyr1[yyn];
591: yyj = yypgo[yyn] + *yyps + 1;
592: if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
593: switch(yym){
594:
595: case 16:
596: # line 49 "beauty.y"
597: {
598: if (!xxlablast) tab(xxindent);
599: xxlablast = 0;
600: } break;
601: case 17:
602: # line 54 "beauty.y"
603: newline(); break;
604: case 18:
605: # line 55 "beauty.y"
606: putout('\n',"\n"); break;
607: case 20:
608: # line 57 "beauty.y"
609:
610: {
611: if (xxstack[xxstind] != xxlb)
612: ++xxindent;
613: } break;
614: case 21:
615: # line 62 "beauty.y"
616:
617: {if (xxstack[xxstind] != xxlb && xxstack[xxstind] != xxelseif)
618: --xxindent;
619: pop();
620: } break;
621: case 28:
622: # line 77 "beauty.y"
623: {putout(xxcase,"case "); free (yypvt[-0]); push(xxcase); } break;
624: case 29:
625: # line 80 "beauty.y"
626: {
627: putout(xxcase,"default");
628: free(yypvt[-1]);
629: putout(':',":");
630: free(yypvt[-0]);
631: push(xxcase);
632: } break;
633: case 30:
634: # line 87 "beauty.y"
635: {putout(xxswitch,"switch"); free(yypvt[-0]); push(xxswitch); } break;
636: case 31:
637: # line 89 "beauty.y"
638: {
639: free(yypvt[-0]);
640: putout(xxident,"end");
641: putout('\n',"\n");
642: putout('\n',"\n");
643: putout('\n',"\n");
644: } break;
645: case 32:
646: # line 96 "beauty.y"
647: {
648: putout(xxident,yypvt[-0]);
649: free(yypvt[-0]);
650: newflag = 1;
651: forst();
652: newflag = 0;
653: } break;
654: case 33:
655: # line 106 "beauty.y"
656: {
657: xxt = addroot(yypvt[-3],xxident,0,0);
658: yyval = addroot("",xxidpar,xxt,yypvt[-1]);
659: } break;
660: case 34:
661: # line 111 "beauty.y"
662: yyval = addroot(yypvt[-0],xxident,0,0); break;
663: case 35:
664: # line 114 "beauty.y"
665: {
666: yield(yypvt[-1],0);
667: putout(':',":");
668: freetree(yypvt[-1]);
669: } break;
670: case 36:
671: # line 119 "beauty.y"
672: yyval = addroot(yypvt[-1],xxexplist,checkneg(yypvt[-2],0),yypvt[-0]); break;
673: case 37:
674: # line 120 "beauty.y"
675: yyval = checkneg(yypvt[-0],0); break;
676: case 40:
677: # line 128 "beauty.y"
678: { t = checkneg(yypvt[-1],0);
679: yield(t,100); freetree(t); } break;
680: case 41:
681: # line 131 "beauty.y"
682: yyval = yypvt[-1]; break;
683: case 42:
684: # line 132 "beauty.y"
685: yyval = addroot(yypvt[-1],xxuminus,yypvt[-0],0); break;
686: case 43:
687: # line 133 "beauty.y"
688: yyval = yypvt[-0]; break;
689: case 44:
690: # line 134 "beauty.y"
691: yyval = addroot(yypvt[-1],'!',yypvt[-0],0); break;
692: case 45:
693: # line 135 "beauty.y"
694: yyval = addroot(yypvt[-1],'+',yypvt[-2],yypvt[-0]); break;
695: case 46:
696: # line 136 "beauty.y"
697: yyval = addroot(yypvt[-1],'-',yypvt[-2],yypvt[-0]); break;
698: case 47:
699: # line 137 "beauty.y"
700: yyval = addroot(yypvt[-1],'*',yypvt[-2],yypvt[-0]); break;
701: case 48:
702: # line 138 "beauty.y"
703: yyval = addroot(yypvt[-1],'/',yypvt[-2],yypvt[-0]); break;
704: case 49:
705: # line 139 "beauty.y"
706: yyval = addroot(yypvt[-1],'^',yypvt[-2],yypvt[-0]); break;
707: case 50:
708: # line 140 "beauty.y"
709: yyval = addroot(yypvt[-1],'|',yypvt[-2],yypvt[-0]); break;
710: case 51:
711: # line 141 "beauty.y"
712: yyval = addroot(yypvt[-1],'&',yypvt[-2],yypvt[-0]); break;
713: case 52:
714: # line 142 "beauty.y"
715: yyval = addroot(yypvt[-1],'>',yypvt[-2],yypvt[-0]); break;
716: case 53:
717: # line 143 "beauty.y"
718: yyval = addroot(yypvt[-1],'<',yypvt[-2],yypvt[-0]); break;
719: case 54:
720: # line 144 "beauty.y"
721: yyval = addroot(yypvt[-1],xxeq,yypvt[-2],yypvt[-0]); break;
722: case 55:
723: # line 145 "beauty.y"
724: yyval = addroot(yypvt[-1],xxle,yypvt[-2],yypvt[-0]); break;
725: case 56:
726: # line 146 "beauty.y"
727: yyval = addroot(yypvt[-1],xxge,yypvt[-2],yypvt[-0]); break;
728: case 57:
729: # line 147 "beauty.y"
730: yyval = addroot(yypvt[-1],xxne,yypvt[-2],yypvt[-0]); break;
731: case 58:
732: # line 148 "beauty.y"
733: yyval = yypvt[-0]; break;
734: case 59:
735: # line 149 "beauty.y"
736: yyval = addroot(yypvt[-0],xxnum,0,0); break;
737: case 60:
738: # line 150 "beauty.y"
739: yyval = addroot(yypvt[-0],xxstring,0,0); break;
740: case 61:
741: # line 153 "beauty.y"
742:
743: {
744: if (xxstack[xxstind] == xxelse && !xxlablast)
745: {
746: --xxindent;
747: xxstack[xxstind] = xxelseif;
748: putout(' '," ");
749: }
750: else
751: {
752: if (!xxlablast)
753: tab(xxindent);
754: xxlablast = 0;
755: }
756: putout(xxif,"if");
757: free(yypvt[-0]);
758: push(xxif);
759: } break;
760: case 62:
761: # line 171 "beauty.y"
762:
763: {
764: tab(xxindent);
765: putout(xxelse,"else");
766: free(yypvt[-0]);
767: push(xxelse);
768: } break;
769: case 63:
770: # line 178 "beauty.y"
771: {
772: putout(xxwhile,"while");
773: free(yypvt[-0]);
774: push(xxwhile);
775: } break;
776: case 64:
777: # line 183 "beauty.y"
778: {
779: putout(xxrept,"repeat");
780: free(yypvt[-0]);
781: push(xxrept);
782: } break;
783: case 67:
784: # line 192 "beauty.y"
785: {
786: putout('\t',"\t");
787: putout(xxuntil,"until");
788: free(yypvt[-0]);
789: } break;
790: case 69:
791: # line 199 "beauty.y"
792:
793: {push(xxdo);
794: putout(xxdo,"do");
795: free(yypvt[-5]);
796: puttree(yypvt[-4]);
797: putout('=',"=");
798: free(yypvt[-3]);
799: puttree(yypvt[-2]);
800: putout(',',",");
801: free(yypvt[-1]);
802: puttree(yypvt[-0]);
803: } break;
804: case 70:
805: # line 211 "beauty.y"
806: {
807: putout(',',",");
808: puttree(yypvt[-0]);
809: } break;
810: case 72:
811: # line 216 "beauty.y"
812: {
813: putout('{'," {");
814: push(xxlb);
815: } break;
816: case 73:
817: # line 220 "beauty.y"
818: { putout('}',"}"); pop(); } break;
819: case 74:
820: # line 221 "beauty.y"
821: {
822: tab(xxindent);
823: putout(xxnum,yypvt[-0]);
824: putout(' '," ");
825: xxlablast = 1;
826: } break;
827: case 75:
828: # line 227 "beauty.y"
829: { putout(xxcom,yypvt[-0]); free(yypvt[-0]); xxlablast = 0; } break;
830: case 76:
831: # line 228 "beauty.y"
832: { putout ('\n',"\n"); putout(xxcom,yypvt[-0]); free(yypvt[-0]); xxlablast = 0; } break;
833: }
834: goto yystack; /* stack new state and value */
835:
836: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.