Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/heimdal/lib/com_err/parse.c
34878 views
1
/* A Bison parser, made by GNU Bison 2.3. */
2
3
/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6
Free Software Foundation, Inc.
7
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2, or (at your option)
11
any later version.
12
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
Boston, MA 02110-1301, USA. */
22
23
/* As a special exception, you may create a larger work that contains
24
part or all of the Bison parser skeleton and distribute that work
25
under terms of your choice, so long as that work isn't itself a
26
parser generator using the skeleton or a modified version thereof
27
as a parser skeleton. Alternatively, if you modify or redistribute
28
the parser skeleton itself, you may (at your option) remove this
29
special exception, which will cause the skeleton and the resulting
30
Bison output files to be licensed under the GNU General Public
31
License without this special exception.
32
33
This special exception was added by the Free Software Foundation in
34
version 2.2 of Bison. */
35
36
/* C LALR(1) parser skeleton written by Richard Stallman, by
37
simplifying the original so-called "semantic" parser. */
38
39
/* All symbols defined below should begin with yy or YY, to avoid
40
infringing on user name space. This should be done even for local
41
variables, as they might otherwise be expanded by user macros.
42
There are some unavoidable exceptions within include files to
43
define necessary library symbols; they are noted "INFRINGES ON
44
USER NAME SPACE" below. */
45
46
/* Identify Bison output. */
47
#define YYBISON 1
48
49
/* Bison version. */
50
#define YYBISON_VERSION "2.3"
51
52
/* Skeleton name. */
53
#define YYSKELETON_NAME "yacc.c"
54
55
/* Pure parsers. */
56
#define YYPURE 0
57
58
/* Using locations. */
59
#define YYLSP_NEEDED 0
60
61
62
63
/* Tokens. */
64
#ifndef YYTOKENTYPE
65
# define YYTOKENTYPE
66
/* Put the tokens into the symbol table, so that GDB and other debuggers
67
know about them. */
68
enum yytokentype {
69
ET = 258,
70
INDEX = 259,
71
PREFIX = 260,
72
EC = 261,
73
ID = 262,
74
END = 263,
75
STRING = 264,
76
NUMBER = 265
77
};
78
#endif
79
/* Tokens. */
80
#define ET 258
81
#define INDEX 259
82
#define PREFIX 260
83
#define EC 261
84
#define ID 262
85
#define END 263
86
#define STRING 264
87
#define NUMBER 265
88
89
90
91
92
/* Copy the first part of user declarations. */
93
#line 1 "parse.y"
94
95
/*
96
* Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
97
* (Royal Institute of Technology, Stockholm, Sweden).
98
* All rights reserved.
99
*
100
* Redistribution and use in source and binary forms, with or without
101
* modification, are permitted provided that the following conditions
102
* are met:
103
*
104
* 1. Redistributions of source code must retain the above copyright
105
* notice, this list of conditions and the following disclaimer.
106
*
107
* 2. Redistributions in binary form must reproduce the above copyright
108
* notice, this list of conditions and the following disclaimer in the
109
* documentation and/or other materials provided with the distribution.
110
*
111
* 3. Neither the name of the Institute nor the names of its contributors
112
* may be used to endorse or promote products derived from this software
113
* without specific prior written permission.
114
*
115
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
116
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
117
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
118
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
119
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
120
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
121
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
122
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
123
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
124
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
125
* SUCH DAMAGE.
126
*/
127
128
#include "compile_et.h"
129
#include "lex.h"
130
131
void yyerror (char *s);
132
static long name2number(const char *str);
133
134
extern char *yytext;
135
136
/* This is for bison */
137
138
#if !defined(alloca) && !defined(HAVE_ALLOCA)
139
#define alloca(x) malloc(x)
140
#endif
141
142
#define YYMALLOC malloc
143
#define YYFREE free
144
145
146
147
/* Enabling traces. */
148
#ifndef YYDEBUG
149
# define YYDEBUG 0
150
#endif
151
152
/* Enabling verbose error messages. */
153
#ifdef YYERROR_VERBOSE
154
# undef YYERROR_VERBOSE
155
# define YYERROR_VERBOSE 1
156
#else
157
# define YYERROR_VERBOSE 0
158
#endif
159
160
/* Enabling the token table. */
161
#ifndef YYTOKEN_TABLE
162
# define YYTOKEN_TABLE 0
163
#endif
164
165
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
166
typedef union YYSTYPE
167
#line 54 "parse.y"
168
{
169
char *string;
170
int number;
171
}
172
/* Line 193 of yacc.c. */
173
#line 174 "parse.c"
174
YYSTYPE;
175
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
176
# define YYSTYPE_IS_DECLARED 1
177
# define YYSTYPE_IS_TRIVIAL 1
178
#endif
179
180
181
182
/* Copy the second part of user declarations. */
183
184
185
/* Line 216 of yacc.c. */
186
#line 187 "parse.c"
187
188
#ifdef short
189
# undef short
190
#endif
191
192
#ifdef YYTYPE_UINT8
193
typedef YYTYPE_UINT8 yytype_uint8;
194
#else
195
typedef unsigned char yytype_uint8;
196
#endif
197
198
#ifdef YYTYPE_INT8
199
typedef YYTYPE_INT8 yytype_int8;
200
#elif (defined __STDC__ || defined __C99__FUNC__ \
201
|| defined __cplusplus || defined _MSC_VER)
202
typedef signed char yytype_int8;
203
#else
204
typedef short int yytype_int8;
205
#endif
206
207
#ifdef YYTYPE_UINT16
208
typedef YYTYPE_UINT16 yytype_uint16;
209
#else
210
typedef unsigned short int yytype_uint16;
211
#endif
212
213
#ifdef YYTYPE_INT16
214
typedef YYTYPE_INT16 yytype_int16;
215
#else
216
typedef short int yytype_int16;
217
#endif
218
219
#ifndef YYSIZE_T
220
# ifdef __SIZE_TYPE__
221
# define YYSIZE_T __SIZE_TYPE__
222
# elif defined size_t
223
# define YYSIZE_T size_t
224
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
225
|| defined __cplusplus || defined _MSC_VER)
226
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
227
# define YYSIZE_T size_t
228
# else
229
# define YYSIZE_T unsigned int
230
# endif
231
#endif
232
233
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
234
235
#ifndef YY_
236
# if defined YYENABLE_NLS && YYENABLE_NLS
237
# if ENABLE_NLS
238
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
239
# define YY_(msgid) dgettext ("bison-runtime", msgid)
240
# endif
241
# endif
242
# ifndef YY_
243
# define YY_(msgid) msgid
244
# endif
245
#endif
246
247
/* Suppress unused-variable warnings by "using" E. */
248
#if ! defined lint || defined __GNUC__
249
# define YYUSE(e) ((void) (e))
250
#else
251
# define YYUSE(e) /* empty */
252
#endif
253
254
/* Identity function, used to suppress warnings about constant conditions. */
255
#ifndef lint
256
# define YYID(n) (n)
257
#else
258
#if (defined __STDC__ || defined __C99__FUNC__ \
259
|| defined __cplusplus || defined _MSC_VER)
260
static int
261
YYID (int i)
262
#else
263
static int
264
YYID (i)
265
int i;
266
#endif
267
{
268
return i;
269
}
270
#endif
271
272
#if ! defined yyoverflow || YYERROR_VERBOSE
273
274
/* The parser invokes alloca or malloc; define the necessary symbols. */
275
276
# ifdef YYSTACK_USE_ALLOCA
277
# if YYSTACK_USE_ALLOCA
278
# ifdef __GNUC__
279
# define YYSTACK_ALLOC __builtin_alloca
280
# elif defined __BUILTIN_VA_ARG_INCR
281
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
282
# elif defined _AIX
283
# define YYSTACK_ALLOC __alloca
284
# elif defined _MSC_VER
285
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
286
# define alloca _alloca
287
# else
288
# define YYSTACK_ALLOC alloca
289
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
290
|| defined __cplusplus || defined _MSC_VER)
291
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
292
# ifndef _STDLIB_H
293
# define _STDLIB_H 1
294
# endif
295
# endif
296
# endif
297
# endif
298
# endif
299
300
# ifdef YYSTACK_ALLOC
301
/* Pacify GCC's `empty if-body' warning. */
302
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
303
# ifndef YYSTACK_ALLOC_MAXIMUM
304
/* The OS might guarantee only one guard page at the bottom of the stack,
305
and a page size can be as small as 4096 bytes. So we cannot safely
306
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
307
to allow for a few compiler-allocated temporary stack slots. */
308
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
309
# endif
310
# else
311
# define YYSTACK_ALLOC YYMALLOC
312
# define YYSTACK_FREE YYFREE
313
# ifndef YYSTACK_ALLOC_MAXIMUM
314
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
315
# endif
316
# if (defined __cplusplus && ! defined _STDLIB_H \
317
&& ! ((defined YYMALLOC || defined malloc) \
318
&& (defined YYFREE || defined free)))
319
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
320
# ifndef _STDLIB_H
321
# define _STDLIB_H 1
322
# endif
323
# endif
324
# ifndef YYMALLOC
325
# define YYMALLOC malloc
326
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
327
|| defined __cplusplus || defined _MSC_VER)
328
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
329
# endif
330
# endif
331
# ifndef YYFREE
332
# define YYFREE free
333
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
334
|| defined __cplusplus || defined _MSC_VER)
335
void free (void *); /* INFRINGES ON USER NAME SPACE */
336
# endif
337
# endif
338
# endif
339
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
340
341
342
#if (! defined yyoverflow \
343
&& (! defined __cplusplus \
344
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
345
346
/* A type that is properly aligned for any stack member. */
347
union yyalloc
348
{
349
yytype_int16 yyss;
350
YYSTYPE yyvs;
351
};
352
353
/* The size of the maximum gap between one aligned stack and the next. */
354
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
355
356
/* The size of an array large to enough to hold all stacks, each with
357
N elements. */
358
# define YYSTACK_BYTES(N) \
359
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
360
+ YYSTACK_GAP_MAXIMUM)
361
362
/* Copy COUNT objects from FROM to TO. The source and destination do
363
not overlap. */
364
# ifndef YYCOPY
365
# if defined __GNUC__ && 1 < __GNUC__
366
# define YYCOPY(To, From, Count) \
367
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
368
# else
369
# define YYCOPY(To, From, Count) \
370
do \
371
{ \
372
YYSIZE_T yyi; \
373
for (yyi = 0; yyi < (Count); yyi++) \
374
(To)[yyi] = (From)[yyi]; \
375
} \
376
while (YYID (0))
377
# endif
378
# endif
379
380
/* Relocate STACK from its old location to the new one. The
381
local variables YYSIZE and YYSTACKSIZE give the old and new number of
382
elements in the stack, and YYPTR gives the new location of the
383
stack. Advance YYPTR to a properly aligned location for the next
384
stack. */
385
# define YYSTACK_RELOCATE(Stack) \
386
do \
387
{ \
388
YYSIZE_T yynewbytes; \
389
YYCOPY (&yyptr->Stack, Stack, yysize); \
390
Stack = &yyptr->Stack; \
391
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
392
yyptr += yynewbytes / sizeof (*yyptr); \
393
} \
394
while (YYID (0))
395
396
#endif
397
398
/* YYFINAL -- State number of the termination state. */
399
#define YYFINAL 9
400
/* YYLAST -- Last index in YYTABLE. */
401
#define YYLAST 23
402
403
/* YYNTOKENS -- Number of terminals. */
404
#define YYNTOKENS 12
405
/* YYNNTS -- Number of nonterminals. */
406
#define YYNNTS 7
407
/* YYNRULES -- Number of rules. */
408
#define YYNRULES 15
409
/* YYNRULES -- Number of states. */
410
#define YYNSTATES 24
411
412
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
413
#define YYUNDEFTOK 2
414
#define YYMAXUTOK 265
415
416
#define YYTRANSLATE(YYX) \
417
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
418
419
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
420
static const yytype_uint8 yytranslate[] =
421
{
422
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426
2, 2, 2, 2, 11, 2, 2, 2, 2, 2,
427
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
448
5, 6, 7, 8, 9, 10
449
};
450
451
#if YYDEBUG
452
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
453
YYRHS. */
454
static const yytype_uint8 yyprhs[] =
455
{
456
0, 0, 3, 4, 7, 10, 12, 15, 18, 22,
457
24, 27, 30, 33, 35, 40
458
};
459
460
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
461
static const yytype_int8 yyrhs[] =
462
{
463
13, 0, -1, -1, 14, 17, -1, 15, 16, -1,
464
16, -1, 7, 9, -1, 3, 9, -1, 3, 9,
465
9, -1, 18, -1, 17, 18, -1, 4, 10, -1,
466
5, 9, -1, 5, -1, 6, 9, 11, 9, -1,
467
8, -1
468
};
469
470
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
471
static const yytype_uint8 yyrline[] =
472
{
473
0, 65, 65, 66, 69, 70, 73, 79, 85, 94,
474
95, 98, 102, 110, 117, 137
475
};
476
#endif
477
478
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
479
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
480
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
481
static const char *const yytname[] =
482
{
483
"$end", "error", "$undefined", "ET", "INDEX", "PREFIX", "EC", "ID",
484
"END", "STRING", "NUMBER", "','", "$accept", "file", "header", "id",
485
"et", "statements", "statement", 0
486
};
487
#endif
488
489
# ifdef YYPRINT
490
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
491
token YYLEX-NUM. */
492
static const yytype_uint16 yytoknum[] =
493
{
494
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
495
265, 44
496
};
497
# endif
498
499
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
500
static const yytype_uint8 yyr1[] =
501
{
502
0, 12, 13, 13, 14, 14, 15, 16, 16, 17,
503
17, 18, 18, 18, 18, 18
504
};
505
506
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
507
static const yytype_uint8 yyr2[] =
508
{
509
0, 2, 0, 2, 2, 1, 2, 2, 3, 1,
510
2, 2, 2, 1, 4, 1
511
};
512
513
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
514
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
515
means the default is an error. */
516
static const yytype_uint8 yydefact[] =
517
{
518
2, 0, 0, 0, 0, 0, 5, 7, 6, 1,
519
0, 13, 0, 15, 3, 9, 4, 8, 11, 12,
520
0, 10, 0, 14
521
};
522
523
/* YYDEFGOTO[NTERM-NUM]. */
524
static const yytype_int8 yydefgoto[] =
525
{
526
-1, 3, 4, 5, 6, 14, 15
527
};
528
529
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
530
STATE-NUM. */
531
#define YYPACT_NINF -5
532
static const yytype_int8 yypact[] =
533
{
534
0, -3, -1, 5, -4, 6, -5, 1, -5, -5,
535
2, 4, 7, -5, -4, -5, -5, -5, -5, -5,
536
3, -5, 8, -5
537
};
538
539
/* YYPGOTO[NTERM-NUM]. */
540
static const yytype_int8 yypgoto[] =
541
{
542
-5, -5, -5, -5, 10, -5, 9
543
};
544
545
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
546
positive, shift that token. If negative, reduce the rule which
547
number is the opposite. If zero, do what YYDEFACT says.
548
If YYTABLE_NINF, syntax error. */
549
#define YYTABLE_NINF -1
550
static const yytype_uint8 yytable[] =
551
{
552
10, 11, 12, 1, 13, 9, 7, 2, 8, 1,
553
17, 0, 18, 19, 22, 16, 20, 23, 0, 0,
554
0, 0, 0, 21
555
};
556
557
static const yytype_int8 yycheck[] =
558
{
559
4, 5, 6, 3, 8, 0, 9, 7, 9, 3,
560
9, -1, 10, 9, 11, 5, 9, 9, -1, -1,
561
-1, -1, -1, 14
562
};
563
564
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
565
symbol of state STATE-NUM. */
566
static const yytype_uint8 yystos[] =
567
{
568
0, 3, 7, 13, 14, 15, 16, 9, 9, 0,
569
4, 5, 6, 8, 17, 18, 16, 9, 10, 9,
570
9, 18, 11, 9
571
};
572
573
#define yyerrok (yyerrstatus = 0)
574
#define yyclearin (yychar = YYEMPTY)
575
#define YYEMPTY (-2)
576
#define YYEOF 0
577
578
#define YYACCEPT goto yyacceptlab
579
#define YYABORT goto yyabortlab
580
#define YYERROR goto yyerrorlab
581
582
583
/* Like YYERROR except do call yyerror. This remains here temporarily
584
to ease the transition to the new meaning of YYERROR, for GCC.
585
Once GCC version 2 has supplanted version 1, this can go. */
586
587
#define YYFAIL goto yyerrlab
588
589
#define YYRECOVERING() (!!yyerrstatus)
590
591
#define YYBACKUP(Token, Value) \
592
do \
593
if (yychar == YYEMPTY && yylen == 1) \
594
{ \
595
yychar = (Token); \
596
yylval = (Value); \
597
yytoken = YYTRANSLATE (yychar); \
598
YYPOPSTACK (1); \
599
goto yybackup; \
600
} \
601
else \
602
{ \
603
yyerror (YY_("syntax error: cannot back up")); \
604
YYERROR; \
605
} \
606
while (YYID (0))
607
608
609
#define YYTERROR 1
610
#define YYERRCODE 256
611
612
613
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
614
If N is 0, then set CURRENT to the empty location which ends
615
the previous symbol: RHS[0] (always defined). */
616
617
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
618
#ifndef YYLLOC_DEFAULT
619
# define YYLLOC_DEFAULT(Current, Rhs, N) \
620
do \
621
if (YYID (N)) \
622
{ \
623
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
624
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
625
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
626
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
627
} \
628
else \
629
{ \
630
(Current).first_line = (Current).last_line = \
631
YYRHSLOC (Rhs, 0).last_line; \
632
(Current).first_column = (Current).last_column = \
633
YYRHSLOC (Rhs, 0).last_column; \
634
} \
635
while (YYID (0))
636
#endif
637
638
639
/* YY_LOCATION_PRINT -- Print the location on the stream.
640
This macro was not mandated originally: define only if we know
641
we won't break user code: when these are the locations we know. */
642
643
#ifndef YY_LOCATION_PRINT
644
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
645
# define YY_LOCATION_PRINT(File, Loc) \
646
fprintf (File, "%d.%d-%d.%d", \
647
(Loc).first_line, (Loc).first_column, \
648
(Loc).last_line, (Loc).last_column)
649
# else
650
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
651
# endif
652
#endif
653
654
655
/* YYLEX -- calling `yylex' with the right arguments. */
656
657
#ifdef YYLEX_PARAM
658
# define YYLEX yylex (YYLEX_PARAM)
659
#else
660
# define YYLEX yylex ()
661
#endif
662
663
/* Enable debugging if requested. */
664
#if YYDEBUG
665
666
# ifndef YYFPRINTF
667
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
668
# define YYFPRINTF fprintf
669
# endif
670
671
# define YYDPRINTF(Args) \
672
do { \
673
if (yydebug) \
674
YYFPRINTF Args; \
675
} while (YYID (0))
676
677
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
678
do { \
679
if (yydebug) \
680
{ \
681
YYFPRINTF (stderr, "%s ", Title); \
682
yy_symbol_print (stderr, \
683
Type, Value); \
684
YYFPRINTF (stderr, "\n"); \
685
} \
686
} while (YYID (0))
687
688
689
/*--------------------------------.
690
| Print this symbol on YYOUTPUT. |
691
`--------------------------------*/
692
693
/*ARGSUSED*/
694
#if (defined __STDC__ || defined __C99__FUNC__ \
695
|| defined __cplusplus || defined _MSC_VER)
696
static void
697
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
698
#else
699
static void
700
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
701
FILE *yyoutput;
702
int yytype;
703
YYSTYPE const * const yyvaluep;
704
#endif
705
{
706
if (!yyvaluep)
707
return;
708
# ifdef YYPRINT
709
if (yytype < YYNTOKENS)
710
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
711
# else
712
YYUSE (yyoutput);
713
# endif
714
switch (yytype)
715
{
716
default:
717
break;
718
}
719
}
720
721
722
/*--------------------------------.
723
| Print this symbol on YYOUTPUT. |
724
`--------------------------------*/
725
726
#if (defined __STDC__ || defined __C99__FUNC__ \
727
|| defined __cplusplus || defined _MSC_VER)
728
static void
729
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
730
#else
731
static void
732
yy_symbol_print (yyoutput, yytype, yyvaluep)
733
FILE *yyoutput;
734
int yytype;
735
YYSTYPE const * const yyvaluep;
736
#endif
737
{
738
if (yytype < YYNTOKENS)
739
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
740
else
741
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
742
743
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
744
YYFPRINTF (yyoutput, ")");
745
}
746
747
/*------------------------------------------------------------------.
748
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
749
| TOP (included). |
750
`------------------------------------------------------------------*/
751
752
#if (defined __STDC__ || defined __C99__FUNC__ \
753
|| defined __cplusplus || defined _MSC_VER)
754
static void
755
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
756
#else
757
static void
758
yy_stack_print (bottom, top)
759
yytype_int16 *bottom;
760
yytype_int16 *top;
761
#endif
762
{
763
YYFPRINTF (stderr, "Stack now");
764
for (; bottom <= top; ++bottom)
765
YYFPRINTF (stderr, " %d", *bottom);
766
YYFPRINTF (stderr, "\n");
767
}
768
769
# define YY_STACK_PRINT(Bottom, Top) \
770
do { \
771
if (yydebug) \
772
yy_stack_print ((Bottom), (Top)); \
773
} while (YYID (0))
774
775
776
/*------------------------------------------------.
777
| Report that the YYRULE is going to be reduced. |
778
`------------------------------------------------*/
779
780
#if (defined __STDC__ || defined __C99__FUNC__ \
781
|| defined __cplusplus || defined _MSC_VER)
782
static void
783
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
784
#else
785
static void
786
yy_reduce_print (yyvsp, yyrule)
787
YYSTYPE *yyvsp;
788
int yyrule;
789
#endif
790
{
791
int yynrhs = yyr2[yyrule];
792
int yyi;
793
unsigned long int yylno = yyrline[yyrule];
794
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
795
yyrule - 1, yylno);
796
/* The symbols being reduced. */
797
for (yyi = 0; yyi < yynrhs; yyi++)
798
{
799
fprintf (stderr, " $%d = ", yyi + 1);
800
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
801
&(yyvsp[(yyi + 1) - (yynrhs)])
802
);
803
fprintf (stderr, "\n");
804
}
805
}
806
807
# define YY_REDUCE_PRINT(Rule) \
808
do { \
809
if (yydebug) \
810
yy_reduce_print (yyvsp, Rule); \
811
} while (YYID (0))
812
813
/* Nonzero means print parse trace. It is left uninitialized so that
814
multiple parsers can coexist. */
815
int yydebug;
816
#else /* !YYDEBUG */
817
# define YYDPRINTF(Args)
818
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
819
# define YY_STACK_PRINT(Bottom, Top)
820
# define YY_REDUCE_PRINT(Rule)
821
#endif /* !YYDEBUG */
822
823
824
/* YYINITDEPTH -- initial size of the parser's stacks. */
825
#ifndef YYINITDEPTH
826
# define YYINITDEPTH 200
827
#endif
828
829
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
830
if the built-in stack extension method is used).
831
832
Do not make this value too large; the results are undefined if
833
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
834
evaluated with infinite-precision integer arithmetic. */
835
836
#ifndef YYMAXDEPTH
837
# define YYMAXDEPTH 10000
838
#endif
839
840
841
842
#if YYERROR_VERBOSE
843
844
# ifndef yystrlen
845
# if defined __GLIBC__ && defined _STRING_H
846
# define yystrlen strlen
847
# else
848
/* Return the length of YYSTR. */
849
#if (defined __STDC__ || defined __C99__FUNC__ \
850
|| defined __cplusplus || defined _MSC_VER)
851
static YYSIZE_T
852
yystrlen (const char *yystr)
853
#else
854
static YYSIZE_T
855
yystrlen (yystr)
856
const char *yystr;
857
#endif
858
{
859
YYSIZE_T yylen;
860
for (yylen = 0; yystr[yylen]; yylen++)
861
continue;
862
return yylen;
863
}
864
# endif
865
# endif
866
867
# ifndef yystpcpy
868
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
869
# define yystpcpy stpcpy
870
# else
871
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
872
YYDEST. */
873
#if (defined __STDC__ || defined __C99__FUNC__ \
874
|| defined __cplusplus || defined _MSC_VER)
875
static char *
876
yystpcpy (char *yydest, const char *yysrc)
877
#else
878
static char *
879
yystpcpy (yydest, yysrc)
880
char *yydest;
881
const char *yysrc;
882
#endif
883
{
884
char *yyd = yydest;
885
const char *yys = yysrc;
886
887
while ((*yyd++ = *yys++) != '\0')
888
continue;
889
890
return yyd - 1;
891
}
892
# endif
893
# endif
894
895
# ifndef yytnamerr
896
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
897
quotes and backslashes, so that it's suitable for yyerror. The
898
heuristic is that double-quoting is unnecessary unless the string
899
contains an apostrophe, a comma, or backslash (other than
900
backslash-backslash). YYSTR is taken from yytname. If YYRES is
901
null, do not copy; instead, return the length of what the result
902
would have been. */
903
static YYSIZE_T
904
yytnamerr (char *yyres, const char *yystr)
905
{
906
if (*yystr == '"')
907
{
908
YYSIZE_T yyn = 0;
909
char const *yyp = yystr;
910
911
for (;;)
912
switch (*++yyp)
913
{
914
case '\'':
915
case ',':
916
goto do_not_strip_quotes;
917
918
case '\\':
919
if (*++yyp != '\\')
920
goto do_not_strip_quotes;
921
/* Fall through. */
922
default:
923
if (yyres)
924
yyres[yyn] = *yyp;
925
yyn++;
926
break;
927
928
case '"':
929
if (yyres)
930
yyres[yyn] = '\0';
931
return yyn;
932
}
933
do_not_strip_quotes: ;
934
}
935
936
if (! yyres)
937
return yystrlen (yystr);
938
939
return yystpcpy (yyres, yystr) - yyres;
940
}
941
# endif
942
943
/* Copy into YYRESULT an error message about the unexpected token
944
YYCHAR while in state YYSTATE. Return the number of bytes copied,
945
including the terminating null byte. If YYRESULT is null, do not
946
copy anything; just return the number of bytes that would be
947
copied. As a special case, return 0 if an ordinary "syntax error"
948
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
949
size calculation. */
950
static YYSIZE_T
951
yysyntax_error (char *yyresult, int yystate, int yychar)
952
{
953
int yyn = yypact[yystate];
954
955
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
956
return 0;
957
else
958
{
959
int yytype = YYTRANSLATE (yychar);
960
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
961
YYSIZE_T yysize = yysize0;
962
YYSIZE_T yysize1;
963
int yysize_overflow = 0;
964
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
965
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
966
int yyx;
967
968
# if 0
969
/* This is so xgettext sees the translatable formats that are
970
constructed on the fly. */
971
YY_("syntax error, unexpected %s");
972
YY_("syntax error, unexpected %s, expecting %s");
973
YY_("syntax error, unexpected %s, expecting %s or %s");
974
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
975
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
976
# endif
977
char *yyfmt;
978
char const *yyf;
979
static char const yyunexpected[] = "syntax error, unexpected %s";
980
static char const yyexpecting[] = ", expecting %s";
981
static char const yyor[] = " or %s";
982
char yyformat[sizeof yyunexpected
983
+ sizeof yyexpecting - 1
984
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
985
* (sizeof yyor - 1))];
986
char const *yyprefix = yyexpecting;
987
988
/* Start YYX at -YYN if negative to avoid negative indexes in
989
YYCHECK. */
990
int yyxbegin = yyn < 0 ? -yyn : 0;
991
992
/* Stay within bounds of both yycheck and yytname. */
993
int yychecklim = YYLAST - yyn + 1;
994
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
995
int yycount = 1;
996
997
yyarg[0] = yytname[yytype];
998
yyfmt = yystpcpy (yyformat, yyunexpected);
999
1000
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1001
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1002
{
1003
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1004
{
1005
yycount = 1;
1006
yysize = yysize0;
1007
yyformat[sizeof yyunexpected - 1] = '\0';
1008
break;
1009
}
1010
yyarg[yycount++] = yytname[yyx];
1011
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1012
yysize_overflow |= (yysize1 < yysize);
1013
yysize = yysize1;
1014
yyfmt = yystpcpy (yyfmt, yyprefix);
1015
yyprefix = yyor;
1016
}
1017
1018
yyf = YY_(yyformat);
1019
yysize1 = yysize + yystrlen (yyf);
1020
yysize_overflow |= (yysize1 < yysize);
1021
yysize = yysize1;
1022
1023
if (yysize_overflow)
1024
return YYSIZE_MAXIMUM;
1025
1026
if (yyresult)
1027
{
1028
/* Avoid sprintf, as that infringes on the user's name space.
1029
Don't have undefined behavior even if the translation
1030
produced a string with the wrong number of "%s"s. */
1031
char *yyp = yyresult;
1032
int yyi = 0;
1033
while ((*yyp = *yyf) != '\0')
1034
{
1035
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1036
{
1037
yyp += yytnamerr (yyp, yyarg[yyi++]);
1038
yyf += 2;
1039
}
1040
else
1041
{
1042
yyp++;
1043
yyf++;
1044
}
1045
}
1046
}
1047
return yysize;
1048
}
1049
}
1050
#endif /* YYERROR_VERBOSE */
1051
1052
1053
/*-----------------------------------------------.
1054
| Release the memory associated to this symbol. |
1055
`-----------------------------------------------*/
1056
1057
/*ARGSUSED*/
1058
#if (defined __STDC__ || defined __C99__FUNC__ \
1059
|| defined __cplusplus || defined _MSC_VER)
1060
static void
1061
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1062
#else
1063
static void
1064
yydestruct (yymsg, yytype, yyvaluep)
1065
const char *yymsg;
1066
int yytype;
1067
YYSTYPE *yyvaluep;
1068
#endif
1069
{
1070
YYUSE (yyvaluep);
1071
1072
if (!yymsg)
1073
yymsg = "Deleting";
1074
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1075
1076
switch (yytype)
1077
{
1078
1079
default:
1080
break;
1081
}
1082
}
1083
1084
1085
/* Prevent warnings from -Wmissing-prototypes. */
1086
1087
#ifdef YYPARSE_PARAM
1088
#if defined __STDC__ || defined __cplusplus
1089
int yyparse (void *YYPARSE_PARAM);
1090
#else
1091
int yyparse ();
1092
#endif
1093
#else /* ! YYPARSE_PARAM */
1094
#if defined __STDC__ || defined __cplusplus
1095
int yyparse (void);
1096
#else
1097
int yyparse ();
1098
#endif
1099
#endif /* ! YYPARSE_PARAM */
1100
1101
1102
1103
/* The look-ahead symbol. */
1104
int yychar;
1105
1106
/* The semantic value of the look-ahead symbol. */
1107
YYSTYPE yylval;
1108
1109
/* Number of syntax errors so far. */
1110
int yynerrs;
1111
1112
1113
1114
/*----------.
1115
| yyparse. |
1116
`----------*/
1117
1118
#ifdef YYPARSE_PARAM
1119
#if (defined __STDC__ || defined __C99__FUNC__ \
1120
|| defined __cplusplus || defined _MSC_VER)
1121
int
1122
yyparse (void *YYPARSE_PARAM)
1123
#else
1124
int
1125
yyparse (YYPARSE_PARAM)
1126
void *YYPARSE_PARAM;
1127
#endif
1128
#else /* ! YYPARSE_PARAM */
1129
#if (defined __STDC__ || defined __C99__FUNC__ \
1130
|| defined __cplusplus || defined _MSC_VER)
1131
int
1132
yyparse (void)
1133
#else
1134
int
1135
yyparse ()
1136
1137
#endif
1138
#endif
1139
{
1140
1141
int yystate;
1142
int yyn;
1143
int yyresult;
1144
/* Number of tokens to shift before error messages enabled. */
1145
int yyerrstatus;
1146
/* Look-ahead token as an internal (translated) token number. */
1147
int yytoken = 0;
1148
#if YYERROR_VERBOSE
1149
/* Buffer for error messages, and its allocated size. */
1150
char yymsgbuf[128];
1151
char *yymsg = yymsgbuf;
1152
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1153
#endif
1154
1155
/* Three stacks and their tools:
1156
`yyss': related to states,
1157
`yyvs': related to semantic values,
1158
`yyls': related to locations.
1159
1160
Refer to the stacks thru separate pointers, to allow yyoverflow
1161
to reallocate them elsewhere. */
1162
1163
/* The state stack. */
1164
yytype_int16 yyssa[YYINITDEPTH];
1165
yytype_int16 *yyss = yyssa;
1166
yytype_int16 *yyssp;
1167
1168
/* The semantic value stack. */
1169
YYSTYPE yyvsa[YYINITDEPTH];
1170
YYSTYPE *yyvs = yyvsa;
1171
YYSTYPE *yyvsp;
1172
1173
1174
1175
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1176
1177
YYSIZE_T yystacksize = YYINITDEPTH;
1178
1179
/* The variables used to return semantic value and location from the
1180
action routines. */
1181
YYSTYPE yyval;
1182
1183
1184
/* The number of symbols on the RHS of the reduced rule.
1185
Keep to zero when no symbol should be popped. */
1186
int yylen = 0;
1187
1188
YYDPRINTF ((stderr, "Starting parse\n"));
1189
1190
yystate = 0;
1191
yyerrstatus = 0;
1192
yynerrs = 0;
1193
yychar = YYEMPTY; /* Cause a token to be read. */
1194
1195
/* Initialize stack pointers.
1196
Waste one element of value and location stack
1197
so that they stay on the same level as the state stack.
1198
The wasted elements are never initialized. */
1199
1200
yyssp = yyss;
1201
yyvsp = yyvs;
1202
1203
goto yysetstate;
1204
1205
/*------------------------------------------------------------.
1206
| yynewstate -- Push a new state, which is found in yystate. |
1207
`------------------------------------------------------------*/
1208
yynewstate:
1209
/* In all cases, when you get here, the value and location stacks
1210
have just been pushed. So pushing a state here evens the stacks. */
1211
yyssp++;
1212
1213
yysetstate:
1214
*yyssp = yystate;
1215
1216
if (yyss + yystacksize - 1 <= yyssp)
1217
{
1218
/* Get the current used size of the three stacks, in elements. */
1219
YYSIZE_T yysize = yyssp - yyss + 1;
1220
1221
#ifdef yyoverflow
1222
{
1223
/* Give user a chance to reallocate the stack. Use copies of
1224
these so that the &'s don't force the real ones into
1225
memory. */
1226
YYSTYPE *yyvs1 = yyvs;
1227
yytype_int16 *yyss1 = yyss;
1228
1229
1230
/* Each stack pointer address is followed by the size of the
1231
data in use in that stack, in bytes. This used to be a
1232
conditional around just the two extra args, but that might
1233
be undefined if yyoverflow is a macro. */
1234
yyoverflow (YY_("memory exhausted"),
1235
&yyss1, yysize * sizeof (*yyssp),
1236
&yyvs1, yysize * sizeof (*yyvsp),
1237
1238
&yystacksize);
1239
1240
yyss = yyss1;
1241
yyvs = yyvs1;
1242
}
1243
#else /* no yyoverflow */
1244
# ifndef YYSTACK_RELOCATE
1245
goto yyexhaustedlab;
1246
# else
1247
/* Extend the stack our own way. */
1248
if (YYMAXDEPTH <= yystacksize)
1249
goto yyexhaustedlab;
1250
yystacksize *= 2;
1251
if (YYMAXDEPTH < yystacksize)
1252
yystacksize = YYMAXDEPTH;
1253
1254
{
1255
yytype_int16 *yyss1 = yyss;
1256
union yyalloc *yyptr =
1257
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1258
if (! yyptr)
1259
goto yyexhaustedlab;
1260
YYSTACK_RELOCATE (yyss);
1261
YYSTACK_RELOCATE (yyvs);
1262
1263
# undef YYSTACK_RELOCATE
1264
if (yyss1 != yyssa)
1265
YYSTACK_FREE (yyss1);
1266
}
1267
# endif
1268
#endif /* no yyoverflow */
1269
1270
yyssp = yyss + yysize - 1;
1271
yyvsp = yyvs + yysize - 1;
1272
1273
1274
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1275
(unsigned long int) yystacksize));
1276
1277
if (yyss + yystacksize - 1 <= yyssp)
1278
YYABORT;
1279
}
1280
1281
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1282
1283
goto yybackup;
1284
1285
/*-----------.
1286
| yybackup. |
1287
`-----------*/
1288
yybackup:
1289
1290
/* Do appropriate processing given the current state. Read a
1291
look-ahead token if we need one and don't already have one. */
1292
1293
/* First try to decide what to do without reference to look-ahead token. */
1294
yyn = yypact[yystate];
1295
if (yyn == YYPACT_NINF)
1296
goto yydefault;
1297
1298
/* Not known => get a look-ahead token if don't already have one. */
1299
1300
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1301
if (yychar == YYEMPTY)
1302
{
1303
YYDPRINTF ((stderr, "Reading a token: "));
1304
yychar = YYLEX;
1305
}
1306
1307
if (yychar <= YYEOF)
1308
{
1309
yychar = yytoken = YYEOF;
1310
YYDPRINTF ((stderr, "Now at end of input.\n"));
1311
}
1312
else
1313
{
1314
yytoken = YYTRANSLATE (yychar);
1315
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1316
}
1317
1318
/* If the proper action on seeing token YYTOKEN is to reduce or to
1319
detect an error, take that action. */
1320
yyn += yytoken;
1321
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1322
goto yydefault;
1323
yyn = yytable[yyn];
1324
if (yyn <= 0)
1325
{
1326
if (yyn == 0 || yyn == YYTABLE_NINF)
1327
goto yyerrlab;
1328
yyn = -yyn;
1329
goto yyreduce;
1330
}
1331
1332
if (yyn == YYFINAL)
1333
YYACCEPT;
1334
1335
/* Count tokens shifted since error; after three, turn off error
1336
status. */
1337
if (yyerrstatus)
1338
yyerrstatus--;
1339
1340
/* Shift the look-ahead token. */
1341
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1342
1343
/* Discard the shifted token unless it is eof. */
1344
if (yychar != YYEOF)
1345
yychar = YYEMPTY;
1346
1347
yystate = yyn;
1348
*++yyvsp = yylval;
1349
1350
goto yynewstate;
1351
1352
1353
/*-----------------------------------------------------------.
1354
| yydefault -- do the default action for the current state. |
1355
`-----------------------------------------------------------*/
1356
yydefault:
1357
yyn = yydefact[yystate];
1358
if (yyn == 0)
1359
goto yyerrlab;
1360
goto yyreduce;
1361
1362
1363
/*-----------------------------.
1364
| yyreduce -- Do a reduction. |
1365
`-----------------------------*/
1366
yyreduce:
1367
/* yyn is the number of a rule to reduce with. */
1368
yylen = yyr2[yyn];
1369
1370
/* If YYLEN is nonzero, implement the default value of the action:
1371
`$$ = $1'.
1372
1373
Otherwise, the following line sets YYVAL to garbage.
1374
This behavior is undocumented and Bison
1375
users should not rely upon it. Assigning to YYVAL
1376
unconditionally makes the parser a bit smaller, and it avoids a
1377
GCC warning that YYVAL may be used uninitialized. */
1378
yyval = yyvsp[1-yylen];
1379
1380
1381
YY_REDUCE_PRINT (yyn);
1382
switch (yyn)
1383
{
1384
case 6:
1385
#line 74 "parse.y"
1386
{
1387
id_str = (yyvsp[(2) - (2)].string);
1388
}
1389
break;
1390
1391
case 7:
1392
#line 80 "parse.y"
1393
{
1394
base_id = name2number((yyvsp[(2) - (2)].string));
1395
strlcpy(name, (yyvsp[(2) - (2)].string), sizeof(name));
1396
free((yyvsp[(2) - (2)].string));
1397
}
1398
break;
1399
1400
case 8:
1401
#line 86 "parse.y"
1402
{
1403
base_id = name2number((yyvsp[(2) - (3)].string));
1404
strlcpy(name, (yyvsp[(3) - (3)].string), sizeof(name));
1405
free((yyvsp[(2) - (3)].string));
1406
free((yyvsp[(3) - (3)].string));
1407
}
1408
break;
1409
1410
case 11:
1411
#line 99 "parse.y"
1412
{
1413
number = (yyvsp[(2) - (2)].number);
1414
}
1415
break;
1416
1417
case 12:
1418
#line 103 "parse.y"
1419
{
1420
free(prefix);
1421
asprintf (&prefix, "%s_", (yyvsp[(2) - (2)].string));
1422
if (prefix == NULL)
1423
errx(1, "malloc");
1424
free((yyvsp[(2) - (2)].string));
1425
}
1426
break;
1427
1428
case 13:
1429
#line 111 "parse.y"
1430
{
1431
prefix = realloc(prefix, 1);
1432
if (prefix == NULL)
1433
errx(1, "malloc");
1434
*prefix = '\0';
1435
}
1436
break;
1437
1438
case 14:
1439
#line 118 "parse.y"
1440
{
1441
struct error_code *ec = malloc(sizeof(*ec));
1442
1443
if (ec == NULL)
1444
errx(1, "malloc");
1445
1446
ec->next = NULL;
1447
ec->number = number;
1448
if(prefix && *prefix != '\0') {
1449
asprintf (&ec->name, "%s%s", prefix, (yyvsp[(2) - (4)].string));
1450
if (ec->name == NULL)
1451
errx(1, "malloc");
1452
free((yyvsp[(2) - (4)].string));
1453
} else
1454
ec->name = (yyvsp[(2) - (4)].string);
1455
ec->string = (yyvsp[(4) - (4)].string);
1456
APPEND(codes, ec);
1457
number++;
1458
}
1459
break;
1460
1461
case 15:
1462
#line 138 "parse.y"
1463
{
1464
YYACCEPT;
1465
}
1466
break;
1467
1468
1469
/* Line 1267 of yacc.c. */
1470
#line 1471 "parse.c"
1471
default: break;
1472
}
1473
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1474
1475
YYPOPSTACK (yylen);
1476
yylen = 0;
1477
YY_STACK_PRINT (yyss, yyssp);
1478
1479
*++yyvsp = yyval;
1480
1481
1482
/* Now `shift' the result of the reduction. Determine what state
1483
that goes to, based on the state we popped back to and the rule
1484
number reduced by. */
1485
1486
yyn = yyr1[yyn];
1487
1488
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1489
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1490
yystate = yytable[yystate];
1491
else
1492
yystate = yydefgoto[yyn - YYNTOKENS];
1493
1494
goto yynewstate;
1495
1496
1497
/*------------------------------------.
1498
| yyerrlab -- here on detecting error |
1499
`------------------------------------*/
1500
yyerrlab:
1501
/* If not already recovering from an error, report this error. */
1502
if (!yyerrstatus)
1503
{
1504
++yynerrs;
1505
#if ! YYERROR_VERBOSE
1506
yyerror (YY_("syntax error"));
1507
#else
1508
{
1509
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1510
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1511
{
1512
YYSIZE_T yyalloc = 2 * yysize;
1513
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1514
yyalloc = YYSTACK_ALLOC_MAXIMUM;
1515
if (yymsg != yymsgbuf)
1516
YYSTACK_FREE (yymsg);
1517
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1518
if (yymsg)
1519
yymsg_alloc = yyalloc;
1520
else
1521
{
1522
yymsg = yymsgbuf;
1523
yymsg_alloc = sizeof yymsgbuf;
1524
}
1525
}
1526
1527
if (0 < yysize && yysize <= yymsg_alloc)
1528
{
1529
(void) yysyntax_error (yymsg, yystate, yychar);
1530
yyerror (yymsg);
1531
}
1532
else
1533
{
1534
yyerror (YY_("syntax error"));
1535
if (yysize != 0)
1536
goto yyexhaustedlab;
1537
}
1538
}
1539
#endif
1540
}
1541
1542
1543
1544
if (yyerrstatus == 3)
1545
{
1546
/* If just tried and failed to reuse look-ahead token after an
1547
error, discard it. */
1548
1549
if (yychar <= YYEOF)
1550
{
1551
/* Return failure if at end of input. */
1552
if (yychar == YYEOF)
1553
YYABORT;
1554
}
1555
else
1556
{
1557
yydestruct ("Error: discarding",
1558
yytoken, &yylval);
1559
yychar = YYEMPTY;
1560
}
1561
}
1562
1563
/* Else will try to reuse look-ahead token after shifting the error
1564
token. */
1565
goto yyerrlab1;
1566
1567
1568
/*---------------------------------------------------.
1569
| yyerrorlab -- error raised explicitly by YYERROR. |
1570
`---------------------------------------------------*/
1571
yyerrorlab:
1572
1573
/* Pacify compilers like GCC when the user code never invokes
1574
YYERROR and the label yyerrorlab therefore never appears in user
1575
code. */
1576
if (/*CONSTCOND*/ 0)
1577
goto yyerrorlab;
1578
1579
/* Do not reclaim the symbols of the rule which action triggered
1580
this YYERROR. */
1581
YYPOPSTACK (yylen);
1582
yylen = 0;
1583
YY_STACK_PRINT (yyss, yyssp);
1584
yystate = *yyssp;
1585
goto yyerrlab1;
1586
1587
1588
/*-------------------------------------------------------------.
1589
| yyerrlab1 -- common code for both syntax error and YYERROR. |
1590
`-------------------------------------------------------------*/
1591
yyerrlab1:
1592
yyerrstatus = 3; /* Each real token shifted decrements this. */
1593
1594
for (;;)
1595
{
1596
yyn = yypact[yystate];
1597
if (yyn != YYPACT_NINF)
1598
{
1599
yyn += YYTERROR;
1600
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1601
{
1602
yyn = yytable[yyn];
1603
if (0 < yyn)
1604
break;
1605
}
1606
}
1607
1608
/* Pop the current state because it cannot handle the error token. */
1609
if (yyssp == yyss)
1610
YYABORT;
1611
1612
1613
yydestruct ("Error: popping",
1614
yystos[yystate], yyvsp);
1615
YYPOPSTACK (1);
1616
yystate = *yyssp;
1617
YY_STACK_PRINT (yyss, yyssp);
1618
}
1619
1620
if (yyn == YYFINAL)
1621
YYACCEPT;
1622
1623
*++yyvsp = yylval;
1624
1625
1626
/* Shift the error token. */
1627
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1628
1629
yystate = yyn;
1630
goto yynewstate;
1631
1632
1633
/*-------------------------------------.
1634
| yyacceptlab -- YYACCEPT comes here. |
1635
`-------------------------------------*/
1636
yyacceptlab:
1637
yyresult = 0;
1638
goto yyreturn;
1639
1640
/*-----------------------------------.
1641
| yyabortlab -- YYABORT comes here. |
1642
`-----------------------------------*/
1643
yyabortlab:
1644
yyresult = 1;
1645
goto yyreturn;
1646
1647
#ifndef yyoverflow
1648
/*-------------------------------------------------.
1649
| yyexhaustedlab -- memory exhaustion comes here. |
1650
`-------------------------------------------------*/
1651
yyexhaustedlab:
1652
yyerror (YY_("memory exhausted"));
1653
yyresult = 2;
1654
/* Fall through. */
1655
#endif
1656
1657
yyreturn:
1658
if (yychar != YYEOF && yychar != YYEMPTY)
1659
yydestruct ("Cleanup: discarding lookahead",
1660
yytoken, &yylval);
1661
/* Do not reclaim the symbols of the rule which action triggered
1662
this YYABORT or YYACCEPT. */
1663
YYPOPSTACK (yylen);
1664
YY_STACK_PRINT (yyss, yyssp);
1665
while (yyssp != yyss)
1666
{
1667
yydestruct ("Cleanup: popping",
1668
yystos[*yyssp], yyvsp);
1669
YYPOPSTACK (1);
1670
}
1671
#ifndef yyoverflow
1672
if (yyss != yyssa)
1673
YYSTACK_FREE (yyss);
1674
#endif
1675
#if YYERROR_VERBOSE
1676
if (yymsg != yymsgbuf)
1677
YYSTACK_FREE (yymsg);
1678
#endif
1679
/* Make sure YYID is used. */
1680
return YYID (yyresult);
1681
}
1682
1683
1684
#line 143 "parse.y"
1685
1686
1687
static long
1688
name2number(const char *str)
1689
{
1690
const char *p;
1691
long num = 0;
1692
const char *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1693
"abcdefghijklmnopqrstuvwxyz0123456789_";
1694
if(strlen(str) > 4) {
1695
yyerror("table name too long");
1696
return 0;
1697
}
1698
for(p = str; *p; p++){
1699
char *q = strchr(x, *p);
1700
if(q == NULL) {
1701
yyerror("invalid character in table name");
1702
return 0;
1703
}
1704
num = (num << 6) + (q - x) + 1;
1705
}
1706
num <<= 8;
1707
if(num > 0x7fffffff)
1708
num = -(0xffffffff - num + 1);
1709
return num;
1710
}
1711
1712
void
1713
yyerror (char *s)
1714
{
1715
_lex_error_message ("%s\n", s);
1716
}
1717
1718
1719