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