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