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