OR-Tools  8.1
parser.tab.cc
Go to the documentation of this file.
1 // Copyright 2010-2018 Google LLC
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 /* A Bison parser, made by GNU Bison 3.7.2. */
15 
16 /* Bison implementation for Yacc-like parsers in C
17 
18  Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
19  Inc.
20 
21  This program is free software: you can redistribute it and/or modify
22  it under the terms of the GNU General Public License as published by
23  the Free Software Foundation, either version 3 of the License, or
24  (at your option) any later version.
25 
26  This program is distributed in the hope that it will be useful,
27  but WITHOUT ANY WARRANTY; without even the implied warranty of
28  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29  GNU General Public License for more details.
30 
31  You should have received a copy of the GNU General Public License
32  along with this program. If not, see <http://www.gnu.org/licenses/>. */
33 
34 /* As a special exception, you may create a larger work that contains
35  part or all of the Bison parser skeleton and distribute that work
36  under terms of your choice, so long as that work isn't itself a
37  parser generator using the skeleton or a modified version thereof
38  as a parser skeleton. Alternatively, if you modify or redistribute
39  the parser skeleton itself, you may (at your option) remove this
40  special exception, which will cause the skeleton and the resulting
41  Bison output files to be licensed under the GNU General Public
42  License without this special exception.
43 
44  This special exception was added by the Free Software Foundation in
45  version 2.2 of Bison. */
46 
47 /* C LALR(1) parser skeleton written by Richard Stallman, by
48  simplifying the original so-called "semantic" parser. */
49 
50 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
51  especially those whose name start with YY_ or yy_. They are
52  private implementation details that can be changed or removed. */
53 
54 /* All symbols defined below should begin with yy or YY, to avoid
55  infringing on user name space. This should be done even for local
56  variables, as they might otherwise be expanded by user macros.
57  There are some unavoidable exceptions within include files to
58  define necessary library symbols; they are noted "INFRINGES ON
59  USER NAME SPACE" below. */
60 
61 /* Identify Bison output. */
62 #define YYBISON 1
63 
64 /* Bison version. */
65 #define YYBISON_VERSION "3.7.2"
66 
67 /* Skeleton name. */
68 #define YYSKELETON_NAME "yacc.c"
69 
70 /* Pure parsers. */
71 #define YYPURE 2
72 
73 /* Push parsers. */
74 #define YYPUSH 0
75 
76 /* Pull parsers. */
77 #define YYPULL 1
78 
79 /* Substitute the type names. */
80 #define YYSTYPE ORFZ_STYPE
81 /* Substitute the variable and function names. */
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
87 
88 #ifndef YY_CAST
89 #ifdef __cplusplus
90 #define YY_CAST(Type, Val) static_cast<Type>(Val)
91 #define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type>(Val)
92 #else
93 #define YY_CAST(Type, Val) ((Type)(Val))
94 #define YY_REINTERPRET_CAST(Type, Val) ((Type)(Val))
95 #endif
96 #endif
97 #ifndef YY_NULLPTR
98 #if defined __cplusplus
99 #if 201103L <= __cplusplus
100 #define YY_NULLPTR nullptr
101 #else
102 #define YY_NULLPTR 0
103 #endif
104 #else
105 #define YY_NULLPTR ((void*)0)
106 #endif
107 #endif
108 
109 #include "parser.tab.hh"
110 /* Symbol kind. */
113  YYSYMBOL_YYEOF = 0, /* "end of file" */
114  YYSYMBOL_YYerror = 1, /* error */
115  YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
116  YYSYMBOL_ARRAY = 3, /* ARRAY */
117  YYSYMBOL_TOKEN_BOOL = 4, /* TOKEN_BOOL */
118  YYSYMBOL_CONSTRAINT = 5, /* CONSTRAINT */
119  YYSYMBOL_TOKEN_FLOAT = 6, /* TOKEN_FLOAT */
120  YYSYMBOL_TOKEN_INT = 7, /* TOKEN_INT */
121  YYSYMBOL_MAXIMIZE = 8, /* MAXIMIZE */
122  YYSYMBOL_MINIMIZE = 9, /* MINIMIZE */
123  YYSYMBOL_OF = 10, /* OF */
124  YYSYMBOL_PREDICATE = 11, /* PREDICATE */
125  YYSYMBOL_SATISFY = 12, /* SATISFY */
126  YYSYMBOL_SET = 13, /* SET */
127  YYSYMBOL_SOLVE = 14, /* SOLVE */
128  YYSYMBOL_VAR = 15, /* VAR */
129  YYSYMBOL_DOTDOT = 16, /* DOTDOT */
130  YYSYMBOL_COLONCOLON = 17, /* COLONCOLON */
131  YYSYMBOL_IVALUE = 18, /* IVALUE */
132  YYSYMBOL_SVALUE = 19, /* SVALUE */
133  YYSYMBOL_IDENTIFIER = 20, /* IDENTIFIER */
134  YYSYMBOL_DVALUE = 21, /* DVALUE */
135  YYSYMBOL_22_ = 22, /* ';' */
136  YYSYMBOL_23_ = 23, /* '(' */
137  YYSYMBOL_24_ = 24, /* ')' */
138  YYSYMBOL_25_ = 25, /* ',' */
139  YYSYMBOL_26_ = 26, /* ':' */
140  YYSYMBOL_27_ = 27, /* '[' */
141  YYSYMBOL_28_ = 28, /* ']' */
142  YYSYMBOL_29_ = 29, /* '=' */
143  YYSYMBOL_30_ = 30, /* '{' */
144  YYSYMBOL_31_ = 31, /* '}' */
145  YYSYMBOL_YYACCEPT = 32, /* $accept */
146  YYSYMBOL_model = 33, /* model */
147  YYSYMBOL_predicates = 34, /* predicates */
148  YYSYMBOL_predicate = 35, /* predicate */
149  YYSYMBOL_predicate_arguments = 36, /* predicate_arguments */
150  YYSYMBOL_predicate_argument = 37, /* predicate_argument */
151  YYSYMBOL_predicate_array_argument = 38, /* predicate_array_argument */
152  YYSYMBOL_predicate_ints = 39, /* predicate_ints */
154  40, /* variable_or_constant_declarations */
156  41, /* variable_or_constant_declaration */
157  YYSYMBOL_optional_var_or_value = 42, /* optional_var_or_value */
158  YYSYMBOL_optional_var_or_value_array = 43, /* optional_var_or_value_array */
159  YYSYMBOL_var_or_value_array = 44, /* var_or_value_array */
160  YYSYMBOL_var_or_value = 45, /* var_or_value */
161  YYSYMBOL_int_domain = 46, /* int_domain */
162  YYSYMBOL_set_domain = 47, /* set_domain */
163  YYSYMBOL_float_domain = 48, /* float_domain */
164  YYSYMBOL_domain = 49, /* domain */
165  YYSYMBOL_integers = 50, /* integers */
166  YYSYMBOL_integer = 51, /* integer */
167  YYSYMBOL_floats = 52, /* floats */
168  YYSYMBOL_float = 53, /* float */
169  YYSYMBOL_const_literal = 54, /* const_literal */
170  YYSYMBOL_const_literals = 55, /* const_literals */
171  YYSYMBOL_constraints = 56, /* constraints */
172  YYSYMBOL_constraint = 57, /* constraint */
173  YYSYMBOL_arguments = 58, /* arguments */
174  YYSYMBOL_argument = 59, /* argument */
175  YYSYMBOL_annotations = 60, /* annotations */
176  YYSYMBOL_annotation_arguments = 61, /* annotation_arguments */
177  YYSYMBOL_annotation = 62, /* annotation */
178  YYSYMBOL_solve = 63 /* solve */
179 };
180 typedef enum yysymbol_kind_t yysymbol_kind_t;
181 
182 /* Unqualified %code blocks. */
183 #line 36 "./ortools/flatzinc/parser.yy"
184 
185 #include "absl/strings/match.h"
186 #include "absl/strings/str_format.h"
188 
201 
202 #line 192 "./ortools/flatzinc/parser.tab.cc"
203 
204 #ifdef short
205 #undef short
206 #endif
207 
208 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
209  <limits.h> and (if available) <stdint.h> are included
210  so that the code can choose integer types of a good width. */
211 
212 #ifndef __PTRDIFF_MAX__
213 #include <limits.h> /* INFRINGES ON USER NAME SPACE */
214 #if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
215 #include <stdint.h> /* INFRINGES ON USER NAME SPACE */
216 #define YY_STDINT_H
217 #endif
218 #endif
219 
220 /* Narrow types that promote to a signed type and that can represent a
221  signed or unsigned integer of at least N bits. In tables they can
222  save space and decrease cache pressure. Promoting to a signed type
223  helps avoid bugs in integer arithmetic. */
224 
225 #ifdef __INT_LEAST8_MAX__
226 typedef __INT_LEAST8_TYPE__ yytype_int8;
227 #elif defined YY_STDINT_H
228 typedef int_least8_t yytype_int8;
229 #else
230 typedef signed char yytype_int8;
231 #endif
232 
233 #ifdef __INT_LEAST16_MAX__
234 typedef __INT_LEAST16_TYPE__ yytype_int16;
235 #elif defined YY_STDINT_H
236 typedef int_least16_t yytype_int16;
237 #else
238 typedef short yytype_int16;
239 #endif
240 
241 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
242 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
243 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H && \
244  UINT_LEAST8_MAX <= INT_MAX)
245 typedef uint_least8_t yytype_uint8;
246 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
247 typedef unsigned char yytype_uint8;
248 #else
249 typedef short yytype_uint8;
250 #endif
251 
252 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
253 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
254 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H && \
255  UINT_LEAST16_MAX <= INT_MAX)
256 typedef uint_least16_t yytype_uint16;
257 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
258 typedef unsigned short yytype_uint16;
259 #else
260 typedef int yytype_uint16;
261 #endif
262 
263 #ifndef YYPTRDIFF_T
264 #if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
265 #define YYPTRDIFF_T __PTRDIFF_TYPE__
266 #define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
267 #elif defined PTRDIFF_MAX
268 #ifndef ptrdiff_t
269 #include <stddef.h> /* INFRINGES ON USER NAME SPACE */
270 #endif
271 #define YYPTRDIFF_T ptrdiff_t
272 #define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
273 #else
274 #define YYPTRDIFF_T long
275 #define YYPTRDIFF_MAXIMUM LONG_MAX
276 #endif
277 #endif
278 
279 #ifndef YYSIZE_T
280 #ifdef __SIZE_TYPE__
281 #define YYSIZE_T __SIZE_TYPE__
282 #elif defined size_t
283 #define YYSIZE_T size_t
284 #elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
285 #include <stddef.h> /* INFRINGES ON USER NAME SPACE */
286 #define YYSIZE_T size_t
287 #else
288 #define YYSIZE_T unsigned
289 #endif
290 #endif
291 
292 #define YYSIZE_MAXIMUM \
293  YY_CAST(YYPTRDIFF_T, \
294  (YYPTRDIFF_MAXIMUM < YY_CAST(YYSIZE_T, -1) ? YYPTRDIFF_MAXIMUM \
295  : YY_CAST(YYSIZE_T, -1)))
296 
297 #define YYSIZEOF(X) YY_CAST(YYPTRDIFF_T, sizeof(X))
298 
299 /* Stored state numbers (used for stacks). */
301 
302 /* State numbers in computations. */
303 typedef int yy_state_fast_t;
304 
305 #ifndef YY_
306 #if defined YYENABLE_NLS && YYENABLE_NLS
307 #if ENABLE_NLS
308 #include <libintl.h> /* INFRINGES ON USER NAME SPACE */
309 #define YY_(Msgid) dgettext("bison-runtime", Msgid)
310 #endif
311 #endif
312 #ifndef YY_
313 #define YY_(Msgid) Msgid
314 #endif
315 #endif
316 
317 #ifndef YY_ATTRIBUTE_PURE
318 #if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
319 #define YY_ATTRIBUTE_PURE __attribute__((__pure__))
320 #else
321 #define YY_ATTRIBUTE_PURE
322 #endif
323 #endif
324 
325 #ifndef YY_ATTRIBUTE_UNUSED
326 #if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
327 #define YY_ATTRIBUTE_UNUSED __attribute__((__unused__))
328 #else
329 #define YY_ATTRIBUTE_UNUSED
330 #endif
331 #endif
332 
333 /* Suppress unused-variable warnings by "using" E. */
334 #if !defined lint || defined __GNUC__
335 #define YYUSE(E) ((void)(E))
336 #else
337 #define YYUSE(E) /* empty */
338 #endif
339 
340 #if defined __GNUC__ && !defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
341 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
342 #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
343  _Pragma("GCC diagnostic push") \
344  _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
345  _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
346 #define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop")
347 #else
348 #define YY_INITIAL_VALUE(Value) Value
349 #endif
350 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
351 #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
352 #define YY_IGNORE_MAYBE_UNINITIALIZED_END
353 #endif
354 #ifndef YY_INITIAL_VALUE
355 #define YY_INITIAL_VALUE(Value) /* Nothing. */
356 #endif
357 
358 #if defined __cplusplus && defined __GNUC__ && !defined __ICC && 6 <= __GNUC__
359 #define YY_IGNORE_USELESS_CAST_BEGIN \
360  _Pragma("GCC diagnostic push") \
361  _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"")
362 #define YY_IGNORE_USELESS_CAST_END _Pragma("GCC diagnostic pop")
363 #endif
364 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
365 #define YY_IGNORE_USELESS_CAST_BEGIN
366 #define YY_IGNORE_USELESS_CAST_END
367 #endif
368 
369 #define YY_ASSERT(E) ((void)(0 && (E)))
370 
371 #if 1
372 
373 /* The parser invokes alloca or malloc; define the necessary symbols. */
374 
375 #ifdef YYSTACK_USE_ALLOCA
376 #if YYSTACK_USE_ALLOCA
377 #ifdef __GNUC__
378 #define YYSTACK_ALLOC __builtin_alloca
379 #elif defined __BUILTIN_VA_ARG_INCR
380 #include <alloca.h> /* INFRINGES ON USER NAME SPACE */
381 #elif defined _AIX
382 #define YYSTACK_ALLOC __alloca
383 #elif defined _MSC_VER
384 #include <malloc.h> /* INFRINGES ON USER NAME SPACE */
385 #define alloca _alloca
386 #else
387 #define YYSTACK_ALLOC alloca
388 #if !defined _ALLOCA_H && !defined EXIT_SUCCESS
389 #include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
390 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
391 #ifndef EXIT_SUCCESS
392 #define EXIT_SUCCESS 0
393 #endif
394 #endif
395 #endif
396 #endif
397 #endif
398 
399 #ifdef YYSTACK_ALLOC
400 /* Pacify GCC's 'empty if-body' warning. */
401 #define YYSTACK_FREE(Ptr) \
402  do { /* empty */ \
403  ; \
404  } while (0)
405 #ifndef YYSTACK_ALLOC_MAXIMUM
406 /* The OS might guarantee only one guard page at the bottom of the stack,
407  and a page size can be as small as 4096 bytes. So we cannot safely
408  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
409  to allow for a few compiler-allocated temporary stack slots. */
410 #define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
411 #endif
412 #else
413 #define YYSTACK_ALLOC YYMALLOC
414 #define YYSTACK_FREE YYFREE
415 #ifndef YYSTACK_ALLOC_MAXIMUM
416 #define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
417 #endif
418 #if (defined __cplusplus && !defined EXIT_SUCCESS && \
419  !((defined YYMALLOC || defined malloc) && \
420  (defined YYFREE || defined free)))
421 #include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
422 #ifndef EXIT_SUCCESS
423 #define EXIT_SUCCESS 0
424 #endif
425 #endif
426 #ifndef YYMALLOC
427 #define YYMALLOC malloc
428 #if !defined malloc && !defined EXIT_SUCCESS
429 void* malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
430 #endif
431 #endif
432 #ifndef YYFREE
433 #define YYFREE free
434 #if !defined free && !defined EXIT_SUCCESS
435 void free(void*); /* INFRINGES ON USER NAME SPACE */
436 #endif
437 #endif
438 #endif
439 #endif /* 1 */
440 
441 #if (!defined yyoverflow && \
442  (!defined __cplusplus || \
443  (defined ORFZ_STYPE_IS_TRIVIAL && ORFZ_STYPE_IS_TRIVIAL)))
444 
445 /* A type that is properly aligned for any stack member. */
446 union yyalloc {
449 };
450 
451 /* The size of the maximum gap between one aligned stack and the next. */
452 #define YYSTACK_GAP_MAXIMUM (YYSIZEOF(union yyalloc) - 1)
453 
454 /* The size of an array large to enough to hold all stacks, each with
455  N elements. */
456 #define YYSTACK_BYTES(N) \
457  ((N) * (YYSIZEOF(yy_state_t) + YYSIZEOF(YYSTYPE)) + YYSTACK_GAP_MAXIMUM)
458 
459 #define YYCOPY_NEEDED 1
460 
461 /* Relocate STACK from its old location to the new one. The
462  local variables YYSIZE and YYSTACKSIZE give the old and new number of
463  elements in the stack, and YYPTR gives the new location of the
464  stack. Advance YYPTR to a properly aligned location for the next
465  stack. */
466 #define YYSTACK_RELOCATE(Stack_alloc, Stack) \
467  do { \
468  YYPTRDIFF_T yynewbytes; \
469  YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \
470  Stack = &yyptr->Stack_alloc; \
471  yynewbytes = yystacksize * YYSIZEOF(*Stack) + YYSTACK_GAP_MAXIMUM; \
472  yyptr += yynewbytes / YYSIZEOF(*yyptr); \
473  } while (0)
474 
475 #endif
476 
477 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
478 /* Copy COUNT objects from SRC to DST. The source and destination do
479  not overlap. */
480 #ifndef YYCOPY
481 #if defined __GNUC__ && 1 < __GNUC__
482 #define YYCOPY(Dst, Src, Count) \
483  __builtin_memcpy(Dst, Src, YY_CAST(YYSIZE_T, (Count)) * sizeof(*(Src)))
484 #else
485 #define YYCOPY(Dst, Src, Count) \
486  do { \
487  YYPTRDIFF_T yyi; \
488  for (yyi = 0; yyi < (Count); yyi++) (Dst)[yyi] = (Src)[yyi]; \
489  } while (0)
490 #endif
491 #endif
492 #endif /* !YYCOPY_NEEDED */
493 
494 /* YYFINAL -- State number of the termination state. */
495 #define YYFINAL 3
496 /* YYLAST -- Last index in YYTABLE. */
497 #define YYLAST 271
498 
499 /* YYNTOKENS -- Number of terminals. */
500 #define YYNTOKENS 32
501 /* YYNNTS -- Number of nonterminals. */
502 #define YYNNTS 32
503 /* YYNRULES -- Number of rules. */
504 #define YYNRULES 96
505 /* YYNSTATES -- Number of states. */
506 #define YYNSTATES 223
507 
508 /* YYMAXUTOK -- Last valid token kind. */
509 #define YYMAXUTOK 276
510 
511 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
512  as returned by yylex, with out-of-bounds checking. */
513 #define YYTRANSLATE(YYX) \
514  (0 <= (YYX) && (YYX) <= YYMAXUTOK \
515  ? YY_CAST(yysymbol_kind_t, yytranslate[YYX]) \
516  : YYSYMBOL_YYUNDEF)
517 
518 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
519  as returned by yylex. */
520 static const yytype_int8 yytranslate[] = {
521  0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523  23, 24, 2, 2, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 22,
524  2, 29, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 2, 28, 2, 2, 2, 2, 2, 2,
526  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527  2, 2, 2, 30, 2, 31, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532  2, 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, 1, 2, 3, 4,
534  5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21};
535 
536 #if ORFZ_DEBUG
537 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
538 static const yytype_int16 yyrline[] = {
539  0, 103, 103, 110, 114, 115, 120, 123, 124, 127, 128, 129, 130, 133,
540  134, 137, 138, 145, 146, 149, 168, 183, 194, 209, 220, 246, 279, 349,
541  350, 353, 354, 355, 358, 362, 368, 369, 382, 400, 401, 402, 403, 410,
542  411, 412, 413, 420, 421, 428, 429, 430, 433, 434, 437, 438, 439, 444,
543  445, 448, 449, 450, 455, 456, 457, 462, 463, 467, 468, 474, 478, 484,
544  485, 488, 500, 501, 504, 505, 506, 507, 508, 513, 544, 561, 586, 595,
545  599, 602, 603, 606, 607, 608, 609, 619, 628, 634, 649, 657, 666};
546 #endif
547 
549 #define YY_ACCESSING_SYMBOL(State) YY_CAST(yysymbol_kind_t, yystos[State])
550 
551 #if 1
552 /* The user-facing name of the symbol whose (internal) number is
553  YYSYMBOL. No bounds checking. */
554 static const char* yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
555 
556 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
557  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
558 static const char* const yytname[] = {"\"end of file\"",
559  "error",
560  "\"invalid token\"",
561  "ARRAY",
562  "TOKEN_BOOL",
563  "CONSTRAINT",
564  "TOKEN_FLOAT",
565  "TOKEN_INT",
566  "MAXIMIZE",
567  "MINIMIZE",
568  "OF",
569  "PREDICATE",
570  "SATISFY",
571  "SET",
572  "SOLVE",
573  "VAR",
574  "DOTDOT",
575  "COLONCOLON",
576  "IVALUE",
577  "SVALUE",
578  "IDENTIFIER",
579  "DVALUE",
580  "';'",
581  "'('",
582  "')'",
583  "','",
584  "':'",
585  "'['",
586  "']'",
587  "'='",
588  "'{'",
589  "'}'",
590  "$accept",
591  "model",
592  "predicates",
593  "predicate",
594  "predicate_arguments",
595  "predicate_argument",
596  "predicate_array_argument",
597  "predicate_ints",
598  "variable_or_constant_declarations",
599  "variable_or_constant_declaration",
600  "optional_var_or_value",
601  "optional_var_or_value_array",
602  "var_or_value_array",
603  "var_or_value",
604  "int_domain",
605  "set_domain",
606  "float_domain",
607  "domain",
608  "integers",
609  "integer",
610  "floats",
611  "float",
612  "const_literal",
613  "const_literals",
614  "constraints",
615  "constraint",
616  "arguments",
617  "argument",
618  "annotations",
619  "annotation_arguments",
620  "annotation",
621  "solve",
622  YY_NULLPTR};
623 
624 static const char* yysymbol_name(yysymbol_kind_t yysymbol) {
625  return yytname[yysymbol];
626 }
627 #endif
628 
629 #ifdef YYPRINT
630 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
631  (internal) symbol number NUM (which must be that of a token). */
632 static const yytype_int16 yytoknum[] = {0, 256, 257, 258, 259, 260, 261, 262,
633  263, 264, 265, 266, 267, 268, 269, 270,
634  271, 272, 273, 274, 275, 276, 59, 40,
635  41, 44, 58, 91, 93, 61, 123, 125};
636 #endif
637 
638 #define YYPACT_NINF (-182)
639 
640 #define yypact_value_is_default(Yyn) ((Yyn) == YYPACT_NINF)
641 
642 #define YYTABLE_NINF (-19)
643 
644 #define yytable_value_is_error(Yyn) 0
645 
646 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
647  STATE-NUM. */
648 static const yytype_int16 yypact[] = {
649  -182, 49, 7, -182, -15, 67, 114, 20, -182, 95, -182, 99,
650  -182, -182, -182, 136, 76, 122, 141, 11, 154, -182, -182, -182,
651  143, 130, 40, 157, 12, 151, 160, 158, -182, 155, 118, -182,
652  -182, 161, 163, -182, 162, 164, 165, 76, 156, 166, 159, 171,
653  -182, -182, 172, 11, 169, -182, -182, 175, 11, -182, -182, 167,
654  125, -182, -182, 27, 168, -182, 40, 176, 177, 179, 120, -182,
655  170, -182, 22, 80, 80, 80, -182, 121, 174, 184, 173, -182,
656  182, -182, -182, 178, -182, -182, 59, -182, 75, 187, -182, 180,
657  -182, 93, 11, 131, -182, -182, -182, 188, -182, 96, 121, -182,
658  198, 190, 199, -182, 200, 150, -182, 195, 185, -182, 34, -182,
659  196, 197, -182, 186, -182, 31, -182, 128, -182, 80, 201, 121,
660  202, 84, -182, -182, -182, 56, 60, -182, 203, 204, -182, 129,
661  -182, 189, 205, 150, -182, -182, 207, -182, -182, 147, 206, 121,
662  -182, 76, 192, 76, 209, 210, 211, -182, 212, -182, -182, 213,
663  -182, -182, -182, -182, 216, 208, 217, 218, 219, 224, -182, -182,
664  225, -182, 226, -182, -182, -182, -182, -182, 74, 85, 87, 91,
665  220, 221, 222, 223, -182, 97, 75, 64, 104, -182, 133, -182,
666  137, 227, -182, -182, 138, -182, -182, 139, -182, 75, -182, 214,
667  153, -182, -182, -182, 228, -182, -182};
668 
669 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
670  Performed when YYTABLE does not specify something else to do. Zero
671  means the default is an error. */
672 static const yytype_int8 yydefact[] = {
673  5, 0, 0, 1, 0, 0, 0, 70, 4, 0, 3, 0, 37, 45, 38, 0, 0, 0, 0,
674  0, 0, 47, 48, 49, 0, 0, 0, 0, 0, 0, 0, 0, 52, 53, 0, 51, 17, 0,
675  0, 84, 0, 0, 0, 0, 0, 8, 0, 0, 41, 42, 0, 0, 0, 39, 46, 0, 0,
676  40, 84, 0, 0, 69, 2, 0, 0, 6, 0, 0, 0, 0, 0, 84, 0, 50, 0, 0,
677  0, 0, 94, 0, 16, 0, 0, 13, 0, 7, 9, 0, 43, 44, 28, 54, 0, 74, 76,
678  79, 75, 0, 0, 0, 73, 96, 95, 88, 89, 90, 0, 83, 0, 0, 0, 10, 0, 0,
679  25, 60, 65, 64, 0, 19, 0, 0, 34, 35, 82, 0, 33, 0, 84, 0, 0, 0, 0,
680  0, 86, 15, 14, 0, 0, 27, 0, 0, 63, 0, 77, 0, 0, 0, 81, 78, 71, 72,
681  87, 0, 0, 0, 93, 0, 0, 0, 0, 0, 0, 61, 0, 62, 80, 0, 32, 91, 92,
682  85, 0, 0, 0, 0, 0, 0, 66, 36, 0, 11, 0, 84, 84, 84, 12, 84, 0, 0,
683  0, 31, 0, 0, 0, 0, 26, 0, 0, 0, 0, 21, 0, 68, 0, 58, 57, 23, 0,
684  56, 30, 0, 20, 0, 24, 0, 0, 22, 29, 67, 0, 55, 59};
685 
686 /* YYPGOTO[NTERM-NUM]. */
687 static const yytype_int16 yypgoto[] = {
688  -182, -182, -182, -182, 191, -182, -182, 108, -182, -182, -182,
689  -182, 25, -107, 88, 89, 92, -7, -50, 215, -182, 13,
690  -181, -182, -182, -182, -182, -72, -56, 100, -76, -182};
691 
692 /* YYDEFGOTO[NTERM-NUM]. */
693 static const yytype_int16 yydefgoto[] = {
694  -1, 1, 2, 6, 44, 45, 82, 83, 7, 20, 114, 196, 125, 126, 21, 22,
695  23, 46, 34, 35, 208, 209, 119, 204, 25, 40, 99, 100, 60, 133, 134, 41};
696 
697 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
698  positive, shift that token. If negative, reduce the rule whose
699  number is the opposite. If YYTABLE_NINF, syntax error. */
700 static const yytype_int16 yytable[] = {
701  24, 70, 74, 107, 101, 102, 139, 8, 4, 29, -18, -18, -18, -18, -18,
702  90, 48, 203, 5, 49, -18, -18, -18, 11, 12, -18, 13, 14, -18, 32,
703  50, 33, 219, 15, 80, 16, 64, -18, 17, 79, 168, 18, 51, 42, 12,
704  81, 13, 14, 127, 3, 19, 92, 32, 15, 33, 43, 147, 151, 17, 148,
705  12, 18, 13, 14, 12, 142, 13, 14, 143, 15, 19, 157, 150, 15, 17,
706  159, 79, 18, 17, 171, 12, 18, 13, 14, 205, 206, 19, 9, 113, 15,
707  19, 79, 207, 115, 17, 116, 117, 18, 93, 94, 95, 96, 79, 192, 79,
708  118, 19, 97, 79, 155, 98, 122, 156, 123, 193, 32, 194, 33, 26, 131,
709  195, 124, 122, 132, 123, 201, 27, 188, 189, 190, 158, 191, 210, 76, 77,
710  38, 10, 78, 30, 103, 104, 105, 79, 56, 39, 56, 28, 202, 106, 57,
711  172, 89, 174, 56, 56, 128, 129, 31, 56, 149, 165, 212, 213, 216, 147,
712  214, 217, 218, 122, 37, 123, 169, 155, 205, 206, 47, 36, 52, 53, 54,
713  65, 58, 55, 59, 61, 67, 62, 68, 69, 71, 75, 66, 63, 72, 84,
714  87, 86, 88, 91, 108, 109, 110, 111, 120, 130, 80, 112, 121, 136, 137,
715  138, 140, 141, 146, 144, 145, 135, 166, 173, 152, 154, 163, 164, 167, 79,
716  211, 160, 161, 181, 221, 162, 153, 220, 0, 170, 175, 176, 177, 183, 184,
717  178, 179, 180, 182, 185, 186, 187, 197, 198, 199, 200, 0, 0, 0, 215,
718  0, 222, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
719  0, 73};
720 
721 static const yytype_int16 yycheck[] = {
722  7, 51, 58, 79, 76, 77, 113, 22, 1, 16, 3, 4, 5, 6, 7, 71,
723  4, 198, 11, 7, 13, 14, 15, 3, 4, 18, 6, 7, 21, 18, 18, 20,
724  213, 13, 7, 15, 43, 30, 18, 17, 147, 21, 30, 3, 4, 18, 6, 7,
725  98, 0, 30, 29, 18, 13, 20, 15, 25, 129, 18, 28, 4, 21, 6, 7,
726  4, 31, 6, 7, 118, 13, 30, 15, 128, 13, 18, 15, 17, 21, 18, 155,
727  4, 21, 6, 7, 20, 21, 30, 20, 29, 13, 30, 17, 28, 18, 18, 20,
728  21, 21, 18, 19, 20, 21, 17, 29, 17, 30, 30, 27, 17, 25, 30, 18,
729  28, 20, 29, 18, 29, 20, 23, 23, 29, 28, 18, 27, 20, 28, 27, 183,
730  184, 185, 137, 187, 28, 8, 9, 5, 22, 12, 16, 18, 19, 20, 17, 25,
731  14, 25, 10, 197, 27, 31, 157, 31, 159, 25, 25, 24, 25, 16, 25, 31,
732  31, 28, 25, 25, 25, 28, 28, 28, 18, 26, 20, 24, 25, 20, 21, 18,
733  22, 26, 18, 21, 24, 20, 27, 20, 22, 26, 22, 16, 16, 20, 23, 25,
734  27, 18, 26, 18, 20, 18, 28, 25, 16, 28, 20, 16, 16, 7, 28, 27,
735  18, 10, 10, 16, 27, 27, 18, 18, 108, 28, 26, 18, 18, 18, 18, 18,
736  17, 200, 138, 138, 20, 216, 138, 131, 18, -1, 28, 26, 26, 26, 20, 20,
737  28, 28, 26, 26, 20, 20, 20, 27, 27, 27, 27, -1, -1, -1, 27, -1,
738  28, 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56};
739 
740 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
741  symbol of state STATE-NUM. */
742 static const yytype_int8 yystos[] = {
743  0, 33, 34, 0, 1, 11, 35, 40, 22, 20, 22, 3, 4, 6, 7, 13, 15, 18, 21,
744  30, 41, 46, 47, 48, 49, 56, 23, 27, 10, 49, 16, 16, 18, 20, 50, 51, 22, 26,
745  5, 14, 57, 63, 3, 15, 36, 37, 49, 18, 4, 7, 18, 30, 26, 18, 21, 27, 25,
746  31, 20, 20, 60, 22, 22, 27, 49, 24, 25, 26, 16, 16, 50, 20, 18, 51, 60, 23,
747  8, 9, 12, 17, 7, 18, 38, 39, 26, 36, 20, 18, 18, 31, 60, 28, 29, 18, 19,
748  20, 21, 27, 30, 58, 59, 59, 59, 18, 19, 20, 27, 62, 25, 16, 28, 20, 28, 29,
749  42, 18, 20, 21, 30, 54, 16, 27, 18, 20, 28, 44, 45, 50, 24, 25, 16, 23, 27,
750  61, 62, 39, 18, 10, 10, 45, 16, 27, 31, 50, 18, 18, 27, 25, 28, 31, 60, 59,
751  18, 61, 18, 25, 28, 15, 49, 15, 46, 47, 48, 18, 18, 31, 28, 18, 45, 24, 28,
752  62, 49, 26, 49, 26, 26, 26, 28, 28, 26, 20, 26, 20, 20, 20, 20, 20, 60, 60,
753  60, 60, 29, 29, 29, 29, 43, 27, 27, 27, 27, 28, 50, 54, 55, 20, 21, 28, 52,
754  53, 28, 44, 28, 25, 28, 27, 25, 28, 28, 54, 18, 53, 28};
755 
756 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
757 static const yytype_int8 yyr1[] = {
758  0, 32, 33, 34, 34, 34, 35, 36, 36, 37, 37, 37, 37, 38, 38, 39, 39,
759  40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44,
760  45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 49, 49, 49, 50,
761  50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 55,
762  55, 56, 56, 57, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60,
763  61, 61, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63};
764 
765 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
766 static const yytype_int8 yyr2[] = {
767  0, 2, 5, 3, 3, 0, 5, 3, 1, 3, 4, 8, 9, 1, 3, 3, 1, 3, 0, 6,
768  15, 14, 15, 14, 15, 6, 13, 2, 0, 4, 3, 0, 3, 1, 1, 1, 4, 1, 1, 3,
769  3, 3, 3, 5, 5, 1, 3, 1, 1, 1, 3, 1, 1, 1, 4, 3, 1, 1, 1, 4,
770  1, 3, 3, 2, 1, 1, 4, 3, 1, 3, 0, 6, 3, 1, 1, 1, 1, 3, 3, 1,
771  4, 3, 2, 3, 0, 3, 1, 3, 1, 1, 1, 4, 4, 3, 3, 4, 4};
772 
773 enum { YYENOMEM = -2 };
774 
775 #define yyerrok (yyerrstatus = 0)
776 #define yyclearin (yychar = ORFZ_EMPTY)
777 
778 #define YYACCEPT goto yyacceptlab
779 #define YYABORT goto yyabortlab
780 #define YYERROR goto yyerrorlab
781 
782 #define YYRECOVERING() (!!yyerrstatus)
783 
784 #define YYBACKUP(Token, Value) \
785  do \
786  if (yychar == ORFZ_EMPTY) { \
787  yychar = (Token); \
788  yylval = (Value); \
789  YYPOPSTACK(yylen); \
790  yystate = *yyssp; \
791  goto yybackup; \
792  } else { \
793  yyerror(context, model, ok, scanner, \
794  YY_("syntax error: cannot back up")); \
795  YYERROR; \
796  } \
797  while (0)
798 
799 /* Backward compatibility with an undocumented macro.
800  Use ORFZ_error or ORFZ_UNDEF. */
801 #define YYERRCODE ORFZ_UNDEF
802 
803 /* Enable debugging if requested. */
804 #if ORFZ_DEBUG
805 
806 #ifndef YYFPRINTF
807 #include <stdio.h> /* INFRINGES ON USER NAME SPACE */
808 #define YYFPRINTF fprintf
809 #endif
810 
811 #define YYDPRINTF(Args) \
812  do { \
813  if (yydebug) YYFPRINTF Args; \
814  } while (0)
815 
816 /* This macro is provided for backward compatibility. */
817 #ifndef YY_LOCATION_PRINT
818 #define YY_LOCATION_PRINT(File, Loc) ((void)0)
819 #endif
820 
821 #define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
822  do { \
823  if (yydebug) { \
824  YYFPRINTF(stderr, "%s ", Title); \
825  yy_symbol_print(stderr, Kind, Value, context, model, ok, scanner); \
826  YYFPRINTF(stderr, "\n"); \
827  } \
828  } while (0)
829 
830 /*-----------------------------------.
831 | Print this symbol's value on YYO. |
832 `-----------------------------------*/
833 
835  FILE* yyo, yysymbol_kind_t yykind, YYSTYPE const* const yyvaluep,
837  operations_research::fz::Model* model, bool* ok, void* scanner) {
838  FILE* yyoutput = yyo;
839  YYUSE(yyoutput);
840  YYUSE(context);
841  YYUSE(model);
842  YYUSE(ok);
843  YYUSE(scanner);
844  if (!yyvaluep) return;
845 #ifdef YYPRINT
846  if (yykind < YYNTOKENS) YYPRINT(yyo, yytoknum[yykind], *yyvaluep);
847 #endif
849  YYUSE(yykind);
851 }
852 
853 /*---------------------------.
854 | Print this symbol on YYO. |
855 `---------------------------*/
856 
857 static void yy_symbol_print(FILE* yyo, yysymbol_kind_t yykind,
858  YYSTYPE const* const yyvaluep,
861  void* scanner) {
862  YYFPRINTF(yyo, "%s %s (", yykind < YYNTOKENS ? "token" : "nterm",
863  yysymbol_name(yykind));
864 
865  yy_symbol_value_print(yyo, yykind, yyvaluep, context, model, ok, scanner);
866  YYFPRINTF(yyo, ")");
867 }
868 
869 /*------------------------------------------------------------------.
870 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
871 | TOP (included). |
872 `------------------------------------------------------------------*/
873 
874 static void yy_stack_print(yy_state_t* yybottom, yy_state_t* yytop) {
875  YYFPRINTF(stderr, "Stack now");
876  for (; yybottom <= yytop; yybottom++) {
877  int yybot = *yybottom;
878  YYFPRINTF(stderr, " %d", yybot);
879  }
880  YYFPRINTF(stderr, "\n");
881 }
882 
883 #define YY_STACK_PRINT(Bottom, Top) \
884  do { \
885  if (yydebug) yy_stack_print((Bottom), (Top)); \
886  } while (0)
887 
888 /*------------------------------------------------.
889 | Report that the YYRULE is going to be reduced. |
890 `------------------------------------------------*/
891 
892 static void yy_reduce_print(yy_state_t* yyssp, YYSTYPE* yyvsp, int yyrule,
895  void* scanner) {
896  int yylno = yyrline[yyrule];
897  int yynrhs = yyr2[yyrule];
898  int yyi;
899  YYFPRINTF(stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1,
900  yylno);
901  /* The symbols being reduced. */
902  for (yyi = 0; yyi < yynrhs; yyi++) {
903  YYFPRINTF(stderr, " $%d = ", yyi + 1);
904  yy_symbol_print(stderr, YY_ACCESSING_SYMBOL(+yyssp[yyi + 1 - yynrhs]),
905  &yyvsp[(yyi + 1) - (yynrhs)], context, model, ok, scanner);
906  YYFPRINTF(stderr, "\n");
907  }
908 }
909 
910 #define YY_REDUCE_PRINT(Rule) \
911  do { \
912  if (yydebug) \
913  yy_reduce_print(yyssp, yyvsp, Rule, context, model, ok, scanner); \
914  } while (0)
915 
916 /* Nonzero means print parse trace. It is left uninitialized so that
917  multiple parsers can coexist. */
919 #else /* !ORFZ_DEBUG */
920 #define YYDPRINTF(Args) ((void)0)
921 #define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
922 #define YY_STACK_PRINT(Bottom, Top)
923 #define YY_REDUCE_PRINT(Rule)
924 #endif /* !ORFZ_DEBUG */
925 
926 /* YYINITDEPTH -- initial size of the parser's stacks. */
927 #ifndef YYINITDEPTH
928 #define YYINITDEPTH 200
929 #endif
930 
931 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
932  if the built-in stack extension method is used).
933 
934  Do not make this value too large; the results are undefined if
935  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
936  evaluated with infinite-precision integer arithmetic. */
937 
938 #ifndef YYMAXDEPTH
939 #define YYMAXDEPTH 10000
940 #endif
941 
942 /* Context of a parse error. */
943 typedef struct {
946 } yypcontext_t;
947 
948 /* Put in YYARG at most YYARGN of the expected tokens given the
949  current YYCTX, and return the number of tokens stored in YYARG. If
950  YYARG is null, return the number of expected tokens (guaranteed to
951  be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
952  Return 0 if there are more than YYARGN expected tokens, yet fill
953  YYARG up to YYARGN. */
954 static int yypcontext_expected_tokens(const yypcontext_t* yyctx,
955  yysymbol_kind_t yyarg[], int yyargn) {
956  /* Actual size of YYARG. */
957  int yycount = 0;
958  int yyn = yypact[+*yyctx->yyssp];
959  if (!yypact_value_is_default(yyn)) {
960  /* Start YYX at -YYN if negative to avoid negative indexes in
961  YYCHECK. In other words, skip the first -YYN actions for
962  this state because they are default actions. */
963  int yyxbegin = yyn < 0 ? -yyn : 0;
964  /* Stay within bounds of both yycheck and yytname. */
965  int yychecklim = YYLAST - yyn + 1;
966  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
967  int yyx;
968  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
969  if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror &&
970  !yytable_value_is_error(yytable[yyx + yyn])) {
971  if (!yyarg)
972  ++yycount;
973  else if (yycount == yyargn)
974  return 0;
975  else
976  yyarg[yycount++] = YY_CAST(yysymbol_kind_t, yyx);
977  }
978  }
979  if (yyarg && yycount == 0 && 0 < yyargn) yyarg[0] = YYSYMBOL_YYEMPTY;
980  return yycount;
981 }
982 
983 #ifndef yystrlen
984 #if defined __GLIBC__ && defined _STRING_H
985 #define yystrlen(S) (YY_CAST(YYPTRDIFF_T, strlen(S)))
986 #else
987 /* Return the length of YYSTR. */
988 static YYPTRDIFF_T yystrlen(const char* yystr) {
989  YYPTRDIFF_T yylen;
990  for (yylen = 0; yystr[yylen]; yylen++) continue;
991  return yylen;
992 }
993 #endif
994 #endif
995 
996 #ifndef yystpcpy
997 #if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
998 #define yystpcpy stpcpy
999 #else
1000 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1001  YYDEST. */
1002 static char* yystpcpy(char* yydest, const char* yysrc) {
1003  char* yyd = yydest;
1004  const char* yys = yysrc;
1005 
1006  while ((*yyd++ = *yys++) != '\0') continue;
1007 
1008  return yyd - 1;
1009 }
1010 #endif
1011 #endif
1012 
1013 #ifndef yytnamerr
1014 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1015  quotes and backslashes, so that it's suitable for yyerror. The
1016  heuristic is that double-quoting is unnecessary unless the string
1017  contains an apostrophe, a comma, or backslash (other than
1018  backslash-backslash). YYSTR is taken from yytname. If YYRES is
1019  null, do not copy; instead, return the length of what the result
1020  would have been. */
1021 static YYPTRDIFF_T yytnamerr(char* yyres, const char* yystr) {
1022  if (*yystr == '"') {
1023  YYPTRDIFF_T yyn = 0;
1024  char const* yyp = yystr;
1025  for (;;) switch (*++yyp) {
1026  case '\'':
1027  case ',':
1028  goto do_not_strip_quotes;
1029 
1030  case '\\':
1031  if (*++yyp != '\\')
1032  goto do_not_strip_quotes;
1033  else
1034  goto append;
1035 
1036  append:
1037  default:
1038  if (yyres) yyres[yyn] = *yyp;
1039  yyn++;
1040  break;
1041 
1042  case '"':
1043  if (yyres) yyres[yyn] = '\0';
1044  return yyn;
1045  }
1046  do_not_strip_quotes:;
1047  }
1048 
1049  if (yyres)
1050  return yystpcpy(yyres, yystr) - yyres;
1051  else
1052  return yystrlen(yystr);
1053 }
1054 #endif
1055 
1056 static int yy_syntax_error_arguments(const yypcontext_t* yyctx,
1057  yysymbol_kind_t yyarg[], int yyargn) {
1058  /* Actual size of YYARG. */
1059  int yycount = 0;
1060  /* There are many possibilities here to consider:
1061  - If this state is a consistent state with a default action, then
1062  the only way this function was invoked is if the default action
1063  is an error action. In that case, don't check for expected
1064  tokens because there are none.
1065  - The only way there can be no lookahead present (in yychar) is if
1066  this state is a consistent state with a default action. Thus,
1067  detecting the absence of a lookahead is sufficient to determine
1068  that there is no unexpected or expected token to report. In that
1069  case, just report a simple "syntax error".
1070  - Don't assume there isn't a lookahead just because this state is a
1071  consistent state with a default action. There might have been a
1072  previous inconsistent state, consistent state with a non-default
1073  action, or user semantic action that manipulated yychar.
1074  - Of course, the expected token list depends on states to have
1075  correct lookahead information, and it depends on the parser not
1076  to perform extra reductions after fetching a lookahead from the
1077  scanner and before detecting a syntax error. Thus, state merging
1078  (from LALR or IELR) and default reductions corrupt the expected
1079  token list. However, the list is correct for canonical LR with
1080  one exception: it will still contain any token that will not be
1081  accepted due to an error action in a later state.
1082  */
1083  if (yyctx->yytoken != YYSYMBOL_YYEMPTY) {
1084  int yyn;
1085  if (yyarg) yyarg[yycount] = yyctx->yytoken;
1086  ++yycount;
1087  yyn = yypcontext_expected_tokens(yyctx, yyarg ? yyarg + 1 : yyarg,
1088  yyargn - 1);
1089  if (yyn == YYENOMEM)
1090  return YYENOMEM;
1091  else
1092  yycount += yyn;
1093  }
1094  return yycount;
1095 }
1096 
1097 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1098  about the unexpected token YYTOKEN for the state stack whose top is
1099  YYSSP.
1100 
1101  Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
1102  not large enough to hold the message. In that case, also set
1103  *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
1104  required number of bytes is too large to store. */
1105 static int yysyntax_error(YYPTRDIFF_T* yymsg_alloc, char** yymsg,
1106  const yypcontext_t* yyctx) {
1107  enum { YYARGS_MAX = 5 };
1108  /* Internationalized format string. */
1109  const char* yyformat = YY_NULLPTR;
1110  /* Arguments of yyformat: reported tokens (one for the "unexpected",
1111  one per "expected"). */
1112  yysymbol_kind_t yyarg[YYARGS_MAX];
1113  /* Cumulated lengths of YYARG. */
1114  YYPTRDIFF_T yysize = 0;
1115 
1116  /* Actual size of YYARG. */
1117  int yycount = yy_syntax_error_arguments(yyctx, yyarg, YYARGS_MAX);
1118  if (yycount == YYENOMEM) return YYENOMEM;
1119 
1120  switch (yycount) {
1121 #define YYCASE_(N, S) \
1122  case N: \
1123  yyformat = S; \
1124  break
1125  default: /* Avoid compiler warnings. */
1126  YYCASE_(0, YY_("syntax error"));
1127  YYCASE_(1, YY_("syntax error, unexpected %s"));
1128  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1129  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1130  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1131  YYCASE_(
1132  5,
1133  YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1134 #undef YYCASE_
1135  }
1136 
1137  /* Compute error message size. Don't count the "%s"s, but reserve
1138  room for the terminator. */
1139  yysize = yystrlen(yyformat) - 2 * yycount + 1;
1140  {
1141  int yyi;
1142  for (yyi = 0; yyi < yycount; ++yyi) {
1143  YYPTRDIFF_T yysize1 = yysize + yytnamerr(YY_NULLPTR, yytname[yyarg[yyi]]);
1144  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1145  yysize = yysize1;
1146  else
1147  return YYENOMEM;
1148  }
1149  }
1150 
1151  if (*yymsg_alloc < yysize) {
1152  *yymsg_alloc = 2 * yysize;
1153  if (!(yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1154  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1155  return -1;
1156  }
1157 
1158  /* Avoid sprintf, as that infringes on the user's name space.
1159  Don't have undefined behavior even if the translation
1160  produced a string with the wrong number of "%s"s. */
1161  {
1162  char* yyp = *yymsg;
1163  int yyi = 0;
1164  while ((*yyp = *yyformat) != '\0')
1165  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) {
1166  yyp += yytnamerr(yyp, yytname[yyarg[yyi++]]);
1167  yyformat += 2;
1168  } else {
1169  ++yyp;
1170  ++yyformat;
1171  }
1172  }
1173  return 0;
1174 }
1175 
1176 /*-----------------------------------------------.
1177 | Release the memory associated to this symbol. |
1178 `-----------------------------------------------*/
1179 
1180 static void yydestruct(const char* yymsg, yysymbol_kind_t yykind,
1181  YYSTYPE* yyvaluep,
1184  void* scanner) {
1185  YYUSE(yyvaluep);
1186  YYUSE(context);
1187  YYUSE(model);
1188  YYUSE(ok);
1189  YYUSE(scanner);
1190  if (!yymsg) yymsg = "Deleting";
1191  YY_SYMBOL_PRINT(yymsg, yykind, yyvaluep, yylocationp);
1192 
1194  YYUSE(yykind);
1196 }
1197 
1198 /*----------.
1199 | yyparse. |
1200 `----------*/
1201 
1203  operations_research::fz::Model* model, bool* ok, void* scanner) {
1204  /* Lookahead token kind. */
1205  int yychar;
1206 
1207  /* The semantic value of the lookahead symbol. */
1208  /* Default value used for initialization, for pacifying older GCCs
1209  or non-GCC compilers. */
1210  YY_INITIAL_VALUE(static YYSTYPE yyval_default;)
1211  YYSTYPE yylval YY_INITIAL_VALUE(= yyval_default);
1212 
1213  /* Number of syntax errors so far. */
1214  int yynerrs = 0;
1215 
1216  yy_state_fast_t yystate = 0;
1217  /* Number of tokens to shift before error messages enabled. */
1218  int yyerrstatus = 0;
1219 
1220  /* Refer to the stacks through separate pointers, to allow yyoverflow
1221  to reallocate them elsewhere. */
1222 
1223  /* Their size. */
1224  YYPTRDIFF_T yystacksize = YYINITDEPTH;
1225 
1226  /* The state stack: array, bottom, top. */
1227  yy_state_t yyssa[YYINITDEPTH];
1228  yy_state_t* yyss = yyssa;
1229  yy_state_t* yyssp = yyss;
1230 
1231  /* The semantic value stack: array, bottom, top. */
1232  YYSTYPE yyvsa[YYINITDEPTH];
1233  YYSTYPE* yyvs = yyvsa;
1234  YYSTYPE* yyvsp = yyvs;
1235 
1236  int yyn;
1237  /* The return value of yyparse. */
1238  int yyresult;
1239  /* Lookahead symbol kind. */
1241  /* The variables used to return semantic value and location from the
1242  action routines. */
1243  YYSTYPE yyval;
1244 
1245  /* Buffer for error messages, and its allocated size. */
1246  char yymsgbuf[128];
1247  char* yymsg = yymsgbuf;
1248  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1249 
1250 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1251 
1252  /* The number of symbols on the RHS of the reduced rule.
1253  Keep to zero when no symbol should be popped. */
1254  int yylen = 0;
1255 
1256  YYDPRINTF((stderr, "Starting parse\n"));
1257 
1258  yychar = ORFZ_EMPTY; /* Cause a token to be read. */
1259  goto yysetstate;
1260 
1261 /*------------------------------------------------------------.
1262 | yynewstate -- push a new state, which is found in yystate. |
1263 `------------------------------------------------------------*/
1264 yynewstate:
1265  /* In all cases, when you get here, the value and location stacks
1266  have just been pushed. So pushing a state here evens the stacks. */
1267  yyssp++;
1268 
1269 /*--------------------------------------------------------------------.
1270 | yysetstate -- set current state (the top of the stack) to yystate. |
1271 `--------------------------------------------------------------------*/
1272 yysetstate:
1273  YYDPRINTF((stderr, "Entering state %d\n", yystate));
1274  YY_ASSERT(0 <= yystate && yystate < YYNSTATES);
1276  *yyssp = YY_CAST(yy_state_t, yystate);
1278  YY_STACK_PRINT(yyss, yyssp);
1279 
1280  if (yyss + yystacksize - 1 <= yyssp)
1281 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1282  goto yyexhaustedlab;
1283 #else
1284  {
1285  /* Get the current used size of the three stacks, in elements. */
1286  YYPTRDIFF_T yysize = yyssp - yyss + 1;
1287 
1288 #if defined yyoverflow
1289  {
1290  /* Give user a chance to reallocate the stack. Use copies of
1291  these so that the &'s don't force the real ones into
1292  memory. */
1293  yy_state_t* yyss1 = yyss;
1294  YYSTYPE* yyvs1 = yyvs;
1295 
1296  /* Each stack pointer address is followed by the size of the
1297  data in use in that stack, in bytes. This used to be a
1298  conditional around just the two extra args, but that might
1299  be undefined if yyoverflow is a macro. */
1300  yyoverflow(YY_("memory exhausted"), &yyss1, yysize * YYSIZEOF(*yyssp),
1301  &yyvs1, yysize * YYSIZEOF(*yyvsp), &yystacksize);
1302  yyss = yyss1;
1303  yyvs = yyvs1;
1304  }
1305 #else /* defined YYSTACK_RELOCATE */
1306  /* Extend the stack our own way. */
1307  if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab;
1308  yystacksize *= 2;
1309  if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH;
1310 
1311  {
1312  yy_state_t* yyss1 = yyss;
1313  union yyalloc* yyptr =
1314  YY_CAST(union yyalloc*,
1315  YYSTACK_ALLOC(YY_CAST(YYSIZE_T, YYSTACK_BYTES(yystacksize))));
1316  if (!yyptr) goto yyexhaustedlab;
1319 #undef YYSTACK_RELOCATE
1320  if (yyss1 != yyssa) YYSTACK_FREE(yyss1);
1321  }
1322 #endif
1323 
1324  yyssp = yyss + yysize - 1;
1325  yyvsp = yyvs + yysize - 1;
1326 
1328  YYDPRINTF(
1329  (stderr, "Stack size increased to %ld\n", YY_CAST(long, yystacksize)));
1331 
1332  if (yyss + yystacksize - 1 <= yyssp) YYABORT;
1333  }
1334 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1335 
1336  if (yystate == YYFINAL) YYACCEPT;
1337 
1338  goto yybackup;
1339 
1340 /*-----------.
1341 | yybackup. |
1342 `-----------*/
1343 yybackup:
1344  /* Do appropriate processing given the current state. Read a
1345  lookahead token if we need one and don't already have one. */
1346 
1347  /* First try to decide what to do without reference to lookahead token. */
1348  yyn = yypact[yystate];
1349  if (yypact_value_is_default(yyn)) goto yydefault;
1350 
1351  /* Not known => get a lookahead token if don't already have one. */
1352 
1353  /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1354  if (yychar == ORFZ_EMPTY) {
1355  YYDPRINTF((stderr, "Reading a token\n"));
1356  yychar = yylex(&yylval, scanner);
1357  }
1358 
1359  if (yychar <= ORFZ_EOF) {
1360  yychar = ORFZ_EOF;
1361  yytoken = YYSYMBOL_YYEOF;
1362  YYDPRINTF((stderr, "Now at end of input.\n"));
1363  } else if (yychar == ORFZ_error) {
1364  /* The scanner already issued an error message, process directly
1365  to error recovery. But do not keep the error token as
1366  lookahead, it is too special and may lead us to an endless
1367  loop in error recovery. */
1368  yychar = ORFZ_UNDEF;
1369  yytoken = YYSYMBOL_YYerror;
1370  goto yyerrlab1;
1371  } else {
1372  yytoken = YYTRANSLATE(yychar);
1373  YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc);
1374  }
1375 
1376  /* If the proper action on seeing token YYTOKEN is to reduce or to
1377  detect an error, take that action. */
1378  yyn += yytoken;
1379  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault;
1380  yyn = yytable[yyn];
1381  if (yyn <= 0) {
1382  if (yytable_value_is_error(yyn)) goto yyerrlab;
1383  yyn = -yyn;
1384  goto yyreduce;
1385  }
1386 
1387  /* Count tokens shifted since error; after three, turn off error
1388  status. */
1389  if (yyerrstatus) yyerrstatus--;
1390 
1391  /* Shift the lookahead token. */
1392  YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc);
1393  yystate = yyn;
1395  *++yyvsp = yylval;
1397 
1398  /* Discard the shifted token. */
1399  yychar = ORFZ_EMPTY;
1400  goto yynewstate;
1401 
1402 /*-----------------------------------------------------------.
1403 | yydefault -- do the default action for the current state. |
1404 `-----------------------------------------------------------*/
1405 yydefault:
1406  yyn = yydefact[yystate];
1407  if (yyn == 0) goto yyerrlab;
1408  goto yyreduce;
1409 
1410 /*-----------------------------.
1411 | yyreduce -- do a reduction. |
1412 `-----------------------------*/
1413 yyreduce:
1414  /* yyn is the number of a rule to reduce with. */
1415  yylen = yyr2[yyn];
1416 
1417  /* If YYLEN is nonzero, implement the default value of the action:
1418  '$$ = $1'.
1419 
1420  Otherwise, the following line sets YYVAL to garbage.
1421  This behavior is undocumented and Bison
1422  users should not rely upon it. Assigning to YYVAL
1423  unconditionally makes the parser a bit smaller, and it avoids a
1424  GCC warning that YYVAL may be used uninitialized. */
1425  yyval = yyvsp[1 - yylen];
1426 
1427  YY_REDUCE_PRINT(yyn);
1428  switch (yyn) {
1429  case 4: /* predicates: predicates error ';' */
1430 #line 114 "./ortools/flatzinc/parser.yy"
1431  {
1432  yyerrok;
1433  }
1434 #line 1581 "./ortools/flatzinc/parser.tab.cc"
1435  break;
1436 
1437  case 19: /* variable_or_constant_declaration: domain ':' IDENTIFIER
1438  annotations '=' const_literal */
1439 #line 149 "./ortools/flatzinc/parser.yy"
1440  {
1441  // Declaration of a (named) constant: we simply register it in the
1442  // parser's context, and don't store it in the model.
1443  const Domain& domain = (yyvsp[-5].domain);
1444  const std::string& identifier = (yyvsp[-3].string_value);
1445  const Domain& assignment = (yyvsp[0].domain);
1446  std::vector<Annotation>* const annotations = (yyvsp[-2].annotations);
1447 
1448  if (!assignment.HasOneValue()) {
1449  // TODO(lperron): Check that the assignment is included in the domain.
1450  context->domain_map[identifier] = assignment;
1451  } else {
1452  const int64 value = assignment.values.front();
1453  CHECK(domain.Contains(value));
1454  context->integer_map[identifier] = value;
1455  }
1456  delete annotations;
1457  }
1458 #line 1605 "./ortools/flatzinc/parser.tab.cc"
1459  break;
1460 
1461  case 20: /* variable_or_constant_declaration: ARRAY '[' IVALUE DOTDOT IVALUE
1462  ']' OF int_domain ':' IDENTIFIER annotations '=' '[' integers
1463  ']' */
1464 #line 169 "./ortools/flatzinc/parser.yy"
1465  {
1466  std::vector<Annotation>* const annotations = (yyvsp[-4].annotations);
1467  // Declaration of a (named) constant array. See rule right above.
1468  CHECK_EQ((yyvsp[-12].integer_value), 1)
1469  << "Only [1..n] array are supported here.";
1470  const int64 num_constants = (yyvsp[-10].integer_value);
1471  const std::string& identifier = (yyvsp[-5].string_value);
1472  const std::vector<int64>* const assignments = (yyvsp[-1].integers);
1473  CHECK(assignments != nullptr);
1474  CHECK_EQ(num_constants, assignments->size());
1475  // TODO(lperron): CHECK all values within domain.
1476  context->integer_array_map[identifier] = *assignments;
1477  delete assignments;
1478  delete annotations;
1479  }
1480 #line 1624 "./ortools/flatzinc/parser.tab.cc"
1481  break;
1482 
1483  case 21: /* variable_or_constant_declaration: ARRAY '[' IVALUE DOTDOT IVALUE
1484  ']' OF int_domain ':' IDENTIFIER annotations '=' '[' ']' */
1485 #line 184 "./ortools/flatzinc/parser.yy"
1486  {
1487  std::vector<Annotation>* const annotations = (yyvsp[-3].annotations);
1488  // Declaration of a (named) constant array. See rule right above.
1489  CHECK_EQ((yyvsp[-11].integer_value), 1)
1490  << "Only [1..n] array are supported here.";
1491  const int64 num_constants = (yyvsp[-9].integer_value);
1492  CHECK_EQ(num_constants, 0) << "Empty arrays should have a size of 0";
1493  const std::string& identifier = (yyvsp[-4].string_value);
1494  context->integer_array_map[identifier] = std::vector<int64>();
1495  delete annotations;
1496  }
1497 #line 1639 "./ortools/flatzinc/parser.tab.cc"
1498  break;
1499 
1500  case 22: /* variable_or_constant_declaration: ARRAY '[' IVALUE DOTDOT IVALUE
1501  ']' OF float_domain ':' IDENTIFIER annotations '=' '[' floats
1502  ']' */
1503 #line 195 "./ortools/flatzinc/parser.yy"
1504  {
1505  std::vector<Annotation>* const annotations = (yyvsp[-4].annotations);
1506  // Declaration of a (named) constant array. See rule right above.
1507  CHECK_EQ((yyvsp[-12].integer_value), 1)
1508  << "Only [1..n] array are supported here.";
1509  const int64 num_constants = (yyvsp[-10].integer_value);
1510  const std::string& identifier = (yyvsp[-5].string_value);
1511  const std::vector<double>* const assignments = (yyvsp[-1].doubles);
1512  CHECK(assignments != nullptr);
1513  CHECK_EQ(num_constants, assignments->size());
1514  // TODO(lperron): CHECK all values within domain.
1515  context->float_array_map[identifier] = *assignments;
1516  delete assignments;
1517  delete annotations;
1518  }
1519 #line 1658 "./ortools/flatzinc/parser.tab.cc"
1520  break;
1521 
1522  case 23: /* variable_or_constant_declaration: ARRAY '[' IVALUE DOTDOT IVALUE
1523  ']' OF float_domain ':' IDENTIFIER annotations '=' '[' ']' */
1524 #line 210 "./ortools/flatzinc/parser.yy"
1525  {
1526  std::vector<Annotation>* const annotations = (yyvsp[-3].annotations);
1527  // Declaration of a (named) constant array. See rule right above.
1528  CHECK_EQ((yyvsp[-11].integer_value), 1)
1529  << "Only [1..n] array are supported here.";
1530  const int64 num_constants = (yyvsp[-9].integer_value);
1531  CHECK_EQ(num_constants, 0) << "Empty arrays should have a size of 0";
1532  const std::string& identifier = (yyvsp[-4].string_value);
1533  context->float_array_map[identifier] = std::vector<double>();
1534  delete annotations;
1535  }
1536 #line 1673 "./ortools/flatzinc/parser.tab.cc"
1537  break;
1538 
1539  case 24: /* variable_or_constant_declaration: ARRAY '[' IVALUE DOTDOT IVALUE
1540  ']' OF set_domain ':' IDENTIFIER annotations '=' '['
1541  const_literals ']' */
1542 #line 221 "./ortools/flatzinc/parser.yy"
1543  {
1544  // Declaration of a (named) constant array: See rule above.
1545  CHECK_EQ((yyvsp[-12].integer_value), 1)
1546  << "Only [1..n] array are supported here.";
1547  const int64 num_constants = (yyvsp[-10].integer_value);
1548  const Domain& domain = (yyvsp[-7].domain);
1549  const std::string& identifier = (yyvsp[-5].string_value);
1550  const std::vector<Domain>* const assignments = (yyvsp[-1].domains);
1551  const std::vector<Annotation>* const annotations =
1552  (yyvsp[-4].annotations);
1553  CHECK(assignments != nullptr);
1554  CHECK_EQ(num_constants, assignments->size());
1555 
1556  if (!AllDomainsHaveOneValue(*assignments)) {
1557  context->domain_array_map[identifier] = *assignments;
1558  // TODO(lperron): check that all assignments are included in the domain.
1559  } else {
1560  std::vector<int64> values(num_constants);
1561  for (int i = 0; i < num_constants; ++i) {
1562  values[i] = (*assignments)[i].values.front();
1563  CHECK(domain.Contains(values[i]));
1564  }
1565  context->integer_array_map[identifier] = values;
1566  }
1567  delete assignments;
1568  delete annotations;
1569  }
1570 #line 1703 "./ortools/flatzinc/parser.tab.cc"
1571  break;
1572 
1573  case 25: /* variable_or_constant_declaration: VAR domain ':' IDENTIFIER
1574  annotations optional_var_or_value */
1575 #line 246 "./ortools/flatzinc/parser.yy"
1576  {
1577  // Declaration of a variable. If it's unassigned or assigned to a
1578  // constant, we'll create a new var stored in the model. If it's
1579  // assigned to another variable x then we simply adjust that
1580  // existing variable x according to the current (re-)declaration.
1581  const Domain& domain = (yyvsp[-4].domain);
1582  const std::string& identifier = (yyvsp[-2].string_value);
1583  std::vector<Annotation>* const annotations = (yyvsp[-1].annotations);
1584  const VariableRefOrValue& assignment = (yyvsp[0].var_or_value);
1585  const bool introduced = ContainsId(annotations, "var_is_introduced") ||
1586  absl::StartsWith(identifier, "X_INTRODUCED");
1587  IntegerVariable* var = nullptr;
1588  if (!assignment.defined) {
1589  var = model->AddVariable(identifier, domain, introduced);
1590  } else if (assignment.variable == nullptr) { // just an integer constant.
1591  CHECK(domain.Contains(assignment.value));
1592  var = model->AddVariable(
1593  identifier, Domain::IntegerValue(assignment.value), introduced);
1594  } else { // a variable.
1595  var = assignment.variable;
1596  var->Merge(identifier, domain, introduced);
1597  }
1598 
1599  // We also register the variable in the parser's context, and add some
1600  // output to the model if needed.
1601  context->variable_map[identifier] = var;
1602  if (ContainsId(annotations, "output_var")) {
1603  model->AddOutput(SolutionOutputSpecs::SingleVariable(
1604  identifier, var, domain.display_as_boolean));
1605  }
1606  delete annotations;
1607  }
1608 #line 1741 "./ortools/flatzinc/parser.tab.cc"
1609  break;
1610 
1611  case 26: /* variable_or_constant_declaration: ARRAY '[' IVALUE DOTDOT IVALUE
1612  ']' OF VAR domain ':' IDENTIFIER annotations
1613  optional_var_or_value_array */
1614 #line 280 "./ortools/flatzinc/parser.yy"
1615  {
1616  // Declaration of a "variable array": these is exactly like N simple
1617  // variable declarations, where the identifier for declaration #i is
1618  // IDENTIFIER[i] (1-based index).
1619  CHECK_EQ((yyvsp[-10].integer_value), 1);
1620  const int64 num_vars = (yyvsp[-8].integer_value);
1621  const Domain& domain = (yyvsp[-4].domain);
1622  const std::string& identifier = (yyvsp[-2].string_value);
1623  std::vector<Annotation>* const annotations = (yyvsp[-1].annotations);
1624  VariableRefOrValueArray* const assignments =
1625  (yyvsp[0].var_or_value_array);
1626  CHECK(assignments == nullptr ||
1627  assignments->variables.size() == num_vars);
1628  CHECK(assignments == nullptr || assignments->values.size() == num_vars);
1629  const bool introduced = ContainsId(annotations, "var_is_introduced") ||
1630  absl::StartsWith(identifier, "X_INTRODUCED");
1631 
1632  std::vector<IntegerVariable*> vars(num_vars, nullptr);
1633 
1634  for (int i = 0; i < num_vars; ++i) {
1635  const std::string var_name =
1636  absl::StrFormat("%s[%d]", identifier, i + 1);
1637  if (assignments == nullptr) {
1638  vars[i] = model->AddVariable(var_name, domain, introduced);
1639  } else if (assignments->variables[i] == nullptr) {
1640  // Assigned to an integer constant.
1641  const int64 value = assignments->values[i];
1642  CHECK(domain.Contains(value));
1643  vars[i] = model->AddVariable(var_name, Domain::IntegerValue(value),
1644  introduced);
1645  } else {
1646  IntegerVariable* const var = assignments->variables[i];
1647  CHECK(var != nullptr);
1648  vars[i] = var;
1649  vars[i]->Merge(var_name, domain, introduced);
1650  }
1651  }
1652  delete assignments;
1653 
1654  // Register the variable array on the context.
1655  context->variable_array_map[identifier] = vars;
1656 
1657  // We parse the annotations to build an output object if
1658  // needed. It's a bit more convoluted than the simple variable
1659  // output.
1660  if (annotations != nullptr) {
1661  for (int i = 0; i < annotations->size(); ++i) {
1662  const Annotation& ann = (*annotations)[i];
1663  if (ann.IsFunctionCallWithIdentifier("output_array")) {
1664  // We have found an output annotation.
1665  CHECK_EQ(1, ann.annotations.size());
1666  CHECK_EQ(Annotation::ANNOTATION_LIST, ann.annotations.back().type);
1667  const Annotation& list = ann.annotations.back();
1668  // Let's build the vector of bounds.
1669  std::vector<SolutionOutputSpecs::Bounds> bounds;
1670  for (int a = 0; a < list.annotations.size(); ++a) {
1671  const Annotation& bound = list.annotations[a];
1672  CHECK_EQ(Annotation::INTERVAL, bound.type);
1673  bounds.emplace_back(SolutionOutputSpecs::Bounds(
1674  bound.interval_min, bound.interval_max));
1675  }
1676  // We add the output information.
1677  model->AddOutput(SolutionOutputSpecs::MultiDimensionalArray(
1678  identifier, bounds, vars, domain.display_as_boolean));
1679  }
1680  }
1681  delete annotations;
1682  }
1683  }
1684 #line 1813 "./ortools/flatzinc/parser.tab.cc"
1685  break;
1686 
1687  case 27: /* optional_var_or_value: '=' var_or_value */
1688 #line 349 "./ortools/flatzinc/parser.yy"
1689  {
1690  (yyval.var_or_value) = (yyvsp[0].var_or_value);
1691  }
1692 #line 1819 "./ortools/flatzinc/parser.tab.cc"
1693  break;
1694 
1695  case 28: /* optional_var_or_value: %empty */
1696 #line 350 "./ortools/flatzinc/parser.yy"
1697  {
1698  (yyval.var_or_value) = VariableRefOrValue::Undefined();
1699  }
1700 #line 1825 "./ortools/flatzinc/parser.tab.cc"
1701  break;
1702 
1703  case 29: /* optional_var_or_value_array: '=' '[' var_or_value_array ']' */
1704 #line 353 "./ortools/flatzinc/parser.yy"
1705  {
1706  (yyval.var_or_value_array) = (yyvsp[-1].var_or_value_array);
1707  }
1708 #line 1831 "./ortools/flatzinc/parser.tab.cc"
1709  break;
1710 
1711  case 30: /* optional_var_or_value_array: '=' '[' ']' */
1712 #line 354 "./ortools/flatzinc/parser.yy"
1713  {
1714  (yyval.var_or_value_array) = nullptr;
1715  }
1716 #line 1837 "./ortools/flatzinc/parser.tab.cc"
1717  break;
1718 
1719  case 31: /* optional_var_or_value_array: %empty */
1720 #line 355 "./ortools/flatzinc/parser.yy"
1721  {
1722  (yyval.var_or_value_array) = nullptr;
1723  }
1724 #line 1843 "./ortools/flatzinc/parser.tab.cc"
1725  break;
1726 
1727  case 32: /* var_or_value_array: var_or_value_array ',' var_or_value */
1728 #line 358 "./ortools/flatzinc/parser.yy"
1729  {
1730  (yyval.var_or_value_array) = (yyvsp[-2].var_or_value_array);
1731  (yyval.var_or_value_array)->PushBack((yyvsp[0].var_or_value));
1732  }
1733 #line 1852 "./ortools/flatzinc/parser.tab.cc"
1734  break;
1735 
1736  case 33: /* var_or_value_array: var_or_value */
1737 #line 362 "./ortools/flatzinc/parser.yy"
1738  {
1739  (yyval.var_or_value_array) = new VariableRefOrValueArray();
1740  (yyval.var_or_value_array)->PushBack((yyvsp[0].var_or_value));
1741  }
1742 #line 1861 "./ortools/flatzinc/parser.tab.cc"
1743  break;
1744 
1745  case 34: /* var_or_value: IVALUE */
1746 #line 368 "./ortools/flatzinc/parser.yy"
1747  {
1748  (yyval.var_or_value) =
1749  VariableRefOrValue::Value((yyvsp[0].integer_value));
1750  }
1751 #line 1867 "./ortools/flatzinc/parser.tab.cc"
1752  break;
1753 
1754  case 35: /* var_or_value: IDENTIFIER */
1755 #line 369 "./ortools/flatzinc/parser.yy"
1756  {
1757  // A reference to an existing integer constant or variable.
1758  const std::string& id = (yyvsp[0].string_value);
1759  if (gtl::ContainsKey(context->integer_map, id)) {
1760  (yyval.var_or_value) =
1762  } else if (gtl::ContainsKey(context->variable_map, id)) {
1763  (yyval.var_or_value) = VariableRefOrValue::VariableRef(
1764  gtl::FindOrDie(context->variable_map, id));
1765  } else {
1766  LOG(ERROR) << "Unknown symbol " << id;
1767  (yyval.var_or_value) = VariableRefOrValue::Undefined();
1768  *ok = false;
1769  }
1770  }
1771 #line 1885 "./ortools/flatzinc/parser.tab.cc"
1772  break;
1773 
1774  case 36: /* var_or_value: IDENTIFIER '[' IVALUE ']' */
1775 #line 382 "./ortools/flatzinc/parser.yy"
1776  {
1777  // A given element of an existing constant array or variable array.
1778  const std::string& id = (yyvsp[-3].string_value);
1779  const int64 value = (yyvsp[-1].integer_value);
1780  if (gtl::ContainsKey(context->integer_array_map, id)) {
1781  (yyval.var_or_value) = VariableRefOrValue::Value(
1782  Lookup(gtl::FindOrDie(context->integer_array_map, id), value));
1783  } else if (gtl::ContainsKey(context->variable_array_map, id)) {
1784  (yyval.var_or_value) = VariableRefOrValue::VariableRef(
1785  Lookup(gtl::FindOrDie(context->variable_array_map, id), value));
1786  } else {
1787  LOG(ERROR) << "Unknown symbol " << id;
1788  (yyval.var_or_value) = VariableRefOrValue::Undefined();
1789  *ok = false;
1790  }
1791  }
1792 #line 1906 "./ortools/flatzinc/parser.tab.cc"
1793  break;
1794 
1795  case 37: /* int_domain: TOKEN_BOOL */
1796 #line 400 "./ortools/flatzinc/parser.yy"
1797  {
1798  (yyval.domain) = Domain::Boolean();
1799  }
1800 #line 1912 "./ortools/flatzinc/parser.tab.cc"
1801  break;
1802 
1803  case 38: /* int_domain: TOKEN_INT */
1804 #line 401 "./ortools/flatzinc/parser.yy"
1805  {
1806  (yyval.domain) = Domain::AllInt64();
1807  }
1808 #line 1918 "./ortools/flatzinc/parser.tab.cc"
1809  break;
1810 
1811  case 39: /* int_domain: IVALUE DOTDOT IVALUE */
1812 #line 402 "./ortools/flatzinc/parser.yy"
1813  {
1814  (yyval.domain) =
1815  Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value));
1816  }
1817 #line 1924 "./ortools/flatzinc/parser.tab.cc"
1818  break;
1819 
1820  case 40: /* int_domain: '{' integers '}' */
1821 #line 403 "./ortools/flatzinc/parser.yy"
1822  {
1823  CHECK((yyvsp[-1].integers) != nullptr);
1824  (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers)));
1825  delete (yyvsp[-1].integers);
1826  }
1827 #line 1934 "./ortools/flatzinc/parser.tab.cc"
1828  break;
1829 
1830  case 41: /* set_domain: SET OF TOKEN_BOOL */
1831 #line 410 "./ortools/flatzinc/parser.yy"
1832  {
1833  (yyval.domain) = Domain::SetOfBoolean();
1834  }
1835 #line 1940 "./ortools/flatzinc/parser.tab.cc"
1836  break;
1837 
1838  case 42: /* set_domain: SET OF TOKEN_INT */
1839 #line 411 "./ortools/flatzinc/parser.yy"
1840  {
1841  (yyval.domain) = Domain::SetOfAllInt64();
1842  }
1843 #line 1946 "./ortools/flatzinc/parser.tab.cc"
1844  break;
1845 
1846  case 43: /* set_domain: SET OF IVALUE DOTDOT IVALUE */
1847 #line 412 "./ortools/flatzinc/parser.yy"
1848  {
1849  (yyval.domain) = Domain::SetOfInterval((yyvsp[-2].integer_value),
1850  (yyvsp[0].integer_value));
1851  }
1852 #line 1952 "./ortools/flatzinc/parser.tab.cc"
1853  break;
1854 
1855  case 44: /* set_domain: SET OF '{' integers '}' */
1856 #line 413 "./ortools/flatzinc/parser.yy"
1857  {
1858  CHECK((yyvsp[-1].integers) != nullptr);
1859  (yyval.domain) =
1860  Domain::SetOfIntegerList(std::move(*(yyvsp[-1].integers)));
1861  delete (yyvsp[-1].integers);
1862  }
1863 #line 1962 "./ortools/flatzinc/parser.tab.cc"
1864  break;
1865 
1866  case 45: /* float_domain: TOKEN_FLOAT */
1867 #line 420 "./ortools/flatzinc/parser.yy"
1868  {
1869  (yyval.domain) = Domain::AllInt64();
1870  }
1871 #line 1968 "./ortools/flatzinc/parser.tab.cc"
1872  break;
1873 
1874  case 46: /* float_domain: DVALUE DOTDOT DVALUE */
1875 #line 421 "./ortools/flatzinc/parser.yy"
1876  {
1877  const int64 lb = ConvertAsIntegerOrDie((yyvsp[-2].double_value));
1878  const int64 ub = ConvertAsIntegerOrDie((yyvsp[0].double_value));
1879  (yyval.domain) = Domain::Interval(lb, ub);
1880  }
1881 #line 1978 "./ortools/flatzinc/parser.tab.cc"
1882  break;
1883 
1884  case 47: /* domain: int_domain */
1885 #line 428 "./ortools/flatzinc/parser.yy"
1886  {
1887  (yyval.domain) = (yyvsp[0].domain);
1888  }
1889 #line 1984 "./ortools/flatzinc/parser.tab.cc"
1890  break;
1891 
1892  case 48: /* domain: set_domain */
1893 #line 429 "./ortools/flatzinc/parser.yy"
1894  {
1895  (yyval.domain) = (yyvsp[0].domain);
1896  }
1897 #line 1990 "./ortools/flatzinc/parser.tab.cc"
1898  break;
1899 
1900  case 49: /* domain: float_domain */
1901 #line 430 "./ortools/flatzinc/parser.yy"
1902  {
1903  (yyval.domain) = (yyvsp[0].domain);
1904  }
1905 #line 1996 "./ortools/flatzinc/parser.tab.cc"
1906  break;
1907 
1908  case 50: /* integers: integers ',' integer */
1909 #line 433 "./ortools/flatzinc/parser.yy"
1910  {
1911  (yyval.integers) = (yyvsp[-2].integers);
1912  (yyval.integers)->emplace_back((yyvsp[0].integer_value));
1913  }
1914 #line 2002 "./ortools/flatzinc/parser.tab.cc"
1915  break;
1916 
1917  case 51: /* integers: integer */
1918 #line 434 "./ortools/flatzinc/parser.yy"
1919  {
1920  (yyval.integers) = new std::vector<int64>();
1921  (yyval.integers)->emplace_back((yyvsp[0].integer_value));
1922  }
1923 #line 2008 "./ortools/flatzinc/parser.tab.cc"
1924  break;
1925 
1926  case 52: /* integer: IVALUE */
1927 #line 437 "./ortools/flatzinc/parser.yy"
1928  {
1929  (yyval.integer_value) = (yyvsp[0].integer_value);
1930  }
1931 #line 2014 "./ortools/flatzinc/parser.tab.cc"
1932  break;
1933 
1934  case 53: /* integer: IDENTIFIER */
1935 #line 438 "./ortools/flatzinc/parser.yy"
1936  {
1937  (yyval.integer_value) =
1938  gtl::FindOrDie(context->integer_map, (yyvsp[0].string_value));
1939  }
1940 #line 2020 "./ortools/flatzinc/parser.tab.cc"
1941  break;
1942 
1943  case 54: /* integer: IDENTIFIER '[' IVALUE ']' */
1944 #line 439 "./ortools/flatzinc/parser.yy"
1945  {
1946  (yyval.integer_value) = Lookup(
1947  gtl::FindOrDie(context->integer_array_map, (yyvsp[-3].string_value)),
1948  (yyvsp[-1].integer_value));
1949  }
1950 #line 2028 "./ortools/flatzinc/parser.tab.cc"
1951  break;
1952 
1953  case 55: /* floats: floats ',' float */
1954 #line 444 "./ortools/flatzinc/parser.yy"
1955  {
1956  (yyval.doubles) = (yyvsp[-2].doubles);
1957  (yyval.doubles)->emplace_back((yyvsp[0].double_value));
1958  }
1959 #line 2034 "./ortools/flatzinc/parser.tab.cc"
1960  break;
1961 
1962  case 56: /* floats: float */
1963 #line 445 "./ortools/flatzinc/parser.yy"
1964  {
1965  (yyval.doubles) = new std::vector<double>();
1966  (yyval.doubles)->emplace_back((yyvsp[0].double_value));
1967  }
1968 #line 2040 "./ortools/flatzinc/parser.tab.cc"
1969  break;
1970 
1971  case 57: /* float: DVALUE */
1972 #line 448 "./ortools/flatzinc/parser.yy"
1973  {
1974  (yyval.double_value) = (yyvsp[0].double_value);
1975  }
1976 #line 2046 "./ortools/flatzinc/parser.tab.cc"
1977  break;
1978 
1979  case 58: /* float: IDENTIFIER */
1980 #line 449 "./ortools/flatzinc/parser.yy"
1981  {
1982  (yyval.double_value) =
1983  gtl::FindOrDie(context->float_map, (yyvsp[0].string_value));
1984  }
1985 #line 2052 "./ortools/flatzinc/parser.tab.cc"
1986  break;
1987 
1988  case 59: /* float: IDENTIFIER '[' IVALUE ']' */
1989 #line 450 "./ortools/flatzinc/parser.yy"
1990  {
1991  (yyval.double_value) = Lookup(
1992  gtl::FindOrDie(context->float_array_map, (yyvsp[-3].string_value)),
1993  (yyvsp[-1].integer_value));
1994  }
1995 #line 2060 "./ortools/flatzinc/parser.tab.cc"
1996  break;
1997 
1998  case 60: /* const_literal: IVALUE */
1999 #line 455 "./ortools/flatzinc/parser.yy"
2000  {
2001  (yyval.domain) = Domain::IntegerValue((yyvsp[0].integer_value));
2002  }
2003 #line 2066 "./ortools/flatzinc/parser.tab.cc"
2004  break;
2005 
2006  case 61: /* const_literal: IVALUE DOTDOT IVALUE */
2007 #line 456 "./ortools/flatzinc/parser.yy"
2008  {
2009  (yyval.domain) =
2010  Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value));
2011  }
2012 #line 2072 "./ortools/flatzinc/parser.tab.cc"
2013  break;
2014 
2015  case 62: /* const_literal: '{' integers '}' */
2016 #line 457 "./ortools/flatzinc/parser.yy"
2017  {
2018  CHECK((yyvsp[-1].integers) != nullptr);
2019  (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers)));
2020  delete (yyvsp[-1].integers);
2021  }
2022 #line 2082 "./ortools/flatzinc/parser.tab.cc"
2023  break;
2024 
2025  case 63: /* const_literal: '{' '}' */
2026 #line 462 "./ortools/flatzinc/parser.yy"
2027  {
2028  (yyval.domain) = Domain::EmptyDomain();
2029  }
2030 #line 2088 "./ortools/flatzinc/parser.tab.cc"
2031  break;
2032 
2033  case 64: /* const_literal: DVALUE */
2034 #line 463 "./ortools/flatzinc/parser.yy"
2035  {
2036  CHECK_EQ(std::round((yyvsp[0].double_value)), (yyvsp[0].double_value));
2037  (yyval.domain) =
2038  Domain::IntegerValue(static_cast<int64>((yyvsp[0].double_value)));
2039  }
2040 #line 2097 "./ortools/flatzinc/parser.tab.cc"
2041  break;
2042 
2043  case 65: /* const_literal: IDENTIFIER */
2044 #line 467 "./ortools/flatzinc/parser.yy"
2045  {
2046  (yyval.domain) = Domain::IntegerValue(
2047  gtl::FindOrDie(context->integer_map, (yyvsp[0].string_value)));
2048  }
2049 #line 2103 "./ortools/flatzinc/parser.tab.cc"
2050  break;
2051 
2052  case 66: /* const_literal: IDENTIFIER '[' IVALUE ']' */
2053 #line 468 "./ortools/flatzinc/parser.yy"
2054  {
2055  (yyval.domain) = Domain::IntegerValue(Lookup(
2056  gtl::FindOrDie(context->integer_array_map, (yyvsp[-3].string_value)),
2057  (yyvsp[-1].integer_value)));
2058  }
2059 #line 2112 "./ortools/flatzinc/parser.tab.cc"
2060  break;
2061 
2062  case 67: /* const_literals: const_literals ',' const_literal */
2063 #line 474 "./ortools/flatzinc/parser.yy"
2064  {
2065  (yyval.domains) = (yyvsp[-2].domains);
2066  (yyval.domains)->emplace_back((yyvsp[0].domain));
2067  }
2068 #line 2121 "./ortools/flatzinc/parser.tab.cc"
2069  break;
2070 
2071  case 68: /* const_literals: const_literal */
2072 #line 478 "./ortools/flatzinc/parser.yy"
2073  {
2074  (yyval.domains) = new std::vector<Domain>();
2075  (yyval.domains)->emplace_back((yyvsp[0].domain));
2076  }
2077 #line 2127 "./ortools/flatzinc/parser.tab.cc"
2078  break;
2079 
2080  case 71: /* constraint: CONSTRAINT IDENTIFIER '(' arguments ')' annotations
2081  */
2082 #line 488 "./ortools/flatzinc/parser.yy"
2083  {
2084  const std::string& identifier = (yyvsp[-4].string_value);
2085  CHECK((yyvsp[-2].args) != nullptr) << "Missing argument in constraint";
2086  const std::vector<Argument>& arguments = *(yyvsp[-2].args);
2087  std::vector<Annotation>* const annotations = (yyvsp[0].annotations);
2088 
2089  model->AddConstraint(identifier, arguments,
2090  ContainsId(annotations, "domain"));
2091  delete annotations;
2092  delete (yyvsp[-2].args);
2093  }
2094 #line 2142 "./ortools/flatzinc/parser.tab.cc"
2095  break;
2096 
2097  case 72: /* arguments: arguments ',' argument */
2098 #line 500 "./ortools/flatzinc/parser.yy"
2099  {
2100  (yyval.args) = (yyvsp[-2].args);
2101  (yyval.args)->emplace_back((yyvsp[0].arg));
2102  }
2103 #line 2148 "./ortools/flatzinc/parser.tab.cc"
2104  break;
2105 
2106  case 73: /* arguments: argument */
2107 #line 501 "./ortools/flatzinc/parser.yy"
2108  {
2109  (yyval.args) = new std::vector<Argument>();
2110  (yyval.args)->emplace_back((yyvsp[0].arg));
2111  }
2112 #line 2154 "./ortools/flatzinc/parser.tab.cc"
2113  break;
2114 
2115  case 74: /* argument: IVALUE */
2116 #line 504 "./ortools/flatzinc/parser.yy"
2117  {
2118  (yyval.arg) = Argument::IntegerValue((yyvsp[0].integer_value));
2119  }
2120 #line 2160 "./ortools/flatzinc/parser.tab.cc"
2121  break;
2122 
2123  case 75: /* argument: DVALUE */
2124 #line 505 "./ortools/flatzinc/parser.yy"
2125  {
2126  (yyval.arg) = Argument::IntegerValue(
2127  ConvertAsIntegerOrDie((yyvsp[0].double_value)));
2128  }
2129 #line 2166 "./ortools/flatzinc/parser.tab.cc"
2130  break;
2131 
2132  case 76: /* argument: SVALUE */
2133 #line 506 "./ortools/flatzinc/parser.yy"
2134  {
2135  (yyval.arg) = Argument::VoidArgument();
2136  }
2137 #line 2172 "./ortools/flatzinc/parser.tab.cc"
2138  break;
2139 
2140  case 77: /* argument: IVALUE DOTDOT IVALUE */
2141 #line 507 "./ortools/flatzinc/parser.yy"
2142  {
2143  (yyval.arg) = Argument::Interval((yyvsp[-2].integer_value),
2144  (yyvsp[0].integer_value));
2145  }
2146 #line 2178 "./ortools/flatzinc/parser.tab.cc"
2147  break;
2148 
2149  case 78: /* argument: '{' integers '}' */
2150 #line 508 "./ortools/flatzinc/parser.yy"
2151  {
2152  CHECK((yyvsp[-1].integers) != nullptr);
2153  (yyval.arg) = Argument::IntegerList(std::move(*(yyvsp[-1].integers)));
2154  delete (yyvsp[-1].integers);
2155  }
2156 #line 2188 "./ortools/flatzinc/parser.tab.cc"
2157  break;
2158 
2159  case 79: /* argument: IDENTIFIER */
2160 #line 513 "./ortools/flatzinc/parser.yy"
2161  {
2162  const std::string& id = (yyvsp[0].string_value);
2163  if (gtl::ContainsKey(context->integer_map, id)) {
2164  (yyval.arg) =
2165  Argument::IntegerValue(gtl::FindOrDie(context->integer_map, id));
2166  } else if (gtl::ContainsKey(context->integer_array_map, id)) {
2167  (yyval.arg) = Argument::IntegerList(
2168  gtl::FindOrDie(context->integer_array_map, id));
2169  } else if (gtl::ContainsKey(context->float_map, id)) {
2170  const double d = gtl::FindOrDie(context->float_map, id);
2171  (yyval.arg) = Argument::IntegerValue(ConvertAsIntegerOrDie(d));
2172  } else if (gtl::ContainsKey(context->float_array_map, id)) {
2173  const auto& double_values =
2174  gtl::FindOrDie(context->float_array_map, id);
2175  std::vector<int64> integer_values;
2176  for (const double d : double_values) {
2177  const int64 i = ConvertAsIntegerOrDie(d);
2178  integer_values.push_back(i);
2179  }
2180  (yyval.arg) = Argument::IntegerList(std::move(integer_values));
2181  } else if (gtl::ContainsKey(context->variable_map, id)) {
2182  (yyval.arg) =
2183  Argument::IntVarRef(gtl::FindOrDie(context->variable_map, id));
2184  } else if (gtl::ContainsKey(context->variable_array_map, id)) {
2185  (yyval.arg) = Argument::IntVarRefArray(
2186  gtl::FindOrDie(context->variable_array_map, id));
2187  } else if (gtl::ContainsKey(context->domain_map, id)) {
2188  const Domain& d = gtl::FindOrDie(context->domain_map, id);
2189  (yyval.arg) = Argument::FromDomain(d);
2190  } else {
2191  CHECK(gtl::ContainsKey(context->domain_array_map, id))
2192  << "Unknown identifier: " << id;
2193  const std::vector<Domain>& d =
2194  gtl::FindOrDie(context->domain_array_map, id);
2195  (yyval.arg) = Argument::DomainList(d);
2196  }
2197  }
2198 #line 2224 "./ortools/flatzinc/parser.tab.cc"
2199  break;
2200 
2201  case 80: /* argument: IDENTIFIER '[' IVALUE ']' */
2202 #line 544 "./ortools/flatzinc/parser.yy"
2203  {
2204  const std::string& id = (yyvsp[-3].string_value);
2205  const int64 index = (yyvsp[-1].integer_value);
2206  if (gtl::ContainsKey(context->integer_array_map, id)) {
2207  (yyval.arg) = Argument::IntegerValue(
2208  Lookup(gtl::FindOrDie(context->integer_array_map, id), index));
2209  } else if (gtl::ContainsKey(context->variable_array_map, id)) {
2210  (yyval.arg) = Argument::IntVarRef(
2211  Lookup(gtl::FindOrDie(context->variable_array_map, id), index));
2212  } else {
2213  CHECK(gtl::ContainsKey(context->domain_array_map, id))
2214  << "Unknown identifier: " << id;
2215  const Domain& d =
2216  Lookup(gtl::FindOrDie(context->domain_array_map, id), index);
2217  (yyval.arg) = Argument::FromDomain(d);
2218  }
2219  }
2220 #line 2246 "./ortools/flatzinc/parser.tab.cc"
2221  break;
2222 
2223  case 81: /* argument: '[' var_or_value_array ']' */
2224 #line 561 "./ortools/flatzinc/parser.yy"
2225  {
2226  VariableRefOrValueArray* const arguments = (yyvsp[-1].var_or_value_array);
2227  CHECK(arguments != nullptr);
2228  bool has_variables = false;
2229  for (int i = 0; i < arguments->Size(); ++i) {
2230  if (arguments->variables[i] != nullptr) {
2231  has_variables = true;
2232  break;
2233  }
2234  }
2235  if (has_variables) {
2236  (yyval.arg) = Argument::IntVarRefArray(std::vector<IntegerVariable*>());
2237  (yyval.arg).variables.reserve(arguments->Size());
2238  for (int i = 0; i < arguments->Size(); ++i) {
2239  if (arguments->variables[i] != nullptr) {
2240  (yyval.arg).variables.emplace_back(arguments->variables[i]);
2241  } else {
2242  (yyval.arg).variables.emplace_back(
2243  model->AddConstant(arguments->values[i]));
2244  }
2245  }
2246  } else {
2247  (yyval.arg) = Argument::IntegerList(arguments->values);
2248  }
2249  delete arguments;
2250  }
2251 #line 2276 "./ortools/flatzinc/parser.tab.cc"
2252  break;
2253 
2254  case 82: /* argument: '[' ']' */
2255 #line 586 "./ortools/flatzinc/parser.yy"
2256  {
2257  (yyval.arg) = Argument::VoidArgument();
2258  }
2259 #line 2284 "./ortools/flatzinc/parser.tab.cc"
2260  break;
2261 
2262  case 83: /* annotations: annotations COLONCOLON annotation */
2263 #line 595 "./ortools/flatzinc/parser.yy"
2264  {
2265  (yyval.annotations) = (yyvsp[-2].annotations) != nullptr
2266  ? (yyvsp[-2].annotations)
2267  : new std::vector<Annotation>();
2268  (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2269  }
2270 #line 2293 "./ortools/flatzinc/parser.tab.cc"
2271  break;
2272 
2273  case 84: /* annotations: %empty */
2274 #line 599 "./ortools/flatzinc/parser.yy"
2275  {
2276  (yyval.annotations) = nullptr;
2277  }
2278 #line 2299 "./ortools/flatzinc/parser.tab.cc"
2279  break;
2280 
2281  case 85: /* annotation_arguments: annotation_arguments ',' annotation */
2282 #line 602 "./ortools/flatzinc/parser.yy"
2283  {
2284  (yyval.annotations) = (yyvsp[-2].annotations);
2285  (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2286  }
2287 #line 2305 "./ortools/flatzinc/parser.tab.cc"
2288  break;
2289 
2290  case 86: /* annotation_arguments: annotation */
2291 #line 603 "./ortools/flatzinc/parser.yy"
2292  {
2293  (yyval.annotations) = new std::vector<Annotation>();
2294  (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2295  }
2296 #line 2311 "./ortools/flatzinc/parser.tab.cc"
2297  break;
2298 
2299  case 87: /* annotation: IVALUE DOTDOT IVALUE */
2300 #line 606 "./ortools/flatzinc/parser.yy"
2301  {
2302  (yyval.annotation) = Annotation::Interval((yyvsp[-2].integer_value),
2303  (yyvsp[0].integer_value));
2304  }
2305 #line 2317 "./ortools/flatzinc/parser.tab.cc"
2306  break;
2307 
2308  case 88: /* annotation: IVALUE */
2309 #line 607 "./ortools/flatzinc/parser.yy"
2310  {
2311  (yyval.annotation) = Annotation::IntegerValue((yyvsp[0].integer_value));
2312  }
2313 #line 2323 "./ortools/flatzinc/parser.tab.cc"
2314  break;
2315 
2316  case 89: /* annotation: SVALUE */
2317 #line 608 "./ortools/flatzinc/parser.yy"
2318  {
2319  (yyval.annotation) = Annotation::String((yyvsp[0].string_value));
2320  }
2321 #line 2329 "./ortools/flatzinc/parser.tab.cc"
2322  break;
2323 
2324  case 90: /* annotation: IDENTIFIER */
2325 #line 609 "./ortools/flatzinc/parser.yy"
2326  {
2327  const std::string& id = (yyvsp[0].string_value);
2328  if (gtl::ContainsKey(context->variable_map, id)) {
2329  (yyval.annotation) =
2330  Annotation::Variable(gtl::FindOrDie(context->variable_map, id));
2331  } else if (gtl::ContainsKey(context->variable_array_map, id)) {
2332  (yyval.annotation) = Annotation::VariableList(
2333  gtl::FindOrDie(context->variable_array_map, id));
2334  } else {
2335  (yyval.annotation) = Annotation::Identifier(id);
2336  }
2337  }
2338 #line 2344 "./ortools/flatzinc/parser.tab.cc"
2339  break;
2340 
2341  case 91: /* annotation: IDENTIFIER '(' annotation_arguments ')' */
2342 #line 619 "./ortools/flatzinc/parser.yy"
2343  {
2344  std::vector<Annotation>* const annotations = (yyvsp[-1].annotations);
2345  if (annotations != nullptr) {
2346  (yyval.annotation) = Annotation::FunctionCallWithArguments(
2347  (yyvsp[-3].string_value), std::move(*annotations));
2348  delete annotations;
2349  } else {
2350  (yyval.annotation) = Annotation::FunctionCall((yyvsp[-3].string_value));
2351  }
2352  }
2353 #line 2358 "./ortools/flatzinc/parser.tab.cc"
2354  break;
2355 
2356  case 92: /* annotation: IDENTIFIER '[' IVALUE ']' */
2357 #line 628 "./ortools/flatzinc/parser.yy"
2358  {
2359  CHECK(gtl::ContainsKey(context->variable_array_map,
2360  (yyvsp[-3].string_value)))
2361  << "Unknown identifier: " << (yyvsp[-3].string_value);
2362  (yyval.annotation) = Annotation::Variable(Lookup(
2363  gtl::FindOrDie(context->variable_array_map, (yyvsp[-3].string_value)),
2364  (yyvsp[-1].integer_value)));
2365  }
2366 #line 2369 "./ortools/flatzinc/parser.tab.cc"
2367  break;
2368 
2369  case 93: /* annotation: '[' annotation_arguments ']' */
2370 #line 634 "./ortools/flatzinc/parser.yy"
2371  {
2372  std::vector<Annotation>* const annotations = (yyvsp[-1].annotations);
2373  if (annotations != nullptr) {
2374  (yyval.annotation) =
2375  Annotation::AnnotationList(std::move(*annotations));
2376  delete annotations;
2377  } else {
2378  (yyval.annotation) = Annotation::Empty();
2379  }
2380  }
2381 #line 2383 "./ortools/flatzinc/parser.tab.cc"
2382  break;
2383 
2384  case 94: /* solve: SOLVE annotations SATISFY */
2385 #line 649 "./ortools/flatzinc/parser.yy"
2386  {
2387  if ((yyvsp[-1].annotations) != nullptr) {
2388  model->Satisfy(std::move(*(yyvsp[-1].annotations)));
2389  delete (yyvsp[-1].annotations);
2390  } else {
2391  model->Satisfy(std::vector<Annotation>());
2392  }
2393  }
2394 #line 2396 "./ortools/flatzinc/parser.tab.cc"
2395  break;
2396 
2397  case 95: /* solve: SOLVE annotations MINIMIZE argument */
2398 #line 657 "./ortools/flatzinc/parser.yy"
2399  {
2400  CHECK_EQ(Argument::INT_VAR_REF, (yyvsp[0].arg).type);
2401  if ((yyvsp[-2].annotations) != nullptr) {
2402  model->Minimize((yyvsp[0].arg).Var(),
2403  std::move(*(yyvsp[-2].annotations)));
2404  delete (yyvsp[-2].annotations);
2405  } else {
2406  model->Minimize((yyvsp[0].arg).Var(), std::vector<Annotation>());
2407  }
2408  }
2409 #line 2410 "./ortools/flatzinc/parser.tab.cc"
2410  break;
2411 
2412  case 96: /* solve: SOLVE annotations MAXIMIZE argument */
2413 #line 666 "./ortools/flatzinc/parser.yy"
2414  {
2415  CHECK_EQ(Argument::INT_VAR_REF, (yyvsp[0].arg).type);
2416  if ((yyvsp[-2].annotations) != nullptr) {
2417  model->Maximize((yyvsp[0].arg).Var(),
2418  std::move(*(yyvsp[-2].annotations)));
2419  delete (yyvsp[-2].annotations);
2420  } else {
2421  model->Maximize((yyvsp[0].arg).Var(), std::vector<Annotation>());
2422  }
2423  }
2424 #line 2424 "./ortools/flatzinc/parser.tab.cc"
2425  break;
2426 
2427 #line 2428 "./ortools/flatzinc/parser.tab.cc"
2428 
2429  default:
2430  break;
2431  }
2432  /* User semantic actions sometimes alter yychar, and that requires
2433  that yytoken be updated with the new translation. We take the
2434  approach of translating immediately before every use of yytoken.
2435  One alternative is translating here after every semantic action,
2436  but that translation would be missed if the semantic action invokes
2437  YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2438  if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2439  incorrect destructor might then be invoked immediately. In the
2440  case of YYERROR or YYBACKUP, subsequent parser actions might lead
2441  to an incorrect destructor call or verbose syntax error message
2442  before the lookahead is translated. */
2443  YY_SYMBOL_PRINT("-> $$ =", YY_CAST(yysymbol_kind_t, yyr1[yyn]), &yyval,
2444  &yyloc);
2445 
2446  YYPOPSTACK(yylen);
2447  yylen = 0;
2448 
2449  *++yyvsp = yyval;
2450 
2451  /* Now 'shift' the result of the reduction. Determine what state
2452  that goes to, based on the state we popped back to and the rule
2453  number reduced by. */
2454  {
2455  const int yylhs = yyr1[yyn] - YYNTOKENS;
2456  const int yyi = yypgoto[yylhs] + *yyssp;
2457  yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2458  ? yytable[yyi]
2459  : yydefgoto[yylhs]);
2460  }
2461 
2462  goto yynewstate;
2463 
2464 /*--------------------------------------.
2465 | yyerrlab -- here on detecting error. |
2466 `--------------------------------------*/
2467 yyerrlab:
2468  /* Make sure we have latest lookahead translation. See comments at
2469  user semantic actions for why this is necessary. */
2470  yytoken = yychar == ORFZ_EMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE(yychar);
2471  /* If not already recovering from an error, report this error. */
2472  if (!yyerrstatus) {
2473  ++yynerrs;
2474  {
2475  yypcontext_t yyctx = {yyssp, yytoken};
2476  char const* yymsgp = YY_("syntax error");
2477  int yysyntax_error_status;
2478  yysyntax_error_status = yysyntax_error(&yymsg_alloc, &yymsg, &yyctx);
2479  if (yysyntax_error_status == 0)
2480  yymsgp = yymsg;
2481  else if (yysyntax_error_status == -1) {
2482  if (yymsg != yymsgbuf) YYSTACK_FREE(yymsg);
2483  yymsg = YY_CAST(char*, YYSTACK_ALLOC(YY_CAST(YYSIZE_T, yymsg_alloc)));
2484  if (yymsg) {
2485  yysyntax_error_status = yysyntax_error(&yymsg_alloc, &yymsg, &yyctx);
2486  yymsgp = yymsg;
2487  } else {
2488  yymsg = yymsgbuf;
2489  yymsg_alloc = sizeof yymsgbuf;
2490  yysyntax_error_status = YYENOMEM;
2491  }
2492  }
2493  yyerror(context, model, ok, scanner, yymsgp);
2494  if (yysyntax_error_status == YYENOMEM) goto yyexhaustedlab;
2495  }
2496  }
2497 
2498  if (yyerrstatus == 3) {
2499  /* If just tried and failed to reuse lookahead token after an
2500  error, discard it. */
2501 
2502  if (yychar <= ORFZ_EOF) {
2503  /* Return failure if at end of input. */
2504  if (yychar == ORFZ_EOF) YYABORT;
2505  } else {
2506  yydestruct("Error: discarding", yytoken, &yylval, context, model, ok,
2507  scanner);
2508  yychar = ORFZ_EMPTY;
2509  }
2510  }
2511 
2512  /* Else will try to reuse lookahead token after shifting the error
2513  token. */
2514  goto yyerrlab1;
2515 
2516 /*---------------------------------------------------.
2517 | yyerrorlab -- error raised explicitly by YYERROR. |
2518 `---------------------------------------------------*/
2519 yyerrorlab:
2520  /* Pacify compilers when the user code never invokes YYERROR and the
2521  label yyerrorlab therefore never appears in user code. */
2522  if (0) YYERROR;
2523 
2524  /* Do not reclaim the symbols of the rule whose action triggered
2525  this YYERROR. */
2526  YYPOPSTACK(yylen);
2527  yylen = 0;
2528  YY_STACK_PRINT(yyss, yyssp);
2529  yystate = *yyssp;
2530  goto yyerrlab1;
2531 
2532 /*-------------------------------------------------------------.
2533 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2534 `-------------------------------------------------------------*/
2535 yyerrlab1:
2536  yyerrstatus = 3; /* Each real token shifted decrements this. */
2537 
2538  /* Pop stack until we find a state that shifts the error token. */
2539  for (;;) {
2540  yyn = yypact[yystate];
2541  if (!yypact_value_is_default(yyn)) {
2542  yyn += YYSYMBOL_YYerror;
2543  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) {
2544  yyn = yytable[yyn];
2545  if (0 < yyn) break;
2546  }
2547  }
2548 
2549  /* Pop the current state because it cannot handle the error token. */
2550  if (yyssp == yyss) YYABORT;
2551 
2552  yydestruct("Error: popping", YY_ACCESSING_SYMBOL(yystate), yyvsp, context,
2553  model, ok, scanner);
2554  YYPOPSTACK(1);
2555  yystate = *yyssp;
2556  YY_STACK_PRINT(yyss, yyssp);
2557  }
2558 
2560  *++yyvsp = yylval;
2562 
2563  /* Shift the error token. */
2564  YY_SYMBOL_PRINT("Shifting", YY_ACCESSING_SYMBOL(yyn), yyvsp, yylsp);
2565 
2566  yystate = yyn;
2567  goto yynewstate;
2568 
2569 /*-------------------------------------.
2570 | yyacceptlab -- YYACCEPT comes here. |
2571 `-------------------------------------*/
2572 yyacceptlab:
2573  yyresult = 0;
2574  goto yyreturn;
2575 
2576 /*-----------------------------------.
2577 | yyabortlab -- YYABORT comes here. |
2578 `-----------------------------------*/
2579 yyabortlab:
2580  yyresult = 1;
2581  goto yyreturn;
2582 
2583 #if 1
2584 /*-------------------------------------------------.
2585 | yyexhaustedlab -- memory exhaustion comes here. |
2586 `-------------------------------------------------*/
2587 yyexhaustedlab:
2588  yyerror(context, model, ok, scanner, YY_("memory exhausted"));
2589  yyresult = 2;
2590  goto yyreturn;
2591 #endif
2592 
2593 /*-------------------------------------------------------.
2594 | yyreturn -- parsing is finished, clean up and return. |
2595 `-------------------------------------------------------*/
2596 yyreturn:
2597  if (yychar != ORFZ_EMPTY) {
2598  /* Make sure we have latest lookahead translation. See comments at
2599  user semantic actions for why this is necessary. */
2600  yytoken = YYTRANSLATE(yychar);
2601  yydestruct("Cleanup: discarding lookahead", yytoken, &yylval, context,
2602  model, ok, scanner);
2603  }
2604  /* Do not reclaim the symbols of the rule whose action triggered
2605  this YYABORT or YYACCEPT. */
2606  YYPOPSTACK(yylen);
2607  YY_STACK_PRINT(yyss, yyssp);
2608  while (yyssp != yyss) {
2609  yydestruct("Cleanup: popping", YY_ACCESSING_SYMBOL(+*yyssp), yyvsp, context,
2610  model, ok, scanner);
2611  YYPOPSTACK(1);
2612  }
2613 #ifndef yyoverflow
2614  if (yyss != yyssa) YYSTACK_FREE(yyss);
2615 #endif
2616  if (yymsg != yymsgbuf) YYSTACK_FREE(yymsg);
2617  return yyresult;
2618 }
2619 
2620 #line 676 "./ortools/flatzinc/parser.yy"
yyr1
static const yytype_int8 yyr1[]
Definition: parser.tab.cc:757
YYSYMBOL_annotation_arguments
@ YYSYMBOL_annotation_arguments
Definition: parser.tab.cc:176
var
IntVar * var
Definition: expr_array.cc:1858
YYSTACK_ALLOC_MAXIMUM
#define YYSTACK_ALLOC_MAXIMUM
Definition: parser.tab.cc:416
YYDPRINTF
#define YYDPRINTF(Args)
Definition: parser.tab.cc:811
YY_STACK_PRINT
#define YY_STACK_PRINT(Bottom, Top)
Definition: parser.tab.cc:883
YYFINAL
#define YYFINAL
Definition: parser.tab.cc:495
yytnamerr
static YYPTRDIFF_T yytnamerr(char *yyres, const char *yystr)
Definition: parser.tab.cc:1021
operations_research::fz::VariableRefOrValueArray
Definition: parser_util.h:72
yytype_int16
short yytype_int16
Definition: parser.tab.cc:238
YYNSTATES
#define YYNSTATES
Definition: parser.tab.cc:506
YYSYMBOL_variable_or_constant_declaration
@ YYSYMBOL_variable_or_constant_declaration
Definition: parser.tab.cc:155
yydefact
static const yytype_int8 yydefact[]
Definition: parser.tab.cc:672
YYERROR
#define YYERROR
Definition: parser.tab.cc:780
YYSTACK_BYTES
#define YYSTACK_BYTES(N)
Definition: parser.tab.cc:456
yylval
yylval
Definition: parser.yy.cc:963
operations_research::fz::ConvertAsIntegerOrDie
int64 ConvertAsIntegerOrDie(double d)
Definition: parser_util.cc:65
bound
int64 bound
Definition: routing_search.cc:971
YYSTACK_ALLOC
#define YYSTACK_ALLOC
Definition: parser.tab.cc:413
YYSYMBOL_integers
@ YYSYMBOL_integers
Definition: parser.tab.cc:165
operations_research::fz::VariableRefOrValue::variable
IntegerVariable * variable
Definition: parser_util.h:67
LOG
#define LOG(severity)
Definition: base/logging.h:420
yyr2
static const yytype_int8 yyr2[]
Definition: parser.tab.cc:766
ERROR
const int ERROR
Definition: log_severity.h:32
operations_research::fz::Annotation
Definition: flatzinc/model.h:238
YYSYMBOL_arguments
@ YYSYMBOL_arguments
Definition: parser.tab.cc:173
YYSYMBOL_TOKEN_FLOAT
@ YYSYMBOL_TOKEN_FLOAT
Definition: parser.tab.cc:119
YYSYMBOL_SATISFY
@ YYSYMBOL_SATISFY
Definition: parser.tab.cc:125
YYTRANSLATE
#define YYTRANSLATE(YYX)
Definition: parser.tab.cc:513
YYSYMBOL_29_
@ YYSYMBOL_29_
Definition: parser.tab.cc:142
YYSYMBOL_predicate_ints
@ YYSYMBOL_predicate_ints
Definition: parser.tab.cc:152
YYSYMBOL_YYACCEPT
@ YYSYMBOL_YYACCEPT
Definition: parser.tab.cc:145
YYSYMBOL_TOKEN_BOOL
@ YYSYMBOL_TOKEN_BOOL
Definition: parser.tab.cc:117
YYLAST
#define YYLAST
Definition: parser.tab.cc:497
yynerrs
#define yynerrs
Definition: parser.tab.cc:86
YYSYMBOL_predicate_argument
@ YYSYMBOL_predicate_argument
Definition: parser.tab.cc:150
YY_
#define YY_(Msgid)
Definition: parser.tab.cc:313
operations_research::fz::Domain::display_as_boolean
bool display_as_boolean
Definition: flatzinc/model.h:99
yytname
static const char *const yytname[]
Definition: parser.tab.cc:558
YYINITDEPTH
#define YYINITDEPTH
Definition: parser.tab.cc:928
operations_research::fz::Lookup
const T & Lookup(const std::vector< T > &v, int index)
Definition: parser_util.cc:75
operations_research::fz::Model
Definition: flatzinc/model.h:315
YYACCEPT
#define YYACCEPT
Definition: parser.tab.cc:778
YYABORT
#define YYABORT
Definition: parser.tab.cc:779
YYSYMBOL_const_literals
@ YYSYMBOL_const_literals
Definition: parser.tab.cc:170
yypcontext_t
Definition: parser.tab.cc:943
operations_research::fz::Annotation::annotations
std::vector< Annotation > annotations
Definition: flatzinc/model.h:275
yyparse
#define yyparse
Definition: parser.tab.cc:82
value
int64 value
Definition: demon_profiler.cc:43
operations_research::fz::SolutionOutputSpecs
Definition: flatzinc/model.h:282
yypcontext_t::yyssp
yy_state_t * yyssp
Definition: parser.tab.cc:944
YYSYMBOL_integer
@ YYSYMBOL_integer
Definition: parser.tab.cc:166
YY_SYMBOL_PRINT
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
Definition: parser.tab.cc:821
bounds
SharedBoundsManager * bounds
Definition: cp_model_solver.cc:2104
YYSYMBOL_solve
@ YYSYMBOL_solve
Definition: parser.tab.cc:178
YYSYMBOL_IDENTIFIER
@ YYSYMBOL_IDENTIFIER
Definition: parser.tab.cc:133
YYSYMBOL_31_
@ YYSYMBOL_31_
Definition: parser.tab.cc:144
YYSYMBOL_ARRAY
@ YYSYMBOL_ARRAY
Definition: parser.tab.cc:116
YYSYMBOL_annotations
@ YYSYMBOL_annotations
Definition: parser.tab.cc:175
yy_symbol_print
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)
Definition: parser.tab.cc:857
YYENOMEM
@ YYENOMEM
Definition: parser.tab.cc:773
YYSYMBOL_YYUNDEF
@ YYSYMBOL_YYUNDEF
Definition: parser.tab.cc:115
malloc
void * malloc(YYSIZE_T)
operations_research::fz::VariableRefOrValue
Definition: parser_util.h:44
int64
int64_t int64
Definition: integral_types.h:34
yysymbol_kind_t
yysymbol_kind_t
Definition: parser.tab.cc:111
YY_INITIAL_VALUE
#define YY_INITIAL_VALUE(Value)
Definition: parser.tab.cc:348
yypact_value_is_default
#define yypact_value_is_default(Yyn)
Definition: parser.tab.cc:640
YYSTYPE
#define YYSTYPE
Definition: parser.tab.cc:80
index
int index
Definition: pack.cc:508
yy_stack_print
static void yy_stack_print(yy_state_t *yybottom, yy_state_t *yytop)
Definition: parser.tab.cc:874
YYSYMBOL_OF
@ YYSYMBOL_OF
Definition: parser.tab.cc:123
YYSYMBOL_COLONCOLON
@ YYSYMBOL_COLONCOLON
Definition: parser.tab.cc:130
context
GurobiMPCallbackContext * context
Definition: gurobi_interface.cc:509
YYUSE
#define YYUSE(E)
Definition: parser.tab.cc:335
YY_IGNORE_USELESS_CAST_END
#define YY_IGNORE_USELESS_CAST_END
Definition: parser.tab.cc:366
YYSYMBOL_predicate_array_argument
@ YYSYMBOL_predicate_array_argument
Definition: parser.tab.cc:151
YYSYMBOL_PREDICATE
@ YYSYMBOL_PREDICATE
Definition: parser.tab.cc:124
gtl::FindOrDie
const Collection::value_type::second_type & FindOrDie(const Collection &collection, const typename Collection::value_type::first_type &key)
Definition: map_util.h:176
YYSYMBOL_constraints
@ YYSYMBOL_constraints
Definition: parser.tab.cc:171
YYSYMBOL_YYEMPTY
@ YYSYMBOL_YYEMPTY
Definition: parser.tab.cc:112
YYSYMBOL_26_
@ YYSYMBOL_26_
Definition: parser.tab.cc:139
yyalloc::yyss_alloc
yy_state_t yyss_alloc
Definition: parser.tab.cc:447
YY_IGNORE_MAYBE_UNINITIALIZED_END
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
Definition: parser.tab.cc:352
YYSYMBOL_float_domain
@ YYSYMBOL_float_domain
Definition: parser.tab.cc:163
YYSYMBOL_IVALUE
@ YYSYMBOL_IVALUE
Definition: parser.tab.cc:131
yytype_int8
signed char yytype_int8
Definition: parser.tab.cc:230
yy_state_t
yytype_uint8 yy_state_t
Definition: parser.tab.cc:300
yypgoto
static const yytype_int16 yypgoto[]
Definition: parser.tab.cc:687
a
int64 a
Definition: constraint_solver/table.cc:42
yy_state_fast_t
int yy_state_fast_t
Definition: parser.tab.cc:303
YYSYMBOL_floats
@ YYSYMBOL_floats
Definition: parser.tab.cc:167
yy_syntax_error_arguments
static int yy_syntax_error_arguments(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn)
Definition: parser.tab.cc:1056
YYSTACK_RELOCATE
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
Definition: parser.tab.cc:466
operations_research::fz::Annotation::IsFunctionCallWithIdentifier
bool IsFunctionCallWithIdentifier(const std::string &identifier) const
Definition: flatzinc/model.h:263
operations_research::fz::Domain::values
std::vector< int64 > values
Definition: flatzinc/model.h:97
operations_research::fz::ParserContext
Definition: parser_util.h:29
operations_research::fz::VariableRefOrValue::defined
bool defined
Definition: parser_util.h:69
YYSTACK_FREE
#define YYSTACK_FREE
Definition: parser.tab.cc:414
YY_REDUCE_PRINT
#define YY_REDUCE_PRINT(Rule)
Definition: parser.tab.cc:910
YYSYMBOL_int_domain
@ YYSYMBOL_int_domain
Definition: parser.tab.cc:161
operations_research::fz::Constraint
Definition: flatzinc/model.h:196
YYSYMBOL_27_
@ YYSYMBOL_27_
Definition: parser.tab.cc:140
yystrlen
static YYPTRDIFF_T yystrlen(const char *yystr)
Definition: parser.tab.cc:988
yytype_uint8
unsigned char yytype_uint8
Definition: parser.tab.cc:247
YYSYMBOL_set_domain
@ YYSYMBOL_set_domain
Definition: parser.tab.cc:162
YYSYMBOL_optional_var_or_value_array
@ YYSYMBOL_optional_var_or_value_array
Definition: parser.tab.cc:158
yytable_value_is_error
#define yytable_value_is_error(Yyn)
Definition: parser.tab.cc:644
operations_research::fz::AllDomainsHaveOneValue
bool AllDomainsHaveOneValue(const std::vector< Domain > &domains)
Definition: parser_util.cc:56
free
void free(void *)
YYSYMBOL_var_or_value
@ YYSYMBOL_var_or_value
Definition: parser.tab.cc:160
YYFPRINTF
#define YYFPRINTF
Definition: parser.tab.cc:808
yyalloc::yyvs_alloc
YYSTYPE yyvs_alloc
Definition: parser.tab.cc:448
YYSYMBOL_22_
@ YYSYMBOL_22_
Definition: parser.tab.cc:135
YYPTRDIFF_T
#define YYPTRDIFF_T
Definition: parser.tab.cc:274
operations_research::fz::Argument
Definition: flatzinc/model.h:143
YYSYMBOL_float
@ YYSYMBOL_float
Definition: parser.tab.cc:168
yyrline
static const yytype_int16 yyrline[]
Definition: parser.tab.cc:538
CHECK_EQ
#define CHECK_EQ(val1, val2)
Definition: base/logging.h:697
operations_research::fz::VariableRefOrValueArray::values
std::vector< int64 > values
Definition: parser_util.h:74
yytype_uint16
unsigned short yytype_uint16
Definition: parser.tab.cc:258
yypcontext_t::yytoken
yysymbol_kind_t yytoken
Definition: parser.tab.cc:945
yysymbol_name
static const char * yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED
Definition: parser.tab.cc:624
yypcontext_expected_tokens
static int yypcontext_expected_tokens(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn)
Definition: parser.tab.cc:954
YY_ASSERT
#define YY_ASSERT(E)
Definition: parser.tab.cc:369
yystos
static const yytype_int8 yystos[]
Definition: parser.tab.cc:742
YYSYMBOL_constraint
@ YYSYMBOL_constraint
Definition: parser.tab.cc:172
YYSYMBOL_24_
@ YYSYMBOL_24_
Definition: parser.tab.cc:137
operations_research::sat::Value
std::function< int64(const Model &)> Value(IntegerVariable v)
Definition: integer.h:1470
YYSIZE_T
#define YYSIZE_T
Definition: parser.tab.cc:288
YYSYMBOL_30_
@ YYSYMBOL_30_
Definition: parser.tab.cc:143
YYSYMBOL_YYerror
@ YYSYMBOL_YYerror
Definition: parser.tab.cc:114
parser_util.cc
operations_research::fz::VariableRefOrValue::value
int64 value
Definition: parser_util.h:68
YYSYMBOL_MAXIMIZE
@ YYSYMBOL_MAXIMIZE
Definition: parser.tab.cc:121
operations_research::fz::Domain::Contains
bool Contains(int64 value) const
Definition: model.cc:265
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Definition: parser.tab.cc:351
YYSYMBOL_const_literal
@ YYSYMBOL_const_literal
Definition: parser.tab.cc:169
operations_research::fz::ContainsId
bool ContainsId(std::vector< Annotation > *annotations, const std::string &id)
Definition: parser_util.cc:43
operations_research::fz::IntegerVariable
Definition: flatzinc/model.h:107
yydebug
#define yydebug
Definition: parser.tab.cc:85
YYSYMBOL_SVALUE
@ YYSYMBOL_SVALUE
Definition: parser.tab.cc:132
YYSYMBOL_DOTDOT
@ YYSYMBOL_DOTDOT
Definition: parser.tab.cc:129
model
GRBmodel * model
Definition: gurobi_interface.cc:269
yystpcpy
static char * yystpcpy(char *yydest, const char *yysrc)
Definition: parser.tab.cc:1002
YYSYMBOL_28_
@ YYSYMBOL_28_
Definition: parser.tab.cc:141
YYSYMBOL_DVALUE
@ YYSYMBOL_DVALUE
Definition: parser.tab.cc:134
yycheck
static const yytype_int16 yycheck[]
Definition: parser.tab.cc:721
YYSYMBOL_optional_var_or_value
@ YYSYMBOL_optional_var_or_value
Definition: parser.tab.cc:157
yy_reduce_print
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)
Definition: parser.tab.cc:892
YYSYMBOL_var_or_value_array
@ YYSYMBOL_var_or_value_array
Definition: parser.tab.cc:159
YY_IGNORE_USELESS_CAST_BEGIN
#define YY_IGNORE_USELESS_CAST_BEGIN
Definition: parser.tab.cc:365
yysyntax_error
static int yysyntax_error(YYPTRDIFF_T *yymsg_alloc, char **yymsg, const yypcontext_t *yyctx)
Definition: parser.tab.cc:1105
YYMAXDEPTH
#define YYMAXDEPTH
Definition: parser.tab.cc:939
YYSYMBOL_variable_or_constant_declarations
@ YYSYMBOL_variable_or_constant_declarations
Definition: parser.tab.cc:153
yy_symbol_value_print
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)
Definition: parser.tab.cc:834
operations_research::fz::Domain::HasOneValue
bool HasOneValue() const
Definition: model.cc:236
yypact
static const yytype_int16 yypact[]
Definition: parser.tab.cc:648
operations_research::fz::VariableRefOrValueArray::variables
std::vector< IntegerVariable * > variables
Definition: parser_util.h:73
YYSYMBOL_VAR
@ YYSYMBOL_VAR
Definition: parser.tab.cc:128
YYSYMBOL_25_
@ YYSYMBOL_25_
Definition: parser.tab.cc:138
YYSYMBOL_CONSTRAINT
@ YYSYMBOL_CONSTRAINT
Definition: parser.tab.cc:118
YYSYMBOL_MINIMIZE
@ YYSYMBOL_MINIMIZE
Definition: parser.tab.cc:122
yyerrok
#define yyerrok
Definition: parser.tab.cc:775
yytranslate
static const yytype_int8 yytranslate[]
Definition: parser.tab.cc:520
YYSYMBOL_domain
@ YYSYMBOL_domain
Definition: parser.tab.cc:164
YYSYMBOL_argument
@ YYSYMBOL_argument
Definition: parser.tab.cc:174
yyalloc
Definition: parser.tab.cc:446
yydestruct
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)
Definition: parser.tab.cc:1180
YYSYMBOL_SET
@ YYSYMBOL_SET
Definition: parser.tab.cc:126
yyerror
#define yyerror
Definition: parser.tab.cc:84
YYPOPSTACK
#define YYPOPSTACK(N)
YY_NULLPTR
#define YY_NULLPTR
Definition: parser.tab.cc:105
YYSYMBOL_annotation
@ YYSYMBOL_annotation
Definition: parser.tab.cc:177
YYSYMBOL_23_
@ YYSYMBOL_23_
Definition: parser.tab.cc:136
YYSYMBOL_predicates
@ YYSYMBOL_predicates
Definition: parser.tab.cc:147
YYSYMBOL_SOLVE
@ YYSYMBOL_SOLVE
Definition: parser.tab.cc:127
YYCASE_
#define YYCASE_(N, S)
yytable
static const yytype_int16 yytable[]
Definition: parser.tab.cc:700
YYSYMBOL_TOKEN_INT
@ YYSYMBOL_TOKEN_INT
Definition: parser.tab.cc:120
operations_research::fz::Domain
Definition: flatzinc/model.h:48
YYSYMBOL_predicate_arguments
@ YYSYMBOL_predicate_arguments
Definition: parser.tab.cc:149
operations_research::fz::VariableRefOrValueArray::Size
int Size() const
Definition: parser_util.h:82
YYSYMBOL_predicate
@ YYSYMBOL_predicate
Definition: parser.tab.cc:148
YYNTOKENS
#define YYNTOKENS
Definition: parser.tab.cc:500
YYSYMBOL_model
@ YYSYMBOL_model
Definition: parser.tab.cc:146
YYSYMBOL_YYEOF
@ YYSYMBOL_YYEOF
Definition: parser.tab.cc:113
CHECK
#define CHECK(condition)
Definition: base/logging.h:495
yydefgoto
static const yytype_int16 yydefgoto[]
Definition: parser.tab.cc:693
YYSIZEOF
#define YYSIZEOF(X)
Definition: parser.tab.cc:297
YY_ATTRIBUTE_UNUSED
#define YY_ATTRIBUTE_UNUSED
Definition: parser.tab.cc:329
YY_CAST
#define YY_CAST(Type, Val)
Definition: parser.tab.cc:93
yylex
#define yylex
Definition: parser.tab.cc:83
YY_ACCESSING_SYMBOL
#define YY_ACCESSING_SYMBOL(State)
Accessing symbol of state STATE.
Definition: parser.tab.cc:549
gtl::ContainsKey
bool ContainsKey(const Collection &collection, const Key &key)
Definition: map_util.h:170