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