1 /* A Bison parser, made by GNU Bison 2.5. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
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.
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.
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/>. */
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.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
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. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "2.5"
50 #define YYSKELETON_NAME "yacc.c"
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
64 /* Substitute the variable and function names. */
65 #define yyparse config_parse
66 #define yylex config_lex
67 #define yyerror config_error
68 #define yylval config_lval
69 #define yychar config_char
70 #define yydebug config_debug
71 #define yynerrs config_nerrs
74 /* Copy the first part of user declarations. */
76 /* Line 268 of yacc.c */
77 #line 36 "libmemcached/csl/parser.yy"
80 #include <libmemcached/csl/common.h>
81 #include <libmemcached/options.hpp>
83 #include <libmemcached/csl/context.h>
84 #include <libmemcached/csl/symbol.h>
85 #include <libmemcached/csl/scanner.h>
87 #ifndef __INTEL_COMPILER
88 #pragma GCC diagnostic ignored "-Wold-style-cast"
91 int conf_lex(YYSTYPE
* lvalp
, void* scanner
);
93 #define select_yychar(__context) yychar == UNKNOWN ? ( (__context)->previous_token == END ? UNKNOWN : (__context)->previous_token ) : yychar
95 #define stryytname(__yytokentype) ((__yytokentype) < YYNTOKENS ) ? yytname[(__yytokentype)] : ""
97 #define parser_abort(__context, __error_message) do { (__context)->abort((__error_message), yytokentype(select_yychar(__context)), stryytname(YYTRANSLATE(select_yychar(__context)))); YYABORT; } while (0)
99 // This is bison calling error.
100 inline void __config_error(Context
*context
, yyscan_t
*scanner
, const char *error
, int last_token
, const char *last_token_str
)
102 if (not context
->end())
104 context
->error(error
, yytokentype(last_token
), last_token_str
);
108 context
->error(error
, yytokentype(last_token
), last_token_str
);
112 #define config_error(__context, __scanner, __error_msg) do { __config_error((__context), (__scanner), (__error_msg), select_yychar(__context), stryytname(YYTRANSLATE(select_yychar(__context)))); } while (0)
117 /* Line 268 of yacc.c */
118 #line 119 "libmemcached/csl/parser.cc"
120 /* Enabling traces. */
125 /* Enabling verbose error messages. */
126 #ifdef YYERROR_VERBOSE
127 # undef YYERROR_VERBOSE
128 # define YYERROR_VERBOSE 1
130 # define YYERROR_VERBOSE 1
133 /* Enabling the token table. */
134 #ifndef YYTOKEN_TABLE
135 # define YYTOKEN_TABLE 0
142 /* Put the tokens into the symbol table, so that GDB and other debuggers
151 CONFIGURE_FILE
= 264,
156 SERVERS_OPTION
= 269,
157 UNKNOWN_OPTION
= 270,
159 BINARY_PROTOCOL
= 272,
160 BUFFER_REQUESTS
= 273,
161 CONNECT_TIMEOUT
= 274,
164 HASH_WITH_NAMESPACE
= 277,
165 IO_BYTES_WATERMARK
= 278,
166 IO_KEY_PREFETCH
= 279,
167 IO_MSG_WATERMARK
= 280,
169 KETAMA_WEIGHTED
= 282,
171 NUMBER_OF_REPLICAS
= 284,
173 RANDOMIZE_REPLICA_READ
= 286,
175 REMOVE_FAILED_SERVERS
= 288,
178 SOCKET_RECV_SIZE
= 291,
179 SOCKET_SEND_SIZE
= 292,
185 _TCP_KEEPALIVE
= 298,
219 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
221 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
222 # define YYSTYPE_IS_DECLARED 1
226 /* Copy the second part of user declarations. */
229 /* Line 343 of yacc.c */
230 #line 231 "libmemcached/csl/parser.cc"
237 typedef YYTYPE_UINT8 yytype_uint8
;
239 typedef unsigned char yytype_uint8
;
243 typedef YYTYPE_INT8 yytype_int8
;
244 #elif (defined __STDC__ || defined __C99__FUNC__ \
245 || defined __cplusplus || defined _MSC_VER)
246 typedef signed char yytype_int8
;
248 typedef short int yytype_int8
;
252 typedef YYTYPE_UINT16 yytype_uint16
;
254 typedef unsigned short int yytype_uint16
;
258 typedef YYTYPE_INT16 yytype_int16
;
260 typedef short int yytype_int16
;
264 # ifdef __SIZE_TYPE__
265 # define YYSIZE_T __SIZE_TYPE__
266 # elif defined size_t
267 # define YYSIZE_T size_t
268 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
269 || defined __cplusplus || defined _MSC_VER)
270 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
271 # define YYSIZE_T size_t
273 # define YYSIZE_T unsigned int
277 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
280 # if defined YYENABLE_NLS && YYENABLE_NLS
282 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
283 # define YY_(msgid) dgettext ("bison-runtime", msgid)
287 # define YY_(msgid) msgid
291 /* Suppress unused-variable warnings by "using" E. */
292 #if ! defined lint || defined __GNUC__
293 # define YYUSE(e) ((void) (e))
295 # define YYUSE(e) /* empty */
298 /* Identity function, used to suppress warnings about constant conditions. */
302 #if (defined __STDC__ || defined __C99__FUNC__ \
303 || defined __cplusplus || defined _MSC_VER)
316 #if ! defined yyoverflow || YYERROR_VERBOSE
318 /* The parser invokes alloca or malloc; define the necessary symbols. */
320 # ifdef YYSTACK_USE_ALLOCA
321 # if YYSTACK_USE_ALLOCA
323 # define YYSTACK_ALLOC __builtin_alloca
324 # elif defined __BUILTIN_VA_ARG_INCR
325 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
327 # define YYSTACK_ALLOC __alloca
328 # elif defined _MSC_VER
329 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
330 # define alloca _alloca
332 # define YYSTACK_ALLOC alloca
333 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
334 || defined __cplusplus || defined _MSC_VER)
335 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
336 # ifndef EXIT_SUCCESS
337 # define EXIT_SUCCESS 0
344 # ifdef YYSTACK_ALLOC
345 /* Pacify GCC's `empty if-body' warning. */
346 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
347 # ifndef YYSTACK_ALLOC_MAXIMUM
348 /* The OS might guarantee only one guard page at the bottom of the stack,
349 and a page size can be as small as 4096 bytes. So we cannot safely
350 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
351 to allow for a few compiler-allocated temporary stack slots. */
352 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
355 # define YYSTACK_ALLOC YYMALLOC
356 # define YYSTACK_FREE YYFREE
357 # ifndef YYSTACK_ALLOC_MAXIMUM
358 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
360 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
361 && ! ((defined YYMALLOC || defined malloc) \
362 && (defined YYFREE || defined free)))
363 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
364 # ifndef EXIT_SUCCESS
365 # define EXIT_SUCCESS 0
369 # define YYMALLOC malloc
370 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
371 || defined __cplusplus || defined _MSC_VER)
372 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
377 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
378 || defined __cplusplus || defined _MSC_VER)
379 void free (void *); /* INFRINGES ON USER NAME SPACE */
383 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
386 #if (! defined yyoverflow \
387 && (! defined __cplusplus \
388 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
390 /* A type that is properly aligned for any stack member. */
393 yytype_int16 yyss_alloc
;
397 /* The size of the maximum gap between one aligned stack and the next. */
398 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
400 /* The size of an array large to enough to hold all stacks, each with
402 # define YYSTACK_BYTES(N) \
403 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
404 + YYSTACK_GAP_MAXIMUM)
406 # define YYCOPY_NEEDED 1
408 /* Relocate STACK from its old location to the new one. The
409 local variables YYSIZE and YYSTACKSIZE give the old and new number of
410 elements in the stack, and YYPTR gives the new location of the
411 stack. Advance YYPTR to a properly aligned location for the next
413 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
416 YYSIZE_T yynewbytes; \
417 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
418 Stack = &yyptr->Stack_alloc; \
419 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
420 yyptr += yynewbytes / sizeof (*yyptr); \
426 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
427 /* Copy COUNT objects from FROM to TO. The source and destination do
430 # if defined __GNUC__ && 1 < __GNUC__
431 # define YYCOPY(To, From, Count) \
432 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
434 # define YYCOPY(To, From, Count) \
438 for (yyi = 0; yyi < (Count); yyi++) \
439 (To)[yyi] = (From)[yyi]; \
444 #endif /* !YYCOPY_NEEDED */
446 /* YYFINAL -- State number of the termination state. */
448 /* YYLAST -- Last index in YYTABLE. */
451 /* YYNTOKENS -- Number of terminals. */
453 /* YYNNTS -- Number of nonterminals. */
455 /* YYNRULES -- Number of rules. */
457 /* YYNRULES -- Number of states. */
460 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
462 #define YYMAXUTOK 326
464 #define YYTRANSLATE(YYX) \
465 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
467 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
468 static const yytype_uint8 yytranslate
[] =
470 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 74, 2, 2, 2, 2, 2, 2, 2,
474 2, 2, 2, 2, 63, 2, 2, 2, 2, 2,
475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476 2, 64, 2, 2, 2, 2, 2, 2, 2, 2,
477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
496 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
497 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
498 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
499 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
500 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
501 55, 56, 57, 58, 59, 60, 61, 62, 65, 66,
502 67, 68, 69, 70, 71, 72, 73
506 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
508 static const yytype_uint8 yyprhs
[] =
510 0, 0, 3, 5, 9, 11, 13, 15, 17, 19,
511 21, 23, 27, 32, 37, 41, 44, 47, 50, 52,
512 55, 58, 63, 66, 69, 71, 73, 75, 77, 79,
513 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,
514 101, 103, 105, 107, 109, 111, 113, 115, 117, 119,
515 121, 122, 124, 125, 127, 129, 131, 133, 135, 137,
516 139, 141, 143, 145, 147, 149, 151, 153
519 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
520 static const yytype_int8 yyrhs
[] =
522 76, 0, -1, 77, -1, 76, 74, 77, -1, 78,
523 -1, 3, -1, 10, -1, 4, -1, 5, -1, 6,
524 -1, 7, -1, 8, 74, 85, -1, 11, 70, 82,
525 83, -1, 11, 69, 82, 83, -1, 12, 85, 83,
526 -1, 9, 85, -1, 47, 66, -1, 48, 66, -1,
527 79, -1, 46, 85, -1, 20, 86, -1, 20, 86,
528 63, 84, -1, 21, 84, -1, 80, 66, -1, 81,
529 -1, 40, -1, 33, -1, 19, -1, 25, -1, 23,
530 -1, 24, -1, 29, -1, 30, -1, 32, -1, 34,
531 -1, 35, -1, 36, -1, 37, -1, 17, -1, 18,
532 -1, 22, -1, 28, -1, 31, -1, 38, -1, 39,
533 -1, 45, -1, 43, -1, 44, -1, 41, -1, 42,
534 -1, -1, 67, -1, -1, 68, -1, 49, -1, 50,
535 -1, 51, -1, 52, -1, 53, -1, 54, -1, 55,
536 -1, 56, -1, 57, -1, 71, -1, 72, -1, 58,
540 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
541 static const yytype_uint16 yyrline
[] =
543 0, 172, 172, 173, 177, 179, 181, 183, 188, 193,
544 197, 201, 212, 222, 232, 241, 245, 249, 253, 257,
545 269, 282, 295, 302, 309, 318, 324, 328, 332, 336,
546 340, 344, 348, 352, 356, 360, 364, 368, 375, 379,
547 383, 387, 391, 395, 399, 403, 407, 411, 415, 419,
548 426, 427, 432, 433, 438, 442, 446, 450, 454, 458,
549 462, 466, 470, 477, 481, 488, 492, 496
553 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
554 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
555 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
556 static const char *const yytname
[] =
558 "$end", "error", "$undefined", "COMMENT", "END", "ERROR", "RESET",
559 "PARSER_DEBUG", "INCLUDE", "CONFIGURE_FILE", "EMPTY_LINE", "SERVER",
560 "SOCKET", "SERVERS", "SERVERS_OPTION", "UNKNOWN_OPTION", "UNKNOWN",
561 "BINARY_PROTOCOL", "BUFFER_REQUESTS", "CONNECT_TIMEOUT", "DISTRIBUTION",
562 "HASH", "HASH_WITH_NAMESPACE", "IO_BYTES_WATERMARK", "IO_KEY_PREFETCH",
563 "IO_MSG_WATERMARK", "KETAMA_HASH", "KETAMA_WEIGHTED", "NOREPLY",
564 "NUMBER_OF_REPLICAS", "POLL_TIMEOUT", "RANDOMIZE_REPLICA_READ",
565 "RCV_TIMEOUT", "REMOVE_FAILED_SERVERS", "RETRY_TIMEOUT", "SND_TIMEOUT",
566 "SOCKET_RECV_SIZE", "SOCKET_SEND_SIZE", "SORT_HOSTS", "SUPPORT_CAS",
567 "USER_DATA", "USE_UDP", "VERIFY_KEY", "_TCP_KEEPALIVE", "_TCP_KEEPIDLE",
568 "_TCP_NODELAY", "NAMESPACE", "POOL_MIN", "POOL_MAX", "MD5", "CRC",
569 "FNV1_64", "FNV1A_64", "FNV1_32", "FNV1A_32", "HSIEH", "MURMUR",
570 "JENKINS", "CONSISTENT", "MODULA", "RANDOM", "TRUE", "FALSE", "','",
571 "'='", "FLOAT", "NUMBER", "PORT", "WEIGHT_START", "IPADDRESS",
572 "HOSTNAME", "STRING", "QUOTED_STRING", "FILE_PATH", "' '", "$accept",
573 "begin", "statement", "expression", "behaviors", "behavior_number",
574 "behavior_boolean", "optional_port", "optional_weight", "hash", "string",
580 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
582 static const yytype_uint16 yytoknum
[] =
584 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
585 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
586 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
587 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
588 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
589 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
590 315, 316, 317, 44, 61, 318, 319, 320, 321, 322,
591 323, 324, 325, 326, 32
595 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
596 static const yytype_uint8 yyr1
[] =
598 0, 75, 76, 76, 77, 77, 77, 77, 77, 77,
599 77, 77, 78, 78, 78, 78, 78, 78, 78, 79,
600 79, 79, 79, 79, 79, 79, 80, 80, 80, 80,
601 80, 80, 80, 80, 80, 80, 80, 80, 81, 81,
602 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
603 82, 82, 83, 83, 84, 84, 84, 84, 84, 84,
604 84, 84, 84, 85, 85, 86, 86, 86
607 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
608 static const yytype_uint8 yyr2
[] =
610 0, 2, 1, 3, 1, 1, 1, 1, 1, 1,
611 1, 3, 4, 4, 3, 2, 2, 2, 1, 2,
612 2, 4, 2, 2, 1, 1, 1, 1, 1, 1,
613 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
614 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
615 0, 1, 0, 1, 1, 1, 1, 1, 1, 1,
616 1, 1, 1, 1, 1, 1, 1, 1
619 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
620 Performed when YYTABLE doesn't specify something else to do. Zero
621 means the default is an error. */
622 static const yytype_uint8 yydefact
[] =
624 0, 5, 7, 8, 9, 10, 0, 0, 6, 0,
625 0, 38, 39, 27, 0, 0, 40, 29, 30, 28,
626 41, 31, 32, 42, 33, 26, 34, 35, 36, 37,
627 43, 44, 25, 48, 49, 46, 47, 45, 0, 0,
628 0, 0, 2, 4, 18, 0, 24, 0, 63, 64,
629 15, 50, 50, 52, 65, 66, 67, 20, 54, 55,
630 56, 57, 58, 59, 60, 61, 62, 22, 19, 16,
631 17, 1, 0, 23, 11, 51, 52, 52, 53, 14,
635 /* YYDEFGOTO[NTERM-NUM]. */
636 static const yytype_int8 yydefgoto
[] =
638 -1, 41, 42, 43, 44, 45, 46, 76, 79, 67,
642 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
644 #define YYPACT_NINF -61
645 static const yytype_int8 yypact
[] =
647 -2, -61, -61, -61, -61, -61, -60, -24, -61, -20,
648 -24, -61, -61, -61, -47, 13, -61, -61, -61, -61,
649 -61, -61, -61, -61, -61, -61, -61, -61, -61, -61,
650 -61, -61, -61, -61, -61, -61, -61, -61, -24, -41,
651 -15, 0, -61, -61, -61, -11, -61, -24, -61, -61,
652 -61, -10, -10, -12, -61, -61, -61, -5, -61, -61,
653 -61, -61, -61, -61, -61, -61, -61, -61, -61, -61,
654 -61, -61, -2, -61, -61, -61, -12, -12, -61, -61,
655 13, -61, -61, -61, -61
658 /* YYPGOTO[NTERM-NUM]. */
659 static const yytype_int8 yypgoto
[] =
661 -61, -61, -13, -61, -61, -61, -61, 8, -23, -9,
665 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
666 positive, shift that token. If negative, reduce the rule which
667 number is the opposite. If YYTABLE_NINF, syntax error. */
668 #define YYTABLE_NINF -1
669 static const yytype_uint8 yytable
[] =
671 71, 1, 2, 3, 4, 5, 6, 7, 8, 9,
672 10, 54, 55, 56, 47, 11, 12, 13, 14, 15,
673 16, 17, 18, 19, 53, 69, 20, 21, 22, 23,
674 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
675 34, 35, 36, 37, 38, 39, 40, 48, 49, 51,
676 52, 70, 68, 82, 83, 73, 78, 75, 80, 81,
677 77, 74, 58, 59, 60, 61, 62, 63, 64, 65,
681 #define yypact_value_is_default(yystate) \
684 #define yytable_value_is_error(yytable_value) \
687 static const yytype_int8 yycheck
[] =
689 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
690 12, 58, 59, 60, 74, 17, 18, 19, 20, 21,
691 22, 23, 24, 25, 10, 66, 28, 29, 30, 31,
692 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
693 42, 43, 44, 45, 46, 47, 48, 71, 72, 69,
694 70, 66, 38, 76, 77, 66, 68, 67, 63, 72,
695 52, 47, 49, 50, 51, 52, 53, 54, 55, 56,
699 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
700 symbol of state STATE-NUM. */
701 static const yytype_uint8 yystos
[] =
703 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
704 12, 17, 18, 19, 20, 21, 22, 23, 24, 25,
705 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
706 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
707 48, 76, 77, 78, 79, 80, 81, 74, 71, 72,
708 85, 69, 70, 85, 58, 59, 60, 86, 49, 50,
709 51, 52, 53, 54, 55, 56, 57, 84, 85, 66,
710 66, 0, 74, 66, 85, 67, 82, 82, 68, 83,
714 #define yyerrok (yyerrstatus = 0)
715 #define yyclearin (yychar = YYEMPTY)
719 #define YYACCEPT goto yyacceptlab
720 #define YYABORT goto yyabortlab
721 #define YYERROR goto yyerrorlab
724 /* Like YYERROR except do call yyerror. This remains here temporarily
725 to ease the transition to the new meaning of YYERROR, for GCC.
726 Once GCC version 2 has supplanted version 1, this can go. However,
727 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
728 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
731 #define YYFAIL goto yyerrlab
733 /* This is here to suppress warnings from the GCC cpp's
734 -Wunused-macros. Normally we don't worry about that warning, but
735 some users do, and we want to make it easy for users to remove
736 YYFAIL uses, which will produce warnings from Bison 2.5. */
739 #define YYRECOVERING() (!!yyerrstatus)
741 #define YYBACKUP(Token, Value) \
743 if (yychar == YYEMPTY && yylen == 1) \
752 yyerror (context, scanner, YY_("syntax error: cannot back up")); \
759 #define YYERRCODE 256
762 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
763 If N is 0, then set CURRENT to the empty location which ends
764 the previous symbol: RHS[0] (always defined). */
766 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
767 #ifndef YYLLOC_DEFAULT
768 # define YYLLOC_DEFAULT(Current, Rhs, N) \
772 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
773 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
774 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
775 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
779 (Current).first_line = (Current).last_line = \
780 YYRHSLOC (Rhs, 0).last_line; \
781 (Current).first_column = (Current).last_column = \
782 YYRHSLOC (Rhs, 0).last_column; \
788 /* This macro is provided for backward compatibility. */
790 #ifndef YY_LOCATION_PRINT
791 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
795 /* YYLEX -- calling `yylex' with the right arguments. */
798 # define YYLEX yylex (&yylval, YYLEX_PARAM)
800 # define YYLEX yylex (&yylval, scanner)
803 /* Enable debugging if requested. */
807 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
808 # define YYFPRINTF fprintf
811 # define YYDPRINTF(Args) \
817 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
821 YYFPRINTF (stderr, "%s ", Title); \
822 yy_symbol_print (stderr, \
823 Type, Value, context, scanner); \
824 YYFPRINTF (stderr, "\n"); \
829 /*--------------------------------.
830 | Print this symbol on YYOUTPUT. |
831 `--------------------------------*/
834 #if (defined __STDC__ || defined __C99__FUNC__ \
835 || defined __cplusplus || defined _MSC_VER)
837 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, Context
*context
, yyscan_t
*scanner
)
840 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, context
, scanner
)
843 YYSTYPE
const * const yyvaluep
;
853 if (yytype
< YYNTOKENS
)
854 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
866 /*--------------------------------.
867 | Print this symbol on YYOUTPUT. |
868 `--------------------------------*/
870 #if (defined __STDC__ || defined __C99__FUNC__ \
871 || defined __cplusplus || defined _MSC_VER)
873 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, Context
*context
, yyscan_t
*scanner
)
876 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, context
, scanner
)
879 YYSTYPE
const * const yyvaluep
;
884 if (yytype
< YYNTOKENS
)
885 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
887 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
889 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, context
, scanner
);
890 YYFPRINTF (yyoutput
, ")");
893 /*------------------------------------------------------------------.
894 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
896 `------------------------------------------------------------------*/
898 #if (defined __STDC__ || defined __C99__FUNC__ \
899 || defined __cplusplus || defined _MSC_VER)
901 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
904 yy_stack_print (yybottom
, yytop
)
905 yytype_int16
*yybottom
;
909 YYFPRINTF (stderr
, "Stack now");
910 for (; yybottom
<= yytop
; yybottom
++)
912 int yybot
= *yybottom
;
913 YYFPRINTF (stderr
, " %d", yybot
);
915 YYFPRINTF (stderr
, "\n");
918 # define YY_STACK_PRINT(Bottom, Top) \
921 yy_stack_print ((Bottom), (Top)); \
925 /*------------------------------------------------.
926 | Report that the YYRULE is going to be reduced. |
927 `------------------------------------------------*/
929 #if (defined __STDC__ || defined __C99__FUNC__ \
930 || defined __cplusplus || defined _MSC_VER)
932 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
, Context
*context
, yyscan_t
*scanner
)
935 yy_reduce_print (yyvsp
, yyrule
, context
, scanner
)
942 int yynrhs
= yyr2
[yyrule
];
944 unsigned long int yylno
= yyrline
[yyrule
];
945 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
947 /* The symbols being reduced. */
948 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
950 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
951 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
952 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
954 YYFPRINTF (stderr
, "\n");
958 # define YY_REDUCE_PRINT(Rule) \
961 yy_reduce_print (yyvsp, Rule, context, scanner); \
964 /* Nonzero means print parse trace. It is left uninitialized so that
965 multiple parsers can coexist. */
968 # define YYDPRINTF(Args)
969 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
970 # define YY_STACK_PRINT(Bottom, Top)
971 # define YY_REDUCE_PRINT(Rule)
972 #endif /* !YYDEBUG */
975 /* YYINITDEPTH -- initial size of the parser's stacks. */
977 # define YYINITDEPTH 200
980 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
981 if the built-in stack extension method is used).
983 Do not make this value too large; the results are undefined if
984 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
985 evaluated with infinite-precision integer arithmetic. */
988 # define YYMAXDEPTH 10000
995 # if defined __GLIBC__ && defined _STRING_H
996 # define yystrlen strlen
998 /* Return the length of YYSTR. */
999 #if (defined __STDC__ || defined __C99__FUNC__ \
1000 || defined __cplusplus || defined _MSC_VER)
1002 yystrlen (const char *yystr
)
1010 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1018 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1019 # define yystpcpy stpcpy
1021 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1023 #if (defined __STDC__ || defined __C99__FUNC__ \
1024 || defined __cplusplus || defined _MSC_VER)
1026 yystpcpy (char *yydest
, const char *yysrc
)
1029 yystpcpy (yydest
, yysrc
)
1035 const char *yys
= yysrc
;
1037 while ((*yyd
++ = *yys
++) != '\0')
1046 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1047 quotes and backslashes, so that it's suitable for yyerror. The
1048 heuristic is that double-quoting is unnecessary unless the string
1049 contains an apostrophe, a comma, or backslash (other than
1050 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1051 null, do not copy; instead, return the length of what the result
1054 yytnamerr (char *yyres
, const char *yystr
)
1059 char const *yyp
= yystr
;
1066 goto do_not_strip_quotes
;
1070 goto do_not_strip_quotes
;
1083 do_not_strip_quotes
: ;
1087 return yystrlen (yystr
);
1089 return yystpcpy (yyres
, yystr
) - yyres
;
1093 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1094 about the unexpected token YYTOKEN for the state stack whose top is
1097 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1098 not large enough to hold the message. In that case, also set
1099 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1100 required number of bytes is too large to store. */
1102 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1103 yytype_int16
*yyssp
, int yytoken
)
1105 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytoken
]);
1106 YYSIZE_T yysize
= yysize0
;
1108 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1109 /* Internationalized format string. */
1110 const char *yyformat
= 0;
1111 /* Arguments of yyformat. */
1112 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1113 /* Number of reported tokens (one for the "unexpected", one per
1117 /* There are many possibilities here to consider:
1118 - Assume YYFAIL is not used. It's too flawed to consider. See
1119 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1120 for details. YYERROR is fine as it does not invoke this
1122 - If this state is a consistent state with a default action, then
1123 the only way this function was invoked is if the default action
1124 is an error action. In that case, don't check for expected
1125 tokens because there are none.
1126 - The only way there can be no lookahead present (in yychar) is if
1127 this state is a consistent state with a default action. Thus,
1128 detecting the absence of a lookahead is sufficient to determine
1129 that there is no unexpected or expected token to report. In that
1130 case, just report a simple "syntax error".
1131 - Don't assume there isn't a lookahead just because this state is a
1132 consistent state with a default action. There might have been a
1133 previous inconsistent state, consistent state with a non-default
1134 action, or user semantic action that manipulated yychar.
1135 - Of course, the expected token list depends on states to have
1136 correct lookahead information, and it depends on the parser not
1137 to perform extra reductions after fetching a lookahead from the
1138 scanner and before detecting a syntax error. Thus, state merging
1139 (from LALR or IELR) and default reductions corrupt the expected
1140 token list. However, the list is correct for canonical LR with
1141 one exception: it will still contain any token that will not be
1142 accepted due to an error action in a later state.
1144 if (yytoken
!= YYEMPTY
)
1146 int yyn
= yypact
[*yyssp
];
1147 yyarg
[yycount
++] = yytname
[yytoken
];
1148 if (!yypact_value_is_default (yyn
))
1150 /* Start YYX at -YYN if negative to avoid negative indexes in
1151 YYCHECK. In other words, skip the first -YYN actions for
1152 this state because they are default actions. */
1153 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1154 /* Stay within bounds of both yycheck and yytname. */
1155 int yychecklim
= YYLAST
- yyn
+ 1;
1156 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1159 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1160 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1161 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1163 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1169 yyarg
[yycount
++] = yytname
[yyx
];
1170 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1171 if (! (yysize
<= yysize1
1172 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1181 # define YYCASE_(N, S) \
1185 YYCASE_(0, YY_("syntax error"));
1186 YYCASE_(1, YY_("syntax error, unexpected %s"));
1187 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1188 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1189 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1190 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1194 yysize1
= yysize
+ yystrlen (yyformat
);
1195 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1199 if (*yymsg_alloc
< yysize
)
1201 *yymsg_alloc
= 2 * yysize
;
1202 if (! (yysize
<= *yymsg_alloc
1203 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1204 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1208 /* Avoid sprintf, as that infringes on the user's name space.
1209 Don't have undefined behavior even if the translation
1210 produced a string with the wrong number of "%s"s. */
1214 while ((*yyp
= *yyformat
) != '\0')
1215 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1217 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1228 #endif /* YYERROR_VERBOSE */
1230 /*-----------------------------------------------.
1231 | Release the memory associated to this symbol. |
1232 `-----------------------------------------------*/
1235 #if (defined __STDC__ || defined __C99__FUNC__ \
1236 || defined __cplusplus || defined _MSC_VER)
1238 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, Context
*context
, yyscan_t
*scanner
)
1241 yydestruct (yymsg
, yytype
, yyvaluep
, context
, scanner
)
1255 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1266 /* Prevent warnings from -Wmissing-prototypes. */
1267 #ifdef YYPARSE_PARAM
1268 #if defined __STDC__ || defined __cplusplus
1269 int yyparse (void *YYPARSE_PARAM
);
1273 #else /* ! YYPARSE_PARAM */
1274 #if defined __STDC__ || defined __cplusplus
1275 int yyparse (Context
*context
, yyscan_t
*scanner
);
1279 #endif /* ! YYPARSE_PARAM */
1286 #ifdef YYPARSE_PARAM
1287 #if (defined __STDC__ || defined __C99__FUNC__ \
1288 || defined __cplusplus || defined _MSC_VER)
1290 yyparse (void *YYPARSE_PARAM
)
1293 yyparse (YYPARSE_PARAM
)
1294 void *YYPARSE_PARAM
;
1296 #else /* ! YYPARSE_PARAM */
1297 #if (defined __STDC__ || defined __C99__FUNC__ \
1298 || defined __cplusplus || defined _MSC_VER)
1300 yyparse (Context
*context
, yyscan_t
*scanner
)
1303 yyparse (context
, scanner
)
1309 /* The lookahead symbol. */
1312 /* The semantic value of the lookahead symbol. */
1315 /* Number of syntax errors so far. */
1319 /* Number of tokens to shift before error messages enabled. */
1322 /* The stacks and their tools:
1323 `yyss': related to states.
1324 `yyvs': related to semantic values.
1326 Refer to the stacks thru separate pointers, to allow yyoverflow
1327 to reallocate them elsewhere. */
1329 /* The state stack. */
1330 yytype_int16 yyssa
[YYINITDEPTH
];
1332 yytype_int16
*yyssp
;
1334 /* The semantic value stack. */
1335 YYSTYPE yyvsa
[YYINITDEPTH
];
1339 YYSIZE_T yystacksize
;
1343 /* Lookahead token as an internal (translated) token number. */
1345 /* The variables used to return semantic value and location from the
1350 /* Buffer for error messages, and its allocated size. */
1352 char *yymsg
= yymsgbuf
;
1353 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1356 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1358 /* The number of symbols on the RHS of the reduced rule.
1359 Keep to zero when no symbol should be popped. */
1365 yystacksize
= YYINITDEPTH
;
1367 YYDPRINTF ((stderr
, "Starting parse\n"));
1372 yychar
= YYEMPTY
; /* Cause a token to be read. */
1374 /* Initialize stack pointers.
1375 Waste one element of value and location stack
1376 so that they stay on the same level as the state stack.
1377 The wasted elements are never initialized. */
1383 /*------------------------------------------------------------.
1384 | yynewstate -- Push a new state, which is found in yystate. |
1385 `------------------------------------------------------------*/
1387 /* In all cases, when you get here, the value and location stacks
1388 have just been pushed. So pushing a state here evens the stacks. */
1394 if (yyss
+ yystacksize
- 1 <= yyssp
)
1396 /* Get the current used size of the three stacks, in elements. */
1397 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1401 /* Give user a chance to reallocate the stack. Use copies of
1402 these so that the &'s don't force the real ones into
1404 YYSTYPE
*yyvs1
= yyvs
;
1405 yytype_int16
*yyss1
= yyss
;
1407 /* Each stack pointer address is followed by the size of the
1408 data in use in that stack, in bytes. This used to be a
1409 conditional around just the two extra args, but that might
1410 be undefined if yyoverflow is a macro. */
1411 yyoverflow (YY_("memory exhausted"),
1412 &yyss1
, yysize
* sizeof (*yyssp
),
1413 &yyvs1
, yysize
* sizeof (*yyvsp
),
1419 #else /* no yyoverflow */
1420 # ifndef YYSTACK_RELOCATE
1421 goto yyexhaustedlab
;
1423 /* Extend the stack our own way. */
1424 if (YYMAXDEPTH
<= yystacksize
)
1425 goto yyexhaustedlab
;
1427 if (YYMAXDEPTH
< yystacksize
)
1428 yystacksize
= YYMAXDEPTH
;
1431 yytype_int16
*yyss1
= yyss
;
1432 union yyalloc
*yyptr
=
1433 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1435 goto yyexhaustedlab
;
1436 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1437 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1438 # undef YYSTACK_RELOCATE
1440 YYSTACK_FREE (yyss1
);
1443 #endif /* no yyoverflow */
1445 yyssp
= yyss
+ yysize
- 1;
1446 yyvsp
= yyvs
+ yysize
- 1;
1448 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1449 (unsigned long int) yystacksize
));
1451 if (yyss
+ yystacksize
- 1 <= yyssp
)
1455 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1457 if (yystate
== YYFINAL
)
1467 /* Do appropriate processing given the current state. Read a
1468 lookahead token if we need one and don't already have one. */
1470 /* First try to decide what to do without reference to lookahead token. */
1471 yyn
= yypact
[yystate
];
1472 if (yypact_value_is_default (yyn
))
1475 /* Not known => get a lookahead token if don't already have one. */
1477 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1478 if (yychar
== YYEMPTY
)
1480 YYDPRINTF ((stderr
, "Reading a token: "));
1484 if (yychar
<= YYEOF
)
1486 yychar
= yytoken
= YYEOF
;
1487 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1491 yytoken
= YYTRANSLATE (yychar
);
1492 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1495 /* If the proper action on seeing token YYTOKEN is to reduce or to
1496 detect an error, take that action. */
1498 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1503 if (yytable_value_is_error (yyn
))
1509 /* Count tokens shifted since error; after three, turn off error
1514 /* Shift the lookahead token. */
1515 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1517 /* Discard the shifted token. */
1526 /*-----------------------------------------------------------.
1527 | yydefault -- do the default action for the current state. |
1528 `-----------------------------------------------------------*/
1530 yyn
= yydefact
[yystate
];
1536 /*-----------------------------.
1537 | yyreduce -- Do a reduction. |
1538 `-----------------------------*/
1540 /* yyn is the number of a rule to reduce with. */
1543 /* If YYLEN is nonzero, implement the default value of the action:
1546 Otherwise, the following line sets YYVAL to garbage.
1547 This behavior is undocumented and Bison
1548 users should not rely upon it. Assigning to YYVAL
1549 unconditionally makes the parser a bit smaller, and it avoids a
1550 GCC warning that YYVAL may be used uninitialized. */
1551 yyval
= yyvsp
[1-yylen
];
1554 YY_REDUCE_PRINT (yyn
);
1559 /* Line 1806 of yacc.c */
1560 #line 178 "libmemcached/csl/parser.yy"
1566 /* Line 1806 of yacc.c */
1567 #line 180 "libmemcached/csl/parser.yy"
1573 /* Line 1806 of yacc.c */
1574 #line 182 "libmemcached/csl/parser.yy"
1580 /* Line 1806 of yacc.c */
1581 #line 184 "libmemcached/csl/parser.yy"
1590 /* Line 1806 of yacc.c */
1591 #line 189 "libmemcached/csl/parser.yy"
1593 context
->rc
= MEMCACHED_PARSE_USER_ERROR
;
1594 parser_abort(context
, "ERROR called directly");
1600 /* Line 1806 of yacc.c */
1601 #line 194 "libmemcached/csl/parser.yy"
1603 memcached_reset(context
->memc
);
1609 /* Line 1806 of yacc.c */
1610 #line 198 "libmemcached/csl/parser.yy"
1618 /* Line 1806 of yacc.c */
1619 #line 202 "libmemcached/csl/parser.yy"
1621 if ((context
->rc
= memcached_parse_configure_file(*context
->memc
, (yyvsp
[(3) - (3)].string
).c_str
, (yyvsp
[(3) - (3)].string
).size
)) != MEMCACHED_SUCCESS
)
1623 parser_abort(context
, "Failed to parse configuration file");
1630 /* Line 1806 of yacc.c */
1631 #line 213 "libmemcached/csl/parser.yy"
1633 if (memcached_failed(context
->rc
= memcached_server_add_with_weight(context
->memc
, (yyvsp
[(2) - (4)].server
).c_str
, (yyvsp
[(3) - (4)].number
), (yyvsp
[(4) - (4)].number
))))
1636 snprintf(buffer
, sizeof(buffer
), "Failed to add server: %s:%u", (yyvsp
[(2) - (4)].server
).c_str
, uint32_t((yyvsp
[(3) - (4)].number
)));
1637 parser_abort(context
, buffer
);
1639 context
->unset_server();
1645 /* Line 1806 of yacc.c */
1646 #line 223 "libmemcached/csl/parser.yy"
1648 if (memcached_failed(context
->rc
= memcached_server_add_with_weight(context
->memc
, (yyvsp
[(2) - (4)].server
).c_str
, (yyvsp
[(3) - (4)].number
), (yyvsp
[(4) - (4)].number
))))
1651 snprintf(buffer
, sizeof(buffer
), "Failed to add server: %s:%u", (yyvsp
[(2) - (4)].server
).c_str
, uint32_t((yyvsp
[(3) - (4)].number
)));
1652 parser_abort(context
, buffer
);
1654 context
->unset_server();
1660 /* Line 1806 of yacc.c */
1661 #line 233 "libmemcached/csl/parser.yy"
1663 if (memcached_failed(context
->rc
= memcached_server_add_unix_socket_with_weight(context
->memc
, (yyvsp
[(2) - (3)].string
).c_str
, (yyvsp
[(3) - (3)].number
))))
1666 snprintf(buffer
, sizeof(buffer
), "Failed to add server: %s", (yyvsp
[(2) - (3)].string
).c_str
);
1667 parser_abort(context
, buffer
);
1674 /* Line 1806 of yacc.c */
1675 #line 242 "libmemcached/csl/parser.yy"
1677 memcached_set_configuration_file(context
->memc
, (yyvsp
[(2) - (2)].string
).c_str
, (yyvsp
[(2) - (2)].string
).size
);
1683 /* Line 1806 of yacc.c */
1684 #line 246 "libmemcached/csl/parser.yy"
1686 context
->memc
->configure
.initial_pool_size
= (yyvsp
[(2) - (2)].number
);
1692 /* Line 1806 of yacc.c */
1693 #line 250 "libmemcached/csl/parser.yy"
1695 context
->memc
->configure
.max_pool_size
= (yyvsp
[(2) - (2)].number
);
1701 /* Line 1806 of yacc.c */
1702 #line 258 "libmemcached/csl/parser.yy"
1704 if (memcached_callback_get(context
->memc
, MEMCACHED_CALLBACK_PREFIX_KEY
, NULL
))
1706 parser_abort(context
, "--NAMESPACE can only be called once");
1709 if ((context
->rc
= memcached_set_namespace(context
->memc
, (yyvsp
[(2) - (2)].string
).c_str
, (yyvsp
[(2) - (2)].string
).size
)) != MEMCACHED_SUCCESS
)
1711 parser_abort(context
, memcached_last_error_message(context
->memc
));
1718 /* Line 1806 of yacc.c */
1719 #line 270 "libmemcached/csl/parser.yy"
1721 // Check to see if DISTRIBUTION has already been set
1722 if ((context
->rc
= memcached_behavior_set(context
->memc
, MEMCACHED_BEHAVIOR_DISTRIBUTION
, (yyvsp
[(2) - (2)].distribution
))) != MEMCACHED_SUCCESS
)
1724 parser_abort(context
, "--DISTRIBUTION can only be called once");
1727 if ((context
->rc
= memcached_behavior_set(context
->memc
, MEMCACHED_BEHAVIOR_DISTRIBUTION
, (yyvsp
[(2) - (2)].distribution
))) != MEMCACHED_SUCCESS
)
1729 parser_abort(context
, memcached_last_error_message(context
->memc
));;
1736 /* Line 1806 of yacc.c */
1737 #line 283 "libmemcached/csl/parser.yy"
1739 // Check to see if DISTRIBUTION has already been set
1740 if ((context
->rc
= memcached_behavior_set(context
->memc
, MEMCACHED_BEHAVIOR_DISTRIBUTION
, (yyvsp
[(2) - (4)].distribution
))) != MEMCACHED_SUCCESS
)
1742 parser_abort(context
, "--DISTRIBUTION can only be called once");
1745 if ((context
->rc
= memcached_behavior_set_distribution_hash(context
->memc
, (yyvsp
[(4) - (4)].hash
))) != MEMCACHED_SUCCESS
)
1747 parser_abort(context
, "Unable to set the hash for the DISTRIBUTION requested");
1754 /* Line 1806 of yacc.c */
1755 #line 296 "libmemcached/csl/parser.yy"
1757 if (context
->set_hash((yyvsp
[(2) - (2)].hash
)) == false)
1759 parser_abort(context
, "--HASH can only be set once");
1766 /* Line 1806 of yacc.c */
1767 #line 303 "libmemcached/csl/parser.yy"
1769 if ((context
->rc
= memcached_behavior_set(context
->memc
, (yyvsp
[(1) - (2)].behavior
), (yyvsp
[(2) - (2)].number
))) != MEMCACHED_SUCCESS
)
1771 parser_abort(context
, "Unable to set behavior");
1778 /* Line 1806 of yacc.c */
1779 #line 310 "libmemcached/csl/parser.yy"
1781 if ((context
->rc
= memcached_behavior_set(context
->memc
, (yyvsp
[(1) - (1)].behavior
), true)) != MEMCACHED_SUCCESS
)
1784 snprintf(buffer
, sizeof(buffer
), "Could not set: %s", libmemcached_string_behavior((yyvsp
[(1) - (1)].behavior
)));
1785 parser_abort(context
, buffer
);
1792 /* Line 1806 of yacc.c */
1793 #line 319 "libmemcached/csl/parser.yy"
1800 /* Line 1806 of yacc.c */
1801 #line 325 "libmemcached/csl/parser.yy"
1803 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS
;
1809 /* Line 1806 of yacc.c */
1810 #line 329 "libmemcached/csl/parser.yy"
1812 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT
;
1818 /* Line 1806 of yacc.c */
1819 #line 333 "libmemcached/csl/parser.yy"
1821 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK
;
1827 /* Line 1806 of yacc.c */
1828 #line 337 "libmemcached/csl/parser.yy"
1830 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK
;
1836 /* Line 1806 of yacc.c */
1837 #line 341 "libmemcached/csl/parser.yy"
1839 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH
;
1845 /* Line 1806 of yacc.c */
1846 #line 345 "libmemcached/csl/parser.yy"
1848 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS
;
1854 /* Line 1806 of yacc.c */
1855 #line 349 "libmemcached/csl/parser.yy"
1857 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_POLL_TIMEOUT
;
1863 /* Line 1806 of yacc.c */
1864 #line 353 "libmemcached/csl/parser.yy"
1866 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_RCV_TIMEOUT
;
1872 /* Line 1806 of yacc.c */
1873 #line 357 "libmemcached/csl/parser.yy"
1875 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_RETRY_TIMEOUT
;
1881 /* Line 1806 of yacc.c */
1882 #line 361 "libmemcached/csl/parser.yy"
1884 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_SND_TIMEOUT
;
1890 /* Line 1806 of yacc.c */
1891 #line 365 "libmemcached/csl/parser.yy"
1893 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
;
1899 /* Line 1806 of yacc.c */
1900 #line 369 "libmemcached/csl/parser.yy"
1902 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
;
1908 /* Line 1806 of yacc.c */
1909 #line 376 "libmemcached/csl/parser.yy"
1911 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_BINARY_PROTOCOL
;
1917 /* Line 1806 of yacc.c */
1918 #line 380 "libmemcached/csl/parser.yy"
1920 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_BUFFER_REQUESTS
;
1926 /* Line 1806 of yacc.c */
1927 #line 384 "libmemcached/csl/parser.yy"
1929 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY
;
1935 /* Line 1806 of yacc.c */
1936 #line 388 "libmemcached/csl/parser.yy"
1938 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_NOREPLY
;
1944 /* Line 1806 of yacc.c */
1945 #line 392 "libmemcached/csl/parser.yy"
1947 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ
;
1953 /* Line 1806 of yacc.c */
1954 #line 396 "libmemcached/csl/parser.yy"
1956 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_SORT_HOSTS
;
1962 /* Line 1806 of yacc.c */
1963 #line 400 "libmemcached/csl/parser.yy"
1965 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_SUPPORT_CAS
;
1971 /* Line 1806 of yacc.c */
1972 #line 404 "libmemcached/csl/parser.yy"
1974 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_TCP_NODELAY
;
1980 /* Line 1806 of yacc.c */
1981 #line 408 "libmemcached/csl/parser.yy"
1983 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_TCP_KEEPALIVE
;
1989 /* Line 1806 of yacc.c */
1990 #line 412 "libmemcached/csl/parser.yy"
1992 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_TCP_KEEPIDLE
;
1998 /* Line 1806 of yacc.c */
1999 #line 416 "libmemcached/csl/parser.yy"
2001 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_USE_UDP
;
2007 /* Line 1806 of yacc.c */
2008 #line 420 "libmemcached/csl/parser.yy"
2010 (yyval
.behavior
)= MEMCACHED_BEHAVIOR_VERIFY_KEY
;
2016 /* Line 1806 of yacc.c */
2017 #line 426 "libmemcached/csl/parser.yy"
2018 { (yyval
.number
)= MEMCACHED_DEFAULT_PORT
;}
2023 /* Line 1806 of yacc.c */
2024 #line 428 "libmemcached/csl/parser.yy"
2030 /* Line 1806 of yacc.c */
2031 #line 432 "libmemcached/csl/parser.yy"
2032 { (yyval
.number
)= 1; }
2037 /* Line 1806 of yacc.c */
2038 #line 434 "libmemcached/csl/parser.yy"
2044 /* Line 1806 of yacc.c */
2045 #line 439 "libmemcached/csl/parser.yy"
2047 (yyval
.hash
)= MEMCACHED_HASH_MD5
;
2053 /* Line 1806 of yacc.c */
2054 #line 443 "libmemcached/csl/parser.yy"
2056 (yyval
.hash
)= MEMCACHED_HASH_CRC
;
2062 /* Line 1806 of yacc.c */
2063 #line 447 "libmemcached/csl/parser.yy"
2065 (yyval
.hash
)= MEMCACHED_HASH_FNV1_64
;
2071 /* Line 1806 of yacc.c */
2072 #line 451 "libmemcached/csl/parser.yy"
2074 (yyval
.hash
)= MEMCACHED_HASH_FNV1A_64
;
2080 /* Line 1806 of yacc.c */
2081 #line 455 "libmemcached/csl/parser.yy"
2083 (yyval
.hash
)= MEMCACHED_HASH_FNV1_32
;
2089 /* Line 1806 of yacc.c */
2090 #line 459 "libmemcached/csl/parser.yy"
2092 (yyval
.hash
)= MEMCACHED_HASH_FNV1A_32
;
2098 /* Line 1806 of yacc.c */
2099 #line 463 "libmemcached/csl/parser.yy"
2101 (yyval
.hash
)= MEMCACHED_HASH_HSIEH
;
2107 /* Line 1806 of yacc.c */
2108 #line 467 "libmemcached/csl/parser.yy"
2110 (yyval
.hash
)= MEMCACHED_HASH_MURMUR
;
2116 /* Line 1806 of yacc.c */
2117 #line 471 "libmemcached/csl/parser.yy"
2119 (yyval
.hash
)= MEMCACHED_HASH_JENKINS
;
2125 /* Line 1806 of yacc.c */
2126 #line 478 "libmemcached/csl/parser.yy"
2128 (yyval
.string
)= (yyvsp
[(1) - (1)].string
);
2134 /* Line 1806 of yacc.c */
2135 #line 482 "libmemcached/csl/parser.yy"
2137 (yyval
.string
)= (yyvsp
[(1) - (1)].string
);
2143 /* Line 1806 of yacc.c */
2144 #line 489 "libmemcached/csl/parser.yy"
2146 (yyval
.distribution
)= MEMCACHED_DISTRIBUTION_CONSISTENT
;
2152 /* Line 1806 of yacc.c */
2153 #line 493 "libmemcached/csl/parser.yy"
2155 (yyval
.distribution
)= MEMCACHED_DISTRIBUTION_MODULA
;
2161 /* Line 1806 of yacc.c */
2162 #line 497 "libmemcached/csl/parser.yy"
2164 (yyval
.distribution
)= MEMCACHED_DISTRIBUTION_RANDOM
;
2170 /* Line 1806 of yacc.c */
2171 #line 2172 "libmemcached/csl/parser.cc"
2174 /* User semantic actions sometimes alter yychar, and that requires
2175 that yytoken be updated with the new translation. We take the
2176 approach of translating immediately before every use of yytoken.
2177 One alternative is translating here after every semantic action,
2178 but that translation would be missed if the semantic action invokes
2179 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2180 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2181 incorrect destructor might then be invoked immediately. In the
2182 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2183 to an incorrect destructor call or verbose syntax error message
2184 before the lookahead is translated. */
2185 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2189 YY_STACK_PRINT (yyss
, yyssp
);
2193 /* Now `shift' the result of the reduction. Determine what state
2194 that goes to, based on the state we popped back to and the rule
2195 number reduced by. */
2199 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2200 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2201 yystate
= yytable
[yystate
];
2203 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2208 /*------------------------------------.
2209 | yyerrlab -- here on detecting error |
2210 `------------------------------------*/
2212 /* Make sure we have latest lookahead translation. See comments at
2213 user semantic actions for why this is necessary. */
2214 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2216 /* If not already recovering from an error, report this error. */
2220 #if ! YYERROR_VERBOSE
2221 yyerror (context
, scanner
, YY_("syntax error"));
2223 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2226 char const *yymsgp
= YY_("syntax error");
2227 int yysyntax_error_status
;
2228 yysyntax_error_status
= YYSYNTAX_ERROR
;
2229 if (yysyntax_error_status
== 0)
2231 else if (yysyntax_error_status
== 1)
2233 if (yymsg
!= yymsgbuf
)
2234 YYSTACK_FREE (yymsg
);
2235 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2239 yymsg_alloc
= sizeof yymsgbuf
;
2240 yysyntax_error_status
= 2;
2244 yysyntax_error_status
= YYSYNTAX_ERROR
;
2248 yyerror (context
, scanner
, yymsgp
);
2249 if (yysyntax_error_status
== 2)
2250 goto yyexhaustedlab
;
2252 # undef YYSYNTAX_ERROR
2258 if (yyerrstatus
== 3)
2260 /* If just tried and failed to reuse lookahead token after an
2261 error, discard it. */
2263 if (yychar
<= YYEOF
)
2265 /* Return failure if at end of input. */
2266 if (yychar
== YYEOF
)
2271 yydestruct ("Error: discarding",
2272 yytoken
, &yylval
, context
, scanner
);
2277 /* Else will try to reuse lookahead token after shifting the error
2282 /*---------------------------------------------------.
2283 | yyerrorlab -- error raised explicitly by YYERROR. |
2284 `---------------------------------------------------*/
2287 /* Pacify compilers like GCC when the user code never invokes
2288 YYERROR and the label yyerrorlab therefore never appears in user
2290 if (/*CONSTCOND*/ 0)
2293 /* Do not reclaim the symbols of the rule which action triggered
2297 YY_STACK_PRINT (yyss
, yyssp
);
2302 /*-------------------------------------------------------------.
2303 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2304 `-------------------------------------------------------------*/
2306 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2310 yyn
= yypact
[yystate
];
2311 if (!yypact_value_is_default (yyn
))
2314 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2322 /* Pop the current state because it cannot handle the error token. */
2327 yydestruct ("Error: popping",
2328 yystos
[yystate
], yyvsp
, context
, scanner
);
2331 YY_STACK_PRINT (yyss
, yyssp
);
2337 /* Shift the error token. */
2338 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2344 /*-------------------------------------.
2345 | yyacceptlab -- YYACCEPT comes here. |
2346 `-------------------------------------*/
2351 /*-----------------------------------.
2352 | yyabortlab -- YYABORT comes here. |
2353 `-----------------------------------*/
2358 #if !defined(yyoverflow) || YYERROR_VERBOSE
2359 /*-------------------------------------------------.
2360 | yyexhaustedlab -- memory exhaustion comes here. |
2361 `-------------------------------------------------*/
2363 yyerror (context
, scanner
, YY_("memory exhausted"));
2369 if (yychar
!= YYEMPTY
)
2371 /* Make sure we have latest lookahead translation. See comments at
2372 user semantic actions for why this is necessary. */
2373 yytoken
= YYTRANSLATE (yychar
);
2374 yydestruct ("Cleanup: discarding lookahead",
2375 yytoken
, &yylval
, context
, scanner
);
2377 /* Do not reclaim the symbols of the rule which action triggered
2378 this YYABORT or YYACCEPT. */
2380 YY_STACK_PRINT (yyss
, yyssp
);
2381 while (yyssp
!= yyss
)
2383 yydestruct ("Cleanup: popping",
2384 yystos
[*yyssp
], yyvsp
, context
, scanner
);
2389 YYSTACK_FREE (yyss
);
2392 if (yymsg
!= yymsgbuf
)
2393 YYSTACK_FREE (yymsg
);
2395 /* Make sure YYID is used. */
2396 return YYID (yyresult
);
2401 /* Line 2067 of yacc.c */
2402 #line 502 "libmemcached/csl/parser.yy"
2405 void Context::start()
2407 config_parse(this, (void **)scanner
);