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