1 #line 2 "dtc-lexer.lex.c"
3 #line 4 "dtc-lexer.lex.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
58 /* Limits of integral types. */
60 #define INT8_MIN (-128)
63 #define INT16_MIN (-32767-1)
66 #define INT32_MIN (-2147483647-1)
69 #define INT8_MAX (127)
72 #define INT16_MAX (32767)
75 #define INT32_MAX (2147483647)
78 #define UINT8_MAX (255U)
81 #define UINT16_MAX (65535U)
84 #define UINT32_MAX (4294967295U)
89 #endif /* ! FLEXINT_H */
93 /* The "const" storage-class-modifier is valid. */
96 #else /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
107 #define yyconst const
112 /* Returned upon end-of-file. */
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
122 /* Enter a start condition. This macro really ought to take a parameter,
123 * but we do it the disgusting crufty way forced on us by the ()-less
124 * definition of BEGIN.
126 #define BEGIN (yy_start) = 1 + 2 *
128 /* Translate the current start state into a value that can be later handed
129 * to BEGIN to return to the state. The YYSTATE alias is for lex
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin )
141 #define YY_END_OF_BUFFER_CHAR 0
143 /* Size of default input buffer. */
146 /* On IA-64, the buffer size is 16k, not 8k.
147 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
148 * Ditto for the __ia64__ case accordingly.
150 #define YY_BUF_SIZE 32768
152 #define YY_BUF_SIZE 16384
153 #endif /* __ia64__ */
156 /* The state buf must be large enough to hold one state per character in the main buffer.
158 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
161 #define YY_TYPEDEF_YY_BUFFER_STATE
162 typedef struct yy_buffer_state *YY_BUFFER_STATE;
167 extern FILE *yyin, *yyout;
169 #define EOB_ACT_CONTINUE_SCAN 0
170 #define EOB_ACT_END_OF_FILE 1
171 #define EOB_ACT_LAST_MATCH 2
173 #define YY_LESS_LINENO(n)
175 /* Return all but the first "n" matched characters back to the input stream. */
179 /* Undo effects of setting up yytext. */ \
180 int yyless_macro_arg = (n); \
181 YY_LESS_LINENO(yyless_macro_arg);\
182 *yy_cp = (yy_hold_char); \
183 YY_RESTORE_YY_MORE_OFFSET \
184 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
185 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
189 #define unput(c) yyunput( c, (yytext_ptr) )
191 #ifndef YY_TYPEDEF_YY_SIZE_T
192 #define YY_TYPEDEF_YY_SIZE_T
193 typedef size_t yy_size_t;
196 #ifndef YY_STRUCT_YY_BUFFER_STATE
197 #define YY_STRUCT_YY_BUFFER_STATE
198 struct yy_buffer_state
202 char *yy_ch_buf; /* input buffer */
203 char *yy_buf_pos; /* current position in input buffer */
205 /* Size of input buffer in bytes, not including room for EOB
208 yy_size_t yy_buf_size;
210 /* Number of characters read into yy_ch_buf, not including EOB
215 /* Whether we "own" the buffer - i.e., we know we created it,
216 * and can realloc() it to grow it, and should free() it to
219 int yy_is_our_buffer;
221 /* Whether this is an "interactive" input source; if so, and
222 * if we're using stdio for input, then we want to use getc()
223 * instead of fread(), to make sure we stop fetching input after
226 int yy_is_interactive;
228 /* Whether we're considered to be at the beginning of a line.
229 * If so, '^' rules will be active on the next match, otherwise
234 int yy_bs_lineno; /**< The line count. */
235 int yy_bs_column; /**< The column count. */
237 /* Whether to try to fill the input buffer when we reach the
242 int yy_buffer_status;
244 #define YY_BUFFER_NEW 0
245 #define YY_BUFFER_NORMAL 1
246 /* When an EOF's been seen but there's still some text to process
247 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
248 * shouldn't try reading from the input source any more. We might
249 * still have a bunch of tokens to match, though, because of
250 * possible backing-up.
252 * When we actually see the EOF, we change the status to "new"
253 * (via yyrestart()), so that the user can continue scanning by
254 * just pointing yyin at a new input file.
256 #define YY_BUFFER_EOF_PENDING 2
259 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
261 /* Stack of input buffers. */
262 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
263 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
264 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
266 /* We provide macros for accessing buffer states in case in the
267 * future we want to put the buffer states in a more general
270 * Returns the top of the stack, or NULL.
272 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
273 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
276 /* Same as previous macro, but useful when we know that the buffer stack is not
277 * NULL or when we need an lvalue. For internal use only.
279 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
281 /* yy_hold_char holds the character lost when yytext is formed. */
282 static char yy_hold_char;
283 static int yy_n_chars; /* number of characters read into yy_ch_buf */
286 /* Points to current character in buffer. */
287 static char *yy_c_buf_p = (char *) 0;
288 static int yy_init = 0; /* whether we need to initialize */
289 static int yy_start = 0; /* start state number */
291 /* Flag which is used to allow yywrap()'s to do buffer switches
292 * instead of setting up a fresh yyin. A bit of a hack ...
294 static int yy_did_buffer_switch_on_eof;
296 void yyrestart (FILE *input_file );
297 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
298 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
299 void yy_delete_buffer (YY_BUFFER_STATE b );
300 void yy_flush_buffer (YY_BUFFER_STATE b );
301 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
302 void yypop_buffer_state (void );
304 static void yyensure_buffer_stack (void );
305 static void yy_load_buffer_state (void );
306 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
308 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
310 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
311 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
312 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
314 void *yyalloc (yy_size_t );
315 void *yyrealloc (void *,yy_size_t );
316 void yyfree (void * );
318 #define yy_new_buffer yy_create_buffer
320 #define yy_set_interactive(is_interactive) \
322 if ( ! YY_CURRENT_BUFFER ){ \
323 yyensure_buffer_stack (); \
324 YY_CURRENT_BUFFER_LVALUE = \
325 yy_create_buffer(yyin,YY_BUF_SIZE ); \
327 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
330 #define yy_set_bol(at_bol) \
332 if ( ! YY_CURRENT_BUFFER ){\
333 yyensure_buffer_stack (); \
334 YY_CURRENT_BUFFER_LVALUE = \
335 yy_create_buffer(yyin,YY_BUF_SIZE ); \
337 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
340 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
342 /* Begin user sect3 */
345 #define YY_SKIP_YYWRAP
347 typedef unsigned char YY_CHAR;
349 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
351 typedef int yy_state_type;
358 #define yytext_ptr yytext
360 static yy_state_type yy_get_previous_state (void );
361 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
362 static int yy_get_next_buffer (void );
363 static void yy_fatal_error (yyconst char msg[] );
365 /* Done after the current pattern has been matched and before the
366 * corresponding action - sets up yytext.
368 #define YY_DO_BEFORE_ACTION \
369 (yytext_ptr) = yy_bp; \
370 yyleng = (size_t) (yy_cp - yy_bp); \
371 (yy_hold_char) = *yy_cp; \
373 (yy_c_buf_p) = yy_cp;
375 #define YY_NUM_RULES 31
376 #define YY_END_OF_BUFFER 32
377 /* This struct is not used in this scanner,
378 but its presence is necessary. */
381 flex_int32_t yy_verify;
384 static yyconst flex_int16_t yy_accept[166] =
386 0, 0, 0, 0, 0, 0, 0, 0, 32, 30,
387 19, 19, 30, 30, 30, 30, 30, 30, 30, 30,
388 30, 30, 30, 30, 30, 30, 16, 17, 17, 30,
389 17, 11, 11, 19, 27, 0, 3, 0, 28, 13,
390 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
391 0, 22, 24, 26, 25, 23, 0, 10, 29, 0,
392 0, 0, 15, 15, 17, 17, 17, 11, 11, 11,
393 0, 13, 0, 12, 0, 0, 0, 21, 0, 0,
394 0, 0, 0, 0, 0, 0, 0, 17, 11, 11,
395 11, 0, 14, 20, 0, 0, 0, 0, 0, 0,
397 0, 0, 0, 0, 17, 0, 0, 0, 0, 0,
398 0, 0, 0, 0, 0, 17, 7, 0, 0, 0,
399 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
400 0, 0, 0, 0, 4, 18, 0, 0, 5, 2,
401 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
402 0, 0, 1, 0, 0, 0, 0, 6, 9, 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, 32, 22, 33, 22, 22, 34, 35, 36,
420 37, 38, 22, 39, 40, 41, 42, 43, 22, 25,
421 44, 22, 45, 46, 47, 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[48] =
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[180] =
449 0, 393, 35, 392, 66, 391, 38, 107, 397, 401,
450 55, 113, 377, 112, 111, 111, 114, 42, 376, 106,
451 377, 347, 126, 120, 0, 147, 401, 0, 124, 0,
452 137, 158, 170, 163, 401, 153, 401, 389, 401, 0,
453 378, 120, 401, 131, 380, 386, 355, 139, 351, 355,
454 351, 401, 401, 401, 401, 401, 367, 401, 401, 185,
455 350, 346, 401, 364, 0, 185, 347, 189, 356, 355,
456 0, 0, 330, 180, 366, 141, 372, 361, 332, 338,
457 331, 341, 334, 326, 205, 331, 337, 329, 401, 341,
458 167, 316, 401, 349, 348, 320, 328, 346, 180, 318,
460 324, 209, 324, 320, 322, 342, 338, 309, 306, 315,
461 305, 315, 312, 192, 342, 341, 401, 293, 306, 282,
462 268, 252, 255, 203, 285, 282, 272, 268, 252, 233,
463 232, 239, 208, 107, 401, 401, 238, 211, 401, 211,
464 212, 208, 228, 203, 215, 207, 233, 222, 212, 211,
465 203, 227, 401, 237, 225, 204, 185, 401, 401, 149,
466 128, 88, 42, 401, 401, 253, 259, 267, 271, 275,
467 281, 288, 292, 300, 308, 312, 318, 326, 334
470 static yyconst flex_int16_t yy_def[180] =
472 165, 1, 1, 3, 165, 5, 1, 1, 165, 165,
473 165, 165, 165, 166, 167, 168, 165, 165, 165, 165,
474 169, 165, 165, 165, 170, 169, 165, 171, 172, 171,
475 171, 165, 165, 165, 165, 166, 165, 166, 165, 173,
476 165, 168, 165, 168, 174, 175, 165, 165, 165, 165,
477 165, 165, 165, 165, 165, 165, 169, 165, 165, 165,
478 165, 165, 165, 169, 171, 172, 171, 165, 165, 165,
479 176, 173, 177, 168, 174, 174, 175, 165, 165, 165,
480 165, 165, 165, 165, 165, 165, 165, 171, 165, 165,
481 176, 177, 165, 165, 165, 165, 165, 165, 165, 165,
483 165, 165, 165, 165, 171, 165, 165, 165, 165, 165,
484 165, 165, 165, 178, 165, 171, 165, 165, 165, 165,
485 165, 165, 165, 178, 165, 178, 165, 165, 165, 165,
486 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
487 165, 165, 165, 165, 165, 165, 165, 179, 165, 165,
488 165, 179, 165, 179, 165, 165, 165, 165, 165, 165,
489 165, 165, 165, 165, 0, 165, 165, 165, 165, 165,
490 165, 165, 165, 165, 165, 165, 165, 165, 165
493 static yyconst flex_int16_t yy_nxt[449] =
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, 21, 10, 22, 10, 24, 25, 25,
500 25, 32, 33, 33, 164, 26, 34, 34, 34, 52,
501 53, 27, 26, 26, 26, 26, 10, 11, 12, 11,
502 13, 14, 28, 15, 16, 28, 28, 28, 24, 28,
503 28, 28, 10, 18, 19, 20, 29, 29, 29, 29,
504 29, 30, 10, 29, 29, 29, 29, 29, 29, 29,
506 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
507 10, 22, 10, 23, 34, 34, 34, 37, 39, 43,
508 32, 33, 33, 45, 55, 56, 46, 60, 43, 45,
509 65, 163, 46, 65, 65, 65, 44, 38, 60, 74,
510 58, 47, 141, 48, 142, 44, 49, 47, 50, 48,
511 76, 51, 62, 94, 50, 41, 44, 51, 37, 61,
512 64, 64, 64, 58, 34, 34, 34, 64, 162, 80,
513 67, 68, 68, 68, 64, 64, 64, 64, 38, 81,
514 69, 70, 71, 68, 68, 68, 60, 161, 43, 69,
515 70, 65, 69, 70, 65, 65, 65, 125, 85, 85,
517 85, 58, 68, 68, 68, 44, 102, 110, 125, 133,
518 102, 69, 70, 111, 114, 160, 159, 126, 85, 85,
519 85, 140, 140, 140, 140, 140, 140, 153, 126, 147,
520 147, 147, 153, 148, 147, 147, 147, 158, 148, 165,
521 157, 156, 155, 151, 150, 149, 146, 154, 145, 144,
522 143, 139, 154, 36, 36, 36, 36, 36, 36, 36,
523 36, 40, 138, 137, 136, 40, 40, 42, 42, 42,
524 42, 42, 42, 42, 42, 57, 57, 57, 57, 63,
525 135, 63, 65, 134, 165, 65, 133, 65, 65, 66,
526 132, 131, 66, 66, 66, 66, 72, 130, 72, 72,
528 75, 75, 75, 75, 75, 75, 75, 75, 77, 77,
529 77, 77, 77, 77, 77, 77, 91, 129, 91, 92,
530 128, 92, 92, 127, 92, 92, 124, 124, 124, 124,
531 124, 124, 124, 124, 152, 152, 152, 152, 152, 152,
532 152, 152, 60, 60, 123, 122, 121, 120, 119, 118,
533 117, 45, 116, 111, 115, 113, 112, 109, 108, 107,
534 46, 106, 93, 89, 105, 104, 103, 101, 100, 99,
535 98, 97, 96, 95, 78, 76, 93, 90, 89, 88,
536 58, 87, 86, 58, 84, 83, 82, 79, 78, 76,
537 73, 165, 59, 58, 54, 35, 165, 31, 23, 23,
539 9, 165, 165, 165, 165, 165, 165, 165, 165, 165,
540 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
541 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
542 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
543 165, 165, 165, 165, 165, 165, 165, 165
546 static yyconst flex_int16_t yy_chk[449] =
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, 1, 1, 1, 1,
552 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
553 3, 7, 7, 7, 163, 3, 11, 11, 11, 18,
554 18, 3, 3, 3, 3, 3, 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,
557 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
559 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
560 5, 5, 5, 8, 12, 12, 12, 14, 15, 16,
561 8, 8, 8, 17, 20, 20, 17, 23, 42, 24,
562 29, 162, 24, 29, 29, 29, 16, 14, 31, 44,
563 29, 17, 134, 17, 134, 42, 17, 24, 17, 24,
564 76, 17, 24, 76, 24, 15, 44, 24, 36, 23,
565 26, 26, 26, 26, 34, 34, 34, 26, 161, 48,
566 31, 32, 32, 32, 26, 26, 26, 26, 36, 48,
567 32, 32, 32, 33, 33, 33, 60, 160, 74, 91,
568 91, 66, 33, 33, 66, 66, 66, 114, 60, 60,
570 60, 66, 68, 68, 68, 74, 85, 99, 124, 133,
571 102, 68, 68, 99, 102, 157, 156, 114, 85, 85,
572 85, 133, 133, 133, 140, 140, 140, 148, 124, 143,
573 143, 143, 152, 143, 147, 147, 147, 155, 147, 154,
574 151, 150, 149, 146, 145, 144, 142, 148, 141, 138,
575 137, 132, 152, 166, 166, 166, 166, 166, 166, 166,
576 166, 167, 131, 130, 129, 167, 167, 168, 168, 168,
577 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
578 128, 170, 171, 127, 126, 171, 125, 171, 171, 172,
579 123, 122, 172, 172, 172, 172, 173, 121, 173, 173,
581 174, 174, 174, 174, 174, 174, 174, 174, 175, 175,
582 175, 175, 175, 175, 175, 175, 176, 120, 176, 177,
583 119, 177, 177, 118, 177, 177, 178, 178, 178, 178,
584 178, 178, 178, 178, 179, 179, 179, 179, 179, 179,
585 179, 179, 116, 115, 113, 112, 111, 110, 109, 108,
586 107, 106, 105, 104, 103, 101, 100, 98, 97, 96,
587 95, 94, 92, 90, 88, 87, 86, 84, 83, 82,
588 81, 80, 79, 78, 77, 75, 73, 70, 69, 67,
589 64, 62, 61, 57, 51, 50, 49, 47, 46, 45,
590 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
592 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
593 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
594 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
595 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
596 165, 165, 165, 165, 165, 165, 165, 165
599 static yy_state_type yy_last_accepting_state;
600 static char *yy_last_accepting_cpos;
602 extern int yy_flex_debug;
603 int yy_flex_debug = 0;
605 /* The intent behind this definition is that it'll catch
606 * any uses of REJECT which flex missed.
608 #define REJECT reject_used_but_not_detected
609 #define yymore() yymore_used_but_not_detected
610 #define YY_MORE_ADJ 0
611 #define YY_RESTORE_YY_MORE_OFFSET
613 #line 1 "dtc-lexer.l"
615 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
618 * This program is free software; you can redistribute it and/or
619 * modify it under the terms of the GNU General Public License as
620 * published by the Free Software Foundation; either version 2 of the
621 * License, or (at your option) any later version.
623 * This program is distributed in the hope that it will be useful,
624 * but WITHOUT ANY WARRANTY; without even the implied warranty of
625 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
626 * General Public License for more details.
628 * You should have received a copy of the GNU General Public License
629 * along with this program; if not, write to the Free Software
630 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
633 #define YY_NO_INPUT 1
637 #line 37 "dtc-lexer.l"
640 #include "dtc-parser.tab.h"
643 extern bool treesource_error;
645 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
646 #define YY_USER_ACTION \
648 srcpos_update(&yylloc, yytext, yyleng); \
651 /*#define LEXDEBUG 1*/
654 #define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
656 #define DPRINT(fmt, ...) do { } while (0)
659 static int dts_version = 1;
661 #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \
664 static void push_input_file(const char *filename);
665 static bool pop_input_file(void);
666 static void lexical_error(const char *fmt, ...);
667 #line 668 "dtc-lexer.lex.c"
671 #define PROPNODENAME 2
674 #ifndef YY_NO_UNISTD_H
675 /* Special case for "unistd.h", since it is non-ANSI. We include it way
676 * down here because we want the user's section 1 to have been scanned first.
677 * The user has a chance to override it with an option.
682 #ifndef YY_EXTRA_TYPE
683 #define YY_EXTRA_TYPE void *
686 static int yy_init_globals (void );
688 /* Accessor methods to globals.
689 These are made visible to non-reentrant scanners for convenience. */
691 int yylex_destroy (void );
693 int yyget_debug (void );
695 void yyset_debug (int debug_flag );
697 YY_EXTRA_TYPE yyget_extra (void );
699 void yyset_extra (YY_EXTRA_TYPE user_defined );
701 FILE *yyget_in (void );
703 void yyset_in (FILE * in_str );
705 FILE *yyget_out (void );
707 void yyset_out (FILE * out_str );
709 int yyget_leng (void );
711 char *yyget_text (void );
713 int yyget_lineno (void );
715 void yyset_lineno (int line_number );
717 /* Macros after this point can all be overridden by user definitions in
721 #ifndef YY_SKIP_YYWRAP
723 extern "C" int yywrap (void );
725 extern int yywrap (void );
730 static void yy_flex_strncpy (char *,yyconst char *,int );
733 #ifdef YY_NEED_STRLEN
734 static int yy_flex_strlen (yyconst char * );
740 static int yyinput (void );
742 static int input (void );
747 /* Amount of stuff to slurp up with each read. */
748 #ifndef YY_READ_BUF_SIZE
750 /* On IA-64, the buffer size is 16k, not 8k */
751 #define YY_READ_BUF_SIZE 16384
753 #define YY_READ_BUF_SIZE 8192
754 #endif /* __ia64__ */
757 /* Copy whatever the last rule matched to the standard output. */
759 /* This used to be an fputs(), but since the string might contain NUL's,
760 * we now use fwrite().
762 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
765 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
766 * is returned in "result".
769 #define YY_INPUT(buf,result,max_size) \
770 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
774 for ( n = 0; n < max_size && \
775 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
778 buf[n++] = (char) c; \
779 if ( c == EOF && ferror( yyin ) ) \
780 YY_FATAL_ERROR( "input in flex scanner failed" ); \
786 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
788 if( errno != EINTR) \
790 YY_FATAL_ERROR( "input in flex scanner failed" ); \
801 /* No semi-colon after return; correct usage is to write "yyterminate();" -
802 * we don't want an extra ';' after the "return" because that will cause
803 * some compilers to complain about unreachable statements.
806 #define yyterminate() return YY_NULL
809 /* Number of entries by which start-condition stack grows. */
810 #ifndef YY_START_STACK_INCR
811 #define YY_START_STACK_INCR 25
814 /* Report a fatal error. */
815 #ifndef YY_FATAL_ERROR
816 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
819 /* end tables serialization structures and prototypes */
821 /* Default declaration of generated scanner - a define so the user can
822 * easily add parameters.
825 #define YY_DECL_IS_OURS 1
827 extern int yylex (void);
829 #define YY_DECL int yylex (void)
830 #endif /* !YY_DECL */
832 /* Code executed at the beginning of each rule, after yytext and yyleng
835 #ifndef YY_USER_ACTION
836 #define YY_USER_ACTION
839 /* Code executed at the end of each rule. */
841 #define YY_BREAK break;
844 #define YY_RULE_SETUP \
846 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
847 (yytext[yyleng - 1] == '\n'); \
850 /** The main scanner function which does all the work.
854 register yy_state_type yy_current_state;
855 register char *yy_cp, *yy_bp;
858 #line 68 "dtc-lexer.l"
860 #line 861 "dtc-lexer.lex.c"
871 (yy_start) = 1; /* first start state */
879 if ( ! YY_CURRENT_BUFFER ) {
880 yyensure_buffer_stack ();
881 YY_CURRENT_BUFFER_LVALUE =
882 yy_create_buffer(yyin,YY_BUF_SIZE );
885 yy_load_buffer_state( );
888 while ( 1 ) /* loops until end-of-file is reached */
890 yy_cp = (yy_c_buf_p);
892 /* Support of yytext. */
893 *yy_cp = (yy_hold_char);
895 /* yy_bp points to the position in yy_ch_buf of the start of
900 yy_current_state = (yy_start);
901 yy_current_state += YY_AT_BOL();
905 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
906 if ( yy_accept[yy_current_state] )
908 (yy_last_accepting_state) = yy_current_state;
909 (yy_last_accepting_cpos) = yy_cp;
911 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
913 yy_current_state = (int) yy_def[yy_current_state];
914 if ( yy_current_state >= 166 )
915 yy_c = yy_meta[(unsigned int) yy_c];
917 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
920 while ( yy_current_state != 165 );
921 yy_cp = (yy_last_accepting_cpos);
922 yy_current_state = (yy_last_accepting_state);
925 yy_act = yy_accept[yy_current_state];
929 do_action: /* This label is used only to access EOF actions. */
932 { /* beginning of action switch */
933 case 0: /* must back up */
934 /* undo the effects of YY_DO_BEFORE_ACTION */
935 *yy_cp = (yy_hold_char);
936 yy_cp = (yy_last_accepting_cpos);
937 yy_current_state = (yy_last_accepting_state);
941 /* rule 1 can match eol */
943 #line 69 "dtc-lexer.l"
945 char *name = strchr(yytext, '\"') + 1;
946 yytext[yyleng-1] = '\0';
947 push_input_file(name);
951 /* rule 2 can match eol */
953 #line 75 "dtc-lexer.l"
955 char *line, *tmp, *fn;
956 /* skip text before line # */
958 while (!isdigit((unsigned char)*line))
960 /* skip digits in line # */
962 while (!isspace((unsigned char)*tmp))
964 /* "NULL"-terminate line # */
966 /* start of filename */
967 fn = strchr(tmp + 1, '"') + 1;
968 /* strip trailing " from filename */
969 tmp = strchr(fn, '"');
971 /* -1 since #line is the number of the next line */
972 srcpos_set_line(xstrdup(fn), atoi(line) - 1);
975 case YY_STATE_EOF(INITIAL):
976 case YY_STATE_EOF(BYTESTRING):
977 case YY_STATE_EOF(PROPNODENAME):
978 case YY_STATE_EOF(V1):
979 #line 96 "dtc-lexer.l"
981 if (!pop_input_file()) {
987 /* rule 3 can match eol */
989 #line 102 "dtc-lexer.l"
991 DPRINT("String: %s\n", yytext);
992 yylval.data = data_copy_escape_string(yytext+1,
999 #line 109 "dtc-lexer.l"
1001 DPRINT("Keyword: /dts-v1/\n");
1009 #line 116 "dtc-lexer.l"
1011 DPRINT("Keyword: /plugin/\n");
1017 #line 121 "dtc-lexer.l"
1019 DPRINT("Keyword: /memreserve/\n");
1021 return DT_MEMRESERVE;
1026 #line 127 "dtc-lexer.l"
1028 DPRINT("Keyword: /bits/\n");
1035 #line 133 "dtc-lexer.l"
1037 DPRINT("Keyword: /delete-property/\n");
1038 DPRINT("<PROPNODENAME>\n");
1039 BEGIN(PROPNODENAME);
1045 #line 140 "dtc-lexer.l"
1047 DPRINT("Keyword: /delete-node/\n");
1048 DPRINT("<PROPNODENAME>\n");
1049 BEGIN(PROPNODENAME);
1055 #line 147 "dtc-lexer.l"
1057 DPRINT("Label: %s\n", yytext);
1058 yylval.labelref = xstrdup(yytext);
1059 yylval.labelref[yyleng-1] = '\0';
1065 #line 154 "dtc-lexer.l"
1068 DPRINT("Integer Literal: '%s'\n", yytext);
1071 yylval.integer = strtoull(yytext, &e, 0);
1073 assert(!(*e) || !e[strspn(e, "UL")]);
1075 if (errno == ERANGE)
1076 lexical_error("Integer literal '%s' out of range",
1079 /* ERANGE is the only strtoull error triggerable
1080 * by strings matching the pattern */
1086 /* rule 12 can match eol */
1088 #line 173 "dtc-lexer.l"
1091 DPRINT("Character literal: %s\n", yytext);
1093 d = data_copy_escape_string(yytext+1, yyleng-2);
1095 lexical_error("Empty character literal");
1097 return DT_CHAR_LITERAL;
1100 yylval.integer = (unsigned char)d.val[0];
1103 lexical_error("Character literal has %d"
1104 " characters instead of 1",
1107 return DT_CHAR_LITERAL;
1112 #line 194 "dtc-lexer.l"
1113 { /* label reference */
1114 DPRINT("Ref: %s\n", yytext+1);
1115 yylval.labelref = xstrdup(yytext+1);
1121 #line 200 "dtc-lexer.l"
1122 { /* new-style path reference */
1123 yytext[yyleng-1] = '\0';
1124 DPRINT("Ref: %s\n", yytext+2);
1125 yylval.labelref = xstrdup(yytext+2);
1131 #line 207 "dtc-lexer.l"
1133 yylval.byte = strtol(yytext, NULL, 16);
1134 DPRINT("Byte: %02x\n", (int)yylval.byte);
1140 #line 213 "dtc-lexer.l"
1142 DPRINT("/BYTESTRING\n");
1149 #line 219 "dtc-lexer.l"
1151 DPRINT("PropNodeName: %s\n", yytext);
1152 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
1153 yytext + 1 : yytext);
1155 return DT_PROPNODENAME;
1160 #line 227 "dtc-lexer.l"
1162 DPRINT("Binary Include\n");
1167 /* rule 19 can match eol */
1169 #line 232 "dtc-lexer.l"
1170 /* eat whitespace */
1173 /* rule 20 can match eol */
1175 #line 233 "dtc-lexer.l"
1176 /* eat C-style comments */
1179 /* rule 21 can match eol */
1181 #line 234 "dtc-lexer.l"
1182 /* eat C++-style comments */
1186 #line 236 "dtc-lexer.l"
1187 { return DT_LSHIFT; };
1191 #line 237 "dtc-lexer.l"
1192 { return DT_RSHIFT; };
1196 #line 238 "dtc-lexer.l"
1201 #line 239 "dtc-lexer.l"
1206 #line 240 "dtc-lexer.l"
1211 #line 241 "dtc-lexer.l"
1216 #line 242 "dtc-lexer.l"
1221 #line 243 "dtc-lexer.l"
1226 #line 245 "dtc-lexer.l"
1228 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1229 (unsigned)yytext[0]);
1230 if (yytext[0] == '[') {
1231 DPRINT("<BYTESTRING>\n");
1234 if ((yytext[0] == '{')
1235 || (yytext[0] == ';')) {
1236 DPRINT("<PROPNODENAME>\n");
1237 BEGIN(PROPNODENAME);
1244 #line 260 "dtc-lexer.l"
1247 #line 1248 "dtc-lexer.lex.c"
1249 case YY_END_OF_BUFFER:
1251 /* Amount of text matched not including the EOB char. */
1252 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1254 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1255 *yy_cp = (yy_hold_char);
1256 YY_RESTORE_YY_MORE_OFFSET
1258 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1260 /* We're scanning a new file or input source. It's
1261 * possible that this happened because the user
1262 * just pointed yyin at a new source and called
1263 * yylex(). If so, then we have to assure
1264 * consistency between YY_CURRENT_BUFFER and our
1265 * globals. Here is the right place to do so, because
1266 * this is the first action (other than possibly a
1267 * back-up) that will match for the new input source.
1269 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1270 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1271 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1274 /* Note that here we test for yy_c_buf_p "<=" to the position
1275 * of the first EOB in the buffer, since yy_c_buf_p will
1276 * already have been incremented past the NUL character
1277 * (since all states make transitions on EOB to the
1278 * end-of-buffer state). Contrast this with the test
1281 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1282 { /* This was really a NUL. */
1283 yy_state_type yy_next_state;
1285 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1287 yy_current_state = yy_get_previous_state( );
1289 /* Okay, we're now positioned to make the NUL
1290 * transition. We couldn't have
1291 * yy_get_previous_state() go ahead and do it
1292 * for us because it doesn't know how to deal
1293 * with the possibility of jamming (and we don't
1294 * want to build jamming into it because then it
1295 * will run more slowly).
1298 yy_next_state = yy_try_NUL_trans( yy_current_state );
1300 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1302 if ( yy_next_state )
1304 /* Consume the NUL. */
1305 yy_cp = ++(yy_c_buf_p);
1306 yy_current_state = yy_next_state;
1312 yy_cp = (yy_last_accepting_cpos);
1313 yy_current_state = (yy_last_accepting_state);
1314 goto yy_find_action;
1318 else switch ( yy_get_next_buffer( ) )
1320 case EOB_ACT_END_OF_FILE:
1322 (yy_did_buffer_switch_on_eof) = 0;
1326 /* Note: because we've taken care in
1327 * yy_get_next_buffer() to have set up
1328 * yytext, we can now set up
1329 * yy_c_buf_p so that if some total
1330 * hoser (like flex itself) wants to
1331 * call the scanner after we return the
1332 * YY_NULL, it'll still work - another
1333 * YY_NULL will get returned.
1335 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1337 yy_act = YY_STATE_EOF(YY_START);
1343 if ( ! (yy_did_buffer_switch_on_eof) )
1349 case EOB_ACT_CONTINUE_SCAN:
1351 (yytext_ptr) + yy_amount_of_matched_text;
1353 yy_current_state = yy_get_previous_state( );
1355 yy_cp = (yy_c_buf_p);
1356 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1359 case EOB_ACT_LAST_MATCH:
1361 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1363 yy_current_state = yy_get_previous_state( );
1365 yy_cp = (yy_c_buf_p);
1366 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1367 goto yy_find_action;
1374 "fatal flex scanner internal error--no action found" );
1375 } /* end of action switch */
1376 } /* end of scanning one token */
1377 } /* end of yylex */
1379 /* yy_get_next_buffer - try to read in a new buffer
1381 * Returns a code representing an action:
1382 * EOB_ACT_LAST_MATCH -
1383 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1384 * EOB_ACT_END_OF_FILE - end of file
1386 static int yy_get_next_buffer (void)
1388 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1389 register char *source = (yytext_ptr);
1390 register int number_to_move, i;
1393 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1395 "fatal flex scanner internal error--end of buffer missed" );
1397 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1398 { /* Don't try to fill the buffer, so this is an EOF. */
1399 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1401 /* We matched a single character, the EOB, so
1402 * treat this as a final EOF.
1404 return EOB_ACT_END_OF_FILE;
1409 /* We matched some text prior to the EOB, first
1412 return EOB_ACT_LAST_MATCH;
1416 /* Try to read more data. */
1418 /* First move last chars to start of buffer. */
1419 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1421 for ( i = 0; i < number_to_move; ++i )
1422 *(dest++) = *(source++);
1424 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1425 /* don't do the read, it's not guaranteed to return an EOF,
1428 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1433 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1435 while ( num_to_read <= 0 )
1436 { /* Not enough room in the buffer - grow it. */
1438 /* just a shorter name for the current buffer */
1439 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1441 int yy_c_buf_p_offset =
1442 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1444 if ( b->yy_is_our_buffer )
1446 int new_size = b->yy_buf_size * 2;
1448 if ( new_size <= 0 )
1449 b->yy_buf_size += b->yy_buf_size / 8;
1451 b->yy_buf_size *= 2;
1453 b->yy_ch_buf = (char *)
1454 /* Include room in for 2 EOB chars. */
1455 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1458 /* Can't grow it, we don't own it. */
1461 if ( ! b->yy_ch_buf )
1463 "fatal error - scanner input buffer overflow" );
1465 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1467 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1472 if ( num_to_read > YY_READ_BUF_SIZE )
1473 num_to_read = YY_READ_BUF_SIZE;
1475 /* Read in more data. */
1476 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1477 (yy_n_chars), (size_t) num_to_read );
1479 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1482 if ( (yy_n_chars) == 0 )
1484 if ( number_to_move == YY_MORE_ADJ )
1486 ret_val = EOB_ACT_END_OF_FILE;
1492 ret_val = EOB_ACT_LAST_MATCH;
1493 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1494 YY_BUFFER_EOF_PENDING;
1499 ret_val = EOB_ACT_CONTINUE_SCAN;
1501 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1502 /* Extend the array by 50%, plus the number we really need. */
1503 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1504 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1505 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1506 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1509 (yy_n_chars) += number_to_move;
1510 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1511 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1513 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1518 /* yy_get_previous_state - get the state just before the EOB char was reached */
1520 static yy_state_type yy_get_previous_state (void)
1522 register yy_state_type yy_current_state;
1523 register char *yy_cp;
1525 yy_current_state = (yy_start);
1526 yy_current_state += YY_AT_BOL();
1528 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1530 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1531 if ( yy_accept[yy_current_state] )
1533 (yy_last_accepting_state) = yy_current_state;
1534 (yy_last_accepting_cpos) = yy_cp;
1536 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1538 yy_current_state = (int) yy_def[yy_current_state];
1539 if ( yy_current_state >= 166 )
1540 yy_c = yy_meta[(unsigned int) yy_c];
1542 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1545 return yy_current_state;
1548 /* yy_try_NUL_trans - try to make a transition on the NUL character
1551 * next_state = yy_try_NUL_trans( current_state );
1553 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1555 register int yy_is_jam;
1556 register char *yy_cp = (yy_c_buf_p);
1558 register YY_CHAR yy_c = 1;
1559 if ( yy_accept[yy_current_state] )
1561 (yy_last_accepting_state) = yy_current_state;
1562 (yy_last_accepting_cpos) = yy_cp;
1564 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1566 yy_current_state = (int) yy_def[yy_current_state];
1567 if ( yy_current_state >= 166 )
1568 yy_c = yy_meta[(unsigned int) yy_c];
1570 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1571 yy_is_jam = (yy_current_state == 165);
1573 return yy_is_jam ? 0 : yy_current_state;
1578 static int yyinput (void)
1580 static int input (void)
1586 *(yy_c_buf_p) = (yy_hold_char);
1588 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1590 /* yy_c_buf_p now points to the character we want to return.
1591 * If this occurs *before* the EOB characters, then it's a
1592 * valid NUL; if not, then we've hit the end of the buffer.
1594 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1595 /* This was really a NUL. */
1596 *(yy_c_buf_p) = '\0';
1599 { /* need more input */
1600 int offset = (yy_c_buf_p) - (yytext_ptr);
1603 switch ( yy_get_next_buffer( ) )
1605 case EOB_ACT_LAST_MATCH:
1606 /* This happens because yy_g_n_b()
1607 * sees that we've accumulated a
1608 * token and flags that we need to
1609 * try matching the token before
1610 * proceeding. But for input(),
1611 * there's no matching to consider.
1612 * So convert the EOB_ACT_LAST_MATCH
1613 * to EOB_ACT_END_OF_FILE.
1616 /* Reset buffer status. */
1621 case EOB_ACT_END_OF_FILE:
1626 if ( ! (yy_did_buffer_switch_on_eof) )
1635 case EOB_ACT_CONTINUE_SCAN:
1636 (yy_c_buf_p) = (yytext_ptr) + offset;
1642 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1643 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1644 (yy_hold_char) = *++(yy_c_buf_p);
1646 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1650 #endif /* ifndef YY_NO_INPUT */
1652 /** Immediately switch to a different input stream.
1653 * @param input_file A readable stream.
1655 * @note This function does not reset the start condition to @c INITIAL .
1657 void yyrestart (FILE * input_file )
1660 if ( ! YY_CURRENT_BUFFER ){
1661 yyensure_buffer_stack ();
1662 YY_CURRENT_BUFFER_LVALUE =
1663 yy_create_buffer(yyin,YY_BUF_SIZE );
1666 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1667 yy_load_buffer_state( );
1670 /** Switch to a different input buffer.
1671 * @param new_buffer The new input buffer.
1674 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1677 /* TODO. We should be able to replace this entire function body
1679 * yypop_buffer_state();
1680 * yypush_buffer_state(new_buffer);
1682 yyensure_buffer_stack ();
1683 if ( YY_CURRENT_BUFFER == new_buffer )
1686 if ( YY_CURRENT_BUFFER )
1688 /* Flush out information for old buffer. */
1689 *(yy_c_buf_p) = (yy_hold_char);
1690 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1691 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1694 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1695 yy_load_buffer_state( );
1697 /* We don't actually know whether we did this switch during
1698 * EOF (yywrap()) processing, but the only time this flag
1699 * is looked at is after yywrap() is called, so it's safe
1700 * to go ahead and always set it.
1702 (yy_did_buffer_switch_on_eof) = 1;
1705 static void yy_load_buffer_state (void)
1707 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1708 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1709 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1710 (yy_hold_char) = *(yy_c_buf_p);
1713 /** Allocate and initialize an input buffer state.
1714 * @param file A readable stream.
1715 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1717 * @return the allocated buffer state.
1719 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1723 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1725 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1727 b->yy_buf_size = size;
1729 /* yy_ch_buf has to be 2 characters longer than the size given because
1730 * we need to put in 2 end-of-buffer characters.
1732 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1733 if ( ! b->yy_ch_buf )
1734 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1736 b->yy_is_our_buffer = 1;
1738 yy_init_buffer(b,file );
1743 /** Destroy the buffer.
1744 * @param b a buffer created with yy_create_buffer()
1747 void yy_delete_buffer (YY_BUFFER_STATE b )
1753 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1754 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1756 if ( b->yy_is_our_buffer )
1757 yyfree((void *) b->yy_ch_buf );
1759 yyfree((void *) b );
1762 /* Initializes or reinitializes a buffer.
1763 * This function is sometimes called more than once on the same buffer,
1764 * such as during a yyrestart() or at EOF.
1766 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1771 yy_flush_buffer(b );
1773 b->yy_input_file = file;
1774 b->yy_fill_buffer = 1;
1776 /* If b is the current buffer, then yy_init_buffer was _probably_
1777 * called from yyrestart() or through yy_get_next_buffer.
1778 * In that case, we don't want to reset the lineno or column.
1780 if (b != YY_CURRENT_BUFFER){
1781 b->yy_bs_lineno = 1;
1782 b->yy_bs_column = 0;
1785 b->yy_is_interactive = 0;
1790 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1791 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1794 void yy_flush_buffer (YY_BUFFER_STATE b )
1801 /* We always need two end-of-buffer characters. The first causes
1802 * a transition to the end-of-buffer state. The second causes
1803 * a jam in that state.
1805 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1806 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1808 b->yy_buf_pos = &b->yy_ch_buf[0];
1811 b->yy_buffer_status = YY_BUFFER_NEW;
1813 if ( b == YY_CURRENT_BUFFER )
1814 yy_load_buffer_state( );
1817 /** Pushes the new state onto the stack. The new state becomes
1818 * the current state. This function will allocate the stack
1820 * @param new_buffer The new state.
1823 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1825 if (new_buffer == NULL)
1828 yyensure_buffer_stack();
1830 /* This block is copied from yy_switch_to_buffer. */
1831 if ( YY_CURRENT_BUFFER )
1833 /* Flush out information for old buffer. */
1834 *(yy_c_buf_p) = (yy_hold_char);
1835 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1836 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1839 /* Only push if top exists. Otherwise, replace top. */
1840 if (YY_CURRENT_BUFFER)
1841 (yy_buffer_stack_top)++;
1842 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1844 /* copied from yy_switch_to_buffer. */
1845 yy_load_buffer_state( );
1846 (yy_did_buffer_switch_on_eof) = 1;
1849 /** Removes and deletes the top of the stack, if present.
1850 * The next element becomes the new top.
1853 void yypop_buffer_state (void)
1855 if (!YY_CURRENT_BUFFER)
1858 yy_delete_buffer(YY_CURRENT_BUFFER );
1859 YY_CURRENT_BUFFER_LVALUE = NULL;
1860 if ((yy_buffer_stack_top) > 0)
1861 --(yy_buffer_stack_top);
1863 if (YY_CURRENT_BUFFER) {
1864 yy_load_buffer_state( );
1865 (yy_did_buffer_switch_on_eof) = 1;
1869 /* Allocates the stack if it does not exist.
1870 * Guarantees space for at least one push.
1872 static void yyensure_buffer_stack (void)
1876 if (!(yy_buffer_stack)) {
1878 /* First allocation is just for 2 elements, since we don't know if this
1879 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1880 * immediate realloc on the next call.
1883 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1884 (num_to_alloc * sizeof(struct yy_buffer_state*)
1886 if ( ! (yy_buffer_stack) )
1887 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1889 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1891 (yy_buffer_stack_max) = num_to_alloc;
1892 (yy_buffer_stack_top) = 0;
1896 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1898 /* Increase the buffer to prepare for a possible push. */
1899 int grow_size = 8 /* arbitrary grow size */;
1901 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1902 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1904 num_to_alloc * sizeof(struct yy_buffer_state*)
1906 if ( ! (yy_buffer_stack) )
1907 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1909 /* zero only the new slots.*/
1910 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1911 (yy_buffer_stack_max) = num_to_alloc;
1915 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1916 * @param base the character buffer
1917 * @param size the size in bytes of the character buffer
1919 * @return the newly allocated buffer state object.
1921 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1926 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1927 base[size-1] != YY_END_OF_BUFFER_CHAR )
1928 /* They forgot to leave room for the EOB's. */
1931 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1933 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1935 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1936 b->yy_buf_pos = b->yy_ch_buf = base;
1937 b->yy_is_our_buffer = 0;
1938 b->yy_input_file = 0;
1939 b->yy_n_chars = b->yy_buf_size;
1940 b->yy_is_interactive = 0;
1942 b->yy_fill_buffer = 0;
1943 b->yy_buffer_status = YY_BUFFER_NEW;
1945 yy_switch_to_buffer(b );
1950 /** Setup the input buffer state to scan a string. The next call to yylex() will
1951 * scan from a @e copy of @a str.
1952 * @param yystr a NUL-terminated string to scan
1954 * @return the newly allocated buffer state object.
1955 * @note If you want to scan bytes that may contain NUL values, then use
1956 * yy_scan_bytes() instead.
1958 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1961 return yy_scan_bytes(yystr,strlen(yystr) );
1964 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1965 * scan from a @e copy of @a bytes.
1966 * @param yybytes the byte buffer to scan
1967 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1969 * @return the newly allocated buffer state object.
1971 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1978 /* Get memory for full buffer, including space for trailing EOB's. */
1979 n = _yybytes_len + 2;
1980 buf = (char *) yyalloc(n );
1982 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1984 for ( i = 0; i < _yybytes_len; ++i )
1985 buf[i] = yybytes[i];
1987 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1989 b = yy_scan_buffer(buf,n );
1991 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1993 /* It's okay to grow etc. this buffer, and we should throw it
1994 * away when we're done.
1996 b->yy_is_our_buffer = 1;
2001 #ifndef YY_EXIT_FAILURE
2002 #define YY_EXIT_FAILURE 2
2005 static void yy_fatal_error (yyconst char* msg )
2007 (void) fprintf( stderr, "%s\n", msg );
2008 exit( YY_EXIT_FAILURE );
2011 /* Redefine yyless() so it works in section 3 code. */
2017 /* Undo effects of setting up yytext. */ \
2018 int yyless_macro_arg = (n); \
2019 YY_LESS_LINENO(yyless_macro_arg);\
2020 yytext[yyleng] = (yy_hold_char); \
2021 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2022 (yy_hold_char) = *(yy_c_buf_p); \
2023 *(yy_c_buf_p) = '\0'; \
2024 yyleng = yyless_macro_arg; \
2028 /* Accessor methods (get/set functions) to struct members. */
2030 /** Get the current line number.
2033 int yyget_lineno (void)
2039 /** Get the input stream.
2042 FILE *yyget_in (void)
2047 /** Get the output stream.
2050 FILE *yyget_out (void)
2055 /** Get the length of the current token.
2058 int yyget_leng (void)
2063 /** Get the current token.
2067 char *yyget_text (void)
2072 /** Set the current line number.
2073 * @param line_number
2076 void yyset_lineno (int line_number )
2079 yylineno = line_number;
2082 /** Set the input stream. This does not discard the current
2084 * @param in_str A readable stream.
2086 * @see yy_switch_to_buffer
2088 void yyset_in (FILE * in_str )
2093 void yyset_out (FILE * out_str )
2098 int yyget_debug (void)
2100 return yy_flex_debug;
2103 void yyset_debug (int bdebug )
2105 yy_flex_debug = bdebug ;
2108 static int yy_init_globals (void)
2110 /* Initialization is the same as for the non-reentrant scanner.
2111 * This function is called from yylex_destroy(), so don't allocate here.
2114 (yy_buffer_stack) = 0;
2115 (yy_buffer_stack_top) = 0;
2116 (yy_buffer_stack_max) = 0;
2117 (yy_c_buf_p) = (char *) 0;
2121 /* Defined in main.c */
2130 /* For future reference: Set errno on error, since we are called by
2136 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2137 int yylex_destroy (void)
2140 /* Pop the buffer stack, destroying each element. */
2141 while(YY_CURRENT_BUFFER){
2142 yy_delete_buffer(YY_CURRENT_BUFFER );
2143 YY_CURRENT_BUFFER_LVALUE = NULL;
2144 yypop_buffer_state();
2147 /* Destroy the stack itself. */
2148 yyfree((yy_buffer_stack) );
2149 (yy_buffer_stack) = NULL;
2151 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2152 * yylex() is called, initialization will occur. */
2159 * Internal utility routines.
2163 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2166 for ( i = 0; i < n; ++i )
2171 #ifdef YY_NEED_STRLEN
2172 static int yy_flex_strlen (yyconst char * s )
2175 for ( n = 0; s[n]; ++n )
2182 void *yyalloc (yy_size_t size )
2184 return (void *) malloc( size );
2187 void *yyrealloc (void * ptr, yy_size_t size )
2189 /* The cast to (char *) in the following accommodates both
2190 * implementations that use char* generic pointers, and those
2191 * that use void* generic pointers. It works with the latter
2192 * because both ANSI C and C++ allow castless assignment from
2193 * any pointer type to void*, and deal with argument conversions
2194 * as though doing an assignment.
2196 return (void *) realloc( (char *) ptr, size );
2199 void yyfree (void * ptr )
2201 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2204 #define YYTABLES_NAME "yytables"
2206 #line 260 "dtc-lexer.l"
2210 static void push_input_file(const char *filename)
2214 srcfile_push(filename);
2216 yyin = current_srcfile->f;
2218 yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
2222 static bool pop_input_file(void)
2224 if (srcfile_pop() == 0)
2227 yypop_buffer_state();
2228 yyin = current_srcfile->f;
2233 static void lexical_error(const char *fmt, ...)
2238 srcpos_verror(&yylloc, "Lexical error", fmt, ap);
2241 treesource_error = true;