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