Vcsn  2.5
Be Rational
scan.cc
Go to the documentation of this file.
1 // Added by flex++.
2 #pragma GCC diagnostic ignored "-Wsign-compare"
3 // Check Clang first, as it does not support -Wzero... but it
4 // defines __GNUC__.
5 #if defined __clang__
6 # pragma clang diagnostic ignored "-Wdeprecated"
7 # pragma clang diagnostic ignored "-Wnull-conversion"
8 #elif defined __GNUC__
9 # pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
10 # pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn"
11 # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
12 # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
13 #endif
14 
15 #line 2 "lib/vcsn/rat/scan.cc"
16 #line 7 "lib/vcsn/rat/scan.ll"
17 // Define YY_DECL.
18 #include <lib/vcsn/rat/parse.hh>
19 
20 #define yyterminate() return parser::make_END(loc)
21 
22 
23 
24 #line 11 "lib/vcsn/rat/scan.cc"
25 
26 #define YY_INT_ALIGNED short int
27 
28 /* A lexical scanner generated by flex */
29 
30 /* %not-for-header */
31 
32 /* %if-c-only */
33 /* %if-not-reentrant */
34 /* %endif */
35 /* %endif */
36 /* %ok-for-header */
37 
38 #define FLEX_SCANNER
39 #define YY_FLEX_MAJOR_VERSION 2
40 #define YY_FLEX_MINOR_VERSION 6
41 #define YY_FLEX_SUBMINOR_VERSION 0
42 #if YY_FLEX_SUBMINOR_VERSION > 0
43 #define FLEX_BETA
44 #endif
45 
46 /* %if-c++-only */
47  /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
48  * following macro. This is required in order to pass the c++-multiple-scanners
49  * test in the regression suite. We get reports that it breaks inheritance.
50  * We will address this in a future release of flex, or omit the C++ scanner
51  * altogether.
52  */
53  #define yyFlexLexer yyFlexLexer
54 /* %endif */
55 
56 /* %if-c-only */
57 /* %endif */
58 
59 /* %if-c-only */
60 /* %endif */
61 
62 /* First, we deal with platform-specific or compiler-specific issues. */
63 
64 /* begin standard C headers. */
65 /* %if-c-only */
66 /* %endif */
67 
68 /* %if-tables-serialization */
69 /* %endif */
70 /* end standard C headers. */
71 
72 /* %if-c-or-c++ */
73 /* flex integer type definitions */
74 
75 #ifndef FLEXINT_H
76 #define FLEXINT_H
77 
78 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
79 
80 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
81 
82 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
83  * if you want the limit (max/min) macros for int types.
84  */
85 #ifndef __STDC_LIMIT_MACROS
86 #define __STDC_LIMIT_MACROS 1
87 #endif
88 
89 #include <inttypes.h>
90 typedef int8_t flex_int8_t;
91 typedef uint8_t flex_uint8_t;
92 typedef int16_t flex_int16_t;
93 typedef uint16_t flex_uint16_t;
94 typedef int32_t flex_int32_t;
95 typedef uint32_t flex_uint32_t;
96 #else
97 typedef signed char flex_int8_t;
98 typedef short int flex_int16_t;
99 typedef int flex_int32_t;
100 typedef unsigned char flex_uint8_t;
101 typedef unsigned short int flex_uint16_t;
102 typedef unsigned int flex_uint32_t;
103 
104 /* Limits of integral types. */
105 #ifndef INT8_MIN
106 #define INT8_MIN (-128)
107 #endif
108 #ifndef INT16_MIN
109 #define INT16_MIN (-32767-1)
110 #endif
111 #ifndef INT32_MIN
112 #define INT32_MIN (-2147483647-1)
113 #endif
114 #ifndef INT8_MAX
115 #define INT8_MAX (127)
116 #endif
117 #ifndef INT16_MAX
118 #define INT16_MAX (32767)
119 #endif
120 #ifndef INT32_MAX
121 #define INT32_MAX (2147483647)
122 #endif
123 #ifndef UINT8_MAX
124 #define UINT8_MAX (255U)
125 #endif
126 #ifndef UINT16_MAX
127 #define UINT16_MAX (65535U)
128 #endif
129 #ifndef UINT32_MAX
130 #define UINT32_MAX (4294967295U)
131 #endif
132 
133 #endif /* ! C99 */
134 
135 #endif /* ! FLEXINT_H */
136 
137 /* %endif */
138 
139 /* %if-c++-only */
140 /* begin standard C++ headers. */
141 #include <iostream>
142 #include <errno.h>
143 #include <cstdlib>
144 #include <cstdio>
145 #include <cstring>
146 /* end standard C++ headers. */
147 /* %endif */
148 
149 #ifdef __cplusplus
150 
151 /* The "const" storage-class-modifier is valid. */
152 #define YY_USE_CONST
153 
154 #else /* ! __cplusplus */
155 
156 /* C99 requires __STDC__ to be defined as 1. */
157 #if defined (__STDC__)
158 
159 #define YY_USE_CONST
160 
161 #endif /* defined (__STDC__) */
162 #endif /* ! __cplusplus */
163 
164 #ifdef YY_USE_CONST
165 #define yyconst const
166 #else
167 #define yyconst
168 #endif
169 
170 /* %not-for-header */
171 
172 /* Returned upon end-of-file. */
173 #define YY_NULL 0
174 /* %ok-for-header */
175 
176 /* %not-for-header */
177 
178 /* Promotes a possibly negative, possibly signed char to an unsigned
179  * integer for use as an array index. If the signed char is negative,
180  * we want to instead treat it as an 8-bit unsigned char, hence the
181  * double cast.
182  */
183 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
184 /* %ok-for-header */
185 
186 /* %if-reentrant */
187 /* %endif */
188 
189 /* %if-not-reentrant */
190 
191 /* %endif */
192 
193 /* Enter a start condition. This macro really ought to take a parameter,
194  * but we do it the disgusting crufty way forced on us by the ()-less
195  * definition of BEGIN.
196  */
197 #define BEGIN (yy_start) = 1 + 2 *
198 
199 /* Translate the current start state into a value that can be later handed
200  * to BEGIN to return to the state. The YYSTATE alias is for lex
201  * compatibility.
202  */
203 #define YY_START (((yy_start) - 1) / 2)
204 #define YYSTATE YY_START
205 
206 /* Action number for EOF rule of a given start state. */
207 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
208 
209 /* Special action meaning "start processing a new file". */
210 #define YY_NEW_FILE yyrestart( yyin )
211 
212 #define YY_END_OF_BUFFER_CHAR 0
213 
214 /* Size of default input buffer. */
215 #ifndef YY_BUF_SIZE
216 #ifdef __ia64__
217 /* On IA-64, the buffer size is 16k, not 8k.
218  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
219  * Ditto for the __ia64__ case accordingly.
220  */
221 #define YY_BUF_SIZE 32768
222 #else
223 #define YY_BUF_SIZE 16384
224 #endif /* __ia64__ */
225 #endif
226 
227 /* The state buf must be large enough to hold one state per character in the main buffer.
228  */
229 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
230 
231 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
232 #define YY_TYPEDEF_YY_BUFFER_STATE
234 #endif
235 
236 #ifndef YY_TYPEDEF_YY_SIZE_T
237 #define YY_TYPEDEF_YY_SIZE_T
238 typedef size_t yy_size_t;
239 #endif
240 
241 /* %if-not-reentrant */
242 extern yy_size_t yyleng;
243 /* %endif */
244 
245 /* %if-c-only */
246 /* %if-not-reentrant */
247 /* %endif */
248 /* %endif */
249 
250 #define EOB_ACT_CONTINUE_SCAN 0
251 #define EOB_ACT_END_OF_FILE 1
252 #define EOB_ACT_LAST_MATCH 2
253 
254  #define YY_LESS_LINENO(n)
255  #define YY_LINENO_REWIND_TO(ptr)
256 
257 /* Return all but the first "n" matched characters back to the input stream. */
258 #define yyless(n) \
259  do \
260  { \
261  /* Undo effects of setting up yytext. */ \
262  int yyless_macro_arg = (n); \
263  YY_LESS_LINENO(yyless_macro_arg);\
264  *yy_cp = (yy_hold_char); \
265  YY_RESTORE_YY_MORE_OFFSET \
266  (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
267  YY_DO_BEFORE_ACTION; /* set up yytext again */ \
268  } \
269  while ( 0 )
270 
271 #define unput(c) yyunput( c, (yytext_ptr) )
272 
273 #ifndef YY_STRUCT_YY_BUFFER_STATE
274 #define YY_STRUCT_YY_BUFFER_STATE
275 struct yy_buffer_state
276  {
277 /* %if-c-only */
278 /* %endif */
279 
280 /* %if-c++-only */
281  std::streambuf* yy_input_file;
282 /* %endif */
283 
284  char *yy_ch_buf; /* input buffer */
285  char *yy_buf_pos; /* current position in input buffer */
286 
287  /* Size of input buffer in bytes, not including room for EOB
288  * characters.
289  */
291 
292  /* Number of characters read into yy_ch_buf, not including EOB
293  * characters.
294  */
296 
297  /* Whether we "own" the buffer - i.e., we know we created it,
298  * and can realloc() it to grow it, and should free() it to
299  * delete it.
300  */
301  int yy_is_our_buffer;
302 
303  /* Whether this is an "interactive" input source; if so, and
304  * if we're using stdio for input, then we want to use getc()
305  * instead of fread(), to make sure we stop fetching input after
306  * each newline.
307  */
308  int yy_is_interactive;
309 
310  /* Whether we're considered to be at the beginning of a line.
311  * If so, '^' rules will be active on the next match, otherwise
312  * not.
313  */
314  int yy_at_bol;
315 
316  int yy_bs_lineno;
317  int yy_bs_column;
319  /* Whether to try to fill the input buffer when we reach the
320  * end of it.
321  */
322  int yy_fill_buffer;
323 
324  int yy_buffer_status;
325 
326 #define YY_BUFFER_NEW 0
327 #define YY_BUFFER_NORMAL 1
328  /* When an EOF's been seen but there's still some text to process
329  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
330  * shouldn't try reading from the input source any more. We might
331  * still have a bunch of tokens to match, though, because of
332  * possible backing-up.
333  *
334  * When we actually see the EOF, we change the status to "new"
335  * (via yyrestart()), so that the user can continue scanning by
336  * just pointing yyin at a new input file.
337  */
338 #define YY_BUFFER_EOF_PENDING 2
339 
340  };
341 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
342 
343 /* %if-c-only Standard (non-C++) definition */
344 /* %not-for-header */
345 
346 /* %if-not-reentrant */
347 /* %endif */
348 /* %ok-for-header */
349 
350 /* %endif */
351 
352 /* We provide macros for accessing buffer states in case in the
353  * future we want to put the buffer states in a more general
354  * "scanner state".
355  *
356  * Returns the top of the stack, or NULL.
357  */
358 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
359  ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
360  : NULL)
361 
362 /* Same as previous macro, but useful when we know that the buffer stack is not
363  * NULL or when we need an lvalue. For internal use only.
364  */
365 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
366 
367 /* %if-c-only Standard (non-C++) definition */
368 /* %if-not-reentrant */
369 /* %not-for-header */
370 
371 /* %ok-for-header */
372 
373 /* %endif */
374 /* %endif */
375 
376 // void *yyalloc (yy_size_t );
377 // void *yyrealloc (void *,yy_size_t );
378 // void yyfree (void * );
379 
380 #define yy_new_buffer yy_create_buffer
381 
382 #define yy_set_interactive(is_interactive) \
383  { \
384  if ( ! YY_CURRENT_BUFFER ){ \
385  yyensure_buffer_stack (); \
386  YY_CURRENT_BUFFER_LVALUE = \
387  yy_create_buffer( yyin, YY_BUF_SIZE ); \
388  } \
389  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
390  }
391 
392 #define yy_set_bol(at_bol) \
393  { \
394  if ( ! YY_CURRENT_BUFFER ){\
395  yyensure_buffer_stack (); \
396  YY_CURRENT_BUFFER_LVALUE = \
397  yy_create_buffer( yyin, YY_BUF_SIZE ); \
398  } \
399  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
400  }
401 
402 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
403 
404 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
405 /* Begin user sect3 */
406 
407 #define FLEX_DEBUG
408 
409 typedef unsigned char YY_CHAR;
410 
411 #define yytext_ptr yytext
412 #define YY_INTERACTIVE
413 
414 #include <lib/vcsn/rat/scan.hh>
415 
416 /* %% [1.5] DFA */
417 
418 /* %if-c-only Standard (non-C++) definition */
419 /* %endif */
420 
421 /* Done after the current pattern has been matched and before the
422  * corresponding action - sets up yytext.
423  */
424 #define YY_DO_BEFORE_ACTION \
425  (yytext_ptr) = yy_bp; \
426 /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
427  yyleng = (size_t) (yy_cp - yy_bp); \
428  (yy_hold_char) = *yy_cp; \
429  *yy_cp = '\0'; \
430 /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
431  (yy_c_buf_p) = yy_cp;
432 
433 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
434 #define YY_NUM_RULES 59
435 #define YY_END_OF_BUFFER 60
436 /* This struct is not used in this scanner,
437  but its presence is necessary. */
438 struct yy_trans_info
439  {
440  flex_int32_t yy_verify;
442  };
444  { 0,
445  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
446  60, 40, 30, 31, 22, 6, 3, 40, 1, 2,
447  18, 7, 12, 9, 4, 28, 32, 17, 14, 29,
448  40, 32, 13, 40, 40, 40, 40, 59, 35, 40,
449  33, 34, 43, 44, 41, 42, 55, 55, 55, 58,
450  56, 57, 58, 30, 31, 5, 0, 0, 0, 8,
451  39, 39, 16, 39, 15, 0, 0, 0, 0, 0,
452  0, 0, 0, 0, 0, 20, 22, 21, 16, 0,
453  0, 0, 0, 0, 43, 44, 47, 48, 46, 0,
454  58, 0, 36, 0, 36, 0, 0, 26, 0, 0,
455 
456  18, 19, 0, 11, 17, 24, 10, 23, 25, 15,
457  28, 32, 45, 49, 50, 51, 52, 53, 54, 56,
458  57, 0, 27, 37, 38, 0
459  } ;
460 
461 static yyconst YY_CHAR yy_ec[256] =
462  { 0,
463  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
464  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
465  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
466  1, 2, 4, 1, 5, 1, 6, 7, 8, 9,
467  10, 11, 12, 13, 14, 15, 16, 17, 17, 17,
468  17, 17, 17, 17, 17, 18, 18, 19, 1, 20,
469  1, 21, 22, 23, 24, 24, 24, 24, 24, 24,
470  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
471  1, 1, 1, 25, 1, 1, 1, 1, 1, 1,
472  26, 27, 28, 29, 1, 1, 24, 24, 30, 24,
473 
474  31, 24, 1, 1, 1, 1, 1, 1, 1, 1,
475  1, 1, 1, 1, 1, 32, 1, 1, 1, 33,
476  1, 34, 35, 36, 37, 1, 1, 1, 38, 1,
477  1, 1, 39, 1, 1, 40, 1, 1, 1, 1,
478  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
479  41, 1, 1, 1, 1, 42, 1, 1, 43, 1,
480  1, 1, 1, 1, 1, 1, 1, 44, 45, 1,
481  1, 46, 1, 1, 1, 47, 1, 48, 49, 50,
482  51, 52, 53, 54, 55, 1, 1, 1, 1, 1,
483  1, 1, 1, 56, 1, 1, 1, 1, 1, 1,
484 
485  1, 1, 1, 1, 1, 57, 1, 1, 1, 1,
486  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
487  1, 1, 1, 1, 58, 59, 1, 1, 1, 1,
488  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
489  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
490  1, 1, 1, 1, 1
491  } ;
492 
493 static yyconst YY_CHAR yy_meta[60] =
494  { 0,
495  1, 1, 2, 1, 1, 1, 1, 3, 4, 4,
496  1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
497  5, 1, 1, 1, 1, 1, 1, 1, 1, 1,
498  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
499  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
500  1, 1, 1, 1, 1, 1, 1, 1, 5
501  } ;
502 
504  { 0,
505  0, 0, 58, 0, 73, 87, 7, 32, 54, 78,
506  255, 256, 237, 234, 256, 256, 213, 201, 186, 256,
507  256, 256, 256, 256, 256, 195, 256, 256, 256, 256,
508  72, 127, 256, 63, 155, 49, 64, 256, 256, 75,
509  256, 256, 0, 202, 256, 256, 256, 71, 166, 0,
510  256, 256, 160, 200, 196, 256, 102, 119, 118, 256,
511  256, 181, 256, 138, 256, 160, 159, 113, 158, 148,
512  156, 155, 141, 126, 123, 256, 256, 256, 256, 112,
513  109, 120, 93, 80, 0, 145, 256, 256, 256, 129,
514  0, 91, 256, 120, 150, 183, 132, 256, 116, 170,
515 
516  256, 256, 172, 256, 256, 256, 256, 256, 256, 256,
517  256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
518  256, 111, 256, 256, 256, 256, 210, 215, 220, 225,
519  230, 235, 240, 244, 249
520  } ;
521 
523  { 0,
524  126, 1, 1, 3, 127, 127, 128, 128, 129, 129,
525  126, 126, 126, 126, 126, 126, 126, 130, 126, 126,
526  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
527  131, 126, 126, 126, 126, 126, 126, 126, 126, 131,
528  126, 126, 132, 126, 126, 126, 126, 126, 126, 133,
529  126, 126, 126, 126, 126, 126, 130, 134, 126, 126,
530  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
531  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
532  126, 126, 126, 126, 132, 126, 126, 126, 126, 126,
533  133, 126, 126, 130, 130, 134, 135, 126, 126, 126,
534 
535  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
536  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
537  126, 135, 126, 126, 126, 0, 126, 126, 126, 126,
538  126, 126, 126, 126, 126
539  } ;
540 
542  { 0,
543  12, 13, 14, 15, 12, 16, 17, 18, 19, 20,
544  21, 22, 23, 12, 24, 12, 12, 12, 25, 26,
545  27, 28, 29, 12, 12, 30, 31, 12, 12, 12,
546  12, 12, 12, 12, 32, 33, 27, 12, 12, 12,
547  12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
548  12, 12, 12, 12, 12, 34, 35, 36, 37, 12,
549  38, 12, 48, 12, 12, 49, 12, 12, 12, 12,
550  12, 39, 12, 51, 52, 44, 12, 12, 12, 12,
551  12, 45, 46, 12, 40, 41, 42, 48, 62, 44,
552  49, 62, 12, 12, 12, 45, 46, 51, 52, 80,
553 
554  81, 82, 63, 83, 64, 65, 84, 64, 77, 93,
555  78, 78, 53, 12, 12, 12, 12, 78, 87, 88,
556  123, 57, 97, 111, 112, 89, 95, 93, 58, 103,
557  103, 110, 124, 101, 120, 121, 53, 66, 67, 68,
558  98, 123, 69, 70, 70, 96, 58, 86, 71, 76,
559  108, 72, 106, 73, 100, 100, 74, 93, 75, 109,
560  68, 100, 108, 76, 70, 70, 78, 100, 100, 78,
561  78, 78, 78, 78, 78, 113, 58, 107, 114, 115,
562  116, 117, 118, 119, 76, 57, 125, 125, 103, 103,
563  95, 106, 105, 125, 104, 102, 101, 99, 55, 125,
564 
565  125, 54, 92, 90, 86, 79, 60, 59, 76, 96,
566  43, 43, 43, 43, 43, 47, 47, 47, 47, 47,
567  50, 50, 50, 50, 50, 57, 57, 58, 57, 57,
568  61, 56, 61, 61, 61, 85, 55, 85, 54, 85,
569  91, 91, 91, 91, 94, 94, 94, 94, 94, 122,
570  122, 122, 122, 122, 126, 11, 126, 126, 126, 126,
571  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
572  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
573  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
574  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
575 
576  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
577  126, 126, 126, 126, 126
578  } ;
579 
581  { 0,
582  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
583  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
584  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
585  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
586  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
587  1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
588  3, 3, 7, 3, 3, 7, 3, 3, 3, 3,
589  3, 3, 3, 9, 9, 5, 3, 3, 3, 3,
590  3, 5, 5, 3, 3, 3, 3, 8, 31, 6,
591  8, 40, 3, 3, 3, 6, 6, 10, 10, 36,
592 
593  36, 37, 31, 37, 31, 31, 37, 40, 34, 57,
594  34, 34, 9, 3, 3, 3, 3, 34, 48, 48,
595  122, 58, 59, 84, 84, 48, 58, 94, 57, 68,
596  68, 83, 99, 83, 92, 92, 10, 32, 32, 32,
597  59, 97, 32, 32, 32, 58, 94, 86, 32, 68,
598  81, 32, 80, 32, 64, 64, 32, 95, 32, 75,
599  70, 64, 74, 32, 70, 70, 82, 64, 64, 82,
600  82, 82, 82, 82, 82, 90, 95, 73, 90, 90,
601  90, 90, 90, 90, 70, 96, 100, 100, 103, 103,
602  96, 72, 71, 100, 69, 67, 66, 62, 55, 100,
603 
604  100, 54, 53, 49, 44, 35, 26, 19, 103, 96,
605  127, 127, 127, 127, 127, 128, 128, 128, 128, 128,
606  129, 129, 129, 129, 129, 130, 130, 18, 130, 130,
607  131, 17, 131, 131, 131, 132, 14, 132, 13, 132,
608  133, 133, 133, 133, 134, 134, 134, 134, 134, 135,
609  135, 135, 135, 135, 11, 126, 126, 126, 126, 126,
610  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
611  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
612  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
613  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
614 
615  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
616  126, 126, 126, 126, 126
617  } ;
618 
620  { 0,
621  62, 63, 65, 66, 67, 68, 69, 70, 71, 72,
622  73, 74, 75, 76, 77, 78, 81, 82, 83, 84,
623  89, 98, 99, 100, 101, 104, 105, 108, 111, 114,
624  115, 117, 124, 128, 129, 139, 143, 144, 145, 146,
625  151, 155, 168, 169, 178, 179, 180, 181, 182, 183,
626  184, 185, 186, 187, 188, 202, 207, 221
627  } ;
628 
629 /* The intent behind this definition is that it'll catch
630  * any uses of REJECT which flex missed.
631  */
632 #define REJECT reject_used_but_not_detected
633 #define yymore() yymore_used_but_not_detected
634 #define YY_MORE_ADJ 0
635 #define YY_RESTORE_YY_MORE_OFFSET
636 #line 1 "lib/vcsn/rat/scan.ll"
637 #define YY_NO_INPUT 1
638 
639 #line 14 "lib/vcsn/rat/scan.ll"
640 #include <cassert>
641 #include <iostream>
642 #include <stack>
643 #include <string>
644 
645 #include <boost/lexical_cast.hpp>
646 
647 #include <vcsn/misc/escape.hh>
648 #include <vcsn/misc/regex.hh>
649 
650 #include <lib/vcsn/rat/driver.hh>
651 #include <lib/vcsn/rat/parse.hh>
652 
653 #define LINE(Line) \
654  do { \
655  loc.end.column = 1; \
656  loc.lines(Line); \
657  } while (false)
658 
659 #define YY_USER_ACTION \
660  loc.columns(yyleng);
661 
662 #define TOK(Token) \
663  parser::make_ ## Token (loc)
664 
666 namespace
667 {
668  irange_type quantifier(driver& d, const location& loc, const std::string& s);
669 }
670 
671 #line 658 "lib/vcsn/rat/scan.cc"
672 
673 #define INITIAL 0
674 #define SC_CLASS 1
675 #define SC_CONTEXT 2
676 #define SC_EXPONENT 3
677 #define SC_WEIGHT 4
678 
679 #ifndef YY_NO_UNISTD_H
680 /* Special case for "unistd.h", since it is non-ANSI. We include it way
681  * down here because we want the user's section 1 to have been scanned first.
682  * The user has a chance to override it with an option.
683  */
684 /* %if-c-only */
685 /* %endif */
686 /* %if-c++-only */
687 #include <unistd.h>
688 /* %endif */
689 #endif
690 
691 #ifndef YY_EXTRA_TYPE
692 #define YY_EXTRA_TYPE void *
693 #endif
694 
695 /* %if-c-only Reentrant structure and macros (non-C++). */
696 /* %if-reentrant */
697 /* %if-c-only */
698 /* %endif */
699 /* %if-reentrant */
700 /* %endif */
701 /* %endif End reentrant structures and macros. */
702 /* %if-bison-bridge */
703 /* %endif */
704 /* %not-for-header */
705 
706 /* %ok-for-header */
707 
708 /* %endif */
709 
710 #ifndef yytext_ptr
711 static void yy_flex_strncpy (char *,yyconst char *,int );
712 #endif
713 
714 #ifdef YY_NEED_STRLEN
715 static int yy_flex_strlen (yyconst char * );
716 #endif
717 
718 #ifndef YY_NO_INPUT
719 /* %if-c-only Standard (non-C++) definition */
720 /* %not-for-header */
721 
722 /* %ok-for-header */
723 
724 /* %endif */
725 #endif
726 
727 /* %if-c-only */
728 /* %endif */
729 
730 /* Amount of stuff to slurp up with each read. */
731 #ifndef YY_READ_BUF_SIZE
732 #ifdef __ia64__
733 /* On IA-64, the buffer size is 16k, not 8k */
734 #define YY_READ_BUF_SIZE 16384
735 #else
736 #define YY_READ_BUF_SIZE 8192
737 #endif /* __ia64__ */
738 #endif
739 
740 /* Copy whatever the last rule matched to the standard output. */
741 #ifndef ECHO
742 /* %if-c-only Standard (non-C++) definition */
743 /* %endif */
744 /* %if-c++-only C++ definition */
745 #define ECHO LexerOutput( yytext, yyleng )
746 /* %endif */
747 #endif
748 
749 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
750  * is returned in "result".
751  */
752 #ifndef YY_INPUT
753 #define YY_INPUT(buf,result,max_size) \
754 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
755 \
756 /* %if-c++-only C++ definition \ */\
757  if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \
758  YY_FATAL_ERROR( "input in flex scanner failed" );
759 /* %endif */
760 
761 #endif
762 
763 /* No semi-colon after return; correct usage is to write "yyterminate();" -
764  * we don't want an extra ';' after the "return" because that will cause
765  * some compilers to complain about unreachable statements.
766  */
767 #ifndef yyterminate
768 #define yyterminate() return YY_NULL
769 #endif
770 
771 /* Number of entries by which start-condition stack grows. */
772 #ifndef YY_START_STACK_INCR
773 #define YY_START_STACK_INCR 25
774 #endif
775 
776 /* Report a fatal error. */
777 #ifndef YY_FATAL_ERROR
778 /* %if-c-only */
779 /* %endif */
780 /* %if-c++-only */
781 #define YY_FATAL_ERROR(msg) LexerError( msg )
782 /* %endif */
783 #endif
784 
785 /* %if-tables-serialization structures and prototypes */
786 /* %not-for-header */
787 
788 /* %ok-for-header */
789 
790 /* %not-for-header */
791 
792 /* %tables-yydmap generated elements */
793 /* %endif */
794 /* end tables serialization structures and prototypes */
795 
796 /* %ok-for-header */
797 
798 /* Default declaration of generated scanner - a define so the user can
799  * easily add parameters.
800  */
801 #ifndef YY_DECL
802 #define YY_DECL_IS_OURS 1
803 /* %if-c-only Standard (non-C++) definition */
804 /* %endif */
805 /* %if-c++-only C++ definition */
806 #define YY_DECL int yyFlexLexer::yylex()
807 /* %endif */
808 #endif /* !YY_DECL */
809 
810 /* Code executed at the beginning of each rule, after yytext and yyleng
811  * have been set up.
812  */
813 #ifndef YY_USER_ACTION
814 #define YY_USER_ACTION
815 #endif
816 
817 /* Code executed at the end of each rule. */
818 #ifndef YY_BREAK
819 #define YY_BREAK /*LINTED*/break;
820 #endif
821 
822 /* %% [6.0] YY_RULE_SETUP definition goes here */
823 #define YY_RULE_SETUP \
824  YY_USER_ACTION
825 
826 /* %not-for-header */
827 
830 YY_DECL
831 {
832  yy_state_type yy_current_state;
833  char *yy_cp, *yy_bp;
834  int yy_act;
835 
836  if ( !(yy_init) )
837  {
838  (yy_init) = 1;
839 
840 #ifdef YY_USER_INIT
841  YY_USER_INIT;
842 #endif
843 
844  if ( ! (yy_start) )
845  (yy_start) = 1; /* first start state */
846 
847  if ( ! yyin )
848 /* %if-c-only */
849 /* %endif */
850 /* %if-c++-only */
851  yyin.rdbuf(std::cin.rdbuf());
852 /* %endif */
853 
854  if ( ! yyout )
855 /* %if-c-only */
856 /* %endif */
857 /* %if-c++-only */
858  yyout.rdbuf(std::cout.rdbuf());
859 /* %endif */
860 
861  if ( ! YY_CURRENT_BUFFER ) {
862  yyensure_buffer_stack ();
864  yy_create_buffer( yyin, YY_BUF_SIZE );
865  }
866 
867  yy_load_buffer_state( );
868  }
869 
870  {
871 /* %% [7.0] user's declarations go here */
872 #line 48 "lib/vcsn/rat/scan.ll"
873 
874 
875  // Count the number of opened braces in SC_WEIGHT, and parens in SC_CONTEXT.
876  unsigned int nesting = 0;
877  // Compute the exponent.
878  unsigned int exponent = 0;
879  // Build a context string. "static" only to save build/dtor.
880  static std::string context;
881  std::string s;
882  loc.step();
883 
884 
885 #line 872 "lib/vcsn/rat/scan.cc"
886 
887  while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
888  {
889 /* %% [8.0] yymore()-related code goes here */
890  yy_cp = (yy_c_buf_p);
891 
892  /* Support of yytext. */
893  *yy_cp = (yy_hold_char);
894 
895  /* yy_bp points to the position in yy_ch_buf of the start of
896  * the current run.
897  */
898  yy_bp = yy_cp;
899 
900 /* %% [9.0] code to set up and find next match goes here */
901  yy_current_state = (yy_start);
902 yy_match:
903  do
904  {
905  YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
906  if ( yy_accept[yy_current_state] )
907  {
908  (yy_last_accepting_state) = yy_current_state;
909  (yy_last_accepting_cpos) = yy_cp;
910  }
911  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
912  {
913  yy_current_state = (int) yy_def[yy_current_state];
914  if ( yy_current_state >= 127 )
915  yy_c = yy_meta[(unsigned int) yy_c];
916  }
917  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
918  ++yy_cp;
919  }
920  while ( yy_base[yy_current_state] != 256 );
921 
922 yy_find_action:
923 /* %% [10.0] code to find the action number goes here */
924  yy_act = yy_accept[yy_current_state];
925  if ( yy_act == 0 )
926  { /* have to back up */
927  yy_cp = (yy_last_accepting_cpos);
928  yy_current_state = (yy_last_accepting_state);
929  yy_act = yy_accept[yy_current_state];
930  }
931 
933 
934 /* %% [11.0] code for yylineno update goes here */
935 
936 do_action: /* This label is used only to access EOF actions. */
937 
938 /* %% [12.0] debug code goes here */
939  if ( yy_flex_debug )
940  {
941  if ( yy_act == 0 )
942  std::cerr << "--scanner backing up\n";
943  else if ( yy_act < 59 )
944  std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] <<
945  "(\"" << yytext << "\")\n";
946  else if ( yy_act == 59 )
947  std::cerr << "--accepting default rule (\"" << yytext << "\")\n";
948  else if ( yy_act == 60 )
949  std::cerr << "--(end of buffer or a NUL)\n";
950  else
951  std::cerr << "--EOF (start condition " << YY_START << ")\n";
952  }
953 
954  switch ( yy_act )
955  { /* beginning of action switch */
956 /* %% [13.0] actions go here */
957  case 0: /* must back up */
958  /* undo the effects of YY_DO_BEFORE_ACTION */
959  *yy_cp = (yy_hold_char);
960  yy_cp = (yy_last_accepting_cpos);
961  yy_current_state = (yy_last_accepting_state);
962  goto yy_find_action;
963 
964 /* Vcsn Syntax */
965 case 1:
967 #line 62 "lib/vcsn/rat/scan.ll"
968 return TOK(LPAREN);
969  YY_BREAK
970 case 2:
972 #line 63 "lib/vcsn/rat/scan.ll"
973 return TOK(RPAREN);
974  YY_BREAK
975 case 3:
977 #line 65 "lib/vcsn/rat/scan.ll"
978 return TOK(AMPERSAND);
979  YY_BREAK
980 case 4:
982 #line 66 "lib/vcsn/rat/scan.ll"
983 return TOK(COLON);
984  YY_BREAK
985 case 5:
987 #line 67 "lib/vcsn/rat/scan.ll"
988 return TOK(AMPERSAND_COLON);
989  YY_BREAK
990 case 6:
992 #line 68 "lib/vcsn/rat/scan.ll"
993 return TOK(PERCENT);
994  YY_BREAK
995 case 7:
997 #line 69 "lib/vcsn/rat/scan.ll"
998 return TOK(PLUS);
999  YY_BREAK
1000 case 8:
1002 #line 70 "lib/vcsn/rat/scan.ll"
1003 return TOK(LT_PLUS);
1004  YY_BREAK
1005 case 9:
1007 #line 71 "lib/vcsn/rat/scan.ll"
1008 return TOK(DOT);
1009  YY_BREAK
1010 case 10:
1012 #line 72 "lib/vcsn/rat/scan.ll"
1013 return TOK(BACKSLASH);
1014  YY_BREAK
1015 case 11:
1017 #line 73 "lib/vcsn/rat/scan.ll"
1018 return TOK(SLASH);
1019  YY_BREAK
1020 case 12:
1022 #line 74 "lib/vcsn/rat/scan.ll"
1023 return TOK(COMMA);
1024  YY_BREAK
1025 case 13:
1027 #line 75 "lib/vcsn/rat/scan.ll"
1028 return TOK(PIPE);
1029  YY_BREAK
1030 case 14:
1032 #line 76 "lib/vcsn/rat/scan.ll"
1033 return TOK(AT);
1034  YY_BREAK
1035 case 15:
1037 #line 77 "lib/vcsn/rat/scan.ll"
1038 return TOK(ZERO);
1039  YY_BREAK
1040 case 16:
1042 #line 78 "lib/vcsn/rat/scan.ll"
1043 return TOK(ONE);
1044  YY_BREAK
1045 /* Quantifiers. */
1046 case 17:
1048 #line 81 "lib/vcsn/rat/scan.ll"
1049 return parser::make_STAR(std::make_tuple(0, 1), loc);
1050  YY_BREAK
1051 case 18:
1053 #line 82 "lib/vcsn/rat/scan.ll"
1054 return parser::make_STAR(std::make_tuple(-1, -1), loc);
1055  YY_BREAK
1056 case 19:
1058 #line 83 "lib/vcsn/rat/scan.ll"
1059 return parser::make_STAR(std::make_tuple(1, -1), loc);
1060  YY_BREAK
1061 case 20:
1063 #line 84 "lib/vcsn/rat/scan.ll"
1064 {
1065  return parser::make_STAR(quantifier(driver_, loc,
1066  {yytext+1, static_cast<size_t>(yyleng)-2}),
1067  loc);
1068  }
1069  YY_BREAK
1070 case 21:
1072 #line 89 "lib/vcsn/rat/scan.ll"
1073 {
1074  // Detect an exponent, do not read it yet. Handle it in the exponent state.
1075  yyless(0);
1076  loc -= yyleng;
1077  exponent = 0;
1078  yy_push_state(SC_EXPONENT);
1079  }
1080  YY_BREAK
1081 case 22:
1083 #line 98 "lib/vcsn/rat/scan.ll"
1084 return TOK(BANG);
1085  YY_BREAK
1086 case 23:
1088 #line 99 "lib/vcsn/rat/scan.ll"
1089 return TOK(COMPLEMENT);
1090  YY_BREAK
1091 case 24:
1093 #line 100 "lib/vcsn/rat/scan.ll"
1094 return TOK(TRANSPOSITION);
1095  YY_BREAK
1096 case 25:
1098 #line 101 "lib/vcsn/rat/scan.ll"
1099 return TOK(TRANSPOSE);
1100  YY_BREAK
1101 /* Special constructs. */
1102 case 26:
1104 #line 104 "lib/vcsn/rat/scan.ll"
1105 context.clear(); yy_push_state(SC_CONTEXT);
1106  YY_BREAK
1107 case 27:
1108 /* rule 27 can match eol */
1110 #line 105 "lib/vcsn/rat/scan.ll"
1111 continue;
1112  YY_BREAK
1113 /* Weights. */
1114 case 28:
1116 #line 108 "lib/vcsn/rat/scan.ll"
1117 yy_push_state(SC_WEIGHT);
1118  YY_BREAK
1119 /* Character classes. */
1120 case 29:
1122 #line 111 "lib/vcsn/rat/scan.ll"
1123 yy_push_state(SC_CLASS); return parser::make_LBRACKET(loc);
1124  YY_BREAK
1125 /* White spaces. */
1126 case 30:
1128 #line 114 "lib/vcsn/rat/scan.ll"
1129 loc.step(); continue;
1130  YY_BREAK
1131 case 31:
1132 /* rule 31 can match eol */
1134 #line 115 "lib/vcsn/rat/scan.ll"
1135 LINE(yyleng); loc.step(); continue;
1136  YY_BREAK
1137 case 32:
1139 #line 117 "lib/vcsn/rat/scan.ll"
1140 {
1141  throw parser::syntax_error(loc,
1142  std::string{"unexpected character: "} + yytext);
1143  }
1144  YY_BREAK
1145 
1146 /* Character-class. Initial [ is eaten. */
1147 case 33:
1149 #line 124 "lib/vcsn/rat/scan.ll"
1150 {
1151  yy_pop_state();
1152  return parser::make_RBRACKET(loc);
1153  }
1154  YY_BREAK
1155 case 34:
1157 #line 128 "lib/vcsn/rat/scan.ll"
1158 return parser::make_CARET(loc);
1159  YY_BREAK
1160 case 35:
1162 #line 129 "lib/vcsn/rat/scan.ll"
1163 return parser::make_DASH(loc);
1164  YY_BREAK
1165 case YY_STATE_EOF(SC_CLASS):
1166 #line 131 "lib/vcsn/rat/scan.ll"
1167 {
1168  driver_.error(loc, "unexpected end of file in a character-class");
1169  unput(']');
1170  }
1171  YY_BREAK
1172 
1173 /* Labels. */
1174 case 36:
1175 /* rule 36 can match eol */
1177 #line 139 "lib/vcsn/rat/scan.ll"
1178 {
1179  return parser::make_LETTER({yytext+1, size_t(yyleng-2)}, loc);
1180  }
1181  YY_BREAK
1182 case 37:
1183 #line 144 "lib/vcsn/rat/scan.ll"
1184 case 38:
1185 #line 145 "lib/vcsn/rat/scan.ll"
1186 case 39:
1187 #line 146 "lib/vcsn/rat/scan.ll"
1188 case 40:
1190 #line 146 "lib/vcsn/rat/scan.ll"
1191 return parser::make_LETTER({yytext, size_t(yyleng)}, loc);
1192  YY_BREAK
1193 
1194 /* Context embedded in a $(?@...) directive. */
1195 case 41:
1197 #line 151 "lib/vcsn/rat/scan.ll"
1198 {
1199  ++nesting;
1200  context.append(yytext, yyleng);
1201  }
1202  YY_BREAK
1203 case 42:
1205 #line 155 "lib/vcsn/rat/scan.ll"
1206 {
1207  if (nesting)
1208  {
1209  --nesting;
1210  context.append(yytext, yyleng);
1211  }
1212  else
1213  {
1214  yy_pop_state();
1215  driver_.context(context);
1216  context.clear();
1217  }
1218  }
1219  YY_BREAK
1220 case 43:
1222 #line 168 "lib/vcsn/rat/scan.ll"
1223 context.append(yytext, yyleng);
1224  YY_BREAK
1225 case 44:
1226 /* rule 44 can match eol */
1228 #line 169 "lib/vcsn/rat/scan.ll"
1229 LINE(yyleng); context.append(yytext, yyleng);
1230  YY_BREAK
1231 case YY_STATE_EOF(SC_CONTEXT):
1232 #line 171 "lib/vcsn/rat/scan.ll"
1233 {
1234  driver_.error(loc, "unexpected end of file in a context comment");
1235  unput(')');
1236  }
1237  YY_BREAK
1238 
1239 /* UTF-8 Exponent */
1240 case 45:
1242 #line 178 "lib/vcsn/rat/scan.ll"
1243 exponent *= 10;
1244  YY_BREAK
1245 case 46:
1247 #line 179 "lib/vcsn/rat/scan.ll"
1248 exponent *= 10; exponent += 1;
1249  YY_BREAK
1250 case 47:
1252 #line 180 "lib/vcsn/rat/scan.ll"
1253 exponent *= 10; exponent += 2;
1254  YY_BREAK
1255 case 48:
1257 #line 181 "lib/vcsn/rat/scan.ll"
1258 exponent *= 10; exponent += 3;
1259  YY_BREAK
1260 case 49:
1262 #line 182 "lib/vcsn/rat/scan.ll"
1263 exponent *= 10; exponent += 4;
1264  YY_BREAK
1265 case 50:
1267 #line 183 "lib/vcsn/rat/scan.ll"
1268 exponent *= 10; exponent += 5;
1269  YY_BREAK
1270 case 51:
1272 #line 184 "lib/vcsn/rat/scan.ll"
1273 exponent *= 10; exponent += 6;
1274  YY_BREAK
1275 case 52:
1277 #line 185 "lib/vcsn/rat/scan.ll"
1278 exponent *= 10; exponent += 7;
1279  YY_BREAK
1280 case 53:
1282 #line 186 "lib/vcsn/rat/scan.ll"
1283 exponent *= 10; exponent += 8;
1284  YY_BREAK
1285 case 54:
1287 #line 187 "lib/vcsn/rat/scan.ll"
1288 exponent *= 10; exponent += 9;
1289  YY_BREAK
1290 case 55:
1291 /* rule 55 can match eol */
1293 #line 188 "lib/vcsn/rat/scan.ll"
1294 {
1295  // The end of the exponent was met, do not read it as it would be lost.
1296  yyless(0);
1297  loc -= yyleng;
1298  yy_pop_state();
1299  return parser::make_STAR(std::make_tuple(exponent, exponent), loc);
1300  }
1301  YY_BREAK
1303 #line 195 "lib/vcsn/rat/scan.ll"
1304 {
1305  yy_pop_state();
1306  return parser::make_STAR(std::make_tuple(exponent, exponent), loc);
1307  }
1308  YY_BREAK
1309 
1310 /* Weight. */
1311 case 56:
1313 #line 202 "lib/vcsn/rat/scan.ll"
1314 {
1315  ++nesting;
1316  s.append(yytext, yyleng);
1317  }
1318  YY_BREAK
1319 case 57:
1321 #line 207 "lib/vcsn/rat/scan.ll"
1322 {
1323  if (nesting)
1324  {
1325  --nesting;
1326  s.append(yytext, yyleng);
1327  }
1328  else
1329  {
1330  yy_pop_state();
1331  return parser::make_WEIGHT(s, loc);
1332  }
1333  }
1334  YY_BREAK
1335 /* "⟨" is e2 9f a8, and "⟩" is e2 9f a9. */
1336 case 58:
1337 /* rule 58 can match eol */
1339 #line 221 "lib/vcsn/rat/scan.ll"
1340 s.append(yytext, yyleng);
1341  YY_BREAK
1342 case YY_STATE_EOF(SC_WEIGHT):
1343 #line 223 "lib/vcsn/rat/scan.ll"
1344 {
1345  driver_.error(loc, "unexpected end of file in a weight");
1346  unput('>');
1347  }
1348  YY_BREAK
1349 
1350 case 59:
1352 #line 229 "lib/vcsn/rat/scan.ll"
1353 ECHO;
1354  YY_BREAK
1355 #line 1342 "lib/vcsn/rat/scan.cc"
1356 case YY_STATE_EOF(INITIAL):
1357  yyterminate();
1358 
1359  case YY_END_OF_BUFFER:
1360  {
1361  /* Amount of text matched not including the EOB char. */
1362  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1363 
1364  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1365  *yy_cp = (yy_hold_char);
1367 
1368  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1369  {
1370  /* We're scanning a new file or input source. It's
1371  * possible that this happened because the user
1372  * just pointed yyin at a new source and called
1373  * yylex(). If so, then we have to assure
1374  * consistency between YY_CURRENT_BUFFER and our
1375  * globals. Here is the right place to do so, because
1376  * this is the first action (other than possibly a
1377  * back-up) that will match for the new input source.
1378  */
1379  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1380 /* %if-c-only */
1381 /* %endif */
1382 /* %if-c++-only */
1383  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin.rdbuf();
1384 /* %endif */
1385  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1386  }
1387 
1388  /* Note that here we test for yy_c_buf_p "<=" to the position
1389  * of the first EOB in the buffer, since yy_c_buf_p will
1390  * already have been incremented past the NUL character
1391  * (since all states make transitions on EOB to the
1392  * end-of-buffer state). Contrast this with the test
1393  * in input().
1394  */
1395  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1396  { /* This was really a NUL. */
1397  yy_state_type yy_next_state;
1398 
1399  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1400 
1401  yy_current_state = yy_get_previous_state( );
1402 
1403  /* Okay, we're now positioned to make the NUL
1404  * transition. We couldn't have
1405  * yy_get_previous_state() go ahead and do it
1406  * for us because it doesn't know how to deal
1407  * with the possibility of jamming (and we don't
1408  * want to build jamming into it because then it
1409  * will run more slowly).
1410  */
1411 
1412  yy_next_state = yy_try_NUL_trans( yy_current_state );
1413 
1414  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1415 
1416  if ( yy_next_state )
1417  {
1418  /* Consume the NUL. */
1419  yy_cp = ++(yy_c_buf_p);
1420  yy_current_state = yy_next_state;
1421  goto yy_match;
1422  }
1423 
1424  else
1425  {
1426 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
1427  yy_cp = (yy_c_buf_p);
1428  goto yy_find_action;
1429  }
1430  }
1431 
1432  else switch ( yy_get_next_buffer( ) )
1433  {
1434  case EOB_ACT_END_OF_FILE:
1435  {
1436  (yy_did_buffer_switch_on_eof) = 0;
1437 
1438  if ( yywrap( ) )
1439  {
1440  /* Note: because we've taken care in
1441  * yy_get_next_buffer() to have set up
1442  * yytext, we can now set up
1443  * yy_c_buf_p so that if some total
1444  * hoser (like flex itself) wants to
1445  * call the scanner after we return the
1446  * YY_NULL, it'll still work - another
1447  * YY_NULL will get returned.
1448  */
1449  (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1450 
1451  yy_act = YY_STATE_EOF(YY_START);
1452  goto do_action;
1453  }
1454 
1455  else
1456  {
1457  if ( ! (yy_did_buffer_switch_on_eof) )
1458  YY_NEW_FILE;
1459  }
1460  break;
1461  }
1462 
1463  case EOB_ACT_CONTINUE_SCAN:
1464  (yy_c_buf_p) =
1465  (yytext_ptr) + yy_amount_of_matched_text;
1466 
1467  yy_current_state = yy_get_previous_state( );
1468 
1469  yy_cp = (yy_c_buf_p);
1470  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1471  goto yy_match;
1472 
1473  case EOB_ACT_LAST_MATCH:
1474  (yy_c_buf_p) =
1475  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1476 
1477  yy_current_state = yy_get_previous_state( );
1478 
1479  yy_cp = (yy_c_buf_p);
1480  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1481  goto yy_find_action;
1482  }
1483  break;
1484  }
1485 
1486  default:
1488  "fatal flex scanner internal error--no action found" );
1489  } /* end of action switch */
1490  } /* end of scanning one token */
1491  } /* end of user's declarations */
1492 } /* end of yylex */
1493 /* %ok-for-header */
1494 
1495 /* %if-c++-only */
1496 /* %not-for-header */
1497 
1498 /* The contents of this function are C++ specific, so the () macro is not used.
1499  * This constructor simply maintains backward compatibility.
1500  * DEPRECATED
1501  */
1502 yyFlexLexer::yyFlexLexer( FLEX_STD istream* arg_yyin, FLEX_STD ostream* arg_yyout ):
1503  yyin(arg_yyin ? arg_yyin->rdbuf() : std::cin.rdbuf()),
1504  yyout(arg_yyout ? arg_yyout->rdbuf() : std::cout.rdbuf())
1505 {
1506  ctor_common();
1507 }
1508 
1509 /* The contents of this function are C++ specific, so the () macro is not used.
1510  */
1511 yyFlexLexer::yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout ):
1512  yyin(arg_yyin.rdbuf()),
1513  yyout(arg_yyout.rdbuf())
1514 {
1515  ctor_common();
1516 }
1517 
1518 /* The contents of this function are C++ specific, so the () macro is not used.
1519  */
1521 {
1522  yy_c_buf_p = 0;
1523  yy_init = 0;
1524  yy_start = 0;
1525  yy_flex_debug = 0;
1526  yylineno = 1; // this will only get updated if %option yylineno
1527 
1528  yy_did_buffer_switch_on_eof = 0;
1529 
1530  yy_looking_for_trail_begin = 0;
1531  yy_more_flag = 0;
1532  yy_more_len = 0;
1533  yy_more_offset = yy_prev_more_offset = 0;
1534 
1535  yy_start_stack_ptr = yy_start_stack_depth = 0;
1536  yy_start_stack = NULL;
1537 
1538  yy_buffer_stack = 0;
1539  yy_buffer_stack_top = 0;
1540  yy_buffer_stack_max = 0;
1541 
1542  yy_state_buf = 0;
1543 
1544 }
1545 
1546 /* The contents of this function are C++ specific, so the () macro is not used.
1547  */
1549 {
1550  delete [] yy_state_buf;
1551  yyfree(yy_start_stack );
1552  yy_delete_buffer( YY_CURRENT_BUFFER );
1553  yyfree(yy_buffer_stack );
1554 }
1555 
1556 /* The contents of this function are C++ specific, so the () macro is not used.
1557  */
1558 void yyFlexLexer::switch_streams( std::istream& new_in, std::ostream& new_out )
1559 {
1560  // was if( new_in )
1561  yy_delete_buffer( YY_CURRENT_BUFFER );
1562  yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
1563 
1564  // was if( new_out )
1565  yyout.rdbuf(new_out.rdbuf());
1566 }
1567 
1568 /* The contents of this function are C++ specific, so the () macro is not used.
1569  */
1570 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1571 {
1572  if( ! new_in ) {
1573  new_in = &yyin;
1574  }
1575 
1576  if ( ! new_out ) {
1577  new_out = &yyout;
1578  }
1579 
1580  switch_streams(*new_in, *new_out);
1581 }
1582 
1583 #ifdef YY_INTERACTIVE
1584 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1585 #else
1586 int yyFlexLexer::LexerInput( char* buf, int max_size )
1587 #endif
1588 {
1589  if ( yyin.eof() || yyin.fail() )
1590  return 0;
1591 
1592 #ifdef YY_INTERACTIVE
1593  yyin.get( buf[0] );
1594 
1595  if ( yyin.eof() )
1596  return 0;
1597 
1598  if ( yyin.bad() )
1599  return -1;
1600 
1601  return 1;
1602 
1603 #else
1604  (void) yyin.read( buf, max_size );
1605 
1606  if ( yyin.bad() )
1607  return -1;
1608  else
1609  return yyin.gcount();
1610 #endif
1611 }
1612 
1613 void yyFlexLexer::LexerOutput( const char* buf, int size )
1614 {
1615  (void) yyout.write( buf, size );
1616 }
1617 /* %ok-for-header */
1618 
1619 /* %endif */
1620 
1621 /* yy_get_next_buffer - try to read in a new buffer
1622  *
1623  * Returns a code representing an action:
1624  * EOB_ACT_LAST_MATCH -
1625  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1626  * EOB_ACT_END_OF_FILE - end of file
1627  */
1628 /* %if-c-only */
1629 /* %endif */
1630 /* %if-c++-only */
1632 /* %endif */
1633 {
1634  char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1635  char *source = (yytext_ptr);
1636  yy_size_t number_to_move, i;
1637  int ret_val;
1638 
1639  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1641  "fatal flex scanner internal error--end of buffer missed" );
1642 
1643  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1644  { /* Don't try to fill the buffer, so this is an EOF. */
1645  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1646  {
1647  /* We matched a single character, the EOB, so
1648  * treat this as a final EOF.
1649  */
1650  return EOB_ACT_END_OF_FILE;
1651  }
1652 
1653  else
1654  {
1655  /* We matched some text prior to the EOB, first
1656  * process it.
1657  */
1658  return EOB_ACT_LAST_MATCH;
1659  }
1660  }
1661 
1662  /* Try to read more data. */
1663 
1664  /* First move last chars to start of buffer. */
1665  number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1666 
1667  for ( i = 0; i < number_to_move; ++i )
1668  *(dest++) = *(source++);
1669 
1670  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1671  /* don't do the read, it's not guaranteed to return an EOF,
1672  * just force an EOF
1673  */
1674  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1675 
1676  else
1677  {
1678  yy_size_t num_to_read =
1679  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1680 
1681  while ( num_to_read <= 0 )
1682  { /* Not enough room in the buffer - grow it. */
1683 
1684  /* just a shorter name for the current buffer */
1685  YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1686 
1687  int yy_c_buf_p_offset =
1688  (int) ((yy_c_buf_p) - b->yy_ch_buf);
1689 
1690  if ( b->yy_is_our_buffer )
1691  {
1692  yy_size_t new_size = b->yy_buf_size * 2;
1693 
1694  if ( new_size <= 0 )
1695  b->yy_buf_size += b->yy_buf_size / 8;
1696  else
1697  b->yy_buf_size *= 2;
1698 
1699  b->yy_ch_buf = (char *)
1700  /* Include room in for 2 EOB chars. */
1701  yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1702  }
1703  else
1704  /* Can't grow it, we don't own it. */
1705  b->yy_ch_buf = 0;
1706 
1707  if ( ! b->yy_ch_buf )
1709  "fatal error - scanner input buffer overflow" );
1710 
1711  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1712 
1713  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1714  number_to_move - 1;
1715 
1716  }
1717 
1718  if ( num_to_read > YY_READ_BUF_SIZE )
1719  num_to_read = YY_READ_BUF_SIZE;
1720 
1721  /* Read in more data. */
1722  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1723  (yy_n_chars), num_to_read );
1724 
1725  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1726  }
1727 
1728  if ( (yy_n_chars) == 0 )
1729  {
1730  if ( number_to_move == YY_MORE_ADJ )
1731  {
1732  ret_val = EOB_ACT_END_OF_FILE;
1733  yyrestart( yyin );
1734  }
1735 
1736  else
1737  {
1738  ret_val = EOB_ACT_LAST_MATCH;
1739  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1741  }
1742  }
1743 
1744  else
1745  ret_val = EOB_ACT_CONTINUE_SCAN;
1746 
1747  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1748  /* Extend the array by 50%, plus the number we really need. */
1749  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1750  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1751  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1752  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1753  }
1754 
1755  (yy_n_chars) += number_to_move;
1758 
1759  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1760 
1761  return ret_val;
1762 }
1763 
1764 /* yy_get_previous_state - get the state just before the EOB char was reached */
1765 
1766 /* %if-c-only */
1767 /* %not-for-header */
1768 
1769 /* %endif */
1770 /* %if-c++-only */
1772 /* %endif */
1773 {
1774  yy_state_type yy_current_state;
1775  char *yy_cp;
1776 
1777 /* %% [15.0] code to get the start state into yy_current_state goes here */
1778  yy_current_state = (yy_start);
1779 
1780  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1781  {
1782 /* %% [16.0] code to find the next state goes here */
1783  YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1784  if ( yy_accept[yy_current_state] )
1785  {
1786  (yy_last_accepting_state) = yy_current_state;
1787  (yy_last_accepting_cpos) = yy_cp;
1788  }
1789  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1790  {
1791  yy_current_state = (int) yy_def[yy_current_state];
1792  if ( yy_current_state >= 127 )
1793  yy_c = yy_meta[(unsigned int) yy_c];
1794  }
1795  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1796  }
1797 
1798  return yy_current_state;
1799 }
1800 
1801 /* yy_try_NUL_trans - try to make a transition on the NUL character
1802  *
1803  * synopsis
1804  * next_state = yy_try_NUL_trans( current_state );
1805  */
1806 /* %if-c-only */
1807 /* %endif */
1808 /* %if-c++-only */
1810 /* %endif */
1811 {
1812  int yy_is_jam;
1813  /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
1814  char *yy_cp = (yy_c_buf_p);
1815 
1816  YY_CHAR yy_c = 1;
1817  if ( yy_accept[yy_current_state] )
1818  {
1819  (yy_last_accepting_state) = yy_current_state;
1820  (yy_last_accepting_cpos) = yy_cp;
1821  }
1822  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1823  {
1824  yy_current_state = (int) yy_def[yy_current_state];
1825  if ( yy_current_state >= 127 )
1826  yy_c = yy_meta[(unsigned int) yy_c];
1827  }
1828  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1829  yy_is_jam = (yy_current_state == 126);
1830 
1831  return yy_is_jam ? 0 : yy_current_state;
1832 }
1833 
1834 #ifndef YY_NO_UNPUT
1835 /* %if-c-only */
1836 /* %endif */
1837 /* %if-c++-only */
1838  void yyFlexLexer::yyunput( int c, char* yy_bp)
1839 /* %endif */
1840 {
1841  char *yy_cp;
1842 
1843  yy_cp = (yy_c_buf_p);
1844 
1845  /* undo effects of setting up yytext */
1846  *yy_cp = (yy_hold_char);
1847 
1848  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1849  { /* need to shift things up to make room */
1850  /* +2 for EOB chars. */
1851  yy_size_t number_to_move = (yy_n_chars) + 2;
1852  char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1853  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1854  char *source =
1855  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1856 
1857  while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1858  *--dest = *--source;
1859 
1860  yy_cp += (int) (dest - source);
1861  yy_bp += (int) (dest - source);
1862  YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1863  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1864 
1865  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1866  YY_FATAL_ERROR( "flex scanner push-back overflow" );
1867  }
1868 
1869  *--yy_cp = (char) c;
1870 
1871 /* %% [18.0] update yylineno here */
1872 
1873  (yytext_ptr) = yy_bp;
1874  (yy_hold_char) = *yy_cp;
1875  (yy_c_buf_p) = yy_cp;
1876 }
1877 /* %if-c-only */
1878 /* %endif */
1879 #endif
1880 
1881 /* %if-c-only */
1882 /* %endif */
1883 /* %if-c++-only */
1884  int yyFlexLexer::yyinput()
1885 /* %endif */
1886 {
1887  int c;
1888 
1889  *(yy_c_buf_p) = (yy_hold_char);
1890 
1891  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1892  {
1893  /* yy_c_buf_p now points to the character we want to return.
1894  * If this occurs *before* the EOB characters, then it's a
1895  * valid NUL; if not, then we've hit the end of the buffer.
1896  */
1897  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1898  /* This was really a NUL. */
1899  *(yy_c_buf_p) = '\0';
1900 
1901  else
1902  { /* need more input */
1903  yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1904  ++(yy_c_buf_p);
1905 
1906  switch ( yy_get_next_buffer( ) )
1907  {
1908  case EOB_ACT_LAST_MATCH:
1909  /* This happens because yy_g_n_b()
1910  * sees that we've accumulated a
1911  * token and flags that we need to
1912  * try matching the token before
1913  * proceeding. But for input(),
1914  * there's no matching to consider.
1915  * So convert the EOB_ACT_LAST_MATCH
1916  * to EOB_ACT_END_OF_FILE.
1917  */
1918 
1919  /* Reset buffer status. */
1920  yyrestart( yyin );
1921 
1922  /*FALLTHROUGH*/
1923 
1924  case EOB_ACT_END_OF_FILE:
1925  {
1926  if ( yywrap( ) )
1927  return EOF;
1928 
1929  if ( ! (yy_did_buffer_switch_on_eof) )
1930  YY_NEW_FILE;
1931 #ifdef __cplusplus
1932  return yyinput();
1933 #else
1934  return input();
1935 #endif
1936  }
1937 
1938  case EOB_ACT_CONTINUE_SCAN:
1939  (yy_c_buf_p) = (yytext_ptr) + offset;
1940  break;
1941  }
1942  }
1943  }
1944 
1945  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1946  *(yy_c_buf_p) = '\0'; /* preserve yytext */
1947  (yy_hold_char) = *++(yy_c_buf_p);
1948 
1949 /* %% [19.0] update BOL and yylineno */
1950 
1951  return c;
1952 }
1953 /* %if-c-only */
1954 /* %endif */
1955 
1961 /* %if-c-only */
1962 /* %endif */
1963 /* %if-c++-only */
1964  void yyFlexLexer::yyrestart( std::istream& input_file )
1965 /* %endif */
1966 {
1967 
1968  if ( ! YY_CURRENT_BUFFER ){
1969  yyensure_buffer_stack ();
1971  yy_create_buffer( yyin, YY_BUF_SIZE );
1972  }
1973 
1974  yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1975  yy_load_buffer_state( );
1976 }
1977 
1978 /* %if-c++-only */
1984 void yyFlexLexer::yyrestart( std::istream* input_file )
1985 {
1986  yyrestart( *input_file );
1987 }
1988 /* %endif */
1989 
1994 /* %if-c-only */
1995 /* %endif */
1996 /* %if-c++-only */
1997  void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1998 /* %endif */
1999 {
2000 
2001  /* TODO. We should be able to replace this entire function body
2002  * with
2003  * yypop_buffer_state();
2004  * yypush_buffer_state(new_buffer);
2005  */
2006  yyensure_buffer_stack ();
2007  if ( YY_CURRENT_BUFFER == new_buffer )
2008  return;
2009 
2010  if ( YY_CURRENT_BUFFER )
2011  {
2012  /* Flush out information for old buffer. */
2013  *(yy_c_buf_p) = (yy_hold_char);
2014  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2015  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2016  }
2017 
2018  YY_CURRENT_BUFFER_LVALUE = new_buffer;
2019  yy_load_buffer_state( );
2020 
2021  /* We don't actually know whether we did this switch during
2022  * EOF (yywrap()) processing, but the only time this flag
2023  * is looked at is after yywrap() is called, so it's safe
2024  * to go ahead and always set it.
2025  */
2026  (yy_did_buffer_switch_on_eof) = 1;
2027 }
2028 
2029 /* %if-c-only */
2030 /* %endif */
2031 /* %if-c++-only */
2033 /* %endif */
2034 {
2035  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2036  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2037 /* %if-c-only */
2038 /* %endif */
2039 /* %if-c++-only */
2040  yyin.rdbuf(YY_CURRENT_BUFFER_LVALUE->yy_input_file);
2041 /* %endif */
2042  (yy_hold_char) = *(yy_c_buf_p);
2043 }
2044 
2051 /* %if-c-only */
2052 /* %endif */
2053 /* %if-c++-only */
2054  YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size )
2055 /* %endif */
2056 {
2057  YY_BUFFER_STATE b;
2058 
2059  b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
2060  if ( ! b )
2061  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2062 
2063  b->yy_buf_size = (yy_size_t)size;
2064 
2065  /* yy_ch_buf has to be 2 characters longer than the size given because
2066  * we need to put in 2 end-of-buffer characters.
2067  */
2068  b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
2069  if ( ! b->yy_ch_buf )
2070  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2071 
2072  b->yy_is_our_buffer = 1;
2073 
2074  yy_init_buffer( b, file );
2075 
2076  return b;
2077 }
2078 
2079 /* %if-c++-only */
2086  YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2087 {
2088  return yy_create_buffer( *file, size );
2089 }
2090 /* %endif */
2091 
2096 /* %if-c-only */
2097 /* %endif */
2098 /* %if-c++-only */
2099  void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2100 /* %endif */
2101 {
2102 
2103  if ( ! b )
2104  return;
2105 
2106  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2108 
2109  if ( b->yy_is_our_buffer )
2110  yyfree((void *) b->yy_ch_buf );
2111 
2112  yyfree((void *) b );
2113 }
2114 
2115 /* Initializes or reinitializes a buffer.
2116  * This function is sometimes called more than once on the same buffer,
2117  * such as during a yyrestart() or at EOF.
2118  */
2119 /* %if-c-only */
2120 /* %endif */
2121 /* %if-c++-only */
2122  void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file )
2123 /* %endif */
2124 
2125 {
2126  int oerrno = errno;
2127 
2128  yy_flush_buffer( b );
2129 
2130 /* %if-c-only */
2131 /* %endif */
2132 /* %if-c++-only */
2133  b->yy_input_file = file.rdbuf();
2134 /* %endif */
2135  b->yy_fill_buffer = 1;
2136 
2137  /* If b is the current buffer, then yy_init_buffer was _probably_
2138  * called from yyrestart() or through yy_get_next_buffer.
2139  * In that case, we don't want to reset the lineno or column.
2140  */
2141  if (b != YY_CURRENT_BUFFER){
2142  b->yy_bs_lineno = 1;
2143  b->yy_bs_column = 0;
2144  }
2145 
2146 /* %if-c-only */
2147 /* %endif */
2148 /* %if-c++-only */
2149  b->yy_is_interactive = 0;
2150 /* %endif */
2151  errno = oerrno;
2152 }
2153 
2158 /* %if-c-only */
2159 /* %endif */
2160 /* %if-c++-only */
2161  void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2162 /* %endif */
2163 {
2164  if ( ! b )
2165  return;
2166 
2167  b->yy_n_chars = 0;
2168 
2169  /* We always need two end-of-buffer characters. The first causes
2170  * a transition to the end-of-buffer state. The second causes
2171  * a jam in that state.
2172  */
2175 
2176  b->yy_buf_pos = &b->yy_ch_buf[0];
2177 
2178  b->yy_at_bol = 1;
2180 
2181  if ( b == YY_CURRENT_BUFFER )
2182  yy_load_buffer_state( );
2183 }
2184 
2185 /* %if-c-or-c++ */
2192 /* %if-c-only */
2193 /* %endif */
2194 /* %if-c++-only */
2195 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2196 /* %endif */
2197 {
2198  if (new_buffer == NULL)
2199  return;
2200 
2201  yyensure_buffer_stack();
2202 
2203  /* This block is copied from yy_switch_to_buffer. */
2204  if ( YY_CURRENT_BUFFER )
2205  {
2206  /* Flush out information for old buffer. */
2207  *(yy_c_buf_p) = (yy_hold_char);
2208  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2209  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2210  }
2211 
2212  /* Only push if top exists. Otherwise, replace top. */
2213  if (YY_CURRENT_BUFFER)
2214  (yy_buffer_stack_top)++;
2215  YY_CURRENT_BUFFER_LVALUE = new_buffer;
2216 
2217  /* copied from yy_switch_to_buffer. */
2218  yy_load_buffer_state( );
2219  (yy_did_buffer_switch_on_eof) = 1;
2220 }
2221 /* %endif */
2222 
2223 /* %if-c-or-c++ */
2228 /* %if-c-only */
2229 /* %endif */
2230 /* %if-c++-only */
2232 /* %endif */
2233 {
2234  if (!YY_CURRENT_BUFFER)
2235  return;
2236 
2237  yy_delete_buffer(YY_CURRENT_BUFFER );
2238  YY_CURRENT_BUFFER_LVALUE = NULL;
2239  if ((yy_buffer_stack_top) > 0)
2240  --(yy_buffer_stack_top);
2241 
2242  if (YY_CURRENT_BUFFER) {
2243  yy_load_buffer_state( );
2244  (yy_did_buffer_switch_on_eof) = 1;
2245  }
2246 }
2247 /* %endif */
2248 
2249 /* %if-c-or-c++ */
2250 /* Allocates the stack if it does not exist.
2251  * Guarantees space for at least one push.
2252  */
2253 /* %if-c-only */
2254 /* %endif */
2255 /* %if-c++-only */
2257 /* %endif */
2258 {
2259  yy_size_t num_to_alloc;
2260 
2261  if (!(yy_buffer_stack)) {
2262 
2263  /* First allocation is just for 2 elements, since we don't know if this
2264  * scanner will even need a stack. We use 2 instead of 1 to avoid an
2265  * immediate realloc on the next call.
2266  */
2267  num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
2268  (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2269  (num_to_alloc * sizeof(struct yy_buffer_state*)
2270  );
2271  if ( ! (yy_buffer_stack) )
2272  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2273 
2274  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2275 
2276  (yy_buffer_stack_max) = num_to_alloc;
2277  (yy_buffer_stack_top) = 0;
2278  return;
2279  }
2280 
2281  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2282 
2283  /* Increase the buffer to prepare for a possible push. */
2284  yy_size_t grow_size = 8 /* arbitrary grow size */;
2285 
2286  num_to_alloc = (yy_buffer_stack_max) + grow_size;
2287  (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2288  ((yy_buffer_stack),
2289  num_to_alloc * sizeof(struct yy_buffer_state*)
2290  );
2291  if ( ! (yy_buffer_stack) )
2292  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2293 
2294  /* zero only the new slots.*/
2295  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2296  (yy_buffer_stack_max) = num_to_alloc;
2297  }
2298 }
2299 /* %endif */
2300 
2301 /* %if-c-only */
2302 /* %endif */
2303 
2304 /* %if-c-only */
2305 /* %endif */
2306 
2307 /* %if-c-only */
2308 /* %endif */
2309 
2310 /* %if-c-only */
2311 /* %endif */
2312 /* %if-c++-only */
2313  void yyFlexLexer::yy_push_state( int _new_state )
2314 /* %endif */
2315 {
2316  if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
2317  {
2318  yy_size_t new_size;
2319 
2320  (yy_start_stack_depth) += YY_START_STACK_INCR;
2321  new_size = (yy_start_stack_depth) * sizeof( int );
2322 
2323  if ( ! (yy_start_stack) )
2324  (yy_start_stack) = (int *) yyalloc(new_size );
2325 
2326  else
2327  (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size );
2328 
2329  if ( ! (yy_start_stack) )
2330  YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2331  }
2332 
2333  (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
2334 
2335  BEGIN(_new_state);
2336 }
2337 
2338 /* %if-c-only */
2339 /* %endif */
2340 /* %if-c++-only */
2342 /* %endif */
2343 {
2344  if ( --(yy_start_stack_ptr) < 0 )
2345  YY_FATAL_ERROR( "start-condition stack underflow" );
2346 
2347  BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
2348 }
2349 
2350 #ifndef YY_EXIT_FAILURE
2351 #define YY_EXIT_FAILURE 2
2352 #endif
2353 
2354 /* %if-c-only */
2355 /* %endif */
2356 /* %if-c++-only */
2357 void yyFlexLexer::LexerError( yyconst char msg[] )
2358 {
2359  std::cerr << msg << std::endl;
2360  exit( YY_EXIT_FAILURE );
2361 }
2362 /* %endif */
2363 
2364 /* Redefine yyless() so it works in section 3 code. */
2365 
2366 #undef yyless
2367 #define yyless(n) \
2368  do \
2369  { \
2370  /* Undo effects of setting up yytext. */ \
2371  int yyless_macro_arg = (n); \
2372  YY_LESS_LINENO(yyless_macro_arg);\
2373  yytext[yyleng] = (yy_hold_char); \
2374  (yy_c_buf_p) = yytext + yyless_macro_arg; \
2375  (yy_hold_char) = *(yy_c_buf_p); \
2376  *(yy_c_buf_p) = '\0'; \
2377  yyleng = yyless_macro_arg; \
2378  } \
2379  while ( 0 )
2380 
2381 /* Accessor methods (get/set functions) to struct members. */
2382 
2383 /* %if-c-only */
2384 /* %if-reentrant */
2385 /* %endif */
2386 /* %if-reentrant */
2387 /* %endif */
2388 /* %endif */
2389 
2390 /* %if-reentrant */
2391 /* %if-bison-bridge */
2392 /* %endif */
2393 /* %endif if-c-only */
2394 
2395 /* %if-c-only */
2396 /* %endif */
2397 
2398 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
2399 /* %if-reentrant */
2400 /* %endif */
2401 /* %endif */
2402 
2403 /*
2404  * Internal utility routines.
2405  */
2406 
2407 #ifndef yytext_ptr
2408 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2409 {
2410 
2411  int i;
2412  for ( i = 0; i < n; ++i )
2413  s1[i] = s2[i];
2414 }
2415 #endif
2416 
2417 #ifdef YY_NEED_STRLEN
2418 static int yy_flex_strlen (yyconst char * s )
2419 {
2420  int n;
2421  for ( n = 0; s[n]; ++n )
2422  ;
2423 
2424  return n;
2425 }
2426 #endif
2427 
2429 {
2430  return (void *) malloc( size );
2431 }
2432 
2433 void *yyrealloc (void * ptr, yy_size_t size )
2434 {
2435 
2436  /* The cast to (char *) in the following accommodates both
2437  * implementations that use char* generic pointers, and those
2438  * that use void* generic pointers. It works with the latter
2439  * because both ANSI C and C++ allow castless assignment from
2440  * any pointer type to void*, and deal with argument conversions
2441  * as though doing an assignment.
2442  */
2443  return (void *) realloc( (char *) ptr, size );
2444 }
2445 
2446 void yyfree (void * ptr )
2447 {
2448  free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2449 }
2450 
2451 /* %if-tables-serialization definitions */
2452 /* %define-yytables The name for this specific scanner's tables. */
2453 #define YYTABLES_NAME "yytables"
2454 /* %endif */
2455 
2456 /* %ok-for-header */
2457 
2458 #line 229 "lib/vcsn/rat/scan.ll"
2459 
2460 
2461 namespace
2462 {
2464  template <typename Out>
2465  Out
2466  lexical_cast(driver& d, const location& loc, const std::string& s)
2467  {
2468  try
2469  {
2470  return boost::lexical_cast<Out>(s);
2471  }
2472  catch (const boost::bad_lexical_cast&)
2473  {
2474  d.error(loc, "invalid numerical literal: " + s);
2475  return 0;
2476  }
2477  }
2478 
2480  int arity(driver& d, const location& loc, const std::string& s)
2481  {
2482  if (s.empty())
2483  return -1;
2484  else
2485  return lexical_cast<int>(d, loc, s);
2486  }
2487 
2493  irange_type
2494  quantifier(driver& d, const location& loc, const std::string& s)
2495  {
2496  auto arity_re = std::regex{"([0-9]*)(,?)([0-9]*)", std::regex::extended};
2497  std::smatch minmax;
2498  if (!std::regex_match(s, minmax, arity_re))
2499  throw std::runtime_error("cannot match arity: " + s);
2500  auto res = irange_type{arity(d, loc, minmax[1].str()),
2501  arity(d, loc, minmax[3].str())};
2502  if (minmax[2].str().empty())
2503  // No comma: single argument.
2504  std::get<1>(res) = std::get<0>(res);
2505  return res;
2506  }
2507 }
2508 
2509 // Do not use %option noyywrap, because then flex generates the
2510 // same definition of yywrap, but outside the namespaces, so it
2511 // defines it for ::yyFlexLexer instead of
2512 // ::vcsn::rat::yyFlexLexer.
2513 int yyFlexLexer::yywrap() { return 1; }
2514 
2515 // Beware of the dummy Flex interface. One would like to use:
2516 //
2517 // yypush_buffer_state(yy_create_buffer(yyin, YY_BUF_SIZE));
2518 //
2519 // and
2520 //
2521 // yypush_buffer_state(yy_scan_bytes(e.c_str(), e.size()));
2522 //
2523 // but the latter (yy_scan_bytes) calls yy_switch_to_buffer, so in
2524 // effect calling yypush_buffer_state saves the new state instead
2525 // of the old one.
2526 //
2527 // So do it in two steps, quite different from what is suggested
2528 // in the documentation: save the old context, switch to the new
2529 // one.
2530 
2531 void yyFlexLexer::scan_open_(std::istream& f)
2532 {
2533  set_debug(!!getenv("YYSCAN"));
2534  yypush_buffer_state(YY_CURRENT_BUFFER);
2535  yy_switch_to_buffer(yy_create_buffer(&f, YY_BUF_SIZE));
2536 }
2537 
2539 {
2540  yypop_buffer_state();
2541 }
2542 
2544 
2545 // Local Variables:
2546 // mode: C++
2547 // End:
2548 
void scan_open_(std::istream &f)
Definition: scan.cc:2255
yy_state_type yy_try_NUL_trans(yy_state_type current_state)
Definition: scan.cc:1574
virtual void LexerError(const char *msg)
Definition: scan.cc:2131
void yy_delete_buffer(yy_buffer_state *b)
Destroy the buffer.
Definition: scan.cc:1864
#define YY_EXIT_FAILURE
Definition: scan.cc:2351
#define YY_END_OF_BUFFER
Definition: scan.cc:435
T lexical_cast(const std::string &str)
String to templated type T conversion.
Definition: cast.hh:79
unsigned short int flex_uint16_t
Definition: scan.cc:101
int yy_is_interactive
Definition: scan.cc:308
irange_type quantifier(driver &d, const location &loc, const std::string &s)
void yypush_buffer_state(yy_buffer_state *new_buffer)
Pushes the new state onto the stack.
Definition: scan.cc:1960
#define YY_START
Definition: scan.cc:203
#define unput(c)
Definition: scan.cc:271
return o str()
#define SC_CONTEXT
Definition: scan.cc:675
std::tuple< int, int > irange_type
An integer range, for quantifiers/exponents.
Definition: parse.hh:78
void yy_flush_buffer(yy_buffer_state *b)
Discard all buffered characters.
Definition: scan.cc:1926
yy_size_t yy_n_chars
Definition: scan.cc:295
weightset_mixin< detail::b_impl > b
Definition: fwd.hh:48
return res
Definition: multiply.hh:398
#define INITIAL
Definition: scan.cc:673
static YY_CHAR yy_meta[60]
Definition: scan.cc:493
int yy_state_type
Definition: flex-lexer.hh:57
static flex_uint16_t yy_nxt[316]
Definition: scan.cc:541
#define ECHO
Definition: scan.cc:745
if(exp.max==-1)
Definition: multiply.hh:381
#define YY_NEW_FILE
Definition: scan.cc:210
void yy_push_state(int new_state)
Definition: scan.cc:2078
#define YY_CURRENT_BUFFER
Definition: scan.cc:358
yy_size_t yyleng
#define YY_RESTORE_YY_MORE_OFFSET
Definition: scan.cc:635
#define YY_BUFFER_NORMAL
Definition: scan.cc:327
#define SC_EXPONENT
Definition: scan.cc:676
void * yyalloc(yy_size_t size)
Definition: scan.cc:2202
#define YY_INPUT(buf, result, max_size)
Definition: scan.cc:753
#define EOB_ACT_CONTINUE_SCAN
Definition: scan.cc:250
#define EOB_ACT_LAST_MATCH
Definition: scan.cc:252
void ctor_common()
Definition: scan.cc:1285
static flex_int16_t yy_rule_linenum[59]
Definition: scan.cc:619
#define YY_READ_BUF_SIZE
Definition: scan.cc:736
void yy_switch_to_buffer(yy_buffer_state *new_buffer)
Switch to a different input buffer.
Definition: scan.cc:1762
#define YY_END_OF_BUFFER_CHAR
Definition: scan.cc:212
#define YY_FATAL_ERROR(msg)
Definition: scan.cc:781
void yy_pop_state()
Definition: scan.cc:2106
#define YY_FLEX_NAMESPACE_END
Definition: scan.hh:9
void yypop_buffer_state()
Removes and deletes the top of the stack, if present.
Definition: scan.cc:1996
int yy_at_bol
Definition: scan.cc:314
void yyrestart(std::istream *s)
Immediately switch to a different input stream.
Definition: scan.cc:1729
#define yytext_ptr
Definition: scan.cc:411
vcsn::rat::location location
Pairs of positions in a file/stream.
Definition: fwd.hh:36
int yy_fill_buffer
Definition: scan.cc:322
void scan_close_()
Definition: scan.cc:2262
unsigned char flex_uint8_t
Definition: scan.cc:100
#define YY_DECL
Definition: scan.cc:806
unsigned int flex_uint32_t
Definition: scan.cc:102
#define YY_RULE_SETUP
Definition: scan.cc:823
#define YY_BREAK
Definition: scan.cc:819
yyFlexLexer(std::istream &arg_yyin, std::ostream &arg_yyout)
Definition: scan.cc:1276
virtual int yywrap()
Definition: scan.cc:2237
void yyunput(int c, char *buf_ptr)
Definition: scan.cc:1603
#define YY_SC_TO_UI(c)
Definition: scan.cc:183
#define EOB_ACT_END_OF_FILE
Definition: scan.cc:251
void yy_init_buffer(yy_buffer_state *b, std::istream *s)
Definition: scan.cc:1887
#define yyless(n)
Definition: scan.cc:2367
virtual void LexerOutput(const char *buf, int size)
Definition: scan.cc:1378
char * yy_ch_buf
Definition: scan.cc:284
static flex_int16_t yy_chk[316]
Definition: scan.cc:580
#define YY_BUFFER_NEW
Definition: scan.cc:326
#define YY_START_STACK_INCR
Definition: scan.cc:773
#define YY_DO_BEFORE_ACTION
Definition: scan.cc:424
void yy_load_buffer_state()
Definition: scan.cc:1797
int yy_bs_column
The column count.
Definition: scan.cc:317
#define LINE(Line)
Definition: scan.cc:653
int yy_is_our_buffer
Definition: scan.cc:301
#define yyconst
Definition: scan.cc:167
static flex_int16_t yy_accept[127]
Definition: scan.cc:443
int yyinput()
Definition: scan.cc:1649
std::streambuf * yy_input_file
Definition: scan.cc:281
void * yyrealloc(void *ptr, yy_size_t size)
Definition: scan.cc:2207
#define YY_MORE_ADJ
Definition: scan.cc:634
Define the vcsn::rat::parser class.
#define YY_BUF_SIZE
Definition: scan.cc:223
int yy_bs_lineno
The line count.
Definition: scan.cc:316
#define YY_STATE_EOF(state)
Definition: scan.cc:207
virtual int LexerInput(char *buf, int max_size)
Definition: scan.cc:1349
static flex_int16_t yy_def[136]
Definition: scan.cc:522
signed char flex_int8_t
Definition: scan.cc:97
#define BEGIN
Definition: scan.cc:197
static YY_CHAR yy_ec[256]
Definition: scan.cc:461
size_t yy_size_t
Definition: scan.cc:238
int yy_buffer_status
Definition: scan.cc:324
#define YY_CURRENT_BUFFER_LVALUE
Definition: scan.cc:365
#define SC_CLASS
Definition: scan.cc:674
void yyfree(void *ptr)
Definition: scan.cc:2220
virtual void switch_streams(std::istream *new_in, std::ostream *new_out=nullptr)
Definition: scan.cc:1323
#define YY_BUFFER_EOF_PENDING
Definition: scan.cc:338
int flex_int32_t
Definition: scan.cc:99
#define FLEX_STD
Definition: flex-lexer.hh:54
yy_state_type yy_get_previous_state()
Definition: scan.cc:1536
short int flex_int16_t
Definition: scan.cc:98
#define TOK(Token)
Definition: scan.cc:662
static flex_uint16_t yy_base[136]
Definition: scan.cc:503
#define SC_WEIGHT
Definition: scan.cc:677
yy_buffer_state * yy_create_buffer(std::istream *s, int size)
Allocate and initialize an input buffer state.
Definition: scan.cc:1819
char * yy_buf_pos
Definition: scan.cc:285
int yy_get_next_buffer()
Definition: scan.cc:1396
struct yy_buffer_state * YY_BUFFER_STATE
Definition: scan.cc:233
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
virtual ~yyFlexLexer()
Definition: scan.cc:1313
void yyensure_buffer_stack(void)
Definition: scan.cc:2021
#define yyterminate()
Definition: scan.cc:20
unsigned char YY_CHAR
Definition: scan.cc:409
yy_size_t yy_buf_size
Definition: scan.cc:290