Vcsn  2.2
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 5
41 #define YY_FLEX_SUBMINOR_VERSION 39
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::istream* 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 63
435 #define YY_END_OF_BUFFER 64
436 /* This struct is not used in this scanner,
437  but its presence is necessary. */
438 struct yy_trans_info
439  {
442  };
444  { 0,
445  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
446  64, 44, 28, 29, 21, 6, 3, 44, 1, 2,
447  17, 7, 12, 9, 4, 26, 16, 27, 44, 44,
448  13, 44, 44, 44, 44, 63, 32, 44, 30, 31,
449  47, 48, 45, 46, 59, 59, 59, 62, 60, 61,
450  62, 28, 29, 5, 0, 0, 0, 8, 43, 43,
451  36, 37, 15, 38, 39, 40, 41, 42, 43, 14,
452  0, 0, 0, 0, 0, 0, 0, 0, 0, 19,
453  21, 20, 15, 0, 0, 0, 0, 0, 47, 48,
454  51, 52, 50, 0, 62, 0, 33, 0, 33, 0,
455 
456  0, 24, 0, 0, 17, 18, 0, 11, 16, 23,
457  10, 22, 14, 26, 49, 53, 54, 55, 56, 57,
458  58, 60, 61, 0, 25, 34, 35, 0
459  } ;
460 
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, 30, 31, 32, 24,
473 
474  33, 34, 1, 1, 1, 1, 1, 1, 1, 35,
475  1, 1, 1, 36, 1, 37, 1, 38, 1, 39,
476  1, 40, 41, 42, 43, 1, 1, 1, 44, 1,
477  1, 1, 45, 1, 1, 46, 1, 1, 1, 1,
478  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
479  47, 1, 1, 1, 1, 48, 1, 1, 49, 1,
480  1, 1, 1, 1, 1, 1, 1, 50, 51, 1,
481  1, 52, 1, 1, 1, 53, 1, 54, 55, 56,
482  57, 58, 59, 60, 61, 1, 1, 1, 1, 1,
483  1, 1, 1, 62, 1, 1, 1, 1, 1, 1,
484 
485  1, 1, 1, 1, 1, 63, 1, 1, 1, 1,
486  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
487  1, 1, 1, 1, 64, 65, 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 
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, 1, 1,
501  1, 1, 1, 1, 5
502  } ;
503 
505  { 0,
506  0, 64, 20, 29, 15, 26, 16, 20, 24, 30,
507  185, 274, 181, 179, 274, 274, 155, 145, 149, 274,
508  274, 274, 274, 274, 274, 157, 274, 274, 113, 143,
509  274, 0, 110, 2, 48, 274, 274, 79, 274, 274,
510  0, 163, 274, 274, 274, 46, 120, 0, 274, 274,
511  108, 140, 133, 274, 6, 13, 64, 274, 274, 118,
512  274, 274, 274, 274, 274, 274, 274, 274, 107, 274,
513  91, 90, 102, 89, 145, 80, 78, 68, 65, 274,
514  274, 274, 274, 41, 32, 120, 57, 3, 0, 35,
515  274, 274, 274, 134, 0, 48, 274, 85, 95, 181,
516 
517  21, 274, 13, 179, 274, 274, 181, 274, 274, 274,
518  274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
519  274, 274, 274, 7, 274, 274, 274, 274, 224, 229,
520  234, 239, 244, 249, 254, 259, 263, 268
521  } ;
522 
524  { 0,
525  129, 129, 129, 129, 130, 130, 131, 131, 132, 132,
526  128, 128, 128, 128, 128, 128, 128, 133, 128, 128,
527  128, 128, 128, 128, 128, 128, 128, 128, 134, 128,
528  128, 128, 128, 128, 128, 128, 128, 134, 128, 128,
529  135, 128, 128, 128, 128, 128, 128, 136, 128, 128,
530  128, 128, 128, 128, 133, 137, 128, 128, 128, 128,
531  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
532  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
533  128, 128, 128, 128, 128, 128, 128, 128, 135, 128,
534  128, 128, 128, 128, 136, 128, 128, 133, 133, 137,
535 
536  138, 128, 128, 128, 128, 128, 128, 128, 128, 128,
537  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
538  128, 128, 128, 138, 128, 128, 128, 0, 128, 128,
539  128, 128, 128, 128, 128, 128, 128, 128
540  } ;
541 
543  { 0,
544  128, 13, 14, 15, 128, 16, 17, 18, 19, 20,
545  21, 22, 23, 97, 24, 55, 125, 42, 25, 26,
546  99, 27, 36, 43, 44, 28, 29, 18, 42, 126,
547  125, 36, 56, 37, 43, 44, 18, 90, 128, 100,
548  30, 31, 37, 49, 50, 128, 38, 39, 40, 49,
549  50, 81, 114, 82, 82, 38, 39, 40, 84, 85,
550  82, 32, 33, 34, 35, 13, 14, 15, 101, 16,
551  17, 18, 19, 20, 21, 22, 23, 46, 24, 112,
552  47, 46, 25, 26, 47, 27, 102, 110, 51, 28,
553  29, 86, 97, 87, 51, 60, 88, 122, 123, 91,
554 
555  92, 113, 97, 105, 30, 31, 93, 112, 61, 62,
556  111, 56, 64, 65, 66, 67, 68, 69, 107, 107,
557  110, 56, 109, 104, 104, 32, 33, 34, 35, 60,
558  104, 108, 106, 105, 103, 53, 104, 104, 104, 104,
559  104, 52, 61, 62, 80, 63, 64, 65, 66, 67,
560  68, 69, 70, 71, 72, 73, 96, 73, 74, 75,
561  75, 75, 75, 94, 76, 90, 83, 77, 58, 78,
562  57, 56, 82, 54, 79, 82, 82, 82, 82, 82,
563  82, 53, 52, 55, 128, 80, 115, 80, 99, 116,
564  117, 118, 119, 120, 121, 127, 127, 107, 107, 128,
565 
566  128, 128, 127, 128, 128, 128, 128, 100, 127, 127,
567  127, 127, 127, 128, 128, 128, 128, 128, 128, 128,
568  128, 128, 128, 80, 12, 12, 12, 12, 12, 41,
569  41, 41, 41, 41, 45, 45, 45, 45, 45, 48,
570  48, 48, 48, 48, 55, 55, 128, 55, 55, 59,
571  128, 59, 59, 59, 89, 128, 89, 128, 89, 95,
572  95, 95, 95, 98, 98, 98, 98, 98, 124, 124,
573  124, 124, 124, 11, 128, 128, 128, 128, 128, 128,
574  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
575  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
576 
577  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
578  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
579  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
580  128, 128, 128, 128, 128, 128, 128, 128, 128
581  } ;
582 
584  { 0,
585  0, 1, 1, 1, 0, 1, 1, 1, 1, 1,
586  1, 1, 1, 55, 1, 56, 124, 5, 1, 1,
587  56, 1, 3, 5, 5, 1, 1, 3, 6, 103,
588  101, 4, 55, 3, 6, 6, 4, 90, 0, 56,
589  1, 1, 4, 9, 9, 0, 3, 3, 3, 10,
590  10, 32, 88, 32, 32, 4, 4, 4, 34, 34,
591  32, 1, 1, 1, 1, 2, 2, 2, 57, 2,
592  2, 2, 2, 2, 2, 2, 2, 7, 2, 85,
593  7, 8, 2, 2, 8, 2, 57, 84, 9, 2,
594  2, 35, 98, 35, 10, 38, 35, 96, 96, 46,
595 
596  46, 87, 99, 87, 2, 2, 46, 79, 38, 38,
597  78, 98, 38, 38, 38, 38, 38, 38, 73, 73,
598  77, 99, 76, 69, 69, 2, 2, 2, 2, 29,
599  69, 74, 72, 71, 60, 53, 69, 69, 69, 69,
600  69, 52, 29, 29, 73, 29, 29, 29, 29, 29,
601  29, 29, 29, 30, 30, 30, 51, 75, 30, 30,
602  30, 75, 75, 47, 30, 42, 33, 30, 26, 30,
603  19, 18, 86, 17, 30, 86, 86, 86, 86, 86,
604  86, 14, 13, 100, 11, 30, 94, 75, 100, 94,
605  94, 94, 94, 94, 94, 104, 104, 107, 107, 0,
606 
607  0, 0, 104, 0, 0, 0, 0, 100, 104, 104,
608  104, 104, 104, 0, 0, 0, 0, 0, 0, 0,
609  0, 0, 0, 107, 129, 129, 129, 129, 129, 130,
610  130, 130, 130, 130, 131, 131, 131, 131, 131, 132,
611  132, 132, 132, 132, 133, 133, 0, 133, 133, 134,
612  0, 134, 134, 134, 135, 0, 135, 0, 135, 136,
613  136, 136, 136, 137, 137, 137, 137, 137, 138, 138,
614  138, 138, 138, 128, 128, 128, 128, 128, 128, 128,
615  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
616  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
617 
618  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
619  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
620  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
621  128, 128, 128, 128, 128, 128, 128, 128, 128
622  } ;
623 
625  { 0,
626  62, 63, 65, 66, 67, 68, 69, 70, 71, 72,
627  73, 74, 75, 76, 77, 80, 81, 82, 83, 88,
628  97, 98, 99, 102, 103, 106, 109, 112, 113, 117,
629  121, 122, 132, 136, 143, 147, 148, 149, 150, 151,
630  152, 153, 154, 155, 160, 164, 177, 178, 187, 188,
631  189, 190, 191, 192, 193, 194, 195, 196, 197, 211,
632  216, 230
633  } ;
634 
635 /* The intent behind this definition is that it'll catch
636  * any uses of REJECT which flex missed.
637  */
638 #define REJECT reject_used_but_not_detected
639 #define yymore() yymore_used_but_not_detected
640 #define YY_MORE_ADJ 0
641 #define YY_RESTORE_YY_MORE_OFFSET
642 #line 1 "lib/vcsn/rat/scan.ll"
643 #define YY_NO_INPUT 1
644 
645 #line 14 "lib/vcsn/rat/scan.ll"
646 #include <cassert>
647 #include <iostream>
648 #include <stack>
649 #include <string>
650 
651 #include <boost/lexical_cast.hpp>
652 
653 #include <vcsn/misc/escape.hh>
654 #include <vcsn/misc/regex.hh>
655 
656 #include <lib/vcsn/rat/driver.hh>
657 #include <lib/vcsn/rat/parse.hh>
658 
659 #define LINE(Line) \
660  do { \
661  loc.end.column = 1; \
662  loc.lines(Line); \
663  } while (false)
664 
665 #define YY_USER_ACTION \
666  loc.columns(yyleng);
667 
668 #define TOK(Token) \
669  parser::make_ ## Token (loc)
670 
672 namespace
673 {
674  irange_type quantifier(driver& d, const location& loc, const std::string& s);
675 }
676 
677 #line 664 "lib/vcsn/rat/scan.cc"
678 
679 #define INITIAL 0
680 #define SC_CLASS 1
681 #define SC_CONTEXT 2
682 #define SC_EXPONENT 3
683 #define SC_WEIGHT 4
684 
685 #ifndef YY_NO_UNISTD_H
686 /* Special case for "unistd.h", since it is non-ANSI. We include it way
687  * down here because we want the user's section 1 to have been scanned first.
688  * The user has a chance to override it with an option.
689  */
690 /* %if-c-only */
691 /* %endif */
692 /* %if-c++-only */
693 #include <unistd.h>
694 /* %endif */
695 #endif
696 
697 #ifndef YY_EXTRA_TYPE
698 #define YY_EXTRA_TYPE void *
699 #endif
700 
701 /* %if-c-only Reentrant structure and macros (non-C++). */
702 /* %if-reentrant */
703 /* %if-c-only */
704 /* %endif */
705 /* %if-reentrant */
706 /* %endif */
707 /* %endif End reentrant structures and macros. */
708 /* %if-bison-bridge */
709 /* %endif */
710 /* %not-for-header */
711 
712 /* %ok-for-header */
713 
714 /* %endif */
715 
716 #ifndef yytext_ptr
717 static void yy_flex_strncpy (char *,yyconst char *,int );
718 #endif
719 
720 #ifdef YY_NEED_STRLEN
721 static int yy_flex_strlen (yyconst char * );
722 #endif
723 
724 #ifndef YY_NO_INPUT
725 /* %if-c-only Standard (non-C++) definition */
726 /* %not-for-header */
727 
728 /* %ok-for-header */
729 
730 /* %endif */
731 #endif
732 
733 /* %if-c-only */
734 /* %endif */
735 
736 /* Amount of stuff to slurp up with each read. */
737 #ifndef YY_READ_BUF_SIZE
738 #ifdef __ia64__
739 /* On IA-64, the buffer size is 16k, not 8k */
740 #define YY_READ_BUF_SIZE 16384
741 #else
742 #define YY_READ_BUF_SIZE 8192
743 #endif /* __ia64__ */
744 #endif
745 
746 /* Copy whatever the last rule matched to the standard output. */
747 #ifndef ECHO
748 /* %if-c-only Standard (non-C++) definition */
749 /* %endif */
750 /* %if-c++-only C++ definition */
751 #define ECHO LexerOutput( yytext, yyleng )
752 /* %endif */
753 #endif
754 
755 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
756  * is returned in "result".
757  */
758 #ifndef YY_INPUT
759 #define YY_INPUT(buf,result,max_size) \
760 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
761 \
762 /* %if-c++-only C++ definition \ */\
763  if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
764  YY_FATAL_ERROR( "input in flex scanner failed" );
765 /* %endif */
766 
767 #endif
768 
769 /* No semi-colon after return; correct usage is to write "yyterminate();" -
770  * we don't want an extra ';' after the "return" because that will cause
771  * some compilers to complain about unreachable statements.
772  */
773 #ifndef yyterminate
774 #define yyterminate() return YY_NULL
775 #endif
776 
777 /* Number of entries by which start-condition stack grows. */
778 #ifndef YY_START_STACK_INCR
779 #define YY_START_STACK_INCR 25
780 #endif
781 
782 /* Report a fatal error. */
783 #ifndef YY_FATAL_ERROR
784 /* %if-c-only */
785 /* %endif */
786 /* %if-c++-only */
787 #define YY_FATAL_ERROR(msg) LexerError( msg )
788 /* %endif */
789 #endif
790 
791 /* %if-tables-serialization structures and prototypes */
792 /* %not-for-header */
793 
794 /* %ok-for-header */
795 
796 /* %not-for-header */
797 
798 /* %tables-yydmap generated elements */
799 /* %endif */
800 /* end tables serialization structures and prototypes */
801 
802 /* %ok-for-header */
803 
804 /* Default declaration of generated scanner - a define so the user can
805  * easily add parameters.
806  */
807 #ifndef YY_DECL
808 #define YY_DECL_IS_OURS 1
809 /* %if-c-only Standard (non-C++) definition */
810 /* %endif */
811 /* %if-c++-only C++ definition */
812 #define YY_DECL int yyFlexLexer::yylex()
813 /* %endif */
814 #endif /* !YY_DECL */
815 
816 /* Code executed at the beginning of each rule, after yytext and yyleng
817  * have been set up.
818  */
819 #ifndef YY_USER_ACTION
820 #define YY_USER_ACTION
821 #endif
822 
823 /* Code executed at the end of each rule. */
824 #ifndef YY_BREAK
825 #define YY_BREAK break;
826 #endif
827 
828 /* %% [6.0] YY_RULE_SETUP definition goes here */
829 #define YY_RULE_SETUP \
830  YY_USER_ACTION
831 
832 /* %not-for-header */
833 
836 YY_DECL
837 {
838  register yy_state_type yy_current_state;
839  register char *yy_cp, *yy_bp;
840  register int yy_act;
841 
842  if ( !(yy_init) )
843  {
844  (yy_init) = 1;
845 
846 #ifdef YY_USER_INIT
847  YY_USER_INIT;
848 #endif
849 
850  if ( ! (yy_start) )
851  (yy_start) = 1; /* first start state */
852 
853  if ( ! yyin )
854 /* %if-c-only */
855 /* %endif */
856 /* %if-c++-only */
857  yyin = & std::cin;
858 /* %endif */
859 
860  if ( ! yyout )
861 /* %if-c-only */
862 /* %endif */
863 /* %if-c++-only */
864  yyout = & std::cout;
865 /* %endif */
866 
867  if ( ! YY_CURRENT_BUFFER ) {
868  yyensure_buffer_stack ();
870  yy_create_buffer( yyin, YY_BUF_SIZE );
871  }
872 
873  yy_load_buffer_state( );
874  }
875 
876  {
877 /* %% [7.0] user's declarations go here */
878 #line 48 "lib/vcsn/rat/scan.ll"
879 
880 
881  // Count the number of opened braces in SC_WEIGHT, and parens in SC_CONTEXT.
882  unsigned int nesting = 0;
883  // Compute the exponent.
884  unsigned int exponent = 0;
885  // Build a context string. "static" only to save build/dtor.
886  static std::string context;
887  std::string s;
888  loc.step();
889 
890 
891 #line 878 "lib/vcsn/rat/scan.cc"
892 
893  while ( 1 ) /* loops until end-of-file is reached */
894  {
895 /* %% [8.0] yymore()-related code goes here */
896  yy_cp = (yy_c_buf_p);
897 
898  /* Support of yytext. */
899  *yy_cp = (yy_hold_char);
900 
901  /* yy_bp points to the position in yy_ch_buf of the start of
902  * the current run.
903  */
904  yy_bp = yy_cp;
905 
906 /* %% [9.0] code to set up and find next match goes here */
907  yy_current_state = (yy_start);
908 yy_match:
909  do
910  {
911  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
912  if ( yy_accept[yy_current_state] )
913  {
914  (yy_last_accepting_state) = yy_current_state;
915  (yy_last_accepting_cpos) = yy_cp;
916  }
917  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
918  {
919  yy_current_state = (int) yy_def[yy_current_state];
920  if ( yy_current_state >= 129 )
921  yy_c = yy_meta[(unsigned int) yy_c];
922  }
923  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
924  ++yy_cp;
925  }
926  while ( yy_base[yy_current_state] != 274 );
927 
928 yy_find_action:
929 /* %% [10.0] code to find the action number goes here */
930  yy_act = yy_accept[yy_current_state];
931  if ( yy_act == 0 )
932  { /* have to back up */
933  yy_cp = (yy_last_accepting_cpos);
934  yy_current_state = (yy_last_accepting_state);
935  yy_act = yy_accept[yy_current_state];
936  }
937 
939 
940 /* %% [11.0] code for yylineno update goes here */
941 
942 do_action: /* This label is used only to access EOF actions. */
943 
944 /* %% [12.0] debug code goes here */
945  if ( yy_flex_debug )
946  {
947  if ( yy_act == 0 )
948  std::cerr << "--scanner backing up\n";
949  else if ( yy_act < 63 )
950  std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] <<
951  "(\"" << yytext << "\")\n";
952  else if ( yy_act == 63 )
953  std::cerr << "--accepting default rule (\"" << yytext << "\")\n";
954  else if ( yy_act == 64 )
955  std::cerr << "--(end of buffer or a NUL)\n";
956  else
957  std::cerr << "--EOF (start condition " << YY_START << ")\n";
958  }
959 
960  switch ( yy_act )
961  { /* beginning of action switch */
962 /* %% [13.0] actions go here */
963  case 0: /* must back up */
964  /* undo the effects of YY_DO_BEFORE_ACTION */
965  *yy_cp = (yy_hold_char);
966  yy_cp = (yy_last_accepting_cpos);
967  yy_current_state = (yy_last_accepting_state);
968  goto yy_find_action;
969 
970 /* Vcsn Syntax */
971 case 1:
973 #line 62 "lib/vcsn/rat/scan.ll"
974 return TOK(LPAREN);
975  YY_BREAK
976 case 2:
978 #line 63 "lib/vcsn/rat/scan.ll"
979 return TOK(RPAREN);
980  YY_BREAK
981 case 3:
983 #line 65 "lib/vcsn/rat/scan.ll"
984 return TOK(AMPERSAND);
985  YY_BREAK
986 case 4:
988 #line 66 "lib/vcsn/rat/scan.ll"
989 return TOK(COLON);
990  YY_BREAK
991 case 5:
993 #line 67 "lib/vcsn/rat/scan.ll"
994 return TOK(AMPERSAND_COLON);
995  YY_BREAK
996 case 6:
998 #line 68 "lib/vcsn/rat/scan.ll"
999 return TOK(PERCENT);
1000  YY_BREAK
1001 case 7:
1003 #line 69 "lib/vcsn/rat/scan.ll"
1004 return TOK(PLUS);
1005  YY_BREAK
1006 case 8:
1008 #line 70 "lib/vcsn/rat/scan.ll"
1009 return TOK(LT_PLUS);
1010  YY_BREAK
1011 case 9:
1013 #line 71 "lib/vcsn/rat/scan.ll"
1014 return TOK(DOT);
1015  YY_BREAK
1016 case 10:
1018 #line 72 "lib/vcsn/rat/scan.ll"
1019 return TOK(BACKSLASH);
1020  YY_BREAK
1021 case 11:
1023 #line 73 "lib/vcsn/rat/scan.ll"
1024 return TOK(SLASH);
1025  YY_BREAK
1026 case 12:
1028 #line 74 "lib/vcsn/rat/scan.ll"
1029 return TOK(COMMA);
1030  YY_BREAK
1031 case 13:
1033 #line 75 "lib/vcsn/rat/scan.ll"
1034 return TOK(PIPE);
1035  YY_BREAK
1036 case 14:
1038 #line 76 "lib/vcsn/rat/scan.ll"
1039 return TOK(ZERO);
1040  YY_BREAK
1041 case 15:
1043 #line 77 "lib/vcsn/rat/scan.ll"
1044 return TOK(ONE);
1045  YY_BREAK
1046 /* Quantifiers. */
1047 case 16:
1049 #line 80 "lib/vcsn/rat/scan.ll"
1050 return parser::make_STAR(std::make_tuple(0, 1), loc);
1051  YY_BREAK
1052 case 17:
1054 #line 81 "lib/vcsn/rat/scan.ll"
1055 return parser::make_STAR(std::make_tuple(-1, -1), loc);
1056  YY_BREAK
1057 case 18:
1059 #line 82 "lib/vcsn/rat/scan.ll"
1060 return parser::make_STAR(std::make_tuple(1, -1), loc);
1061  YY_BREAK
1062 case 19:
1064 #line 83 "lib/vcsn/rat/scan.ll"
1065 {
1066  return parser::make_STAR(quantifier(driver_, loc,
1067  {yytext+1, static_cast<size_t>(yyleng)-2}),
1068  loc);
1069  }
1070  YY_BREAK
1071 case 20:
1073 #line 88 "lib/vcsn/rat/scan.ll"
1074 {
1075  // Detect an exponent, do not read it yet. Handle it in the exponent state.
1076  yyless(0);
1077  loc -= yyleng;
1078  exponent = 0;
1079  yy_push_state(SC_EXPONENT);
1080  }
1081  YY_BREAK
1082 case 21:
1084 #line 97 "lib/vcsn/rat/scan.ll"
1085 return TOK(BANG);
1086  YY_BREAK
1087 case 22:
1089 #line 98 "lib/vcsn/rat/scan.ll"
1090 return TOK(COMPLEMENT);
1091  YY_BREAK
1092 case 23:
1094 #line 99 "lib/vcsn/rat/scan.ll"
1095 return TOK(TRANSPOSITION);
1096  YY_BREAK
1097 /* Special constructs. */
1098 case 24:
1100 #line 102 "lib/vcsn/rat/scan.ll"
1101 context.clear(); yy_push_state(SC_CONTEXT);
1102  YY_BREAK
1103 case 25:
1104 /* rule 25 can match eol */
1106 #line 103 "lib/vcsn/rat/scan.ll"
1107 continue;
1108  YY_BREAK
1109 /* Weights. */
1110 case 26:
1112 #line 106 "lib/vcsn/rat/scan.ll"
1113 yy_push_state(SC_WEIGHT);
1114  YY_BREAK
1115 /* Character classes. */
1116 case 27:
1118 #line 109 "lib/vcsn/rat/scan.ll"
1119 yy_push_state(SC_CLASS); return parser::make_LBRACKET(loc);
1120  YY_BREAK
1121 /* White spaces. */
1122 case 28:
1124 #line 112 "lib/vcsn/rat/scan.ll"
1125 loc.step(); continue;
1126  YY_BREAK
1127 case 29:
1128 /* rule 29 can match eol */
1130 #line 113 "lib/vcsn/rat/scan.ll"
1131 LINE(yyleng); loc.step(); continue;
1132  YY_BREAK
1133 
1134 /* Character-class. Initial [ is eaten. */
1135 case 30:
1137 #line 117 "lib/vcsn/rat/scan.ll"
1138 {
1139  yy_pop_state();
1140  return parser::make_RBRACKET(loc);
1141  }
1142  YY_BREAK
1143 case 31:
1145 #line 121 "lib/vcsn/rat/scan.ll"
1146 return parser::make_CARET(loc);
1147  YY_BREAK
1148 case 32:
1150 #line 122 "lib/vcsn/rat/scan.ll"
1151 return parser::make_DASH(loc);
1152  YY_BREAK
1153 case YY_STATE_EOF(SC_CLASS):
1154 #line 124 "lib/vcsn/rat/scan.ll"
1155 {
1156  driver_.error(loc, "unexpected end of file in a character-class");
1157  unput(']');
1158  }
1159  YY_BREAK
1160 
1161 /* Labels. */
1162 case 33:
1163 /* rule 33 can match eol */
1165 #line 132 "lib/vcsn/rat/scan.ll"
1166 {
1167  return parser::make_LETTER({yytext+1, size_t(yyleng-2)}, loc);
1168  }
1169  YY_BREAK
1170 case 34:
1172 #line 136 "lib/vcsn/rat/scan.ll"
1173 {
1174  long c = strtol(yytext + 1, 0, 8);
1175  if (255 < c)
1176  driver_.error(loc, "invalid escape: " + str_escape(yytext));
1177  return parser::make_LETTER({char(c)}, loc);
1178  }
1179  YY_BREAK
1180 case 35:
1182 #line 143 "lib/vcsn/rat/scan.ll"
1183 {
1184  return parser::make_LETTER({char(strtol(yytext + 2, 0, 16))}, loc);
1185  }
1186  YY_BREAK
1187 case 36:
1189 #line 147 "lib/vcsn/rat/scan.ll"
1190 return parser::make_LETTER({'\a'}, loc);
1191  YY_BREAK
1192 case 37:
1194 #line 148 "lib/vcsn/rat/scan.ll"
1195 return parser::make_LETTER({'\b'}, loc);
1196  YY_BREAK
1197 case 38:
1199 #line 149 "lib/vcsn/rat/scan.ll"
1200 return parser::make_LETTER({'\f'}, loc);
1201  YY_BREAK
1202 case 39:
1204 #line 150 "lib/vcsn/rat/scan.ll"
1205 return parser::make_LETTER({'\n'}, loc);
1206  YY_BREAK
1207 case 40:
1209 #line 151 "lib/vcsn/rat/scan.ll"
1210 return parser::make_LETTER({'\r'}, loc);
1211  YY_BREAK
1212 case 41:
1214 #line 152 "lib/vcsn/rat/scan.ll"
1215 return parser::make_LETTER({'\t'}, loc);
1216  YY_BREAK
1217 case 42:
1219 #line 153 "lib/vcsn/rat/scan.ll"
1220 return parser::make_LETTER({'\v'}, loc);
1221  YY_BREAK
1222 case 43:
1224 #line 154 "lib/vcsn/rat/scan.ll"
1225 return parser::make_LETTER(yytext+1, loc+1);
1226  YY_BREAK
1227 case 44:
1229 #line 155 "lib/vcsn/rat/scan.ll"
1230 return parser::make_LETTER(yytext, loc);
1231  YY_BREAK
1232 
1233 /* Context embedded in a $(?@...) directive. */
1234 case 45:
1236 #line 160 "lib/vcsn/rat/scan.ll"
1237 {
1238  ++nesting;
1239  context.append(yytext, yyleng);
1240  }
1241  YY_BREAK
1242 case 46:
1244 #line 164 "lib/vcsn/rat/scan.ll"
1245 {
1246  if (nesting)
1247  {
1248  --nesting;
1249  context.append(yytext, yyleng);
1250  }
1251  else
1252  {
1253  yy_pop_state();
1254  driver_.context(context);
1255  context.clear();
1256  }
1257  }
1258  YY_BREAK
1259 case 47:
1261 #line 177 "lib/vcsn/rat/scan.ll"
1262 context.append(yytext, yyleng);
1263  YY_BREAK
1264 case 48:
1265 /* rule 48 can match eol */
1267 #line 178 "lib/vcsn/rat/scan.ll"
1268 LINE(yyleng); context.append(yytext, yyleng);
1269  YY_BREAK
1270 case YY_STATE_EOF(SC_CONTEXT):
1271 #line 180 "lib/vcsn/rat/scan.ll"
1272 {
1273  driver_.error(loc, "unexpected end of file in a context comment");
1274  unput(')');
1275  }
1276  YY_BREAK
1277 
1278 /* UTF-8 Exponent */
1279 case 49:
1281 #line 187 "lib/vcsn/rat/scan.ll"
1282 exponent *= 10;
1283  YY_BREAK
1284 case 50:
1286 #line 188 "lib/vcsn/rat/scan.ll"
1287 exponent *= 10; exponent += 1;
1288  YY_BREAK
1289 case 51:
1291 #line 189 "lib/vcsn/rat/scan.ll"
1292 exponent *= 10; exponent += 2;
1293  YY_BREAK
1294 case 52:
1296 #line 190 "lib/vcsn/rat/scan.ll"
1297 exponent *= 10; exponent += 3;
1298  YY_BREAK
1299 case 53:
1301 #line 191 "lib/vcsn/rat/scan.ll"
1302 exponent *= 10; exponent += 4;
1303  YY_BREAK
1304 case 54:
1306 #line 192 "lib/vcsn/rat/scan.ll"
1307 exponent *= 10; exponent += 5;
1308  YY_BREAK
1309 case 55:
1311 #line 193 "lib/vcsn/rat/scan.ll"
1312 exponent *= 10; exponent += 6;
1313  YY_BREAK
1314 case 56:
1316 #line 194 "lib/vcsn/rat/scan.ll"
1317 exponent *= 10; exponent += 7;
1318  YY_BREAK
1319 case 57:
1321 #line 195 "lib/vcsn/rat/scan.ll"
1322 exponent *= 10; exponent += 8;
1323  YY_BREAK
1324 case 58:
1326 #line 196 "lib/vcsn/rat/scan.ll"
1327 exponent *= 10; exponent += 9;
1328  YY_BREAK
1329 case 59:
1330 /* rule 59 can match eol */
1332 #line 197 "lib/vcsn/rat/scan.ll"
1333 {
1334  // The end of the exponent was met, do not read it as it would be lost.
1335  yyless(0);
1336  loc -= yyleng;
1337  yy_pop_state();
1338  return parser::make_STAR(std::make_tuple(exponent, exponent), loc);
1339  }
1340  YY_BREAK
1342 #line 204 "lib/vcsn/rat/scan.ll"
1343 {
1344  yy_pop_state();
1345  return parser::make_STAR(std::make_tuple(exponent, exponent), loc);
1346  }
1347  YY_BREAK
1348 
1349 /* Weight. */
1350 case 60:
1352 #line 211 "lib/vcsn/rat/scan.ll"
1353 {
1354  ++nesting;
1355  s.append(yytext, yyleng);
1356  }
1357  YY_BREAK
1358 case 61:
1360 #line 216 "lib/vcsn/rat/scan.ll"
1361 {
1362  if (nesting)
1363  {
1364  --nesting;
1365  s.append(yytext, yyleng);
1366  }
1367  else
1368  {
1369  yy_pop_state();
1370  return parser::make_WEIGHT(s, loc);
1371  }
1372  }
1373  YY_BREAK
1374 /* "⟨" is e2 9f a8, and "⟩" is e2 9f a9. */
1375 case 62:
1376 /* rule 62 can match eol */
1378 #line 230 "lib/vcsn/rat/scan.ll"
1379 s.append(yytext, yyleng);
1380  YY_BREAK
1381 case YY_STATE_EOF(SC_WEIGHT):
1382 #line 232 "lib/vcsn/rat/scan.ll"
1383 {
1384  driver_.error(loc, "unexpected end of file in a weight");
1385  unput('>');
1386  }
1387  YY_BREAK
1388 
1389 case 63:
1391 #line 238 "lib/vcsn/rat/scan.ll"
1392 ECHO;
1393  YY_BREAK
1394 #line 1381 "lib/vcsn/rat/scan.cc"
1395 case YY_STATE_EOF(INITIAL):
1396  yyterminate();
1397 
1398  case YY_END_OF_BUFFER:
1399  {
1400  /* Amount of text matched not including the EOB char. */
1401  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1402 
1403  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1404  *yy_cp = (yy_hold_char);
1406 
1407  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1408  {
1409  /* We're scanning a new file or input source. It's
1410  * possible that this happened because the user
1411  * just pointed yyin at a new source and called
1412  * yylex(). If so, then we have to assure
1413  * consistency between YY_CURRENT_BUFFER and our
1414  * globals. Here is the right place to do so, because
1415  * this is the first action (other than possibly a
1416  * back-up) that will match for the new input source.
1417  */
1418  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1419  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1420  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1421  }
1422 
1423  /* Note that here we test for yy_c_buf_p "<=" to the position
1424  * of the first EOB in the buffer, since yy_c_buf_p will
1425  * already have been incremented past the NUL character
1426  * (since all states make transitions on EOB to the
1427  * end-of-buffer state). Contrast this with the test
1428  * in input().
1429  */
1430  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1431  { /* This was really a NUL. */
1432  yy_state_type yy_next_state;
1433 
1434  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1435 
1436  yy_current_state = yy_get_previous_state( );
1437 
1438  /* Okay, we're now positioned to make the NUL
1439  * transition. We couldn't have
1440  * yy_get_previous_state() go ahead and do it
1441  * for us because it doesn't know how to deal
1442  * with the possibility of jamming (and we don't
1443  * want to build jamming into it because then it
1444  * will run more slowly).
1445  */
1446 
1447  yy_next_state = yy_try_NUL_trans( yy_current_state );
1448 
1449  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1450 
1451  if ( yy_next_state )
1452  {
1453  /* Consume the NUL. */
1454  yy_cp = ++(yy_c_buf_p);
1455  yy_current_state = yy_next_state;
1456  goto yy_match;
1457  }
1458 
1459  else
1460  {
1461 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
1462  yy_cp = (yy_c_buf_p);
1463  goto yy_find_action;
1464  }
1465  }
1466 
1467  else switch ( yy_get_next_buffer( ) )
1468  {
1469  case EOB_ACT_END_OF_FILE:
1470  {
1471  (yy_did_buffer_switch_on_eof) = 0;
1472 
1473  if ( yywrap( ) )
1474  {
1475  /* Note: because we've taken care in
1476  * yy_get_next_buffer() to have set up
1477  * yytext, we can now set up
1478  * yy_c_buf_p so that if some total
1479  * hoser (like flex itself) wants to
1480  * call the scanner after we return the
1481  * YY_NULL, it'll still work - another
1482  * YY_NULL will get returned.
1483  */
1484  (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1485 
1486  yy_act = YY_STATE_EOF(YY_START);
1487  goto do_action;
1488  }
1489 
1490  else
1491  {
1492  if ( ! (yy_did_buffer_switch_on_eof) )
1493  YY_NEW_FILE;
1494  }
1495  break;
1496  }
1497 
1498  case EOB_ACT_CONTINUE_SCAN:
1499  (yy_c_buf_p) =
1500  (yytext_ptr) + yy_amount_of_matched_text;
1501 
1502  yy_current_state = yy_get_previous_state( );
1503 
1504  yy_cp = (yy_c_buf_p);
1505  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1506  goto yy_match;
1507 
1508  case EOB_ACT_LAST_MATCH:
1509  (yy_c_buf_p) =
1510  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1511 
1512  yy_current_state = yy_get_previous_state( );
1513 
1514  yy_cp = (yy_c_buf_p);
1515  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1516  goto yy_find_action;
1517  }
1518  break;
1519  }
1520 
1521  default:
1523  "fatal flex scanner internal error--no action found" );
1524  } /* end of action switch */
1525  } /* end of scanning one token */
1526  } /* end of user's declarations */
1527 } /* end of yylex */
1528 /* %ok-for-header */
1529 
1530 /* %if-c++-only */
1531 /* %not-for-header */
1532 
1533 /* The contents of this function are C++ specific, so the () macro is not used.
1534  */
1535 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1536 {
1537  yyin = arg_yyin;
1538  yyout = arg_yyout;
1539  yy_c_buf_p = 0;
1540  yy_init = 0;
1541  yy_start = 0;
1542  yy_flex_debug = 0;
1543  yylineno = 1; // this will only get updated if %option yylineno
1544 
1546 
1548  yy_more_flag = 0;
1549  yy_more_len = 0;
1551 
1553  yy_start_stack = NULL;
1554 
1555  yy_buffer_stack = 0;
1556  yy_buffer_stack_top = 0;
1557  yy_buffer_stack_max = 0;
1558 
1559  yy_state_buf = 0;
1560 
1561 }
1562 
1563 /* The contents of this function are C++ specific, so the () macro is not used.
1564  */
1566 {
1567  delete [] yy_state_buf;
1571 }
1572 
1573 /* The contents of this function are C++ specific, so the () macro is not used.
1574  */
1575 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1576 {
1577  if ( new_in )
1578  {
1581  }
1582 
1583  if ( new_out )
1584  yyout = new_out;
1585 }
1586 
1587 #ifdef YY_INTERACTIVE
1588 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1589 #else
1590 int yyFlexLexer::LexerInput( char* buf, int max_size )
1591 #endif
1592 {
1593  if ( yyin->eof() || yyin->fail() )
1594  return 0;
1595 
1596 #ifdef YY_INTERACTIVE
1597  yyin->get( buf[0] );
1598 
1599  if ( yyin->eof() )
1600  return 0;
1601 
1602  if ( yyin->bad() )
1603  return -1;
1604 
1605  return 1;
1606 
1607 #else
1608  (void) yyin->read( buf, max_size );
1609 
1610  if ( yyin->bad() )
1611  return -1;
1612  else
1613  return yyin->gcount();
1614 #endif
1615 }
1616 
1617 void yyFlexLexer::LexerOutput( const char* buf, int size )
1618 {
1619  (void) yyout->write( buf, size );
1620 }
1621 /* %ok-for-header */
1622 
1623 /* %endif */
1624 
1625 /* yy_get_next_buffer - try to read in a new buffer
1626  *
1627  * Returns a code representing an action:
1628  * EOB_ACT_LAST_MATCH -
1629  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1630  * EOB_ACT_END_OF_FILE - end of file
1631  */
1632 /* %if-c-only */
1633 /* %endif */
1634 /* %if-c++-only */
1636 /* %endif */
1637 {
1638  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1639  register char *source = (yytext_ptr);
1640  register int number_to_move, i;
1641  int ret_val;
1642 
1643  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1645  "fatal flex scanner internal error--end of buffer missed" );
1646 
1647  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1648  { /* Don't try to fill the buffer, so this is an EOF. */
1649  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1650  {
1651  /* We matched a single character, the EOB, so
1652  * treat this as a final EOF.
1653  */
1654  return EOB_ACT_END_OF_FILE;
1655  }
1656 
1657  else
1658  {
1659  /* We matched some text prior to the EOB, first
1660  * process it.
1661  */
1662  return EOB_ACT_LAST_MATCH;
1663  }
1664  }
1665 
1666  /* Try to read more data. */
1667 
1668  /* First move last chars to start of buffer. */
1669  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1670 
1671  for ( i = 0; i < number_to_move; ++i )
1672  *(dest++) = *(source++);
1673 
1674  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1675  /* don't do the read, it's not guaranteed to return an EOF,
1676  * just force an EOF
1677  */
1678  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1679 
1680  else
1681  {
1682  yy_size_t num_to_read =
1683  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1684 
1685  while ( num_to_read <= 0 )
1686  { /* Not enough room in the buffer - grow it. */
1687 
1688  /* just a shorter name for the current buffer */
1689  YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1690 
1691  int yy_c_buf_p_offset =
1692  (int) ((yy_c_buf_p) - b->yy_ch_buf);
1693 
1694  if ( b->yy_is_our_buffer )
1695  {
1696  yy_size_t new_size = b->yy_buf_size * 2;
1697 
1698  if ( new_size <= 0 )
1699  b->yy_buf_size += b->yy_buf_size / 8;
1700  else
1701  b->yy_buf_size *= 2;
1702 
1703  b->yy_ch_buf = (char *)
1704  /* Include room in for 2 EOB chars. */
1705  yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1706  }
1707  else
1708  /* Can't grow it, we don't own it. */
1709  b->yy_ch_buf = 0;
1710 
1711  if ( ! b->yy_ch_buf )
1713  "fatal error - scanner input buffer overflow" );
1714 
1715  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1716 
1717  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1718  number_to_move - 1;
1719 
1720  }
1721 
1722  if ( num_to_read > YY_READ_BUF_SIZE )
1723  num_to_read = YY_READ_BUF_SIZE;
1724 
1725  /* Read in more data. */
1726  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1727  (yy_n_chars), num_to_read );
1728 
1729  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1730  }
1731 
1732  if ( (yy_n_chars) == 0 )
1733  {
1734  if ( number_to_move == YY_MORE_ADJ )
1735  {
1736  ret_val = EOB_ACT_END_OF_FILE;
1737  yyrestart( yyin );
1738  }
1739 
1740  else
1741  {
1742  ret_val = EOB_ACT_LAST_MATCH;
1743  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1745  }
1746  }
1747 
1748  else
1749  ret_val = EOB_ACT_CONTINUE_SCAN;
1750 
1751  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1752  /* Extend the array by 50%, plus the number we really need. */
1753  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1754  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1755  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1756  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1757  }
1758 
1759  (yy_n_chars) += number_to_move;
1762 
1763  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1764 
1765  return ret_val;
1766 }
1767 
1768 /* yy_get_previous_state - get the state just before the EOB char was reached */
1769 
1770 /* %if-c-only */
1771 /* %not-for-header */
1772 
1773 /* %endif */
1774 /* %if-c++-only */
1776 /* %endif */
1777 {
1778  register yy_state_type yy_current_state;
1779  register char *yy_cp;
1780 
1781 /* %% [15.0] code to get the start state into yy_current_state goes here */
1782  yy_current_state = (yy_start);
1783 
1784  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1785  {
1786 /* %% [16.0] code to find the next state goes here */
1787  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1788  if ( yy_accept[yy_current_state] )
1789  {
1790  (yy_last_accepting_state) = yy_current_state;
1791  (yy_last_accepting_cpos) = yy_cp;
1792  }
1793  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1794  {
1795  yy_current_state = (int) yy_def[yy_current_state];
1796  if ( yy_current_state >= 129 )
1797  yy_c = yy_meta[(unsigned int) yy_c];
1798  }
1799  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1800  }
1801 
1802  return yy_current_state;
1803 }
1804 
1805 /* yy_try_NUL_trans - try to make a transition on the NUL character
1806  *
1807  * synopsis
1808  * next_state = yy_try_NUL_trans( current_state );
1809  */
1810 /* %if-c-only */
1811 /* %endif */
1812 /* %if-c++-only */
1814 /* %endif */
1815 {
1816  register int yy_is_jam;
1817  /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
1818  register char *yy_cp = (yy_c_buf_p);
1819 
1820  register YY_CHAR yy_c = 1;
1821  if ( yy_accept[yy_current_state] )
1822  {
1823  (yy_last_accepting_state) = yy_current_state;
1824  (yy_last_accepting_cpos) = yy_cp;
1825  }
1826  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1827  {
1828  yy_current_state = (int) yy_def[yy_current_state];
1829  if ( yy_current_state >= 129 )
1830  yy_c = yy_meta[(unsigned int) yy_c];
1831  }
1832  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1833  yy_is_jam = (yy_current_state == 128);
1834 
1835  return yy_is_jam ? 0 : yy_current_state;
1836 }
1837 
1838 /* %if-c-only */
1839 /* %endif */
1840 /* %if-c++-only */
1841  void yyFlexLexer::yyunput( int c, register char* yy_bp)
1842 /* %endif */
1843 {
1844  register char *yy_cp;
1845 
1846  yy_cp = (yy_c_buf_p);
1847 
1848  /* undo effects of setting up yytext */
1849  *yy_cp = (yy_hold_char);
1850 
1851  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1852  { /* need to shift things up to make room */
1853  /* +2 for EOB chars. */
1854  register yy_size_t number_to_move = (yy_n_chars) + 2;
1855  register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1856  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1857  register char *source =
1858  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1859 
1860  while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1861  *--dest = *--source;
1862 
1863  yy_cp += (int) (dest - source);
1864  yy_bp += (int) (dest - source);
1865  YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1866  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1867 
1868  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1869  YY_FATAL_ERROR( "flex scanner push-back overflow" );
1870  }
1871 
1872  *--yy_cp = (char) c;
1873 
1874 /* %% [18.0] update yylineno here */
1875 
1876  (yytext_ptr) = yy_bp;
1877  (yy_hold_char) = *yy_cp;
1878  (yy_c_buf_p) = yy_cp;
1879 }
1880 /* %if-c-only */
1881 /* %endif */
1882 
1883 /* %if-c-only */
1884 /* %endif */
1885 /* %if-c++-only */
1886  int yyFlexLexer::yyinput()
1887 /* %endif */
1888 {
1889  int c;
1890 
1891  *(yy_c_buf_p) = (yy_hold_char);
1892 
1893  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1894  {
1895  /* yy_c_buf_p now points to the character we want to return.
1896  * If this occurs *before* the EOB characters, then it's a
1897  * valid NUL; if not, then we've hit the end of the buffer.
1898  */
1899  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1900  /* This was really a NUL. */
1901  *(yy_c_buf_p) = '\0';
1902 
1903  else
1904  { /* need more input */
1905  yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1906  ++(yy_c_buf_p);
1907 
1908  switch ( yy_get_next_buffer( ) )
1909  {
1910  case EOB_ACT_LAST_MATCH:
1911  /* This happens because yy_g_n_b()
1912  * sees that we've accumulated a
1913  * token and flags that we need to
1914  * try matching the token before
1915  * proceeding. But for input(),
1916  * there's no matching to consider.
1917  * So convert the EOB_ACT_LAST_MATCH
1918  * to EOB_ACT_END_OF_FILE.
1919  */
1920 
1921  /* Reset buffer status. */
1922  yyrestart( yyin );
1923 
1924  /*FALLTHROUGH*/
1925 
1926  case EOB_ACT_END_OF_FILE:
1927  {
1928  if ( yywrap( ) )
1929  return EOF;
1930 
1931  if ( ! (yy_did_buffer_switch_on_eof) )
1932  YY_NEW_FILE;
1933 #ifdef __cplusplus
1934  return yyinput();
1935 #else
1936  return input();
1937 #endif
1938  }
1939 
1940  case EOB_ACT_CONTINUE_SCAN:
1941  (yy_c_buf_p) = (yytext_ptr) + offset;
1942  break;
1943  }
1944  }
1945  }
1946 
1947  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1948  *(yy_c_buf_p) = '\0'; /* preserve yytext */
1949  (yy_hold_char) = *++(yy_c_buf_p);
1950 
1951 /* %% [19.0] update BOL and yylineno */
1952 
1953  return c;
1954 }
1955 /* %if-c-only */
1956 /* %endif */
1957 
1963 /* %if-c-only */
1964 /* %endif */
1965 /* %if-c++-only */
1966  void yyFlexLexer::yyrestart( std::istream* input_file )
1967 /* %endif */
1968 {
1969 
1970  if ( ! YY_CURRENT_BUFFER ){
1974  }
1975 
1976  yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1978 }
1979 
1984 /* %if-c-only */
1985 /* %endif */
1986 /* %if-c++-only */
1987  void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1988 /* %endif */
1989 {
1990 
1991  /* TODO. We should be able to replace this entire function body
1992  * with
1993  * yypop_buffer_state();
1994  * yypush_buffer_state(new_buffer);
1995  */
1997  if ( YY_CURRENT_BUFFER == new_buffer )
1998  return;
1999 
2000  if ( YY_CURRENT_BUFFER )
2001  {
2002  /* Flush out information for old buffer. */
2003  *(yy_c_buf_p) = (yy_hold_char);
2004  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2005  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2006  }
2007 
2008  YY_CURRENT_BUFFER_LVALUE = new_buffer;
2010 
2011  /* We don't actually know whether we did this switch during
2012  * EOF (yywrap()) processing, but the only time this flag
2013  * is looked at is after yywrap() is called, so it's safe
2014  * to go ahead and always set it.
2015  */
2017 }
2018 
2019 /* %if-c-only */
2020 /* %endif */
2021 /* %if-c++-only */
2023 /* %endif */
2024 {
2025  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2026  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2027  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2028  (yy_hold_char) = *(yy_c_buf_p);
2029 }
2030 
2037 /* %if-c-only */
2038 /* %endif */
2039 /* %if-c++-only */
2040  YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2041 /* %endif */
2042 {
2043  YY_BUFFER_STATE b;
2044 
2045  b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
2046  if ( ! b )
2047  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2048 
2049  b->yy_buf_size = size;
2050 
2051  /* yy_ch_buf has to be 2 characters longer than the size given because
2052  * we need to put in 2 end-of-buffer characters.
2053  */
2054  b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
2055  if ( ! b->yy_ch_buf )
2056  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2057 
2058  b->yy_is_our_buffer = 1;
2059 
2060  yy_init_buffer( b, file );
2061 
2062  return b;
2063 }
2064 
2069 /* %if-c-only */
2070 /* %endif */
2071 /* %if-c++-only */
2072  void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2073 /* %endif */
2074 {
2075 
2076  if ( ! b )
2077  return;
2078 
2079  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2081 
2082  if ( b->yy_is_our_buffer )
2083  yyfree((void *) b->yy_ch_buf );
2084 
2085  yyfree((void *) b );
2086 }
2087 
2088 /* Initializes or reinitializes a buffer.
2089  * This function is sometimes called more than once on the same buffer,
2090  * such as during a yyrestart() or at EOF.
2091  */
2092 /* %if-c-only */
2093 /* %endif */
2094 /* %if-c++-only */
2095  void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2096 /* %endif */
2097 
2098 {
2099  int oerrno = errno;
2100 
2101  yy_flush_buffer( b );
2102 
2103  b->yy_input_file = file;
2104  b->yy_fill_buffer = 1;
2105 
2106  /* If b is the current buffer, then yy_init_buffer was _probably_
2107  * called from yyrestart() or through yy_get_next_buffer.
2108  * In that case, we don't want to reset the lineno or column.
2109  */
2110  if (b != YY_CURRENT_BUFFER){
2111  b->yy_bs_lineno = 1;
2112  b->yy_bs_column = 0;
2113  }
2114 
2115 /* %if-c-only */
2116 /* %endif */
2117 /* %if-c++-only */
2118  b->yy_is_interactive = 0;
2119 /* %endif */
2120  errno = oerrno;
2121 }
2122 
2127 /* %if-c-only */
2128 /* %endif */
2129 /* %if-c++-only */
2130  void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2131 /* %endif */
2132 {
2133  if ( ! b )
2134  return;
2135 
2136  b->yy_n_chars = 0;
2137 
2138  /* We always need two end-of-buffer characters. The first causes
2139  * a transition to the end-of-buffer state. The second causes
2140  * a jam in that state.
2141  */
2144 
2145  b->yy_buf_pos = &b->yy_ch_buf[0];
2146 
2147  b->yy_at_bol = 1;
2149 
2150  if ( b == YY_CURRENT_BUFFER )
2152 }
2153 
2154 /* %if-c-or-c++ */
2161 /* %if-c-only */
2162 /* %endif */
2163 /* %if-c++-only */
2164 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2165 /* %endif */
2166 {
2167  if (new_buffer == NULL)
2168  return;
2169 
2171 
2172  /* This block is copied from yy_switch_to_buffer. */
2173  if ( YY_CURRENT_BUFFER )
2174  {
2175  /* Flush out information for old buffer. */
2176  *(yy_c_buf_p) = (yy_hold_char);
2177  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2178  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2179  }
2180 
2181  /* Only push if top exists. Otherwise, replace top. */
2182  if (YY_CURRENT_BUFFER)
2183  (yy_buffer_stack_top)++;
2184  YY_CURRENT_BUFFER_LVALUE = new_buffer;
2185 
2186  /* copied from yy_switch_to_buffer. */
2189 }
2190 /* %endif */
2191 
2192 /* %if-c-or-c++ */
2197 /* %if-c-only */
2198 /* %endif */
2199 /* %if-c++-only */
2201 /* %endif */
2202 {
2203  if (!YY_CURRENT_BUFFER)
2204  return;
2205 
2207  YY_CURRENT_BUFFER_LVALUE = NULL;
2208  if ((yy_buffer_stack_top) > 0)
2209  --(yy_buffer_stack_top);
2210 
2211  if (YY_CURRENT_BUFFER) {
2214  }
2215 }
2216 /* %endif */
2217 
2218 /* %if-c-or-c++ */
2219 /* Allocates the stack if it does not exist.
2220  * Guarantees space for at least one push.
2221  */
2222 /* %if-c-only */
2223 /* %endif */
2224 /* %if-c++-only */
2226 /* %endif */
2227 {
2228  yy_size_t num_to_alloc;
2229 
2230  if (!(yy_buffer_stack)) {
2231 
2232  /* First allocation is just for 2 elements, since we don't know if this
2233  * scanner will even need a stack. We use 2 instead of 1 to avoid an
2234  * immediate realloc on the next call.
2235  */
2236  num_to_alloc = 1;
2238  (num_to_alloc * sizeof(struct yy_buffer_state*)
2239  );
2240  if ( ! (yy_buffer_stack) )
2241  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2242 
2243  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2244 
2245  (yy_buffer_stack_max) = num_to_alloc;
2246  (yy_buffer_stack_top) = 0;
2247  return;
2248  }
2249 
2250  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2251 
2252  /* Increase the buffer to prepare for a possible push. */
2253  int grow_size = 8 /* arbitrary grow size */;
2254 
2255  num_to_alloc = (yy_buffer_stack_max) + grow_size;
2257  ((yy_buffer_stack),
2258  num_to_alloc * sizeof(struct yy_buffer_state*)
2259  );
2260  if ( ! (yy_buffer_stack) )
2261  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2262 
2263  /* zero only the new slots.*/
2264  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2265  (yy_buffer_stack_max) = num_to_alloc;
2266  }
2267 }
2268 /* %endif */
2269 
2270 /* %if-c-only */
2271 /* %endif */
2272 
2273 /* %if-c-only */
2274 /* %endif */
2275 
2276 /* %if-c-only */
2277 /* %endif */
2278 
2279 /* %if-c-only */
2280 /* %endif */
2281 /* %if-c++-only */
2282  void yyFlexLexer::yy_push_state( int new_state )
2283 /* %endif */
2284 {
2286  {
2287  yy_size_t new_size;
2288 
2290  new_size = (yy_start_stack_depth) * sizeof( int );
2291 
2292  if ( ! (yy_start_stack) )
2293  (yy_start_stack) = (int *) yyalloc(new_size );
2294 
2295  else
2296  (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size );
2297 
2298  if ( ! (yy_start_stack) )
2299  YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2300  }
2301 
2303 
2304  BEGIN(new_state);
2305 }
2306 
2307 /* %if-c-only */
2308 /* %endif */
2309 /* %if-c++-only */
2311 /* %endif */
2312 {
2313  if ( --(yy_start_stack_ptr) < 0 )
2314  YY_FATAL_ERROR( "start-condition stack underflow" );
2315 
2317 }
2318 
2319 #ifndef YY_EXIT_FAILURE
2320 #define YY_EXIT_FAILURE 2
2321 #endif
2322 
2323 /* %if-c-only */
2324 /* %endif */
2325 /* %if-c++-only */
2326 void yyFlexLexer::LexerError( yyconst char msg[] )
2327 {
2328  std::cerr << msg << std::endl;
2329  exit( YY_EXIT_FAILURE );
2330 }
2331 /* %endif */
2332 
2333 /* Redefine yyless() so it works in section 3 code. */
2334 
2335 #undef yyless
2336 #define yyless(n) \
2337  do \
2338  { \
2339  /* Undo effects of setting up yytext. */ \
2340  int yyless_macro_arg = (n); \
2341  YY_LESS_LINENO(yyless_macro_arg);\
2342  yytext[yyleng] = (yy_hold_char); \
2343  (yy_c_buf_p) = yytext + yyless_macro_arg; \
2344  (yy_hold_char) = *(yy_c_buf_p); \
2345  *(yy_c_buf_p) = '\0'; \
2346  yyleng = yyless_macro_arg; \
2347  } \
2348  while ( 0 )
2349 
2350 /* Accessor methods (get/set functions) to struct members. */
2351 
2352 /* %if-c-only */
2353 /* %if-reentrant */
2354 /* %endif */
2355 /* %if-reentrant */
2356 /* %endif */
2357 /* %endif */
2358 
2359 /* %if-reentrant */
2360 /* %if-bison-bridge */
2361 /* %endif */
2362 /* %endif if-c-only */
2363 
2364 /* %if-c-only */
2365 /* %endif */
2366 
2367 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
2368 /* %if-reentrant */
2369 /* %endif */
2370 /* %endif */
2371 
2372 /*
2373  * Internal utility routines.
2374  */
2375 
2376 #ifndef yytext_ptr
2377 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2378 {
2379  register int i;
2380  for ( i = 0; i < n; ++i )
2381  s1[i] = s2[i];
2382 }
2383 #endif
2384 
2385 #ifdef YY_NEED_STRLEN
2386 static int yy_flex_strlen (yyconst char * s )
2387 {
2388  register int n;
2389  for ( n = 0; s[n]; ++n )
2390  ;
2391 
2392  return n;
2393 }
2394 #endif
2395 
2396 void *yyalloc (yy_size_t size )
2397 {
2398  return (void *) malloc( size );
2399 }
2400 
2401 void *yyrealloc (void * ptr, yy_size_t size )
2402 {
2403  /* The cast to (char *) in the following accommodates both
2404  * implementations that use char* generic pointers, and those
2405  * that use void* generic pointers. It works with the latter
2406  * because both ANSI C and C++ allow castless assignment from
2407  * any pointer type to void*, and deal with argument conversions
2408  * as though doing an assignment.
2409  */
2410  return (void *) realloc( (char *) ptr, size );
2411 }
2412 
2413 void yyfree (void * ptr )
2414 {
2415  free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2416 }
2417 
2418 /* %if-tables-serialization definitions */
2419 /* %define-yytables The name for this specific scanner's tables. */
2420 #define YYTABLES_NAME "yytables"
2421 /* %endif */
2422 
2423 /* %ok-for-header */
2424 
2425 #line 237 "lib/vcsn/rat/scan.ll"
2426 
2427 
2428 namespace
2429 {
2431  template <typename Out>
2432  Out
2433  lexical_cast(driver& d, const location& loc, const std::string& s)
2434  {
2435  try
2436  {
2437  return boost::lexical_cast<Out>(s);
2438  }
2439  catch (const boost::bad_lexical_cast&)
2440  {
2441  d.error(loc, "invalid numerical literal: " + s);
2442  return 0;
2443  }
2444  }
2445 
2447  int arity(driver& d, const location& loc, const std::string& s)
2448  {
2449  if (s.empty())
2450  return -1;
2451  else
2452  return lexical_cast<int>(d, loc, s);
2453  }
2454 
2460  irange_type
2461  quantifier(driver& d, const location& loc, const std::string& s)
2462  {
2463  auto arity_re = std::regex{"([0-9]*)(,?)([0-9]*)", std::regex::extended};
2464  std::smatch minmax;
2465  if (!std::regex_match(s, minmax, arity_re))
2466  throw std::runtime_error("cannot match arity: " + s);
2467  auto res = irange_type{arity(d, loc, minmax[1].str()),
2468  arity(d, loc, minmax[3].str())};
2469  if (minmax[2].str().empty())
2470  // No comma: single argument.
2471  std::get<1>(res) = std::get<0>(res);
2472  return res;
2473  }
2474 }
2475 
2476 // Do not use %option noyywrap, because then flex generates the
2477 // same definition of yywrap, but outside the namespaces, so it
2478 // defines it for ::yyFlexLexer instead of
2479 // ::vcsn::rat::yyFlexLexer.
2480 int yyFlexLexer::yywrap() { return 1; }
2481 
2482 // Beware of the dummy Flex interface. One would like to use:
2483 //
2484 // yypush_buffer_state(yy_create_buffer(yyin, YY_BUF_SIZE));
2485 //
2486 // and
2487 //
2488 // yypush_buffer_state(yy_scan_bytes(e.c_str(), e.size()));
2489 //
2490 // but the latter (yy_scan_bytes) calls yy_switch_to_buffer, so in
2491 // effect calling yypush_buffer_state saves the new state instead
2492 // of the old one.
2493 //
2494 // So do it in two steps, quite different from what is suggested
2495 // in the documentation: save the old context, switch to the new
2496 // one.
2497 
2498 void yyFlexLexer::scan_open_(std::istream& f)
2499 {
2500  set_debug(!!getenv("YYSCAN"));
2503 }
2504 
2506 {
2508 }
2509 
2511 
2512 // Local Variables:
2513 // mode: C++
2514 // End:
2515 
yy_state_type yy_try_NUL_trans(yy_state_type current_state)
Definition: scan.cc:1539
void yy_switch_to_buffer(yy_buffer_state *new_buffer)
Switch to a different input buffer.
Definition: scan.cc:1713
#define YY_RESTORE_YY_MORE_OFFSET
Definition: scan.cc:641
std::ostream & str_escape(std::ostream &os, const std::string &str, const char *special=nullptr)
Output a string, escaping special characters.
Definition: escape.cc:54
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
static flex_int16_t yy_accept[129]
Definition: scan.cc:443
#define LINE(Line)
Definition: scan.cc:659
#define YY_START
Definition: scan.cc:203
#define YY_START_STACK_INCR
Definition: scan.cc:779
int yy_start_stack_ptr
Definition: flex-lexer.hh:161
#define YY_CURRENT_BUFFER_LVALUE
Definition: scan.cc:365
#define YY_BUFFER_EOF_PENDING
Definition: scan.cc:338
#define SC_CONTEXT
Definition: scan.cc:681
int yy_more_flag
Definition: flex-lexer.hh:217
#define SC_EXPONENT
Definition: scan.cc:682
yy_size_t yy_n_chars
Definition: scan.cc:295
#define YY_INPUT(buf, result, max_size)
Definition: scan.cc:759
yyFlexLexer(std::istream &arg_yyin, std::ostream &arg_yyout)
unsigned int flex_uint32_t
Definition: scan.cc:102
#define YY_DO_BEFORE_ACTION
Definition: scan.cc:424
void yypop_buffer_state()
Removes and deletes the top of the stack, if present.
Definition: scan.cc:1926
short int flex_int16_t
Definition: scan.cc:98
#define YY_STATE_EOF(state)
Definition: scan.cc:207
#define yyconst
Definition: scan.cc:167
void yypush_buffer_state(yy_buffer_state *new_buffer)
Pushes the new state onto the stack.
Definition: scan.cc:1890
void * yyrealloc(void *ptr, yy_size_t size)
Definition: scan.cc:2136
signed char flex_int8_t
Definition: scan.cc:97
virtual void LexerOutput(const char *buf, int size)
Definition: scan.cc:1343
int yy_at_bol
Definition: scan.cc:314
Define the vcsn::rat::parser class.
struct yy_buffer_state * YY_BUFFER_STATE
Definition: scan.cc:233
unsigned short int flex_uint16_t
Definition: scan.cc:101
virtual void LexerError(const char *msg)
Definition: scan.cc:2061
yy_size_t yyleng
static flex_int32_t yy_ec[256]
Definition: scan.cc:461
int yy_looking_for_trail_begin
Definition: flex-lexer.hh:215
int yy_more_offset
Definition: flex-lexer.hh:219
int yy_state_type
Definition: flex-lexer.hh:56
std::ostream * yyout
Definition: flex-lexer.hh:176
void yyfree(void *ptr)
Definition: scan.cc:2148
#define yyterminate()
Definition: scan.cc:20
static flex_int16_t yy_def[139]
Definition: scan.cc:523
#define YY_BUFFER_NEW
Definition: scan.cc:326
std::istream * yyin
Definition: flex-lexer.hh:145
size_t yy_buffer_stack_max
capacity of stack.
Definition: flex-lexer.hh:197
int yyinput()
Definition: scan.cc:1612
int yy_did_buffer_switch_on_eof
Definition: flex-lexer.hh:193
#define yyless(n)
Definition: scan.cc:2336
#define SC_WEIGHT
Definition: scan.cc:683
virtual ~yyFlexLexer()
Definition: scan.cc:1291
#define YY_EXIT_FAILURE
Definition: scan.cc:2320
#define YY_SC_TO_UI(c)
Definition: scan.cc:183
int yy_fill_buffer
Definition: scan.cc:322
#define EOB_ACT_CONTINUE_SCAN
Definition: scan.cc:250
void set_debug(int flag)
Definition: flex-lexer.hh:85
int yy_bs_column
The column count.
Definition: scan.cc:317
yy_state_type yy_last_accepting_state
Definition: flex-lexer.hh:204
static flex_int16_t yy_chk[340]
Definition: scan.cc:583
vcsn::rat::location location
Definition: scan.hh:17
int yy_get_next_buffer()
Definition: scan.cc:1361
int flex_int32_t
Definition: scan.cc:99
#define YY_BUFFER_NORMAL
Definition: scan.cc:327
static flex_int16_t yy_base[139]
Definition: scan.cc:504
virtual int yywrap()
Definition: scan.cc:2165
void scan_open_(std::istream &f)
Definition: scan.cc:2183
size_t yy_buffer_stack_top
index of top of stack.
Definition: flex-lexer.hh:196
weightset_mixin< detail::b_impl > b
Definition: fwd.hh:48
#define YY_MORE_ADJ
Definition: scan.cc:640
void yyensure_buffer_stack(void)
Definition: scan.cc:1951
std::istream * yy_input_file
Definition: scan.cc:281
void scan_close_()
Definition: scan.cc:2190
int yy_prev_more_offset
Definition: flex-lexer.hh:220
#define yytext_ptr
Definition: scan.cc:411
int * yy_start_stack
Definition: flex-lexer.hh:163
#define INITIAL
Definition: scan.cc:679
void yy_flush_buffer(yy_buffer_state *b)
Discard all buffered characters.
Definition: scan.cc:1856
int yy_bs_lineno
The line count.
Definition: scan.cc:316
char * yy_ch_buf
Definition: scan.cc:284
yy_buffer_state ** yy_buffer_stack
Stack as an array.
Definition: flex-lexer.hh:198
char * yy_last_accepting_cpos
Definition: flex-lexer.hh:205
flex_int32_t yy_nxt
Definition: scan.cc:441
virtual void switch_streams(std::istream *new_in, std::ostream *new_out=nullptr)
Definition: scan.cc:1301
yy_state_type yy_get_previous_state()
Definition: scan.cc:1501
#define YY_CURRENT_BUFFER
Definition: scan.cc:358
flex_int32_t yy_verify
Definition: scan.cc:440
unsigned char flex_uint8_t
Definition: scan.cc:100
#define YY_END_OF_BUFFER
Definition: scan.cc:435
#define YY_NEW_FILE
Definition: scan.cc:210
int yy_is_interactive
Definition: scan.cc:308
#define ECHO
Definition: scan.cc:751
#define EOB_ACT_END_OF_FILE
Definition: scan.cc:251
static flex_int16_t yy_nxt[340]
Definition: scan.cc:542
#define YY_FLEX_NAMESPACE_END
Definition: scan.hh:9
char * yy_buf_pos
Definition: scan.cc:285
char * yy_c_buf_p
Definition: flex-lexer.hh:186
#define YY_DECL
Definition: scan.cc:812
void yyrestart(std::istream *s)
Immediately switch to a different input stream.
Definition: scan.cc:1692
void yyunput(int c, char *buf_ptr)
Definition: scan.cc:1567
int yy_flex_debug
Definition: flex-lexer.hh:91
#define unput(c)
Definition: scan.cc:271
virtual int LexerInput(char *buf, int max_size)
Definition: scan.cc:1314
std::tuple< int, int > irange_type
An integer range, for quantifiers/exponents.
Definition: parse.hh:78
#define TOK(Token)
Definition: scan.cc:668
void yy_load_buffer_state()
Definition: scan.cc:1748
int yy_buffer_status
Definition: scan.cc:324
void * yyalloc(yy_size_t size)
Definition: scan.cc:2131
void yy_pop_state()
Definition: scan.cc:2036
yy_buffer_state * yy_create_buffer(std::istream *s, int size)
Allocate and initialize an input buffer state.
Definition: scan.cc:1766
static flex_int32_t yy_meta[66]
Definition: scan.cc:493
void yy_push_state(int new_state)
Definition: scan.cc:2008
yy_state_type * yy_state_buf
Definition: flex-lexer.hh:207
unsigned char YY_CHAR
Definition: scan.cc:409
size_t yy_size_t
Definition: scan.cc:238
std::shared_ptr< const detail::context_base > context
A dyn::context.
Definition: fwd.hh:43
void yy_init_buffer(yy_buffer_state *b, std::istream *s)
Definition: scan.cc:1821
yy_size_t yy_buf_size
Definition: scan.cc:290
#define YY_BUF_SIZE
Definition: scan.cc:223
static flex_int16_t yy_rule_linenum[63]
Definition: scan.cc:624
#define YY_END_OF_BUFFER_CHAR
Definition: scan.cc:212
int yy_start_stack_depth
Definition: flex-lexer.hh:162
#define SC_CLASS
Definition: scan.cc:680
#define YY_FATAL_ERROR(msg)
Definition: scan.cc:787
int yy_is_our_buffer
Definition: scan.cc:301
#define YY_READ_BUF_SIZE
Definition: scan.cc:742
#define BEGIN
Definition: scan.cc:197
#define YY_RULE_SETUP
Definition: scan.cc:829
#define YY_BREAK
Definition: scan.cc:825
int yylineno
Definition: flex-lexer.hh:90
#define EOB_ACT_LAST_MATCH
Definition: scan.cc:252
char yy_hold_char
Definition: flex-lexer.hh:180
irange_type quantifier(driver &d, const location &loc, const std::string &s)
void yy_delete_buffer(yy_buffer_state *b)
Destroy the buffer.
Definition: scan.cc:1798