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 39
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
58 /* Limits of integral types. */
60 #define INT8_MIN (-128)
63 #define INT16_MIN (-32767-1)
66 #define INT32_MIN (-2147483647-1)
69 #define INT8_MAX (127)
72 #define INT16_MAX (32767)
75 #define INT32_MAX (2147483647)
78 #define UINT8_MAX (255U)
81 #define UINT16_MAX (65535U)
84 #define UINT32_MAX (4294967295U)
89 #endif /* ! FLEXINT_H */
93 /* The "const" storage-class-modifier is valid. */
96 #else /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
107 #define yyconst const
112 /* Returned upon end-of-file. */
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
122 /* Enter a start condition. This macro really ought to take a parameter,
123 * but we do it the disgusting crufty way forced on us by the ()-less
124 * definition of BEGIN.
126 #define BEGIN (yy_start) = 1 + 2 *
128 /* Translate the current start state into a value that can be later handed
129 * to BEGIN to return to the state. The YYSTATE alias is for lex
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin )
141 #define YY_END_OF_BUFFER_CHAR 0
143 /* Size of default input buffer. */
146 /* On IA-64, the buffer size is 16k, not 8k.
147 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
148 * Ditto for the __ia64__ case accordingly.
150 #define YY_BUF_SIZE 32768
152 #define YY_BUF_SIZE 16384
153 #endif /* __ia64__ */
156 /* The state buf must be large enough to hold one state per character in the main buffer.
158 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
161 #define YY_TYPEDEF_YY_BUFFER_STATE
162 typedef struct yy_buffer_state *YY_BUFFER_STATE;
165 #ifndef YY_TYPEDEF_YY_SIZE_T
166 #define YY_TYPEDEF_YY_SIZE_T
167 typedef size_t yy_size_t;
170 extern yy_size_t yyleng;
172 extern FILE *yyin, *yyout;
174 #define EOB_ACT_CONTINUE_SCAN 0
175 #define EOB_ACT_END_OF_FILE 1
176 #define EOB_ACT_LAST_MATCH 2
178 #define YY_LESS_LINENO(n)
179 #define YY_LINENO_REWIND_TO(ptr)
181 /* Return all but the first "n" matched characters back to the input stream. */
185 /* Undo effects of setting up yytext. */ \
186 int yyless_macro_arg = (n); \
187 YY_LESS_LINENO(yyless_macro_arg);\
188 *yy_cp = (yy_hold_char); \
189 YY_RESTORE_YY_MORE_OFFSET \
190 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
191 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
195 #define unput(c) yyunput( c, (yytext_ptr) )
197 #ifndef YY_STRUCT_YY_BUFFER_STATE
198 #define YY_STRUCT_YY_BUFFER_STATE
199 struct yy_buffer_state
203 char *yy_ch_buf; /* input buffer */
204 char *yy_buf_pos; /* current position in input buffer */
206 /* Size of input buffer in bytes, not including room for EOB
209 yy_size_t yy_buf_size;
211 /* Number of characters read into yy_ch_buf, not including EOB
214 yy_size_t yy_n_chars;
216 /* Whether we "own" the buffer - i.e., we know we created it,
217 * and can realloc() it to grow it, and should free() it to
220 int yy_is_our_buffer;
222 /* Whether this is an "interactive" input source; if so, and
223 * if we're using stdio for input, then we want to use getc()
224 * instead of fread(), to make sure we stop fetching input after
227 int yy_is_interactive;
229 /* Whether we're considered to be at the beginning of a line.
230 * If so, '^' rules will be active on the next match, otherwise
235 int yy_bs_lineno; /**< The line count. */
236 int yy_bs_column; /**< The column count. */
238 /* Whether to try to fill the input buffer when we reach the
243 int yy_buffer_status;
245 #define YY_BUFFER_NEW 0
246 #define YY_BUFFER_NORMAL 1
247 /* When an EOF's been seen but there's still some text to process
248 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
249 * shouldn't try reading from the input source any more. We might
250 * still have a bunch of tokens to match, though, because of
251 * possible backing-up.
253 * When we actually see the EOF, we change the status to "new"
254 * (via yyrestart()), so that the user can continue scanning by
255 * just pointing yyin at a new input file.
257 #define YY_BUFFER_EOF_PENDING 2
260 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
262 /* Stack of input buffers. */
263 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
264 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
265 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
267 /* We provide macros for accessing buffer states in case in the
268 * future we want to put the buffer states in a more general
271 * Returns the top of the stack, or NULL.
273 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
274 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
277 /* Same as previous macro, but useful when we know that the buffer stack is not
278 * NULL or when we need an lvalue. For internal use only.
280 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
282 /* yy_hold_char holds the character lost when yytext is formed. */
283 static char yy_hold_char;
284 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
287 /* Points to current character in buffer. */
288 static char *yy_c_buf_p = (char *) 0;
289 static int yy_init = 0; /* whether we need to initialize */
290 static int yy_start = 0; /* start state number */
292 /* Flag which is used to allow yywrap()'s to do buffer switches
293 * instead of setting up a fresh yyin. A bit of a hack ...
295 static int yy_did_buffer_switch_on_eof;
297 void yyrestart (FILE *input_file );
298 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
299 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
300 void yy_delete_buffer (YY_BUFFER_STATE b );
301 void yy_flush_buffer (YY_BUFFER_STATE b );
302 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
303 void yypop_buffer_state (void );
305 static void yyensure_buffer_stack (void );
306 static void yy_load_buffer_state (void );
307 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
309 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
311 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
312 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
313 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
315 void *yyalloc (yy_size_t );
316 void *yyrealloc (void *,yy_size_t );
317 void yyfree (void * );
319 #define yy_new_buffer yy_create_buffer
321 #define yy_set_interactive(is_interactive) \
323 if ( ! YY_CURRENT_BUFFER ){ \
324 yyensure_buffer_stack (); \
325 YY_CURRENT_BUFFER_LVALUE = \
326 yy_create_buffer(yyin,YY_BUF_SIZE ); \
328 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
331 #define yy_set_bol(at_bol) \
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_at_bol = at_bol; \
341 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
343 /* Begin user sect3 */
346 #define YY_SKIP_YYWRAP
348 typedef unsigned char YY_CHAR;
350 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
352 typedef int yy_state_type;
359 #define yytext_ptr yytext
361 static yy_state_type yy_get_previous_state (void );
362 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
363 static int yy_get_next_buffer (void );
364 static void yy_fatal_error (yyconst char msg[] );
366 /* Done after the current pattern has been matched and before the
367 * corresponding action - sets up yytext.
369 #define YY_DO_BEFORE_ACTION \
370 (yytext_ptr) = yy_bp; \
371 yyleng = (size_t) (yy_cp - yy_bp); \
372 (yy_hold_char) = *yy_cp; \
374 (yy_c_buf_p) = yy_cp;
376 #define YY_NUM_RULES 30
377 #define YY_END_OF_BUFFER 31
378 /* This struct is not used in this scanner,
379 but its presence is necessary. */
382 flex_int32_t yy_verify;
385 static yyconst flex_int16_t yy_accept[159] =
387 0, 0, 0, 0, 0, 0, 0, 0, 31, 29,
388 18, 18, 29, 29, 29, 29, 29, 29, 29, 29,
389 29, 29, 29, 29, 29, 29, 15, 16, 16, 29,
390 16, 10, 10, 18, 26, 0, 3, 0, 27, 12,
391 0, 0, 11, 0, 0, 0, 0, 0, 0, 0,
392 21, 23, 25, 24, 22, 0, 9, 28, 0, 0,
393 0, 14, 14, 16, 16, 16, 10, 10, 10, 0,
394 12, 0, 11, 0, 0, 0, 20, 0, 0, 0,
395 0, 0, 0, 0, 0, 16, 10, 10, 10, 0,
396 13, 19, 0, 0, 0, 0, 0, 0, 0, 0,
398 0, 16, 0, 0, 0, 0, 0, 0, 0, 0,
399 0, 16, 6, 0, 0, 0, 0, 0, 0, 2,
400 0, 0, 0, 0, 0, 0, 0, 0, 4, 17,
401 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
402 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
403 5, 8, 0, 0, 0, 0, 7, 0
406 static yyconst flex_int32_t yy_ec[256] =
408 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
409 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 1, 2, 5, 6, 7, 1, 1, 8, 9, 1,
412 1, 10, 11, 11, 12, 11, 13, 14, 15, 16,
413 16, 16, 16, 16, 16, 16, 16, 17, 1, 18,
414 19, 20, 11, 11, 21, 21, 21, 21, 21, 21,
415 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
416 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
417 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
419 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
420 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
421 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 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,
434 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438 static yyconst flex_int32_t yy_meta[47] =
440 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
441 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
442 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
443 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
447 static yyconst flex_int16_t yy_base[173] =
449 0, 383, 34, 382, 65, 381, 37, 105, 387, 391,
450 54, 111, 367, 110, 109, 109, 112, 41, 366, 104,
451 367, 338, 124, 117, 0, 144, 391, 0, 121, 0,
452 135, 155, 140, 179, 391, 160, 391, 379, 391, 0,
453 368, 141, 391, 167, 370, 376, 346, 103, 342, 345,
454 391, 391, 391, 391, 391, 358, 391, 391, 175, 342,
455 338, 391, 355, 0, 185, 339, 184, 347, 346, 0,
456 0, 322, 175, 357, 175, 363, 352, 324, 330, 323,
457 332, 326, 201, 324, 329, 322, 391, 333, 181, 309,
458 391, 341, 340, 313, 320, 338, 178, 311, 146, 317,
460 314, 315, 335, 331, 303, 300, 309, 299, 308, 188,
461 336, 335, 391, 305, 320, 281, 283, 271, 203, 288,
462 281, 271, 266, 264, 245, 242, 208, 104, 391, 391,
463 244, 218, 204, 219, 206, 224, 201, 212, 204, 229,
464 215, 208, 207, 200, 219, 391, 233, 221, 200, 181,
465 391, 391, 149, 122, 86, 41, 391, 391, 245, 251,
466 259, 263, 267, 273, 280, 284, 292, 300, 304, 310,
470 static yyconst flex_int16_t yy_def[173] =
472 158, 1, 1, 3, 158, 5, 1, 1, 158, 158,
473 158, 158, 158, 159, 160, 161, 158, 158, 158, 158,
474 162, 158, 158, 158, 163, 162, 158, 164, 165, 164,
475 164, 158, 158, 158, 158, 159, 158, 159, 158, 166,
476 158, 161, 158, 161, 167, 168, 158, 158, 158, 158,
477 158, 158, 158, 158, 158, 162, 158, 158, 158, 158,
478 158, 158, 162, 164, 165, 164, 158, 158, 158, 169,
479 166, 170, 161, 167, 167, 168, 158, 158, 158, 158,
480 158, 158, 158, 158, 158, 164, 158, 158, 169, 170,
481 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
483 158, 164, 158, 158, 158, 158, 158, 158, 158, 171,
484 158, 164, 158, 158, 158, 158, 158, 158, 171, 158,
485 171, 158, 158, 158, 158, 158, 158, 158, 158, 158,
486 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
487 172, 158, 158, 158, 172, 158, 172, 158, 158, 158,
488 158, 158, 158, 158, 158, 158, 158, 0, 158, 158,
489 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
493 static yyconst flex_int16_t yy_nxt[438] =
495 10, 11, 12, 11, 13, 14, 10, 15, 16, 10,
496 10, 10, 17, 10, 10, 10, 10, 18, 19, 20,
497 21, 21, 21, 21, 21, 10, 10, 21, 21, 21,
498 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
499 21, 21, 21, 10, 22, 10, 24, 25, 25, 25,
500 32, 33, 33, 157, 26, 34, 34, 34, 51, 52,
501 27, 26, 26, 26, 26, 10, 11, 12, 11, 13,
502 14, 28, 15, 16, 28, 28, 28, 24, 28, 28,
503 28, 10, 18, 19, 20, 29, 29, 29, 29, 29,
504 30, 10, 29, 29, 29, 29, 29, 29, 29, 29,
506 29, 29, 29, 29, 29, 29, 29, 29, 10, 22,
507 10, 23, 34, 34, 34, 37, 39, 43, 32, 33,
508 33, 45, 54, 55, 46, 59, 45, 64, 156, 46,
509 64, 64, 64, 79, 44, 38, 59, 57, 134, 47,
510 135, 48, 80, 49, 47, 50, 48, 99, 61, 43,
511 50, 110, 41, 67, 67, 67, 60, 63, 63, 63,
512 57, 155, 68, 69, 63, 37, 44, 66, 67, 67,
513 67, 63, 63, 63, 63, 73, 59, 68, 69, 70,
514 34, 34, 34, 43, 75, 38, 154, 92, 83, 83,
515 83, 64, 44, 120, 64, 64, 64, 67, 67, 67,
517 44, 57, 99, 68, 69, 107, 68, 69, 120, 127,
518 108, 153, 152, 121, 83, 83, 83, 133, 133, 133,
519 146, 133, 133, 133, 146, 140, 140, 140, 121, 141,
520 140, 140, 140, 151, 141, 158, 150, 149, 148, 144,
521 147, 143, 142, 139, 147, 36, 36, 36, 36, 36,
522 36, 36, 36, 40, 138, 137, 136, 40, 40, 42,
523 42, 42, 42, 42, 42, 42, 42, 56, 56, 56,
524 56, 62, 132, 62, 64, 131, 130, 64, 129, 64,
525 64, 65, 128, 158, 65, 65, 65, 65, 71, 127,
526 71, 71, 74, 74, 74, 74, 74, 74, 74, 74,
528 76, 76, 76, 76, 76, 76, 76, 76, 89, 126,
529 89, 90, 125, 90, 90, 124, 90, 90, 119, 119,
530 119, 119, 119, 119, 119, 119, 145, 145, 145, 145,
531 145, 145, 145, 145, 123, 122, 59, 59, 118, 117,
532 116, 115, 114, 113, 45, 112, 108, 111, 109, 106,
533 105, 104, 46, 103, 91, 87, 102, 101, 100, 98,
534 97, 96, 95, 94, 93, 77, 75, 91, 88, 87,
535 86, 57, 85, 84, 57, 82, 81, 78, 77, 75,
536 72, 158, 58, 57, 53, 35, 158, 31, 23, 23,
537 9, 158, 158, 158, 158, 158, 158, 158, 158, 158,
539 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
540 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
541 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
542 158, 158, 158, 158, 158, 158, 158
545 static yyconst flex_int16_t yy_chk[438] =
547 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
548 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
549 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
550 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
551 1, 1, 1, 1, 1, 1, 3, 3, 3, 3,
552 7, 7, 7, 156, 3, 11, 11, 11, 18, 18,
553 3, 3, 3, 3, 3, 5, 5, 5, 5, 5,
554 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
555 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
556 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
558 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
559 5, 8, 12, 12, 12, 14, 15, 16, 8, 8,
560 8, 17, 20, 20, 17, 23, 24, 29, 155, 24,
561 29, 29, 29, 48, 16, 14, 31, 29, 128, 17,
562 128, 17, 48, 17, 24, 17, 24, 99, 24, 42,
563 24, 99, 15, 33, 33, 33, 23, 26, 26, 26,
564 26, 154, 33, 33, 26, 36, 42, 31, 32, 32,
565 32, 26, 26, 26, 26, 44, 59, 32, 32, 32,
566 34, 34, 34, 73, 75, 36, 153, 75, 59, 59,
567 59, 65, 44, 110, 65, 65, 65, 67, 67, 67,
569 73, 65, 83, 89, 89, 97, 67, 67, 119, 127,
570 97, 150, 149, 110, 83, 83, 83, 133, 133, 133,
571 141, 127, 127, 127, 145, 136, 136, 136, 119, 136,
572 140, 140, 140, 148, 140, 147, 144, 143, 142, 139,
573 141, 138, 137, 135, 145, 159, 159, 159, 159, 159,
574 159, 159, 159, 160, 134, 132, 131, 160, 160, 161,
575 161, 161, 161, 161, 161, 161, 161, 162, 162, 162,
576 162, 163, 126, 163, 164, 125, 124, 164, 123, 164,
577 164, 165, 122, 121, 165, 165, 165, 165, 166, 120,
578 166, 166, 167, 167, 167, 167, 167, 167, 167, 167,
580 168, 168, 168, 168, 168, 168, 168, 168, 169, 118,
581 169, 170, 117, 170, 170, 116, 170, 170, 171, 171,
582 171, 171, 171, 171, 171, 171, 172, 172, 172, 172,
583 172, 172, 172, 172, 115, 114, 112, 111, 109, 108,
584 107, 106, 105, 104, 103, 102, 101, 100, 98, 96,
585 95, 94, 93, 92, 90, 88, 86, 85, 84, 82,
586 81, 80, 79, 78, 77, 76, 74, 72, 69, 68,
587 66, 63, 61, 60, 56, 50, 49, 47, 46, 45,
588 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
589 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
591 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
592 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
593 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
594 158, 158, 158, 158, 158, 158, 158
597 static yy_state_type yy_last_accepting_state;
598 static char *yy_last_accepting_cpos;
600 extern int yy_flex_debug;
601 int yy_flex_debug = 0;
603 /* The intent behind this definition is that it'll catch
604 * any uses of REJECT which flex missed.
606 #define REJECT reject_used_but_not_detected
607 #define yymore() yymore_used_but_not_detected
608 #define YY_MORE_ADJ 0
609 #define YY_RESTORE_YY_MORE_OFFSET
611 #line 1 "dtc-lexer.l"
613 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
616 * This program is free software; you can redistribute it and/or
617 * modify it under the terms of the GNU General Public License as
618 * published by the Free Software Foundation; either version 2 of the
619 * License, or (at your option) any later version.
621 * This program is distributed in the hope that it will be useful,
622 * but WITHOUT ANY WARRANTY; without even the implied warranty of
623 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
624 * General Public License for more details.
626 * You should have received a copy of the GNU General Public License
627 * along with this program; if not, write to the Free Software
628 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
631 #define YY_NO_INPUT 1
635 #line 37 "dtc-lexer.l"
638 #include "dtc-parser.tab.h"
641 extern bool treesource_error;
643 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
644 #define YY_USER_ACTION \
646 srcpos_update(&yylloc, yytext, yyleng); \
649 /*#define LEXDEBUG 1*/
652 #define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
654 #define DPRINT(fmt, ...) do { } while (0)
657 static int dts_version = 1;
659 #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \
662 static void push_input_file(const char *filename);
663 static bool pop_input_file(void);
664 static void lexical_error(const char *fmt, ...);
665 #line 666 "dtc-lexer.lex.c"
669 #define PROPNODENAME 2
672 #ifndef YY_NO_UNISTD_H
673 /* Special case for "unistd.h", since it is non-ANSI. We include it way
674 * down here because we want the user's section 1 to have been scanned first.
675 * The user has a chance to override it with an option.
680 #ifndef YY_EXTRA_TYPE
681 #define YY_EXTRA_TYPE void *
684 static int yy_init_globals (void );
686 /* Accessor methods to globals.
687 These are made visible to non-reentrant scanners for convenience. */
689 int yylex_destroy (void );
691 int yyget_debug (void );
693 void yyset_debug (int debug_flag );
695 YY_EXTRA_TYPE yyget_extra (void );
697 void yyset_extra (YY_EXTRA_TYPE user_defined );
699 FILE *yyget_in (void );
701 void yyset_in (FILE * in_str );
703 FILE *yyget_out (void );
705 void yyset_out (FILE * out_str );
707 yy_size_t yyget_leng (void );
709 char *yyget_text (void );
711 int yyget_lineno (void );
713 void yyset_lineno (int line_number );
715 /* Macros after this point can all be overridden by user definitions in
719 #ifndef YY_SKIP_YYWRAP
721 extern "C" int yywrap (void );
723 extern int yywrap (void );
728 static void yy_flex_strncpy (char *,yyconst char *,int );
731 #ifdef YY_NEED_STRLEN
732 static int yy_flex_strlen (yyconst char * );
738 static int yyinput (void );
740 static int input (void );
745 /* Amount of stuff to slurp up with each read. */
746 #ifndef YY_READ_BUF_SIZE
748 /* On IA-64, the buffer size is 16k, not 8k */
749 #define YY_READ_BUF_SIZE 16384
751 #define YY_READ_BUF_SIZE 8192
752 #endif /* __ia64__ */
755 /* Copy whatever the last rule matched to the standard output. */
757 /* This used to be an fputs(), but since the string might contain NUL's,
758 * we now use fwrite().
760 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
763 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
764 * is returned in "result".
767 #define YY_INPUT(buf,result,max_size) \
768 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
772 for ( n = 0; n < max_size && \
773 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
776 buf[n++] = (char) c; \
777 if ( c == EOF && ferror( yyin ) ) \
778 YY_FATAL_ERROR( "input in flex scanner failed" ); \
784 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
786 if( errno != EINTR) \
788 YY_FATAL_ERROR( "input in flex scanner failed" ); \
799 /* No semi-colon after return; correct usage is to write "yyterminate();" -
800 * we don't want an extra ';' after the "return" because that will cause
801 * some compilers to complain about unreachable statements.
804 #define yyterminate() return YY_NULL
807 /* Number of entries by which start-condition stack grows. */
808 #ifndef YY_START_STACK_INCR
809 #define YY_START_STACK_INCR 25
812 /* Report a fatal error. */
813 #ifndef YY_FATAL_ERROR
814 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
817 /* end tables serialization structures and prototypes */
819 /* Default declaration of generated scanner - a define so the user can
820 * easily add parameters.
823 #define YY_DECL_IS_OURS 1
825 extern int yylex (void);
827 #define YY_DECL int yylex (void)
828 #endif /* !YY_DECL */
830 /* Code executed at the beginning of each rule, after yytext and yyleng
833 #ifndef YY_USER_ACTION
834 #define YY_USER_ACTION
837 /* Code executed at the end of each rule. */
839 #define YY_BREAK break;
842 #define YY_RULE_SETUP \
844 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
845 (yytext[yyleng - 1] == '\n'); \
848 /** The main scanner function which does all the work.
852 register yy_state_type yy_current_state;
853 register char *yy_cp, *yy_bp;
865 (yy_start) = 1; /* first start state */
873 if ( ! YY_CURRENT_BUFFER ) {
874 yyensure_buffer_stack ();
875 YY_CURRENT_BUFFER_LVALUE =
876 yy_create_buffer(yyin,YY_BUF_SIZE );
879 yy_load_buffer_state( );
883 #line 68 "dtc-lexer.l"
885 #line 886 "dtc-lexer.lex.c"
887 while ( 1 ) /* loops until end-of-file is reached */
889 yy_cp = (yy_c_buf_p);
891 /* Support of yytext. */
892 *yy_cp = (yy_hold_char);
894 /* yy_bp points to the position in yy_ch_buf of the start of
899 yy_current_state = (yy_start);
900 yy_current_state += YY_AT_BOL();
904 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
905 if ( yy_accept[yy_current_state] )
907 (yy_last_accepting_state) = yy_current_state;
908 (yy_last_accepting_cpos) = yy_cp;
910 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
912 yy_current_state = (int) yy_def[yy_current_state];
913 if ( yy_current_state >= 159 )
914 yy_c = yy_meta[(unsigned int) yy_c];
916 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
919 while ( yy_current_state != 158 );
920 yy_cp = (yy_last_accepting_cpos);
921 yy_current_state = (yy_last_accepting_state);
924 yy_act = yy_accept[yy_current_state];
928 do_action: /* This label is used only to access EOF actions. */
931 { /* beginning of action switch */
932 case 0: /* must back up */
933 /* undo the effects of YY_DO_BEFORE_ACTION */
934 *yy_cp = (yy_hold_char);
935 yy_cp = (yy_last_accepting_cpos);
936 yy_current_state = (yy_last_accepting_state);
940 /* rule 1 can match eol */
942 #line 69 "dtc-lexer.l"
944 char *name = strchr(yytext, '\"') + 1;
945 yytext[yyleng-1] = '\0';
946 push_input_file(name);
950 /* rule 2 can match eol */
952 #line 75 "dtc-lexer.l"
954 char *line, *fnstart, *fnend;
956 /* skip text before line # */
958 while (!isdigit((unsigned char)*line))
961 /* regexp ensures that first and list "
962 * in the whole yytext are those at
963 * beginning and end of the filename string */
964 fnstart = memchr(yytext, '"', yyleng);
965 for (fnend = yytext + yyleng - 1;
966 *fnend != '"'; fnend--)
968 assert(fnstart && fnend && (fnend > fnstart));
970 fn = data_copy_escape_string(fnstart + 1,
971 fnend - fnstart - 1);
973 /* Don't allow nuls in filenames */
974 if (memchr(fn.val, '\0', fn.len - 1))
975 lexical_error("nul in line number directive");
977 /* -1 since #line is the number of the next line */
978 srcpos_set_line(xstrdup(fn.val), atoi(line) - 1);
982 case YY_STATE_EOF(INITIAL):
983 case YY_STATE_EOF(BYTESTRING):
984 case YY_STATE_EOF(PROPNODENAME):
985 case YY_STATE_EOF(V1):
986 #line 104 "dtc-lexer.l"
988 if (!pop_input_file()) {
994 /* rule 3 can match eol */
996 #line 110 "dtc-lexer.l"
998 DPRINT("String: %s\n", yytext);
999 yylval.data = data_copy_escape_string(yytext+1,
1006 #line 117 "dtc-lexer.l"
1008 DPRINT("Keyword: /dts-v1/\n");
1016 #line 124 "dtc-lexer.l"
1018 DPRINT("Keyword: /memreserve/\n");
1020 return DT_MEMRESERVE;
1025 #line 130 "dtc-lexer.l"
1027 DPRINT("Keyword: /bits/\n");
1034 #line 136 "dtc-lexer.l"
1036 DPRINT("Keyword: /delete-property/\n");
1037 DPRINT("<PROPNODENAME>\n");
1038 BEGIN(PROPNODENAME);
1044 #line 143 "dtc-lexer.l"
1046 DPRINT("Keyword: /delete-node/\n");
1047 DPRINT("<PROPNODENAME>\n");
1048 BEGIN(PROPNODENAME);
1054 #line 150 "dtc-lexer.l"
1056 DPRINT("Label: %s\n", yytext);
1057 yylval.labelref = xstrdup(yytext);
1058 yylval.labelref[yyleng-1] = '\0';
1064 #line 157 "dtc-lexer.l"
1067 DPRINT("Integer Literal: '%s'\n", yytext);
1070 yylval.integer = strtoull(yytext, &e, 0);
1072 if (*e && e[strspn(e, "UL")]) {
1073 lexical_error("Bad integer literal '%s'",
1077 if (errno == ERANGE)
1078 lexical_error("Integer literal '%s' out of range",
1081 /* ERANGE is the only strtoull error triggerable
1082 * by strings matching the pattern */
1088 /* rule 11 can match eol */
1090 #line 179 "dtc-lexer.l"
1093 DPRINT("Character literal: %s\n", yytext);
1095 d = data_copy_escape_string(yytext+1, yyleng-2);
1097 lexical_error("Empty character literal");
1099 return DT_CHAR_LITERAL;
1102 yylval.integer = (unsigned char)d.val[0];
1105 lexical_error("Character literal has %d"
1106 " characters instead of 1",
1109 return DT_CHAR_LITERAL;
1114 #line 200 "dtc-lexer.l"
1115 { /* label reference */
1116 DPRINT("Ref: %s\n", yytext+1);
1117 yylval.labelref = xstrdup(yytext+1);
1123 #line 206 "dtc-lexer.l"
1124 { /* new-style path reference */
1125 yytext[yyleng-1] = '\0';
1126 DPRINT("Ref: %s\n", yytext+2);
1127 yylval.labelref = xstrdup(yytext+2);
1133 #line 213 "dtc-lexer.l"
1135 yylval.byte = strtol(yytext, NULL, 16);
1136 DPRINT("Byte: %02x\n", (int)yylval.byte);
1142 #line 219 "dtc-lexer.l"
1144 DPRINT("/BYTESTRING\n");
1151 #line 225 "dtc-lexer.l"
1153 DPRINT("PropNodeName: %s\n", yytext);
1154 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
1155 yytext + 1 : yytext);
1157 return DT_PROPNODENAME;
1162 #line 233 "dtc-lexer.l"
1164 DPRINT("Binary Include\n");
1169 /* rule 18 can match eol */
1171 #line 238 "dtc-lexer.l"
1172 /* eat whitespace */
1175 /* rule 19 can match eol */
1177 #line 239 "dtc-lexer.l"
1178 /* eat C-style comments */
1181 /* rule 20 can match eol */
1183 #line 240 "dtc-lexer.l"
1184 /* eat C++-style comments */
1188 #line 242 "dtc-lexer.l"
1189 { return DT_LSHIFT; };
1193 #line 243 "dtc-lexer.l"
1194 { return DT_RSHIFT; };
1198 #line 244 "dtc-lexer.l"
1203 #line 245 "dtc-lexer.l"
1208 #line 246 "dtc-lexer.l"
1213 #line 247 "dtc-lexer.l"
1218 #line 248 "dtc-lexer.l"
1223 #line 249 "dtc-lexer.l"
1228 #line 251 "dtc-lexer.l"
1230 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1231 (unsigned)yytext[0]);
1232 if (yytext[0] == '[') {
1233 DPRINT("<BYTESTRING>\n");
1236 if ((yytext[0] == '{')
1237 || (yytext[0] == ';')) {
1238 DPRINT("<PROPNODENAME>\n");
1239 BEGIN(PROPNODENAME);
1246 #line 266 "dtc-lexer.l"
1249 #line 1250 "dtc-lexer.lex.c"
1251 case YY_END_OF_BUFFER:
1253 /* Amount of text matched not including the EOB char. */
1254 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1256 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1257 *yy_cp = (yy_hold_char);
1258 YY_RESTORE_YY_MORE_OFFSET
1260 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1262 /* We're scanning a new file or input source. It's
1263 * possible that this happened because the user
1264 * just pointed yyin at a new source and called
1265 * yylex(). If so, then we have to assure
1266 * consistency between YY_CURRENT_BUFFER and our
1267 * globals. Here is the right place to do so, because
1268 * this is the first action (other than possibly a
1269 * back-up) that will match for the new input source.
1271 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1272 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1273 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1276 /* Note that here we test for yy_c_buf_p "<=" to the position
1277 * of the first EOB in the buffer, since yy_c_buf_p will
1278 * already have been incremented past the NUL character
1279 * (since all states make transitions on EOB to the
1280 * end-of-buffer state). Contrast this with the test
1283 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1284 { /* This was really a NUL. */
1285 yy_state_type yy_next_state;
1287 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1289 yy_current_state = yy_get_previous_state( );
1291 /* Okay, we're now positioned to make the NUL
1292 * transition. We couldn't have
1293 * yy_get_previous_state() go ahead and do it
1294 * for us because it doesn't know how to deal
1295 * with the possibility of jamming (and we don't
1296 * want to build jamming into it because then it
1297 * will run more slowly).
1300 yy_next_state = yy_try_NUL_trans( yy_current_state );
1302 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1304 if ( yy_next_state )
1306 /* Consume the NUL. */
1307 yy_cp = ++(yy_c_buf_p);
1308 yy_current_state = yy_next_state;
1314 yy_cp = (yy_last_accepting_cpos);
1315 yy_current_state = (yy_last_accepting_state);
1316 goto yy_find_action;
1320 else switch ( yy_get_next_buffer( ) )
1322 case EOB_ACT_END_OF_FILE:
1324 (yy_did_buffer_switch_on_eof) = 0;
1328 /* Note: because we've taken care in
1329 * yy_get_next_buffer() to have set up
1330 * yytext, we can now set up
1331 * yy_c_buf_p so that if some total
1332 * hoser (like flex itself) wants to
1333 * call the scanner after we return the
1334 * YY_NULL, it'll still work - another
1335 * YY_NULL will get returned.
1337 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1339 yy_act = YY_STATE_EOF(YY_START);
1345 if ( ! (yy_did_buffer_switch_on_eof) )
1351 case EOB_ACT_CONTINUE_SCAN:
1353 (yytext_ptr) + yy_amount_of_matched_text;
1355 yy_current_state = yy_get_previous_state( );
1357 yy_cp = (yy_c_buf_p);
1358 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1361 case EOB_ACT_LAST_MATCH:
1363 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1365 yy_current_state = yy_get_previous_state( );
1367 yy_cp = (yy_c_buf_p);
1368 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1369 goto yy_find_action;
1376 "fatal flex scanner internal error--no action found" );
1377 } /* end of action switch */
1378 } /* end of scanning one token */
1379 } /* end of user's declarations */
1380 } /* end of yylex */
1382 /* yy_get_next_buffer - try to read in a new buffer
1384 * Returns a code representing an action:
1385 * EOB_ACT_LAST_MATCH -
1386 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1387 * EOB_ACT_END_OF_FILE - end of file
1389 static int yy_get_next_buffer (void)
1391 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1392 register char *source = (yytext_ptr);
1393 register int number_to_move, i;
1396 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1398 "fatal flex scanner internal error--end of buffer missed" );
1400 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1401 { /* Don't try to fill the buffer, so this is an EOF. */
1402 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1404 /* We matched a single character, the EOB, so
1405 * treat this as a final EOF.
1407 return EOB_ACT_END_OF_FILE;
1412 /* We matched some text prior to the EOB, first
1415 return EOB_ACT_LAST_MATCH;
1419 /* Try to read more data. */
1421 /* First move last chars to start of buffer. */
1422 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1424 for ( i = 0; i < number_to_move; ++i )
1425 *(dest++) = *(source++);
1427 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1428 /* don't do the read, it's not guaranteed to return an EOF,
1431 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1435 yy_size_t num_to_read =
1436 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1438 while ( num_to_read <= 0 )
1439 { /* Not enough room in the buffer - grow it. */
1441 /* just a shorter name for the current buffer */
1442 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1444 int yy_c_buf_p_offset =
1445 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1447 if ( b->yy_is_our_buffer )
1449 yy_size_t new_size = b->yy_buf_size * 2;
1451 if ( new_size <= 0 )
1452 b->yy_buf_size += b->yy_buf_size / 8;
1454 b->yy_buf_size *= 2;
1456 b->yy_ch_buf = (char *)
1457 /* Include room in for 2 EOB chars. */
1458 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1461 /* Can't grow it, we don't own it. */
1464 if ( ! b->yy_ch_buf )
1466 "fatal error - scanner input buffer overflow" );
1468 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1470 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1475 if ( num_to_read > YY_READ_BUF_SIZE )
1476 num_to_read = YY_READ_BUF_SIZE;
1478 /* Read in more data. */
1479 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1480 (yy_n_chars), num_to_read );
1482 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1485 if ( (yy_n_chars) == 0 )
1487 if ( number_to_move == YY_MORE_ADJ )
1489 ret_val = EOB_ACT_END_OF_FILE;
1495 ret_val = EOB_ACT_LAST_MATCH;
1496 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1497 YY_BUFFER_EOF_PENDING;
1502 ret_val = EOB_ACT_CONTINUE_SCAN;
1504 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1505 /* Extend the array by 50%, plus the number we really need. */
1506 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1507 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1508 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1509 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1512 (yy_n_chars) += number_to_move;
1513 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1514 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1516 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1521 /* yy_get_previous_state - get the state just before the EOB char was reached */
1523 static yy_state_type yy_get_previous_state (void)
1525 register yy_state_type yy_current_state;
1526 register char *yy_cp;
1528 yy_current_state = (yy_start);
1529 yy_current_state += YY_AT_BOL();
1531 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1533 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1534 if ( yy_accept[yy_current_state] )
1536 (yy_last_accepting_state) = yy_current_state;
1537 (yy_last_accepting_cpos) = yy_cp;
1539 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1541 yy_current_state = (int) yy_def[yy_current_state];
1542 if ( yy_current_state >= 159 )
1543 yy_c = yy_meta[(unsigned int) yy_c];
1545 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1548 return yy_current_state;
1551 /* yy_try_NUL_trans - try to make a transition on the NUL character
1554 * next_state = yy_try_NUL_trans( current_state );
1556 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1558 register int yy_is_jam;
1559 register char *yy_cp = (yy_c_buf_p);
1561 register YY_CHAR yy_c = 1;
1562 if ( yy_accept[yy_current_state] )
1564 (yy_last_accepting_state) = yy_current_state;
1565 (yy_last_accepting_cpos) = yy_cp;
1567 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1569 yy_current_state = (int) yy_def[yy_current_state];
1570 if ( yy_current_state >= 159 )
1571 yy_c = yy_meta[(unsigned int) yy_c];
1573 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1574 yy_is_jam = (yy_current_state == 158);
1576 return yy_is_jam ? 0 : yy_current_state;
1581 static int yyinput (void)
1583 static int input (void)
1589 *(yy_c_buf_p) = (yy_hold_char);
1591 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1593 /* yy_c_buf_p now points to the character we want to return.
1594 * If this occurs *before* the EOB characters, then it's a
1595 * valid NUL; if not, then we've hit the end of the buffer.
1597 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1598 /* This was really a NUL. */
1599 *(yy_c_buf_p) = '\0';
1602 { /* need more input */
1603 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1606 switch ( yy_get_next_buffer( ) )
1608 case EOB_ACT_LAST_MATCH:
1609 /* This happens because yy_g_n_b()
1610 * sees that we've accumulated a
1611 * token and flags that we need to
1612 * try matching the token before
1613 * proceeding. But for input(),
1614 * there's no matching to consider.
1615 * So convert the EOB_ACT_LAST_MATCH
1616 * to EOB_ACT_END_OF_FILE.
1619 /* Reset buffer status. */
1624 case EOB_ACT_END_OF_FILE:
1629 if ( ! (yy_did_buffer_switch_on_eof) )
1638 case EOB_ACT_CONTINUE_SCAN:
1639 (yy_c_buf_p) = (yytext_ptr) + offset;
1645 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1646 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1647 (yy_hold_char) = *++(yy_c_buf_p);
1649 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1653 #endif /* ifndef YY_NO_INPUT */
1655 /** Immediately switch to a different input stream.
1656 * @param input_file A readable stream.
1658 * @note This function does not reset the start condition to @c INITIAL .
1660 void yyrestart (FILE * input_file )
1663 if ( ! YY_CURRENT_BUFFER ){
1664 yyensure_buffer_stack ();
1665 YY_CURRENT_BUFFER_LVALUE =
1666 yy_create_buffer(yyin,YY_BUF_SIZE );
1669 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1670 yy_load_buffer_state( );
1673 /** Switch to a different input buffer.
1674 * @param new_buffer The new input buffer.
1677 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1680 /* TODO. We should be able to replace this entire function body
1682 * yypop_buffer_state();
1683 * yypush_buffer_state(new_buffer);
1685 yyensure_buffer_stack ();
1686 if ( YY_CURRENT_BUFFER == new_buffer )
1689 if ( YY_CURRENT_BUFFER )
1691 /* Flush out information for old buffer. */
1692 *(yy_c_buf_p) = (yy_hold_char);
1693 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1694 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1697 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1698 yy_load_buffer_state( );
1700 /* We don't actually know whether we did this switch during
1701 * EOF (yywrap()) processing, but the only time this flag
1702 * is looked at is after yywrap() is called, so it's safe
1703 * to go ahead and always set it.
1705 (yy_did_buffer_switch_on_eof) = 1;
1708 static void yy_load_buffer_state (void)
1710 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1711 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1712 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1713 (yy_hold_char) = *(yy_c_buf_p);
1716 /** Allocate and initialize an input buffer state.
1717 * @param file A readable stream.
1718 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1720 * @return the allocated buffer state.
1722 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1726 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1728 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1730 b->yy_buf_size = size;
1732 /* yy_ch_buf has to be 2 characters longer than the size given because
1733 * we need to put in 2 end-of-buffer characters.
1735 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1736 if ( ! b->yy_ch_buf )
1737 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1739 b->yy_is_our_buffer = 1;
1741 yy_init_buffer(b,file );
1746 /** Destroy the buffer.
1747 * @param b a buffer created with yy_create_buffer()
1750 void yy_delete_buffer (YY_BUFFER_STATE b )
1756 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1757 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1759 if ( b->yy_is_our_buffer )
1760 yyfree((void *) b->yy_ch_buf );
1762 yyfree((void *) b );
1765 /* Initializes or reinitializes a buffer.
1766 * This function is sometimes called more than once on the same buffer,
1767 * such as during a yyrestart() or at EOF.
1769 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1774 yy_flush_buffer(b );
1776 b->yy_input_file = file;
1777 b->yy_fill_buffer = 1;
1779 /* If b is the current buffer, then yy_init_buffer was _probably_
1780 * called from yyrestart() or through yy_get_next_buffer.
1781 * In that case, we don't want to reset the lineno or column.
1783 if (b != YY_CURRENT_BUFFER){
1784 b->yy_bs_lineno = 1;
1785 b->yy_bs_column = 0;
1788 b->yy_is_interactive = 0;
1793 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1794 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1797 void yy_flush_buffer (YY_BUFFER_STATE b )
1804 /* We always need two end-of-buffer characters. The first causes
1805 * a transition to the end-of-buffer state. The second causes
1806 * a jam in that state.
1808 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1809 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1811 b->yy_buf_pos = &b->yy_ch_buf[0];
1814 b->yy_buffer_status = YY_BUFFER_NEW;
1816 if ( b == YY_CURRENT_BUFFER )
1817 yy_load_buffer_state( );
1820 /** Pushes the new state onto the stack. The new state becomes
1821 * the current state. This function will allocate the stack
1823 * @param new_buffer The new state.
1826 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1828 if (new_buffer == NULL)
1831 yyensure_buffer_stack();
1833 /* This block is copied from yy_switch_to_buffer. */
1834 if ( YY_CURRENT_BUFFER )
1836 /* Flush out information for old buffer. */
1837 *(yy_c_buf_p) = (yy_hold_char);
1838 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1839 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1842 /* Only push if top exists. Otherwise, replace top. */
1843 if (YY_CURRENT_BUFFER)
1844 (yy_buffer_stack_top)++;
1845 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1847 /* copied from yy_switch_to_buffer. */
1848 yy_load_buffer_state( );
1849 (yy_did_buffer_switch_on_eof) = 1;
1852 /** Removes and deletes the top of the stack, if present.
1853 * The next element becomes the new top.
1856 void yypop_buffer_state (void)
1858 if (!YY_CURRENT_BUFFER)
1861 yy_delete_buffer(YY_CURRENT_BUFFER );
1862 YY_CURRENT_BUFFER_LVALUE = NULL;
1863 if ((yy_buffer_stack_top) > 0)
1864 --(yy_buffer_stack_top);
1866 if (YY_CURRENT_BUFFER) {
1867 yy_load_buffer_state( );
1868 (yy_did_buffer_switch_on_eof) = 1;
1872 /* Allocates the stack if it does not exist.
1873 * Guarantees space for at least one push.
1875 static void yyensure_buffer_stack (void)
1877 yy_size_t num_to_alloc;
1879 if (!(yy_buffer_stack)) {
1881 /* First allocation is just for 2 elements, since we don't know if this
1882 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1883 * immediate realloc on the next call.
1886 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1887 (num_to_alloc * sizeof(struct yy_buffer_state*)
1889 if ( ! (yy_buffer_stack) )
1890 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1892 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1894 (yy_buffer_stack_max) = num_to_alloc;
1895 (yy_buffer_stack_top) = 0;
1899 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1901 /* Increase the buffer to prepare for a possible push. */
1902 int grow_size = 8 /* arbitrary grow size */;
1904 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1905 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1907 num_to_alloc * sizeof(struct yy_buffer_state*)
1909 if ( ! (yy_buffer_stack) )
1910 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1912 /* zero only the new slots.*/
1913 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1914 (yy_buffer_stack_max) = num_to_alloc;
1918 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1919 * @param base the character buffer
1920 * @param size the size in bytes of the character buffer
1922 * @return the newly allocated buffer state object.
1924 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1929 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1930 base[size-1] != YY_END_OF_BUFFER_CHAR )
1931 /* They forgot to leave room for the EOB's. */
1934 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1936 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1938 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1939 b->yy_buf_pos = b->yy_ch_buf = base;
1940 b->yy_is_our_buffer = 0;
1941 b->yy_input_file = 0;
1942 b->yy_n_chars = b->yy_buf_size;
1943 b->yy_is_interactive = 0;
1945 b->yy_fill_buffer = 0;
1946 b->yy_buffer_status = YY_BUFFER_NEW;
1948 yy_switch_to_buffer(b );
1953 /** Setup the input buffer state to scan a string. The next call to yylex() will
1954 * scan from a @e copy of @a str.
1955 * @param yystr a NUL-terminated string to scan
1957 * @return the newly allocated buffer state object.
1958 * @note If you want to scan bytes that may contain NUL values, then use
1959 * yy_scan_bytes() instead.
1961 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1964 return yy_scan_bytes(yystr,strlen(yystr) );
1967 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1968 * scan from a @e copy of @a bytes.
1969 * @param yybytes the byte buffer to scan
1970 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1972 * @return the newly allocated buffer state object.
1974 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
1981 /* Get memory for full buffer, including space for trailing EOB's. */
1982 n = _yybytes_len + 2;
1983 buf = (char *) yyalloc(n );
1985 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1987 for ( i = 0; i < _yybytes_len; ++i )
1988 buf[i] = yybytes[i];
1990 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1992 b = yy_scan_buffer(buf,n );
1994 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1996 /* It's okay to grow etc. this buffer, and we should throw it
1997 * away when we're done.
1999 b->yy_is_our_buffer = 1;
2004 #ifndef YY_EXIT_FAILURE
2005 #define YY_EXIT_FAILURE 2
2008 static void yy_fatal_error (yyconst char* msg )
2010 (void) fprintf( stderr, "%s\n", msg );
2011 exit( YY_EXIT_FAILURE );
2014 /* Redefine yyless() so it works in section 3 code. */
2020 /* Undo effects of setting up yytext. */ \
2021 int yyless_macro_arg = (n); \
2022 YY_LESS_LINENO(yyless_macro_arg);\
2023 yytext[yyleng] = (yy_hold_char); \
2024 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2025 (yy_hold_char) = *(yy_c_buf_p); \
2026 *(yy_c_buf_p) = '\0'; \
2027 yyleng = yyless_macro_arg; \
2031 /* Accessor methods (get/set functions) to struct members. */
2033 /** Get the current line number.
2036 int yyget_lineno (void)
2042 /** Get the input stream.
2045 FILE *yyget_in (void)
2050 /** Get the output stream.
2053 FILE *yyget_out (void)
2058 /** Get the length of the current token.
2061 yy_size_t yyget_leng (void)
2066 /** Get the current token.
2070 char *yyget_text (void)
2075 /** Set the current line number.
2076 * @param line_number
2079 void yyset_lineno (int line_number )
2082 yylineno = line_number;
2085 /** Set the input stream. This does not discard the current
2087 * @param in_str A readable stream.
2089 * @see yy_switch_to_buffer
2091 void yyset_in (FILE * in_str )
2096 void yyset_out (FILE * out_str )
2101 int yyget_debug (void)
2103 return yy_flex_debug;
2106 void yyset_debug (int bdebug )
2108 yy_flex_debug = bdebug ;
2111 static int yy_init_globals (void)
2113 /* Initialization is the same as for the non-reentrant scanner.
2114 * This function is called from yylex_destroy(), so don't allocate here.
2117 (yy_buffer_stack) = 0;
2118 (yy_buffer_stack_top) = 0;
2119 (yy_buffer_stack_max) = 0;
2120 (yy_c_buf_p) = (char *) 0;
2124 /* Defined in main.c */
2133 /* For future reference: Set errno on error, since we are called by
2139 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2140 int yylex_destroy (void)
2143 /* Pop the buffer stack, destroying each element. */
2144 while(YY_CURRENT_BUFFER){
2145 yy_delete_buffer(YY_CURRENT_BUFFER );
2146 YY_CURRENT_BUFFER_LVALUE = NULL;
2147 yypop_buffer_state();
2150 /* Destroy the stack itself. */
2151 yyfree((yy_buffer_stack) );
2152 (yy_buffer_stack) = NULL;
2154 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2155 * yylex() is called, initialization will occur. */
2162 * Internal utility routines.
2166 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2169 for ( i = 0; i < n; ++i )
2174 #ifdef YY_NEED_STRLEN
2175 static int yy_flex_strlen (yyconst char * s )
2178 for ( n = 0; s[n]; ++n )
2185 void *yyalloc (yy_size_t size )
2187 return (void *) malloc( size );
2190 void *yyrealloc (void * ptr, yy_size_t size )
2192 /* The cast to (char *) in the following accommodates both
2193 * implementations that use char* generic pointers, and those
2194 * that use void* generic pointers. It works with the latter
2195 * because both ANSI C and C++ allow castless assignment from
2196 * any pointer type to void*, and deal with argument conversions
2197 * as though doing an assignment.
2199 return (void *) realloc( (char *) ptr, size );
2202 void yyfree (void * ptr )
2204 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2207 #define YYTABLES_NAME "yytables"
2209 #line 265 "dtc-lexer.l"
2213 static void push_input_file(const char *filename)
2217 srcfile_push(filename);
2219 yyin = current_srcfile->f;
2221 yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
2225 static bool pop_input_file(void)
2227 if (srcfile_pop() == 0)
2230 yypop_buffer_state();
2231 yyin = current_srcfile->f;
2236 static void lexical_error(const char *fmt, ...)
2241 srcpos_verror(&yylloc, "Lexical error", fmt, ap);
2244 treesource_error = true;