]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/byacc/test/btyacc/ok_syntax1.tab.c
MFC: r257315, r260445, r264803
[FreeBSD/stable/10.git] / contrib / byacc / test / btyacc / ok_syntax1.tab.c
1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar    1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
4
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8 #define YYCHECK "yyyymmdd"
9
10 #define YYEMPTY        (-1)
11 #define yyclearin      (yychar = YYEMPTY)
12 #define yyerrok        (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
14 #define YYENOMEM       (-2)
15 #define YYEOF          0
16 #undef YYBTYACC
17 #define YYBTYACC 0
18 #define YYDEBUGSTR YYPREFIX "debug"
19
20 #ifndef yyparse
21 #define yyparse    ok_syntax1_parse
22 #endif /* yyparse */
23
24 #ifndef yylex
25 #define yylex      ok_syntax1_lex
26 #endif /* yylex */
27
28 #ifndef yyerror
29 #define yyerror    ok_syntax1_error
30 #endif /* yyerror */
31
32 #ifndef yychar
33 #define yychar     ok_syntax1_char
34 #endif /* yychar */
35
36 #ifndef yyval
37 #define yyval      ok_syntax1_val
38 #endif /* yyval */
39
40 #ifndef yylval
41 #define yylval     ok_syntax1_lval
42 #endif /* yylval */
43
44 #ifndef yydebug
45 #define yydebug    ok_syntax1_debug
46 #endif /* yydebug */
47
48 #ifndef yynerrs
49 #define yynerrs    ok_syntax1_nerrs
50 #endif /* yynerrs */
51
52 #ifndef yyerrflag
53 #define yyerrflag  ok_syntax1_errflag
54 #endif /* yyerrflag */
55
56 #ifndef yylhs
57 #define yylhs      ok_syntax1_lhs
58 #endif /* yylhs */
59
60 #ifndef yylen
61 #define yylen      ok_syntax1_len
62 #endif /* yylen */
63
64 #ifndef yydefred
65 #define yydefred   ok_syntax1_defred
66 #endif /* yydefred */
67
68 #ifndef yystos
69 #define yystos     ok_syntax1_stos
70 #endif /* yystos */
71
72 #ifndef yydgoto
73 #define yydgoto    ok_syntax1_dgoto
74 #endif /* yydgoto */
75
76 #ifndef yysindex
77 #define yysindex   ok_syntax1_sindex
78 #endif /* yysindex */
79
80 #ifndef yyrindex
81 #define yyrindex   ok_syntax1_rindex
82 #endif /* yyrindex */
83
84 #ifndef yygindex
85 #define yygindex   ok_syntax1_gindex
86 #endif /* yygindex */
87
88 #ifndef yytable
89 #define yytable    ok_syntax1_table
90 #endif /* yytable */
91
92 #ifndef yycheck
93 #define yycheck    ok_syntax1_check
94 #endif /* yycheck */
95
96 #ifndef yyname
97 #define yyname     ok_syntax1_name
98 #endif /* yyname */
99
100 #ifndef yyrule
101 #define yyrule     ok_syntax1_rule
102 #endif /* yyrule */
103
104 #if YYBTYACC
105
106 #ifndef yycindex
107 #define yycindex   ok_syntax1_cindex
108 #endif /* yycindex */
109
110 #ifndef yyctable
111 #define yyctable   ok_syntax1_ctable
112 #endif /* yyctable */
113
114 #endif /* YYBTYACC */
115
116 #define YYPREFIX "ok_syntax1_"
117
118 #define YYPURE 1
119
120 #line 9 "ok_syntax1.y"
121 # include <stdio.h>
122 # include <ctype.h>
123
124 #ifdef YYBISON
125 #define YYSTYPE int
126 #define YYLEX_PARAM base
127 #define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
128 #define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
129 int YYLEX_DECL();
130 static void YYERROR_DECL();
131 #endif
132
133 #line 43 "ok_syntax1.y"
134 #ifdef YYSTYPE
135 #undef  YYSTYPE_IS_DECLARED
136 #define YYSTYPE_IS_DECLARED 1
137 #endif
138 #ifndef YYSTYPE_IS_DECLARED
139 #define YYSTYPE_IS_DECLARED 1
140 typedef union
141 {
142     char *      cval;
143     int         ival;
144     double      dval;
145 } YYSTYPE;
146 #endif /* !YYSTYPE_IS_DECLARED */
147 #line 148 "ok_syntax1.tab.c"
148
149 /* compatibility with bison */
150 #ifdef YYPARSE_PARAM
151 /* compatibility with FreeBSD */
152 # ifdef YYPARSE_PARAM_TYPE
153 #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
154 # else
155 #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
156 # endif
157 #else
158 # define YYPARSE_DECL() yyparse(int  regs[26], int * base)
159 #endif
160
161 /* Parameters sent to lex. */
162 #ifdef YYLEX_PARAM
163 # ifdef YYLEX_PARAM_TYPE
164 #  define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
165 # else
166 #  define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
167 # endif
168 # define YYLEX yylex(&yylval, YYLEX_PARAM)
169 #else
170 # define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base)
171 # define YYLEX yylex(&yylval, base)
172 #endif
173
174 /* Parameters sent to yyerror. */
175 #ifndef YYERROR_DECL
176 #define YYERROR_DECL() yyerror(int  regs[26], int * base, const char *s)
177 #endif
178 #ifndef YYERROR_CALL
179 #define YYERROR_CALL(msg) yyerror(regs, base, msg)
180 #endif
181
182 extern int YYPARSE_DECL();
183
184 #define DIGIT 257
185 #define LETTER 258
186 #define OCT1 259
187 #define HEX1 260
188 #define HEX2 261
189 #define HEX3 262
190 #define STR1 263
191 #define STR2 265
192 #define BELL 266
193 #define BS 267
194 #define NL 268
195 #define LF 269
196 #define CR 270
197 #define TAB 271
198 #define VT 272
199 #define UMINUS 273
200 #define YYERRCODE 256
201 typedef short YYINT;
202 static const YYINT ok_syntax1_lhs[] = {                  -1,
203     0,    0,    0,    1,    1,    2,    2,    2,    2,    2,
204     2,    2,    2,    2,    2,    2,    3,    3,
205 };
206 static const YYINT ok_syntax1_len[] = {                   2,
207     0,    3,    3,    1,    3,    3,    3,    3,    3,    3,
208     3,    3,    3,    2,    1,    1,    1,    2,
209 };
210 static const YYINT ok_syntax1_defred[] = {                1,
211     0,    0,   17,    0,    0,    0,    0,    0,    0,    3,
212     0,   15,   14,    0,    2,    0,    0,    0,    0,    0,
213     0,    0,   18,    0,    6,    0,    0,    0,    0,    9,
214    10,   11,
215 };
216 static const YYINT ok_syntax1_stos[] = {                  0,
217   275,  256,  257,  258,   45,   40,  276,  277,  278,   10,
218    61,  258,  277,  277,   10,  124,   38,   43,   45,   42,
219    47,   37,  257,  277,   41,  277,  277,  277,  277,  277,
220   277,  277,
221 };
222 static const YYINT ok_syntax1_dgoto[] = {                 1,
223     7,    8,    9,
224 };
225 static const YYINT ok_syntax1_sindex[] = {                0,
226   -40,   -7,    0,  -55,  -38,  -38,    1,  -29, -247,    0,
227   -38,    0,    0,   22,    0,  -38,  -38,  -38,  -38,  -38,
228   -38,  -38,    0,  -29,    0,   51,   60,  -20,  -20,    0,
229     0,    0,
230 };
231 static const YYINT ok_syntax1_rindex[] = {                0,
232     0,    0,    0,    2,    0,    0,    0,    9,   -9,    0,
233     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
234     0,    0,    0,   10,    0,   -6,   14,    5,   13,    0,
235     0,    0,
236 };
237 #if YYBTYACC
238 static const YYINT ok_syntax1_cindex[] = {                0,
239     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
240     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
241     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
242     0,    0,
243 };
244 #endif
245 static const YYINT ok_syntax1_gindex[] = {                0,
246     0,   65,    0,
247 };
248 #define YYTABLESIZE 220
249 static const YYINT ok_syntax1_table[] = {                 6,
250    16,    6,   10,   13,    5,   11,    5,   22,   17,   23,
251    15,   15,   20,   18,    7,   19,   22,   21,    4,    5,
252     0,   20,    8,   12,    0,    0,   21,   16,   16,    0,
253     0,   16,   16,   16,   13,   16,    0,   16,   15,   15,
254     0,    0,    7,   15,   15,    7,   15,    7,   15,    7,
255     8,   12,    0,    8,   12,    8,    0,    8,   22,   17,
256     0,    0,   25,   20,   18,    0,   19,    0,   21,   13,
257    14,    0,    0,    0,    0,   24,    0,    0,    0,    0,
258    26,   27,   28,   29,   30,   31,   32,   22,   17,    0,
259     0,    0,   20,   18,   16,   19,   22,   21,    0,    0,
260     0,   20,   18,    0,   19,    0,   21,    0,    0,    0,
261     0,    0,    0,    0,   16,    0,    0,   13,    0,    0,
262     0,    0,    0,    0,    0,   15,    0,    0,    7,    0,
263     0,    0,    0,    0,    0,    0,    8,   12,    0,    0,
264     0,    0,    0,    0,    0,   16,    0,    0,    0,    0,
265     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
266     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
267     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
268     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
269     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
270     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
271     0,    0,    0,    0,    0,    2,    3,    4,    3,   12,
272 };
273 static const YYINT ok_syntax1_check[] = {                40,
274    10,   40,   10,   10,   45,   61,   45,   37,   38,  257,
275    10,   10,   42,   43,   10,   45,   37,   47,   10,   10,
276    -1,   42,   10,   10,   -1,   -1,   47,   37,   38,   -1,
277    -1,   41,   42,   43,   41,   45,   -1,   47,   37,   38,
278    -1,   -1,   38,   42,   43,   41,   45,   43,   47,   45,
279    38,   38,   -1,   41,   41,   43,   -1,   45,   37,   38,
280    -1,   -1,   41,   42,   43,   -1,   45,   -1,   47,    5,
281     6,   -1,   -1,   -1,   -1,   11,   -1,   -1,   -1,   -1,
282    16,   17,   18,   19,   20,   21,   22,   37,   38,   -1,
283    -1,   -1,   42,   43,  124,   45,   37,   47,   -1,   -1,
284    -1,   42,   43,   -1,   45,   -1,   47,   -1,   -1,   -1,
285    -1,   -1,   -1,   -1,  124,   -1,   -1,  124,   -1,   -1,
286    -1,   -1,   -1,   -1,   -1,  124,   -1,   -1,  124,   -1,
287    -1,   -1,   -1,   -1,   -1,   -1,  124,  124,   -1,   -1,
288    -1,   -1,   -1,   -1,   -1,  124,   -1,   -1,   -1,   -1,
289    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
290    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
291    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
292    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
293    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
294    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
295    -1,   -1,   -1,   -1,   -1,  256,  257,  258,  257,  258,
296 };
297 #define YYFINAL 1
298 #ifndef YYDEBUG
299 #define YYDEBUG 0
300 #endif
301 #define YYMAXTOKEN 273
302 #define YYUNDFTOKEN 279
303 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
304 #if YYDEBUG
305 static const char *const ok_syntax1_name[] = {
306
307 "$end",0,0,0,0,0,0,"'\\a'","'\\b'","'\\t'","'\\n'","'\\v'","'\\f'","'\\r'",0,0,
308 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'#'",0,"'%'","'&'",0,"'('","')'","'*'",
309 "'+'",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,
310 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,
311 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,
312 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,
313 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,
314 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,"'\\377'",
315 "error","DIGIT","LETTER","OCT1","HEX1","HEX2","HEX3","STR1",
316 "\"\\177\\177\\\\\\n\"","STR2","BELL","BS","NL","LF","CR","TAB","VT","UMINUS",
317 "$accept","list","stat","expr","number","illegal-symbol",
318 };
319 static const char *const ok_syntax1_rule[] = {
320 "$accept : list",
321 "list :",
322 "list : list stat '\\n'",
323 "list : list error '\\n'",
324 "stat : expr",
325 "stat : LETTER '=' expr",
326 "expr : '(' expr ')'",
327 "expr : expr '+' expr",
328 "expr : expr '-' expr",
329 "expr : expr '*' expr",
330 "expr : expr '/' expr",
331 "expr : expr '%' expr",
332 "expr : expr '&' expr",
333 "expr : expr '|' expr",
334 "expr : '-' expr",
335 "expr : LETTER",
336 "expr : number",
337 "number : DIGIT",
338 "number : number DIGIT",
339
340 };
341 #endif
342
343 int      yydebug;
344 int      yynerrs;
345
346 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
347 #ifndef YYLLOC_DEFAULT
348 #define YYLLOC_DEFAULT(loc, rhs, n) \
349 do \
350 { \
351     if (n == 0) \
352     { \
353         (loc).first_line   = ((rhs)[-1]).last_line; \
354         (loc).first_column = ((rhs)[-1]).last_column; \
355         (loc).last_line    = ((rhs)[-1]).last_line; \
356         (loc).last_column  = ((rhs)[-1]).last_column; \
357     } \
358     else \
359     { \
360         (loc).first_line   = ((rhs)[ 0 ]).first_line; \
361         (loc).first_column = ((rhs)[ 0 ]).first_column; \
362         (loc).last_line    = ((rhs)[n-1]).last_line; \
363         (loc).last_column  = ((rhs)[n-1]).last_column; \
364     } \
365 } while (0)
366 #endif /* YYLLOC_DEFAULT */
367 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
368 #if YYBTYACC
369
370 #ifndef YYLVQUEUEGROWTH
371 #define YYLVQUEUEGROWTH 32
372 #endif
373 #endif /* YYBTYACC */
374
375 /* define the initial stack-sizes */
376 #ifdef YYSTACKSIZE
377 #undef YYMAXDEPTH
378 #define YYMAXDEPTH  YYSTACKSIZE
379 #else
380 #ifdef YYMAXDEPTH
381 #define YYSTACKSIZE YYMAXDEPTH
382 #else
383 #define YYSTACKSIZE 10000
384 #define YYMAXDEPTH  10000
385 #endif
386 #endif
387
388 #ifndef YYINITSTACKSIZE
389 #define YYINITSTACKSIZE 200
390 #endif
391
392 typedef struct {
393     unsigned stacksize;
394     short    *s_base;
395     short    *s_mark;
396     short    *s_last;
397     YYSTYPE  *l_base;
398     YYSTYPE  *l_mark;
399 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
400     YYLTYPE  *p_base;
401     YYLTYPE  *p_mark;
402 #endif
403 } YYSTACKDATA;
404 #if YYBTYACC
405
406 struct YYParseState_s
407 {
408     struct YYParseState_s *save;    /* Previously saved parser state */
409     YYSTACKDATA            yystack; /* saved parser stack */
410     int                    state;   /* saved parser state */
411     int                    errflag; /* saved error recovery status */
412     int                    lexeme;  /* saved index of the conflict lexeme in the lexical queue */
413     YYINT                  ctry;    /* saved index in yyctable[] for this conflict */
414 };
415 typedef struct YYParseState_s YYParseState;
416 #endif /* YYBTYACC */
417 #line 104 "ok_syntax1.y"
418  /* start of programs */
419
420 #ifdef YYBYACC
421 extern int YYLEX_DECL();
422 #endif
423
424 int
425 main (void)
426 {
427     int regs[26];
428     int base = 10;
429
430     while(!feof(stdin)) {
431         yyparse(regs, &base);
432     }
433     return 0;
434 }
435
436 #define UNUSED(x) ((void)(x))
437
438 static void
439 YYERROR_DECL()
440 {
441     UNUSED(regs); /* %parse-param regs is not actually used here */
442     UNUSED(base); /* %parse-param base is not actually used here */
443     fprintf(stderr, "%s\n", s);
444 }
445
446 int
447 YYLEX_DECL()
448 {
449         /* lexical analysis routine */
450         /* returns LETTER for a lower case letter, yylval = 0 through 25 */
451         /* return DIGIT for a digit, yylval = 0 through 9 */
452         /* all other characters are returned immediately */
453
454     int c;
455
456     while( (c=getchar()) == ' ' )   { /* skip blanks */ }
457
458     /* c is now nonblank */
459
460     if( islower( c )) {
461         yylval->ival = (c - 'a');
462         return ( LETTER );
463     }
464     if( isdigit( c )) {
465         yylval->ival = (c - '0') % (*base);
466         return ( DIGIT );
467     }
468     return( c );
469 }
470 #line 471 "ok_syntax1.tab.c"
471
472 /* For use in generated program */
473 #define yydepth (int)(yystack.s_mark - yystack.s_base)
474 #if YYBTYACC
475 #define yytrial (yyps->save)
476 #endif /* YYBTYACC */
477
478 #if YYDEBUG
479 #include <stdio.h>              /* needed for printf */
480 #endif
481
482 #include <stdlib.h>     /* needed for malloc, etc */
483 #include <string.h>     /* needed for memset */
484
485 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
486 static int yygrowstack(YYSTACKDATA *data)
487 {
488     int i;
489     unsigned newsize;
490     short *newss;
491     YYSTYPE *newvs;
492 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
493     YYLTYPE *newps;
494 #endif
495
496     if ((newsize = data->stacksize) == 0)
497         newsize = YYINITSTACKSIZE;
498     else if (newsize >= YYMAXDEPTH)
499         return YYENOMEM;
500     else if ((newsize *= 2) > YYMAXDEPTH)
501         newsize = YYMAXDEPTH;
502
503     i = (int) (data->s_mark - data->s_base);
504     newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
505     if (newss == 0)
506         return YYENOMEM;
507
508     data->s_base = newss;
509     data->s_mark = newss + i;
510
511     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
512     if (newvs == 0)
513         return YYENOMEM;
514
515     data->l_base = newvs;
516     data->l_mark = newvs + i;
517
518 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
519     newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
520     if (newps == 0)
521         return YYENOMEM;
522
523     data->p_base = newps;
524     data->p_mark = newps + i;
525 #endif
526
527     data->stacksize = newsize;
528     data->s_last = data->s_base + newsize - 1;
529
530 #if YYDEBUG
531     if (yydebug)
532         fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
533 #endif
534     return 0;
535 }
536
537 #if YYPURE || defined(YY_NO_LEAKS)
538 static void yyfreestack(YYSTACKDATA *data)
539 {
540     free(data->s_base);
541     free(data->l_base);
542 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
543     free(data->p_base);
544 #endif
545     memset(data, 0, sizeof(*data));
546 }
547 #else
548 #define yyfreestack(data) /* nothing */
549 #endif /* YYPURE || defined(YY_NO_LEAKS) */
550 #if YYBTYACC
551
552 static YYParseState *
553 yyNewState(unsigned size)
554 {
555     YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
556     if (p == NULL) return NULL;
557
558     p->yystack.stacksize = size;
559     if (size == 0)
560     {
561         p->yystack.s_base = NULL;
562         p->yystack.l_base = NULL;
563 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
564         p->yystack.p_base = NULL;
565 #endif
566         return p;
567     }
568     p->yystack.s_base    = (short *) malloc(size * sizeof(short));
569     if (p->yystack.s_base == NULL) return NULL;
570     p->yystack.l_base    = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
571     if (p->yystack.l_base == NULL) return NULL;
572     memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
573 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
574     p->yystack.p_base    = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
575     if (p->yystack.p_base == NULL) return NULL;
576     memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
577 #endif
578
579     return p;
580 }
581
582 static void
583 yyFreeState(YYParseState *p)
584 {
585     yyfreestack(&p->yystack);
586     free(p);
587 }
588 #endif /* YYBTYACC */
589
590 #define YYABORT  goto yyabort
591 #define YYREJECT goto yyabort
592 #define YYACCEPT goto yyaccept
593 #define YYERROR  goto yyerrlab
594 #if YYBTYACC
595 #define YYVALID        do { if (yyps->save)            goto yyvalid; } while(0)
596 #define YYVALID_NESTED do { if (yyps->save && \
597                                 yyps->save->save == 0) goto yyvalid; } while(0)
598 #endif /* YYBTYACC */
599
600 int
601 YYPARSE_DECL()
602 {
603     int      yyerrflag;
604     int      yychar;
605     YYSTYPE  yyval;
606     YYSTYPE  yylval;
607 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
608     YYLTYPE  yyloc; /* position returned by actions */
609     YYLTYPE  yylloc; /* position from the lexer */
610 #endif
611
612     /* variables for the parser stack */
613     YYSTACKDATA yystack;
614 #if YYBTYACC
615
616     /* Current parser state */
617     static YYParseState *yyps = 0;
618
619     /* yypath != NULL: do the full parse, starting at *yypath parser state. */
620     static YYParseState *yypath = 0;
621
622     /* Base of the lexical value queue */
623     static YYSTYPE *yylvals = 0;
624
625     /* Current position at lexical value queue */
626     static YYSTYPE *yylvp = 0;
627
628     /* End position of lexical value queue */
629     static YYSTYPE *yylve = 0;
630
631     /* The last allocated position at the lexical value queue */
632     static YYSTYPE *yylvlim = 0;
633
634 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
635     /* Base of the lexical position queue */
636     static YYLTYPE *yylpsns = 0;
637
638     /* Current position at lexical position queue */
639     static YYLTYPE *yylpp = 0;
640
641     /* End position of lexical position queue */
642     static YYLTYPE *yylpe = 0;
643
644     /* The last allocated position at the lexical position queue */
645     static YYLTYPE *yylplim = 0;
646 #endif
647
648     /* Current position at lexical token queue */
649     static short  *yylexp = 0;
650
651     static short  *yylexemes = 0;
652 #endif /* YYBTYACC */
653     int yym, yyn, yystate, yyresult;
654 #if YYBTYACC
655     int yynewerrflag;
656     YYParseState *yyerrctx = NULL;
657 #endif /* YYBTYACC */
658 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
659     YYLTYPE  yyerror_loc_range[2]; /* position of error start & end */
660 #endif
661 #if YYDEBUG
662     const char *yys;
663
664     if ((yys = getenv("YYDEBUG")) != 0)
665     {
666         yyn = *yys;
667         if (yyn >= '0' && yyn <= '9')
668             yydebug = yyn - '0';
669     }
670     if (yydebug)
671         fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
672 #endif
673
674 #if YYBTYACC
675     yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
676     yyps->save = 0;
677 #endif /* YYBTYACC */
678     yynerrs = 0;
679     yyerrflag = 0;
680     yychar = YYEMPTY;
681     yystate = 0;
682
683 #if YYPURE
684     memset(&yystack, 0, sizeof(yystack));
685 #endif
686
687     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
688     yystack.s_mark = yystack.s_base;
689     yystack.l_mark = yystack.l_base;
690 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
691     yystack.p_mark = yystack.p_base;
692 #endif
693     yystate = 0;
694     *yystack.s_mark = 0;
695
696 yyloop:
697     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
698     if (yychar < 0)
699     {
700 #if YYBTYACC
701         do {
702         if (yylvp < yylve)
703         {
704             /* we're currently re-reading tokens */
705             yylval = *yylvp++;
706 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
707             yylloc = *yylpp++;
708 #endif
709             yychar = *yylexp++;
710             break;
711         }
712         if (yyps->save)
713         {
714             /* in trial mode; save scanner results for future parse attempts */
715             if (yylvp == yylvlim)
716             {   /* Enlarge lexical value queue */
717                 int p = yylvp - yylvals;
718                 int s = yylvlim - yylvals;
719
720                 s += YYLVQUEUEGROWTH;
721                 if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
722                 if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
723 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
724                 if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
725 #endif
726                 yylvp   = yylve = yylvals + p;
727                 yylvlim = yylvals + s;
728 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
729                 yylpp   = yylpe = yylpsns + p;
730                 yylplim = yylpsns + s;
731 #endif
732                 yylexp  = yylexemes + p;
733             }
734             *yylexp = (short) YYLEX;
735             *yylvp++ = yylval;
736             yylve++;
737 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
738             *yylpp++ = yylloc;
739             yylpe++;
740 #endif
741             yychar = *yylexp++;
742             break;
743         }
744         /* normal operation, no conflict encountered */
745 #endif /* YYBTYACC */
746         yychar = YYLEX;
747 #if YYBTYACC
748         } while (0);
749 #endif /* YYBTYACC */
750         if (yychar < 0) yychar = YYEOF;
751         /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
752 #if YYDEBUG
753         if (yydebug)
754         {
755             yys = yyname[YYTRANSLATE(yychar)];
756             fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
757                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
758 #ifdef YYSTYPE_TOSTRING
759 #if YYBTYACC
760             if (!yytrial)
761 #endif /* YYBTYACC */
762                 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
763 #endif
764             fputc('\n', stderr);
765         }
766 #endif
767     }
768 #if YYBTYACC
769
770     /* Do we have a conflict? */
771     if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
772         yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
773     {
774         YYINT ctry;
775
776         if (yypath)
777         {
778             YYParseState *save;
779 #if YYDEBUG
780             if (yydebug)
781                 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
782                                 YYDEBUGSTR, yydepth, yystate);
783 #endif
784             /* Switch to the next conflict context */
785             save = yypath;
786             yypath = save->save;
787             save->save = NULL;
788             ctry = save->ctry;
789             if (save->state != yystate) YYABORT;
790             yyFreeState(save);
791
792         }
793         else
794         {
795
796             /* Unresolved conflict - start/continue trial parse */
797             YYParseState *save;
798 #if YYDEBUG
799             if (yydebug)
800             {
801                 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
802                 if (yyps->save)
803                     fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
804                 else
805                     fputs("Starting trial parse.\n", stderr);
806             }
807 #endif
808             save                  = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
809             if (save == NULL) goto yyenomem;
810             save->save            = yyps->save;
811             save->state           = yystate;
812             save->errflag         = yyerrflag;
813             save->yystack.s_mark  = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
814             memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
815             save->yystack.l_mark  = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
816             memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
817 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
818             save->yystack.p_mark  = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
819             memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
820 #endif
821             ctry                  = yytable[yyn];
822             if (yyctable[ctry] == -1)
823             {
824 #if YYDEBUG
825                 if (yydebug && yychar >= YYEOF)
826                     fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
827 #endif
828                 ctry++;
829             }
830             save->ctry = ctry;
831             if (yyps->save == NULL)
832             {
833                 /* If this is a first conflict in the stack, start saving lexemes */
834                 if (!yylexemes)
835                 {
836                     yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
837                     if (yylexemes == NULL) goto yyenomem;
838                     yylvals   = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
839                     if (yylvals == NULL) goto yyenomem;
840                     yylvlim   = yylvals + YYLVQUEUEGROWTH;
841 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
842                     yylpsns   = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
843                     if (yylpsns == NULL) goto yyenomem;
844                     yylplim   = yylpsns + YYLVQUEUEGROWTH;
845 #endif
846                 }
847                 if (yylvp == yylve)
848                 {
849                     yylvp  = yylve = yylvals;
850 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
851                     yylpp  = yylpe = yylpsns;
852 #endif
853                     yylexp = yylexemes;
854                     if (yychar >= YYEOF)
855                     {
856                         *yylve++ = yylval;
857 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
858                         *yylpe++ = yylloc;
859 #endif
860                         *yylexp  = (short) yychar;
861                         yychar   = YYEMPTY;
862                     }
863                 }
864             }
865             if (yychar >= YYEOF)
866             {
867                 yylvp--;
868 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
869                 yylpp--;
870 #endif
871                 yylexp--;
872                 yychar = YYEMPTY;
873             }
874             save->lexeme = yylvp - yylvals;
875             yyps->save   = save;
876         }
877         if (yytable[yyn] == ctry)
878         {
879 #if YYDEBUG
880             if (yydebug)
881                 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
882                                 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
883 #endif
884             if (yychar < 0)
885             {
886                 yylvp++;
887 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
888                 yylpp++;
889 #endif
890                 yylexp++;
891             }
892             if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
893                 goto yyoverflow;
894             yystate = yyctable[ctry];
895             *++yystack.s_mark = (short) yystate;
896             *++yystack.l_mark = yylval;
897 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
898             *++yystack.p_mark = yylloc;
899 #endif
900             yychar  = YYEMPTY;
901             if (yyerrflag > 0) --yyerrflag;
902             goto yyloop;
903         }
904         else
905         {
906             yyn = yyctable[ctry];
907             goto yyreduce;
908         }
909     } /* End of code dealing with conflicts */
910 #endif /* YYBTYACC */
911     if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
912             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
913     {
914 #if YYDEBUG
915         if (yydebug)
916             fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
917                             YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
918 #endif
919         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
920         yystate = yytable[yyn];
921         *++yystack.s_mark = yytable[yyn];
922         *++yystack.l_mark = yylval;
923 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
924         *++yystack.p_mark = yylloc;
925 #endif
926         yychar = YYEMPTY;
927         if (yyerrflag > 0)  --yyerrflag;
928         goto yyloop;
929     }
930     if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
931             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
932     {
933         yyn = yytable[yyn];
934         goto yyreduce;
935     }
936     if (yyerrflag != 0) goto yyinrecovery;
937 #if YYBTYACC
938
939     yynewerrflag = 1;
940     goto yyerrhandler;
941     goto yyerrlab;
942
943 yyerrlab:
944     yynewerrflag = 0;
945 yyerrhandler:
946     while (yyps->save)
947     {
948         int ctry;
949         YYParseState *save = yyps->save;
950 #if YYDEBUG
951         if (yydebug)
952             fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
953                             YYDEBUGSTR, yydepth, yystate, yyps->save->state,
954                     (int)(yylvp - yylvals - yyps->save->lexeme));
955 #endif
956         /* Memorize most forward-looking error state in case it's really an error. */
957         if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
958         {
959             /* Free old saved error context state */
960             if (yyerrctx) yyFreeState(yyerrctx);
961             /* Create and fill out new saved error context state */
962             yyerrctx                 = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
963             if (yyerrctx == NULL) goto yyenomem;
964             yyerrctx->save           = yyps->save;
965             yyerrctx->state          = yystate;
966             yyerrctx->errflag        = yyerrflag;
967             yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
968             memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
969             yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
970             memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
971 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
972             yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
973             memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
974 #endif
975             yyerrctx->lexeme         = yylvp - yylvals;
976         }
977         yylvp          = yylvals   + save->lexeme;
978 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
979         yylpp          = yylpsns   + save->lexeme;
980 #endif
981         yylexp         = yylexemes + save->lexeme;
982         yychar         = YYEMPTY;
983         yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
984         memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
985         yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
986         memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
987 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
988         yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
989         memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
990 #endif
991         ctry           = ++save->ctry;
992         yystate        = save->state;
993         /* We tried shift, try reduce now */
994         if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
995         yyps->save     = save->save;
996         save->save     = NULL;
997         yyFreeState(save);
998
999         /* Nothing left on the stack -- error */
1000         if (!yyps->save)
1001         {
1002 #if YYDEBUG
1003             if (yydebug)
1004                 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1005                                 YYPREFIX, yydepth);
1006 #endif
1007             /* Restore state as it was in the most forward-advanced error */
1008             yylvp          = yylvals   + yyerrctx->lexeme;
1009 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1010             yylpp          = yylpsns   + yyerrctx->lexeme;
1011 #endif
1012             yylexp         = yylexemes + yyerrctx->lexeme;
1013             yychar         = yylexp[-1];
1014             yylval         = yylvp[-1];
1015 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1016             yylloc         = yylpp[-1];
1017 #endif
1018             yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1019             memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1020             yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1021             memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1022 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1023             yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1024             memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1025 #endif
1026             yystate        = yyerrctx->state;
1027             yyFreeState(yyerrctx);
1028             yyerrctx       = NULL;
1029         }
1030         yynewerrflag = 1;
1031     }
1032     if (yynewerrflag == 0) goto yyinrecovery;
1033 #endif /* YYBTYACC */
1034
1035     YYERROR_CALL("syntax error");
1036 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1037     yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1038 #endif
1039
1040 #if !YYBTYACC
1041     goto yyerrlab;
1042 yyerrlab:
1043 #endif
1044     ++yynerrs;
1045
1046 yyinrecovery:
1047     if (yyerrflag < 3)
1048     {
1049         yyerrflag = 3;
1050         for (;;)
1051         {
1052             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1053                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1054             {
1055 #if YYDEBUG
1056                 if (yydebug)
1057                     fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1058                                     YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1059 #endif
1060                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1061                 yystate = yytable[yyn];
1062                 *++yystack.s_mark = yytable[yyn];
1063                 *++yystack.l_mark = yylval;
1064 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1065                 /* lookahead position is error end position */
1066                 yyerror_loc_range[1] = yylloc;
1067                 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1068                 *++yystack.p_mark = yyloc;
1069 #endif
1070                 goto yyloop;
1071             }
1072             else
1073             {
1074 #if YYDEBUG
1075                 if (yydebug)
1076                     fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1077                                     YYDEBUGSTR, yydepth, *yystack.s_mark);
1078 #endif
1079                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1080 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1081                 /* the current TOS position is the error start position */
1082                 yyerror_loc_range[0] = *yystack.p_mark;
1083 #endif
1084 #if defined(YYDESTRUCT_CALL)
1085 #if YYBTYACC
1086                 if (!yytrial)
1087 #endif /* YYBTYACC */
1088 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1089                     YYDESTRUCT_CALL("error: discarding state",
1090                                     yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1091 #else
1092                     YYDESTRUCT_CALL("error: discarding state",
1093                                     yystos[*yystack.s_mark], yystack.l_mark);
1094 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1095 #endif /* defined(YYDESTRUCT_CALL) */
1096                 --yystack.s_mark;
1097                 --yystack.l_mark;
1098 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1099                 --yystack.p_mark;
1100 #endif
1101             }
1102         }
1103     }
1104     else
1105     {
1106         if (yychar == YYEOF) goto yyabort;
1107 #if YYDEBUG
1108         if (yydebug)
1109         {
1110             yys = yyname[YYTRANSLATE(yychar)];
1111             fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1112                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
1113         }
1114 #endif
1115 #if defined(YYDESTRUCT_CALL)
1116 #if YYBTYACC
1117         if (!yytrial)
1118 #endif /* YYBTYACC */
1119 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1120             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1121 #else
1122             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1123 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1124 #endif /* defined(YYDESTRUCT_CALL) */
1125         yychar = YYEMPTY;
1126         goto yyloop;
1127     }
1128
1129 yyreduce:
1130     yym = yylen[yyn];
1131 #if YYDEBUG
1132     if (yydebug)
1133     {
1134         fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1135                         YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1136 #ifdef YYSTYPE_TOSTRING
1137 #if YYBTYACC
1138         if (!yytrial)
1139 #endif /* YYBTYACC */
1140             if (yym > 0)
1141             {
1142                 int i;
1143                 fputc('<', stderr);
1144                 for (i = yym; i > 0; i--)
1145                 {
1146                     if (i != yym) fputs(", ", stderr);
1147                     fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1148                                            yystack.l_mark[1-i]), stderr);
1149                 }
1150                 fputc('>', stderr);
1151             }
1152 #endif
1153         fputc('\n', stderr);
1154     }
1155 #endif
1156     if (yym > 0)
1157         yyval = yystack.l_mark[1-yym];
1158     else
1159         memset(&yyval, 0, sizeof yyval);
1160 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1161
1162     /* Perform position reduction */
1163     memset(&yyloc, 0, sizeof(yyloc));
1164 #if YYBTYACC
1165     if (!yytrial)
1166 #endif /* YYBTYACC */
1167     {
1168         YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1169         /* just in case YYERROR is invoked within the action, save
1170            the start of the rhs as the error start position */
1171         yyerror_loc_range[0] = yystack.p_mark[1-yym];
1172     }
1173 #endif
1174
1175     switch (yyn)
1176     {
1177 case 3:
1178 #line 66 "ok_syntax1.y"
1179         {  yyerrok ; }
1180 break;
1181 case 4:
1182 #line 70 "ok_syntax1.y"
1183         {  printf("%d\n",yystack.l_mark[0].ival);}
1184 break;
1185 case 5:
1186 #line 72 "ok_syntax1.y"
1187         {  regs[yystack.l_mark[-2].ival] = yystack.l_mark[0].ival; }
1188 break;
1189 case 6:
1190 #line 76 "ok_syntax1.y"
1191         {  yyval.ival = yystack.l_mark[-1].ival; }
1192 break;
1193 case 7:
1194 #line 78 "ok_syntax1.y"
1195         {  yyval.ival = yystack.l_mark[-2].ival + yystack.l_mark[0].ival; }
1196 break;
1197 case 8:
1198 #line 80 "ok_syntax1.y"
1199         {  yyval.ival = yystack.l_mark[-2].ival - yystack.l_mark[0].ival; }
1200 break;
1201 case 9:
1202 #line 82 "ok_syntax1.y"
1203         {  yyval.ival = yystack.l_mark[-2].ival * yystack.l_mark[0].ival; }
1204 break;
1205 case 10:
1206 #line 84 "ok_syntax1.y"
1207         {  yyval.ival = yystack.l_mark[-2].ival / yystack.l_mark[0].ival; }
1208 break;
1209 case 11:
1210 #line 86 "ok_syntax1.y"
1211         {  yyval.ival = yystack.l_mark[-2].ival % yystack.l_mark[0].ival; }
1212 break;
1213 case 12:
1214 #line 88 "ok_syntax1.y"
1215         {  yyval.ival = yystack.l_mark[-2].ival & yystack.l_mark[0].ival; }
1216 break;
1217 case 13:
1218 #line 90 "ok_syntax1.y"
1219         {  yyval.ival = yystack.l_mark[-2].ival | yystack.l_mark[0].ival; }
1220 break;
1221 case 14:
1222 #line 92 "ok_syntax1.y"
1223         {  yyval.ival = - yystack.l_mark[0].ival; }
1224 break;
1225 case 15:
1226 #line 94 "ok_syntax1.y"
1227         {  yyval.ival = regs[yystack.l_mark[0].ival]; }
1228 break;
1229 case 17:
1230 #line 99 "ok_syntax1.y"
1231         {  yyval.ival = yystack.l_mark[0].ival; (*base) = (yystack.l_mark[0].ival==0) ? 8 : 10; }
1232 break;
1233 case 18:
1234 #line 101 "ok_syntax1.y"
1235         {  yyval.ival = (*base) * yystack.l_mark[-1].ival + yystack.l_mark[0].ival; }
1236 break;
1237 #line 1238 "ok_syntax1.tab.c"
1238     default:
1239         break;
1240     }
1241     yystack.s_mark -= yym;
1242     yystate = *yystack.s_mark;
1243     yystack.l_mark -= yym;
1244 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1245     yystack.p_mark -= yym;
1246 #endif
1247     yym = yylhs[yyn];
1248     if (yystate == 0 && yym == 0)
1249     {
1250 #if YYDEBUG
1251         if (yydebug)
1252         {
1253             fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1254 #ifdef YYSTYPE_TOSTRING
1255 #if YYBTYACC
1256             if (!yytrial)
1257 #endif /* YYBTYACC */
1258                 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1259 #endif
1260             fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1261         }
1262 #endif
1263         yystate = YYFINAL;
1264         *++yystack.s_mark = YYFINAL;
1265         *++yystack.l_mark = yyval;
1266 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1267         *++yystack.p_mark = yyloc;
1268 #endif
1269         if (yychar < 0)
1270         {
1271 #if YYBTYACC
1272             do {
1273             if (yylvp < yylve)
1274             {
1275                 /* we're currently re-reading tokens */
1276                 yylval = *yylvp++;
1277 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1278                 yylloc = *yylpp++;
1279 #endif
1280                 yychar = *yylexp++;
1281                 break;
1282             }
1283             if (yyps->save)
1284             {
1285                 /* in trial mode; save scanner results for future parse attempts */
1286                 if (yylvp == yylvlim)
1287                 {   /* Enlarge lexical value queue */
1288                     int p = yylvp - yylvals;
1289                     int s = yylvlim - yylvals;
1290
1291                     s += YYLVQUEUEGROWTH;
1292                     if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL)
1293                         goto yyenomem;
1294                     if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1295                         goto yyenomem;
1296 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1297                     if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1298                         goto yyenomem;
1299 #endif
1300                     yylvp   = yylve = yylvals + p;
1301                     yylvlim = yylvals + s;
1302 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1303                     yylpp   = yylpe = yylpsns + p;
1304                     yylplim = yylpsns + s;
1305 #endif
1306                     yylexp  = yylexemes + p;
1307                 }
1308                 *yylexp = (short) YYLEX;
1309                 *yylvp++ = yylval;
1310                 yylve++;
1311 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1312                 *yylpp++ = yylloc;
1313                 yylpe++;
1314 #endif
1315                 yychar = *yylexp++;
1316                 break;
1317             }
1318             /* normal operation, no conflict encountered */
1319 #endif /* YYBTYACC */
1320             yychar = YYLEX;
1321 #if YYBTYACC
1322             } while (0);
1323 #endif /* YYBTYACC */
1324             if (yychar < 0) yychar = YYEOF;
1325             /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1326 #if YYDEBUG
1327             if (yydebug)
1328             {
1329                 yys = yyname[YYTRANSLATE(yychar)];
1330                 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1331                                 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1332             }
1333 #endif
1334         }
1335         if (yychar == YYEOF) goto yyaccept;
1336         goto yyloop;
1337     }
1338     if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1339             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1340         yystate = yytable[yyn];
1341     else
1342         yystate = yydgoto[yym];
1343 #if YYDEBUG
1344     if (yydebug)
1345     {
1346         fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1347 #ifdef YYSTYPE_TOSTRING
1348 #if YYBTYACC
1349         if (!yytrial)
1350 #endif /* YYBTYACC */
1351             fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1352 #endif
1353         fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1354     }
1355 #endif
1356     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1357     *++yystack.s_mark = (short) yystate;
1358     *++yystack.l_mark = yyval;
1359 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1360     *++yystack.p_mark = yyloc;
1361 #endif
1362     goto yyloop;
1363 #if YYBTYACC
1364
1365     /* Reduction declares that this path is valid. Set yypath and do a full parse */
1366 yyvalid:
1367     if (yypath) YYABORT;
1368     while (yyps->save)
1369     {
1370         YYParseState *save = yyps->save;
1371         yyps->save = save->save;
1372         save->save = yypath;
1373         yypath = save;
1374     }
1375 #if YYDEBUG
1376     if (yydebug)
1377         fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1378                         YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1379 #endif
1380     if (yyerrctx)
1381     {
1382         yyFreeState(yyerrctx);
1383         yyerrctx = NULL;
1384     }
1385     yylvp          = yylvals + yypath->lexeme;
1386 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1387     yylpp          = yylpsns + yypath->lexeme;
1388 #endif
1389     yylexp         = yylexemes + yypath->lexeme;
1390     yychar         = YYEMPTY;
1391     yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1392     memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1393     yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1394     memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1395 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1396     yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1397     memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1398 #endif
1399     yystate        = yypath->state;
1400     goto yyloop;
1401 #endif /* YYBTYACC */
1402
1403 yyoverflow:
1404     YYERROR_CALL("yacc stack overflow");
1405 #if YYBTYACC
1406     goto yyabort_nomem;
1407 yyenomem:
1408     YYERROR_CALL("memory exhausted");
1409 yyabort_nomem:
1410 #endif /* YYBTYACC */
1411     yyresult = 2;
1412     goto yyreturn;
1413
1414 yyabort:
1415     yyresult = 1;
1416     goto yyreturn;
1417
1418 yyaccept:
1419 #if YYBTYACC
1420     if (yyps->save) goto yyvalid;
1421 #endif /* YYBTYACC */
1422     yyresult = 0;
1423
1424 yyreturn:
1425 #if defined(YYDESTRUCT_CALL)
1426     if (yychar != YYEOF && yychar != YYEMPTY)
1427 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1428         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1429 #else
1430         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1431 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1432
1433     {
1434         YYSTYPE *pv;
1435 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1436         YYLTYPE *pp;
1437
1438         for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1439              YYDESTRUCT_CALL("cleanup: discarding state",
1440                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1441 #else
1442         for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1443              YYDESTRUCT_CALL("cleanup: discarding state",
1444                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1445 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1446     }
1447 #endif /* defined(YYDESTRUCT_CALL) */
1448
1449 #if YYBTYACC
1450     if (yyerrctx)
1451     {
1452         yyFreeState(yyerrctx);
1453         yyerrctx = NULL;
1454     }
1455     while (yyps)
1456     {
1457         YYParseState *save = yyps;
1458         yyps = save->save;
1459         save->save = NULL;
1460         yyFreeState(save);
1461     }
1462     while (yypath)
1463     {
1464         YYParseState *save = yypath;
1465         yypath = save->save;
1466         save->save = NULL;
1467         yyFreeState(save);
1468     }
1469 #endif /* YYBTYACC */
1470     yyfreestack(&yystack);
1471     return (yyresult);
1472 }