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