65#define YYBISON_VERSION "3.8.2"
68#define YYSKELETON_NAME "yacc.c"
80#define YYSTYPE ORFZ_STYPE
82#define yyparse orfz_parse
84#define yyerror orfz_error
85#define yydebug orfz_debug
86#define yynerrs orfz_nerrs
90#define YY_CAST(Type, Val) static_cast<Type>(Val)
91#define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type>(Val)
93#define YY_CAST(Type, Val) ((Type)(Val))
94#define YY_REINTERPRET_CAST(Type, Val) ((Type)(Val))
98#if defined __cplusplus
99#if 201103L <= __cplusplus
100#define YY_NULLPTR nullptr
105#define YY_NULLPTR ((void*)0)
109#include "parser.tab.hh"
183#line 36 "./ortools/flatzinc/parser.yy"
185#include "absl/strings/match.h"
186#include "absl/strings/str_format.h"
201#line 191 "./ortools/flatzinc/parser.tab.cc"
211#ifndef __PTRDIFF_MAX__
213#if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
224#ifdef __INT_LEAST8_MAX__
226#elif defined YY_STDINT_H
232#ifdef __INT_LEAST16_MAX__
234#elif defined YY_STDINT_H
246#undef UINT_LEAST8_MAX
247#undef UINT_LEAST16_MAX
248#define UINT_LEAST8_MAX 255
249#define UINT_LEAST16_MAX 65535
252#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
254#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H && \
255 UINT_LEAST8_MAX <= INT_MAX)
257#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
263#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
265#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H && \
266 UINT_LEAST16_MAX <= INT_MAX)
268#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
275#if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
276#define YYPTRDIFF_T __PTRDIFF_TYPE__
277#define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
278#elif defined PTRDIFF_MAX
282#define YYPTRDIFF_T ptrdiff_t
283#define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
285#define YYPTRDIFF_T long
286#define YYPTRDIFF_MAXIMUM LONG_MAX
292#define YYSIZE_T __SIZE_TYPE__
294#define YYSIZE_T size_t
295#elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
297#define YYSIZE_T size_t
299#define YYSIZE_T unsigned
303#define YYSIZE_MAXIMUM \
304 YY_CAST(YYPTRDIFF_T, \
305 (YYPTRDIFF_MAXIMUM < YY_CAST(YYSIZE_T, -1) ? YYPTRDIFF_MAXIMUM \
306 : YY_CAST(YYSIZE_T, -1)))
308#define YYSIZEOF(X) YY_CAST(YYPTRDIFF_T, sizeof(X))
317#if defined YYENABLE_NLS && YYENABLE_NLS
320#define YY_(Msgid) dgettext("bison-runtime", Msgid)
324#define YY_(Msgid) Msgid
328#ifndef YY_ATTRIBUTE_PURE
329#if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
330#define YY_ATTRIBUTE_PURE __attribute__((__pure__))
332#define YY_ATTRIBUTE_PURE
336#ifndef YY_ATTRIBUTE_UNUSED
337#if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
338#define YY_ATTRIBUTE_UNUSED __attribute__((__unused__))
340#define YY_ATTRIBUTE_UNUSED
345#if !defined lint || defined __GNUC__
346#define YY_USE(E) ((void)(E))
352#if defined __GNUC__ && !defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
353#if __GNUC__ * 100 + __GNUC_MINOR__ < 407
354#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
355 _Pragma("GCC diagnostic push") \
356 _Pragma("GCC diagnostic ignored \"-Wuninitialized\"")
358#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
359 _Pragma("GCC diagnostic push") \
360 _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
361 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
363#define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop")
365#define YY_INITIAL_VALUE(Value) Value
367#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
368#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
369#define YY_IGNORE_MAYBE_UNINITIALIZED_END
371#ifndef YY_INITIAL_VALUE
372#define YY_INITIAL_VALUE(Value)
375#if defined __cplusplus && defined __GNUC__ && !defined __ICC && 6 <= __GNUC__
376#define YY_IGNORE_USELESS_CAST_BEGIN \
377 _Pragma("GCC diagnostic push") \
378 _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"")
379#define YY_IGNORE_USELESS_CAST_END _Pragma("GCC diagnostic pop")
381#ifndef YY_IGNORE_USELESS_CAST_BEGIN
382#define YY_IGNORE_USELESS_CAST_BEGIN
383#define YY_IGNORE_USELESS_CAST_END
386#define YY_ASSERT(E) ((void)(0 && (E)))
392#ifdef YYSTACK_USE_ALLOCA
393#if YYSTACK_USE_ALLOCA
395#define YYSTACK_ALLOC __builtin_alloca
396#elif defined __BUILTIN_VA_ARG_INCR
399#define YYSTACK_ALLOC __alloca
400#elif defined _MSC_VER
402#define alloca _alloca
404#define YYSTACK_ALLOC alloca
405#if !defined _ALLOCA_H && !defined EXIT_SUCCESS
409#define EXIT_SUCCESS 0
418#define YYSTACK_FREE(Ptr) \
422#ifndef YYSTACK_ALLOC_MAXIMUM
427#define YYSTACK_ALLOC_MAXIMUM 4032
430#define YYSTACK_ALLOC YYMALLOC
431#define YYSTACK_FREE YYFREE
432#ifndef YYSTACK_ALLOC_MAXIMUM
433#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
435#if (defined __cplusplus && !defined EXIT_SUCCESS && \
436 !((defined YYMALLOC || defined malloc) && \
437 (defined YYFREE || defined free)))
440#define EXIT_SUCCESS 0
444#define YYMALLOC malloc
445#if !defined malloc && !defined EXIT_SUCCESS
451#if !defined free && !defined EXIT_SUCCESS
458#if (!defined yyoverflow && \
459 (!defined __cplusplus || \
460 (defined ORFZ_STYPE_IS_TRIVIAL && ORFZ_STYPE_IS_TRIVIAL)))
469#define YYSTACK_GAP_MAXIMUM (YYSIZEOF(union yyalloc) - 1)
473#define YYSTACK_BYTES(N) \
474 ((N) * (YYSIZEOF(yy_state_t) + YYSIZEOF(YYSTYPE)) + YYSTACK_GAP_MAXIMUM)
476#define YYCOPY_NEEDED 1
483#define YYSTACK_RELOCATE(Stack_alloc, Stack) \
485 YYPTRDIFF_T yynewbytes; \
486 YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \
487 Stack = &yyptr->Stack_alloc; \
488 yynewbytes = yystacksize * YYSIZEOF(*Stack) + YYSTACK_GAP_MAXIMUM; \
489 yyptr += yynewbytes / YYSIZEOF(*yyptr); \
494#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
498#if defined __GNUC__ && 1 < __GNUC__
499#define YYCOPY(Dst, Src, Count) \
500 __builtin_memcpy(Dst, Src, YY_CAST(YYSIZE_T, (Count)) * sizeof(*(Src)))
502#define YYCOPY(Dst, Src, Count) \
505 for (yyi = 0; yyi < (Count); yyi++) (Dst)[yyi] = (Src)[yyi]; \
530#define YYTRANSLATE(YYX) \
531 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
532 ? YY_CAST(yysymbol_kind_t, yytranslate[YYX]) \
538 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 23, 24, 2, 2, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 22,
541 2, 29, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 2, 28, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 30, 2, 31, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
551 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21};
556 0, 102, 102, 109, 113, 114, 119, 122, 123, 126, 127, 128, 129, 132,
557 133, 136, 137, 144, 145, 148, 167, 182, 193, 208, 219, 245, 278, 355,
558 356, 359, 360, 361, 364, 368, 374, 375, 376, 391, 412, 413, 414, 415,
559 422, 423, 424, 425, 432, 433, 438, 439, 440, 443, 444, 447, 448, 449,
560 454, 455, 458, 459, 460, 465, 466, 467, 472, 473, 476, 477, 483, 487,
561 493, 494, 497, 509, 510, 513, 514, 515, 516, 517, 522, 548, 565, 613,
562 622, 626, 629, 630, 633, 634, 635, 636, 646, 655, 661, 676, 684, 695};
566#define YY_ACCESSING_SYMBOL(State) YY_CAST(yysymbol_kind_t, yystos[State])
575static const char*
const yytname[] = {
"\"end of file\"",
611 "predicate_arguments",
612 "predicate_argument",
613 "predicate_array_argument",
615 "variable_or_constant_declarations",
616 "variable_or_constant_declaration",
617 "optional_var_or_value",
618 "optional_var_or_value_array",
619 "var_or_value_array",
636 "annotation_arguments",
646#define YYPACT_NINF (-184)
648#define yypact_value_is_default(Yyn) ((Yyn) == YYPACT_NINF)
650#define YYTABLE_NINF (-19)
652#define yytable_value_is_error(Yyn) 0
657 -184, 26, 7, -184, -15, 41, 24, 36, -184, 64, -184, 70,
658 -184, -184, -184, 112, 88, 117, 129, 155, 116, -184, -184, -184,
659 121, 132, 49, 143, 20, 126, 164, 162, -184, 157, -2, -184,
660 -184, 123, 165, -184, 166, 167, 159, 88, 163, 168, 169, 174,
661 -184, -184, 175, 155, 172, -184, -184, 176, 155, -184, -184, 173,
662 127, -184, -184, 53, 171, -184, 49, 178, 181, 182, 38, -184,
663 177, -184, 16, 84, 84, 84, -184, 122, 179, 185, 180, -184,
664 183, -184, -184, 184, -184, -184, 30, -184, 14, 186, -184, 187,
665 -184, 95, 155, 152, -184, -184, -184, 190, -184, 98, 122, -184,
666 200, 191, 201, -184, 203, 139, -184, 194, 188, -184, -1, -184,
667 198, 199, -184, 192, -184, -184, 82, -184, 125, -184, 84, 202,
668 122, 204, 138, -184, -184, -184, 68, 78, -184, 205, 206, -184,
669 133, -184, 193, 207, 139, -184, -184, 209, -184, -184, 154, 208,
670 122, -184, 88, 211, 88, 212, 213, 214, -184, 215, -184, -184,
671 216, -184, -184, -184, -184, 219, 210, 220, 221, 222, 227, -184,
672 -184, 228, -184, 229, -184, -184, -184, -184, -184, 48, 59, 61,
673 83, 223, 224, 225, 226, -184, 106, 14, 134, 99, -184, 140,
674 -184, 142, 230, -184, -184, 144, -184, -184, 146, -184, 14, -184,
675 217, 160, -184, -184, -184, 231, -184, -184};
681 5, 0, 0, 1, 0, 0, 0, 71, 4, 0, 3, 0, 38, 46, 39, 0, 0, 0, 0,
682 0, 0, 48, 49, 50, 0, 0, 0, 0, 0, 0, 0, 0, 53, 54, 0, 52, 17, 0,
683 0, 85, 0, 0, 0, 0, 0, 8, 0, 0, 42, 43, 0, 0, 0, 40, 47, 0, 0,
684 41, 85, 0, 0, 70, 2, 0, 0, 6, 0, 0, 0, 0, 0, 85, 0, 51, 0, 0,
685 0, 0, 95, 0, 16, 0, 0, 13, 0, 7, 9, 0, 44, 45, 28, 55, 0, 75, 77,
686 80, 76, 0, 0, 0, 74, 97, 96, 89, 90, 91, 0, 84, 0, 0, 0, 10, 0, 0,
687 25, 61, 66, 65, 0, 19, 0, 0, 34, 36, 35, 83, 0, 33, 0, 85, 0, 0, 0,
688 0, 0, 87, 15, 14, 0, 0, 27, 0, 0, 64, 0, 78, 0, 0, 0, 82, 79, 72,
689 73, 88, 0, 0, 0, 94, 0, 0, 0, 0, 0, 0, 62, 0, 63, 81, 0, 32, 92,
690 93, 86, 0, 0, 0, 0, 0, 0, 67, 37, 0, 11, 0, 85, 85, 85, 12, 85, 0,
691 0, 0, 31, 0, 0, 0, 0, 26, 0, 0, 0, 0, 21, 0, 69, 0, 59, 58, 23,
692 0, 57, 30, 0, 20, 0, 24, 0, 0, 22, 29, 68, 0, 56, 60};
696 -184, -184, -184, -184, 161, -184, -184, 110, -184, -184, -184,
697 -184, 27, -107, 90, 92, 93, -7, -50, 218, -184, 17,
698 -183, -184, -184, -184, -184, -72, -56, 101, -76, -184};
702 0, 1, 2, 6, 44, 45, 82, 83, 7, 20, 114, 197, 126, 127, 21, 22,
703 23, 46, 34, 35, 209, 210, 119, 205, 25, 40, 99, 100, 60, 134, 135, 41};
709 24, 70, 74, 107, 101, 102, 140, 8, 4, 29, -18, -18, -18, -18, -18,
710 90, 204, 32, 5, 33, -18, -18, -18, 56, 48, -18, 3, 49, -18, 57,
711 143, 220, 115, 79, 116, 117, 64, -18, 50, 11, 12, 169, 13, 14, 118,
712 92, 10, 79, 128, 15, 51, 16, 42, 12, 17, 13, 14, 18, 152, 113,
713 80, 9, 15, 56, 43, 79, 19, 17, 144, 89, 18, 81, 12, 151, 13,
714 14, 79, 193, 79, 19, 172, 15, 12, 158, 13, 14, 17, 26, 194, 18,
715 195, 15, 12, 160, 13, 14, 17, 27, 19, 18, 79, 15, 93, 94, 95,
716 96, 17, 148, 19, 18, 149, 97, 196, 122, 98, 123, 124, 122, 19, 123,
717 124, 132, 28, 125, 32, 133, 33, 211, 189, 190, 191, 159, 192, 30, 202,
718 76, 77, 38, 36, 78, 103, 104, 105, 58, 79, 31, 39, 37, 203, 106,
719 56, 173, 52, 175, 206, 207, 150, 122, 56, 123, 124, 47, 208, 156, 166,
720 56, 157, 214, 213, 217, 215, 148, 218, 32, 219, 33, 129, 130, 170, 156,
721 206, 207, 53, 54, 55, 59, 63, 65, 61, 62, 68, 69, 71, 66, 72,
722 67, 75, 84, 86, 87, 88, 109, 120, 111, 108, 91, 131, 80, 110, 137,
723 141, 138, 112, 139, 121, 142, 145, 146, 136, 147, 153, 167, 155, 164, 165,
724 168, 79, 85, 212, 161, 182, 162, 163, 154, 222, 221, 171, 174, 176, 177,
725 178, 184, 185, 179, 180, 181, 183, 186, 187, 188, 198, 199, 200, 201, 0,
726 0, 0, 216, 0, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
730 7, 51, 58, 79, 76, 77, 113, 22, 1, 16, 3, 4, 5, 6, 7, 71,
731 199, 18, 11, 20, 13, 14, 15, 25, 4, 18, 0, 7, 21, 31, 31, 214,
732 18, 17, 20, 21, 43, 30, 18, 3, 4, 148, 6, 7, 30, 29, 22, 17,
733 98, 13, 30, 15, 3, 4, 18, 6, 7, 21, 130, 29, 7, 20, 13, 25,
734 15, 17, 30, 18, 118, 31, 21, 18, 4, 129, 6, 7, 17, 29, 17, 30,
735 156, 13, 4, 15, 6, 7, 18, 23, 29, 21, 29, 13, 4, 15, 6, 7,
736 18, 27, 30, 21, 17, 13, 18, 19, 20, 21, 18, 25, 30, 21, 28, 27,
737 29, 18, 30, 20, 21, 18, 30, 20, 21, 23, 10, 28, 18, 27, 20, 28,
738 184, 185, 186, 138, 188, 16, 28, 8, 9, 5, 22, 12, 18, 19, 20, 20,
739 17, 16, 14, 26, 198, 27, 25, 158, 26, 160, 20, 21, 31, 18, 25, 20,
740 21, 18, 28, 25, 31, 25, 28, 25, 28, 25, 28, 25, 28, 18, 28, 20,
741 24, 25, 24, 25, 20, 21, 18, 21, 27, 20, 27, 24, 22, 22, 16, 16,
742 20, 25, 18, 26, 23, 26, 20, 18, 18, 16, 16, 20, 25, 28, 16, 7,
743 28, 18, 16, 10, 28, 10, 27, 27, 18, 18, 108, 27, 18, 28, 18, 18,
744 18, 18, 17, 66, 201, 139, 20, 139, 139, 132, 217, 18, 28, 26, 26, 26,
745 26, 20, 20, 28, 28, 26, 26, 20, 20, 20, 27, 27, 27, 27, -1, -1,
746 -1, 27, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
752 0, 33, 34, 0, 1, 11, 35, 40, 22, 20, 22, 3, 4, 6, 7, 13, 15, 18, 21,
753 30, 41, 46, 47, 48, 49, 56, 23, 27, 10, 49, 16, 16, 18, 20, 50, 51, 22, 26,
754 5, 14, 57, 63, 3, 15, 36, 37, 49, 18, 4, 7, 18, 30, 26, 18, 21, 27, 25,
755 31, 20, 20, 60, 22, 22, 27, 49, 24, 25, 26, 16, 16, 50, 20, 18, 51, 60, 23,
756 8, 9, 12, 17, 7, 18, 38, 39, 26, 36, 20, 18, 18, 31, 60, 28, 29, 18, 19,
757 20, 21, 27, 30, 58, 59, 59, 59, 18, 19, 20, 27, 62, 25, 16, 28, 20, 28, 29,
758 42, 18, 20, 21, 30, 54, 16, 27, 18, 20, 21, 28, 44, 45, 50, 24, 25, 16, 23,
759 27, 61, 62, 39, 18, 10, 10, 45, 16, 27, 31, 50, 18, 18, 27, 25, 28, 31, 60,
760 59, 18, 61, 18, 25, 28, 15, 49, 15, 46, 47, 48, 18, 18, 31, 28, 18, 45, 24,
761 28, 62, 49, 26, 49, 26, 26, 26, 28, 28, 26, 20, 26, 20, 20, 20, 20, 20, 60,
762 60, 60, 60, 29, 29, 29, 29, 43, 27, 27, 27, 27, 28, 50, 54, 55, 20, 21, 28,
763 52, 53, 28, 44, 28, 25, 28, 27, 25, 28, 28, 54, 18, 53, 28};
767 0, 32, 33, 34, 34, 34, 35, 36, 36, 37, 37, 37, 37, 38, 38, 39, 39,
768 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44,
769 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 49, 49, 49,
770 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54,
771 55, 55, 56, 56, 57, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60,
772 60, 61, 61, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63};
777 0, 2, 5, 3, 3, 0, 5, 3, 1, 3, 4, 8, 9, 1, 3, 3, 1, 3, 0, 6,
778 15, 14, 15, 14, 15, 6, 13, 2, 0, 4, 3, 0, 3, 1, 1, 1, 1, 4, 1, 1,
779 3, 3, 3, 3, 5, 5, 1, 3, 1, 1, 1, 3, 1, 1, 1, 4, 3, 1, 1, 1,
780 4, 1, 3, 3, 2, 1, 1, 4, 3, 1, 3, 0, 6, 3, 1, 1, 1, 1, 3, 3,
781 1, 4, 3, 2, 3, 0, 3, 1, 3, 1, 1, 1, 4, 4, 3, 3, 4, 4};
785#define yyerrok (yyerrstatus = 0)
786#define yyclearin (yychar = ORFZ_EMPTY)
788#define YYACCEPT goto yyacceptlab
789#define YYABORT goto yyabortlab
790#define YYERROR goto yyerrorlab
791#define YYNOMEM goto yyexhaustedlab
793#define YYRECOVERING() (!!yyerrstatus)
795#define YYBACKUP(Token, Value) \
797 if (yychar == ORFZ_EMPTY) { \
804 yyerror(context, model, ok, scanner, \
805 YY_("syntax error: cannot back up")); \
812#define YYERRCODE ORFZ_UNDEF
819#define YYFPRINTF fprintf
822#define YYDPRINTF(Args) \
824 if (yydebug) YYFPRINTF Args; \
827#define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
830 YYFPRINTF(stderr, "%s ", Title); \
831 yy_symbol_print(stderr, Kind, Value, context, model, ok, scanner); \
832 YYFPRINTF(stderr, "\n"); \
844 FILE* yyoutput = yyo;
850 if (!yyvaluep)
return;
879 for (; yybottom <= yytop; yybottom++) {
880 int yybot = *yybottom;
886#define YY_STACK_PRINT(Bottom, Top) \
888 if (yydebug) yy_stack_print((Bottom), (Top)); \
900 int yynrhs =
yyr2[yyrule];
902 YYFPRINTF(stderr,
"Reducing stack by rule %d (line %d):\n", yyrule - 1,
905 for (yyi = 0; yyi < yynrhs; yyi++) {
908 &yyvsp[(yyi + 1) - (yynrhs)],
context,
model, ok, scanner);
913#define YY_REDUCE_PRINT(Rule) \
916 yy_reduce_print(yyssp, yyvsp, Rule, context, model, ok, scanner); \
923#define YYDPRINTF(Args) ((void)0)
924#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
925#define YY_STACK_PRINT(Bottom, Top)
926#define YY_REDUCE_PRINT(Rule)
931#define YYINITDEPTH 200
942#define YYMAXDEPTH 10000
966 int yyxbegin = yyn < 0 ? -yyn : 0;
968 int yychecklim =
YYLAST - yyn + 1;
971 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
976 else if (yycount == yyargn)
987#if defined __GLIBC__ && defined _STRING_H
988#define yystrlen(S) (YY_CAST(YYPTRDIFF_T, strlen(S)))
993 for (yylen = 0; yystr[yylen]; yylen++)
continue;
1000#if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1001#define yystpcpy stpcpy
1005static char*
yystpcpy(
char* yydest,
const char* yysrc) {
1007 const char* yys = yysrc;
1009 while ((*yyd++ = *yys++) !=
'\0')
continue;
1025 if (*yystr ==
'"') {
1027 char const* yyp = yystr;
1028 for (;;)
switch (*++yyp) {
1031 goto do_not_strip_quotes;
1035 goto do_not_strip_quotes;
1041 if (yyres) yyres[yyn] = *yyp;
1046 if (yyres) yyres[yyn] =
'\0';
1049 do_not_strip_quotes:;
1053 return yystpcpy(yyres, yystr) - yyres;
1088 if (yyarg) yyarg[yycount] = yyctx->
yytoken;
1110 enum { YYARGS_MAX = 5 };
1124#define YYCASE_(N, S) \
1130 YYCASE_(1,
YY_(
"syntax error, unexpected %s"));
1131 YYCASE_(2,
YY_(
"syntax error, unexpected %s, expecting %s"));
1132 YYCASE_(3,
YY_(
"syntax error, unexpected %s, expecting %s or %s"));
1133 YYCASE_(4,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
1136 YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1142 yysize =
yystrlen(yyformat) - 2 * yycount + 1;
1145 for (yyi = 0; yyi < yycount; ++yyi) {
1154 if (*yymsg_alloc < yysize) {
1155 *yymsg_alloc = 2 * yysize;
1167 while ((*yyp = *yyformat) !=
'\0')
1168 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount) {
1193 if (!yymsg) yymsg =
"Deleting";
1221 int yyerrstatus = 0;
1250 char* yymsg = yymsgbuf;
1253#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1259 YYDPRINTF((stderr,
"Starting parse\n"));
1261 yychar = ORFZ_EMPTY;
1277 YYDPRINTF((stderr,
"Entering state %d\n", yystate));
1284 if (yyss + yystacksize - 1 <= yyssp)
1285#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1292#if defined yyoverflow
1304 yyoverflow(
YY_(
"memory exhausted"), &yyss1, yysize *
YYSIZEOF(*yyssp),
1305 &yyvs1, yysize *
YYSIZEOF(*yyvsp), &yystacksize);
1323#undef YYSTACK_RELOCATE
1328 yyssp = yyss + yysize - 1;
1329 yyvsp = yyvs + yysize - 1;
1333 (stderr,
"Stack size increased to %ld\n",
YY_CAST(
long, yystacksize)));
1336 if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
1358 if (yychar == ORFZ_EMPTY) {
1359 YYDPRINTF((stderr,
"Reading a token\n"));
1363 if (yychar <= ORFZ_EOF) {
1366 YYDPRINTF((stderr,
"Now at end of input.\n"));
1367 }
else if (yychar == ORFZ_error) {
1372 yychar = ORFZ_UNDEF;
1383 if (yyn < 0 ||
YYLAST < yyn ||
yycheck[yyn] != yytoken)
goto yydefault;
1393 if (yyerrstatus) yyerrstatus--;
1403 yychar = ORFZ_EMPTY;
1411 if (yyn == 0)
goto yyerrlab;
1429 yyval = yyvsp[1 - yylen];
1434#line 113 "./ortools/flatzinc/parser.yy"
1438#line 1582 "./ortools/flatzinc/parser.tab.cc"
1443#line 148 "./ortools/flatzinc/parser.yy"
1447 const Domain& domain = (yyvsp[-5].domain);
1448 const std::string& identifier = (yyvsp[-3].string_value);
1449 const Domain& assignment = (yyvsp[0].domain);
1450 std::vector<Annotation>*
const annotations = (yyvsp[-2].annotations);
1454 context->domain_map[identifier] = assignment;
1462#line 1606 "./ortools/flatzinc/parser.tab.cc"
1468#line 168 "./ortools/flatzinc/parser.yy"
1470 std::vector<Annotation>*
const annotations = (yyvsp[-4].annotations);
1472 CHECK_EQ((yyvsp[-12].integer_value), 1)
1473 <<
"Only [1..n] array are supported here.";
1474 const int64_t num_constants = (yyvsp[-10].integer_value);
1475 const std::string& identifier = (yyvsp[-5].string_value);
1476 const std::vector<int64_t>*
const assignments = (yyvsp[-1].integers);
1477 CHECK(assignments !=
nullptr);
1478 CHECK_EQ(num_constants, assignments->size());
1480 context->integer_array_map[identifier] = *assignments;
1484#line 1625 "./ortools/flatzinc/parser.tab.cc"
1489#line 183 "./ortools/flatzinc/parser.yy"
1491 std::vector<Annotation>*
const annotations = (yyvsp[-3].annotations);
1493 CHECK_EQ((yyvsp[-11].integer_value), 1)
1494 <<
"Only [1..n] array are supported here.";
1495 const int64_t num_constants = (yyvsp[-9].integer_value);
1496 CHECK_EQ(num_constants, 0) <<
"Empty arrays should have a size of 0";
1497 const std::string& identifier = (yyvsp[-4].string_value);
1498 context->integer_array_map[identifier] = std::vector<int64_t>();
1501#line 1640 "./ortools/flatzinc/parser.tab.cc"
1507#line 194 "./ortools/flatzinc/parser.yy"
1509 std::vector<Annotation>*
const annotations = (yyvsp[-4].annotations);
1511 CHECK_EQ((yyvsp[-12].integer_value), 1)
1512 <<
"Only [1..n] array are supported here.";
1513 const int64_t num_constants = (yyvsp[-10].integer_value);
1514 const std::string& identifier = (yyvsp[-5].string_value);
1515 const std::vector<double>*
const assignments = (yyvsp[-1].doubles);
1516 CHECK(assignments !=
nullptr);
1517 CHECK_EQ(num_constants, assignments->size());
1519 context->float_array_map[identifier] = *assignments;
1523#line 1659 "./ortools/flatzinc/parser.tab.cc"
1528#line 209 "./ortools/flatzinc/parser.yy"
1530 std::vector<Annotation>*
const annotations = (yyvsp[-3].annotations);
1532 CHECK_EQ((yyvsp[-11].integer_value), 1)
1533 <<
"Only [1..n] array are supported here.";
1534 const int64_t num_constants = (yyvsp[-9].integer_value);
1535 CHECK_EQ(num_constants, 0) <<
"Empty arrays should have a size of 0";
1536 const std::string& identifier = (yyvsp[-4].string_value);
1537 context->float_array_map[identifier] = std::vector<double>();
1540#line 1674 "./ortools/flatzinc/parser.tab.cc"
1546#line 220 "./ortools/flatzinc/parser.yy"
1549 CHECK_EQ((yyvsp[-12].integer_value), 1)
1550 <<
"Only [1..n] array are supported here.";
1551 const int64_t num_constants = (yyvsp[-10].integer_value);
1552 const Domain& domain = (yyvsp[-7].domain);
1553 const std::string& identifier = (yyvsp[-5].string_value);
1554 const std::vector<Domain>*
const assignments = (yyvsp[-1].domains);
1555 const std::vector<Annotation>*
const annotations =
1556 (yyvsp[-4].annotations);
1557 CHECK(assignments !=
nullptr);
1558 CHECK_EQ(num_constants, assignments->size());
1561 context->domain_array_map[identifier] = *assignments;
1564 std::vector<int64_t> values(num_constants);
1565 for (
int i = 0; i < num_constants; ++i) {
1566 values[i] = (*assignments)[i].values.front();
1569 context->integer_array_map[identifier] = values;
1574#line 1704 "./ortools/flatzinc/parser.tab.cc"
1579#line 245 "./ortools/flatzinc/parser.yy"
1585 const Domain& domain = (yyvsp[-4].domain);
1586 const std::string& identifier = (yyvsp[-2].string_value);
1587 std::vector<Annotation>*
const annotations = (yyvsp[-1].annotations);
1589 const bool introduced =
ContainsId(annotations,
"var_is_introduced") ||
1590 absl::StartsWith(identifier,
"X_INTRODUCED");
1593 var =
model->AddVariable(identifier, domain, introduced);
1594 }
else if (assignment.
variable ==
nullptr) {
1597 identifier, Domain::IntegerValue(assignment.
value), introduced);
1600 var->Merge(identifier, domain, introduced);
1607 model->AddOutput(SolutionOutputSpecs::SingleVariable(
1612#line 1742 "./ortools/flatzinc/parser.tab.cc"
1618#line 279 "./ortools/flatzinc/parser.yy"
1623 CHECK_EQ((yyvsp[-10].integer_value), 1);
1624 const int64_t num_vars = (yyvsp[-8].integer_value);
1625 const Domain& domain = (yyvsp[-4].domain);
1626 const std::string& identifier = (yyvsp[-2].string_value);
1627 std::vector<Annotation>*
const annotations = (yyvsp[-1].annotations);
1628 std::vector<VarRefOrValue>*
const assignments =
1629 (yyvsp[0].var_or_value_array);
1630 CHECK(assignments ==
nullptr || assignments->size() == num_vars);
1631 const bool introduced =
ContainsId(annotations,
"var_is_introduced") ||
1632 absl::StartsWith(identifier,
"X_INTRODUCED");
1634 std::vector<Variable*> vars(num_vars,
nullptr);
1636 for (
int i = 0; i < num_vars; ++i) {
1637 const std::string var_name =
1638 absl::StrFormat(
"%s[%d]", identifier, i + 1);
1639 if (assignments ==
nullptr) {
1640 vars[i] =
model->AddVariable(var_name, domain, introduced);
1641 }
else if ((*assignments)[i].variable ==
nullptr) {
1642 if ((*assignments)[i].is_float) {
1644 const double value = (*assignments)[i].float_value;
1646 vars[i] =
model->AddVariable(var_name, Domain::FloatValue(
value),
1650 const int64_t
value = (*assignments)[i].value;
1652 vars[i] =
model->AddVariable(var_name, Domain::IntegerValue(
value),
1659 vars[i]->Merge(var_name, domain, introduced);
1665 context->variable_array_map[identifier] = vars;
1670 if (annotations !=
nullptr) {
1671 for (
int i = 0; i < annotations->size(); ++i) {
1679 std::vector<SolutionOutputSpecs::Bounds>
bounds;
1683 bounds.emplace_back(SolutionOutputSpecs::Bounds(
1687 model->AddOutput(SolutionOutputSpecs::MultiDimensionalArray(
1694#line 1821 "./ortools/flatzinc/parser.tab.cc"
1698#line 355 "./ortools/flatzinc/parser.yy"
1700 (yyval.var_or_value) = (yyvsp[0].var_or_value);
1702#line 1827 "./ortools/flatzinc/parser.tab.cc"
1706#line 356 "./ortools/flatzinc/parser.yy"
1708 (yyval.var_or_value) = VarRefOrValue::Undefined();
1710#line 1833 "./ortools/flatzinc/parser.tab.cc"
1714#line 359 "./ortools/flatzinc/parser.yy"
1716 (yyval.var_or_value_array) = (yyvsp[-1].var_or_value_array);
1718#line 1839 "./ortools/flatzinc/parser.tab.cc"
1722#line 360 "./ortools/flatzinc/parser.yy"
1724 (yyval.var_or_value_array) =
nullptr;
1726#line 1845 "./ortools/flatzinc/parser.tab.cc"
1730#line 361 "./ortools/flatzinc/parser.yy"
1732 (yyval.var_or_value_array) =
nullptr;
1734#line 1851 "./ortools/flatzinc/parser.tab.cc"
1738#line 364 "./ortools/flatzinc/parser.yy"
1740 (yyval.var_or_value_array) = (yyvsp[-2].var_or_value_array);
1741 (yyval.var_or_value_array)->push_back((yyvsp[0].var_or_value));
1743#line 1860 "./ortools/flatzinc/parser.tab.cc"
1747#line 368 "./ortools/flatzinc/parser.yy"
1749 (yyval.var_or_value_array) =
new std::vector<VarRefOrValue>();
1750 (yyval.var_or_value_array)->push_back((yyvsp[0].var_or_value));
1752#line 1869 "./ortools/flatzinc/parser.tab.cc"
1756#line 374 "./ortools/flatzinc/parser.yy"
1760#line 1875 "./ortools/flatzinc/parser.tab.cc"
1764#line 375 "./ortools/flatzinc/parser.yy"
1766 (yyval.var_or_value) = VarRefOrValue::FloatValue((yyvsp[0].double_value));
1768#line 1881 "./ortools/flatzinc/parser.tab.cc"
1772#line 376 "./ortools/flatzinc/parser.yy"
1775 const std::string&
id = (yyvsp[0].string_value);
1776 if (
context->integer_map.contains(
id)) {
1777 (yyval.var_or_value) =
1779 }
else if (
context->float_map.contains(
id)) {
1780 (yyval.var_or_value) =
1781 VarRefOrValue::FloatValue(
context->float_map.at(
id));
1782 }
else if (
context->variable_map.contains(
id)) {
1783 (yyval.var_or_value) =
1784 VarRefOrValue::VarRef(
context->variable_map.at(
id));
1786 LOG(
ERROR) <<
"Unknown symbol " << id;
1787 (yyval.var_or_value) = VarRefOrValue::Undefined();
1791#line 1901 "./ortools/flatzinc/parser.tab.cc"
1795#line 391 "./ortools/flatzinc/parser.yy"
1798 const std::string&
id = (yyvsp[-3].string_value);
1799 const int64_t
value = (yyvsp[-1].integer_value);
1800 if (
context->integer_array_map.contains(
id)) {
1803 }
else if (
context->float_array_map.contains(
id)) {
1804 (yyval.var_or_value) = VarRefOrValue::FloatValue(
1806 }
else if (
context->variable_array_map.contains(
id)) {
1807 (yyval.var_or_value) = VarRefOrValue::VarRef(
1810 LOG(
ERROR) <<
"Unknown symbol " << id;
1811 (yyval.var_or_value) = VarRefOrValue::Undefined();
1815#line 1925 "./ortools/flatzinc/parser.tab.cc"
1819#line 412 "./ortools/flatzinc/parser.yy"
1821 (yyval.domain) = Domain::Boolean();
1823#line 1931 "./ortools/flatzinc/parser.tab.cc"
1827#line 413 "./ortools/flatzinc/parser.yy"
1829 (yyval.domain) = Domain::AllInt64();
1831#line 1937 "./ortools/flatzinc/parser.tab.cc"
1835#line 414 "./ortools/flatzinc/parser.yy"
1838 Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value));
1840#line 1943 "./ortools/flatzinc/parser.tab.cc"
1844#line 415 "./ortools/flatzinc/parser.yy"
1846 CHECK((yyvsp[-1].integers) !=
nullptr);
1847 (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers)));
1848 delete (yyvsp[-1].integers);
1850#line 1953 "./ortools/flatzinc/parser.tab.cc"
1854#line 422 "./ortools/flatzinc/parser.yy"
1856 (yyval.domain) = Domain::SetOfBoolean();
1858#line 1959 "./ortools/flatzinc/parser.tab.cc"
1862#line 423 "./ortools/flatzinc/parser.yy"
1864 (yyval.domain) = Domain::SetOfAllInt64();
1866#line 1965 "./ortools/flatzinc/parser.tab.cc"
1870#line 424 "./ortools/flatzinc/parser.yy"
1872 (yyval.domain) = Domain::SetOfInterval((yyvsp[-2].integer_value),
1873 (yyvsp[0].integer_value));
1875#line 1971 "./ortools/flatzinc/parser.tab.cc"
1879#line 425 "./ortools/flatzinc/parser.yy"
1881 CHECK((yyvsp[-1].integers) !=
nullptr);
1883 Domain::SetOfIntegerList(std::move(*(yyvsp[-1].integers)));
1884 delete (yyvsp[-1].integers);
1886#line 1981 "./ortools/flatzinc/parser.tab.cc"
1890#line 432 "./ortools/flatzinc/parser.yy"
1892 (yyval.domain) = Domain::AllFloats();
1894#line 1987 "./ortools/flatzinc/parser.tab.cc"
1898#line 433 "./ortools/flatzinc/parser.yy"
1900 (yyval.domain) = Domain::FloatInterval((yyvsp[-2].double_value),
1901 (yyvsp[0].double_value));
1903#line 1995 "./ortools/flatzinc/parser.tab.cc"
1907#line 438 "./ortools/flatzinc/parser.yy"
1909 (yyval.domain) = (yyvsp[0].domain);
1911#line 2001 "./ortools/flatzinc/parser.tab.cc"
1915#line 439 "./ortools/flatzinc/parser.yy"
1917 (yyval.domain) = (yyvsp[0].domain);
1919#line 2007 "./ortools/flatzinc/parser.tab.cc"
1923#line 440 "./ortools/flatzinc/parser.yy"
1925 (yyval.domain) = (yyvsp[0].domain);
1927#line 2013 "./ortools/flatzinc/parser.tab.cc"
1931#line 443 "./ortools/flatzinc/parser.yy"
1933 (yyval.integers) = (yyvsp[-2].integers);
1934 (yyval.integers)->emplace_back((yyvsp[0].integer_value));
1936#line 2019 "./ortools/flatzinc/parser.tab.cc"
1940#line 444 "./ortools/flatzinc/parser.yy"
1942 (yyval.integers) =
new std::vector<int64_t>();
1943 (yyval.integers)->emplace_back((yyvsp[0].integer_value));
1945#line 2025 "./ortools/flatzinc/parser.tab.cc"
1949#line 447 "./ortools/flatzinc/parser.yy"
1951 (yyval.integer_value) = (yyvsp[0].integer_value);
1953#line 2031 "./ortools/flatzinc/parser.tab.cc"
1957#line 448 "./ortools/flatzinc/parser.yy"
1959 (yyval.integer_value) =
context->integer_map.at((yyvsp[0].string_value));
1961#line 2037 "./ortools/flatzinc/parser.tab.cc"
1965#line 449 "./ortools/flatzinc/parser.yy"
1967 (yyval.integer_value) =
1968 Lookup(
context->integer_array_map.at((yyvsp[-3].string_value)),
1969 (yyvsp[-1].integer_value));
1971#line 2045 "./ortools/flatzinc/parser.tab.cc"
1975#line 454 "./ortools/flatzinc/parser.yy"
1977 (yyval.doubles) = (yyvsp[-2].doubles);
1978 (yyval.doubles)->emplace_back((yyvsp[0].double_value));
1980#line 2051 "./ortools/flatzinc/parser.tab.cc"
1984#line 455 "./ortools/flatzinc/parser.yy"
1986 (yyval.doubles) =
new std::vector<double>();
1987 (yyval.doubles)->emplace_back((yyvsp[0].double_value));
1989#line 2057 "./ortools/flatzinc/parser.tab.cc"
1993#line 458 "./ortools/flatzinc/parser.yy"
1995 (yyval.double_value) = (yyvsp[0].double_value);
1997#line 2063 "./ortools/flatzinc/parser.tab.cc"
2001#line 459 "./ortools/flatzinc/parser.yy"
2003 (yyval.double_value) =
context->float_map.at((yyvsp[0].string_value));
2005#line 2069 "./ortools/flatzinc/parser.tab.cc"
2009#line 460 "./ortools/flatzinc/parser.yy"
2011 (yyval.double_value) =
2012 Lookup(
context->float_array_map.at((yyvsp[-3].string_value)),
2013 (yyvsp[-1].integer_value));
2015#line 2077 "./ortools/flatzinc/parser.tab.cc"
2019#line 465 "./ortools/flatzinc/parser.yy"
2021 (yyval.domain) = Domain::IntegerValue((yyvsp[0].integer_value));
2023#line 2083 "./ortools/flatzinc/parser.tab.cc"
2027#line 466 "./ortools/flatzinc/parser.yy"
2030 Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value));
2032#line 2089 "./ortools/flatzinc/parser.tab.cc"
2036#line 467 "./ortools/flatzinc/parser.yy"
2038 CHECK((yyvsp[-1].integers) !=
nullptr);
2039 (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers)));
2040 delete (yyvsp[-1].integers);
2042#line 2099 "./ortools/flatzinc/parser.tab.cc"
2046#line 472 "./ortools/flatzinc/parser.yy"
2048 (yyval.domain) = Domain::EmptyDomain();
2050#line 2105 "./ortools/flatzinc/parser.tab.cc"
2054#line 473 "./ortools/flatzinc/parser.yy"
2056 (yyval.domain) = Domain::FloatValue((yyvsp[0].double_value));
2058#line 2113 "./ortools/flatzinc/parser.tab.cc"
2062#line 476 "./ortools/flatzinc/parser.yy"
2064 (yyval.domain) = Domain::IntegerValue(
2065 context->integer_map.at((yyvsp[0].string_value)));
2067#line 2119 "./ortools/flatzinc/parser.tab.cc"
2071#line 477 "./ortools/flatzinc/parser.yy"
2073 (yyval.domain) = Domain::IntegerValue(
2074 Lookup(
context->integer_array_map.at((yyvsp[-3].string_value)),
2075 (yyvsp[-1].integer_value)));
2077#line 2128 "./ortools/flatzinc/parser.tab.cc"
2081#line 483 "./ortools/flatzinc/parser.yy"
2083 (yyval.domains) = (yyvsp[-2].domains);
2084 (yyval.domains)->emplace_back((yyvsp[0].domain));
2086#line 2137 "./ortools/flatzinc/parser.tab.cc"
2090#line 487 "./ortools/flatzinc/parser.yy"
2092 (yyval.domains) =
new std::vector<Domain>();
2093 (yyval.domains)->emplace_back((yyvsp[0].domain));
2095#line 2143 "./ortools/flatzinc/parser.tab.cc"
2100#line 497 "./ortools/flatzinc/parser.yy"
2102 const std::string& identifier = (yyvsp[-4].string_value);
2103 CHECK((yyvsp[-2].args) !=
nullptr) <<
"Missing argument in constraint";
2104 const std::vector<Argument>& arguments = *(yyvsp[-2].args);
2105 std::vector<Annotation>*
const annotations = (yyvsp[0].annotations);
2107 model->AddConstraint(identifier, arguments,
2110 delete (yyvsp[-2].args);
2112#line 2158 "./ortools/flatzinc/parser.tab.cc"
2116#line 509 "./ortools/flatzinc/parser.yy"
2118 (yyval.args) = (yyvsp[-2].args);
2119 (yyval.args)->emplace_back((yyvsp[0].arg));
2121#line 2164 "./ortools/flatzinc/parser.tab.cc"
2125#line 510 "./ortools/flatzinc/parser.yy"
2127 (yyval.args) =
new std::vector<Argument>();
2128 (yyval.args)->emplace_back((yyvsp[0].arg));
2130#line 2170 "./ortools/flatzinc/parser.tab.cc"
2134#line 513 "./ortools/flatzinc/parser.yy"
2136 (yyval.arg) = Argument::IntegerValue((yyvsp[0].integer_value));
2138#line 2176 "./ortools/flatzinc/parser.tab.cc"
2142#line 514 "./ortools/flatzinc/parser.yy"
2144 (yyval.arg) = Argument::FloatValue((yyvsp[0].double_value));
2146#line 2182 "./ortools/flatzinc/parser.tab.cc"
2150#line 515 "./ortools/flatzinc/parser.yy"
2152 (yyval.arg) = Argument::VoidArgument();
2154#line 2188 "./ortools/flatzinc/parser.tab.cc"
2158#line 516 "./ortools/flatzinc/parser.yy"
2160 (yyval.arg) = Argument::Interval((yyvsp[-2].integer_value),
2161 (yyvsp[0].integer_value));
2163#line 2194 "./ortools/flatzinc/parser.tab.cc"
2167#line 517 "./ortools/flatzinc/parser.yy"
2169 CHECK((yyvsp[-1].integers) !=
nullptr);
2170 (yyval.arg) = Argument::IntegerList(std::move(*(yyvsp[-1].integers)));
2171 delete (yyvsp[-1].integers);
2173#line 2204 "./ortools/flatzinc/parser.tab.cc"
2177#line 522 "./ortools/flatzinc/parser.yy"
2179 const std::string&
id = (yyvsp[0].string_value);
2180 if (
context->integer_map.contains(
id)) {
2181 (yyval.arg) = Argument::IntegerValue(
context->integer_map.at(
id));
2182 }
else if (
context->integer_array_map.contains(
id)) {
2183 (yyval.arg) = Argument::IntegerList(
context->integer_array_map.at(
id));
2184 }
else if (
context->float_map.contains(
id)) {
2185 const double d =
context->float_map.at(
id);
2186 (yyval.arg) = Argument::FloatValue(d);
2187 }
else if (
context->float_array_map.contains(
id)) {
2188 const auto& double_values =
context->float_array_map.at(
id);
2189 (yyval.arg) = Argument::FloatList(std::move(double_values));
2190 }
else if (
context->variable_map.contains(
id)) {
2191 (yyval.arg) = Argument::VarRef(
context->variable_map.at(
id));
2192 }
else if (
context->variable_array_map.contains(
id)) {
2193 (yyval.arg) = Argument::VarRefArray(
context->variable_array_map.at(
id));
2194 }
else if (
context->domain_map.contains(
id)) {
2196 (yyval.arg) = Argument::FromDomain(d);
2199 <<
"Unknown identifier: " << id;
2200 const std::vector<Domain>& d =
context->domain_array_map.at(
id);
2201 (yyval.arg) = Argument::DomainList(d);
2204#line 2235 "./ortools/flatzinc/parser.tab.cc"
2208#line 548 "./ortools/flatzinc/parser.yy"
2210 const std::string&
id = (yyvsp[-3].string_value);
2211 const int64_t
index = (yyvsp[-1].integer_value);
2212 if (
context->integer_array_map.contains(
id)) {
2213 (yyval.arg) = Argument::IntegerValue(
2215 }
else if (
context->variable_array_map.contains(
id)) {
2220 <<
"Unknown identifier: " << id;
2222 (yyval.arg) = Argument::FromDomain(d);
2225#line 2257 "./ortools/flatzinc/parser.tab.cc"
2229#line 565 "./ortools/flatzinc/parser.yy"
2231 std::vector<VarRefOrValue>*
const arguments =
2232 (yyvsp[-1].var_or_value_array);
2233 CHECK(arguments !=
nullptr);
2234 bool has_variables =
false;
2235 bool has_floats =
false;
2236 for (
int i = 0; i < arguments->size(); ++i) {
2237 if ((*arguments)[i].variable !=
nullptr) {
2238 has_variables =
true;
2240 if ((*arguments)[i].is_float) {
2244 if (has_variables) {
2245 std::vector<Variable*> vars;
2246 vars.reserve(arguments->size());
2247 for (
int i = 0; i < arguments->size(); ++i) {
2252 vars.push_back(
model->AddConstant(data.
value));
2257 (yyval.arg) = Argument::VarRefArray(std::move(vars));
2258 }
else if (has_floats) {
2259 std::vector<double> values;
2260 values.reserve(arguments->size());
2262 if (data.is_float) {
2263 values.push_back(data.float_value);
2265 values.push_back(data.value);
2268 (yyval.arg) = Argument::FloatList(std::move(values));
2270 std::vector<int64_t> values;
2271 values.reserve(arguments->size());
2273 values.push_back(data.value);
2275 (yyval.arg) = Argument::IntegerList(std::move(values));
2279#line 2310 "./ortools/flatzinc/parser.tab.cc"
2283#line 613 "./ortools/flatzinc/parser.yy"
2285 (yyval.arg) = Argument::VoidArgument();
2287#line 2318 "./ortools/flatzinc/parser.tab.cc"
2291#line 622 "./ortools/flatzinc/parser.yy"
2293 (yyval.annotations) = (yyvsp[-2].annotations) !=
nullptr
2294 ? (yyvsp[-2].annotations)
2295 :
new std::vector<Annotation>();
2296 (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2298#line 2327 "./ortools/flatzinc/parser.tab.cc"
2302#line 626 "./ortools/flatzinc/parser.yy"
2304 (yyval.annotations) =
nullptr;
2306#line 2333 "./ortools/flatzinc/parser.tab.cc"
2310#line 629 "./ortools/flatzinc/parser.yy"
2312 (yyval.annotations) = (yyvsp[-2].annotations);
2313 (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2315#line 2339 "./ortools/flatzinc/parser.tab.cc"
2319#line 630 "./ortools/flatzinc/parser.yy"
2321 (yyval.annotations) =
new std::vector<Annotation>();
2322 (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2324#line 2345 "./ortools/flatzinc/parser.tab.cc"
2328#line 633 "./ortools/flatzinc/parser.yy"
2330 (yyval.annotation) = Annotation::Interval((yyvsp[-2].integer_value),
2331 (yyvsp[0].integer_value));
2333#line 2351 "./ortools/flatzinc/parser.tab.cc"
2337#line 634 "./ortools/flatzinc/parser.yy"
2339 (yyval.annotation) = Annotation::IntegerValue((yyvsp[0].integer_value));
2341#line 2357 "./ortools/flatzinc/parser.tab.cc"
2345#line 635 "./ortools/flatzinc/parser.yy"
2347 (yyval.annotation) = Annotation::String((yyvsp[0].string_value));
2349#line 2363 "./ortools/flatzinc/parser.tab.cc"
2353#line 636 "./ortools/flatzinc/parser.yy"
2355 const std::string&
id = (yyvsp[0].string_value);
2356 if (
context->variable_map.contains(
id)) {
2357 (yyval.annotation) = Annotation::VarRef(
context->variable_map.at(
id));
2358 }
else if (
context->variable_array_map.contains(
id)) {
2359 (yyval.annotation) =
2360 Annotation::VarRefArray(
context->variable_array_map.at(
id));
2362 (yyval.annotation) = Annotation::Identifier(
id);
2365#line 2378 "./ortools/flatzinc/parser.tab.cc"
2369#line 646 "./ortools/flatzinc/parser.yy"
2371 std::vector<Annotation>*
const annotations = (yyvsp[-1].annotations);
2372 if (annotations !=
nullptr) {
2373 (yyval.annotation) = Annotation::FunctionCallWithArguments(
2374 (yyvsp[-3].string_value), std::move(*annotations));
2377 (yyval.annotation) = Annotation::FunctionCall((yyvsp[-3].string_value));
2380#line 2392 "./ortools/flatzinc/parser.tab.cc"
2384#line 655 "./ortools/flatzinc/parser.yy"
2386 CHECK(
context->variable_array_map.contains((yyvsp[-3].string_value)))
2387 <<
"Unknown identifier: " << (yyvsp[-3].string_value);
2388 (yyval.annotation) = Annotation::VarRef(
2389 Lookup(
context->variable_array_map.at((yyvsp[-3].string_value)),
2390 (yyvsp[-1].integer_value)));
2392#line 2403 "./ortools/flatzinc/parser.tab.cc"
2396#line 661 "./ortools/flatzinc/parser.yy"
2398 std::vector<Annotation>*
const annotations = (yyvsp[-1].annotations);
2399 if (annotations !=
nullptr) {
2400 (yyval.annotation) =
2401 Annotation::AnnotationList(std::move(*annotations));
2404 (yyval.annotation) = Annotation::Empty();
2407#line 2417 "./ortools/flatzinc/parser.tab.cc"
2411#line 676 "./ortools/flatzinc/parser.yy"
2413 if ((yyvsp[-1].annotations) !=
nullptr) {
2414 model->Satisfy(std::move(*(yyvsp[-1].annotations)));
2415 delete (yyvsp[-1].annotations);
2417 model->Satisfy(std::vector<Annotation>());
2420#line 2430 "./ortools/flatzinc/parser.tab.cc"
2424#line 684 "./ortools/flatzinc/parser.yy"
2426 Variable* obj_var = (yyvsp[0].arg).type == Argument::VAR_REF
2427 ? (yyvsp[0].arg).Var()
2428 :
model->AddConstant((yyvsp[0].arg).Value());
2429 if ((yyvsp[-2].annotations) !=
nullptr) {
2430 model->Minimize(obj_var, std::move(*(yyvsp[-2].annotations)));
2431 delete (yyvsp[-2].annotations);
2433 model->Minimize(obj_var, std::vector<Annotation>());
2436#line 2446 "./ortools/flatzinc/parser.tab.cc"
2440#line 695 "./ortools/flatzinc/parser.yy"
2442 Variable* obj_var = (yyvsp[0].arg).type == Argument::VAR_REF
2443 ? (yyvsp[0].arg).Var()
2444 :
model->AddConstant((yyvsp[0].arg).Value());
2445 if ((yyvsp[-2].annotations) !=
nullptr) {
2446 model->Maximize(obj_var, std::move(*(yyvsp[-2].annotations)));
2447 delete (yyvsp[-2].annotations);
2449 model->Maximize(obj_var, std::vector<Annotation>());
2452#line 2462 "./ortools/flatzinc/parser.tab.cc"
2455#line 2466 "./ortools/flatzinc/parser.tab.cc"
2484 const int yyi =
yypgoto[yylhs] + *yyssp;
2485 yystate = (0 <= yyi && yyi <=
YYLAST &&
yycheck[yyi] == *yyssp
2504 char const* yymsgp =
YY_(
"syntax error");
2505 int yysyntax_error_status;
2506 yysyntax_error_status =
yysyntax_error(&yymsg_alloc, &yymsg, &yyctx);
2507 if (yysyntax_error_status == 0)
2509 else if (yysyntax_error_status == -1) {
2513 yysyntax_error_status =
yysyntax_error(&yymsg_alloc, &yymsg, &yyctx);
2517 yymsg_alloc =
sizeof yymsgbuf;
2526 if (yyerrstatus == 3) {
2530 if (yychar <= ORFZ_EOF) {
2532 if (yychar == ORFZ_EOF)
YYABORT;
2536 yychar = ORFZ_EMPTY;
2582 model, ok, scanner);
2624 if (yychar != ORFZ_EMPTY) {
2629 model, ok, scanner);
2635 while (yyssp != yyss) {
2637 model, ok, scanner);
2647#line 707 "./ortools/flatzinc/parser.yy"
#define CHECK_EQ(val1, val2)
SharedBoundsManager * bounds
GurobiMPCallbackContext * context
const T & Lookup(const std::vector< T > &v, int index)
bool ContainsId(std::vector< Annotation > *annotations, const std::string &id)
int64_t ConvertAsIntegerOrDie(double d)
bool AllDomainsHaveOneValue(const std::vector< Domain > &domains)
std::function< int64_t(const Model &)> Value(IntegerVariable v)
static const char * yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED
static YYPTRDIFF_T yystrlen(const char *yystr)
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
static void yydestruct(const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, operations_research::fz::ParserContext *context, operations_research::fz::Model *model, bool *ok, void *scanner)
static const yytype_int8 yytranslate[]
@ YYSYMBOL_const_literals
@ YYSYMBOL_optional_var_or_value_array
@ YYSYMBOL_var_or_value_array
@ YYSYMBOL_variable_or_constant_declarations
@ YYSYMBOL_predicate_arguments
@ YYSYMBOL_variable_or_constant_declaration
@ YYSYMBOL_optional_var_or_value
@ YYSYMBOL_predicate_array_argument
@ YYSYMBOL_annotation_arguments
@ YYSYMBOL_predicate_argument
@ YYSYMBOL_predicate_ints
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
static const yytype_int8 yydefact[]
#define YY_IGNORE_USELESS_CAST_END
static const yytype_int16 yyrline[]
#define YY_REDUCE_PRINT(Rule)
#define YY_CAST(Type, Val)
static const yytype_int16 yypact[]
static const yytype_uint8 yydefgoto[]
static void yy_symbol_print(FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, operations_research::fz::ParserContext *context, operations_research::fz::Model *model, bool *ok, void *scanner)
#define YY_ACCESSING_SYMBOL(State)
Accessing symbol of state STATE.
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
static const yytype_int16 yypgoto[]
#define YY_INITIAL_VALUE(Value)
static void yy_symbol_value_print(FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, operations_research::fz::ParserContext *context, operations_research::fz::Model *model, bool *ok, void *scanner)
static YYPTRDIFF_T yytnamerr(char *yyres, const char *yystr)
unsigned char yytype_uint8
#define YY_STACK_PRINT(Bottom, Top)
#define YYSTACK_ALLOC_MAXIMUM
#define YY_IGNORE_USELESS_CAST_BEGIN
static const yytype_int8 yyr2[]
static const yytype_int16 yytable[]
#define yytable_value_is_error(Yyn)
static const yytype_int8 yystos[]
#define YY_ATTRIBUTE_UNUSED
static const char *const yytname[]
static int yypcontext_expected_tokens(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn)
static const yytype_int8 yyr1[]
static char * yystpcpy(char *yydest, const char *yysrc)
unsigned short yytype_uint16
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
#define yypact_value_is_default(Yyn)
static int yy_syntax_error_arguments(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn)
static void yy_reduce_print(yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule, operations_research::fz::ParserContext *context, operations_research::fz::Model *model, bool *ok, void *scanner)
static void yy_stack_print(yy_state_t *yybottom, yy_state_t *yytop)
static const yytype_int16 yycheck[]
static int yysyntax_error(YYPTRDIFF_T *yymsg_alloc, char **yymsg, const yypcontext_t *yyctx)
bool IsFunctionCallWithIdentifier(absl::string_view identifier) const
std::vector< Annotation > annotations
bool Contains(int64_t value) const
std::vector< int64_t > values