1 /* A Bison parser, made by GNU Bison 3.0.2. */
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 "3.0.2"
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 /* Substitute the variable and function names. */
63 #define yyparse scotchyyparse
64 #define yylex scotchyylex
65 #define yyerror scotchyyerror
66 #define yydebug scotchyydebug
67 #define yynerrs scotchyynerrs
68
69 #define yylval scotchyylval
70 #define yychar scotchyychar
71
72 /* Copy the first part of user declarations. */
73 #line 1 "parser_yy.y" /* yacc.c:339 */
74
75 /* Copyright 2004,2007,2008,2011,2014 IPB, Universite de Bordeaux, INRIA & CNRS
76 **
77 ** This file is part of the Scotch software package for static mapping,
78 ** graph partitioning and sparse matrix ordering.
79 **
80 ** This software is governed by the CeCILL-C license under French law
81 ** and abiding by the rules of distribution of free software. You can
82 ** use, modify and/or redistribute the software under the terms of the
83 ** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
84 ** URL: "http://www.cecill.info".
85 **
86 ** As a counterpart to the access to the source code and rights to copy,
87 ** modify and redistribute granted by the license, users are provided
88 ** only with a limited warranty and the software's author, the holder of
89 ** the economic rights, and the successive licensors have only limited
90 ** liability.
91 **
92 ** In this respect, the user's attention is drawn to the risks associated
93 ** with loading, using, modifying and/or developing or reproducing the
94 ** software by the user in light of its specific status of free software,
95 ** that may mean that it is complicated to manipulate, and that also
96 ** therefore means that it is reserved for developers and experienced
97 ** professionals having in-depth computer knowledge. Users are therefore
98 ** encouraged to load and test the software's suitability as regards
99 ** their requirements in conditions enabling the security of their
100 ** systems and/or data to be ensured and, more generally, to use and
101 ** operate it in the same conditions as regards security.
102 **
103 ** The fact that you are presently reading this means that you have had
104 ** knowledge of the CeCILL-C license and that you accept its terms.
105 */
106 /************************************************************/
107 /** **/
108 /** NAME : parser_yy.y **/
109 /** **/
110 /** AUTHOR : Francois PELLEGRINI **/
111 /** **/
112 /** FUNCTION : This module is the syntactic parser **/
113 /** which processes strategy strings. **/
114 /** **/
115 /** DATES : # Version 3.1 : from : 07 nov 1995 **/
116 /** to 13 jun 1996 **/
117 /** # Version 3.2 : from : 24 sep 1996 **/
118 /** to 27 feb 1997 **/
119 /** # Version 3.3 : from : 01 oct 1998 **/
120 /** to 01 oct 1998 **/
121 /** # Version 4.0 : from : 20 dec 2001 **/
122 /** to 11 jun 2004 **/
123 /** # Version 5.1 : from : 30 oct 2007 **/
124 /** to 24 jul 2011 **/
125 /** # Version 6.0 : from : 30 sep 2014 **/
126 /** to 30 sep 2014 **/
127 /** **/
128 /************************************************************/
129
130 /*
131 ** The defines and includes.
132 */
133
134 #define PARSER_YY
135
136 #include "module.h"
137 #include "common.h"
138
139 #undef INTEGER /* In case someone defined them */
140 #undef DOUBLE
141
142 #include "parser.h"
143 #include "parser_ll.h"
144 #include "parser_yy.h"
145
146 /* #define SCOTCH_DEBUG_PARSER3 */
147 #ifdef SCOTCH_DEBUG_PARSER3
148 extern int yydebug;
149 #define YYDEBUG 1
150 #endif /* SCOTCH_DEBUG_PARSER3 */
151
152 /*
153 ** The static and global definitions.
154 ** See also at the end of this file.
155 */
156
157 static const StratTab * parserstrattab; /* Pointer to parsing tables */
158 static Strat * parserstratcurr = NULL; /* Pointer to current strategy node */
159 static StratParamTab * parserparamcurr = NULL; /* Pointer to current parameter */
160
161 extern unsigned int parsermethtokentab[]; /* Pre-definition for stupid compilers */
162
163
164 #line 165 "y.tab.c" /* yacc.c:339 */
165
166 # ifndef YY_NULLPTR
167 # if defined __cplusplus && 201103L <= __cplusplus
168 # define YY_NULLPTR nullptr
169 # else
170 # define YY_NULLPTR 0
171 # endif
172 # endif
173
174 /* Enabling verbose error messages. */
175 #ifdef YYERROR_VERBOSE
176 # undef YYERROR_VERBOSE
177 # define YYERROR_VERBOSE 1
178 #else
179 # define YYERROR_VERBOSE 0
180 #endif
181
182 /* In a future release of Bison, this section will be replaced
183 by #include "y.tab.h". */
184 #ifndef YY_SCOTCHYY_Y_TAB_H_INCLUDED
185 # define YY_SCOTCHYY_Y_TAB_H_INCLUDED
186 /* Debug traces. */
187 #ifndef YYDEBUG
188 # define YYDEBUG 0
189 #endif
190 #if YYDEBUG
191 extern int scotchyydebug;
192 #endif
193
194 /* Token type. */
195 #ifndef YYTOKENTYPE
196 # define YYTOKENTYPE
197 enum yytokentype
198 {
199 METHODNAME = 258,
200 PARAMNAME = 259,
201 VALCASE = 260,
202 VALDOUBLE = 261,
203 VALINT = 262,
204 VALSTRING = 263,
205 VALSTRAT = 264,
206 VALPARAM = 265,
207 VALTEST = 266
208 };
209 #endif
210 /* Tokens. */
211 #define METHODNAME 258
212 #define PARAMNAME 259
213 #define VALCASE 260
214 #define VALDOUBLE 261
215 #define VALINT 262
216 #define VALSTRING 263
217 #define VALSTRAT 264
218 #define VALPARAM 265
219 #define VALTEST 266
220
221 /* Value type. */
222 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
223 typedef union YYSTYPE YYSTYPE;
224 union YYSTYPE
225 {
226 #line 92 "parser_yy.y" /* yacc.c:355 */
227
228 char CASEVAL; /* Case value */
229 StratTest * TEST; /* Test type */
230 StratTestType TESTOP; /* Relational type */
231 double DOUBLE; /* Double-precision */
232 INT INTEGER; /* Integer */
233 char STRING[PARSERSTRINGLEN]; /* Character string */
234 struct {
235 const StratTab * tabl; /* Current tables */
236 Strat * strat; /* Current method */
237 StratParamTab * param; /* Current parameter */
238 } SAVE; /* Parameter type */
239 Strat * STRAT; /* Strategy tree */
240
241 #line 242 "y.tab.c" /* yacc.c:355 */
242 };
243 # define YYSTYPE_IS_TRIVIAL 1
244 # define YYSTYPE_IS_DECLARED 1
245 #endif
246
247
248 extern YYSTYPE scotchyylval;
249
250 int scotchyyparse (void);
251
252 #endif /* !YY_SCOTCHYY_Y_TAB_H_INCLUDED */
253
254 /* Copy the second part of user declarations. */
255
256 #line 257 "y.tab.c" /* yacc.c:358 */
257
258 #ifdef short
259 # undef short
260 #endif
261
262 #ifdef YYTYPE_UINT8
263 typedef YYTYPE_UINT8 yytype_uint8;
264 #else
265 typedef unsigned char yytype_uint8;
266 #endif
267
268 #ifdef YYTYPE_INT8
269 typedef YYTYPE_INT8 yytype_int8;
270 #else
271 typedef signed char yytype_int8;
272 #endif
273
274 #ifdef YYTYPE_UINT16
275 typedef YYTYPE_UINT16 yytype_uint16;
276 #else
277 typedef unsigned short int yytype_uint16;
278 #endif
279
280 #ifdef YYTYPE_INT16
281 typedef YYTYPE_INT16 yytype_int16;
282 #else
283 typedef short int yytype_int16;
284 #endif
285
286 #ifndef YYSIZE_T
287 # ifdef __SIZE_TYPE__
288 # define YYSIZE_T __SIZE_TYPE__
289 # elif defined size_t
290 # define YYSIZE_T size_t
291 # elif ! defined YYSIZE_T
292 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
293 # define YYSIZE_T size_t
294 # else
295 # define YYSIZE_T unsigned int
296 # endif
297 #endif
298
299 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
300
301 #ifndef YY_
302 # if defined YYENABLE_NLS && YYENABLE_NLS
303 # if ENABLE_NLS
304 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
305 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
306 # endif
307 # endif
308 # ifndef YY_
309 # define YY_(Msgid) Msgid
310 # endif
311 #endif
312
313 #ifndef YY_ATTRIBUTE
314 # if (defined __GNUC__ \
315 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
316 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
317 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
318 # else
319 # define YY_ATTRIBUTE(Spec) /* empty */
320 # endif
321 #endif
322
323 #ifndef YY_ATTRIBUTE_PURE
324 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
325 #endif
326
327 #ifndef YY_ATTRIBUTE_UNUSED
328 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
329 #endif
330
331 #if !defined _Noreturn \
332 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
333 # if defined _MSC_VER && 1200 <= _MSC_VER
334 # define _Noreturn __declspec (noreturn)
335 # else
336 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
337 # endif
338 #endif
339
340 /* Suppress unused-variable warnings by "using" E. */
341 #if ! defined lint || defined __GNUC__
342 # define YYUSE(E) ((void) (E))
343 #else
344 # define YYUSE(E) /* empty */
345 #endif
346
347 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
348 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
349 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
350 _Pragma ("GCC diagnostic push") \
351 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
352 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
353 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
354 _Pragma ("GCC diagnostic pop")
355 #else
356 # define YY_INITIAL_VALUE(Value) Value
357 #endif
358 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
359 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
360 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
361 #endif
362 #ifndef YY_INITIAL_VALUE
363 # define YY_INITIAL_VALUE(Value) /* Nothing. */
364 #endif
365
366
367 #if ! defined yyoverflow || YYERROR_VERBOSE
368
369 /* The parser invokes alloca or malloc; define the necessary symbols. */
370
371 # ifdef YYSTACK_USE_ALLOCA
372 # if YYSTACK_USE_ALLOCA
373 # ifdef __GNUC__
374 # define YYSTACK_ALLOC __builtin_alloca
375 # elif defined __BUILTIN_VA_ARG_INCR
376 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
377 # elif defined _AIX
378 # define YYSTACK_ALLOC __alloca
379 # elif defined _MSC_VER
380 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
381 # define alloca _alloca
382 # else
383 # define YYSTACK_ALLOC alloca
384 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
385 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
386 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
387 # ifndef EXIT_SUCCESS
388 # define EXIT_SUCCESS 0
389 # endif
390 # endif
391 # endif
392 # endif
393 # endif
394
395 # ifdef YYSTACK_ALLOC
396 /* Pacify GCC's 'empty if-body' warning. */
397 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
398 # ifndef YYSTACK_ALLOC_MAXIMUM
399 /* The OS might guarantee only one guard page at the bottom of the stack,
400 and a page size can be as small as 4096 bytes. So we cannot safely
401 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
402 to allow for a few compiler-allocated temporary stack slots. */
403 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
404 # endif
405 # else
406 # define YYSTACK_ALLOC YYMALLOC
407 # define YYSTACK_FREE YYFREE
408 # ifndef YYSTACK_ALLOC_MAXIMUM
409 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
410 # endif
411 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
412 && ! ((defined YYMALLOC || defined malloc) \
413 && (defined YYFREE || defined free)))
414 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
415 # ifndef EXIT_SUCCESS
416 # define EXIT_SUCCESS 0
417 # endif
418 # endif
419 # ifndef YYMALLOC
420 # define YYMALLOC malloc
421 # if ! defined malloc && ! defined EXIT_SUCCESS
422 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
423 # endif
424 # endif
425 # ifndef YYFREE
426 # define YYFREE free
427 # if ! defined free && ! defined EXIT_SUCCESS
428 void free (void *); /* INFRINGES ON USER NAME SPACE */
429 # endif
430 # endif
431 # endif
432 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
433
434
435 #if (! defined yyoverflow \
436 && (! defined __cplusplus \
437 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
438
439 /* A type that is properly aligned for any stack member. */
440 union yyalloc
441 {
442 yytype_int16 yyss_alloc;
443 YYSTYPE yyvs_alloc;
444 };
445
446 /* The size of the maximum gap between one aligned stack and the next. */
447 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
448
449 /* The size of an array large to enough to hold all stacks, each with
450 N elements. */
451 # define YYSTACK_BYTES(N) \
452 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
453 + YYSTACK_GAP_MAXIMUM)
454
455 # define YYCOPY_NEEDED 1
456
457 /* Relocate STACK from its old location to the new one. The
458 local variables YYSIZE and YYSTACKSIZE give the old and new number of
459 elements in the stack, and YYPTR gives the new location of the
460 stack. Advance YYPTR to a properly aligned location for the next
461 stack. */
462 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
463 do \
464 { \
465 YYSIZE_T yynewbytes; \
466 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
467 Stack = &yyptr->Stack_alloc; \
468 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
469 yyptr += yynewbytes / sizeof (*yyptr); \
470 } \
471 while (0)
472
473 #endif
474
475 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
476 /* Copy COUNT objects from SRC to DST. The source and destination do
477 not overlap. */
478 # ifndef YYCOPY
479 # if defined __GNUC__ && 1 < __GNUC__
480 # define YYCOPY(Dst, Src, Count) \
481 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
482 # else
483 # define YYCOPY(Dst, Src, Count) \
484 do \
485 { \
486 YYSIZE_T yyi; \
487 for (yyi = 0; yyi < (Count); yyi++) \
488 (Dst)[yyi] = (Src)[yyi]; \
489 } \
490 while (0)
491 # endif
492 # endif
493 #endif /* !YYCOPY_NEEDED */
494
495 /* YYFINAL -- State number of the termination state. */
496 #define YYFINAL 13
497 /* YYLAST -- Last index in YYTABLE. */
498 #define YYLAST 93
499
500 /* YYNTOKENS -- Number of terminals. */
501 #define YYNTOKENS 31
502 /* YYNNTS -- Number of nonterminals. */
503 #define YYNNTS 37
504 /* YYNRULES -- Number of rules. */
505 #define YYNRULES 65
506 /* YYNSTATES -- Number of states. */
507 #define YYNSTATES 93
508
509 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
510 by yylex, with out-of-bounds checking. */
511 #define YYUNDEFTOK 2
512 #define YYMAXUTOK 266
513
514 #define YYTRANSLATE(YYX) \
515 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
516
517 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
518 as returned by yylex, without out-of-bounds checking. */
519 static const yytype_uint8 yytranslate[] =
520 {
521 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 24, 2, 2, 2, 30, 23, 2,
525 17, 18, 29, 27, 21, 28, 2, 13, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 16, 15,
527 25, 22, 26, 14, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 19, 12, 20, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
547 5, 6, 7, 8, 9, 10, 11
548 };
549
550 #if YYDEBUG
551 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
552 static const yytype_uint16 yyrline[] =
553 {
554 0, 132, 132, 138, 156, 159, 161, 176, 194, 198,
555 202, 198, 226, 229, 234, 239, 243, 247, 246, 308,
556 312, 308, 316, 319, 320, 324, 323, 362, 397, 412,
557 427, 444, 444, 468, 476, 479, 497, 500, 518, 521,
558 537, 541, 544, 563, 567, 571, 577, 593, 596, 600,
559 606, 622, 625, 631, 647, 650, 656, 660, 661, 664,
560 679, 696, 737, 741, 744, 748
561 };
562 #endif
563
564 #if YYDEBUG || YYERROR_VERBOSE || 0
565 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
566 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
567 static const char *const yytname[] =
568 {
569 "$end", "error", "$undefined", "METHODNAME", "PARAMNAME", "VALCASE",
570 "VALDOUBLE", "VALINT", "VALSTRING", "VALSTRAT", "VALPARAM", "VALTEST",
571 "'|'", "'/'", "'?'", "';'", "':'", "'('", "')'", "'{'", "'}'", "','",
572 "'='", "'&'", "'!'", "'<'", "'>'", "'+'", "'-'", "'*'", "'%'", "$accept",
573 "STRAT", "STRATSELECT", "STRATEMPTY", "STRATCONCAT", "STRATTEST", "$@1",
574 "$@2", "STRATTESTELSE", "STRATGROUP", "STRATMETHOD", "$@3",
575 "METHODPARAM", "$@4", "$@5", "PARAMLIST", "PARAMPARAM", "@6", "PARAMVAL",
576 "@7", "TEST", "TESTOR", "TESTAND", "TESTNOT", "TESTREL", "TESTRELOP",
577 "TESTEXPR1", "TESTEXPR1OP", "TESTEXPR2", "TESTEXPR2OP", "TESTEXPR3",
578 "TESTEXPR3OP", "TESTEXPR4", "TESTVAL", "TESTVAR", "VALSDOUBLE",
579 "VALSINT", YY_NULLPTR
580 };
581 #endif
582
583 # ifdef YYPRINT
584 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
585 (internal) symbol number NUM (which must be that of a token). */
586 static const yytype_uint16 yytoknum[] =
587 {
588 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
589 265, 266, 124, 47, 63, 59, 58, 40, 41, 123,
590 125, 44, 61, 38, 33, 60, 62, 43, 45, 42,
591 37
592 };
593 # endif
594
595 #define YYPACT_NINF -33
596
597 #define yypact_value_is_default(Yystate) \
598 (!!((Yystate) == (-33)))
599
600 #define YYTABLE_NINF -32
601
602 #define yytable_value_is_error(Yytable_value) \
603 0
604
605 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
606 STATE-NUM. */
607 static const yytype_int8 yypact[] =
608 {
609 5, -33, 5, 10, 7, -33, 5, -33, 4, -33,
610 -33, 19, 40, -33, 5, -33, 27, -33, 20, -33,
611 -33, -33, -33, -33, 27, 27, -33, -33, -33, 28,
612 3, -33, -33, 47, -1, 33, 13, -33, -33, -33,
613 -33, -33, 44, 41, 39, -33, 42, 27, 27, -33,
614 -33, -33, 43, 43, -33, -33, -33, 43, -33, 43,
615 -33, 55, -33, -33, -33, 5, 3, -33, 43, -4,
616 33, 13, -33, 46, 44, 57, -9, 14, 8, -33,
617 -33, 5, 63, -33, -33, -33, -33, 5, -33, -33,
618 7, -33, 7
619 };
620
621 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
622 Performed when YYTABLE does not specify something else to do. Zero
623 means the default is an error. */
624 static const yytype_uint8 yydefact[] =
625 {
626 6, 17, 6, 0, 2, 4, 5, 8, 0, 12,
627 16, 22, 0, 1, 6, 7, 0, 18, 0, 15,
628 3, 61, 63, 65, 0, 0, 48, 49, 10, 34,
629 36, 38, 41, 0, 0, 47, 51, 54, 57, 58,
630 59, 60, 0, 0, 0, 39, 0, 0, 0, 44,
631 43, 45, 0, 0, 62, 64, 52, 0, 55, 0,
632 25, 20, 24, 40, 56, 6, 35, 37, 0, 42,
633 46, 50, 53, 0, 0, 0, 14, 0, 0, 23,
634 21, 6, 0, 33, 27, 30, 26, 6, 28, 29,
635 13, 11, 32
636 };
637
638 /* YYPGOTO[NTERM-NUM]. */
639 static const yytype_int8 yypgoto[] =
640 {
641 -33, -33, -2, 66, -33, 75, -33, -33, -33, -33,
642 -33, -33, -33, -33, -33, -33, 9, -33, -33, -33,
643 -33, 58, 37, -21, -33, -33, -22, -32, 34, -33,
644 29, -33, 30, -33, -33, 12, 15
645 };
646
647 /* YYDEFGOTO[NTERM-NUM]. */
648 static const yytype_int8 yydefgoto[] =
649 {
650 -1, 3, 4, 5, 6, 7, 8, 46, 82, 9,
651 10, 11, 17, 18, 75, 61, 62, 73, 86, 87,
652 28, 29, 30, 31, 32, 52, 33, 34, 35, 57,
653 36, 59, 37, 38, 39, 40, 41
654 };
655
656 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
657 positive, shift that token. If negative, reduce the rule whose
658 number is the opposite. If YYTABLE_NINF, syntax error. */
659 static const yytype_int8 yytable[] =
660 {
661 12, 53, 44, 14, 45, 54, 55, 81, 1, 83,
662 13, -31, 53, 84, 22, 23, 85, 16, -9, 14,
663 -31, -31, 2, 26, 27, -31, 48, 67, -31, -31,
664 69, 21, 64, 22, 23, 26, 27, 53, -19, 42,
665 47, 26, 27, 58, 24, 53, 77, 21, 60, 22,
666 23, 25, 14, 47, 26, 27, 65, 64, 19, 63,
667 68, 49, 56, 76, 50, 51, 26, 27, 78, 49,
668 26, 27, 50, 51, 26, 27, 74, 80, 91, 90,
669 20, 15, 43, 79, 66, 92, 71, 70, 0, 72,
670 88, 0, 0, 89
671 };
672
673 static const yytype_int8 yycheck[] =
674 {
675 2, 33, 24, 12, 25, 6, 7, 16, 3, 1,
676 0, 3, 44, 5, 6, 7, 8, 13, 13, 12,
677 12, 13, 17, 27, 28, 17, 23, 48, 20, 21,
678 52, 4, 18, 6, 7, 27, 28, 69, 19, 19,
679 12, 27, 28, 30, 17, 77, 68, 4, 4, 6,
680 7, 24, 12, 12, 27, 28, 14, 18, 18, 18,
681 17, 22, 29, 65, 25, 26, 27, 28, 22, 22,
682 27, 28, 25, 26, 27, 28, 21, 20, 15, 81,
683 14, 6, 24, 74, 47, 87, 57, 53, -1, 59,
684 78, -1, -1, 78
685 };
686
687 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
688 symbol of state STATE-NUM. */
689 static const yytype_uint8 yystos[] =
690 {
691 0, 3, 17, 32, 33, 34, 35, 36, 37, 40,
692 41, 42, 33, 0, 12, 36, 13, 43, 44, 18,
693 34, 4, 6, 7, 17, 24, 27, 28, 51, 52,
694 53, 54, 55, 57, 58, 59, 61, 63, 64, 65,
695 66, 67, 19, 52, 57, 54, 38, 12, 23, 22,
696 25, 26, 56, 58, 6, 7, 29, 60, 30, 62,
697 4, 46, 47, 18, 18, 14, 53, 54, 17, 57,
698 59, 61, 63, 48, 21, 45, 33, 57, 22, 47,
699 20, 16, 39, 1, 5, 8, 49, 50, 66, 67,
700 33, 15, 33
701 };
702
703 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
704 static const yytype_uint8 yyr1[] =
705 {
706 0, 31, 32, 33, 33, 34, 34, 35, 35, 37,
707 38, 36, 36, 39, 39, 40, 40, 42, 41, 44,
708 45, 43, 43, 46, 46, 48, 47, 49, 49, 49,
709 49, 50, 49, 49, 51, 52, 52, 53, 53, 54,
710 54, 54, 55, 56, 56, 56, 57, 57, 58, 58,
711 59, 59, 60, 61, 61, 62, 63, 63, 63, 64,
712 64, 65, 66, 66, 67, 67
713 };
714
715 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
716 static const yytype_uint8 yyr2[] =
717 {
718 0, 2, 1, 3, 1, 1, 0, 2, 1, 0,
719 0, 8, 1, 2, 0, 3, 1, 0, 3, 0,
720 0, 5, 0, 3, 1, 0, 4, 1, 1, 1,
721 1, 0, 2, 1, 1, 3, 1, 3, 1, 2,
722 3, 1, 3, 1, 1, 1, 3, 1, 1, 1,
723 3, 1, 1, 3, 1, 1, 3, 1, 1, 1,
724 1, 1, 2, 1, 2, 1
725 };
726
727
728 #define yyerrok (yyerrstatus = 0)
729 #define yyclearin (yychar = YYEMPTY)
730 #define YYEMPTY (-2)
731 #define YYEOF 0
732
733 #define YYACCEPT goto yyacceptlab
734 #define YYABORT goto yyabortlab
735 #define YYERROR goto yyerrorlab
736
737
738 #define YYRECOVERING() (!!yyerrstatus)
739
740 #define YYBACKUP(Token, Value) \
741 do \
742 if (yychar == YYEMPTY) \
743 { \
744 yychar = (Token); \
745 yylval = (Value); \
746 YYPOPSTACK (yylen); \
747 yystate = *yyssp; \
748 goto yybackup; \
749 } \
750 else \
751 { \
752 yyerror (YY_("syntax error: cannot back up")); \
753 YYERROR; \
754 } \
755 while (0)
756
757 /* Error token number */
758 #define YYTERROR 1
759 #define YYERRCODE 256
760
761
762
763 /* Enable debugging if requested. */
764 #if YYDEBUG
765
766 # ifndef YYFPRINTF
767 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
768 # define YYFPRINTF fprintf
769 # endif
770
771 # define YYDPRINTF(Args) \
772 do { \
773 if (yydebug) \
774 YYFPRINTF Args; \
775 } while (0)
776
777 /* This macro is provided for backward compatibility. */
778 #ifndef YY_LOCATION_PRINT
779 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
780 #endif
781
782
783 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
784 do { \
785 if (yydebug) \
786 { \
787 YYFPRINTF (stderr, "%s ", Title); \
788 yy_symbol_print (stderr, \
789 Type, Value); \
790 YYFPRINTF (stderr, "\n"); \
791 } \
792 } while (0)
793
794
795 /*----------------------------------------.
796 | Print this symbol's value on YYOUTPUT. |
797 `----------------------------------------*/
798
799 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)800 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
801 {
802 FILE *yyo = yyoutput;
803 YYUSE (yyo);
804 if (!yyvaluep)
805 return;
806 # ifdef YYPRINT
807 if (yytype < YYNTOKENS)
808 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
809 # endif
810 YYUSE (yytype);
811 }
812
813
814 /*--------------------------------.
815 | Print this symbol on YYOUTPUT. |
816 `--------------------------------*/
817
818 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)819 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
820 {
821 YYFPRINTF (yyoutput, "%s %s (",
822 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
823
824 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
825 YYFPRINTF (yyoutput, ")");
826 }
827
828 /*------------------------------------------------------------------.
829 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
830 | TOP (included). |
831 `------------------------------------------------------------------*/
832
833 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)834 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
835 {
836 YYFPRINTF (stderr, "Stack now");
837 for (; yybottom <= yytop; yybottom++)
838 {
839 int yybot = *yybottom;
840 YYFPRINTF (stderr, " %d", yybot);
841 }
842 YYFPRINTF (stderr, "\n");
843 }
844
845 # define YY_STACK_PRINT(Bottom, Top) \
846 do { \
847 if (yydebug) \
848 yy_stack_print ((Bottom), (Top)); \
849 } while (0)
850
851
852 /*------------------------------------------------.
853 | Report that the YYRULE is going to be reduced. |
854 `------------------------------------------------*/
855
856 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule)857 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
858 {
859 unsigned long int yylno = yyrline[yyrule];
860 int yynrhs = yyr2[yyrule];
861 int yyi;
862 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
863 yyrule - 1, yylno);
864 /* The symbols being reduced. */
865 for (yyi = 0; yyi < yynrhs; yyi++)
866 {
867 YYFPRINTF (stderr, " $%d = ", yyi + 1);
868 yy_symbol_print (stderr,
869 yystos[yyssp[yyi + 1 - yynrhs]],
870 &(yyvsp[(yyi + 1) - (yynrhs)])
871 );
872 YYFPRINTF (stderr, "\n");
873 }
874 }
875
876 # define YY_REDUCE_PRINT(Rule) \
877 do { \
878 if (yydebug) \
879 yy_reduce_print (yyssp, yyvsp, Rule); \
880 } while (0)
881
882 /* Nonzero means print parse trace. It is left uninitialized so that
883 multiple parsers can coexist. */
884 int yydebug;
885 #else /* !YYDEBUG */
886 # define YYDPRINTF(Args)
887 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
888 # define YY_STACK_PRINT(Bottom, Top)
889 # define YY_REDUCE_PRINT(Rule)
890 #endif /* !YYDEBUG */
891
892
893 /* YYINITDEPTH -- initial size of the parser's stacks. */
894 #ifndef YYINITDEPTH
895 # define YYINITDEPTH 200
896 #endif
897
898 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
899 if the built-in stack extension method is used).
900
901 Do not make this value too large; the results are undefined if
902 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
903 evaluated with infinite-precision integer arithmetic. */
904
905 #ifndef YYMAXDEPTH
906 # define YYMAXDEPTH 10000
907 #endif
908
909
910 #if YYERROR_VERBOSE
911
912 # ifndef yystrlen
913 # if defined __GLIBC__ && defined _STRING_H
914 # define yystrlen strlen
915 # else
916 /* Return the length of YYSTR. */
917 static YYSIZE_T
yystrlen(const char * yystr)918 yystrlen (const char *yystr)
919 {
920 YYSIZE_T yylen;
921 for (yylen = 0; yystr[yylen]; yylen++)
922 continue;
923 return yylen;
924 }
925 # endif
926 # endif
927
928 # ifndef yystpcpy
929 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
930 # define yystpcpy stpcpy
931 # else
932 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
933 YYDEST. */
934 static char *
yystpcpy(char * yydest,const char * yysrc)935 yystpcpy (char *yydest, const char *yysrc)
936 {
937 char *yyd = yydest;
938 const char *yys = yysrc;
939
940 while ((*yyd++ = *yys++) != '\0')
941 continue;
942
943 return yyd - 1;
944 }
945 # endif
946 # endif
947
948 # ifndef yytnamerr
949 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
950 quotes and backslashes, so that it's suitable for yyerror. The
951 heuristic is that double-quoting is unnecessary unless the string
952 contains an apostrophe, a comma, or backslash (other than
953 backslash-backslash). YYSTR is taken from yytname. If YYRES is
954 null, do not copy; instead, return the length of what the result
955 would have been. */
956 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)957 yytnamerr (char *yyres, const char *yystr)
958 {
959 if (*yystr == '"')
960 {
961 YYSIZE_T yyn = 0;
962 char const *yyp = yystr;
963
964 for (;;)
965 switch (*++yyp)
966 {
967 case '\'':
968 case ',':
969 goto do_not_strip_quotes;
970
971 case '\\':
972 if (*++yyp != '\\')
973 goto do_not_strip_quotes;
974 /* Fall through. */
975 default:
976 if (yyres)
977 yyres[yyn] = *yyp;
978 yyn++;
979 break;
980
981 case '"':
982 if (yyres)
983 yyres[yyn] = '\0';
984 return yyn;
985 }
986 do_not_strip_quotes: ;
987 }
988
989 if (! yyres)
990 return yystrlen (yystr);
991
992 return yystpcpy (yyres, yystr) - yyres;
993 }
994 # endif
995
996 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
997 about the unexpected token YYTOKEN for the state stack whose top is
998 YYSSP.
999
1000 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1001 not large enough to hold the message. In that case, also set
1002 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1003 required number of bytes is too large to store. */
1004 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)1005 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1006 yytype_int16 *yyssp, int yytoken)
1007 {
1008 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1009 YYSIZE_T yysize = yysize0;
1010 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1011 /* Internationalized format string. */
1012 const char *yyformat = YY_NULLPTR;
1013 /* Arguments of yyformat. */
1014 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1015 /* Number of reported tokens (one for the "unexpected", one per
1016 "expected"). */
1017 int yycount = 0;
1018
1019 /* There are many possibilities here to consider:
1020 - If this state is a consistent state with a default action, then
1021 the only way this function was invoked is if the default action
1022 is an error action. In that case, don't check for expected
1023 tokens because there are none.
1024 - The only way there can be no lookahead present (in yychar) is if
1025 this state is a consistent state with a default action. Thus,
1026 detecting the absence of a lookahead is sufficient to determine
1027 that there is no unexpected or expected token to report. In that
1028 case, just report a simple "syntax error".
1029 - Don't assume there isn't a lookahead just because this state is a
1030 consistent state with a default action. There might have been a
1031 previous inconsistent state, consistent state with a non-default
1032 action, or user semantic action that manipulated yychar.
1033 - Of course, the expected token list depends on states to have
1034 correct lookahead information, and it depends on the parser not
1035 to perform extra reductions after fetching a lookahead from the
1036 scanner and before detecting a syntax error. Thus, state merging
1037 (from LALR or IELR) and default reductions corrupt the expected
1038 token list. However, the list is correct for canonical LR with
1039 one exception: it will still contain any token that will not be
1040 accepted due to an error action in a later state.
1041 */
1042 if (yytoken != YYEMPTY)
1043 {
1044 int yyn = yypact[*yyssp];
1045 yyarg[yycount++] = yytname[yytoken];
1046 if (!yypact_value_is_default (yyn))
1047 {
1048 /* Start YYX at -YYN if negative to avoid negative indexes in
1049 YYCHECK. In other words, skip the first -YYN actions for
1050 this state because they are default actions. */
1051 int yyxbegin = yyn < 0 ? -yyn : 0;
1052 /* Stay within bounds of both yycheck and yytname. */
1053 int yychecklim = YYLAST - yyn + 1;
1054 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1055 int yyx;
1056
1057 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1058 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1059 && !yytable_value_is_error (yytable[yyx + yyn]))
1060 {
1061 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1062 {
1063 yycount = 1;
1064 yysize = yysize0;
1065 break;
1066 }
1067 yyarg[yycount++] = yytname[yyx];
1068 {
1069 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1070 if (! (yysize <= yysize1
1071 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1072 return 2;
1073 yysize = yysize1;
1074 }
1075 }
1076 }
1077 }
1078
1079 switch (yycount)
1080 {
1081 # define YYCASE_(N, S) \
1082 case N: \
1083 yyformat = S; \
1084 break
1085 YYCASE_(0, YY_("syntax error"));
1086 YYCASE_(1, YY_("syntax error, unexpected %s"));
1087 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1088 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1089 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1090 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1091 # undef YYCASE_
1092 }
1093
1094 {
1095 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1096 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1097 return 2;
1098 yysize = yysize1;
1099 }
1100
1101 if (*yymsg_alloc < yysize)
1102 {
1103 *yymsg_alloc = 2 * yysize;
1104 if (! (yysize <= *yymsg_alloc
1105 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1106 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1107 return 1;
1108 }
1109
1110 /* Avoid sprintf, as that infringes on the user's name space.
1111 Don't have undefined behavior even if the translation
1112 produced a string with the wrong number of "%s"s. */
1113 {
1114 char *yyp = *yymsg;
1115 int yyi = 0;
1116 while ((*yyp = *yyformat) != '\0')
1117 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1118 {
1119 yyp += yytnamerr (yyp, yyarg[yyi++]);
1120 yyformat += 2;
1121 }
1122 else
1123 {
1124 yyp++;
1125 yyformat++;
1126 }
1127 }
1128 return 0;
1129 }
1130 #endif /* YYERROR_VERBOSE */
1131
1132 /*-----------------------------------------------.
1133 | Release the memory associated to this symbol. |
1134 `-----------------------------------------------*/
1135
1136 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1137 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1138 {
1139 YYUSE (yyvaluep);
1140 if (!yymsg)
1141 yymsg = "Deleting";
1142 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1143
1144 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1145 YYUSE (yytype);
1146 YY_IGNORE_MAYBE_UNINITIALIZED_END
1147 }
1148
1149
1150
1151
1152 /* The lookahead symbol. */
1153 int yychar;
1154
1155 /* The semantic value of the lookahead symbol. */
1156 YYSTYPE yylval;
1157 /* Number of syntax errors so far. */
1158 int yynerrs;
1159
1160
1161 /*----------.
1162 | yyparse. |
1163 `----------*/
1164
1165 int
yyparse(void)1166 yyparse (void)
1167 {
1168 int yystate;
1169 /* Number of tokens to shift before error messages enabled. */
1170 int yyerrstatus;
1171
1172 /* The stacks and their tools:
1173 'yyss': related to states.
1174 'yyvs': related to semantic values.
1175
1176 Refer to the stacks through separate pointers, to allow yyoverflow
1177 to reallocate them elsewhere. */
1178
1179 /* The state stack. */
1180 yytype_int16 yyssa[YYINITDEPTH];
1181 yytype_int16 *yyss;
1182 yytype_int16 *yyssp;
1183
1184 /* The semantic value stack. */
1185 YYSTYPE yyvsa[YYINITDEPTH];
1186 YYSTYPE *yyvs;
1187 YYSTYPE *yyvsp;
1188
1189 YYSIZE_T yystacksize;
1190
1191 int yyn;
1192 int yyresult;
1193 /* Lookahead token as an internal (translated) token number. */
1194 int yytoken = 0;
1195 /* The variables used to return semantic value and location from the
1196 action routines. */
1197 YYSTYPE yyval;
1198
1199 #if YYERROR_VERBOSE
1200 /* Buffer for error messages, and its allocated size. */
1201 char yymsgbuf[128];
1202 char *yymsg = yymsgbuf;
1203 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1204 #endif
1205
1206 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1207
1208 /* The number of symbols on the RHS of the reduced rule.
1209 Keep to zero when no symbol should be popped. */
1210 int yylen = 0;
1211
1212 yyssp = yyss = yyssa;
1213 yyvsp = yyvs = yyvsa;
1214 yystacksize = YYINITDEPTH;
1215
1216 YYDPRINTF ((stderr, "Starting parse\n"));
1217
1218 yystate = 0;
1219 yyerrstatus = 0;
1220 yynerrs = 0;
1221 yychar = YYEMPTY; /* Cause a token to be read. */
1222 goto yysetstate;
1223
1224 /*------------------------------------------------------------.
1225 | yynewstate -- Push a new state, which is found in yystate. |
1226 `------------------------------------------------------------*/
1227 yynewstate:
1228 /* In all cases, when you get here, the value and location stacks
1229 have just been pushed. So pushing a state here evens the stacks. */
1230 yyssp++;
1231
1232 yysetstate:
1233 *yyssp = yystate;
1234
1235 if (yyss + yystacksize - 1 <= yyssp)
1236 {
1237 /* Get the current used size of the three stacks, in elements. */
1238 YYSIZE_T yysize = yyssp - yyss + 1;
1239
1240 #ifdef yyoverflow
1241 {
1242 /* Give user a chance to reallocate the stack. Use copies of
1243 these so that the &'s don't force the real ones into
1244 memory. */
1245 YYSTYPE *yyvs1 = yyvs;
1246 yytype_int16 *yyss1 = yyss;
1247
1248 /* Each stack pointer address is followed by the size of the
1249 data in use in that stack, in bytes. This used to be a
1250 conditional around just the two extra args, but that might
1251 be undefined if yyoverflow is a macro. */
1252 yyoverflow (YY_("memory exhausted"),
1253 &yyss1, yysize * sizeof (*yyssp),
1254 &yyvs1, yysize * sizeof (*yyvsp),
1255 &yystacksize);
1256
1257 yyss = yyss1;
1258 yyvs = yyvs1;
1259 }
1260 #else /* no yyoverflow */
1261 # ifndef YYSTACK_RELOCATE
1262 goto yyexhaustedlab;
1263 # else
1264 /* Extend the stack our own way. */
1265 if (YYMAXDEPTH <= yystacksize)
1266 goto yyexhaustedlab;
1267 yystacksize *= 2;
1268 if (YYMAXDEPTH < yystacksize)
1269 yystacksize = YYMAXDEPTH;
1270
1271 {
1272 yytype_int16 *yyss1 = yyss;
1273 union yyalloc *yyptr =
1274 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1275 if (! yyptr)
1276 goto yyexhaustedlab;
1277 YYSTACK_RELOCATE (yyss_alloc, yyss);
1278 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1279 # undef YYSTACK_RELOCATE
1280 if (yyss1 != yyssa)
1281 YYSTACK_FREE (yyss1);
1282 }
1283 # endif
1284 #endif /* no yyoverflow */
1285
1286 yyssp = yyss + yysize - 1;
1287 yyvsp = yyvs + yysize - 1;
1288
1289 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1290 (unsigned long int) yystacksize));
1291
1292 if (yyss + yystacksize - 1 <= yyssp)
1293 YYABORT;
1294 }
1295
1296 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1297
1298 if (yystate == YYFINAL)
1299 YYACCEPT;
1300
1301 goto yybackup;
1302
1303 /*-----------.
1304 | yybackup. |
1305 `-----------*/
1306 yybackup:
1307
1308 /* Do appropriate processing given the current state. Read a
1309 lookahead token if we need one and don't already have one. */
1310
1311 /* First try to decide what to do without reference to lookahead token. */
1312 yyn = yypact[yystate];
1313 if (yypact_value_is_default (yyn))
1314 goto yydefault;
1315
1316 /* Not known => get a lookahead token if don't already have one. */
1317
1318 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1319 if (yychar == YYEMPTY)
1320 {
1321 YYDPRINTF ((stderr, "Reading a token: "));
1322 yychar = yylex ();
1323 }
1324
1325 if (yychar <= YYEOF)
1326 {
1327 yychar = yytoken = YYEOF;
1328 YYDPRINTF ((stderr, "Now at end of input.\n"));
1329 }
1330 else
1331 {
1332 yytoken = YYTRANSLATE (yychar);
1333 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1334 }
1335
1336 /* If the proper action on seeing token YYTOKEN is to reduce or to
1337 detect an error, take that action. */
1338 yyn += yytoken;
1339 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1340 goto yydefault;
1341 yyn = yytable[yyn];
1342 if (yyn <= 0)
1343 {
1344 if (yytable_value_is_error (yyn))
1345 goto yyerrlab;
1346 yyn = -yyn;
1347 goto yyreduce;
1348 }
1349
1350 /* Count tokens shifted since error; after three, turn off error
1351 status. */
1352 if (yyerrstatus)
1353 yyerrstatus--;
1354
1355 /* Shift the lookahead token. */
1356 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1357
1358 /* Discard the shifted token. */
1359 yychar = YYEMPTY;
1360
1361 yystate = yyn;
1362 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1363 *++yyvsp = yylval;
1364 YY_IGNORE_MAYBE_UNINITIALIZED_END
1365
1366 goto yynewstate;
1367
1368
1369 /*-----------------------------------------------------------.
1370 | yydefault -- do the default action for the current state. |
1371 `-----------------------------------------------------------*/
1372 yydefault:
1373 yyn = yydefact[yystate];
1374 if (yyn == 0)
1375 goto yyerrlab;
1376 goto yyreduce;
1377
1378
1379 /*-----------------------------.
1380 | yyreduce -- Do a reduction. |
1381 `-----------------------------*/
1382 yyreduce:
1383 /* yyn is the number of a rule to reduce with. */
1384 yylen = yyr2[yyn];
1385
1386 /* If YYLEN is nonzero, implement the default value of the action:
1387 '$$ = $1'.
1388
1389 Otherwise, the following line sets YYVAL to garbage.
1390 This behavior is undocumented and Bison
1391 users should not rely upon it. Assigning to YYVAL
1392 unconditionally makes the parser a bit smaller, and it avoids a
1393 GCC warning that YYVAL may be used uninitialized. */
1394 yyval = yyvsp[1-yylen];
1395
1396
1397 YY_REDUCE_PRINT (yyn);
1398 switch (yyn)
1399 {
1400 case 2:
1401 #line 133 "parser_yy.y" /* yacc.c:1646 */
1402 {
1403 parserstratcurr = ((yyvsp[0].STRAT)); /* Save pointer to root of tree */
1404 }
1405 #line 1406 "y.tab.c" /* yacc.c:1646 */
1406 break;
1407
1408 case 3:
1409 #line 139 "parser_yy.y" /* yacc.c:1646 */
1410 {
1411 Strat * strat;
1412
1413 if ((strat = (Strat *) memAlloc (sizeof (Strat))) == NULL) {
1414 errorPrint ("stratParserParse: out of memory (2)");
1415 stratExit ((yyvsp[-2].STRAT));
1416 stratExit ((yyvsp[0].STRAT));
1417 YYABORT;
1418 }
1419
1420 strat->tabl = parserstrattab;
1421 strat->type = STRATNODESELECT;
1422 strat->data.select.strat[0] = ((yyvsp[-2].STRAT));
1423 strat->data.select.strat[1] = ((yyvsp[0].STRAT));
1424
1425 ((yyval.STRAT)) = strat;
1426 }
1427 #line 1428 "y.tab.c" /* yacc.c:1646 */
1428 break;
1429
1430 case 6:
1431 #line 161 "parser_yy.y" /* yacc.c:1646 */
1432 {
1433 Strat * strat;
1434
1435 if ((strat = (Strat *) memAlloc (sizeof (Strat))) == NULL) {
1436 errorPrint ("stratParserParse: out of memory (3)");
1437 YYABORT;
1438 }
1439
1440 strat->tabl = parserstrattab;
1441 strat->type = STRATNODEEMPTY;
1442
1443 ((yyval.STRAT)) = strat;
1444 }
1445 #line 1446 "y.tab.c" /* yacc.c:1646 */
1446 break;
1447
1448 case 7:
1449 #line 177 "parser_yy.y" /* yacc.c:1646 */
1450 {
1451 Strat * strat;
1452
1453 if ((strat = (Strat *) memAlloc (sizeof (Strat))) == NULL) {
1454 errorPrint ("stratParserParse: out of memory (4)");
1455 stratExit ((yyvsp[-1].STRAT));
1456 stratExit ((yyvsp[0].STRAT));
1457 YYABORT;
1458 }
1459
1460 strat->tabl = parserstrattab;
1461 strat->type = STRATNODECONCAT;
1462 strat->data.concat.strat[0] = ((yyvsp[-1].STRAT));
1463 strat->data.concat.strat[1] = ((yyvsp[0].STRAT));
1464
1465 ((yyval.STRAT)) = strat;
1466 }
1467 #line 1468 "y.tab.c" /* yacc.c:1646 */
1468 break;
1469
1470 case 9:
1471 #line 198 "parser_yy.y" /* yacc.c:1646 */
1472 {
1473 stratParserSelect (VALTEST); /* Parse parameter tokens */
1474 }
1475 #line 1476 "y.tab.c" /* yacc.c:1646 */
1476 break;
1477
1478 case 10:
1479 #line 202 "parser_yy.y" /* yacc.c:1646 */
1480 {
1481 stratParserSelect (VALSTRAT); /* Parse strategy tokens */
1482 }
1483 #line 1484 "y.tab.c" /* yacc.c:1646 */
1484 break;
1485
1486 case 11:
1487 #line 206 "parser_yy.y" /* yacc.c:1646 */
1488 {
1489 Strat * strat;
1490
1491 if ((strat = (Strat *) memAlloc (sizeof (Strat))) == NULL) {
1492 errorPrint ("stratParserParse: out of memory (1)");
1493 stratExit ((yyvsp[-2].STRAT));
1494 if (((yyvsp[-1].STRAT)) != NULL)
1495 stratExit ((yyvsp[-1].STRAT));
1496 stratTestExit ((yyvsp[-5].TEST));
1497 YYABORT;
1498 }
1499
1500 strat->tabl = parserstrattab;
1501 strat->type = STRATNODECOND;
1502 strat->data.cond.test = ((yyvsp[-5].TEST));
1503 strat->data.cond.strat[0] = ((yyvsp[-2].STRAT));
1504 strat->data.cond.strat[1] = ((yyvsp[-1].STRAT));
1505
1506 ((yyval.STRAT)) = strat;
1507 }
1508 #line 1509 "y.tab.c" /* yacc.c:1646 */
1509 break;
1510
1511 case 13:
1512 #line 230 "parser_yy.y" /* yacc.c:1646 */
1513 {
1514 ((yyval.STRAT)) = ((yyvsp[0].STRAT));
1515 }
1516 #line 1517 "y.tab.c" /* yacc.c:1646 */
1517 break;
1518
1519 case 14:
1520 #line 234 "parser_yy.y" /* yacc.c:1646 */
1521 {
1522 ((yyval.STRAT)) = NULL;
1523 }
1524 #line 1525 "y.tab.c" /* yacc.c:1646 */
1525 break;
1526
1527 case 15:
1528 #line 240 "parser_yy.y" /* yacc.c:1646 */
1529 {
1530 ((yyval.STRAT)) = ((yyvsp[-1].STRAT));
1531 }
1532 #line 1533 "y.tab.c" /* yacc.c:1646 */
1533 break;
1534
1535 case 17:
1536 #line 247 "parser_yy.y" /* yacc.c:1646 */
1537 {
1538 Strat * strat;
1539 int meth;
1540 int methlen;
1541 StratMethodTab * methtab;
1542 int i, j;
1543
1544 meth =
1545 methlen = 0; /* No method recognized yet */
1546 methtab = parserstrattab->methtab; /* Point to the method table */
1547 for (i = 0; methtab[i].name != NULL; i ++) {
1548 if ((strncasecmp (((yyvsp[0].STRING)), /* Find longest matching code name */
1549 methtab[i].name,
1550 j = strlen (methtab[i].name)) == 0) &&
1551 (j > methlen)) {
1552 meth = methtab[i].meth;
1553 methlen = j;
1554 }
1555 }
1556 if (methlen == 0) { /* If method name not known */
1557 errorPrint ("stratParserParse: invalid method name \"%s\", before \"%s\"",
1558 ((yyvsp[0].STRING)), stratParserRemain ());
1559 YYABORT;
1560 }
1561 if ((strat = (Strat *) memAlloc (sizeof (Strat))) == NULL) {
1562 errorPrint ("stratParserParse: out of memory (5)");
1563 YYABORT;
1564 }
1565
1566 strat->tabl = parserstrattab;
1567 strat->type = STRATNODEMETHOD;
1568 strat->data.method.meth = meth; /* Set method type */
1569 if (methtab[meth].data != NULL) /* If default values exist */
1570 memcpy (&strat->data.method.data, /* Set values to default */
1571 methtab[meth].data,
1572 sizeof (StratNodeMethodData));
1573
1574 parserstratcurr = strat; /* Structure available for parameter processing */
1575 }
1576 #line 1577 "y.tab.c" /* yacc.c:1646 */
1577 break;
1578
1579 case 18:
1580 #line 287 "parser_yy.y" /* yacc.c:1646 */
1581 {
1582 StratParamTab * paratab;
1583 int i;
1584
1585 paratab = parserstrattab->paratab; /* Point to the parameter table */
1586 for (i = 0; paratab[i].name != NULL; i ++) {
1587 if ((paratab[i].meth == parserstratcurr->data.method.meth) && /* If a strategy parameter found for this method */
1588 (paratab[i].type == STRATPARAMSTRAT)) {
1589 if (*((Strat **) ((byte *) &parserstratcurr->data.method.data + /* And this parameter has not been set */
1590 (paratab[i].dataofft - paratab[i].database))) == NULL)
1591 errorPrintW ("stratParserParse: strategy parameter \"%s\" of method \"%s\" not set, before \"%s\"",
1592 paratab[i].name, parserstrattab->methtab[parserstratcurr->data.method.meth].name, stratParserRemain ());
1593 }
1594 }
1595
1596 ((yyval.STRAT)) = parserstratcurr; /* Return current structure */
1597 parserstratcurr = NULL; /* No current structure */
1598 }
1599 #line 1600 "y.tab.c" /* yacc.c:1646 */
1600 break;
1601
1602 case 19:
1603 #line 308 "parser_yy.y" /* yacc.c:1646 */
1604 {
1605 stratParserSelect (VALPARAM); /* Parse parameter tokens */
1606 }
1607 #line 1608 "y.tab.c" /* yacc.c:1646 */
1608 break;
1609
1610 case 20:
1611 #line 312 "parser_yy.y" /* yacc.c:1646 */
1612 {
1613 stratParserSelect (VALSTRAT); /* Parse strategy tokens */
1614 }
1615 #line 1616 "y.tab.c" /* yacc.c:1646 */
1616 break;
1617
1618 case 25:
1619 #line 324 "parser_yy.y" /* yacc.c:1646 */
1620 {
1621 int para;
1622 int paralen;
1623 StratParamTab * paratab;
1624 int i, j;
1625
1626 para =
1627 paralen = 0; /* No parameter recognized yet */
1628 paratab = parserstrattab->paratab; /* Point to the parameter table */
1629 for (i = 0; paratab[i].name != NULL; i ++) {
1630 if ((paratab[i].meth == parserstratcurr->data.method.meth) &&
1631 (strncasecmp (((yyvsp[0].STRING)), /* Find longest matching parameter name */
1632 paratab[i].name,
1633 j = strlen (paratab[i].name)) == 0) &&
1634 (j > paralen)) {
1635 para = i;
1636 paralen = j;
1637 }
1638 }
1639 if (paralen == 0) {
1640 errorPrint ("stratParserParse: invalid method parameter name \"%s\", before \"%s\"",
1641 ((yyvsp[0].STRING)), stratParserRemain ());
1642 YYABORT;
1643 }
1644
1645 ((yyval.SAVE)).tabl = parserstrattab; /* Save current strategy tables */
1646 parserparamcurr = ¶tab[para]; /* Save current parameter value */
1647 stratParserSelect (parsermethtokentab[parserparamcurr->type & ~STRATPARAMDEPRECATED]); /* Get non-deprecated type */
1648 if (parserparamcurr->type == STRATPARAMSTRAT) /* If parameter is a strategy */
1649 parserstrattab = (StratTab *) parserparamcurr->datasltr; /* Use new strategy tables */
1650 }
1651 #line 1652 "y.tab.c" /* yacc.c:1646 */
1652 break;
1653
1654 case 26:
1655 #line 356 "parser_yy.y" /* yacc.c:1646 */
1656 {
1657 stratParserSelect (VALPARAM); /* Go-on reading parameters */
1658 parserstrattab = ((yyvsp[-2].SAVE)).tabl; /* Restore current strategy tables */
1659 }
1660 #line 1661 "y.tab.c" /* yacc.c:1646 */
1661 break;
1662
1663 case 27:
1664 #line 363 "parser_yy.y" /* yacc.c:1646 */
1665 {
1666 char c; /* Character read */
1667 char * p; /* Pointer to selector string */
1668 int i; /* Index in selector string */
1669
1670 if ((parserparamcurr->type & STRATPARAMDEPRECATED) == 0) { /* If parameter is not deprecated */
1671 c = ((yyvsp[0].CASEVAL)); /* First, use char as is */
1672 for (p = (char *) parserparamcurr->datasltr, i = 0;
1673 (*p != '\0') && (*p != c);
1674 p ++, i ++) ;
1675 if (*p == '\0') { /* Char was not found */
1676 c = tolower (c); /* Convert char to lower case */
1677 for (p = (char *) parserparamcurr->datasltr, i = 0;
1678 (*p != '\0') && (*p != c);
1679 p ++, i ++) ;
1680 if (*p == '\0') {
1681 errorPrint ("stratParserParse: invalid method parameter switch \"%s=%c\", before \"%s\"",
1682 parserparamcurr->name, ((yyvsp[0].CASEVAL)), stratParserRemain ());
1683 YYABORT;
1684 }
1685 }
1686
1687 #ifdef SCOTCH_DEBUG_PARSER2
1688 if ((parserparamcurr->dataofft - parserparamcurr->database + sizeof (int)) > sizeof (StratNodeMethodData)) {
1689 errorPrint ("stratParserParse: internal error (1)");
1690 YYABORT;
1691 }
1692 #endif /* SCOTCH_DEBUG_PARSER2 */
1693
1694 *((int *) ((byte *) &parserstratcurr->data.method.data +
1695 (parserparamcurr->dataofft -
1696 parserparamcurr->database))) = i;
1697 }
1698 }
1699 #line 1700 "y.tab.c" /* yacc.c:1646 */
1700 break;
1701
1702 case 28:
1703 #line 398 "parser_yy.y" /* yacc.c:1646 */
1704 {
1705 if ((parserparamcurr->type & STRATPARAMDEPRECATED) == 0) { /* If parameter is not deprecated */
1706 #ifdef SCOTCH_DEBUG_PARSER2
1707 if ((parserparamcurr->dataofft - parserparamcurr->database + sizeof (double)) > sizeof (StratNodeMethodData)) {
1708 errorPrint ("stratParserParse: internal error (2)");
1709 YYABORT;
1710 }
1711 #endif /* SCOTCH_DEBUG_PARSER2 */
1712
1713 *((double *) ((byte *) &parserstratcurr->data.method.data +
1714 (parserparamcurr->dataofft -
1715 parserparamcurr->database))) = ((yyvsp[0].DOUBLE));
1716 }
1717 }
1718 #line 1719 "y.tab.c" /* yacc.c:1646 */
1719 break;
1720
1721 case 29:
1722 #line 413 "parser_yy.y" /* yacc.c:1646 */
1723 {
1724 if ((parserparamcurr->type & STRATPARAMDEPRECATED) == 0) { /* If parameter is not deprecated */
1725 #ifdef SCOTCH_DEBUG_PARSER2
1726 if ((parserparamcurr->dataofft - parserparamcurr->database + sizeof (INT)) > sizeof (StratNodeMethodData)) {
1727 errorPrint ("stratParserParse: internal error (3)");
1728 YYABORT;
1729 }
1730 #endif /* SCOTCH_DEBUG_PARSER2 */
1731
1732 *((INT *) ((byte *) &parserstratcurr->data.method.data +
1733 (parserparamcurr->dataofft -
1734 parserparamcurr->database))) = (INT) ((yyvsp[0].INTEGER));
1735 }
1736 }
1737 #line 1738 "y.tab.c" /* yacc.c:1646 */
1738 break;
1739
1740 case 30:
1741 #line 428 "parser_yy.y" /* yacc.c:1646 */
1742 {
1743 if ((parserparamcurr->type & STRATPARAMDEPRECATED) == 0) { /* If parameter is not deprecated */
1744 #ifdef SCOTCH_DEBUG_PARSER2
1745 if ((parserparamcurr->dataofft - parserparamcurr->database + strlen ((yyvsp[0].STRING)) + 1) > sizeof (StratNodeMethodData)) {
1746 errorPrint ("stratParserParse: internal error (4)");
1747 YYABORT;
1748 }
1749 #endif /* SCOTCH_DEBUG_PARSER2 */
1750
1751 strcpy ((char *) ((byte *) &parserstratcurr->data.method.data +
1752 (parserparamcurr->dataofft -
1753 parserparamcurr->database)),
1754 ((yyvsp[0].STRING)));
1755 }
1756 }
1757 #line 1758 "y.tab.c" /* yacc.c:1646 */
1758 break;
1759
1760 case 31:
1761 #line 444 "parser_yy.y" /* yacc.c:1646 */
1762 {
1763 ((yyval.SAVE)).strat = parserstratcurr;
1764 ((yyval.SAVE)).param = parserparamcurr;
1765 parserstratcurr = NULL;
1766 parserparamcurr = NULL;
1767 }
1768 #line 1769 "y.tab.c" /* yacc.c:1646 */
1769 break;
1770
1771 case 32:
1772 #line 451 "parser_yy.y" /* yacc.c:1646 */
1773 {
1774 parserstratcurr = ((yyvsp[-1].SAVE)).strat; /* Restore current method */
1775 parserparamcurr = ((yyvsp[-1].SAVE)).param; /* Restore current parameter */
1776
1777 if ((parserparamcurr->type & STRATPARAMDEPRECATED) == 0) { /* If parameter is not deprecated */
1778 #ifdef SCOTCH_DEBUG_PARSER2
1779 if ((parserparamcurr->dataofft - parserparamcurr->database + sizeof (Strat *)) > sizeof (StratNodeMethodData)) {
1780 errorPrint ("stratParserParse: internal error (5)");
1781 YYABORT;
1782 }
1783 #endif /* SCOTCH_DEBUG_PARSER2 */
1784
1785 *((Strat **) ((byte *) &parserstratcurr->data.method.data +
1786 (parserparamcurr->dataofft -
1787 parserparamcurr->database))) = ((yyvsp[0].STRAT));
1788 }
1789 }
1790 #line 1791 "y.tab.c" /* yacc.c:1646 */
1791 break;
1792
1793 case 33:
1794 #line 469 "parser_yy.y" /* yacc.c:1646 */
1795 {
1796 errorPrint ("stratParserParse: invalid value for parameter \"%s\" of method \"%s\", before \"%s\"",
1797 parserparamcurr->name, parserstratcurr->tabl->methtab[parserstratcurr->data.method.meth].name, stratParserRemain ());
1798 YYABORT;
1799 }
1800 #line 1801 "y.tab.c" /* yacc.c:1646 */
1801 break;
1802
1803 case 35:
1804 #line 480 "parser_yy.y" /* yacc.c:1646 */
1805 {
1806 StratTest * test;
1807
1808 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
1809 errorPrint ("stratParserParse: out of memory (6)");
1810 stratTestExit ((yyvsp[-2].TEST));
1811 stratTestExit ((yyvsp[0].TEST));
1812 YYABORT;
1813 }
1814
1815 test->typetest = STRATTESTOR;
1816 test->typenode = STRATPARAMLOG;
1817 test->data.test[0] = ((yyvsp[-2].TEST));
1818 test->data.test[1] = ((yyvsp[0].TEST));
1819
1820 ((yyval.TEST)) = test;
1821 }
1822 #line 1823 "y.tab.c" /* yacc.c:1646 */
1823 break;
1824
1825 case 37:
1826 #line 501 "parser_yy.y" /* yacc.c:1646 */
1827 {
1828 StratTest * test;
1829
1830 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
1831 errorPrint ("stratParserParse: out of memory (7)");
1832 stratTestExit ((yyvsp[-2].TEST));
1833 stratTestExit ((yyvsp[0].TEST));
1834 YYABORT;
1835 }
1836
1837 test->typetest = STRATTESTAND;
1838 test->typenode = STRATPARAMLOG;
1839 test->data.test[0] = ((yyvsp[-2].TEST));
1840 test->data.test[1] = ((yyvsp[0].TEST));
1841
1842 ((yyval.TEST)) = test;
1843 }
1844 #line 1845 "y.tab.c" /* yacc.c:1646 */
1845 break;
1846
1847 case 39:
1848 #line 522 "parser_yy.y" /* yacc.c:1646 */
1849 {
1850 StratTest * test;
1851
1852 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
1853 errorPrint ("stratParserParse: out of memory (8)");
1854 stratTestExit ((yyvsp[0].TEST));
1855 YYABORT;
1856 }
1857
1858 test->typetest = STRATTESTNOT;
1859 test->typenode = STRATPARAMLOG;
1860 test->data.test[0] = ((yyvsp[0].TEST));
1861
1862 ((yyval.TEST)) = test;
1863 }
1864 #line 1865 "y.tab.c" /* yacc.c:1646 */
1865 break;
1866
1867 case 40:
1868 #line 538 "parser_yy.y" /* yacc.c:1646 */
1869 {
1870 ((yyval.TEST)) = ((yyvsp[-1].TEST));
1871 }
1872 #line 1873 "y.tab.c" /* yacc.c:1646 */
1873 break;
1874
1875 case 42:
1876 #line 545 "parser_yy.y" /* yacc.c:1646 */
1877 {
1878 StratTest * test;
1879
1880 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
1881 errorPrint ("stratParserParse: out of memory (9)");
1882 stratTestExit ((yyvsp[-2].TEST));
1883 stratTestExit ((yyvsp[0].TEST));
1884 YYABORT;
1885 }
1886 test->typetest = ((yyvsp[-1].TESTOP));
1887 test->typenode = STRATPARAMLOG;
1888 test->data.test[0] = ((yyvsp[-2].TEST));
1889 test->data.test[1] = ((yyvsp[0].TEST));
1890
1891 ((yyval.TEST)) = test;
1892 }
1893 #line 1894 "y.tab.c" /* yacc.c:1646 */
1894 break;
1895
1896 case 43:
1897 #line 564 "parser_yy.y" /* yacc.c:1646 */
1898 {
1899 ((yyval.TESTOP)) = STRATTESTLT;
1900 }
1901 #line 1902 "y.tab.c" /* yacc.c:1646 */
1902 break;
1903
1904 case 44:
1905 #line 568 "parser_yy.y" /* yacc.c:1646 */
1906 {
1907 ((yyval.TESTOP)) = STRATTESTEQ;
1908 }
1909 #line 1910 "y.tab.c" /* yacc.c:1646 */
1910 break;
1911
1912 case 45:
1913 #line 572 "parser_yy.y" /* yacc.c:1646 */
1914 {
1915 ((yyval.TESTOP)) = STRATTESTGT;
1916 }
1917 #line 1918 "y.tab.c" /* yacc.c:1646 */
1918 break;
1919
1920 case 46:
1921 #line 578 "parser_yy.y" /* yacc.c:1646 */
1922 {
1923 StratTest * test;
1924
1925 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
1926 errorPrint ("stratParserParse: out of memory (10)");
1927 stratTestExit ((yyvsp[-2].TEST));
1928 stratTestExit ((yyvsp[0].TEST));
1929 YYABORT;
1930 }
1931 test->typetest = ((yyvsp[-1].TESTOP));
1932 test->data.test[0] = ((yyvsp[-2].TEST));
1933 test->data.test[1] = ((yyvsp[0].TEST));
1934
1935 ((yyval.TEST)) = test;
1936 }
1937 #line 1938 "y.tab.c" /* yacc.c:1646 */
1938 break;
1939
1940 case 48:
1941 #line 597 "parser_yy.y" /* yacc.c:1646 */
1942 {
1943 ((yyval.TESTOP)) = STRATTESTADD;
1944 }
1945 #line 1946 "y.tab.c" /* yacc.c:1646 */
1946 break;
1947
1948 case 49:
1949 #line 601 "parser_yy.y" /* yacc.c:1646 */
1950 {
1951 ((yyval.TESTOP)) = STRATTESTSUB;
1952 }
1953 #line 1954 "y.tab.c" /* yacc.c:1646 */
1954 break;
1955
1956 case 50:
1957 #line 607 "parser_yy.y" /* yacc.c:1646 */
1958 {
1959 StratTest * test;
1960
1961 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
1962 stratTestExit ((yyvsp[-2].TEST));
1963 stratTestExit ((yyvsp[0].TEST));
1964 errorPrint ("stratParserParse: out of memory (11)");
1965 YYABORT;
1966 }
1967 test->typetest = ((yyvsp[-1].TESTOP));
1968 test->data.test[0] = ((yyvsp[-2].TEST));
1969 test->data.test[1] = ((yyvsp[0].TEST));
1970
1971 ((yyval.TEST)) = test;
1972 }
1973 #line 1974 "y.tab.c" /* yacc.c:1646 */
1974 break;
1975
1976 case 52:
1977 #line 626 "parser_yy.y" /* yacc.c:1646 */
1978 {
1979 ((yyval.TESTOP)) = STRATTESTMUL;
1980 }
1981 #line 1982 "y.tab.c" /* yacc.c:1646 */
1982 break;
1983
1984 case 53:
1985 #line 632 "parser_yy.y" /* yacc.c:1646 */
1986 {
1987 StratTest * test;
1988
1989 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
1990 errorPrint ("stratParserParse: out of memory (12)");
1991 stratTestExit ((yyvsp[-2].TEST));
1992 stratTestExit ((yyvsp[0].TEST));
1993 YYABORT;
1994 }
1995 test->typetest = ((yyvsp[-1].TESTOP));
1996 test->data.test[0] = ((yyvsp[-2].TEST));
1997 test->data.test[1] = ((yyvsp[0].TEST));
1998
1999 ((yyval.TEST)) = test;
2000 }
2001 #line 2002 "y.tab.c" /* yacc.c:1646 */
2002 break;
2003
2004 case 55:
2005 #line 651 "parser_yy.y" /* yacc.c:1646 */
2006 {
2007 ((yyval.TESTOP)) = STRATTESTMOD;
2008 }
2009 #line 2010 "y.tab.c" /* yacc.c:1646 */
2010 break;
2011
2012 case 56:
2013 #line 657 "parser_yy.y" /* yacc.c:1646 */
2014 {
2015 ((yyval.TEST)) = ((yyvsp[-1].TEST));
2016 }
2017 #line 2018 "y.tab.c" /* yacc.c:1646 */
2018 break;
2019
2020 case 59:
2021 #line 665 "parser_yy.y" /* yacc.c:1646 */
2022 {
2023 StratTest * test;
2024
2025 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
2026 errorPrint ("stratParserParse: out of memory (13)");
2027 YYABORT;
2028 }
2029
2030 test->typetest = STRATTESTVAL;
2031 test->typenode = STRATPARAMDOUBLE;
2032 test->data.val.valdbl = ((yyvsp[0].DOUBLE));
2033
2034 ((yyval.TEST)) = test;
2035 }
2036 #line 2037 "y.tab.c" /* yacc.c:1646 */
2037 break;
2038
2039 case 60:
2040 #line 680 "parser_yy.y" /* yacc.c:1646 */
2041 {
2042 StratTest * test;
2043
2044 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
2045 errorPrint ("stratParserParse: out of memory (14)");
2046 YYABORT;
2047 }
2048
2049 test->typetest = STRATTESTVAL;
2050 test->typenode = STRATPARAMINT;
2051 test->data.val.valint = ((yyvsp[0].INTEGER));
2052
2053 ((yyval.TEST)) = test;
2054 }
2055 #line 2056 "y.tab.c" /* yacc.c:1646 */
2056 break;
2057
2058 case 61:
2059 #line 697 "parser_yy.y" /* yacc.c:1646 */
2060 {
2061 StratTest * test;
2062 StratParamTab * condtab;
2063 int para;
2064 int paralen;
2065 int i, j;
2066
2067 para =
2068 paralen = 0; /* No parameter recognized yet */
2069 condtab = parserstrattab->condtab; /* Point to parameter table */
2070 for (i = 0; condtab[i].name != NULL; i ++) {
2071 if ((strncasecmp (((yyvsp[0].STRING)), /* Find longest matching parameter name */
2072 condtab[i].name,
2073 j = strlen (condtab[i].name)) == 0) &&
2074 (j > paralen)) {
2075 para = i;
2076 paralen = j;
2077 }
2078 }
2079 if (paralen == 0) {
2080 errorPrint ("stratParserParse: invalid graph parameter name \"%s\", before \"%s\"",
2081 ((yyvsp[0].STRING)), stratParserRemain ());
2082 YYABORT;
2083 }
2084
2085 if ((test = (StratTest *) memAlloc (sizeof (StratTest))) == NULL) {
2086 errorPrint ("stratParserParse: out of memory (15)");
2087 YYABORT;
2088 }
2089
2090 test->typetest = STRATTESTVAR;
2091 test->typenode = condtab[para].type;
2092 test->data.var.datatab = parserstrattab;
2093 test->data.var.datadisp = condtab[para].dataofft -
2094 condtab[para].database;
2095
2096 ((yyval.TEST)) = test;
2097 }
2098 #line 2099 "y.tab.c" /* yacc.c:1646 */
2099 break;
2100
2101 case 62:
2102 #line 738 "parser_yy.y" /* yacc.c:1646 */
2103 {
2104 ((yyval.DOUBLE)) = (((yyvsp[-1].TESTOP)) == STRATTESTSUB) ? - ((yyvsp[0].DOUBLE)) : ((yyvsp[0].DOUBLE));
2105 }
2106 #line 2107 "y.tab.c" /* yacc.c:1646 */
2107 break;
2108
2109 case 64:
2110 #line 745 "parser_yy.y" /* yacc.c:1646 */
2111 {
2112 ((yyval.INTEGER)) = (((yyvsp[-1].TESTOP)) == STRATTESTSUB) ? - ((yyvsp[0].INTEGER)) : ((yyvsp[0].INTEGER));
2113 }
2114 #line 2115 "y.tab.c" /* yacc.c:1646 */
2115 break;
2116
2117
2118 #line 2119 "y.tab.c" /* yacc.c:1646 */
2119 default: break;
2120 }
2121 /* User semantic actions sometimes alter yychar, and that requires
2122 that yytoken be updated with the new translation. We take the
2123 approach of translating immediately before every use of yytoken.
2124 One alternative is translating here after every semantic action,
2125 but that translation would be missed if the semantic action invokes
2126 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2127 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2128 incorrect destructor might then be invoked immediately. In the
2129 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2130 to an incorrect destructor call or verbose syntax error message
2131 before the lookahead is translated. */
2132 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2133
2134 YYPOPSTACK (yylen);
2135 yylen = 0;
2136 YY_STACK_PRINT (yyss, yyssp);
2137
2138 *++yyvsp = yyval;
2139
2140 /* Now 'shift' the result of the reduction. Determine what state
2141 that goes to, based on the state we popped back to and the rule
2142 number reduced by. */
2143
2144 yyn = yyr1[yyn];
2145
2146 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2147 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2148 yystate = yytable[yystate];
2149 else
2150 yystate = yydefgoto[yyn - YYNTOKENS];
2151
2152 goto yynewstate;
2153
2154
2155 /*--------------------------------------.
2156 | yyerrlab -- here on detecting error. |
2157 `--------------------------------------*/
2158 yyerrlab:
2159 /* Make sure we have latest lookahead translation. See comments at
2160 user semantic actions for why this is necessary. */
2161 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2162
2163 /* If not already recovering from an error, report this error. */
2164 if (!yyerrstatus)
2165 {
2166 ++yynerrs;
2167 #if ! YYERROR_VERBOSE
2168 yyerror (YY_("syntax error"));
2169 #else
2170 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2171 yyssp, yytoken)
2172 {
2173 char const *yymsgp = YY_("syntax error");
2174 int yysyntax_error_status;
2175 yysyntax_error_status = YYSYNTAX_ERROR;
2176 if (yysyntax_error_status == 0)
2177 yymsgp = yymsg;
2178 else if (yysyntax_error_status == 1)
2179 {
2180 if (yymsg != yymsgbuf)
2181 YYSTACK_FREE (yymsg);
2182 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2183 if (!yymsg)
2184 {
2185 yymsg = yymsgbuf;
2186 yymsg_alloc = sizeof yymsgbuf;
2187 yysyntax_error_status = 2;
2188 }
2189 else
2190 {
2191 yysyntax_error_status = YYSYNTAX_ERROR;
2192 yymsgp = yymsg;
2193 }
2194 }
2195 yyerror (yymsgp);
2196 if (yysyntax_error_status == 2)
2197 goto yyexhaustedlab;
2198 }
2199 # undef YYSYNTAX_ERROR
2200 #endif
2201 }
2202
2203
2204
2205 if (yyerrstatus == 3)
2206 {
2207 /* If just tried and failed to reuse lookahead token after an
2208 error, discard it. */
2209
2210 if (yychar <= YYEOF)
2211 {
2212 /* Return failure if at end of input. */
2213 if (yychar == YYEOF)
2214 YYABORT;
2215 }
2216 else
2217 {
2218 yydestruct ("Error: discarding",
2219 yytoken, &yylval);
2220 yychar = YYEMPTY;
2221 }
2222 }
2223
2224 /* Else will try to reuse lookahead token after shifting the error
2225 token. */
2226 goto yyerrlab1;
2227
2228
2229 /*---------------------------------------------------.
2230 | yyerrorlab -- error raised explicitly by YYERROR. |
2231 `---------------------------------------------------*/
2232 yyerrorlab:
2233
2234 /* Pacify compilers like GCC when the user code never invokes
2235 YYERROR and the label yyerrorlab therefore never appears in user
2236 code. */
2237 if (/*CONSTCOND*/ 0)
2238 goto yyerrorlab;
2239
2240 /* Do not reclaim the symbols of the rule whose action triggered
2241 this YYERROR. */
2242 YYPOPSTACK (yylen);
2243 yylen = 0;
2244 YY_STACK_PRINT (yyss, yyssp);
2245 yystate = *yyssp;
2246 goto yyerrlab1;
2247
2248
2249 /*-------------------------------------------------------------.
2250 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2251 `-------------------------------------------------------------*/
2252 yyerrlab1:
2253 yyerrstatus = 3; /* Each real token shifted decrements this. */
2254
2255 for (;;)
2256 {
2257 yyn = yypact[yystate];
2258 if (!yypact_value_is_default (yyn))
2259 {
2260 yyn += YYTERROR;
2261 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2262 {
2263 yyn = yytable[yyn];
2264 if (0 < yyn)
2265 break;
2266 }
2267 }
2268
2269 /* Pop the current state because it cannot handle the error token. */
2270 if (yyssp == yyss)
2271 YYABORT;
2272
2273
2274 yydestruct ("Error: popping",
2275 yystos[yystate], yyvsp);
2276 YYPOPSTACK (1);
2277 yystate = *yyssp;
2278 YY_STACK_PRINT (yyss, yyssp);
2279 }
2280
2281 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2282 *++yyvsp = yylval;
2283 YY_IGNORE_MAYBE_UNINITIALIZED_END
2284
2285
2286 /* Shift the error token. */
2287 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2288
2289 yystate = yyn;
2290 goto yynewstate;
2291
2292
2293 /*-------------------------------------.
2294 | yyacceptlab -- YYACCEPT comes here. |
2295 `-------------------------------------*/
2296 yyacceptlab:
2297 yyresult = 0;
2298 goto yyreturn;
2299
2300 /*-----------------------------------.
2301 | yyabortlab -- YYABORT comes here. |
2302 `-----------------------------------*/
2303 yyabortlab:
2304 yyresult = 1;
2305 goto yyreturn;
2306
2307 #if !defined yyoverflow || YYERROR_VERBOSE
2308 /*-------------------------------------------------.
2309 | yyexhaustedlab -- memory exhaustion comes here. |
2310 `-------------------------------------------------*/
2311 yyexhaustedlab:
2312 yyerror (YY_("memory exhausted"));
2313 yyresult = 2;
2314 /* Fall through. */
2315 #endif
2316
2317 yyreturn:
2318 if (yychar != YYEMPTY)
2319 {
2320 /* Make sure we have latest lookahead translation. See comments at
2321 user semantic actions for why this is necessary. */
2322 yytoken = YYTRANSLATE (yychar);
2323 yydestruct ("Cleanup: discarding lookahead",
2324 yytoken, &yylval);
2325 }
2326 /* Do not reclaim the symbols of the rule whose action triggered
2327 this YYABORT or YYACCEPT. */
2328 YYPOPSTACK (yylen);
2329 YY_STACK_PRINT (yyss, yyssp);
2330 while (yyssp != yyss)
2331 {
2332 yydestruct ("Cleanup: popping",
2333 yystos[*yyssp], yyvsp);
2334 YYPOPSTACK (1);
2335 }
2336 #ifndef yyoverflow
2337 if (yyss != yyssa)
2338 YYSTACK_FREE (yyss);
2339 #endif
2340 #if YYERROR_VERBOSE
2341 if (yymsg != yymsgbuf)
2342 YYSTACK_FREE (yymsg);
2343 #endif
2344 return yyresult;
2345 }
2346 #line 751 "parser_yy.y" /* yacc.c:1906 */
2347
2348
2349 /*
2350 ** The static and global definitions (bis).
2351 ** These are put at the end of the file because
2352 ** the token values that they use are not yet
2353 ** defined in the first section of the file.
2354 */
2355
2356 unsigned int parsermethtokentab[] = { /* Table for parameter/token type conversion */
2357 VALCASE,
2358 VALDOUBLE,
2359 VALINT,
2360 -1, /* No logical parameters */
2361 VALSTRAT,
2362 VALSTRING,
2363 -1 /* One more value to detect array overflow */
2364 };
2365
2366 /************************************/
2367 /* */
2368 /* These routines drive the parser. */
2369 /* */
2370 /************************************/
2371
2372 /* This routine is the entry point for
2373 ** the strategy parser.
2374 ** It returns:
2375 ** - !NULL : pointer to the strategy.
2376 ** - NULL : on error.
2377 */
2378
2379 Strat *
stratParserParse(const StratTab * const strattab,const char * const string)2380 stratParserParse (
2381 const StratTab * const strattab, /*+ Pointer to parsing tables +*/
2382 const char * const string) /*+ Strategy string to parse +*/
2383 {
2384 yyclearin; /* Reset the parser state */
2385
2386 #ifdef SCOTCH_DEBUG_PARSER3
2387 yydebug = 1; /* Set debugging if needed */
2388 #endif /* SCOTCH_DEBUG_PARSER3 */
2389
2390 stratParserInit (string); /* Initialize the lexical parser */
2391 parserstrattab = strattab; /* Point to the parsing tables */
2392 parserstratcurr = NULL; /* Clear up the temporary strategy pointer */
2393
2394 if (stratParserParse2 () != 0) { /* Parse the strategy string */
2395 if (parserstratcurr != NULL)
2396 stratExit (parserstratcurr);
2397 return (NULL);
2398 }
2399
2400 return (parserstratcurr); /* Return strategy pointer */
2401 }
2402
2403 /* This routine displays the parser error message.
2404 ** It returns:
2405 ** - 1 : in all cases.
2406 */
2407
2408 static
2409 int
stratParserError(const char * const errstr)2410 stratParserError (
2411 const char * const errstr)
2412 {
2413 errorPrint ("stratParserParse: invalid strategy string, before \"%s\"", stratParserRemain ());
2414 return (1);
2415 }
2416