65 #define YYBISON_VERSION "3.7.6" 68 #define YYSKELETON_NAME "yacc.c" 80 #define YYSTYPE ORFZ_STYPE 82 #define yyparse orfz_parse 83 #define yylex orfz_lex 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)) 351 #if defined __GNUC__ && !defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 353 #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 354 _Pragma("GCC diagnostic push") \ 355 _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \ 356 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 357 #define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop") 359 #define YY_INITIAL_VALUE(Value) Value 361 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 362 #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 363 #define YY_IGNORE_MAYBE_UNINITIALIZED_END 365 #ifndef YY_INITIAL_VALUE 366 #define YY_INITIAL_VALUE(Value) 369 #if defined __cplusplus && defined __GNUC__ && !defined __ICC && 6 <= __GNUC__ 370 #define YY_IGNORE_USELESS_CAST_BEGIN \ 371 _Pragma("GCC diagnostic push") \ 372 _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"") 373 #define YY_IGNORE_USELESS_CAST_END _Pragma("GCC diagnostic pop") 375 #ifndef YY_IGNORE_USELESS_CAST_BEGIN 376 #define YY_IGNORE_USELESS_CAST_BEGIN 377 #define YY_IGNORE_USELESS_CAST_END 380 #define YY_ASSERT(E) ((void)(0 && (E))) 386 #ifdef YYSTACK_USE_ALLOCA 387 #if YYSTACK_USE_ALLOCA 389 #define YYSTACK_ALLOC __builtin_alloca 390 #elif defined __BUILTIN_VA_ARG_INCR 393 #define YYSTACK_ALLOC __alloca 394 #elif defined _MSC_VER 396 #define alloca _alloca 398 #define YYSTACK_ALLOC alloca 399 #if !defined _ALLOCA_H && !defined EXIT_SUCCESS 403 #define EXIT_SUCCESS 0 412 #define YYSTACK_FREE(Ptr) \ 416 #ifndef YYSTACK_ALLOC_MAXIMUM 421 #define YYSTACK_ALLOC_MAXIMUM 4032 424 #define YYSTACK_ALLOC YYMALLOC 425 #define YYSTACK_FREE YYFREE 426 #ifndef YYSTACK_ALLOC_MAXIMUM 427 #define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 429 #if (defined __cplusplus && !defined EXIT_SUCCESS && \ 430 !((defined YYMALLOC || defined malloc) && \ 431 (defined YYFREE || defined free))) 434 #define EXIT_SUCCESS 0 438 #define YYMALLOC malloc 439 #if !defined malloc && !defined EXIT_SUCCESS 445 #if !defined free && !defined EXIT_SUCCESS 452 #if (!defined yyoverflow && \ 453 (!defined __cplusplus || \ 454 (defined ORFZ_STYPE_IS_TRIVIAL && ORFZ_STYPE_IS_TRIVIAL))) 463 #define YYSTACK_GAP_MAXIMUM (YYSIZEOF(union yyalloc) - 1) 467 #define YYSTACK_BYTES(N) \ 468 ((N) * (YYSIZEOF(yy_state_t) + YYSIZEOF(YYSTYPE)) + YYSTACK_GAP_MAXIMUM) 470 #define YYCOPY_NEEDED 1 477 #define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 479 YYPTRDIFF_T yynewbytes; \ 480 YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \ 481 Stack = &yyptr->Stack_alloc; \ 482 yynewbytes = yystacksize * YYSIZEOF(*Stack) + YYSTACK_GAP_MAXIMUM; \ 483 yyptr += yynewbytes / YYSIZEOF(*yyptr); \ 488 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 492 #if defined __GNUC__ && 1 < __GNUC__ 493 #define YYCOPY(Dst, Src, Count) \ 494 __builtin_memcpy(Dst, Src, YY_CAST(YYSIZE_T, (Count)) * sizeof(*(Src))) 496 #define YYCOPY(Dst, Src, Count) \ 499 for (yyi = 0; yyi < (Count); yyi++) (Dst)[yyi] = (Src)[yyi]; \ 517 #define YYNSTATES 224 520 #define YYMAXUTOK 276 524 #define YYTRANSLATE(YYX) \ 525 (0 <= (YYX) && (YYX) <= YYMAXUTOK \ 526 ? YY_CAST(yysymbol_kind_t, yytranslate[YYX]) \ 532 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 23, 24, 2, 2, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 22,
535 2, 29, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 2, 28, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 30, 2, 31, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 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, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
545 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21};
550 0, 102, 102, 109, 113, 114, 119, 122, 123, 126, 127, 128, 129, 132,
551 133, 136, 137, 144, 145, 148, 167, 182, 193, 208, 219, 245, 278, 355,
552 356, 359, 360, 361, 364, 368, 374, 375, 376, 391, 412, 413, 414, 415,
553 422, 423, 424, 425, 432, 433, 438, 439, 440, 443, 444, 447, 448, 449,
554 454, 455, 458, 459, 460, 465, 466, 467, 472, 473, 476, 477, 483, 487,
555 493, 494, 497, 509, 510, 513, 514, 515, 516, 517, 522, 548, 565, 613,
556 622, 626, 629, 630, 633, 634, 635, 636, 646, 655, 661, 676, 684, 695};
560 #define YY_ACCESSING_SYMBOL(State) YY_CAST(yysymbol_kind_t, yystos[State]) 569 static const char*
const yytname[] = {
"\"end of file\"",
605 "predicate_arguments",
606 "predicate_argument",
607 "predicate_array_argument",
609 "variable_or_constant_declarations",
610 "variable_or_constant_declaration",
611 "optional_var_or_value",
612 "optional_var_or_value_array",
613 "var_or_value_array",
630 "annotation_arguments",
643 static const yytype_int16 yytoknum[] = {0, 256, 257, 258, 259, 260, 261, 262,
644 263, 264, 265, 266, 267, 268, 269, 270,
645 271, 272, 273, 274, 275, 276, 59, 40,
646 41, 44, 58, 91, 93, 61, 123, 125};
649 #define YYPACT_NINF (-184) 651 #define yypact_value_is_default(Yyn) ((Yyn) == YYPACT_NINF) 653 #define YYTABLE_NINF (-19) 655 #define yytable_value_is_error(Yyn) 0 660 -184, 26, 7, -184, -15, 41, 24, 36, -184, 64, -184, 70,
661 -184, -184, -184, 112, 88, 117, 129, 155, 116, -184, -184, -184,
662 121, 132, 49, 143, 20, 126, 164, 162, -184, 157, -2, -184,
663 -184, 123, 165, -184, 166, 167, 159, 88, 163, 168, 169, 174,
664 -184, -184, 175, 155, 172, -184, -184, 176, 155, -184, -184, 173,
665 127, -184, -184, 53, 171, -184, 49, 178, 181, 182, 38, -184,
666 177, -184, 16, 84, 84, 84, -184, 122, 179, 185, 180, -184,
667 183, -184, -184, 184, -184, -184, 30, -184, 14, 186, -184, 187,
668 -184, 95, 155, 152, -184, -184, -184, 190, -184, 98, 122, -184,
669 200, 191, 201, -184, 203, 139, -184, 194, 188, -184, -1, -184,
670 198, 199, -184, 192, -184, -184, 82, -184, 125, -184, 84, 202,
671 122, 204, 138, -184, -184, -184, 68, 78, -184, 205, 206, -184,
672 133, -184, 193, 207, 139, -184, -184, 209, -184, -184, 154, 208,
673 122, -184, 88, 211, 88, 212, 213, 214, -184, 215, -184, -184,
674 216, -184, -184, -184, -184, 219, 210, 220, 221, 222, 227, -184,
675 -184, 228, -184, 229, -184, -184, -184, -184, -184, 48, 59, 61,
676 83, 223, 224, 225, 226, -184, 106, 14, 134, 99, -184, 140,
677 -184, 142, 230, -184, -184, 144, -184, -184, 146, -184, 14, -184,
678 217, 160, -184, -184, -184, 231, -184, -184};
684 5, 0, 0, 1, 0, 0, 0, 71, 4, 0, 3, 0, 38, 46, 39, 0, 0, 0, 0,
685 0, 0, 48, 49, 50, 0, 0, 0, 0, 0, 0, 0, 0, 53, 54, 0, 52, 17, 0,
686 0, 85, 0, 0, 0, 0, 0, 8, 0, 0, 42, 43, 0, 0, 0, 40, 47, 0, 0,
687 41, 85, 0, 0, 70, 2, 0, 0, 6, 0, 0, 0, 0, 0, 85, 0, 51, 0, 0,
688 0, 0, 95, 0, 16, 0, 0, 13, 0, 7, 9, 0, 44, 45, 28, 55, 0, 75, 77,
689 80, 76, 0, 0, 0, 74, 97, 96, 89, 90, 91, 0, 84, 0, 0, 0, 10, 0, 0,
690 25, 61, 66, 65, 0, 19, 0, 0, 34, 36, 35, 83, 0, 33, 0, 85, 0, 0, 0,
691 0, 0, 87, 15, 14, 0, 0, 27, 0, 0, 64, 0, 78, 0, 0, 0, 82, 79, 72,
692 73, 88, 0, 0, 0, 94, 0, 0, 0, 0, 0, 0, 62, 0, 63, 81, 0, 32, 92,
693 93, 86, 0, 0, 0, 0, 0, 0, 67, 37, 0, 11, 0, 85, 85, 85, 12, 85, 0,
694 0, 0, 31, 0, 0, 0, 0, 26, 0, 0, 0, 0, 21, 0, 69, 0, 59, 58, 23,
695 0, 57, 30, 0, 20, 0, 24, 0, 0, 22, 29, 68, 0, 56, 60};
699 -184, -184, -184, -184, 161, -184, -184, 110, -184, -184, -184,
700 -184, 27, -107, 90, 92, 93, -7, -50, 218, -184, 17,
701 -183, -184, -184, -184, -184, -72, -56, 101, -76, -184};
705 0, 1, 2, 6, 44, 45, 82, 83, 7, 20, 114, 197, 126, 127, 21, 22,
706 23, 46, 34, 35, 209, 210, 119, 205, 25, 40, 99, 100, 60, 134, 135, 41};
712 24, 70, 74, 107, 101, 102, 140, 8, 4, 29, -18, -18, -18, -18, -18,
713 90, 204, 32, 5, 33, -18, -18, -18, 56, 48, -18, 3, 49, -18, 57,
714 143, 220, 115, 79, 116, 117, 64, -18, 50, 11, 12, 169, 13, 14, 118,
715 92, 10, 79, 128, 15, 51, 16, 42, 12, 17, 13, 14, 18, 152, 113,
716 80, 9, 15, 56, 43, 79, 19, 17, 144, 89, 18, 81, 12, 151, 13,
717 14, 79, 193, 79, 19, 172, 15, 12, 158, 13, 14, 17, 26, 194, 18,
718 195, 15, 12, 160, 13, 14, 17, 27, 19, 18, 79, 15, 93, 94, 95,
719 96, 17, 148, 19, 18, 149, 97, 196, 122, 98, 123, 124, 122, 19, 123,
720 124, 132, 28, 125, 32, 133, 33, 211, 189, 190, 191, 159, 192, 30, 202,
721 76, 77, 38, 36, 78, 103, 104, 105, 58, 79, 31, 39, 37, 203, 106,
722 56, 173, 52, 175, 206, 207, 150, 122, 56, 123, 124, 47, 208, 156, 166,
723 56, 157, 214, 213, 217, 215, 148, 218, 32, 219, 33, 129, 130, 170, 156,
724 206, 207, 53, 54, 55, 59, 63, 65, 61, 62, 68, 69, 71, 66, 72,
725 67, 75, 84, 86, 87, 88, 109, 120, 111, 108, 91, 131, 80, 110, 137,
726 141, 138, 112, 139, 121, 142, 145, 146, 136, 147, 153, 167, 155, 164, 165,
727 168, 79, 85, 212, 161, 182, 162, 163, 154, 222, 221, 171, 174, 176, 177,
728 178, 184, 185, 179, 180, 181, 183, 186, 187, 188, 198, 199, 200, 201, 0,
729 0, 0, 216, 0, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
733 7, 51, 58, 79, 76, 77, 113, 22, 1, 16, 3, 4, 5, 6, 7, 71,
734 199, 18, 11, 20, 13, 14, 15, 25, 4, 18, 0, 7, 21, 31, 31, 214,
735 18, 17, 20, 21, 43, 30, 18, 3, 4, 148, 6, 7, 30, 29, 22, 17,
736 98, 13, 30, 15, 3, 4, 18, 6, 7, 21, 130, 29, 7, 20, 13, 25,
737 15, 17, 30, 18, 118, 31, 21, 18, 4, 129, 6, 7, 17, 29, 17, 30,
738 156, 13, 4, 15, 6, 7, 18, 23, 29, 21, 29, 13, 4, 15, 6, 7,
739 18, 27, 30, 21, 17, 13, 18, 19, 20, 21, 18, 25, 30, 21, 28, 27,
740 29, 18, 30, 20, 21, 18, 30, 20, 21, 23, 10, 28, 18, 27, 20, 28,
741 184, 185, 186, 138, 188, 16, 28, 8, 9, 5, 22, 12, 18, 19, 20, 20,
742 17, 16, 14, 26, 198, 27, 25, 158, 26, 160, 20, 21, 31, 18, 25, 20,
743 21, 18, 28, 25, 31, 25, 28, 25, 28, 25, 28, 25, 28, 18, 28, 20,
744 24, 25, 24, 25, 20, 21, 18, 21, 27, 20, 27, 24, 22, 22, 16, 16,
745 20, 25, 18, 26, 23, 26, 20, 18, 18, 16, 16, 20, 25, 28, 16, 7,
746 28, 18, 16, 10, 28, 10, 27, 27, 18, 18, 108, 27, 18, 28, 18, 18,
747 18, 18, 17, 66, 201, 139, 20, 139, 139, 132, 217, 18, 28, 26, 26, 26,
748 26, 20, 20, 28, 28, 26, 26, 20, 20, 20, 27, 27, 27, 27, -1, -1,
749 -1, 27, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
755 0, 33, 34, 0, 1, 11, 35, 40, 22, 20, 22, 3, 4, 6, 7, 13, 15, 18, 21,
756 30, 41, 46, 47, 48, 49, 56, 23, 27, 10, 49, 16, 16, 18, 20, 50, 51, 22, 26,
757 5, 14, 57, 63, 3, 15, 36, 37, 49, 18, 4, 7, 18, 30, 26, 18, 21, 27, 25,
758 31, 20, 20, 60, 22, 22, 27, 49, 24, 25, 26, 16, 16, 50, 20, 18, 51, 60, 23,
759 8, 9, 12, 17, 7, 18, 38, 39, 26, 36, 20, 18, 18, 31, 60, 28, 29, 18, 19,
760 20, 21, 27, 30, 58, 59, 59, 59, 18, 19, 20, 27, 62, 25, 16, 28, 20, 28, 29,
761 42, 18, 20, 21, 30, 54, 16, 27, 18, 20, 21, 28, 44, 45, 50, 24, 25, 16, 23,
762 27, 61, 62, 39, 18, 10, 10, 45, 16, 27, 31, 50, 18, 18, 27, 25, 28, 31, 60,
763 59, 18, 61, 18, 25, 28, 15, 49, 15, 46, 47, 48, 18, 18, 31, 28, 18, 45, 24,
764 28, 62, 49, 26, 49, 26, 26, 26, 28, 28, 26, 20, 26, 20, 20, 20, 20, 20, 60,
765 60, 60, 60, 29, 29, 29, 29, 43, 27, 27, 27, 27, 28, 50, 54, 55, 20, 21, 28,
766 52, 53, 28, 44, 28, 25, 28, 27, 25, 28, 28, 54, 18, 53, 28};
770 0, 32, 33, 34, 34, 34, 35, 36, 36, 37, 37, 37, 37, 38, 38, 39, 39,
771 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44,
772 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 49, 49, 49,
773 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54,
774 55, 55, 56, 56, 57, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60,
775 60, 61, 61, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63};
779 0, 2, 5, 3, 3, 0, 5, 3, 1, 3, 4, 8, 9, 1, 3, 3, 1, 3, 0, 6,
780 15, 14, 15, 14, 15, 6, 13, 2, 0, 4, 3, 0, 3, 1, 1, 1, 1, 4, 1, 1,
781 3, 3, 3, 3, 5, 5, 1, 3, 1, 1, 1, 3, 1, 1, 1, 4, 3, 1, 1, 1,
782 4, 1, 3, 3, 2, 1, 1, 4, 3, 1, 3, 0, 6, 3, 1, 1, 1, 1, 3, 3,
783 1, 4, 3, 2, 3, 0, 3, 1, 3, 1, 1, 1, 4, 4, 3, 3, 4, 4};
787 #define yyerrok (yyerrstatus = 0) 788 #define yyclearin (yychar = ORFZ_EMPTY) 790 #define YYACCEPT goto yyacceptlab 791 #define YYABORT goto yyabortlab 792 #define YYERROR goto yyerrorlab 794 #define YYRECOVERING() (!!yyerrstatus) 796 #define YYBACKUP(Token, Value) \ 798 if (yychar == ORFZ_EMPTY) { \ 805 yyerror(context, model, ok, scanner, \ 806 YY_("syntax error: cannot back up")); \ 813 #define YYERRCODE ORFZ_UNDEF 820 #define YYFPRINTF fprintf 823 #define YYDPRINTF(Args) \ 825 if (yydebug) YYFPRINTF Args; \ 829 #ifndef YY_LOCATION_PRINT 830 #define YY_LOCATION_PRINT(File, Loc) ((void)0) 833 #define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ 836 YYFPRINTF(stderr, "%s ", Title); \ 837 yy_symbol_print(stderr, Kind, Value, context, model, ok, scanner); \ 838 YYFPRINTF(stderr, "\n"); \ 850 FILE* yyoutput = yyo;
856 if (!yyvaluep)
return;
858 if (yykind <
YYNTOKENS) YYPRINT(yyo, yytoknum[yykind], *yyvaluep);
888 for (; yybottom <= yytop; yybottom++) {
889 int yybot = *yybottom;
895 #define YY_STACK_PRINT(Bottom, Top) \ 897 if (yydebug) yy_stack_print((Bottom), (Top)); \ 909 int yynrhs =
yyr2[yyrule];
911 YYFPRINTF(stderr,
"Reducing stack by rule %d (line %d):\n", yyrule - 1,
914 for (yyi = 0; yyi < yynrhs; yyi++) {
917 &yyvsp[(yyi + 1) - (yynrhs)],
context,
model, ok, scanner);
922 #define YY_REDUCE_PRINT(Rule) \ 925 yy_reduce_print(yyssp, yyvsp, Rule, context, model, ok, scanner); \ 932 #define YYDPRINTF(Args) ((void)0) 933 #define YY_SYMBOL_PRINT(Title, Kind, Value, Location) 934 #define YY_STACK_PRINT(Bottom, Top) 935 #define YY_REDUCE_PRINT(Rule) 940 #define YYINITDEPTH 200 951 #define YYMAXDEPTH 10000 975 int yyxbegin = yyn < 0 ? -yyn : 0;
977 int yychecklim =
YYLAST - yyn + 1;
980 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
985 else if (yycount == yyargn)
996 #if defined __GLIBC__ && defined _STRING_H 997 #define yystrlen(S) (YY_CAST(YYPTRDIFF_T, strlen(S))) 1002 for (yylen = 0; yystr[yylen]; yylen++)
continue;
1009 #if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1010 #define yystpcpy stpcpy 1014 static char*
yystpcpy(
char* yydest,
const char* yysrc) {
1016 const char* yys = yysrc;
1018 while ((*yyd++ = *yys++) !=
'\0')
continue;
1034 if (*yystr ==
'"') {
1036 char const* yyp = yystr;
1037 for (;;)
switch (*++yyp) {
1040 goto do_not_strip_quotes;
1044 goto do_not_strip_quotes;
1050 if (yyres) yyres[yyn] = *yyp;
1055 if (yyres) yyres[yyn] =
'\0';
1058 do_not_strip_quotes:;
1062 return yystpcpy(yyres, yystr) - yyres;
1097 if (yyarg) yyarg[yycount] = yyctx->
yytoken;
1119 enum { YYARGS_MAX = 5 };
1133 #define YYCASE_(N, S) \ 1139 YYCASE_(1,
YY_(
"syntax error, unexpected %s"));
1140 YYCASE_(2,
YY_(
"syntax error, unexpected %s, expecting %s"));
1141 YYCASE_(3,
YY_(
"syntax error, unexpected %s, expecting %s or %s"));
1142 YYCASE_(4,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
1145 YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1151 yysize =
yystrlen(yyformat) - 2 * yycount + 1;
1154 for (yyi = 0; yyi < yycount; ++yyi) {
1163 if (*yymsg_alloc < yysize) {
1164 *yymsg_alloc = 2 * yysize;
1176 while ((*yyp = *yyformat) !=
'\0')
1177 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount) {
1202 if (!yymsg) yymsg =
"Deleting";
1230 int yyerrstatus = 0;
1259 char* yymsg = yymsgbuf;
1262 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1268 YYDPRINTF((stderr,
"Starting parse\n"));
1270 yychar = ORFZ_EMPTY;
1285 YYDPRINTF((stderr,
"Entering state %d\n", yystate));
1292 if (yyss + yystacksize - 1 <= yyssp)
1293 #if !defined yyoverflow && !defined YYSTACK_RELOCATE 1294 goto yyexhaustedlab;
1300 #if defined yyoverflow 1312 yyoverflow(
YY_(
"memory exhausted"), &yyss1, yysize *
YYSIZEOF(*yyssp),
1313 &yyvs1, yysize *
YYSIZEOF(*yyvsp), &yystacksize);
1319 if (
YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
1328 if (!yyptr)
goto yyexhaustedlab;
1331 #undef YYSTACK_RELOCATE 1336 yyssp = yyss + yysize - 1;
1337 yyvsp = yyvs + yysize - 1;
1341 (stderr,
"Stack size increased to %ld\n",
YY_CAST(
long, yystacksize)));
1344 if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
1366 if (yychar == ORFZ_EMPTY) {
1367 YYDPRINTF((stderr,
"Reading a token\n"));
1371 if (yychar <= ORFZ_EOF) {
1374 YYDPRINTF((stderr,
"Now at end of input.\n"));
1375 }
else if (yychar == ORFZ_error) {
1380 yychar = ORFZ_UNDEF;
1391 if (yyn < 0 ||
YYLAST < yyn ||
yycheck[yyn] != yytoken)
goto yydefault;
1401 if (yyerrstatus) yyerrstatus--;
1411 yychar = ORFZ_EMPTY;
1419 if (yyn == 0)
goto yyerrlab;
1437 yyval = yyvsp[1 - yylen];
1442 #line 113 "./ortools/flatzinc/parser.yy" 1446 #line 1592 "./ortools/flatzinc/parser.tab.cc" 1451 #line 148 "./ortools/flatzinc/parser.yy" 1455 const Domain& domain = (yyvsp[-5].domain);
1456 const std::string& identifier = (yyvsp[-3].string_value);
1457 const Domain& assignment = (yyvsp[0].domain);
1458 std::vector<Annotation>*
const annotations = (yyvsp[-2].annotations);
1462 context->domain_map[identifier] = assignment;
1470 #line 1616 "./ortools/flatzinc/parser.tab.cc" 1476 #line 168 "./ortools/flatzinc/parser.yy" 1478 std::vector<Annotation>*
const annotations = (yyvsp[-4].annotations);
1480 CHECK_EQ((yyvsp[-12].integer_value), 1)
1481 <<
"Only [1..n] array are supported here.";
1482 const int64_t num_constants = (yyvsp[-10].integer_value);
1483 const std::string& identifier = (yyvsp[-5].string_value);
1484 const std::vector<int64_t>*
const assignments = (yyvsp[-1].integers);
1485 CHECK(assignments !=
nullptr);
1486 CHECK_EQ(num_constants, assignments->size());
1488 context->integer_array_map[identifier] = *assignments;
1492 #line 1635 "./ortools/flatzinc/parser.tab.cc" 1497 #line 183 "./ortools/flatzinc/parser.yy" 1499 std::vector<Annotation>*
const annotations = (yyvsp[-3].annotations);
1501 CHECK_EQ((yyvsp[-11].integer_value), 1)
1502 <<
"Only [1..n] array are supported here.";
1503 const int64_t num_constants = (yyvsp[-9].integer_value);
1504 CHECK_EQ(num_constants, 0) <<
"Empty arrays should have a size of 0";
1505 const std::string& identifier = (yyvsp[-4].string_value);
1506 context->integer_array_map[identifier] = std::vector<int64_t>();
1509 #line 1650 "./ortools/flatzinc/parser.tab.cc" 1515 #line 194 "./ortools/flatzinc/parser.yy" 1517 std::vector<Annotation>*
const annotations = (yyvsp[-4].annotations);
1519 CHECK_EQ((yyvsp[-12].integer_value), 1)
1520 <<
"Only [1..n] array are supported here.";
1521 const int64_t num_constants = (yyvsp[-10].integer_value);
1522 const std::string& identifier = (yyvsp[-5].string_value);
1523 const std::vector<double>*
const assignments = (yyvsp[-1].doubles);
1524 CHECK(assignments !=
nullptr);
1525 CHECK_EQ(num_constants, assignments->size());
1527 context->float_array_map[identifier] = *assignments;
1531 #line 1669 "./ortools/flatzinc/parser.tab.cc" 1536 #line 209 "./ortools/flatzinc/parser.yy" 1538 std::vector<Annotation>*
const annotations = (yyvsp[-3].annotations);
1540 CHECK_EQ((yyvsp[-11].integer_value), 1)
1541 <<
"Only [1..n] array are supported here.";
1542 const int64_t num_constants = (yyvsp[-9].integer_value);
1543 CHECK_EQ(num_constants, 0) <<
"Empty arrays should have a size of 0";
1544 const std::string& identifier = (yyvsp[-4].string_value);
1545 context->float_array_map[identifier] = std::vector<double>();
1548 #line 1684 "./ortools/flatzinc/parser.tab.cc" 1554 #line 220 "./ortools/flatzinc/parser.yy" 1557 CHECK_EQ((yyvsp[-12].integer_value), 1)
1558 <<
"Only [1..n] array are supported here.";
1559 const int64_t num_constants = (yyvsp[-10].integer_value);
1560 const Domain& domain = (yyvsp[-7].domain);
1561 const std::string& identifier = (yyvsp[-5].string_value);
1562 const std::vector<Domain>*
const assignments = (yyvsp[-1].domains);
1563 const std::vector<Annotation>*
const annotations =
1564 (yyvsp[-4].annotations);
1565 CHECK(assignments !=
nullptr);
1566 CHECK_EQ(num_constants, assignments->size());
1569 context->domain_array_map[identifier] = *assignments;
1572 std::vector<int64_t> values(num_constants);
1573 for (
int i = 0; i < num_constants; ++i) {
1574 values[i] = (*assignments)[i].values.front();
1577 context->integer_array_map[identifier] = values;
1582 #line 1714 "./ortools/flatzinc/parser.tab.cc" 1587 #line 245 "./ortools/flatzinc/parser.yy" 1593 const Domain& domain = (yyvsp[-4].domain);
1594 const std::string& identifier = (yyvsp[-2].string_value);
1595 std::vector<Annotation>*
const annotations = (yyvsp[-1].annotations);
1597 const bool introduced =
ContainsId(annotations,
"var_is_introduced") ||
1598 absl::StartsWith(identifier,
"X_INTRODUCED");
1601 var =
model->AddVariable(identifier, domain, introduced);
1602 }
else if (assignment.
variable ==
nullptr) {
1605 identifier, Domain::IntegerValue(assignment.
value), introduced);
1608 var->Merge(identifier, domain, introduced);
1615 model->AddOutput(SolutionOutputSpecs::SingleVariable(
1620 #line 1752 "./ortools/flatzinc/parser.tab.cc" 1626 #line 279 "./ortools/flatzinc/parser.yy" 1631 CHECK_EQ((yyvsp[-10].integer_value), 1);
1632 const int64_t num_vars = (yyvsp[-8].integer_value);
1633 const Domain& domain = (yyvsp[-4].domain);
1634 const std::string& identifier = (yyvsp[-2].string_value);
1635 std::vector<Annotation>*
const annotations = (yyvsp[-1].annotations);
1636 std::vector<VarRefOrValue>*
const assignments =
1637 (yyvsp[0].var_or_value_array);
1638 CHECK(assignments ==
nullptr || assignments->size() == num_vars);
1639 const bool introduced =
ContainsId(annotations,
"var_is_introduced") ||
1640 absl::StartsWith(identifier,
"X_INTRODUCED");
1642 std::vector<Variable*> vars(num_vars,
nullptr);
1644 for (
int i = 0; i < num_vars; ++i) {
1645 const std::string var_name =
1646 absl::StrFormat(
"%s[%d]", identifier, i + 1);
1647 if (assignments ==
nullptr) {
1648 vars[i] =
model->AddVariable(var_name, domain, introduced);
1649 }
else if ((*assignments)[i].variable ==
nullptr) {
1650 if ((*assignments)[i].is_float) {
1652 const double value = (*assignments)[i].float_value;
1654 vars[i] =
model->AddVariable(var_name, Domain::FloatValue(
value),
1658 const int64_t
value = (*assignments)[i].value;
1660 vars[i] =
model->AddVariable(var_name, Domain::IntegerValue(
value),
1667 vars[i]->Merge(var_name, domain, introduced);
1673 context->variable_array_map[identifier] = vars;
1678 if (annotations !=
nullptr) {
1679 for (
int i = 0; i < annotations->size(); ++i) {
1687 std::vector<SolutionOutputSpecs::Bounds>
bounds;
1688 for (
int a = 0;
a < list.annotations.size(); ++
a) {
1691 bounds.emplace_back(SolutionOutputSpecs::Bounds(
1695 model->AddOutput(SolutionOutputSpecs::MultiDimensionalArray(
1702 #line 1831 "./ortools/flatzinc/parser.tab.cc" 1706 #line 355 "./ortools/flatzinc/parser.yy" 1708 (yyval.var_or_value) = (yyvsp[0].var_or_value);
1710 #line 1837 "./ortools/flatzinc/parser.tab.cc" 1714 #line 356 "./ortools/flatzinc/parser.yy" 1716 (yyval.var_or_value) = VarRefOrValue::Undefined();
1718 #line 1843 "./ortools/flatzinc/parser.tab.cc" 1722 #line 359 "./ortools/flatzinc/parser.yy" 1724 (yyval.var_or_value_array) = (yyvsp[-1].var_or_value_array);
1726 #line 1849 "./ortools/flatzinc/parser.tab.cc" 1730 #line 360 "./ortools/flatzinc/parser.yy" 1732 (yyval.var_or_value_array) =
nullptr;
1734 #line 1855 "./ortools/flatzinc/parser.tab.cc" 1738 #line 361 "./ortools/flatzinc/parser.yy" 1740 (yyval.var_or_value_array) =
nullptr;
1742 #line 1861 "./ortools/flatzinc/parser.tab.cc" 1746 #line 364 "./ortools/flatzinc/parser.yy" 1748 (yyval.var_or_value_array) = (yyvsp[-2].var_or_value_array);
1749 (yyval.var_or_value_array)->push_back((yyvsp[0].var_or_value));
1751 #line 1870 "./ortools/flatzinc/parser.tab.cc" 1755 #line 368 "./ortools/flatzinc/parser.yy" 1757 (yyval.var_or_value_array) =
new std::vector<VarRefOrValue>();
1758 (yyval.var_or_value_array)->push_back((yyvsp[0].var_or_value));
1760 #line 1879 "./ortools/flatzinc/parser.tab.cc" 1764 #line 374 "./ortools/flatzinc/parser.yy" 1768 #line 1885 "./ortools/flatzinc/parser.tab.cc" 1772 #line 375 "./ortools/flatzinc/parser.yy" 1774 (yyval.var_or_value) = VarRefOrValue::FloatValue((yyvsp[0].double_value));
1776 #line 1891 "./ortools/flatzinc/parser.tab.cc" 1780 #line 376 "./ortools/flatzinc/parser.yy" 1783 const std::string&
id = (yyvsp[0].string_value);
1785 (yyval.var_or_value) =
1788 (yyval.var_or_value) =
1791 (yyval.var_or_value) =
1794 LOG(
ERROR) <<
"Unknown symbol " << id;
1795 (yyval.var_or_value) = VarRefOrValue::Undefined();
1799 #line 1911 "./ortools/flatzinc/parser.tab.cc" 1803 #line 391 "./ortools/flatzinc/parser.yy" 1806 const std::string&
id = (yyvsp[-3].string_value);
1807 const int64_t
value = (yyvsp[-1].integer_value);
1812 (yyval.var_or_value) = VarRefOrValue::FloatValue(
1815 (yyval.var_or_value) = VarRefOrValue::VarRef(
1818 LOG(
ERROR) <<
"Unknown symbol " << id;
1819 (yyval.var_or_value) = VarRefOrValue::Undefined();
1823 #line 1935 "./ortools/flatzinc/parser.tab.cc" 1827 #line 412 "./ortools/flatzinc/parser.yy" 1829 (yyval.domain) = Domain::Boolean();
1831 #line 1941 "./ortools/flatzinc/parser.tab.cc" 1835 #line 413 "./ortools/flatzinc/parser.yy" 1837 (yyval.domain) = Domain::AllInt64();
1839 #line 1947 "./ortools/flatzinc/parser.tab.cc" 1843 #line 414 "./ortools/flatzinc/parser.yy" 1846 Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value));
1848 #line 1953 "./ortools/flatzinc/parser.tab.cc" 1852 #line 415 "./ortools/flatzinc/parser.yy" 1854 CHECK((yyvsp[-1].integers) !=
nullptr);
1855 (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers)));
1856 delete (yyvsp[-1].integers);
1858 #line 1963 "./ortools/flatzinc/parser.tab.cc" 1862 #line 422 "./ortools/flatzinc/parser.yy" 1864 (yyval.domain) = Domain::SetOfBoolean();
1866 #line 1969 "./ortools/flatzinc/parser.tab.cc" 1870 #line 423 "./ortools/flatzinc/parser.yy" 1872 (yyval.domain) = Domain::SetOfAllInt64();
1874 #line 1975 "./ortools/flatzinc/parser.tab.cc" 1878 #line 424 "./ortools/flatzinc/parser.yy" 1880 (yyval.domain) = Domain::SetOfInterval((yyvsp[-2].integer_value),
1881 (yyvsp[0].integer_value));
1883 #line 1981 "./ortools/flatzinc/parser.tab.cc" 1887 #line 425 "./ortools/flatzinc/parser.yy" 1889 CHECK((yyvsp[-1].integers) !=
nullptr);
1891 Domain::SetOfIntegerList(std::move(*(yyvsp[-1].integers)));
1892 delete (yyvsp[-1].integers);
1894 #line 1991 "./ortools/flatzinc/parser.tab.cc" 1898 #line 432 "./ortools/flatzinc/parser.yy" 1900 (yyval.domain) = Domain::AllFloats();
1902 #line 1997 "./ortools/flatzinc/parser.tab.cc" 1906 #line 433 "./ortools/flatzinc/parser.yy" 1908 (yyval.domain) = Domain::FloatInterval((yyvsp[-2].double_value),
1909 (yyvsp[0].double_value));
1911 #line 2005 "./ortools/flatzinc/parser.tab.cc" 1915 #line 438 "./ortools/flatzinc/parser.yy" 1917 (yyval.domain) = (yyvsp[0].domain);
1919 #line 2011 "./ortools/flatzinc/parser.tab.cc" 1923 #line 439 "./ortools/flatzinc/parser.yy" 1925 (yyval.domain) = (yyvsp[0].domain);
1927 #line 2017 "./ortools/flatzinc/parser.tab.cc" 1931 #line 440 "./ortools/flatzinc/parser.yy" 1933 (yyval.domain) = (yyvsp[0].domain);
1935 #line 2023 "./ortools/flatzinc/parser.tab.cc" 1939 #line 443 "./ortools/flatzinc/parser.yy" 1941 (yyval.integers) = (yyvsp[-2].integers);
1942 (yyval.integers)->emplace_back((yyvsp[0].integer_value));
1944 #line 2029 "./ortools/flatzinc/parser.tab.cc" 1948 #line 444 "./ortools/flatzinc/parser.yy" 1950 (yyval.integers) =
new std::vector<int64_t>();
1951 (yyval.integers)->emplace_back((yyvsp[0].integer_value));
1953 #line 2035 "./ortools/flatzinc/parser.tab.cc" 1957 #line 447 "./ortools/flatzinc/parser.yy" 1959 (yyval.integer_value) = (yyvsp[0].integer_value);
1961 #line 2041 "./ortools/flatzinc/parser.tab.cc" 1965 #line 448 "./ortools/flatzinc/parser.yy" 1967 (yyval.integer_value) =
1970 #line 2047 "./ortools/flatzinc/parser.tab.cc" 1974 #line 449 "./ortools/flatzinc/parser.yy" 1976 (yyval.integer_value) =
Lookup(
1978 (yyvsp[-1].integer_value));
1980 #line 2055 "./ortools/flatzinc/parser.tab.cc" 1984 #line 454 "./ortools/flatzinc/parser.yy" 1986 (yyval.doubles) = (yyvsp[-2].doubles);
1987 (yyval.doubles)->emplace_back((yyvsp[0].double_value));
1989 #line 2061 "./ortools/flatzinc/parser.tab.cc" 1993 #line 455 "./ortools/flatzinc/parser.yy" 1995 (yyval.doubles) =
new std::vector<double>();
1996 (yyval.doubles)->emplace_back((yyvsp[0].double_value));
1998 #line 2067 "./ortools/flatzinc/parser.tab.cc" 2002 #line 458 "./ortools/flatzinc/parser.yy" 2004 (yyval.double_value) = (yyvsp[0].double_value);
2006 #line 2073 "./ortools/flatzinc/parser.tab.cc" 2010 #line 459 "./ortools/flatzinc/parser.yy" 2012 (yyval.double_value) =
2015 #line 2079 "./ortools/flatzinc/parser.tab.cc" 2019 #line 460 "./ortools/flatzinc/parser.yy" 2021 (yyval.double_value) =
Lookup(
2023 (yyvsp[-1].integer_value));
2025 #line 2087 "./ortools/flatzinc/parser.tab.cc" 2029 #line 465 "./ortools/flatzinc/parser.yy" 2031 (yyval.domain) = Domain::IntegerValue((yyvsp[0].integer_value));
2033 #line 2093 "./ortools/flatzinc/parser.tab.cc" 2037 #line 466 "./ortools/flatzinc/parser.yy" 2040 Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value));
2042 #line 2099 "./ortools/flatzinc/parser.tab.cc" 2046 #line 467 "./ortools/flatzinc/parser.yy" 2048 CHECK((yyvsp[-1].integers) !=
nullptr);
2049 (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers)));
2050 delete (yyvsp[-1].integers);
2052 #line 2109 "./ortools/flatzinc/parser.tab.cc" 2056 #line 472 "./ortools/flatzinc/parser.yy" 2058 (yyval.domain) = Domain::EmptyDomain();
2060 #line 2115 "./ortools/flatzinc/parser.tab.cc" 2064 #line 473 "./ortools/flatzinc/parser.yy" 2066 (yyval.domain) = Domain::FloatValue((yyvsp[0].double_value));
2068 #line 2123 "./ortools/flatzinc/parser.tab.cc" 2072 #line 476 "./ortools/flatzinc/parser.yy" 2074 (yyval.domain) = Domain::IntegerValue(
2077 #line 2129 "./ortools/flatzinc/parser.tab.cc" 2081 #line 477 "./ortools/flatzinc/parser.yy" 2083 (yyval.domain) = Domain::IntegerValue(
Lookup(
2085 (yyvsp[-1].integer_value)));
2087 #line 2138 "./ortools/flatzinc/parser.tab.cc" 2091 #line 483 "./ortools/flatzinc/parser.yy" 2093 (yyval.domains) = (yyvsp[-2].domains);
2094 (yyval.domains)->emplace_back((yyvsp[0].domain));
2096 #line 2147 "./ortools/flatzinc/parser.tab.cc" 2100 #line 487 "./ortools/flatzinc/parser.yy" 2102 (yyval.domains) =
new std::vector<Domain>();
2103 (yyval.domains)->emplace_back((yyvsp[0].domain));
2105 #line 2153 "./ortools/flatzinc/parser.tab.cc" 2110 #line 497 "./ortools/flatzinc/parser.yy" 2112 const std::string& identifier = (yyvsp[-4].string_value);
2113 CHECK((yyvsp[-2].args) !=
nullptr) <<
"Missing argument in constraint";
2114 const std::vector<Argument>& arguments = *(yyvsp[-2].args);
2115 std::vector<Annotation>*
const annotations = (yyvsp[0].annotations);
2117 model->AddConstraint(identifier, arguments,
2120 delete (yyvsp[-2].args);
2122 #line 2168 "./ortools/flatzinc/parser.tab.cc" 2126 #line 509 "./ortools/flatzinc/parser.yy" 2128 (yyval.args) = (yyvsp[-2].args);
2129 (yyval.args)->emplace_back((yyvsp[0].arg));
2131 #line 2174 "./ortools/flatzinc/parser.tab.cc" 2135 #line 510 "./ortools/flatzinc/parser.yy" 2137 (yyval.args) =
new std::vector<Argument>();
2138 (yyval.args)->emplace_back((yyvsp[0].arg));
2140 #line 2180 "./ortools/flatzinc/parser.tab.cc" 2144 #line 513 "./ortools/flatzinc/parser.yy" 2146 (yyval.arg) = Argument::IntegerValue((yyvsp[0].integer_value));
2148 #line 2186 "./ortools/flatzinc/parser.tab.cc" 2152 #line 514 "./ortools/flatzinc/parser.yy" 2154 (yyval.arg) = Argument::FloatValue((yyvsp[0].double_value));
2156 #line 2192 "./ortools/flatzinc/parser.tab.cc" 2160 #line 515 "./ortools/flatzinc/parser.yy" 2162 (yyval.arg) = Argument::VoidArgument();
2164 #line 2198 "./ortools/flatzinc/parser.tab.cc" 2168 #line 516 "./ortools/flatzinc/parser.yy" 2170 (yyval.arg) = Argument::Interval((yyvsp[-2].integer_value),
2171 (yyvsp[0].integer_value));
2173 #line 2204 "./ortools/flatzinc/parser.tab.cc" 2177 #line 517 "./ortools/flatzinc/parser.yy" 2179 CHECK((yyvsp[-1].integers) !=
nullptr);
2180 (yyval.arg) = Argument::IntegerList(std::move(*(yyvsp[-1].integers)));
2181 delete (yyvsp[-1].integers);
2183 #line 2214 "./ortools/flatzinc/parser.tab.cc" 2187 #line 522 "./ortools/flatzinc/parser.yy" 2189 const std::string&
id = (yyvsp[0].string_value);
2194 (yyval.arg) = Argument::IntegerList(
2198 (yyval.arg) = Argument::FloatValue(d);
2200 const auto& double_values =
2202 (yyval.arg) = Argument::FloatList(std::move(double_values));
2207 (yyval.arg) = Argument::VarRefArray(
2211 (yyval.arg) = Argument::FromDomain(d);
2214 <<
"Unknown identifier: " << id;
2215 const std::vector<Domain>& d =
2217 (yyval.arg) = Argument::DomainList(d);
2220 #line 2245 "./ortools/flatzinc/parser.tab.cc" 2224 #line 548 "./ortools/flatzinc/parser.yy" 2226 const std::string&
id = (yyvsp[-3].string_value);
2227 const int64_t
index = (yyvsp[-1].integer_value);
2229 (yyval.arg) = Argument::IntegerValue(
2232 (yyval.arg) = Argument::VarRef(
2236 <<
"Unknown identifier: " << id;
2239 (yyval.arg) = Argument::FromDomain(d);
2242 #line 2267 "./ortools/flatzinc/parser.tab.cc" 2246 #line 565 "./ortools/flatzinc/parser.yy" 2248 std::vector<VarRefOrValue>*
const arguments =
2249 (yyvsp[-1].var_or_value_array);
2250 CHECK(arguments !=
nullptr);
2251 bool has_variables =
false;
2252 bool has_floats =
false;
2253 for (
int i = 0; i < arguments->size(); ++i) {
2254 if ((*arguments)[i].variable !=
nullptr) {
2255 has_variables =
true;
2257 if ((*arguments)[i].is_float) {
2261 if (has_variables) {
2262 std::vector<Variable*> vars;
2263 vars.reserve(arguments->size());
2264 for (
int i = 0; i < arguments->size(); ++i) {
2269 vars.push_back(
model->AddConstant(data.
value));
2274 (yyval.arg) = Argument::VarRefArray(std::move(vars));
2275 }
else if (has_floats) {
2276 std::vector<double> values;
2277 values.reserve(arguments->size());
2279 if (data.is_float) {
2280 values.push_back(data.float_value);
2282 values.push_back(data.value);
2285 (yyval.arg) = Argument::FloatList(std::move(values));
2287 std::vector<int64_t> values;
2288 values.reserve(arguments->size());
2290 values.push_back(data.value);
2292 (yyval.arg) = Argument::IntegerList(std::move(values));
2296 #line 2320 "./ortools/flatzinc/parser.tab.cc" 2300 #line 613 "./ortools/flatzinc/parser.yy" 2302 (yyval.arg) = Argument::VoidArgument();
2304 #line 2328 "./ortools/flatzinc/parser.tab.cc" 2308 #line 622 "./ortools/flatzinc/parser.yy" 2310 (yyval.annotations) = (yyvsp[-2].annotations) !=
nullptr 2311 ? (yyvsp[-2].annotations)
2312 :
new std::vector<Annotation>();
2313 (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2315 #line 2337 "./ortools/flatzinc/parser.tab.cc" 2319 #line 626 "./ortools/flatzinc/parser.yy" 2321 (yyval.annotations) =
nullptr;
2323 #line 2343 "./ortools/flatzinc/parser.tab.cc" 2327 #line 629 "./ortools/flatzinc/parser.yy" 2329 (yyval.annotations) = (yyvsp[-2].annotations);
2330 (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2332 #line 2349 "./ortools/flatzinc/parser.tab.cc" 2336 #line 630 "./ortools/flatzinc/parser.yy" 2338 (yyval.annotations) =
new std::vector<Annotation>();
2339 (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2341 #line 2355 "./ortools/flatzinc/parser.tab.cc" 2345 #line 633 "./ortools/flatzinc/parser.yy" 2347 (yyval.annotation) = Annotation::Interval((yyvsp[-2].integer_value),
2348 (yyvsp[0].integer_value));
2350 #line 2361 "./ortools/flatzinc/parser.tab.cc" 2354 #line 634 "./ortools/flatzinc/parser.yy" 2356 (yyval.annotation) = Annotation::IntegerValue((yyvsp[0].integer_value));
2358 #line 2367 "./ortools/flatzinc/parser.tab.cc" 2362 #line 635 "./ortools/flatzinc/parser.yy" 2364 (yyval.annotation) = Annotation::String((yyvsp[0].string_value));
2366 #line 2373 "./ortools/flatzinc/parser.tab.cc" 2370 #line 636 "./ortools/flatzinc/parser.yy" 2372 const std::string&
id = (yyvsp[0].string_value);
2374 (yyval.annotation) =
2377 (yyval.annotation) = Annotation::VarRefArray(
2380 (yyval.annotation) = Annotation::Identifier(
id);
2383 #line 2388 "./ortools/flatzinc/parser.tab.cc" 2387 #line 646 "./ortools/flatzinc/parser.yy" 2389 std::vector<Annotation>*
const annotations = (yyvsp[-1].annotations);
2390 if (annotations !=
nullptr) {
2391 (yyval.annotation) = Annotation::FunctionCallWithArguments(
2392 (yyvsp[-3].string_value), std::move(*annotations));
2395 (yyval.annotation) = Annotation::FunctionCall((yyvsp[-3].string_value));
2398 #line 2402 "./ortools/flatzinc/parser.tab.cc" 2402 #line 655 "./ortools/flatzinc/parser.yy" 2405 (yyvsp[-3].string_value)))
2406 <<
"Unknown identifier: " << (yyvsp[-3].string_value);
2407 (yyval.annotation) = Annotation::VarRef(
Lookup(
2409 (yyvsp[-1].integer_value)));
2411 #line 2413 "./ortools/flatzinc/parser.tab.cc" 2415 #line 661 "./ortools/flatzinc/parser.yy" 2417 std::vector<Annotation>*
const annotations = (yyvsp[-1].annotations);
2418 if (annotations !=
nullptr) {
2419 (yyval.annotation) =
2420 Annotation::AnnotationList(std::move(*annotations));
2423 (yyval.annotation) = Annotation::Empty();
2426 #line 2427 "./ortools/flatzinc/parser.tab.cc" 2430 #line 676 "./ortools/flatzinc/parser.yy" 2432 if ((yyvsp[-1].annotations) !=
nullptr) {
2433 model->Satisfy(std::move(*(yyvsp[-1].annotations)));
2434 delete (yyvsp[-1].annotations);
2436 model->Satisfy(std::vector<Annotation>());
2439 #line 2440 "./ortools/flatzinc/parser.tab.cc" 2443 #line 684 "./ortools/flatzinc/parser.yy" 2445 Variable* obj_var = (yyvsp[0].arg).type == Argument::VAR_REF
2446 ? (yyvsp[0].arg).Var()
2447 :
model->AddConstant((yyvsp[0].arg).
Value());
2448 if ((yyvsp[-2].annotations) !=
nullptr) {
2449 model->Minimize(obj_var, std::move(*(yyvsp[-2].annotations)));
2450 delete (yyvsp[-2].annotations);
2452 model->Minimize(obj_var, std::vector<Annotation>());
2455 #line 2456 "./ortools/flatzinc/parser.tab.cc" 2459 #line 695 "./ortools/flatzinc/parser.yy" 2461 Variable* obj_var = (yyvsp[0].arg).type == Argument::VAR_REF
2462 ? (yyvsp[0].arg).Var()
2463 :
model->AddConstant((yyvsp[0].arg).
Value());
2464 if ((yyvsp[-2].annotations) !=
nullptr) {
2465 model->Maximize(obj_var, std::move(*(yyvsp[-2].annotations)));
2466 delete (yyvsp[-2].annotations);
2468 model->Maximize(obj_var, std::vector<Annotation>());
2471 #line 2472 "./ortools/flatzinc/parser.tab.cc" 2474 #line 2476 "./ortools/flatzinc/parser.tab.cc" 2503 const int yyi =
yypgoto[yylhs] + *yyssp;
2504 yystate = (0 <= yyi && yyi <=
YYLAST &&
yycheck[yyi] == *yyssp
2523 char const* yymsgp =
YY_(
"syntax error");
2524 int yysyntax_error_status;
2525 yysyntax_error_status =
yysyntax_error(&yymsg_alloc, &yymsg, &yyctx);
2526 if (yysyntax_error_status == 0)
2528 else if (yysyntax_error_status == -1) {
2532 yysyntax_error_status =
yysyntax_error(&yymsg_alloc, &yymsg, &yyctx);
2536 yymsg_alloc =
sizeof yymsgbuf;
2541 if (yysyntax_error_status ==
YYENOMEM)
goto yyexhaustedlab;
2545 if (yyerrstatus == 3) {
2549 if (yychar <= ORFZ_EOF) {
2551 if (yychar == ORFZ_EOF)
YYABORT;
2555 yychar = ORFZ_EMPTY;
2600 model, ok, scanner);
2644 if (yychar != ORFZ_EMPTY) {
2649 model, ok, scanner);
2655 while (yyssp != yyss) {
2657 model, ok, scanner);
2667 #line 707 "./ortools/flatzinc/parser.yy"
unsigned short yytype_uint16
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
static char * yystpcpy(char *yydest, const char *yysrc)
unsigned char yytype_uint8
#define YY_IGNORE_USELESS_CAST_BEGIN
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
static const yytype_int16 yypact[]
bool AllDomainsHaveOneValue(const std::vector< Domain > &domains)
static const yytype_int8 yystos[]
#define yytable_value_is_error(Yyn)
static int yysyntax_error(YYPTRDIFF_T *yymsg_alloc, char **yymsg, const yypcontext_t *yyctx)
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 int yypcontext_expected_tokens(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn)
bool Contains(int64_t value) const
const T & Lookup(const std::vector< T > &v, int index)
static const yytype_int16 yycheck[]
bool ContainsId(std::vector< Annotation > *annotations, const std::string &id)
#define YY_ATTRIBUTE_UNUSED
std::function< int64_t(const Model &)> Value(IntegerVariable v)
static const yytype_int8 yytranslate[]
int64_t ConvertAsIntegerOrDie(double d)
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 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 yydefact[]
bool IsFunctionCallWithIdentifier(const std::string &identifier) const
static const yytype_int16 yytable[]
static const yytype_int8 yyr2[]
static YYPTRDIFF_T yytnamerr(char *yyres, const char *yystr)
#define YY_CAST(Type, Val)
bool ContainsKey(const Collection &collection, const Key &key)
const Collection::value_type::second_type & FindOrDie(const Collection &collection, const typename Collection::value_type::first_type &key)
#define YY_ACCESSING_SYMBOL(State)
Accessing symbol of state STATE.
#define CHECK_EQ(val1, val2)
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)
static const yytype_int8 yyr1[]
std::vector< int64_t > values
#define YYSTACK_ALLOC_MAXIMUM
#define YY_STACK_PRINT(Bottom, Top)
#define YY_INITIAL_VALUE(Value)
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
static void yy_stack_print(yy_state_t *yybottom, yy_state_t *yytop)
#define YY_IGNORE_USELESS_CAST_END
static const yytype_int16 yypgoto[]
SharedBoundsManager * bounds
std::vector< Annotation > annotations
#define YY_REDUCE_PRINT(Rule)
static const char *const yytname[]
static YYPTRDIFF_T yystrlen(const char *yystr)
static int yy_syntax_error_arguments(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn)
static const yytype_int16 yyrline[]
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
GurobiMPCallbackContext * context
static const char * yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED
#define yypact_value_is_default(Yyn)