OR-Tools  8.2
parser.tab.cc
Go to the documentation of this file.
1// Copyright 2010-2018 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14/* A Bison parser, made by GNU Bison 3.7.5. */
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 <http://www.gnu.org/licenses/>. */
33
34/* As a special exception, you may create a larger work that contains
35 part or all of the Bison parser skeleton and distribute that work
36 under terms of your choice, so long as that work isn't itself a
37 parser generator using the skeleton or a modified version thereof
38 as a parser skeleton. Alternatively, if you modify or redistribute
39 the parser skeleton itself, you may (at your option) remove this
40 special exception, which will cause the skeleton and the resulting
41 Bison output files to be licensed under the GNU General Public
42 License without this special exception.
43
44 This special exception was added by the Free Software Foundation in
45 version 2.2 of Bison. */
46
47/* C LALR(1) parser skeleton written by Richard Stallman, by
48 simplifying the original so-called "semantic" parser. */
49
50/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
51 especially those whose name start with YY_ or yy_. They are
52 private implementation details that can be changed or removed. */
53
54/* All symbols defined below should begin with yy or YY, to avoid
55 infringing on user name space. This should be done even for local
56 variables, as they might otherwise be expanded by user macros.
57 There are some unavoidable exceptions within include files to
58 define necessary library symbols; they are noted "INFRINGES ON
59 USER NAME SPACE" below. */
60
61/* Identify Bison output, and Bison version. */
62#define YYBISON 30705
63
64/* Bison version string. */
65#define YYBISON_VERSION "3.7.5"
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 */
181
182/* Unqualified %code blocks. */
183#line 36 "./ortools/flatzinc/parser.yy"
184
185#include "absl/strings/match.h"
186#include "absl/strings/str_format.h"
188
201
202#line 192 "./ortools/flatzinc/parser.tab.cc"
203
204#ifdef short
205#undef short
206#endif
207
208/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
209 <limits.h> and (if available) <stdint.h> are included
210 so that the code can choose integer types of a good width. */
211
212#ifndef __PTRDIFF_MAX__
213#include <limits.h> /* INFRINGES ON USER NAME SPACE */
214#if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
215#include <stdint.h> /* INFRINGES ON USER NAME SPACE */
216#define YY_STDINT_H
217#endif
218#endif
219
220/* Narrow types that promote to a signed type and that can represent a
221 signed or unsigned integer of at least N bits. In tables they can
222 save space and decrease cache pressure. Promoting to a signed type
223 helps avoid bugs in integer arithmetic. */
224
225#ifdef __INT_LEAST8_MAX__
226typedef __INT_LEAST8_TYPE__ yytype_int8;
227#elif defined YY_STDINT_H
228typedef int_least8_t yytype_int8;
229#else
230typedef signed char yytype_int8;
231#endif
232
233#ifdef __INT_LEAST16_MAX__
234typedef __INT_LEAST16_TYPE__ yytype_int16;
235#elif defined YY_STDINT_H
236typedef int_least16_t yytype_int16;
237#else
238typedef short yytype_int16;
239#endif
240
241/* Work around bug in HP-UX 11.23, which defines these macros
242 incorrectly for preprocessor constants. This workaround can likely
243 be removed in 2023, as HPE has promised support for HP-UX 11.23
244 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
245 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
246#ifdef __hpux
247#undef UINT_LEAST8_MAX
248#undef UINT_LEAST16_MAX
249#define UINT_LEAST8_MAX 255
250#define UINT_LEAST16_MAX 65535
251#endif
252
253#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
254typedef __UINT_LEAST8_TYPE__ yytype_uint8;
255#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H && \
256 UINT_LEAST8_MAX <= INT_MAX)
257typedef uint_least8_t yytype_uint8;
258#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
259typedef unsigned char yytype_uint8;
260#else
261typedef short yytype_uint8;
262#endif
263
264#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
265typedef __UINT_LEAST16_TYPE__ yytype_uint16;
266#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H && \
267 UINT_LEAST16_MAX <= INT_MAX)
268typedef uint_least16_t yytype_uint16;
269#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
270typedef unsigned short yytype_uint16;
271#else
272typedef int yytype_uint16;
273#endif
274
275#ifndef YYPTRDIFF_T
276#if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
277#define YYPTRDIFF_T __PTRDIFF_TYPE__
278#define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
279#elif defined PTRDIFF_MAX
280#ifndef ptrdiff_t
281#include <stddef.h> /* INFRINGES ON USER NAME SPACE */
282#endif
283#define YYPTRDIFF_T ptrdiff_t
284#define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
285#else
286#define YYPTRDIFF_T long
287#define YYPTRDIFF_MAXIMUM LONG_MAX
288#endif
289#endif
290
291#ifndef YYSIZE_T
292#ifdef __SIZE_TYPE__
293#define YYSIZE_T __SIZE_TYPE__
294#elif defined size_t
295#define YYSIZE_T size_t
296#elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
297#include <stddef.h> /* INFRINGES ON USER NAME SPACE */
298#define YYSIZE_T size_t
299#else
300#define YYSIZE_T unsigned
301#endif
302#endif
303
304#define YYSIZE_MAXIMUM \
305 YY_CAST(YYPTRDIFF_T, \
306 (YYPTRDIFF_MAXIMUM < YY_CAST(YYSIZE_T, -1) ? YYPTRDIFF_MAXIMUM \
307 : YY_CAST(YYSIZE_T, -1)))
308
309#define YYSIZEOF(X) YY_CAST(YYPTRDIFF_T, sizeof(X))
310
311/* Stored state numbers (used for stacks). */
313
314/* State numbers in computations. */
315typedef int yy_state_fast_t;
316
317#ifndef YY_
318#if defined YYENABLE_NLS && YYENABLE_NLS
319#if ENABLE_NLS
320#include <libintl.h> /* INFRINGES ON USER NAME SPACE */
321#define YY_(Msgid) dgettext("bison-runtime", Msgid)
322#endif
323#endif
324#ifndef YY_
325#define YY_(Msgid) Msgid
326#endif
327#endif
328
329#ifndef YY_ATTRIBUTE_PURE
330#if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
331#define YY_ATTRIBUTE_PURE __attribute__((__pure__))
332#else
333#define YY_ATTRIBUTE_PURE
334#endif
335#endif
336
337#ifndef YY_ATTRIBUTE_UNUSED
338#if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
339#define YY_ATTRIBUTE_UNUSED __attribute__((__unused__))
340#else
341#define YY_ATTRIBUTE_UNUSED
342#endif
343#endif
344
345/* Suppress unused-variable warnings by "using" E. */
346#if !defined lint || defined __GNUC__
347#define YY_USE(E) ((void)(E))
348#else
349#define YY_USE(E) /* empty */
350#endif
351
352#if defined __GNUC__ && !defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
353/* Suppress an incorrect diagnostic about yylval being uninitialized. */
354#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
355 _Pragma("GCC diagnostic push") \
356 _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
357 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
358#define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop")
359#else
360#define YY_INITIAL_VALUE(Value) Value
361#endif
362#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
363#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
364#define YY_IGNORE_MAYBE_UNINITIALIZED_END
365#endif
366#ifndef YY_INITIAL_VALUE
367#define YY_INITIAL_VALUE(Value) /* Nothing. */
368#endif
369
370#if defined __cplusplus && defined __GNUC__ && !defined __ICC && 6 <= __GNUC__
371#define YY_IGNORE_USELESS_CAST_BEGIN \
372 _Pragma("GCC diagnostic push") \
373 _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"")
374#define YY_IGNORE_USELESS_CAST_END _Pragma("GCC diagnostic pop")
375#endif
376#ifndef YY_IGNORE_USELESS_CAST_BEGIN
377#define YY_IGNORE_USELESS_CAST_BEGIN
378#define YY_IGNORE_USELESS_CAST_END
379#endif
380
381#define YY_ASSERT(E) ((void)(0 && (E)))
382
383#if 1
384
385/* The parser invokes alloca or malloc; define the necessary symbols. */
386
387#ifdef YYSTACK_USE_ALLOCA
388#if YYSTACK_USE_ALLOCA
389#ifdef __GNUC__
390#define YYSTACK_ALLOC __builtin_alloca
391#elif defined __BUILTIN_VA_ARG_INCR
392#include <alloca.h> /* INFRINGES ON USER NAME SPACE */
393#elif defined _AIX
394#define YYSTACK_ALLOC __alloca
395#elif defined _MSC_VER
396#include <malloc.h> /* INFRINGES ON USER NAME SPACE */
397#define alloca _alloca
398#else
399#define YYSTACK_ALLOC alloca
400#if !defined _ALLOCA_H && !defined EXIT_SUCCESS
401#include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
402/* Use EXIT_SUCCESS as a witness for stdlib.h. */
403#ifndef EXIT_SUCCESS
404#define EXIT_SUCCESS 0
405#endif
406#endif
407#endif
408#endif
409#endif
410
411#ifdef YYSTACK_ALLOC
412/* Pacify GCC's 'empty if-body' warning. */
413#define YYSTACK_FREE(Ptr) \
414 do { /* empty */ \
415 ; \
416 } while (0)
417#ifndef YYSTACK_ALLOC_MAXIMUM
418/* The OS might guarantee only one guard page at the bottom of the stack,
419 and a page size can be as small as 4096 bytes. So we cannot safely
420 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
421 to allow for a few compiler-allocated temporary stack slots. */
422#define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
423#endif
424#else
425#define YYSTACK_ALLOC YYMALLOC
426#define YYSTACK_FREE YYFREE
427#ifndef YYSTACK_ALLOC_MAXIMUM
428#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
429#endif
430#if (defined __cplusplus && !defined EXIT_SUCCESS && \
431 !((defined YYMALLOC || defined malloc) && \
432 (defined YYFREE || defined free)))
433#include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
434#ifndef EXIT_SUCCESS
435#define EXIT_SUCCESS 0
436#endif
437#endif
438#ifndef YYMALLOC
439#define YYMALLOC malloc
440#if !defined malloc && !defined EXIT_SUCCESS
441void* malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
442#endif
443#endif
444#ifndef YYFREE
445#define YYFREE free
446#if !defined free && !defined EXIT_SUCCESS
447void free(void*); /* INFRINGES ON USER NAME SPACE */
448#endif
449#endif
450#endif
451#endif /* 1 */
452
453#if (!defined yyoverflow && \
454 (!defined __cplusplus || \
455 (defined ORFZ_STYPE_IS_TRIVIAL && ORFZ_STYPE_IS_TRIVIAL)))
456
457/* A type that is properly aligned for any stack member. */
458union yyalloc {
461};
462
463/* The size of the maximum gap between one aligned stack and the next. */
464#define YYSTACK_GAP_MAXIMUM (YYSIZEOF(union yyalloc) - 1)
465
466/* The size of an array large to enough to hold all stacks, each with
467 N elements. */
468#define YYSTACK_BYTES(N) \
469 ((N) * (YYSIZEOF(yy_state_t) + YYSIZEOF(YYSTYPE)) + YYSTACK_GAP_MAXIMUM)
470
471#define YYCOPY_NEEDED 1
472
473/* Relocate STACK from its old location to the new one. The
474 local variables YYSIZE and YYSTACKSIZE give the old and new number of
475 elements in the stack, and YYPTR gives the new location of the
476 stack. Advance YYPTR to a properly aligned location for the next
477 stack. */
478#define YYSTACK_RELOCATE(Stack_alloc, Stack) \
479 do { \
480 YYPTRDIFF_T yynewbytes; \
481 YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \
482 Stack = &yyptr->Stack_alloc; \
483 yynewbytes = yystacksize * YYSIZEOF(*Stack) + YYSTACK_GAP_MAXIMUM; \
484 yyptr += yynewbytes / YYSIZEOF(*yyptr); \
485 } while (0)
486
487#endif
488
489#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
490/* Copy COUNT objects from SRC to DST. The source and destination do
491 not overlap. */
492#ifndef YYCOPY
493#if defined __GNUC__ && 1 < __GNUC__
494#define YYCOPY(Dst, Src, Count) \
495 __builtin_memcpy(Dst, Src, YY_CAST(YYSIZE_T, (Count)) * sizeof(*(Src)))
496#else
497#define YYCOPY(Dst, Src, Count) \
498 do { \
499 YYPTRDIFF_T yyi; \
500 for (yyi = 0; yyi < (Count); yyi++) (Dst)[yyi] = (Src)[yyi]; \
501 } while (0)
502#endif
503#endif
504#endif /* !YYCOPY_NEEDED */
505
506/* YYFINAL -- State number of the termination state. */
507#define YYFINAL 3
508/* YYLAST -- Last index in YYTABLE. */
509#define YYLAST 271
510
511/* YYNTOKENS -- Number of terminals. */
512#define YYNTOKENS 32
513/* YYNNTS -- Number of nonterminals. */
514#define YYNNTS 32
515/* YYNRULES -- Number of rules. */
516#define YYNRULES 96
517/* YYNSTATES -- Number of states. */
518#define YYNSTATES 223
519
520/* YYMAXUTOK -- Last valid token kind. */
521#define YYMAXUTOK 276
522
523/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
524 as returned by yylex, with out-of-bounds checking. */
525#define YYTRANSLATE(YYX) \
526 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
527 ? YY_CAST(yysymbol_kind_t, yytranslate[YYX]) \
528 : YYSYMBOL_YYUNDEF)
529
530/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
531 as returned by yylex. */
532static const yytype_int8 yytranslate[] = {
533 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 23, 24, 2, 2, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 22,
536 2, 29, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 2, 28, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 30, 2, 31, 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, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
546 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21};
547
548#if ORFZ_DEBUG
549/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
550static const yytype_int16 yyrline[] = {
551 0, 103, 103, 110, 114, 115, 120, 123, 124, 127, 128, 129, 130, 133,
552 134, 137, 138, 145, 146, 149, 168, 183, 194, 209, 220, 246, 279, 349,
553 350, 353, 354, 355, 358, 362, 368, 369, 382, 400, 401, 402, 403, 410,
554 411, 412, 413, 420, 421, 428, 429, 430, 433, 434, 437, 438, 439, 444,
555 445, 448, 449, 450, 455, 456, 457, 462, 463, 467, 468, 474, 478, 484,
556 485, 488, 500, 501, 504, 505, 506, 507, 508, 513, 544, 561, 586, 595,
557 599, 602, 603, 606, 607, 608, 609, 619, 628, 634, 649, 657, 668};
558#endif
559
561#define YY_ACCESSING_SYMBOL(State) YY_CAST(yysymbol_kind_t, yystos[State])
562
563#if 1
564/* The user-facing name of the symbol whose (internal) number is
565 YYSYMBOL. No bounds checking. */
566static const char* yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
567
568/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
569 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
570static const char* const yytname[] = {"\"end of file\"",
571 "error",
572 "\"invalid token\"",
573 "ARRAY",
574 "TOKEN_BOOL",
575 "CONSTRAINT",
576 "TOKEN_FLOAT",
577 "TOKEN_INT",
578 "MAXIMIZE",
579 "MINIMIZE",
580 "OF",
581 "PREDICATE",
582 "SATISFY",
583 "SET",
584 "SOLVE",
585 "VAR",
586 "DOTDOT",
587 "COLONCOLON",
588 "IVALUE",
589 "SVALUE",
590 "IDENTIFIER",
591 "DVALUE",
592 "';'",
593 "'('",
594 "')'",
595 "','",
596 "':'",
597 "'['",
598 "']'",
599 "'='",
600 "'{'",
601 "'}'",
602 "$accept",
603 "model",
604 "predicates",
605 "predicate",
606 "predicate_arguments",
607 "predicate_argument",
608 "predicate_array_argument",
609 "predicate_ints",
610 "variable_or_constant_declarations",
611 "variable_or_constant_declaration",
612 "optional_var_or_value",
613 "optional_var_or_value_array",
614 "var_or_value_array",
615 "var_or_value",
616 "int_domain",
617 "set_domain",
618 "float_domain",
619 "domain",
620 "integers",
621 "integer",
622 "floats",
623 "float",
624 "const_literal",
625 "const_literals",
626 "constraints",
627 "constraint",
628 "arguments",
629 "argument",
630 "annotations",
631 "annotation_arguments",
632 "annotation",
633 "solve",
634 YY_NULLPTR};
635
636static const char* yysymbol_name(yysymbol_kind_t yysymbol) {
637 return yytname[yysymbol];
638}
639#endif
640
641#ifdef YYPRINT
642/* YYTOKNUM[NUM] -- (External) token number corresponding to the
643 (internal) symbol number NUM (which must be that of a token). */
644static const yytype_int16 yytoknum[] = {0, 256, 257, 258, 259, 260, 261, 262,
645 263, 264, 265, 266, 267, 268, 269, 270,
646 271, 272, 273, 274, 275, 276, 59, 40,
647 41, 44, 58, 91, 93, 61, 123, 125};
648#endif
649
650#define YYPACT_NINF (-182)
651
652#define yypact_value_is_default(Yyn) ((Yyn) == YYPACT_NINF)
653
654#define YYTABLE_NINF (-19)
655
656#define yytable_value_is_error(Yyn) 0
657
658/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
659 STATE-NUM. */
660static const yytype_int16 yypact[] = {
661 -182, 49, 7, -182, -15, 67, 114, 20, -182, 95, -182, 99,
662 -182, -182, -182, 136, 76, 122, 141, 11, 154, -182, -182, -182,
663 143, 130, 40, 157, 12, 151, 160, 158, -182, 155, 118, -182,
664 -182, 161, 163, -182, 162, 164, 165, 76, 156, 166, 159, 171,
665 -182, -182, 172, 11, 169, -182, -182, 175, 11, -182, -182, 167,
666 125, -182, -182, 27, 168, -182, 40, 176, 177, 179, 120, -182,
667 170, -182, 22, 80, 80, 80, -182, 121, 174, 184, 173, -182,
668 182, -182, -182, 178, -182, -182, 59, -182, 75, 187, -182, 180,
669 -182, 93, 11, 131, -182, -182, -182, 188, -182, 96, 121, -182,
670 198, 190, 199, -182, 200, 150, -182, 195, 185, -182, 34, -182,
671 196, 197, -182, 186, -182, 31, -182, 128, -182, 80, 201, 121,
672 202, 84, -182, -182, -182, 56, 60, -182, 203, 204, -182, 129,
673 -182, 189, 205, 150, -182, -182, 207, -182, -182, 147, 206, 121,
674 -182, 76, 192, 76, 209, 210, 211, -182, 212, -182, -182, 213,
675 -182, -182, -182, -182, 216, 208, 217, 218, 219, 224, -182, -182,
676 225, -182, 226, -182, -182, -182, -182, -182, 74, 85, 87, 91,
677 220, 221, 222, 223, -182, 97, 75, 64, 104, -182, 133, -182,
678 137, 227, -182, -182, 138, -182, -182, 139, -182, 75, -182, 214,
679 153, -182, -182, -182, 228, -182, -182};
680
681/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
682 Performed when YYTABLE does not specify something else to do. Zero
683 means the default is an error. */
684static const yytype_int8 yydefact[] = {
685 5, 0, 0, 1, 0, 0, 0, 70, 4, 0, 3, 0, 37, 45, 38, 0, 0, 0, 0,
686 0, 0, 47, 48, 49, 0, 0, 0, 0, 0, 0, 0, 0, 52, 53, 0, 51, 17, 0,
687 0, 84, 0, 0, 0, 0, 0, 8, 0, 0, 41, 42, 0, 0, 0, 39, 46, 0, 0,
688 40, 84, 0, 0, 69, 2, 0, 0, 6, 0, 0, 0, 0, 0, 84, 0, 50, 0, 0,
689 0, 0, 94, 0, 16, 0, 0, 13, 0, 7, 9, 0, 43, 44, 28, 54, 0, 74, 76,
690 79, 75, 0, 0, 0, 73, 96, 95, 88, 89, 90, 0, 83, 0, 0, 0, 10, 0, 0,
691 25, 60, 65, 64, 0, 19, 0, 0, 34, 35, 82, 0, 33, 0, 84, 0, 0, 0, 0,
692 0, 86, 15, 14, 0, 0, 27, 0, 0, 63, 0, 77, 0, 0, 0, 81, 78, 71, 72,
693 87, 0, 0, 0, 93, 0, 0, 0, 0, 0, 0, 61, 0, 62, 80, 0, 32, 91, 92,
694 85, 0, 0, 0, 0, 0, 0, 66, 36, 0, 11, 0, 84, 84, 84, 12, 84, 0, 0,
695 0, 31, 0, 0, 0, 0, 26, 0, 0, 0, 0, 21, 0, 68, 0, 58, 57, 23, 0,
696 56, 30, 0, 20, 0, 24, 0, 0, 22, 29, 67, 0, 55, 59};
697
698/* YYPGOTO[NTERM-NUM]. */
699static const yytype_int16 yypgoto[] = {
700 -182, -182, -182, -182, 191, -182, -182, 108, -182, -182, -182,
701 -182, 25, -107, 88, 89, 92, -7, -50, 215, -182, 13,
702 -181, -182, -182, -182, -182, -72, -56, 100, -76, -182};
703
704/* YYDEFGOTO[NTERM-NUM]. */
705static const yytype_uint8 yydefgoto[] = {
706 0, 1, 2, 6, 44, 45, 82, 83, 7, 20, 114, 196, 125, 126, 21, 22,
707 23, 46, 34, 35, 208, 209, 119, 204, 25, 40, 99, 100, 60, 133, 134, 41};
708
709/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
710 positive, shift that token. If negative, reduce the rule whose
711 number is the opposite. If YYTABLE_NINF, syntax error. */
712static const yytype_int16 yytable[] = {
713 24, 70, 74, 107, 101, 102, 139, 8, 4, 29, -18, -18, -18, -18, -18,
714 90, 48, 203, 5, 49, -18, -18, -18, 11, 12, -18, 13, 14, -18, 32,
715 50, 33, 219, 15, 80, 16, 64, -18, 17, 79, 168, 18, 51, 42, 12,
716 81, 13, 14, 127, 3, 19, 92, 32, 15, 33, 43, 147, 151, 17, 148,
717 12, 18, 13, 14, 12, 142, 13, 14, 143, 15, 19, 157, 150, 15, 17,
718 159, 79, 18, 17, 171, 12, 18, 13, 14, 205, 206, 19, 9, 113, 15,
719 19, 79, 207, 115, 17, 116, 117, 18, 93, 94, 95, 96, 79, 192, 79,
720 118, 19, 97, 79, 155, 98, 122, 156, 123, 193, 32, 194, 33, 26, 131,
721 195, 124, 122, 132, 123, 201, 27, 188, 189, 190, 158, 191, 210, 76, 77,
722 38, 10, 78, 30, 103, 104, 105, 79, 56, 39, 56, 28, 202, 106, 57,
723 172, 89, 174, 56, 56, 128, 129, 31, 56, 149, 165, 212, 213, 216, 147,
724 214, 217, 218, 122, 37, 123, 169, 155, 205, 206, 47, 36, 52, 53, 54,
725 65, 58, 55, 59, 61, 67, 62, 68, 69, 71, 75, 66, 63, 72, 84,
726 87, 86, 88, 91, 108, 109, 110, 111, 120, 130, 80, 112, 121, 136, 137,
727 138, 140, 141, 146, 144, 145, 135, 166, 173, 152, 154, 163, 164, 167, 79,
728 211, 160, 161, 181, 221, 162, 153, 220, 0, 170, 175, 176, 177, 183, 184,
729 178, 179, 180, 182, 185, 186, 187, 197, 198, 199, 200, 0, 0, 0, 215,
730 0, 222, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
731 0, 73};
732
733static const yytype_int16 yycheck[] = {
734 7, 51, 58, 79, 76, 77, 113, 22, 1, 16, 3, 4, 5, 6, 7, 71,
735 4, 198, 11, 7, 13, 14, 15, 3, 4, 18, 6, 7, 21, 18, 18, 20,
736 213, 13, 7, 15, 43, 30, 18, 17, 147, 21, 30, 3, 4, 18, 6, 7,
737 98, 0, 30, 29, 18, 13, 20, 15, 25, 129, 18, 28, 4, 21, 6, 7,
738 4, 31, 6, 7, 118, 13, 30, 15, 128, 13, 18, 15, 17, 21, 18, 155,
739 4, 21, 6, 7, 20, 21, 30, 20, 29, 13, 30, 17, 28, 18, 18, 20,
740 21, 21, 18, 19, 20, 21, 17, 29, 17, 30, 30, 27, 17, 25, 30, 18,
741 28, 20, 29, 18, 29, 20, 23, 23, 29, 28, 18, 27, 20, 28, 27, 183,
742 184, 185, 137, 187, 28, 8, 9, 5, 22, 12, 16, 18, 19, 20, 17, 25,
743 14, 25, 10, 197, 27, 31, 157, 31, 159, 25, 25, 24, 25, 16, 25, 31,
744 31, 28, 25, 25, 25, 28, 28, 28, 18, 26, 20, 24, 25, 20, 21, 18,
745 22, 26, 18, 21, 24, 20, 27, 20, 22, 26, 22, 16, 16, 20, 23, 25,
746 27, 18, 26, 18, 20, 18, 28, 25, 16, 28, 20, 16, 16, 7, 28, 27,
747 18, 10, 10, 16, 27, 27, 18, 18, 108, 28, 26, 18, 18, 18, 18, 18,
748 17, 200, 138, 138, 20, 216, 138, 131, 18, -1, 28, 26, 26, 26, 20, 20,
749 28, 28, 26, 26, 20, 20, 20, 27, 27, 27, 27, -1, -1, -1, 27, -1,
750 28, 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56};
751
752/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
753 symbol of state STATE-NUM. */
754static 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, 28, 44, 45, 50, 24, 25, 16, 23, 27,
762 61, 62, 39, 18, 10, 10, 45, 16, 27, 31, 50, 18, 18, 27, 25, 28, 31, 60, 59,
763 18, 61, 18, 25, 28, 15, 49, 15, 46, 47, 48, 18, 18, 31, 28, 18, 45, 24, 28,
764 62, 49, 26, 49, 26, 26, 26, 28, 28, 26, 20, 26, 20, 20, 20, 20, 20, 60, 60,
765 60, 60, 29, 29, 29, 29, 43, 27, 27, 27, 27, 28, 50, 54, 55, 20, 21, 28, 52,
766 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. */
769static 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, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 49, 49, 49, 50,
773 50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 55,
774 55, 56, 56, 57, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, 60,
775 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. */
778static 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, 4, 1, 1, 3,
781 3, 3, 3, 5, 5, 1, 3, 1, 1, 1, 3, 1, 1, 1, 4, 3, 1, 1, 1, 4,
782 1, 3, 3, 2, 1, 1, 4, 3, 1, 3, 0, 6, 3, 1, 1, 1, 1, 3, 3, 1,
783 4, 3, 2, 3, 0, 3, 1, 3, 1, 1, 1, 4, 4, 3, 3, 4, 4};
784
785enum { 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);
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
869static 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
886static 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
904static 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. */
955typedef struct {
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. */
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. */
1000static 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. */
1014static 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. */
1033static 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
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. */
1117static 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
1192static 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`------------------------------------------------------------*/
1276yynewstate:
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`--------------------------------------------------------------------*/
1284yysetstate:
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*,
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`-----------*/
1355yybackup:
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`-----------------------------------------------------------*/
1417yydefault:
1418 yyn = yydefact[yystate];
1419 if (yyn == 0) goto yyerrlab;
1420 goto yyreduce;
1421
1422/*-----------------------------.
1423| yyreduce -- do a reduction. |
1424`-----------------------------*/
1425yyreduce:
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 114 "./ortools/flatzinc/parser.yy"
1443 {
1444 yyerrok;
1445 }
1446#line 1593 "./ortools/flatzinc/parser.tab.cc"
1447 break;
1448
1449 case 19: /* variable_or_constant_declaration: domain ':' IDENTIFIER
1450 annotations '=' const_literal */
1451#line 149 "./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(lperron): Check that the assignment is included in the domain.
1462 context->domain_map[identifier] = assignment;
1463 } else {
1464 const int64 value = assignment.values.front();
1465 CHECK(domain.Contains(value));
1466 context->integer_map[identifier] = value;
1467 }
1468 delete annotations;
1469 }
1470#line 1617 "./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 169 "./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 num_constants = (yyvsp[-10].integer_value);
1483 const std::string& identifier = (yyvsp[-5].string_value);
1484 const std::vector<int64>* const assignments = (yyvsp[-1].integers);
1485 CHECK(assignments != nullptr);
1486 CHECK_EQ(num_constants, assignments->size());
1487 // TODO(lperron): CHECK all values within domain.
1488 context->integer_array_map[identifier] = *assignments;
1489 delete assignments;
1490 delete annotations;
1491 }
1492#line 1636 "./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 184 "./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 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>();
1507 delete annotations;
1508 }
1509#line 1651 "./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 195 "./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 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(lperron): CHECK all values within domain.
1527 context->float_array_map[identifier] = *assignments;
1528 delete assignments;
1529 delete annotations;
1530 }
1531#line 1670 "./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 210 "./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 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 1685 "./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 221 "./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 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(lperron): check that all assignments are included in the domain.
1571 } else {
1572 std::vector<int64> 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 1715 "./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 246 "./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 VariableRefOrValue& assignment = (yyvsp[0].var_or_value);
1597 const bool introduced = ContainsId(annotations, "var_is_introduced") ||
1598 absl::StartsWith(identifier, "X_INTRODUCED");
1599 IntegerVariable* 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 1753 "./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 280 "./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 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 VariableRefOrValueArray* const assignments =
1637 (yyvsp[0].var_or_value_array);
1638 CHECK(assignments == nullptr ||
1639 assignments->variables.size() == num_vars);
1640 CHECK(assignments == nullptr || assignments->values.size() == num_vars);
1641 const bool introduced = ContainsId(annotations, "var_is_introduced") ||
1642 absl::StartsWith(identifier, "X_INTRODUCED");
1643
1644 std::vector<IntegerVariable*> vars(num_vars, nullptr);
1645
1646 for (int i = 0; i < num_vars; ++i) {
1647 const std::string var_name =
1648 absl::StrFormat("%s[%d]", identifier, i + 1);
1649 if (assignments == nullptr) {
1650 vars[i] = model->AddVariable(var_name, domain, introduced);
1651 } else if (assignments->variables[i] == nullptr) {
1652 // Assigned to an integer constant.
1653 const int64 value = assignments->values[i];
1654 CHECK(domain.Contains(value));
1655 vars[i] = model->AddVariable(var_name, Domain::IntegerValue(value),
1656 introduced);
1657 } else {
1658 IntegerVariable* const var = assignments->variables[i];
1659 CHECK(var != nullptr);
1660 vars[i] = var;
1661 vars[i]->Merge(var_name, domain, introduced);
1662 }
1663 }
1664 delete assignments;
1665
1666 // Register the variable array on the context.
1667 context->variable_array_map[identifier] = vars;
1668
1669 // We parse the annotations to build an output object if
1670 // needed. It's a bit more convoluted than the simple variable
1671 // output.
1672 if (annotations != nullptr) {
1673 for (int i = 0; i < annotations->size(); ++i) {
1674 const Annotation& ann = (*annotations)[i];
1675 if (ann.IsFunctionCallWithIdentifier("output_array")) {
1676 // We have found an output annotation.
1677 CHECK_EQ(1, ann.annotations.size());
1678 CHECK_EQ(Annotation::ANNOTATION_LIST, ann.annotations.back().type);
1679 const Annotation& list = ann.annotations.back();
1680 // Let's build the vector of bounds.
1681 std::vector<SolutionOutputSpecs::Bounds> bounds;
1682 for (int a = 0; a < list.annotations.size(); ++a) {
1683 const Annotation& bound = list.annotations[a];
1684 CHECK_EQ(Annotation::INTERVAL, bound.type);
1685 bounds.emplace_back(SolutionOutputSpecs::Bounds(
1686 bound.interval_min, bound.interval_max));
1687 }
1688 // We add the output information.
1689 model->AddOutput(SolutionOutputSpecs::MultiDimensionalArray(
1690 identifier, bounds, vars, domain.display_as_boolean));
1691 }
1692 }
1693 delete annotations;
1694 }
1695 }
1696#line 1825 "./ortools/flatzinc/parser.tab.cc"
1697 break;
1698
1699 case 27: /* optional_var_or_value: '=' var_or_value */
1700#line 349 "./ortools/flatzinc/parser.yy"
1701 {
1702 (yyval.var_or_value) = (yyvsp[0].var_or_value);
1703 }
1704#line 1831 "./ortools/flatzinc/parser.tab.cc"
1705 break;
1706
1707 case 28: /* optional_var_or_value: %empty */
1708#line 350 "./ortools/flatzinc/parser.yy"
1709 {
1710 (yyval.var_or_value) = VariableRefOrValue::Undefined();
1711 }
1712#line 1837 "./ortools/flatzinc/parser.tab.cc"
1713 break;
1714
1715 case 29: /* optional_var_or_value_array: '=' '[' var_or_value_array ']' */
1716#line 353 "./ortools/flatzinc/parser.yy"
1717 {
1718 (yyval.var_or_value_array) = (yyvsp[-1].var_or_value_array);
1719 }
1720#line 1843 "./ortools/flatzinc/parser.tab.cc"
1721 break;
1722
1723 case 30: /* optional_var_or_value_array: '=' '[' ']' */
1724#line 354 "./ortools/flatzinc/parser.yy"
1725 {
1726 (yyval.var_or_value_array) = nullptr;
1727 }
1728#line 1849 "./ortools/flatzinc/parser.tab.cc"
1729 break;
1730
1731 case 31: /* optional_var_or_value_array: %empty */
1732#line 355 "./ortools/flatzinc/parser.yy"
1733 {
1734 (yyval.var_or_value_array) = nullptr;
1735 }
1736#line 1855 "./ortools/flatzinc/parser.tab.cc"
1737 break;
1738
1739 case 32: /* var_or_value_array: var_or_value_array ',' var_or_value */
1740#line 358 "./ortools/flatzinc/parser.yy"
1741 {
1742 (yyval.var_or_value_array) = (yyvsp[-2].var_or_value_array);
1743 (yyval.var_or_value_array)->PushBack((yyvsp[0].var_or_value));
1744 }
1745#line 1864 "./ortools/flatzinc/parser.tab.cc"
1746 break;
1747
1748 case 33: /* var_or_value_array: var_or_value */
1749#line 362 "./ortools/flatzinc/parser.yy"
1750 {
1751 (yyval.var_or_value_array) = new VariableRefOrValueArray();
1752 (yyval.var_or_value_array)->PushBack((yyvsp[0].var_or_value));
1753 }
1754#line 1873 "./ortools/flatzinc/parser.tab.cc"
1755 break;
1756
1757 case 34: /* var_or_value: IVALUE */
1758#line 368 "./ortools/flatzinc/parser.yy"
1759 {
1760 (yyval.var_or_value) =
1761 VariableRefOrValue::Value((yyvsp[0].integer_value));
1762 }
1763#line 1879 "./ortools/flatzinc/parser.tab.cc"
1764 break;
1765
1766 case 35: /* var_or_value: IDENTIFIER */
1767#line 369 "./ortools/flatzinc/parser.yy"
1768 {
1769 // A reference to an existing integer constant or variable.
1770 const std::string& id = (yyvsp[0].string_value);
1771 if (gtl::ContainsKey(context->integer_map, id)) {
1772 (yyval.var_or_value) =
1774 } else if (gtl::ContainsKey(context->variable_map, id)) {
1775 (yyval.var_or_value) = VariableRefOrValue::VariableRef(
1776 gtl::FindOrDie(context->variable_map, id));
1777 } else {
1778 LOG(ERROR) << "Unknown symbol " << id;
1779 (yyval.var_or_value) = VariableRefOrValue::Undefined();
1780 *ok = false;
1781 }
1782 }
1783#line 1897 "./ortools/flatzinc/parser.tab.cc"
1784 break;
1785
1786 case 36: /* var_or_value: IDENTIFIER '[' IVALUE ']' */
1787#line 382 "./ortools/flatzinc/parser.yy"
1788 {
1789 // A given element of an existing constant array or variable array.
1790 const std::string& id = (yyvsp[-3].string_value);
1791 const int64 value = (yyvsp[-1].integer_value);
1792 if (gtl::ContainsKey(context->integer_array_map, id)) {
1793 (yyval.var_or_value) = VariableRefOrValue::Value(
1794 Lookup(gtl::FindOrDie(context->integer_array_map, id), value));
1795 } else if (gtl::ContainsKey(context->variable_array_map, id)) {
1796 (yyval.var_or_value) = VariableRefOrValue::VariableRef(
1797 Lookup(gtl::FindOrDie(context->variable_array_map, id), value));
1798 } else {
1799 LOG(ERROR) << "Unknown symbol " << id;
1800 (yyval.var_or_value) = VariableRefOrValue::Undefined();
1801 *ok = false;
1802 }
1803 }
1804#line 1918 "./ortools/flatzinc/parser.tab.cc"
1805 break;
1806
1807 case 37: /* int_domain: TOKEN_BOOL */
1808#line 400 "./ortools/flatzinc/parser.yy"
1809 {
1810 (yyval.domain) = Domain::Boolean();
1811 }
1812#line 1924 "./ortools/flatzinc/parser.tab.cc"
1813 break;
1814
1815 case 38: /* int_domain: TOKEN_INT */
1816#line 401 "./ortools/flatzinc/parser.yy"
1817 {
1818 (yyval.domain) = Domain::AllInt64();
1819 }
1820#line 1930 "./ortools/flatzinc/parser.tab.cc"
1821 break;
1822
1823 case 39: /* int_domain: IVALUE DOTDOT IVALUE */
1824#line 402 "./ortools/flatzinc/parser.yy"
1825 {
1826 (yyval.domain) =
1827 Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value));
1828 }
1829#line 1936 "./ortools/flatzinc/parser.tab.cc"
1830 break;
1831
1832 case 40: /* int_domain: '{' integers '}' */
1833#line 403 "./ortools/flatzinc/parser.yy"
1834 {
1835 CHECK((yyvsp[-1].integers) != nullptr);
1836 (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers)));
1837 delete (yyvsp[-1].integers);
1838 }
1839#line 1946 "./ortools/flatzinc/parser.tab.cc"
1840 break;
1841
1842 case 41: /* set_domain: SET OF TOKEN_BOOL */
1843#line 410 "./ortools/flatzinc/parser.yy"
1844 {
1845 (yyval.domain) = Domain::SetOfBoolean();
1846 }
1847#line 1952 "./ortools/flatzinc/parser.tab.cc"
1848 break;
1849
1850 case 42: /* set_domain: SET OF TOKEN_INT */
1851#line 411 "./ortools/flatzinc/parser.yy"
1852 {
1853 (yyval.domain) = Domain::SetOfAllInt64();
1854 }
1855#line 1958 "./ortools/flatzinc/parser.tab.cc"
1856 break;
1857
1858 case 43: /* set_domain: SET OF IVALUE DOTDOT IVALUE */
1859#line 412 "./ortools/flatzinc/parser.yy"
1860 {
1861 (yyval.domain) = Domain::SetOfInterval((yyvsp[-2].integer_value),
1862 (yyvsp[0].integer_value));
1863 }
1864#line 1964 "./ortools/flatzinc/parser.tab.cc"
1865 break;
1866
1867 case 44: /* set_domain: SET OF '{' integers '}' */
1868#line 413 "./ortools/flatzinc/parser.yy"
1869 {
1870 CHECK((yyvsp[-1].integers) != nullptr);
1871 (yyval.domain) =
1872 Domain::SetOfIntegerList(std::move(*(yyvsp[-1].integers)));
1873 delete (yyvsp[-1].integers);
1874 }
1875#line 1974 "./ortools/flatzinc/parser.tab.cc"
1876 break;
1877
1878 case 45: /* float_domain: TOKEN_FLOAT */
1879#line 420 "./ortools/flatzinc/parser.yy"
1880 {
1881 (yyval.domain) = Domain::AllInt64();
1882 }
1883#line 1980 "./ortools/flatzinc/parser.tab.cc"
1884 break;
1885
1886 case 46: /* float_domain: DVALUE DOTDOT DVALUE */
1887#line 421 "./ortools/flatzinc/parser.yy"
1888 {
1889 const int64 lb = ConvertAsIntegerOrDie((yyvsp[-2].double_value));
1890 const int64 ub = ConvertAsIntegerOrDie((yyvsp[0].double_value));
1891 (yyval.domain) = Domain::Interval(lb, ub);
1892 }
1893#line 1990 "./ortools/flatzinc/parser.tab.cc"
1894 break;
1895
1896 case 47: /* domain: int_domain */
1897#line 428 "./ortools/flatzinc/parser.yy"
1898 {
1899 (yyval.domain) = (yyvsp[0].domain);
1900 }
1901#line 1996 "./ortools/flatzinc/parser.tab.cc"
1902 break;
1903
1904 case 48: /* domain: set_domain */
1905#line 429 "./ortools/flatzinc/parser.yy"
1906 {
1907 (yyval.domain) = (yyvsp[0].domain);
1908 }
1909#line 2002 "./ortools/flatzinc/parser.tab.cc"
1910 break;
1911
1912 case 49: /* domain: float_domain */
1913#line 430 "./ortools/flatzinc/parser.yy"
1914 {
1915 (yyval.domain) = (yyvsp[0].domain);
1916 }
1917#line 2008 "./ortools/flatzinc/parser.tab.cc"
1918 break;
1919
1920 case 50: /* integers: integers ',' integer */
1921#line 433 "./ortools/flatzinc/parser.yy"
1922 {
1923 (yyval.integers) = (yyvsp[-2].integers);
1924 (yyval.integers)->emplace_back((yyvsp[0].integer_value));
1925 }
1926#line 2014 "./ortools/flatzinc/parser.tab.cc"
1927 break;
1928
1929 case 51: /* integers: integer */
1930#line 434 "./ortools/flatzinc/parser.yy"
1931 {
1932 (yyval.integers) = new std::vector<int64>();
1933 (yyval.integers)->emplace_back((yyvsp[0].integer_value));
1934 }
1935#line 2020 "./ortools/flatzinc/parser.tab.cc"
1936 break;
1937
1938 case 52: /* integer: IVALUE */
1939#line 437 "./ortools/flatzinc/parser.yy"
1940 {
1941 (yyval.integer_value) = (yyvsp[0].integer_value);
1942 }
1943#line 2026 "./ortools/flatzinc/parser.tab.cc"
1944 break;
1945
1946 case 53: /* integer: IDENTIFIER */
1947#line 438 "./ortools/flatzinc/parser.yy"
1948 {
1949 (yyval.integer_value) =
1950 gtl::FindOrDie(context->integer_map, (yyvsp[0].string_value));
1951 }
1952#line 2032 "./ortools/flatzinc/parser.tab.cc"
1953 break;
1954
1955 case 54: /* integer: IDENTIFIER '[' IVALUE ']' */
1956#line 439 "./ortools/flatzinc/parser.yy"
1957 {
1958 (yyval.integer_value) = Lookup(
1959 gtl::FindOrDie(context->integer_array_map, (yyvsp[-3].string_value)),
1960 (yyvsp[-1].integer_value));
1961 }
1962#line 2040 "./ortools/flatzinc/parser.tab.cc"
1963 break;
1964
1965 case 55: /* floats: floats ',' float */
1966#line 444 "./ortools/flatzinc/parser.yy"
1967 {
1968 (yyval.doubles) = (yyvsp[-2].doubles);
1969 (yyval.doubles)->emplace_back((yyvsp[0].double_value));
1970 }
1971#line 2046 "./ortools/flatzinc/parser.tab.cc"
1972 break;
1973
1974 case 56: /* floats: float */
1975#line 445 "./ortools/flatzinc/parser.yy"
1976 {
1977 (yyval.doubles) = new std::vector<double>();
1978 (yyval.doubles)->emplace_back((yyvsp[0].double_value));
1979 }
1980#line 2052 "./ortools/flatzinc/parser.tab.cc"
1981 break;
1982
1983 case 57: /* float: DVALUE */
1984#line 448 "./ortools/flatzinc/parser.yy"
1985 {
1986 (yyval.double_value) = (yyvsp[0].double_value);
1987 }
1988#line 2058 "./ortools/flatzinc/parser.tab.cc"
1989 break;
1990
1991 case 58: /* float: IDENTIFIER */
1992#line 449 "./ortools/flatzinc/parser.yy"
1993 {
1994 (yyval.double_value) =
1995 gtl::FindOrDie(context->float_map, (yyvsp[0].string_value));
1996 }
1997#line 2064 "./ortools/flatzinc/parser.tab.cc"
1998 break;
1999
2000 case 59: /* float: IDENTIFIER '[' IVALUE ']' */
2001#line 450 "./ortools/flatzinc/parser.yy"
2002 {
2003 (yyval.double_value) = Lookup(
2004 gtl::FindOrDie(context->float_array_map, (yyvsp[-3].string_value)),
2005 (yyvsp[-1].integer_value));
2006 }
2007#line 2072 "./ortools/flatzinc/parser.tab.cc"
2008 break;
2009
2010 case 60: /* const_literal: IVALUE */
2011#line 455 "./ortools/flatzinc/parser.yy"
2012 {
2013 (yyval.domain) = Domain::IntegerValue((yyvsp[0].integer_value));
2014 }
2015#line 2078 "./ortools/flatzinc/parser.tab.cc"
2016 break;
2017
2018 case 61: /* const_literal: IVALUE DOTDOT IVALUE */
2019#line 456 "./ortools/flatzinc/parser.yy"
2020 {
2021 (yyval.domain) =
2022 Domain::Interval((yyvsp[-2].integer_value), (yyvsp[0].integer_value));
2023 }
2024#line 2084 "./ortools/flatzinc/parser.tab.cc"
2025 break;
2026
2027 case 62: /* const_literal: '{' integers '}' */
2028#line 457 "./ortools/flatzinc/parser.yy"
2029 {
2030 CHECK((yyvsp[-1].integers) != nullptr);
2031 (yyval.domain) = Domain::IntegerList(std::move(*(yyvsp[-1].integers)));
2032 delete (yyvsp[-1].integers);
2033 }
2034#line 2094 "./ortools/flatzinc/parser.tab.cc"
2035 break;
2036
2037 case 63: /* const_literal: '{' '}' */
2038#line 462 "./ortools/flatzinc/parser.yy"
2039 {
2040 (yyval.domain) = Domain::EmptyDomain();
2041 }
2042#line 2100 "./ortools/flatzinc/parser.tab.cc"
2043 break;
2044
2045 case 64: /* const_literal: DVALUE */
2046#line 463 "./ortools/flatzinc/parser.yy"
2047 {
2048 CHECK_EQ(std::round((yyvsp[0].double_value)), (yyvsp[0].double_value));
2049 (yyval.domain) =
2050 Domain::IntegerValue(static_cast<int64>((yyvsp[0].double_value)));
2051 }
2052#line 2109 "./ortools/flatzinc/parser.tab.cc"
2053 break;
2054
2055 case 65: /* const_literal: IDENTIFIER */
2056#line 467 "./ortools/flatzinc/parser.yy"
2057 {
2058 (yyval.domain) = Domain::IntegerValue(
2059 gtl::FindOrDie(context->integer_map, (yyvsp[0].string_value)));
2060 }
2061#line 2115 "./ortools/flatzinc/parser.tab.cc"
2062 break;
2063
2064 case 66: /* const_literal: IDENTIFIER '[' IVALUE ']' */
2065#line 468 "./ortools/flatzinc/parser.yy"
2066 {
2067 (yyval.domain) = Domain::IntegerValue(Lookup(
2068 gtl::FindOrDie(context->integer_array_map, (yyvsp[-3].string_value)),
2069 (yyvsp[-1].integer_value)));
2070 }
2071#line 2124 "./ortools/flatzinc/parser.tab.cc"
2072 break;
2073
2074 case 67: /* const_literals: const_literals ',' const_literal */
2075#line 474 "./ortools/flatzinc/parser.yy"
2076 {
2077 (yyval.domains) = (yyvsp[-2].domains);
2078 (yyval.domains)->emplace_back((yyvsp[0].domain));
2079 }
2080#line 2133 "./ortools/flatzinc/parser.tab.cc"
2081 break;
2082
2083 case 68: /* const_literals: const_literal */
2084#line 478 "./ortools/flatzinc/parser.yy"
2085 {
2086 (yyval.domains) = new std::vector<Domain>();
2087 (yyval.domains)->emplace_back((yyvsp[0].domain));
2088 }
2089#line 2139 "./ortools/flatzinc/parser.tab.cc"
2090 break;
2091
2092 case 71: /* constraint: CONSTRAINT IDENTIFIER '(' arguments ')' annotations
2093 */
2094#line 488 "./ortools/flatzinc/parser.yy"
2095 {
2096 const std::string& identifier = (yyvsp[-4].string_value);
2097 CHECK((yyvsp[-2].args) != nullptr) << "Missing argument in constraint";
2098 const std::vector<Argument>& arguments = *(yyvsp[-2].args);
2099 std::vector<Annotation>* const annotations = (yyvsp[0].annotations);
2100
2101 model->AddConstraint(identifier, arguments,
2102 ContainsId(annotations, "domain"));
2103 delete annotations;
2104 delete (yyvsp[-2].args);
2105 }
2106#line 2154 "./ortools/flatzinc/parser.tab.cc"
2107 break;
2108
2109 case 72: /* arguments: arguments ',' argument */
2110#line 500 "./ortools/flatzinc/parser.yy"
2111 {
2112 (yyval.args) = (yyvsp[-2].args);
2113 (yyval.args)->emplace_back((yyvsp[0].arg));
2114 }
2115#line 2160 "./ortools/flatzinc/parser.tab.cc"
2116 break;
2117
2118 case 73: /* arguments: argument */
2119#line 501 "./ortools/flatzinc/parser.yy"
2120 {
2121 (yyval.args) = new std::vector<Argument>();
2122 (yyval.args)->emplace_back((yyvsp[0].arg));
2123 }
2124#line 2166 "./ortools/flatzinc/parser.tab.cc"
2125 break;
2126
2127 case 74: /* argument: IVALUE */
2128#line 504 "./ortools/flatzinc/parser.yy"
2129 {
2130 (yyval.arg) = Argument::IntegerValue((yyvsp[0].integer_value));
2131 }
2132#line 2172 "./ortools/flatzinc/parser.tab.cc"
2133 break;
2134
2135 case 75: /* argument: DVALUE */
2136#line 505 "./ortools/flatzinc/parser.yy"
2137 {
2138 (yyval.arg) = Argument::IntegerValue(
2139 ConvertAsIntegerOrDie((yyvsp[0].double_value)));
2140 }
2141#line 2178 "./ortools/flatzinc/parser.tab.cc"
2142 break;
2143
2144 case 76: /* argument: SVALUE */
2145#line 506 "./ortools/flatzinc/parser.yy"
2146 {
2147 (yyval.arg) = Argument::VoidArgument();
2148 }
2149#line 2184 "./ortools/flatzinc/parser.tab.cc"
2150 break;
2151
2152 case 77: /* argument: IVALUE DOTDOT IVALUE */
2153#line 507 "./ortools/flatzinc/parser.yy"
2154 {
2155 (yyval.arg) = Argument::Interval((yyvsp[-2].integer_value),
2156 (yyvsp[0].integer_value));
2157 }
2158#line 2190 "./ortools/flatzinc/parser.tab.cc"
2159 break;
2160
2161 case 78: /* argument: '{' integers '}' */
2162#line 508 "./ortools/flatzinc/parser.yy"
2163 {
2164 CHECK((yyvsp[-1].integers) != nullptr);
2165 (yyval.arg) = Argument::IntegerList(std::move(*(yyvsp[-1].integers)));
2166 delete (yyvsp[-1].integers);
2167 }
2168#line 2200 "./ortools/flatzinc/parser.tab.cc"
2169 break;
2170
2171 case 79: /* argument: IDENTIFIER */
2172#line 513 "./ortools/flatzinc/parser.yy"
2173 {
2174 const std::string& id = (yyvsp[0].string_value);
2175 if (gtl::ContainsKey(context->integer_map, id)) {
2176 (yyval.arg) =
2177 Argument::IntegerValue(gtl::FindOrDie(context->integer_map, id));
2178 } else if (gtl::ContainsKey(context->integer_array_map, id)) {
2179 (yyval.arg) = Argument::IntegerList(
2180 gtl::FindOrDie(context->integer_array_map, id));
2181 } else if (gtl::ContainsKey(context->float_map, id)) {
2182 const double d = gtl::FindOrDie(context->float_map, id);
2183 (yyval.arg) = Argument::IntegerValue(ConvertAsIntegerOrDie(d));
2184 } else if (gtl::ContainsKey(context->float_array_map, id)) {
2185 const auto& double_values =
2186 gtl::FindOrDie(context->float_array_map, id);
2187 std::vector<int64> integer_values;
2188 for (const double d : double_values) {
2189 const int64 i = ConvertAsIntegerOrDie(d);
2190 integer_values.push_back(i);
2191 }
2192 (yyval.arg) = Argument::IntegerList(std::move(integer_values));
2193 } else if (gtl::ContainsKey(context->variable_map, id)) {
2194 (yyval.arg) =
2195 Argument::IntVarRef(gtl::FindOrDie(context->variable_map, id));
2196 } else if (gtl::ContainsKey(context->variable_array_map, id)) {
2197 (yyval.arg) = Argument::IntVarRefArray(
2198 gtl::FindOrDie(context->variable_array_map, id));
2199 } else if (gtl::ContainsKey(context->domain_map, id)) {
2200 const Domain& d = gtl::FindOrDie(context->domain_map, id);
2201 (yyval.arg) = Argument::FromDomain(d);
2202 } else {
2203 CHECK(gtl::ContainsKey(context->domain_array_map, id))
2204 << "Unknown identifier: " << id;
2205 const std::vector<Domain>& d =
2206 gtl::FindOrDie(context->domain_array_map, id);
2207 (yyval.arg) = Argument::DomainList(d);
2208 }
2209 }
2210#line 2236 "./ortools/flatzinc/parser.tab.cc"
2211 break;
2212
2213 case 80: /* argument: IDENTIFIER '[' IVALUE ']' */
2214#line 544 "./ortools/flatzinc/parser.yy"
2215 {
2216 const std::string& id = (yyvsp[-3].string_value);
2217 const int64 index = (yyvsp[-1].integer_value);
2218 if (gtl::ContainsKey(context->integer_array_map, id)) {
2219 (yyval.arg) = Argument::IntegerValue(
2220 Lookup(gtl::FindOrDie(context->integer_array_map, id), index));
2221 } else if (gtl::ContainsKey(context->variable_array_map, id)) {
2222 (yyval.arg) = Argument::IntVarRef(
2223 Lookup(gtl::FindOrDie(context->variable_array_map, id), index));
2224 } else {
2225 CHECK(gtl::ContainsKey(context->domain_array_map, id))
2226 << "Unknown identifier: " << id;
2227 const Domain& d =
2228 Lookup(gtl::FindOrDie(context->domain_array_map, id), index);
2229 (yyval.arg) = Argument::FromDomain(d);
2230 }
2231 }
2232#line 2258 "./ortools/flatzinc/parser.tab.cc"
2233 break;
2234
2235 case 81: /* argument: '[' var_or_value_array ']' */
2236#line 561 "./ortools/flatzinc/parser.yy"
2237 {
2238 VariableRefOrValueArray* const arguments = (yyvsp[-1].var_or_value_array);
2239 CHECK(arguments != nullptr);
2240 bool has_variables = false;
2241 for (int i = 0; i < arguments->Size(); ++i) {
2242 if (arguments->variables[i] != nullptr) {
2243 has_variables = true;
2244 break;
2245 }
2246 }
2247 if (has_variables) {
2248 (yyval.arg) = Argument::IntVarRefArray(std::vector<IntegerVariable*>());
2249 (yyval.arg).variables.reserve(arguments->Size());
2250 for (int i = 0; i < arguments->Size(); ++i) {
2251 if (arguments->variables[i] != nullptr) {
2252 (yyval.arg).variables.emplace_back(arguments->variables[i]);
2253 } else {
2254 (yyval.arg).variables.emplace_back(
2255 model->AddConstant(arguments->values[i]));
2256 }
2257 }
2258 } else {
2259 (yyval.arg) = Argument::IntegerList(arguments->values);
2260 }
2261 delete arguments;
2262 }
2263#line 2288 "./ortools/flatzinc/parser.tab.cc"
2264 break;
2265
2266 case 82: /* argument: '[' ']' */
2267#line 586 "./ortools/flatzinc/parser.yy"
2268 {
2269 (yyval.arg) = Argument::VoidArgument();
2270 }
2271#line 2296 "./ortools/flatzinc/parser.tab.cc"
2272 break;
2273
2274 case 83: /* annotations: annotations COLONCOLON annotation */
2275#line 595 "./ortools/flatzinc/parser.yy"
2276 {
2277 (yyval.annotations) = (yyvsp[-2].annotations) != nullptr
2278 ? (yyvsp[-2].annotations)
2279 : new std::vector<Annotation>();
2280 (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2281 }
2282#line 2305 "./ortools/flatzinc/parser.tab.cc"
2283 break;
2284
2285 case 84: /* annotations: %empty */
2286#line 599 "./ortools/flatzinc/parser.yy"
2287 {
2288 (yyval.annotations) = nullptr;
2289 }
2290#line 2311 "./ortools/flatzinc/parser.tab.cc"
2291 break;
2292
2293 case 85: /* annotation_arguments: annotation_arguments ',' annotation */
2294#line 602 "./ortools/flatzinc/parser.yy"
2295 {
2296 (yyval.annotations) = (yyvsp[-2].annotations);
2297 (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2298 }
2299#line 2317 "./ortools/flatzinc/parser.tab.cc"
2300 break;
2301
2302 case 86: /* annotation_arguments: annotation */
2303#line 603 "./ortools/flatzinc/parser.yy"
2304 {
2305 (yyval.annotations) = new std::vector<Annotation>();
2306 (yyval.annotations)->emplace_back((yyvsp[0].annotation));
2307 }
2308#line 2323 "./ortools/flatzinc/parser.tab.cc"
2309 break;
2310
2311 case 87: /* annotation: IVALUE DOTDOT IVALUE */
2312#line 606 "./ortools/flatzinc/parser.yy"
2313 {
2314 (yyval.annotation) = Annotation::Interval((yyvsp[-2].integer_value),
2315 (yyvsp[0].integer_value));
2316 }
2317#line 2329 "./ortools/flatzinc/parser.tab.cc"
2318 break;
2319
2320 case 88: /* annotation: IVALUE */
2321#line 607 "./ortools/flatzinc/parser.yy"
2322 {
2323 (yyval.annotation) = Annotation::IntegerValue((yyvsp[0].integer_value));
2324 }
2325#line 2335 "./ortools/flatzinc/parser.tab.cc"
2326 break;
2327
2328 case 89: /* annotation: SVALUE */
2329#line 608 "./ortools/flatzinc/parser.yy"
2330 {
2331 (yyval.annotation) = Annotation::String((yyvsp[0].string_value));
2332 }
2333#line 2341 "./ortools/flatzinc/parser.tab.cc"
2334 break;
2335
2336 case 90: /* annotation: IDENTIFIER */
2337#line 609 "./ortools/flatzinc/parser.yy"
2338 {
2339 const std::string& id = (yyvsp[0].string_value);
2340 if (gtl::ContainsKey(context->variable_map, id)) {
2341 (yyval.annotation) =
2342 Annotation::Variable(gtl::FindOrDie(context->variable_map, id));
2343 } else if (gtl::ContainsKey(context->variable_array_map, id)) {
2344 (yyval.annotation) = Annotation::VariableList(
2345 gtl::FindOrDie(context->variable_array_map, id));
2346 } else {
2347 (yyval.annotation) = Annotation::Identifier(id);
2348 }
2349 }
2350#line 2356 "./ortools/flatzinc/parser.tab.cc"
2351 break;
2352
2353 case 91: /* annotation: IDENTIFIER '(' annotation_arguments ')' */
2354#line 619 "./ortools/flatzinc/parser.yy"
2355 {
2356 std::vector<Annotation>* const annotations = (yyvsp[-1].annotations);
2357 if (annotations != nullptr) {
2358 (yyval.annotation) = Annotation::FunctionCallWithArguments(
2359 (yyvsp[-3].string_value), std::move(*annotations));
2360 delete annotations;
2361 } else {
2362 (yyval.annotation) = Annotation::FunctionCall((yyvsp[-3].string_value));
2363 }
2364 }
2365#line 2370 "./ortools/flatzinc/parser.tab.cc"
2366 break;
2367
2368 case 92: /* annotation: IDENTIFIER '[' IVALUE ']' */
2369#line 628 "./ortools/flatzinc/parser.yy"
2370 {
2371 CHECK(gtl::ContainsKey(context->variable_array_map,
2372 (yyvsp[-3].string_value)))
2373 << "Unknown identifier: " << (yyvsp[-3].string_value);
2374 (yyval.annotation) = Annotation::Variable(Lookup(
2375 gtl::FindOrDie(context->variable_array_map, (yyvsp[-3].string_value)),
2376 (yyvsp[-1].integer_value)));
2377 }
2378#line 2381 "./ortools/flatzinc/parser.tab.cc"
2379 break;
2380
2381 case 93: /* annotation: '[' annotation_arguments ']' */
2382#line 634 "./ortools/flatzinc/parser.yy"
2383 {
2384 std::vector<Annotation>* const annotations = (yyvsp[-1].annotations);
2385 if (annotations != nullptr) {
2386 (yyval.annotation) =
2387 Annotation::AnnotationList(std::move(*annotations));
2388 delete annotations;
2389 } else {
2390 (yyval.annotation) = Annotation::Empty();
2391 }
2392 }
2393#line 2395 "./ortools/flatzinc/parser.tab.cc"
2394 break;
2395
2396 case 94: /* solve: SOLVE annotations SATISFY */
2397#line 649 "./ortools/flatzinc/parser.yy"
2398 {
2399 if ((yyvsp[-1].annotations) != nullptr) {
2400 model->Satisfy(std::move(*(yyvsp[-1].annotations)));
2401 delete (yyvsp[-1].annotations);
2402 } else {
2403 model->Satisfy(std::vector<Annotation>());
2404 }
2405 }
2406#line 2408 "./ortools/flatzinc/parser.tab.cc"
2407 break;
2408
2409 case 95: /* solve: SOLVE annotations MINIMIZE argument */
2410#line 657 "./ortools/flatzinc/parser.yy"
2411 {
2412 IntegerVariable* obj_var =
2413 (yyvsp[0].arg).type == Argument::INT_VAR_REF
2414 ? (yyvsp[0].arg).Var()
2415 : model->AddConstant((yyvsp[0].arg).Value());
2416 if ((yyvsp[-2].annotations) != nullptr) {
2417 model->Minimize(obj_var, std::move(*(yyvsp[-2].annotations)));
2418 delete (yyvsp[-2].annotations);
2419 } else {
2420 model->Minimize(obj_var, std::vector<Annotation>());
2421 }
2422 }
2423#line 2424 "./ortools/flatzinc/parser.tab.cc"
2424 break;
2425
2426 case 96: /* solve: SOLVE annotations MAXIMIZE argument */
2427#line 668 "./ortools/flatzinc/parser.yy"
2428 {
2429 IntegerVariable* obj_var =
2430 (yyvsp[0].arg).type == Argument::INT_VAR_REF
2431 ? (yyvsp[0].arg).Var()
2432 : model->AddConstant((yyvsp[0].arg).Value());
2433 if ((yyvsp[-2].annotations) != nullptr) {
2434 model->Maximize(obj_var, std::move(*(yyvsp[-2].annotations)));
2435 delete (yyvsp[-2].annotations);
2436 } else {
2437 model->Maximize(obj_var, std::vector<Annotation>());
2438 }
2439 }
2440#line 2440 "./ortools/flatzinc/parser.tab.cc"
2441 break;
2442
2443#line 2444 "./ortools/flatzinc/parser.tab.cc"
2444
2445 default:
2446 break;
2447 }
2448 /* User semantic actions sometimes alter yychar, and that requires
2449 that yytoken be updated with the new translation. We take the
2450 approach of translating immediately before every use of yytoken.
2451 One alternative is translating here after every semantic action,
2452 but that translation would be missed if the semantic action invokes
2453 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2454 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2455 incorrect destructor might then be invoked immediately. In the
2456 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2457 to an incorrect destructor call or verbose syntax error message
2458 before the lookahead is translated. */
2459 YY_SYMBOL_PRINT("-> $$ =", YY_CAST(yysymbol_kind_t, yyr1[yyn]), &yyval,
2460 &yyloc);
2461
2462 YYPOPSTACK(yylen);
2463 yylen = 0;
2464
2465 *++yyvsp = yyval;
2466
2467 /* Now 'shift' the result of the reduction. Determine what state
2468 that goes to, based on the state we popped back to and the rule
2469 number reduced by. */
2470 {
2471 const int yylhs = yyr1[yyn] - YYNTOKENS;
2472 const int yyi = yypgoto[yylhs] + *yyssp;
2473 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2474 ? yytable[yyi]
2475 : yydefgoto[yylhs]);
2476 }
2477
2478 goto yynewstate;
2479
2480/*--------------------------------------.
2481| yyerrlab -- here on detecting error. |
2482`--------------------------------------*/
2483yyerrlab:
2484 /* Make sure we have latest lookahead translation. See comments at
2485 user semantic actions for why this is necessary. */
2486 yytoken = yychar == ORFZ_EMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE(yychar);
2487 /* If not already recovering from an error, report this error. */
2488 if (!yyerrstatus) {
2489 ++yynerrs;
2490 {
2491 yypcontext_t yyctx = {yyssp, yytoken};
2492 char const* yymsgp = YY_("syntax error");
2493 int yysyntax_error_status;
2494 yysyntax_error_status = yysyntax_error(&yymsg_alloc, &yymsg, &yyctx);
2495 if (yysyntax_error_status == 0)
2496 yymsgp = yymsg;
2497 else if (yysyntax_error_status == -1) {
2498 if (yymsg != yymsgbuf) YYSTACK_FREE(yymsg);
2499 yymsg = YY_CAST(char*, YYSTACK_ALLOC(YY_CAST(YYSIZE_T, yymsg_alloc)));
2500 if (yymsg) {
2501 yysyntax_error_status = yysyntax_error(&yymsg_alloc, &yymsg, &yyctx);
2502 yymsgp = yymsg;
2503 } else {
2504 yymsg = yymsgbuf;
2505 yymsg_alloc = sizeof yymsgbuf;
2506 yysyntax_error_status = YYENOMEM;
2507 }
2508 }
2509 yyerror(context, model, ok, scanner, yymsgp);
2510 if (yysyntax_error_status == YYENOMEM) goto yyexhaustedlab;
2511 }
2512 }
2513
2514 if (yyerrstatus == 3) {
2515 /* If just tried and failed to reuse lookahead token after an
2516 error, discard it. */
2517
2518 if (yychar <= ORFZ_EOF) {
2519 /* Return failure if at end of input. */
2520 if (yychar == ORFZ_EOF) YYABORT;
2521 } else {
2522 yydestruct("Error: discarding", yytoken, &yylval, context, model, ok,
2523 scanner);
2524 yychar = ORFZ_EMPTY;
2525 }
2526 }
2527
2528 /* Else will try to reuse lookahead token after shifting the error
2529 token. */
2530 goto yyerrlab1;
2531
2532/*---------------------------------------------------.
2533| yyerrorlab -- error raised explicitly by YYERROR. |
2534`---------------------------------------------------*/
2535yyerrorlab:
2536 /* Pacify compilers when the user code never invokes YYERROR and the
2537 label yyerrorlab therefore never appears in user code. */
2538 if (0) YYERROR;
2539
2540 /* Do not reclaim the symbols of the rule whose action triggered
2541 this YYERROR. */
2542 YYPOPSTACK(yylen);
2543 yylen = 0;
2544 YY_STACK_PRINT(yyss, yyssp);
2545 yystate = *yyssp;
2546 goto yyerrlab1;
2547
2548/*-------------------------------------------------------------.
2549| yyerrlab1 -- common code for both syntax error and YYERROR. |
2550`-------------------------------------------------------------*/
2551yyerrlab1:
2552 yyerrstatus = 3; /* Each real token shifted decrements this. */
2553
2554 /* Pop stack until we find a state that shifts the error token. */
2555 for (;;) {
2556 yyn = yypact[yystate];
2557 if (!yypact_value_is_default(yyn)) {
2558 yyn += YYSYMBOL_YYerror;
2559 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) {
2560 yyn = yytable[yyn];
2561 if (0 < yyn) break;
2562 }
2563 }
2564
2565 /* Pop the current state because it cannot handle the error token. */
2566 if (yyssp == yyss) YYABORT;
2567
2568 yydestruct("Error: popping", YY_ACCESSING_SYMBOL(yystate), yyvsp, context,
2569 model, ok, scanner);
2570 YYPOPSTACK(1);
2571 yystate = *yyssp;
2572 YY_STACK_PRINT(yyss, yyssp);
2573 }
2574
2576 *++yyvsp = yylval;
2578
2579 /* Shift the error token. */
2580 YY_SYMBOL_PRINT("Shifting", YY_ACCESSING_SYMBOL(yyn), yyvsp, yylsp);
2581
2582 yystate = yyn;
2583 goto yynewstate;
2584
2585/*-------------------------------------.
2586| yyacceptlab -- YYACCEPT comes here. |
2587`-------------------------------------*/
2588yyacceptlab:
2589 yyresult = 0;
2590 goto yyreturn;
2591
2592/*-----------------------------------.
2593| yyabortlab -- YYABORT comes here. |
2594`-----------------------------------*/
2595yyabortlab:
2596 yyresult = 1;
2597 goto yyreturn;
2598
2599#if 1
2600/*-------------------------------------------------.
2601| yyexhaustedlab -- memory exhaustion comes here. |
2602`-------------------------------------------------*/
2603yyexhaustedlab:
2604 yyerror(context, model, ok, scanner, YY_("memory exhausted"));
2605 yyresult = 2;
2606 goto yyreturn;
2607#endif
2608
2609/*-------------------------------------------------------.
2610| yyreturn -- parsing is finished, clean up and return. |
2611`-------------------------------------------------------*/
2612yyreturn:
2613 if (yychar != ORFZ_EMPTY) {
2614 /* Make sure we have latest lookahead translation. See comments at
2615 user semantic actions for why this is necessary. */
2616 yytoken = YYTRANSLATE(yychar);
2617 yydestruct("Cleanup: discarding lookahead", yytoken, &yylval, context,
2618 model, ok, scanner);
2619 }
2620 /* Do not reclaim the symbols of the rule whose action triggered
2621 this YYABORT or YYACCEPT. */
2622 YYPOPSTACK(yylen);
2623 YY_STACK_PRINT(yyss, yyssp);
2624 while (yyssp != yyss) {
2625 yydestruct("Cleanup: popping", YY_ACCESSING_SYMBOL(+*yyssp), yyvsp, context,
2626 model, ok, scanner);
2627 YYPOPSTACK(1);
2628 }
2629#ifndef yyoverflow
2630 if (yyss != yyssa) YYSTACK_FREE(yyss);
2631#endif
2632 if (yymsg != yymsgbuf) YYSTACK_FREE(yymsg);
2633 return yyresult;
2634}
2635
2636#line 680 "./ortools/flatzinc/parser.yy"
#define CHECK(condition)
Definition: base/logging.h:495
#define CHECK_EQ(val1, val2)
Definition: base/logging.h:697
#define LOG(severity)
Definition: base/logging.h:420
SharedBoundsManager * bounds
int64 value
IntVar * var
Definition: expr_array.cc:1858
GRBmodel * model
GurobiMPCallbackContext * context
int64_t int64
const int ERROR
Definition: log_severity.h:32
const Collection::value_type::second_type & FindOrDie(const Collection &collection, const typename Collection::value_type::first_type &key)
Definition: map_util.h:176
bool ContainsKey(const Collection &collection, const Key &key)
Definition: map_util.h:170
int64 ConvertAsIntegerOrDie(double d)
Definition: parser_util.cc:65
bool ContainsId(std::vector< Annotation > *annotations, const std::string &id)
Definition: parser_util.cc:43
const T & Lookup(const std::vector< T > &v, int index)
Definition: parser_util.cc:75
bool AllDomainsHaveOneValue(const std::vector< Domain > &domains)
Definition: parser_util.cc:56
std::function< int64(const Model &)> Value(IntegerVariable v)
Definition: integer.h:1487
int index
Definition: pack.cc:508
static const char * yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED
Definition: parser.tab.cc:636
static YYPTRDIFF_T yystrlen(const char *yystr)
Definition: parser.tab.cc:1000
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Definition: parser.tab.cc:363
#define YYMAXDEPTH
Definition: parser.tab.cc:951
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 YYSTACK_FREE
Definition: parser.tab.cc:426
static const yytype_int8 yytranslate[]
Definition: parser.tab.cc:532
yysymbol_kind_t
Definition: parser.tab.cc:111
@ YYSYMBOL_integer
Definition: parser.tab.cc:166
@ YYSYMBOL_25_
Definition: parser.tab.cc:138
@ YYSYMBOL_YYUNDEF
Definition: parser.tab.cc:115
@ YYSYMBOL_const_literals
Definition: parser.tab.cc:170
@ YYSYMBOL_optional_var_or_value_array
Definition: parser.tab.cc:158
@ YYSYMBOL_float_domain
Definition: parser.tab.cc:163
@ YYSYMBOL_var_or_value_array
Definition: parser.tab.cc:159
@ YYSYMBOL_var_or_value
Definition: parser.tab.cc:160
@ YYSYMBOL_DVALUE
Definition: parser.tab.cc:134
@ YYSYMBOL_SVALUE
Definition: parser.tab.cc:132
@ YYSYMBOL_26_
Definition: parser.tab.cc:139
@ YYSYMBOL_YYerror
Definition: parser.tab.cc:114
@ YYSYMBOL_SET
Definition: parser.tab.cc:126
@ YYSYMBOL_IVALUE
Definition: parser.tab.cc:131
@ YYSYMBOL_predicate
Definition: parser.tab.cc:148
@ YYSYMBOL_SATISFY
Definition: parser.tab.cc:125
@ YYSYMBOL_29_
Definition: parser.tab.cc:142
@ YYSYMBOL_TOKEN_FLOAT
Definition: parser.tab.cc:119
@ YYSYMBOL_28_
Definition: parser.tab.cc:141
@ YYSYMBOL_variable_or_constant_declarations
Definition: parser.tab.cc:153
@ YYSYMBOL_annotation
Definition: parser.tab.cc:177
@ YYSYMBOL_predicate_arguments
Definition: parser.tab.cc:149
@ YYSYMBOL_constraints
Definition: parser.tab.cc:171
@ YYSYMBOL_variable_or_constant_declaration
Definition: parser.tab.cc:155
@ YYSYMBOL_annotations
Definition: parser.tab.cc:175
@ YYSYMBOL_floats
Definition: parser.tab.cc:167
@ YYSYMBOL_model
Definition: parser.tab.cc:146
@ YYSYMBOL_integers
Definition: parser.tab.cc:165
@ YYSYMBOL_solve
Definition: parser.tab.cc:178
@ YYSYMBOL_arguments
Definition: parser.tab.cc:173
@ YYSYMBOL_optional_var_or_value
Definition: parser.tab.cc:157
@ YYSYMBOL_predicate_array_argument
Definition: parser.tab.cc:151
@ YYSYMBOL_annotation_arguments
Definition: parser.tab.cc:176
@ YYSYMBOL_DOTDOT
Definition: parser.tab.cc:129
@ YYSYMBOL_TOKEN_INT
Definition: parser.tab.cc:120
@ YYSYMBOL_VAR
Definition: parser.tab.cc:128
@ YYSYMBOL_set_domain
Definition: parser.tab.cc:162
@ YYSYMBOL_TOKEN_BOOL
Definition: parser.tab.cc:117
@ YYSYMBOL_constraint
Definition: parser.tab.cc:172
@ YYSYMBOL_MINIMIZE
Definition: parser.tab.cc:122
@ YYSYMBOL_ARRAY
Definition: parser.tab.cc:116
@ YYSYMBOL_float
Definition: parser.tab.cc:168
@ YYSYMBOL_predicate_argument
Definition: parser.tab.cc:150
@ YYSYMBOL_COLONCOLON
Definition: parser.tab.cc:130
@ YYSYMBOL_const_literal
Definition: parser.tab.cc:169
@ YYSYMBOL_predicate_ints
Definition: parser.tab.cc:152
@ YYSYMBOL_YYACCEPT
Definition: parser.tab.cc:145
@ YYSYMBOL_30_
Definition: parser.tab.cc:143
@ YYSYMBOL_23_
Definition: parser.tab.cc:136
@ YYSYMBOL_domain
Definition: parser.tab.cc:164
@ YYSYMBOL_YYEOF
Definition: parser.tab.cc:113
@ YYSYMBOL_OF
Definition: parser.tab.cc:123
@ YYSYMBOL_22_
Definition: parser.tab.cc:135
@ YYSYMBOL_24_
Definition: parser.tab.cc:137
@ YYSYMBOL_27_
Definition: parser.tab.cc:140
@ YYSYMBOL_argument
Definition: parser.tab.cc:174
@ YYSYMBOL_YYEMPTY
Definition: parser.tab.cc:112
@ YYSYMBOL_IDENTIFIER
Definition: parser.tab.cc:133
@ YYSYMBOL_predicates
Definition: parser.tab.cc:147
@ YYSYMBOL_int_domain
Definition: parser.tab.cc:161
@ YYSYMBOL_PREDICATE
Definition: parser.tab.cc:124
@ YYSYMBOL_31_
Definition: parser.tab.cc:144
@ YYSYMBOL_CONSTRAINT
Definition: parser.tab.cc:118
@ YYSYMBOL_MAXIMIZE
Definition: parser.tab.cc:121
@ YYSYMBOL_SOLVE
Definition: parser.tab.cc:127
#define yyerrok
Definition: parser.tab.cc:787
#define YY_ASSERT(E)
Definition: parser.tab.cc:381
#define YY_(Msgid)
Definition: parser.tab.cc:325
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
Definition: parser.tab.cc:364
static const yytype_int8 yydefact[]
Definition: parser.tab.cc:684
#define YYNSTATES
Definition: parser.tab.cc:518
#define YYSTYPE
Definition: parser.tab.cc:80
#define YY_IGNORE_USELESS_CAST_END
Definition: parser.tab.cc:378
short yytype_int16
Definition: parser.tab.cc:238
#define YYABORT
Definition: parser.tab.cc:791
static const yytype_int16 yyrline[]
Definition: parser.tab.cc:550
#define YYSTACK_BYTES(N)
Definition: parser.tab.cc:468
yytype_uint8 yy_state_t
Definition: parser.tab.cc:312
#define YY_REDUCE_PRINT(Rule)
Definition: parser.tab.cc:922
#define YY_CAST(Type, Val)
Definition: parser.tab.cc:93
static const yytype_int16 yypact[]
Definition: parser.tab.cc:660
#define yylex
Definition: parser.tab.cc:83
#define YYCASE_(N, S)
static const yytype_uint8 yydefgoto[]
Definition: parser.tab.cc:705
#define YY_NULLPTR
Definition: parser.tab.cc:105
static void yy_symbol_print(FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, operations_research::fz::ParserContext *context, operations_research::fz::Model *model, bool *ok, void *scanner)
Definition: parser.tab.cc:869
#define YYFINAL
Definition: parser.tab.cc:507
#define YY_ACCESSING_SYMBOL(State)
Accessing symbol of state STATE.
Definition: parser.tab.cc:561
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
Definition: parser.tab.cc:833
static const yytype_int16 yypgoto[]
Definition: parser.tab.cc:699
#define YY_INITIAL_VALUE(Value)
Definition: parser.tab.cc:360
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
@ YYENOMEM
Definition: parser.tab.cc:785
static YYPTRDIFF_T yytnamerr(char *yyres, const char *yystr)
Definition: parser.tab.cc:1033
#define yyparse
Definition: parser.tab.cc:82
#define YYNTOKENS
Definition: parser.tab.cc:512
unsigned char yytype_uint8
Definition: parser.tab.cc:259
#define YY_STACK_PRINT(Bottom, Top)
Definition: parser.tab.cc:895
#define YYSIZE_T
Definition: parser.tab.cc:300
#define YYSTACK_ALLOC_MAXIMUM
Definition: parser.tab.cc:428
#define yydebug
Definition: parser.tab.cc:85
#define YY_IGNORE_USELESS_CAST_BEGIN
Definition: parser.tab.cc:377
static const yytype_int8 yyr2[]
Definition: parser.tab.cc:778
void * malloc(YYSIZE_T)
#define YYPTRDIFF_T
Definition: parser.tab.cc:286
#define yynerrs
Definition: parser.tab.cc:86
static const yytype_int16 yytable[]
Definition: parser.tab.cc:712
#define YYACCEPT
Definition: parser.tab.cc:790
#define yytable_value_is_error(Yyn)
Definition: parser.tab.cc:656
#define YYTRANSLATE(YYX)
Definition: parser.tab.cc:525
static const yytype_int8 yystos[]
Definition: parser.tab.cc:754
#define YY_ATTRIBUTE_UNUSED
Definition: parser.tab.cc:341
static const char *const yytname[]
Definition: parser.tab.cc:570
static int yypcontext_expected_tokens(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn)
Definition: parser.tab.cc:966
static const yytype_int8 yyr1[]
Definition: parser.tab.cc:769
static char * yystpcpy(char *yydest, const char *yysrc)
Definition: parser.tab.cc:1014
#define YYPOPSTACK(N)
int yy_state_fast_t
Definition: parser.tab.cc:315
unsigned short yytype_uint16
Definition: parser.tab.cc:270
#define YYLAST
Definition: parser.tab.cc:509
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
Definition: parser.tab.cc:478
#define yypact_value_is_default(Yyn)
Definition: parser.tab.cc:652
#define YYINITDEPTH
Definition: parser.tab.cc:940
static int yy_syntax_error_arguments(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn)
Definition: parser.tab.cc:1068
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
signed char yytype_int8
Definition: parser.tab.cc:230
void free(void *)
#define YYERROR
Definition: parser.tab.cc:792
static void yy_stack_print(yy_state_t *yybottom, yy_state_t *yytop)
Definition: parser.tab.cc:886
#define YYSIZEOF(X)
Definition: parser.tab.cc:309
#define YYFPRINTF
Definition: parser.tab.cc:820
static const yytype_int16 yycheck[]
Definition: parser.tab.cc:733
#define YYSTACK_ALLOC
Definition: parser.tab.cc:425
#define YYDPRINTF(Args)
Definition: parser.tab.cc:823
#define YY_USE(E)
Definition: parser.tab.cc:347
#define yyerror
Definition: parser.tab.cc:84
static int yysyntax_error(YYPTRDIFF_T *yymsg_alloc, char **yymsg, const yypcontext_t *yyctx)
Definition: parser.tab.cc:1117
yylval
Definition: parser.yy.cc:963
int64 bound
bool IsFunctionCallWithIdentifier(const std::string &identifier) const
std::vector< Annotation > annotations
bool Contains(int64 value) const
Definition: model.cc:265
std::vector< int64 > values
std::vector< IntegerVariable * > variables
Definition: parser_util.h:73
yysymbol_kind_t yytoken
Definition: parser.tab.cc:957
yy_state_t * yyssp
Definition: parser.tab.cc:956
YYSTYPE yyvs_alloc
Definition: parser.tab.cc:460
yy_state_t yyss_alloc
Definition: parser.tab.cc:459