1 #line 2 "flex_scanner.cpp"
2 
3 #line 4 "flex_scanner.cpp"
4 
5 #define  YY_INT_ALIGNED short int
6 
7 /* A lexical scanner generated by flex */
8 
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
16 
17     /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
18      * following macro. This is required in order to pass the c++-multiple-scanners
19      * test in the regression suite. We get reports that it breaks inheritance.
20      * We will address this in a future release of flex, or omit the C++ scanner
21      * altogether.
22      */
23     #define yyFlexLexer SlamFlexLexer
24 
25 /* First, we deal with  platform-specific or compiler-specific issues. */
26 
27 /* begin standard C headers. */
28 
29 /* end standard C headers. */
30 
31 /* flex integer type definitions */
32 
33 #ifndef FLEXINT_H
34 #define FLEXINT_H
35 
36 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
37 
38 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
39 
40 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
41  * if you want the limit (max/min) macros for int types.
42  */
43 #ifndef __STDC_LIMIT_MACROS
44 #define __STDC_LIMIT_MACROS 1
45 #endif
46 
47 #include <inttypes.h>
48 typedef int8_t flex_int8_t;
49 typedef uint8_t flex_uint8_t;
50 typedef int16_t flex_int16_t;
51 typedef uint16_t flex_uint16_t;
52 typedef int32_t flex_int32_t;
53 typedef uint32_t flex_uint32_t;
54 #else
55 typedef signed char flex_int8_t;
56 typedef short int flex_int16_t;
57 typedef int flex_int32_t;
58 typedef unsigned char flex_uint8_t;
59 typedef unsigned short int flex_uint16_t;
60 typedef unsigned int flex_uint32_t;
61 
62 /* Limits of integral types. */
63 #ifndef INT8_MIN
64 #define INT8_MIN               (-128)
65 #endif
66 #ifndef INT16_MIN
67 #define INT16_MIN              (-32767-1)
68 #endif
69 #ifndef INT32_MIN
70 #define INT32_MIN              (-2147483647-1)
71 #endif
72 #ifndef INT8_MAX
73 #define INT8_MAX               (127)
74 #endif
75 #ifndef INT16_MAX
76 #define INT16_MAX              (32767)
77 #endif
78 #ifndef INT32_MAX
79 #define INT32_MAX              (2147483647)
80 #endif
81 #ifndef UINT8_MAX
82 #define UINT8_MAX              (255U)
83 #endif
84 #ifndef UINT16_MAX
85 #define UINT16_MAX             (65535U)
86 #endif
87 #ifndef UINT32_MAX
88 #define UINT32_MAX             (4294967295U)
89 #endif
90 
91 #endif /* ! C99 */
92 
93 #endif /* ! FLEXINT_H */
94 
95 /* begin standard C++ headers. */
96 #include <iostream>
97 #include <errno.h>
98 #include <cstdlib>
99 #include <cstdio>
100 #include <cstring>
101 /* end standard C++ headers. */
102 
103 #ifdef __cplusplus
104 
105 /* The "const" storage-class-modifier is valid. */
106 #define YY_USE_CONST
107 
108 #else  /* ! __cplusplus */
109 
110 /* C99 requires __STDC__ to be defined as 1. */
111 #if defined (__STDC__)
112 
113 #define YY_USE_CONST
114 
115 #endif  /* defined (__STDC__) */
116 #endif  /* ! __cplusplus */
117 
118 #ifdef YY_USE_CONST
119 #define yyconst const
120 #else
121 #define yyconst
122 #endif
123 
124 /* Returned upon end-of-file. */
125 #define YY_NULL 0
126 
127 /* Promotes a possibly negative, possibly signed char to an unsigned
128  * integer for use as an array index.  If the signed char is negative,
129  * we want to instead treat it as an 8-bit unsigned char, hence the
130  * double cast.
131  */
132 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
133 
134 /* Enter a start condition.  This macro really ought to take a parameter,
135  * but we do it the disgusting crufty way forced on us by the ()-less
136  * definition of BEGIN.
137  */
138 #define BEGIN (yy_start) = 1 + 2 *
139 
140 /* Translate the current start state into a value that can be later handed
141  * to BEGIN to return to the state.  The YYSTATE alias is for lex
142  * compatibility.
143  */
144 #define YY_START (((yy_start) - 1) / 2)
145 #define YYSTATE YY_START
146 
147 /* Action number for EOF rule of a given start state. */
148 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
149 
150 /* Special action meaning "start processing a new file". */
151 #define YY_NEW_FILE yyrestart( yyin  )
152 
153 #define YY_END_OF_BUFFER_CHAR 0
154 
155 /* Size of default input buffer. */
156 #ifndef YY_BUF_SIZE
157 #ifdef __ia64__
158 /* On IA-64, the buffer size is 16k, not 8k.
159  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
160  * Ditto for the __ia64__ case accordingly.
161  */
162 #define YY_BUF_SIZE 32768
163 #else
164 #define YY_BUF_SIZE 16384
165 #endif /* __ia64__ */
166 #endif
167 
168 /* The state buf must be large enough to hold one state per character in the main buffer.
169  */
170 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
171 
172 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
173 #define YY_TYPEDEF_YY_BUFFER_STATE
174 typedef struct yy_buffer_state *YY_BUFFER_STATE;
175 #endif
176 
177 extern int yyleng;
178 
179 #define EOB_ACT_CONTINUE_SCAN 0
180 #define EOB_ACT_END_OF_FILE 1
181 #define EOB_ACT_LAST_MATCH 2
182 
183     #define YY_LESS_LINENO(n)
184 
185 /* Return all but the first "n" matched characters back to the input stream. */
186 #define yyless(n) \
187   do \
188     { \
189     /* Undo effects of setting up yytext. */ \
190         int yyless_macro_arg = (n); \
191         YY_LESS_LINENO(yyless_macro_arg);\
192     *yy_cp = (yy_hold_char); \
193     YY_RESTORE_YY_MORE_OFFSET \
194     (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
195     YY_DO_BEFORE_ACTION; /* set up yytext again */ \
196     } \
197   while ( 0 )
198 
199 #define unput(c) yyunput( c, (yytext_ptr)  )
200 
201 #ifndef YY_TYPEDEF_YY_SIZE_T
202 #define YY_TYPEDEF_YY_SIZE_T
203 typedef size_t yy_size_t;
204 #endif
205 
206 #ifndef YY_STRUCT_YY_BUFFER_STATE
207 #define YY_STRUCT_YY_BUFFER_STATE
208 struct yy_buffer_state
209   {
210 
211   std::istream* yy_input_file;
212 
213   char *yy_ch_buf;    /* input buffer */
214   char *yy_buf_pos;    /* current position in input buffer */
215 
216   /* Size of input buffer in bytes, not including room for EOB
217    * characters.
218    */
219   yy_size_t yy_buf_size;
220 
221   /* Number of characters read into yy_ch_buf, not including EOB
222    * characters.
223    */
224   int yy_n_chars;
225 
226   /* Whether we "own" the buffer - i.e., we know we created it,
227    * and can realloc() it to grow it, and should free() it to
228    * delete it.
229    */
230   int yy_is_our_buffer;
231 
232   /* Whether this is an "interactive" input source; if so, and
233    * if we're using stdio for input, then we want to use getc()
234    * instead of fread(), to make sure we stop fetching input after
235    * each newline.
236    */
237   int yy_is_interactive;
238 
239   /* Whether we're considered to be at the beginning of a line.
240    * If so, '^' rules will be active on the next match, otherwise
241    * not.
242    */
243   int yy_at_bol;
244 
245     int yy_bs_lineno; /**< The line count. */
246     int yy_bs_column; /**< The column count. */
247 
248   /* Whether to try to fill the input buffer when we reach the
249    * end of it.
250    */
251   int yy_fill_buffer;
252 
253   int yy_buffer_status;
254 
255 #define YY_BUFFER_NEW 0
256 #define YY_BUFFER_NORMAL 1
257   /* When an EOF's been seen but there's still some text to process
258    * then we mark the buffer as YY_EOF_PENDING, to indicate that we
259    * shouldn't try reading from the input source any more.  We might
260    * still have a bunch of tokens to match, though, because of
261    * possible backing-up.
262    *
263    * When we actually see the EOF, we change the status to "new"
264    * (via yyrestart()), so that the user can continue scanning by
265    * just pointing yyin at a new input file.
266    */
267 #define YY_BUFFER_EOF_PENDING 2
268 
269   };
270 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
271 
272 /* We provide macros for accessing buffer states in case in the
273  * future we want to put the buffer states in a more general
274  * "scanner state".
275  *
276  * Returns the top of the stack, or NULL.
277  */
278 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
279                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
280                           : NULL)
281 
282 /* Same as previous macro, but useful when we know that the buffer stack is not
283  * NULL or when we need an lvalue. For internal use only.
284  */
285 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
286 
287 void *Slamalloc (yy_size_t  );
288 void *Slamrealloc (void *,yy_size_t  );
289 void Slamfree (void *  );
290 
291 #define yy_new_buffer yy_create_buffer
292 
293 #define yy_set_interactive(is_interactive) \
294   { \
295   if ( ! YY_CURRENT_BUFFER ){ \
296         yyensure_buffer_stack (); \
297     YY_CURRENT_BUFFER_LVALUE =    \
298             yy_create_buffer( yyin, YY_BUF_SIZE ); \
299   } \
300   YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
301   }
302 
303 #define yy_set_bol(at_bol) \
304   { \
305   if ( ! YY_CURRENT_BUFFER ){\
306         yyensure_buffer_stack (); \
307     YY_CURRENT_BUFFER_LVALUE =    \
308             yy_create_buffer( yyin, YY_BUF_SIZE ); \
309   } \
310   YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
311   }
312 
313 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
314 
315 /* Begin user sect3 */
316 
317 typedef unsigned char YY_CHAR;
318 
319 #define yytext_ptr yytext
320 
321 #include <FlexLexer.h>
322 
323 /* Done after the current pattern has been matched and before the
324  * corresponding action - sets up yytext.
325  */
326 #define YY_DO_BEFORE_ACTION \
327   (yytext_ptr) = yy_bp; \
328   yyleng = (size_t) (yy_cp - yy_bp); \
329   (yy_hold_char) = *yy_cp; \
330   *yy_cp = '\0'; \
331   (yy_c_buf_p) = yy_cp;
332 
333 #define YY_NUM_RULES 15
334 #define YY_END_OF_BUFFER 16
335 /* This struct is not used in this scanner,
336    but its presence is necessary. */
337 struct yy_trans_info
338   {
339   flex_int32_t yy_verify;
340   flex_int32_t yy_nxt;
341   };
342 static yyconst flex_int16_t yy_accept[77] =
343     {   0,
344         0,    0,   16,   14,   12,   13,   14,   14,    1,   11,
345        11,   11,   11,   11,   11,   11,   12,    0,    1,    2,
346         2,    1,    0,   11,   11,   11,   11,   11,   11,   11,
347         2,    0,    2,    3,   11,    8,   11,   11,   11,   11,
348        11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
349        11,   11,   11,   11,   11,    6,   11,   11,   11,   11,
350        11,   11,   11,   11,   11,   11,   11,    4,   11,    7,
351        10,    9,   11,   11,    5,    0
352     } ;
353 
354 static yyconst flex_int32_t yy_ec[256] =
355     {   0,
356         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
357         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
358         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
359         1,    2,    1,    1,    1,    1,    1,    1,    1,    1,
360         1,    1,    4,    5,    6,    7,    1,    8,    8,    8,
361         8,    8,    8,    8,    8,    8,    8,    1,    1,    1,
362         1,    1,    1,    1,    9,   10,   10,   11,   12,   13,
363        14,   10,   15,   10,   10,   16,   10,   10,   17,   18,
364        19,   20,   21,   22,   23,   24,   10,   25,   26,   27,
365         1,    1,    1,    1,   28,    1,   29,   10,   10,   30,
366 
367        31,   32,   33,   10,   34,   10,   10,   35,   10,   10,
368        36,   37,   38,   39,   40,   41,   42,   43,   10,   44,
369        45,   46,    1,    1,    1,    1,    1,    1,    1,    1,
370         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
371         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
372         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
373         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
374         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
375         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
376         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
377 
378         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
379         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
380         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
381         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
382         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
383         1,    1,    1,    1,    1
384     } ;
385 
386 static yyconst flex_int32_t yy_meta[47] =
387     {   0,
388         1,    1,    1,    1,    2,    2,    2,    2,    2,    2,
389         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
390         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
391         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
392         2,    2,    2,    2,    2,    2
393     } ;
394 
395 static yyconst flex_int16_t yy_base[78] =
396     {   0,
397         0,    0,  170,  173,  167,  173,   40,  160,   42,   40,
398         0,   41,   38,   32,   39,   45,  163,  153,   51,   52,
399        53,   73,   82,    0,   57,   63,   53,   67,   73,   71,
400        87,  147,  146,    0,   80,    0,   73,   70,   78,  103,
401        75,   90,   91,   80,   41,   39,   81,   81,   88,   93,
402        38,  105,   93,   94,   92,    0,  103,  120,  121,  111,
403       120,  117,  118,  121,  115,  132,  133,    0,  127,    0,
404         0,    0,  134,  127,    0,  173,   60
405     } ;
406 
407 static yyconst flex_int16_t yy_def[78] =
408     {   0,
409        76,    1,   76,   76,   76,   76,   76,   76,   76,   77,
410        77,   77,   77,   77,   77,   77,   76,   76,   76,   76,
411        76,   76,   76,   77,   77,   77,   77,   77,   77,   77,
412        76,   76,   76,   77,   77,   77,   77,   77,   77,   77,
413        77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
414        77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
415        77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
416        77,   77,   77,   77,   77,    0,   76
417     } ;
418 
419 static yyconst flex_int16_t yy_nxt[220] =
420     {   0,
421         4,    5,    6,    7,    4,    7,    8,    9,   10,   11,
422        11,   12,   13,   11,   11,   11,   11,   11,   14,   11,
423        15,   11,   11,   16,   11,   11,   11,    4,   10,   11,
424        12,   13,   11,   11,   11,   11,   11,   14,   11,   15,
425        11,   11,   16,   11,   11,   11,   18,   19,   21,   22,
426        25,   26,   27,   23,   28,   29,   30,   21,   22,   20,
427        31,   24,   23,   23,   23,   55,   50,   34,   49,   25,
428        26,   27,   23,   28,   29,   30,   35,   36,   37,   21,
429        22,   23,   23,   23,   23,   32,   34,   32,   38,   33,
430        39,   40,   41,   42,   31,   35,   36,   37,   23,   43,
431 
432        45,   46,   47,   23,   48,   51,   52,   38,   53,   39,
433        40,   41,   42,   54,   58,   59,   60,   23,   43,   45,
434        46,   47,   61,   48,   51,   52,   56,   53,   62,   63,
435        44,   57,   54,   58,   59,   60,   64,   65,   66,   67,
436        70,   61,   68,   71,   72,   56,   73,   69,   62,   63,
437        57,   74,   75,   33,   33,   64,   65,   66,   67,   70,
438        20,   68,   71,   72,   17,   73,   69,   20,   17,   76,
439        74,   75,    3,   76,   76,   76,   76,   76,   76,   76,
440        76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
441        76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
442 
443        76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
444        76,   76,   76,   76,   76,   76,   76,   76,   76
445     } ;
446 
447 static yyconst flex_int16_t yy_chk[220] =
448     {   0,
449         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
450         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
451         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
452         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
453         1,    1,    1,    1,    1,    1,    7,    7,    9,    9,
454        10,   12,   13,    9,   14,   15,   16,   19,   19,   20,
455        21,   77,   19,   20,   21,   51,   46,   25,   45,   10,
456        12,   13,    9,   14,   15,   16,   26,   27,   28,   22,
457        22,   19,   20,   21,   22,   23,   25,   23,   29,   23,
458        30,   35,   37,   38,   31,   26,   27,   28,   31,   39,
459 
460        41,   42,   43,   22,   44,   47,   48,   29,   49,   30,
461        35,   37,   38,   50,   53,   54,   55,   31,   39,   41,
462        42,   43,   57,   44,   47,   48,   52,   49,   58,   59,
463        40,   52,   50,   53,   54,   55,   60,   61,   62,   63,
464        65,   57,   64,   66,   67,   52,   69,   64,   58,   59,
465        52,   73,   74,   33,   32,   60,   61,   62,   63,   65,
466        18,   64,   66,   67,   17,   69,   64,    8,    5,    3,
467        73,   74,   76,   76,   76,   76,   76,   76,   76,   76,
468        76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
469        76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
470 
471        76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
472        76,   76,   76,   76,   76,   76,   76,   76,   76
473     } ;
474 
475 /* The intent behind this definition is that it'll catch
476  * any uses of REJECT which flex missed.
477  */
478 #define REJECT reject_used_but_not_detected
479 #define yymore() yymore_used_but_not_detected
480 #define YY_MORE_ADJ 0
481 #define YY_RESTORE_YY_MORE_OFFSET
482 #line 1 "scanner.l"
483 #line 2 "scanner.l"
484 
485 #include <vector>
486 #include <string>
487 
488 #include "scanner.h"
489 
490 /* import the parser's token type into a local typedef */
491 typedef SlamParser::Parser::token token;
492 typedef SlamParser::Parser::token_type token_type;
493 
494 /* By default yylex returns int, we use token_type. Unfortunately yyterminate
495  * by default returns 0, which is not of token_type. */
496 #define yyterminate() return token::END
497 
498 /* This disables inclusion of unistd.h, which is not available under Visual C++
499  * on Win32. The C++ scanner uses STL streams instead. */
500 #define YY_NO_UNISTD_H
501 
502 /*** Flex Declarations and Options ***/
503 /* enable c++ scanner class generation */
504 /* change the name of the scanner class. results in "SlamFlexLexer" */
505 /* the manual says "somewhat more optimized" */
506 /* enable scanner to generate debug output. disable this for release
507  * versions. */
508 /*%option debug*/
509 /* no support for include files is planned */
510 /* enables the use of start condition stacks */
511 /* The following paragraph suffices to track locations accurately. Each time
512  * yylex is invoked, the begin position is moved onto the end position. */
513 #line 46 "scanner.l"
514 #define YY_USER_ACTION  yylloc->columns(yyleng);
515 #line 516 "flex_scanner.cpp"
516 
517 #define INITIAL 0
518 
519 #ifndef YY_NO_UNISTD_H
520 /* Special case for "unistd.h", since it is non-ANSI. We include it way
521  * down here because we want the user's section 1 to have been scanned first.
522  * The user has a chance to override it with an option.
523  */
524 #include <unistd.h>
525 #endif
526 
527 #ifndef YY_EXTRA_TYPE
528 #define YY_EXTRA_TYPE void *
529 #endif
530 
531 #ifndef yytext_ptr
532 static void yy_flex_strncpy (char *,yyconst char *,int );
533 #endif
534 
535 #ifdef YY_NEED_STRLEN
536 static int yy_flex_strlen (yyconst char * );
537 #endif
538 
539 #ifndef YY_NO_INPUT
540 
541 #endif
542 
543 /* Amount of stuff to slurp up with each read. */
544 #ifndef YY_READ_BUF_SIZE
545 #ifdef __ia64__
546 /* On IA-64, the buffer size is 16k, not 8k */
547 #define YY_READ_BUF_SIZE 16384
548 #else
549 #define YY_READ_BUF_SIZE 8192
550 #endif /* __ia64__ */
551 #endif
552 
553 /* Copy whatever the last rule matched to the standard output. */
554 #ifndef ECHO
555 #define ECHO LexerOutput( yytext, yyleng )
556 #endif
557 
558 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
559  * is returned in "result".
560  */
561 #ifndef YY_INPUT
562 #define YY_INPUT(buf,result,max_size) \
563 \
564   if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
565     YY_FATAL_ERROR( "input in flex scanner failed" );
566 
567 #endif
568 
569 /* No semi-colon after return; correct usage is to write "yyterminate();" -
570  * we don't want an extra ';' after the "return" because that will cause
571  * some compilers to complain about unreachable statements.
572  */
573 #ifndef yyterminate
574 #define yyterminate() return YY_NULL
575 #endif
576 
577 /* Number of entries by which start-condition stack grows. */
578 #ifndef YY_START_STACK_INCR
579 #define YY_START_STACK_INCR 25
580 #endif
581 
582 /* Report a fatal error. */
583 #ifndef YY_FATAL_ERROR
584 #define YY_FATAL_ERROR(msg) LexerError( msg )
585 #endif
586 
587 /* end tables serialization structures and prototypes */
588 
589 /* Default declaration of generated scanner - a define so the user can
590  * easily add parameters.
591  */
592 #ifndef YY_DECL
593 #define YY_DECL_IS_OURS 1
594 #define YY_DECL int yyFlexLexer::yylex()
595 #endif /* !YY_DECL */
596 
597 /* Code executed at the beginning of each rule, after yytext and yyleng
598  * have been set up.
599  */
600 #ifndef YY_USER_ACTION
601 #define YY_USER_ACTION
602 #endif
603 
604 /* Code executed at the end of each rule. */
605 #ifndef YY_BREAK
606 #define YY_BREAK break;
607 #endif
608 
609 #define YY_RULE_SETUP \
610   YY_USER_ACTION
611 
612 /** The main scanner function which does all the work.
613  */
614 YY_DECL
615 {
616   yy_state_type yy_current_state;
617   char *yy_cp, *yy_bp;
618   int yy_act;
619 
620 #line 49 "scanner.l"
621 
622 
623  /* code to place at the beginning of yylex() */
624 
625     // reset location
626     yylloc->step();
627 
628 
629  /*** BEGIN EXAMPLE - Change the example lexer rules below ***/
630 
631 #line 632 "flex_scanner.cpp"
632 
633   if ( !(yy_init) )
634     {
635     (yy_init) = 1;
636 
637 #ifdef YY_USER_INIT
638     YY_USER_INIT;
639 #endif
640 
641     if ( ! (yy_start) )
642       (yy_start) = 1;  /* first start state */
643 
644     if ( ! yyin )
645       yyin = & std::cin;
646 
647     if ( ! yyout )
648       yyout = & std::cout;
649 
650     if ( ! YY_CURRENT_BUFFER ) {
651       yyensure_buffer_stack ();
652       YY_CURRENT_BUFFER_LVALUE =
653         yy_create_buffer( yyin, YY_BUF_SIZE );
654     }
655 
656     yy_load_buffer_state(  );
657     }
658 
659   while ( 1 )    /* loops until end-of-file is reached */
660     {
661     yy_cp = (yy_c_buf_p);
662 
663     /* Support of yytext. */
664     *yy_cp = (yy_hold_char);
665 
666     /* yy_bp points to the position in yy_ch_buf of the start of
667      * the current run.
668      */
669     yy_bp = yy_cp;
670 
671     yy_current_state = (yy_start);
672 yy_match:
673     do
674       {
675       YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
676       if ( yy_accept[yy_current_state] )
677         {
678         (yy_last_accepting_state) = yy_current_state;
679         (yy_last_accepting_cpos) = yy_cp;
680         }
681       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
682         {
683         yy_current_state = (int) yy_def[yy_current_state];
684         if ( yy_current_state >= 77 )
685           yy_c = yy_meta[(unsigned int) yy_c];
686         }
687       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
688       ++yy_cp;
689       }
690     while ( yy_current_state != 76 );
691     yy_cp = (yy_last_accepting_cpos);
692     yy_current_state = (yy_last_accepting_state);
693 
694 yy_find_action:
695     yy_act = yy_accept[yy_current_state];
696 
697     YY_DO_BEFORE_ACTION;
698 
699 do_action:  /* This label is used only to access EOF actions. */
700 
701     switch ( yy_act )
702   { /* beginning of action switch */
703       case 0: /* must back up */
704       /* undo the effects of YY_DO_BEFORE_ACTION */
705       *yy_cp = (yy_hold_char);
706       yy_cp = (yy_last_accepting_cpos);
707       yy_current_state = (yy_last_accepting_state);
708       goto yy_find_action;
709 
710 case 1:
711 YY_RULE_SETUP
712 #line 59 "scanner.l"
713 {
714   yylval->integerVal = atoi(yytext);
715   return token::INTEGER;
716 }
717   YY_BREAK
718 case 2:
719 YY_RULE_SETUP
720 #line 64 "scanner.l"
721 {
722   yylval->doubleVal = atof(yytext);
723   return token::DOUBLE;
724 }
725   YY_BREAK
726 case 3:
727 YY_RULE_SETUP
728 #line 69 "scanner.l"
729 {
730   /*yylval->stringVal = new std::string(yytext, yyleng);*/
731   return token::ADD;
732 }
733   YY_BREAK
734 case 4:
735 YY_RULE_SETUP
736 #line 74 "scanner.l"
737 {
738   yylval->stringVal = new std::string(yytext, yyleng);
739   return token::V_SE2;
740 }
741   YY_BREAK
742 case 5:
743 YY_RULE_SETUP
744 #line 79 "scanner.l"
745 {
746   yylval->stringVal = new std::string(yytext, yyleng);
747   return token::V_SE3;
748 }
749   YY_BREAK
750 case 6:
751 YY_RULE_SETUP
752 #line 84 "scanner.l"
753 {
754   yylval->stringVal = new std::string(yytext, yyleng);
755   return token::E_SE2;
756 }
757   YY_BREAK
758 case 7:
759 YY_RULE_SETUP
760 #line 89 "scanner.l"
761 {
762   yylval->stringVal = new std::string(yytext, yyleng);
763   return token::E_SE3;
764 }
765   YY_BREAK
766 case 8:
767 YY_RULE_SETUP
768 #line 94 "scanner.l"
769 {
770   /*yylval->stringVal = new std::string(yytext, yyleng);*/
771   return token::FIX;
772 }
773   YY_BREAK
774 case 9:
775 YY_RULE_SETUP
776 #line 99 "scanner.l"
777 {
778   /*yylval->stringVal = new std::string(yytext, yyleng);*/
779   return token::SOLVE_STATE;
780 }
781   YY_BREAK
782 case 10:
783 YY_RULE_SETUP
784 #line 104 "scanner.l"
785 {
786   /*yylval->stringVal = new std::string(yytext, yyleng);*/
787   return token::QUERY_STATE;
788 }
789   YY_BREAK
790 case 11:
791 YY_RULE_SETUP
792 #line 109 "scanner.l"
793 {
794     yylval->stringVal = new std::string(yytext, yyleng);
795     return token::STRING;
796 }
797   YY_BREAK
798 /* gobble up white-spaces */
799 case 12:
800 YY_RULE_SETUP
801 #line 115 "scanner.l"
802 {
803     yylloc->step();
804 }
805   YY_BREAK
806 /* gobble up end-of-lines */
807 case 13:
808 /* rule 13 can match eol */
809 YY_RULE_SETUP
810 #line 120 "scanner.l"
811 {
812     yylloc->lines(yyleng); yylloc->step();
813     return token::EOL;
814 }
815   YY_BREAK
816 /* pass all other characters up to bison */
817 case 14:
818 YY_RULE_SETUP
819 #line 126 "scanner.l"
820 {
821     return static_cast<token_type>(*yytext);
822 }
823   YY_BREAK
824 /*** END EXAMPLE - Change the example lexer rules above ***/
825 case 15:
826 YY_RULE_SETUP
827 #line 132 "scanner.l"
828 ECHO;
829   YY_BREAK
830 #line 831 "flex_scanner.cpp"
831 case YY_STATE_EOF(INITIAL):
832   yyterminate();
833 
834   case YY_END_OF_BUFFER:
835     {
836     /* Amount of text matched not including the EOB char. */
837     int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
838 
839     /* Undo the effects of YY_DO_BEFORE_ACTION. */
840     *yy_cp = (yy_hold_char);
841     YY_RESTORE_YY_MORE_OFFSET
842 
843     if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
844       {
845       /* We're scanning a new file or input source.  It's
846        * possible that this happened because the user
847        * just pointed yyin at a new source and called
848        * yylex().  If so, then we have to assure
849        * consistency between YY_CURRENT_BUFFER and our
850        * globals.  Here is the right place to do so, because
851        * this is the first action (other than possibly a
852        * back-up) that will match for the new input source.
853        */
854       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
855       YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
856       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
857       }
858 
859     /* Note that here we test for yy_c_buf_p "<=" to the position
860      * of the first EOB in the buffer, since yy_c_buf_p will
861      * already have been incremented past the NUL character
862      * (since all states make transitions on EOB to the
863      * end-of-buffer state).  Contrast this with the test
864      * in input().
865      */
866     if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
867       { /* This was really a NUL. */
868       yy_state_type yy_next_state;
869 
870       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
871 
872       yy_current_state = yy_get_previous_state(  );
873 
874       /* Okay, we're now positioned to make the NUL
875        * transition.  We couldn't have
876        * yy_get_previous_state() go ahead and do it
877        * for us because it doesn't know how to deal
878        * with the possibility of jamming (and we don't
879        * want to build jamming into it because then it
880        * will run more slowly).
881        */
882 
883       yy_next_state = yy_try_NUL_trans( yy_current_state );
884 
885       yy_bp = (yytext_ptr) + YY_MORE_ADJ;
886 
887       if ( yy_next_state )
888         {
889         /* Consume the NUL. */
890         yy_cp = ++(yy_c_buf_p);
891         yy_current_state = yy_next_state;
892         goto yy_match;
893         }
894 
895       else
896         {
897         yy_cp = (yy_last_accepting_cpos);
898         yy_current_state = (yy_last_accepting_state);
899         goto yy_find_action;
900         }
901       }
902 
903     else switch ( yy_get_next_buffer(  ) )
904       {
905       case EOB_ACT_END_OF_FILE:
906         {
907         (yy_did_buffer_switch_on_eof) = 0;
908 
909         if ( yywrap(  ) )
910           {
911           /* Note: because we've taken care in
912            * yy_get_next_buffer() to have set up
913            * yytext, we can now set up
914            * yy_c_buf_p so that if some total
915            * hoser (like flex itself) wants to
916            * call the scanner after we return the
917            * YY_NULL, it'll still work - another
918            * YY_NULL will get returned.
919            */
920           (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
921 
922           yy_act = YY_STATE_EOF(YY_START);
923           goto do_action;
924           }
925 
926         else
927           {
928           if ( ! (yy_did_buffer_switch_on_eof) )
929             YY_NEW_FILE;
930           }
931         break;
932         }
933 
934       case EOB_ACT_CONTINUE_SCAN:
935         (yy_c_buf_p) =
936           (yytext_ptr) + yy_amount_of_matched_text;
937 
938         yy_current_state = yy_get_previous_state(  );
939 
940         yy_cp = (yy_c_buf_p);
941         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
942         goto yy_match;
943 
944       case EOB_ACT_LAST_MATCH:
945         (yy_c_buf_p) =
946         &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
947 
948         yy_current_state = yy_get_previous_state(  );
949 
950         yy_cp = (yy_c_buf_p);
951         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
952         goto yy_find_action;
953       }
954     break;
955     }
956 
957   default:
958     YY_FATAL_ERROR(
959       "fatal flex scanner internal error--no action found" );
960   } /* end of action switch */
961     } /* end of scanning one token */
962 } /* end of yylex */
963 
964 /* The contents of this function are C++ specific, so the () macro is not used.
965  */
966 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
967 {
968   yyin = arg_yyin;
969   yyout = arg_yyout;
970   yy_c_buf_p = 0;
971   yy_init = 0;
972   yy_start = 0;
973   yy_flex_debug = 0;
974   yylineno = 1;  // this will only get updated if %option yylineno
975 
976   yy_did_buffer_switch_on_eof = 0;
977 
978   yy_looking_for_trail_begin = 0;
979   yy_more_flag = 0;
980   yy_more_len = 0;
981   yy_more_offset = yy_prev_more_offset = 0;
982 
983   yy_start_stack_ptr = yy_start_stack_depth = 0;
984   yy_start_stack = NULL;
985 
986   yy_buffer_stack = 0;
987   yy_buffer_stack_top = 0;
988   yy_buffer_stack_max = 0;
989 
990   yy_state_buf = 0;
991 
992 }
993 
994 /* The contents of this function are C++ specific, so the () macro is not used.
995  */
~yyFlexLexer()996 yyFlexLexer::~yyFlexLexer()
997 {
998   delete [] yy_state_buf;
999   Slamfree(yy_start_stack  );
1000   yy_delete_buffer( YY_CURRENT_BUFFER );
1001   Slamfree(yy_buffer_stack  );
1002 }
1003 
1004 /* The contents of this function are C++ specific, so the () macro is not used.
1005  */
switch_streams(std::istream * new_in,std::ostream * new_out)1006 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1007 {
1008   if ( new_in )
1009     {
1010     yy_delete_buffer( YY_CURRENT_BUFFER );
1011     yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
1012     }
1013 
1014   if ( new_out )
1015     yyout = new_out;
1016 }
1017 
1018 #ifdef YY_INTERACTIVE
LexerInput(char * buf,int)1019 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1020 #else
1021 int yyFlexLexer::LexerInput( char* buf, int max_size )
1022 #endif
1023 {
1024   if ( yyin->eof() || yyin->fail() )
1025     return 0;
1026 
1027 #ifdef YY_INTERACTIVE
1028   yyin->get( buf[0] );
1029 
1030   if ( yyin->eof() )
1031     return 0;
1032 
1033   if ( yyin->bad() )
1034     return -1;
1035 
1036   return 1;
1037 
1038 #else
1039   (void) yyin->read( buf, max_size );
1040 
1041   if ( yyin->bad() )
1042     return -1;
1043   else
1044     return yyin->gcount();
1045 #endif
1046 }
1047 
LexerOutput(const char * buf,int size)1048 void yyFlexLexer::LexerOutput( const char* buf, int size )
1049 {
1050   (void) yyout->write( buf, size );
1051 }
1052 
1053 /* yy_get_next_buffer - try to read in a new buffer
1054  *
1055  * Returns a code representing an action:
1056  *  EOB_ACT_LAST_MATCH -
1057  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1058  *  EOB_ACT_END_OF_FILE - end of file
1059  */
yy_get_next_buffer()1060 int yyFlexLexer::yy_get_next_buffer()
1061 {
1062       char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1063   char *source = (yytext_ptr);
1064   int number_to_move, i;
1065   int ret_val;
1066 
1067   if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1068     YY_FATAL_ERROR(
1069     "fatal flex scanner internal error--end of buffer missed" );
1070 
1071   if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1072     { /* Don't try to fill the buffer, so this is an EOF. */
1073     if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1074       {
1075       /* We matched a single character, the EOB, so
1076        * treat this as a final EOF.
1077        */
1078       return EOB_ACT_END_OF_FILE;
1079       }
1080 
1081     else
1082       {
1083       /* We matched some text prior to the EOB, first
1084        * process it.
1085        */
1086       return EOB_ACT_LAST_MATCH;
1087       }
1088     }
1089 
1090   /* Try to read more data. */
1091 
1092   /* First move last chars to start of buffer. */
1093   number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1094 
1095   for ( i = 0; i < number_to_move; ++i )
1096     *(dest++) = *(source++);
1097 
1098   if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1099     /* don't do the read, it's not guaranteed to return an EOF,
1100      * just force an EOF
1101      */
1102     YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1103 
1104   else
1105     {
1106       int num_to_read =
1107       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1108 
1109     while ( num_to_read <= 0 )
1110       { /* Not enough room in the buffer - grow it. */
1111 
1112       /* just a shorter name for the current buffer */
1113       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1114 
1115       int yy_c_buf_p_offset =
1116         (int) ((yy_c_buf_p) - b->yy_ch_buf);
1117 
1118       if ( b->yy_is_our_buffer )
1119         {
1120         int new_size = b->yy_buf_size * 2;
1121 
1122         if ( new_size <= 0 )
1123           b->yy_buf_size += b->yy_buf_size / 8;
1124         else
1125           b->yy_buf_size *= 2;
1126 
1127         b->yy_ch_buf = (char *)
1128           /* Include room in for 2 EOB chars. */
1129           Slamrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
1130         }
1131       else
1132         /* Can't grow it, we don't own it. */
1133         b->yy_ch_buf = 0;
1134 
1135       if ( ! b->yy_ch_buf )
1136         YY_FATAL_ERROR(
1137         "fatal error - scanner input buffer overflow" );
1138 
1139       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1140 
1141       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1142             number_to_move - 1;
1143 
1144       }
1145 
1146     if ( num_to_read > YY_READ_BUF_SIZE )
1147       num_to_read = YY_READ_BUF_SIZE;
1148 
1149     /* Read in more data. */
1150     YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1151       (yy_n_chars), (size_t) num_to_read );
1152 
1153     YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1154     }
1155 
1156   if ( (yy_n_chars) == 0 )
1157     {
1158     if ( number_to_move == YY_MORE_ADJ )
1159       {
1160       ret_val = EOB_ACT_END_OF_FILE;
1161       yyrestart( yyin  );
1162       }
1163 
1164     else
1165       {
1166       ret_val = EOB_ACT_LAST_MATCH;
1167       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1168         YY_BUFFER_EOF_PENDING;
1169       }
1170     }
1171 
1172   else
1173     ret_val = EOB_ACT_CONTINUE_SCAN;
1174 
1175   if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1176     /* Extend the array by 50%, plus the number we really need. */
1177     yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1178     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) Slamrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
1179     if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1180       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1181   }
1182 
1183   (yy_n_chars) += number_to_move;
1184   YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1185   YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1186 
1187   (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1188 
1189   return ret_val;
1190 }
1191 
1192 /* yy_get_previous_state - get the state just before the EOB char was reached */
1193 
yy_get_previous_state()1194     yy_state_type yyFlexLexer::yy_get_previous_state()
1195 {
1196   yy_state_type yy_current_state;
1197   char *yy_cp;
1198 
1199   yy_current_state = (yy_start);
1200 
1201   for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1202     {
1203     YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1204     if ( yy_accept[yy_current_state] )
1205       {
1206       (yy_last_accepting_state) = yy_current_state;
1207       (yy_last_accepting_cpos) = yy_cp;
1208       }
1209     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1210       {
1211       yy_current_state = (int) yy_def[yy_current_state];
1212       if ( yy_current_state >= 77 )
1213         yy_c = yy_meta[(unsigned int) yy_c];
1214       }
1215     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1216     }
1217 
1218   return yy_current_state;
1219 }
1220 
1221 /* yy_try_NUL_trans - try to make a transition on the NUL character
1222  *
1223  * synopsis
1224  *  next_state = yy_try_NUL_trans( current_state );
1225  */
yy_try_NUL_trans(yy_state_type yy_current_state)1226     yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1227 {
1228   int yy_is_jam;
1229       char *yy_cp = (yy_c_buf_p);
1230 
1231   YY_CHAR yy_c = 1;
1232   if ( yy_accept[yy_current_state] )
1233     {
1234     (yy_last_accepting_state) = yy_current_state;
1235     (yy_last_accepting_cpos) = yy_cp;
1236     }
1237   while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1238     {
1239     yy_current_state = (int) yy_def[yy_current_state];
1240     if ( yy_current_state >= 77 )
1241       yy_c = yy_meta[(unsigned int) yy_c];
1242     }
1243   yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1244   yy_is_jam = (yy_current_state == 76);
1245 
1246   return yy_is_jam ? 0 : yy_current_state;
1247 }
1248 
yyunput(int c,char * yy_bp)1249     void yyFlexLexer::yyunput( int c, char* yy_bp)
1250 {
1251   char *yy_cp;
1252 
1253     yy_cp = (yy_c_buf_p);
1254 
1255   /* undo effects of setting up yytext */
1256   *yy_cp = (yy_hold_char);
1257 
1258   if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1259     { /* need to shift things up to make room */
1260     /* +2 for EOB chars. */
1261     int number_to_move = (yy_n_chars) + 2;
1262     char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1263           YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1264     char *source =
1265         &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1266 
1267     while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1268       *--dest = *--source;
1269 
1270     yy_cp += (int) (dest - source);
1271     yy_bp += (int) (dest - source);
1272     YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1273       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1274 
1275     if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1276       YY_FATAL_ERROR( "flex scanner push-back overflow" );
1277     }
1278 
1279   *--yy_cp = (char) c;
1280 
1281   (yytext_ptr) = yy_bp;
1282   (yy_hold_char) = *yy_cp;
1283   (yy_c_buf_p) = yy_cp;
1284 }
1285 
yyinput()1286     int yyFlexLexer::yyinput()
1287 {
1288   int c;
1289 
1290   *(yy_c_buf_p) = (yy_hold_char);
1291 
1292   if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1293     {
1294     /* yy_c_buf_p now points to the character we want to return.
1295      * If this occurs *before* the EOB characters, then it's a
1296      * valid NUL; if not, then we've hit the end of the buffer.
1297      */
1298     if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1299       /* This was really a NUL. */
1300       *(yy_c_buf_p) = '\0';
1301 
1302     else
1303       { /* need more input */
1304       int offset = (yy_c_buf_p) - (yytext_ptr);
1305       ++(yy_c_buf_p);
1306 
1307       switch ( yy_get_next_buffer(  ) )
1308         {
1309         case EOB_ACT_LAST_MATCH:
1310           /* This happens because yy_g_n_b()
1311            * sees that we've accumulated a
1312            * token and flags that we need to
1313            * try matching the token before
1314            * proceeding.  But for input(),
1315            * there's no matching to consider.
1316            * So convert the EOB_ACT_LAST_MATCH
1317            * to EOB_ACT_END_OF_FILE.
1318            */
1319 
1320           /* Reset buffer status. */
1321           yyrestart( yyin );
1322 
1323           /*FALLTHROUGH*/
1324 
1325         case EOB_ACT_END_OF_FILE:
1326           {
1327           if ( yywrap(  ) )
1328             return EOF;
1329 
1330           if ( ! (yy_did_buffer_switch_on_eof) )
1331             YY_NEW_FILE;
1332 #ifdef __cplusplus
1333           return yyinput();
1334 #else
1335           return input();
1336 #endif
1337           }
1338 
1339         case EOB_ACT_CONTINUE_SCAN:
1340           (yy_c_buf_p) = (yytext_ptr) + offset;
1341           break;
1342         }
1343       }
1344     }
1345 
1346   c = *(unsigned char *) (yy_c_buf_p);  /* cast for 8-bit char's */
1347   *(yy_c_buf_p) = '\0';  /* preserve yytext */
1348   (yy_hold_char) = *++(yy_c_buf_p);
1349 
1350   return c;
1351 }
1352 
1353 /** Immediately switch to a different input stream.
1354  * @param input_file A readable stream.
1355  *
1356  * @note This function does not reset the start condition to @c INITIAL .
1357  */
yyrestart(std::istream * input_file)1358     void yyFlexLexer::yyrestart( std::istream* input_file )
1359 {
1360 
1361   if ( ! YY_CURRENT_BUFFER ){
1362         yyensure_buffer_stack ();
1363     YY_CURRENT_BUFFER_LVALUE =
1364             yy_create_buffer( yyin, YY_BUF_SIZE );
1365   }
1366 
1367   yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1368   yy_load_buffer_state(  );
1369 }
1370 
1371 /** Switch to a different input buffer.
1372  * @param new_buffer The new input buffer.
1373  *
1374  */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)1375     void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1376 {
1377 
1378   /* TODO. We should be able to replace this entire function body
1379    * with
1380    *    yypop_buffer_state();
1381    *    yypush_buffer_state(new_buffer);
1382      */
1383   yyensure_buffer_stack ();
1384   if ( YY_CURRENT_BUFFER == new_buffer )
1385     return;
1386 
1387   if ( YY_CURRENT_BUFFER )
1388     {
1389     /* Flush out information for old buffer. */
1390     *(yy_c_buf_p) = (yy_hold_char);
1391     YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1392     YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1393     }
1394 
1395   YY_CURRENT_BUFFER_LVALUE = new_buffer;
1396   yy_load_buffer_state(  );
1397 
1398   /* We don't actually know whether we did this switch during
1399    * EOF (yywrap()) processing, but the only time this flag
1400    * is looked at is after yywrap() is called, so it's safe
1401    * to go ahead and always set it.
1402    */
1403   (yy_did_buffer_switch_on_eof) = 1;
1404 }
1405 
yy_load_buffer_state()1406     void yyFlexLexer::yy_load_buffer_state()
1407 {
1408       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1409   (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1410   yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1411   (yy_hold_char) = *(yy_c_buf_p);
1412 }
1413 
1414 /** Allocate and initialize an input buffer state.
1415  * @param file A readable stream.
1416  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1417  *
1418  * @return the allocated buffer state.
1419  */
yy_create_buffer(std::istream * file,int size)1420     YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1421 {
1422   YY_BUFFER_STATE b;
1423 
1424   b = (YY_BUFFER_STATE) Slamalloc(sizeof( struct yy_buffer_state )  );
1425   if ( ! b )
1426     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1427 
1428   b->yy_buf_size = size;
1429 
1430   /* yy_ch_buf has to be 2 characters longer than the size given because
1431    * we need to put in 2 end-of-buffer characters.
1432    */
1433   b->yy_ch_buf = (char *) Slamalloc(b->yy_buf_size + 2  );
1434   if ( ! b->yy_ch_buf )
1435     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1436 
1437   b->yy_is_our_buffer = 1;
1438 
1439   yy_init_buffer( b, file );
1440 
1441   return b;
1442 }
1443 
1444 /** Destroy the buffer.
1445  * @param b a buffer created with yy_create_buffer()
1446  *
1447  */
yy_delete_buffer(YY_BUFFER_STATE b)1448     void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1449 {
1450 
1451   if ( ! b )
1452     return;
1453 
1454   if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1455     YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1456 
1457   if ( b->yy_is_our_buffer )
1458     Slamfree((void *) b->yy_ch_buf  );
1459 
1460   Slamfree((void *) b  );
1461 }
1462 
1463 extern "C" int isatty (int );
1464 
1465 /* Initializes or reinitializes a buffer.
1466  * This function is sometimes called more than once on the same buffer,
1467  * such as during a yyrestart() or at EOF.
1468  */
yy_init_buffer(YY_BUFFER_STATE b,std::istream * file)1469     void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
1470 
1471 {
1472   int oerrno = errno;
1473 
1474   yy_flush_buffer( b );
1475 
1476   b->yy_input_file = file;
1477   b->yy_fill_buffer = 1;
1478 
1479     /* If b is the current buffer, then yy_init_buffer was _probably_
1480      * called from yyrestart() or through yy_get_next_buffer.
1481      * In that case, we don't want to reset the lineno or column.
1482      */
1483     if (b != YY_CURRENT_BUFFER){
1484         b->yy_bs_lineno = 1;
1485         b->yy_bs_column = 0;
1486     }
1487 
1488   b->yy_is_interactive = 0;
1489   errno = oerrno;
1490 }
1491 
1492 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1493  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1494  *
1495  */
yy_flush_buffer(YY_BUFFER_STATE b)1496     void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1497 {
1498       if ( ! b )
1499     return;
1500 
1501   b->yy_n_chars = 0;
1502 
1503   /* We always need two end-of-buffer characters.  The first causes
1504    * a transition to the end-of-buffer state.  The second causes
1505    * a jam in that state.
1506    */
1507   b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1508   b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1509 
1510   b->yy_buf_pos = &b->yy_ch_buf[0];
1511 
1512   b->yy_at_bol = 1;
1513   b->yy_buffer_status = YY_BUFFER_NEW;
1514 
1515   if ( b == YY_CURRENT_BUFFER )
1516     yy_load_buffer_state(  );
1517 }
1518 
1519 /** Pushes the new state onto the stack. The new state becomes
1520  *  the current state. This function will allocate the stack
1521  *  if necessary.
1522  *  @param new_buffer The new state.
1523  *
1524  */
yypush_buffer_state(YY_BUFFER_STATE new_buffer)1525 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
1526 {
1527       if (new_buffer == NULL)
1528     return;
1529 
1530   yyensure_buffer_stack();
1531 
1532   /* This block is copied from yy_switch_to_buffer. */
1533   if ( YY_CURRENT_BUFFER )
1534     {
1535     /* Flush out information for old buffer. */
1536     *(yy_c_buf_p) = (yy_hold_char);
1537     YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1538     YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1539     }
1540 
1541   /* Only push if top exists. Otherwise, replace top. */
1542   if (YY_CURRENT_BUFFER)
1543     (yy_buffer_stack_top)++;
1544   YY_CURRENT_BUFFER_LVALUE = new_buffer;
1545 
1546   /* copied from yy_switch_to_buffer. */
1547   yy_load_buffer_state(  );
1548   (yy_did_buffer_switch_on_eof) = 1;
1549 }
1550 
1551 /** Removes and deletes the top of the stack, if present.
1552  *  The next element becomes the new top.
1553  *
1554  */
yypop_buffer_state(void)1555 void yyFlexLexer::yypop_buffer_state (void)
1556 {
1557       if (!YY_CURRENT_BUFFER)
1558     return;
1559 
1560   yy_delete_buffer(YY_CURRENT_BUFFER );
1561   YY_CURRENT_BUFFER_LVALUE = NULL;
1562   if ((yy_buffer_stack_top) > 0)
1563     --(yy_buffer_stack_top);
1564 
1565   if (YY_CURRENT_BUFFER) {
1566     yy_load_buffer_state(  );
1567     (yy_did_buffer_switch_on_eof) = 1;
1568   }
1569 }
1570 
1571 /* Allocates the stack if it does not exist.
1572  *  Guarantees space for at least one push.
1573  */
yyensure_buffer_stack(void)1574 void yyFlexLexer::yyensure_buffer_stack(void)
1575 {
1576   int num_to_alloc;
1577 
1578   if (!(yy_buffer_stack)) {
1579 
1580     /* First allocation is just for 2 elements, since we don't know if this
1581      * scanner will even need a stack. We use 2 instead of 1 to avoid an
1582      * immediate realloc on the next call.
1583          */
1584     num_to_alloc = 1;
1585     (yy_buffer_stack) = (struct yy_buffer_state**)Slamalloc
1586                 (num_to_alloc * sizeof(struct yy_buffer_state*)
1587                 );
1588     if ( ! (yy_buffer_stack) )
1589       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1590 
1591     memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1592 
1593     (yy_buffer_stack_max) = num_to_alloc;
1594     (yy_buffer_stack_top) = 0;
1595     return;
1596   }
1597 
1598   if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1599 
1600     /* Increase the buffer to prepare for a possible push. */
1601     int grow_size = 8 /* arbitrary grow size */;
1602 
1603     num_to_alloc = (yy_buffer_stack_max) + grow_size;
1604     (yy_buffer_stack) = (struct yy_buffer_state**)Slamrealloc
1605                 ((yy_buffer_stack),
1606                 num_to_alloc * sizeof(struct yy_buffer_state*)
1607                 );
1608     if ( ! (yy_buffer_stack) )
1609       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1610 
1611     /* zero only the new slots.*/
1612     memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1613     (yy_buffer_stack_max) = num_to_alloc;
1614   }
1615 }
1616 
yy_push_state(int new_state)1617     void yyFlexLexer::yy_push_state( int new_state )
1618 {
1619       if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
1620     {
1621     yy_size_t new_size;
1622 
1623     (yy_start_stack_depth) += YY_START_STACK_INCR;
1624     new_size = (yy_start_stack_depth) * sizeof( int );
1625 
1626     if ( ! (yy_start_stack) )
1627       (yy_start_stack) = (int *) Slamalloc(new_size  );
1628 
1629     else
1630       (yy_start_stack) = (int *) Slamrealloc((void *) (yy_start_stack),new_size  );
1631 
1632     if ( ! (yy_start_stack) )
1633       YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
1634     }
1635 
1636   (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
1637 
1638   BEGIN(new_state);
1639 }
1640 
yy_pop_state()1641     void yyFlexLexer::yy_pop_state()
1642 {
1643       if ( --(yy_start_stack_ptr) < 0 )
1644     YY_FATAL_ERROR( "start-condition stack underflow" );
1645 
1646   BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
1647 }
1648 
yy_top_state()1649     int yyFlexLexer::yy_top_state()
1650 {
1651       return (yy_start_stack)[(yy_start_stack_ptr) - 1];
1652 }
1653 
1654 #ifndef YY_EXIT_FAILURE
1655 #define YY_EXIT_FAILURE 2
1656 #endif
1657 
LexerError(yyconst char msg[])1658 void yyFlexLexer::LexerError( yyconst char msg[] )
1659 {
1660       std::cerr << msg << std::endl;
1661   exit( YY_EXIT_FAILURE );
1662 }
1663 
1664 /* Redefine yyless() so it works in section 3 code. */
1665 
1666 #undef yyless
1667 #define yyless(n) \
1668   do \
1669     { \
1670     /* Undo effects of setting up yytext. */ \
1671         int yyless_macro_arg = (n); \
1672         YY_LESS_LINENO(yyless_macro_arg);\
1673     yytext[yyleng] = (yy_hold_char); \
1674     (yy_c_buf_p) = yytext + yyless_macro_arg; \
1675     (yy_hold_char) = *(yy_c_buf_p); \
1676     *(yy_c_buf_p) = '\0'; \
1677     yyleng = yyless_macro_arg; \
1678     } \
1679   while ( 0 )
1680 
1681 /* Accessor  methods (get/set functions) to struct members. */
1682 
1683 /*
1684  * Internal utility routines.
1685  */
1686 
1687 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,yyconst char * s2,int n)1688 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1689 {
1690   int i;
1691   for ( i = 0; i < n; ++i )
1692     s1[i] = s2[i];
1693 }
1694 #endif
1695 
1696 #ifdef YY_NEED_STRLEN
yy_flex_strlen(yyconst char * s)1697 static int yy_flex_strlen (yyconst char * s )
1698 {
1699   int n;
1700   for ( n = 0; s[n]; ++n )
1701     ;
1702 
1703   return n;
1704 }
1705 #endif
1706 
Slamalloc(yy_size_t size)1707 void *Slamalloc (yy_size_t  size )
1708 {
1709   return (void *) malloc( size );
1710 }
1711 
Slamrealloc(void * ptr,yy_size_t size)1712 void *Slamrealloc  (void * ptr, yy_size_t  size )
1713 {
1714   /* The cast to (char *) in the following accommodates both
1715    * implementations that use char* generic pointers, and those
1716    * that use void* generic pointers.  It works with the latter
1717    * because both ANSI C and C++ allow castless assignment from
1718    * any pointer type to void*, and deal with argument conversions
1719    * as though doing an assignment.
1720    */
1721   return (void *) realloc( (char *) ptr, size );
1722 }
1723 
Slamfree(void * ptr)1724 void Slamfree (void * ptr )
1725 {
1726   free( (char *) ptr );  /* see Slamrealloc() for (char *) cast */
1727 }
1728 
1729 #define YYTABLES_NAME "yytables"
1730 
1731 #line 132 "scanner.l"
1732 
1733 
1734 
1735 namespace SlamParser {
1736 
Scanner(std::istream * in,std::ostream * out)1737 Scanner::Scanner(std::istream* in,
1738      std::ostream* out)
1739     : SlamFlexLexer(in, out)
1740 {
1741 }
1742 
~Scanner()1743 Scanner::~Scanner()
1744 {
1745 }
1746 
set_debug(bool b)1747 void Scanner::set_debug(bool b)
1748 {
1749     yy_flex_debug = b;
1750 }
1751 
1752 }
1753 
1754 #ifdef yylex
1755 #undef yylex
1756 #endif
1757 
yylex()1758 int SlamFlexLexer::yylex()
1759 {
1760     std::cerr << "in SlamFlexLexer::yylex() !" << std::endl;
1761     return 0;
1762 }
1763 
1764 /* When the scanner receives an end-of-file indication from YY_INPUT, it then
1765  * checks the yywrap() function. If yywrap() returns false (zero), then it is
1766  * assumed that the function has gone ahead and set up `yyin' to point to
1767  * another input file, and scanning continues. If it returns true (non-zero),
1768  * then the scanner terminates, returning 0 to its caller. */
1769 
yywrap()1770 int SlamFlexLexer::yywrap()
1771 {
1772     //std::cerr << "in SlamFlexLexer::yywrap() !" << std::endl;
1773     return 1;
1774 }
1775 
1776