|
|
1.1 root 1:
2: # line 3 "r.g"
3: extern int transfer;
4: extern int indent;
5: # define IF 257
6: # define ELSE 258
7: # define FOR 259
8: # define WHILE 260
9: # define BREAK 261
10: # define NEXT 262
11: # define DIGITS 263
12: # define DO 264
13: # define GOK 265
14: # define DEFINE 266
15: # define INCLUDE 267
16: # define REPEAT 268
17: # define UNTIL 269
18: # define RETURN 270
19: # define SWITCH 271
20: # define CASE 272
21: # define DEFAULT 273
22: #define yyclearin yychar = -1
23: #define yyerrok yyerrflag = 0
24: extern int yychar;
25: extern short yyerrflag;
26: #ifndef YYMAXDEPTH
27: #define YYMAXDEPTH 150
28: #endif
29: #ifndef YYSTYPE
30: #define YYSTYPE int
31: #endif
32: YYSTYPE yylval, yyval;
33: # define YYERRCODE 256
34:
35: # line 67 "r.g"
36:
37: short yyexca[] ={
38: -1, 1,
39: 0, -1,
40: -2, 0,
41: };
42: # define YYNPROD 36
43: # define YYLAST 229
44: short yyact[]={
45:
46: 14, 32, 45, 32, 47, 40, 41, 39, 1, 30,
47: 2, 31, 44, 42, 26, 27, 14, 33, 34, 35,
48: 29, 19, 36, 16, 37, 11, 8, 38, 7, 6,
49: 28, 5, 4, 3, 0, 0, 0, 0, 0, 43,
50: 46, 0, 0, 0, 0, 0, 0, 0, 0, 0,
51: 0, 0, 0, 49, 0, 0, 0, 0, 0, 0,
52: 0, 0, 0, 0, 15, 0, 48, 0, 0, 0,
53: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
54: 15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
55: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
58: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
59: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
60: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
65: 0, 0, 0, 0, 0, 0, 0, 17, 18, 0,
66: 21, 20, 9, 10, 24, 23, 12, 0, 0, 22,
67: 0, 13, 25, 17, 18, 0, 21, 20, 9, 10,
68: 24, 23, 12, 0, 0, 22, 0, 13, 25 };
69: short yypact[]={
70:
71: -1000, -43,-1000, -43, -43,-269, -43, -43, -43,-1000,
72: -1000, -43,-1000,-1000,-1000,-1000, -43,-1000,-1000,-116,
73: -1000,-1000,-1000,-1000,-1000,-1000,-253,-1000,-119,-271,
74: -1000,-1000,-1000,-1000,-1000,-265,-1000, -59,-1000,-1000,
75: -1000,-1000,-1000,-1000,-1000,-1000, -43,-1000,-1000, -43 };
76: short yypgo[]={
77:
78: 0, 8, 10, 33, 32, 31, 30, 29, 28, 26,
79: 25, 23, 21, 20, 13, 9, 12, 11 };
80: short yyr1[]={
81:
82: 0, 1, 1, 2, 2, 2, 2, 2, 2, 2,
83: 2, 2, 2, 2, 2, 2, 2, 2, 2, 5,
84: 12, 6, 6, 13, 13, 14, 16, 15, 17, 11,
85: 3, 4, 7, 8, 9, 10 };
86: short yyr2[]={
87:
88: 0, 2, 0, 2, 2, 3, 2, 2, 3, 2,
89: 1, 1, 2, 1, 1, 1, 3, 2, 1, 2,
90: 1, 1, 2, 1, 2, 2, 1, 2, 1, 1,
91: 1, 3, 1, 1, 1, 1 };
92: short yychk[]={
93:
94: -1000, -1, -2, -3, -4, -5, -7, -8, -9, 261,
95: 262, -10, 265, 270, 59, 123, -11, 256, 257, -12,
96: 260, 259, 268, 264, 263, 271, -2, -2, -6, -13,
97: -15, -17, 272, -2, -2, -2, -2, -1, -2, 123,
98: 258, 125, -14, -15, -16, 273, -1, 269, 125, -1 };
99: short yydef[]={
100:
101: 2, -2, 1, 0, 0, 0, 0, 0, 0, 10,
102: 11, 0, 13, 14, 15, 2, 0, 18, 30, 0,
103: 32, 33, 34, 35, 29, 20, 3, 4, 0, 21,
104: 23, 2, 28, 6, 7, 9, 12, 0, 17, 19,
105: 31, 5, 22, 24, 2, 26, 27, 8, 16, 25 };
106: #ifndef lint
107: static char yaccpar_sccsid[] = "@(#)yaccpar 4.1 (Berkeley) 2/11/83";
108: #endif not lint
109:
110: #
111: # define YYFLAG -1000
112: # define YYERROR goto yyerrlab
113: # define YYACCEPT return(0)
114: # define YYABORT return(1)
115:
116: /* parser for yacc output */
117:
118: #ifdef YYDEBUG
119: int yydebug = 0; /* 1 for debugging */
120: #endif
121: YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
122: int yychar = -1; /* current input token number */
123: int yynerrs = 0; /* number of errors */
124: short yyerrflag = 0; /* error recovery flag */
125:
126: yyparse() {
127:
128: short yys[YYMAXDEPTH];
129: short yyj, yym;
130: register YYSTYPE *yypvt;
131: register short yystate, *yyps, yyn;
132: register YYSTYPE *yypv;
133: register short *yyxi;
134:
135: yystate = 0;
136: yychar = -1;
137: yynerrs = 0;
138: yyerrflag = 0;
139: yyps= &yys[-1];
140: yypv= &yyv[-1];
141:
142: yystack: /* put a state and value onto the stack */
143:
144: #ifdef YYDEBUG
145: if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar );
146: #endif
147: if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
148: *yyps = yystate;
149: ++yypv;
150: *yypv = yyval;
151:
152: yynewstate:
153:
154: yyn = yypact[yystate];
155:
156: if( yyn<= YYFLAG ) goto yydefault; /* simple state */
157:
158: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
159: if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
160:
161: if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
162: yychar = -1;
163: yyval = yylval;
164: yystate = yyn;
165: if( yyerrflag > 0 ) --yyerrflag;
166: goto yystack;
167: }
168:
169: yydefault:
170: /* default state action */
171:
172: if( (yyn=yydef[yystate]) == -2 ) {
173: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
174: /* look through exception table */
175:
176: for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
177:
178: while( *(yyxi+=2) >= 0 ){
179: if( *yyxi == yychar ) break;
180: }
181: if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */
182: }
183:
184: if( yyn == 0 ){ /* error */
185: /* error ... attempt to resume parsing */
186:
187: switch( yyerrflag ){
188:
189: case 0: /* brand new error */
190:
191: yyerror( "syntax error" );
192: yyerrlab:
193: ++yynerrs;
194:
195: case 1:
196: case 2: /* incompletely recovered error ... try again */
197:
198: yyerrflag = 3;
199:
200: /* find a state where "error" is a legal shift action */
201:
202: while ( yyps >= yys ) {
203: yyn = yypact[*yyps] + YYERRCODE;
204: if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
205: yystate = yyact[yyn]; /* simulate a shift of "error" */
206: goto yystack;
207: }
208: yyn = yypact[*yyps];
209:
210: /* the current yyps has no shift onn "error", pop stack */
211:
212: #ifdef YYDEBUG
213: if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
214: #endif
215: --yyps;
216: --yypv;
217: }
218:
219: /* there is no state on the stack with an error shift ... abort */
220:
221: yyabort:
222: return(1);
223:
224:
225: case 3: /* no shift yet; clobber input char */
226:
227: #ifdef YYDEBUG
228: if( yydebug ) printf( "error recovery discards char %d\n", yychar );
229: #endif
230:
231: if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
232: yychar = -1;
233: goto yynewstate; /* try again in the same state */
234:
235: }
236:
237: }
238:
239: /* reduction by production yyn */
240:
241: #ifdef YYDEBUG
242: if( yydebug ) printf("reduce %d\n",yyn);
243: #endif
244: yyps -= yyr2[yyn];
245: yypvt = yypv;
246: yypv -= yyr2[yyn];
247: yyval = yypv[1];
248: yym=yyn;
249: /* consult goto table to find next state */
250: yyn = yyr1[yyn];
251: yyj = yypgo[yyn] + *yyps + 1;
252: if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
253: switch(yym){
254:
255: case 3:
256: # line 18 "r.g"
257: { indent--; outcont(yypvt[-1]); } break;
258: case 4:
259: # line 19 "r.g"
260: { indent--; outcont(yypvt[-1]+1); } break;
261: case 5:
262: # line 20 "r.g"
263: { endsw(yypvt[-2], yypvt[-1]); } break;
264: case 6:
265: # line 21 "r.g"
266: { whilestat(yypvt[-1]); } break;
267: case 7:
268: # line 22 "r.g"
269: { forstat(yypvt[-1]); } break;
270: case 8:
271: # line 23 "r.g"
272: { untils(yypvt[-2],1); } break;
273: case 9:
274: # line 24 "r.g"
275: { untils(yypvt[-1],0); } break;
276: case 10:
277: # line 25 "r.g"
278: { breakcode(); } break;
279: case 11:
280: # line 26 "r.g"
281: { nextcode(); } break;
282: case 12:
283: # line 27 "r.g"
284: { dostat(yypvt[-1]); } break;
285: case 13:
286: # line 28 "r.g"
287: { gokcode(yypvt[-0]); } break;
288: case 14:
289: # line 29 "r.g"
290: { retcode(); } break;
291: case 18:
292: # line 33 "r.g"
293: { errcode(); yyclearin; } break;
294: case 20:
295: # line 37 "r.g"
296: { swcode(); } break;
297: case 21:
298: # line 39 "r.g"
299: { yyval = 0; } break;
300: case 22:
301: # line 40 "r.g"
302: { yyval = 1; } break;
303: case 26:
304: # line 47 "r.g"
305: { getdefault(); } break;
306: case 28:
307: # line 51 "r.g"
308: { getcase(); } break;
309: case 29:
310: # line 53 "r.g"
311: { transfer = 0; outcode(yypvt[-0]); } break;
312: case 30:
313: # line 55 "r.g"
314: { ifcode(); } break;
315: case 31:
316: # line 57 "r.g"
317: { elsecode(yypvt[-2]); } break;
318: case 32:
319: # line 59 "r.g"
320: { whilecode(); } break;
321: case 33:
322: # line 61 "r.g"
323: { forcode(); } break;
324: case 34:
325: # line 63 "r.g"
326: { repcode(); } break;
327: case 35:
328: # line 65 "r.g"
329: { docode(); } break;
330: }
331: goto yystack; /* stack new state and value */
332:
333: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.