1 /* A Bison parser, made by GNU Bison 2.7.12-4996.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5       Copyright (C) 1984, 1989-1990, 2000-2013 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 "2.7.12-4996"
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 371 of yacc.c  */
66 #line 16 "../../../../../src/lib/oogl/wa/fsaparse.y"
67 
68 
69 #if 0
70 static char copyright[] =
71   "Copyright (C) 1991 Mark B. Phillips, The Geometry Center";
72 #endif
73 
74 #ifdef HAVE_CONFIG_H
75 # include "config.h"
76 #endif
77 
78 #include <stdio.h>
79 #include <stdlib.h>
80 #include <string.h>
81 #include "wa.h"
82 #include "wa.yystype.h"
83 #include "wa.yacc.h"
84 
85 #define MAXSTATES 100
86 #define MAXGENS 128
87 
88 static int adj[MAXSTATES];
89 static int adj_index = 0;
90 static void install_adjacency();
91 static void yyerror(char *s);
92 extern int yylex(void);
93 
94 static wa *fsa;
95 
96 
97 /* Line 371 of yacc.c  */
98 #line 99 "y.tab.c"
99 
100 # ifndef YY_NULL
101 #  if defined __cplusplus && 201103L <= __cplusplus
102 #   define YY_NULL nullptr
103 #  else
104 #   define YY_NULL 0
105 #  endif
106 # endif
107 
108 /* Enabling verbose error messages.  */
109 #ifdef YYERROR_VERBOSE
110 # undef YYERROR_VERBOSE
111 # define YYERROR_VERBOSE 1
112 #else
113 # define YYERROR_VERBOSE 0
114 #endif
115 
116 /* In a future release of Bison, this section will be replaced
117    by #include "y.tab.h".  */
118 #ifndef YY_YY_Y_TAB_H_INCLUDED
119 # define YY_YY_Y_TAB_H_INCLUDED
120 /* Enabling traces.  */
121 #ifndef YYDEBUG
122 # define YYDEBUG 0
123 #endif
124 #if YYDEBUG
125 extern int yydebug;
126 #endif
127 
128 /* Tokens.  */
129 #ifndef YYTOKENTYPE
130 # define YYTOKENTYPE
131    /* Put the tokens into the symbol table, so that GDB and other debuggers
132       know about them.  */
133    enum yytokentype {
134      FORMAT = 258,
135      FSA = 259,
136      STATES = 260,
137      SYMBOLS = 261,
138      BFS = 262,
139      MIN = 263,
140      VARIABLES = 264,
141      ALPHABET = 265,
142      START = 266,
143      ATABLE = 267,
144      INVERSES = 268,
145      INV = 269,
146      LEFT_BRACE = 270,
147      RIGHT_BRACE = 271,
148      LEFT_PAREN = 272,
149      RIGHT_PAREN = 273,
150      SEMICOLON = 274,
151      PERCENT = 275,
152      INT = 276,
153      EQUAL = 277,
154      STRING = 278,
155      REAL = 279
156    };
157 #endif
158 /* Tokens.  */
159 #define FORMAT 258
160 #define FSA 259
161 #define STATES 260
162 #define SYMBOLS 261
163 #define BFS 262
164 #define MIN 263
165 #define VARIABLES 264
166 #define ALPHABET 265
167 #define START 266
168 #define ATABLE 267
169 #define INVERSES 268
170 #define INV 269
171 #define LEFT_BRACE 270
172 #define RIGHT_BRACE 271
173 #define LEFT_PAREN 272
174 #define RIGHT_PAREN 273
175 #define SEMICOLON 274
176 #define PERCENT 275
177 #define INT 276
178 #define EQUAL 277
179 #define STRING 278
180 #define REAL 279
181 
182 
183 
184 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
185 
186 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
187 # define YYSTYPE_IS_DECLARED 1
188 #endif
189 
190 extern YYSTYPE yylval;
191 
192 #ifdef YYPARSE_PARAM
193 #if defined __STDC__ || defined __cplusplus
194 int yyparse (void *YYPARSE_PARAM);
195 #else
196 int yyparse ();
197 #endif
198 #else /* ! YYPARSE_PARAM */
199 #if defined __STDC__ || defined __cplusplus
200 int yyparse (void);
201 #else
202 int yyparse ();
203 #endif
204 #endif /* ! YYPARSE_PARAM */
205 
206 #endif /* !YY_YY_Y_TAB_H_INCLUDED  */
207 
208 /* Copy the second part of user declarations.  */
209 
210 /* Line 390 of yacc.c  */
211 #line 212 "y.tab.c"
212 
213 #ifdef short
214 # undef short
215 #endif
216 
217 #ifdef YYTYPE_UINT8
218 typedef YYTYPE_UINT8 yytype_uint8;
219 #else
220 typedef unsigned char yytype_uint8;
221 #endif
222 
223 #ifdef YYTYPE_INT8
224 typedef YYTYPE_INT8 yytype_int8;
225 #elif (defined __STDC__ || defined __C99__FUNC__ \
226      || defined __cplusplus || defined _MSC_VER)
227 typedef signed char yytype_int8;
228 #else
229 typedef short int yytype_int8;
230 #endif
231 
232 #ifdef YYTYPE_UINT16
233 typedef YYTYPE_UINT16 yytype_uint16;
234 #else
235 typedef unsigned short int yytype_uint16;
236 #endif
237 
238 #ifdef YYTYPE_INT16
239 typedef YYTYPE_INT16 yytype_int16;
240 #else
241 typedef short int yytype_int16;
242 #endif
243 
244 #ifndef YYSIZE_T
245 # ifdef __SIZE_TYPE__
246 #  define YYSIZE_T __SIZE_TYPE__
247 # elif defined size_t
248 #  define YYSIZE_T size_t
249 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
250      || defined __cplusplus || defined _MSC_VER)
251 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
252 #  define YYSIZE_T size_t
253 # else
254 #  define YYSIZE_T unsigned int
255 # endif
256 #endif
257 
258 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
259 
260 #ifndef YY_
261 # if defined YYENABLE_NLS && YYENABLE_NLS
262 #  if ENABLE_NLS
263 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
264 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
265 #  endif
266 # endif
267 # ifndef YY_
268 #  define YY_(Msgid) Msgid
269 # endif
270 #endif
271 
272 #ifndef __attribute__
273 /* This feature is available in gcc versions 2.5 and later.  */
274 # if (! defined __GNUC__ || __GNUC__ < 2 \
275       || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
276 #  define __attribute__(Spec) /* empty */
277 # endif
278 #endif
279 
280 /* Suppress unused-variable warnings by "using" E.  */
281 #if ! defined lint || defined __GNUC__
282 # define YYUSE(E) ((void) (E))
283 #else
284 # define YYUSE(E) /* empty */
285 #endif
286 
287 
288 /* Identity function, used to suppress warnings about constant conditions.  */
289 #ifndef lint
290 # define YYID(N) (N)
291 #else
292 #if (defined __STDC__ || defined __C99__FUNC__ \
293      || defined __cplusplus || defined _MSC_VER)
294 static int
YYID(int yyi)295 YYID (int yyi)
296 #else
297 static int
298 YYID (yyi)
299     int yyi;
300 #endif
301 {
302   return yyi;
303 }
304 #endif
305 
306 #if ! defined yyoverflow || YYERROR_VERBOSE
307 
308 /* The parser invokes alloca or malloc; define the necessary symbols.  */
309 
310 # ifdef YYSTACK_USE_ALLOCA
311 #  if YYSTACK_USE_ALLOCA
312 #   ifdef __GNUC__
313 #    define YYSTACK_ALLOC __builtin_alloca
314 #   elif defined __BUILTIN_VA_ARG_INCR
315 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
316 #   elif defined _AIX
317 #    define YYSTACK_ALLOC __alloca
318 #   elif defined _MSC_VER
319 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
320 #    define alloca _alloca
321 #   else
322 #    define YYSTACK_ALLOC alloca
323 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
324      || defined __cplusplus || defined _MSC_VER)
325 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
326       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
327 #     ifndef EXIT_SUCCESS
328 #      define EXIT_SUCCESS 0
329 #     endif
330 #    endif
331 #   endif
332 #  endif
333 # endif
334 
335 # ifdef YYSTACK_ALLOC
336    /* Pacify GCC's `empty if-body' warning.  */
337 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
338 #  ifndef YYSTACK_ALLOC_MAXIMUM
339     /* The OS might guarantee only one guard page at the bottom of the stack,
340        and a page size can be as small as 4096 bytes.  So we cannot safely
341        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
342        to allow for a few compiler-allocated temporary stack slots.  */
343 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
344 #  endif
345 # else
346 #  define YYSTACK_ALLOC YYMALLOC
347 #  define YYSTACK_FREE YYFREE
348 #  ifndef YYSTACK_ALLOC_MAXIMUM
349 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
350 #  endif
351 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
352        && ! ((defined YYMALLOC || defined malloc) \
353 	     && (defined YYFREE || defined free)))
354 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
355 #   ifndef EXIT_SUCCESS
356 #    define EXIT_SUCCESS 0
357 #   endif
358 #  endif
359 #  ifndef YYMALLOC
360 #   define YYMALLOC malloc
361 #   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
362      || defined __cplusplus || defined _MSC_VER)
363 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
364 #   endif
365 #  endif
366 #  ifndef YYFREE
367 #   define YYFREE free
368 #   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
369      || defined __cplusplus || defined _MSC_VER)
370 void free (void *); /* INFRINGES ON USER NAME SPACE */
371 #   endif
372 #  endif
373 # endif
374 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
375 
376 
377 #if (! defined yyoverflow \
378      && (! defined __cplusplus \
379 	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
380 
381 /* A type that is properly aligned for any stack member.  */
382 union yyalloc
383 {
384   yytype_int16 yyss_alloc;
385   YYSTYPE yyvs_alloc;
386 };
387 
388 /* The size of the maximum gap between one aligned stack and the next.  */
389 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
390 
391 /* The size of an array large to enough to hold all stacks, each with
392    N elements.  */
393 # define YYSTACK_BYTES(N) \
394      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
395       + YYSTACK_GAP_MAXIMUM)
396 
397 # define YYCOPY_NEEDED 1
398 
399 /* Relocate STACK from its old location to the new one.  The
400    local variables YYSIZE and YYSTACKSIZE give the old and new number of
401    elements in the stack, and YYPTR gives the new location of the
402    stack.  Advance YYPTR to a properly aligned location for the next
403    stack.  */
404 # define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
405     do									\
406       {									\
407 	YYSIZE_T yynewbytes;						\
408 	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
409 	Stack = &yyptr->Stack_alloc;					\
410 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
411 	yyptr += yynewbytes / sizeof (*yyptr);				\
412       }									\
413     while (YYID (0))
414 
415 #endif
416 
417 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
418 /* Copy COUNT objects from SRC to DST.  The source and destination do
419    not overlap.  */
420 # ifndef YYCOPY
421 #  if defined __GNUC__ && 1 < __GNUC__
422 #   define YYCOPY(Dst, Src, Count) \
423       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
424 #  else
425 #   define YYCOPY(Dst, Src, Count)              \
426       do                                        \
427         {                                       \
428           YYSIZE_T yyi;                         \
429           for (yyi = 0; yyi < (Count); yyi++)   \
430             (Dst)[yyi] = (Src)[yyi];            \
431         }                                       \
432       while (YYID (0))
433 #  endif
434 # endif
435 #endif /* !YYCOPY_NEEDED */
436 
437 /* YYFINAL -- State number of the termination state.  */
438 #define YYFINAL  4
439 /* YYLAST -- Last index in YYTABLE.  */
440 #define YYLAST   44
441 
442 /* YYNTOKENS -- Number of terminals.  */
443 #define YYNTOKENS  25
444 /* YYNNTS -- Number of nonterminals.  */
445 #define YYNNTS  18
446 /* YYNRULES -- Number of rules.  */
447 #define YYNRULES  29
448 /* YYNRULES -- Number of states.  */
449 #define YYNSTATES  56
450 
451 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
452 #define YYUNDEFTOK  2
453 #define YYMAXUTOK   279
454 
455 #define YYTRANSLATE(YYX)						\
456   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
457 
458 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
459 static const yytype_uint8 yytranslate[] =
460 {
461        0,     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,     2,     2,     2,     2,
470        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
471        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
472        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
473        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
474        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
475        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
476        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
477        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
478        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
479        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
480        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
481        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
482        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
483        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
484        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
485        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
486        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
487        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
488       15,    16,    17,    18,    19,    20,    21,    22,    23,    24
489 };
490 
491 #if YYDEBUG
492 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
493    YYRHS.  */
494 static const yytype_uint8 yyprhs[] =
495 {
496        0,     0,     3,     7,    17,    20,    23,    25,    28,    30,
497       32,    35,    37,    40,    42,    44,    49,    51,    54,    58,
498       63,    69,    71,    74,    77,    79,    81,    84,    89,    91
499 };
500 
501 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
502 static const yytype_int8 yyrhs[] =
503 {
504       26,     0,    -1,     3,    24,    27,    -1,     4,    15,    28,
505       29,    30,    32,    20,    39,    16,    -1,     5,    21,    -1,
506        6,    21,    -1,    31,    -1,    31,    30,    -1,     7,    -1,
507        8,    -1,     9,    21,    -1,    33,    -1,    33,    32,    -1,
508       34,    -1,    37,    -1,    10,    15,    35,    16,    -1,    36,
509       -1,    35,    36,    -1,    21,    22,    23,    -1,    11,    15,
510       21,    16,    -1,    11,    15,    21,    38,    16,    -1,    21,
511       -1,    21,    38,    -1,    12,    40,    -1,    12,    -1,    41,
512       -1,    41,    40,    -1,    21,    23,    42,    19,    -1,    21,
513       -1,    42,    21,    -1
514 };
515 
516 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
517 static const yytype_uint8 yyrline[] =
518 {
519        0,    58,    58,    61,    73,    81,    98,    99,   104,   105,
520      106,   110,   111,   114,   115,   121,   124,   125,   128,   136,
521      138,   143,   144,   148,   149,   152,   153,   156,   160,   164
522 };
523 #endif
524 
525 #if YYDEBUG || YYERROR_VERBOSE || 0
526 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
527    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
528 static const char *const yytname[] =
529 {
530   "$end", "error", "$undefined", "FORMAT", "FSA", "STATES", "SYMBOLS",
531   "BFS", "MIN", "VARIABLES", "ALPHABET", "START", "ATABLE", "INVERSES",
532   "INV", "LEFT_BRACE", "RIGHT_BRACE", "LEFT_PAREN", "RIGHT_PAREN",
533   "SEMICOLON", "PERCENT", "INT", "EQUAL", "STRING", "REAL", "$accept",
534   "fsa_file", "fsa_format", "states", "symbols", "fsa_characteristics",
535   "fsa_characteristic", "info_items", "info_item", "alphabet",
536   "symbol_names", "symbol_name", "start_states", "int_list", "fsa_table",
537   "acstates", "acstate", "adjacency", YY_NULL
538 };
539 #endif
540 
541 # ifdef YYPRINT
542 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
543    token YYLEX-NUM.  */
544 static const yytype_uint16 yytoknum[] =
545 {
546        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
547      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
548      275,   276,   277,   278,   279
549 };
550 # endif
551 
552 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
553 static const yytype_uint8 yyr1[] =
554 {
555        0,    25,    26,    27,    28,    29,    30,    30,    31,    31,
556       31,    32,    32,    33,    33,    34,    35,    35,    36,    37,
557       37,    38,    38,    39,    39,    40,    40,    41,    42,    42
558 };
559 
560 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
561 static const yytype_uint8 yyr2[] =
562 {
563        0,     2,     3,     9,     2,     2,     1,     2,     1,     1,
564        2,     1,     2,     1,     1,     4,     1,     2,     3,     4,
565        5,     1,     2,     2,     1,     1,     2,     4,     1,     2
566 };
567 
568 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
569    Performed when YYTABLE doesn't specify something else to do.  Zero
570    means the default is an error.  */
571 static const yytype_uint8 yydefact[] =
572 {
573        0,     0,     0,     0,     1,     0,     2,     0,     0,     0,
574        4,     0,     0,     5,     8,     9,     0,     0,     6,    10,
575        0,     0,     0,    11,    13,    14,     7,     0,     0,     0,
576       12,     0,     0,    16,     0,    24,     0,     0,    15,    17,
577       19,    21,     0,     0,    23,    25,     3,    18,    22,    20,
578        0,    26,    28,     0,    27,    29
579 };
580 
581 /* YYDEFGOTO[NTERM-NUM].  */
582 static const yytype_int8 yydefgoto[] =
583 {
584       -1,     2,     6,     9,    12,    17,    18,    22,    23,    24,
585       32,    33,    25,    42,    36,    44,    45,    53
586 };
587 
588 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
589    STATE-NUM.  */
590 #define YYPACT_NINF -17
591 static const yytype_int8 yypact[] =
592 {
593        5,   -11,    12,    10,   -17,     1,   -17,    13,    -6,    11,
594      -17,    -2,    -5,   -17,   -17,   -17,    -1,     0,    -5,   -17,
595        6,     7,     3,     0,   -17,   -17,   -17,     4,     8,    14,
596      -17,     2,   -16,   -17,   -15,     9,    15,    16,   -17,   -17,
597      -17,    17,    18,    19,   -17,     9,   -17,   -17,   -17,   -17,
598       20,   -17,   -17,   -12,   -17,   -17
599 };
600 
601 /* YYPGOTO[NTERM-NUM].  */
602 static const yytype_int8 yypgoto[] =
603 {
604      -17,   -17,   -17,   -17,   -17,    22,   -17,    21,   -17,   -17,
605      -17,    -4,   -17,   -14,   -17,   -13,   -17,   -17
606 };
607 
608 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
609    positive, shift that token.  If negative, reduce the rule which
610    number is the opposite.  If YYTABLE_NINF, syntax error.  */
611 #define YYTABLE_NINF -1
612 static const yytype_uint8 yytable[] =
613 {
614       38,    40,    14,    15,    16,    31,    41,    54,     1,    55,
615       20,    21,     4,     3,     5,    10,     7,    11,     8,    13,
616       19,    27,    28,    29,    37,    31,    35,    48,    39,    34,
617       43,    46,    51,     0,    49,     0,     0,     0,    41,    47,
618       26,    52,    50,     0,    30
619 };
620 
621 #define yypact_value_is_default(Yystate) \
622   (!!((Yystate) == (-17)))
623 
624 #define yytable_value_is_error(Yytable_value) \
625   YYID (0)
626 
627 static const yytype_int8 yycheck[] =
628 {
629       16,    16,     7,     8,     9,    21,    21,    19,     3,    21,
630       10,    11,     0,    24,     4,    21,    15,     6,     5,    21,
631       21,    15,    15,    20,    22,    21,    12,    41,    32,    21,
632       21,    16,    45,    -1,    16,    -1,    -1,    -1,    21,    23,
633       18,    21,    23,    -1,    23
634 };
635 
636 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
637    symbol of state STATE-NUM.  */
638 static const yytype_uint8 yystos[] =
639 {
640        0,     3,    26,    24,     0,     4,    27,    15,     5,    28,
641       21,     6,    29,    21,     7,     8,     9,    30,    31,    21,
642       10,    11,    32,    33,    34,    37,    30,    15,    15,    20,
643       32,    21,    35,    36,    21,    12,    39,    22,    16,    36,
644       16,    21,    38,    21,    40,    41,    16,    23,    38,    16,
645       23,    40,    21,    42,    19,    21
646 };
647 
648 #define yyerrok		(yyerrstatus = 0)
649 #define yyclearin	(yychar = YYEMPTY)
650 #define YYEMPTY		(-2)
651 #define YYEOF		0
652 
653 #define YYACCEPT	goto yyacceptlab
654 #define YYABORT		goto yyabortlab
655 #define YYERROR		goto yyerrorlab
656 
657 
658 /* Like YYERROR except do call yyerror.  This remains here temporarily
659    to ease the transition to the new meaning of YYERROR, for GCC.
660    Once GCC version 2 has supplanted version 1, this can go.  However,
661    YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
662    in Bison 2.4.2's NEWS entry, where a plan to phase it out is
663    discussed.  */
664 
665 #define YYFAIL		goto yyerrlab
666 #if defined YYFAIL
667   /* This is here to suppress warnings from the GCC cpp's
668      -Wunused-macros.  Normally we don't worry about that warning, but
669      some users do, and we want to make it easy for users to remove
670      YYFAIL uses, which will produce warnings from Bison 2.5.  */
671 #endif
672 
673 #define YYRECOVERING()  (!!yyerrstatus)
674 
675 #define YYBACKUP(Token, Value)                                  \
676 do                                                              \
677   if (yychar == YYEMPTY)                                        \
678     {                                                           \
679       yychar = (Token);                                         \
680       yylval = (Value);                                         \
681       YYPOPSTACK (yylen);                                       \
682       yystate = *yyssp;                                         \
683       goto yybackup;                                            \
684     }                                                           \
685   else                                                          \
686     {                                                           \
687       yyerror (YY_("syntax error: cannot back up")); \
688       YYERROR;							\
689     }								\
690 while (YYID (0))
691 
692 /* Error token number */
693 #define YYTERROR	1
694 #define YYERRCODE	256
695 
696 
697 /* This macro is provided for backward compatibility. */
698 #ifndef YY_LOCATION_PRINT
699 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
700 #endif
701 
702 
703 /* YYLEX -- calling `yylex' with the right arguments.  */
704 #ifdef YYLEX_PARAM
705 # define YYLEX yylex (YYLEX_PARAM)
706 #else
707 # define YYLEX yylex ()
708 #endif
709 
710 /* Enable debugging if requested.  */
711 #if YYDEBUG
712 
713 # ifndef YYFPRINTF
714 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
715 #  define YYFPRINTF fprintf
716 # endif
717 
718 # define YYDPRINTF(Args)			\
719 do {						\
720   if (yydebug)					\
721     YYFPRINTF Args;				\
722 } while (YYID (0))
723 
724 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
725 do {									  \
726   if (yydebug)								  \
727     {									  \
728       YYFPRINTF (stderr, "%s ", Title);					  \
729       yy_symbol_print (stderr,						  \
730 		  Type, Value); \
731       YYFPRINTF (stderr, "\n");						  \
732     }									  \
733 } while (YYID (0))
734 
735 
736 /*--------------------------------.
737 | Print this symbol on YYOUTPUT.  |
738 `--------------------------------*/
739 
740 /*ARGSUSED*/
741 #if (defined __STDC__ || defined __C99__FUNC__ \
742      || defined __cplusplus || defined _MSC_VER)
743 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)744 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
745 #else
746 static void
747 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
748     FILE *yyoutput;
749     int yytype;
750     YYSTYPE const * const yyvaluep;
751 #endif
752 {
753   FILE *yyo = yyoutput;
754   YYUSE (yyo);
755   if (!yyvaluep)
756     return;
757 # ifdef YYPRINT
758   if (yytype < YYNTOKENS)
759     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
760 # else
761   YYUSE (yyoutput);
762 # endif
763   YYUSE (yytype);
764 }
765 
766 
767 /*--------------------------------.
768 | Print this symbol on YYOUTPUT.  |
769 `--------------------------------*/
770 
771 #if (defined __STDC__ || defined __C99__FUNC__ \
772      || defined __cplusplus || defined _MSC_VER)
773 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)774 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
775 #else
776 static void
777 yy_symbol_print (yyoutput, yytype, yyvaluep)
778     FILE *yyoutput;
779     int yytype;
780     YYSTYPE const * const yyvaluep;
781 #endif
782 {
783   if (yytype < YYNTOKENS)
784     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
785   else
786     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
787 
788   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
789   YYFPRINTF (yyoutput, ")");
790 }
791 
792 /*------------------------------------------------------------------.
793 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
794 | TOP (included).                                                   |
795 `------------------------------------------------------------------*/
796 
797 #if (defined __STDC__ || defined __C99__FUNC__ \
798      || defined __cplusplus || defined _MSC_VER)
799 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)800 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
801 #else
802 static void
803 yy_stack_print (yybottom, yytop)
804     yytype_int16 *yybottom;
805     yytype_int16 *yytop;
806 #endif
807 {
808   YYFPRINTF (stderr, "Stack now");
809   for (; yybottom <= yytop; yybottom++)
810     {
811       int yybot = *yybottom;
812       YYFPRINTF (stderr, " %d", yybot);
813     }
814   YYFPRINTF (stderr, "\n");
815 }
816 
817 # define YY_STACK_PRINT(Bottom, Top)				\
818 do {								\
819   if (yydebug)							\
820     yy_stack_print ((Bottom), (Top));				\
821 } while (YYID (0))
822 
823 
824 /*------------------------------------------------.
825 | Report that the YYRULE is going to be reduced.  |
826 `------------------------------------------------*/
827 
828 #if (defined __STDC__ || defined __C99__FUNC__ \
829      || defined __cplusplus || defined _MSC_VER)
830 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)831 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
832 #else
833 static void
834 yy_reduce_print (yyvsp, yyrule)
835     YYSTYPE *yyvsp;
836     int yyrule;
837 #endif
838 {
839   int yynrhs = yyr2[yyrule];
840   int yyi;
841   unsigned long int yylno = yyrline[yyrule];
842   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
843 	     yyrule - 1, yylno);
844   /* The symbols being reduced.  */
845   for (yyi = 0; yyi < yynrhs; yyi++)
846     {
847       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
848       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
849 		       &(yyvsp[(yyi + 1) - (yynrhs)])
850 		       		       );
851       YYFPRINTF (stderr, "\n");
852     }
853 }
854 
855 # define YY_REDUCE_PRINT(Rule)		\
856 do {					\
857   if (yydebug)				\
858     yy_reduce_print (yyvsp, Rule); \
859 } while (YYID (0))
860 
861 /* Nonzero means print parse trace.  It is left uninitialized so that
862    multiple parsers can coexist.  */
863 int yydebug;
864 #else /* !YYDEBUG */
865 # define YYDPRINTF(Args)
866 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
867 # define YY_STACK_PRINT(Bottom, Top)
868 # define YY_REDUCE_PRINT(Rule)
869 #endif /* !YYDEBUG */
870 
871 
872 /* YYINITDEPTH -- initial size of the parser's stacks.  */
873 #ifndef	YYINITDEPTH
874 # define YYINITDEPTH 200
875 #endif
876 
877 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
878    if the built-in stack extension method is used).
879 
880    Do not make this value too large; the results are undefined if
881    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
882    evaluated with infinite-precision integer arithmetic.  */
883 
884 #ifndef YYMAXDEPTH
885 # define YYMAXDEPTH 10000
886 #endif
887 
888 
889 #if YYERROR_VERBOSE
890 
891 # ifndef yystrlen
892 #  if defined __GLIBC__ && defined _STRING_H
893 #   define yystrlen strlen
894 #  else
895 /* Return the length of YYSTR.  */
896 #if (defined __STDC__ || defined __C99__FUNC__ \
897      || defined __cplusplus || defined _MSC_VER)
898 static YYSIZE_T
yystrlen(const char * yystr)899 yystrlen (const char *yystr)
900 #else
901 static YYSIZE_T
902 yystrlen (yystr)
903     const char *yystr;
904 #endif
905 {
906   YYSIZE_T yylen;
907   for (yylen = 0; yystr[yylen]; yylen++)
908     continue;
909   return yylen;
910 }
911 #  endif
912 # endif
913 
914 # ifndef yystpcpy
915 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
916 #   define yystpcpy stpcpy
917 #  else
918 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
919    YYDEST.  */
920 #if (defined __STDC__ || defined __C99__FUNC__ \
921      || defined __cplusplus || defined _MSC_VER)
922 static char *
yystpcpy(char * yydest,const char * yysrc)923 yystpcpy (char *yydest, const char *yysrc)
924 #else
925 static char *
926 yystpcpy (yydest, yysrc)
927     char *yydest;
928     const char *yysrc;
929 #endif
930 {
931   char *yyd = yydest;
932   const char *yys = yysrc;
933 
934   while ((*yyd++ = *yys++) != '\0')
935     continue;
936 
937   return yyd - 1;
938 }
939 #  endif
940 # endif
941 
942 # ifndef yytnamerr
943 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
944    quotes and backslashes, so that it's suitable for yyerror.  The
945    heuristic is that double-quoting is unnecessary unless the string
946    contains an apostrophe, a comma, or backslash (other than
947    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
948    null, do not copy; instead, return the length of what the result
949    would have been.  */
950 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)951 yytnamerr (char *yyres, const char *yystr)
952 {
953   if (*yystr == '"')
954     {
955       YYSIZE_T yyn = 0;
956       char const *yyp = yystr;
957 
958       for (;;)
959 	switch (*++yyp)
960 	  {
961 	  case '\'':
962 	  case ',':
963 	    goto do_not_strip_quotes;
964 
965 	  case '\\':
966 	    if (*++yyp != '\\')
967 	      goto do_not_strip_quotes;
968 	    /* Fall through.  */
969 	  default:
970 	    if (yyres)
971 	      yyres[yyn] = *yyp;
972 	    yyn++;
973 	    break;
974 
975 	  case '"':
976 	    if (yyres)
977 	      yyres[yyn] = '\0';
978 	    return yyn;
979 	  }
980     do_not_strip_quotes: ;
981     }
982 
983   if (! yyres)
984     return yystrlen (yystr);
985 
986   return yystpcpy (yyres, yystr) - yyres;
987 }
988 # endif
989 
990 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
991    about the unexpected token YYTOKEN for the state stack whose top is
992    YYSSP.
993 
994    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
995    not large enough to hold the message.  In that case, also set
996    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
997    required number of bytes is too large to store.  */
998 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)999 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1000                 yytype_int16 *yyssp, int yytoken)
1001 {
1002   YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
1003   YYSIZE_T yysize = yysize0;
1004   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1005   /* Internationalized format string. */
1006   const char *yyformat = YY_NULL;
1007   /* Arguments of yyformat. */
1008   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1009   /* Number of reported tokens (one for the "unexpected", one per
1010      "expected"). */
1011   int yycount = 0;
1012 
1013   /* There are many possibilities here to consider:
1014      - Assume YYFAIL is not used.  It's too flawed to consider.  See
1015        <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1016        for details.  YYERROR is fine as it does not invoke this
1017        function.
1018      - If this state is a consistent state with a default action, then
1019        the only way this function was invoked is if the default action
1020        is an error action.  In that case, don't check for expected
1021        tokens because there are none.
1022      - The only way there can be no lookahead present (in yychar) is if
1023        this state is a consistent state with a default action.  Thus,
1024        detecting the absence of a lookahead is sufficient to determine
1025        that there is no unexpected or expected token to report.  In that
1026        case, just report a simple "syntax error".
1027      - Don't assume there isn't a lookahead just because this state is a
1028        consistent state with a default action.  There might have been a
1029        previous inconsistent state, consistent state with a non-default
1030        action, or user semantic action that manipulated yychar.
1031      - Of course, the expected token list depends on states to have
1032        correct lookahead information, and it depends on the parser not
1033        to perform extra reductions after fetching a lookahead from the
1034        scanner and before detecting a syntax error.  Thus, state merging
1035        (from LALR or IELR) and default reductions corrupt the expected
1036        token list.  However, the list is correct for canonical LR with
1037        one exception: it will still contain any token that will not be
1038        accepted due to an error action in a later state.
1039   */
1040   if (yytoken != YYEMPTY)
1041     {
1042       int yyn = yypact[*yyssp];
1043       yyarg[yycount++] = yytname[yytoken];
1044       if (!yypact_value_is_default (yyn))
1045         {
1046           /* Start YYX at -YYN if negative to avoid negative indexes in
1047              YYCHECK.  In other words, skip the first -YYN actions for
1048              this state because they are default actions.  */
1049           int yyxbegin = yyn < 0 ? -yyn : 0;
1050           /* Stay within bounds of both yycheck and yytname.  */
1051           int yychecklim = YYLAST - yyn + 1;
1052           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1053           int yyx;
1054 
1055           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1056             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1057                 && !yytable_value_is_error (yytable[yyx + yyn]))
1058               {
1059                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1060                   {
1061                     yycount = 1;
1062                     yysize = yysize0;
1063                     break;
1064                   }
1065                 yyarg[yycount++] = yytname[yyx];
1066                 {
1067                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1068                   if (! (yysize <= yysize1
1069                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1070                     return 2;
1071                   yysize = yysize1;
1072                 }
1073               }
1074         }
1075     }
1076 
1077   switch (yycount)
1078     {
1079 # define YYCASE_(N, S)                      \
1080       case N:                               \
1081         yyformat = S;                       \
1082       break
1083       YYCASE_(0, YY_("syntax error"));
1084       YYCASE_(1, YY_("syntax error, unexpected %s"));
1085       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1086       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1087       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1088       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1089 # undef YYCASE_
1090     }
1091 
1092   {
1093     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1094     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1095       return 2;
1096     yysize = yysize1;
1097   }
1098 
1099   if (*yymsg_alloc < yysize)
1100     {
1101       *yymsg_alloc = 2 * yysize;
1102       if (! (yysize <= *yymsg_alloc
1103              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1104         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1105       return 1;
1106     }
1107 
1108   /* Avoid sprintf, as that infringes on the user's name space.
1109      Don't have undefined behavior even if the translation
1110      produced a string with the wrong number of "%s"s.  */
1111   {
1112     char *yyp = *yymsg;
1113     int yyi = 0;
1114     while ((*yyp = *yyformat) != '\0')
1115       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1116         {
1117           yyp += yytnamerr (yyp, yyarg[yyi++]);
1118           yyformat += 2;
1119         }
1120       else
1121         {
1122           yyp++;
1123           yyformat++;
1124         }
1125   }
1126   return 0;
1127 }
1128 #endif /* YYERROR_VERBOSE */
1129 
1130 /*-----------------------------------------------.
1131 | Release the memory associated to this symbol.  |
1132 `-----------------------------------------------*/
1133 
1134 /*ARGSUSED*/
1135 #if (defined __STDC__ || defined __C99__FUNC__ \
1136      || defined __cplusplus || defined _MSC_VER)
1137 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1138 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1139 #else
1140 static void
1141 yydestruct (yymsg, yytype, yyvaluep)
1142     const char *yymsg;
1143     int yytype;
1144     YYSTYPE *yyvaluep;
1145 #endif
1146 {
1147   YYUSE (yyvaluep);
1148 
1149   if (!yymsg)
1150     yymsg = "Deleting";
1151   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1152 
1153   YYUSE (yytype);
1154 }
1155 
1156 
1157 
1158 
1159 /* The lookahead symbol.  */
1160 int yychar;
1161 
1162 
1163 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1164 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1165 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1166 #endif
1167 #ifndef YY_INITIAL_VALUE
1168 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1169 #endif
1170 
1171 /* The semantic value of the lookahead symbol.  */
1172 YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
1173 
1174 /* Number of syntax errors so far.  */
1175 int yynerrs;
1176 
1177 
1178 /*----------.
1179 | yyparse.  |
1180 `----------*/
1181 
1182 #ifdef YYPARSE_PARAM
1183 #if (defined __STDC__ || defined __C99__FUNC__ \
1184      || defined __cplusplus || defined _MSC_VER)
1185 int
yyparse(void * YYPARSE_PARAM)1186 yyparse (void *YYPARSE_PARAM)
1187 #else
1188 int
1189 yyparse (YYPARSE_PARAM)
1190     void *YYPARSE_PARAM;
1191 #endif
1192 #else /* ! YYPARSE_PARAM */
1193 #if (defined __STDC__ || defined __C99__FUNC__ \
1194      || defined __cplusplus || defined _MSC_VER)
1195 int
1196 yyparse (void)
1197 #else
1198 int
1199 yyparse ()
1200 
1201 #endif
1202 #endif
1203 {
1204     int yystate;
1205     /* Number of tokens to shift before error messages enabled.  */
1206     int yyerrstatus;
1207 
1208     /* The stacks and their tools:
1209        `yyss': related to states.
1210        `yyvs': related to semantic values.
1211 
1212        Refer to the stacks through separate pointers, to allow yyoverflow
1213        to reallocate them elsewhere.  */
1214 
1215     /* The state stack.  */
1216     yytype_int16 yyssa[YYINITDEPTH];
1217     yytype_int16 *yyss;
1218     yytype_int16 *yyssp;
1219 
1220     /* The semantic value stack.  */
1221     YYSTYPE yyvsa[YYINITDEPTH];
1222     YYSTYPE *yyvs;
1223     YYSTYPE *yyvsp;
1224 
1225     YYSIZE_T yystacksize;
1226 
1227   int yyn;
1228   int yyresult;
1229   /* Lookahead token as an internal (translated) token number.  */
1230   int yytoken = 0;
1231   /* The variables used to return semantic value and location from the
1232      action routines.  */
1233   YYSTYPE yyval;
1234 
1235 #if YYERROR_VERBOSE
1236   /* Buffer for error messages, and its allocated size.  */
1237   char yymsgbuf[128];
1238   char *yymsg = yymsgbuf;
1239   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1240 #endif
1241 
1242 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1243 
1244   /* The number of symbols on the RHS of the reduced rule.
1245      Keep to zero when no symbol should be popped.  */
1246   int yylen = 0;
1247 
1248   yyssp = yyss = yyssa;
1249   yyvsp = yyvs = yyvsa;
1250   yystacksize = YYINITDEPTH;
1251 
1252   YYDPRINTF ((stderr, "Starting parse\n"));
1253 
1254   yystate = 0;
1255   yyerrstatus = 0;
1256   yynerrs = 0;
1257   yychar = YYEMPTY; /* Cause a token to be read.  */
1258   goto yysetstate;
1259 
1260 /*------------------------------------------------------------.
1261 | yynewstate -- Push a new state, which is found in yystate.  |
1262 `------------------------------------------------------------*/
1263  yynewstate:
1264   /* In all cases, when you get here, the value and location stacks
1265      have just been pushed.  So pushing a state here evens the stacks.  */
1266   yyssp++;
1267 
1268  yysetstate:
1269   *yyssp = yystate;
1270 
1271   if (yyss + yystacksize - 1 <= yyssp)
1272     {
1273       /* Get the current used size of the three stacks, in elements.  */
1274       YYSIZE_T yysize = yyssp - yyss + 1;
1275 
1276 #ifdef yyoverflow
1277       {
1278 	/* Give user a chance to reallocate the stack.  Use copies of
1279 	   these so that the &'s don't force the real ones into
1280 	   memory.  */
1281 	YYSTYPE *yyvs1 = yyvs;
1282 	yytype_int16 *yyss1 = yyss;
1283 
1284 	/* Each stack pointer address is followed by the size of the
1285 	   data in use in that stack, in bytes.  This used to be a
1286 	   conditional around just the two extra args, but that might
1287 	   be undefined if yyoverflow is a macro.  */
1288 	yyoverflow (YY_("memory exhausted"),
1289 		    &yyss1, yysize * sizeof (*yyssp),
1290 		    &yyvs1, yysize * sizeof (*yyvsp),
1291 		    &yystacksize);
1292 
1293 	yyss = yyss1;
1294 	yyvs = yyvs1;
1295       }
1296 #else /* no yyoverflow */
1297 # ifndef YYSTACK_RELOCATE
1298       goto yyexhaustedlab;
1299 # else
1300       /* Extend the stack our own way.  */
1301       if (YYMAXDEPTH <= yystacksize)
1302 	goto yyexhaustedlab;
1303       yystacksize *= 2;
1304       if (YYMAXDEPTH < yystacksize)
1305 	yystacksize = YYMAXDEPTH;
1306 
1307       {
1308 	yytype_int16 *yyss1 = yyss;
1309 	union yyalloc *yyptr =
1310 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1311 	if (! yyptr)
1312 	  goto yyexhaustedlab;
1313 	YYSTACK_RELOCATE (yyss_alloc, yyss);
1314 	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1315 #  undef YYSTACK_RELOCATE
1316 	if (yyss1 != yyssa)
1317 	  YYSTACK_FREE (yyss1);
1318       }
1319 # endif
1320 #endif /* no yyoverflow */
1321 
1322       yyssp = yyss + yysize - 1;
1323       yyvsp = yyvs + yysize - 1;
1324 
1325       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1326 		  (unsigned long int) yystacksize));
1327 
1328       if (yyss + yystacksize - 1 <= yyssp)
1329 	YYABORT;
1330     }
1331 
1332   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1333 
1334   if (yystate == YYFINAL)
1335     YYACCEPT;
1336 
1337   goto yybackup;
1338 
1339 /*-----------.
1340 | yybackup.  |
1341 `-----------*/
1342 yybackup:
1343 
1344   /* Do appropriate processing given the current state.  Read a
1345      lookahead token if we need one and don't already have one.  */
1346 
1347   /* First try to decide what to do without reference to lookahead token.  */
1348   yyn = yypact[yystate];
1349   if (yypact_value_is_default (yyn))
1350     goto yydefault;
1351 
1352   /* Not known => get a lookahead token if don't already have one.  */
1353 
1354   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1355   if (yychar == YYEMPTY)
1356     {
1357       YYDPRINTF ((stderr, "Reading a token: "));
1358       yychar = YYLEX;
1359     }
1360 
1361   if (yychar <= YYEOF)
1362     {
1363       yychar = yytoken = YYEOF;
1364       YYDPRINTF ((stderr, "Now at end of input.\n"));
1365     }
1366   else
1367     {
1368       yytoken = YYTRANSLATE (yychar);
1369       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1370     }
1371 
1372   /* If the proper action on seeing token YYTOKEN is to reduce or to
1373      detect an error, take that action.  */
1374   yyn += yytoken;
1375   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1376     goto yydefault;
1377   yyn = yytable[yyn];
1378   if (yyn <= 0)
1379     {
1380       if (yytable_value_is_error (yyn))
1381         goto yyerrlab;
1382       yyn = -yyn;
1383       goto yyreduce;
1384     }
1385 
1386   /* Count tokens shifted since error; after three, turn off error
1387      status.  */
1388   if (yyerrstatus)
1389     yyerrstatus--;
1390 
1391   /* Shift the lookahead token.  */
1392   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1393 
1394   /* Discard the shifted token.  */
1395   yychar = YYEMPTY;
1396 
1397   yystate = yyn;
1398   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1399   *++yyvsp = yylval;
1400   YY_IGNORE_MAYBE_UNINITIALIZED_END
1401 
1402   goto yynewstate;
1403 
1404 
1405 /*-----------------------------------------------------------.
1406 | yydefault -- do the default action for the current state.  |
1407 `-----------------------------------------------------------*/
1408 yydefault:
1409   yyn = yydefact[yystate];
1410   if (yyn == 0)
1411     goto yyerrlab;
1412   goto yyreduce;
1413 
1414 
1415 /*-----------------------------.
1416 | yyreduce -- Do a reduction.  |
1417 `-----------------------------*/
1418 yyreduce:
1419   /* yyn is the number of a rule to reduce with.  */
1420   yylen = yyr2[yyn];
1421 
1422   /* If YYLEN is nonzero, implement the default value of the action:
1423      `$$ = $1'.
1424 
1425      Otherwise, the following line sets YYVAL to garbage.
1426      This behavior is undocumented and Bison
1427      users should not rely upon it.  Assigning to YYVAL
1428      unconditionally makes the parser a bit smaller, and it avoids a
1429      GCC warning that YYVAL may be used uninitialized.  */
1430   yyval = yyvsp[1-yylen];
1431 
1432 
1433   YY_REDUCE_PRINT (yyn);
1434   switch (yyn)
1435     {
1436         case 3:
1437 /* Line 1787 of yacc.c  */
1438 #line 70 "../../../../../src/lib/oogl/wa/fsaparse.y"
1439     { return(0); }
1440     break;
1441 
1442   case 4:
1443 /* Line 1787 of yacc.c  */
1444 #line 74 "../../../../../src/lib/oogl/wa/fsaparse.y"
1445     {
1446 		      fsa->nstates = (yyvsp[(2) - (2)].i);
1447 		      fsa->action =
1448 			(int**)malloc((fsa->nstates+1)*sizeof(int*));
1449 		    }
1450     break;
1451 
1452   case 5:
1453 /* Line 1787 of yacc.c  */
1454 #line 82 "../../../../../src/lib/oogl/wa/fsaparse.y"
1455     {
1456 		      int i,j;
1457 		      fsa->ngens = (yyvsp[(2) - (2)].i);
1458 		      for (i=0; i<=fsa->nstates; ++i) {
1459 			fsa->action[i] =
1460 			  (int*)malloc((fsa->ngens+1)*sizeof(int));
1461 			for (j=0; j<=fsa->ngens; ++j)
1462 			  fsa->action[i][j] = 0;
1463 		      }
1464 		      fsa->genlist=(char**)malloc(fsa->ngens*sizeof(char*));
1465 		      for (i=0; i<fsa->ngens; ++i)
1466 			fsa->genlist[i] = "";
1467 		    }
1468     break;
1469 
1470   case 14:
1471 /* Line 1787 of yacc.c  */
1472 #line 116 "../../../../../src/lib/oogl/wa/fsaparse.y"
1473     {
1474 		      fsa->start= (yyvsp[(1) - (1)].i);
1475 		    }
1476     break;
1477 
1478   case 18:
1479 /* Line 1787 of yacc.c  */
1480 #line 129 "../../../../../src/lib/oogl/wa/fsaparse.y"
1481     {
1482 		      fsa->genlist[(yyvsp[(1) - (3)].i)-1] =
1483 			(char*)malloc((strlen((yyvsp[(3) - (3)].s))+1)*sizeof(char));
1484 		      strcpy(fsa->genlist[(yyvsp[(1) - (3)].i)-1], (yyvsp[(3) - (3)].s));
1485 		    }
1486     break;
1487 
1488   case 19:
1489 /* Line 1787 of yacc.c  */
1490 #line 137 "../../../../../src/lib/oogl/wa/fsaparse.y"
1491     { (yyval.i) = (yyvsp[(3) - (4)].i); }
1492     break;
1493 
1494   case 20:
1495 /* Line 1787 of yacc.c  */
1496 #line 139 "../../../../../src/lib/oogl/wa/fsaparse.y"
1497     { (yyval.i) = (yyvsp[(3) - (5)].i); }
1498     break;
1499 
1500   case 27:
1501 /* Line 1787 of yacc.c  */
1502 #line 157 "../../../../../src/lib/oogl/wa/fsaparse.y"
1503     { install_adjacency((yyvsp[(1) - (4)].i)); adj_index = 0; }
1504     break;
1505 
1506   case 28:
1507 /* Line 1787 of yacc.c  */
1508 #line 161 "../../../../../src/lib/oogl/wa/fsaparse.y"
1509     {
1510 		    adj[adj_index++] = (yyvsp[(1) - (1)].i);
1511 		  }
1512     break;
1513 
1514   case 29:
1515 /* Line 1787 of yacc.c  */
1516 #line 165 "../../../../../src/lib/oogl/wa/fsaparse.y"
1517     {
1518 		    adj[adj_index++] = (yyvsp[(2) - (2)].i);
1519 		  }
1520     break;
1521 
1522 
1523 /* Line 1787 of yacc.c  */
1524 #line 1525 "y.tab.c"
1525       default: break;
1526     }
1527   /* User semantic actions sometimes alter yychar, and that requires
1528      that yytoken be updated with the new translation.  We take the
1529      approach of translating immediately before every use of yytoken.
1530      One alternative is translating here after every semantic action,
1531      but that translation would be missed if the semantic action invokes
1532      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1533      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1534      incorrect destructor might then be invoked immediately.  In the
1535      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1536      to an incorrect destructor call or verbose syntax error message
1537      before the lookahead is translated.  */
1538   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1539 
1540   YYPOPSTACK (yylen);
1541   yylen = 0;
1542   YY_STACK_PRINT (yyss, yyssp);
1543 
1544   *++yyvsp = yyval;
1545 
1546   /* Now `shift' the result of the reduction.  Determine what state
1547      that goes to, based on the state we popped back to and the rule
1548      number reduced by.  */
1549 
1550   yyn = yyr1[yyn];
1551 
1552   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1553   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1554     yystate = yytable[yystate];
1555   else
1556     yystate = yydefgoto[yyn - YYNTOKENS];
1557 
1558   goto yynewstate;
1559 
1560 
1561 /*------------------------------------.
1562 | yyerrlab -- here on detecting error |
1563 `------------------------------------*/
1564 yyerrlab:
1565   /* Make sure we have latest lookahead translation.  See comments at
1566      user semantic actions for why this is necessary.  */
1567   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1568 
1569   /* If not already recovering from an error, report this error.  */
1570   if (!yyerrstatus)
1571     {
1572       ++yynerrs;
1573 #if ! YYERROR_VERBOSE
1574       yyerror (YY_("syntax error"));
1575 #else
1576 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1577                                         yyssp, yytoken)
1578       {
1579         char const *yymsgp = YY_("syntax error");
1580         int yysyntax_error_status;
1581         yysyntax_error_status = YYSYNTAX_ERROR;
1582         if (yysyntax_error_status == 0)
1583           yymsgp = yymsg;
1584         else if (yysyntax_error_status == 1)
1585           {
1586             if (yymsg != yymsgbuf)
1587               YYSTACK_FREE (yymsg);
1588             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1589             if (!yymsg)
1590               {
1591                 yymsg = yymsgbuf;
1592                 yymsg_alloc = sizeof yymsgbuf;
1593                 yysyntax_error_status = 2;
1594               }
1595             else
1596               {
1597                 yysyntax_error_status = YYSYNTAX_ERROR;
1598                 yymsgp = yymsg;
1599               }
1600           }
1601         yyerror (yymsgp);
1602         if (yysyntax_error_status == 2)
1603           goto yyexhaustedlab;
1604       }
1605 # undef YYSYNTAX_ERROR
1606 #endif
1607     }
1608 
1609 
1610 
1611   if (yyerrstatus == 3)
1612     {
1613       /* If just tried and failed to reuse lookahead token after an
1614 	 error, discard it.  */
1615 
1616       if (yychar <= YYEOF)
1617 	{
1618 	  /* Return failure if at end of input.  */
1619 	  if (yychar == YYEOF)
1620 	    YYABORT;
1621 	}
1622       else
1623 	{
1624 	  yydestruct ("Error: discarding",
1625 		      yytoken, &yylval);
1626 	  yychar = YYEMPTY;
1627 	}
1628     }
1629 
1630   /* Else will try to reuse lookahead token after shifting the error
1631      token.  */
1632   goto yyerrlab1;
1633 
1634 
1635 /*---------------------------------------------------.
1636 | yyerrorlab -- error raised explicitly by YYERROR.  |
1637 `---------------------------------------------------*/
1638 yyerrorlab:
1639 
1640   /* Pacify compilers like GCC when the user code never invokes
1641      YYERROR and the label yyerrorlab therefore never appears in user
1642      code.  */
1643   if (/*CONSTCOND*/ 0)
1644      goto yyerrorlab;
1645 
1646   /* Do not reclaim the symbols of the rule which action triggered
1647      this YYERROR.  */
1648   YYPOPSTACK (yylen);
1649   yylen = 0;
1650   YY_STACK_PRINT (yyss, yyssp);
1651   yystate = *yyssp;
1652   goto yyerrlab1;
1653 
1654 
1655 /*-------------------------------------------------------------.
1656 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1657 `-------------------------------------------------------------*/
1658 yyerrlab1:
1659   yyerrstatus = 3;	/* Each real token shifted decrements this.  */
1660 
1661   for (;;)
1662     {
1663       yyn = yypact[yystate];
1664       if (!yypact_value_is_default (yyn))
1665 	{
1666 	  yyn += YYTERROR;
1667 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1668 	    {
1669 	      yyn = yytable[yyn];
1670 	      if (0 < yyn)
1671 		break;
1672 	    }
1673 	}
1674 
1675       /* Pop the current state because it cannot handle the error token.  */
1676       if (yyssp == yyss)
1677 	YYABORT;
1678 
1679 
1680       yydestruct ("Error: popping",
1681 		  yystos[yystate], yyvsp);
1682       YYPOPSTACK (1);
1683       yystate = *yyssp;
1684       YY_STACK_PRINT (yyss, yyssp);
1685     }
1686 
1687   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1688   *++yyvsp = yylval;
1689   YY_IGNORE_MAYBE_UNINITIALIZED_END
1690 
1691 
1692   /* Shift the error token.  */
1693   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1694 
1695   yystate = yyn;
1696   goto yynewstate;
1697 
1698 
1699 /*-------------------------------------.
1700 | yyacceptlab -- YYACCEPT comes here.  |
1701 `-------------------------------------*/
1702 yyacceptlab:
1703   yyresult = 0;
1704   goto yyreturn;
1705 
1706 /*-----------------------------------.
1707 | yyabortlab -- YYABORT comes here.  |
1708 `-----------------------------------*/
1709 yyabortlab:
1710   yyresult = 1;
1711   goto yyreturn;
1712 
1713 #if !defined yyoverflow || YYERROR_VERBOSE
1714 /*-------------------------------------------------.
1715 | yyexhaustedlab -- memory exhaustion comes here.  |
1716 `-------------------------------------------------*/
1717 yyexhaustedlab:
1718   yyerror (YY_("memory exhausted"));
1719   yyresult = 2;
1720   /* Fall through.  */
1721 #endif
1722 
1723 yyreturn:
1724   if (yychar != YYEMPTY)
1725     {
1726       /* Make sure we have latest lookahead translation.  See comments at
1727          user semantic actions for why this is necessary.  */
1728       yytoken = YYTRANSLATE (yychar);
1729       yydestruct ("Cleanup: discarding lookahead",
1730                   yytoken, &yylval);
1731     }
1732   /* Do not reclaim the symbols of the rule which action triggered
1733      this YYABORT or YYACCEPT.  */
1734   YYPOPSTACK (yylen);
1735   YY_STACK_PRINT (yyss, yyssp);
1736   while (yyssp != yyss)
1737     {
1738       yydestruct ("Cleanup: popping",
1739 		  yystos[*yyssp], yyvsp);
1740       YYPOPSTACK (1);
1741     }
1742 #ifndef yyoverflow
1743   if (yyss != yyssa)
1744     YYSTACK_FREE (yyss);
1745 #endif
1746 #if YYERROR_VERBOSE
1747   if (yymsg != yymsgbuf)
1748     YYSTACK_FREE (yymsg);
1749 #endif
1750   /* Make sure YYID is used.  */
1751   return YYID (yyresult);
1752 }
1753 
1754 
1755 /* Line 2050 of yacc.c  */
1756 #line 171 "../../../../../src/lib/oogl/wa/fsaparse.y"
1757 
1758 
yyerror(char * s)1759 static void yyerror(char *s)
1760 {
1761   printf("yyerror: %s\n", s);
1762 }
1763 
1764 static void
install_adjacency(n)1765   install_adjacency(n)
1766 int n;
1767 {
1768   int i;
1769 
1770   for (i=0; i<adj_index; ++i)
1771     fsa->action[n][i+1] = adj[i];
1772 }
1773 
1774 void
parse_init(f)1775 parse_init(f)
1776      wa *f;
1777 {
1778   fsa = f;
1779 
1780   fsa->fail = fsa->state = 0;
1781 }
1782 
1783 /*-----------------------------------------------------------------------
1784  * Function:	fsaparse
1785  * Description:	parse a .wa file into an wa struct
1786  * Args  IN:	fp: .wa file pointer
1787  *      OUT:	*fsa: the resulting fsa struct
1788  * Returns:	1 for success, 0 for error
1789  * Author:	mbp
1790  * Date:	Sat Mar 23 21:47:04 1991
1791  * Notes:	Does not recognize the full grammar defined by
1792  *		"Data Exchange for Automatic Groups".  Only recognizes
1793  *		files of the form used by several examples I was
1794  *		using at the time I wrote this.  I think, but am not
1795  *		at all sure, that this includes all word-acceptor
1796  *		automata.
1797  */
1798 int
fsaparse(fp,fsa)1799   fsaparse(fp, fsa)
1800 FILE *fp;
1801 wa *fsa;
1802 {
1803   extern FILE *yyin;
1804   int ret;
1805 
1806   parse_init(fsa);
1807 
1808   yyin = fp;
1809   ret = yyparse();
1810 
1811   return(ret ==0);
1812 }
1813