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