]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - usr.bin/yacc/tests/regress.14.out
MFC various moves of tools/regressions/ tests to the new infrastructure.
[FreeBSD/stable/10.git] / usr.bin / yacc / tests / regress.14.out
1 #ifndef lint
2 static const char yysccsid[] = "@(#)yaccpar     1.9 (Berkeley) 02/21/93";
3 #endif
4
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8 #define YYPATCH 20140101
9
10 #define YYEMPTY        (-1)
11 #define yyclearin      (yychar = YYEMPTY)
12 #define yyerrok        (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
14
15 #define YYPREFIX "yy"
16
17 #define YYPURE 0
18
19 #line 2 "quote_calc4.y"
20 # include <stdio.h>
21 # include <ctype.h>
22
23 int regs[26];
24 int base;
25
26 int yylex(void);
27 static void yyerror(const char *s);
28
29 #line 29 "/dev/stdout"
30
31 #ifndef YYSTYPE
32 typedef int YYSTYPE;
33 #endif
34
35 /* compatibility with bison */
36 #ifdef YYPARSE_PARAM
37 /* compatibility with FreeBSD */
38 # ifdef YYPARSE_PARAM_TYPE
39 #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
40 # else
41 #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
42 # endif
43 #else
44 # define YYPARSE_DECL() yyparse(void)
45 #endif
46
47 /* Parameters sent to lex. */
48 #ifdef YYLEX_PARAM
49 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
50 # define YYLEX yylex(YYLEX_PARAM)
51 #else
52 # define YYLEX_DECL() yylex(void)
53 # define YYLEX yylex()
54 #endif
55
56 /* Parameters sent to yyerror. */
57 #ifndef YYERROR_DECL
58 #define YYERROR_DECL() yyerror(const char *s)
59 #endif
60 #ifndef YYERROR_CALL
61 #define YYERROR_CALL(msg) yyerror(msg)
62 #endif
63
64 extern int YYPARSE_DECL();
65
66 #define OP_ADD 257
67 #define OP_SUB 259
68 #define OP_MUL 261
69 #define OP_DIV 263
70 #define OP_MOD 265
71 #define OP_AND 267
72 #define DIGIT 269
73 #define LETTER 270
74 #define UMINUS 271
75 #define YYERRCODE 256
76 static const short yylhs[] = {                           -1,
77     0,    0,    0,    1,    1,    2,    2,    2,    2,    2,
78     2,    2,    2,    2,    2,    2,    3,    3,
79 };
80 static const short yylen[] = {                            2,
81     0,    3,    3,    1,    3,    3,    3,    3,    3,    3,
82     3,    3,    3,    2,    1,    1,    1,    2,
83 };
84 static const short yydefred[] = {                         1,
85     0,    0,    0,   17,    0,    0,    0,    0,    0,    3,
86    15,    0,    0,    0,    2,    0,    0,    0,    0,    0,
87     0,    0,   18,    0,    6,    0,    0,    0,    0,    0,
88     0,    0,
89 };
90 static const short yydgoto[] = {                          1,
91     7,    8,    9,
92 };
93 static const short yysindex[] = {                         0,
94   -38,    4,  -36,    0,  -51,  -36,    6, -121, -249,    0,
95     0, -243,  -36,  -23,    0,  -36,  -36,  -36,  -36,  -36,
96   -36,  -36,    0, -121,    0, -121, -121, -121, -121, -121,
97  -121, -243,
98 };
99 static const short yyrindex[] = {                         0,
100     0,    0,    0,    0,   -9,    0,    0,   12,  -10,    0,
101     0,   -5,    0,    0,    0,    0,    0,    0,    0,    0,
102     0,    0,    0,   14,    0,   -3,   -2,   -1,    1,    2,
103     3,   -4,
104 };
105 static const short yygindex[] = {                         0,
106     0,   42,    0,
107 };
108 #define YYTABLESIZE 259
109 static const short yytable[] = {                         16,
110    15,    6,   22,    6,   14,   13,    7,    8,    9,   13,
111    10,   11,   12,   10,   16,   15,   17,   25,   18,   23,
112    19,    4,   20,    5,   21,    0,    0,    0,    0,    0,
113    16,    0,    0,    0,    0,   14,   13,    7,    8,    9,
114     0,   10,   11,   12,   12,    0,    0,   14,    0,    0,
115     0,    0,    0,    0,   24,    0,    0,   26,   27,   28,
116    29,   30,   31,   32,    0,    0,    0,    0,    0,    0,
117     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
118     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
119     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
120    22,    0,    0,    0,    0,    0,    0,    0,    0,    0,
121     0,    0,    0,   16,   15,    0,    0,    0,   14,   13,
122     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
123     0,    0,    0,    0,    0,    0,   16,    0,   17,    0,
124    18,    0,   19,    0,   20,    0,   21,    0,    0,    0,
125     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
126     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
127     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
128     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
129     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
130     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
131     0,    0,    0,    0,    0,    0,    0,    2,    0,    0,
132     0,    3,    0,    3,    0,    0,    0,    0,    0,    0,
133     4,    5,    4,   11,   16,    0,   17,    0,   18,    0,
134    19,    0,   20,    0,   21,    0,    0,   16,   15,   16,
135    15,   16,   15,   16,   15,   16,   15,   16,   15,
136 };
137 static const short yycheck[] = {                         10,
138    10,   40,  124,   40,   10,   10,   10,   10,   10,   61,
139    10,   10,   10,   10,  258,   10,  260,   41,  262,  269,
140   264,   10,  266,   10,  268,   -1,   -1,   -1,   -1,   -1,
141    41,   -1,   -1,   -1,   -1,   41,   41,   41,   41,   41,
142    -1,   41,   41,   41,    3,   -1,   -1,    6,   -1,   -1,
143    -1,   -1,   -1,   -1,   13,   -1,   -1,   16,   17,   18,
144    19,   20,   21,   22,   -1,   -1,   -1,   -1,   -1,   -1,
145    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
146    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
147    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
148   124,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
149    -1,   -1,   -1,  124,  124,   -1,   -1,   -1,  124,  124,
150    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
151    -1,   -1,   -1,   -1,   -1,   -1,  258,   -1,  260,   -1,
152   262,   -1,  264,   -1,  266,   -1,  268,   -1,   -1,   -1,
153    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
154    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
155    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
156    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
157    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
158    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
159    -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,
160    -1,  260,   -1,  260,   -1,   -1,   -1,   -1,   -1,   -1,
161   269,  270,  269,  270,  258,   -1,  260,   -1,  262,   -1,
162   264,   -1,  266,   -1,  268,   -1,   -1,  258,  258,  260,
163   260,  262,  262,  264,  264,  266,  266,  268,  268,
164 };
165 #define YYFINAL 1
166 #ifndef YYDEBUG
167 #define YYDEBUG 0
168 #endif
169 #define YYMAXTOKEN 271
170 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
171 #if YYDEBUG
172 static const char *yyname[] = {
173
174 "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
175 0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
176 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,
177 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,
178 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,
179 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,
180 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,
181 0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
182 "\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
183 "OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol",
184 };
185 static const char *yyrule[] = {
186 "$accept : list",
187 "list :",
188 "list : list stat '\\n'",
189 "list : list error '\\n'",
190 "stat : expr",
191 "stat : LETTER '=' expr",
192 "expr : '(' expr ')'",
193 "expr : expr \"ADD-operator\" expr",
194 "expr : expr \"SUB-operator\" expr",
195 "expr : expr \"MUL-operator\" expr",
196 "expr : expr \"DIV-operator\" expr",
197 "expr : expr \"MOD-operator\" expr",
198 "expr : expr \"AND-operator\" expr",
199 "expr : expr '|' expr",
200 "expr : \"SUB-operator\" expr",
201 "expr : LETTER",
202 "expr : number",
203 "number : DIGIT",
204 "number : number DIGIT",
205
206 };
207 #endif
208
209 int      yydebug;
210 int      yynerrs;
211
212 int      yyerrflag;
213 int      yychar;
214 YYSTYPE  yyval;
215 YYSTYPE  yylval;
216
217 /* define the initial stack-sizes */
218 #ifdef YYSTACKSIZE
219 #undef YYMAXDEPTH
220 #define YYMAXDEPTH  YYSTACKSIZE
221 #else
222 #ifdef YYMAXDEPTH
223 #define YYSTACKSIZE YYMAXDEPTH
224 #else
225 #define YYSTACKSIZE 10000
226 #define YYMAXDEPTH  10000
227 #endif
228 #endif
229
230 #define YYINITSTACKSIZE 200
231
232 typedef struct {
233     unsigned stacksize;
234     short    *s_base;
235     short    *s_mark;
236     short    *s_last;
237     YYSTYPE  *l_base;
238     YYSTYPE  *l_mark;
239 } YYSTACKDATA;
240 /* variables for the parser stack */
241 static YYSTACKDATA yystack;
242 #line 73 "quote_calc4.y"
243  /* start of programs */
244
245 int
246 main (void)
247 {
248     while(!feof(stdin)) {
249         yyparse();
250     }
251     return 0;
252 }
253
254 static void
255 yyerror(const char *s)
256 {
257     fprintf(stderr, "%s\n", s);
258 }
259
260 int
261 yylex(void) {
262         /* lexical analysis routine */
263         /* returns LETTER for a lower case letter, yylval = 0 through 25 */
264         /* return DIGIT for a digit, yylval = 0 through 9 */
265         /* all other characters are returned immediately */
266
267     int c;
268
269     while( (c=getchar()) == ' ' )   { /* skip blanks */ }
270
271     /* c is now nonblank */
272
273     if( islower( c )) {
274         yylval = c - 'a';
275         return ( LETTER );
276     }
277     if( isdigit( c )) {
278         yylval = c - '0';
279         return ( DIGIT );
280     }
281     return( c );
282 }
283 #line 282 "/dev/stdout"
284
285 #if YYDEBUG
286 #include <stdio.h>              /* needed for printf */
287 #endif
288
289 #include <stdlib.h>     /* needed for malloc, etc */
290 #include <string.h>     /* needed for memset */
291
292 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
293 static int yygrowstack(YYSTACKDATA *data)
294 {
295     int i;
296     unsigned newsize;
297     short *newss;
298     YYSTYPE *newvs;
299
300     if ((newsize = data->stacksize) == 0)
301         newsize = YYINITSTACKSIZE;
302     else if (newsize >= YYMAXDEPTH)
303         return -1;
304     else if ((newsize *= 2) > YYMAXDEPTH)
305         newsize = YYMAXDEPTH;
306
307     i = (int) (data->s_mark - data->s_base);
308     newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
309     if (newss == 0)
310         return -1;
311
312     data->s_base = newss;
313     data->s_mark = newss + i;
314
315     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
316     if (newvs == 0)
317         return -1;
318
319     data->l_base = newvs;
320     data->l_mark = newvs + i;
321
322     data->stacksize = newsize;
323     data->s_last = data->s_base + newsize - 1;
324     return 0;
325 }
326
327 #if YYPURE || defined(YY_NO_LEAKS)
328 static void yyfreestack(YYSTACKDATA *data)
329 {
330     free(data->s_base);
331     free(data->l_base);
332     memset(data, 0, sizeof(*data));
333 }
334 #else
335 #define yyfreestack(data) /* nothing */
336 #endif
337
338 #define YYABORT  goto yyabort
339 #define YYREJECT goto yyabort
340 #define YYACCEPT goto yyaccept
341 #define YYERROR  goto yyerrlab
342
343 int
344 YYPARSE_DECL()
345 {
346     int yym, yyn, yystate;
347 #if YYDEBUG
348     const char *yys;
349
350     if ((yys = getenv("YYDEBUG")) != 0)
351     {
352         yyn = *yys;
353         if (yyn >= '0' && yyn <= '9')
354             yydebug = yyn - '0';
355     }
356 #endif
357
358     yynerrs = 0;
359     yyerrflag = 0;
360     yychar = YYEMPTY;
361     yystate = 0;
362
363 #if YYPURE
364     memset(&yystack, 0, sizeof(yystack));
365 #endif
366
367     if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
368     yystack.s_mark = yystack.s_base;
369     yystack.l_mark = yystack.l_base;
370     yystate = 0;
371     *yystack.s_mark = 0;
372
373 yyloop:
374     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
375     if (yychar < 0)
376     {
377         if ((yychar = YYLEX) < 0) yychar = 0;
378 #if YYDEBUG
379         if (yydebug)
380         {
381             yys = yyname[YYTRANSLATE(yychar)];
382             printf("%sdebug: state %d, reading %d (%s)\n",
383                     YYPREFIX, yystate, yychar, yys);
384         }
385 #endif
386     }
387     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
388             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
389     {
390 #if YYDEBUG
391         if (yydebug)
392             printf("%sdebug: state %d, shifting to state %d\n",
393                     YYPREFIX, yystate, yytable[yyn]);
394 #endif
395         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
396         {
397             goto yyoverflow;
398         }
399         yystate = yytable[yyn];
400         *++yystack.s_mark = yytable[yyn];
401         *++yystack.l_mark = yylval;
402         yychar = YYEMPTY;
403         if (yyerrflag > 0)  --yyerrflag;
404         goto yyloop;
405     }
406     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
407             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
408     {
409         yyn = yytable[yyn];
410         goto yyreduce;
411     }
412     if (yyerrflag) goto yyinrecovery;
413
414     yyerror("syntax error");
415
416     goto yyerrlab;
417
418 yyerrlab:
419     ++yynerrs;
420
421 yyinrecovery:
422     if (yyerrflag < 3)
423     {
424         yyerrflag = 3;
425         for (;;)
426         {
427             if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
428                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
429             {
430 #if YYDEBUG
431                 if (yydebug)
432                     printf("%sdebug: state %d, error recovery shifting\
433  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
434 #endif
435                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
436                 {
437                     goto yyoverflow;
438                 }
439                 yystate = yytable[yyn];
440                 *++yystack.s_mark = yytable[yyn];
441                 *++yystack.l_mark = yylval;
442                 goto yyloop;
443             }
444             else
445             {
446 #if YYDEBUG
447                 if (yydebug)
448                     printf("%sdebug: error recovery discarding state %d\n",
449                             YYPREFIX, *yystack.s_mark);
450 #endif
451                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
452                 --yystack.s_mark;
453                 --yystack.l_mark;
454             }
455         }
456     }
457     else
458     {
459         if (yychar == 0) goto yyabort;
460 #if YYDEBUG
461         if (yydebug)
462         {
463             yys = yyname[YYTRANSLATE(yychar)];
464             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
465                     YYPREFIX, yystate, yychar, yys);
466         }
467 #endif
468         yychar = YYEMPTY;
469         goto yyloop;
470     }
471
472 yyreduce:
473 #if YYDEBUG
474     if (yydebug)
475         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
476                 YYPREFIX, yystate, yyn, yyrule[yyn]);
477 #endif
478     yym = yylen[yyn];
479     if (yym)
480         yyval = yystack.l_mark[1-yym];
481     else
482         memset(&yyval, 0, sizeof yyval);
483     switch (yyn)
484     {
485 case 3:
486 #line 35 "quote_calc4.y"
487         {  yyerrok ; }
488 break;
489 case 4:
490 #line 39 "quote_calc4.y"
491         {  printf("%d\n",yystack.l_mark[0]);}
492 break;
493 case 5:
494 #line 41 "quote_calc4.y"
495         {  regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
496 break;
497 case 6:
498 #line 45 "quote_calc4.y"
499         {  yyval = yystack.l_mark[-1]; }
500 break;
501 case 7:
502 #line 47 "quote_calc4.y"
503         {  yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
504 break;
505 case 8:
506 #line 49 "quote_calc4.y"
507         {  yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
508 break;
509 case 9:
510 #line 51 "quote_calc4.y"
511         {  yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
512 break;
513 case 10:
514 #line 53 "quote_calc4.y"
515         {  yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
516 break;
517 case 11:
518 #line 55 "quote_calc4.y"
519         {  yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
520 break;
521 case 12:
522 #line 57 "quote_calc4.y"
523         {  yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
524 break;
525 case 13:
526 #line 59 "quote_calc4.y"
527         {  yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
528 break;
529 case 14:
530 #line 61 "quote_calc4.y"
531         {  yyval = - yystack.l_mark[0]; }
532 break;
533 case 15:
534 #line 63 "quote_calc4.y"
535         {  yyval = regs[yystack.l_mark[0]]; }
536 break;
537 case 17:
538 #line 68 "quote_calc4.y"
539         {  yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
540 break;
541 case 18:
542 #line 70 "quote_calc4.y"
543         {  yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
544 break;
545 #line 544 "/dev/stdout"
546     }
547     yystack.s_mark -= yym;
548     yystate = *yystack.s_mark;
549     yystack.l_mark -= yym;
550     yym = yylhs[yyn];
551     if (yystate == 0 && yym == 0)
552     {
553 #if YYDEBUG
554         if (yydebug)
555             printf("%sdebug: after reduction, shifting from state 0 to\
556  state %d\n", YYPREFIX, YYFINAL);
557 #endif
558         yystate = YYFINAL;
559         *++yystack.s_mark = YYFINAL;
560         *++yystack.l_mark = yyval;
561         if (yychar < 0)
562         {
563             if ((yychar = YYLEX) < 0) yychar = 0;
564 #if YYDEBUG
565             if (yydebug)
566             {
567                 yys = yyname[YYTRANSLATE(yychar)];
568                 printf("%sdebug: state %d, reading %d (%s)\n",
569                         YYPREFIX, YYFINAL, yychar, yys);
570             }
571 #endif
572         }
573         if (yychar == 0) goto yyaccept;
574         goto yyloop;
575     }
576     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
577             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
578         yystate = yytable[yyn];
579     else
580         yystate = yydgoto[yym];
581 #if YYDEBUG
582     if (yydebug)
583         printf("%sdebug: after reduction, shifting from state %d \
584 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
585 #endif
586     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
587     {
588         goto yyoverflow;
589     }
590     *++yystack.s_mark = (short) yystate;
591     *++yystack.l_mark = yyval;
592     goto yyloop;
593
594 yyoverflow:
595     yyerror("yacc stack overflow");
596
597 yyabort:
598     yyfreestack(&yystack);
599     return (1);
600
601 yyaccept:
602     yyfreestack(&yystack);
603     return (0);
604 }