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