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 33
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 __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 */
101 #endif /* __STDC__ */
102 #endif /* ! __cplusplus */
105 #define yyconst const
110 /* Returned upon end-of-file. */
113 /* Promotes a possibly negative, possibly signed char to an unsigned
114 * integer for use as an array index. If the signed char is negative,
115 * we want to instead treat it as an 8-bit unsigned char, hence the
118 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
120 /* Enter a start condition. This macro really ought to take a parameter,
121 * but we do it the disgusting crufty way forced on us by the ()-less
122 * definition of BEGIN.
124 #define BEGIN (yy_start) = 1 + 2 *
126 /* Translate the current start state into a value that can be later handed
127 * to BEGIN to return to the state. The YYSTATE alias is for lex
130 #define YY_START (((yy_start) - 1) / 2)
131 #define YYSTATE YY_START
133 /* Action number for EOF rule of a given start state. */
134 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
136 /* Special action meaning "start processing a new file". */
137 #define YY_NEW_FILE yyrestart(yyin )
139 #define YY_END_OF_BUFFER_CHAR 0
141 /* Size of default input buffer. */
143 #define YY_BUF_SIZE 16384
146 /* The state buf must be large enough to hold one state per character in the main buffer.
148 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
150 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
151 #define YY_TYPEDEF_YY_BUFFER_STATE
152 typedef struct yy_buffer_state *YY_BUFFER_STATE;
157 extern FILE *yyin, *yyout;
159 #define EOB_ACT_CONTINUE_SCAN 0
160 #define EOB_ACT_END_OF_FILE 1
161 #define EOB_ACT_LAST_MATCH 2
163 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
164 * access to the local variable yy_act. Since yyless() is a macro, it would break
165 * existing scanners that call yyless() from OUTSIDE yylex.
166 * One obvious solution it to make yy_act a global. I tried that, and saw
167 * a 5% performance hit in a non-yylineno scanner, because yy_act is
168 * normally declared as a register variable-- so it is not worth it.
170 #define YY_LESS_LINENO(n) \
173 for ( yyl = n; yyl < yyleng; ++yyl )\
174 if ( yytext[yyl] == '\n' )\
178 /* Return all but the first "n" matched characters back to the input stream. */
182 /* Undo effects of setting up yytext. */ \
183 int yyless_macro_arg = (n); \
184 YY_LESS_LINENO(yyless_macro_arg);\
185 *yy_cp = (yy_hold_char); \
186 YY_RESTORE_YY_MORE_OFFSET \
187 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
188 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
192 #define unput(c) yyunput( c, (yytext_ptr) )
194 /* The following is because we cannot portably get our hands on size_t
195 * (without autoconf's help, which isn't available because we want
196 * flex-generated scanners to compile on their own).
199 #ifndef YY_TYPEDEF_YY_SIZE_T
200 #define YY_TYPEDEF_YY_SIZE_T
201 typedef unsigned int yy_size_t;
204 #ifndef YY_STRUCT_YY_BUFFER_STATE
205 #define YY_STRUCT_YY_BUFFER_STATE
206 struct yy_buffer_state
210 char *yy_ch_buf; /* input buffer */
211 char *yy_buf_pos; /* current position in input buffer */
213 /* Size of input buffer in bytes, not including room for EOB
216 yy_size_t yy_buf_size;
218 /* Number of characters read into yy_ch_buf, not including EOB
223 /* Whether we "own" the buffer - i.e., we know we created it,
224 * and can realloc() it to grow it, and should free() it to
227 int yy_is_our_buffer;
229 /* Whether this is an "interactive" input source; if so, and
230 * if we're using stdio for input, then we want to use getc()
231 * instead of fread(), to make sure we stop fetching input after
234 int yy_is_interactive;
236 /* Whether we're considered to be at the beginning of a line.
237 * If so, '^' rules will be active on the next match, otherwise
242 int yy_bs_lineno; /**< The line count. */
243 int yy_bs_column; /**< The column count. */
245 /* Whether to try to fill the input buffer when we reach the
250 int yy_buffer_status;
252 #define YY_BUFFER_NEW 0
253 #define YY_BUFFER_NORMAL 1
254 /* When an EOF's been seen but there's still some text to process
255 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
256 * shouldn't try reading from the input source any more. We might
257 * still have a bunch of tokens to match, though, because of
258 * possible backing-up.
260 * When we actually see the EOF, we change the status to "new"
261 * (via yyrestart()), so that the user can continue scanning by
262 * just pointing yyin at a new input file.
264 #define YY_BUFFER_EOF_PENDING 2
267 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
269 /* Stack of input buffers. */
270 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
271 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
272 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
274 /* We provide macros for accessing buffer states in case in the
275 * future we want to put the buffer states in a more general
278 * Returns the top of the stack, or NULL.
280 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
281 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
284 /* Same as previous macro, but useful when we know that the buffer stack is not
285 * NULL or when we need an lvalue. For internal use only.
287 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
289 /* yy_hold_char holds the character lost when yytext is formed. */
290 static char yy_hold_char;
291 static int yy_n_chars; /* number of characters read into yy_ch_buf */
294 /* Points to current character in buffer. */
295 static char *yy_c_buf_p = (char *) 0;
296 static int yy_init = 0; /* whether we need to initialize */
297 static int yy_start = 0; /* start state number */
299 /* Flag which is used to allow yywrap()'s to do buffer switches
300 * instead of setting up a fresh yyin. A bit of a hack ...
302 static int yy_did_buffer_switch_on_eof;
304 void yyrestart (FILE *input_file );
305 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
306 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
307 void yy_delete_buffer (YY_BUFFER_STATE b );
308 void yy_flush_buffer (YY_BUFFER_STATE b );
309 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
310 void yypop_buffer_state (void );
312 static void yyensure_buffer_stack (void );
313 static void yy_load_buffer_state (void );
314 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
316 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
318 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
319 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
320 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
322 void *yyalloc (yy_size_t );
323 void *yyrealloc (void *,yy_size_t );
324 void yyfree (void * );
326 #define yy_new_buffer yy_create_buffer
328 #define yy_set_interactive(is_interactive) \
330 if ( ! YY_CURRENT_BUFFER ){ \
331 yyensure_buffer_stack (); \
332 YY_CURRENT_BUFFER_LVALUE = \
333 yy_create_buffer(yyin,YY_BUF_SIZE ); \
335 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
338 #define yy_set_bol(at_bol) \
340 if ( ! YY_CURRENT_BUFFER ){\
341 yyensure_buffer_stack (); \
342 YY_CURRENT_BUFFER_LVALUE = \
343 yy_create_buffer(yyin,YY_BUF_SIZE ); \
345 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
348 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
350 /* Begin user sect3 */
353 #define YY_SKIP_YYWRAP
355 typedef unsigned char YY_CHAR;
357 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
359 typedef int yy_state_type;
366 #define yytext_ptr yytext
368 static yy_state_type yy_get_previous_state (void );
369 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
370 static int yy_get_next_buffer (void );
371 static void yy_fatal_error (yyconst char msg[] );
373 /* Done after the current pattern has been matched and before the
374 * corresponding action - sets up yytext.
376 #define YY_DO_BEFORE_ACTION \
377 (yytext_ptr) = yy_bp; \
378 yyleng = (size_t) (yy_cp - yy_bp); \
379 (yy_hold_char) = *yy_cp; \
381 (yy_c_buf_p) = yy_cp;
383 #define YY_NUM_RULES 20
384 #define YY_END_OF_BUFFER 21
385 /* This struct is not used in this scanner,
386 but its presence is necessary. */
389 flex_int32_t yy_verify;
392 static yyconst flex_int16_t yy_accept[94] =
394 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
395 21, 19, 16, 16, 19, 19, 19, 8, 8, 19,
396 8, 19, 19, 19, 19, 14, 15, 15, 19, 9,
397 9, 16, 0, 3, 0, 0, 10, 0, 0, 0,
398 0, 0, 0, 8, 8, 6, 0, 7, 0, 2,
399 0, 13, 13, 15, 15, 9, 0, 12, 10, 0,
400 0, 0, 0, 18, 0, 0, 0, 2, 9, 0,
401 17, 0, 0, 0, 11, 0, 0, 0, 0, 0,
402 0, 0, 0, 0, 4, 0, 0, 1, 0, 0,
407 static yyconst flex_int32_t yy_ec[256] =
409 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
410 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412 1, 2, 1, 4, 5, 1, 1, 6, 1, 1,
413 1, 7, 8, 8, 9, 8, 10, 11, 12, 13,
414 13, 13, 13, 13, 13, 13, 13, 14, 1, 1,
415 1, 1, 8, 8, 15, 15, 15, 15, 15, 15,
416 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
417 16, 16, 16, 16, 16, 16, 16, 17, 16, 16,
418 1, 18, 19, 1, 16, 1, 15, 20, 21, 22,
420 23, 15, 16, 24, 25, 16, 16, 26, 27, 28,
421 24, 16, 16, 29, 30, 31, 32, 33, 16, 17,
422 16, 16, 34, 1, 35, 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,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 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,
434 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439 static yyconst flex_int32_t yy_meta[36] =
441 1, 1, 1, 1, 2, 1, 2, 2, 2, 3,
442 4, 4, 4, 5, 6, 7, 7, 1, 1, 6,
443 6, 6, 6, 7, 7, 7, 7, 7, 7, 7,
447 static yyconst flex_int16_t yy_base[107] =
449 0, 0, 32, 0, 53, 0, 76, 0, 108, 111,
450 280, 288, 37, 39, 33, 36, 106, 0, 123, 146,
451 255, 251, 45, 0, 159, 288, 0, 53, 108, 172,
452 114, 127, 158, 288, 245, 0, 0, 234, 235, 236,
453 197, 195, 199, 0, 0, 288, 0, 288, 160, 288,
454 183, 288, 0, 0, 183, 182, 0, 0, 0, 0,
455 204, 189, 207, 288, 179, 187, 180, 194, 0, 171,
456 288, 196, 178, 174, 288, 169, 169, 177, 165, 153,
457 143, 155, 137, 118, 288, 122, 42, 288, 36, 36,
458 40, 288, 288, 212, 218, 223, 229, 234, 239, 245,
460 251, 255, 262, 270, 275, 280
463 static yyconst flex_int16_t yy_def[107] =
465 93, 1, 1, 3, 3, 5, 93, 7, 3, 3,
466 93, 93, 93, 93, 94, 95, 93, 96, 93, 19,
467 19, 20, 97, 98, 20, 93, 99, 100, 95, 93,
468 93, 93, 94, 93, 94, 101, 102, 93, 103, 104,
469 93, 93, 93, 96, 19, 93, 20, 93, 97, 93,
470 97, 93, 20, 99, 100, 93, 105, 101, 102, 106,
471 103, 103, 104, 93, 93, 93, 93, 94, 105, 106,
472 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
473 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
474 93, 93, 0, 93, 93, 93, 93, 93, 93, 93,
476 93, 93, 93, 93, 93, 93
479 static yyconst flex_int16_t yy_nxt[324] =
481 12, 13, 14, 15, 12, 16, 12, 12, 12, 17,
482 18, 18, 18, 12, 19, 20, 20, 12, 12, 21,
483 19, 21, 19, 22, 20, 20, 20, 20, 20, 20,
484 20, 20, 20, 12, 12, 23, 34, 12, 32, 32,
485 32, 32, 12, 12, 12, 36, 20, 33, 50, 92,
486 35, 20, 20, 20, 20, 20, 15, 54, 91, 54,
487 54, 54, 51, 24, 24, 24, 46, 25, 90, 38,
488 89, 26, 25, 25, 25, 25, 12, 13, 14, 15,
489 27, 12, 27, 27, 27, 17, 27, 27, 27, 12,
490 28, 28, 28, 12, 12, 28, 28, 28, 28, 28,
492 28, 28, 28, 28, 28, 28, 28, 28, 28, 12,
493 12, 15, 39, 29, 15, 40, 29, 93, 30, 31,
494 31, 30, 31, 31, 56, 56, 56, 41, 32, 32,
495 42, 88, 43, 45, 45, 45, 46, 45, 47, 47,
496 87, 38, 45, 45, 45, 45, 47, 47, 47, 47,
497 47, 47, 47, 47, 47, 47, 47, 47, 47, 86,
498 47, 34, 33, 50, 85, 47, 47, 47, 47, 53,
499 53, 53, 84, 53, 83, 35, 82, 51, 53, 53,
500 53, 53, 56, 56, 56, 93, 68, 54, 57, 54,
501 54, 54, 56, 56, 56, 62, 46, 34, 71, 81,
503 80, 79, 78, 77, 76, 75, 74, 73, 72, 64,
504 62, 35, 33, 33, 33, 33, 33, 33, 33, 33,
505 37, 67, 66, 37, 37, 37, 44, 65, 44, 49,
506 49, 49, 49, 49, 49, 49, 49, 52, 64, 52,
507 54, 62, 54, 60, 54, 54, 55, 93, 55, 55,
508 55, 55, 58, 58, 58, 48, 58, 58, 59, 48,
509 59, 59, 61, 61, 61, 61, 61, 61, 61, 61,
510 63, 63, 63, 63, 63, 63, 63, 63, 69, 93,
511 69, 70, 70, 70, 93, 70, 70, 11, 93, 93,
512 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
514 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
515 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
519 static yyconst flex_int16_t yy_chk[324] =
521 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
522 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
523 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
524 1, 1, 1, 1, 1, 3, 15, 3, 13, 13,
525 14, 14, 3, 3, 3, 16, 3, 23, 23, 91,
526 15, 3, 3, 3, 3, 3, 5, 28, 90, 28,
527 28, 28, 23, 5, 5, 5, 28, 5, 89, 16,
528 87, 5, 5, 5, 5, 5, 7, 7, 7, 7,
529 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
530 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
532 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
533 7, 9, 17, 9, 10, 17, 10, 29, 9, 9,
534 9, 10, 10, 10, 31, 31, 31, 17, 32, 32,
535 17, 86, 17, 19, 19, 19, 19, 19, 19, 19,
536 84, 29, 19, 19, 19, 19, 19, 19, 19, 19,
537 19, 19, 19, 19, 19, 19, 20, 20, 20, 83,
538 20, 33, 49, 49, 82, 20, 20, 20, 20, 25,
539 25, 25, 81, 25, 80, 33, 79, 49, 25, 25,
540 25, 25, 30, 30, 30, 51, 51, 55, 30, 55,
541 55, 55, 56, 56, 56, 62, 55, 68, 62, 78,
543 77, 76, 74, 73, 72, 70, 67, 66, 65, 63,
544 61, 68, 94, 94, 94, 94, 94, 94, 94, 94,
545 95, 43, 42, 95, 95, 95, 96, 41, 96, 97,
546 97, 97, 97, 97, 97, 97, 97, 98, 40, 98,
547 99, 39, 99, 38, 99, 99, 100, 35, 100, 100,
548 100, 100, 101, 101, 101, 22, 101, 101, 102, 21,
549 102, 102, 103, 103, 103, 103, 103, 103, 103, 103,
550 104, 104, 104, 104, 104, 104, 104, 104, 105, 11,
551 105, 106, 106, 106, 0, 106, 106, 93, 93, 93,
552 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
554 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
555 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
559 /* Table of booleans, true if rule could match eol. */
560 static yyconst flex_int32_t yy_rule_can_match_eol[21] =
562 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
565 static yy_state_type yy_last_accepting_state;
566 static char *yy_last_accepting_cpos;
568 extern int yy_flex_debug;
569 int yy_flex_debug = 0;
571 /* The intent behind this definition is that it'll catch
572 * any uses of REJECT which flex missed.
574 #define REJECT reject_used_but_not_detected
575 #define yymore() yymore_used_but_not_detected
576 #define YY_MORE_ADJ 0
577 #define YY_RESTORE_YY_MORE_OFFSET
579 #line 1 "dtc-lexer.l"
581 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
584 * This program is free software; you can redistribute it and/or
585 * modify it under the terms of the GNU General Public License as
586 * published by the Free Software Foundation; either version 2 of the
587 * License, or (at your option) any later version.
589 * This program is distributed in the hope that it will be useful,
590 * but WITHOUT ANY WARRANTY; without even the implied warranty of
591 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
592 * General Public License for more details.
594 * You should have received a copy of the GNU General Public License
595 * along with this program; if not, write to the Free Software
596 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
603 #line 33 "dtc-lexer.l"
606 #include "dtc-parser.tab.h"
609 /*#define LEXDEBUG 1*/
612 #define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
614 #define DPRINT(fmt, ...) do { } while (0)
617 static int dts_version; /* = 0 */
619 #define BEGIN_DEFAULT() if (dts_version == 0) { \
620 DPRINT("<INITIAL>\n"); \
626 #line 627 "dtc-lexer.lex.c"
631 #define PROPNODENAME 3
634 #ifndef YY_NO_UNISTD_H
635 /* Special case for "unistd.h", since it is non-ANSI. We include it way
636 * down here because we want the user's section 1 to have been scanned first.
637 * The user has a chance to override it with an option.
642 #ifndef YY_EXTRA_TYPE
643 #define YY_EXTRA_TYPE void *
646 static int yy_init_globals (void );
648 /* Macros after this point can all be overridden by user definitions in
652 #ifndef YY_SKIP_YYWRAP
654 extern "C" int yywrap (void );
656 extern int yywrap (void );
661 static void yy_flex_strncpy (char *,yyconst char *,int );
664 #ifdef YY_NEED_STRLEN
665 static int yy_flex_strlen (yyconst char * );
671 static int yyinput (void );
673 static int input (void );
678 /* Amount of stuff to slurp up with each read. */
679 #ifndef YY_READ_BUF_SIZE
680 #define YY_READ_BUF_SIZE 8192
683 /* Copy whatever the last rule matched to the standard output. */
685 /* This used to be an fputs(), but since the string might contain NUL's,
686 * we now use fwrite().
688 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
691 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
692 * is returned in "result".
695 #define YY_INPUT(buf,result,max_size) \
696 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
700 for ( n = 0; n < max_size && \
701 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
704 buf[n++] = (char) c; \
705 if ( c == EOF && ferror( yyin ) ) \
706 YY_FATAL_ERROR( "input in flex scanner failed" ); \
712 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
714 if( errno != EINTR) \
716 YY_FATAL_ERROR( "input in flex scanner failed" ); \
727 /* No semi-colon after return; correct usage is to write "yyterminate();" -
728 * we don't want an extra ';' after the "return" because that will cause
729 * some compilers to complain about unreachable statements.
732 #define yyterminate() return YY_NULL
735 /* Number of entries by which start-condition stack grows. */
736 #ifndef YY_START_STACK_INCR
737 #define YY_START_STACK_INCR 25
740 /* Report a fatal error. */
741 #ifndef YY_FATAL_ERROR
742 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
745 /* end tables serialization structures and prototypes */
747 /* Default declaration of generated scanner - a define so the user can
748 * easily add parameters.
751 #define YY_DECL_IS_OURS 1
753 extern int yylex (void);
755 #define YY_DECL int yylex (void)
756 #endif /* !YY_DECL */
758 /* Code executed at the beginning of each rule, after yytext and yyleng
761 #ifndef YY_USER_ACTION
762 #define YY_USER_ACTION
765 /* Code executed at the end of each rule. */
767 #define YY_BREAK break;
770 #define YY_RULE_SETUP \
773 /** The main scanner function which does all the work.
777 register yy_state_type yy_current_state;
778 register char *yy_cp, *yy_bp;
781 #line 57 "dtc-lexer.l"
783 #line 784 "dtc-lexer.lex.c"
794 (yy_start) = 1; /* first start state */
802 if ( ! YY_CURRENT_BUFFER ) {
803 yyensure_buffer_stack ();
804 YY_CURRENT_BUFFER_LVALUE =
805 yy_create_buffer(yyin,YY_BUF_SIZE );
808 yy_load_buffer_state( );
811 while ( 1 ) /* loops until end-of-file is reached */
813 yy_cp = (yy_c_buf_p);
815 /* Support of yytext. */
816 *yy_cp = (yy_hold_char);
818 /* yy_bp points to the position in yy_ch_buf of the start of
823 yy_current_state = (yy_start);
827 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
828 if ( yy_accept[yy_current_state] )
830 (yy_last_accepting_state) = yy_current_state;
831 (yy_last_accepting_cpos) = yy_cp;
833 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
835 yy_current_state = (int) yy_def[yy_current_state];
836 if ( yy_current_state >= 94 )
837 yy_c = yy_meta[(unsigned int) yy_c];
839 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
842 while ( yy_base[yy_current_state] != 288 );
845 yy_act = yy_accept[yy_current_state];
847 { /* have to back up */
848 yy_cp = (yy_last_accepting_cpos);
849 yy_current_state = (yy_last_accepting_state);
850 yy_act = yy_accept[yy_current_state];
855 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
858 for ( yyl = 0; yyl < yyleng; ++yyl )
859 if ( yytext[yyl] == '\n' )
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);
878 #line 58 "dtc-lexer.l"
883 #line 60 "dtc-lexer.l"
885 yytext[strlen(yytext) - 1] = 0;
886 if (!push_input_file(yytext + 1)) {
887 /* Some unrecoverable error.*/
893 case YY_STATE_EOF(INITIAL):
894 case YY_STATE_EOF(INCLUDE):
895 case YY_STATE_EOF(BYTESTRING):
896 case YY_STATE_EOF(PROPNODENAME):
897 case YY_STATE_EOF(V1):
898 #line 70 "dtc-lexer.l"
900 if (!pop_input_file()) {
906 /* rule 3 can match eol */
908 #line 76 "dtc-lexer.l"
910 yylloc.filenum = srcpos_filenum;
911 yylloc.first_line = yylineno;
912 DPRINT("String: %s\n", yytext);
913 yylval.data = data_copy_escape_string(yytext+1,
915 yylloc.first_line = yylineno;
921 #line 86 "dtc-lexer.l"
923 yylloc.filenum = srcpos_filenum;
924 yylloc.first_line = yylineno;
925 DPRINT("Keyword: /dts-v1/\n");
933 #line 95 "dtc-lexer.l"
935 yylloc.filenum = srcpos_filenum;
936 yylloc.first_line = yylineno;
937 DPRINT("Keyword: /memreserve/\n");
939 return DT_MEMRESERVE;
944 #line 103 "dtc-lexer.l"
946 yylloc.filenum = srcpos_filenum;
947 yylloc.first_line = yylineno;
948 DPRINT("Label: %s\n", yytext);
949 yylval.labelref = strdup(yytext);
950 yylval.labelref[yyleng-1] = '\0';
956 #line 112 "dtc-lexer.l"
958 yylloc.filenum = srcpos_filenum;
959 yylloc.first_line = yylineno;
962 else if (*yytext == 'o')
964 else if (*yytext == 'd')
968 DPRINT("Base: %d\n", yylval.cbase);
974 #line 127 "dtc-lexer.l"
976 yylloc.filenum = srcpos_filenum;
977 yylloc.first_line = yylineno;
978 yylval.literal = strdup(yytext);
979 DPRINT("Literal: '%s'\n", yylval.literal);
980 return DT_LEGACYLITERAL;
985 #line 135 "dtc-lexer.l"
987 yylloc.filenum = srcpos_filenum;
988 yylloc.first_line = yylineno;
989 yylval.literal = strdup(yytext);
990 DPRINT("Literal: '%s'\n", yylval.literal);
996 #line 143 "dtc-lexer.l"
997 { /* label reference */
998 yylloc.filenum = srcpos_filenum;
999 yylloc.first_line = yylineno;
1000 DPRINT("Ref: %s\n", yytext+1);
1001 yylval.labelref = strdup(yytext+1);
1007 #line 151 "dtc-lexer.l"
1008 { /* new-style path reference */
1009 yylloc.filenum = srcpos_filenum;
1010 yylloc.first_line = yylineno;
1011 yytext[yyleng-1] = '\0';
1012 DPRINT("Ref: %s\n", yytext+2);
1013 yylval.labelref = strdup(yytext+2);
1019 #line 160 "dtc-lexer.l"
1020 { /* old-style path reference */
1021 yylloc.filenum = srcpos_filenum;
1022 yylloc.first_line = yylineno;
1023 DPRINT("Ref: %s\n", yytext+1);
1024 yylval.labelref = strdup(yytext+1);
1030 #line 168 "dtc-lexer.l"
1032 yylloc.filenum = srcpos_filenum;
1033 yylloc.first_line = yylineno;
1034 yylval.byte = strtol(yytext, NULL, 16);
1035 DPRINT("Byte: %02x\n", (int)yylval.byte);
1041 #line 176 "dtc-lexer.l"
1043 yylloc.filenum = srcpos_filenum;
1044 yylloc.first_line = yylineno;
1045 DPRINT("/BYTESTRING\n");
1052 #line 184 "dtc-lexer.l"
1054 yylloc.filenum = srcpos_filenum;
1055 yylloc.first_line = yylineno;
1056 DPRINT("PropNodeName: %s\n", yytext);
1057 yylval.propnodename = strdup(yytext);
1059 return DT_PROPNODENAME;
1063 /* rule 16 can match eol */
1065 #line 194 "dtc-lexer.l"
1066 /* eat whitespace */
1069 /* rule 17 can match eol */
1071 #line 196 "dtc-lexer.l"
1073 yylloc.filenum = srcpos_filenum;
1074 yylloc.first_line = yylineno;
1075 DPRINT("Comment: %s\n", yytext);
1080 /* rule 18 can match eol */
1082 #line 203 "dtc-lexer.l"
1083 /* eat line comments */
1087 #line 205 "dtc-lexer.l"
1089 yylloc.filenum = srcpos_filenum;
1090 yylloc.first_line = yylineno;
1091 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1092 (unsigned)yytext[0]);
1093 if (yytext[0] == '[') {
1094 DPRINT("<BYTESTRING>\n");
1097 if ((yytext[0] == '{')
1098 || (yytext[0] == ';')) {
1099 DPRINT("<PROPNODENAME>\n");
1100 BEGIN(PROPNODENAME);
1107 #line 222 "dtc-lexer.l"
1110 #line 1111 "dtc-lexer.lex.c"
1112 case YY_END_OF_BUFFER:
1114 /* Amount of text matched not including the EOB char. */
1115 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1117 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1118 *yy_cp = (yy_hold_char);
1119 YY_RESTORE_YY_MORE_OFFSET
1121 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1123 /* We're scanning a new file or input source. It's
1124 * possible that this happened because the user
1125 * just pointed yyin at a new source and called
1126 * yylex(). If so, then we have to assure
1127 * consistency between YY_CURRENT_BUFFER and our
1128 * globals. Here is the right place to do so, because
1129 * this is the first action (other than possibly a
1130 * back-up) that will match for the new input source.
1132 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1133 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1134 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1137 /* Note that here we test for yy_c_buf_p "<=" to the position
1138 * of the first EOB in the buffer, since yy_c_buf_p will
1139 * already have been incremented past the NUL character
1140 * (since all states make transitions on EOB to the
1141 * end-of-buffer state). Contrast this with the test
1144 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1145 { /* This was really a NUL. */
1146 yy_state_type yy_next_state;
1148 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1150 yy_current_state = yy_get_previous_state( );
1152 /* Okay, we're now positioned to make the NUL
1153 * transition. We couldn't have
1154 * yy_get_previous_state() go ahead and do it
1155 * for us because it doesn't know how to deal
1156 * with the possibility of jamming (and we don't
1157 * want to build jamming into it because then it
1158 * will run more slowly).
1161 yy_next_state = yy_try_NUL_trans( yy_current_state );
1163 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1165 if ( yy_next_state )
1167 /* Consume the NUL. */
1168 yy_cp = ++(yy_c_buf_p);
1169 yy_current_state = yy_next_state;
1175 yy_cp = (yy_c_buf_p);
1176 goto yy_find_action;
1180 else switch ( yy_get_next_buffer( ) )
1182 case EOB_ACT_END_OF_FILE:
1184 (yy_did_buffer_switch_on_eof) = 0;
1188 /* Note: because we've taken care in
1189 * yy_get_next_buffer() to have set up
1190 * yytext, we can now set up
1191 * yy_c_buf_p so that if some total
1192 * hoser (like flex itself) wants to
1193 * call the scanner after we return the
1194 * YY_NULL, it'll still work - another
1195 * YY_NULL will get returned.
1197 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1199 yy_act = YY_STATE_EOF(YY_START);
1205 if ( ! (yy_did_buffer_switch_on_eof) )
1211 case EOB_ACT_CONTINUE_SCAN:
1213 (yytext_ptr) + yy_amount_of_matched_text;
1215 yy_current_state = yy_get_previous_state( );
1217 yy_cp = (yy_c_buf_p);
1218 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1221 case EOB_ACT_LAST_MATCH:
1223 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1225 yy_current_state = yy_get_previous_state( );
1227 yy_cp = (yy_c_buf_p);
1228 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1229 goto yy_find_action;
1236 "fatal flex scanner internal error--no action found" );
1237 } /* end of action switch */
1238 } /* end of scanning one token */
1239 } /* end of yylex */
1241 /* yy_get_next_buffer - try to read in a new buffer
1243 * Returns a code representing an action:
1244 * EOB_ACT_LAST_MATCH -
1245 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1246 * EOB_ACT_END_OF_FILE - end of file
1248 static int yy_get_next_buffer (void)
1250 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1251 register char *source = (yytext_ptr);
1252 register int number_to_move, i;
1255 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1257 "fatal flex scanner internal error--end of buffer missed" );
1259 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1260 { /* Don't try to fill the buffer, so this is an EOF. */
1261 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1263 /* We matched a single character, the EOB, so
1264 * treat this as a final EOF.
1266 return EOB_ACT_END_OF_FILE;
1271 /* We matched some text prior to the EOB, first
1274 return EOB_ACT_LAST_MATCH;
1278 /* Try to read more data. */
1280 /* First move last chars to start of buffer. */
1281 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1283 for ( i = 0; i < number_to_move; ++i )
1284 *(dest++) = *(source++);
1286 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1287 /* don't do the read, it's not guaranteed to return an EOF,
1290 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1295 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1297 while ( num_to_read <= 0 )
1298 { /* Not enough room in the buffer - grow it. */
1300 /* just a shorter name for the current buffer */
1301 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1303 int yy_c_buf_p_offset =
1304 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1306 if ( b->yy_is_our_buffer )
1308 int new_size = b->yy_buf_size * 2;
1310 if ( new_size <= 0 )
1311 b->yy_buf_size += b->yy_buf_size / 8;
1313 b->yy_buf_size *= 2;
1315 b->yy_ch_buf = (char *)
1316 /* Include room in for 2 EOB chars. */
1317 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1320 /* Can't grow it, we don't own it. */
1323 if ( ! b->yy_ch_buf )
1325 "fatal error - scanner input buffer overflow" );
1327 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1329 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1334 if ( num_to_read > YY_READ_BUF_SIZE )
1335 num_to_read = YY_READ_BUF_SIZE;
1337 /* Read in more data. */
1338 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1339 (yy_n_chars), (size_t) num_to_read );
1341 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1344 if ( (yy_n_chars) == 0 )
1346 if ( number_to_move == YY_MORE_ADJ )
1348 ret_val = EOB_ACT_END_OF_FILE;
1354 ret_val = EOB_ACT_LAST_MATCH;
1355 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1356 YY_BUFFER_EOF_PENDING;
1361 ret_val = EOB_ACT_CONTINUE_SCAN;
1363 (yy_n_chars) += number_to_move;
1364 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1365 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1367 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1372 /* yy_get_previous_state - get the state just before the EOB char was reached */
1374 static yy_state_type yy_get_previous_state (void)
1376 register yy_state_type yy_current_state;
1377 register char *yy_cp;
1379 yy_current_state = (yy_start);
1381 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1383 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1384 if ( yy_accept[yy_current_state] )
1386 (yy_last_accepting_state) = yy_current_state;
1387 (yy_last_accepting_cpos) = yy_cp;
1389 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1391 yy_current_state = (int) yy_def[yy_current_state];
1392 if ( yy_current_state >= 94 )
1393 yy_c = yy_meta[(unsigned int) yy_c];
1395 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1398 return yy_current_state;
1401 /* yy_try_NUL_trans - try to make a transition on the NUL character
1404 * next_state = yy_try_NUL_trans( current_state );
1406 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1408 register int yy_is_jam;
1409 register char *yy_cp = (yy_c_buf_p);
1411 register YY_CHAR yy_c = 1;
1412 if ( yy_accept[yy_current_state] )
1414 (yy_last_accepting_state) = yy_current_state;
1415 (yy_last_accepting_cpos) = yy_cp;
1417 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1419 yy_current_state = (int) yy_def[yy_current_state];
1420 if ( yy_current_state >= 94 )
1421 yy_c = yy_meta[(unsigned int) yy_c];
1423 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1424 yy_is_jam = (yy_current_state == 93);
1426 return yy_is_jam ? 0 : yy_current_state;
1431 static int yyinput (void)
1433 static int input (void)
1439 *(yy_c_buf_p) = (yy_hold_char);
1441 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1443 /* yy_c_buf_p now points to the character we want to return.
1444 * If this occurs *before* the EOB characters, then it's a
1445 * valid NUL; if not, then we've hit the end of the buffer.
1447 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1448 /* This was really a NUL. */
1449 *(yy_c_buf_p) = '\0';
1452 { /* need more input */
1453 int offset = (yy_c_buf_p) - (yytext_ptr);
1456 switch ( yy_get_next_buffer( ) )
1458 case EOB_ACT_LAST_MATCH:
1459 /* This happens because yy_g_n_b()
1460 * sees that we've accumulated a
1461 * token and flags that we need to
1462 * try matching the token before
1463 * proceeding. But for input(),
1464 * there's no matching to consider.
1465 * So convert the EOB_ACT_LAST_MATCH
1466 * to EOB_ACT_END_OF_FILE.
1469 /* Reset buffer status. */
1474 case EOB_ACT_END_OF_FILE:
1479 if ( ! (yy_did_buffer_switch_on_eof) )
1488 case EOB_ACT_CONTINUE_SCAN:
1489 (yy_c_buf_p) = (yytext_ptr) + offset;
1495 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1496 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1497 (yy_hold_char) = *++(yy_c_buf_p);
1506 #endif /* ifndef YY_NO_INPUT */
1508 /** Immediately switch to a different input stream.
1509 * @param input_file A readable stream.
1511 * @note This function does not reset the start condition to @c INITIAL .
1513 void yyrestart (FILE * input_file )
1516 if ( ! YY_CURRENT_BUFFER ){
1517 yyensure_buffer_stack ();
1518 YY_CURRENT_BUFFER_LVALUE =
1519 yy_create_buffer(yyin,YY_BUF_SIZE );
1522 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1523 yy_load_buffer_state( );
1526 /** Switch to a different input buffer.
1527 * @param new_buffer The new input buffer.
1530 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1533 /* TODO. We should be able to replace this entire function body
1535 * yypop_buffer_state();
1536 * yypush_buffer_state(new_buffer);
1538 yyensure_buffer_stack ();
1539 if ( YY_CURRENT_BUFFER == new_buffer )
1542 if ( YY_CURRENT_BUFFER )
1544 /* Flush out information for old buffer. */
1545 *(yy_c_buf_p) = (yy_hold_char);
1546 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1547 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1550 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1551 yy_load_buffer_state( );
1553 /* We don't actually know whether we did this switch during
1554 * EOF (yywrap()) processing, but the only time this flag
1555 * is looked at is after yywrap() is called, so it's safe
1556 * to go ahead and always set it.
1558 (yy_did_buffer_switch_on_eof) = 1;
1561 static void yy_load_buffer_state (void)
1563 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1564 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1565 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1566 (yy_hold_char) = *(yy_c_buf_p);
1569 /** Allocate and initialize an input buffer state.
1570 * @param file A readable stream.
1571 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1573 * @return the allocated buffer state.
1575 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1579 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1581 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1583 b->yy_buf_size = size;
1585 /* yy_ch_buf has to be 2 characters longer than the size given because
1586 * we need to put in 2 end-of-buffer characters.
1588 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1589 if ( ! b->yy_ch_buf )
1590 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1592 b->yy_is_our_buffer = 1;
1594 yy_init_buffer(b,file );
1599 /** Destroy the buffer.
1600 * @param b a buffer created with yy_create_buffer()
1603 void yy_delete_buffer (YY_BUFFER_STATE b )
1609 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1610 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1612 if ( b->yy_is_our_buffer )
1613 yyfree((void *) b->yy_ch_buf );
1615 yyfree((void *) b );
1619 extern int isatty (int );
1620 #endif /* __cplusplus */
1622 /* Initializes or reinitializes a buffer.
1623 * This function is sometimes called more than once on the same buffer,
1624 * such as during a yyrestart() or at EOF.
1626 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1631 yy_flush_buffer(b );
1633 b->yy_input_file = file;
1634 b->yy_fill_buffer = 1;
1636 /* If b is the current buffer, then yy_init_buffer was _probably_
1637 * called from yyrestart() or through yy_get_next_buffer.
1638 * In that case, we don't want to reset the lineno or column.
1640 if (b != YY_CURRENT_BUFFER){
1641 b->yy_bs_lineno = 1;
1642 b->yy_bs_column = 0;
1645 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1650 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1651 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1654 void yy_flush_buffer (YY_BUFFER_STATE b )
1661 /* We always need two end-of-buffer characters. The first causes
1662 * a transition to the end-of-buffer state. The second causes
1663 * a jam in that state.
1665 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1666 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1668 b->yy_buf_pos = &b->yy_ch_buf[0];
1671 b->yy_buffer_status = YY_BUFFER_NEW;
1673 if ( b == YY_CURRENT_BUFFER )
1674 yy_load_buffer_state( );
1677 /** Pushes the new state onto the stack. The new state becomes
1678 * the current state. This function will allocate the stack
1680 * @param new_buffer The new state.
1683 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1685 if (new_buffer == NULL)
1688 yyensure_buffer_stack();
1690 /* This block is copied from yy_switch_to_buffer. */
1691 if ( YY_CURRENT_BUFFER )
1693 /* Flush out information for old buffer. */
1694 *(yy_c_buf_p) = (yy_hold_char);
1695 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1696 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1699 /* Only push if top exists. Otherwise, replace top. */
1700 if (YY_CURRENT_BUFFER)
1701 (yy_buffer_stack_top)++;
1702 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1704 /* copied from yy_switch_to_buffer. */
1705 yy_load_buffer_state( );
1706 (yy_did_buffer_switch_on_eof) = 1;
1709 /** Removes and deletes the top of the stack, if present.
1710 * The next element becomes the new top.
1713 void yypop_buffer_state (void)
1715 if (!YY_CURRENT_BUFFER)
1718 yy_delete_buffer(YY_CURRENT_BUFFER );
1719 YY_CURRENT_BUFFER_LVALUE = NULL;
1720 if ((yy_buffer_stack_top) > 0)
1721 --(yy_buffer_stack_top);
1723 if (YY_CURRENT_BUFFER) {
1724 yy_load_buffer_state( );
1725 (yy_did_buffer_switch_on_eof) = 1;
1729 /* Allocates the stack if it does not exist.
1730 * Guarantees space for at least one push.
1732 static void yyensure_buffer_stack (void)
1736 if (!(yy_buffer_stack)) {
1738 /* First allocation is just for 2 elements, since we don't know if this
1739 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1740 * immediate realloc on the next call.
1743 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1744 (num_to_alloc * sizeof(struct yy_buffer_state*)
1747 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1749 (yy_buffer_stack_max) = num_to_alloc;
1750 (yy_buffer_stack_top) = 0;
1754 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1756 /* Increase the buffer to prepare for a possible push. */
1757 int grow_size = 8 /* arbitrary grow size */;
1759 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1760 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1762 num_to_alloc * sizeof(struct yy_buffer_state*)
1765 /* zero only the new slots.*/
1766 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1767 (yy_buffer_stack_max) = num_to_alloc;
1771 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1772 * @param base the character buffer
1773 * @param size the size in bytes of the character buffer
1775 * @return the newly allocated buffer state object.
1777 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1782 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1783 base[size-1] != YY_END_OF_BUFFER_CHAR )
1784 /* They forgot to leave room for the EOB's. */
1787 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1789 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1791 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1792 b->yy_buf_pos = b->yy_ch_buf = base;
1793 b->yy_is_our_buffer = 0;
1794 b->yy_input_file = 0;
1795 b->yy_n_chars = b->yy_buf_size;
1796 b->yy_is_interactive = 0;
1798 b->yy_fill_buffer = 0;
1799 b->yy_buffer_status = YY_BUFFER_NEW;
1801 yy_switch_to_buffer(b );
1806 /** Setup the input buffer state to scan a string. The next call to yylex() will
1807 * scan from a @e copy of @a str.
1808 * @param yystr a NUL-terminated string to scan
1810 * @return the newly allocated buffer state object.
1811 * @note If you want to scan bytes that may contain NUL values, then use
1812 * yy_scan_bytes() instead.
1814 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1817 return yy_scan_bytes(yystr,strlen(yystr) );
1820 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1821 * scan from a @e copy of @a bytes.
1822 * @param bytes the byte buffer to scan
1823 * @param len the number of bytes in the buffer pointed to by @a bytes.
1825 * @return the newly allocated buffer state object.
1827 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1834 /* Get memory for full buffer, including space for trailing EOB's. */
1835 n = _yybytes_len + 2;
1836 buf = (char *) yyalloc(n );
1838 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1840 for ( i = 0; i < _yybytes_len; ++i )
1841 buf[i] = yybytes[i];
1843 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1845 b = yy_scan_buffer(buf,n );
1847 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1849 /* It's okay to grow etc. this buffer, and we should throw it
1850 * away when we're done.
1852 b->yy_is_our_buffer = 1;
1857 #ifndef YY_EXIT_FAILURE
1858 #define YY_EXIT_FAILURE 2
1861 static void yy_fatal_error (yyconst char* msg )
1863 (void) fprintf( stderr, "%s\n", msg );
1864 exit( YY_EXIT_FAILURE );
1867 /* Redefine yyless() so it works in section 3 code. */
1873 /* Undo effects of setting up yytext. */ \
1874 int yyless_macro_arg = (n); \
1875 YY_LESS_LINENO(yyless_macro_arg);\
1876 yytext[yyleng] = (yy_hold_char); \
1877 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1878 (yy_hold_char) = *(yy_c_buf_p); \
1879 *(yy_c_buf_p) = '\0'; \
1880 yyleng = yyless_macro_arg; \
1884 /* Accessor methods (get/set functions) to struct members. */
1886 /** Get the current line number.
1889 int yyget_lineno (void)
1895 /** Get the input stream.
1898 FILE *yyget_in (void)
1903 /** Get the output stream.
1906 FILE *yyget_out (void)
1911 /** Get the length of the current token.
1914 int yyget_leng (void)
1919 /** Get the current token.
1923 char *yyget_text (void)
1928 /** Set the current line number.
1929 * @param line_number
1932 void yyset_lineno (int line_number )
1935 yylineno = line_number;
1938 /** Set the input stream. This does not discard the current
1940 * @param in_str A readable stream.
1942 * @see yy_switch_to_buffer
1944 void yyset_in (FILE * in_str )
1949 void yyset_out (FILE * out_str )
1954 int yyget_debug (void)
1956 return yy_flex_debug;
1959 void yyset_debug (int bdebug )
1961 yy_flex_debug = bdebug ;
1964 static int yy_init_globals (void)
1966 /* Initialization is the same as for the non-reentrant scanner.
1967 * This function is called from yylex_destroy(), so don't allocate here.
1970 /* We do not touch yylineno unless the option is enabled. */
1973 (yy_buffer_stack) = 0;
1974 (yy_buffer_stack_top) = 0;
1975 (yy_buffer_stack_max) = 0;
1976 (yy_c_buf_p) = (char *) 0;
1980 /* Defined in main.c */
1989 /* For future reference: Set errno on error, since we are called by
1995 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1996 int yylex_destroy (void)
1999 /* Pop the buffer stack, destroying each element. */
2000 while(YY_CURRENT_BUFFER){
2001 yy_delete_buffer(YY_CURRENT_BUFFER );
2002 YY_CURRENT_BUFFER_LVALUE = NULL;
2003 yypop_buffer_state();
2006 /* Destroy the stack itself. */
2007 yyfree((yy_buffer_stack) );
2008 (yy_buffer_stack) = NULL;
2010 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2011 * yylex() is called, initialization will occur. */
2018 * Internal utility routines.
2022 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2025 for ( i = 0; i < n; ++i )
2030 #ifdef YY_NEED_STRLEN
2031 static int yy_flex_strlen (yyconst char * s )
2034 for ( n = 0; s[n]; ++n )
2041 void *yyalloc (yy_size_t size )
2043 return (void *) malloc( size );
2046 void *yyrealloc (void * ptr, yy_size_t size )
2048 /* The cast to (char *) in the following accommodates both
2049 * implementations that use char* generic pointers, and those
2050 * that use void* generic pointers. It works with the latter
2051 * because both ANSI C and C++ allow castless assignment from
2052 * any pointer type to void*, and deal with argument conversions
2053 * as though doing an assignment.
2055 return (void *) realloc( (char *) ptr, size );
2058 void yyfree (void * ptr )
2060 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2063 #define YYTABLES_NAME "yytables"
2065 #line 222 "dtc-lexer.l"
2071 * Stack of nested include file contexts.
2077 YY_BUFFER_STATE yy_prev_buf;
2079 struct incl_file *prev;
2082 struct incl_file *incl_file_stack;
2086 * Detect infinite include recursion.
2088 #define MAX_INCLUDE_DEPTH (100)
2090 static int incl_depth = 0;
2093 int push_input_file(const char *filename)
2096 struct incl_file *incl_file;
2099 yyerror("No include file name given.");
2103 if (incl_depth++ >= MAX_INCLUDE_DEPTH) {
2104 yyerror("Includes nested too deeply");
2108 f = dtc_open_file(filename);
2110 incl_file = malloc(sizeof(struct incl_file));
2112 yyerror("Can not allocate include file space.");
2117 * Save current context.
2119 incl_file->yy_prev_buf = YY_CURRENT_BUFFER;
2120 incl_file->yy_prev_lineno = yylineno;
2121 incl_file->filenum = srcpos_filenum;
2122 incl_file->file = yyin;
2123 incl_file->prev = incl_file_stack;
2125 incl_file_stack = incl_file;
2128 * Establish new context.
2130 srcpos_filenum = lookup_file_name(filename, 0);
2133 yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
2139 int pop_input_file(void)
2141 struct incl_file *incl_file;
2143 if (incl_file_stack == 0)
2152 incl_file = incl_file_stack;
2153 incl_file_stack = incl_file->prev;
2156 * Recover old context.
2158 yy_delete_buffer(YY_CURRENT_BUFFER);
2159 yy_switch_to_buffer(incl_file->yy_prev_buf);
2160 yylineno = incl_file->yy_prev_lineno;
2161 srcpos_filenum = incl_file->filenum;
2162 yyin = incl_file->file;
2169 if (YY_CURRENT_BUFFER == 0)