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 34
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;
59 /* Limits of integral types. */
61 #define INT8_MIN (-128)
64 #define INT16_MIN (-32767-1)
67 #define INT32_MIN (-2147483647-1)
70 #define INT8_MAX (127)
73 #define INT16_MAX (32767)
76 #define INT32_MAX (2147483647)
79 #define UINT8_MAX (255U)
82 #define UINT16_MAX (65535U)
85 #define UINT32_MAX (4294967295U)
88 #endif /* ! FLEXINT_H */
92 /* The "const" storage-class-modifier is valid. */
95 #else /* ! __cplusplus */
97 /* C99 requires __STDC__ to be defined as 1. */
98 #if defined (__STDC__)
102 #endif /* defined (__STDC__) */
103 #endif /* ! __cplusplus */
106 #define yyconst const
111 /* Returned upon end-of-file. */
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
119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
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.
125 #define BEGIN (yy_start) = 1 + 2 *
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
131 #define YY_START (((yy_start) - 1) / 2)
132 #define YYSTATE YY_START
134 /* Action number for EOF rule of a given start state. */
135 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
137 /* Special action meaning "start processing a new file". */
138 #define YY_NEW_FILE yyrestart(yyin )
140 #define YY_END_OF_BUFFER_CHAR 0
142 /* Size of default input buffer. */
144 #define YY_BUF_SIZE 16384
147 /* The state buf must be large enough to hold one state per character in the main buffer.
149 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
151 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
152 #define YY_TYPEDEF_YY_BUFFER_STATE
153 typedef struct yy_buffer_state *YY_BUFFER_STATE;
158 extern FILE *yyin, *yyout;
160 #define EOB_ACT_CONTINUE_SCAN 0
161 #define EOB_ACT_END_OF_FILE 1
162 #define EOB_ACT_LAST_MATCH 2
164 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
165 * access to the local variable yy_act. Since yyless() is a macro, it would break
166 * existing scanners that call yyless() from OUTSIDE yylex.
167 * One obvious solution it to make yy_act a global. I tried that, and saw
168 * a 5% performance hit in a non-yylineno scanner, because yy_act is
169 * normally declared as a register variable-- so it is not worth it.
171 #define YY_LESS_LINENO(n) \
174 for ( yyl = n; yyl < yyleng; ++yyl )\
175 if ( yytext[yyl] == '\n' )\
179 /* Return all but the first "n" matched characters back to the input stream. */
183 /* Undo effects of setting up yytext. */ \
184 int yyless_macro_arg = (n); \
185 YY_LESS_LINENO(yyless_macro_arg);\
186 *yy_cp = (yy_hold_char); \
187 YY_RESTORE_YY_MORE_OFFSET \
188 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
189 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
193 #define unput(c) yyunput( c, (yytext_ptr) )
195 /* The following is because we cannot portably get our hands on size_t
196 * (without autoconf's help, which isn't available because we want
197 * flex-generated scanners to compile on their own).
198 * Given that the standard has decreed that size_t exists since 1989,
199 * I guess we can afford to depend on it. Manoj.
202 #ifndef YY_TYPEDEF_YY_SIZE_T
203 #define YY_TYPEDEF_YY_SIZE_T
204 typedef size_t yy_size_t;
207 #ifndef YY_STRUCT_YY_BUFFER_STATE
208 #define YY_STRUCT_YY_BUFFER_STATE
209 struct yy_buffer_state
213 char *yy_ch_buf; /* input buffer */
214 char *yy_buf_pos; /* current position in input buffer */
216 /* Size of input buffer in bytes, not including room for EOB
219 yy_size_t yy_buf_size;
221 /* Number of characters read into yy_ch_buf, not including EOB
226 /* Whether we "own" the buffer - i.e., we know we created it,
227 * and can realloc() it to grow it, and should free() it to
230 int yy_is_our_buffer;
232 /* Whether this is an "interactive" input source; if so, and
233 * if we're using stdio for input, then we want to use getc()
234 * instead of fread(), to make sure we stop fetching input after
237 int yy_is_interactive;
239 /* Whether we're considered to be at the beginning of a line.
240 * If so, '^' rules will be active on the next match, otherwise
245 int yy_bs_lineno; /**< The line count. */
246 int yy_bs_column; /**< The column count. */
248 /* Whether to try to fill the input buffer when we reach the
253 int yy_buffer_status;
255 #define YY_BUFFER_NEW 0
256 #define YY_BUFFER_NORMAL 1
257 /* When an EOF's been seen but there's still some text to process
258 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
259 * shouldn't try reading from the input source any more. We might
260 * still have a bunch of tokens to match, though, because of
261 * possible backing-up.
263 * When we actually see the EOF, we change the status to "new"
264 * (via yyrestart()), so that the user can continue scanning by
265 * just pointing yyin at a new input file.
267 #define YY_BUFFER_EOF_PENDING 2
270 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
272 /* Stack of input buffers. */
273 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
274 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
275 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
277 /* We provide macros for accessing buffer states in case in the
278 * future we want to put the buffer states in a more general
281 * Returns the top of the stack, or NULL.
283 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
284 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
287 /* Same as previous macro, but useful when we know that the buffer stack is not
288 * NULL or when we need an lvalue. For internal use only.
290 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
292 /* yy_hold_char holds the character lost when yytext is formed. */
293 static char yy_hold_char;
294 static int yy_n_chars; /* number of characters read into yy_ch_buf */
297 /* Points to current character in buffer. */
298 static char *yy_c_buf_p = (char *) 0;
299 static int yy_init = 0; /* whether we need to initialize */
300 static int yy_start = 0; /* start state number */
302 /* Flag which is used to allow yywrap()'s to do buffer switches
303 * instead of setting up a fresh yyin. A bit of a hack ...
305 static int yy_did_buffer_switch_on_eof;
307 void yyrestart (FILE *input_file );
308 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
309 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
310 void yy_delete_buffer (YY_BUFFER_STATE b );
311 void yy_flush_buffer (YY_BUFFER_STATE b );
312 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
313 void yypop_buffer_state (void );
315 static void yyensure_buffer_stack (void );
316 static void yy_load_buffer_state (void );
317 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
319 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
321 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
322 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
323 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
325 void *yyalloc (yy_size_t );
326 void *yyrealloc (void *,yy_size_t );
327 void yyfree (void * );
329 #define yy_new_buffer yy_create_buffer
331 #define yy_set_interactive(is_interactive) \
333 if ( ! YY_CURRENT_BUFFER ){ \
334 yyensure_buffer_stack (); \
335 YY_CURRENT_BUFFER_LVALUE = \
336 yy_create_buffer(yyin,YY_BUF_SIZE ); \
338 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
341 #define yy_set_bol(at_bol) \
343 if ( ! YY_CURRENT_BUFFER ){\
344 yyensure_buffer_stack (); \
345 YY_CURRENT_BUFFER_LVALUE = \
346 yy_create_buffer(yyin,YY_BUF_SIZE ); \
348 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
351 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
353 /* Begin user sect3 */
356 #define YY_SKIP_YYWRAP
358 typedef unsigned char YY_CHAR;
360 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
362 typedef int yy_state_type;
369 #define yytext_ptr yytext
371 static yy_state_type yy_get_previous_state (void );
372 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
373 static int yy_get_next_buffer (void );
374 static void yy_fatal_error (yyconst char msg[] );
376 /* Done after the current pattern has been matched and before the
377 * corresponding action - sets up yytext.
379 #define YY_DO_BEFORE_ACTION \
380 (yytext_ptr) = yy_bp; \
381 yyleng = (size_t) (yy_cp - yy_bp); \
382 (yy_hold_char) = *yy_cp; \
384 (yy_c_buf_p) = yy_cp;
386 #define YY_NUM_RULES 20
387 #define YY_END_OF_BUFFER 21
388 /* This struct is not used in this scanner,
389 but its presence is necessary. */
392 flex_int32_t yy_verify;
395 static yyconst flex_int16_t yy_accept[104] =
397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
398 21, 19, 16, 16, 19, 19, 19, 7, 7, 19,
399 7, 19, 19, 19, 19, 13, 14, 14, 19, 8,
400 8, 16, 0, 2, 0, 0, 9, 0, 0, 0,
401 0, 0, 0, 7, 7, 5, 0, 6, 0, 12,
402 12, 14, 14, 8, 0, 11, 9, 0, 0, 0,
403 0, 18, 0, 0, 0, 0, 8, 0, 17, 0,
404 0, 0, 0, 0, 10, 0, 0, 0, 0, 0,
405 0, 0, 0, 0, 0, 0, 0, 0, 3, 15,
406 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
411 static yyconst flex_int32_t yy_ec[256] =
413 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
414 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416 1, 2, 1, 4, 5, 1, 1, 6, 1, 1,
417 1, 7, 8, 8, 9, 8, 10, 11, 12, 13,
418 13, 13, 13, 13, 13, 13, 13, 14, 1, 1,
419 1, 1, 8, 8, 15, 15, 15, 15, 15, 15,
420 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
421 16, 16, 16, 16, 16, 16, 16, 17, 16, 16,
422 1, 18, 19, 1, 16, 1, 15, 20, 21, 22,
424 23, 15, 16, 24, 25, 16, 16, 26, 27, 28,
425 24, 16, 16, 29, 30, 31, 32, 33, 16, 17,
426 16, 16, 34, 1, 35, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
433 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
443 static yyconst flex_int32_t yy_meta[36] =
445 1, 1, 1, 1, 2, 1, 2, 2, 2, 3,
446 4, 4, 4, 5, 6, 7, 7, 1, 1, 6,
447 6, 6, 6, 7, 7, 7, 7, 7, 7, 7,
451 static yyconst flex_int16_t yy_base[117] =
453 0, 0, 30, 0, 44, 0, 67, 0, 97, 105,
454 302, 303, 35, 44, 40, 94, 112, 0, 129, 152,
455 296, 295, 159, 0, 176, 303, 0, 116, 95, 165,
456 49, 46, 102, 303, 296, 0, 0, 288, 290, 293,
457 264, 266, 270, 0, 0, 303, 0, 303, 264, 303,
458 0, 0, 195, 101, 0, 0, 0, 0, 284, 125,
459 277, 265, 225, 230, 216, 218, 0, 202, 224, 221,
460 217, 107, 196, 188, 303, 206, 179, 186, 178, 185,
461 183, 162, 161, 150, 169, 160, 145, 125, 303, 303,
462 137, 109, 190, 103, 203, 167, 108, 197, 303, 123,
464 29, 303, 303, 215, 221, 226, 229, 234, 240, 246,
465 250, 257, 265, 270, 275, 282
468 static yyconst flex_int16_t yy_def[117] =
470 103, 1, 1, 3, 3, 5, 103, 7, 3, 3,
471 103, 103, 103, 103, 104, 105, 103, 106, 103, 19,
472 19, 20, 103, 107, 20, 103, 108, 109, 105, 103,
473 103, 103, 104, 103, 104, 110, 111, 103, 112, 113,
474 103, 103, 103, 106, 19, 103, 20, 103, 103, 103,
475 20, 108, 109, 103, 114, 110, 111, 115, 112, 112,
476 113, 103, 103, 103, 103, 103, 114, 115, 103, 103,
477 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
478 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
479 103, 103, 103, 103, 103, 116, 103, 116, 103, 116,
481 103, 103, 0, 103, 103, 103, 103, 103, 103, 103,
482 103, 103, 103, 103, 103, 103
485 static yyconst flex_int16_t yy_nxt[339] =
487 12, 13, 14, 15, 12, 16, 12, 12, 12, 17,
488 18, 18, 18, 12, 19, 20, 20, 12, 12, 21,
489 19, 21, 19, 22, 20, 20, 20, 20, 20, 20,
490 20, 20, 20, 12, 12, 12, 32, 32, 102, 23,
491 12, 12, 12, 34, 20, 32, 32, 32, 32, 20,
492 20, 20, 20, 20, 24, 24, 24, 35, 25, 54,
493 54, 54, 26, 25, 25, 25, 25, 12, 13, 14,
494 15, 27, 12, 27, 27, 27, 23, 27, 27, 27,
495 12, 28, 28, 28, 12, 12, 28, 28, 28, 28,
496 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
498 12, 12, 29, 36, 103, 34, 17, 30, 31, 31,
499 29, 54, 54, 54, 17, 30, 31, 31, 39, 35,
500 52, 40, 52, 52, 52, 103, 78, 38, 38, 46,
501 101, 60, 79, 41, 69, 97, 42, 94, 43, 45,
502 45, 45, 46, 45, 47, 47, 93, 92, 45, 45,
503 45, 45, 47, 47, 47, 47, 47, 47, 47, 47,
504 47, 47, 47, 47, 47, 39, 47, 91, 40, 90,
505 99, 47, 47, 47, 47, 54, 54, 54, 89, 88,
506 41, 55, 87, 49, 100, 43, 51, 51, 51, 86,
507 51, 95, 95, 96, 85, 51, 51, 51, 51, 52,
509 99, 52, 52, 52, 95, 95, 96, 84, 46, 83,
510 82, 81, 39, 79, 100, 33, 33, 33, 33, 33,
511 33, 33, 33, 37, 80, 77, 37, 37, 37, 44,
512 40, 44, 50, 76, 50, 52, 75, 52, 74, 52,
513 52, 53, 73, 53, 53, 53, 53, 56, 56, 56,
514 72, 56, 56, 57, 71, 57, 57, 59, 59, 59,
515 59, 59, 59, 59, 59, 61, 61, 61, 61, 61,
516 61, 61, 61, 67, 70, 67, 68, 68, 68, 62,
517 68, 68, 98, 98, 98, 98, 98, 98, 98, 98,
518 60, 66, 65, 64, 63, 62, 60, 58, 103, 48,
520 48, 103, 11, 103, 103, 103, 103, 103, 103, 103,
521 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
522 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
523 103, 103, 103, 103, 103, 103, 103, 103
526 static yyconst flex_int16_t yy_chk[339] =
528 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
529 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
530 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
531 1, 1, 1, 1, 1, 3, 13, 13, 101, 3,
532 3, 3, 3, 15, 3, 14, 14, 32, 32, 3,
533 3, 3, 3, 3, 5, 5, 5, 15, 5, 31,
534 31, 31, 5, 5, 5, 5, 5, 7, 7, 7,
535 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
536 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
537 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
539 7, 7, 9, 16, 29, 33, 9, 9, 9, 9,
540 10, 54, 54, 54, 10, 10, 10, 10, 17, 33,
541 28, 17, 28, 28, 28, 100, 72, 16, 29, 28,
542 97, 60, 72, 17, 60, 94, 17, 92, 17, 19,
543 19, 19, 19, 19, 19, 19, 91, 88, 19, 19,
544 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
545 19, 19, 20, 20, 20, 23, 20, 87, 23, 86,
546 96, 20, 20, 20, 20, 30, 30, 30, 85, 84,
547 23, 30, 83, 23, 96, 23, 25, 25, 25, 82,
548 25, 93, 93, 93, 81, 25, 25, 25, 25, 53,
550 98, 53, 53, 53, 95, 95, 95, 80, 53, 79,
551 78, 77, 76, 74, 98, 104, 104, 104, 104, 104,
552 104, 104, 104, 105, 73, 71, 105, 105, 105, 106,
553 70, 106, 107, 69, 107, 108, 68, 108, 66, 108,
554 108, 109, 65, 109, 109, 109, 109, 110, 110, 110,
555 64, 110, 110, 111, 63, 111, 111, 112, 112, 112,
556 112, 112, 112, 112, 112, 113, 113, 113, 113, 113,
557 113, 113, 113, 114, 62, 114, 115, 115, 115, 61,
558 115, 115, 116, 116, 116, 116, 116, 116, 116, 116,
559 59, 49, 43, 42, 41, 40, 39, 38, 35, 22,
561 21, 11, 103, 103, 103, 103, 103, 103, 103, 103,
562 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
563 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
564 103, 103, 103, 103, 103, 103, 103, 103
567 /* Table of booleans, true if rule could match eol. */
568 static yyconst flex_int32_t yy_rule_can_match_eol[21] =
570 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
573 static yy_state_type yy_last_accepting_state;
574 static char *yy_last_accepting_cpos;
576 extern int yy_flex_debug;
577 int yy_flex_debug = 0;
579 /* The intent behind this definition is that it'll catch
580 * any uses of REJECT which flex missed.
582 #define REJECT reject_used_but_not_detected
583 #define yymore() yymore_used_but_not_detected
584 #define YY_MORE_ADJ 0
585 #define YY_RESTORE_YY_MORE_OFFSET
587 #line 1 "dtc-lexer.l"
589 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
592 * This program is free software; you can redistribute it and/or
593 * modify it under the terms of the GNU General Public License as
594 * published by the Free Software Foundation; either version 2 of the
595 * License, or (at your option) any later version.
597 * This program is distributed in the hope that it will be useful,
598 * but WITHOUT ANY WARRANTY; without even the implied warranty of
599 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
600 * General Public License for more details.
602 * You should have received a copy of the GNU General Public License
603 * along with this program; if not, write to the Free Software
604 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
611 #line 37 "dtc-lexer.l"
614 #include "dtc-parser.tab.h"
617 /*#define LEXDEBUG 1*/
620 #define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
622 #define DPRINT(fmt, ...) do { } while (0)
625 static int dts_version; /* = 0 */
627 #define BEGIN_DEFAULT() if (dts_version == 0) { \
628 DPRINT("<INITIAL>\n"); \
635 static void push_input_file(const char *filename);
636 static int pop_input_file(void);
637 #line 638 "dtc-lexer.lex.c"
642 #define PROPNODENAME 3
645 #ifndef YY_NO_UNISTD_H
646 /* Special case for "unistd.h", since it is non-ANSI. We include it way
647 * down here because we want the user's section 1 to have been scanned first.
648 * The user has a chance to override it with an option.
653 #ifndef YY_EXTRA_TYPE
654 #define YY_EXTRA_TYPE void *
657 static int yy_init_globals (void );
659 /* Macros after this point can all be overridden by user definitions in
663 #ifndef YY_SKIP_YYWRAP
665 extern "C" int yywrap (void );
667 extern int yywrap (void );
672 static void yy_flex_strncpy (char *,yyconst char *,int );
675 #ifdef YY_NEED_STRLEN
676 static int yy_flex_strlen (yyconst char * );
682 static int yyinput (void );
684 static int input (void );
689 /* Amount of stuff to slurp up with each read. */
690 #ifndef YY_READ_BUF_SIZE
691 #define YY_READ_BUF_SIZE 8192
694 /* Copy whatever the last rule matched to the standard output. */
696 /* This used to be an fputs(), but since the string might contain NUL's,
697 * we now use fwrite().
699 #define ECHO fwrite( yytext, yyleng, 1, yyout )
702 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
703 * is returned in "result".
706 #define YY_INPUT(buf,result,max_size) \
707 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
711 for ( n = 0; n < max_size && \
712 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
715 buf[n++] = (char) c; \
716 if ( c == EOF && ferror( yyin ) ) \
717 YY_FATAL_ERROR( "input in flex scanner failed" ); \
723 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
725 if( errno != EINTR) \
727 YY_FATAL_ERROR( "input in flex scanner failed" ); \
738 /* No semi-colon after return; correct usage is to write "yyterminate();" -
739 * we don't want an extra ';' after the "return" because that will cause
740 * some compilers to complain about unreachable statements.
743 #define yyterminate() return YY_NULL
746 /* Number of entries by which start-condition stack grows. */
747 #ifndef YY_START_STACK_INCR
748 #define YY_START_STACK_INCR 25
751 /* Report a fatal error. */
752 #ifndef YY_FATAL_ERROR
753 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
756 /* end tables serialization structures and prototypes */
758 /* Default declaration of generated scanner - a define so the user can
759 * easily add parameters.
762 #define YY_DECL_IS_OURS 1
764 extern int yylex (void);
766 #define YY_DECL int yylex (void)
767 #endif /* !YY_DECL */
769 /* Code executed at the beginning of each rule, after yytext and yyleng
772 #ifndef YY_USER_ACTION
773 #define YY_USER_ACTION
776 /* Code executed at the end of each rule. */
778 #define YY_BREAK break;
781 #define YY_RULE_SETUP \
784 /** The main scanner function which does all the work.
788 register yy_state_type yy_current_state;
789 register char *yy_cp, *yy_bp;
792 #line 64 "dtc-lexer.l"
794 #line 795 "dtc-lexer.lex.c"
805 (yy_start) = 1; /* first start state */
813 if ( ! YY_CURRENT_BUFFER ) {
814 yyensure_buffer_stack ();
815 YY_CURRENT_BUFFER_LVALUE =
816 yy_create_buffer(yyin,YY_BUF_SIZE );
819 yy_load_buffer_state( );
822 while ( 1 ) /* loops until end-of-file is reached */
824 yy_cp = (yy_c_buf_p);
826 /* Support of yytext. */
827 *yy_cp = (yy_hold_char);
829 /* yy_bp points to the position in yy_ch_buf of the start of
834 yy_current_state = (yy_start);
838 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
839 if ( yy_accept[yy_current_state] )
841 (yy_last_accepting_state) = yy_current_state;
842 (yy_last_accepting_cpos) = yy_cp;
844 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
846 yy_current_state = (int) yy_def[yy_current_state];
847 if ( yy_current_state >= 104 )
848 yy_c = yy_meta[(unsigned int) yy_c];
850 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
853 while ( yy_base[yy_current_state] != 303 );
856 yy_act = yy_accept[yy_current_state];
858 { /* have to back up */
859 yy_cp = (yy_last_accepting_cpos);
860 yy_current_state = (yy_last_accepting_state);
861 yy_act = yy_accept[yy_current_state];
866 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
869 for ( yyl = 0; yyl < yyleng; ++yyl )
870 if ( yytext[yyl] == '\n' )
876 do_action: /* This label is used only to access EOF actions. */
879 { /* beginning of action switch */
880 case 0: /* must back up */
881 /* undo the effects of YY_DO_BEFORE_ACTION */
882 *yy_cp = (yy_hold_char);
883 yy_cp = (yy_last_accepting_cpos);
884 yy_current_state = (yy_last_accepting_state);
888 /* rule 1 can match eol */
890 #line 65 "dtc-lexer.l"
892 char *name = strchr(yytext, '\"') + 1;
893 yytext[yyleng-1] = '\0';
894 push_input_file(name);
897 case YY_STATE_EOF(INITIAL):
898 case YY_STATE_EOF(INCLUDE):
899 case YY_STATE_EOF(BYTESTRING):
900 case YY_STATE_EOF(PROPNODENAME):
901 case YY_STATE_EOF(V1):
902 #line 71 "dtc-lexer.l"
904 if (!pop_input_file()) {
910 /* rule 2 can match eol */
912 #line 77 "dtc-lexer.l"
914 yylloc.file = srcpos_file;
915 yylloc.first_line = yylineno;
916 DPRINT("String: %s\n", yytext);
917 yylval.data = data_copy_escape_string(yytext+1,
919 yylloc.first_line = yylineno;
925 #line 87 "dtc-lexer.l"
927 yylloc.file = srcpos_file;
928 yylloc.first_line = yylineno;
929 DPRINT("Keyword: /dts-v1/\n");
937 #line 96 "dtc-lexer.l"
939 yylloc.file = srcpos_file;
940 yylloc.first_line = yylineno;
941 DPRINT("Keyword: /memreserve/\n");
943 return DT_MEMRESERVE;
948 #line 104 "dtc-lexer.l"
950 yylloc.file = srcpos_file;
951 yylloc.first_line = yylineno;
952 DPRINT("Label: %s\n", yytext);
953 yylval.labelref = strdup(yytext);
954 yylval.labelref[yyleng-1] = '\0';
960 #line 113 "dtc-lexer.l"
962 yylloc.file = srcpos_file;
963 yylloc.first_line = yylineno;
966 else if (*yytext == 'o')
968 else if (*yytext == 'd')
972 DPRINT("Base: %d\n", yylval.cbase);
978 #line 128 "dtc-lexer.l"
980 yylloc.file = srcpos_file;
981 yylloc.first_line = yylineno;
982 yylval.literal = strdup(yytext);
983 DPRINT("Literal: '%s'\n", yylval.literal);
984 return DT_LEGACYLITERAL;
989 #line 136 "dtc-lexer.l"
991 yylloc.file = srcpos_file;
992 yylloc.first_line = yylineno;
993 yylval.literal = strdup(yytext);
994 DPRINT("Literal: '%s'\n", yylval.literal);
1000 #line 144 "dtc-lexer.l"
1001 { /* label reference */
1002 yylloc.file = srcpos_file;
1003 yylloc.first_line = yylineno;
1004 DPRINT("Ref: %s\n", yytext+1);
1005 yylval.labelref = strdup(yytext+1);
1011 #line 152 "dtc-lexer.l"
1012 { /* new-style path reference */
1013 yylloc.file = srcpos_file;
1014 yylloc.first_line = yylineno;
1015 yytext[yyleng-1] = '\0';
1016 DPRINT("Ref: %s\n", yytext+2);
1017 yylval.labelref = strdup(yytext+2);
1023 #line 161 "dtc-lexer.l"
1024 { /* old-style path reference */
1025 yylloc.file = srcpos_file;
1026 yylloc.first_line = yylineno;
1027 DPRINT("Ref: %s\n", yytext+1);
1028 yylval.labelref = strdup(yytext+1);
1034 #line 169 "dtc-lexer.l"
1036 yylloc.file = srcpos_file;
1037 yylloc.first_line = yylineno;
1038 yylval.byte = strtol(yytext, NULL, 16);
1039 DPRINT("Byte: %02x\n", (int)yylval.byte);
1045 #line 177 "dtc-lexer.l"
1047 yylloc.file = srcpos_file;
1048 yylloc.first_line = yylineno;
1049 DPRINT("/BYTESTRING\n");
1056 #line 185 "dtc-lexer.l"
1058 yylloc.file = srcpos_file;
1059 yylloc.first_line = yylineno;
1060 DPRINT("PropNodeName: %s\n", yytext);
1061 yylval.propnodename = strdup(yytext);
1063 return DT_PROPNODENAME;
1068 #line 194 "dtc-lexer.l"
1070 yylloc.file = srcpos_file;
1071 yylloc.first_line = yylineno;
1072 DPRINT("Binary Include\n");
1077 /* rule 16 can match eol */
1079 #line 201 "dtc-lexer.l"
1080 /* eat whitespace */
1083 /* rule 17 can match eol */
1085 #line 202 "dtc-lexer.l"
1086 /* eat C-style comments */
1089 /* rule 18 can match eol */
1091 #line 203 "dtc-lexer.l"
1092 /* eat C++-style comments */
1096 #line 205 "dtc-lexer.l"
1098 yylloc.file = srcpos_file;
1099 yylloc.first_line = yylineno;
1100 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1101 (unsigned)yytext[0]);
1102 if (yytext[0] == '[') {
1103 DPRINT("<BYTESTRING>\n");
1106 if ((yytext[0] == '{')
1107 || (yytext[0] == ';')) {
1108 DPRINT("<PROPNODENAME>\n");
1109 BEGIN(PROPNODENAME);
1116 #line 222 "dtc-lexer.l"
1119 #line 1120 "dtc-lexer.lex.c"
1121 case YY_END_OF_BUFFER:
1123 /* Amount of text matched not including the EOB char. */
1124 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1126 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1127 *yy_cp = (yy_hold_char);
1128 YY_RESTORE_YY_MORE_OFFSET
1130 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1132 /* We're scanning a new file or input source. It's
1133 * possible that this happened because the user
1134 * just pointed yyin at a new source and called
1135 * yylex(). If so, then we have to assure
1136 * consistency between YY_CURRENT_BUFFER and our
1137 * globals. Here is the right place to do so, because
1138 * this is the first action (other than possibly a
1139 * back-up) that will match for the new input source.
1141 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1142 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1143 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1146 /* Note that here we test for yy_c_buf_p "<=" to the position
1147 * of the first EOB in the buffer, since yy_c_buf_p will
1148 * already have been incremented past the NUL character
1149 * (since all states make transitions on EOB to the
1150 * end-of-buffer state). Contrast this with the test
1153 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1154 { /* This was really a NUL. */
1155 yy_state_type yy_next_state;
1157 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1159 yy_current_state = yy_get_previous_state( );
1161 /* Okay, we're now positioned to make the NUL
1162 * transition. We couldn't have
1163 * yy_get_previous_state() go ahead and do it
1164 * for us because it doesn't know how to deal
1165 * with the possibility of jamming (and we don't
1166 * want to build jamming into it because then it
1167 * will run more slowly).
1170 yy_next_state = yy_try_NUL_trans( yy_current_state );
1172 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1174 if ( yy_next_state )
1176 /* Consume the NUL. */
1177 yy_cp = ++(yy_c_buf_p);
1178 yy_current_state = yy_next_state;
1184 yy_cp = (yy_c_buf_p);
1185 goto yy_find_action;
1189 else switch ( yy_get_next_buffer( ) )
1191 case EOB_ACT_END_OF_FILE:
1193 (yy_did_buffer_switch_on_eof) = 0;
1197 /* Note: because we've taken care in
1198 * yy_get_next_buffer() to have set up
1199 * yytext, we can now set up
1200 * yy_c_buf_p so that if some total
1201 * hoser (like flex itself) wants to
1202 * call the scanner after we return the
1203 * YY_NULL, it'll still work - another
1204 * YY_NULL will get returned.
1206 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1208 yy_act = YY_STATE_EOF(YY_START);
1214 if ( ! (yy_did_buffer_switch_on_eof) )
1220 case EOB_ACT_CONTINUE_SCAN:
1222 (yytext_ptr) + yy_amount_of_matched_text;
1224 yy_current_state = yy_get_previous_state( );
1226 yy_cp = (yy_c_buf_p);
1227 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1230 case EOB_ACT_LAST_MATCH:
1232 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1234 yy_current_state = yy_get_previous_state( );
1236 yy_cp = (yy_c_buf_p);
1237 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1238 goto yy_find_action;
1245 "fatal flex scanner internal error--no action found" );
1246 } /* end of action switch */
1247 } /* end of scanning one token */
1248 } /* end of yylex */
1250 /* yy_get_next_buffer - try to read in a new buffer
1252 * Returns a code representing an action:
1253 * EOB_ACT_LAST_MATCH -
1254 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1255 * EOB_ACT_END_OF_FILE - end of file
1257 static int yy_get_next_buffer (void)
1259 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1260 register char *source = (yytext_ptr);
1261 register int number_to_move, i;
1264 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1266 "fatal flex scanner internal error--end of buffer missed" );
1268 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1269 { /* Don't try to fill the buffer, so this is an EOF. */
1270 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1272 /* We matched a single character, the EOB, so
1273 * treat this as a final EOF.
1275 return EOB_ACT_END_OF_FILE;
1280 /* We matched some text prior to the EOB, first
1283 return EOB_ACT_LAST_MATCH;
1287 /* Try to read more data. */
1289 /* First move last chars to start of buffer. */
1290 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1292 for ( i = 0; i < number_to_move; ++i )
1293 *(dest++) = *(source++);
1295 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1296 /* don't do the read, it's not guaranteed to return an EOF,
1299 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1304 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1306 while ( num_to_read <= 0 )
1307 { /* Not enough room in the buffer - grow it. */
1309 /* just a shorter name for the current buffer */
1310 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1312 int yy_c_buf_p_offset =
1313 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1315 if ( b->yy_is_our_buffer )
1317 int new_size = b->yy_buf_size * 2;
1319 if ( new_size <= 0 )
1320 b->yy_buf_size += b->yy_buf_size / 8;
1322 b->yy_buf_size *= 2;
1324 b->yy_ch_buf = (char *)
1325 /* Include room in for 2 EOB chars. */
1326 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1329 /* Can't grow it, we don't own it. */
1332 if ( ! b->yy_ch_buf )
1334 "fatal error - scanner input buffer overflow" );
1336 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1338 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1343 if ( num_to_read > YY_READ_BUF_SIZE )
1344 num_to_read = YY_READ_BUF_SIZE;
1346 /* Read in more data. */
1347 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1348 (yy_n_chars), (size_t) num_to_read );
1350 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1353 if ( (yy_n_chars) == 0 )
1355 if ( number_to_move == YY_MORE_ADJ )
1357 ret_val = EOB_ACT_END_OF_FILE;
1363 ret_val = EOB_ACT_LAST_MATCH;
1364 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1365 YY_BUFFER_EOF_PENDING;
1370 ret_val = EOB_ACT_CONTINUE_SCAN;
1372 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1373 /* Extend the array by 50%, plus the number we really need. */
1374 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1375 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1376 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1377 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1380 (yy_n_chars) += number_to_move;
1381 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1382 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1384 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1389 /* yy_get_previous_state - get the state just before the EOB char was reached */
1391 static yy_state_type yy_get_previous_state (void)
1393 register yy_state_type yy_current_state;
1394 register char *yy_cp;
1396 yy_current_state = (yy_start);
1398 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1400 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1401 if ( yy_accept[yy_current_state] )
1403 (yy_last_accepting_state) = yy_current_state;
1404 (yy_last_accepting_cpos) = yy_cp;
1406 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1408 yy_current_state = (int) yy_def[yy_current_state];
1409 if ( yy_current_state >= 104 )
1410 yy_c = yy_meta[(unsigned int) yy_c];
1412 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1415 return yy_current_state;
1418 /* yy_try_NUL_trans - try to make a transition on the NUL character
1421 * next_state = yy_try_NUL_trans( current_state );
1423 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1425 register int yy_is_jam;
1426 register char *yy_cp = (yy_c_buf_p);
1428 register YY_CHAR yy_c = 1;
1429 if ( yy_accept[yy_current_state] )
1431 (yy_last_accepting_state) = yy_current_state;
1432 (yy_last_accepting_cpos) = yy_cp;
1434 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1436 yy_current_state = (int) yy_def[yy_current_state];
1437 if ( yy_current_state >= 104 )
1438 yy_c = yy_meta[(unsigned int) yy_c];
1440 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1441 yy_is_jam = (yy_current_state == 103);
1443 return yy_is_jam ? 0 : yy_current_state;
1448 static int yyinput (void)
1450 static int input (void)
1456 *(yy_c_buf_p) = (yy_hold_char);
1458 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1460 /* yy_c_buf_p now points to the character we want to return.
1461 * If this occurs *before* the EOB characters, then it's a
1462 * valid NUL; if not, then we've hit the end of the buffer.
1464 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1465 /* This was really a NUL. */
1466 *(yy_c_buf_p) = '\0';
1469 { /* need more input */
1470 int offset = (yy_c_buf_p) - (yytext_ptr);
1473 switch ( yy_get_next_buffer( ) )
1475 case EOB_ACT_LAST_MATCH:
1476 /* This happens because yy_g_n_b()
1477 * sees that we've accumulated a
1478 * token and flags that we need to
1479 * try matching the token before
1480 * proceeding. But for input(),
1481 * there's no matching to consider.
1482 * So convert the EOB_ACT_LAST_MATCH
1483 * to EOB_ACT_END_OF_FILE.
1486 /* Reset buffer status. */
1491 case EOB_ACT_END_OF_FILE:
1496 if ( ! (yy_did_buffer_switch_on_eof) )
1505 case EOB_ACT_CONTINUE_SCAN:
1506 (yy_c_buf_p) = (yytext_ptr) + offset;
1512 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1513 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1514 (yy_hold_char) = *++(yy_c_buf_p);
1523 #endif /* ifndef YY_NO_INPUT */
1525 /** Immediately switch to a different input stream.
1526 * @param input_file A readable stream.
1528 * @note This function does not reset the start condition to @c INITIAL .
1530 void yyrestart (FILE * input_file )
1533 if ( ! YY_CURRENT_BUFFER ){
1534 yyensure_buffer_stack ();
1535 YY_CURRENT_BUFFER_LVALUE =
1536 yy_create_buffer(yyin,YY_BUF_SIZE );
1539 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1540 yy_load_buffer_state( );
1543 /** Switch to a different input buffer.
1544 * @param new_buffer The new input buffer.
1547 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1550 /* TODO. We should be able to replace this entire function body
1552 * yypop_buffer_state();
1553 * yypush_buffer_state(new_buffer);
1555 yyensure_buffer_stack ();
1556 if ( YY_CURRENT_BUFFER == new_buffer )
1559 if ( YY_CURRENT_BUFFER )
1561 /* Flush out information for old buffer. */
1562 *(yy_c_buf_p) = (yy_hold_char);
1563 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1564 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1567 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1568 yy_load_buffer_state( );
1570 /* We don't actually know whether we did this switch during
1571 * EOF (yywrap()) processing, but the only time this flag
1572 * is looked at is after yywrap() is called, so it's safe
1573 * to go ahead and always set it.
1575 (yy_did_buffer_switch_on_eof) = 1;
1578 static void yy_load_buffer_state (void)
1580 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1581 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1582 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1583 (yy_hold_char) = *(yy_c_buf_p);
1586 /** Allocate and initialize an input buffer state.
1587 * @param file A readable stream.
1588 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1590 * @return the allocated buffer state.
1592 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1596 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1598 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1600 b->yy_buf_size = size;
1602 /* yy_ch_buf has to be 2 characters longer than the size given because
1603 * we need to put in 2 end-of-buffer characters.
1605 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1606 if ( ! b->yy_ch_buf )
1607 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1609 b->yy_is_our_buffer = 1;
1611 yy_init_buffer(b,file );
1616 /** Destroy the buffer.
1617 * @param b a buffer created with yy_create_buffer()
1620 void yy_delete_buffer (YY_BUFFER_STATE b )
1626 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1627 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1629 if ( b->yy_is_our_buffer )
1630 yyfree((void *) b->yy_ch_buf );
1632 yyfree((void *) b );
1636 extern int isatty (int );
1637 #endif /* __cplusplus */
1639 /* Initializes or reinitializes a buffer.
1640 * This function is sometimes called more than once on the same buffer,
1641 * such as during a yyrestart() or at EOF.
1643 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1648 yy_flush_buffer(b );
1650 b->yy_input_file = file;
1651 b->yy_fill_buffer = 1;
1653 /* If b is the current buffer, then yy_init_buffer was _probably_
1654 * called from yyrestart() or through yy_get_next_buffer.
1655 * In that case, we don't want to reset the lineno or column.
1657 if (b != YY_CURRENT_BUFFER){
1658 b->yy_bs_lineno = 1;
1659 b->yy_bs_column = 0;
1662 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1667 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1668 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1671 void yy_flush_buffer (YY_BUFFER_STATE b )
1678 /* We always need two end-of-buffer characters. The first causes
1679 * a transition to the end-of-buffer state. The second causes
1680 * a jam in that state.
1682 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1683 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1685 b->yy_buf_pos = &b->yy_ch_buf[0];
1688 b->yy_buffer_status = YY_BUFFER_NEW;
1690 if ( b == YY_CURRENT_BUFFER )
1691 yy_load_buffer_state( );
1694 /** Pushes the new state onto the stack. The new state becomes
1695 * the current state. This function will allocate the stack
1697 * @param new_buffer The new state.
1700 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1702 if (new_buffer == NULL)
1705 yyensure_buffer_stack();
1707 /* This block is copied from yy_switch_to_buffer. */
1708 if ( YY_CURRENT_BUFFER )
1710 /* Flush out information for old buffer. */
1711 *(yy_c_buf_p) = (yy_hold_char);
1712 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1713 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1716 /* Only push if top exists. Otherwise, replace top. */
1717 if (YY_CURRENT_BUFFER)
1718 (yy_buffer_stack_top)++;
1719 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1721 /* copied from yy_switch_to_buffer. */
1722 yy_load_buffer_state( );
1723 (yy_did_buffer_switch_on_eof) = 1;
1726 /** Removes and deletes the top of the stack, if present.
1727 * The next element becomes the new top.
1730 void yypop_buffer_state (void)
1732 if (!YY_CURRENT_BUFFER)
1735 yy_delete_buffer(YY_CURRENT_BUFFER );
1736 YY_CURRENT_BUFFER_LVALUE = NULL;
1737 if ((yy_buffer_stack_top) > 0)
1738 --(yy_buffer_stack_top);
1740 if (YY_CURRENT_BUFFER) {
1741 yy_load_buffer_state( );
1742 (yy_did_buffer_switch_on_eof) = 1;
1746 /* Allocates the stack if it does not exist.
1747 * Guarantees space for at least one push.
1749 static void yyensure_buffer_stack (void)
1753 if (!(yy_buffer_stack)) {
1755 /* First allocation is just for 2 elements, since we don't know if this
1756 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1757 * immediate realloc on the next call.
1760 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1761 (num_to_alloc * sizeof(struct yy_buffer_state*)
1763 if ( ! (yy_buffer_stack) )
1764 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1766 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1768 (yy_buffer_stack_max) = num_to_alloc;
1769 (yy_buffer_stack_top) = 0;
1773 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1775 /* Increase the buffer to prepare for a possible push. */
1776 int grow_size = 8 /* arbitrary grow size */;
1778 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1779 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1781 num_to_alloc * sizeof(struct yy_buffer_state*)
1783 if ( ! (yy_buffer_stack) )
1784 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1786 /* zero only the new slots.*/
1787 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1788 (yy_buffer_stack_max) = num_to_alloc;
1792 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1793 * @param base the character buffer
1794 * @param size the size in bytes of the character buffer
1796 * @return the newly allocated buffer state object.
1798 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1803 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1804 base[size-1] != YY_END_OF_BUFFER_CHAR )
1805 /* They forgot to leave room for the EOB's. */
1808 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1810 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1812 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1813 b->yy_buf_pos = b->yy_ch_buf = base;
1814 b->yy_is_our_buffer = 0;
1815 b->yy_input_file = 0;
1816 b->yy_n_chars = b->yy_buf_size;
1817 b->yy_is_interactive = 0;
1819 b->yy_fill_buffer = 0;
1820 b->yy_buffer_status = YY_BUFFER_NEW;
1822 yy_switch_to_buffer(b );
1827 /** Setup the input buffer state to scan a string. The next call to yylex() will
1828 * scan from a @e copy of @a str.
1829 * @param yystr a NUL-terminated string to scan
1831 * @return the newly allocated buffer state object.
1832 * @note If you want to scan bytes that may contain NUL values, then use
1833 * yy_scan_bytes() instead.
1835 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1838 return yy_scan_bytes(yystr,strlen(yystr) );
1841 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1842 * scan from a @e copy of @a bytes.
1843 * @param bytes the byte buffer to scan
1844 * @param len the number of bytes in the buffer pointed to by @a bytes.
1846 * @return the newly allocated buffer state object.
1848 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1855 /* Get memory for full buffer, including space for trailing EOB's. */
1856 n = _yybytes_len + 2;
1857 buf = (char *) yyalloc(n );
1859 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1861 for ( i = 0; i < _yybytes_len; ++i )
1862 buf[i] = yybytes[i];
1864 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1866 b = yy_scan_buffer(buf,n );
1868 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1870 /* It's okay to grow etc. this buffer, and we should throw it
1871 * away when we're done.
1873 b->yy_is_our_buffer = 1;
1878 #ifndef YY_EXIT_FAILURE
1879 #define YY_EXIT_FAILURE 2
1882 static void yy_fatal_error (yyconst char* msg )
1884 (void) fprintf( stderr, "%s\n", msg );
1885 exit( YY_EXIT_FAILURE );
1888 /* Redefine yyless() so it works in section 3 code. */
1894 /* Undo effects of setting up yytext. */ \
1895 int yyless_macro_arg = (n); \
1896 YY_LESS_LINENO(yyless_macro_arg);\
1897 yytext[yyleng] = (yy_hold_char); \
1898 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1899 (yy_hold_char) = *(yy_c_buf_p); \
1900 *(yy_c_buf_p) = '\0'; \
1901 yyleng = yyless_macro_arg; \
1905 /* Accessor methods (get/set functions) to struct members. */
1907 /** Get the current line number.
1910 int yyget_lineno (void)
1916 /** Get the input stream.
1919 FILE *yyget_in (void)
1924 /** Get the output stream.
1927 FILE *yyget_out (void)
1932 /** Get the length of the current token.
1935 int yyget_leng (void)
1940 /** Get the current token.
1944 char *yyget_text (void)
1949 /** Set the current line number.
1950 * @param line_number
1953 void yyset_lineno (int line_number )
1956 yylineno = line_number;
1959 /** Set the input stream. This does not discard the current
1961 * @param in_str A readable stream.
1963 * @see yy_switch_to_buffer
1965 void yyset_in (FILE * in_str )
1970 void yyset_out (FILE * out_str )
1975 int yyget_debug (void)
1977 return yy_flex_debug;
1980 void yyset_debug (int bdebug )
1982 yy_flex_debug = bdebug ;
1985 static int yy_init_globals (void)
1987 /* Initialization is the same as for the non-reentrant scanner.
1988 * This function is called from yylex_destroy(), so don't allocate here.
1991 /* We do not touch yylineno unless the option is enabled. */
1994 (yy_buffer_stack) = 0;
1995 (yy_buffer_stack_top) = 0;
1996 (yy_buffer_stack_max) = 0;
1997 (yy_c_buf_p) = (char *) 0;
2001 /* Defined in main.c */
2010 /* For future reference: Set errno on error, since we are called by
2016 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2017 int yylex_destroy (void)
2020 /* Pop the buffer stack, destroying each element. */
2021 while(YY_CURRENT_BUFFER){
2022 yy_delete_buffer(YY_CURRENT_BUFFER );
2023 YY_CURRENT_BUFFER_LVALUE = NULL;
2024 yypop_buffer_state();
2027 /* Destroy the stack itself. */
2028 yyfree((yy_buffer_stack) );
2029 (yy_buffer_stack) = NULL;
2031 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2032 * yylex() is called, initialization will occur. */
2039 * Internal utility routines.
2043 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2046 for ( i = 0; i < n; ++i )
2051 #ifdef YY_NEED_STRLEN
2052 static int yy_flex_strlen (yyconst char * s )
2055 for ( n = 0; s[n]; ++n )
2062 void *yyalloc (yy_size_t size )
2064 return (void *) malloc( size );
2067 void *yyrealloc (void * ptr, yy_size_t size )
2069 /* The cast to (char *) in the following accommodates both
2070 * implementations that use char* generic pointers, and those
2071 * that use void* generic pointers. It works with the latter
2072 * because both ANSI C and C++ allow castless assignment from
2073 * any pointer type to void*, and deal with argument conversions
2074 * as though doing an assignment.
2076 return (void *) realloc( (char *) ptr, size );
2079 void yyfree (void * ptr )
2081 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2084 #define YYTABLES_NAME "yytables"
2086 #line 222 "dtc-lexer.l"
2092 * Stack of nested include file contexts.
2096 struct dtc_file *file;
2097 YY_BUFFER_STATE yy_prev_buf;
2099 struct incl_file *prev;
2102 static struct incl_file *incl_file_stack;
2106 * Detect infinite include recursion.
2108 #define MAX_INCLUDE_DEPTH (100)
2110 static int incl_depth = 0;
2113 static void push_input_file(const char *filename)
2115 struct incl_file *incl_file;
2116 struct dtc_file *newfile;
2117 struct search_path search, *searchptr = NULL;
2121 if (incl_depth++ >= MAX_INCLUDE_DEPTH)
2122 die("Includes nested too deeply");
2125 search.dir = srcpos_file->dir;
2128 searchptr = &search;
2131 newfile = dtc_open_file(filename, searchptr);
2133 incl_file = xmalloc(sizeof(struct incl_file));
2136 * Save current context.
2138 incl_file->yy_prev_buf = YY_CURRENT_BUFFER;
2139 incl_file->yy_prev_lineno = yylineno;
2140 incl_file->file = srcpos_file;
2141 incl_file->prev = incl_file_stack;
2143 incl_file_stack = incl_file;
2146 * Establish new context.
2148 srcpos_file = newfile;
2150 yyin = newfile->file;
2151 yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
2155 static int pop_input_file(void)
2157 struct incl_file *incl_file;
2159 if (incl_file_stack == 0)
2162 dtc_close_file(srcpos_file);
2168 incl_file = incl_file_stack;
2169 incl_file_stack = incl_file->prev;
2172 * Recover old context.
2174 yy_delete_buffer(YY_CURRENT_BUFFER);
2175 yy_switch_to_buffer(incl_file->yy_prev_buf);
2176 yylineno = incl_file->yy_prev_lineno;
2177 srcpos_file = incl_file->file;
2178 yyin = incl_file->file ? incl_file->file->file : NULL;