1 /* A Bison parser, made by GNU Bison 3.0.4. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6
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.
11
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.
16
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/>. */
19
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.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
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. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.4"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 0
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61
62
63
64 /* Copy the first part of user declarations. */
65 #line 34 "parse.y" /* yacc.c:339 */
66
67 /* Copyright (c) 1990 The Regents of the University of California. */
68 /* All rights reserved. */
69
70 /* This code is derived from software contributed to Berkeley by */
71 /* Vern Paxson. */
72
73 /* The United States Government has rights in this work pursuant */
74 /* to contract no. DE-AC03-76SF00098 between the United States */
75 /* Department of Energy and the University of California. */
76
77 /* This file is part of flex. */
78
79 /* Redistribution and use in source and binary forms, with or without */
80 /* modification, are permitted provided that the following conditions */
81 /* are met: */
82
83 /* 1. Redistributions of source code must retain the above copyright */
84 /* notice, this list of conditions and the following disclaimer. */
85 /* 2. Redistributions in binary form must reproduce the above copyright */
86 /* notice, this list of conditions and the following disclaimer in the */
87 /* documentation and/or other materials provided with the distribution. */
88
89 /* Neither the name of the University nor the names of its contributors */
90 /* may be used to endorse or promote products derived from this software */
91 /* without specific prior written permission. */
92
93 /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
94 /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
95 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
96 /* PURPOSE. */
97
98 #include "flexdef.h"
99 #include "tables.h"
100
101 int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen;
102 int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule;
103
104 int *scon_stk;
105 int scon_stk_ptr;
106
107 static int madeany = false; /* whether we've made the '.' character class */
108 static int ccldot, cclany;
109 int previous_continued_action; /* whether the previous rule's action was '|' */
110
111 #define format_warn3(fmt, a1, a2) \
112 do{ \
113 char fw3_msg[MAXLINE];\
114 snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
115 lwarn( fw3_msg );\
116 }while(0)
117
118 /* Expand a POSIX character class expression. */
119 #define CCL_EXPR(func) \
120 do{ \
121 int c; \
122 for ( c = 0; c < csize; ++c ) \
123 if ( isascii(c) && func(c) ) \
124 ccladd( currccl, c ); \
125 }while(0)
126
127 /* negated class */
128 #define CCL_NEG_EXPR(func) \
129 do{ \
130 int c; \
131 for ( c = 0; c < csize; ++c ) \
132 if ( !func(c) ) \
133 ccladd( currccl, c ); \
134 }while(0)
135
136 /* While POSIX defines isblank(), it's not ANSI C. */
137 #define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
138
139 /* On some over-ambitious machines, such as DEC Alpha's, the default
140 * token type is "long" instead of "int"; this leads to problems with
141 * declaring yylval in flexdef.h. But so far, all the yacc's I've seen
142 * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
143 * following should ensure that the default token type is "int".
144 */
145 #define YYSTYPE int
146
147
148 #line 149 "parse.c" /* yacc.c:339 */
149
150 # ifndef YY_NULLPTR
151 # if defined __cplusplus && 201103L <= __cplusplus
152 # define YY_NULLPTR nullptr
153 # else
154 # define YY_NULLPTR 0
155 # endif
156 # endif
157
158 /* Enabling verbose error messages. */
159 #ifdef YYERROR_VERBOSE
160 # undef YYERROR_VERBOSE
161 # define YYERROR_VERBOSE 1
162 #else
163 # define YYERROR_VERBOSE 0
164 #endif
165
166 /* In a future release of Bison, this section will be replaced
167 by #include "y.tab.h". */
168 #ifndef YY_YY_PARSE_H_INCLUDED
169 # define YY_YY_PARSE_H_INCLUDED
170 /* Debug traces. */
171 #ifndef YYDEBUG
172 # define YYDEBUG 0
173 #endif
174 #if YYDEBUG
175 extern int yydebug;
176 #endif
177
178 /* Token type. */
179 #ifndef YYTOKENTYPE
180 # define YYTOKENTYPE
181 enum yytokentype
182 {
183 CHAR = 258,
184 NUMBER = 259,
185 SECTEND = 260,
186 SCDECL = 261,
187 XSCDECL = 262,
188 NAME = 263,
189 PREVCCL = 264,
190 EOF_OP = 265,
191 TOK_OPTION = 266,
192 TOK_OUTFILE = 267,
193 TOK_PREFIX = 268,
194 TOK_YYCLASS = 269,
195 TOK_HEADER_FILE = 270,
196 TOK_EXTRA_TYPE = 271,
197 TOK_TABLES_FILE = 272,
198 CCE_ALNUM = 273,
199 CCE_ALPHA = 274,
200 CCE_BLANK = 275,
201 CCE_CNTRL = 276,
202 CCE_DIGIT = 277,
203 CCE_GRAPH = 278,
204 CCE_LOWER = 279,
205 CCE_PRINT = 280,
206 CCE_PUNCT = 281,
207 CCE_SPACE = 282,
208 CCE_UPPER = 283,
209 CCE_XDIGIT = 284,
210 CCE_NEG_ALNUM = 285,
211 CCE_NEG_ALPHA = 286,
212 CCE_NEG_BLANK = 287,
213 CCE_NEG_CNTRL = 288,
214 CCE_NEG_DIGIT = 289,
215 CCE_NEG_GRAPH = 290,
216 CCE_NEG_LOWER = 291,
217 CCE_NEG_PRINT = 292,
218 CCE_NEG_PUNCT = 293,
219 CCE_NEG_SPACE = 294,
220 CCE_NEG_UPPER = 295,
221 CCE_NEG_XDIGIT = 296,
222 CCL_OP_DIFF = 297,
223 CCL_OP_UNION = 298,
224 BEGIN_REPEAT_POSIX = 299,
225 END_REPEAT_POSIX = 300,
226 BEGIN_REPEAT_FLEX = 301,
227 END_REPEAT_FLEX = 302
228 };
229 #endif
230 /* Tokens. */
231 #define CHAR 258
232 #define NUMBER 259
233 #define SECTEND 260
234 #define SCDECL 261
235 #define XSCDECL 262
236 #define NAME 263
237 #define PREVCCL 264
238 #define EOF_OP 265
239 #define TOK_OPTION 266
240 #define TOK_OUTFILE 267
241 #define TOK_PREFIX 268
242 #define TOK_YYCLASS 269
243 #define TOK_HEADER_FILE 270
244 #define TOK_EXTRA_TYPE 271
245 #define TOK_TABLES_FILE 272
246 #define CCE_ALNUM 273
247 #define CCE_ALPHA 274
248 #define CCE_BLANK 275
249 #define CCE_CNTRL 276
250 #define CCE_DIGIT 277
251 #define CCE_GRAPH 278
252 #define CCE_LOWER 279
253 #define CCE_PRINT 280
254 #define CCE_PUNCT 281
255 #define CCE_SPACE 282
256 #define CCE_UPPER 283
257 #define CCE_XDIGIT 284
258 #define CCE_NEG_ALNUM 285
259 #define CCE_NEG_ALPHA 286
260 #define CCE_NEG_BLANK 287
261 #define CCE_NEG_CNTRL 288
262 #define CCE_NEG_DIGIT 289
263 #define CCE_NEG_GRAPH 290
264 #define CCE_NEG_LOWER 291
265 #define CCE_NEG_PRINT 292
266 #define CCE_NEG_PUNCT 293
267 #define CCE_NEG_SPACE 294
268 #define CCE_NEG_UPPER 295
269 #define CCE_NEG_XDIGIT 296
270 #define CCL_OP_DIFF 297
271 #define CCL_OP_UNION 298
272 #define BEGIN_REPEAT_POSIX 299
273 #define END_REPEAT_POSIX 300
274 #define BEGIN_REPEAT_FLEX 301
275 #define END_REPEAT_FLEX 302
276
277 /* Value type. */
278 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
279 typedef int YYSTYPE;
280 # define YYSTYPE_IS_TRIVIAL 1
281 # define YYSTYPE_IS_DECLARED 1
282 #endif
283
284
285 extern YYSTYPE yylval;
286
287 int yyparse (void);
288
289 #endif /* !YY_YY_PARSE_H_INCLUDED */
290
291 /* Copy the second part of user declarations. */
292
293 #line 294 "parse.c" /* yacc.c:358 */
294
295 #ifdef short
296 # undef short
297 #endif
298
299 #ifdef YYTYPE_UINT8
300 typedef YYTYPE_UINT8 yytype_uint8;
301 #else
302 typedef unsigned char yytype_uint8;
303 #endif
304
305 #ifdef YYTYPE_INT8
306 typedef YYTYPE_INT8 yytype_int8;
307 #else
308 typedef signed char yytype_int8;
309 #endif
310
311 #ifdef YYTYPE_UINT16
312 typedef YYTYPE_UINT16 yytype_uint16;
313 #else
314 typedef unsigned short int yytype_uint16;
315 #endif
316
317 #ifdef YYTYPE_INT16
318 typedef YYTYPE_INT16 yytype_int16;
319 #else
320 typedef short int yytype_int16;
321 #endif
322
323 #ifndef YYSIZE_T
324 # ifdef __SIZE_TYPE__
325 # define YYSIZE_T __SIZE_TYPE__
326 # elif defined size_t
327 # define YYSIZE_T size_t
328 # elif ! defined YYSIZE_T
329 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
330 # define YYSIZE_T size_t
331 # else
332 # define YYSIZE_T unsigned int
333 # endif
334 #endif
335
336 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
337
338 #ifndef YY_
339 # if defined YYENABLE_NLS && YYENABLE_NLS
340 # if ENABLE_NLS
341 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
342 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
343 # endif
344 # endif
345 # ifndef YY_
346 # define YY_(Msgid) Msgid
347 # endif
348 #endif
349
350 #ifndef YY_ATTRIBUTE
351 # if (defined __GNUC__ \
352 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
353 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
354 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
355 # else
356 # define YY_ATTRIBUTE(Spec) /* empty */
357 # endif
358 #endif
359
360 #ifndef YY_ATTRIBUTE_PURE
361 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
362 #endif
363
364 #ifndef YY_ATTRIBUTE_UNUSED
365 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
366 #endif
367
368 #if !defined _Noreturn \
369 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
370 # if defined _MSC_VER && 1200 <= _MSC_VER
371 # define _Noreturn __declspec (noreturn)
372 # else
373 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
374 # endif
375 #endif
376
377 /* Suppress unused-variable warnings by "using" E. */
378 #if ! defined lint || defined __GNUC__
379 # define YYUSE(E) ((void) (E))
380 #else
381 # define YYUSE(E) /* empty */
382 #endif
383
384 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
385 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
386 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
387 _Pragma ("GCC diagnostic push") \
388 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
389 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
390 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
391 _Pragma ("GCC diagnostic pop")
392 #else
393 # define YY_INITIAL_VALUE(Value) Value
394 #endif
395 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
396 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
397 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
398 #endif
399 #ifndef YY_INITIAL_VALUE
400 # define YY_INITIAL_VALUE(Value) /* Nothing. */
401 #endif
402
403
404 #if ! defined yyoverflow || YYERROR_VERBOSE
405
406 /* The parser invokes alloca or malloc; define the necessary symbols. */
407
408 # ifdef YYSTACK_USE_ALLOCA
409 # if YYSTACK_USE_ALLOCA
410 # ifdef __GNUC__
411 # define YYSTACK_ALLOC __builtin_alloca
412 # elif defined __BUILTIN_VA_ARG_INCR
413 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
414 # elif defined _AIX
415 # define YYSTACK_ALLOC __alloca
416 # elif defined _MSC_VER
417 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
418 # define alloca _alloca
419 # else
420 # define YYSTACK_ALLOC alloca
421 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
422 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
423 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
424 # ifndef EXIT_SUCCESS
425 # define EXIT_SUCCESS 0
426 # endif
427 # endif
428 # endif
429 # endif
430 # endif
431
432 # ifdef YYSTACK_ALLOC
433 /* Pacify GCC's 'empty if-body' warning. */
434 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
435 # ifndef YYSTACK_ALLOC_MAXIMUM
436 /* The OS might guarantee only one guard page at the bottom of the stack,
437 and a page size can be as small as 4096 bytes. So we cannot safely
438 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
439 to allow for a few compiler-allocated temporary stack slots. */
440 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
441 # endif
442 # else
443 # define YYSTACK_ALLOC YYMALLOC
444 # define YYSTACK_FREE YYFREE
445 # ifndef YYSTACK_ALLOC_MAXIMUM
446 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
447 # endif
448 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
449 && ! ((defined YYMALLOC || defined malloc) \
450 && (defined YYFREE || defined free)))
451 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
452 # ifndef EXIT_SUCCESS
453 # define EXIT_SUCCESS 0
454 # endif
455 # endif
456 # ifndef YYMALLOC
457 # define YYMALLOC malloc
458 # if ! defined malloc && ! defined EXIT_SUCCESS
459 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
460 # endif
461 # endif
462 # ifndef YYFREE
463 # define YYFREE free
464 # if ! defined free && ! defined EXIT_SUCCESS
465 void free (void *); /* INFRINGES ON USER NAME SPACE */
466 # endif
467 # endif
468 # endif
469 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
470
471
472 #if (! defined yyoverflow \
473 && (! defined __cplusplus \
474 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
475
476 /* A type that is properly aligned for any stack member. */
477 union yyalloc
478 {
479 yytype_int16 yyss_alloc;
480 YYSTYPE yyvs_alloc;
481 };
482
483 /* The size of the maximum gap between one aligned stack and the next. */
484 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
485
486 /* The size of an array large to enough to hold all stacks, each with
487 N elements. */
488 # define YYSTACK_BYTES(N) \
489 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
490 + YYSTACK_GAP_MAXIMUM)
491
492 # define YYCOPY_NEEDED 1
493
494 /* Relocate STACK from its old location to the new one. The
495 local variables YYSIZE and YYSTACKSIZE give the old and new number of
496 elements in the stack, and YYPTR gives the new location of the
497 stack. Advance YYPTR to a properly aligned location for the next
498 stack. */
499 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
500 do \
501 { \
502 YYSIZE_T yynewbytes; \
503 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
504 Stack = &yyptr->Stack_alloc; \
505 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
506 yyptr += yynewbytes / sizeof (*yyptr); \
507 } \
508 while (0)
509
510 #endif
511
512 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
513 /* Copy COUNT objects from SRC to DST. The source and destination do
514 not overlap. */
515 # ifndef YYCOPY
516 # if defined __GNUC__ && 1 < __GNUC__
517 # define YYCOPY(Dst, Src, Count) \
518 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
519 # else
520 # define YYCOPY(Dst, Src, Count) \
521 do \
522 { \
523 YYSIZE_T yyi; \
524 for (yyi = 0; yyi < (Count); yyi++) \
525 (Dst)[yyi] = (Src)[yyi]; \
526 } \
527 while (0)
528 # endif
529 # endif
530 #endif /* !YYCOPY_NEEDED */
531
532 /* YYFINAL -- State number of the termination state. */
533 #define YYFINAL 3
534 /* YYLAST -- Last index in YYTABLE. */
535 #define YYLAST 161
536
537 /* YYNTOKENS -- Number of terminals. */
538 #define YYNTOKENS 69
539 /* YYNNTS -- Number of nonterminals. */
540 #define YYNNTS 27
541 /* YYNRULES -- Number of rules. */
542 #define YYNRULES 97
543 /* YYNSTATES -- Number of states. */
544 #define YYNSTATES 140
545
546 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
547 by yylex, with out-of-bounds checking. */
548 #define YYUNDEFTOK 2
549 #define YYMAXUTOK 302
550
551 #define YYTRANSLATE(YYX) \
552 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
553
554 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
555 as returned by yylex, without out-of-bounds checking. */
556 static const yytype_uint8 yytranslate[] =
557 {
558 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 49, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 63, 2, 57, 2, 2, 2,
562 64, 65, 55, 60, 56, 68, 62, 59, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 53, 48, 54, 61, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 66, 2, 67, 52, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 50, 58, 51, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 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 2, 2, 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, 1, 2, 3, 4,
584 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
585 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
586 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
587 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
588 45, 46, 47
589 };
590
591 #if YYDEBUG
592 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
593 static const yytype_uint16 yyrline[] =
594 {
595 0, 118, 118, 148, 155, 156, 157, 158, 162, 170,
596 173, 177, 180, 183, 187, 190, 191, 194, 199, 201,
597 205, 207, 209, 213, 215, 217, 221, 233, 269, 293,
598 316, 321, 324, 327, 345, 348, 350, 352, 356, 379,
599 435, 438, 481, 499, 505, 510, 537, 545, 548, 576,
600 590, 612, 619, 625, 631, 659, 673, 692, 726, 744,
601 754, 757, 760, 775, 776, 777, 782, 784, 791, 851,
602 869, 877, 885, 886, 887, 888, 889, 890, 891, 896,
603 897, 898, 899, 900, 906, 907, 908, 909, 910, 911,
604 912, 913, 914, 915, 916, 922, 930, 946
605 };
606 #endif
607
608 #if YYDEBUG || YYERROR_VERBOSE || 0
609 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
610 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
611 static const char *const yytname[] =
612 {
613 "$end", "error", "$undefined", "CHAR", "NUMBER", "SECTEND", "SCDECL",
614 "XSCDECL", "NAME", "PREVCCL", "EOF_OP", "TOK_OPTION", "TOK_OUTFILE",
615 "TOK_PREFIX", "TOK_YYCLASS", "TOK_HEADER_FILE", "TOK_EXTRA_TYPE",
616 "TOK_TABLES_FILE", "CCE_ALNUM", "CCE_ALPHA", "CCE_BLANK", "CCE_CNTRL",
617 "CCE_DIGIT", "CCE_GRAPH", "CCE_LOWER", "CCE_PRINT", "CCE_PUNCT",
618 "CCE_SPACE", "CCE_UPPER", "CCE_XDIGIT", "CCE_NEG_ALNUM", "CCE_NEG_ALPHA",
619 "CCE_NEG_BLANK", "CCE_NEG_CNTRL", "CCE_NEG_DIGIT", "CCE_NEG_GRAPH",
620 "CCE_NEG_LOWER", "CCE_NEG_PRINT", "CCE_NEG_PUNCT", "CCE_NEG_SPACE",
621 "CCE_NEG_UPPER", "CCE_NEG_XDIGIT", "CCL_OP_DIFF", "CCL_OP_UNION",
622 "BEGIN_REPEAT_POSIX", "END_REPEAT_POSIX", "BEGIN_REPEAT_FLEX",
623 "END_REPEAT_FLEX", "'='", "'\\n'", "'{'", "'}'", "'^'", "'<'", "'>'",
624 "'*'", "','", "'$'", "'|'", "'/'", "'+'", "'?'", "'.'", "'\"'", "'('",
625 "')'", "'['", "']'", "'-'", "$accept", "goal", "initlex", "sect1",
626 "sect1end", "startconddecl", "namelist1", "options", "optionlist",
627 "option", "sect2", "initforrule", "flexrule", "scon_stk_ptr", "scon",
628 "namelist2", "sconname", "rule", "re", "re2", "series", "singleton",
629 "fullccl", "braceccl", "ccl", "ccl_expr", "string", YY_NULLPTR
630 };
631 #endif
632
633 # ifdef YYPRINT
634 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
635 (internal) symbol number NUM (which must be that of a token). */
636 static const yytype_uint16 yytoknum[] =
637 {
638 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
639 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
640 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
641 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
642 295, 296, 297, 298, 299, 300, 301, 302, 61, 10,
643 123, 125, 94, 60, 62, 42, 44, 36, 124, 47,
644 43, 63, 46, 34, 40, 41, 91, 93, 45
645 };
646 # endif
647
648 #define YYPACT_NINF -52
649
650 #define yypact_value_is_default(Yystate) \
651 (!!((Yystate) == (-52)))
652
653 #define YYTABLE_NINF -27
654
655 #define yytable_value_is_error(Yytable_value) \
656 0
657
658 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
659 STATE-NUM. */
660 static const yytype_int16 yypact[] =
661 {
662 -52, 17, 103, -52, -52, 113, -52, -52, -52, -52,
663 -52, 48, -52, 114, 6, -52, -52, 42, 7, 12,
664 58, 77, 88, 89, -52, 43, -52, 73, -52, 130,
665 131, 132, 133, 134, 135, 90, 91, -52, -1, -52,
666 -52, -52, -52, -52, -52, -52, -52, -52, 40, -52,
667 44, -52, -52, -52, -52, 39, -52, -52, 39, 93,
668 97, -52, -12, 39, 49, 61, -31, -52, -52, 139,
669 -52, -52, 1, -51, -52, 0, -52, -52, 39, -52,
670 75, 144, 61, 145, -52, -52, -52, 84, 84, -52,
671 -52, -52, -52, 50, 83, -52, -52, -52, -52, -52,
672 -52, -52, -52, -52, -52, -52, -52, -52, -52, -52,
673 -52, -52, -52, -52, -52, -52, -52, -52, -52, -52,
674 -52, 49, -52, -40, 10, -52, -52, -52, 149, -52,
675 9, -52, -3, -52, 108, -52, 107, -52, -52, -52
676 };
677
678 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
679 Performed when YYTABLE does not specify something else to do. Zero
680 means the default is an error. */
681 static const yytype_uint8 yydefact[] =
682 {
683 3, 0, 0, 1, 7, 0, 8, 9, 10, 16,
684 25, 0, 5, 14, 34, 13, 12, 4, 0, 0,
685 0, 0, 0, 0, 15, 31, 2, 26, 11, 0,
686 0, 0, 0, 0, 0, 0, 0, 25, 0, 17,
687 19, 20, 21, 18, 22, 33, 37, 38, 0, 36,
688 34, 30, 62, 59, 29, 0, 57, 97, 0, 71,
689 0, 28, 42, 0, 44, 47, 58, 65, 32, 0,
690 24, 27, 0, 0, 71, 0, 23, 41, 0, 45,
691 39, 0, 46, 0, 51, 52, 53, 0, 0, 35,
692 96, 60, 61, 0, 69, 72, 73, 74, 75, 76,
693 77, 78, 79, 80, 81, 83, 82, 84, 85, 86,
694 87, 88, 89, 94, 90, 91, 92, 95, 93, 66,
695 70, 43, 40, 0, 0, 63, 64, 67, 0, 50,
696 0, 56, 0, 68, 0, 49, 0, 55, 48, 54
697 };
698
699 /* YYPGOTO[NTERM-NUM]. */
700 static const yytype_int16 yypgoto[] =
701 {
702 -52, -52, -52, -52, -52, -52, -52, -52, -52, -52,
703 118, 129, -52, -52, -52, -52, 92, 102, -48, -52,
704 80, -21, -52, 47, 85, -52, -52
705 };
706
707 /* YYDEFGOTO[NTERM-NUM]. */
708 static const yytype_int8 yydefgoto[] =
709 {
710 -1, 1, 2, 5, 10, 11, 17, 12, 13, 24,
711 14, 26, 60, 36, 27, 48, 49, 61, 62, 63,
712 64, 65, 66, 67, 75, 120, 72
713 };
714
715 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
716 positive, shift that token. If negative, reduce the rule whose
717 number is the opposite. If YYTABLE_NINF, syntax error. */
718 static const yytype_int16 yytable[] =
719 {
720 51, 136, 52, 94, 90, 129, -26, 78, 53, 54,
721 73, 87, 88, 134, 92, 80, 130, 3, 95, 96,
722 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
723 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
724 117, 118, 52, 82, 137, 77, 78, 79, 53, 15,
725 28, 55, 52, 94, 135, 29, 16, 131, 53, 25,
726 30, 56, 57, 58, 91, 59, 132, 119, 95, 96,
727 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
728 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
729 117, 118, 46, 81, 68, 70, 69, 25, 35, 47,
730 82, 56, 57, 58, 4, 59, 31, 83, -6, -6,
731 -6, 56, 57, 58, -6, 59, 84, 127, 6, 7,
732 8, 85, 86, 37, 9, 32, 18, 19, 20, 21,
733 22, 23, 122, 78, 125, 126, 33, 34, 39, 40,
734 41, 42, 43, 44, 45, 74, 76, 47, 123, 124,
735 59, 128, 133, 138, 139, 50, 38, 71, 121, 93,
736 0, 89
737 };
738
739 static const yytype_int8 yycheck[] =
740 {
741 1, 4, 3, 3, 3, 45, 0, 58, 9, 10,
742 58, 42, 43, 4, 65, 63, 56, 0, 18, 19,
743 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
744 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
745 40, 41, 3, 64, 47, 57, 58, 59, 9, 1,
746 8, 52, 3, 3, 45, 48, 8, 47, 9, 53,
747 48, 62, 63, 64, 63, 66, 56, 67, 18, 19,
748 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
749 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
750 40, 41, 1, 44, 54, 51, 56, 53, 55, 8,
751 121, 62, 63, 64, 1, 66, 48, 46, 5, 6,
752 7, 62, 63, 64, 11, 66, 55, 67, 5, 6,
753 7, 60, 61, 50, 11, 48, 12, 13, 14, 15,
754 16, 17, 57, 58, 87, 88, 48, 48, 8, 8,
755 8, 8, 8, 8, 54, 52, 49, 8, 4, 4,
756 66, 68, 3, 45, 47, 37, 27, 55, 78, 74,
757 -1, 69
758 };
759
760 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
761 symbol of state STATE-NUM. */
762 static const yytype_uint8 yystos[] =
763 {
764 0, 70, 71, 0, 1, 72, 5, 6, 7, 11,
765 73, 74, 76, 77, 79, 1, 8, 75, 12, 13,
766 14, 15, 16, 17, 78, 53, 80, 83, 8, 48,
767 48, 48, 48, 48, 48, 55, 82, 50, 80, 8,
768 8, 8, 8, 8, 8, 54, 1, 8, 84, 85,
769 79, 1, 3, 9, 10, 52, 62, 63, 64, 66,
770 81, 86, 87, 88, 89, 90, 91, 92, 54, 56,
771 51, 86, 95, 87, 52, 93, 49, 57, 58, 59,
772 87, 44, 90, 46, 55, 60, 61, 42, 43, 85,
773 3, 63, 65, 93, 3, 18, 19, 20, 21, 22,
774 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
775 33, 34, 35, 36, 37, 38, 39, 40, 41, 67,
776 94, 89, 57, 4, 4, 92, 92, 67, 68, 45,
777 56, 47, 56, 3, 4, 45, 4, 47, 45, 47
778 };
779
780 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
781 static const yytype_uint8 yyr1[] =
782 {
783 0, 69, 70, 71, 72, 72, 72, 72, 73, 74,
784 74, 75, 75, 75, 76, 77, 77, 78, 78, 78,
785 78, 78, 78, 79, 79, 79, 80, 81, 81, 81,
786 81, 82, 83, 83, 83, 84, 84, 84, 85, 86,
787 86, 86, 86, 87, 87, 88, 89, 89, 89, 89,
788 89, 90, 90, 90, 90, 90, 90, 90, 90, 90,
789 90, 90, 90, 91, 91, 91, 92, 92, 93, 93,
790 93, 93, 94, 94, 94, 94, 94, 94, 94, 94,
791 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
792 94, 94, 94, 94, 94, 94, 95, 95
793 };
794
795 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
796 static const yytype_uint8 yyr2[] =
797 {
798 0, 2, 5, 0, 3, 2, 0, 1, 1, 1,
799 1, 2, 1, 1, 2, 2, 0, 3, 3, 3,
800 3, 3, 3, 5, 5, 0, 0, 2, 1, 1,
801 1, 0, 4, 3, 0, 3, 1, 1, 1, 2,
802 3, 2, 1, 3, 1, 2, 2, 1, 6, 5,
803 4, 2, 2, 2, 6, 5, 4, 1, 1, 1,
804 3, 3, 1, 3, 3, 1, 3, 4, 4, 2,
805 2, 0, 1, 1, 1, 1, 1, 1, 1, 1,
806 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
807 1, 1, 1, 1, 1, 1, 2, 0
808 };
809
810
811 #define yyerrok (yyerrstatus = 0)
812 #define yyclearin (yychar = YYEMPTY)
813 #define YYEMPTY (-2)
814 #define YYEOF 0
815
816 #define YYACCEPT goto yyacceptlab
817 #define YYABORT goto yyabortlab
818 #define YYERROR goto yyerrorlab
819
820
821 #define YYRECOVERING() (!!yyerrstatus)
822
823 #define YYBACKUP(Token, Value) \
824 do \
825 if (yychar == YYEMPTY) \
826 { \
827 yychar = (Token); \
828 yylval = (Value); \
829 YYPOPSTACK (yylen); \
830 yystate = *yyssp; \
831 goto yybackup; \
832 } \
833 else \
834 { \
835 yyerror (YY_("syntax error: cannot back up")); \
836 YYERROR; \
837 } \
838 while (0)
839
840 /* Error token number */
841 #define YYTERROR 1
842 #define YYERRCODE 256
843
844
845
846 /* Enable debugging if requested. */
847 #if YYDEBUG
848
849 # ifndef YYFPRINTF
850 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
851 # define YYFPRINTF fprintf
852 # endif
853
854 # define YYDPRINTF(Args) \
855 do { \
856 if (yydebug) \
857 YYFPRINTF Args; \
858 } while (0)
859
860 /* This macro is provided for backward compatibility. */
861 #ifndef YY_LOCATION_PRINT
862 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
863 #endif
864
865
866 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
867 do { \
868 if (yydebug) \
869 { \
870 YYFPRINTF (stderr, "%s ", Title); \
871 yy_symbol_print (stderr, \
872 Type, Value); \
873 YYFPRINTF (stderr, "\n"); \
874 } \
875 } while (0)
876
877
878 /*----------------------------------------.
879 | Print this symbol's value on YYOUTPUT. |
880 `----------------------------------------*/
881
882 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)883 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
884 {
885 FILE *yyo = yyoutput;
886 YYUSE (yyo);
887 if (!yyvaluep)
888 return;
889 # ifdef YYPRINT
890 if (yytype < YYNTOKENS)
891 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
892 # endif
893 YYUSE (yytype);
894 }
895
896
897 /*--------------------------------.
898 | Print this symbol on YYOUTPUT. |
899 `--------------------------------*/
900
901 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)902 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
903 {
904 YYFPRINTF (yyoutput, "%s %s (",
905 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
906
907 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
908 YYFPRINTF (yyoutput, ")");
909 }
910
911 /*------------------------------------------------------------------.
912 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
913 | TOP (included). |
914 `------------------------------------------------------------------*/
915
916 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)917 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
918 {
919 YYFPRINTF (stderr, "Stack now");
920 for (; yybottom <= yytop; yybottom++)
921 {
922 int yybot = *yybottom;
923 YYFPRINTF (stderr, " %d", yybot);
924 }
925 YYFPRINTF (stderr, "\n");
926 }
927
928 # define YY_STACK_PRINT(Bottom, Top) \
929 do { \
930 if (yydebug) \
931 yy_stack_print ((Bottom), (Top)); \
932 } while (0)
933
934
935 /*------------------------------------------------.
936 | Report that the YYRULE is going to be reduced. |
937 `------------------------------------------------*/
938
939 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule)940 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
941 {
942 unsigned long int yylno = yyrline[yyrule];
943 int yynrhs = yyr2[yyrule];
944 int yyi;
945 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
946 yyrule - 1, yylno);
947 /* The symbols being reduced. */
948 for (yyi = 0; yyi < yynrhs; yyi++)
949 {
950 YYFPRINTF (stderr, " $%d = ", yyi + 1);
951 yy_symbol_print (stderr,
952 yystos[yyssp[yyi + 1 - yynrhs]],
953 &(yyvsp[(yyi + 1) - (yynrhs)])
954 );
955 YYFPRINTF (stderr, "\n");
956 }
957 }
958
959 # define YY_REDUCE_PRINT(Rule) \
960 do { \
961 if (yydebug) \
962 yy_reduce_print (yyssp, yyvsp, Rule); \
963 } while (0)
964
965 /* Nonzero means print parse trace. It is left uninitialized so that
966 multiple parsers can coexist. */
967 int yydebug;
968 #else /* !YYDEBUG */
969 # define YYDPRINTF(Args)
970 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
971 # define YY_STACK_PRINT(Bottom, Top)
972 # define YY_REDUCE_PRINT(Rule)
973 #endif /* !YYDEBUG */
974
975
976 /* YYINITDEPTH -- initial size of the parser's stacks. */
977 #ifndef YYINITDEPTH
978 # define YYINITDEPTH 200
979 #endif
980
981 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
982 if the built-in stack extension method is used).
983
984 Do not make this value too large; the results are undefined if
985 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
986 evaluated with infinite-precision integer arithmetic. */
987
988 #ifndef YYMAXDEPTH
989 # define YYMAXDEPTH 10000
990 #endif
991
992
993 #if YYERROR_VERBOSE
994
995 # ifndef yystrlen
996 # if defined __GLIBC__ && defined _STRING_H
997 # define yystrlen strlen
998 # else
999 /* Return the length of YYSTR. */
1000 static YYSIZE_T
yystrlen(const char * yystr)1001 yystrlen (const char *yystr)
1002 {
1003 YYSIZE_T yylen;
1004 for (yylen = 0; yystr[yylen]; yylen++)
1005 continue;
1006 return yylen;
1007 }
1008 # endif
1009 # endif
1010
1011 # ifndef yystpcpy
1012 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1013 # define yystpcpy stpcpy
1014 # else
1015 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1016 YYDEST. */
1017 static char *
yystpcpy(char * yydest,const char * yysrc)1018 yystpcpy (char *yydest, const char *yysrc)
1019 {
1020 char *yyd = yydest;
1021 const char *yys = yysrc;
1022
1023 while ((*yyd++ = *yys++) != '\0')
1024 continue;
1025
1026 return yyd - 1;
1027 }
1028 # endif
1029 # endif
1030
1031 # ifndef yytnamerr
1032 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1033 quotes and backslashes, so that it's suitable for yyerror. The
1034 heuristic is that double-quoting is unnecessary unless the string
1035 contains an apostrophe, a comma, or backslash (other than
1036 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1037 null, do not copy; instead, return the length of what the result
1038 would have been. */
1039 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1040 yytnamerr (char *yyres, const char *yystr)
1041 {
1042 if (*yystr == '"')
1043 {
1044 YYSIZE_T yyn = 0;
1045 char const *yyp = yystr;
1046
1047 for (;;)
1048 switch (*++yyp)
1049 {
1050 case '\'':
1051 case ',':
1052 goto do_not_strip_quotes;
1053
1054 case '\\':
1055 if (*++yyp != '\\')
1056 goto do_not_strip_quotes;
1057 /* Fall through. */
1058 default:
1059 if (yyres)
1060 yyres[yyn] = *yyp;
1061 yyn++;
1062 break;
1063
1064 case '"':
1065 if (yyres)
1066 yyres[yyn] = '\0';
1067 return yyn;
1068 }
1069 do_not_strip_quotes: ;
1070 }
1071
1072 if (! yyres)
1073 return yystrlen (yystr);
1074
1075 return yystpcpy (yyres, yystr) - yyres;
1076 }
1077 # endif
1078
1079 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1080 about the unexpected token YYTOKEN for the state stack whose top is
1081 YYSSP.
1082
1083 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1084 not large enough to hold the message. In that case, also set
1085 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1086 required number of bytes is too large to store. */
1087 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)1088 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1089 yytype_int16 *yyssp, int yytoken)
1090 {
1091 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1092 YYSIZE_T yysize = yysize0;
1093 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1094 /* Internationalized format string. */
1095 const char *yyformat = YY_NULLPTR;
1096 /* Arguments of yyformat. */
1097 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1098 /* Number of reported tokens (one for the "unexpected", one per
1099 "expected"). */
1100 int yycount = 0;
1101
1102 /* There are many possibilities here to consider:
1103 - If this state is a consistent state with a default action, then
1104 the only way this function was invoked is if the default action
1105 is an error action. In that case, don't check for expected
1106 tokens because there are none.
1107 - The only way there can be no lookahead present (in yychar) is if
1108 this state is a consistent state with a default action. Thus,
1109 detecting the absence of a lookahead is sufficient to determine
1110 that there is no unexpected or expected token to report. In that
1111 case, just report a simple "syntax error".
1112 - Don't assume there isn't a lookahead just because this state is a
1113 consistent state with a default action. There might have been a
1114 previous inconsistent state, consistent state with a non-default
1115 action, or user semantic action that manipulated yychar.
1116 - Of course, the expected token list depends on states to have
1117 correct lookahead information, and it depends on the parser not
1118 to perform extra reductions after fetching a lookahead from the
1119 scanner and before detecting a syntax error. Thus, state merging
1120 (from LALR or IELR) and default reductions corrupt the expected
1121 token list. However, the list is correct for canonical LR with
1122 one exception: it will still contain any token that will not be
1123 accepted due to an error action in a later state.
1124 */
1125 if (yytoken != YYEMPTY)
1126 {
1127 int yyn = yypact[*yyssp];
1128 yyarg[yycount++] = yytname[yytoken];
1129 if (!yypact_value_is_default (yyn))
1130 {
1131 /* Start YYX at -YYN if negative to avoid negative indexes in
1132 YYCHECK. In other words, skip the first -YYN actions for
1133 this state because they are default actions. */
1134 int yyxbegin = yyn < 0 ? -yyn : 0;
1135 /* Stay within bounds of both yycheck and yytname. */
1136 int yychecklim = YYLAST - yyn + 1;
1137 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1138 int yyx;
1139
1140 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1141 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1142 && !yytable_value_is_error (yytable[yyx + yyn]))
1143 {
1144 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1145 {
1146 yycount = 1;
1147 yysize = yysize0;
1148 break;
1149 }
1150 yyarg[yycount++] = yytname[yyx];
1151 {
1152 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1153 if (! (yysize <= yysize1
1154 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1155 return 2;
1156 yysize = yysize1;
1157 }
1158 }
1159 }
1160 }
1161
1162 switch (yycount)
1163 {
1164 # define YYCASE_(N, S) \
1165 case N: \
1166 yyformat = S; \
1167 break
1168 YYCASE_(0, YY_("syntax error"));
1169 YYCASE_(1, YY_("syntax error, unexpected %s"));
1170 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1171 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1172 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1173 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1174 # undef YYCASE_
1175 }
1176
1177 {
1178 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1179 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1180 return 2;
1181 yysize = yysize1;
1182 }
1183
1184 if (*yymsg_alloc < yysize)
1185 {
1186 *yymsg_alloc = 2 * yysize;
1187 if (! (yysize <= *yymsg_alloc
1188 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1189 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1190 return 1;
1191 }
1192
1193 /* Avoid sprintf, as that infringes on the user's name space.
1194 Don't have undefined behavior even if the translation
1195 produced a string with the wrong number of "%s"s. */
1196 {
1197 char *yyp = *yymsg;
1198 int yyi = 0;
1199 while ((*yyp = *yyformat) != '\0')
1200 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1201 {
1202 yyp += yytnamerr (yyp, yyarg[yyi++]);
1203 yyformat += 2;
1204 }
1205 else
1206 {
1207 yyp++;
1208 yyformat++;
1209 }
1210 }
1211 return 0;
1212 }
1213 #endif /* YYERROR_VERBOSE */
1214
1215 /*-----------------------------------------------.
1216 | Release the memory associated to this symbol. |
1217 `-----------------------------------------------*/
1218
1219 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1220 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1221 {
1222 YYUSE (yyvaluep);
1223 if (!yymsg)
1224 yymsg = "Deleting";
1225 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1226
1227 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1228 YYUSE (yytype);
1229 YY_IGNORE_MAYBE_UNINITIALIZED_END
1230 }
1231
1232
1233
1234
1235 /* The lookahead symbol. */
1236 int yychar;
1237
1238 /* The semantic value of the lookahead symbol. */
1239 YYSTYPE yylval;
1240 /* Number of syntax errors so far. */
1241 int yynerrs;
1242
1243
1244 /*----------.
1245 | yyparse. |
1246 `----------*/
1247
1248 int
yyparse(void)1249 yyparse (void)
1250 {
1251 int yystate;
1252 /* Number of tokens to shift before error messages enabled. */
1253 int yyerrstatus;
1254
1255 /* The stacks and their tools:
1256 'yyss': related to states.
1257 'yyvs': related to semantic values.
1258
1259 Refer to the stacks through separate pointers, to allow yyoverflow
1260 to reallocate them elsewhere. */
1261
1262 /* The state stack. */
1263 yytype_int16 yyssa[YYINITDEPTH];
1264 yytype_int16 *yyss;
1265 yytype_int16 *yyssp;
1266
1267 /* The semantic value stack. */
1268 YYSTYPE yyvsa[YYINITDEPTH];
1269 YYSTYPE *yyvs;
1270 YYSTYPE *yyvsp;
1271
1272 YYSIZE_T yystacksize;
1273
1274 int yyn;
1275 int yyresult;
1276 /* Lookahead token as an internal (translated) token number. */
1277 int yytoken = 0;
1278 /* The variables used to return semantic value and location from the
1279 action routines. */
1280 YYSTYPE yyval;
1281
1282 #if YYERROR_VERBOSE
1283 /* Buffer for error messages, and its allocated size. */
1284 char yymsgbuf[128];
1285 char *yymsg = yymsgbuf;
1286 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1287 #endif
1288
1289 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1290
1291 /* The number of symbols on the RHS of the reduced rule.
1292 Keep to zero when no symbol should be popped. */
1293 int yylen = 0;
1294
1295 yyssp = yyss = yyssa;
1296 yyvsp = yyvs = yyvsa;
1297 yystacksize = YYINITDEPTH;
1298
1299 YYDPRINTF ((stderr, "Starting parse\n"));
1300
1301 yystate = 0;
1302 yyerrstatus = 0;
1303 yynerrs = 0;
1304 yychar = YYEMPTY; /* Cause a token to be read. */
1305 goto yysetstate;
1306
1307 /*------------------------------------------------------------.
1308 | yynewstate -- Push a new state, which is found in yystate. |
1309 `------------------------------------------------------------*/
1310 yynewstate:
1311 /* In all cases, when you get here, the value and location stacks
1312 have just been pushed. So pushing a state here evens the stacks. */
1313 yyssp++;
1314
1315 yysetstate:
1316 *yyssp = yystate;
1317
1318 if (yyss + yystacksize - 1 <= yyssp)
1319 {
1320 /* Get the current used size of the three stacks, in elements. */
1321 YYSIZE_T yysize = yyssp - yyss + 1;
1322
1323 #ifdef yyoverflow
1324 {
1325 /* Give user a chance to reallocate the stack. Use copies of
1326 these so that the &'s don't force the real ones into
1327 memory. */
1328 YYSTYPE *yyvs1 = yyvs;
1329 yytype_int16 *yyss1 = yyss;
1330
1331 /* Each stack pointer address is followed by the size of the
1332 data in use in that stack, in bytes. This used to be a
1333 conditional around just the two extra args, but that might
1334 be undefined if yyoverflow is a macro. */
1335 yyoverflow (YY_("memory exhausted"),
1336 &yyss1, yysize * sizeof (*yyssp),
1337 &yyvs1, yysize * sizeof (*yyvsp),
1338 &yystacksize);
1339
1340 yyss = yyss1;
1341 yyvs = yyvs1;
1342 }
1343 #else /* no yyoverflow */
1344 # ifndef YYSTACK_RELOCATE
1345 goto yyexhaustedlab;
1346 # else
1347 /* Extend the stack our own way. */
1348 if (YYMAXDEPTH <= yystacksize)
1349 goto yyexhaustedlab;
1350 yystacksize *= 2;
1351 if (YYMAXDEPTH < yystacksize)
1352 yystacksize = YYMAXDEPTH;
1353
1354 {
1355 yytype_int16 *yyss1 = yyss;
1356 union yyalloc *yyptr =
1357 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1358 if (! yyptr)
1359 goto yyexhaustedlab;
1360 YYSTACK_RELOCATE (yyss_alloc, yyss);
1361 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1362 # undef YYSTACK_RELOCATE
1363 if (yyss1 != yyssa)
1364 YYSTACK_FREE (yyss1);
1365 }
1366 # endif
1367 #endif /* no yyoverflow */
1368
1369 yyssp = yyss + yysize - 1;
1370 yyvsp = yyvs + yysize - 1;
1371
1372 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1373 (unsigned long int) yystacksize));
1374
1375 if (yyss + yystacksize - 1 <= yyssp)
1376 YYABORT;
1377 }
1378
1379 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1380
1381 if (yystate == YYFINAL)
1382 YYACCEPT;
1383
1384 goto yybackup;
1385
1386 /*-----------.
1387 | yybackup. |
1388 `-----------*/
1389 yybackup:
1390
1391 /* Do appropriate processing given the current state. Read a
1392 lookahead token if we need one and don't already have one. */
1393
1394 /* First try to decide what to do without reference to lookahead token. */
1395 yyn = yypact[yystate];
1396 if (yypact_value_is_default (yyn))
1397 goto yydefault;
1398
1399 /* Not known => get a lookahead token if don't already have one. */
1400
1401 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1402 if (yychar == YYEMPTY)
1403 {
1404 YYDPRINTF ((stderr, "Reading a token: "));
1405 yychar = yylex ();
1406 }
1407
1408 if (yychar <= YYEOF)
1409 {
1410 yychar = yytoken = YYEOF;
1411 YYDPRINTF ((stderr, "Now at end of input.\n"));
1412 }
1413 else
1414 {
1415 yytoken = YYTRANSLATE (yychar);
1416 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1417 }
1418
1419 /* If the proper action on seeing token YYTOKEN is to reduce or to
1420 detect an error, take that action. */
1421 yyn += yytoken;
1422 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1423 goto yydefault;
1424 yyn = yytable[yyn];
1425 if (yyn <= 0)
1426 {
1427 if (yytable_value_is_error (yyn))
1428 goto yyerrlab;
1429 yyn = -yyn;
1430 goto yyreduce;
1431 }
1432
1433 /* Count tokens shifted since error; after three, turn off error
1434 status. */
1435 if (yyerrstatus)
1436 yyerrstatus--;
1437
1438 /* Shift the lookahead token. */
1439 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1440
1441 /* Discard the shifted token. */
1442 yychar = YYEMPTY;
1443
1444 yystate = yyn;
1445 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1446 *++yyvsp = yylval;
1447 YY_IGNORE_MAYBE_UNINITIALIZED_END
1448
1449 goto yynewstate;
1450
1451
1452 /*-----------------------------------------------------------.
1453 | yydefault -- do the default action for the current state. |
1454 `-----------------------------------------------------------*/
1455 yydefault:
1456 yyn = yydefact[yystate];
1457 if (yyn == 0)
1458 goto yyerrlab;
1459 goto yyreduce;
1460
1461
1462 /*-----------------------------.
1463 | yyreduce -- Do a reduction. |
1464 `-----------------------------*/
1465 yyreduce:
1466 /* yyn is the number of a rule to reduce with. */
1467 yylen = yyr2[yyn];
1468
1469 /* If YYLEN is nonzero, implement the default value of the action:
1470 '$$ = $1'.
1471
1472 Otherwise, the following line sets YYVAL to garbage.
1473 This behavior is undocumented and Bison
1474 users should not rely upon it. Assigning to YYVAL
1475 unconditionally makes the parser a bit smaller, and it avoids a
1476 GCC warning that YYVAL may be used uninitialized. */
1477 yyval = yyvsp[1-yylen];
1478
1479
1480 YY_REDUCE_PRINT (yyn);
1481 switch (yyn)
1482 {
1483 case 2:
1484 #line 119 "parse.y" /* yacc.c:1646 */
1485 { /* add default rule */
1486 int def_rule;
1487
1488 pat = cclinit();
1489 cclnegate( pat );
1490
1491 def_rule = mkstate( -pat );
1492
1493 /* Remember the number of the default rule so we
1494 * don't generate "can't match" warnings for it.
1495 */
1496 default_rule = num_rules;
1497
1498 finish_rule( def_rule, false, 0, 0, 0);
1499
1500 for ( i = 1; i <= lastsc; ++i )
1501 scset[i] = mkbranch( scset[i], def_rule );
1502
1503 if ( spprdflt )
1504 add_action(
1505 "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
1506 else
1507 add_action( "ECHO" );
1508
1509 add_action( ";\n\tYY_BREAK]]\n" );
1510 }
1511 #line 1512 "parse.c" /* yacc.c:1646 */
1512 break;
1513
1514 case 3:
1515 #line 148 "parse.y" /* yacc.c:1646 */
1516 { /* initialize for processing rules */
1517
1518 /* Create default DFA start condition. */
1519 scinstal( "INITIAL", false );
1520 }
1521 #line 1522 "parse.c" /* yacc.c:1646 */
1522 break;
1523
1524 case 7:
1525 #line 159 "parse.y" /* yacc.c:1646 */
1526 { synerr( _("unknown error processing section 1") ); }
1527 #line 1528 "parse.c" /* yacc.c:1646 */
1528 break;
1529
1530 case 8:
1531 #line 163 "parse.y" /* yacc.c:1646 */
1532 {
1533 check_options();
1534 scon_stk = allocate_integer_array( lastsc + 1 );
1535 scon_stk_ptr = 0;
1536 }
1537 #line 1538 "parse.c" /* yacc.c:1646 */
1538 break;
1539
1540 case 9:
1541 #line 171 "parse.y" /* yacc.c:1646 */
1542 { xcluflg = false; }
1543 #line 1544 "parse.c" /* yacc.c:1646 */
1544 break;
1545
1546 case 10:
1547 #line 174 "parse.y" /* yacc.c:1646 */
1548 { xcluflg = true; }
1549 #line 1550 "parse.c" /* yacc.c:1646 */
1550 break;
1551
1552 case 11:
1553 #line 178 "parse.y" /* yacc.c:1646 */
1554 { scinstal( nmstr, xcluflg ); }
1555 #line 1556 "parse.c" /* yacc.c:1646 */
1556 break;
1557
1558 case 12:
1559 #line 181 "parse.y" /* yacc.c:1646 */
1560 { scinstal( nmstr, xcluflg ); }
1561 #line 1562 "parse.c" /* yacc.c:1646 */
1562 break;
1563
1564 case 13:
1565 #line 184 "parse.y" /* yacc.c:1646 */
1566 { synerr( _("bad start condition list") ); }
1567 #line 1568 "parse.c" /* yacc.c:1646 */
1568 break;
1569
1570 case 17:
1571 #line 195 "parse.y" /* yacc.c:1646 */
1572 {
1573 outfilename = xstrdup(nmstr);
1574 did_outfilename = 1;
1575 }
1576 #line 1577 "parse.c" /* yacc.c:1646 */
1577 break;
1578
1579 case 18:
1580 #line 200 "parse.y" /* yacc.c:1646 */
1581 { extra_type = xstrdup(nmstr); }
1582 #line 1583 "parse.c" /* yacc.c:1646 */
1583 break;
1584
1585 case 19:
1586 #line 202 "parse.y" /* yacc.c:1646 */
1587 { prefix = xstrdup(nmstr);
1588 if (strchr(prefix, '[') || strchr(prefix, ']'))
1589 flexerror(_("Prefix must not contain [ or ]")); }
1590 #line 1591 "parse.c" /* yacc.c:1646 */
1591 break;
1592
1593 case 20:
1594 #line 206 "parse.y" /* yacc.c:1646 */
1595 { yyclass = xstrdup(nmstr); }
1596 #line 1597 "parse.c" /* yacc.c:1646 */
1597 break;
1598
1599 case 21:
1600 #line 208 "parse.y" /* yacc.c:1646 */
1601 { headerfilename = xstrdup(nmstr); }
1602 #line 1603 "parse.c" /* yacc.c:1646 */
1603 break;
1604
1605 case 22:
1606 #line 210 "parse.y" /* yacc.c:1646 */
1607 { tablesext = true; tablesfilename = xstrdup(nmstr); }
1608 #line 1609 "parse.c" /* yacc.c:1646 */
1609 break;
1610
1611 case 23:
1612 #line 214 "parse.y" /* yacc.c:1646 */
1613 { scon_stk_ptr = (yyvsp[-3]); }
1614 #line 1615 "parse.c" /* yacc.c:1646 */
1615 break;
1616
1617 case 24:
1618 #line 216 "parse.y" /* yacc.c:1646 */
1619 { scon_stk_ptr = (yyvsp[-3]); }
1620 #line 1621 "parse.c" /* yacc.c:1646 */
1621 break;
1622
1623 case 26:
1624 #line 221 "parse.y" /* yacc.c:1646 */
1625 {
1626 /* Initialize for a parse of one rule. */
1627 trlcontxt = variable_trail_rule = varlength = false;
1628 trailcnt = headcnt = rulelen = 0;
1629 current_state_type = STATE_NORMAL;
1630 previous_continued_action = continued_action;
1631 in_rule = true;
1632
1633 new_rule();
1634 }
1635 #line 1636 "parse.c" /* yacc.c:1646 */
1636 break;
1637
1638 case 27:
1639 #line 234 "parse.y" /* yacc.c:1646 */
1640 {
1641 pat = (yyvsp[0]);
1642 finish_rule( pat, variable_trail_rule,
1643 headcnt, trailcnt , previous_continued_action);
1644
1645 if ( scon_stk_ptr > 0 )
1646 {
1647 for ( i = 1; i <= scon_stk_ptr; ++i )
1648 scbol[scon_stk[i]] =
1649 mkbranch( scbol[scon_stk[i]],
1650 pat );
1651 }
1652
1653 else
1654 {
1655 /* Add to all non-exclusive start conditions,
1656 * including the default (0) start condition.
1657 */
1658
1659 for ( i = 1; i <= lastsc; ++i )
1660 if ( ! scxclu[i] )
1661 scbol[i] = mkbranch( scbol[i],
1662 pat );
1663 }
1664
1665 if ( ! bol_needed )
1666 {
1667 bol_needed = true;
1668
1669 if ( performance_report > 1 )
1670 pinpoint_message(
1671 "'^' operator results in sub-optimal performance" );
1672 }
1673 }
1674 #line 1675 "parse.c" /* yacc.c:1646 */
1675 break;
1676
1677 case 28:
1678 #line 270 "parse.y" /* yacc.c:1646 */
1679 {
1680 pat = (yyvsp[0]);
1681 finish_rule( pat, variable_trail_rule,
1682 headcnt, trailcnt , previous_continued_action);
1683
1684 if ( scon_stk_ptr > 0 )
1685 {
1686 for ( i = 1; i <= scon_stk_ptr; ++i )
1687 scset[scon_stk[i]] =
1688 mkbranch( scset[scon_stk[i]],
1689 pat );
1690 }
1691
1692 else
1693 {
1694 for ( i = 1; i <= lastsc; ++i )
1695 if ( ! scxclu[i] )
1696 scset[i] =
1697 mkbranch( scset[i],
1698 pat );
1699 }
1700 }
1701 #line 1702 "parse.c" /* yacc.c:1646 */
1702 break;
1703
1704 case 29:
1705 #line 294 "parse.y" /* yacc.c:1646 */
1706 {
1707 if ( scon_stk_ptr > 0 )
1708 build_eof_action();
1709
1710 else
1711 {
1712 /* This EOF applies to all start conditions
1713 * which don't already have EOF actions.
1714 */
1715 for ( i = 1; i <= lastsc; ++i )
1716 if ( ! sceof[i] )
1717 scon_stk[++scon_stk_ptr] = i;
1718
1719 if ( scon_stk_ptr == 0 )
1720 lwarn(
1721 "all start conditions already have <<EOF>> rules" );
1722
1723 else
1724 build_eof_action();
1725 }
1726 }
1727 #line 1728 "parse.c" /* yacc.c:1646 */
1728 break;
1729
1730 case 30:
1731 #line 317 "parse.y" /* yacc.c:1646 */
1732 { synerr( _("unrecognized rule") ); }
1733 #line 1734 "parse.c" /* yacc.c:1646 */
1734 break;
1735
1736 case 31:
1737 #line 321 "parse.y" /* yacc.c:1646 */
1738 { (yyval) = scon_stk_ptr; }
1739 #line 1740 "parse.c" /* yacc.c:1646 */
1740 break;
1741
1742 case 32:
1743 #line 325 "parse.y" /* yacc.c:1646 */
1744 { (yyval) = (yyvsp[-2]); }
1745 #line 1746 "parse.c" /* yacc.c:1646 */
1746 break;
1747
1748 case 33:
1749 #line 328 "parse.y" /* yacc.c:1646 */
1750 {
1751 (yyval) = scon_stk_ptr;
1752
1753 for ( i = 1; i <= lastsc; ++i )
1754 {
1755 int j;
1756
1757 for ( j = 1; j <= scon_stk_ptr; ++j )
1758 if ( scon_stk[j] == i )
1759 break;
1760
1761 if ( j > scon_stk_ptr )
1762 scon_stk[++scon_stk_ptr] = i;
1763 }
1764 }
1765 #line 1766 "parse.c" /* yacc.c:1646 */
1766 break;
1767
1768 case 34:
1769 #line 345 "parse.y" /* yacc.c:1646 */
1770 { (yyval) = scon_stk_ptr; }
1771 #line 1772 "parse.c" /* yacc.c:1646 */
1772 break;
1773
1774 case 37:
1775 #line 353 "parse.y" /* yacc.c:1646 */
1776 { synerr( _("bad start condition list") ); }
1777 #line 1778 "parse.c" /* yacc.c:1646 */
1778 break;
1779
1780 case 38:
1781 #line 357 "parse.y" /* yacc.c:1646 */
1782 {
1783 if ( (scnum = sclookup( nmstr )) == 0 )
1784 format_pinpoint_message(
1785 "undeclared start condition %s",
1786 nmstr );
1787 else
1788 {
1789 for ( i = 1; i <= scon_stk_ptr; ++i )
1790 if ( scon_stk[i] == scnum )
1791 {
1792 format_warn(
1793 "<%s> specified twice",
1794 scname[scnum] );
1795 break;
1796 }
1797
1798 if ( i > scon_stk_ptr )
1799 scon_stk[++scon_stk_ptr] = scnum;
1800 }
1801 }
1802 #line 1803 "parse.c" /* yacc.c:1646 */
1803 break;
1804
1805 case 39:
1806 #line 380 "parse.y" /* yacc.c:1646 */
1807 {
1808 if ( transchar[lastst[(yyvsp[0])]] != SYM_EPSILON )
1809 /* Provide final transition \now/ so it
1810 * will be marked as a trailing context
1811 * state.
1812 */
1813 (yyvsp[0]) = link_machines( (yyvsp[0]),
1814 mkstate( SYM_EPSILON ) );
1815
1816 mark_beginning_as_normal( (yyvsp[0]) );
1817 current_state_type = STATE_NORMAL;
1818
1819 if ( previous_continued_action )
1820 {
1821 /* We need to treat this as variable trailing
1822 * context so that the backup does not happen
1823 * in the action but before the action switch
1824 * statement. If the backup happens in the
1825 * action, then the rules "falling into" this
1826 * one's action will *also* do the backup,
1827 * erroneously.
1828 */
1829 if ( ! varlength || headcnt != 0 )
1830 lwarn(
1831 "trailing context made variable due to preceding '|' action" );
1832
1833 /* Mark as variable. */
1834 varlength = true;
1835 headcnt = 0;
1836
1837 }
1838
1839 if ( lex_compat || (varlength && headcnt == 0) )
1840 { /* variable trailing context rule */
1841 /* Mark the first part of the rule as the
1842 * accepting "head" part of a trailing
1843 * context rule.
1844 *
1845 * By the way, we didn't do this at the
1846 * beginning of this production because back
1847 * then current_state_type was set up for a
1848 * trail rule, and add_accept() can create
1849 * a new state ...
1850 */
1851 add_accept( (yyvsp[-1]),
1852 num_rules | YY_TRAILING_HEAD_MASK );
1853 variable_trail_rule = true;
1854 }
1855
1856 else
1857 trailcnt = rulelen;
1858
1859 (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) );
1860 }
1861 #line 1862 "parse.c" /* yacc.c:1646 */
1862 break;
1863
1864 case 40:
1865 #line 436 "parse.y" /* yacc.c:1646 */
1866 { synerr( _("trailing context used twice") ); }
1867 #line 1868 "parse.c" /* yacc.c:1646 */
1868 break;
1869
1870 case 41:
1871 #line 439 "parse.y" /* yacc.c:1646 */
1872 {
1873 headcnt = 0;
1874 trailcnt = 1;
1875 rulelen = 1;
1876 varlength = false;
1877
1878 current_state_type = STATE_TRAILING_CONTEXT;
1879
1880 if ( trlcontxt )
1881 {
1882 synerr( _("trailing context used twice") );
1883 (yyval) = mkstate( SYM_EPSILON );
1884 }
1885
1886 else if ( previous_continued_action )
1887 {
1888 /* See the comment in the rule for "re2 re"
1889 * above.
1890 */
1891 lwarn(
1892 "trailing context made variable due to preceding '|' action" );
1893
1894 varlength = true;
1895 }
1896
1897 if ( lex_compat || varlength )
1898 {
1899 /* Again, see the comment in the rule for
1900 * "re2 re" above.
1901 */
1902 add_accept( (yyvsp[-1]),
1903 num_rules | YY_TRAILING_HEAD_MASK );
1904 variable_trail_rule = true;
1905 }
1906
1907 trlcontxt = true;
1908
1909 eps = mkstate( SYM_EPSILON );
1910 (yyval) = link_machines( (yyvsp[-1]),
1911 link_machines( eps, mkstate( '\n' ) ) );
1912 }
1913 #line 1914 "parse.c" /* yacc.c:1646 */
1914 break;
1915
1916 case 42:
1917 #line 482 "parse.y" /* yacc.c:1646 */
1918 {
1919 (yyval) = (yyvsp[0]);
1920
1921 if ( trlcontxt )
1922 {
1923 if ( lex_compat || (varlength && headcnt == 0) )
1924 /* Both head and trail are
1925 * variable-length.
1926 */
1927 variable_trail_rule = true;
1928 else
1929 trailcnt = rulelen;
1930 }
1931 }
1932 #line 1933 "parse.c" /* yacc.c:1646 */
1933 break;
1934
1935 case 43:
1936 #line 500 "parse.y" /* yacc.c:1646 */
1937 {
1938 varlength = true;
1939 (yyval) = mkor( (yyvsp[-2]), (yyvsp[0]) );
1940 }
1941 #line 1942 "parse.c" /* yacc.c:1646 */
1942 break;
1943
1944 case 44:
1945 #line 506 "parse.y" /* yacc.c:1646 */
1946 { (yyval) = (yyvsp[0]); }
1947 #line 1948 "parse.c" /* yacc.c:1646 */
1948 break;
1949
1950 case 45:
1951 #line 511 "parse.y" /* yacc.c:1646 */
1952 {
1953 /* This rule is written separately so the
1954 * reduction will occur before the trailing
1955 * series is parsed.
1956 */
1957
1958 if ( trlcontxt )
1959 synerr( _("trailing context used twice") );
1960 else
1961 trlcontxt = true;
1962
1963 if ( varlength )
1964 /* We hope the trailing context is
1965 * fixed-length.
1966 */
1967 varlength = false;
1968 else
1969 headcnt = rulelen;
1970
1971 rulelen = 0;
1972
1973 current_state_type = STATE_TRAILING_CONTEXT;
1974 (yyval) = (yyvsp[-1]);
1975 }
1976 #line 1977 "parse.c" /* yacc.c:1646 */
1977 break;
1978
1979 case 46:
1980 #line 538 "parse.y" /* yacc.c:1646 */
1981 {
1982 /* This is where concatenation of adjacent patterns
1983 * gets done.
1984 */
1985 (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) );
1986 }
1987 #line 1988 "parse.c" /* yacc.c:1646 */
1988 break;
1989
1990 case 47:
1991 #line 546 "parse.y" /* yacc.c:1646 */
1992 { (yyval) = (yyvsp[0]); }
1993 #line 1994 "parse.c" /* yacc.c:1646 */
1994 break;
1995
1996 case 48:
1997 #line 549 "parse.y" /* yacc.c:1646 */
1998 {
1999 varlength = true;
2000
2001 if ( (yyvsp[-3]) > (yyvsp[-1]) || (yyvsp[-3]) < 0 )
2002 {
2003 synerr( _("bad iteration values") );
2004 (yyval) = (yyvsp[-5]);
2005 }
2006 else
2007 {
2008 if ( (yyvsp[-3]) == 0 )
2009 {
2010 if ( (yyvsp[-1]) <= 0 )
2011 {
2012 synerr(
2013 _("bad iteration values") );
2014 (yyval) = (yyvsp[-5]);
2015 }
2016 else
2017 (yyval) = mkopt(
2018 mkrep( (yyvsp[-5]), 1, (yyvsp[-1]) ) );
2019 }
2020 else
2021 (yyval) = mkrep( (yyvsp[-5]), (yyvsp[-3]), (yyvsp[-1]) );
2022 }
2023 }
2024 #line 2025 "parse.c" /* yacc.c:1646 */
2025 break;
2026
2027 case 49:
2028 #line 577 "parse.y" /* yacc.c:1646 */
2029 {
2030 varlength = true;
2031
2032 if ( (yyvsp[-2]) <= 0 )
2033 {
2034 synerr( _("iteration value must be positive") );
2035 (yyval) = (yyvsp[-4]);
2036 }
2037
2038 else
2039 (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT );
2040 }
2041 #line 2042 "parse.c" /* yacc.c:1646 */
2042 break;
2043
2044 case 50:
2045 #line 591 "parse.y" /* yacc.c:1646 */
2046 {
2047 /* The series could be something like "(foo)",
2048 * in which case we have no idea what its length
2049 * is, so we punt here.
2050 */
2051 varlength = true;
2052
2053 if ( (yyvsp[-1]) <= 0 )
2054 {
2055 synerr( _("iteration value must be positive")
2056 );
2057 (yyval) = (yyvsp[-3]);
2058 }
2059
2060 else
2061 (yyval) = link_machines( (yyvsp[-3]),
2062 copysingl( (yyvsp[-3]), (yyvsp[-1]) - 1 ) );
2063 }
2064 #line 2065 "parse.c" /* yacc.c:1646 */
2065 break;
2066
2067 case 51:
2068 #line 613 "parse.y" /* yacc.c:1646 */
2069 {
2070 varlength = true;
2071
2072 (yyval) = mkclos( (yyvsp[-1]) );
2073 }
2074 #line 2075 "parse.c" /* yacc.c:1646 */
2075 break;
2076
2077 case 52:
2078 #line 620 "parse.y" /* yacc.c:1646 */
2079 {
2080 varlength = true;
2081 (yyval) = mkposcl( (yyvsp[-1]) );
2082 }
2083 #line 2084 "parse.c" /* yacc.c:1646 */
2084 break;
2085
2086 case 53:
2087 #line 626 "parse.y" /* yacc.c:1646 */
2088 {
2089 varlength = true;
2090 (yyval) = mkopt( (yyvsp[-1]) );
2091 }
2092 #line 2093 "parse.c" /* yacc.c:1646 */
2093 break;
2094
2095 case 54:
2096 #line 632 "parse.y" /* yacc.c:1646 */
2097 {
2098 varlength = true;
2099
2100 if ( (yyvsp[-3]) > (yyvsp[-1]) || (yyvsp[-3]) < 0 )
2101 {
2102 synerr( _("bad iteration values") );
2103 (yyval) = (yyvsp[-5]);
2104 }
2105 else
2106 {
2107 if ( (yyvsp[-3]) == 0 )
2108 {
2109 if ( (yyvsp[-1]) <= 0 )
2110 {
2111 synerr(
2112 _("bad iteration values") );
2113 (yyval) = (yyvsp[-5]);
2114 }
2115 else
2116 (yyval) = mkopt(
2117 mkrep( (yyvsp[-5]), 1, (yyvsp[-1]) ) );
2118 }
2119 else
2120 (yyval) = mkrep( (yyvsp[-5]), (yyvsp[-3]), (yyvsp[-1]) );
2121 }
2122 }
2123 #line 2124 "parse.c" /* yacc.c:1646 */
2124 break;
2125
2126 case 55:
2127 #line 660 "parse.y" /* yacc.c:1646 */
2128 {
2129 varlength = true;
2130
2131 if ( (yyvsp[-2]) <= 0 )
2132 {
2133 synerr( _("iteration value must be positive") );
2134 (yyval) = (yyvsp[-4]);
2135 }
2136
2137 else
2138 (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT );
2139 }
2140 #line 2141 "parse.c" /* yacc.c:1646 */
2141 break;
2142
2143 case 56:
2144 #line 674 "parse.y" /* yacc.c:1646 */
2145 {
2146 /* The singleton could be something like "(foo)",
2147 * in which case we have no idea what its length
2148 * is, so we punt here.
2149 */
2150 varlength = true;
2151
2152 if ( (yyvsp[-1]) <= 0 )
2153 {
2154 synerr( _("iteration value must be positive") );
2155 (yyval) = (yyvsp[-3]);
2156 }
2157
2158 else
2159 (yyval) = link_machines( (yyvsp[-3]),
2160 copysingl( (yyvsp[-3]), (yyvsp[-1]) - 1 ) );
2161 }
2162 #line 2163 "parse.c" /* yacc.c:1646 */
2163 break;
2164
2165 case 57:
2166 #line 693 "parse.y" /* yacc.c:1646 */
2167 {
2168 if ( ! madeany )
2169 {
2170 /* Create the '.' character class. */
2171 ccldot = cclinit();
2172 ccladd( ccldot, '\n' );
2173 cclnegate( ccldot );
2174
2175 if ( useecs )
2176 mkeccl( ccltbl + cclmap[ccldot],
2177 ccllen[ccldot], nextecm,
2178 ecgroup, csize, csize );
2179
2180 /* Create the (?s:'.') character class. */
2181 cclany = cclinit();
2182 cclnegate( cclany );
2183
2184 if ( useecs )
2185 mkeccl( ccltbl + cclmap[cclany],
2186 ccllen[cclany], nextecm,
2187 ecgroup, csize, csize );
2188
2189 madeany = true;
2190 }
2191
2192 ++rulelen;
2193
2194 if (sf_dot_all())
2195 (yyval) = mkstate( -cclany );
2196 else
2197 (yyval) = mkstate( -ccldot );
2198 }
2199 #line 2200 "parse.c" /* yacc.c:1646 */
2200 break;
2201
2202 case 58:
2203 #line 727 "parse.y" /* yacc.c:1646 */
2204 {
2205 /* Sort characters for fast searching.
2206 */
2207 qsort( ccltbl + cclmap[(yyvsp[0])], (size_t) ccllen[(yyvsp[0])], sizeof (*ccltbl), cclcmp );
2208
2209 if ( useecs )
2210 mkeccl( ccltbl + cclmap[(yyvsp[0])], ccllen[(yyvsp[0])],
2211 nextecm, ecgroup, csize, csize );
2212
2213 ++rulelen;
2214
2215 if (ccl_has_nl[(yyvsp[0])])
2216 rule_has_nl[num_rules] = true;
2217
2218 (yyval) = mkstate( -(yyvsp[0]) );
2219 }
2220 #line 2221 "parse.c" /* yacc.c:1646 */
2221 break;
2222
2223 case 59:
2224 #line 745 "parse.y" /* yacc.c:1646 */
2225 {
2226 ++rulelen;
2227
2228 if (ccl_has_nl[(yyvsp[0])])
2229 rule_has_nl[num_rules] = true;
2230
2231 (yyval) = mkstate( -(yyvsp[0]) );
2232 }
2233 #line 2234 "parse.c" /* yacc.c:1646 */
2234 break;
2235
2236 case 60:
2237 #line 755 "parse.y" /* yacc.c:1646 */
2238 { (yyval) = (yyvsp[-1]); }
2239 #line 2240 "parse.c" /* yacc.c:1646 */
2240 break;
2241
2242 case 61:
2243 #line 758 "parse.y" /* yacc.c:1646 */
2244 { (yyval) = (yyvsp[-1]); }
2245 #line 2246 "parse.c" /* yacc.c:1646 */
2246 break;
2247
2248 case 62:
2249 #line 761 "parse.y" /* yacc.c:1646 */
2250 {
2251 ++rulelen;
2252
2253 if ((yyvsp[0]) == nlch)
2254 rule_has_nl[num_rules] = true;
2255
2256 if (sf_case_ins() && has_case((yyvsp[0])))
2257 /* create an alternation, as in (a|A) */
2258 (yyval) = mkor (mkstate((yyvsp[0])), mkstate(reverse_case((yyvsp[0]))));
2259 else
2260 (yyval) = mkstate( (yyvsp[0]) );
2261 }
2262 #line 2263 "parse.c" /* yacc.c:1646 */
2263 break;
2264
2265 case 63:
2266 #line 775 "parse.y" /* yacc.c:1646 */
2267 { (yyval) = ccl_set_diff ((yyvsp[-2]), (yyvsp[0])); }
2268 #line 2269 "parse.c" /* yacc.c:1646 */
2269 break;
2270
2271 case 64:
2272 #line 776 "parse.y" /* yacc.c:1646 */
2273 { (yyval) = ccl_set_union ((yyvsp[-2]), (yyvsp[0])); }
2274 #line 2275 "parse.c" /* yacc.c:1646 */
2275 break;
2276
2277 case 66:
2278 #line 782 "parse.y" /* yacc.c:1646 */
2279 { (yyval) = (yyvsp[-1]); }
2280 #line 2281 "parse.c" /* yacc.c:1646 */
2281 break;
2282
2283 case 67:
2284 #line 785 "parse.y" /* yacc.c:1646 */
2285 {
2286 cclnegate( (yyvsp[-1]) );
2287 (yyval) = (yyvsp[-1]);
2288 }
2289 #line 2290 "parse.c" /* yacc.c:1646 */
2290 break;
2291
2292 case 68:
2293 #line 792 "parse.y" /* yacc.c:1646 */
2294 {
2295
2296 if (sf_case_ins())
2297 {
2298
2299 /* If one end of the range has case and the other
2300 * does not, or the cases are different, then we're not
2301 * sure what range the user is trying to express.
2302 * Examples: [@-z] or [S-t]
2303 */
2304 if (has_case ((yyvsp[-2])) != has_case ((yyvsp[0]))
2305 || (has_case ((yyvsp[-2])) && (b_islower ((yyvsp[-2])) != b_islower ((yyvsp[0]))))
2306 || (has_case ((yyvsp[-2])) && (b_isupper ((yyvsp[-2])) != b_isupper ((yyvsp[0])))))
2307 format_warn3 (
2308 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
2309 (yyvsp[-2]), (yyvsp[0]));
2310
2311 /* If the range spans uppercase characters but not
2312 * lowercase (or vice-versa), then should we automatically
2313 * include lowercase characters in the range?
2314 * Example: [@-_] spans [a-z] but not [A-Z]
2315 */
2316 else if (!has_case ((yyvsp[-2])) && !has_case ((yyvsp[0])) && !range_covers_case ((yyvsp[-2]), (yyvsp[0])))
2317 format_warn3 (
2318 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
2319 (yyvsp[-2]), (yyvsp[0]));
2320 }
2321
2322 if ( (yyvsp[-2]) > (yyvsp[0]) )
2323 synerr( _("negative range in character class") );
2324
2325 else
2326 {
2327 for ( i = (yyvsp[-2]); i <= (yyvsp[0]); ++i )
2328 ccladd( (yyvsp[-3]), i );
2329
2330 /* Keep track if this ccl is staying in
2331 * alphabetical order.
2332 */
2333 cclsorted = cclsorted && ((yyvsp[-2]) > lastchar);
2334 lastchar = (yyvsp[0]);
2335
2336 /* Do it again for upper/lowercase */
2337 if (sf_case_ins() && has_case((yyvsp[-2])) && has_case((yyvsp[0]))){
2338 (yyvsp[-2]) = reverse_case ((yyvsp[-2]));
2339 (yyvsp[0]) = reverse_case ((yyvsp[0]));
2340
2341 for ( i = (yyvsp[-2]); i <= (yyvsp[0]); ++i )
2342 ccladd( (yyvsp[-3]), i );
2343
2344 cclsorted = cclsorted && ((yyvsp[-2]) > lastchar);
2345 lastchar = (yyvsp[0]);
2346 }
2347
2348 }
2349
2350 (yyval) = (yyvsp[-3]);
2351 }
2352 #line 2353 "parse.c" /* yacc.c:1646 */
2353 break;
2354
2355 case 69:
2356 #line 852 "parse.y" /* yacc.c:1646 */
2357 {
2358 ccladd( (yyvsp[-1]), (yyvsp[0]) );
2359 cclsorted = cclsorted && ((yyvsp[0]) > lastchar);
2360 lastchar = (yyvsp[0]);
2361
2362 /* Do it again for upper/lowercase */
2363 if (sf_case_ins() && has_case((yyvsp[0]))){
2364 (yyvsp[0]) = reverse_case ((yyvsp[0]));
2365 ccladd ((yyvsp[-1]), (yyvsp[0]));
2366
2367 cclsorted = cclsorted && ((yyvsp[0]) > lastchar);
2368 lastchar = (yyvsp[0]);
2369 }
2370
2371 (yyval) = (yyvsp[-1]);
2372 }
2373 #line 2374 "parse.c" /* yacc.c:1646 */
2374 break;
2375
2376 case 70:
2377 #line 870 "parse.y" /* yacc.c:1646 */
2378 {
2379 /* Too hard to properly maintain cclsorted. */
2380 cclsorted = false;
2381 (yyval) = (yyvsp[-1]);
2382 }
2383 #line 2384 "parse.c" /* yacc.c:1646 */
2384 break;
2385
2386 case 71:
2387 #line 877 "parse.y" /* yacc.c:1646 */
2388 {
2389 cclsorted = true;
2390 lastchar = 0;
2391 currccl = (yyval) = cclinit();
2392 }
2393 #line 2394 "parse.c" /* yacc.c:1646 */
2394 break;
2395
2396 case 72:
2397 #line 885 "parse.y" /* yacc.c:1646 */
2398 { CCL_EXPR(isalnum); }
2399 #line 2400 "parse.c" /* yacc.c:1646 */
2400 break;
2401
2402 case 73:
2403 #line 886 "parse.y" /* yacc.c:1646 */
2404 { CCL_EXPR(isalpha); }
2405 #line 2406 "parse.c" /* yacc.c:1646 */
2406 break;
2407
2408 case 74:
2409 #line 887 "parse.y" /* yacc.c:1646 */
2410 { CCL_EXPR(IS_BLANK); }
2411 #line 2412 "parse.c" /* yacc.c:1646 */
2412 break;
2413
2414 case 75:
2415 #line 888 "parse.y" /* yacc.c:1646 */
2416 { CCL_EXPR(iscntrl); }
2417 #line 2418 "parse.c" /* yacc.c:1646 */
2418 break;
2419
2420 case 76:
2421 #line 889 "parse.y" /* yacc.c:1646 */
2422 { CCL_EXPR(isdigit); }
2423 #line 2424 "parse.c" /* yacc.c:1646 */
2424 break;
2425
2426 case 77:
2427 #line 890 "parse.y" /* yacc.c:1646 */
2428 { CCL_EXPR(isgraph); }
2429 #line 2430 "parse.c" /* yacc.c:1646 */
2430 break;
2431
2432 case 78:
2433 #line 891 "parse.y" /* yacc.c:1646 */
2434 {
2435 CCL_EXPR(islower);
2436 if (sf_case_ins())
2437 CCL_EXPR(isupper);
2438 }
2439 #line 2440 "parse.c" /* yacc.c:1646 */
2440 break;
2441
2442 case 79:
2443 #line 896 "parse.y" /* yacc.c:1646 */
2444 { CCL_EXPR(isprint); }
2445 #line 2446 "parse.c" /* yacc.c:1646 */
2446 break;
2447
2448 case 80:
2449 #line 897 "parse.y" /* yacc.c:1646 */
2450 { CCL_EXPR(ispunct); }
2451 #line 2452 "parse.c" /* yacc.c:1646 */
2452 break;
2453
2454 case 81:
2455 #line 898 "parse.y" /* yacc.c:1646 */
2456 { CCL_EXPR(isspace); }
2457 #line 2458 "parse.c" /* yacc.c:1646 */
2458 break;
2459
2460 case 82:
2461 #line 899 "parse.y" /* yacc.c:1646 */
2462 { CCL_EXPR(isxdigit); }
2463 #line 2464 "parse.c" /* yacc.c:1646 */
2464 break;
2465
2466 case 83:
2467 #line 900 "parse.y" /* yacc.c:1646 */
2468 {
2469 CCL_EXPR(isupper);
2470 if (sf_case_ins())
2471 CCL_EXPR(islower);
2472 }
2473 #line 2474 "parse.c" /* yacc.c:1646 */
2474 break;
2475
2476 case 84:
2477 #line 906 "parse.y" /* yacc.c:1646 */
2478 { CCL_NEG_EXPR(isalnum); }
2479 #line 2480 "parse.c" /* yacc.c:1646 */
2480 break;
2481
2482 case 85:
2483 #line 907 "parse.y" /* yacc.c:1646 */
2484 { CCL_NEG_EXPR(isalpha); }
2485 #line 2486 "parse.c" /* yacc.c:1646 */
2486 break;
2487
2488 case 86:
2489 #line 908 "parse.y" /* yacc.c:1646 */
2490 { CCL_NEG_EXPR(IS_BLANK); }
2491 #line 2492 "parse.c" /* yacc.c:1646 */
2492 break;
2493
2494 case 87:
2495 #line 909 "parse.y" /* yacc.c:1646 */
2496 { CCL_NEG_EXPR(iscntrl); }
2497 #line 2498 "parse.c" /* yacc.c:1646 */
2498 break;
2499
2500 case 88:
2501 #line 910 "parse.y" /* yacc.c:1646 */
2502 { CCL_NEG_EXPR(isdigit); }
2503 #line 2504 "parse.c" /* yacc.c:1646 */
2504 break;
2505
2506 case 89:
2507 #line 911 "parse.y" /* yacc.c:1646 */
2508 { CCL_NEG_EXPR(isgraph); }
2509 #line 2510 "parse.c" /* yacc.c:1646 */
2510 break;
2511
2512 case 90:
2513 #line 912 "parse.y" /* yacc.c:1646 */
2514 { CCL_NEG_EXPR(isprint); }
2515 #line 2516 "parse.c" /* yacc.c:1646 */
2516 break;
2517
2518 case 91:
2519 #line 913 "parse.y" /* yacc.c:1646 */
2520 { CCL_NEG_EXPR(ispunct); }
2521 #line 2522 "parse.c" /* yacc.c:1646 */
2522 break;
2523
2524 case 92:
2525 #line 914 "parse.y" /* yacc.c:1646 */
2526 { CCL_NEG_EXPR(isspace); }
2527 #line 2528 "parse.c" /* yacc.c:1646 */
2528 break;
2529
2530 case 93:
2531 #line 915 "parse.y" /* yacc.c:1646 */
2532 { CCL_NEG_EXPR(isxdigit); }
2533 #line 2534 "parse.c" /* yacc.c:1646 */
2534 break;
2535
2536 case 94:
2537 #line 916 "parse.y" /* yacc.c:1646 */
2538 {
2539 if ( sf_case_ins() )
2540 lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
2541 else
2542 CCL_NEG_EXPR(islower);
2543 }
2544 #line 2545 "parse.c" /* yacc.c:1646 */
2545 break;
2546
2547 case 95:
2548 #line 922 "parse.y" /* yacc.c:1646 */
2549 {
2550 if ( sf_case_ins() )
2551 lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
2552 else
2553 CCL_NEG_EXPR(isupper);
2554 }
2555 #line 2556 "parse.c" /* yacc.c:1646 */
2556 break;
2557
2558 case 96:
2559 #line 931 "parse.y" /* yacc.c:1646 */
2560 {
2561 if ( (yyvsp[0]) == nlch )
2562 rule_has_nl[num_rules] = true;
2563
2564 ++rulelen;
2565
2566 if (sf_case_ins() && has_case((yyvsp[0])))
2567 (yyval) = mkor (mkstate((yyvsp[0])), mkstate(reverse_case((yyvsp[0]))));
2568 else
2569 (yyval) = mkstate ((yyvsp[0]));
2570
2571 (yyval) = link_machines( (yyvsp[-1]), (yyval));
2572 }
2573 #line 2574 "parse.c" /* yacc.c:1646 */
2574 break;
2575
2576 case 97:
2577 #line 946 "parse.y" /* yacc.c:1646 */
2578 { (yyval) = mkstate( SYM_EPSILON ); }
2579 #line 2580 "parse.c" /* yacc.c:1646 */
2580 break;
2581
2582
2583 #line 2584 "parse.c" /* yacc.c:1646 */
2584 default: break;
2585 }
2586 /* User semantic actions sometimes alter yychar, and that requires
2587 that yytoken be updated with the new translation. We take the
2588 approach of translating immediately before every use of yytoken.
2589 One alternative is translating here after every semantic action,
2590 but that translation would be missed if the semantic action invokes
2591 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2592 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2593 incorrect destructor might then be invoked immediately. In the
2594 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2595 to an incorrect destructor call or verbose syntax error message
2596 before the lookahead is translated. */
2597 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2598
2599 YYPOPSTACK (yylen);
2600 yylen = 0;
2601 YY_STACK_PRINT (yyss, yyssp);
2602
2603 *++yyvsp = yyval;
2604
2605 /* Now 'shift' the result of the reduction. Determine what state
2606 that goes to, based on the state we popped back to and the rule
2607 number reduced by. */
2608
2609 yyn = yyr1[yyn];
2610
2611 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2612 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2613 yystate = yytable[yystate];
2614 else
2615 yystate = yydefgoto[yyn - YYNTOKENS];
2616
2617 goto yynewstate;
2618
2619
2620 /*--------------------------------------.
2621 | yyerrlab -- here on detecting error. |
2622 `--------------------------------------*/
2623 yyerrlab:
2624 /* Make sure we have latest lookahead translation. See comments at
2625 user semantic actions for why this is necessary. */
2626 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2627
2628 /* If not already recovering from an error, report this error. */
2629 if (!yyerrstatus)
2630 {
2631 ++yynerrs;
2632 #if ! YYERROR_VERBOSE
2633 yyerror (YY_("syntax error"));
2634 #else
2635 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2636 yyssp, yytoken)
2637 {
2638 char const *yymsgp = YY_("syntax error");
2639 int yysyntax_error_status;
2640 yysyntax_error_status = YYSYNTAX_ERROR;
2641 if (yysyntax_error_status == 0)
2642 yymsgp = yymsg;
2643 else if (yysyntax_error_status == 1)
2644 {
2645 if (yymsg != yymsgbuf)
2646 YYSTACK_FREE (yymsg);
2647 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2648 if (!yymsg)
2649 {
2650 yymsg = yymsgbuf;
2651 yymsg_alloc = sizeof yymsgbuf;
2652 yysyntax_error_status = 2;
2653 }
2654 else
2655 {
2656 yysyntax_error_status = YYSYNTAX_ERROR;
2657 yymsgp = yymsg;
2658 }
2659 }
2660 yyerror (yymsgp);
2661 if (yysyntax_error_status == 2)
2662 goto yyexhaustedlab;
2663 }
2664 # undef YYSYNTAX_ERROR
2665 #endif
2666 }
2667
2668
2669
2670 if (yyerrstatus == 3)
2671 {
2672 /* If just tried and failed to reuse lookahead token after an
2673 error, discard it. */
2674
2675 if (yychar <= YYEOF)
2676 {
2677 /* Return failure if at end of input. */
2678 if (yychar == YYEOF)
2679 YYABORT;
2680 }
2681 else
2682 {
2683 yydestruct ("Error: discarding",
2684 yytoken, &yylval);
2685 yychar = YYEMPTY;
2686 }
2687 }
2688
2689 /* Else will try to reuse lookahead token after shifting the error
2690 token. */
2691 goto yyerrlab1;
2692
2693
2694 /*---------------------------------------------------.
2695 | yyerrorlab -- error raised explicitly by YYERROR. |
2696 `---------------------------------------------------*/
2697 yyerrorlab:
2698
2699 /* Pacify compilers like GCC when the user code never invokes
2700 YYERROR and the label yyerrorlab therefore never appears in user
2701 code. */
2702 if (/*CONSTCOND*/ 0)
2703 goto yyerrorlab;
2704
2705 /* Do not reclaim the symbols of the rule whose action triggered
2706 this YYERROR. */
2707 YYPOPSTACK (yylen);
2708 yylen = 0;
2709 YY_STACK_PRINT (yyss, yyssp);
2710 yystate = *yyssp;
2711 goto yyerrlab1;
2712
2713
2714 /*-------------------------------------------------------------.
2715 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2716 `-------------------------------------------------------------*/
2717 yyerrlab1:
2718 yyerrstatus = 3; /* Each real token shifted decrements this. */
2719
2720 for (;;)
2721 {
2722 yyn = yypact[yystate];
2723 if (!yypact_value_is_default (yyn))
2724 {
2725 yyn += YYTERROR;
2726 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2727 {
2728 yyn = yytable[yyn];
2729 if (0 < yyn)
2730 break;
2731 }
2732 }
2733
2734 /* Pop the current state because it cannot handle the error token. */
2735 if (yyssp == yyss)
2736 YYABORT;
2737
2738
2739 yydestruct ("Error: popping",
2740 yystos[yystate], yyvsp);
2741 YYPOPSTACK (1);
2742 yystate = *yyssp;
2743 YY_STACK_PRINT (yyss, yyssp);
2744 }
2745
2746 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2747 *++yyvsp = yylval;
2748 YY_IGNORE_MAYBE_UNINITIALIZED_END
2749
2750
2751 /* Shift the error token. */
2752 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2753
2754 yystate = yyn;
2755 goto yynewstate;
2756
2757
2758 /*-------------------------------------.
2759 | yyacceptlab -- YYACCEPT comes here. |
2760 `-------------------------------------*/
2761 yyacceptlab:
2762 yyresult = 0;
2763 goto yyreturn;
2764
2765 /*-----------------------------------.
2766 | yyabortlab -- YYABORT comes here. |
2767 `-----------------------------------*/
2768 yyabortlab:
2769 yyresult = 1;
2770 goto yyreturn;
2771
2772 #if !defined yyoverflow || YYERROR_VERBOSE
2773 /*-------------------------------------------------.
2774 | yyexhaustedlab -- memory exhaustion comes here. |
2775 `-------------------------------------------------*/
2776 yyexhaustedlab:
2777 yyerror (YY_("memory exhausted"));
2778 yyresult = 2;
2779 /* Fall through. */
2780 #endif
2781
2782 yyreturn:
2783 if (yychar != YYEMPTY)
2784 {
2785 /* Make sure we have latest lookahead translation. See comments at
2786 user semantic actions for why this is necessary. */
2787 yytoken = YYTRANSLATE (yychar);
2788 yydestruct ("Cleanup: discarding lookahead",
2789 yytoken, &yylval);
2790 }
2791 /* Do not reclaim the symbols of the rule whose action triggered
2792 this YYABORT or YYACCEPT. */
2793 YYPOPSTACK (yylen);
2794 YY_STACK_PRINT (yyss, yyssp);
2795 while (yyssp != yyss)
2796 {
2797 yydestruct ("Cleanup: popping",
2798 yystos[*yyssp], yyvsp);
2799 YYPOPSTACK (1);
2800 }
2801 #ifndef yyoverflow
2802 if (yyss != yyssa)
2803 YYSTACK_FREE (yyss);
2804 #endif
2805 #if YYERROR_VERBOSE
2806 if (yymsg != yymsgbuf)
2807 YYSTACK_FREE (yymsg);
2808 #endif
2809 return yyresult;
2810 }
2811 #line 949 "parse.y" /* yacc.c:1906 */
2812
2813
2814
2815 /* build_eof_action - build the "<<EOF>>" action for the active start
2816 * conditions
2817 */
2818
build_eof_action(void)2819 void build_eof_action(void)
2820 {
2821 int i;
2822 char action_text[MAXLINE];
2823
2824 for ( i = 1; i <= scon_stk_ptr; ++i )
2825 {
2826 if ( sceof[scon_stk[i]] )
2827 format_pinpoint_message(
2828 "multiple <<EOF>> rules for start condition %s",
2829 scname[scon_stk[i]] );
2830
2831 else
2832 {
2833 sceof[scon_stk[i]] = true;
2834
2835 if (previous_continued_action /* && previous action was regular */)
2836 add_action("YY_RULE_SETUP\n");
2837
2838 snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n",
2839 scname[scon_stk[i]] );
2840 add_action( action_text );
2841 }
2842 }
2843
2844 line_directive_out(NULL, 1);
2845 add_action("[[");
2846
2847 /* This isn't a normal rule after all - don't count it as
2848 * such, so we don't have any holes in the rule numbering
2849 * (which make generating "rule can never match" warnings
2850 * more difficult.
2851 */
2852 --num_rules;
2853 ++num_eof_rules;
2854 }
2855
2856
2857 /* format_synerr - write out formatted syntax error */
2858
format_synerr(const char * msg,const char arg[])2859 void format_synerr( const char *msg, const char arg[] )
2860 {
2861 char errmsg[MAXLINE];
2862
2863 (void) snprintf( errmsg, sizeof(errmsg), msg, arg );
2864 synerr( errmsg );
2865 }
2866
2867
2868 /* synerr - report a syntax error */
2869
synerr(const char * str)2870 void synerr( const char *str )
2871 {
2872 syntaxerror = true;
2873 pinpoint_message( str );
2874 }
2875
2876
2877 /* format_warn - write out formatted warning */
2878
format_warn(const char * msg,const char arg[])2879 void format_warn( const char *msg, const char arg[] )
2880 {
2881 char warn_msg[MAXLINE];
2882
2883 snprintf( warn_msg, sizeof(warn_msg), msg, arg );
2884 lwarn( warn_msg );
2885 }
2886
2887
2888 /* lwarn - report a warning, unless -w was given */
2889
lwarn(const char * str)2890 void lwarn( const char *str )
2891 {
2892 line_warning( str, linenum );
2893 }
2894
2895 /* format_pinpoint_message - write out a message formatted with one string,
2896 * pinpointing its location
2897 */
2898
format_pinpoint_message(const char * msg,const char arg[])2899 void format_pinpoint_message( const char *msg, const char arg[] )
2900 {
2901 char errmsg[MAXLINE];
2902
2903 snprintf( errmsg, sizeof(errmsg), msg, arg );
2904 pinpoint_message( errmsg );
2905 }
2906
2907
2908 /* pinpoint_message - write out a message, pinpointing its location */
2909
pinpoint_message(const char * str)2910 void pinpoint_message( const char *str )
2911 {
2912 line_pinpoint( str, linenum );
2913 }
2914
2915
2916 /* line_warning - report a warning at a given line, unless -w was given */
2917
line_warning(const char * str,int line)2918 void line_warning( const char *str, int line )
2919 {
2920 char warning[MAXLINE];
2921
2922 if ( ! nowarn )
2923 {
2924 snprintf( warning, sizeof(warning), "warning, %s", str );
2925 line_pinpoint( warning, line );
2926 }
2927 }
2928
2929
2930 /* line_pinpoint - write out a message, pinpointing it at the given line */
2931
line_pinpoint(const char * str,int line)2932 void line_pinpoint( const char *str, int line )
2933 {
2934 fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
2935 }
2936
2937
2938 /* yyerror - eat up an error message from the parser;
2939 * currently, messages are ignore
2940 */
2941
yyerror(const char * msg)2942 void yyerror( const char *msg )
2943 {
2944 (void)msg;
2945 }
2946