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