1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
56 /* Put the tokens into the symbol table, so that GDB and other debuggers
100 BEGIN_REPEAT_POSIX = 299,
101 END_REPEAT_POSIX = 300,
102 BEGIN_REPEAT_FLEX = 301,
103 END_REPEAT_FLEX = 302
115 #define OPTION_OP 266
116 #define OPT_OUTFILE 267
117 #define OPT_PREFIX 268
118 #define OPT_YYCLASS 269
119 #define OPT_HEADER 270
120 #define OPT_EXTRA_TYPE 271
121 #define OPT_TABLES 272
122 #define CCE_ALNUM 273
123 #define CCE_ALPHA 274
124 #define CCE_BLANK 275
125 #define CCE_CNTRL 276
126 #define CCE_DIGIT 277
127 #define CCE_GRAPH 278
128 #define CCE_LOWER 279
129 #define CCE_PRINT 280
130 #define CCE_PUNCT 281
131 #define CCE_SPACE 282
132 #define CCE_UPPER 283
133 #define CCE_XDIGIT 284
134 #define CCE_NEG_ALNUM 285
135 #define CCE_NEG_ALPHA 286
136 #define CCE_NEG_BLANK 287
137 #define CCE_NEG_CNTRL 288
138 #define CCE_NEG_DIGIT 289
139 #define CCE_NEG_GRAPH 290
140 #define CCE_NEG_LOWER 291
141 #define CCE_NEG_PRINT 292
142 #define CCE_NEG_PUNCT 293
143 #define CCE_NEG_SPACE 294
144 #define CCE_NEG_UPPER 295
145 #define CCE_NEG_XDIGIT 296
146 #define CCL_OP_UNION 297
147 #define CCL_OP_DIFF 298
148 #define BEGIN_REPEAT_POSIX 299
149 #define END_REPEAT_POSIX 300
150 #define BEGIN_REPEAT_FLEX 301
151 #define END_REPEAT_FLEX 302
156 /* Copy the first part of user declarations. */
159 /* Copyright (c) 1990 The Regents of the University of California. */
160 /* All rights reserved. */
162 /* This code is derived from software contributed to Berkeley by */
165 /* The United States Government has rights in this work pursuant */
166 /* to contract no. DE-AC03-76SF00098 between the United States */
167 /* Department of Energy and the University of California. */
169 /* This file is part of flex. */
171 /* Redistribution and use in source and binary forms, with or without */
172 /* modification, are permitted provided that the following conditions */
175 /* 1. Redistributions of source code must retain the above copyright */
176 /* notice, this list of conditions and the following disclaimer. */
177 /* 2. Redistributions in binary form must reproduce the above copyright */
178 /* notice, this list of conditions and the following disclaimer in the */
179 /* documentation and/or other materials provided with the distribution. */
181 /* Neither the name of the University nor the names of its contributors */
182 /* may be used to endorse or promote products derived from this software */
183 /* without specific prior written permission. */
185 /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
186 /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
187 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
193 int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen;
194 int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule;
199 static int madeany = false; /* whether we've made the '.' character class */
200 static int ccldot, cclany;
201 int previous_continued_action; /* whether the previous rule's action was '|' */
203 #define format_warn3(fmt, a1, a2) \
205 char fw3_msg[MAXLINE];\
206 snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
210 /* Expand a POSIX character class expression. */
211 #define CCL_EXPR(func) \
214 for ( c = 0; c < csize; ++c ) \
215 if ( isascii(c) && func(c) ) \
216 ccladd( currccl, c ); \
220 #define CCL_NEG_EXPR(func) \
223 for ( c = 0; c < csize; ++c ) \
225 ccladd( currccl, c ); \
228 /* While POSIX defines isblank(), it's not ANSI C. */
229 #define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
231 /* On some over-ambitious machines, such as DEC Alpha's, the default
232 * token type is "long" instead of "int"; this leads to problems with
233 * declaring yylval in flexdef.h. But so far, all the yacc's I've seen
234 * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
235 * following should ensure that the default token type is "int".
241 /* Enabling traces. */
246 /* Enabling verbose error messages. */
247 #ifdef YYERROR_VERBOSE
248 # undef YYERROR_VERBOSE
249 # define YYERROR_VERBOSE 1
251 # define YYERROR_VERBOSE 0
254 /* Enabling the token table. */
255 #ifndef YYTOKEN_TABLE
256 # define YYTOKEN_TABLE 0
259 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
261 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
262 # define YYSTYPE_IS_DECLARED 1
263 # define YYSTYPE_IS_TRIVIAL 1
268 /* Copy the second part of user declarations. */
271 /* Line 219 of yacc.c. */
274 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
275 # define YYSIZE_T __SIZE_TYPE__
277 #if ! defined (YYSIZE_T) && defined (size_t)
278 # define YYSIZE_T size_t
280 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
281 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
282 # define YYSIZE_T size_t
284 #if ! defined (YYSIZE_T)
285 # define YYSIZE_T unsigned int
291 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
292 # define YY_(msgid) dgettext ("bison-runtime", msgid)
296 # define YY_(msgid) msgid
300 #if ! defined (yyoverflow) || YYERROR_VERBOSE
302 /* The parser invokes alloca or malloc; define the necessary symbols. */
304 # ifdef YYSTACK_USE_ALLOCA
305 # if YYSTACK_USE_ALLOCA
307 # define YYSTACK_ALLOC __builtin_alloca
309 # define YYSTACK_ALLOC alloca
310 # if defined (__STDC__) || defined (__cplusplus)
311 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
312 # define YYINCLUDED_STDLIB_H
318 # ifdef YYSTACK_ALLOC
319 /* Pacify GCC's `empty if-body' warning. */
320 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
321 # ifndef YYSTACK_ALLOC_MAXIMUM
322 /* The OS might guarantee only one guard page at the bottom of the stack,
323 and a page size can be as small as 4096 bytes. So we cannot safely
324 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
325 to allow for a few compiler-allocated temporary stack slots. */
326 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
329 # define YYSTACK_ALLOC YYMALLOC
330 # define YYSTACK_FREE YYFREE
331 # ifndef YYSTACK_ALLOC_MAXIMUM
332 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
338 # define YYMALLOC malloc
339 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
340 && (defined (__STDC__) || defined (__cplusplus)))
341 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
346 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
347 && (defined (__STDC__) || defined (__cplusplus)))
348 void free (void *); /* INFRINGES ON USER NAME SPACE */
355 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
358 #if (! defined (yyoverflow) \
359 && (! defined (__cplusplus) \
360 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
362 /* A type that is properly aligned for any stack member. */
369 /* The size of the maximum gap between one aligned stack and the next. */
370 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
372 /* The size of an array large to enough to hold all stacks, each with
374 # define YYSTACK_BYTES(N) \
375 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
376 + YYSTACK_GAP_MAXIMUM)
378 /* Copy COUNT objects from FROM to TO. The source and destination do
381 # if defined (__GNUC__) && 1 < __GNUC__
382 # define YYCOPY(To, From, Count) \
383 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
385 # define YYCOPY(To, From, Count) \
389 for (yyi = 0; yyi < (Count); yyi++) \
390 (To)[yyi] = (From)[yyi]; \
396 /* Relocate STACK from its old location to the new one. The
397 local variables YYSIZE and YYSTACKSIZE give the old and new number of
398 elements in the stack, and YYPTR gives the new location of the
399 stack. Advance YYPTR to a properly aligned location for the next
401 # define YYSTACK_RELOCATE(Stack) \
404 YYSIZE_T yynewbytes; \
405 YYCOPY (&yyptr->Stack, Stack, yysize); \
406 Stack = &yyptr->Stack; \
407 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
408 yyptr += yynewbytes / sizeof (*yyptr); \
414 #if defined (__STDC__) || defined (__cplusplus)
415 typedef signed char yysigned_char;
417 typedef short int yysigned_char;
420 /* YYFINAL -- State number of the termination state. */
422 /* YYLAST -- Last index in YYTABLE. */
425 /* YYNTOKENS -- Number of terminals. */
427 /* YYNNTS -- Number of nonterminals. */
429 /* YYNRULES -- Number of rules. */
431 /* YYNRULES -- Number of states. */
432 #define YYNSTATES 140
434 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
436 #define YYMAXUTOK 302
438 #define YYTRANSLATE(YYX) \
439 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
441 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
442 static const unsigned char yytranslate[] =
444 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 49, 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, 63, 2, 57, 2, 2, 2,
448 64, 65, 55, 60, 56, 68, 62, 59, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 53, 48, 54, 61, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 66, 2, 67, 52, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 50, 58, 51, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
470 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
471 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
472 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
473 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
478 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
480 static const unsigned short int yyprhs[] =
482 0, 0, 3, 9, 10, 14, 17, 18, 20, 22,
483 24, 26, 29, 31, 33, 36, 39, 40, 44, 48,
484 52, 56, 60, 64, 70, 76, 77, 78, 81, 83,
485 85, 87, 88, 93, 97, 98, 102, 104, 106, 108,
486 111, 115, 118, 120, 124, 126, 129, 132, 134, 141,
487 147, 152, 155, 158, 161, 168, 174, 179, 181, 183,
488 185, 189, 193, 195, 199, 203, 205, 209, 214, 219,
489 222, 225, 226, 228, 230, 232, 234, 236, 238, 240,
490 242, 244, 246, 248, 250, 252, 254, 256, 258, 260,
491 262, 264, 266, 268, 270, 272, 274, 277
494 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
495 static const yysigned_char yyrhs[] =
497 70, 0, -1, 71, 72, 73, 79, 80, -1, -1,
498 72, 74, 75, -1, 72, 76, -1, -1, 1, -1,
499 5, -1, 6, -1, 7, -1, 75, 8, -1, 8,
500 -1, 1, -1, 11, 77, -1, 77, 78, -1, -1,
501 12, 48, 8, -1, 16, 48, 8, -1, 13, 48,
502 8, -1, 14, 48, 8, -1, 15, 48, 8, -1,
503 17, 48, 8, -1, 79, 83, 80, 81, 49, -1,
504 79, 83, 50, 79, 51, -1, -1, -1, 52, 86,
505 -1, 86, -1, 10, -1, 1, -1, -1, 53, 82,
506 84, 54, -1, 53, 55, 54, -1, -1, 84, 56,
507 85, -1, 85, -1, 1, -1, 8, -1, 88, 87,
508 -1, 88, 87, 57, -1, 87, 57, -1, 87, -1,
509 87, 58, 89, -1, 89, -1, 87, 59, -1, 89,
510 90, -1, 90, -1, 89, 44, 4, 56, 4, 45,
511 -1, 89, 44, 4, 56, 45, -1, 89, 44, 4,
512 45, -1, 90, 55, -1, 90, 60, -1, 90, 61,
513 -1, 90, 46, 4, 56, 4, 47, -1, 90, 46,
514 4, 56, 47, -1, 90, 46, 4, 47, -1, 62,
515 -1, 91, -1, 9, -1, 63, 95, 63, -1, 64,
516 87, 65, -1, 3, -1, 91, 43, 92, -1, 91,
517 42, 92, -1, 92, -1, 66, 93, 67, -1, 66,
518 52, 93, 67, -1, 93, 3, 68, 3, -1, 93,
519 3, -1, 93, 94, -1, -1, 18, -1, 19, -1,
520 20, -1, 21, -1, 22, -1, 23, -1, 24, -1,
521 25, -1, 26, -1, 27, -1, 29, -1, 28, -1,
522 30, -1, 31, -1, 32, -1, 33, -1, 34, -1,
523 35, -1, 37, -1, 38, -1, 39, -1, 41, -1,
524 36, -1, 40, -1, 95, 3, -1, -1
527 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
528 static const unsigned short int yyrline[] =
530 0, 118, 118, 148, 155, 156, 157, 158, 162, 170,
531 173, 177, 180, 183, 187, 190, 191, 194, 199, 201,
532 203, 205, 207, 211, 213, 215, 219, 231, 267, 291,
533 314, 319, 322, 325, 343, 346, 348, 350, 354, 377,
534 433, 436, 479, 497, 503, 508, 535, 543, 546, 574,
535 588, 610, 617, 623, 629, 657, 671, 690, 724, 744,
536 754, 757, 760, 775, 776, 777, 782, 784, 791, 851,
537 869, 877, 885, 886, 887, 888, 889, 890, 891, 896,
538 897, 898, 899, 900, 906, 907, 908, 909, 910, 911,
539 912, 913, 914, 915, 916, 922, 930, 946
543 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
544 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
545 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
546 static const char *const yytname[] =
548 "$end", "error", "$undefined", "CHAR", "NUMBER", "SECTEND", "SCDECL",
549 "XSCDECL", "NAME", "PREVCCL", "EOF_OP", "OPTION_OP", "OPT_OUTFILE",
550 "OPT_PREFIX", "OPT_YYCLASS", "OPT_HEADER", "OPT_EXTRA_TYPE",
551 "OPT_TABLES", "CCE_ALNUM", "CCE_ALPHA", "CCE_BLANK", "CCE_CNTRL",
552 "CCE_DIGIT", "CCE_GRAPH", "CCE_LOWER", "CCE_PRINT", "CCE_PUNCT",
553 "CCE_SPACE", "CCE_UPPER", "CCE_XDIGIT", "CCE_NEG_ALNUM", "CCE_NEG_ALPHA",
554 "CCE_NEG_BLANK", "CCE_NEG_CNTRL", "CCE_NEG_DIGIT", "CCE_NEG_GRAPH",
555 "CCE_NEG_LOWER", "CCE_NEG_PRINT", "CCE_NEG_PUNCT", "CCE_NEG_SPACE",
556 "CCE_NEG_UPPER", "CCE_NEG_XDIGIT", "CCL_OP_UNION", "CCL_OP_DIFF",
557 "BEGIN_REPEAT_POSIX", "END_REPEAT_POSIX", "BEGIN_REPEAT_FLEX",
558 "END_REPEAT_FLEX", "'='", "'\\n'", "'{'", "'}'", "'^'", "'<'", "'>'",
559 "'*'", "','", "'$'", "'|'", "'/'", "'+'", "'?'", "'.'", "'\"'", "'('",
560 "')'", "'['", "']'", "'-'", "$accept", "goal", "initlex", "sect1",
561 "sect1end", "startconddecl", "namelist1", "options", "optionlist",
562 "option", "sect2", "initforrule", "flexrule", "scon_stk_ptr", "scon",
563 "namelist2", "sconname", "rule", "re", "re2", "series", "singleton",
564 "fullccl", "braceccl", "ccl", "ccl_expr", "string", 0
569 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
571 static const unsigned short int yytoknum[] =
573 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
574 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
575 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
576 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
577 295, 296, 297, 298, 299, 300, 301, 302, 61, 10,
578 123, 125, 94, 60, 62, 42, 44, 36, 124, 47,
579 43, 63, 46, 34, 40, 41, 91, 93, 45
583 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
584 static const unsigned char yyr1[] =
586 0, 69, 70, 71, 72, 72, 72, 72, 73, 74,
587 74, 75, 75, 75, 76, 77, 77, 78, 78, 78,
588 78, 78, 78, 79, 79, 79, 80, 81, 81, 81,
589 81, 82, 83, 83, 83, 84, 84, 84, 85, 86,
590 86, 86, 86, 87, 87, 88, 89, 89, 89, 89,
591 89, 90, 90, 90, 90, 90, 90, 90, 90, 90,
592 90, 90, 90, 91, 91, 91, 92, 92, 93, 93,
593 93, 93, 94, 94, 94, 94, 94, 94, 94, 94,
594 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
595 94, 94, 94, 94, 94, 94, 95, 95
598 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
599 static const unsigned char yyr2[] =
601 0, 2, 5, 0, 3, 2, 0, 1, 1, 1,
602 1, 2, 1, 1, 2, 2, 0, 3, 3, 3,
603 3, 3, 3, 5, 5, 0, 0, 2, 1, 1,
604 1, 0, 4, 3, 0, 3, 1, 1, 1, 2,
605 3, 2, 1, 3, 1, 2, 2, 1, 6, 5,
606 4, 2, 2, 2, 6, 5, 4, 1, 1, 1,
607 3, 3, 1, 3, 3, 1, 3, 4, 4, 2,
608 2, 0, 1, 1, 1, 1, 1, 1, 1, 1,
609 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
610 1, 1, 1, 1, 1, 1, 2, 0
613 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
614 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
615 means the default is an error. */
616 static const unsigned char yydefact[] =
618 3, 0, 0, 1, 7, 0, 8, 9, 10, 16,
619 25, 0, 5, 14, 34, 13, 12, 4, 0, 0,
620 0, 0, 0, 0, 15, 31, 2, 26, 11, 0,
621 0, 0, 0, 0, 0, 0, 0, 25, 0, 17,
622 19, 20, 21, 18, 22, 33, 37, 38, 0, 36,
623 34, 30, 62, 59, 29, 0, 57, 97, 0, 71,
624 0, 28, 42, 0, 44, 47, 58, 65, 32, 0,
625 24, 27, 0, 0, 71, 0, 23, 41, 0, 45,
626 39, 0, 46, 0, 51, 52, 53, 0, 0, 35,
627 96, 60, 61, 0, 69, 72, 73, 74, 75, 76,
628 77, 78, 79, 80, 81, 83, 82, 84, 85, 86,
629 87, 88, 89, 94, 90, 91, 92, 95, 93, 66,
630 70, 43, 40, 0, 0, 64, 63, 67, 0, 50,
631 0, 56, 0, 68, 0, 49, 0, 55, 48, 54
634 /* YYDEFGOTO[NTERM-NUM]. */
635 static const yysigned_char yydefgoto[] =
637 -1, 1, 2, 5, 10, 11, 17, 12, 13, 24,
638 14, 26, 60, 36, 27, 48, 49, 61, 62, 63,
639 64, 65, 66, 67, 75, 120, 72
642 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
644 #define YYPACT_NINF -52
645 static const short int yypact[] =
647 -52, 17, 103, -52, -52, 113, -52, -52, -52, -52,
648 -52, 48, -52, 114, 6, -52, -52, 42, 7, 12,
649 58, 77, 88, 89, -52, 43, -52, 73, -52, 130,
650 131, 132, 133, 134, 135, 90, 91, -52, -1, -52,
651 -52, -52, -52, -52, -52, -52, -52, -52, 40, -52,
652 44, -52, -52, -52, -52, 39, -52, -52, 39, 93,
653 97, -52, -12, 39, 49, 61, -31, -52, -52, 139,
654 -52, -52, 1, -51, -52, 0, -52, -52, 39, -52,
655 75, 144, 61, 145, -52, -52, -52, 84, 84, -52,
656 -52, -52, -52, 50, 83, -52, -52, -52, -52, -52,
657 -52, -52, -52, -52, -52, -52, -52, -52, -52, -52,
658 -52, -52, -52, -52, -52, -52, -52, -52, -52, -52,
659 -52, 49, -52, -40, 10, -52, -52, -52, 149, -52,
660 9, -52, -3, -52, 108, -52, 107, -52, -52, -52
663 /* YYPGOTO[NTERM-NUM]. */
664 static const short int yypgoto[] =
666 -52, -52, -52, -52, -52, -52, -52, -52, -52, -52,
667 118, 129, -52, -52, -52, -52, 92, 102, -48, -52,
668 80, -21, -52, 47, 85, -52, -52
671 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
672 positive, shift that token. If negative, reduce the rule which
673 number is the opposite. If zero, do what YYDEFACT says.
674 If YYTABLE_NINF, syntax error. */
675 #define YYTABLE_NINF -27
676 static const short int yytable[] =
678 51, 136, 52, 94, 90, 129, -26, 78, 53, 54,
679 73, 87, 88, 134, 92, 80, 130, 3, 95, 96,
680 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
681 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
682 117, 118, 52, 82, 137, 77, 78, 79, 53, 15,
683 28, 55, 52, 94, 135, 29, 16, 131, 53, 25,
684 30, 56, 57, 58, 91, 59, 132, 119, 95, 96,
685 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
686 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
687 117, 118, 46, 81, 68, 70, 69, 25, 35, 47,
688 82, 56, 57, 58, 4, 59, 31, 83, -6, -6,
689 -6, 56, 57, 58, -6, 59, 84, 127, 6, 7,
690 8, 85, 86, 37, 9, 32, 18, 19, 20, 21,
691 22, 23, 122, 78, 125, 126, 33, 34, 39, 40,
692 41, 42, 43, 44, 45, 74, 76, 47, 123, 124,
693 59, 128, 133, 138, 139, 50, 38, 71, 121, 93,
697 static const yysigned_char yycheck[] =
699 1, 4, 3, 3, 3, 45, 0, 58, 9, 10,
700 58, 42, 43, 4, 65, 63, 56, 0, 18, 19,
701 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
702 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
703 40, 41, 3, 64, 47, 57, 58, 59, 9, 1,
704 8, 52, 3, 3, 45, 48, 8, 47, 9, 53,
705 48, 62, 63, 64, 63, 66, 56, 67, 18, 19,
706 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
707 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
708 40, 41, 1, 44, 54, 51, 56, 53, 55, 8,
709 121, 62, 63, 64, 1, 66, 48, 46, 5, 6,
710 7, 62, 63, 64, 11, 66, 55, 67, 5, 6,
711 7, 60, 61, 50, 11, 48, 12, 13, 14, 15,
712 16, 17, 57, 58, 87, 88, 48, 48, 8, 8,
713 8, 8, 8, 8, 54, 52, 49, 8, 4, 4,
714 66, 68, 3, 45, 47, 37, 27, 55, 78, 74,
718 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
719 symbol of state STATE-NUM. */
720 static const unsigned char yystos[] =
722 0, 70, 71, 0, 1, 72, 5, 6, 7, 11,
723 73, 74, 76, 77, 79, 1, 8, 75, 12, 13,
724 14, 15, 16, 17, 78, 53, 80, 83, 8, 48,
725 48, 48, 48, 48, 48, 55, 82, 50, 80, 8,
726 8, 8, 8, 8, 8, 54, 1, 8, 84, 85,
727 79, 1, 3, 9, 10, 52, 62, 63, 64, 66,
728 81, 86, 87, 88, 89, 90, 91, 92, 54, 56,
729 51, 86, 95, 87, 52, 93, 49, 57, 58, 59,
730 87, 44, 90, 46, 55, 60, 61, 42, 43, 85,
731 3, 63, 65, 93, 3, 18, 19, 20, 21, 22,
732 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
733 33, 34, 35, 36, 37, 38, 39, 40, 41, 67,
734 94, 89, 57, 4, 4, 92, 92, 67, 68, 45,
735 56, 47, 56, 3, 4, 45, 4, 47, 45, 47
738 #define yyerrok (yyerrstatus = 0)
739 #define yyclearin (yychar = YYEMPTY)
743 #define YYACCEPT goto yyacceptlab
744 #define YYABORT goto yyabortlab
745 #define YYERROR goto yyerrorlab
748 /* Like YYERROR except do call yyerror. This remains here temporarily
749 to ease the transition to the new meaning of YYERROR, for GCC.
750 Once GCC version 2 has supplanted version 1, this can go. */
752 #define YYFAIL goto yyerrlab
754 #define YYRECOVERING() (!!yyerrstatus)
756 #define YYBACKUP(Token, Value) \
758 if (yychar == YYEMPTY && yylen == 1) \
762 yytoken = YYTRANSLATE (yychar); \
768 yyerror (YY_("syntax error: cannot back up")); \
775 #define YYERRCODE 256
778 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
779 If N is 0, then set CURRENT to the empty location which ends
780 the previous symbol: RHS[0] (always defined). */
782 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
783 #ifndef YYLLOC_DEFAULT
784 # define YYLLOC_DEFAULT(Current, Rhs, N) \
788 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
789 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
790 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
791 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
795 (Current).first_line = (Current).last_line = \
796 YYRHSLOC (Rhs, 0).last_line; \
797 (Current).first_column = (Current).last_column = \
798 YYRHSLOC (Rhs, 0).last_column; \
804 /* YY_LOCATION_PRINT -- Print the location on the stream.
805 This macro was not mandated originally: define only if we know
806 we won't break user code: when these are the locations we know. */
808 #ifndef YY_LOCATION_PRINT
809 # if YYLTYPE_IS_TRIVIAL
810 # define YY_LOCATION_PRINT(File, Loc) \
811 fprintf (File, "%d.%d-%d.%d", \
812 (Loc).first_line, (Loc).first_column, \
813 (Loc).last_line, (Loc).last_column)
815 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
820 /* YYLEX -- calling `yylex' with the right arguments. */
823 # define YYLEX yylex (YYLEX_PARAM)
825 # define YYLEX yylex ()
828 /* Enable debugging if requested. */
832 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
833 # define YYFPRINTF fprintf
836 # define YYDPRINTF(Args) \
842 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
846 YYFPRINTF (stderr, "%s ", Title); \
847 yysymprint (stderr, \
849 YYFPRINTF (stderr, "\n"); \
853 /*------------------------------------------------------------------.
854 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
856 `------------------------------------------------------------------*/
858 #if defined (__STDC__) || defined (__cplusplus)
860 yy_stack_print (short int *bottom, short int *top)
863 yy_stack_print (bottom, top)
868 YYFPRINTF (stderr, "Stack now");
869 for (/* Nothing. */; bottom <= top; ++bottom)
870 YYFPRINTF (stderr, " %d", *bottom);
871 YYFPRINTF (stderr, "\n");
874 # define YY_STACK_PRINT(Bottom, Top) \
877 yy_stack_print ((Bottom), (Top)); \
881 /*------------------------------------------------.
882 | Report that the YYRULE is going to be reduced. |
883 `------------------------------------------------*/
885 #if defined (__STDC__) || defined (__cplusplus)
887 yy_reduce_print (int yyrule)
890 yy_reduce_print (yyrule)
895 unsigned long int yylno = yyrline[yyrule];
896 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
898 /* Print the symbols being reduced, and their result. */
899 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
900 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
901 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
904 # define YY_REDUCE_PRINT(Rule) \
907 yy_reduce_print (Rule); \
910 /* Nonzero means print parse trace. It is left uninitialized so that
911 multiple parsers can coexist. */
914 # define YYDPRINTF(Args)
915 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
916 # define YY_STACK_PRINT(Bottom, Top)
917 # define YY_REDUCE_PRINT(Rule)
918 #endif /* !YYDEBUG */
921 /* YYINITDEPTH -- initial size of the parser's stacks. */
923 # define YYINITDEPTH 200
926 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
927 if the built-in stack extension method is used).
929 Do not make this value too large; the results are undefined if
930 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
931 evaluated with infinite-precision integer arithmetic. */
934 # define YYMAXDEPTH 10000
942 # if defined (__GLIBC__) && defined (_STRING_H)
943 # define yystrlen strlen
945 /* Return the length of YYSTR. */
947 # if defined (__STDC__) || defined (__cplusplus)
948 yystrlen (const char *yystr)
954 const char *yys = yystr;
956 while (*yys++ != '\0')
959 return yys - yystr - 1;
965 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
966 # define yystpcpy stpcpy
968 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
971 # if defined (__STDC__) || defined (__cplusplus)
972 yystpcpy (char *yydest, const char *yysrc)
974 yystpcpy (yydest, yysrc)
980 const char *yys = yysrc;
982 while ((*yyd++ = *yys++) != '\0')
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
999 yytnamerr (char *yyres, const char *yystr)
1004 char const *yyp = yystr;
1011 goto do_not_strip_quotes;
1015 goto do_not_strip_quotes;
1028 do_not_strip_quotes: ;
1032 return yystrlen (yystr);
1034 return yystpcpy (yyres, yystr) - yyres;
1038 #endif /* YYERROR_VERBOSE */
1043 /*--------------------------------.
1044 | Print this symbol on YYOUTPUT. |
1045 `--------------------------------*/
1047 #if defined (__STDC__) || defined (__cplusplus)
1049 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1052 yysymprint (yyoutput, yytype, yyvaluep)
1058 /* Pacify ``unused variable'' warnings. */
1061 if (yytype < YYNTOKENS)
1062 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1064 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1068 if (yytype < YYNTOKENS)
1069 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1076 YYFPRINTF (yyoutput, ")");
1079 #endif /* ! YYDEBUG */
1080 /*-----------------------------------------------.
1081 | Release the memory associated to this symbol. |
1082 `-----------------------------------------------*/
1084 #if defined (__STDC__) || defined (__cplusplus)
1086 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1089 yydestruct (yymsg, yytype, yyvaluep)
1095 /* Pacify ``unused variable'' warnings. */
1100 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1111 /* Prevent warnings from -Wmissing-prototypes. */
1113 #ifdef YYPARSE_PARAM
1114 # if defined (__STDC__) || defined (__cplusplus)
1115 int yyparse (void *YYPARSE_PARAM);
1119 #else /* ! YYPARSE_PARAM */
1120 #if defined (__STDC__) || defined (__cplusplus)
1125 #endif /* ! YYPARSE_PARAM */
1129 /* The look-ahead symbol. */
1132 /* The semantic value of the look-ahead symbol. */
1135 /* Number of syntax errors so far. */
1144 #ifdef YYPARSE_PARAM
1145 # if defined (__STDC__) || defined (__cplusplus)
1146 int yyparse (void *YYPARSE_PARAM)
1148 int yyparse (YYPARSE_PARAM)
1149 void *YYPARSE_PARAM;
1151 #else /* ! YYPARSE_PARAM */
1152 #if defined (__STDC__) || defined (__cplusplus)
1166 /* Number of tokens to shift before error messages enabled. */
1168 /* Look-ahead token as an internal (translated) token number. */
1171 /* Three stacks and their tools:
1172 `yyss': related to states,
1173 `yyvs': related to semantic values,
1174 `yyls': related to locations.
1176 Refer to the stacks thru separate pointers, to allow yyoverflow
1177 to reallocate them elsewhere. */
1179 /* The state stack. */
1180 short int yyssa[YYINITDEPTH];
1181 short int *yyss = yyssa;
1184 /* The semantic value stack. */
1185 YYSTYPE yyvsa[YYINITDEPTH];
1186 YYSTYPE *yyvs = yyvsa;
1191 #define YYPOPSTACK (yyvsp--, yyssp--)
1193 YYSIZE_T yystacksize = YYINITDEPTH;
1195 /* The variables used to return semantic value and location from the
1200 /* When reducing, the number of symbols on the RHS of the reduced
1204 YYDPRINTF ((stderr, "Starting parse\n"));
1209 yychar = YYEMPTY; /* Cause a token to be read. */
1211 /* Initialize stack pointers.
1212 Waste one element of value and location stack
1213 so that they stay on the same level as the state stack.
1214 The wasted elements are never initialized. */
1221 /*------------------------------------------------------------.
1222 | yynewstate -- Push a new state, which is found in yystate. |
1223 `------------------------------------------------------------*/
1225 /* In all cases, when you get here, the value and location stacks
1226 have just been pushed. so pushing a state here evens the stacks.
1233 if (yyss + yystacksize - 1 <= yyssp)
1235 /* Get the current used size of the three stacks, in elements. */
1236 YYSIZE_T yysize = yyssp - yyss + 1;
1240 /* Give user a chance to reallocate the stack. Use copies of
1241 these so that the &'s don't force the real ones into
1243 YYSTYPE *yyvs1 = yyvs;
1244 short int *yyss1 = yyss;
1247 /* Each stack pointer address is followed by the size of the
1248 data in use in that stack, in bytes. This used to be a
1249 conditional around just the two extra args, but that might
1250 be undefined if yyoverflow is a macro. */
1251 yyoverflow (YY_("memory exhausted"),
1252 &yyss1, yysize * sizeof (*yyssp),
1253 &yyvs1, yysize * sizeof (*yyvsp),
1260 #else /* no yyoverflow */
1261 # ifndef YYSTACK_RELOCATE
1262 goto yyexhaustedlab;
1264 /* Extend the stack our own way. */
1265 if (YYMAXDEPTH <= yystacksize)
1266 goto yyexhaustedlab;
1268 if (YYMAXDEPTH < yystacksize)
1269 yystacksize = YYMAXDEPTH;
1272 short int *yyss1 = yyss;
1273 union yyalloc *yyptr =
1274 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1276 goto yyexhaustedlab;
1277 YYSTACK_RELOCATE (yyss);
1278 YYSTACK_RELOCATE (yyvs);
1280 # undef YYSTACK_RELOCATE
1282 YYSTACK_FREE (yyss1);
1285 #endif /* no yyoverflow */
1287 yyssp = yyss + yysize - 1;
1288 yyvsp = yyvs + yysize - 1;
1291 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1292 (unsigned long int) yystacksize));
1294 if (yyss + yystacksize - 1 <= yyssp)
1298 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1307 /* Do appropriate processing given the current state. */
1308 /* Read a look-ahead token if we need one and don't already have one. */
1311 /* First try to decide what to do without reference to look-ahead token. */
1313 yyn = yypact[yystate];
1314 if (yyn == YYPACT_NINF)
1317 /* Not known => get a look-ahead token if don't already have one. */
1319 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1320 if (yychar == YYEMPTY)
1322 YYDPRINTF ((stderr, "Reading a token: "));
1326 if (yychar <= YYEOF)
1328 yychar = yytoken = YYEOF;
1329 YYDPRINTF ((stderr, "Now at end of input.\n"));
1333 yytoken = YYTRANSLATE (yychar);
1334 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1337 /* If the proper action on seeing token YYTOKEN is to reduce or to
1338 detect an error, take that action. */
1340 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1345 if (yyn == 0 || yyn == YYTABLE_NINF)
1354 /* Shift the look-ahead token. */
1355 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1357 /* Discard the token being shifted unless it is eof. */
1358 if (yychar != YYEOF)
1364 /* Count tokens shifted since error; after three, turn off error
1373 /*-----------------------------------------------------------.
1374 | yydefault -- do the default action for the current state. |
1375 `-----------------------------------------------------------*/
1377 yyn = yydefact[yystate];
1383 /*-----------------------------.
1384 | yyreduce -- Do a reduction. |
1385 `-----------------------------*/
1387 /* yyn is the number of a rule to reduce with. */
1390 /* If YYLEN is nonzero, implement the default value of the action:
1393 Otherwise, the following line sets YYVAL to garbage.
1394 This behavior is undocumented and Bison
1395 users should not rely upon it. Assigning to YYVAL
1396 unconditionally makes the parser a bit smaller, and it avoids a
1397 GCC warning that YYVAL may be used uninitialized. */
1398 yyval = yyvsp[1-yylen];
1401 YY_REDUCE_PRINT (yyn);
1406 { /* add default rule */
1412 def_rule = mkstate( -pat );
1414 /* Remember the number of the default rule so we
1415 * don't generate "can't match" warnings for it.
1417 default_rule = num_rules;
1419 finish_rule( def_rule, false, 0, 0, 0);
1421 for ( i = 1; i <= lastsc; ++i )
1422 scset[i] = mkbranch( scset[i], def_rule );
1426 "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
1428 add_action( "ECHO" );
1430 add_action( ";\n\tYY_BREAK\n" );
1436 { /* initialize for processing rules */
1438 /* Create default DFA start condition. */
1439 scinstal( "INITIAL", false );
1445 { synerr( _("unknown error processing section 1") ); }
1452 scon_stk = allocate_integer_array( lastsc + 1 );
1459 { xcluflg = false; }
1469 { scinstal( nmstr, xcluflg ); }
1474 { scinstal( nmstr, xcluflg ); }
1479 { synerr( _("bad start condition list") ); }
1485 outfilename = copy_string( nmstr );
1486 did_outfilename = 1;
1492 { extra_type = copy_string( nmstr ); }
1497 { prefix = copy_string( nmstr ); }
1502 { yyclass = copy_string( nmstr ); }
1507 { headerfilename = copy_string( nmstr ); }
1512 { tablesext = true; tablesfilename = copy_string( nmstr ); }
1517 { scon_stk_ptr = (yyvsp[-3]); }
1522 { scon_stk_ptr = (yyvsp[-3]); }
1528 /* Initialize for a parse of one rule. */
1529 trlcontxt = variable_trail_rule = varlength = false;
1530 trailcnt = headcnt = rulelen = 0;
1531 current_state_type = STATE_NORMAL;
1532 previous_continued_action = continued_action;
1543 finish_rule( pat, variable_trail_rule,
1544 headcnt, trailcnt , previous_continued_action);
1546 if ( scon_stk_ptr > 0 )
1548 for ( i = 1; i <= scon_stk_ptr; ++i )
1549 scbol[scon_stk[i]] =
1550 mkbranch( scbol[scon_stk[i]],
1556 /* Add to all non-exclusive start conditions,
1557 * including the default (0) start condition.
1560 for ( i = 1; i <= lastsc; ++i )
1562 scbol[i] = mkbranch( scbol[i],
1570 if ( performance_report > 1 )
1572 "'^' operator results in sub-optimal performance" );
1581 finish_rule( pat, variable_trail_rule,
1582 headcnt, trailcnt , previous_continued_action);
1584 if ( scon_stk_ptr > 0 )
1586 for ( i = 1; i <= scon_stk_ptr; ++i )
1587 scset[scon_stk[i]] =
1588 mkbranch( scset[scon_stk[i]],
1594 for ( i = 1; i <= lastsc; ++i )
1606 if ( scon_stk_ptr > 0 )
1611 /* This EOF applies to all start conditions
1612 * which don't already have EOF actions.
1614 for ( i = 1; i <= lastsc; ++i )
1616 scon_stk[++scon_stk_ptr] = i;
1618 if ( scon_stk_ptr == 0 )
1620 "all start conditions already have <<EOF>> rules" );
1630 { synerr( _("unrecognized rule") ); }
1635 { (yyval) = scon_stk_ptr; }
1640 { (yyval) = (yyvsp[-2]); }
1646 (yyval) = scon_stk_ptr;
1648 for ( i = 1; i <= lastsc; ++i )
1652 for ( j = 1; j <= scon_stk_ptr; ++j )
1653 if ( scon_stk[j] == i )
1656 if ( j > scon_stk_ptr )
1657 scon_stk[++scon_stk_ptr] = i;
1664 { (yyval) = scon_stk_ptr; }
1669 { synerr( _("bad start condition list") ); }
1675 if ( (scnum = sclookup( nmstr )) == 0 )
1676 format_pinpoint_message(
1677 "undeclared start condition %s",
1681 for ( i = 1; i <= scon_stk_ptr; ++i )
1682 if ( scon_stk[i] == scnum )
1685 "<%s> specified twice",
1690 if ( i > scon_stk_ptr )
1691 scon_stk[++scon_stk_ptr] = scnum;
1699 if ( transchar[lastst[(yyvsp[0])]] != SYM_EPSILON )
1700 /* Provide final transition \now/ so it
1701 * will be marked as a trailing context
1704 (yyvsp[0]) = link_machines( (yyvsp[0]),
1705 mkstate( SYM_EPSILON ) );
1707 mark_beginning_as_normal( (yyvsp[0]) );
1708 current_state_type = STATE_NORMAL;
1710 if ( previous_continued_action )
1712 /* We need to treat this as variable trailing
1713 * context so that the backup does not happen
1714 * in the action but before the action switch
1715 * statement. If the backup happens in the
1716 * action, then the rules "falling into" this
1717 * one's action will *also* do the backup,
1720 if ( ! varlength || headcnt != 0 )
1722 "trailing context made variable due to preceding '|' action" );
1724 /* Mark as variable. */
1730 if ( lex_compat || (varlength && headcnt == 0) )
1731 { /* variable trailing context rule */
1732 /* Mark the first part of the rule as the
1733 * accepting "head" part of a trailing
1736 * By the way, we didn't do this at the
1737 * beginning of this production because back
1738 * then current_state_type was set up for a
1739 * trail rule, and add_accept() can create
1742 add_accept( (yyvsp[-1]),
1743 num_rules | YY_TRAILING_HEAD_MASK );
1744 variable_trail_rule = true;
1750 (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) );
1756 { synerr( _("trailing context used twice") ); }
1767 current_state_type = STATE_TRAILING_CONTEXT;
1771 synerr( _("trailing context used twice") );
1772 (yyval) = mkstate( SYM_EPSILON );
1775 else if ( previous_continued_action )
1777 /* See the comment in the rule for "re2 re"
1781 "trailing context made variable due to preceding '|' action" );
1786 if ( lex_compat || varlength )
1788 /* Again, see the comment in the rule for
1791 add_accept( (yyvsp[-1]),
1792 num_rules | YY_TRAILING_HEAD_MASK );
1793 variable_trail_rule = true;
1798 eps = mkstate( SYM_EPSILON );
1799 (yyval) = link_machines( (yyvsp[-1]),
1800 link_machines( eps, mkstate( '\n' ) ) );
1807 (yyval) = (yyvsp[0]);
1811 if ( lex_compat || (varlength && headcnt == 0) )
1812 /* Both head and trail are
1815 variable_trail_rule = true;
1826 (yyval) = mkor( (yyvsp[-2]), (yyvsp[0]) );
1832 { (yyval) = (yyvsp[0]); }
1838 /* This rule is written separately so the
1839 * reduction will occur before the trailing
1844 synerr( _("trailing context used twice") );
1849 /* We hope the trailing context is
1858 current_state_type = STATE_TRAILING_CONTEXT;
1859 (yyval) = (yyvsp[-1]);
1866 /* This is where concatenation of adjacent patterns
1869 (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) );
1875 { (yyval) = (yyvsp[0]); }
1883 if ( (yyvsp[-3]) > (yyvsp[-1]) || (yyvsp[-3]) < 0 )
1885 synerr( _("bad iteration values") );
1886 (yyval) = (yyvsp[-5]);
1890 if ( (yyvsp[-3]) == 0 )
1892 if ( (yyvsp[-1]) <= 0 )
1895 _("bad iteration values") );
1896 (yyval) = (yyvsp[-5]);
1900 mkrep( (yyvsp[-5]), 1, (yyvsp[-1]) ) );
1903 (yyval) = mkrep( (yyvsp[-5]), (yyvsp[-3]), (yyvsp[-1]) );
1913 if ( (yyvsp[-2]) <= 0 )
1915 synerr( _("iteration value must be positive") );
1916 (yyval) = (yyvsp[-4]);
1920 (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT );
1927 /* The series could be something like "(foo)",
1928 * in which case we have no idea what its length
1929 * is, so we punt here.
1933 if ( (yyvsp[-1]) <= 0 )
1935 synerr( _("iteration value must be positive")
1937 (yyval) = (yyvsp[-3]);
1941 (yyval) = link_machines( (yyvsp[-3]),
1942 copysingl( (yyvsp[-3]), (yyvsp[-1]) - 1 ) );
1951 (yyval) = mkclos( (yyvsp[-1]) );
1959 (yyval) = mkposcl( (yyvsp[-1]) );
1967 (yyval) = mkopt( (yyvsp[-1]) );
1976 if ( (yyvsp[-3]) > (yyvsp[-1]) || (yyvsp[-3]) < 0 )
1978 synerr( _("bad iteration values") );
1979 (yyval) = (yyvsp[-5]);
1983 if ( (yyvsp[-3]) == 0 )
1985 if ( (yyvsp[-1]) <= 0 )
1988 _("bad iteration values") );
1989 (yyval) = (yyvsp[-5]);
1993 mkrep( (yyvsp[-5]), 1, (yyvsp[-1]) ) );
1996 (yyval) = mkrep( (yyvsp[-5]), (yyvsp[-3]), (yyvsp[-1]) );
2006 if ( (yyvsp[-2]) <= 0 )
2008 synerr( _("iteration value must be positive") );
2009 (yyval) = (yyvsp[-4]);
2013 (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT );
2020 /* The singleton could be something like "(foo)",
2021 * in which case we have no idea what its length
2022 * is, so we punt here.
2026 if ( (yyvsp[-1]) <= 0 )
2028 synerr( _("iteration value must be positive") );
2029 (yyval) = (yyvsp[-3]);
2033 (yyval) = link_machines( (yyvsp[-3]),
2034 copysingl( (yyvsp[-3]), (yyvsp[-1]) - 1 ) );
2043 /* Create the '.' character class. */
2045 ccladd( ccldot, '\n' );
2046 cclnegate( ccldot );
2049 mkeccl( ccltbl + cclmap[ccldot],
2050 ccllen[ccldot], nextecm,
2051 ecgroup, csize, csize );
2053 /* Create the (?s:'.') character class. */
2055 cclnegate( cclany );
2058 mkeccl( ccltbl + cclmap[cclany],
2059 ccllen[cclany], nextecm,
2060 ecgroup, csize, csize );
2068 (yyval) = mkstate( -cclany );
2070 (yyval) = mkstate( -ccldot );
2077 /* Sort characters for fast searching. We
2078 * use a shell sort since this list could
2081 cshell( ccltbl + cclmap[(yyvsp[0])], ccllen[(yyvsp[0])], true );
2084 mkeccl( ccltbl + cclmap[(yyvsp[0])], ccllen[(yyvsp[0])],
2085 nextecm, ecgroup, csize, csize );
2089 if (ccl_has_nl[(yyvsp[0])])
2090 rule_has_nl[num_rules] = true;
2092 (yyval) = mkstate( -(yyvsp[0]) );
2101 if (ccl_has_nl[(yyvsp[0])])
2102 rule_has_nl[num_rules] = true;
2104 (yyval) = mkstate( -(yyvsp[0]) );
2110 { (yyval) = (yyvsp[-1]); }
2115 { (yyval) = (yyvsp[-1]); }
2123 if ((yyvsp[0]) == nlch)
2124 rule_has_nl[num_rules] = true;
2126 if (sf_case_ins() && has_case((yyvsp[0])))
2127 /* create an alternation, as in (a|A) */
2128 (yyval) = mkor (mkstate((yyvsp[0])), mkstate(reverse_case((yyvsp[0]))));
2130 (yyval) = mkstate( (yyvsp[0]) );
2136 { (yyval) = ccl_set_diff ((yyvsp[-2]), (yyvsp[0])); }
2141 { (yyval) = ccl_set_union ((yyvsp[-2]), (yyvsp[0])); }
2146 { (yyval) = (yyvsp[-1]); }
2152 cclnegate( (yyvsp[-1]) );
2153 (yyval) = (yyvsp[-1]);
2164 /* If one end of the range has case and the other
2165 * does not, or the cases are different, then we're not
2166 * sure what range the user is trying to express.
2167 * Examples: [@-z] or [S-t]
2169 if (has_case ((yyvsp[-2])) != has_case ((yyvsp[0]))
2170 || (has_case ((yyvsp[-2])) && (b_islower ((yyvsp[-2])) != b_islower ((yyvsp[0]))))
2171 || (has_case ((yyvsp[-2])) && (b_isupper ((yyvsp[-2])) != b_isupper ((yyvsp[0])))))
2173 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
2174 (yyvsp[-2]), (yyvsp[0]));
2176 /* If the range spans uppercase characters but not
2177 * lowercase (or vice-versa), then should we automatically
2178 * include lowercase characters in the range?
2179 * Example: [@-_] spans [a-z] but not [A-Z]
2181 else if (!has_case ((yyvsp[-2])) && !has_case ((yyvsp[0])) && !range_covers_case ((yyvsp[-2]), (yyvsp[0])))
2183 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
2184 (yyvsp[-2]), (yyvsp[0]));
2187 if ( (yyvsp[-2]) > (yyvsp[0]) )
2188 synerr( _("negative range in character class") );
2192 for ( i = (yyvsp[-2]); i <= (yyvsp[0]); ++i )
2193 ccladd( (yyvsp[-3]), i );
2195 /* Keep track if this ccl is staying in
2196 * alphabetical order.
2198 cclsorted = cclsorted && ((yyvsp[-2]) > lastchar);
2199 lastchar = (yyvsp[0]);
2201 /* Do it again for upper/lowercase */
2202 if (sf_case_ins() && has_case((yyvsp[-2])) && has_case((yyvsp[0]))){
2203 (yyvsp[-2]) = reverse_case ((yyvsp[-2]));
2204 (yyvsp[0]) = reverse_case ((yyvsp[0]));
2206 for ( i = (yyvsp[-2]); i <= (yyvsp[0]); ++i )
2207 ccladd( (yyvsp[-3]), i );
2209 cclsorted = cclsorted && ((yyvsp[-2]) > lastchar);
2210 lastchar = (yyvsp[0]);
2215 (yyval) = (yyvsp[-3]);
2222 ccladd( (yyvsp[-1]), (yyvsp[0]) );
2223 cclsorted = cclsorted && ((yyvsp[0]) > lastchar);
2224 lastchar = (yyvsp[0]);
2226 /* Do it again for upper/lowercase */
2227 if (sf_case_ins() && has_case((yyvsp[0]))){
2228 (yyvsp[0]) = reverse_case ((yyvsp[0]));
2229 ccladd ((yyvsp[-1]), (yyvsp[0]));
2231 cclsorted = cclsorted && ((yyvsp[0]) > lastchar);
2232 lastchar = (yyvsp[0]);
2235 (yyval) = (yyvsp[-1]);
2242 /* Too hard to properly maintain cclsorted. */
2244 (yyval) = (yyvsp[-1]);
2253 currccl = (yyval) = cclinit();
2259 { CCL_EXPR(isalnum); }
2264 { CCL_EXPR(isalpha); }
2269 { CCL_EXPR(IS_BLANK); }
2274 { CCL_EXPR(iscntrl); }
2279 { CCL_EXPR(isdigit); }
2284 { CCL_EXPR(isgraph); }
2298 { CCL_EXPR(isprint); }
2303 { CCL_EXPR(ispunct); }
2308 { CCL_EXPR(isspace); }
2313 { CCL_EXPR(isxdigit); }
2327 { CCL_NEG_EXPR(isalnum); }
2332 { CCL_NEG_EXPR(isalpha); }
2337 { CCL_NEG_EXPR(IS_BLANK); }
2342 { CCL_NEG_EXPR(iscntrl); }
2347 { CCL_NEG_EXPR(isdigit); }
2352 { CCL_NEG_EXPR(isgraph); }
2357 { CCL_NEG_EXPR(isprint); }
2362 { CCL_NEG_EXPR(ispunct); }
2367 { CCL_NEG_EXPR(isspace); }
2372 { CCL_NEG_EXPR(isxdigit); }
2378 if ( sf_case_ins() )
2379 warn(_("[:^lower:] is ambiguous in case insensitive scanner"));
2381 CCL_NEG_EXPR(islower);
2388 if ( sf_case_ins() )
2389 warn(_("[:^upper:] ambiguous in case insensitive scanner"));
2391 CCL_NEG_EXPR(isupper);
2398 if ( (yyvsp[0]) == nlch )
2399 rule_has_nl[num_rules] = true;
2403 if (sf_case_ins() && has_case((yyvsp[0])))
2404 (yyval) = mkor (mkstate((yyvsp[0])), mkstate(reverse_case((yyvsp[0]))));
2406 (yyval) = mkstate ((yyvsp[0]));
2408 (yyval) = link_machines( (yyvsp[-1]), (yyval));
2414 { (yyval) = mkstate( SYM_EPSILON ); }
2421 /* Line 1126 of yacc.c. */
2422 #line 2423 "parse.c"
2428 YY_STACK_PRINT (yyss, yyssp);
2433 /* Now `shift' the result of the reduction. Determine what state
2434 that goes to, based on the state we popped back to and the rule
2435 number reduced by. */
2439 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2440 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2441 yystate = yytable[yystate];
2443 yystate = yydefgoto[yyn - YYNTOKENS];
2448 /*------------------------------------.
2449 | yyerrlab -- here on detecting error |
2450 `------------------------------------*/
2452 /* If not already recovering from an error, report this error. */
2457 yyn = yypact[yystate];
2459 if (YYPACT_NINF < yyn && yyn < YYLAST)
2461 int yytype = YYTRANSLATE (yychar);
2462 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
2463 YYSIZE_T yysize = yysize0;
2465 int yysize_overflow = 0;
2467 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
2468 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2472 /* This is so xgettext sees the translatable formats that are
2473 constructed on the fly. */
2474 YY_("syntax error, unexpected %s");
2475 YY_("syntax error, unexpected %s, expecting %s");
2476 YY_("syntax error, unexpected %s, expecting %s or %s");
2477 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
2478 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
2482 static char const yyunexpected[] = "syntax error, unexpected %s";
2483 static char const yyexpecting[] = ", expecting %s";
2484 static char const yyor[] = " or %s";
2485 char yyformat[sizeof yyunexpected
2486 + sizeof yyexpecting - 1
2487 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
2488 * (sizeof yyor - 1))];
2489 char const *yyprefix = yyexpecting;
2491 /* Start YYX at -YYN if negative to avoid negative indexes in
2493 int yyxbegin = yyn < 0 ? -yyn : 0;
2495 /* Stay within bounds of both yycheck and yytname. */
2496 int yychecklim = YYLAST - yyn;
2497 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2500 yyarg[0] = yytname[yytype];
2501 yyfmt = yystpcpy (yyformat, yyunexpected);
2503 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2504 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2506 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2510 yyformat[sizeof yyunexpected - 1] = '\0';
2513 yyarg[yycount++] = yytname[yyx];
2514 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
2515 yysize_overflow |= yysize1 < yysize;
2517 yyfmt = yystpcpy (yyfmt, yyprefix);
2521 yyf = YY_(yyformat);
2522 yysize1 = yysize + yystrlen (yyf);
2523 yysize_overflow |= yysize1 < yysize;
2526 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
2527 yymsg = (char *) YYSTACK_ALLOC (yysize);
2530 /* Avoid sprintf, as that infringes on the user's name space.
2531 Don't have undefined behavior even if the translation
2532 produced a string with the wrong number of "%s"s. */
2535 while ((*yyp = *yyf))
2537 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
2539 yyp += yytnamerr (yyp, yyarg[yyi++]);
2549 YYSTACK_FREE (yymsg);
2553 yyerror (YY_("syntax error"));
2554 goto yyexhaustedlab;
2558 #endif /* YYERROR_VERBOSE */
2559 yyerror (YY_("syntax error"));
2564 if (yyerrstatus == 3)
2566 /* If just tried and failed to reuse look-ahead token after an
2567 error, discard it. */
2569 if (yychar <= YYEOF)
2571 /* Return failure if at end of input. */
2572 if (yychar == YYEOF)
2577 yydestruct ("Error: discarding", yytoken, &yylval);
2582 /* Else will try to reuse look-ahead token after shifting the error
2587 /*---------------------------------------------------.
2588 | yyerrorlab -- error raised explicitly by YYERROR. |
2589 `---------------------------------------------------*/
2592 /* Pacify compilers like GCC when the user code never invokes
2593 YYERROR and the label yyerrorlab therefore never appears in user
2604 /*-------------------------------------------------------------.
2605 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2606 `-------------------------------------------------------------*/
2608 yyerrstatus = 3; /* Each real token shifted decrements this. */
2612 yyn = yypact[yystate];
2613 if (yyn != YYPACT_NINF)
2616 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2624 /* Pop the current state because it cannot handle the error token. */
2629 yydestruct ("Error: popping", yystos[yystate], yyvsp);
2632 YY_STACK_PRINT (yyss, yyssp);
2641 /* Shift the error token. */
2642 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2648 /*-------------------------------------.
2649 | yyacceptlab -- YYACCEPT comes here. |
2650 `-------------------------------------*/
2655 /*-----------------------------------.
2656 | yyabortlab -- YYABORT comes here. |
2657 `-----------------------------------*/
2663 /*-------------------------------------------------.
2664 | yyexhaustedlab -- memory exhaustion comes here. |
2665 `-------------------------------------------------*/
2667 yyerror (YY_("memory exhausted"));
2673 if (yychar != YYEOF && yychar != YYEMPTY)
2674 yydestruct ("Cleanup: discarding lookahead",
2676 while (yyssp != yyss)
2678 yydestruct ("Cleanup: popping",
2679 yystos[*yyssp], yyvsp);
2684 YYSTACK_FREE (yyss);
2694 /* build_eof_action - build the "<<EOF>>" action for the active start
2698 void build_eof_action()
2701 char action_text[MAXLINE];
2703 for ( i = 1; i <= scon_stk_ptr; ++i )
2705 if ( sceof[scon_stk[i]] )
2706 format_pinpoint_message(
2707 "multiple <<EOF>> rules for start condition %s",
2708 scname[scon_stk[i]] );
2712 sceof[scon_stk[i]] = true;
2713 snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n",
2714 scname[scon_stk[i]] );
2715 add_action( action_text );
2719 line_directive_out( (FILE *) 0, 1 );
2721 /* This isn't a normal rule after all - don't count it as
2722 * such, so we don't have any holes in the rule numbering
2723 * (which make generating "rule can never match" warnings
2731 /* format_synerr - write out formatted syntax error */
2733 void format_synerr( msg, arg )
2734 const char *msg, arg[];
2736 char errmsg[MAXLINE];
2738 (void) snprintf( errmsg, sizeof(errmsg), msg, arg );
2743 /* synerr - report a syntax error */
2749 pinpoint_message( str );
2753 /* format_warn - write out formatted warning */
2755 void format_warn( msg, arg )
2756 const char *msg, arg[];
2758 char warn_msg[MAXLINE];
2760 snprintf( warn_msg, sizeof(warn_msg), msg, arg );
2765 /* warn - report a warning, unless -w was given */
2770 line_warning( str, linenum );
2773 /* format_pinpoint_message - write out a message formatted with one string,
2774 * pinpointing its location
2777 void format_pinpoint_message( msg, arg )
2778 const char *msg, arg[];
2780 char errmsg[MAXLINE];
2782 snprintf( errmsg, sizeof(errmsg), msg, arg );
2783 pinpoint_message( errmsg );
2787 /* pinpoint_message - write out a message, pinpointing its location */
2789 void pinpoint_message( str )
2792 line_pinpoint( str, linenum );
2796 /* line_warning - report a warning at a given line, unless -w was given */
2798 void line_warning( str, line )
2802 char warning[MAXLINE];
2806 snprintf( warning, sizeof(warning), "warning, %s", str );
2807 line_pinpoint( warning, line );
2812 /* line_pinpoint - write out a message, pinpointing it at the given line */
2814 void line_pinpoint( str, line )
2818 fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
2822 /* yyerror - eat up an error message from the parser;
2823 * currently, messages are ignore