1 #line 2 "dtc-lexer.lex.c"
3 #line 4 "dtc-lexer.lex.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
58 /* Limits of integral types. */
60 #define INT8_MIN (-128)
63 #define INT16_MIN (-32767-1)
66 #define INT32_MIN (-2147483647-1)
69 #define INT8_MAX (127)
72 #define INT16_MAX (32767)
75 #define INT32_MAX (2147483647)
78 #define UINT8_MAX (255U)
81 #define UINT16_MAX (65535U)
84 #define UINT32_MAX (4294967295U)
89 #endif /* ! FLEXINT_H */
93 /* The "const" storage-class-modifier is valid. */
96 #else /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
107 #define yyconst const
112 /* Returned upon end-of-file. */
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
122 /* Enter a start condition. This macro really ought to take a parameter,
123 * but we do it the disgusting crufty way forced on us by the ()-less
124 * definition of BEGIN.
126 #define BEGIN (yy_start) = 1 + 2 *
128 /* Translate the current start state into a value that can be later handed
129 * to BEGIN to return to the state. The YYSTATE alias is for lex
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin )
141 #define YY_END_OF_BUFFER_CHAR 0
143 /* Size of default input buffer. */
146 /* On IA-64, the buffer size is 16k, not 8k.
147 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
148 * Ditto for the __ia64__ case accordingly.
150 #define YY_BUF_SIZE 32768
152 #define YY_BUF_SIZE 16384
153 #endif /* __ia64__ */
156 /* The state buf must be large enough to hold one state per character in the main buffer.
158 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
161 #define YY_TYPEDEF_YY_BUFFER_STATE
162 typedef struct yy_buffer_state *YY_BUFFER_STATE;
167 extern FILE *yyin, *yyout;
169 #define EOB_ACT_CONTINUE_SCAN 0
170 #define EOB_ACT_END_OF_FILE 1
171 #define EOB_ACT_LAST_MATCH 2
173 #define YY_LESS_LINENO(n)
175 /* Return all but the first "n" matched characters back to the input stream. */
179 /* Undo effects of setting up yytext. */ \
180 int yyless_macro_arg = (n); \
181 YY_LESS_LINENO(yyless_macro_arg);\
182 *yy_cp = (yy_hold_char); \
183 YY_RESTORE_YY_MORE_OFFSET \
184 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
185 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
189 #define unput(c) yyunput( c, (yytext_ptr) )
191 #ifndef YY_TYPEDEF_YY_SIZE_T
192 #define YY_TYPEDEF_YY_SIZE_T
193 typedef size_t yy_size_t;
196 #ifndef YY_STRUCT_YY_BUFFER_STATE
197 #define YY_STRUCT_YY_BUFFER_STATE
198 struct yy_buffer_state
202 char *yy_ch_buf; /* input buffer */
203 char *yy_buf_pos; /* current position in input buffer */
205 /* Size of input buffer in bytes, not including room for EOB
208 yy_size_t yy_buf_size;
210 /* Number of characters read into yy_ch_buf, not including EOB
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
219 int yy_is_our_buffer;
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
226 int yy_is_interactive;
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
234 int yy_bs_lineno; /**< The line count. */
235 int yy_bs_column; /**< The column count. */
237 /* Whether to try to fill the input buffer when we reach the
242 int yy_buffer_status;
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.
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.
256 #define YY_BUFFER_EOF_PENDING 2
259 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
261 /* Stack of input buffers. */
262 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
263 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
264 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
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
270 * Returns the top of the stack, or NULL.
272 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
273 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
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.
279 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
281 /* yy_hold_char holds the character lost when yytext is formed. */
282 static char yy_hold_char;
283 static int yy_n_chars; /* number of characters read into yy_ch_buf */
286 /* Points to current character in buffer. */
287 static char *yy_c_buf_p = (char *) 0;
288 static int yy_init = 0; /* whether we need to initialize */
289 static int yy_start = 0; /* start state number */
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 ...
294 static int yy_did_buffer_switch_on_eof;
296 void yyrestart (FILE *input_file );
297 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
298 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
299 void yy_delete_buffer (YY_BUFFER_STATE b );
300 void yy_flush_buffer (YY_BUFFER_STATE b );
301 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
302 void yypop_buffer_state (void );
304 static void yyensure_buffer_stack (void );
305 static void yy_load_buffer_state (void );
306 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
308 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
310 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
311 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
312 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
314 void *yyalloc (yy_size_t );
315 void *yyrealloc (void *,yy_size_t );
316 void yyfree (void * );
318 #define yy_new_buffer yy_create_buffer
320 #define yy_set_interactive(is_interactive) \
322 if ( ! YY_CURRENT_BUFFER ){ \
323 yyensure_buffer_stack (); \
324 YY_CURRENT_BUFFER_LVALUE = \
325 yy_create_buffer(yyin,YY_BUF_SIZE ); \
327 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
330 #define yy_set_bol(at_bol) \
332 if ( ! YY_CURRENT_BUFFER ){\
333 yyensure_buffer_stack (); \
334 YY_CURRENT_BUFFER_LVALUE = \
335 yy_create_buffer(yyin,YY_BUF_SIZE ); \
337 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
340 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
342 /* Begin user sect3 */
345 #define YY_SKIP_YYWRAP
347 typedef unsigned char YY_CHAR;
349 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
351 typedef int yy_state_type;
358 #define yytext_ptr yytext
360 static yy_state_type yy_get_previous_state (void );
361 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
362 static int yy_get_next_buffer (void );
363 static void yy_fatal_error (yyconst char msg[] );
365 /* Done after the current pattern has been matched and before the
366 * corresponding action - sets up yytext.
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; \
373 (yy_c_buf_p) = yy_cp;
375 #define YY_NUM_RULES 17
376 #define YY_END_OF_BUFFER 18
377 /* This struct is not used in this scanner,
378 but its presence is necessary. */
381 flex_int32_t yy_verify;
384 static yyconst flex_int16_t yy_accept[94] =
386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
387 18, 16, 13, 13, 16, 16, 16, 16, 16, 16,
388 16, 10, 11, 11, 6, 6, 13, 0, 2, 0,
389 7, 0, 0, 0, 0, 0, 0, 0, 5, 0,
390 9, 9, 11, 11, 6, 0, 7, 0, 0, 0,
391 0, 15, 0, 0, 0, 0, 6, 0, 14, 0,
392 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
393 0, 0, 0, 0, 0, 0, 0, 0, 3, 12,
394 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
399 static yyconst flex_int32_t yy_ec[256] =
401 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
402 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
403 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
404 1, 2, 1, 4, 5, 1, 1, 6, 1, 1,
405 1, 7, 5, 5, 8, 5, 9, 10, 11, 12,
406 12, 12, 12, 12, 12, 12, 12, 13, 1, 1,
407 1, 1, 5, 5, 14, 14, 14, 14, 14, 14,
408 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
409 15, 15, 15, 15, 15, 15, 15, 16, 15, 15,
410 1, 17, 18, 1, 15, 1, 14, 19, 20, 21,
412 22, 14, 15, 15, 23, 15, 15, 24, 25, 26,
413 15, 15, 15, 27, 28, 29, 30, 31, 15, 16,
414 15, 15, 32, 1, 33, 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,
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, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 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, 1, 1,
431 static yyconst flex_int32_t yy_meta[34] =
433 1, 1, 1, 1, 2, 1, 2, 2, 3, 4,
434 4, 4, 5, 6, 7, 7, 1, 1, 6, 6,
435 6, 6, 7, 7, 7, 7, 7, 7, 7, 7,
439 static yyconst flex_int16_t yy_base[106] =
441 0, 0, 237, 236, 25, 0, 47, 0, 30, 71,
442 244, 247, 82, 84, 84, 211, 95, 229, 218, 0,
443 111, 247, 0, 84, 83, 95, 106, 86, 247, 237,
444 0, 230, 231, 234, 207, 209, 212, 220, 247, 206,
445 247, 218, 0, 106, 116, 0, 0, 0, 223, 89,
446 226, 219, 199, 206, 200, 204, 0, 190, 213, 212,
447 202, 91, 178, 161, 247, 172, 144, 150, 140, 130,
448 140, 124, 128, 120, 138, 137, 123, 122, 247, 247,
449 134, 114, 132, 86, 135, 125, 90, 136, 247, 97,
450 29, 247, 247, 153, 156, 161, 165, 170, 176, 180,
452 187, 195, 200, 205, 212
455 static yyconst flex_int16_t yy_def[106] =
457 93, 1, 1, 1, 1, 5, 93, 7, 1, 1,
458 93, 93, 93, 93, 94, 95, 93, 96, 17, 97,
459 96, 93, 98, 99, 93, 93, 93, 94, 93, 94,
460 100, 93, 101, 102, 93, 93, 93, 96, 93, 93,
461 93, 96, 98, 99, 93, 103, 100, 104, 101, 101,
462 102, 93, 93, 93, 93, 93, 103, 104, 93, 93,
463 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
464 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
465 93, 93, 93, 93, 93, 105, 93, 105, 93, 105,
466 93, 93, 0, 93, 93, 93, 93, 93, 93, 93,
471 static yyconst flex_int16_t yy_nxt[281] =
473 12, 13, 14, 15, 12, 16, 12, 12, 17, 12,
474 12, 12, 12, 18, 18, 18, 12, 12, 18, 18,
475 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
476 18, 12, 12, 19, 20, 20, 20, 92, 21, 25,
477 26, 26, 22, 21, 21, 21, 21, 12, 13, 14,
478 15, 23, 16, 23, 23, 19, 23, 23, 23, 12,
479 24, 24, 24, 12, 12, 24, 24, 24, 24, 24,
480 24, 24, 24, 24, 24, 24, 24, 24, 12, 12,
481 25, 26, 26, 27, 27, 27, 27, 29, 43, 29,
482 43, 43, 45, 45, 45, 50, 39, 59, 46, 93,
484 30, 33, 30, 34, 45, 45, 45, 27, 27, 68,
485 43, 91, 43, 43, 69, 35, 87, 36, 39, 37,
486 42, 42, 42, 39, 42, 45, 45, 45, 89, 42,
487 42, 42, 42, 85, 85, 86, 85, 85, 86, 89,
488 84, 90, 83, 82, 81, 80, 79, 78, 77, 76,
489 75, 74, 90, 28, 28, 28, 28, 28, 28, 28,
490 28, 31, 31, 31, 38, 38, 38, 38, 41, 73,
491 41, 43, 72, 43, 71, 43, 43, 44, 33, 44,
492 44, 44, 44, 47, 69, 47, 47, 49, 49, 49,
493 49, 49, 49, 49, 49, 51, 51, 51, 51, 51,
495 51, 51, 51, 57, 70, 57, 58, 58, 58, 67,
496 58, 58, 88, 88, 88, 88, 88, 88, 88, 88,
497 34, 66, 65, 64, 63, 62, 61, 60, 52, 50,
498 39, 56, 39, 55, 54, 53, 52, 50, 48, 93,
499 40, 39, 32, 93, 19, 19, 11, 93, 93, 93,
500 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
501 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
502 93, 93, 93, 93, 93, 93, 93, 93, 93, 93
505 static yyconst flex_int16_t yy_chk[281] =
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, 1, 1,
510 1, 1, 1, 5, 5, 5, 5, 91, 5, 9,
511 9, 9, 5, 5, 5, 5, 5, 7, 7, 7,
512 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
513 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
514 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
515 10, 10, 10, 13, 13, 14, 14, 15, 24, 28,
516 24, 24, 25, 25, 25, 50, 24, 50, 25, 90,
518 15, 17, 28, 17, 26, 26, 26, 27, 27, 62,
519 44, 87, 44, 44, 62, 17, 84, 17, 44, 17,
520 21, 21, 21, 21, 21, 45, 45, 45, 86, 21,
521 21, 21, 21, 83, 83, 83, 85, 85, 85, 88,
522 82, 86, 81, 78, 77, 76, 75, 74, 73, 72,
523 71, 70, 88, 94, 94, 94, 94, 94, 94, 94,
524 94, 95, 95, 95, 96, 96, 96, 96, 97, 69,
525 97, 98, 68, 98, 67, 98, 98, 99, 66, 99,
526 99, 99, 99, 100, 64, 100, 100, 101, 101, 101,
527 101, 101, 101, 101, 101, 102, 102, 102, 102, 102,
529 102, 102, 102, 103, 63, 103, 104, 104, 104, 61,
530 104, 104, 105, 105, 105, 105, 105, 105, 105, 105,
531 60, 59, 58, 56, 55, 54, 53, 52, 51, 49,
532 42, 40, 38, 37, 36, 35, 34, 33, 32, 30,
533 19, 18, 16, 11, 4, 3, 93, 93, 93, 93,
534 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
535 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
536 93, 93, 93, 93, 93, 93, 93, 93, 93, 93
539 static yy_state_type yy_last_accepting_state;
540 static char *yy_last_accepting_cpos;
542 extern int yy_flex_debug;
543 int yy_flex_debug = 0;
545 /* The intent behind this definition is that it'll catch
546 * any uses of REJECT which flex missed.
548 #define REJECT reject_used_but_not_detected
549 #define yymore() yymore_used_but_not_detected
550 #define YY_MORE_ADJ 0
551 #define YY_RESTORE_YY_MORE_OFFSET
553 #line 1 "dtc-lexer.l"
555 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
558 * This program is free software; you can redistribute it and/or
559 * modify it under the terms of the GNU General Public License as
560 * published by the Free Software Foundation; either version 2 of the
561 * License, or (at your option) any later version.
563 * This program is distributed in the hope that it will be useful,
564 * but WITHOUT ANY WARRANTY; without even the implied warranty of
565 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
566 * General Public License for more details.
568 * You should have received a copy of the GNU General Public License
569 * along with this program; if not, write to the Free Software
570 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
573 #define YY_NO_INPUT 1
578 #line 37 "dtc-lexer.l"
581 #include "dtc-parser.tab.h"
585 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
586 #define YY_USER_ACTION \
588 srcpos_update(&yylloc, yytext, yyleng); \
591 /*#define LEXDEBUG 1*/
594 #define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
596 #define DPRINT(fmt, ...) do { } while (0)
599 static int dts_version = 1;
601 #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \
604 static void push_input_file(const char *filename);
605 static int pop_input_file(void);
606 #line 607 "dtc-lexer.lex.c"
611 #define PROPNODENAME 3
614 #ifndef YY_NO_UNISTD_H
615 /* Special case for "unistd.h", since it is non-ANSI. We include it way
616 * down here because we want the user's section 1 to have been scanned first.
617 * The user has a chance to override it with an option.
622 #ifndef YY_EXTRA_TYPE
623 #define YY_EXTRA_TYPE void *
626 static int yy_init_globals (void );
628 /* Accessor methods to globals.
629 These are made visible to non-reentrant scanners for convenience. */
631 int yylex_destroy (void );
633 int yyget_debug (void );
635 void yyset_debug (int debug_flag );
637 YY_EXTRA_TYPE yyget_extra (void );
639 void yyset_extra (YY_EXTRA_TYPE user_defined );
641 FILE *yyget_in (void );
643 void yyset_in (FILE * in_str );
645 FILE *yyget_out (void );
647 void yyset_out (FILE * out_str );
649 int yyget_leng (void );
651 char *yyget_text (void );
653 int yyget_lineno (void );
655 void yyset_lineno (int line_number );
657 /* Macros after this point can all be overridden by user definitions in
661 #ifndef YY_SKIP_YYWRAP
663 extern "C" int yywrap (void );
665 extern int yywrap (void );
670 static void yy_flex_strncpy (char *,yyconst char *,int );
673 #ifdef YY_NEED_STRLEN
674 static int yy_flex_strlen (yyconst char * );
680 static int yyinput (void );
682 static int input (void );
687 /* Amount of stuff to slurp up with each read. */
688 #ifndef YY_READ_BUF_SIZE
690 /* On IA-64, the buffer size is 16k, not 8k */
691 #define YY_READ_BUF_SIZE 16384
693 #define YY_READ_BUF_SIZE 8192
694 #endif /* __ia64__ */
697 /* Copy whatever the last rule matched to the standard output. */
699 /* This used to be an fputs(), but since the string might contain NUL's,
700 * we now use fwrite().
702 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
705 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
706 * is returned in "result".
709 #define YY_INPUT(buf,result,max_size) \
710 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
714 for ( n = 0; n < max_size && \
715 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
718 buf[n++] = (char) c; \
719 if ( c == EOF && ferror( yyin ) ) \
720 YY_FATAL_ERROR( "input in flex scanner failed" ); \
726 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
728 if( errno != EINTR) \
730 YY_FATAL_ERROR( "input in flex scanner failed" ); \
741 /* No semi-colon after return; correct usage is to write "yyterminate();" -
742 * we don't want an extra ';' after the "return" because that will cause
743 * some compilers to complain about unreachable statements.
746 #define yyterminate() return YY_NULL
749 /* Number of entries by which start-condition stack grows. */
750 #ifndef YY_START_STACK_INCR
751 #define YY_START_STACK_INCR 25
754 /* Report a fatal error. */
755 #ifndef YY_FATAL_ERROR
756 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
759 /* end tables serialization structures and prototypes */
761 /* Default declaration of generated scanner - a define so the user can
762 * easily add parameters.
765 #define YY_DECL_IS_OURS 1
767 extern int yylex (void);
769 #define YY_DECL int yylex (void)
770 #endif /* !YY_DECL */
772 /* Code executed at the beginning of each rule, after yytext and yyleng
775 #ifndef YY_USER_ACTION
776 #define YY_USER_ACTION
779 /* Code executed at the end of each rule. */
781 #define YY_BREAK break;
784 #define YY_RULE_SETUP \
787 /** The main scanner function which does all the work.
791 register yy_state_type yy_current_state;
792 register char *yy_cp, *yy_bp;
795 #line 66 "dtc-lexer.l"
797 #line 798 "dtc-lexer.lex.c"
808 (yy_start) = 1; /* first start state */
816 if ( ! YY_CURRENT_BUFFER ) {
817 yyensure_buffer_stack ();
818 YY_CURRENT_BUFFER_LVALUE =
819 yy_create_buffer(yyin,YY_BUF_SIZE );
822 yy_load_buffer_state( );
825 while ( 1 ) /* loops until end-of-file is reached */
827 yy_cp = (yy_c_buf_p);
829 /* Support of yytext. */
830 *yy_cp = (yy_hold_char);
832 /* yy_bp points to the position in yy_ch_buf of the start of
837 yy_current_state = (yy_start);
841 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
842 if ( yy_accept[yy_current_state] )
844 (yy_last_accepting_state) = yy_current_state;
845 (yy_last_accepting_cpos) = yy_cp;
847 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
849 yy_current_state = (int) yy_def[yy_current_state];
850 if ( yy_current_state >= 94 )
851 yy_c = yy_meta[(unsigned int) yy_c];
853 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
856 while ( yy_current_state != 93 );
857 yy_cp = (yy_last_accepting_cpos);
858 yy_current_state = (yy_last_accepting_state);
861 yy_act = yy_accept[yy_current_state];
865 do_action: /* This label is used only to access EOF actions. */
868 { /* beginning of action switch */
869 case 0: /* must back up */
870 /* undo the effects of YY_DO_BEFORE_ACTION */
871 *yy_cp = (yy_hold_char);
872 yy_cp = (yy_last_accepting_cpos);
873 yy_current_state = (yy_last_accepting_state);
877 /* rule 1 can match eol */
879 #line 67 "dtc-lexer.l"
881 char *name = strchr(yytext, '\"') + 1;
882 yytext[yyleng-1] = '\0';
883 push_input_file(name);
886 case YY_STATE_EOF(INITIAL):
887 case YY_STATE_EOF(INCLUDE):
888 case YY_STATE_EOF(BYTESTRING):
889 case YY_STATE_EOF(PROPNODENAME):
890 case YY_STATE_EOF(V1):
891 #line 73 "dtc-lexer.l"
893 if (!pop_input_file()) {
899 /* rule 2 can match eol */
901 #line 79 "dtc-lexer.l"
903 DPRINT("String: %s\n", yytext);
904 yylval.data = data_copy_escape_string(yytext+1,
911 #line 86 "dtc-lexer.l"
913 DPRINT("Keyword: /dts-v1/\n");
921 #line 93 "dtc-lexer.l"
923 DPRINT("Keyword: /memreserve/\n");
925 return DT_MEMRESERVE;
930 #line 99 "dtc-lexer.l"
932 DPRINT("Label: %s\n", yytext);
933 yylval.labelref = xstrdup(yytext);
934 yylval.labelref[yyleng-1] = '\0';
940 #line 106 "dtc-lexer.l"
942 yylval.literal = xstrdup(yytext);
943 DPRINT("Literal: '%s'\n", yylval.literal);
949 #line 112 "dtc-lexer.l"
950 { /* label reference */
951 DPRINT("Ref: %s\n", yytext+1);
952 yylval.labelref = xstrdup(yytext+1);
958 #line 118 "dtc-lexer.l"
959 { /* new-style path reference */
960 yytext[yyleng-1] = '\0';
961 DPRINT("Ref: %s\n", yytext+2);
962 yylval.labelref = xstrdup(yytext+2);
968 #line 125 "dtc-lexer.l"
970 yylval.byte = strtol(yytext, NULL, 16);
971 DPRINT("Byte: %02x\n", (int)yylval.byte);
977 #line 131 "dtc-lexer.l"
979 DPRINT("/BYTESTRING\n");
986 #line 137 "dtc-lexer.l"
988 DPRINT("PropNodeName: %s\n", yytext);
989 yylval.propnodename = xstrdup(yytext);
991 return DT_PROPNODENAME;
996 #line 144 "dtc-lexer.l"
998 DPRINT("Binary Include\n");
1003 /* rule 13 can match eol */
1005 #line 149 "dtc-lexer.l"
1006 /* eat whitespace */
1009 /* rule 14 can match eol */
1011 #line 150 "dtc-lexer.l"
1012 /* eat C-style comments */
1015 /* rule 15 can match eol */
1017 #line 151 "dtc-lexer.l"
1018 /* eat C++-style comments */
1022 #line 153 "dtc-lexer.l"
1024 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1025 (unsigned)yytext[0]);
1026 if (yytext[0] == '[') {
1027 DPRINT("<BYTESTRING>\n");
1030 if ((yytext[0] == '{')
1031 || (yytext[0] == ';')) {
1032 DPRINT("<PROPNODENAME>\n");
1033 BEGIN(PROPNODENAME);
1040 #line 168 "dtc-lexer.l"
1043 #line 1044 "dtc-lexer.lex.c"
1045 case YY_END_OF_BUFFER:
1047 /* Amount of text matched not including the EOB char. */
1048 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1050 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1051 *yy_cp = (yy_hold_char);
1052 YY_RESTORE_YY_MORE_OFFSET
1054 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1056 /* We're scanning a new file or input source. It's
1057 * possible that this happened because the user
1058 * just pointed yyin at a new source and called
1059 * yylex(). If so, then we have to assure
1060 * consistency between YY_CURRENT_BUFFER and our
1061 * globals. Here is the right place to do so, because
1062 * this is the first action (other than possibly a
1063 * back-up) that will match for the new input source.
1065 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1066 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1067 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1070 /* Note that here we test for yy_c_buf_p "<=" to the position
1071 * of the first EOB in the buffer, since yy_c_buf_p will
1072 * already have been incremented past the NUL character
1073 * (since all states make transitions on EOB to the
1074 * end-of-buffer state). Contrast this with the test
1077 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1078 { /* This was really a NUL. */
1079 yy_state_type yy_next_state;
1081 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1083 yy_current_state = yy_get_previous_state( );
1085 /* Okay, we're now positioned to make the NUL
1086 * transition. We couldn't have
1087 * yy_get_previous_state() go ahead and do it
1088 * for us because it doesn't know how to deal
1089 * with the possibility of jamming (and we don't
1090 * want to build jamming into it because then it
1091 * will run more slowly).
1094 yy_next_state = yy_try_NUL_trans( yy_current_state );
1096 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1098 if ( yy_next_state )
1100 /* Consume the NUL. */
1101 yy_cp = ++(yy_c_buf_p);
1102 yy_current_state = yy_next_state;
1108 yy_cp = (yy_last_accepting_cpos);
1109 yy_current_state = (yy_last_accepting_state);
1110 goto yy_find_action;
1114 else switch ( yy_get_next_buffer( ) )
1116 case EOB_ACT_END_OF_FILE:
1118 (yy_did_buffer_switch_on_eof) = 0;
1122 /* Note: because we've taken care in
1123 * yy_get_next_buffer() to have set up
1124 * yytext, we can now set up
1125 * yy_c_buf_p so that if some total
1126 * hoser (like flex itself) wants to
1127 * call the scanner after we return the
1128 * YY_NULL, it'll still work - another
1129 * YY_NULL will get returned.
1131 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1133 yy_act = YY_STATE_EOF(YY_START);
1139 if ( ! (yy_did_buffer_switch_on_eof) )
1145 case EOB_ACT_CONTINUE_SCAN:
1147 (yytext_ptr) + yy_amount_of_matched_text;
1149 yy_current_state = yy_get_previous_state( );
1151 yy_cp = (yy_c_buf_p);
1152 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1155 case EOB_ACT_LAST_MATCH:
1157 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1159 yy_current_state = yy_get_previous_state( );
1161 yy_cp = (yy_c_buf_p);
1162 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1163 goto yy_find_action;
1170 "fatal flex scanner internal error--no action found" );
1171 } /* end of action switch */
1172 } /* end of scanning one token */
1173 } /* end of yylex */
1175 /* yy_get_next_buffer - try to read in a new buffer
1177 * Returns a code representing an action:
1178 * EOB_ACT_LAST_MATCH -
1179 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1180 * EOB_ACT_END_OF_FILE - end of file
1182 static int yy_get_next_buffer (void)
1184 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1185 register char *source = (yytext_ptr);
1186 register int number_to_move, i;
1189 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1191 "fatal flex scanner internal error--end of buffer missed" );
1193 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1194 { /* Don't try to fill the buffer, so this is an EOF. */
1195 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1197 /* We matched a single character, the EOB, so
1198 * treat this as a final EOF.
1200 return EOB_ACT_END_OF_FILE;
1205 /* We matched some text prior to the EOB, first
1208 return EOB_ACT_LAST_MATCH;
1212 /* Try to read more data. */
1214 /* First move last chars to start of buffer. */
1215 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1217 for ( i = 0; i < number_to_move; ++i )
1218 *(dest++) = *(source++);
1220 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1221 /* don't do the read, it's not guaranteed to return an EOF,
1224 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1229 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1231 while ( num_to_read <= 0 )
1232 { /* Not enough room in the buffer - grow it. */
1234 /* just a shorter name for the current buffer */
1235 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1237 int yy_c_buf_p_offset =
1238 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1240 if ( b->yy_is_our_buffer )
1242 int new_size = b->yy_buf_size * 2;
1244 if ( new_size <= 0 )
1245 b->yy_buf_size += b->yy_buf_size / 8;
1247 b->yy_buf_size *= 2;
1249 b->yy_ch_buf = (char *)
1250 /* Include room in for 2 EOB chars. */
1251 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1254 /* Can't grow it, we don't own it. */
1257 if ( ! b->yy_ch_buf )
1259 "fatal error - scanner input buffer overflow" );
1261 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1263 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1268 if ( num_to_read > YY_READ_BUF_SIZE )
1269 num_to_read = YY_READ_BUF_SIZE;
1271 /* Read in more data. */
1272 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1273 (yy_n_chars), (size_t) num_to_read );
1275 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1278 if ( (yy_n_chars) == 0 )
1280 if ( number_to_move == YY_MORE_ADJ )
1282 ret_val = EOB_ACT_END_OF_FILE;
1288 ret_val = EOB_ACT_LAST_MATCH;
1289 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1290 YY_BUFFER_EOF_PENDING;
1295 ret_val = EOB_ACT_CONTINUE_SCAN;
1297 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1298 /* Extend the array by 50%, plus the number we really need. */
1299 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1300 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1301 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1302 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1305 (yy_n_chars) += number_to_move;
1306 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1307 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1309 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1314 /* yy_get_previous_state - get the state just before the EOB char was reached */
1316 static yy_state_type yy_get_previous_state (void)
1318 register yy_state_type yy_current_state;
1319 register char *yy_cp;
1321 yy_current_state = (yy_start);
1323 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1325 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1326 if ( yy_accept[yy_current_state] )
1328 (yy_last_accepting_state) = yy_current_state;
1329 (yy_last_accepting_cpos) = yy_cp;
1331 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1333 yy_current_state = (int) yy_def[yy_current_state];
1334 if ( yy_current_state >= 94 )
1335 yy_c = yy_meta[(unsigned int) yy_c];
1337 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1340 return yy_current_state;
1343 /* yy_try_NUL_trans - try to make a transition on the NUL character
1346 * next_state = yy_try_NUL_trans( current_state );
1348 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1350 register int yy_is_jam;
1351 register char *yy_cp = (yy_c_buf_p);
1353 register YY_CHAR yy_c = 1;
1354 if ( yy_accept[yy_current_state] )
1356 (yy_last_accepting_state) = yy_current_state;
1357 (yy_last_accepting_cpos) = yy_cp;
1359 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1361 yy_current_state = (int) yy_def[yy_current_state];
1362 if ( yy_current_state >= 94 )
1363 yy_c = yy_meta[(unsigned int) yy_c];
1365 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1366 yy_is_jam = (yy_current_state == 93);
1368 return yy_is_jam ? 0 : yy_current_state;
1373 static int yyinput (void)
1375 static int input (void)
1381 *(yy_c_buf_p) = (yy_hold_char);
1383 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1385 /* yy_c_buf_p now points to the character we want to return.
1386 * If this occurs *before* the EOB characters, then it's a
1387 * valid NUL; if not, then we've hit the end of the buffer.
1389 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1390 /* This was really a NUL. */
1391 *(yy_c_buf_p) = '\0';
1394 { /* need more input */
1395 int offset = (yy_c_buf_p) - (yytext_ptr);
1398 switch ( yy_get_next_buffer( ) )
1400 case EOB_ACT_LAST_MATCH:
1401 /* This happens because yy_g_n_b()
1402 * sees that we've accumulated a
1403 * token and flags that we need to
1404 * try matching the token before
1405 * proceeding. But for input(),
1406 * there's no matching to consider.
1407 * So convert the EOB_ACT_LAST_MATCH
1408 * to EOB_ACT_END_OF_FILE.
1411 /* Reset buffer status. */
1416 case EOB_ACT_END_OF_FILE:
1421 if ( ! (yy_did_buffer_switch_on_eof) )
1430 case EOB_ACT_CONTINUE_SCAN:
1431 (yy_c_buf_p) = (yytext_ptr) + offset;
1437 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1438 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1439 (yy_hold_char) = *++(yy_c_buf_p);
1443 #endif /* ifndef YY_NO_INPUT */
1445 /** Immediately switch to a different input stream.
1446 * @param input_file A readable stream.
1448 * @note This function does not reset the start condition to @c INITIAL .
1450 void yyrestart (FILE * input_file )
1453 if ( ! YY_CURRENT_BUFFER ){
1454 yyensure_buffer_stack ();
1455 YY_CURRENT_BUFFER_LVALUE =
1456 yy_create_buffer(yyin,YY_BUF_SIZE );
1459 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1460 yy_load_buffer_state( );
1463 /** Switch to a different input buffer.
1464 * @param new_buffer The new input buffer.
1467 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1470 /* TODO. We should be able to replace this entire function body
1472 * yypop_buffer_state();
1473 * yypush_buffer_state(new_buffer);
1475 yyensure_buffer_stack ();
1476 if ( YY_CURRENT_BUFFER == new_buffer )
1479 if ( YY_CURRENT_BUFFER )
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);
1487 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1488 yy_load_buffer_state( );
1490 /* We don't actually know whether we did this switch during
1491 * EOF (yywrap()) processing, but the only time this flag
1492 * is looked at is after yywrap() is called, so it's safe
1493 * to go ahead and always set it.
1495 (yy_did_buffer_switch_on_eof) = 1;
1498 static void yy_load_buffer_state (void)
1500 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1501 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1502 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1503 (yy_hold_char) = *(yy_c_buf_p);
1506 /** Allocate and initialize an input buffer state.
1507 * @param file A readable stream.
1508 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1510 * @return the allocated buffer state.
1512 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1516 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1518 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1520 b->yy_buf_size = size;
1522 /* yy_ch_buf has to be 2 characters longer than the size given because
1523 * we need to put in 2 end-of-buffer characters.
1525 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1526 if ( ! b->yy_ch_buf )
1527 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1529 b->yy_is_our_buffer = 1;
1531 yy_init_buffer(b,file );
1536 /** Destroy the buffer.
1537 * @param b a buffer created with yy_create_buffer()
1540 void yy_delete_buffer (YY_BUFFER_STATE b )
1546 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1547 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1549 if ( b->yy_is_our_buffer )
1550 yyfree((void *) b->yy_ch_buf );
1552 yyfree((void *) b );
1555 /* Initializes or reinitializes a buffer.
1556 * This function is sometimes called more than once on the same buffer,
1557 * such as during a yyrestart() or at EOF.
1559 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1564 yy_flush_buffer(b );
1566 b->yy_input_file = file;
1567 b->yy_fill_buffer = 1;
1569 /* If b is the current buffer, then yy_init_buffer was _probably_
1570 * called from yyrestart() or through yy_get_next_buffer.
1571 * In that case, we don't want to reset the lineno or column.
1573 if (b != YY_CURRENT_BUFFER){
1574 b->yy_bs_lineno = 1;
1575 b->yy_bs_column = 0;
1578 b->yy_is_interactive = 0;
1583 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1584 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1587 void yy_flush_buffer (YY_BUFFER_STATE b )
1594 /* We always need two end-of-buffer characters. The first causes
1595 * a transition to the end-of-buffer state. The second causes
1596 * a jam in that state.
1598 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1599 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1601 b->yy_buf_pos = &b->yy_ch_buf[0];
1604 b->yy_buffer_status = YY_BUFFER_NEW;
1606 if ( b == YY_CURRENT_BUFFER )
1607 yy_load_buffer_state( );
1610 /** Pushes the new state onto the stack. The new state becomes
1611 * the current state. This function will allocate the stack
1613 * @param new_buffer The new state.
1616 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1618 if (new_buffer == NULL)
1621 yyensure_buffer_stack();
1623 /* This block is copied from yy_switch_to_buffer. */
1624 if ( YY_CURRENT_BUFFER )
1626 /* Flush out information for old buffer. */
1627 *(yy_c_buf_p) = (yy_hold_char);
1628 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1629 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1632 /* Only push if top exists. Otherwise, replace top. */
1633 if (YY_CURRENT_BUFFER)
1634 (yy_buffer_stack_top)++;
1635 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1637 /* copied from yy_switch_to_buffer. */
1638 yy_load_buffer_state( );
1639 (yy_did_buffer_switch_on_eof) = 1;
1642 /** Removes and deletes the top of the stack, if present.
1643 * The next element becomes the new top.
1646 void yypop_buffer_state (void)
1648 if (!YY_CURRENT_BUFFER)
1651 yy_delete_buffer(YY_CURRENT_BUFFER );
1652 YY_CURRENT_BUFFER_LVALUE = NULL;
1653 if ((yy_buffer_stack_top) > 0)
1654 --(yy_buffer_stack_top);
1656 if (YY_CURRENT_BUFFER) {
1657 yy_load_buffer_state( );
1658 (yy_did_buffer_switch_on_eof) = 1;
1662 /* Allocates the stack if it does not exist.
1663 * Guarantees space for at least one push.
1665 static void yyensure_buffer_stack (void)
1669 if (!(yy_buffer_stack)) {
1671 /* First allocation is just for 2 elements, since we don't know if this
1672 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1673 * immediate realloc on the next call.
1676 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1677 (num_to_alloc * sizeof(struct yy_buffer_state*)
1679 if ( ! (yy_buffer_stack) )
1680 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1682 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1684 (yy_buffer_stack_max) = num_to_alloc;
1685 (yy_buffer_stack_top) = 0;
1689 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1691 /* Increase the buffer to prepare for a possible push. */
1692 int grow_size = 8 /* arbitrary grow size */;
1694 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1695 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1697 num_to_alloc * sizeof(struct yy_buffer_state*)
1699 if ( ! (yy_buffer_stack) )
1700 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1702 /* zero only the new slots.*/
1703 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1704 (yy_buffer_stack_max) = num_to_alloc;
1708 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1709 * @param base the character buffer
1710 * @param size the size in bytes of the character buffer
1712 * @return the newly allocated buffer state object.
1714 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1719 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1720 base[size-1] != YY_END_OF_BUFFER_CHAR )
1721 /* They forgot to leave room for the EOB's. */
1724 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1726 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1728 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1729 b->yy_buf_pos = b->yy_ch_buf = base;
1730 b->yy_is_our_buffer = 0;
1731 b->yy_input_file = 0;
1732 b->yy_n_chars = b->yy_buf_size;
1733 b->yy_is_interactive = 0;
1735 b->yy_fill_buffer = 0;
1736 b->yy_buffer_status = YY_BUFFER_NEW;
1738 yy_switch_to_buffer(b );
1743 /** Setup the input buffer state to scan a string. The next call to yylex() will
1744 * scan from a @e copy of @a str.
1745 * @param yystr a NUL-terminated string to scan
1747 * @return the newly allocated buffer state object.
1748 * @note If you want to scan bytes that may contain NUL values, then use
1749 * yy_scan_bytes() instead.
1751 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1754 return yy_scan_bytes(yystr,strlen(yystr) );
1757 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1758 * scan from a @e copy of @a bytes.
1759 * @param yybytes the byte buffer to scan
1760 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1762 * @return the newly allocated buffer state object.
1764 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1771 /* Get memory for full buffer, including space for trailing EOB's. */
1772 n = _yybytes_len + 2;
1773 buf = (char *) yyalloc(n );
1775 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1777 for ( i = 0; i < _yybytes_len; ++i )
1778 buf[i] = yybytes[i];
1780 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1782 b = yy_scan_buffer(buf,n );
1784 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1786 /* It's okay to grow etc. this buffer, and we should throw it
1787 * away when we're done.
1789 b->yy_is_our_buffer = 1;
1794 #ifndef YY_EXIT_FAILURE
1795 #define YY_EXIT_FAILURE 2
1798 static void yy_fatal_error (yyconst char* msg )
1800 (void) fprintf( stderr, "%s\n", msg );
1801 exit( YY_EXIT_FAILURE );
1804 /* Redefine yyless() so it works in section 3 code. */
1810 /* Undo effects of setting up yytext. */ \
1811 int yyless_macro_arg = (n); \
1812 YY_LESS_LINENO(yyless_macro_arg);\
1813 yytext[yyleng] = (yy_hold_char); \
1814 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1815 (yy_hold_char) = *(yy_c_buf_p); \
1816 *(yy_c_buf_p) = '\0'; \
1817 yyleng = yyless_macro_arg; \
1821 /* Accessor methods (get/set functions) to struct members. */
1823 /** Get the current line number.
1826 int yyget_lineno (void)
1832 /** Get the input stream.
1835 FILE *yyget_in (void)
1840 /** Get the output stream.
1843 FILE *yyget_out (void)
1848 /** Get the length of the current token.
1851 int yyget_leng (void)
1856 /** Get the current token.
1860 char *yyget_text (void)
1865 /** Set the current line number.
1866 * @param line_number
1869 void yyset_lineno (int line_number )
1872 yylineno = line_number;
1875 /** Set the input stream. This does not discard the current
1877 * @param in_str A readable stream.
1879 * @see yy_switch_to_buffer
1881 void yyset_in (FILE * in_str )
1886 void yyset_out (FILE * out_str )
1891 int yyget_debug (void)
1893 return yy_flex_debug;
1896 void yyset_debug (int bdebug )
1898 yy_flex_debug = bdebug ;
1901 static int yy_init_globals (void)
1903 /* Initialization is the same as for the non-reentrant scanner.
1904 * This function is called from yylex_destroy(), so don't allocate here.
1907 (yy_buffer_stack) = 0;
1908 (yy_buffer_stack_top) = 0;
1909 (yy_buffer_stack_max) = 0;
1910 (yy_c_buf_p) = (char *) 0;
1914 /* Defined in main.c */
1923 /* For future reference: Set errno on error, since we are called by
1929 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1930 int yylex_destroy (void)
1933 /* Pop the buffer stack, destroying each element. */
1934 while(YY_CURRENT_BUFFER){
1935 yy_delete_buffer(YY_CURRENT_BUFFER );
1936 YY_CURRENT_BUFFER_LVALUE = NULL;
1937 yypop_buffer_state();
1940 /* Destroy the stack itself. */
1941 yyfree((yy_buffer_stack) );
1942 (yy_buffer_stack) = NULL;
1944 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1945 * yylex() is called, initialization will occur. */
1952 * Internal utility routines.
1956 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1959 for ( i = 0; i < n; ++i )
1964 #ifdef YY_NEED_STRLEN
1965 static int yy_flex_strlen (yyconst char * s )
1968 for ( n = 0; s[n]; ++n )
1975 void *yyalloc (yy_size_t size )
1977 return (void *) malloc( size );
1980 void *yyrealloc (void * ptr, yy_size_t size )
1982 /* The cast to (char *) in the following accommodates both
1983 * implementations that use char* generic pointers, and those
1984 * that use void* generic pointers. It works with the latter
1985 * because both ANSI C and C++ allow castless assignment from
1986 * any pointer type to void*, and deal with argument conversions
1987 * as though doing an assignment.
1989 return (void *) realloc( (char *) ptr, size );
1992 void yyfree (void * ptr )
1994 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1997 #define YYTABLES_NAME "yytables"
1999 #line 168 "dtc-lexer.l"
2003 static void push_input_file(const char *filename)
2007 srcfile_push(filename);
2009 yyin = current_srcfile->f;
2011 yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
2015 static int pop_input_file(void)
2017 if (srcfile_pop() == 0)
2020 yypop_buffer_state();
2021 yyin = current_srcfile->f;