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