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