From 8b6e23f2773cf1168d7c1ca9461d0dbc1d31fb36 Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Mon, 2 Oct 2017 15:27:31 +0200 Subject: [PATCH] bump flatzinc parser --- ortools/flatzinc/parser.tab.cc | 816 ++++++++++++++++++--------------- 1 file changed, 458 insertions(+), 358 deletions(-) diff --git a/ortools/flatzinc/parser.tab.cc b/ortools/flatzinc/parser.tab.cc index b13e36d6295..4e9876679e3 100644 --- a/ortools/flatzinc/parser.tab.cc +++ b/ortools/flatzinc/parser.tab.cc @@ -163,6 +163,7 @@ int orfz_parse (operations_research::fz::ParserContext* context, operations_rese using operations_research::fz::Annotation; using operations_research::fz::Argument; using operations_research::fz::Constraint; +using operations_research::fz::ConvertAsIntegerOrDie; using operations_research::fz::Domain; using operations_research::fz::IntegerVariable; using operations_research::fz::Lookup; @@ -172,7 +173,7 @@ using operations_research::fz::ParserContext; using operations_research::fz::VariableRefOrValue; using operations_research::fz::VariableRefOrValueArray; -#line 176 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:359 */ +#line 177 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:359 */ #ifdef short # undef short @@ -414,16 +415,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 255 +#define YYLAST 271 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 32 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 30 +#define YYNNTS 32 /* YYNRULES -- Number of rules. */ -#define YYNRULES 89 +#define YYNRULES 96 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 206 +#define YYNSTATES 223 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ @@ -471,15 +472,16 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 100, 100, 107, 111, 112, 117, 120, 121, 124, - 125, 126, 127, 130, 131, 134, 135, 142, 143, 146, - 165, 180, 190, 216, 249, 319, 320, 323, 324, 325, - 328, 332, 338, 339, 352, 370, 371, 372, 373, 380, - 381, 382, 383, 390, 391, 395, 396, 397, 400, 401, - 404, 405, 406, 411, 412, 413, 418, 419, 420, 421, - 427, 431, 437, 438, 441, 468, 469, 472, 473, 474, - 475, 476, 481, 501, 518, 543, 552, 556, 559, 560, - 563, 564, 565, 566, 576, 585, 591, 606, 614, 623 + 0, 103, 103, 110, 114, 115, 120, 123, 124, 127, + 128, 129, 130, 133, 134, 137, 138, 145, 146, 149, + 168, 183, 194, 209, 220, 246, 279, 349, 350, 353, + 354, 355, 358, 362, 368, 369, 382, 400, 401, 402, + 403, 410, 411, 412, 413, 420, 421, 428, 429, 430, + 433, 434, 437, 438, 439, 444, 445, 448, 449, 450, + 455, 456, 457, 462, 463, 467, 468, 474, 478, 484, + 485, 488, 515, 516, 519, 520, 521, 522, 523, 528, + 559, 576, 601, 610, 614, 617, 618, 621, 622, 623, + 624, 634, 643, 649, 664, 672, 681 }; #endif @@ -498,8 +500,8 @@ static const char *const yytname[] = "variable_or_constant_declaration", "optional_var_or_value", "optional_var_or_value_array", "var_or_value_array", "var_or_value", "int_domain", "set_domain", "float_domain", "domain", "integers", - "integer", "const_literal", "const_literals", "constraints", - "constraint", "arguments", "argument", "annotations", + "integer", "floats", "float", "const_literal", "const_literals", + "constraints", "constraint", "arguments", "argument", "annotations", "annotation_arguments", "annotation", "solve", YY_NULLPTR }; #endif @@ -516,10 +518,10 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -108 +#define YYPACT_NINF -182 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-108))) + (!!((Yystate) == (-182))) #define YYTABLE_NINF -19 @@ -530,27 +532,29 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -108, 31, 7, -108, -15, 39, 27, 20, -108, 62, - -108, 66, -108, -108, -108, 99, 60, 101, 131, 114, - 140, -108, -108, -108, 138, 109, 40, 145, 12, 139, - 148, 146, -108, 141, 106, -108, -108, 149, 150, -108, - 151, 152, 144, 60, 153, 147, 154, 159, -108, -108, - 160, 114, 158, -108, -108, 161, 114, -108, -108, 162, - 107, -108, -108, 47, 155, -108, 40, 163, 164, 166, - 108, -108, 165, -108, 0, 77, 77, 77, -108, 102, - 167, 170, 168, -108, 169, -108, -108, 171, -108, -108, - 22, -108, 81, 172, -108, 173, -108, 64, 114, 134, - -108, -108, -108, 174, -108, 29, 102, -108, 180, 176, - 181, -108, 185, 137, -108, 182, 175, -108, 14, -108, - 179, 183, -108, 177, -108, 115, -108, 110, -108, 77, - 187, 102, 188, 120, -108, -108, -108, 56, 76, -108, - 189, 190, -108, 113, -108, 184, 191, 137, -108, -108, - 186, -108, -108, 136, 192, 102, -108, 60, 193, 60, - 195, 196, -108, 197, -108, -108, 198, -108, -108, -108, - -108, 201, 194, 202, 203, 204, -108, -108, 209, -108, - 210, -108, -108, -108, -108, 58, 59, 83, 205, 206, - 207, -108, 85, 81, 90, -108, 121, -108, 126, -108, - 128, -108, 81, -108, -108, -108 + -182, 49, 7, -182, -15, 67, 114, 20, -182, 95, + -182, 99, -182, -182, -182, 136, 76, 122, 141, 11, + 154, -182, -182, -182, 143, 130, 40, 157, 12, 151, + 160, 158, -182, 155, 118, -182, -182, 161, 163, -182, + 162, 164, 165, 76, 156, 166, 159, 171, -182, -182, + 172, 11, 169, -182, -182, 175, 11, -182, -182, 167, + 125, -182, -182, 27, 168, -182, 40, 176, 177, 179, + 120, -182, 170, -182, 22, 80, 80, 80, -182, 121, + 174, 184, 173, -182, 182, -182, -182, 178, -182, -182, + 59, -182, 75, 187, -182, 180, -182, 93, 11, 131, + -182, -182, -182, 188, -182, 96, 121, -182, 198, 190, + 199, -182, 200, 150, -182, 195, 185, -182, 34, -182, + 196, 197, -182, 186, -182, 31, -182, 128, -182, 80, + 201, 121, 202, 84, -182, -182, -182, 56, 60, -182, + 203, 204, -182, 129, -182, 189, 205, 150, -182, -182, + 207, -182, -182, 147, 206, 121, -182, 76, 192, 76, + 209, 210, 211, -182, 212, -182, -182, 213, -182, -182, + -182, -182, 216, 208, 217, 218, 219, 224, -182, -182, + 225, -182, 226, -182, -182, -182, -182, -182, 74, 85, + 87, 91, 220, 221, 222, 223, -182, 97, 75, 64, + 104, -182, 133, -182, 137, 227, -182, -182, 138, -182, + -182, 139, -182, 75, -182, 214, 153, -182, -182, -182, + 228, -182, -182 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -558,43 +562,47 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 5, 0, 0, 1, 0, 0, 0, 63, 4, 0, - 3, 0, 35, 43, 36, 0, 0, 0, 0, 0, - 0, 45, 46, 47, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 51, 0, 49, 17, 0, 0, 77, - 0, 0, 0, 0, 0, 8, 0, 0, 39, 40, - 0, 0, 0, 37, 44, 0, 0, 38, 77, 0, - 0, 62, 2, 0, 0, 6, 0, 0, 0, 0, - 0, 77, 0, 48, 0, 0, 0, 0, 87, 0, - 16, 0, 0, 13, 0, 7, 9, 0, 41, 42, - 26, 52, 0, 67, 69, 72, 68, 0, 0, 0, - 66, 89, 88, 81, 82, 83, 0, 76, 0, 0, - 0, 10, 0, 0, 23, 53, 58, 57, 0, 19, - 0, 0, 32, 33, 75, 0, 31, 0, 77, 0, - 0, 0, 0, 0, 79, 15, 14, 0, 0, 25, - 0, 0, 56, 0, 70, 0, 0, 0, 74, 71, - 64, 65, 80, 0, 0, 0, 86, 0, 0, 0, - 0, 0, 54, 0, 55, 73, 0, 30, 84, 85, - 78, 0, 0, 0, 0, 0, 59, 34, 0, 11, - 0, 77, 77, 12, 77, 0, 0, 29, 0, 0, - 0, 24, 0, 0, 0, 21, 0, 61, 0, 28, - 0, 20, 0, 22, 27, 60 + 5, 0, 0, 1, 0, 0, 0, 70, 4, 0, + 3, 0, 37, 45, 38, 0, 0, 0, 0, 0, + 0, 47, 48, 49, 0, 0, 0, 0, 0, 0, + 0, 0, 52, 53, 0, 51, 17, 0, 0, 84, + 0, 0, 0, 0, 0, 8, 0, 0, 41, 42, + 0, 0, 0, 39, 46, 0, 0, 40, 84, 0, + 0, 69, 2, 0, 0, 6, 0, 0, 0, 0, + 0, 84, 0, 50, 0, 0, 0, 0, 94, 0, + 16, 0, 0, 13, 0, 7, 9, 0, 43, 44, + 28, 54, 0, 74, 76, 79, 75, 0, 0, 0, + 73, 96, 95, 88, 89, 90, 0, 83, 0, 0, + 0, 10, 0, 0, 25, 60, 65, 64, 0, 19, + 0, 0, 34, 35, 82, 0, 33, 0, 84, 0, + 0, 0, 0, 0, 86, 15, 14, 0, 0, 27, + 0, 0, 63, 0, 77, 0, 0, 0, 81, 78, + 71, 72, 87, 0, 0, 0, 93, 0, 0, 0, + 0, 0, 0, 61, 0, 62, 80, 0, 32, 91, + 92, 85, 0, 0, 0, 0, 0, 0, 66, 36, + 0, 11, 0, 84, 84, 84, 12, 84, 0, 0, + 0, 31, 0, 0, 0, 0, 26, 0, 0, 0, + 0, 21, 0, 68, 0, 58, 57, 23, 0, 56, + 30, 0, 20, 0, 24, 0, 0, 22, 29, 67, + 0, 55, 59 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -108, -108, -108, -108, 178, -108, -108, 103, -108, -108, - -108, -108, 16, -107, 75, 78, -108, -7, -50, 199, - -66, -108, -108, -108, -108, -72, -56, 84, -76, -108 + -182, -182, -182, -182, 191, -182, -182, 108, -182, -182, + -182, -182, 25, -107, 88, 89, 92, -7, -50, 215, + -182, 13, -181, -182, -182, -182, -182, -72, -56, 100, + -76, -182 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 1, 2, 6, 44, 45, 82, 83, 7, 20, - 114, 191, 125, 126, 21, 22, 23, 46, 34, 35, - 119, 198, 25, 40, 99, 100, 60, 133, 134, 41 + 114, 196, 125, 126, 21, 22, 23, 46, 34, 35, + 208, 209, 119, 204, 25, 40, 99, 100, 60, 133, + 134, 41 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -603,61 +611,65 @@ static const yytype_int16 yydefgoto[] = static const yytype_int16 yytable[] = { 24, 70, 74, 107, 101, 102, 139, 8, 4, 29, - -18, -18, -18, -18, -18, 90, 48, 79, 5, 49, - -18, -18, -18, 11, 12, -18, 13, 14, -18, 92, - 50, 3, 32, 15, 33, 16, 64, -18, 17, 79, - 167, 18, 51, 42, 12, 142, 13, 14, 127, 10, - 19, 113, 131, 15, 80, 43, 132, 151, 17, 9, - 12, 18, 13, 14, 12, 81, 13, 14, 143, 15, - 19, 157, 150, 15, 17, 79, 79, 18, 17, 170, - 12, 18, 122, 14, 123, 26, 19, 188, 189, 15, - 19, 159, 124, 27, 17, 93, 94, 95, 96, 115, - 79, 116, 117, 32, 97, 33, 19, 98, 122, 28, - 123, 118, 190, 195, 38, 76, 77, 30, 199, 78, - 103, 104, 105, 39, 79, 185, 186, 197, 187, 106, - 158, 56, 32, 56, 33, 56, 205, 57, 56, 89, - 147, 149, 196, 148, 164, 155, 56, 31, 156, 201, - 171, 202, 173, 147, 203, 122, 204, 123, 128, 129, - 168, 155, 36, 47, 37, 52, 53, 54, 55, 58, - 59, 63, 66, 61, 62, 68, 69, 65, 71, 72, - 67, 84, 87, 86, 88, 75, 109, 80, 120, 111, - 130, 137, 108, 91, 136, 138, 110, 144, 140, 112, - 121, 145, 141, 79, 146, 152, 154, 162, 163, 166, - 200, 135, 165, 160, 179, 153, 161, 0, 0, 172, - 169, 174, 175, 181, 182, 176, 177, 178, 180, 183, - 184, 0, 192, 193, 194, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 85, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 73 + -18, -18, -18, -18, -18, 90, 48, 203, 5, 49, + -18, -18, -18, 11, 12, -18, 13, 14, -18, 32, + 50, 33, 219, 15, 80, 16, 64, -18, 17, 79, + 168, 18, 51, 42, 12, 81, 13, 14, 127, 3, + 19, 92, 32, 15, 33, 43, 147, 151, 17, 148, + 12, 18, 13, 14, 12, 142, 13, 14, 143, 15, + 19, 157, 150, 15, 17, 159, 79, 18, 17, 171, + 12, 18, 13, 14, 205, 206, 19, 9, 113, 15, + 19, 79, 207, 115, 17, 116, 117, 18, 93, 94, + 95, 96, 79, 192, 79, 118, 19, 97, 79, 155, + 98, 122, 156, 123, 193, 32, 194, 33, 26, 131, + 195, 124, 122, 132, 123, 201, 27, 188, 189, 190, + 158, 191, 210, 76, 77, 38, 10, 78, 30, 103, + 104, 105, 79, 56, 39, 56, 28, 202, 106, 57, + 172, 89, 174, 56, 56, 128, 129, 31, 56, 149, + 165, 212, 213, 216, 147, 214, 217, 218, 122, 37, + 123, 169, 155, 205, 206, 47, 36, 52, 53, 54, + 65, 58, 55, 59, 61, 67, 62, 68, 69, 71, + 75, 66, 63, 72, 84, 87, 86, 88, 91, 108, + 109, 110, 111, 120, 130, 80, 112, 121, 136, 137, + 138, 140, 141, 146, 144, 145, 135, 166, 173, 152, + 154, 163, 164, 167, 79, 211, 160, 161, 181, 221, + 162, 153, 220, 0, 170, 175, 176, 177, 183, 184, + 178, 179, 180, 182, 185, 186, 187, 197, 198, 199, + 200, 0, 0, 0, 215, 0, 222, 85, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 73 }; static const yytype_int16 yycheck[] = { 7, 51, 58, 79, 76, 77, 113, 22, 1, 16, - 3, 4, 5, 6, 7, 71, 4, 17, 11, 7, - 13, 14, 15, 3, 4, 18, 6, 7, 21, 29, - 18, 0, 18, 13, 20, 15, 43, 30, 18, 17, - 147, 21, 30, 3, 4, 31, 6, 7, 98, 22, - 30, 29, 23, 13, 7, 15, 27, 129, 18, 20, - 4, 21, 6, 7, 4, 18, 6, 7, 118, 13, - 30, 15, 128, 13, 18, 17, 17, 21, 18, 155, - 4, 21, 18, 7, 20, 23, 30, 29, 29, 13, - 30, 15, 28, 27, 18, 18, 19, 20, 21, 18, - 17, 20, 21, 18, 27, 20, 30, 30, 18, 10, - 20, 30, 29, 28, 5, 8, 9, 16, 28, 12, - 18, 19, 20, 14, 17, 181, 182, 193, 184, 27, - 137, 25, 18, 25, 20, 25, 202, 31, 25, 31, - 25, 31, 192, 28, 31, 25, 25, 16, 28, 28, - 157, 25, 159, 25, 28, 18, 28, 20, 24, 25, - 24, 25, 22, 18, 26, 26, 18, 21, 27, 20, - 20, 27, 25, 22, 22, 16, 16, 24, 20, 18, - 26, 26, 18, 20, 18, 23, 16, 7, 16, 20, - 16, 10, 25, 28, 18, 10, 28, 18, 16, 28, - 27, 18, 27, 17, 27, 18, 18, 18, 18, 18, - 194, 108, 28, 138, 20, 131, 138, -1, -1, 26, - 28, 26, 26, 20, 20, 28, 28, 26, 26, 20, - 20, -1, 27, 27, 27, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 56 + 3, 4, 5, 6, 7, 71, 4, 198, 11, 7, + 13, 14, 15, 3, 4, 18, 6, 7, 21, 18, + 18, 20, 213, 13, 7, 15, 43, 30, 18, 17, + 147, 21, 30, 3, 4, 18, 6, 7, 98, 0, + 30, 29, 18, 13, 20, 15, 25, 129, 18, 28, + 4, 21, 6, 7, 4, 31, 6, 7, 118, 13, + 30, 15, 128, 13, 18, 15, 17, 21, 18, 155, + 4, 21, 6, 7, 20, 21, 30, 20, 29, 13, + 30, 17, 28, 18, 18, 20, 21, 21, 18, 19, + 20, 21, 17, 29, 17, 30, 30, 27, 17, 25, + 30, 18, 28, 20, 29, 18, 29, 20, 23, 23, + 29, 28, 18, 27, 20, 28, 27, 183, 184, 185, + 137, 187, 28, 8, 9, 5, 22, 12, 16, 18, + 19, 20, 17, 25, 14, 25, 10, 197, 27, 31, + 157, 31, 159, 25, 25, 24, 25, 16, 25, 31, + 31, 28, 25, 25, 25, 28, 28, 28, 18, 26, + 20, 24, 25, 20, 21, 18, 22, 26, 18, 21, + 24, 20, 27, 20, 22, 26, 22, 16, 16, 20, + 23, 25, 27, 18, 26, 18, 20, 18, 28, 25, + 16, 28, 20, 16, 16, 7, 28, 27, 18, 10, + 10, 16, 27, 27, 18, 18, 108, 28, 26, 18, + 18, 18, 18, 18, 17, 200, 138, 138, 20, 216, + 138, 131, 18, -1, 28, 26, 26, 26, 20, 20, + 28, 28, 26, 26, 20, 20, 20, 27, 27, 27, + 27, -1, -1, -1, 27, -1, 28, 66, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 56 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -666,25 +678,27 @@ static const yytype_uint8 yystos[] = { 0, 33, 34, 0, 1, 11, 35, 40, 22, 20, 22, 3, 4, 6, 7, 13, 15, 18, 21, 30, - 41, 46, 47, 48, 49, 54, 23, 27, 10, 49, + 41, 46, 47, 48, 49, 56, 23, 27, 10, 49, 16, 16, 18, 20, 50, 51, 22, 26, 5, 14, - 55, 61, 3, 15, 36, 37, 49, 18, 4, 7, + 57, 63, 3, 15, 36, 37, 49, 18, 4, 7, 18, 30, 26, 18, 21, 27, 25, 31, 20, 20, - 58, 22, 22, 27, 49, 24, 25, 26, 16, 16, - 50, 20, 18, 51, 58, 23, 8, 9, 12, 17, + 60, 22, 22, 27, 49, 24, 25, 26, 16, 16, + 50, 20, 18, 51, 60, 23, 8, 9, 12, 17, 7, 18, 38, 39, 26, 36, 20, 18, 18, 31, - 58, 28, 29, 18, 19, 20, 21, 27, 30, 56, - 57, 57, 57, 18, 19, 20, 27, 60, 25, 16, - 28, 20, 28, 29, 42, 18, 20, 21, 30, 52, + 60, 28, 29, 18, 19, 20, 21, 27, 30, 58, + 59, 59, 59, 18, 19, 20, 27, 62, 25, 16, + 28, 20, 28, 29, 42, 18, 20, 21, 30, 54, 16, 27, 18, 20, 28, 44, 45, 50, 24, 25, - 16, 23, 27, 59, 60, 39, 18, 10, 10, 45, + 16, 23, 27, 61, 62, 39, 18, 10, 10, 45, 16, 27, 31, 50, 18, 18, 27, 25, 28, 31, - 58, 57, 18, 59, 18, 25, 28, 15, 49, 15, - 46, 47, 18, 18, 31, 28, 18, 45, 24, 28, - 60, 49, 26, 49, 26, 26, 28, 28, 26, 20, - 26, 20, 20, 20, 20, 58, 58, 58, 29, 29, - 29, 43, 27, 27, 27, 28, 50, 52, 53, 28, - 44, 28, 25, 28, 28, 52 + 60, 59, 18, 61, 18, 25, 28, 15, 49, 15, + 46, 47, 48, 18, 18, 31, 28, 18, 45, 24, + 28, 62, 49, 26, 49, 26, 26, 26, 28, 28, + 26, 20, 26, 20, 20, 20, 20, 20, 60, 60, + 60, 60, 29, 29, 29, 29, 43, 27, 27, 27, + 27, 28, 50, 54, 55, 20, 21, 28, 52, 53, + 28, 44, 28, 25, 28, 27, 25, 28, 28, 54, + 18, 53, 28 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ @@ -692,13 +706,14 @@ static const yytype_uint8 yyr1[] = { 0, 32, 33, 34, 34, 34, 35, 36, 36, 37, 37, 37, 37, 38, 38, 39, 39, 40, 40, 41, - 41, 41, 41, 41, 41, 42, 42, 43, 43, 43, - 44, 44, 45, 45, 45, 46, 46, 46, 46, 47, - 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, - 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, - 53, 53, 54, 54, 55, 56, 56, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 58, 58, 59, 59, - 60, 60, 60, 60, 60, 60, 60, 61, 61, 61 + 41, 41, 41, 41, 41, 41, 41, 42, 42, 43, + 43, 43, 44, 44, 45, 45, 45, 46, 46, 46, + 46, 47, 47, 47, 47, 48, 48, 49, 49, 49, + 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, + 54, 54, 54, 54, 54, 54, 54, 55, 55, 56, + 56, 57, 58, 58, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 60, 60, 61, 61, 62, 62, 62, + 62, 62, 62, 62, 63, 63, 63 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -706,13 +721,14 @@ static const yytype_uint8 yyr2[] = { 0, 2, 5, 3, 3, 0, 5, 3, 1, 3, 4, 8, 9, 1, 3, 3, 1, 3, 0, 6, - 15, 14, 15, 6, 13, 2, 0, 4, 3, 0, - 3, 1, 1, 1, 4, 1, 1, 3, 3, 3, - 3, 5, 5, 1, 3, 1, 1, 1, 3, 1, - 1, 1, 4, 1, 3, 3, 2, 1, 1, 4, - 3, 1, 3, 0, 6, 3, 1, 1, 1, 1, - 3, 3, 1, 4, 3, 2, 3, 0, 3, 1, - 3, 1, 1, 1, 4, 4, 3, 3, 4, 4 + 15, 14, 15, 14, 15, 6, 13, 2, 0, 4, + 3, 0, 3, 1, 1, 1, 4, 1, 1, 3, + 3, 3, 3, 5, 5, 1, 3, 1, 1, 1, + 3, 1, 1, 1, 4, 3, 1, 1, 1, 4, + 1, 3, 3, 2, 1, 1, 4, 3, 1, 3, + 0, 6, 3, 1, 1, 1, 1, 3, 3, 1, + 4, 3, 2, 3, 0, 3, 1, 3, 1, 1, + 1, 4, 4, 3, 3, 4, 4 }; @@ -1401,13 +1417,13 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); switch (yyn) { case 4: -#line 111 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ +#line 114 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { yyerrok; } -#line 1407 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1423 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; case 19: -#line 146 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ +#line 149 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { // Declaration of a (named) constant: we simply register it in the // parser's context, and don't store it in the model. @@ -1427,11 +1443,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } delete annotations; } -#line 1431 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1447 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; case 20: -#line 166 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ +#line 169 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { std::vector* const annotations = (yyvsp[-4].annotations); // Declaration of a (named) constant array. See rule right above. @@ -1446,11 +1462,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); delete assignments; delete annotations; } -#line 1450 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1466 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; case 21: -#line 181 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ +#line 184 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { std::vector* const annotations = (yyvsp[-3].annotations); // Declaration of a (named) constant array. See rule right above. @@ -1461,11 +1477,45 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); context->integer_array_map[identifier] = std::vector(); delete annotations; } -#line 1465 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1481 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; case 22: -#line 191 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ +#line 195 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { + std::vector* const annotations = (yyvsp[-4].annotations); + // Declaration of a (named) constant array. See rule right above. + CHECK_EQ((yyvsp[-12].integer_value), 1) << "Only [1..n] array are supported here."; + const int64 num_constants = (yyvsp[-10].integer_value); + const std::string& identifier = (yyvsp[-5].string_value); + const std::vector* const assignments = (yyvsp[-1].doubles); + CHECK(assignments != nullptr); + CHECK_EQ(num_constants, assignments->size()); + // TODO(lperron): CHECK all values within domain. + context->float_array_map[identifier] = *assignments; + delete assignments; + delete annotations; +} +#line 1500 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + break; + + case 23: +#line 210 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { + std::vector* const annotations = (yyvsp[-3].annotations); + // Declaration of a (named) constant array. See rule right above. + CHECK_EQ((yyvsp[-11].integer_value), 1) << "Only [1..n] array are supported here."; + const int64 num_constants = (yyvsp[-9].integer_value); + CHECK_EQ(num_constants, 0) << "Empty arrays should have a size of 0"; + const std::string& identifier = (yyvsp[-4].string_value); + context->float_array_map[identifier] = std::vector(); + delete annotations; +} +#line 1515 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + break; + + case 24: +#line 221 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { // Declaration of a (named) constant array: See rule above. CHECK_EQ((yyvsp[-12].integer_value), 1) << "Only [1..n] array are supported here."; @@ -1491,11 +1541,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); delete assignments; delete annotations; } -#line 1495 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1545 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 23: -#line 216 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 25: +#line 246 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { // Declaration of a variable. If it's unassigned or assigned to a // constant, we'll create a new var stored in the model. If it's @@ -1529,11 +1579,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } delete annotations; } -#line 1533 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1583 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 24: -#line 250 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 26: +#line 280 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { // Declaration of a "variable array": these is exactly like N simple // variable declarations, where the identifier for declaration #i is @@ -1601,65 +1651,65 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); delete annotations; } } -#line 1605 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1655 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 25: -#line 319 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 27: +#line 349 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.var_or_value) = (yyvsp[0].var_or_value); } -#line 1611 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1661 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 26: -#line 320 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 28: +#line 350 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.var_or_value) = VariableRefOrValue::Undefined(); } -#line 1617 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1667 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 27: -#line 323 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 29: +#line 353 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.var_or_value_array) = (yyvsp[-1].var_or_value_array); } -#line 1623 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1673 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 28: -#line 324 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 30: +#line 354 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.var_or_value_array) = nullptr; } -#line 1629 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1679 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 29: -#line 325 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 31: +#line 355 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.var_or_value_array) = nullptr; } -#line 1635 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1685 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 30: -#line 328 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 32: +#line 358 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.var_or_value_array) = (yyvsp[-2].var_or_value_array); (yyval.var_or_value_array)->PushBack((yyvsp[0].var_or_value)); } -#line 1644 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1694 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 31: -#line 332 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 33: +#line 362 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.var_or_value_array) = new VariableRefOrValueArray(); (yyval.var_or_value_array)->PushBack((yyvsp[0].var_or_value)); } -#line 1653 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1703 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 32: -#line 338 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 34: +#line 368 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.var_or_value) = VariableRefOrValue::Value((yyvsp[0].integer_value)); } -#line 1659 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1709 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 33: -#line 339 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 35: +#line 369 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { // A reference to an existing integer constant or variable. const std::string& id = (yyvsp[0].string_value); @@ -1673,11 +1723,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); *ok = false; } } -#line 1677 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1727 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 34: -#line 352 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 36: +#line 382 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { // A given element of an existing constant array or variable array. const std::string& id = (yyvsp[-3].string_value); @@ -1694,200 +1744,239 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); *ok = false; } } -#line 1698 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1748 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 35: -#line 370 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 37: +#line 400 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = Domain::Boolean(); } -#line 1704 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1754 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 36: -#line 371 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 38: +#line 401 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = Domain::AllInt64(); } -#line 1710 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1760 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 37: -#line 372 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 39: +#line 402 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value)); } -#line 1716 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1766 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 38: -#line 373 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 40: +#line 403 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { CHECK((yyvsp[-1].integers) != nullptr); (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers))); delete (yyvsp[-1].integers); } -#line 1726 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1776 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 39: -#line 380 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ - { (yyval.domain) = Domain::Boolean(); } -#line 1732 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + case 41: +#line 410 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { (yyval.domain) = Domain::SetOfBoolean(); } +#line 1782 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 40: -#line 381 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ - { (yyval.domain) = Domain::AllInt64(); } -#line 1738 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + case 42: +#line 411 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { (yyval.domain) = Domain::SetOfAllInt64(); } +#line 1788 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 41: -#line 382 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ - { (yyval.domain) = Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value)); } -#line 1744 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + case 43: +#line 412 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { (yyval.domain) = Domain::SetOfInterval((yyvsp[-2].integer_value), (yyvsp[0].integer_value)); } +#line 1794 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 42: -#line 383 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 44: +#line 413 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { CHECK((yyvsp[-1].integers) != nullptr); - (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers))); + (yyval.domain) = Domain::SetOfIntegerList(std::move(*(yyvsp[-1].integers))); delete (yyvsp[-1].integers); } -#line 1754 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1804 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 43: -#line 390 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 45: +#line 420 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = Domain::AllInt64(); } -#line 1760 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1810 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 44: -#line 391 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ - { (yyval.domain) = Domain::AllInt64(); } -#line 1766 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + case 46: +#line 421 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { + const int64 lb = ConvertAsIntegerOrDie((yyvsp[-2].double_value)); + const int64 ub = ConvertAsIntegerOrDie((yyvsp[0].double_value)); + (yyval.domain) = Domain::Interval(lb, ub); +} +#line 1820 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 45: -#line 395 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 47: +#line 428 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = (yyvsp[0].domain); } -#line 1772 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1826 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 46: -#line 396 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 48: +#line 429 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = (yyvsp[0].domain); } -#line 1778 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1832 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 47: -#line 397 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 49: +#line 430 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = (yyvsp[0].domain); } -#line 1784 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1838 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 48: -#line 400 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 50: +#line 433 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.integers) = (yyvsp[-2].integers); (yyval.integers)->emplace_back((yyvsp[0].integer_value)); } -#line 1790 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1844 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 49: -#line 401 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 51: +#line 434 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.integers) = new std::vector(); (yyval.integers)->emplace_back((yyvsp[0].integer_value)); } -#line 1796 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1850 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 50: -#line 404 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 52: +#line 437 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.integer_value) = (yyvsp[0].integer_value); } -#line 1802 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1856 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 51: -#line 405 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 53: +#line 438 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.integer_value) = FindOrDie(context->integer_map, (yyvsp[0].string_value)); } -#line 1808 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1862 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 52: -#line 406 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 54: +#line 439 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.integer_value) = Lookup(FindOrDie(context->integer_array_map, (yyvsp[-3].string_value)), (yyvsp[-1].integer_value)); } -#line 1816 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1870 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 53: -#line 411 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 55: +#line 444 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { (yyval.doubles) = (yyvsp[-2].doubles); (yyval.doubles)->emplace_back((yyvsp[0].double_value)); } +#line 1876 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + break; + + case 56: +#line 445 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { (yyval.doubles) = new std::vector(); (yyval.doubles)->emplace_back((yyvsp[0].double_value)); } +#line 1882 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + break; + + case 57: +#line 448 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { (yyval.double_value) = (yyvsp[0].double_value); } +#line 1888 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + break; + + case 58: +#line 449 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { (yyval.double_value) = FindOrDie(context->float_map, (yyvsp[0].string_value)); } +#line 1894 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + break; + + case 59: +#line 450 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { + (yyval.double_value) = Lookup(FindOrDie(context->float_array_map, (yyvsp[-3].string_value)), (yyvsp[-1].integer_value)); +} +#line 1902 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + break; + + case 60: +#line 455 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = Domain::IntegerValue((yyvsp[0].integer_value)); } -#line 1822 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1908 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 54: -#line 412 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 61: +#line 456 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value)); } -#line 1828 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1914 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 55: -#line 413 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 62: +#line 457 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { CHECK((yyvsp[-1].integers) != nullptr); (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers))); delete (yyvsp[-1].integers); } -#line 1838 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1924 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 56: -#line 418 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 63: +#line 462 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = Domain::EmptyDomain(); } -#line 1844 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1930 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 57: -#line 419 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ - { (yyval.domain) = Domain::AllInt64(); } -#line 1850 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + case 64: +#line 463 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { + CHECK_EQ(std::round((yyvsp[0].double_value)), (yyvsp[0].double_value)); + (yyval.domain) = Domain::IntegerValue(static_cast((yyvsp[0].double_value))); +} +#line 1939 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 58: -#line 420 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 65: +#line 467 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = Domain::IntegerValue(FindOrDie(context->integer_map, (yyvsp[0].string_value))); } -#line 1856 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1945 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 59: -#line 421 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 66: +#line 468 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domain) = Domain::IntegerValue( Lookup(FindOrDie(context->integer_array_map, (yyvsp[-3].string_value)), (yyvsp[-1].integer_value))); } -#line 1865 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1954 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 60: -#line 427 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 67: +#line 474 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domains) = (yyvsp[-2].domains); (yyval.domains)->emplace_back((yyvsp[0].domain)); } -#line 1874 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1963 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 61: -#line 431 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 68: +#line 478 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.domains) = new std::vector(); (yyval.domains)->emplace_back((yyvsp[0].domain)); } -#line 1880 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1969 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 64: -#line 441 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 71: +#line 488 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { const std::string& identifier = (yyvsp[-4].string_value); CHECK((yyvsp[-2].args) != nullptr) << "Missing argument in constraint"; const std::vector& arguments = *(yyvsp[-2].args); std::vector* const annotations = (yyvsp[0].annotations); - // Does the constraint has a defines_var annotation? + // Does the constraint have a defines_var annotation? IntegerVariable* defines_var = nullptr; if (annotations != nullptr) { for (int i = 0; i < annotations->size(); ++i) { @@ -1906,63 +1995,74 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); delete annotations; delete (yyvsp[-2].args); } -#line 1910 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 1999 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 65: -#line 468 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 72: +#line 515 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.args) = (yyvsp[-2].args); (yyval.args)->emplace_back((yyvsp[0].arg)); } -#line 1916 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2005 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 66: -#line 469 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 73: +#line 516 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.args) = new std::vector(); (yyval.args)->emplace_back((yyvsp[0].arg)); } -#line 1922 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2011 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 67: -#line 472 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 74: +#line 519 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.arg) = Argument::IntegerValue((yyvsp[0].integer_value)); } -#line 1928 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2017 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 68: -#line 473 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ - { (yyval.arg) = Argument::VoidArgument(); } -#line 1934 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ + case 75: +#line 520 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + { (yyval.arg) = Argument::IntegerValue(ConvertAsIntegerOrDie((yyvsp[0].double_value))); } +#line 2023 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 69: -#line 474 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 76: +#line 521 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.arg) = Argument::VoidArgument(); } -#line 1940 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2029 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 70: -#line 475 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 77: +#line 522 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.arg) = Argument::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value)); } -#line 1946 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2035 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 71: -#line 476 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 78: +#line 523 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { CHECK((yyvsp[-1].integers) != nullptr); (yyval.arg) = Argument::IntegerList(std::move(*(yyvsp[-1].integers))); delete (yyvsp[-1].integers); } -#line 1956 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2045 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 72: -#line 481 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 79: +#line 528 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { const std::string& id = (yyvsp[0].string_value); if (ContainsKey(context->integer_map, id)) { (yyval.arg) = Argument::IntegerValue(FindOrDie(context->integer_map, id)); } else if (ContainsKey(context->integer_array_map, id)) { (yyval.arg) = Argument::IntegerList(FindOrDie(context->integer_array_map, id)); + } else if (ContainsKey(context->float_map, id)) { + const double d = FindOrDie(context->float_map, id); + (yyval.arg) = Argument::IntegerValue(ConvertAsIntegerOrDie(d)); + } else if (ContainsKey(context->float_array_map, id)) { + const auto& double_values = FindOrDie(context->float_array_map, id); + std::vector integer_values; + for (const double d : double_values) { + const int64 i = ConvertAsIntegerOrDie(d); + integer_values.push_back(i); + } + (yyval.arg) = Argument::IntegerList(std::move(integer_values)); } else if (ContainsKey(context->variable_map, id)) { (yyval.arg) = Argument::IntVarRef(FindOrDie(context->variable_map, id)); } else if (ContainsKey(context->variable_array_map, id)) { @@ -1977,11 +2077,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.arg) = Argument::DomainList(d); } } -#line 1981 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2081 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 73: -#line 501 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 80: +#line 559 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { const std::string& id = (yyvsp[-3].string_value); const int64 index = (yyvsp[-1].integer_value); @@ -1999,11 +2099,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.arg) = Argument::FromDomain(d); } } -#line 2003 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2103 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 74: -#line 518 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 81: +#line 576 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { VariableRefOrValueArray* const arguments = (yyvsp[-1].var_or_value_array); CHECK(arguments != nullptr); @@ -2029,64 +2129,64 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); } delete arguments; } -#line 2033 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2133 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 75: -#line 543 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 82: +#line 601 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.arg) = Argument::VoidArgument(); } -#line 2041 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2141 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 76: -#line 552 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 83: +#line 610 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.annotations) = (yyvsp[-2].annotations) != nullptr ? (yyvsp[-2].annotations) : new std::vector(); (yyval.annotations)->emplace_back((yyvsp[0].annotation)); } -#line 2050 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2150 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 77: -#line 556 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 84: +#line 614 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.annotations) = nullptr; } -#line 2056 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2156 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 78: -#line 559 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 85: +#line 617 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.annotations) = (yyvsp[-2].annotations); (yyval.annotations)->emplace_back((yyvsp[0].annotation)); } -#line 2062 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2162 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 79: -#line 560 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 86: +#line 618 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.annotations) = new std::vector(); (yyval.annotations)->emplace_back((yyvsp[0].annotation)); } -#line 2068 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2168 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 80: -#line 563 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 87: +#line 621 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.annotation) = Annotation::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value)); } -#line 2074 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2174 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 81: -#line 564 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 88: +#line 622 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.annotation) = Annotation::IntegerValue((yyvsp[0].integer_value)); } -#line 2080 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2180 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 82: -#line 565 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 89: +#line 623 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { (yyval.annotation) = Annotation::String((yyvsp[0].string_value)); } -#line 2086 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2186 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 83: -#line 566 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 90: +#line 624 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { const std::string& id = (yyvsp[0].string_value); if (ContainsKey(context->variable_map, id)) { @@ -2097,11 +2197,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.annotation) = Annotation::Identifier(id); } } -#line 2101 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2201 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 84: -#line 576 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 91: +#line 634 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { std::vector* const annotations = (yyvsp[-1].annotations); if (annotations != nullptr) { @@ -2111,22 +2211,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.annotation) = Annotation::FunctionCall((yyvsp[-3].string_value)); } } -#line 2115 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2215 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 85: -#line 585 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 92: +#line 643 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { CHECK(ContainsKey(context->variable_array_map, (yyvsp[-3].string_value))) << "Unknown identifier: " << (yyvsp[-3].string_value); (yyval.annotation) = Annotation::Variable( Lookup(FindOrDie(context->variable_array_map, (yyvsp[-3].string_value)), (yyvsp[-1].integer_value))); } -#line 2126 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2226 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 86: -#line 591 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 93: +#line 649 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { std::vector* const annotations = (yyvsp[-1].annotations); if (annotations != nullptr) { @@ -2136,11 +2236,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.annotation) = Annotation::Empty(); } } -#line 2140 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2240 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 87: -#line 606 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 94: +#line 664 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { if ((yyvsp[-1].annotations) != nullptr) { model->Satisfy(std::move(*(yyvsp[-1].annotations))); @@ -2149,11 +2249,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); model->Satisfy(std::vector()); } } -#line 2153 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2253 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 88: -#line 614 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 95: +#line 672 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { CHECK_EQ(Argument::INT_VAR_REF, (yyvsp[0].arg).type); if ((yyvsp[-2].annotations) != nullptr) { @@ -2163,11 +2263,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); model->Minimize((yyvsp[0].arg).Var(), std::vector()); } } -#line 2167 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2267 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; - case 89: -#line 623 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ + case 96: +#line 681 "./ortools/flatzinc/parser.yy" /* yacc.c:1646 */ { CHECK_EQ(Argument::INT_VAR_REF, (yyvsp[0].arg).type); if ((yyvsp[-2].annotations) != nullptr) { @@ -2177,11 +2277,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); model->Maximize((yyvsp[0].arg).Var(), std::vector()); } } -#line 2181 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2281 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ break; -#line 2185 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ +#line 2285 "./ortools/flatzinc/parser.tab.cc" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2409,5 +2509,5 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); #endif return yyresult; } -#line 633 "./ortools/flatzinc/parser.yy" /* yacc.c:1906 */ +#line 691 "./ortools/flatzinc/parser.yy" /* yacc.c:1906 */