struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / sdbinutils / binutils / nlmheader.c
blob120cb751effdf141cbe51b72ef7851e1153e7209
1 /* A Bison parser, made by GNU Bison 3.0.4. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
44 #define YYBISON 1
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.4"
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
52 /* Pure parsers. */
53 #define YYPURE 0
55 /* Push parsers. */
56 #define YYPUSH 0
58 /* Pull parsers. */
59 #define YYPULL 1
64 /* Copy the first part of user declarations. */
65 #line 1 "nlmheader.y" /* yacc.c:339 */
66 /* nlmheader.y - parse NLM header specification keywords.
67 Copyright (C) 1993-2018 Free Software Foundation, Inc.
69 This file is part of GNU Binutils.
71 This program is free software; you can redistribute it and/or modify
72 it under the terms of the GNU General Public License as published by
73 the Free Software Foundation; either version 3 of the License, or
74 (at your option) any later version.
76 This program is distributed in the hope that it will be useful,
77 but WITHOUT ANY WARRANTY; without even the implied warranty of
78 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
79 GNU General Public License for more details.
81 You should have received a copy of the GNU General Public License
82 along with this program; if not, write to the Free Software
83 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
84 MA 02110-1301, USA. */
86 /* Written by Ian Lance Taylor <ian@cygnus.com>.
88 This bison file parses the commands recognized by the NetWare NLM
89 linker, except for lists of object files. It stores the
90 information in global variables.
92 This implementation is based on the description in the NetWare Tool
93 Maker Specification manual, edition 1.0. */
95 #include "sysdep.h"
96 #include "safe-ctype.h"
97 #include "bfd.h"
98 #include "nlm/common.h"
99 #include "nlm/internal.h"
100 #include "bucomm.h"
101 #include "nlmconv.h"
103 /* Information is stored in the structures pointed to by these
104 variables. */
106 Nlm_Internal_Fixed_Header *fixed_hdr;
107 Nlm_Internal_Variable_Header *var_hdr;
108 Nlm_Internal_Version_Header *version_hdr;
109 Nlm_Internal_Copyright_Header *copyright_hdr;
110 Nlm_Internal_Extended_Header *extended_hdr;
112 /* Procedure named by CHECK. */
113 char *check_procedure;
114 /* File named by CUSTOM. */
115 char *custom_file;
116 /* Whether to generate debugging information (DEBUG). */
117 bfd_boolean debug_info;
118 /* Procedure named by EXIT. */
119 char *exit_procedure;
120 /* Exported symbols (EXPORT). */
121 struct string_list *export_symbols;
122 /* List of files from INPUT. */
123 struct string_list *input_files;
124 /* Map file name (MAP, FULLMAP). */
125 char *map_file;
126 /* Whether a full map has been requested (FULLMAP). */
127 bfd_boolean full_map;
128 /* File named by HELP. */
129 char *help_file;
130 /* Imported symbols (IMPORT). */
131 struct string_list *import_symbols;
132 /* File named by MESSAGES. */
133 char *message_file;
134 /* Autoload module list (MODULE). */
135 struct string_list *modules;
136 /* File named by OUTPUT. */
137 char *output_file;
138 /* File named by SHARELIB. */
139 char *sharelib_file;
140 /* Start procedure name (START). */
141 char *start_procedure;
142 /* VERBOSE. */
143 bfd_boolean verbose;
144 /* RPC description file (XDCDATA). */
145 char *rpc_file;
147 /* The number of serious errors that have occurred. */
148 int parse_errors;
150 /* The current symbol prefix when reading a list of import or export
151 symbols. */
152 static char *symbol_prefix;
154 /* Parser error message handler. */
155 #define yyerror(msg) nlmheader_error (msg);
157 /* Local functions. */
158 static int yylex (void);
159 static void nlmlex_file_push (const char *);
160 static bfd_boolean nlmlex_file_open (const char *);
161 static int nlmlex_buf_init (void);
162 static char nlmlex_buf_add (int);
163 static long nlmlex_get_number (const char *);
164 static void nlmheader_identify (void);
165 static void nlmheader_warn (const char *, int);
166 static void nlmheader_error (const char *);
167 static struct string_list * string_list_cons (char *, struct string_list *);
168 static struct string_list * string_list_append (struct string_list *,
169 struct string_list *);
170 static struct string_list * string_list_append1 (struct string_list *,
171 char *);
172 static char *xstrdup (const char *);
175 #line 176 "nlmheader.c" /* yacc.c:339 */
177 # ifndef YY_NULLPTR
178 # if defined __cplusplus && 201103L <= __cplusplus
179 # define YY_NULLPTR nullptr
180 # else
181 # define YY_NULLPTR 0
182 # endif
183 # endif
185 /* Enabling verbose error messages. */
186 #ifdef YYERROR_VERBOSE
187 # undef YYERROR_VERBOSE
188 # define YYERROR_VERBOSE 1
189 #else
190 # define YYERROR_VERBOSE 0
191 #endif
193 /* In a future release of Bison, this section will be replaced
194 by #include "y.tab.h". */
195 #ifndef YY_YY_NLMHEADER_H_INCLUDED
196 # define YY_YY_NLMHEADER_H_INCLUDED
197 /* Debug traces. */
198 #ifndef YYDEBUG
199 # define YYDEBUG 0
200 #endif
201 #if YYDEBUG
202 extern int yydebug;
203 #endif
205 /* Token type. */
206 #ifndef YYTOKENTYPE
207 # define YYTOKENTYPE
208 enum yytokentype
210 CHECK = 258,
211 CODESTART = 259,
212 COPYRIGHT = 260,
213 CUSTOM = 261,
214 DATE = 262,
215 DEBUG_K = 263,
216 DESCRIPTION = 264,
217 EXIT = 265,
218 EXPORT = 266,
219 FLAG_ON = 267,
220 FLAG_OFF = 268,
221 FULLMAP = 269,
222 HELP = 270,
223 IMPORT = 271,
224 INPUT = 272,
225 MAP = 273,
226 MESSAGES = 274,
227 MODULE = 275,
228 MULTIPLE = 276,
229 OS_DOMAIN = 277,
230 OUTPUT = 278,
231 PSEUDOPREEMPTION = 279,
232 REENTRANT = 280,
233 SCREENNAME = 281,
234 SHARELIB = 282,
235 STACK = 283,
236 START = 284,
237 SYNCHRONIZE = 285,
238 THREADNAME = 286,
239 TYPE = 287,
240 VERBOSE = 288,
241 VERSIONK = 289,
242 XDCDATA = 290,
243 STRING = 291,
244 QUOTED_STRING = 292
246 #endif
247 /* Tokens. */
248 #define CHECK 258
249 #define CODESTART 259
250 #define COPYRIGHT 260
251 #define CUSTOM 261
252 #define DATE 262
253 #define DEBUG_K 263
254 #define DESCRIPTION 264
255 #define EXIT 265
256 #define EXPORT 266
257 #define FLAG_ON 267
258 #define FLAG_OFF 268
259 #define FULLMAP 269
260 #define HELP 270
261 #define IMPORT 271
262 #define INPUT 272
263 #define MAP 273
264 #define MESSAGES 274
265 #define MODULE 275
266 #define MULTIPLE 276
267 #define OS_DOMAIN 277
268 #define OUTPUT 278
269 #define PSEUDOPREEMPTION 279
270 #define REENTRANT 280
271 #define SCREENNAME 281
272 #define SHARELIB 282
273 #define STACK 283
274 #define START 284
275 #define SYNCHRONIZE 285
276 #define THREADNAME 286
277 #define TYPE 287
278 #define VERBOSE 288
279 #define VERSIONK 289
280 #define XDCDATA 290
281 #define STRING 291
282 #define QUOTED_STRING 292
284 /* Value type. */
285 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
287 union YYSTYPE
289 #line 112 "nlmheader.y" /* yacc.c:355 */
291 char *string;
292 struct string_list *list;
294 #line 295 "nlmheader.c" /* yacc.c:355 */
297 typedef union YYSTYPE YYSTYPE;
298 # define YYSTYPE_IS_TRIVIAL 1
299 # define YYSTYPE_IS_DECLARED 1
300 #endif
303 extern YYSTYPE yylval;
305 int yyparse (void);
307 #endif /* !YY_YY_NLMHEADER_H_INCLUDED */
309 /* Copy the second part of user declarations. */
311 #line 312 "nlmheader.c" /* yacc.c:358 */
313 #ifdef short
314 # undef short
315 #endif
317 #ifdef YYTYPE_UINT8
318 typedef YYTYPE_UINT8 yytype_uint8;
319 #else
320 typedef unsigned char yytype_uint8;
321 #endif
323 #ifdef YYTYPE_INT8
324 typedef YYTYPE_INT8 yytype_int8;
325 #else
326 typedef signed char yytype_int8;
327 #endif
329 #ifdef YYTYPE_UINT16
330 typedef YYTYPE_UINT16 yytype_uint16;
331 #else
332 typedef unsigned short int yytype_uint16;
333 #endif
335 #ifdef YYTYPE_INT16
336 typedef YYTYPE_INT16 yytype_int16;
337 #else
338 typedef short int yytype_int16;
339 #endif
341 #ifndef YYSIZE_T
342 # ifdef __SIZE_TYPE__
343 # define YYSIZE_T __SIZE_TYPE__
344 # elif defined size_t
345 # define YYSIZE_T size_t
346 # elif ! defined YYSIZE_T
347 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
348 # define YYSIZE_T size_t
349 # else
350 # define YYSIZE_T unsigned int
351 # endif
352 #endif
354 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
356 #ifndef YY_
357 # if defined YYENABLE_NLS && YYENABLE_NLS
358 # if ENABLE_NLS
359 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
360 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
361 # endif
362 # endif
363 # ifndef YY_
364 # define YY_(Msgid) Msgid
365 # endif
366 #endif
368 #ifndef YY_ATTRIBUTE
369 # if (defined __GNUC__ \
370 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
371 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
372 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
373 # else
374 # define YY_ATTRIBUTE(Spec) /* empty */
375 # endif
376 #endif
378 #ifndef YY_ATTRIBUTE_PURE
379 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
380 #endif
382 #ifndef YY_ATTRIBUTE_UNUSED
383 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
384 #endif
386 #if !defined _Noreturn \
387 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
388 # if defined _MSC_VER && 1200 <= _MSC_VER
389 # define _Noreturn __declspec (noreturn)
390 # else
391 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
392 # endif
393 #endif
395 /* Suppress unused-variable warnings by "using" E. */
396 #if ! defined lint || defined __GNUC__
397 # define YYUSE(E) ((void) (E))
398 #else
399 # define YYUSE(E) /* empty */
400 #endif
402 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
403 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
404 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
405 _Pragma ("GCC diagnostic push") \
406 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
407 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
408 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
409 _Pragma ("GCC diagnostic pop")
410 #else
411 # define YY_INITIAL_VALUE(Value) Value
412 #endif
413 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
414 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
415 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
416 #endif
417 #ifndef YY_INITIAL_VALUE
418 # define YY_INITIAL_VALUE(Value) /* Nothing. */
419 #endif
422 #if ! defined yyoverflow || YYERROR_VERBOSE
424 /* The parser invokes alloca or malloc; define the necessary symbols. */
426 # ifdef YYSTACK_USE_ALLOCA
427 # if YYSTACK_USE_ALLOCA
428 # ifdef __GNUC__
429 # define YYSTACK_ALLOC __builtin_alloca
430 # elif defined __BUILTIN_VA_ARG_INCR
431 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
432 # elif defined _AIX
433 # define YYSTACK_ALLOC __alloca
434 # elif defined _MSC_VER
435 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
436 # define alloca _alloca
437 # else
438 # define YYSTACK_ALLOC alloca
439 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
440 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
441 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
442 # ifndef EXIT_SUCCESS
443 # define EXIT_SUCCESS 0
444 # endif
445 # endif
446 # endif
447 # endif
448 # endif
450 # ifdef YYSTACK_ALLOC
451 /* Pacify GCC's 'empty if-body' warning. */
452 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
453 # ifndef YYSTACK_ALLOC_MAXIMUM
454 /* The OS might guarantee only one guard page at the bottom of the stack,
455 and a page size can be as small as 4096 bytes. So we cannot safely
456 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
457 to allow for a few compiler-allocated temporary stack slots. */
458 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
459 # endif
460 # else
461 # define YYSTACK_ALLOC YYMALLOC
462 # define YYSTACK_FREE YYFREE
463 # ifndef YYSTACK_ALLOC_MAXIMUM
464 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
465 # endif
466 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
467 && ! ((defined YYMALLOC || defined malloc) \
468 && (defined YYFREE || defined free)))
469 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
470 # ifndef EXIT_SUCCESS
471 # define EXIT_SUCCESS 0
472 # endif
473 # endif
474 # ifndef YYMALLOC
475 # define YYMALLOC malloc
476 # if ! defined malloc && ! defined EXIT_SUCCESS
477 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
478 # endif
479 # endif
480 # ifndef YYFREE
481 # define YYFREE free
482 # if ! defined free && ! defined EXIT_SUCCESS
483 void free (void *); /* INFRINGES ON USER NAME SPACE */
484 # endif
485 # endif
486 # endif
487 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
490 #if (! defined yyoverflow \
491 && (! defined __cplusplus \
492 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
494 /* A type that is properly aligned for any stack member. */
495 union yyalloc
497 yytype_int16 yyss_alloc;
498 YYSTYPE yyvs_alloc;
501 /* The size of the maximum gap between one aligned stack and the next. */
502 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
504 /* The size of an array large to enough to hold all stacks, each with
505 N elements. */
506 # define YYSTACK_BYTES(N) \
507 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
508 + YYSTACK_GAP_MAXIMUM)
510 # define YYCOPY_NEEDED 1
512 /* Relocate STACK from its old location to the new one. The
513 local variables YYSIZE and YYSTACKSIZE give the old and new number of
514 elements in the stack, and YYPTR gives the new location of the
515 stack. Advance YYPTR to a properly aligned location for the next
516 stack. */
517 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
518 do \
520 YYSIZE_T yynewbytes; \
521 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
522 Stack = &yyptr->Stack_alloc; \
523 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
524 yyptr += yynewbytes / sizeof (*yyptr); \
526 while (0)
528 #endif
530 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
531 /* Copy COUNT objects from SRC to DST. The source and destination do
532 not overlap. */
533 # ifndef YYCOPY
534 # if defined __GNUC__ && 1 < __GNUC__
535 # define YYCOPY(Dst, Src, Count) \
536 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
537 # else
538 # define YYCOPY(Dst, Src, Count) \
539 do \
541 YYSIZE_T yyi; \
542 for (yyi = 0; yyi < (Count); yyi++) \
543 (Dst)[yyi] = (Src)[yyi]; \
545 while (0)
546 # endif
547 # endif
548 #endif /* !YYCOPY_NEEDED */
550 /* YYFINAL -- State number of the termination state. */
551 #define YYFINAL 64
552 /* YYLAST -- Last index in YYTABLE. */
553 #define YYLAST 73
555 /* YYNTOKENS -- Number of terminals. */
556 #define YYNTOKENS 40
557 /* YYNNTS -- Number of nonterminals. */
558 #define YYNNTS 11
559 /* YYNRULES -- Number of rules. */
560 #define YYNRULES 52
561 /* YYNSTATES -- Number of states. */
562 #define YYNSTATES 82
564 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
565 by yylex, with out-of-bounds checking. */
566 #define YYUNDEFTOK 2
567 #define YYMAXUTOK 292
569 #define YYTRANSLATE(YYX) \
570 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
572 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
573 as returned by yylex, without out-of-bounds checking. */
574 static const yytype_uint8 yytranslate[] =
576 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 38, 39, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
602 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
603 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
604 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
605 35, 36, 37
608 #if YYDEBUG
609 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
610 static const yytype_uint16 yyrline[] =
612 0, 143, 143, 148, 150, 156, 160, 165, 182, 186,
613 204, 208, 224, 229, 228, 236, 241, 246, 251, 256,
614 261, 260, 268, 272, 276, 280, 284, 288, 292, 296,
615 303, 307, 311, 327, 331, 336, 340, 344, 360, 365,
616 369, 393, 409, 419, 422, 433, 437, 441, 445, 454,
617 465, 482, 485
619 #endif
621 #if YYDEBUG || YYERROR_VERBOSE || 0
622 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
623 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
624 static const char *const yytname[] =
626 "$end", "error", "$undefined", "CHECK", "CODESTART", "COPYRIGHT",
627 "CUSTOM", "DATE", "DEBUG_K", "DESCRIPTION", "EXIT", "EXPORT", "FLAG_ON",
628 "FLAG_OFF", "FULLMAP", "HELP", "IMPORT", "INPUT", "MAP", "MESSAGES",
629 "MODULE", "MULTIPLE", "OS_DOMAIN", "OUTPUT", "PSEUDOPREEMPTION",
630 "REENTRANT", "SCREENNAME", "SHARELIB", "STACK", "START", "SYNCHRONIZE",
631 "THREADNAME", "TYPE", "VERBOSE", "VERSIONK", "XDCDATA", "STRING",
632 "QUOTED_STRING", "'('", "')'", "$accept", "file", "commands", "command",
633 "$@1", "$@2", "symbol_list_opt", "symbol_list", "symbol_prefix",
634 "symbol", "string_list", YY_NULLPTR
636 #endif
638 # ifdef YYPRINT
639 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
640 (internal) symbol number NUM (which must be that of a token). */
641 static const yytype_uint16 yytoknum[] =
643 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
644 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
645 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
646 285, 286, 287, 288, 289, 290, 291, 292, 40, 41
648 # endif
650 #define YYPACT_NINF -20
652 #define yypact_value_is_default(Yystate) \
653 (!!((Yystate) == (-20)))
655 #define YYTABLE_NINF -1
657 #define yytable_value_is_error(Yytable_value) \
660 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
661 STATE-NUM. */
662 static const yytype_int8 yypact[] =
664 -3, -1, 1, 2, 4, 5, -20, 6, 8, -20,
665 9, 10, 11, 12, -20, 13, 14, 16, 13, -20,
666 -20, 17, -20, -20, 18, 20, 21, 22, -20, 23,
667 25, -20, 26, 27, 38, -20, -3, -20, -20, -20,
668 -20, 28, -20, -20, -2, -20, -20, -20, -20, -2,
669 13, -20, -20, -20, -20, -20, -20, -20, -20, -20,
670 -20, -20, 30, -20, -20, -20, 31, -20, 32, -20,
671 -2, -20, -20, -20, -20, 33, -20, 3, -20, -20,
672 -20, -20
675 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
676 Performed when YYTABLE does not specify something else to do. Zero
677 means the default is an error. */
678 static const yytype_uint8 yydefact[] =
680 3, 0, 0, 0, 0, 0, 10, 0, 0, 13,
681 0, 0, 17, 0, 20, 51, 23, 0, 51, 27,
682 28, 0, 30, 31, 0, 0, 0, 0, 36, 0,
683 0, 39, 0, 0, 0, 2, 3, 5, 6, 7,
684 8, 0, 11, 12, 43, 15, 16, 18, 19, 43,
685 51, 22, 24, 25, 26, 29, 32, 33, 34, 35,
686 37, 38, 0, 42, 1, 4, 0, 50, 0, 14,
687 44, 46, 45, 21, 52, 41, 9, 0, 48, 47,
688 40, 49
691 /* YYPGOTO[NTERM-NUM]. */
692 static const yytype_int8 yypgoto[] =
694 -20, -20, 34, -20, -20, -20, 24, -20, -19, -16,
698 /* YYDEFGOTO[NTERM-NUM]. */
699 static const yytype_int8 yydefgoto[] =
701 -1, 34, 35, 36, 44, 49, 69, 70, 71, 72,
705 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
706 positive, shift that token. If negative, reduce the rule whose
707 number is the opposite. If YYTABLE_NINF, syntax error. */
708 static const yytype_uint8 yytable[] =
710 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
711 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
712 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
713 31, 32, 33, 54, 67, 37, 68, 38, 64, 39,
714 40, 41, 81, 42, 43, 45, 46, 47, 48, 50,
715 52, 78, 53, 55, 79, 56, 57, 58, 59, 0,
716 60, 61, 62, 63, 66, 74, 75, 76, 77, 80,
717 65, 0, 0, 73
720 static const yytype_int8 yycheck[] =
722 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
723 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
724 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
725 33, 34, 35, 18, 36, 36, 38, 36, 0, 37,
726 36, 36, 39, 37, 36, 36, 36, 36, 36, 36,
727 36, 70, 36, 36, 70, 37, 36, 36, 36, -1,
728 37, 36, 36, 36, 36, 50, 36, 36, 36, 36,
729 36, -1, -1, 49
732 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
733 symbol of state STATE-NUM. */
734 static const yytype_uint8 yystos[] =
736 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
737 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
738 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
739 32, 33, 34, 35, 41, 42, 43, 36, 36, 37,
740 36, 36, 37, 36, 44, 36, 36, 36, 36, 45,
741 36, 50, 36, 36, 50, 36, 37, 36, 36, 36,
742 37, 36, 36, 36, 0, 42, 36, 36, 38, 46,
743 47, 48, 49, 46, 50, 36, 36, 36, 48, 49,
744 36, 39
747 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
748 static const yytype_uint8 yyr1[] =
750 0, 40, 41, 42, 42, 43, 43, 43, 43, 43,
751 43, 43, 43, 44, 43, 43, 43, 43, 43, 43,
752 45, 43, 43, 43, 43, 43, 43, 43, 43, 43,
753 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
754 43, 43, 43, 46, 46, 47, 47, 47, 47, 48,
755 49, 50, 50
758 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
759 static const yytype_uint8 yyr2[] =
761 0, 2, 1, 0, 2, 2, 2, 2, 2, 4,
762 1, 2, 2, 0, 3, 2, 2, 1, 2, 2,
763 0, 3, 2, 1, 2, 2, 2, 1, 1, 2,
764 1, 1, 2, 2, 2, 2, 1, 2, 2, 1,
765 4, 3, 2, 0, 1, 1, 1, 2, 2, 3,
766 1, 0, 2
770 #define yyerrok (yyerrstatus = 0)
771 #define yyclearin (yychar = YYEMPTY)
772 #define YYEMPTY (-2)
773 #define YYEOF 0
775 #define YYACCEPT goto yyacceptlab
776 #define YYABORT goto yyabortlab
777 #define YYERROR goto yyerrorlab
780 #define YYRECOVERING() (!!yyerrstatus)
782 #define YYBACKUP(Token, Value) \
783 do \
784 if (yychar == YYEMPTY) \
786 yychar = (Token); \
787 yylval = (Value); \
788 YYPOPSTACK (yylen); \
789 yystate = *yyssp; \
790 goto yybackup; \
792 else \
794 yyerror (YY_("syntax error: cannot back up")); \
795 YYERROR; \
797 while (0)
799 /* Error token number */
800 #define YYTERROR 1
801 #define YYERRCODE 256
805 /* Enable debugging if requested. */
806 #if YYDEBUG
808 # ifndef YYFPRINTF
809 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
810 # define YYFPRINTF fprintf
811 # endif
813 # define YYDPRINTF(Args) \
814 do { \
815 if (yydebug) \
816 YYFPRINTF Args; \
817 } while (0)
819 /* This macro is provided for backward compatibility. */
820 #ifndef YY_LOCATION_PRINT
821 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
822 #endif
825 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
826 do { \
827 if (yydebug) \
829 YYFPRINTF (stderr, "%s ", Title); \
830 yy_symbol_print (stderr, \
831 Type, Value); \
832 YYFPRINTF (stderr, "\n"); \
834 } while (0)
837 /*----------------------------------------.
838 | Print this symbol's value on YYOUTPUT. |
839 `----------------------------------------*/
841 static void
842 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
844 FILE *yyo = yyoutput;
845 YYUSE (yyo);
846 if (!yyvaluep)
847 return;
848 # ifdef YYPRINT
849 if (yytype < YYNTOKENS)
850 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
851 # endif
852 YYUSE (yytype);
856 /*--------------------------------.
857 | Print this symbol on YYOUTPUT. |
858 `--------------------------------*/
860 static void
861 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
863 YYFPRINTF (yyoutput, "%s %s (",
864 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
866 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
867 YYFPRINTF (yyoutput, ")");
870 /*------------------------------------------------------------------.
871 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
872 | TOP (included). |
873 `------------------------------------------------------------------*/
875 static void
876 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
878 YYFPRINTF (stderr, "Stack now");
879 for (; yybottom <= yytop; yybottom++)
881 int yybot = *yybottom;
882 YYFPRINTF (stderr, " %d", yybot);
884 YYFPRINTF (stderr, "\n");
887 # define YY_STACK_PRINT(Bottom, Top) \
888 do { \
889 if (yydebug) \
890 yy_stack_print ((Bottom), (Top)); \
891 } while (0)
894 /*------------------------------------------------.
895 | Report that the YYRULE is going to be reduced. |
896 `------------------------------------------------*/
898 static void
899 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
901 unsigned long int yylno = yyrline[yyrule];
902 int yynrhs = yyr2[yyrule];
903 int yyi;
904 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
905 yyrule - 1, yylno);
906 /* The symbols being reduced. */
907 for (yyi = 0; yyi < yynrhs; yyi++)
909 YYFPRINTF (stderr, " $%d = ", yyi + 1);
910 yy_symbol_print (stderr,
911 yystos[yyssp[yyi + 1 - yynrhs]],
912 &(yyvsp[(yyi + 1) - (yynrhs)])
914 YYFPRINTF (stderr, "\n");
918 # define YY_REDUCE_PRINT(Rule) \
919 do { \
920 if (yydebug) \
921 yy_reduce_print (yyssp, yyvsp, Rule); \
922 } while (0)
924 /* Nonzero means print parse trace. It is left uninitialized so that
925 multiple parsers can coexist. */
926 int yydebug;
927 #else /* !YYDEBUG */
928 # define YYDPRINTF(Args)
929 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
930 # define YY_STACK_PRINT(Bottom, Top)
931 # define YY_REDUCE_PRINT(Rule)
932 #endif /* !YYDEBUG */
935 /* YYINITDEPTH -- initial size of the parser's stacks. */
936 #ifndef YYINITDEPTH
937 # define YYINITDEPTH 200
938 #endif
940 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
941 if the built-in stack extension method is used).
943 Do not make this value too large; the results are undefined if
944 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
945 evaluated with infinite-precision integer arithmetic. */
947 #ifndef YYMAXDEPTH
948 # define YYMAXDEPTH 10000
949 #endif
952 #if YYERROR_VERBOSE
954 # ifndef yystrlen
955 # if defined __GLIBC__ && defined _STRING_H
956 # define yystrlen strlen
957 # else
958 /* Return the length of YYSTR. */
959 static YYSIZE_T
960 yystrlen (const char *yystr)
962 YYSIZE_T yylen;
963 for (yylen = 0; yystr[yylen]; yylen++)
964 continue;
965 return yylen;
967 # endif
968 # endif
970 # ifndef yystpcpy
971 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
972 # define yystpcpy stpcpy
973 # else
974 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
975 YYDEST. */
976 static char *
977 yystpcpy (char *yydest, const char *yysrc)
979 char *yyd = yydest;
980 const char *yys = yysrc;
982 while ((*yyd++ = *yys++) != '\0')
983 continue;
985 return yyd - 1;
987 # endif
988 # endif
990 # ifndef yytnamerr
991 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
992 quotes and backslashes, so that it's suitable for yyerror. The
993 heuristic is that double-quoting is unnecessary unless the string
994 contains an apostrophe, a comma, or backslash (other than
995 backslash-backslash). YYSTR is taken from yytname. If YYRES is
996 null, do not copy; instead, return the length of what the result
997 would have been. */
998 static YYSIZE_T
999 yytnamerr (char *yyres, const char *yystr)
1001 if (*yystr == '"')
1003 YYSIZE_T yyn = 0;
1004 char const *yyp = yystr;
1006 for (;;)
1007 switch (*++yyp)
1009 case '\'':
1010 case ',':
1011 goto do_not_strip_quotes;
1013 case '\\':
1014 if (*++yyp != '\\')
1015 goto do_not_strip_quotes;
1016 /* Fall through. */
1017 default:
1018 if (yyres)
1019 yyres[yyn] = *yyp;
1020 yyn++;
1021 break;
1023 case '"':
1024 if (yyres)
1025 yyres[yyn] = '\0';
1026 return yyn;
1028 do_not_strip_quotes: ;
1031 if (! yyres)
1032 return yystrlen (yystr);
1034 return yystpcpy (yyres, yystr) - yyres;
1036 # endif
1038 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1039 about the unexpected token YYTOKEN for the state stack whose top is
1040 YYSSP.
1042 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1043 not large enough to hold the message. In that case, also set
1044 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1045 required number of bytes is too large to store. */
1046 static int
1047 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1048 yytype_int16 *yyssp, int yytoken)
1050 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1051 YYSIZE_T yysize = yysize0;
1052 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1053 /* Internationalized format string. */
1054 const char *yyformat = YY_NULLPTR;
1055 /* Arguments of yyformat. */
1056 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1057 /* Number of reported tokens (one for the "unexpected", one per
1058 "expected"). */
1059 int yycount = 0;
1061 /* There are many possibilities here to consider:
1062 - If this state is a consistent state with a default action, then
1063 the only way this function was invoked is if the default action
1064 is an error action. In that case, don't check for expected
1065 tokens because there are none.
1066 - The only way there can be no lookahead present (in yychar) is if
1067 this state is a consistent state with a default action. Thus,
1068 detecting the absence of a lookahead is sufficient to determine
1069 that there is no unexpected or expected token to report. In that
1070 case, just report a simple "syntax error".
1071 - Don't assume there isn't a lookahead just because this state is a
1072 consistent state with a default action. There might have been a
1073 previous inconsistent state, consistent state with a non-default
1074 action, or user semantic action that manipulated yychar.
1075 - Of course, the expected token list depends on states to have
1076 correct lookahead information, and it depends on the parser not
1077 to perform extra reductions after fetching a lookahead from the
1078 scanner and before detecting a syntax error. Thus, state merging
1079 (from LALR or IELR) and default reductions corrupt the expected
1080 token list. However, the list is correct for canonical LR with
1081 one exception: it will still contain any token that will not be
1082 accepted due to an error action in a later state.
1084 if (yytoken != YYEMPTY)
1086 int yyn = yypact[*yyssp];
1087 yyarg[yycount++] = yytname[yytoken];
1088 if (!yypact_value_is_default (yyn))
1090 /* Start YYX at -YYN if negative to avoid negative indexes in
1091 YYCHECK. In other words, skip the first -YYN actions for
1092 this state because they are default actions. */
1093 int yyxbegin = yyn < 0 ? -yyn : 0;
1094 /* Stay within bounds of both yycheck and yytname. */
1095 int yychecklim = YYLAST - yyn + 1;
1096 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1097 int yyx;
1099 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1100 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1101 && !yytable_value_is_error (yytable[yyx + yyn]))
1103 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1105 yycount = 1;
1106 yysize = yysize0;
1107 break;
1109 yyarg[yycount++] = yytname[yyx];
1111 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1112 if (! (yysize <= yysize1
1113 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1114 return 2;
1115 yysize = yysize1;
1121 switch (yycount)
1123 # define YYCASE_(N, S) \
1124 case N: \
1125 yyformat = S; \
1126 break
1127 YYCASE_(0, YY_("syntax error"));
1128 YYCASE_(1, YY_("syntax error, unexpected %s"));
1129 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1130 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1131 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1132 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1133 # undef YYCASE_
1137 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1138 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1139 return 2;
1140 yysize = yysize1;
1143 if (*yymsg_alloc < yysize)
1145 *yymsg_alloc = 2 * yysize;
1146 if (! (yysize <= *yymsg_alloc
1147 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1148 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1149 return 1;
1152 /* Avoid sprintf, as that infringes on the user's name space.
1153 Don't have undefined behavior even if the translation
1154 produced a string with the wrong number of "%s"s. */
1156 char *yyp = *yymsg;
1157 int yyi = 0;
1158 while ((*yyp = *yyformat) != '\0')
1159 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1161 yyp += yytnamerr (yyp, yyarg[yyi++]);
1162 yyformat += 2;
1164 else
1166 yyp++;
1167 yyformat++;
1170 return 0;
1172 #endif /* YYERROR_VERBOSE */
1174 /*-----------------------------------------------.
1175 | Release the memory associated to this symbol. |
1176 `-----------------------------------------------*/
1178 static void
1179 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1181 YYUSE (yyvaluep);
1182 if (!yymsg)
1183 yymsg = "Deleting";
1184 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1186 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1187 YYUSE (yytype);
1188 YY_IGNORE_MAYBE_UNINITIALIZED_END
1194 /* The lookahead symbol. */
1195 int yychar;
1197 /* The semantic value of the lookahead symbol. */
1198 YYSTYPE yylval;
1199 /* Number of syntax errors so far. */
1200 int yynerrs;
1203 /*----------.
1204 | yyparse. |
1205 `----------*/
1208 yyparse (void)
1210 int yystate;
1211 /* Number of tokens to shift before error messages enabled. */
1212 int yyerrstatus;
1214 /* The stacks and their tools:
1215 'yyss': related to states.
1216 'yyvs': related to semantic values.
1218 Refer to the stacks through separate pointers, to allow yyoverflow
1219 to reallocate them elsewhere. */
1221 /* The state stack. */
1222 yytype_int16 yyssa[YYINITDEPTH];
1223 yytype_int16 *yyss;
1224 yytype_int16 *yyssp;
1226 /* The semantic value stack. */
1227 YYSTYPE yyvsa[YYINITDEPTH];
1228 YYSTYPE *yyvs;
1229 YYSTYPE *yyvsp;
1231 YYSIZE_T yystacksize;
1233 int yyn;
1234 int yyresult;
1235 /* Lookahead token as an internal (translated) token number. */
1236 int yytoken = 0;
1237 /* The variables used to return semantic value and location from the
1238 action routines. */
1239 YYSTYPE yyval;
1241 #if YYERROR_VERBOSE
1242 /* Buffer for error messages, and its allocated size. */
1243 char yymsgbuf[128];
1244 char *yymsg = yymsgbuf;
1245 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1246 #endif
1248 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1250 /* The number of symbols on the RHS of the reduced rule.
1251 Keep to zero when no symbol should be popped. */
1252 int yylen = 0;
1254 yyssp = yyss = yyssa;
1255 yyvsp = yyvs = yyvsa;
1256 yystacksize = YYINITDEPTH;
1258 YYDPRINTF ((stderr, "Starting parse\n"));
1260 yystate = 0;
1261 yyerrstatus = 0;
1262 yynerrs = 0;
1263 yychar = YYEMPTY; /* Cause a token to be read. */
1264 goto yysetstate;
1266 /*------------------------------------------------------------.
1267 | yynewstate -- Push a new state, which is found in yystate. |
1268 `------------------------------------------------------------*/
1269 yynewstate:
1270 /* In all cases, when you get here, the value and location stacks
1271 have just been pushed. So pushing a state here evens the stacks. */
1272 yyssp++;
1274 yysetstate:
1275 *yyssp = yystate;
1277 if (yyss + yystacksize - 1 <= yyssp)
1279 /* Get the current used size of the three stacks, in elements. */
1280 YYSIZE_T yysize = yyssp - yyss + 1;
1282 #ifdef yyoverflow
1284 /* Give user a chance to reallocate the stack. Use copies of
1285 these so that the &'s don't force the real ones into
1286 memory. */
1287 YYSTYPE *yyvs1 = yyvs;
1288 yytype_int16 *yyss1 = yyss;
1290 /* Each stack pointer address is followed by the size of the
1291 data in use in that stack, in bytes. This used to be a
1292 conditional around just the two extra args, but that might
1293 be undefined if yyoverflow is a macro. */
1294 yyoverflow (YY_("memory exhausted"),
1295 &yyss1, yysize * sizeof (*yyssp),
1296 &yyvs1, yysize * sizeof (*yyvsp),
1297 &yystacksize);
1299 yyss = yyss1;
1300 yyvs = yyvs1;
1302 #else /* no yyoverflow */
1303 # ifndef YYSTACK_RELOCATE
1304 goto yyexhaustedlab;
1305 # else
1306 /* Extend the stack our own way. */
1307 if (YYMAXDEPTH <= yystacksize)
1308 goto yyexhaustedlab;
1309 yystacksize *= 2;
1310 if (YYMAXDEPTH < yystacksize)
1311 yystacksize = YYMAXDEPTH;
1314 yytype_int16 *yyss1 = yyss;
1315 union yyalloc *yyptr =
1316 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1317 if (! yyptr)
1318 goto yyexhaustedlab;
1319 YYSTACK_RELOCATE (yyss_alloc, yyss);
1320 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1321 # undef YYSTACK_RELOCATE
1322 if (yyss1 != yyssa)
1323 YYSTACK_FREE (yyss1);
1325 # endif
1326 #endif /* no yyoverflow */
1328 yyssp = yyss + yysize - 1;
1329 yyvsp = yyvs + yysize - 1;
1331 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1332 (unsigned long int) yystacksize));
1334 if (yyss + yystacksize - 1 <= yyssp)
1335 YYABORT;
1338 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1340 if (yystate == YYFINAL)
1341 YYACCEPT;
1343 goto yybackup;
1345 /*-----------.
1346 | yybackup. |
1347 `-----------*/
1348 yybackup:
1350 /* Do appropriate processing given the current state. Read a
1351 lookahead token if we need one and don't already have one. */
1353 /* First try to decide what to do without reference to lookahead token. */
1354 yyn = yypact[yystate];
1355 if (yypact_value_is_default (yyn))
1356 goto yydefault;
1358 /* Not known => get a lookahead token if don't already have one. */
1360 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1361 if (yychar == YYEMPTY)
1363 YYDPRINTF ((stderr, "Reading a token: "));
1364 yychar = yylex ();
1367 if (yychar <= YYEOF)
1369 yychar = yytoken = YYEOF;
1370 YYDPRINTF ((stderr, "Now at end of input.\n"));
1372 else
1374 yytoken = YYTRANSLATE (yychar);
1375 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1378 /* If the proper action on seeing token YYTOKEN is to reduce or to
1379 detect an error, take that action. */
1380 yyn += yytoken;
1381 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1382 goto yydefault;
1383 yyn = yytable[yyn];
1384 if (yyn <= 0)
1386 if (yytable_value_is_error (yyn))
1387 goto yyerrlab;
1388 yyn = -yyn;
1389 goto yyreduce;
1392 /* Count tokens shifted since error; after three, turn off error
1393 status. */
1394 if (yyerrstatus)
1395 yyerrstatus--;
1397 /* Shift the lookahead token. */
1398 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1400 /* Discard the shifted token. */
1401 yychar = YYEMPTY;
1403 yystate = yyn;
1404 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1405 *++yyvsp = yylval;
1406 YY_IGNORE_MAYBE_UNINITIALIZED_END
1408 goto yynewstate;
1411 /*-----------------------------------------------------------.
1412 | yydefault -- do the default action for the current state. |
1413 `-----------------------------------------------------------*/
1414 yydefault:
1415 yyn = yydefact[yystate];
1416 if (yyn == 0)
1417 goto yyerrlab;
1418 goto yyreduce;
1421 /*-----------------------------.
1422 | yyreduce -- Do a reduction. |
1423 `-----------------------------*/
1424 yyreduce:
1425 /* yyn is the number of a rule to reduce with. */
1426 yylen = yyr2[yyn];
1428 /* If YYLEN is nonzero, implement the default value of the action:
1429 '$$ = $1'.
1431 Otherwise, the following line sets YYVAL to garbage.
1432 This behavior is undocumented and Bison
1433 users should not rely upon it. Assigning to YYVAL
1434 unconditionally makes the parser a bit smaller, and it avoids a
1435 GCC warning that YYVAL may be used uninitialized. */
1436 yyval = yyvsp[1-yylen];
1439 YY_REDUCE_PRINT (yyn);
1440 switch (yyn)
1442 case 5:
1443 #line 157 "nlmheader.y" /* yacc.c:1646 */
1445 check_procedure = (yyvsp[0].string);
1447 #line 1448 "nlmheader.c" /* yacc.c:1646 */
1448 break;
1450 case 6:
1451 #line 161 "nlmheader.y" /* yacc.c:1646 */
1453 nlmheader_warn (_("CODESTART is not implemented; sorry"), -1);
1454 free ((yyvsp[0].string));
1456 #line 1457 "nlmheader.c" /* yacc.c:1646 */
1457 break;
1459 case 7:
1460 #line 166 "nlmheader.y" /* yacc.c:1646 */
1462 int len;
1464 strncpy (copyright_hdr->stamp, "CoPyRiGhT=", 10);
1465 len = strlen ((yyvsp[0].string));
1466 if (len >= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH)
1468 nlmheader_warn (_("copyright string is too long"),
1469 NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1);
1470 len = NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1;
1472 copyright_hdr->copyrightMessageLength = len;
1473 strncpy (copyright_hdr->copyrightMessage, (yyvsp[0].string), len);
1474 copyright_hdr->copyrightMessage[len] = '\0';
1475 free ((yyvsp[0].string));
1477 #line 1478 "nlmheader.c" /* yacc.c:1646 */
1478 break;
1480 case 8:
1481 #line 183 "nlmheader.y" /* yacc.c:1646 */
1483 custom_file = (yyvsp[0].string);
1485 #line 1486 "nlmheader.c" /* yacc.c:1646 */
1486 break;
1488 case 9:
1489 #line 187 "nlmheader.y" /* yacc.c:1646 */
1491 /* We don't set the version stamp here, because we use the
1492 version stamp to detect whether the required VERSION
1493 keyword was given. */
1494 version_hdr->month = nlmlex_get_number ((yyvsp[-2].string));
1495 version_hdr->day = nlmlex_get_number ((yyvsp[-1].string));
1496 version_hdr->year = nlmlex_get_number ((yyvsp[0].string));
1497 free ((yyvsp[-2].string));
1498 free ((yyvsp[-1].string));
1499 free ((yyvsp[0].string));
1500 if (version_hdr->month < 1 || version_hdr->month > 12)
1501 nlmheader_warn (_("illegal month"), -1);
1502 if (version_hdr->day < 1 || version_hdr->day > 31)
1503 nlmheader_warn (_("illegal day"), -1);
1504 if (version_hdr->year < 1900 || version_hdr->year > 3000)
1505 nlmheader_warn (_("illegal year"), -1);
1507 #line 1508 "nlmheader.c" /* yacc.c:1646 */
1508 break;
1510 case 10:
1511 #line 205 "nlmheader.y" /* yacc.c:1646 */
1513 debug_info = TRUE;
1515 #line 1516 "nlmheader.c" /* yacc.c:1646 */
1516 break;
1518 case 11:
1519 #line 209 "nlmheader.y" /* yacc.c:1646 */
1521 int len;
1523 len = strlen ((yyvsp[0].string));
1524 if (len > NLM_MAX_DESCRIPTION_LENGTH)
1526 nlmheader_warn (_("description string is too long"),
1527 NLM_MAX_DESCRIPTION_LENGTH);
1528 len = NLM_MAX_DESCRIPTION_LENGTH;
1530 var_hdr->descriptionLength = len;
1531 strncpy (var_hdr->descriptionText, (yyvsp[0].string), len);
1532 var_hdr->descriptionText[len] = '\0';
1533 free ((yyvsp[0].string));
1535 #line 1536 "nlmheader.c" /* yacc.c:1646 */
1536 break;
1538 case 12:
1539 #line 225 "nlmheader.y" /* yacc.c:1646 */
1541 exit_procedure = (yyvsp[0].string);
1543 #line 1544 "nlmheader.c" /* yacc.c:1646 */
1544 break;
1546 case 13:
1547 #line 229 "nlmheader.y" /* yacc.c:1646 */
1549 symbol_prefix = NULL;
1551 #line 1552 "nlmheader.c" /* yacc.c:1646 */
1552 break;
1554 case 14:
1555 #line 233 "nlmheader.y" /* yacc.c:1646 */
1557 export_symbols = string_list_append (export_symbols, (yyvsp[0].list));
1559 #line 1560 "nlmheader.c" /* yacc.c:1646 */
1560 break;
1562 case 15:
1563 #line 237 "nlmheader.y" /* yacc.c:1646 */
1565 fixed_hdr->flags |= nlmlex_get_number ((yyvsp[0].string));
1566 free ((yyvsp[0].string));
1568 #line 1569 "nlmheader.c" /* yacc.c:1646 */
1569 break;
1571 case 16:
1572 #line 242 "nlmheader.y" /* yacc.c:1646 */
1574 fixed_hdr->flags &=~ nlmlex_get_number ((yyvsp[0].string));
1575 free ((yyvsp[0].string));
1577 #line 1578 "nlmheader.c" /* yacc.c:1646 */
1578 break;
1580 case 17:
1581 #line 247 "nlmheader.y" /* yacc.c:1646 */
1583 map_file = "";
1584 full_map = TRUE;
1586 #line 1587 "nlmheader.c" /* yacc.c:1646 */
1587 break;
1589 case 18:
1590 #line 252 "nlmheader.y" /* yacc.c:1646 */
1592 map_file = (yyvsp[0].string);
1593 full_map = TRUE;
1595 #line 1596 "nlmheader.c" /* yacc.c:1646 */
1596 break;
1598 case 19:
1599 #line 257 "nlmheader.y" /* yacc.c:1646 */
1601 help_file = (yyvsp[0].string);
1603 #line 1604 "nlmheader.c" /* yacc.c:1646 */
1604 break;
1606 case 20:
1607 #line 261 "nlmheader.y" /* yacc.c:1646 */
1609 symbol_prefix = NULL;
1611 #line 1612 "nlmheader.c" /* yacc.c:1646 */
1612 break;
1614 case 21:
1615 #line 265 "nlmheader.y" /* yacc.c:1646 */
1617 import_symbols = string_list_append (import_symbols, (yyvsp[0].list));
1619 #line 1620 "nlmheader.c" /* yacc.c:1646 */
1620 break;
1622 case 22:
1623 #line 269 "nlmheader.y" /* yacc.c:1646 */
1625 input_files = string_list_append (input_files, (yyvsp[0].list));
1627 #line 1628 "nlmheader.c" /* yacc.c:1646 */
1628 break;
1630 case 23:
1631 #line 273 "nlmheader.y" /* yacc.c:1646 */
1633 map_file = "";
1635 #line 1636 "nlmheader.c" /* yacc.c:1646 */
1636 break;
1638 case 24:
1639 #line 277 "nlmheader.y" /* yacc.c:1646 */
1641 map_file = (yyvsp[0].string);
1643 #line 1644 "nlmheader.c" /* yacc.c:1646 */
1644 break;
1646 case 25:
1647 #line 281 "nlmheader.y" /* yacc.c:1646 */
1649 message_file = (yyvsp[0].string);
1651 #line 1652 "nlmheader.c" /* yacc.c:1646 */
1652 break;
1654 case 26:
1655 #line 285 "nlmheader.y" /* yacc.c:1646 */
1657 modules = string_list_append (modules, (yyvsp[0].list));
1659 #line 1660 "nlmheader.c" /* yacc.c:1646 */
1660 break;
1662 case 27:
1663 #line 289 "nlmheader.y" /* yacc.c:1646 */
1665 fixed_hdr->flags |= 0x2;
1667 #line 1668 "nlmheader.c" /* yacc.c:1646 */
1668 break;
1670 case 28:
1671 #line 293 "nlmheader.y" /* yacc.c:1646 */
1673 fixed_hdr->flags |= 0x10;
1675 #line 1676 "nlmheader.c" /* yacc.c:1646 */
1676 break;
1678 case 29:
1679 #line 297 "nlmheader.y" /* yacc.c:1646 */
1681 if (output_file == NULL)
1682 output_file = (yyvsp[0].string);
1683 else
1684 nlmheader_warn (_("ignoring duplicate OUTPUT statement"), -1);
1686 #line 1687 "nlmheader.c" /* yacc.c:1646 */
1687 break;
1689 case 30:
1690 #line 304 "nlmheader.y" /* yacc.c:1646 */
1692 fixed_hdr->flags |= 0x8;
1694 #line 1695 "nlmheader.c" /* yacc.c:1646 */
1695 break;
1697 case 31:
1698 #line 308 "nlmheader.y" /* yacc.c:1646 */
1700 fixed_hdr->flags |= 0x1;
1702 #line 1703 "nlmheader.c" /* yacc.c:1646 */
1703 break;
1705 case 32:
1706 #line 312 "nlmheader.y" /* yacc.c:1646 */
1708 int len;
1710 len = strlen ((yyvsp[0].string));
1711 if (len >= NLM_MAX_SCREEN_NAME_LENGTH)
1713 nlmheader_warn (_("screen name is too long"),
1714 NLM_MAX_SCREEN_NAME_LENGTH);
1715 len = NLM_MAX_SCREEN_NAME_LENGTH;
1717 var_hdr->screenNameLength = len;
1718 strncpy (var_hdr->screenName, (yyvsp[0].string), len);
1719 var_hdr->screenName[NLM_MAX_SCREEN_NAME_LENGTH] = '\0';
1720 free ((yyvsp[0].string));
1722 #line 1723 "nlmheader.c" /* yacc.c:1646 */
1723 break;
1725 case 33:
1726 #line 328 "nlmheader.y" /* yacc.c:1646 */
1728 sharelib_file = (yyvsp[0].string);
1730 #line 1731 "nlmheader.c" /* yacc.c:1646 */
1731 break;
1733 case 34:
1734 #line 332 "nlmheader.y" /* yacc.c:1646 */
1736 var_hdr->stackSize = nlmlex_get_number ((yyvsp[0].string));
1737 free ((yyvsp[0].string));
1739 #line 1740 "nlmheader.c" /* yacc.c:1646 */
1740 break;
1742 case 35:
1743 #line 337 "nlmheader.y" /* yacc.c:1646 */
1745 start_procedure = (yyvsp[0].string);
1747 #line 1748 "nlmheader.c" /* yacc.c:1646 */
1748 break;
1750 case 36:
1751 #line 341 "nlmheader.y" /* yacc.c:1646 */
1753 fixed_hdr->flags |= 0x4;
1755 #line 1756 "nlmheader.c" /* yacc.c:1646 */
1756 break;
1758 case 37:
1759 #line 345 "nlmheader.y" /* yacc.c:1646 */
1761 int len;
1763 len = strlen ((yyvsp[0].string));
1764 if (len >= NLM_MAX_THREAD_NAME_LENGTH)
1766 nlmheader_warn (_("thread name is too long"),
1767 NLM_MAX_THREAD_NAME_LENGTH);
1768 len = NLM_MAX_THREAD_NAME_LENGTH;
1770 var_hdr->threadNameLength = len;
1771 strncpy (var_hdr->threadName, (yyvsp[0].string), len);
1772 var_hdr->threadName[len] = '\0';
1773 free ((yyvsp[0].string));
1775 #line 1776 "nlmheader.c" /* yacc.c:1646 */
1776 break;
1778 case 38:
1779 #line 361 "nlmheader.y" /* yacc.c:1646 */
1781 fixed_hdr->moduleType = nlmlex_get_number ((yyvsp[0].string));
1782 free ((yyvsp[0].string));
1784 #line 1785 "nlmheader.c" /* yacc.c:1646 */
1785 break;
1787 case 39:
1788 #line 366 "nlmheader.y" /* yacc.c:1646 */
1790 verbose = TRUE;
1792 #line 1793 "nlmheader.c" /* yacc.c:1646 */
1793 break;
1795 case 40:
1796 #line 370 "nlmheader.y" /* yacc.c:1646 */
1798 long val;
1800 strncpy (version_hdr->stamp, "VeRsIoN#", 8);
1801 version_hdr->majorVersion = nlmlex_get_number ((yyvsp[-2].string));
1802 val = nlmlex_get_number ((yyvsp[-1].string));
1803 if (val < 0 || val > 99)
1804 nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1805 -1);
1806 else
1807 version_hdr->minorVersion = val;
1808 val = nlmlex_get_number ((yyvsp[0].string));
1809 if (val < 0)
1810 nlmheader_warn (_("illegal revision number (must be between 0 and 26)"),
1811 -1);
1812 else if (val > 26)
1813 version_hdr->revision = 0;
1814 else
1815 version_hdr->revision = val;
1816 free ((yyvsp[-2].string));
1817 free ((yyvsp[-1].string));
1818 free ((yyvsp[0].string));
1820 #line 1821 "nlmheader.c" /* yacc.c:1646 */
1821 break;
1823 case 41:
1824 #line 394 "nlmheader.y" /* yacc.c:1646 */
1826 long val;
1828 strncpy (version_hdr->stamp, "VeRsIoN#", 8);
1829 version_hdr->majorVersion = nlmlex_get_number ((yyvsp[-1].string));
1830 val = nlmlex_get_number ((yyvsp[0].string));
1831 if (val < 0 || val > 99)
1832 nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1833 -1);
1834 else
1835 version_hdr->minorVersion = val;
1836 version_hdr->revision = 0;
1837 free ((yyvsp[-1].string));
1838 free ((yyvsp[0].string));
1840 #line 1841 "nlmheader.c" /* yacc.c:1646 */
1841 break;
1843 case 42:
1844 #line 410 "nlmheader.y" /* yacc.c:1646 */
1846 rpc_file = (yyvsp[0].string);
1848 #line 1849 "nlmheader.c" /* yacc.c:1646 */
1849 break;
1851 case 43:
1852 #line 419 "nlmheader.y" /* yacc.c:1646 */
1854 (yyval.list) = NULL;
1856 #line 1857 "nlmheader.c" /* yacc.c:1646 */
1857 break;
1859 case 44:
1860 #line 423 "nlmheader.y" /* yacc.c:1646 */
1862 (yyval.list) = (yyvsp[0].list);
1864 #line 1865 "nlmheader.c" /* yacc.c:1646 */
1865 break;
1867 case 45:
1868 #line 434 "nlmheader.y" /* yacc.c:1646 */
1870 (yyval.list) = string_list_cons ((yyvsp[0].string), NULL);
1872 #line 1873 "nlmheader.c" /* yacc.c:1646 */
1873 break;
1875 case 46:
1876 #line 438 "nlmheader.y" /* yacc.c:1646 */
1878 (yyval.list) = NULL;
1880 #line 1881 "nlmheader.c" /* yacc.c:1646 */
1881 break;
1883 case 47:
1884 #line 442 "nlmheader.y" /* yacc.c:1646 */
1886 (yyval.list) = string_list_append1 ((yyvsp[-1].list), (yyvsp[0].string));
1888 #line 1889 "nlmheader.c" /* yacc.c:1646 */
1889 break;
1891 case 48:
1892 #line 446 "nlmheader.y" /* yacc.c:1646 */
1894 (yyval.list) = (yyvsp[-1].list);
1896 #line 1897 "nlmheader.c" /* yacc.c:1646 */
1897 break;
1899 case 49:
1900 #line 455 "nlmheader.y" /* yacc.c:1646 */
1902 if (symbol_prefix != NULL)
1903 free (symbol_prefix);
1904 symbol_prefix = (yyvsp[-1].string);
1906 #line 1907 "nlmheader.c" /* yacc.c:1646 */
1907 break;
1909 case 50:
1910 #line 466 "nlmheader.y" /* yacc.c:1646 */
1912 if (symbol_prefix == NULL)
1913 (yyval.string) = (yyvsp[0].string);
1914 else
1916 (yyval.string) = xmalloc (strlen (symbol_prefix) + strlen ((yyvsp[0].string)) + 2);
1917 sprintf ((yyval.string), "%s@%s", symbol_prefix, (yyvsp[0].string));
1918 free ((yyvsp[0].string));
1921 #line 1922 "nlmheader.c" /* yacc.c:1646 */
1922 break;
1924 case 51:
1925 #line 482 "nlmheader.y" /* yacc.c:1646 */
1927 (yyval.list) = NULL;
1929 #line 1930 "nlmheader.c" /* yacc.c:1646 */
1930 break;
1932 case 52:
1933 #line 486 "nlmheader.y" /* yacc.c:1646 */
1935 (yyval.list) = string_list_cons ((yyvsp[-1].string), (yyvsp[0].list));
1937 #line 1938 "nlmheader.c" /* yacc.c:1646 */
1938 break;
1941 #line 1942 "nlmheader.c" /* yacc.c:1646 */
1942 default: break;
1944 /* User semantic actions sometimes alter yychar, and that requires
1945 that yytoken be updated with the new translation. We take the
1946 approach of translating immediately before every use of yytoken.
1947 One alternative is translating here after every semantic action,
1948 but that translation would be missed if the semantic action invokes
1949 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1950 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1951 incorrect destructor might then be invoked immediately. In the
1952 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1953 to an incorrect destructor call or verbose syntax error message
1954 before the lookahead is translated. */
1955 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1957 YYPOPSTACK (yylen);
1958 yylen = 0;
1959 YY_STACK_PRINT (yyss, yyssp);
1961 *++yyvsp = yyval;
1963 /* Now 'shift' the result of the reduction. Determine what state
1964 that goes to, based on the state we popped back to and the rule
1965 number reduced by. */
1967 yyn = yyr1[yyn];
1969 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1970 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1971 yystate = yytable[yystate];
1972 else
1973 yystate = yydefgoto[yyn - YYNTOKENS];
1975 goto yynewstate;
1978 /*--------------------------------------.
1979 | yyerrlab -- here on detecting error. |
1980 `--------------------------------------*/
1981 yyerrlab:
1982 /* Make sure we have latest lookahead translation. See comments at
1983 user semantic actions for why this is necessary. */
1984 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1986 /* If not already recovering from an error, report this error. */
1987 if (!yyerrstatus)
1989 ++yynerrs;
1990 #if ! YYERROR_VERBOSE
1991 yyerror (YY_("syntax error"));
1992 #else
1993 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1994 yyssp, yytoken)
1996 char const *yymsgp = YY_("syntax error");
1997 int yysyntax_error_status;
1998 yysyntax_error_status = YYSYNTAX_ERROR;
1999 if (yysyntax_error_status == 0)
2000 yymsgp = yymsg;
2001 else if (yysyntax_error_status == 1)
2003 if (yymsg != yymsgbuf)
2004 YYSTACK_FREE (yymsg);
2005 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2006 if (!yymsg)
2008 yymsg = yymsgbuf;
2009 yymsg_alloc = sizeof yymsgbuf;
2010 yysyntax_error_status = 2;
2012 else
2014 yysyntax_error_status = YYSYNTAX_ERROR;
2015 yymsgp = yymsg;
2018 yyerror (yymsgp);
2019 if (yysyntax_error_status == 2)
2020 goto yyexhaustedlab;
2022 # undef YYSYNTAX_ERROR
2023 #endif
2028 if (yyerrstatus == 3)
2030 /* If just tried and failed to reuse lookahead token after an
2031 error, discard it. */
2033 if (yychar <= YYEOF)
2035 /* Return failure if at end of input. */
2036 if (yychar == YYEOF)
2037 YYABORT;
2039 else
2041 yydestruct ("Error: discarding",
2042 yytoken, &yylval);
2043 yychar = YYEMPTY;
2047 /* Else will try to reuse lookahead token after shifting the error
2048 token. */
2049 goto yyerrlab1;
2052 /*---------------------------------------------------.
2053 | yyerrorlab -- error raised explicitly by YYERROR. |
2054 `---------------------------------------------------*/
2055 yyerrorlab:
2057 /* Pacify compilers like GCC when the user code never invokes
2058 YYERROR and the label yyerrorlab therefore never appears in user
2059 code. */
2060 if (/*CONSTCOND*/ 0)
2061 goto yyerrorlab;
2063 /* Do not reclaim the symbols of the rule whose action triggered
2064 this YYERROR. */
2065 YYPOPSTACK (yylen);
2066 yylen = 0;
2067 YY_STACK_PRINT (yyss, yyssp);
2068 yystate = *yyssp;
2069 goto yyerrlab1;
2072 /*-------------------------------------------------------------.
2073 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2074 `-------------------------------------------------------------*/
2075 yyerrlab1:
2076 yyerrstatus = 3; /* Each real token shifted decrements this. */
2078 for (;;)
2080 yyn = yypact[yystate];
2081 if (!yypact_value_is_default (yyn))
2083 yyn += YYTERROR;
2084 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2086 yyn = yytable[yyn];
2087 if (0 < yyn)
2088 break;
2092 /* Pop the current state because it cannot handle the error token. */
2093 if (yyssp == yyss)
2094 YYABORT;
2097 yydestruct ("Error: popping",
2098 yystos[yystate], yyvsp);
2099 YYPOPSTACK (1);
2100 yystate = *yyssp;
2101 YY_STACK_PRINT (yyss, yyssp);
2104 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2105 *++yyvsp = yylval;
2106 YY_IGNORE_MAYBE_UNINITIALIZED_END
2109 /* Shift the error token. */
2110 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2112 yystate = yyn;
2113 goto yynewstate;
2116 /*-------------------------------------.
2117 | yyacceptlab -- YYACCEPT comes here. |
2118 `-------------------------------------*/
2119 yyacceptlab:
2120 yyresult = 0;
2121 goto yyreturn;
2123 /*-----------------------------------.
2124 | yyabortlab -- YYABORT comes here. |
2125 `-----------------------------------*/
2126 yyabortlab:
2127 yyresult = 1;
2128 goto yyreturn;
2130 #if !defined yyoverflow || YYERROR_VERBOSE
2131 /*-------------------------------------------------.
2132 | yyexhaustedlab -- memory exhaustion comes here. |
2133 `-------------------------------------------------*/
2134 yyexhaustedlab:
2135 yyerror (YY_("memory exhausted"));
2136 yyresult = 2;
2137 /* Fall through. */
2138 #endif
2140 yyreturn:
2141 if (yychar != YYEMPTY)
2143 /* Make sure we have latest lookahead translation. See comments at
2144 user semantic actions for why this is necessary. */
2145 yytoken = YYTRANSLATE (yychar);
2146 yydestruct ("Cleanup: discarding lookahead",
2147 yytoken, &yylval);
2149 /* Do not reclaim the symbols of the rule whose action triggered
2150 this YYABORT or YYACCEPT. */
2151 YYPOPSTACK (yylen);
2152 YY_STACK_PRINT (yyss, yyssp);
2153 while (yyssp != yyss)
2155 yydestruct ("Cleanup: popping",
2156 yystos[*yyssp], yyvsp);
2157 YYPOPSTACK (1);
2159 #ifndef yyoverflow
2160 if (yyss != yyssa)
2161 YYSTACK_FREE (yyss);
2162 #endif
2163 #if YYERROR_VERBOSE
2164 if (yymsg != yymsgbuf)
2165 YYSTACK_FREE (yymsg);
2166 #endif
2167 return yyresult;
2169 #line 491 "nlmheader.y" /* yacc.c:1906 */
2172 /* If strerror is just a macro, we want to use the one from libiberty
2173 since it will handle undefined values. */
2174 #undef strerror
2175 extern char *strerror (int);
2177 /* The lexer is simple, too simple for flex. Keywords are only
2178 recognized at the start of lines. Everything else must be an
2179 argument. A comma is treated as whitespace. */
2181 /* The states the lexer can be in. */
2183 enum lex_state
2185 /* At the beginning of a line. */
2186 BEGINNING_OF_LINE,
2187 /* In the middle of a line. */
2188 IN_LINE
2191 /* We need to keep a stack of files to handle file inclusion. */
2193 struct input
2195 /* The file to read from. */
2196 FILE *file;
2197 /* The name of the file. */
2198 char *name;
2199 /* The current line number. */
2200 int lineno;
2201 /* The current state. */
2202 enum lex_state state;
2203 /* The next file on the stack. */
2204 struct input *next;
2207 /* The current input file. */
2209 static struct input current;
2211 /* The character which introduces comments. */
2212 #define COMMENT_CHAR '#'
2214 /* Start the lexer going on the main input file. */
2216 bfd_boolean
2217 nlmlex_file (const char *name)
2219 current.next = NULL;
2220 return nlmlex_file_open (name);
2223 /* Start the lexer going on a subsidiary input file. */
2225 static void
2226 nlmlex_file_push (const char *name)
2228 struct input *push;
2230 push = (struct input *) xmalloc (sizeof (struct input));
2231 *push = current;
2232 if (nlmlex_file_open (name))
2233 current.next = push;
2234 else
2236 current = *push;
2237 free (push);
2241 /* Start lexing from a file. */
2243 static bfd_boolean
2244 nlmlex_file_open (const char *name)
2246 current.file = fopen (name, "r");
2247 if (current.file == NULL)
2249 fprintf (stderr, "%s:%s: %s\n", program_name, name, strerror (errno));
2250 ++parse_errors;
2251 return FALSE;
2253 current.name = xstrdup (name);
2254 current.lineno = 1;
2255 current.state = BEGINNING_OF_LINE;
2256 return TRUE;
2259 /* Table used to turn keywords into tokens. */
2261 struct keyword_tokens_struct
2263 const char *keyword;
2264 int token;
2267 static struct keyword_tokens_struct keyword_tokens[] =
2269 { "CHECK", CHECK },
2270 { "CODESTART", CODESTART },
2271 { "COPYRIGHT", COPYRIGHT },
2272 { "CUSTOM", CUSTOM },
2273 { "DATE", DATE },
2274 { "DEBUG", DEBUG_K },
2275 { "DESCRIPTION", DESCRIPTION },
2276 { "EXIT", EXIT },
2277 { "EXPORT", EXPORT },
2278 { "FLAG_ON", FLAG_ON },
2279 { "FLAG_OFF", FLAG_OFF },
2280 { "FULLMAP", FULLMAP },
2281 { "HELP", HELP },
2282 { "IMPORT", IMPORT },
2283 { "INPUT", INPUT },
2284 { "MAP", MAP },
2285 { "MESSAGES", MESSAGES },
2286 { "MODULE", MODULE },
2287 { "MULTIPLE", MULTIPLE },
2288 { "OS_DOMAIN", OS_DOMAIN },
2289 { "OUTPUT", OUTPUT },
2290 { "PSEUDOPREEMPTION", PSEUDOPREEMPTION },
2291 { "REENTRANT", REENTRANT },
2292 { "SCREENNAME", SCREENNAME },
2293 { "SHARELIB", SHARELIB },
2294 { "STACK", STACK },
2295 { "STACKSIZE", STACK },
2296 { "START", START },
2297 { "SYNCHRONIZE", SYNCHRONIZE },
2298 { "THREADNAME", THREADNAME },
2299 { "TYPE", TYPE },
2300 { "VERBOSE", VERBOSE },
2301 { "VERSION", VERSIONK },
2302 { "XDCDATA", XDCDATA }
2305 #define KEYWORD_COUNT (sizeof (keyword_tokens) / sizeof (keyword_tokens[0]))
2307 /* The lexer accumulates strings in these variables. */
2308 static char *lex_buf;
2309 static int lex_size;
2310 static int lex_pos;
2312 /* Start accumulating strings into the buffer. */
2313 #define BUF_INIT() \
2314 ((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ()))
2316 static int
2317 nlmlex_buf_init (void)
2319 lex_size = 10;
2320 lex_buf = xmalloc (lex_size + 1);
2321 lex_pos = 0;
2322 return 0;
2325 /* Finish a string in the buffer. */
2326 #define BUF_FINISH() ((void) (lex_buf[lex_pos] = '\0'))
2328 /* Accumulate a character into the buffer. */
2329 #define BUF_ADD(c) \
2330 ((void) (lex_pos < lex_size \
2331 ? lex_buf[lex_pos++] = (c) \
2332 : nlmlex_buf_add (c)))
2334 static char
2335 nlmlex_buf_add (int c)
2337 if (lex_pos >= lex_size)
2339 lex_size *= 2;
2340 lex_buf = xrealloc (lex_buf, lex_size + 1);
2343 return lex_buf[lex_pos++] = c;
2346 /* The lexer proper. This is called by the bison generated parsing
2347 code. */
2349 static int
2350 yylex (void)
2352 int c;
2354 tail_recurse:
2356 c = getc (current.file);
2358 /* Commas are treated as whitespace characters. */
2359 while (ISSPACE (c) || c == ',')
2361 current.state = IN_LINE;
2362 if (c == '\n')
2364 ++current.lineno;
2365 current.state = BEGINNING_OF_LINE;
2367 c = getc (current.file);
2370 /* At the end of the file we either pop to the previous file or
2371 finish up. */
2372 if (c == EOF)
2374 fclose (current.file);
2375 free (current.name);
2376 if (current.next == NULL)
2377 return 0;
2378 else
2380 struct input *next;
2382 next = current.next;
2383 current = *next;
2384 free (next);
2385 goto tail_recurse;
2389 /* A comment character always means to drop everything until the
2390 next newline. */
2391 if (c == COMMENT_CHAR)
2395 c = getc (current.file);
2397 while (c != '\n');
2398 ++current.lineno;
2399 current.state = BEGINNING_OF_LINE;
2400 goto tail_recurse;
2403 /* An '@' introduces an include file. */
2404 if (c == '@')
2408 c = getc (current.file);
2409 if (c == '\n')
2410 ++current.lineno;
2412 while (ISSPACE (c));
2413 BUF_INIT ();
2414 while (! ISSPACE (c) && c != EOF)
2416 BUF_ADD (c);
2417 c = getc (current.file);
2419 BUF_FINISH ();
2421 ungetc (c, current.file);
2423 nlmlex_file_push (lex_buf);
2424 goto tail_recurse;
2427 /* A non-space character at the start of a line must be the start of
2428 a keyword. */
2429 if (current.state == BEGINNING_OF_LINE)
2431 BUF_INIT ();
2432 while (ISALNUM (c) || c == '_')
2434 BUF_ADD (TOUPPER (c));
2435 c = getc (current.file);
2437 BUF_FINISH ();
2439 if (c != EOF && ! ISSPACE (c) && c != ',')
2441 nlmheader_identify ();
2442 fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"),
2443 current.name, current.lineno, c);
2445 else
2447 unsigned int i;
2449 for (i = 0; i < KEYWORD_COUNT; i++)
2451 if (lex_buf[0] == keyword_tokens[i].keyword[0]
2452 && strcmp (lex_buf, keyword_tokens[i].keyword) == 0)
2454 /* Pushing back the final whitespace avoids worrying
2455 about \n here. */
2456 ungetc (c, current.file);
2457 current.state = IN_LINE;
2458 return keyword_tokens[i].token;
2462 nlmheader_identify ();
2463 fprintf (stderr, _("%s:%d: unrecognized keyword: %s\n"),
2464 current.name, current.lineno, lex_buf);
2467 ++parse_errors;
2468 /* Treat the rest of this line as a comment. */
2469 ungetc (COMMENT_CHAR, current.file);
2470 goto tail_recurse;
2473 /* Parentheses just represent themselves. */
2474 if (c == '(' || c == ')')
2475 return c;
2477 /* Handle quoted strings. */
2478 if (c == '"' || c == '\'')
2480 int quote;
2481 int start_lineno;
2483 quote = c;
2484 start_lineno = current.lineno;
2486 c = getc (current.file);
2487 BUF_INIT ();
2488 while (c != quote && c != EOF)
2490 BUF_ADD (c);
2491 if (c == '\n')
2492 ++current.lineno;
2493 c = getc (current.file);
2495 BUF_FINISH ();
2497 if (c == EOF)
2499 nlmheader_identify ();
2500 fprintf (stderr, _("%s:%d: end of file in quoted string\n"),
2501 current.name, start_lineno);
2502 ++parse_errors;
2505 /* FIXME: Possible memory leak. */
2506 yylval.string = xstrdup (lex_buf);
2507 return QUOTED_STRING;
2510 /* Gather a generic argument. */
2511 BUF_INIT ();
2512 while (! ISSPACE (c)
2513 && c != ','
2514 && c != COMMENT_CHAR
2515 && c != '('
2516 && c != ')')
2518 BUF_ADD (c);
2519 c = getc (current.file);
2521 BUF_FINISH ();
2523 ungetc (c, current.file);
2525 /* FIXME: Possible memory leak. */
2526 yylval.string = xstrdup (lex_buf);
2527 return STRING;
2530 /* Get a number from a string. */
2532 static long
2533 nlmlex_get_number (const char *s)
2535 long ret;
2536 char *send;
2538 ret = strtol (s, &send, 10);
2539 if (*send != '\0')
2540 nlmheader_warn (_("bad number"), -1);
2541 return ret;
2544 /* Prefix the nlmconv warnings with a note as to where they come from.
2545 We don't use program_name on every warning, because then some
2546 versions of the emacs next-error function can't recognize the line
2547 number. */
2549 static void
2550 nlmheader_identify (void)
2552 static int done;
2554 if (! done)
2556 fprintf (stderr, _("%s: problems in NLM command language input:\n"),
2557 program_name);
2558 done = 1;
2562 /* Issue a warning. */
2564 static void
2565 nlmheader_warn (const char *s, int imax)
2567 nlmheader_identify ();
2568 fprintf (stderr, "%s:%d: %s", current.name, current.lineno, s);
2569 if (imax != -1)
2570 fprintf (stderr, " (max %d)", imax);
2571 fprintf (stderr, "\n");
2574 /* Report an error. */
2576 static void
2577 nlmheader_error (const char *s)
2579 nlmheader_warn (s, -1);
2580 ++parse_errors;
2583 /* Add a string to a string list. */
2585 static struct string_list *
2586 string_list_cons (char *s, struct string_list *l)
2588 struct string_list *ret;
2590 ret = (struct string_list *) xmalloc (sizeof (struct string_list));
2591 ret->next = l;
2592 ret->string = s;
2593 return ret;
2596 /* Append a string list to another string list. */
2598 static struct string_list *
2599 string_list_append (struct string_list *l1, struct string_list *l2)
2601 register struct string_list **pp;
2603 for (pp = &l1; *pp != NULL; pp = &(*pp)->next)
2605 *pp = l2;
2606 return l1;
2609 /* Append a string to a string list. */
2611 static struct string_list *
2612 string_list_append1 (struct string_list *l, char *s)
2614 struct string_list *n;
2615 register struct string_list **pp;
2617 n = (struct string_list *) xmalloc (sizeof (struct string_list));
2618 n->next = NULL;
2619 n->string = s;
2620 for (pp = &l; *pp != NULL; pp = &(*pp)->next)
2622 *pp = n;
2623 return l;
2626 /* Duplicate a string in memory. */
2628 static char *
2629 xstrdup (const char *s)
2631 unsigned long len;
2632 char *ret;
2634 len = strlen (s);
2635 ret = xmalloc (len + 1);
2636 strcpy (ret, s);
2637 return ret;