2 #define YY_INT_ALIGNED short int
4 /* A lexical scanner generated by flex */
7 #define YY_FLEX_MAJOR_VERSION 2
8 #define YY_FLEX_MINOR_VERSION 6
9 #define YY_FLEX_SUBMINOR_VERSION 1
10 #if YY_FLEX_SUBMINOR_VERSION > 0
14 /* First, we deal with platform-specific or compiler-specific issues. */
16 /* begin standard C headers. */
22 /* end standard C headers. */
24 /* flex integer type definitions */
29 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
31 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
33 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
34 * if you want the limit (max/min) macros for int types.
36 #ifndef __STDC_LIMIT_MACROS
37 #define __STDC_LIMIT_MACROS 1
41 typedef int8_t flex_int8_t;
42 typedef uint8_t flex_uint8_t;
43 typedef int16_t flex_int16_t;
44 typedef uint16_t flex_uint16_t;
45 typedef int32_t flex_int32_t;
46 typedef uint32_t flex_uint32_t;
48 typedef signed char flex_int8_t;
49 typedef short int flex_int16_t;
50 typedef int flex_int32_t;
51 typedef unsigned char flex_uint8_t;
52 typedef unsigned short int flex_uint16_t;
53 typedef unsigned int flex_uint32_t;
55 /* Limits of integral types. */
57 #define INT8_MIN (-128)
60 #define INT16_MIN (-32767-1)
63 #define INT32_MIN (-2147483647-1)
66 #define INT8_MAX (127)
69 #define INT16_MAX (32767)
72 #define INT32_MAX (2147483647)
75 #define UINT8_MAX (255U)
78 #define UINT16_MAX (65535U)
81 #define UINT32_MAX (4294967295U)
86 #endif /* ! FLEXINT_H */
88 /* TODO: this is always defined, so inline it */
91 #if defined(__GNUC__) && __GNUC__ >= 3
92 #define yynoreturn __attribute__((__noreturn__))
97 /* Returned upon end-of-file. */
100 /* Promotes a possibly negative, possibly signed char to an unsigned
101 * integer for use as an array index. If the signed char is negative,
102 * we want to instead treat it as an 8-bit unsigned char, hence the
105 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
107 /* Enter a start condition. This macro really ought to take a parameter,
108 * but we do it the disgusting crufty way forced on us by the ()-less
109 * definition of BEGIN.
111 #define BEGIN (yy_start) = 1 + 2 *
113 /* Translate the current start state into a value that can be later handed
114 * to BEGIN to return to the state. The YYSTATE alias is for lex
117 #define YY_START (((yy_start) - 1) / 2)
118 #define YYSTATE YY_START
120 /* Action number for EOF rule of a given start state. */
121 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
123 /* Special action meaning "start processing a new file". */
124 #define YY_NEW_FILE yyrestart(yyin )
126 #define YY_END_OF_BUFFER_CHAR 0
128 /* Size of default input buffer. */
131 /* On IA-64, the buffer size is 16k, not 8k.
132 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
133 * Ditto for the __ia64__ case accordingly.
135 #define YY_BUF_SIZE 32768
137 #define YY_BUF_SIZE 16384
138 #endif /* __ia64__ */
141 /* The state buf must be large enough to hold one state per character in the main buffer.
143 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
145 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
146 #define YY_TYPEDEF_YY_BUFFER_STATE
147 typedef struct yy_buffer_state *YY_BUFFER_STATE;
150 #ifndef YY_TYPEDEF_YY_SIZE_T
151 #define YY_TYPEDEF_YY_SIZE_T
152 typedef size_t yy_size_t;
157 extern FILE *yyin, *yyout;
159 #define EOB_ACT_CONTINUE_SCAN 0
160 #define EOB_ACT_END_OF_FILE 1
161 #define EOB_ACT_LAST_MATCH 2
163 #define YY_LESS_LINENO(n)
164 #define YY_LINENO_REWIND_TO(ptr)
166 /* Return all but the first "n" matched characters back to the input stream. */
170 /* Undo effects of setting up yytext. */ \
171 int yyless_macro_arg = (n); \
172 YY_LESS_LINENO(yyless_macro_arg);\
173 *yy_cp = (yy_hold_char); \
174 YY_RESTORE_YY_MORE_OFFSET \
175 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
176 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
180 #define unput(c) yyunput( c, (yytext_ptr) )
182 #ifndef YY_STRUCT_YY_BUFFER_STATE
183 #define YY_STRUCT_YY_BUFFER_STATE
184 struct yy_buffer_state
188 char *yy_ch_buf; /* input buffer */
189 char *yy_buf_pos; /* current position in input buffer */
191 /* Size of input buffer in bytes, not including room for EOB
196 /* Number of characters read into yy_ch_buf, not including EOB
201 /* Whether we "own" the buffer - i.e., we know we created it,
202 * and can realloc() it to grow it, and should free() it to
205 int yy_is_our_buffer;
207 /* Whether this is an "interactive" input source; if so, and
208 * if we're using stdio for input, then we want to use getc()
209 * instead of fread(), to make sure we stop fetching input after
212 int yy_is_interactive;
214 /* Whether we're considered to be at the beginning of a line.
215 * If so, '^' rules will be active on the next match, otherwise
220 int yy_bs_lineno; /**< The line count. */
221 int yy_bs_column; /**< The column count. */
223 /* Whether to try to fill the input buffer when we reach the
228 int yy_buffer_status;
230 #define YY_BUFFER_NEW 0
231 #define YY_BUFFER_NORMAL 1
232 /* When an EOF's been seen but there's still some text to process
233 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
234 * shouldn't try reading from the input source any more. We might
235 * still have a bunch of tokens to match, though, because of
236 * possible backing-up.
238 * When we actually see the EOF, we change the status to "new"
239 * (via yyrestart()), so that the user can continue scanning by
240 * just pointing yyin at a new input file.
242 #define YY_BUFFER_EOF_PENDING 2
245 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
247 /* Stack of input buffers. */
248 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
249 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
250 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
252 /* We provide macros for accessing buffer states in case in the
253 * future we want to put the buffer states in a more general
256 * Returns the top of the stack, or NULL.
258 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
259 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
262 /* Same as previous macro, but useful when we know that the buffer stack is not
263 * NULL or when we need an lvalue. For internal use only.
265 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
267 /* yy_hold_char holds the character lost when yytext is formed. */
268 static char yy_hold_char;
269 static int yy_n_chars; /* number of characters read into yy_ch_buf */
272 /* Points to current character in buffer. */
273 static char *yy_c_buf_p = NULL;
274 static int yy_init = 0; /* whether we need to initialize */
275 static int yy_start = 0; /* start state number */
277 /* Flag which is used to allow yywrap()'s to do buffer switches
278 * instead of setting up a fresh yyin. A bit of a hack ...
280 static int yy_did_buffer_switch_on_eof;
282 void yyrestart (FILE *input_file );
283 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
284 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
285 void yy_delete_buffer (YY_BUFFER_STATE b );
286 void yy_flush_buffer (YY_BUFFER_STATE b );
287 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
288 void yypop_buffer_state (void );
290 static void yyensure_buffer_stack (void );
291 static void yy_load_buffer_state (void );
292 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
294 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
296 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
297 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
298 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
300 void *yyalloc (yy_size_t );
301 void *yyrealloc (void *,yy_size_t );
302 void yyfree (void * );
304 #define yy_new_buffer yy_create_buffer
306 #define yy_set_interactive(is_interactive) \
308 if ( ! YY_CURRENT_BUFFER ){ \
309 yyensure_buffer_stack (); \
310 YY_CURRENT_BUFFER_LVALUE = \
311 yy_create_buffer(yyin,YY_BUF_SIZE ); \
313 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
316 #define yy_set_bol(at_bol) \
318 if ( ! YY_CURRENT_BUFFER ){\
319 yyensure_buffer_stack (); \
320 YY_CURRENT_BUFFER_LVALUE = \
321 yy_create_buffer(yyin,YY_BUF_SIZE ); \
323 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
326 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
328 /* Begin user sect3 */
330 typedef unsigned char YY_CHAR;
332 FILE *yyin = NULL, *yyout = NULL;
334 typedef int yy_state_type;
344 #define yytext_ptr yytext
346 static yy_state_type yy_get_previous_state (void );
347 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
348 static int yy_get_next_buffer (void );
349 static void yynoreturn yy_fatal_error (yyconst char* msg );
351 /* Done after the current pattern has been matched and before the
352 * corresponding action - sets up yytext.
354 #define YY_DO_BEFORE_ACTION \
355 (yytext_ptr) = yy_bp; \
356 yyleng = (int) (yy_cp - yy_bp); \
357 (yy_hold_char) = *yy_cp; \
359 (yy_c_buf_p) = yy_cp;
361 #define YY_NUM_RULES 37
362 #define YY_END_OF_BUFFER 38
363 /* This struct is not used in this scanner,
364 but its presence is necessary. */
367 flex_int32_t yy_verify;
370 static yyconst flex_int16_t yy_accept[145] =
372 0, 0, 38, 36, 1, 3, 36, 36, 36, 31,
373 31, 29, 32, 36, 32, 32, 32, 36, 36, 36,
374 36, 36, 36, 36, 36, 36, 36, 36, 1, 3,
375 36, 0, 36, 36, 0, 2, 31, 32, 36, 36,
376 36, 36, 32, 36, 36, 36, 36, 36, 36, 36,
377 24, 36, 36, 36, 36, 7, 36, 36, 36, 36,
378 36, 36, 35, 35, 36, 0, 30, 36, 36, 16,
379 36, 36, 23, 28, 36, 36, 13, 36, 36, 22,
380 36, 36, 8, 10, 12, 36, 20, 36, 21, 36,
381 0, 33, 4, 36, 36, 36, 36, 36, 36, 36,
383 36, 19, 36, 36, 34, 34, 36, 36, 36, 36,
384 36, 36, 36, 14, 36, 36, 36, 5, 17, 36,
385 9, 36, 11, 36, 36, 36, 18, 26, 36, 36,
386 36, 36, 36, 6, 36, 36, 36, 36, 36, 25,
390 static yyconst YY_CHAR yy_ec[256] =
392 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
393 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
394 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
395 1, 2, 1, 5, 6, 1, 1, 1, 1, 1,
396 1, 1, 1, 1, 1, 7, 1, 8, 7, 9,
397 7, 7, 7, 7, 7, 7, 7, 1, 1, 1,
398 10, 1, 1, 1, 11, 11, 11, 11, 12, 12,
399 1, 1, 13, 1, 1, 1, 1, 14, 1, 1,
400 1, 1, 1, 15, 1, 1, 1, 1, 1, 1,
401 1, 1, 1, 1, 16, 1, 17, 18, 19, 20,
403 21, 22, 23, 24, 25, 1, 1, 26, 27, 28,
404 29, 30, 31, 32, 33, 34, 35, 36, 1, 37,
405 38, 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, 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,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
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,
422 static yyconst YY_CHAR yy_meta[39] =
424 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1
430 static yyconst flex_uint16_t yy_base[152] =
432 0, 0, 212, 0, 209, 213, 207, 37, 41, 38,
433 172, 0, 44, 194, 54, 78, 60, 186, 181, 45,
434 188, 177, 42, 47, 182, 41, 169, 0, 199, 213,
435 77, 195, 87, 91, 196, 213, 0, 88, 104, 183,
436 172, 161, 93, 168, 163, 173, 164, 171, 171, 165,
437 171, 156, 156, 160, 162, 0, 158, 152, 158, 155,
438 161, 160, 0, 213, 101, 172, 0, 165, 145, 158,
439 148, 155, 0, 0, 150, 150, 0, 148, 138, 0,
440 142, 137, 0, 0, 0, 140, 0, 131, 0, 158,
441 157, 0, 0, 142, 141, 134, 126, 136, 124, 130,
443 135, 0, 120, 114, 0, 213, 125, 129, 121, 123,
444 119, 121, 126, 0, 110, 110, 107, 0, 0, 109,
445 0, 93, 104, 98, 84, 84, 0, 0, 89, 77,
446 87, 71, 66, 0, 64, 62, 50, 47, 33, 0,
447 28, 0, 0, 213, 40, 129, 131, 133, 135, 137,
451 static yyconst flex_int16_t yy_def[152] =
453 144, 1, 144, 145, 144, 144, 145, 146, 147, 145,
454 10, 145, 10, 145, 10, 10, 10, 145, 145, 145,
455 145, 145, 145, 145, 145, 145, 145, 145, 144, 144,
456 146, 148, 149, 147, 150, 144, 10, 10, 10, 145,
457 145, 145, 10, 145, 145, 145, 145, 145, 145, 145,
458 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
459 145, 145, 145, 144, 149, 151, 39, 145, 145, 145,
460 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
461 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
462 144, 145, 145, 145, 145, 145, 145, 145, 145, 145,
464 145, 145, 145, 145, 145, 144, 145, 145, 145, 145,
465 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
466 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
467 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
468 145, 145, 145, 0, 144, 144, 144, 144, 144, 144,
472 static yyconst flex_uint16_t yy_nxt[252] =
474 4, 5, 6, 7, 8, 9, 10, 11, 10, 12,
475 13, 13, 14, 4, 4, 4, 13, 13, 15, 16,
476 17, 13, 18, 19, 20, 21, 22, 4, 23, 24,
477 4, 25, 26, 4, 27, 4, 4, 4, 32, 32,
478 28, 33, 35, 36, 37, 37, 37, 143, 38, 38,
479 38, 38, 38, 49, 38, 38, 38, 38, 38, 38,
480 38, 38, 38, 55, 142, 57, 38, 38, 38, 56,
481 60, 141, 50, 51, 58, 61, 52, 41, 32, 32,
482 140, 63, 139, 42, 38, 38, 38, 46, 66, 66,
483 138, 28, 35, 36, 38, 38, 38, 137, 43, 38,
485 38, 38, 66, 66, 136, 90, 44, 135, 134, 45,
486 67, 67, 67, 133, 67, 67, 132, 131, 130, 129,
487 67, 67, 67, 67, 67, 67, 128, 127, 71, 31,
488 31, 34, 34, 32, 32, 65, 65, 35, 35, 66,
489 66, 126, 125, 124, 123, 122, 121, 120, 119, 118,
490 117, 116, 115, 114, 113, 112, 111, 110, 109, 108,
491 107, 106, 105, 104, 103, 102, 101, 100, 99, 98,
492 97, 96, 95, 94, 93, 92, 91, 89, 88, 87,
493 86, 85, 84, 83, 82, 81, 80, 79, 78, 77,
494 76, 75, 74, 73, 72, 70, 69, 68, 36, 64,
496 29, 62, 59, 54, 53, 48, 47, 40, 39, 30,
497 29, 144, 3, 144, 144, 144, 144, 144, 144, 144,
498 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
499 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
500 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
504 static yyconst flex_int16_t yy_chk[252] =
506 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
507 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
508 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
509 1, 1, 1, 1, 1, 1, 1, 1, 8, 8,
510 145, 8, 9, 9, 10, 10, 10, 141, 10, 10,
511 13, 13, 13, 20, 10, 10, 10, 10, 10, 10,
512 15, 15, 15, 23, 139, 24, 17, 17, 17, 23,
513 26, 138, 20, 20, 24, 26, 20, 15, 31, 31,
514 137, 31, 136, 15, 16, 16, 16, 17, 33, 33,
515 135, 33, 34, 34, 38, 38, 38, 133, 16, 43,
517 43, 43, 65, 65, 132, 65, 16, 131, 130, 16,
518 39, 39, 39, 129, 39, 39, 126, 125, 124, 123,
519 39, 39, 39, 39, 39, 39, 122, 120, 43, 146,
520 146, 147, 147, 148, 148, 149, 149, 150, 150, 151,
521 151, 117, 116, 115, 113, 112, 111, 110, 109, 108,
522 107, 104, 103, 101, 100, 99, 98, 97, 96, 95,
523 94, 91, 90, 88, 86, 82, 81, 79, 78, 76,
524 75, 72, 71, 70, 69, 68, 66, 62, 61, 60,
525 59, 58, 57, 55, 54, 53, 52, 51, 50, 49,
526 48, 47, 46, 45, 44, 42, 41, 40, 35, 32,
528 29, 27, 25, 22, 21, 19, 18, 14, 11, 7,
529 5, 3, 144, 144, 144, 144, 144, 144, 144, 144,
530 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
531 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
532 144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
536 static yy_state_type yy_last_accepting_state;
537 static char *yy_last_accepting_cpos;
539 extern int yy_flex_debug;
540 int yy_flex_debug = 0;
542 /* The intent behind this definition is that it'll catch
543 * any uses of REJECT which flex missed.
545 #define REJECT reject_used_but_not_detected
546 #define yymore() yymore_used_but_not_detected
547 #define YY_MORE_ADJ 0
548 #define YY_RESTORE_YY_MORE_OFFSET
551 * sconfig, coreboot device tree compiler
553 * Copyright (C) 2010 coresystems GmbH
554 * written by Patrick Georgi <patrick@georgi-clan.de>
556 * This program is free software; you can redistribute it and/or modify
557 * it under the terms of the GNU General Public License as published by
558 * the Free Software Foundation; version 2 of the License.
560 * This program is distributed in the hope that it will be useful,
561 * but WITHOUT ANY WARRANTY; without even the implied warranty of
562 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
563 * GNU General Public License for more details.
566 #include "sconfig.tab.h"
572 #ifndef YY_NO_UNISTD_H
573 /* Special case for "unistd.h", since it is non-ANSI. We include it way
574 * down here because we want the user's section 1 to have been scanned first.
575 * The user has a chance to override it with an option.
580 #ifndef YY_EXTRA_TYPE
581 #define YY_EXTRA_TYPE void *
584 static int yy_init_globals (void );
586 /* Accessor methods to globals.
587 These are made visible to non-reentrant scanners for convenience. */
589 int yylex_destroy (void );
591 int yyget_debug (void );
593 void yyset_debug (int debug_flag );
595 YY_EXTRA_TYPE yyget_extra (void );
597 void yyset_extra (YY_EXTRA_TYPE user_defined );
599 FILE *yyget_in (void );
601 void yyset_in (FILE * _in_str );
603 FILE *yyget_out (void );
605 void yyset_out (FILE * _out_str );
607 int yyget_leng (void );
609 char *yyget_text (void );
611 int yyget_lineno (void );
613 void yyset_lineno (int _line_number );
615 /* Macros after this point can all be overridden by user definitions in
619 #ifndef YY_SKIP_YYWRAP
621 extern "C" int yywrap (void );
623 extern int yywrap (void );
629 static void yyunput (int c,char *buf_ptr );
634 static void yy_flex_strncpy (char *,yyconst char *,int );
637 #ifdef YY_NEED_STRLEN
638 static int yy_flex_strlen (yyconst char * );
644 static int yyinput (void );
646 static int input (void );
651 /* Amount of stuff to slurp up with each read. */
652 #ifndef YY_READ_BUF_SIZE
654 /* On IA-64, the buffer size is 16k, not 8k */
655 #define YY_READ_BUF_SIZE 16384
657 #define YY_READ_BUF_SIZE 8192
658 #endif /* __ia64__ */
661 /* Copy whatever the last rule matched to the standard output. */
663 /* This used to be an fputs(), but since the string might contain NUL's,
664 * we now use fwrite().
666 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
669 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
670 * is returned in "result".
673 #define YY_INPUT(buf,result,max_size) \
674 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
678 for ( n = 0; n < max_size && \
679 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
682 buf[n++] = (char) c; \
683 if ( c == EOF && ferror( yyin ) ) \
684 YY_FATAL_ERROR( "input in flex scanner failed" ); \
690 while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
692 if( errno != EINTR) \
694 YY_FATAL_ERROR( "input in flex scanner failed" ); \
705 /* No semi-colon after return; correct usage is to write "yyterminate();" -
706 * we don't want an extra ';' after the "return" because that will cause
707 * some compilers to complain about unreachable statements.
710 #define yyterminate() return YY_NULL
713 /* Number of entries by which start-condition stack grows. */
714 #ifndef YY_START_STACK_INCR
715 #define YY_START_STACK_INCR 25
718 /* Report a fatal error. */
719 #ifndef YY_FATAL_ERROR
720 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
723 /* end tables serialization structures and prototypes */
725 /* Default declaration of generated scanner - a define so the user can
726 * easily add parameters.
729 #define YY_DECL_IS_OURS 1
731 extern int yylex (void);
733 #define YY_DECL int yylex (void)
734 #endif /* !YY_DECL */
736 /* Code executed at the beginning of each rule, after yytext and yyleng
739 #ifndef YY_USER_ACTION
740 #define YY_USER_ACTION
743 /* Code executed at the end of each rule. */
745 #define YY_BREAK /*LINTED*/break;
748 #define YY_RULE_SETUP \
751 /** The main scanner function which does all the work.
755 yy_state_type yy_current_state;
768 (yy_start) = 1; /* first start state */
776 if ( ! YY_CURRENT_BUFFER ) {
777 yyensure_buffer_stack ();
778 YY_CURRENT_BUFFER_LVALUE =
779 yy_create_buffer(yyin,YY_BUF_SIZE );
782 yy_load_buffer_state( );
787 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
789 yy_cp = (yy_c_buf_p);
791 /* Support of yytext. */
792 *yy_cp = (yy_hold_char);
794 /* yy_bp points to the position in yy_ch_buf of the start of
799 yy_current_state = (yy_start);
803 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
804 if ( yy_accept[yy_current_state] )
806 (yy_last_accepting_state) = yy_current_state;
807 (yy_last_accepting_cpos) = yy_cp;
809 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
811 yy_current_state = (int) yy_def[yy_current_state];
812 if ( yy_current_state >= 145 )
813 yy_c = yy_meta[(unsigned int) yy_c];
815 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
818 while ( yy_base[yy_current_state] != 213 );
821 yy_act = yy_accept[yy_current_state];
823 { /* have to back up */
824 yy_cp = (yy_last_accepting_cpos);
825 yy_current_state = (yy_last_accepting_state);
826 yy_act = yy_accept[yy_current_state];
831 do_action: /* This label is used only to access EOF actions. */
834 { /* beginning of action switch */
835 case 0: /* must back up */
836 /* undo the effects of YY_DO_BEFORE_ACTION */
837 *yy_cp = (yy_hold_char);
838 yy_cp = (yy_last_accepting_cpos);
839 yy_current_state = (yy_last_accepting_state);
847 /* rule 2 can match eol */
852 /* rule 3 can match eol */
870 {yylval.number=1; return(BOOL);}
874 {yylval.number=0; return(BOOL);}
878 {yylval.number=3; return(HIDDEN);}
882 {yylval.number=PCI; return(BUS);}
886 {yylval.number=IOAPIC; return(BUS);}
890 {yylval.number=PNP; return(BUS);}
894 {yylval.number=I2C; return(BUS);}
898 {yylval.number=APIC; return(BUS);}
902 {yylval.number=CPU_CLUSTER; return(BUS);}
906 {yylval.number=CPU; return(BUS);}
910 {yylval.number=DOMAIN; return(BUS);}
914 {yylval.number=GENERIC; return(BUS);}
918 {yylval.number=MMIO; return(BUS);}
922 {yylval.number=SPI; return(BUS);}
926 {yylval.number=USB; return(BUS);}
930 {yylval.number=IRQ; return(RESOURCE);}
934 {yylval.number=DRQ; return(RESOURCE);}
938 {yylval.number=IO; return(RESOURCE);}
942 {return(IOAPIC_IRQ);}
950 {return(SUBSYSTEMID);}
962 {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
966 {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
970 {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
974 {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
977 /* rule 34 can match eol */
979 {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
982 /* rule 35 can match eol */
984 {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
988 {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
994 case YY_STATE_EOF(INITIAL):
997 case YY_END_OF_BUFFER:
999 /* Amount of text matched not including the EOB char. */
1000 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1002 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1003 *yy_cp = (yy_hold_char);
1004 YY_RESTORE_YY_MORE_OFFSET
1006 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1008 /* We're scanning a new file or input source. It's
1009 * possible that this happened because the user
1010 * just pointed yyin at a new source and called
1011 * yylex(). If so, then we have to assure
1012 * consistency between YY_CURRENT_BUFFER and our
1013 * globals. Here is the right place to do so, because
1014 * this is the first action (other than possibly a
1015 * back-up) that will match for the new input source.
1017 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1018 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1019 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1022 /* Note that here we test for yy_c_buf_p "<=" to the position
1023 * of the first EOB in the buffer, since yy_c_buf_p will
1024 * already have been incremented past the NUL character
1025 * (since all states make transitions on EOB to the
1026 * end-of-buffer state). Contrast this with the test
1029 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1030 { /* This was really a NUL. */
1031 yy_state_type yy_next_state;
1033 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1035 yy_current_state = yy_get_previous_state( );
1037 /* Okay, we're now positioned to make the NUL
1038 * transition. We couldn't have
1039 * yy_get_previous_state() go ahead and do it
1040 * for us because it doesn't know how to deal
1041 * with the possibility of jamming (and we don't
1042 * want to build jamming into it because then it
1043 * will run more slowly).
1046 yy_next_state = yy_try_NUL_trans( yy_current_state );
1048 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1050 if ( yy_next_state )
1052 /* Consume the NUL. */
1053 yy_cp = ++(yy_c_buf_p);
1054 yy_current_state = yy_next_state;
1060 yy_cp = (yy_c_buf_p);
1061 goto yy_find_action;
1065 else switch ( yy_get_next_buffer( ) )
1067 case EOB_ACT_END_OF_FILE:
1069 (yy_did_buffer_switch_on_eof) = 0;
1073 /* Note: because we've taken care in
1074 * yy_get_next_buffer() to have set up
1075 * yytext, we can now set up
1076 * yy_c_buf_p so that if some total
1077 * hoser (like flex itself) wants to
1078 * call the scanner after we return the
1079 * YY_NULL, it'll still work - another
1080 * YY_NULL will get returned.
1082 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1084 yy_act = YY_STATE_EOF(YY_START);
1090 if ( ! (yy_did_buffer_switch_on_eof) )
1096 case EOB_ACT_CONTINUE_SCAN:
1098 (yytext_ptr) + yy_amount_of_matched_text;
1100 yy_current_state = yy_get_previous_state( );
1102 yy_cp = (yy_c_buf_p);
1103 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1106 case EOB_ACT_LAST_MATCH:
1108 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1110 yy_current_state = yy_get_previous_state( );
1112 yy_cp = (yy_c_buf_p);
1113 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1114 goto yy_find_action;
1121 "fatal flex scanner internal error--no action found" );
1122 } /* end of action switch */
1123 } /* end of scanning one token */
1124 } /* end of user's declarations */
1125 } /* end of yylex */
1127 /* yy_get_next_buffer - try to read in a new buffer
1129 * Returns a code representing an action:
1130 * EOB_ACT_LAST_MATCH -
1131 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1132 * EOB_ACT_END_OF_FILE - end of file
1134 static int yy_get_next_buffer (void)
1136 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1137 char *source = (yytext_ptr);
1138 int number_to_move, i;
1141 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1143 "fatal flex scanner internal error--end of buffer missed" );
1145 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1146 { /* Don't try to fill the buffer, so this is an EOF. */
1147 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1149 /* We matched a single character, the EOB, so
1150 * treat this as a final EOF.
1152 return EOB_ACT_END_OF_FILE;
1157 /* We matched some text prior to the EOB, first
1160 return EOB_ACT_LAST_MATCH;
1164 /* Try to read more data. */
1166 /* First move last chars to start of buffer. */
1167 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1169 for ( i = 0; i < number_to_move; ++i )
1170 *(dest++) = *(source++);
1172 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1173 /* don't do the read, it's not guaranteed to return an EOF,
1176 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1181 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1183 while ( num_to_read <= 0 )
1184 { /* Not enough room in the buffer - grow it. */
1186 /* just a shorter name for the current buffer */
1187 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1189 int yy_c_buf_p_offset =
1190 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1192 if ( b->yy_is_our_buffer )
1194 int new_size = b->yy_buf_size * 2;
1196 if ( new_size <= 0 )
1197 b->yy_buf_size += b->yy_buf_size / 8;
1199 b->yy_buf_size *= 2;
1201 b->yy_ch_buf = (char *)
1202 /* Include room in for 2 EOB chars. */
1203 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1206 /* Can't grow it, we don't own it. */
1207 b->yy_ch_buf = NULL;
1209 if ( ! b->yy_ch_buf )
1211 "fatal error - scanner input buffer overflow" );
1213 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1215 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1220 if ( num_to_read > YY_READ_BUF_SIZE )
1221 num_to_read = YY_READ_BUF_SIZE;
1223 /* Read in more data. */
1224 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1225 (yy_n_chars), num_to_read );
1227 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1230 if ( (yy_n_chars) == 0 )
1232 if ( number_to_move == YY_MORE_ADJ )
1234 ret_val = EOB_ACT_END_OF_FILE;
1240 ret_val = EOB_ACT_LAST_MATCH;
1241 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1242 YY_BUFFER_EOF_PENDING;
1247 ret_val = EOB_ACT_CONTINUE_SCAN;
1249 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1250 /* Extend the array by 50%, plus the number we really need. */
1251 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1252 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1253 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1254 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1257 (yy_n_chars) += number_to_move;
1258 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1259 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1261 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1266 /* yy_get_previous_state - get the state just before the EOB char was reached */
1268 static yy_state_type yy_get_previous_state (void)
1270 yy_state_type yy_current_state;
1273 yy_current_state = (yy_start);
1275 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1277 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1278 if ( yy_accept[yy_current_state] )
1280 (yy_last_accepting_state) = yy_current_state;
1281 (yy_last_accepting_cpos) = yy_cp;
1283 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1285 yy_current_state = (int) yy_def[yy_current_state];
1286 if ( yy_current_state >= 145 )
1287 yy_c = yy_meta[(unsigned int) yy_c];
1289 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1292 return yy_current_state;
1295 /* yy_try_NUL_trans - try to make a transition on the NUL character
1298 * next_state = yy_try_NUL_trans( current_state );
1300 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1303 char *yy_cp = (yy_c_buf_p);
1306 if ( yy_accept[yy_current_state] )
1308 (yy_last_accepting_state) = yy_current_state;
1309 (yy_last_accepting_cpos) = yy_cp;
1311 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1313 yy_current_state = (int) yy_def[yy_current_state];
1314 if ( yy_current_state >= 145 )
1315 yy_c = yy_meta[(unsigned int) yy_c];
1317 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1318 yy_is_jam = (yy_current_state == 144);
1320 return yy_is_jam ? 0 : yy_current_state;
1325 static void yyunput (int c, char * yy_bp )
1329 yy_cp = (yy_c_buf_p);
1331 /* undo effects of setting up yytext */
1332 *yy_cp = (yy_hold_char);
1334 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1335 { /* need to shift things up to make room */
1336 /* +2 for EOB chars. */
1337 int number_to_move = (yy_n_chars) + 2;
1338 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1339 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1341 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1343 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1344 *--dest = *--source;
1346 yy_cp += (int) (dest - source);
1347 yy_bp += (int) (dest - source);
1348 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1349 (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1351 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1352 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1355 *--yy_cp = (char) c;
1357 (yytext_ptr) = yy_bp;
1358 (yy_hold_char) = *yy_cp;
1359 (yy_c_buf_p) = yy_cp;
1366 static int yyinput (void)
1368 static int input (void)
1374 *(yy_c_buf_p) = (yy_hold_char);
1376 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1378 /* yy_c_buf_p now points to the character we want to return.
1379 * If this occurs *before* the EOB characters, then it's a
1380 * valid NUL; if not, then we've hit the end of the buffer.
1382 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1383 /* This was really a NUL. */
1384 *(yy_c_buf_p) = '\0';
1387 { /* need more input */
1388 int offset = (yy_c_buf_p) - (yytext_ptr);
1391 switch ( yy_get_next_buffer( ) )
1393 case EOB_ACT_LAST_MATCH:
1394 /* This happens because yy_g_n_b()
1395 * sees that we've accumulated a
1396 * token and flags that we need to
1397 * try matching the token before
1398 * proceeding. But for input(),
1399 * there's no matching to consider.
1400 * So convert the EOB_ACT_LAST_MATCH
1401 * to EOB_ACT_END_OF_FILE.
1404 /* Reset buffer status. */
1409 case EOB_ACT_END_OF_FILE:
1414 if ( ! (yy_did_buffer_switch_on_eof) )
1423 case EOB_ACT_CONTINUE_SCAN:
1424 (yy_c_buf_p) = (yytext_ptr) + offset;
1430 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1431 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1432 (yy_hold_char) = *++(yy_c_buf_p);
1436 #endif /* ifndef YY_NO_INPUT */
1438 /** Immediately switch to a different input stream.
1439 * @param input_file A readable stream.
1441 * @note This function does not reset the start condition to @c INITIAL .
1443 void yyrestart (FILE * input_file )
1446 if ( ! YY_CURRENT_BUFFER ){
1447 yyensure_buffer_stack ();
1448 YY_CURRENT_BUFFER_LVALUE =
1449 yy_create_buffer(yyin,YY_BUF_SIZE );
1452 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1453 yy_load_buffer_state( );
1456 /** Switch to a different input buffer.
1457 * @param new_buffer The new input buffer.
1460 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1463 /* TODO. We should be able to replace this entire function body
1465 * yypop_buffer_state();
1466 * yypush_buffer_state(new_buffer);
1468 yyensure_buffer_stack ();
1469 if ( YY_CURRENT_BUFFER == new_buffer )
1472 if ( YY_CURRENT_BUFFER )
1474 /* Flush out information for old buffer. */
1475 *(yy_c_buf_p) = (yy_hold_char);
1476 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1477 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1480 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1481 yy_load_buffer_state( );
1483 /* We don't actually know whether we did this switch during
1484 * EOF (yywrap()) processing, but the only time this flag
1485 * is looked at is after yywrap() is called, so it's safe
1486 * to go ahead and always set it.
1488 (yy_did_buffer_switch_on_eof) = 1;
1491 static void yy_load_buffer_state (void)
1493 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1494 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1495 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1496 (yy_hold_char) = *(yy_c_buf_p);
1499 /** Allocate and initialize an input buffer state.
1500 * @param file A readable stream.
1501 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1503 * @return the allocated buffer state.
1505 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1509 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1511 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1513 b->yy_buf_size = (yy_size_t)size;
1515 /* yy_ch_buf has to be 2 characters longer than the size given because
1516 * we need to put in 2 end-of-buffer characters.
1518 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1519 if ( ! b->yy_ch_buf )
1520 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1522 b->yy_is_our_buffer = 1;
1524 yy_init_buffer(b,file );
1529 /** Destroy the buffer.
1530 * @param b a buffer created with yy_create_buffer()
1533 void yy_delete_buffer (YY_BUFFER_STATE b )
1539 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1540 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1542 if ( b->yy_is_our_buffer )
1543 yyfree((void *) b->yy_ch_buf );
1545 yyfree((void *) b );
1548 /* Initializes or reinitializes a buffer.
1549 * This function is sometimes called more than once on the same buffer,
1550 * such as during a yyrestart() or at EOF.
1552 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1557 yy_flush_buffer(b );
1559 b->yy_input_file = file;
1560 b->yy_fill_buffer = 1;
1562 /* If b is the current buffer, then yy_init_buffer was _probably_
1563 * called from yyrestart() or through yy_get_next_buffer.
1564 * In that case, we don't want to reset the lineno or column.
1566 if (b != YY_CURRENT_BUFFER){
1567 b->yy_bs_lineno = 1;
1568 b->yy_bs_column = 0;
1571 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1576 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1577 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1580 void yy_flush_buffer (YY_BUFFER_STATE b )
1587 /* We always need two end-of-buffer characters. The first causes
1588 * a transition to the end-of-buffer state. The second causes
1589 * a jam in that state.
1591 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1592 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1594 b->yy_buf_pos = &b->yy_ch_buf[0];
1597 b->yy_buffer_status = YY_BUFFER_NEW;
1599 if ( b == YY_CURRENT_BUFFER )
1600 yy_load_buffer_state( );
1603 /** Pushes the new state onto the stack. The new state becomes
1604 * the current state. This function will allocate the stack
1606 * @param new_buffer The new state.
1609 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1611 if (new_buffer == NULL)
1614 yyensure_buffer_stack();
1616 /* This block is copied from yy_switch_to_buffer. */
1617 if ( YY_CURRENT_BUFFER )
1619 /* Flush out information for old buffer. */
1620 *(yy_c_buf_p) = (yy_hold_char);
1621 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1622 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1625 /* Only push if top exists. Otherwise, replace top. */
1626 if (YY_CURRENT_BUFFER)
1627 (yy_buffer_stack_top)++;
1628 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1630 /* copied from yy_switch_to_buffer. */
1631 yy_load_buffer_state( );
1632 (yy_did_buffer_switch_on_eof) = 1;
1635 /** Removes and deletes the top of the stack, if present.
1636 * The next element becomes the new top.
1639 void yypop_buffer_state (void)
1641 if (!YY_CURRENT_BUFFER)
1644 yy_delete_buffer(YY_CURRENT_BUFFER );
1645 YY_CURRENT_BUFFER_LVALUE = NULL;
1646 if ((yy_buffer_stack_top) > 0)
1647 --(yy_buffer_stack_top);
1649 if (YY_CURRENT_BUFFER) {
1650 yy_load_buffer_state( );
1651 (yy_did_buffer_switch_on_eof) = 1;
1655 /* Allocates the stack if it does not exist.
1656 * Guarantees space for at least one push.
1658 static void yyensure_buffer_stack (void)
1662 if (!(yy_buffer_stack)) {
1664 /* First allocation is just for 2 elements, since we don't know if this
1665 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1666 * immediate realloc on the next call.
1668 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1669 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1670 (num_to_alloc * sizeof(struct yy_buffer_state*)
1672 if ( ! (yy_buffer_stack) )
1673 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1675 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1677 (yy_buffer_stack_max) = num_to_alloc;
1678 (yy_buffer_stack_top) = 0;
1682 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1684 /* Increase the buffer to prepare for a possible push. */
1685 yy_size_t grow_size = 8 /* arbitrary grow size */;
1687 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1688 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1690 num_to_alloc * sizeof(struct yy_buffer_state*)
1692 if ( ! (yy_buffer_stack) )
1693 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1695 /* zero only the new slots.*/
1696 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1697 (yy_buffer_stack_max) = num_to_alloc;
1701 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1702 * @param base the character buffer
1703 * @param size the size in bytes of the character buffer
1705 * @return the newly allocated buffer state object.
1707 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1712 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1713 base[size-1] != YY_END_OF_BUFFER_CHAR )
1714 /* They forgot to leave room for the EOB's. */
1717 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1719 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1721 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1722 b->yy_buf_pos = b->yy_ch_buf = base;
1723 b->yy_is_our_buffer = 0;
1724 b->yy_input_file = NULL;
1725 b->yy_n_chars = b->yy_buf_size;
1726 b->yy_is_interactive = 0;
1728 b->yy_fill_buffer = 0;
1729 b->yy_buffer_status = YY_BUFFER_NEW;
1731 yy_switch_to_buffer(b );
1736 /** Setup the input buffer state to scan a string. The next call to yylex() will
1737 * scan from a @e copy of @a str.
1738 * @param yystr a NUL-terminated string to scan
1740 * @return the newly allocated buffer state object.
1741 * @note If you want to scan bytes that may contain NUL values, then use
1742 * yy_scan_bytes() instead.
1744 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1747 return yy_scan_bytes(yystr,(int) strlen(yystr) );
1750 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1751 * scan from a @e copy of @a bytes.
1752 * @param yybytes the byte buffer to scan
1753 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1755 * @return the newly allocated buffer state object.
1757 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1764 /* Get memory for full buffer, including space for trailing EOB's. */
1765 n = (yy_size_t) (_yybytes_len + 2);
1766 buf = (char *) yyalloc(n );
1768 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1770 for ( i = 0; i < _yybytes_len; ++i )
1771 buf[i] = yybytes[i];
1773 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1775 b = yy_scan_buffer(buf,n );
1777 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1779 /* It's okay to grow etc. this buffer, and we should throw it
1780 * away when we're done.
1782 b->yy_is_our_buffer = 1;
1787 #ifndef YY_EXIT_FAILURE
1788 #define YY_EXIT_FAILURE 2
1791 static void yynoreturn yy_fatal_error (yyconst char* msg )
1793 (void) fprintf( stderr, "%s\n", msg );
1794 exit( YY_EXIT_FAILURE );
1797 /* Redefine yyless() so it works in section 3 code. */
1803 /* Undo effects of setting up yytext. */ \
1804 int yyless_macro_arg = (n); \
1805 YY_LESS_LINENO(yyless_macro_arg);\
1806 yytext[yyleng] = (yy_hold_char); \
1807 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1808 (yy_hold_char) = *(yy_c_buf_p); \
1809 *(yy_c_buf_p) = '\0'; \
1810 yyleng = yyless_macro_arg; \
1814 /* Accessor methods (get/set functions) to struct members. */
1816 /** Get the current line number.
1819 int yyget_lineno (void)
1825 /** Get the input stream.
1828 FILE *yyget_in (void)
1833 /** Get the output stream.
1836 FILE *yyget_out (void)
1841 /** Get the length of the current token.
1844 int yyget_leng (void)
1849 /** Get the current token.
1853 char *yyget_text (void)
1858 /** Set the current line number.
1859 * @param _line_number line number
1862 void yyset_lineno (int _line_number )
1865 yylineno = _line_number;
1868 /** Set the input stream. This does not discard the current
1870 * @param _in_str A readable stream.
1872 * @see yy_switch_to_buffer
1874 void yyset_in (FILE * _in_str )
1879 void yyset_out (FILE * _out_str )
1884 int yyget_debug (void)
1886 return yy_flex_debug;
1889 void yyset_debug (int _bdebug )
1891 yy_flex_debug = _bdebug ;
1894 static int yy_init_globals (void)
1896 /* Initialization is the same as for the non-reentrant scanner.
1897 * This function is called from yylex_destroy(), so don't allocate here.
1900 (yy_buffer_stack) = NULL;
1901 (yy_buffer_stack_top) = 0;
1902 (yy_buffer_stack_max) = 0;
1903 (yy_c_buf_p) = NULL;
1907 /* Defined in main.c */
1916 /* For future reference: Set errno on error, since we are called by
1922 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1923 int yylex_destroy (void)
1926 /* Pop the buffer stack, destroying each element. */
1927 while(YY_CURRENT_BUFFER){
1928 yy_delete_buffer(YY_CURRENT_BUFFER );
1929 YY_CURRENT_BUFFER_LVALUE = NULL;
1930 yypop_buffer_state();
1933 /* Destroy the stack itself. */
1934 yyfree((yy_buffer_stack) );
1935 (yy_buffer_stack) = NULL;
1937 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1938 * yylex() is called, initialization will occur. */
1945 * Internal utility routines.
1949 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1953 for ( i = 0; i < n; ++i )
1958 #ifdef YY_NEED_STRLEN
1959 static int yy_flex_strlen (yyconst char * s )
1962 for ( n = 0; s[n]; ++n )
1969 void *yyalloc (yy_size_t size )
1971 return malloc(size);
1974 void *yyrealloc (void * ptr, yy_size_t size )
1977 /* The cast to (char *) in the following accommodates both
1978 * implementations that use char* generic pointers, and those
1979 * that use void* generic pointers. It works with the latter
1980 * because both ANSI C and C++ allow castless assignment from
1981 * any pointer type to void*, and deal with argument conversions
1982 * as though doing an assignment.
1984 return realloc(ptr, size);
1987 void yyfree (void * ptr )
1989 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1992 #define YYTABLES_NAME "yytables"