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