this repo has no description
1#line 1 "gecode/flatzinc/lexer.yy.cpp"
2
3#line 3 "gecode/flatzinc/lexer.yy.cpp"
4
5#define YY_INT_ALIGNED short int
6
7/* A lexical scanner generated by flex */
8
9#define FLEX_SCANNER
10#define YY_FLEX_MAJOR_VERSION 2
11#define YY_FLEX_MINOR_VERSION 6
12#define YY_FLEX_SUBMINOR_VERSION 4
13#if YY_FLEX_SUBMINOR_VERSION > 0
14#define FLEX_BETA
15#endif
16
17#ifdef yyget_lval
18#define yyget_lval_ALREADY_DEFINED
19#else
20#define yyget_lval yyget_lval
21#endif
22
23#ifdef yyset_lval
24#define yyset_lval_ALREADY_DEFINED
25#else
26#define yyset_lval yyset_lval
27#endif
28
29/* First, we deal with platform-specific or compiler-specific issues. */
30
31/* begin standard C headers. */
32#include <stdio.h>
33#include <string.h>
34#include <errno.h>
35#include <stdlib.h>
36
37/* end standard C headers. */
38
39/* flex integer type definitions */
40
41#ifndef FLEXINT_H
42#define FLEXINT_H
43
44/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
45
46#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
47
48/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
49 * if you want the limit (max/min) macros for int types.
50 */
51#ifndef __STDC_LIMIT_MACROS
52#define __STDC_LIMIT_MACROS 1
53#endif
54
55#include <inttypes.h>
56typedef int8_t flex_int8_t;
57typedef uint8_t flex_uint8_t;
58typedef int16_t flex_int16_t;
59typedef uint16_t flex_uint16_t;
60typedef int32_t flex_int32_t;
61typedef uint32_t flex_uint32_t;
62#else
63typedef signed char flex_int8_t;
64typedef short int flex_int16_t;
65typedef int flex_int32_t;
66typedef unsigned char flex_uint8_t;
67typedef unsigned short int flex_uint16_t;
68typedef unsigned int flex_uint32_t;
69
70/* Limits of integral types. */
71#ifndef INT8_MIN
72#define INT8_MIN (-128)
73#endif
74#ifndef INT16_MIN
75#define INT16_MIN (-32767-1)
76#endif
77#ifndef INT32_MIN
78#define INT32_MIN (-2147483647-1)
79#endif
80#ifndef INT8_MAX
81#define INT8_MAX (127)
82#endif
83#ifndef INT16_MAX
84#define INT16_MAX (32767)
85#endif
86#ifndef INT32_MAX
87#define INT32_MAX (2147483647)
88#endif
89#ifndef UINT8_MAX
90#define UINT8_MAX (255U)
91#endif
92#ifndef UINT16_MAX
93#define UINT16_MAX (65535U)
94#endif
95#ifndef UINT32_MAX
96#define UINT32_MAX (4294967295U)
97#endif
98
99#ifndef SIZE_MAX
100#define SIZE_MAX (~(size_t)0)
101#endif
102
103#endif /* ! C99 */
104
105#endif /* ! FLEXINT_H */
106
107/* begin standard C++ headers. */
108
109/* TODO: this is always defined, so inline it */
110#define yyconst const
111
112#if defined(__GNUC__) && __GNUC__ >= 3
113#define yynoreturn __attribute__((__noreturn__))
114#else
115#define yynoreturn
116#endif
117
118/* Returned upon end-of-file. */
119#define YY_NULL 0
120
121/* Promotes a possibly negative, possibly signed char to an
122 * integer in range [0..255] for use as an array index.
123 */
124#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
125
126/* An opaque pointer. */
127#ifndef YY_TYPEDEF_YY_SCANNER_T
128#define YY_TYPEDEF_YY_SCANNER_T
129typedef void* yyscan_t;
130#endif
131
132/* For convenience, these vars (plus the bison vars far below)
133 are macros in the reentrant scanner. */
134#define yyin yyg->yyin_r
135#define yyout yyg->yyout_r
136#define yyextra yyg->yyextra_r
137#define yyleng yyg->yyleng_r
138#define yytext yyg->yytext_r
139#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
140#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
141#define yy_flex_debug yyg->yy_flex_debug_r
142
143/* Enter a start condition. This macro really ought to take a parameter,
144 * but we do it the disgusting crufty way forced on us by the ()-less
145 * definition of BEGIN.
146 */
147#define BEGIN yyg->yy_start = 1 + 2 *
148/* Translate the current start state into a value that can be later handed
149 * to BEGIN to return to the state. The YYSTATE alias is for lex
150 * compatibility.
151 */
152#define YY_START ((yyg->yy_start - 1) / 2)
153#define YYSTATE YY_START
154/* Action number for EOF rule of a given start state. */
155#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
156/* Special action meaning "start processing a new file". */
157#define YY_NEW_FILE yyrestart( yyin , yyscanner )
158#define YY_END_OF_BUFFER_CHAR 0
159
160/* Size of default input buffer. */
161#ifndef YY_BUF_SIZE
162#ifdef __ia64__
163/* On IA-64, the buffer size is 16k, not 8k.
164 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
165 * Ditto for the __ia64__ case accordingly.
166 */
167#define YY_BUF_SIZE 32768
168#else
169#define YY_BUF_SIZE 16384
170#endif /* __ia64__ */
171#endif
172
173/* The state buf must be large enough to hold one state per character in the main buffer.
174 */
175#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
176
177#ifndef YY_TYPEDEF_YY_BUFFER_STATE
178#define YY_TYPEDEF_YY_BUFFER_STATE
179typedef struct yy_buffer_state *YY_BUFFER_STATE;
180#endif
181
182#ifndef YY_TYPEDEF_YY_SIZE_T
183#define YY_TYPEDEF_YY_SIZE_T
184typedef size_t yy_size_t;
185#endif
186
187#define EOB_ACT_CONTINUE_SCAN 0
188#define EOB_ACT_END_OF_FILE 1
189#define EOB_ACT_LAST_MATCH 2
190
191 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
192 * access to the local variable yy_act. Since yyless() is a macro, it would break
193 * existing scanners that call yyless() from OUTSIDE yylex.
194 * One obvious solution it to make yy_act a global. I tried that, and saw
195 * a 5% performance hit in a non-yylineno scanner, because yy_act is
196 * normally declared as a register variable-- so it is not worth it.
197 */
198 #define YY_LESS_LINENO(n) \
199 do { \
200 int yyl;\
201 for ( yyl = n; yyl < yyleng; ++yyl )\
202 if ( yytext[yyl] == '\n' )\
203 --yylineno;\
204 }while(0)
205 #define YY_LINENO_REWIND_TO(dst) \
206 do {\
207 const char *p;\
208 for ( p = yy_cp-1; p >= (dst); --p)\
209 if ( *p == '\n' )\
210 --yylineno;\
211 }while(0)
212
213/* Return all but the first "n" matched characters back to the input stream. */
214#define yyless(n) \
215 do \
216 { \
217 /* Undo effects of setting up yytext. */ \
218 int yyless_macro_arg = (n); \
219 YY_LESS_LINENO(yyless_macro_arg);\
220 *yy_cp = yyg->yy_hold_char; \
221 YY_RESTORE_YY_MORE_OFFSET \
222 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
223 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
224 } \
225 while ( 0 )
226#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
227
228#ifndef YY_STRUCT_YY_BUFFER_STATE
229#define YY_STRUCT_YY_BUFFER_STATE
230struct yy_buffer_state
231 {
232 FILE *yy_input_file;
233
234 char *yy_ch_buf; /* input buffer */
235 char *yy_buf_pos; /* current position in input buffer */
236
237 /* Size of input buffer in bytes, not including room for EOB
238 * characters.
239 */
240 int yy_buf_size;
241
242 /* Number of characters read into yy_ch_buf, not including EOB
243 * characters.
244 */
245 int yy_n_chars;
246
247 /* Whether we "own" the buffer - i.e., we know we created it,
248 * and can realloc() it to grow it, and should free() it to
249 * delete it.
250 */
251 int yy_is_our_buffer;
252
253 /* Whether this is an "interactive" input source; if so, and
254 * if we're using stdio for input, then we want to use getc()
255 * instead of fread(), to make sure we stop fetching input after
256 * each newline.
257 */
258 int yy_is_interactive;
259
260 /* Whether we're considered to be at the beginning of a line.
261 * If so, '^' rules will be active on the next match, otherwise
262 * not.
263 */
264 int yy_at_bol;
265
266 int yy_bs_lineno; /**< The line count. */
267 int yy_bs_column; /**< The column count. */
268
269 /* Whether to try to fill the input buffer when we reach the
270 * end of it.
271 */
272 int yy_fill_buffer;
273
274 int yy_buffer_status;
275
276#define YY_BUFFER_NEW 0
277#define YY_BUFFER_NORMAL 1
278 /* When an EOF's been seen but there's still some text to process
279 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
280 * shouldn't try reading from the input source any more. We might
281 * still have a bunch of tokens to match, though, because of
282 * possible backing-up.
283 *
284 * When we actually see the EOF, we change the status to "new"
285 * (via yyrestart()), so that the user can continue scanning by
286 * just pointing yyin at a new input file.
287 */
288#define YY_BUFFER_EOF_PENDING 2
289
290 };
291#endif /* !YY_STRUCT_YY_BUFFER_STATE */
292
293/* We provide macros for accessing buffer states in case in the
294 * future we want to put the buffer states in a more general
295 * "scanner state".
296 *
297 * Returns the top of the stack, or NULL.
298 */
299#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
300 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
301 : NULL)
302/* Same as previous macro, but useful when we know that the buffer stack is not
303 * NULL or when we need an lvalue. For internal use only.
304 */
305#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
306
307void yyrestart ( FILE *input_file , yyscan_t yyscanner );
308void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
309YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
310void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
311void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
312void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
313void yypop_buffer_state ( yyscan_t yyscanner );
314
315static void yyensure_buffer_stack ( yyscan_t yyscanner );
316static void yy_load_buffer_state ( yyscan_t yyscanner );
317static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
318#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
319
320YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
321YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
322YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
323
324void *yyalloc ( yy_size_t , yyscan_t yyscanner );
325void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
326void yyfree ( void * , yyscan_t yyscanner );
327
328#define yy_new_buffer yy_create_buffer
329#define yy_set_interactive(is_interactive) \
330 { \
331 if ( ! YY_CURRENT_BUFFER ){ \
332 yyensure_buffer_stack (yyscanner); \
333 YY_CURRENT_BUFFER_LVALUE = \
334 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
335 } \
336 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
337 }
338#define yy_set_bol(at_bol) \
339 { \
340 if ( ! YY_CURRENT_BUFFER ){\
341 yyensure_buffer_stack (yyscanner); \
342 YY_CURRENT_BUFFER_LVALUE = \
343 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
344 } \
345 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
346 }
347#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
348
349/* Begin user sect3 */
350
351#define yywrap(yyscanner) (/*CONSTCOND*/1)
352#define YY_SKIP_YYWRAP
353typedef flex_uint8_t YY_CHAR;
354
355typedef int yy_state_type;
356
357#define yytext_ptr yytext_r
358
359static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
360static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
361static int yy_get_next_buffer ( yyscan_t yyscanner );
362static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
363
364/* Done after the current pattern has been matched and before the
365 * corresponding action - sets up yytext.
366 */
367#define YY_DO_BEFORE_ACTION \
368 yyg->yytext_ptr = yy_bp; \
369 yyleng = (int) (yy_cp - yy_bp); \
370 yyg->yy_hold_char = *yy_cp; \
371 *yy_cp = '\0'; \
372 yyg->yy_c_buf_p = yy_cp;
373#define YY_NUM_RULES 56
374#define YY_END_OF_BUFFER 57
375/* This struct is not used in this scanner,
376 but its presence is necessary. */
377struct yy_trans_info
378 {
379 flex_int32_t yy_verify;
380 flex_int32_t yy_nxt;
381 };
382static const flex_int16_t yy_accept[221] =
383 { 0,
384 0, 0, 57, 55, 2, 1, 55, 3, 12, 55,
385 12, 6, 6, 12, 52, 55, 52, 52, 52, 52,
386 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
387 52, 52, 0, 54, 3, 6, 6, 13, 0, 0,
388 0, 0, 14, 52, 53, 0, 52, 52, 52, 52,
389 52, 52, 52, 52, 52, 52, 52, 28, 52, 52,
390 52, 52, 34, 52, 52, 52, 52, 52, 52, 52,
391 52, 52, 52, 52, 52, 52, 52, 52, 52, 9,
392 0, 11, 8, 7, 53, 52, 16, 52, 52, 52,
393 52, 52, 52, 52, 52, 52, 52, 52, 52, 30,
394
395 31, 52, 52, 52, 37, 52, 52, 52, 40, 52,
396 52, 52, 52, 52, 52, 52, 52, 49, 52, 0,
397 52, 52, 18, 19, 52, 52, 22, 52, 25, 52,
398 52, 52, 52, 52, 52, 52, 52, 52, 52, 42,
399 52, 52, 45, 46, 4, 52, 48, 52, 52, 0,
400 10, 52, 17, 52, 52, 52, 24, 5, 26, 52,
401 52, 52, 52, 52, 52, 52, 52, 52, 43, 52,
402 47, 52, 51, 52, 52, 52, 23, 52, 52, 52,
403 52, 36, 52, 39, 52, 52, 44, 52, 52, 52,
404 21, 52, 29, 52, 52, 52, 35, 52, 52, 52,
405
406 52, 27, 32, 33, 52, 52, 52, 52, 52, 38,
407 41, 52, 15, 20, 52, 52, 52, 52, 50, 0
408 } ;
409
410static const YY_CHAR yy_ec[256] =
411 { 0,
412 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
413 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 2, 1, 4, 1, 1, 5, 1, 1, 6,
416 6, 1, 7, 6, 8, 9, 1, 10, 11, 11,
417 11, 11, 11, 11, 11, 12, 12, 13, 6, 1,
418 6, 1, 1, 1, 14, 14, 14, 14, 15, 14,
419 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
420 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
421 6, 1, 6, 1, 17, 1, 18, 19, 20, 21,
422
423 22, 23, 24, 25, 26, 16, 16, 27, 28, 29,
424 30, 31, 16, 32, 33, 34, 35, 36, 37, 38,
425 39, 40, 6, 1, 6, 1, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
433
434 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439 1, 1, 1, 1, 1
440 } ;
441
442static const YY_CHAR yy_meta[41] =
443 { 0,
444 1, 1, 2, 1, 1, 1, 1, 1, 1, 3,
445 3, 3, 1, 4, 4, 5, 5, 4, 4, 4,
446 4, 4, 4, 5, 5, 5, 5, 5, 5, 5,
447 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
448 } ;
449
450static const flex_int16_t yy_base[227] =
451 { 0,
452 0, 0, 276, 277, 277, 277, 271, 0, 277, 31,
453 265, 35, 18, 260, 0, 255, 20, 241, 33, 248,
454 26, 40, 31, 247, 43, 36, 44, 246, 52, 56,
455 249, 241, 261, 277, 0, 0, 0, 277, 73, 82,
456 69, 0, 277, 0, 0, 247, 58, 231, 232, 228,
457 231, 236, 225, 75, 230, 226, 226, 0, 78, 220,
458 215, 223, 0, 217, 218, 227, 228, 213, 212, 215,
459 217, 211, 209, 219, 205, 208, 207, 205, 214, 89,
460 95, 103, 92, 0, 0, 205, 0, 216, 206, 210,
461 198, 212, 207, 202, 199, 193, 207, 204, 196, 0,
462
463 0, 196, 195, 189, 0, 198, 188, 191, 0, 179,
464 179, 188, 179, 183, 189, 183, 187, 182, 175, 109,
465 172, 166, 0, 0, 170, 168, 176, 178, 0, 178,
466 165, 164, 162, 168, 167, 159, 167, 160, 158, 173,
467 167, 159, 0, 0, 0, 165, 0, 168, 163, 112,
468 115, 166, 0, 151, 155, 158, 0, 0, 0, 154,
469 158, 152, 151, 142, 155, 153, 150, 152, 0, 147,
470 0, 141, 0, 135, 150, 133, 0, 136, 143, 124,
471 123, 0, 144, 0, 122, 130, 0, 125, 132, 131,
472 0, 127, 0, 133, 132, 119, 0, 123, 134, 120,
473
474 120, 0, 0, 0, 126, 113, 97, 89, 75, 0,
475 0, 86, 0, 0, 52, 38, 34, 43, 0, 277,
476 127, 132, 135, 137, 140, 142
477 } ;
478
479static const flex_int16_t yy_def[227] =
480 { 0,
481 220, 1, 220, 220, 220, 220, 221, 222, 220, 220,
482 220, 220, 12, 220, 223, 224, 223, 223, 223, 223,
483 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
484 223, 223, 221, 220, 222, 12, 13, 220, 220, 220,
485 220, 225, 220, 223, 226, 224, 223, 223, 223, 223,
486 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
487 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
488 223, 223, 223, 223, 223, 223, 223, 223, 223, 220,
489 220, 220, 220, 225, 226, 223, 223, 223, 223, 223,
490 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
491
492 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
493 223, 223, 223, 223, 223, 223, 223, 223, 223, 220,
494 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
495 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
496 223, 223, 223, 223, 223, 223, 223, 223, 223, 220,
497 220, 223, 223, 223, 223, 223, 223, 223, 223, 223,
498 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
499 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
500 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
501 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
502
503 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
504 223, 223, 223, 223, 223, 223, 223, 223, 223, 0,
505 220, 220, 220, 220, 220, 220
506 } ;
507
508static const flex_int16_t yy_nxt[318] =
509 { 0,
510 4, 5, 6, 7, 8, 9, 4, 10, 11, 12,
511 13, 13, 14, 15, 15, 15, 16, 17, 18, 19,
512 20, 21, 22, 15, 15, 23, 24, 25, 15, 26,
513 27, 28, 29, 30, 15, 31, 32, 15, 15, 15,
514 36, 37, 37, 39, 37, 37, 37, 220, 47, 40,
515 50, 48, 53, 58, 54, 220, 40, 55, 63, 59,
516 61, 65, 51, 219, 41, 218, 56, 217, 62, 68,
517 64, 216, 42, 69, 57, 66, 70, 73, 83, 83,
518 74, 71, 80, 80, 80, 72, 86, 75, 81, 81,
519 76, 82, 82, 82, 77, 94, 87, 99, 80, 80,
520
521 80, 83, 83, 120, 82, 82, 82, 215, 214, 95,
522 120, 100, 82, 82, 82, 150, 150, 213, 151, 151,
523 151, 151, 151, 151, 151, 151, 151, 33, 212, 33,
524 33, 33, 35, 211, 35, 35, 35, 44, 44, 44,
525 45, 45, 84, 84, 85, 85, 85, 210, 209, 208,
526 207, 206, 205, 204, 203, 202, 201, 200, 199, 198,
527 197, 196, 195, 194, 193, 192, 191, 190, 189, 188,
528 187, 186, 185, 184, 183, 182, 181, 180, 179, 178,
529 177, 176, 175, 174, 173, 172, 171, 170, 169, 168,
530 167, 166, 165, 164, 163, 162, 161, 160, 159, 158,
531
532 157, 156, 155, 154, 153, 152, 149, 148, 147, 146,
533 145, 144, 143, 142, 141, 140, 139, 138, 137, 136,
534 135, 134, 133, 132, 131, 130, 129, 128, 127, 126,
535 125, 124, 123, 122, 121, 119, 118, 117, 116, 115,
536 114, 113, 112, 111, 110, 109, 108, 107, 106, 105,
537 104, 103, 102, 101, 98, 97, 96, 93, 92, 91,
538 90, 89, 88, 46, 34, 79, 78, 67, 60, 52,
539 49, 46, 43, 38, 34, 220, 3, 220, 220, 220,
540 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
541 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
542
543 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
544 220, 220, 220, 220, 220, 220, 220
545 } ;
546
547static const flex_int16_t yy_chk[318] =
548 { 0,
549 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
550 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
551 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
552 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
553 10, 10, 10, 12, 12, 12, 12, 13, 17, 12,
554 19, 17, 21, 23, 21, 13, 12, 22, 26, 23,
555 25, 27, 19, 218, 12, 217, 22, 216, 25, 29,
556 26, 215, 12, 29, 22, 27, 29, 30, 41, 41,
557 30, 29, 39, 39, 39, 29, 47, 30, 40, 40,
558 30, 40, 40, 40, 30, 54, 47, 59, 80, 80,
559
560 80, 83, 83, 80, 81, 81, 81, 212, 209, 54,
561 80, 59, 82, 82, 82, 120, 120, 208, 120, 120,
562 120, 150, 150, 150, 151, 151, 151, 221, 207, 221,
563 221, 221, 222, 206, 222, 222, 222, 223, 223, 223,
564 224, 224, 225, 225, 226, 226, 226, 205, 201, 200,
565 199, 198, 196, 195, 194, 192, 190, 189, 188, 186,
566 185, 183, 181, 180, 179, 178, 176, 175, 174, 172,
567 170, 168, 167, 166, 165, 164, 163, 162, 161, 160,
568 156, 155, 154, 152, 149, 148, 146, 142, 141, 140,
569 139, 138, 137, 136, 135, 134, 133, 132, 131, 130,
570
571 128, 127, 126, 125, 122, 121, 119, 118, 117, 116,
572 115, 114, 113, 112, 111, 110, 108, 107, 106, 104,
573 103, 102, 99, 98, 97, 96, 95, 94, 93, 92,
574 91, 90, 89, 88, 86, 79, 78, 77, 76, 75,
575 74, 73, 72, 71, 70, 69, 68, 67, 66, 65,
576 64, 62, 61, 60, 57, 56, 55, 53, 52, 51,
577 50, 49, 48, 46, 33, 32, 31, 28, 24, 20,
578 18, 16, 14, 11, 7, 3, 220, 220, 220, 220,
579 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
580 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
581
582 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
583 220, 220, 220, 220, 220, 220, 220
584 } ;
585
586/* Table of booleans, true if rule could match eol. */
587static const flex_int32_t yy_rule_can_match_eol[57] =
588 { 0,
5891, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
590 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
591 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
592
593/* The intent behind this definition is that it'll catch
594 * any uses of REJECT which flex missed.
595 */
596#define REJECT reject_used_but_not_detected
597#define yymore() yymore_used_but_not_detected
598#define YY_MORE_ADJ 0
599#define YY_RESTORE_YY_MORE_OFFSET
600#line 1 "../gecode/flatzinc/lexer.lxx"
601/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
602/*
603 * Main authors:
604 * Guido Tack <tack@gecode.org>
605 *
606 * Copyright:
607 * Guido Tack, 2007
608 *
609 * This file is part of Gecode, the generic constraint
610 * development environment:
611 * http://www.gecode.org
612 *
613 * Permission is hereby granted, free of charge, to any person obtaining
614 * a copy of this software and associated documentation files (the
615 * "Software"), to deal in the Software without restriction, including
616 * without limitation the rights to use, copy, modify, merge, publish,
617 * distribute, sublicense, and/or sell copies of the Software, and to
618 * permit persons to whom the Software is furnished to do so, subject to
619 * the following conditions:
620 *
621 * The above copyright notice and this permission notice shall be
622 * included in all copies or substantial portions of the Software.
623 *
624 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
625 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
626 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
627 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
628 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
629 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
630 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
631 *
632 */
633#line 40 "../gecode/flatzinc/lexer.lxx"
634#if defined __GNUC__
635#pragma GCC diagnostic ignored "-Wunused-function"
636#pragma GCC diagnostic ignored "-Wunused-parameter"
637#pragma GCC diagnostic ignored "-Wsign-compare"
638#elif defined _MSC_VER
639#pragma warning(push, 1)
640#endif
641
642void yyerror(void*, const char*);
643#define yyerror(s) yyerror(yyextra, s)
644
645#include <errno.h>
646#include <stdlib.h>
647
648#include <gecode/flatzinc/parser.hh>
649
650const char* stringbuf;
651int stringbuflen;
652int stringbufpos;
653
654bool parseInt(const char* text, int& value) {
655 long int result = strtol(text,NULL,0);
656 if ( (result == LONG_MAX || result == LONG_MIN) && errno == ERANGE )
657 return false;
658 if (result < Gecode::Int::Limits::min || result > Gecode::Int::Limits::max)
659 return false;
660 value = static_cast<int>(result);
661 return true;
662}
663
664int yy_input_proc(char* buf, int size, yyscan_t yyscanner);
665#define YY_INPUT(buf, result, max_size) \
666 result = yy_input_proc(buf, max_size, yyscanner);
667#line 667 "gecode/flatzinc/lexer.yy.cpp"
668#line 668 "gecode/flatzinc/lexer.yy.cpp"
669
670#define INITIAL 0
671
672#ifndef YY_NO_UNISTD_H
673/* Special case for "unistd.h", since it is non-ANSI. We include it way
674 * down here because we want the user's section 1 to have been scanned first.
675 * The user has a chance to override it with an option.
676 */
677#include <unistd.h>
678#endif
679
680#ifndef YY_EXTRA_TYPE
681#define YY_EXTRA_TYPE void *
682#endif
683
684/* Holds the entire state of the reentrant scanner. */
685struct yyguts_t
686 {
687
688 /* User-defined. Not touched by flex. */
689 YY_EXTRA_TYPE yyextra_r;
690
691 /* The rest are the same as the globals declared in the non-reentrant scanner. */
692 FILE *yyin_r, *yyout_r;
693 size_t yy_buffer_stack_top; /**< index of top of stack. */
694 size_t yy_buffer_stack_max; /**< capacity of stack. */
695 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
696 char yy_hold_char;
697 int yy_n_chars;
698 int yyleng_r;
699 char *yy_c_buf_p;
700 int yy_init;
701 int yy_start;
702 int yy_did_buffer_switch_on_eof;
703 int yy_start_stack_ptr;
704 int yy_start_stack_depth;
705 int *yy_start_stack;
706 yy_state_type yy_last_accepting_state;
707 char* yy_last_accepting_cpos;
708
709 int yylineno_r;
710 int yy_flex_debug_r;
711
712 char *yytext_r;
713 int yy_more_flag;
714 int yy_more_len;
715
716 YYSTYPE * yylval_r;
717
718 }; /* end struct yyguts_t */
719
720static int yy_init_globals ( yyscan_t yyscanner );
721
722 /* This must go here because YYSTYPE and YYLTYPE are included
723 * from bison output in section 1.*/
724 # define yylval yyg->yylval_r
725
726int yylex_init (yyscan_t* scanner);
727
728int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
729
730/* Accessor methods to globals.
731 These are made visible to non-reentrant scanners for convenience. */
732
733int yylex_destroy ( yyscan_t yyscanner );
734
735int yyget_debug ( yyscan_t yyscanner );
736
737void yyset_debug ( int debug_flag , yyscan_t yyscanner );
738
739YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
740
741void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
742
743FILE *yyget_in ( yyscan_t yyscanner );
744
745void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
746
747FILE *yyget_out ( yyscan_t yyscanner );
748
749void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
750
751 int yyget_leng ( yyscan_t yyscanner );
752
753char *yyget_text ( yyscan_t yyscanner );
754
755int yyget_lineno ( yyscan_t yyscanner );
756
757void yyset_lineno ( int _line_number , yyscan_t yyscanner );
758
759int yyget_column ( yyscan_t yyscanner );
760
761void yyset_column ( int _column_no , yyscan_t yyscanner );
762
763YYSTYPE * yyget_lval ( yyscan_t yyscanner );
764
765void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
766
767/* Macros after this point can all be overridden by user definitions in
768 * section 1.
769 */
770
771#ifndef YY_SKIP_YYWRAP
772#ifdef __cplusplus
773extern "C" int yywrap ( yyscan_t yyscanner );
774#else
775extern int yywrap ( yyscan_t yyscanner );
776#endif
777#endif
778
779#ifndef YY_NO_UNPUT
780
781 static void yyunput ( int c, char *buf_ptr , yyscan_t yyscanner);
782
783#endif
784
785#ifndef yytext_ptr
786static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
787#endif
788
789#ifdef YY_NEED_STRLEN
790static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
791#endif
792
793#ifndef YY_NO_INPUT
794#ifdef __cplusplus
795static int yyinput ( yyscan_t yyscanner );
796#else
797static int input ( yyscan_t yyscanner );
798#endif
799
800#endif
801
802/* Amount of stuff to slurp up with each read. */
803#ifndef YY_READ_BUF_SIZE
804#ifdef __ia64__
805/* On IA-64, the buffer size is 16k, not 8k */
806#define YY_READ_BUF_SIZE 16384
807#else
808#define YY_READ_BUF_SIZE 8192
809#endif /* __ia64__ */
810#endif
811
812/* Copy whatever the last rule matched to the standard output. */
813#ifndef ECHO
814/* This used to be an fputs(), but since the string might contain NUL's,
815 * we now use fwrite().
816 */
817#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
818#endif
819
820/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
821 * is returned in "result".
822 */
823#ifndef YY_INPUT
824#define YY_INPUT(buf,result,max_size) \
825 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
826 { \
827 int c = '*'; \
828 int n; \
829 for ( n = 0; n < max_size && \
830 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
831 buf[n] = (char) c; \
832 if ( c == '\n' ) \
833 buf[n++] = (char) c; \
834 if ( c == EOF && ferror( yyin ) ) \
835 YY_FATAL_ERROR( "input in flex scanner failed" ); \
836 result = n; \
837 } \
838 else \
839 { \
840 errno=0; \
841 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
842 { \
843 if( errno != EINTR) \
844 { \
845 YY_FATAL_ERROR( "input in flex scanner failed" ); \
846 break; \
847 } \
848 errno=0; \
849 clearerr(yyin); \
850 } \
851 }\
852\
853
854#endif
855
856/* No semi-colon after return; correct usage is to write "yyterminate();" -
857 * we don't want an extra ';' after the "return" because that will cause
858 * some compilers to complain about unreachable statements.
859 */
860#ifndef yyterminate
861#define yyterminate() return YY_NULL
862#endif
863
864/* Number of entries by which start-condition stack grows. */
865#ifndef YY_START_STACK_INCR
866#define YY_START_STACK_INCR 25
867#endif
868
869/* Report a fatal error. */
870#ifndef YY_FATAL_ERROR
871#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
872#endif
873
874/* end tables serialization structures and prototypes */
875
876/* Default declaration of generated scanner - a define so the user can
877 * easily add parameters.
878 */
879#ifndef YY_DECL
880#define YY_DECL_IS_OURS 1
881
882extern int yylex \
883 (YYSTYPE * yylval_param , yyscan_t yyscanner);
884
885#define YY_DECL int yylex \
886 (YYSTYPE * yylval_param , yyscan_t yyscanner)
887#endif /* !YY_DECL */
888
889/* Code executed at the beginning of each rule, after yytext and yyleng
890 * have been set up.
891 */
892#ifndef YY_USER_ACTION
893#define YY_USER_ACTION
894#endif
895
896/* Code executed at the end of each rule. */
897#ifndef YY_BREAK
898#define YY_BREAK /*LINTED*/break;
899#endif
900
901#define YY_RULE_SETUP \
902 YY_USER_ACTION
903
904/** The main scanner function which does all the work.
905 */
906YY_DECL
907{
908 yy_state_type yy_current_state;
909 char *yy_cp, *yy_bp;
910 int yy_act;
911 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
912
913 yylval = yylval_param;
914
915 if ( !yyg->yy_init )
916 {
917 yyg->yy_init = 1;
918
919#ifdef YY_USER_INIT
920 YY_USER_INIT;
921#endif
922
923 if ( ! yyg->yy_start )
924 yyg->yy_start = 1; /* first start state */
925
926 if ( ! yyin )
927 yyin = stdin;
928
929 if ( ! yyout )
930 yyout = stdout;
931
932 if ( ! YY_CURRENT_BUFFER ) {
933 yyensure_buffer_stack (yyscanner);
934 YY_CURRENT_BUFFER_LVALUE =
935 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
936 }
937
938 yy_load_buffer_state( yyscanner );
939 }
940
941 {
942#line 75 "../gecode/flatzinc/lexer.lxx"
943
944
945#line 945 "gecode/flatzinc/lexer.yy.cpp"
946
947 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
948 {
949 yy_cp = yyg->yy_c_buf_p;
950
951 /* Support of yytext. */
952 *yy_cp = yyg->yy_hold_char;
953
954 /* yy_bp points to the position in yy_ch_buf of the start of
955 * the current run.
956 */
957 yy_bp = yy_cp;
958
959 yy_current_state = yyg->yy_start;
960yy_match:
961 do
962 {
963 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
964 if ( yy_accept[yy_current_state] )
965 {
966 yyg->yy_last_accepting_state = yy_current_state;
967 yyg->yy_last_accepting_cpos = yy_cp;
968 }
969 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
970 {
971 yy_current_state = (int) yy_def[yy_current_state];
972 if ( yy_current_state >= 221 )
973 yy_c = yy_meta[yy_c];
974 }
975 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
976 ++yy_cp;
977 }
978 while ( yy_base[yy_current_state] != 277 );
979
980yy_find_action:
981 yy_act = yy_accept[yy_current_state];
982 if ( yy_act == 0 )
983 { /* have to back up */
984 yy_cp = yyg->yy_last_accepting_cpos;
985 yy_current_state = yyg->yy_last_accepting_state;
986 yy_act = yy_accept[yy_current_state];
987 }
988
989 YY_DO_BEFORE_ACTION;
990
991 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
992 {
993 int yyl;
994 for ( yyl = 0; yyl < yyleng; ++yyl )
995 if ( yytext[yyl] == '\n' )
996
997 do{ yylineno++;
998 yycolumn=0;
999 }while(0)
1000;
1001 }
1002
1003do_action: /* This label is used only to access EOF actions. */
1004
1005 switch ( yy_act )
1006 { /* beginning of action switch */
1007 case 0: /* must back up */
1008 /* undo the effects of YY_DO_BEFORE_ACTION */
1009 *yy_cp = yyg->yy_hold_char;
1010 yy_cp = yyg->yy_last_accepting_cpos;
1011 yy_current_state = yyg->yy_last_accepting_state;
1012 goto yy_find_action;
1013
1014case 1:
1015/* rule 1 can match eol */
1016YY_RULE_SETUP
1017#line 77 "../gecode/flatzinc/lexer.lxx"
1018{ /*yylineno++;*/ /* ignore EOL */ }
1019 YY_BREAK
1020case 2:
1021YY_RULE_SETUP
1022#line 78 "../gecode/flatzinc/lexer.lxx"
1023{ /* ignore whitespace */ }
1024 YY_BREAK
1025case 3:
1026YY_RULE_SETUP
1027#line 79 "../gecode/flatzinc/lexer.lxx"
1028{ /* ignore comments */ }
1029 YY_BREAK
1030case 4:
1031YY_RULE_SETUP
1032#line 81 "../gecode/flatzinc/lexer.lxx"
1033{ yylval->iValue = 1; return FZ_BOOL_LIT; }
1034 YY_BREAK
1035case 5:
1036YY_RULE_SETUP
1037#line 82 "../gecode/flatzinc/lexer.lxx"
1038{ yylval->iValue = 0; return FZ_BOOL_LIT; }
1039 YY_BREAK
1040case 6:
1041YY_RULE_SETUP
1042#line 83 "../gecode/flatzinc/lexer.lxx"
1043{ if (parseInt(yytext,yylval->iValue))
1044 return FZ_INT_LIT;
1045 else
1046 yyerror(("The literal '" + std::string(yytext)
1047 + "' of the type int is out of range ("
1048 + std::to_string(Gecode::Int::Limits::min)
1049 + ".." + std::to_string(Gecode::Int::Limits::max)
1050 + ")").c_str());
1051 }
1052 YY_BREAK
1053case 7:
1054YY_RULE_SETUP
1055#line 92 "../gecode/flatzinc/lexer.lxx"
1056{ if (parseInt(yytext,yylval->iValue))
1057 return FZ_INT_LIT;
1058 else
1059 yyerror(("The literal '" + std::string(yytext)
1060 + "' of the type int is out of range ("
1061 + std::to_string(Gecode::Int::Limits::min)
1062 + ".." + std::to_string(Gecode::Int::Limits::max)
1063 + ")").c_str());
1064 }
1065 YY_BREAK
1066case 8:
1067YY_RULE_SETUP
1068#line 101 "../gecode/flatzinc/lexer.lxx"
1069{ if (parseInt(yytext,yylval->iValue))
1070 return FZ_INT_LIT;
1071 else
1072 yyerror(("The literal '" + std::string(yytext)
1073 + "' of the type int is out of range ("
1074 + std::to_string(Gecode::Int::Limits::min)
1075 + ".." + std::to_string(Gecode::Int::Limits::max)
1076 + ")").c_str());
1077 }
1078 YY_BREAK
1079case 9:
1080YY_RULE_SETUP
1081#line 110 "../gecode/flatzinc/lexer.lxx"
1082{ yylval->dValue = strtod(yytext,NULL);
1083 return FZ_FLOAT_LIT; }
1084 YY_BREAK
1085case 10:
1086YY_RULE_SETUP
1087#line 112 "../gecode/flatzinc/lexer.lxx"
1088{ yylval->dValue = strtod(yytext,NULL);
1089 return FZ_FLOAT_LIT; }
1090 YY_BREAK
1091case 11:
1092YY_RULE_SETUP
1093#line 114 "../gecode/flatzinc/lexer.lxx"
1094{ yylval->dValue = strtod(yytext,NULL);
1095 return FZ_FLOAT_LIT; }
1096 YY_BREAK
1097case 12:
1098YY_RULE_SETUP
1099#line 116 "../gecode/flatzinc/lexer.lxx"
1100{ return *yytext; }
1101 YY_BREAK
1102case 13:
1103YY_RULE_SETUP
1104#line 117 "../gecode/flatzinc/lexer.lxx"
1105{ return FZ_DOTDOT; }
1106 YY_BREAK
1107case 14:
1108YY_RULE_SETUP
1109#line 118 "../gecode/flatzinc/lexer.lxx"
1110{ return FZ_COLONCOLON; }
1111 YY_BREAK
1112case 15:
1113YY_RULE_SETUP
1114#line 119 "../gecode/flatzinc/lexer.lxx"
1115{ return FZ_ANNOTATION; }
1116 YY_BREAK
1117case 16:
1118YY_RULE_SETUP
1119#line 120 "../gecode/flatzinc/lexer.lxx"
1120{ return FZ_ANY; }
1121 YY_BREAK
1122case 17:
1123YY_RULE_SETUP
1124#line 121 "../gecode/flatzinc/lexer.lxx"
1125{ return FZ_ARRAY; }
1126 YY_BREAK
1127case 18:
1128YY_RULE_SETUP
1129#line 122 "../gecode/flatzinc/lexer.lxx"
1130{ return FZ_BOOL; }
1131 YY_BREAK
1132case 19:
1133YY_RULE_SETUP
1134#line 123 "../gecode/flatzinc/lexer.lxx"
1135{ return FZ_CASE; }
1136 YY_BREAK
1137case 20:
1138YY_RULE_SETUP
1139#line 124 "../gecode/flatzinc/lexer.lxx"
1140{ return FZ_CONSTRAINT; }
1141 YY_BREAK
1142case 21:
1143YY_RULE_SETUP
1144#line 125 "../gecode/flatzinc/lexer.lxx"
1145{ return FZ_DEFAULT; }
1146 YY_BREAK
1147case 22:
1148YY_RULE_SETUP
1149#line 126 "../gecode/flatzinc/lexer.lxx"
1150{ return FZ_ELSE; }
1151 YY_BREAK
1152case 23:
1153YY_RULE_SETUP
1154#line 127 "../gecode/flatzinc/lexer.lxx"
1155{ return FZ_ELSEIF; }
1156 YY_BREAK
1157case 24:
1158YY_RULE_SETUP
1159#line 128 "../gecode/flatzinc/lexer.lxx"
1160{ return FZ_ENDIF; }
1161 YY_BREAK
1162case 25:
1163YY_RULE_SETUP
1164#line 129 "../gecode/flatzinc/lexer.lxx"
1165{ return FZ_ENUM; }
1166 YY_BREAK
1167case 26:
1168YY_RULE_SETUP
1169#line 130 "../gecode/flatzinc/lexer.lxx"
1170{ return FZ_FLOAT; }
1171 YY_BREAK
1172case 27:
1173YY_RULE_SETUP
1174#line 131 "../gecode/flatzinc/lexer.lxx"
1175{ return FZ_FUNCTION; }
1176 YY_BREAK
1177case 28:
1178YY_RULE_SETUP
1179#line 132 "../gecode/flatzinc/lexer.lxx"
1180{ return FZ_IF; }
1181 YY_BREAK
1182case 29:
1183YY_RULE_SETUP
1184#line 133 "../gecode/flatzinc/lexer.lxx"
1185{ return FZ_INCLUDE; }
1186 YY_BREAK
1187case 30:
1188YY_RULE_SETUP
1189#line 134 "../gecode/flatzinc/lexer.lxx"
1190{ return FZ_INT; }
1191 YY_BREAK
1192case 31:
1193YY_RULE_SETUP
1194#line 135 "../gecode/flatzinc/lexer.lxx"
1195{ return FZ_LET; }
1196 YY_BREAK
1197case 32:
1198YY_RULE_SETUP
1199#line 136 "../gecode/flatzinc/lexer.lxx"
1200{ yylval->bValue = false; return FZ_MAXIMIZE; }
1201 YY_BREAK
1202case 33:
1203YY_RULE_SETUP
1204#line 137 "../gecode/flatzinc/lexer.lxx"
1205{ yylval->bValue = true; return FZ_MINIMIZE; }
1206 YY_BREAK
1207case 34:
1208YY_RULE_SETUP
1209#line 138 "../gecode/flatzinc/lexer.lxx"
1210{ return FZ_OF; }
1211 YY_BREAK
1212case 35:
1213YY_RULE_SETUP
1214#line 139 "../gecode/flatzinc/lexer.lxx"
1215{ return FZ_SATISFY; }
1216 YY_BREAK
1217case 36:
1218YY_RULE_SETUP
1219#line 140 "../gecode/flatzinc/lexer.lxx"
1220{ return FZ_OUTPUT; }
1221 YY_BREAK
1222case 37:
1223YY_RULE_SETUP
1224#line 141 "../gecode/flatzinc/lexer.lxx"
1225{ yylval->bValue = false; return FZ_PAR; }
1226 YY_BREAK
1227case 38:
1228YY_RULE_SETUP
1229#line 142 "../gecode/flatzinc/lexer.lxx"
1230{ return FZ_PREDICATE; }
1231 YY_BREAK
1232case 39:
1233YY_RULE_SETUP
1234#line 143 "../gecode/flatzinc/lexer.lxx"
1235{ return FZ_RECORD; }
1236 YY_BREAK
1237case 40:
1238YY_RULE_SETUP
1239#line 144 "../gecode/flatzinc/lexer.lxx"
1240{ return FZ_SET; }
1241 YY_BREAK
1242case 41:
1243YY_RULE_SETUP
1244#line 145 "../gecode/flatzinc/lexer.lxx"
1245{ return FZ_SHOWCOND; }
1246 YY_BREAK
1247case 42:
1248YY_RULE_SETUP
1249#line 146 "../gecode/flatzinc/lexer.lxx"
1250{ return FZ_SHOW; }
1251 YY_BREAK
1252case 43:
1253YY_RULE_SETUP
1254#line 147 "../gecode/flatzinc/lexer.lxx"
1255{ return FZ_SOLVE; }
1256 YY_BREAK
1257case 44:
1258YY_RULE_SETUP
1259#line 148 "../gecode/flatzinc/lexer.lxx"
1260{ return FZ_STRING; }
1261 YY_BREAK
1262case 45:
1263YY_RULE_SETUP
1264#line 149 "../gecode/flatzinc/lexer.lxx"
1265{ return FZ_TEST; }
1266 YY_BREAK
1267case 46:
1268YY_RULE_SETUP
1269#line 150 "../gecode/flatzinc/lexer.lxx"
1270{ return FZ_THEN; }
1271 YY_BREAK
1272case 47:
1273YY_RULE_SETUP
1274#line 151 "../gecode/flatzinc/lexer.lxx"
1275{ return FZ_TUPLE; }
1276 YY_BREAK
1277case 48:
1278YY_RULE_SETUP
1279#line 152 "../gecode/flatzinc/lexer.lxx"
1280{ return FZ_TYPE; }
1281 YY_BREAK
1282case 49:
1283YY_RULE_SETUP
1284#line 153 "../gecode/flatzinc/lexer.lxx"
1285{ yylval->bValue = true; return FZ_VAR; }
1286 YY_BREAK
1287case 50:
1288YY_RULE_SETUP
1289#line 154 "../gecode/flatzinc/lexer.lxx"
1290{ return FZ_VARIANT_RECORD; }
1291 YY_BREAK
1292case 51:
1293YY_RULE_SETUP
1294#line 155 "../gecode/flatzinc/lexer.lxx"
1295{ return FZ_WHERE; }
1296 YY_BREAK
1297case 52:
1298YY_RULE_SETUP
1299#line 156 "../gecode/flatzinc/lexer.lxx"
1300{ yylval->sValue = strdup(yytext); return FZ_ID; }
1301 YY_BREAK
1302case 53:
1303YY_RULE_SETUP
1304#line 157 "../gecode/flatzinc/lexer.lxx"
1305{ yylval->sValue = strdup(yytext); return FZ_U_ID; }
1306 YY_BREAK
1307case 54:
1308YY_RULE_SETUP
1309#line 158 "../gecode/flatzinc/lexer.lxx"
1310{
1311 yylval->sValue = strdup(yytext+1);
1312 yylval->sValue[strlen(yytext)-2] = 0;
1313 return FZ_STRING_LIT; }
1314 YY_BREAK
1315case 55:
1316YY_RULE_SETUP
1317#line 162 "../gecode/flatzinc/lexer.lxx"
1318{ yyerror("Unknown character"); }
1319 YY_BREAK
1320case 56:
1321YY_RULE_SETUP
1322#line 163 "../gecode/flatzinc/lexer.lxx"
1323ECHO;
1324 YY_BREAK
1325#line 1325 "gecode/flatzinc/lexer.yy.cpp"
1326case YY_STATE_EOF(INITIAL):
1327 yyterminate();
1328
1329 case YY_END_OF_BUFFER:
1330 {
1331 /* Amount of text matched not including the EOB char. */
1332 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1333
1334 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1335 *yy_cp = yyg->yy_hold_char;
1336 YY_RESTORE_YY_MORE_OFFSET
1337
1338 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1339 {
1340 /* We're scanning a new file or input source. It's
1341 * possible that this happened because the user
1342 * just pointed yyin at a new source and called
1343 * yylex(). If so, then we have to assure
1344 * consistency between YY_CURRENT_BUFFER and our
1345 * globals. Here is the right place to do so, because
1346 * this is the first action (other than possibly a
1347 * back-up) that will match for the new input source.
1348 */
1349 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1350 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1351 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1352 }
1353
1354 /* Note that here we test for yy_c_buf_p "<=" to the position
1355 * of the first EOB in the buffer, since yy_c_buf_p will
1356 * already have been incremented past the NUL character
1357 * (since all states make transitions on EOB to the
1358 * end-of-buffer state). Contrast this with the test
1359 * in input().
1360 */
1361 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1362 { /* This was really a NUL. */
1363 yy_state_type yy_next_state;
1364
1365 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1366
1367 yy_current_state = yy_get_previous_state( yyscanner );
1368
1369 /* Okay, we're now positioned to make the NUL
1370 * transition. We couldn't have
1371 * yy_get_previous_state() go ahead and do it
1372 * for us because it doesn't know how to deal
1373 * with the possibility of jamming (and we don't
1374 * want to build jamming into it because then it
1375 * will run more slowly).
1376 */
1377
1378 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1379
1380 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1381
1382 if ( yy_next_state )
1383 {
1384 /* Consume the NUL. */
1385 yy_cp = ++yyg->yy_c_buf_p;
1386 yy_current_state = yy_next_state;
1387 goto yy_match;
1388 }
1389
1390 else
1391 {
1392 yy_cp = yyg->yy_c_buf_p;
1393 goto yy_find_action;
1394 }
1395 }
1396
1397 else switch ( yy_get_next_buffer( yyscanner ) )
1398 {
1399 case EOB_ACT_END_OF_FILE:
1400 {
1401 yyg->yy_did_buffer_switch_on_eof = 0;
1402
1403 if ( yywrap( yyscanner ) )
1404 {
1405 /* Note: because we've taken care in
1406 * yy_get_next_buffer() to have set up
1407 * yytext, we can now set up
1408 * yy_c_buf_p so that if some total
1409 * hoser (like flex itself) wants to
1410 * call the scanner after we return the
1411 * YY_NULL, it'll still work - another
1412 * YY_NULL will get returned.
1413 */
1414 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1415
1416 yy_act = YY_STATE_EOF(YY_START);
1417 goto do_action;
1418 }
1419
1420 else
1421 {
1422 if ( ! yyg->yy_did_buffer_switch_on_eof )
1423 YY_NEW_FILE;
1424 }
1425 break;
1426 }
1427
1428 case EOB_ACT_CONTINUE_SCAN:
1429 yyg->yy_c_buf_p =
1430 yyg->yytext_ptr + yy_amount_of_matched_text;
1431
1432 yy_current_state = yy_get_previous_state( yyscanner );
1433
1434 yy_cp = yyg->yy_c_buf_p;
1435 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1436 goto yy_match;
1437
1438 case EOB_ACT_LAST_MATCH:
1439 yyg->yy_c_buf_p =
1440 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1441
1442 yy_current_state = yy_get_previous_state( yyscanner );
1443
1444 yy_cp = yyg->yy_c_buf_p;
1445 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1446 goto yy_find_action;
1447 }
1448 break;
1449 }
1450
1451 default:
1452 YY_FATAL_ERROR(
1453 "fatal flex scanner internal error--no action found" );
1454 } /* end of action switch */
1455 } /* end of scanning one token */
1456 } /* end of user's declarations */
1457} /* end of yylex */
1458
1459/* yy_get_next_buffer - try to read in a new buffer
1460 *
1461 * Returns a code representing an action:
1462 * EOB_ACT_LAST_MATCH -
1463 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1464 * EOB_ACT_END_OF_FILE - end of file
1465 */
1466static int yy_get_next_buffer (yyscan_t yyscanner)
1467{
1468 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1469 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1470 char *source = yyg->yytext_ptr;
1471 int number_to_move, i;
1472 int ret_val;
1473
1474 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1475 YY_FATAL_ERROR(
1476 "fatal flex scanner internal error--end of buffer missed" );
1477
1478 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1479 { /* Don't try to fill the buffer, so this is an EOF. */
1480 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1481 {
1482 /* We matched a single character, the EOB, so
1483 * treat this as a final EOF.
1484 */
1485 return EOB_ACT_END_OF_FILE;
1486 }
1487
1488 else
1489 {
1490 /* We matched some text prior to the EOB, first
1491 * process it.
1492 */
1493 return EOB_ACT_LAST_MATCH;
1494 }
1495 }
1496
1497 /* Try to read more data. */
1498
1499 /* First move last chars to start of buffer. */
1500 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
1501
1502 for ( i = 0; i < number_to_move; ++i )
1503 *(dest++) = *(source++);
1504
1505 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1506 /* don't do the read, it's not guaranteed to return an EOF,
1507 * just force an EOF
1508 */
1509 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1510
1511 else
1512 {
1513 int num_to_read =
1514 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1515
1516 while ( num_to_read <= 0 )
1517 { /* Not enough room in the buffer - grow it. */
1518
1519 /* just a shorter name for the current buffer */
1520 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1521
1522 int yy_c_buf_p_offset =
1523 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1524
1525 if ( b->yy_is_our_buffer )
1526 {
1527 int new_size = b->yy_buf_size * 2;
1528
1529 if ( new_size <= 0 )
1530 b->yy_buf_size += b->yy_buf_size / 8;
1531 else
1532 b->yy_buf_size *= 2;
1533
1534 b->yy_ch_buf = (char *)
1535 /* Include room in for 2 EOB chars. */
1536 yyrealloc( (void *) b->yy_ch_buf,
1537 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
1538 }
1539 else
1540 /* Can't grow it, we don't own it. */
1541 b->yy_ch_buf = NULL;
1542
1543 if ( ! b->yy_ch_buf )
1544 YY_FATAL_ERROR(
1545 "fatal error - scanner input buffer overflow" );
1546
1547 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1548
1549 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1550 number_to_move - 1;
1551
1552 }
1553
1554 if ( num_to_read > YY_READ_BUF_SIZE )
1555 num_to_read = YY_READ_BUF_SIZE;
1556
1557 /* Read in more data. */
1558 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1559 yyg->yy_n_chars, num_to_read );
1560
1561 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1562 }
1563
1564 if ( yyg->yy_n_chars == 0 )
1565 {
1566 if ( number_to_move == YY_MORE_ADJ )
1567 {
1568 ret_val = EOB_ACT_END_OF_FILE;
1569 yyrestart( yyin , yyscanner);
1570 }
1571
1572 else
1573 {
1574 ret_val = EOB_ACT_LAST_MATCH;
1575 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1576 YY_BUFFER_EOF_PENDING;
1577 }
1578 }
1579
1580 else
1581 ret_val = EOB_ACT_CONTINUE_SCAN;
1582
1583 if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1584 /* Extend the array by 50%, plus the number we really need. */
1585 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1586 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1587 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
1588 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1589 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1590 /* "- 2" to take care of EOB's */
1591 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1592 }
1593
1594 yyg->yy_n_chars += number_to_move;
1595 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1596 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1597
1598 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1599
1600 return ret_val;
1601}
1602
1603/* yy_get_previous_state - get the state just before the EOB char was reached */
1604
1605 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1606{
1607 yy_state_type yy_current_state;
1608 char *yy_cp;
1609 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1610
1611 yy_current_state = yyg->yy_start;
1612
1613 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1614 {
1615 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1616 if ( yy_accept[yy_current_state] )
1617 {
1618 yyg->yy_last_accepting_state = yy_current_state;
1619 yyg->yy_last_accepting_cpos = yy_cp;
1620 }
1621 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1622 {
1623 yy_current_state = (int) yy_def[yy_current_state];
1624 if ( yy_current_state >= 221 )
1625 yy_c = yy_meta[yy_c];
1626 }
1627 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1628 }
1629
1630 return yy_current_state;
1631}
1632
1633/* yy_try_NUL_trans - try to make a transition on the NUL character
1634 *
1635 * synopsis
1636 * next_state = yy_try_NUL_trans( current_state );
1637 */
1638 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1639{
1640 int yy_is_jam;
1641 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1642 char *yy_cp = yyg->yy_c_buf_p;
1643
1644 YY_CHAR yy_c = 1;
1645 if ( yy_accept[yy_current_state] )
1646 {
1647 yyg->yy_last_accepting_state = yy_current_state;
1648 yyg->yy_last_accepting_cpos = yy_cp;
1649 }
1650 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1651 {
1652 yy_current_state = (int) yy_def[yy_current_state];
1653 if ( yy_current_state >= 221 )
1654 yy_c = yy_meta[yy_c];
1655 }
1656 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1657 yy_is_jam = (yy_current_state == 220);
1658
1659 (void)yyg;
1660 return yy_is_jam ? 0 : yy_current_state;
1661}
1662
1663#ifndef YY_NO_UNPUT
1664
1665 static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
1666{
1667 char *yy_cp;
1668 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1669
1670 yy_cp = yyg->yy_c_buf_p;
1671
1672 /* undo effects of setting up yytext */
1673 *yy_cp = yyg->yy_hold_char;
1674
1675 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1676 { /* need to shift things up to make room */
1677 /* +2 for EOB chars. */
1678 int number_to_move = yyg->yy_n_chars + 2;
1679 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1680 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1681 char *source =
1682 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1683
1684 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1685 *--dest = *--source;
1686
1687 yy_cp += (int) (dest - source);
1688 yy_bp += (int) (dest - source);
1689 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1690 yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1691
1692 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1693 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1694 }
1695
1696 *--yy_cp = (char) c;
1697
1698 if ( c == '\n' ){
1699 --yylineno;
1700 }
1701
1702 yyg->yytext_ptr = yy_bp;
1703 yyg->yy_hold_char = *yy_cp;
1704 yyg->yy_c_buf_p = yy_cp;
1705}
1706
1707#endif
1708
1709#ifndef YY_NO_INPUT
1710#ifdef __cplusplus
1711 static int yyinput (yyscan_t yyscanner)
1712#else
1713 static int input (yyscan_t yyscanner)
1714#endif
1715
1716{
1717 int c;
1718 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1719
1720 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1721
1722 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1723 {
1724 /* yy_c_buf_p now points to the character we want to return.
1725 * If this occurs *before* the EOB characters, then it's a
1726 * valid NUL; if not, then we've hit the end of the buffer.
1727 */
1728 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1729 /* This was really a NUL. */
1730 *yyg->yy_c_buf_p = '\0';
1731
1732 else
1733 { /* need more input */
1734 int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
1735 ++yyg->yy_c_buf_p;
1736
1737 switch ( yy_get_next_buffer( yyscanner ) )
1738 {
1739 case EOB_ACT_LAST_MATCH:
1740 /* This happens because yy_g_n_b()
1741 * sees that we've accumulated a
1742 * token and flags that we need to
1743 * try matching the token before
1744 * proceeding. But for input(),
1745 * there's no matching to consider.
1746 * So convert the EOB_ACT_LAST_MATCH
1747 * to EOB_ACT_END_OF_FILE.
1748 */
1749
1750 /* Reset buffer status. */
1751 yyrestart( yyin , yyscanner);
1752
1753 /*FALLTHROUGH*/
1754
1755 case EOB_ACT_END_OF_FILE:
1756 {
1757 if ( yywrap( yyscanner ) )
1758 return 0;
1759
1760 if ( ! yyg->yy_did_buffer_switch_on_eof )
1761 YY_NEW_FILE;
1762#ifdef __cplusplus
1763 return yyinput(yyscanner);
1764#else
1765 return input(yyscanner);
1766#endif
1767 }
1768
1769 case EOB_ACT_CONTINUE_SCAN:
1770 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1771 break;
1772 }
1773 }
1774 }
1775
1776 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1777 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1778 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1779
1780 if ( c == '\n' )
1781
1782 do{ yylineno++;
1783 yycolumn=0;
1784 }while(0)
1785;
1786
1787 return c;
1788}
1789#endif /* ifndef YY_NO_INPUT */
1790
1791/** Immediately switch to a different input stream.
1792 * @param input_file A readable stream.
1793 * @param yyscanner The scanner object.
1794 * @note This function does not reset the start condition to @c INITIAL .
1795 */
1796 void yyrestart (FILE * input_file , yyscan_t yyscanner)
1797{
1798 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1799
1800 if ( ! YY_CURRENT_BUFFER ){
1801 yyensure_buffer_stack (yyscanner);
1802 YY_CURRENT_BUFFER_LVALUE =
1803 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
1804 }
1805
1806 yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
1807 yy_load_buffer_state( yyscanner );
1808}
1809
1810/** Switch to a different input buffer.
1811 * @param new_buffer The new input buffer.
1812 * @param yyscanner The scanner object.
1813 */
1814 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1815{
1816 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1817
1818 /* TODO. We should be able to replace this entire function body
1819 * with
1820 * yypop_buffer_state();
1821 * yypush_buffer_state(new_buffer);
1822 */
1823 yyensure_buffer_stack (yyscanner);
1824 if ( YY_CURRENT_BUFFER == new_buffer )
1825 return;
1826
1827 if ( YY_CURRENT_BUFFER )
1828 {
1829 /* Flush out information for old buffer. */
1830 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1831 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1832 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1833 }
1834
1835 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1836 yy_load_buffer_state( yyscanner );
1837
1838 /* We don't actually know whether we did this switch during
1839 * EOF (yywrap()) processing, but the only time this flag
1840 * is looked at is after yywrap() is called, so it's safe
1841 * to go ahead and always set it.
1842 */
1843 yyg->yy_did_buffer_switch_on_eof = 1;
1844}
1845
1846static void yy_load_buffer_state (yyscan_t yyscanner)
1847{
1848 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1849 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1850 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1851 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1852 yyg->yy_hold_char = *yyg->yy_c_buf_p;
1853}
1854
1855/** Allocate and initialize an input buffer state.
1856 * @param file A readable stream.
1857 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1858 * @param yyscanner The scanner object.
1859 * @return the allocated buffer state.
1860 */
1861 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
1862{
1863 YY_BUFFER_STATE b;
1864
1865 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
1866 if ( ! b )
1867 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1868
1869 b->yy_buf_size = size;
1870
1871 /* yy_ch_buf has to be 2 characters longer than the size given because
1872 * we need to put in 2 end-of-buffer characters.
1873 */
1874 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
1875 if ( ! b->yy_ch_buf )
1876 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1877
1878 b->yy_is_our_buffer = 1;
1879
1880 yy_init_buffer( b, file , yyscanner);
1881
1882 return b;
1883}
1884
1885/** Destroy the buffer.
1886 * @param b a buffer created with yy_create_buffer()
1887 * @param yyscanner The scanner object.
1888 */
1889 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1890{
1891 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1892
1893 if ( ! b )
1894 return;
1895
1896 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1897 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1898
1899 if ( b->yy_is_our_buffer )
1900 yyfree( (void *) b->yy_ch_buf , yyscanner );
1901
1902 yyfree( (void *) b , yyscanner );
1903}
1904
1905/* Initializes or reinitializes a buffer.
1906 * This function is sometimes called more than once on the same buffer,
1907 * such as during a yyrestart() or at EOF.
1908 */
1909 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1910
1911{
1912 int oerrno = errno;
1913 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1914
1915 yy_flush_buffer( b , yyscanner);
1916
1917 b->yy_input_file = file;
1918 b->yy_fill_buffer = 1;
1919
1920 /* If b is the current buffer, then yy_init_buffer was _probably_
1921 * called from yyrestart() or through yy_get_next_buffer.
1922 * In that case, we don't want to reset the lineno or column.
1923 */
1924 if (b != YY_CURRENT_BUFFER){
1925 b->yy_bs_lineno = 1;
1926 b->yy_bs_column = 0;
1927 }
1928
1929 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1930
1931 errno = oerrno;
1932}
1933
1934/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1935 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1936 * @param yyscanner The scanner object.
1937 */
1938 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1939{
1940 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1941 if ( ! b )
1942 return;
1943
1944 b->yy_n_chars = 0;
1945
1946 /* We always need two end-of-buffer characters. The first causes
1947 * a transition to the end-of-buffer state. The second causes
1948 * a jam in that state.
1949 */
1950 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1951 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1952
1953 b->yy_buf_pos = &b->yy_ch_buf[0];
1954
1955 b->yy_at_bol = 1;
1956 b->yy_buffer_status = YY_BUFFER_NEW;
1957
1958 if ( b == YY_CURRENT_BUFFER )
1959 yy_load_buffer_state( yyscanner );
1960}
1961
1962/** Pushes the new state onto the stack. The new state becomes
1963 * the current state. This function will allocate the stack
1964 * if necessary.
1965 * @param new_buffer The new state.
1966 * @param yyscanner The scanner object.
1967 */
1968void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1969{
1970 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1971 if (new_buffer == NULL)
1972 return;
1973
1974 yyensure_buffer_stack(yyscanner);
1975
1976 /* This block is copied from yy_switch_to_buffer. */
1977 if ( YY_CURRENT_BUFFER )
1978 {
1979 /* Flush out information for old buffer. */
1980 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1981 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1982 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1983 }
1984
1985 /* Only push if top exists. Otherwise, replace top. */
1986 if (YY_CURRENT_BUFFER)
1987 yyg->yy_buffer_stack_top++;
1988 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1989
1990 /* copied from yy_switch_to_buffer. */
1991 yy_load_buffer_state( yyscanner );
1992 yyg->yy_did_buffer_switch_on_eof = 1;
1993}
1994
1995/** Removes and deletes the top of the stack, if present.
1996 * The next element becomes the new top.
1997 * @param yyscanner The scanner object.
1998 */
1999void yypop_buffer_state (yyscan_t yyscanner)
2000{
2001 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2002 if (!YY_CURRENT_BUFFER)
2003 return;
2004
2005 yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
2006 YY_CURRENT_BUFFER_LVALUE = NULL;
2007 if (yyg->yy_buffer_stack_top > 0)
2008 --yyg->yy_buffer_stack_top;
2009
2010 if (YY_CURRENT_BUFFER) {
2011 yy_load_buffer_state( yyscanner );
2012 yyg->yy_did_buffer_switch_on_eof = 1;
2013 }
2014}
2015
2016/* Allocates the stack if it does not exist.
2017 * Guarantees space for at least one push.
2018 */
2019static void yyensure_buffer_stack (yyscan_t yyscanner)
2020{
2021 yy_size_t num_to_alloc;
2022 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2023
2024 if (!yyg->yy_buffer_stack) {
2025
2026 /* First allocation is just for 2 elements, since we don't know if this
2027 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2028 * immediate realloc on the next call.
2029 */
2030 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2031 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
2032 (num_to_alloc * sizeof(struct yy_buffer_state*)
2033 , yyscanner);
2034 if ( ! yyg->yy_buffer_stack )
2035 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2036
2037 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2038
2039 yyg->yy_buffer_stack_max = num_to_alloc;
2040 yyg->yy_buffer_stack_top = 0;
2041 return;
2042 }
2043
2044 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2045
2046 /* Increase the buffer to prepare for a possible push. */
2047 yy_size_t grow_size = 8 /* arbitrary grow size */;
2048
2049 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2050 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
2051 (yyg->yy_buffer_stack,
2052 num_to_alloc * sizeof(struct yy_buffer_state*)
2053 , yyscanner);
2054 if ( ! yyg->yy_buffer_stack )
2055 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2056
2057 /* zero only the new slots.*/
2058 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2059 yyg->yy_buffer_stack_max = num_to_alloc;
2060 }
2061}
2062
2063/** Setup the input buffer state to scan directly from a user-specified character buffer.
2064 * @param base the character buffer
2065 * @param size the size in bytes of the character buffer
2066 * @param yyscanner The scanner object.
2067 * @return the newly allocated buffer state object.
2068 */
2069YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2070{
2071 YY_BUFFER_STATE b;
2072
2073 if ( size < 2 ||
2074 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2075 base[size-1] != YY_END_OF_BUFFER_CHAR )
2076 /* They forgot to leave room for the EOB's. */
2077 return NULL;
2078
2079 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
2080 if ( ! b )
2081 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2082
2083 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
2084 b->yy_buf_pos = b->yy_ch_buf = base;
2085 b->yy_is_our_buffer = 0;
2086 b->yy_input_file = NULL;
2087 b->yy_n_chars = b->yy_buf_size;
2088 b->yy_is_interactive = 0;
2089 b->yy_at_bol = 1;
2090 b->yy_fill_buffer = 0;
2091 b->yy_buffer_status = YY_BUFFER_NEW;
2092
2093 yy_switch_to_buffer( b , yyscanner );
2094
2095 return b;
2096}
2097
2098/** Setup the input buffer state to scan a string. The next call to yylex() will
2099 * scan from a @e copy of @a str.
2100 * @param yystr a NUL-terminated string to scan
2101 * @param yyscanner The scanner object.
2102 * @return the newly allocated buffer state object.
2103 * @note If you want to scan bytes that may contain NUL values, then use
2104 * yy_scan_bytes() instead.
2105 */
2106YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
2107{
2108
2109 return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
2110}
2111
2112/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2113 * scan from a @e copy of @a bytes.
2114 * @param yybytes the byte buffer to scan
2115 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2116 * @param yyscanner The scanner object.
2117 * @return the newly allocated buffer state object.
2118 */
2119YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2120{
2121 YY_BUFFER_STATE b;
2122 char *buf;
2123 yy_size_t n;
2124 int i;
2125
2126 /* Get memory for full buffer, including space for trailing EOB's. */
2127 n = (yy_size_t) (_yybytes_len + 2);
2128 buf = (char *) yyalloc( n , yyscanner );
2129 if ( ! buf )
2130 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2131
2132 for ( i = 0; i < _yybytes_len; ++i )
2133 buf[i] = yybytes[i];
2134
2135 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2136
2137 b = yy_scan_buffer( buf, n , yyscanner);
2138 if ( ! b )
2139 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2140
2141 /* It's okay to grow etc. this buffer, and we should throw it
2142 * away when we're done.
2143 */
2144 b->yy_is_our_buffer = 1;
2145
2146 return b;
2147}
2148
2149#ifndef YY_EXIT_FAILURE
2150#define YY_EXIT_FAILURE 2
2151#endif
2152
2153static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
2154{
2155 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2156 (void)yyg;
2157 fprintf( stderr, "%s\n", msg );
2158 exit( YY_EXIT_FAILURE );
2159}
2160
2161/* Redefine yyless() so it works in section 3 code. */
2162
2163#undef yyless
2164#define yyless(n) \
2165 do \
2166 { \
2167 /* Undo effects of setting up yytext. */ \
2168 int yyless_macro_arg = (n); \
2169 YY_LESS_LINENO(yyless_macro_arg);\
2170 yytext[yyleng] = yyg->yy_hold_char; \
2171 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2172 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2173 *yyg->yy_c_buf_p = '\0'; \
2174 yyleng = yyless_macro_arg; \
2175 } \
2176 while ( 0 )
2177
2178/* Accessor methods (get/set functions) to struct members. */
2179
2180/** Get the user-defined data for this scanner.
2181 * @param yyscanner The scanner object.
2182 */
2183YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
2184{
2185 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2186 return yyextra;
2187}
2188
2189/** Get the current line number.
2190 * @param yyscanner The scanner object.
2191 */
2192int yyget_lineno (yyscan_t yyscanner)
2193{
2194 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2195
2196 if (! YY_CURRENT_BUFFER)
2197 return 0;
2198
2199 return yylineno;
2200}
2201
2202/** Get the current column number.
2203 * @param yyscanner The scanner object.
2204 */
2205int yyget_column (yyscan_t yyscanner)
2206{
2207 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2208
2209 if (! YY_CURRENT_BUFFER)
2210 return 0;
2211
2212 return yycolumn;
2213}
2214
2215/** Get the input stream.
2216 * @param yyscanner The scanner object.
2217 */
2218FILE *yyget_in (yyscan_t yyscanner)
2219{
2220 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2221 return yyin;
2222}
2223
2224/** Get the output stream.
2225 * @param yyscanner The scanner object.
2226 */
2227FILE *yyget_out (yyscan_t yyscanner)
2228{
2229 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2230 return yyout;
2231}
2232
2233/** Get the length of the current token.
2234 * @param yyscanner The scanner object.
2235 */
2236int yyget_leng (yyscan_t yyscanner)
2237{
2238 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2239 return yyleng;
2240}
2241
2242/** Get the current token.
2243 * @param yyscanner The scanner object.
2244 */
2245
2246char *yyget_text (yyscan_t yyscanner)
2247{
2248 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2249 return yytext;
2250}
2251
2252/** Set the user-defined data. This data is never touched by the scanner.
2253 * @param user_defined The data to be associated with this scanner.
2254 * @param yyscanner The scanner object.
2255 */
2256void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2257{
2258 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2259 yyextra = user_defined ;
2260}
2261
2262/** Set the current line number.
2263 * @param _line_number line number
2264 * @param yyscanner The scanner object.
2265 */
2266void yyset_lineno (int _line_number , yyscan_t yyscanner)
2267{
2268 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2269
2270 /* lineno is only valid if an input buffer exists. */
2271 if (! YY_CURRENT_BUFFER )
2272 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
2273
2274 yylineno = _line_number;
2275}
2276
2277/** Set the current column.
2278 * @param _column_no column number
2279 * @param yyscanner The scanner object.
2280 */
2281void yyset_column (int _column_no , yyscan_t yyscanner)
2282{
2283 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2284
2285 /* column is only valid if an input buffer exists. */
2286 if (! YY_CURRENT_BUFFER )
2287 YY_FATAL_ERROR( "yyset_column called with no buffer" );
2288
2289 yycolumn = _column_no;
2290}
2291
2292/** Set the input stream. This does not discard the current
2293 * input buffer.
2294 * @param _in_str A readable stream.
2295 * @param yyscanner The scanner object.
2296 * @see yy_switch_to_buffer
2297 */
2298void yyset_in (FILE * _in_str , yyscan_t yyscanner)
2299{
2300 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2301 yyin = _in_str ;
2302}
2303
2304void yyset_out (FILE * _out_str , yyscan_t yyscanner)
2305{
2306 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2307 yyout = _out_str ;
2308}
2309
2310int yyget_debug (yyscan_t yyscanner)
2311{
2312 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2313 return yy_flex_debug;
2314}
2315
2316void yyset_debug (int _bdebug , yyscan_t yyscanner)
2317{
2318 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2319 yy_flex_debug = _bdebug ;
2320}
2321
2322/* Accessor methods for yylval and yylloc */
2323
2324YYSTYPE * yyget_lval (yyscan_t yyscanner)
2325{
2326 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2327 return yylval;
2328}
2329
2330void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2331{
2332 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2333 yylval = yylval_param;
2334}
2335
2336/* User-visible API */
2337
2338/* yylex_init is special because it creates the scanner itself, so it is
2339 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2340 * That's why we explicitly handle the declaration, instead of using our macros.
2341 */
2342int yylex_init(yyscan_t* ptr_yy_globals)
2343{
2344 if (ptr_yy_globals == NULL){
2345 errno = EINVAL;
2346 return 1;
2347 }
2348
2349 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2350
2351 if (*ptr_yy_globals == NULL){
2352 errno = ENOMEM;
2353 return 1;
2354 }
2355
2356 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2357 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2358
2359 return yy_init_globals ( *ptr_yy_globals );
2360}
2361
2362/* yylex_init_extra has the same functionality as yylex_init, but follows the
2363 * convention of taking the scanner as the last argument. Note however, that
2364 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2365 * is the reason, too, why this function also must handle its own declaration).
2366 * The user defined value in the first argument will be available to yyalloc in
2367 * the yyextra field.
2368 */
2369int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2370{
2371 struct yyguts_t dummy_yyguts;
2372
2373 yyset_extra (yy_user_defined, &dummy_yyguts);
2374
2375 if (ptr_yy_globals == NULL){
2376 errno = EINVAL;
2377 return 1;
2378 }
2379
2380 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2381
2382 if (*ptr_yy_globals == NULL){
2383 errno = ENOMEM;
2384 return 1;
2385 }
2386
2387 /* By setting to 0xAA, we expose bugs in
2388 yy_init_globals. Leave at 0x00 for releases. */
2389 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2390
2391 yyset_extra (yy_user_defined, *ptr_yy_globals);
2392
2393 return yy_init_globals ( *ptr_yy_globals );
2394}
2395
2396static int yy_init_globals (yyscan_t yyscanner)
2397{
2398 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2399 /* Initialization is the same as for the non-reentrant scanner.
2400 * This function is called from yylex_destroy(), so don't allocate here.
2401 */
2402
2403 yyg->yy_buffer_stack = NULL;
2404 yyg->yy_buffer_stack_top = 0;
2405 yyg->yy_buffer_stack_max = 0;
2406 yyg->yy_c_buf_p = NULL;
2407 yyg->yy_init = 0;
2408 yyg->yy_start = 0;
2409
2410 yyg->yy_start_stack_ptr = 0;
2411 yyg->yy_start_stack_depth = 0;
2412 yyg->yy_start_stack = NULL;
2413
2414/* Defined in main.c */
2415#ifdef YY_STDINIT
2416 yyin = stdin;
2417 yyout = stdout;
2418#else
2419 yyin = NULL;
2420 yyout = NULL;
2421#endif
2422
2423 /* For future reference: Set errno on error, since we are called by
2424 * yylex_init()
2425 */
2426 return 0;
2427}
2428
2429/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2430int yylex_destroy (yyscan_t yyscanner)
2431{
2432 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2433
2434 /* Pop the buffer stack, destroying each element. */
2435 while(YY_CURRENT_BUFFER){
2436 yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
2437 YY_CURRENT_BUFFER_LVALUE = NULL;
2438 yypop_buffer_state(yyscanner);
2439 }
2440
2441 /* Destroy the stack itself. */
2442 yyfree(yyg->yy_buffer_stack , yyscanner);
2443 yyg->yy_buffer_stack = NULL;
2444
2445 /* Destroy the start condition stack. */
2446 yyfree( yyg->yy_start_stack , yyscanner );
2447 yyg->yy_start_stack = NULL;
2448
2449 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2450 * yylex() is called, initialization will occur. */
2451 yy_init_globals( yyscanner);
2452
2453 /* Destroy the main struct (reentrant only). */
2454 yyfree ( yyscanner , yyscanner );
2455 yyscanner = NULL;
2456 return 0;
2457}
2458
2459/*
2460 * Internal utility routines.
2461 */
2462
2463#ifndef yytext_ptr
2464static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
2465{
2466 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2467 (void)yyg;
2468
2469 int i;
2470 for ( i = 0; i < n; ++i )
2471 s1[i] = s2[i];
2472}
2473#endif
2474
2475#ifdef YY_NEED_STRLEN
2476static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
2477{
2478 int n;
2479 for ( n = 0; s[n]; ++n )
2480 ;
2481
2482 return n;
2483}
2484#endif
2485
2486void *yyalloc (yy_size_t size , yyscan_t yyscanner)
2487{
2488 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2489 (void)yyg;
2490 return malloc(size);
2491}
2492
2493void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2494{
2495 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2496 (void)yyg;
2497
2498 /* The cast to (char *) in the following accommodates both
2499 * implementations that use char* generic pointers, and those
2500 * that use void* generic pointers. It works with the latter
2501 * because both ANSI C and C++ allow castless assignment from
2502 * any pointer type to void*, and deal with argument conversions
2503 * as though doing an assignment.
2504 */
2505 return realloc(ptr, size);
2506}
2507
2508void yyfree (void * ptr , yyscan_t yyscanner)
2509{
2510 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2511 (void)yyg;
2512 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2513}
2514
2515#define YYTABLES_NAME "yytables"
2516
2517#line 163 "../gecode/flatzinc/lexer.lxx"
2518
2519int yy_input_proc(char* buf, int size, yyscan_t yyscanner) {
2520 Gecode::FlatZinc::ParserState* parm =
2521 static_cast<Gecode::FlatZinc::ParserState*>(yyget_extra(yyscanner));
2522 return parm->fillBuffer(buf, size);
2523 // work around warning that yyunput is unused
2524 yyunput (0,buf,yyscanner);
2525}
2526