blob: d77fdfe590593ba59aa12e90ec03faf3ebd6ad16 [file] [log] [blame]
Tom Rinibd391732017-09-23 12:52:44 -04001#line 2 "dtc-lexer.lex.c"
2
3#line 4 "dtc-lexer.lex.c"
4
5#define YY_INT_ALIGNED short int
6
7/* A lexical scanner generated by flex */
8
9#define FLEX_SCANNER
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
14#define FLEX_BETA
15#endif
16
17/* First, we deal with platform-specific or compiler-specific issues. */
18
19/* begin standard C headers. */
20#include <stdio.h>
21#include <string.h>
22#include <errno.h>
23#include <stdlib.h>
24
25/* end standard C headers. */
26
27/* flex integer type definitions */
28
29#ifndef FLEXINT_H
30#define FLEXINT_H
31
32/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33
34#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35
36/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
38 */
39#ifndef __STDC_LIMIT_MACROS
40#define __STDC_LIMIT_MACROS 1
41#endif
42
43#include <inttypes.h>
44typedef int8_t flex_int8_t;
45typedef uint8_t flex_uint8_t;
46typedef int16_t flex_int16_t;
47typedef uint16_t flex_uint16_t;
48typedef int32_t flex_int32_t;
49typedef uint32_t flex_uint32_t;
50#else
51typedef signed char flex_int8_t;
52typedef short int flex_int16_t;
53typedef int flex_int32_t;
54typedef unsigned char flex_uint8_t;
55typedef unsigned short int flex_uint16_t;
56typedef unsigned int flex_uint32_t;
57
58/* Limits of integral types. */
59#ifndef INT8_MIN
60#define INT8_MIN (-128)
61#endif
62#ifndef INT16_MIN
63#define INT16_MIN (-32767-1)
64#endif
65#ifndef INT32_MIN
66#define INT32_MIN (-2147483647-1)
67#endif
68#ifndef INT8_MAX
69#define INT8_MAX (127)
70#endif
71#ifndef INT16_MAX
72#define INT16_MAX (32767)
73#endif
74#ifndef INT32_MAX
75#define INT32_MAX (2147483647)
76#endif
77#ifndef UINT8_MAX
78#define UINT8_MAX (255U)
79#endif
80#ifndef UINT16_MAX
81#define UINT16_MAX (65535U)
82#endif
83#ifndef UINT32_MAX
84#define UINT32_MAX (4294967295U)
85#endif
86
87#endif /* ! C99 */
88
89#endif /* ! FLEXINT_H */
90
91#ifdef __cplusplus
92
93/* The "const" storage-class-modifier is valid. */
94#define YY_USE_CONST
95
96#else /* ! __cplusplus */
97
98/* C99 requires __STDC__ to be defined as 1. */
99#if defined (__STDC__)
100
101#define YY_USE_CONST
102
103#endif /* defined (__STDC__) */
104#endif /* ! __cplusplus */
105
106#ifdef YY_USE_CONST
107#define yyconst const
108#else
109#define yyconst
110#endif
111
112/* Returned upon end-of-file. */
113#define YY_NULL 0
114
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
118 * double cast.
119 */
120#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121
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.
125 */
126#define BEGIN (yy_start) = 1 + 2 *
127
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
130 * compatibility.
131 */
132#define YY_START (((yy_start) - 1) / 2)
133#define YYSTATE YY_START
134
135/* Action number for EOF rule of a given start state. */
136#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
137
138/* Special action meaning "start processing a new file". */
139#define YY_NEW_FILE yyrestart(yyin )
140
141#define YY_END_OF_BUFFER_CHAR 0
142
143/* Size of default input buffer. */
144#ifndef YY_BUF_SIZE
145#ifdef __ia64__
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.
149 */
150#define YY_BUF_SIZE 32768
151#else
152#define YY_BUF_SIZE 16384
153#endif /* __ia64__ */
154#endif
155
156/* The state buf must be large enough to hold one state per character in the main buffer.
157 */
158#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
159
160#ifndef YY_TYPEDEF_YY_BUFFER_STATE
161#define YY_TYPEDEF_YY_BUFFER_STATE
162typedef struct yy_buffer_state *YY_BUFFER_STATE;
163#endif
164
165extern int yyleng;
166
167extern FILE *yyin, *yyout;
168
169#define EOB_ACT_CONTINUE_SCAN 0
170#define EOB_ACT_END_OF_FILE 1
171#define EOB_ACT_LAST_MATCH 2
172
173 #define YY_LESS_LINENO(n)
174
175/* Return all but the first "n" matched characters back to the input stream. */
176#define yyless(n) \
177 do \
178 { \
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 */ \
186 } \
187 while ( 0 )
188
189#define unput(c) yyunput( c, (yytext_ptr) )
190
191#ifndef YY_TYPEDEF_YY_SIZE_T
192#define YY_TYPEDEF_YY_SIZE_T
193typedef size_t yy_size_t;
194#endif
195
196#ifndef YY_STRUCT_YY_BUFFER_STATE
197#define YY_STRUCT_YY_BUFFER_STATE
198struct yy_buffer_state
199 {
200 FILE *yy_input_file;
201
202 char *yy_ch_buf; /* input buffer */
203 char *yy_buf_pos; /* current position in input buffer */
204
205 /* Size of input buffer in bytes, not including room for EOB
206 * characters.
207 */
208 yy_size_t yy_buf_size;
209
210 /* Number of characters read into yy_ch_buf, not including EOB
211 * characters.
212 */
213 int yy_n_chars;
214
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
217 * delete it.
218 */
219 int yy_is_our_buffer;
220
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
224 * each newline.
225 */
226 int yy_is_interactive;
227
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
230 * not.
231 */
232 int yy_at_bol;
233
234 int yy_bs_lineno; /**< The line count. */
235 int yy_bs_column; /**< The column count. */
236
237 /* Whether to try to fill the input buffer when we reach the
238 * end of it.
239 */
240 int yy_fill_buffer;
241
242 int yy_buffer_status;
243
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.
251 *
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.
255 */
256#define YY_BUFFER_EOF_PENDING 2
257
258 };
259#endif /* !YY_STRUCT_YY_BUFFER_STATE */
260
261/* Stack of input buffers. */
262static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
263static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
264static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
265
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
268 * "scanner state".
269 *
270 * Returns the top of the stack, or NULL.
271 */
272#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
273 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
274 : NULL)
275
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.
278 */
279#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
280
281/* yy_hold_char holds the character lost when yytext is formed. */
282static char yy_hold_char;
283static int yy_n_chars; /* number of characters read into yy_ch_buf */
284int yyleng;
285
286/* Points to current character in buffer. */
287static char *yy_c_buf_p = (char *) 0;
288static int yy_init = 0; /* whether we need to initialize */
289static int yy_start = 0; /* start state number */
290
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 ...
293 */
294static int yy_did_buffer_switch_on_eof;
295
296void yyrestart (FILE *input_file );
297void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
298YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
299void yy_delete_buffer (YY_BUFFER_STATE b );
300void yy_flush_buffer (YY_BUFFER_STATE b );
301void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
302void yypop_buffer_state (void );
303
304static void yyensure_buffer_stack (void );
305static void yy_load_buffer_state (void );
306static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
307
308#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
309
310YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
311YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
312YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
313
314void *yyalloc (yy_size_t );
315void *yyrealloc (void *,yy_size_t );
316void yyfree (void * );
317
318#define yy_new_buffer yy_create_buffer
319
320#define yy_set_interactive(is_interactive) \
321 { \
322 if ( ! YY_CURRENT_BUFFER ){ \
323 yyensure_buffer_stack (); \
324 YY_CURRENT_BUFFER_LVALUE = \
325 yy_create_buffer(yyin,YY_BUF_SIZE ); \
326 } \
327 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
328 }
329
330#define yy_set_bol(at_bol) \
331 { \
332 if ( ! YY_CURRENT_BUFFER ){\
333 yyensure_buffer_stack (); \
334 YY_CURRENT_BUFFER_LVALUE = \
335 yy_create_buffer(yyin,YY_BUF_SIZE ); \
336 } \
337 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
338 }
339
340#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
341
342/* Begin user sect3 */
343
344#define yywrap(n) 1
345#define YY_SKIP_YYWRAP
346
347typedef unsigned char YY_CHAR;
348
349FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
350
351typedef int yy_state_type;
352
353extern int yylineno;
354
355int yylineno = 1;
356
357extern char *yytext;
358#define yytext_ptr yytext
359
360static yy_state_type yy_get_previous_state (void );
361static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
362static int yy_get_next_buffer (void );
363static void yy_fatal_error (yyconst char msg[] );
364
365/* Done after the current pattern has been matched and before the
366 * corresponding action - sets up yytext.
367 */
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; \
372 *yy_cp = '\0'; \
373 (yy_c_buf_p) = yy_cp;
374
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. */
379struct yy_trans_info
380 {
381 flex_int32_t yy_verify;
382 flex_int32_t yy_nxt;
383 };
384static yyconst flex_int16_t yy_accept[166] =
385 { 0,
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,
396
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,
403 0, 0, 0, 8, 0
404 } ;
405
406static yyconst flex_int32_t yy_ec[256] =
407 { 0,
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,
418
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,
429
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,
435 1, 1, 1, 1, 1
436 } ;
437
438static yyconst flex_int32_t yy_meta[48] =
439 { 0,
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,
444 8, 8, 8, 8, 3, 1, 4
445 } ;
446
447static yyconst flex_int16_t yy_base[180] =
448 { 0,
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,
459
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
468 } ;
469
470static yyconst flex_int16_t yy_def[180] =
471 { 0,
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,
482
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
491 } ;
492
493static yyconst flex_int16_t yy_nxt[449] =
494 { 0,
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,
505
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,
516
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,
527
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,
538
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
544 } ;
545
546static yyconst flex_int16_t yy_chk[449] =
547 { 0,
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,
558
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,
569
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,
580
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,
591
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
597 } ;
598
599static yy_state_type yy_last_accepting_state;
600static char *yy_last_accepting_cpos;
601
602extern int yy_flex_debug;
603int yy_flex_debug = 0;
604
605/* The intent behind this definition is that it'll catch
606 * any uses of REJECT which flex missed.
607 */
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
612char *yytext;
613#line 1 "dtc-lexer.l"
614/*
615 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
616 *
617 *
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.
622 *
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.
627 *
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
631 * USA
632 */
633#define YY_NO_INPUT 1
634
635
636
637#line 37 "dtc-lexer.l"
638#include "dtc.h"
639#include "srcpos.h"
640#include "dtc-parser.tab.h"
641
642YYLTYPE yylloc;
643extern bool treesource_error;
644
645/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
646#define YY_USER_ACTION \
647 { \
648 srcpos_update(&yylloc, yytext, yyleng); \
649 }
650
651/*#define LEXDEBUG 1*/
652
653#ifdef LEXDEBUG
654#define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
655#else
656#define DPRINT(fmt, ...) do { } while (0)
657#endif
658
659static int dts_version = 1;
660
661#define BEGIN_DEFAULT() DPRINT("<V1>\n"); \
662 BEGIN(V1); \
663
664static void push_input_file(const char *filename);
665static bool pop_input_file(void);
666#ifdef __GNUC__
667static void lexical_error(const char *fmt, ...)
668 __attribute__((format (printf, 1, 2)));
669#else
670static void lexical_error(const char *fmt, ...);
671#endif
672
673#line 674 "dtc-lexer.lex.c"
674
675#define INITIAL 0
676#define BYTESTRING 1
677#define PROPNODENAME 2
678#define V1 3
679
680#ifndef YY_NO_UNISTD_H
681/* Special case for "unistd.h", since it is non-ANSI. We include it way
682 * down here because we want the user's section 1 to have been scanned first.
683 * The user has a chance to override it with an option.
684 */
685#include <unistd.h>
686#endif
687
688#ifndef YY_EXTRA_TYPE
689#define YY_EXTRA_TYPE void *
690#endif
691
692static int yy_init_globals (void );
693
694/* Accessor methods to globals.
695 These are made visible to non-reentrant scanners for convenience. */
696
697int yylex_destroy (void );
698
699int yyget_debug (void );
700
701void yyset_debug (int debug_flag );
702
703YY_EXTRA_TYPE yyget_extra (void );
704
705void yyset_extra (YY_EXTRA_TYPE user_defined );
706
707FILE *yyget_in (void );
708
709void yyset_in (FILE * in_str );
710
711FILE *yyget_out (void );
712
713void yyset_out (FILE * out_str );
714
715int yyget_leng (void );
716
717char *yyget_text (void );
718
719int yyget_lineno (void );
720
721void yyset_lineno (int line_number );
722
723/* Macros after this point can all be overridden by user definitions in
724 * section 1.
725 */
726
727#ifndef YY_SKIP_YYWRAP
728#ifdef __cplusplus
729extern "C" int yywrap (void );
730#else
731extern int yywrap (void );
732#endif
733#endif
734
735#ifndef yytext_ptr
736static void yy_flex_strncpy (char *,yyconst char *,int );
737#endif
738
739#ifdef YY_NEED_STRLEN
740static int yy_flex_strlen (yyconst char * );
741#endif
742
743#ifndef YY_NO_INPUT
744
745#ifdef __cplusplus
746static int yyinput (void );
747#else
748static int input (void );
749#endif
750
751#endif
752
753/* Amount of stuff to slurp up with each read. */
754#ifndef YY_READ_BUF_SIZE
755#ifdef __ia64__
756/* On IA-64, the buffer size is 16k, not 8k */
757#define YY_READ_BUF_SIZE 16384
758#else
759#define YY_READ_BUF_SIZE 8192
760#endif /* __ia64__ */
761#endif
762
763/* Copy whatever the last rule matched to the standard output. */
764#ifndef ECHO
765/* This used to be an fputs(), but since the string might contain NUL's,
766 * we now use fwrite().
767 */
768#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
769#endif
770
771/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
772 * is returned in "result".
773 */
774#ifndef YY_INPUT
775#define YY_INPUT(buf,result,max_size) \
776 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
777 { \
778 int c = '*'; \
779 size_t n; \
780 for ( n = 0; n < max_size && \
781 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
782 buf[n] = (char) c; \
783 if ( c == '\n' ) \
784 buf[n++] = (char) c; \
785 if ( c == EOF && ferror( yyin ) ) \
786 YY_FATAL_ERROR( "input in flex scanner failed" ); \
787 result = n; \
788 } \
789 else \
790 { \
791 errno=0; \
792 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
793 { \
794 if( errno != EINTR) \
795 { \
796 YY_FATAL_ERROR( "input in flex scanner failed" ); \
797 break; \
798 } \
799 errno=0; \
800 clearerr(yyin); \
801 } \
802 }\
803\
804
805#endif
806
807/* No semi-colon after return; correct usage is to write "yyterminate();" -
808 * we don't want an extra ';' after the "return" because that will cause
809 * some compilers to complain about unreachable statements.
810 */
811#ifndef yyterminate
812#define yyterminate() return YY_NULL
813#endif
814
815/* Number of entries by which start-condition stack grows. */
816#ifndef YY_START_STACK_INCR
817#define YY_START_STACK_INCR 25
818#endif
819
820/* Report a fatal error. */
821#ifndef YY_FATAL_ERROR
822#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
823#endif
824
825/* end tables serialization structures and prototypes */
826
827/* Default declaration of generated scanner - a define so the user can
828 * easily add parameters.
829 */
830#ifndef YY_DECL
831#define YY_DECL_IS_OURS 1
832
833extern int yylex (void);
834
835#define YY_DECL int yylex (void)
836#endif /* !YY_DECL */
837
838/* Code executed at the beginning of each rule, after yytext and yyleng
839 * have been set up.
840 */
841#ifndef YY_USER_ACTION
842#define YY_USER_ACTION
843#endif
844
845/* Code executed at the end of each rule. */
846#ifndef YY_BREAK
847#define YY_BREAK break;
848#endif
849
850#define YY_RULE_SETUP \
851 if ( yyleng > 0 ) \
852 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
853 (yytext[yyleng - 1] == '\n'); \
854 YY_USER_ACTION
855
856/** The main scanner function which does all the work.
857 */
858YY_DECL
859{
860 register yy_state_type yy_current_state;
861 register char *yy_cp, *yy_bp;
862 register int yy_act;
863
864#line 74 "dtc-lexer.l"
865
866#line 867 "dtc-lexer.lex.c"
867
868 if ( !(yy_init) )
869 {
870 (yy_init) = 1;
871
872#ifdef YY_USER_INIT
873 YY_USER_INIT;
874#endif
875
876 if ( ! (yy_start) )
877 (yy_start) = 1; /* first start state */
878
879 if ( ! yyin )
880 yyin = stdin;
881
882 if ( ! yyout )
883 yyout = stdout;
884
885 if ( ! YY_CURRENT_BUFFER ) {
886 yyensure_buffer_stack ();
887 YY_CURRENT_BUFFER_LVALUE =
888 yy_create_buffer(yyin,YY_BUF_SIZE );
889 }
890
891 yy_load_buffer_state( );
892 }
893
894 while ( 1 ) /* loops until end-of-file is reached */
895 {
896 yy_cp = (yy_c_buf_p);
897
898 /* Support of yytext. */
899 *yy_cp = (yy_hold_char);
900
901 /* yy_bp points to the position in yy_ch_buf of the start of
902 * the current run.
903 */
904 yy_bp = yy_cp;
905
906 yy_current_state = (yy_start);
907 yy_current_state += YY_AT_BOL();
908yy_match:
909 do
910 {
911 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
912 if ( yy_accept[yy_current_state] )
913 {
914 (yy_last_accepting_state) = yy_current_state;
915 (yy_last_accepting_cpos) = yy_cp;
916 }
917 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
918 {
919 yy_current_state = (int) yy_def[yy_current_state];
920 if ( yy_current_state >= 166 )
921 yy_c = yy_meta[(unsigned int) yy_c];
922 }
923 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
924 ++yy_cp;
925 }
926 while ( yy_current_state != 165 );
927 yy_cp = (yy_last_accepting_cpos);
928 yy_current_state = (yy_last_accepting_state);
929
930yy_find_action:
931 yy_act = yy_accept[yy_current_state];
932
933 YY_DO_BEFORE_ACTION;
934
935do_action: /* This label is used only to access EOF actions. */
936
937 switch ( yy_act )
938 { /* beginning of action switch */
939 case 0: /* must back up */
940 /* undo the effects of YY_DO_BEFORE_ACTION */
941 *yy_cp = (yy_hold_char);
942 yy_cp = (yy_last_accepting_cpos);
943 yy_current_state = (yy_last_accepting_state);
944 goto yy_find_action;
945
946case 1:
947/* rule 1 can match eol */
948YY_RULE_SETUP
949#line 75 "dtc-lexer.l"
950{
951 char *name = strchr(yytext, '\"') + 1;
952 yytext[yyleng-1] = '\0';
953 push_input_file(name);
954 }
955 YY_BREAK
956case 2:
957/* rule 2 can match eol */
958YY_RULE_SETUP
959#line 81 "dtc-lexer.l"
960{
961 char *line, *fnstart, *fnend;
962 struct data fn;
963 /* skip text before line # */
964 line = yytext;
965 while (!isdigit((unsigned char)*line))
966 line++;
967
968 /* regexp ensures that first and list "
969 * in the whole yytext are those at
970 * beginning and end of the filename string */
971 fnstart = memchr(yytext, '"', yyleng);
972 for (fnend = yytext + yyleng - 1;
973 *fnend != '"'; fnend--)
974 ;
975 assert(fnstart && fnend && (fnend > fnstart));
976
977 fn = data_copy_escape_string(fnstart + 1,
978 fnend - fnstart - 1);
979
980 /* Don't allow nuls in filenames */
981 if (memchr(fn.val, '\0', fn.len - 1))
982 lexical_error("nul in line number directive");
983
984 /* -1 since #line is the number of the next line */
985 srcpos_set_line(xstrdup(fn.val), atoi(line) - 1);
986 data_free(fn);
987 }
988 YY_BREAK
989case YY_STATE_EOF(INITIAL):
990case YY_STATE_EOF(BYTESTRING):
991case YY_STATE_EOF(PROPNODENAME):
992case YY_STATE_EOF(V1):
993#line 110 "dtc-lexer.l"
994{
995 if (!pop_input_file()) {
996 yyterminate();
997 }
998 }
999 YY_BREAK
1000case 3:
1001/* rule 3 can match eol */
1002YY_RULE_SETUP
1003#line 116 "dtc-lexer.l"
1004{
1005 DPRINT("String: %s\n", yytext);
1006 yylval.data = data_copy_escape_string(yytext+1,
1007 yyleng-2);
1008 return DT_STRING;
1009 }
1010 YY_BREAK
1011case 4:
1012YY_RULE_SETUP
1013#line 123 "dtc-lexer.l"
1014{
1015 DPRINT("Keyword: /dts-v1/\n");
1016 dts_version = 1;
1017 BEGIN_DEFAULT();
1018 return DT_V1;
1019 }
1020 YY_BREAK
1021case 5:
1022YY_RULE_SETUP
1023#line 130 "dtc-lexer.l"
1024{
1025 DPRINT("Keyword: /plugin/\n");
1026 return DT_PLUGIN;
1027 }
1028 YY_BREAK
1029case 6:
1030YY_RULE_SETUP
1031#line 135 "dtc-lexer.l"
1032{
1033 DPRINT("Keyword: /memreserve/\n");
1034 BEGIN_DEFAULT();
1035 return DT_MEMRESERVE;
1036 }
1037 YY_BREAK
1038case 7:
1039YY_RULE_SETUP
1040#line 141 "dtc-lexer.l"
1041{
1042 DPRINT("Keyword: /bits/\n");
1043 BEGIN_DEFAULT();
1044 return DT_BITS;
1045 }
1046 YY_BREAK
1047case 8:
1048YY_RULE_SETUP
1049#line 147 "dtc-lexer.l"
1050{
1051 DPRINT("Keyword: /delete-property/\n");
1052 DPRINT("<PROPNODENAME>\n");
1053 BEGIN(PROPNODENAME);
1054 return DT_DEL_PROP;
1055 }
1056 YY_BREAK
1057case 9:
1058YY_RULE_SETUP
1059#line 154 "dtc-lexer.l"
1060{
1061 DPRINT("Keyword: /delete-node/\n");
1062 DPRINT("<PROPNODENAME>\n");
1063 BEGIN(PROPNODENAME);
1064 return DT_DEL_NODE;
1065 }
1066 YY_BREAK
1067case 10:
1068YY_RULE_SETUP
1069#line 161 "dtc-lexer.l"
1070{
1071 DPRINT("Label: %s\n", yytext);
1072 yylval.labelref = xstrdup(yytext);
1073 yylval.labelref[yyleng-1] = '\0';
1074 return DT_LABEL;
1075 }
1076 YY_BREAK
1077case 11:
1078YY_RULE_SETUP
1079#line 168 "dtc-lexer.l"
1080{
1081 char *e;
1082 DPRINT("Integer Literal: '%s'\n", yytext);
1083
1084 errno = 0;
1085 yylval.integer = strtoull(yytext, &e, 0);
1086
1087 if (*e && e[strspn(e, "UL")]) {
1088 lexical_error("Bad integer literal '%s'",
1089 yytext);
1090 }
1091
1092 if (errno == ERANGE)
1093 lexical_error("Integer literal '%s' out of range",
1094 yytext);
1095 else
1096 /* ERANGE is the only strtoull error triggerable
1097 * by strings matching the pattern */
1098 assert(errno == 0);
1099 return DT_LITERAL;
1100 }
1101 YY_BREAK
1102case 12:
1103/* rule 12 can match eol */
1104YY_RULE_SETUP
1105#line 190 "dtc-lexer.l"
1106{
1107 struct data d;
1108 DPRINT("Character literal: %s\n", yytext);
1109
1110 d = data_copy_escape_string(yytext+1, yyleng-2);
1111 if (d.len == 1) {
1112 lexical_error("Empty character literal");
1113 yylval.integer = 0;
1114 } else {
1115 yylval.integer = (unsigned char)d.val[0];
1116
1117 if (d.len > 2)
1118 lexical_error("Character literal has %d"
1119 " characters instead of 1",
1120 d.len - 1);
1121 }
1122
1123 data_free(d);
1124 return DT_CHAR_LITERAL;
1125 }
1126 YY_BREAK
1127case 13:
1128YY_RULE_SETUP
1129#line 211 "dtc-lexer.l"
1130{ /* label reference */
1131 DPRINT("Ref: %s\n", yytext+1);
1132 yylval.labelref = xstrdup(yytext+1);
1133 return DT_REF;
1134 }
1135 YY_BREAK
1136case 14:
1137YY_RULE_SETUP
1138#line 217 "dtc-lexer.l"
1139{ /* new-style path reference */
1140 yytext[yyleng-1] = '\0';
1141 DPRINT("Ref: %s\n", yytext+2);
1142 yylval.labelref = xstrdup(yytext+2);
1143 return DT_REF;
1144 }
1145 YY_BREAK
1146case 15:
1147YY_RULE_SETUP
1148#line 224 "dtc-lexer.l"
1149{
1150 yylval.byte = strtol(yytext, NULL, 16);
1151 DPRINT("Byte: %02x\n", (int)yylval.byte);
1152 return DT_BYTE;
1153 }
1154 YY_BREAK
1155case 16:
1156YY_RULE_SETUP
1157#line 230 "dtc-lexer.l"
1158{
1159 DPRINT("/BYTESTRING\n");
1160 BEGIN_DEFAULT();
1161 return ']';
1162 }
1163 YY_BREAK
1164case 17:
1165YY_RULE_SETUP
1166#line 236 "dtc-lexer.l"
1167{
1168 DPRINT("PropNodeName: %s\n", yytext);
1169 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
1170 yytext + 1 : yytext);
1171 BEGIN_DEFAULT();
1172 return DT_PROPNODENAME;
1173 }
1174 YY_BREAK
1175case 18:
1176YY_RULE_SETUP
1177#line 244 "dtc-lexer.l"
1178{
1179 DPRINT("Binary Include\n");
1180 return DT_INCBIN;
1181 }
1182 YY_BREAK
1183case 19:
1184/* rule 19 can match eol */
1185YY_RULE_SETUP
1186#line 249 "dtc-lexer.l"
1187/* eat whitespace */
1188 YY_BREAK
1189case 20:
1190/* rule 20 can match eol */
1191YY_RULE_SETUP
1192#line 250 "dtc-lexer.l"
1193/* eat C-style comments */
1194 YY_BREAK
1195case 21:
1196/* rule 21 can match eol */
1197YY_RULE_SETUP
1198#line 251 "dtc-lexer.l"
1199/* eat C++-style comments */
1200 YY_BREAK
1201case 22:
1202YY_RULE_SETUP
1203#line 253 "dtc-lexer.l"
1204{ return DT_LSHIFT; };
1205 YY_BREAK
1206case 23:
1207YY_RULE_SETUP
1208#line 254 "dtc-lexer.l"
1209{ return DT_RSHIFT; };
1210 YY_BREAK
1211case 24:
1212YY_RULE_SETUP
1213#line 255 "dtc-lexer.l"
1214{ return DT_LE; };
1215 YY_BREAK
1216case 25:
1217YY_RULE_SETUP
1218#line 256 "dtc-lexer.l"
1219{ return DT_GE; };
1220 YY_BREAK
1221case 26:
1222YY_RULE_SETUP
1223#line 257 "dtc-lexer.l"
1224{ return DT_EQ; };
1225 YY_BREAK
1226case 27:
1227YY_RULE_SETUP
1228#line 258 "dtc-lexer.l"
1229{ return DT_NE; };
1230 YY_BREAK
1231case 28:
1232YY_RULE_SETUP
1233#line 259 "dtc-lexer.l"
1234{ return DT_AND; };
1235 YY_BREAK
1236case 29:
1237YY_RULE_SETUP
1238#line 260 "dtc-lexer.l"
1239{ return DT_OR; };
1240 YY_BREAK
1241case 30:
1242YY_RULE_SETUP
1243#line 262 "dtc-lexer.l"
1244{
1245 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1246 (unsigned)yytext[0]);
1247 if (yytext[0] == '[') {
1248 DPRINT("<BYTESTRING>\n");
1249 BEGIN(BYTESTRING);
1250 }
1251 if ((yytext[0] == '{')
1252 || (yytext[0] == ';')) {
1253 DPRINT("<PROPNODENAME>\n");
1254 BEGIN(PROPNODENAME);
1255 }
1256 return yytext[0];
1257 }
1258 YY_BREAK
1259case 31:
1260YY_RULE_SETUP
1261#line 277 "dtc-lexer.l"
1262ECHO;
1263 YY_BREAK
1264#line 1265 "dtc-lexer.lex.c"
1265
1266 case YY_END_OF_BUFFER:
1267 {
1268 /* Amount of text matched not including the EOB char. */
1269 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1270
1271 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1272 *yy_cp = (yy_hold_char);
1273 YY_RESTORE_YY_MORE_OFFSET
1274
1275 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1276 {
1277 /* We're scanning a new file or input source. It's
1278 * possible that this happened because the user
1279 * just pointed yyin at a new source and called
1280 * yylex(). If so, then we have to assure
1281 * consistency between YY_CURRENT_BUFFER and our
1282 * globals. Here is the right place to do so, because
1283 * this is the first action (other than possibly a
1284 * back-up) that will match for the new input source.
1285 */
1286 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1287 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1288 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1289 }
1290
1291 /* Note that here we test for yy_c_buf_p "<=" to the position
1292 * of the first EOB in the buffer, since yy_c_buf_p will
1293 * already have been incremented past the NUL character
1294 * (since all states make transitions on EOB to the
1295 * end-of-buffer state). Contrast this with the test
1296 * in input().
1297 */
1298 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1299 { /* This was really a NUL. */
1300 yy_state_type yy_next_state;
1301
1302 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1303
1304 yy_current_state = yy_get_previous_state( );
1305
1306 /* Okay, we're now positioned to make the NUL
1307 * transition. We couldn't have
1308 * yy_get_previous_state() go ahead and do it
1309 * for us because it doesn't know how to deal
1310 * with the possibility of jamming (and we don't
1311 * want to build jamming into it because then it
1312 * will run more slowly).
1313 */
1314
1315 yy_next_state = yy_try_NUL_trans( yy_current_state );
1316
1317 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1318
1319 if ( yy_next_state )
1320 {
1321 /* Consume the NUL. */
1322 yy_cp = ++(yy_c_buf_p);
1323 yy_current_state = yy_next_state;
1324 goto yy_match;
1325 }
1326
1327 else
1328 {
1329 yy_cp = (yy_last_accepting_cpos);
1330 yy_current_state = (yy_last_accepting_state);
1331 goto yy_find_action;
1332 }
1333 }
1334
1335 else switch ( yy_get_next_buffer( ) )
1336 {
1337 case EOB_ACT_END_OF_FILE:
1338 {
1339 (yy_did_buffer_switch_on_eof) = 0;
1340
1341 if ( yywrap( ) )
1342 {
1343 /* Note: because we've taken care in
1344 * yy_get_next_buffer() to have set up
1345 * yytext, we can now set up
1346 * yy_c_buf_p so that if some total
1347 * hoser (like flex itself) wants to
1348 * call the scanner after we return the
1349 * YY_NULL, it'll still work - another
1350 * YY_NULL will get returned.
1351 */
1352 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1353
1354 yy_act = YY_STATE_EOF(YY_START);
1355 goto do_action;
1356 }
1357
1358 else
1359 {
1360 if ( ! (yy_did_buffer_switch_on_eof) )
1361 YY_NEW_FILE;
1362 }
1363 break;
1364 }
1365
1366 case EOB_ACT_CONTINUE_SCAN:
1367 (yy_c_buf_p) =
1368 (yytext_ptr) + yy_amount_of_matched_text;
1369
1370 yy_current_state = yy_get_previous_state( );
1371
1372 yy_cp = (yy_c_buf_p);
1373 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1374 goto yy_match;
1375
1376 case EOB_ACT_LAST_MATCH:
1377 (yy_c_buf_p) =
1378 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1379
1380 yy_current_state = yy_get_previous_state( );
1381
1382 yy_cp = (yy_c_buf_p);
1383 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1384 goto yy_find_action;
1385 }
1386 break;
1387 }
1388
1389 default:
1390 YY_FATAL_ERROR(
1391 "fatal flex scanner internal error--no action found" );
1392 } /* end of action switch */
1393 } /* end of scanning one token */
1394} /* end of yylex */
1395
1396/* yy_get_next_buffer - try to read in a new buffer
1397 *
1398 * Returns a code representing an action:
1399 * EOB_ACT_LAST_MATCH -
1400 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1401 * EOB_ACT_END_OF_FILE - end of file
1402 */
1403static int yy_get_next_buffer (void)
1404{
1405 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1406 register char *source = (yytext_ptr);
1407 register int number_to_move, i;
1408 int ret_val;
1409
1410 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1411 YY_FATAL_ERROR(
1412 "fatal flex scanner internal error--end of buffer missed" );
1413
1414 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1415 { /* Don't try to fill the buffer, so this is an EOF. */
1416 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1417 {
1418 /* We matched a single character, the EOB, so
1419 * treat this as a final EOF.
1420 */
1421 return EOB_ACT_END_OF_FILE;
1422 }
1423
1424 else
1425 {
1426 /* We matched some text prior to the EOB, first
1427 * process it.
1428 */
1429 return EOB_ACT_LAST_MATCH;
1430 }
1431 }
1432
1433 /* Try to read more data. */
1434
1435 /* First move last chars to start of buffer. */
1436 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1437
1438 for ( i = 0; i < number_to_move; ++i )
1439 *(dest++) = *(source++);
1440
1441 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1442 /* don't do the read, it's not guaranteed to return an EOF,
1443 * just force an EOF
1444 */
1445 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1446
1447 else
1448 {
1449 int num_to_read =
1450 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1451
1452 while ( num_to_read <= 0 )
1453 { /* Not enough room in the buffer - grow it. */
1454
1455 /* just a shorter name for the current buffer */
1456 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1457
1458 int yy_c_buf_p_offset =
1459 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1460
1461 if ( b->yy_is_our_buffer )
1462 {
1463 int new_size = b->yy_buf_size * 2;
1464
1465 if ( new_size <= 0 )
1466 b->yy_buf_size += b->yy_buf_size / 8;
1467 else
1468 b->yy_buf_size *= 2;
1469
1470 b->yy_ch_buf = (char *)
1471 /* Include room in for 2 EOB chars. */
1472 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1473 }
1474 else
1475 /* Can't grow it, we don't own it. */
1476 b->yy_ch_buf = 0;
1477
1478 if ( ! b->yy_ch_buf )
1479 YY_FATAL_ERROR(
1480 "fatal error - scanner input buffer overflow" );
1481
1482 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1483
1484 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1485 number_to_move - 1;
1486
1487 }
1488
1489 if ( num_to_read > YY_READ_BUF_SIZE )
1490 num_to_read = YY_READ_BUF_SIZE;
1491
1492 /* Read in more data. */
1493 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1494 (yy_n_chars), (size_t) num_to_read );
1495
1496 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1497 }
1498
1499 if ( (yy_n_chars) == 0 )
1500 {
1501 if ( number_to_move == YY_MORE_ADJ )
1502 {
1503 ret_val = EOB_ACT_END_OF_FILE;
1504 yyrestart(yyin );
1505 }
1506
1507 else
1508 {
1509 ret_val = EOB_ACT_LAST_MATCH;
1510 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1511 YY_BUFFER_EOF_PENDING;
1512 }
1513 }
1514
1515 else
1516 ret_val = EOB_ACT_CONTINUE_SCAN;
1517
1518 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1519 /* Extend the array by 50%, plus the number we really need. */
1520 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1521 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1522 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1523 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1524 }
1525
1526 (yy_n_chars) += number_to_move;
1527 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1528 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1529
1530 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1531
1532 return ret_val;
1533}
1534
1535/* yy_get_previous_state - get the state just before the EOB char was reached */
1536
1537 static yy_state_type yy_get_previous_state (void)
1538{
1539 register yy_state_type yy_current_state;
1540 register char *yy_cp;
1541
1542 yy_current_state = (yy_start);
1543 yy_current_state += YY_AT_BOL();
1544
1545 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1546 {
1547 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1548 if ( yy_accept[yy_current_state] )
1549 {
1550 (yy_last_accepting_state) = yy_current_state;
1551 (yy_last_accepting_cpos) = yy_cp;
1552 }
1553 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1554 {
1555 yy_current_state = (int) yy_def[yy_current_state];
1556 if ( yy_current_state >= 166 )
1557 yy_c = yy_meta[(unsigned int) yy_c];
1558 }
1559 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1560 }
1561
1562 return yy_current_state;
1563}
1564
1565/* yy_try_NUL_trans - try to make a transition on the NUL character
1566 *
1567 * synopsis
1568 * next_state = yy_try_NUL_trans( current_state );
1569 */
1570 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1571{
1572 register int yy_is_jam;
1573 register char *yy_cp = (yy_c_buf_p);
1574
1575 register YY_CHAR yy_c = 1;
1576 if ( yy_accept[yy_current_state] )
1577 {
1578 (yy_last_accepting_state) = yy_current_state;
1579 (yy_last_accepting_cpos) = yy_cp;
1580 }
1581 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1582 {
1583 yy_current_state = (int) yy_def[yy_current_state];
1584 if ( yy_current_state >= 166 )
1585 yy_c = yy_meta[(unsigned int) yy_c];
1586 }
1587 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1588 yy_is_jam = (yy_current_state == 165);
1589
1590 return yy_is_jam ? 0 : yy_current_state;
1591}
1592
1593#ifndef YY_NO_INPUT
1594#ifdef __cplusplus
1595 static int yyinput (void)
1596#else
1597 static int input (void)
1598#endif
1599
1600{
1601 int c;
1602
1603 *(yy_c_buf_p) = (yy_hold_char);
1604
1605 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1606 {
1607 /* yy_c_buf_p now points to the character we want to return.
1608 * If this occurs *before* the EOB characters, then it's a
1609 * valid NUL; if not, then we've hit the end of the buffer.
1610 */
1611 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1612 /* This was really a NUL. */
1613 *(yy_c_buf_p) = '\0';
1614
1615 else
1616 { /* need more input */
1617 int offset = (yy_c_buf_p) - (yytext_ptr);
1618 ++(yy_c_buf_p);
1619
1620 switch ( yy_get_next_buffer( ) )
1621 {
1622 case EOB_ACT_LAST_MATCH:
1623 /* This happens because yy_g_n_b()
1624 * sees that we've accumulated a
1625 * token and flags that we need to
1626 * try matching the token before
1627 * proceeding. But for input(),
1628 * there's no matching to consider.
1629 * So convert the EOB_ACT_LAST_MATCH
1630 * to EOB_ACT_END_OF_FILE.
1631 */
1632
1633 /* Reset buffer status. */
1634 yyrestart(yyin );
1635
1636 /*FALLTHROUGH*/
1637
1638 case EOB_ACT_END_OF_FILE:
1639 {
1640 if ( yywrap( ) )
1641 return EOF;
1642
1643 if ( ! (yy_did_buffer_switch_on_eof) )
1644 YY_NEW_FILE;
1645#ifdef __cplusplus
1646 return yyinput();
1647#else
1648 return input();
1649#endif
1650 }
1651
1652 case EOB_ACT_CONTINUE_SCAN:
1653 (yy_c_buf_p) = (yytext_ptr) + offset;
1654 break;
1655 }
1656 }
1657 }
1658
1659 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1660 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1661 (yy_hold_char) = *++(yy_c_buf_p);
1662
1663 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1664
1665 return c;
1666}
1667#endif /* ifndef YY_NO_INPUT */
1668
1669/** Immediately switch to a different input stream.
1670 * @param input_file A readable stream.
1671 *
1672 * @note This function does not reset the start condition to @c INITIAL .
1673 */
1674 void yyrestart (FILE * input_file )
1675{
1676
1677 if ( ! YY_CURRENT_BUFFER ){
1678 yyensure_buffer_stack ();
1679 YY_CURRENT_BUFFER_LVALUE =
1680 yy_create_buffer(yyin,YY_BUF_SIZE );
1681 }
1682
1683 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1684 yy_load_buffer_state( );
1685}
1686
1687/** Switch to a different input buffer.
1688 * @param new_buffer The new input buffer.
1689 *
1690 */
1691 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1692{
1693
1694 /* TODO. We should be able to replace this entire function body
1695 * with
1696 * yypop_buffer_state();
1697 * yypush_buffer_state(new_buffer);
1698 */
1699 yyensure_buffer_stack ();
1700 if ( YY_CURRENT_BUFFER == new_buffer )
1701 return;
1702
1703 if ( YY_CURRENT_BUFFER )
1704 {
1705 /* Flush out information for old buffer. */
1706 *(yy_c_buf_p) = (yy_hold_char);
1707 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1708 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1709 }
1710
1711 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1712 yy_load_buffer_state( );
1713
1714 /* We don't actually know whether we did this switch during
1715 * EOF (yywrap()) processing, but the only time this flag
1716 * is looked at is after yywrap() is called, so it's safe
1717 * to go ahead and always set it.
1718 */
1719 (yy_did_buffer_switch_on_eof) = 1;
1720}
1721
1722static void yy_load_buffer_state (void)
1723{
1724 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1725 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1726 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1727 (yy_hold_char) = *(yy_c_buf_p);
1728}
1729
1730/** Allocate and initialize an input buffer state.
1731 * @param file A readable stream.
1732 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1733 *
1734 * @return the allocated buffer state.
1735 */
1736 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1737{
1738 YY_BUFFER_STATE b;
1739
1740 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1741 if ( ! b )
1742 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1743
1744 b->yy_buf_size = size;
1745
1746 /* yy_ch_buf has to be 2 characters longer than the size given because
1747 * we need to put in 2 end-of-buffer characters.
1748 */
1749 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1750 if ( ! b->yy_ch_buf )
1751 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1752
1753 b->yy_is_our_buffer = 1;
1754
1755 yy_init_buffer(b,file );
1756
1757 return b;
1758}
1759
1760/** Destroy the buffer.
1761 * @param b a buffer created with yy_create_buffer()
1762 *
1763 */
1764 void yy_delete_buffer (YY_BUFFER_STATE b )
1765{
1766
1767 if ( ! b )
1768 return;
1769
1770 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1771 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1772
1773 if ( b->yy_is_our_buffer )
1774 yyfree((void *) b->yy_ch_buf );
1775
1776 yyfree((void *) b );
1777}
1778
1779/* Initializes or reinitializes a buffer.
1780 * This function is sometimes called more than once on the same buffer,
1781 * such as during a yyrestart() or at EOF.
1782 */
1783 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1784
1785{
1786 int oerrno = errno;
1787
1788 yy_flush_buffer(b );
1789
1790 b->yy_input_file = file;
1791 b->yy_fill_buffer = 1;
1792
1793 /* If b is the current buffer, then yy_init_buffer was _probably_
1794 * called from yyrestart() or through yy_get_next_buffer.
1795 * In that case, we don't want to reset the lineno or column.
1796 */
1797 if (b != YY_CURRENT_BUFFER){
1798 b->yy_bs_lineno = 1;
1799 b->yy_bs_column = 0;
1800 }
1801
1802 b->yy_is_interactive = 0;
1803
1804 errno = oerrno;
1805}
1806
1807/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1808 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1809 *
1810 */
1811 void yy_flush_buffer (YY_BUFFER_STATE b )
1812{
1813 if ( ! b )
1814 return;
1815
1816 b->yy_n_chars = 0;
1817
1818 /* We always need two end-of-buffer characters. The first causes
1819 * a transition to the end-of-buffer state. The second causes
1820 * a jam in that state.
1821 */
1822 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1823 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1824
1825 b->yy_buf_pos = &b->yy_ch_buf[0];
1826
1827 b->yy_at_bol = 1;
1828 b->yy_buffer_status = YY_BUFFER_NEW;
1829
1830 if ( b == YY_CURRENT_BUFFER )
1831 yy_load_buffer_state( );
1832}
1833
1834/** Pushes the new state onto the stack. The new state becomes
1835 * the current state. This function will allocate the stack
1836 * if necessary.
1837 * @param new_buffer The new state.
1838 *
1839 */
1840void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1841{
1842 if (new_buffer == NULL)
1843 return;
1844
1845 yyensure_buffer_stack();
1846
1847 /* This block is copied from yy_switch_to_buffer. */
1848 if ( YY_CURRENT_BUFFER )
1849 {
1850 /* Flush out information for old buffer. */
1851 *(yy_c_buf_p) = (yy_hold_char);
1852 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1853 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1854 }
1855
1856 /* Only push if top exists. Otherwise, replace top. */
1857 if (YY_CURRENT_BUFFER)
1858 (yy_buffer_stack_top)++;
1859 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1860
1861 /* copied from yy_switch_to_buffer. */
1862 yy_load_buffer_state( );
1863 (yy_did_buffer_switch_on_eof) = 1;
1864}
1865
1866/** Removes and deletes the top of the stack, if present.
1867 * The next element becomes the new top.
1868 *
1869 */
1870void yypop_buffer_state (void)
1871{
1872 if (!YY_CURRENT_BUFFER)
1873 return;
1874
1875 yy_delete_buffer(YY_CURRENT_BUFFER );
1876 YY_CURRENT_BUFFER_LVALUE = NULL;
1877 if ((yy_buffer_stack_top) > 0)
1878 --(yy_buffer_stack_top);
1879
1880 if (YY_CURRENT_BUFFER) {
1881 yy_load_buffer_state( );
1882 (yy_did_buffer_switch_on_eof) = 1;
1883 }
1884}
1885
1886/* Allocates the stack if it does not exist.
1887 * Guarantees space for at least one push.
1888 */
1889static void yyensure_buffer_stack (void)
1890{
1891 int num_to_alloc;
1892
1893 if (!(yy_buffer_stack)) {
1894
1895 /* First allocation is just for 2 elements, since we don't know if this
1896 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1897 * immediate realloc on the next call.
1898 */
1899 num_to_alloc = 1;
1900 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1901 (num_to_alloc * sizeof(struct yy_buffer_state*)
1902 );
1903 if ( ! (yy_buffer_stack) )
1904 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1905
1906 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1907
1908 (yy_buffer_stack_max) = num_to_alloc;
1909 (yy_buffer_stack_top) = 0;
1910 return;
1911 }
1912
1913 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1914
1915 /* Increase the buffer to prepare for a possible push. */
1916 int grow_size = 8 /* arbitrary grow size */;
1917
1918 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1919 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1920 ((yy_buffer_stack),
1921 num_to_alloc * sizeof(struct yy_buffer_state*)
1922 );
1923 if ( ! (yy_buffer_stack) )
1924 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1925
1926 /* zero only the new slots.*/
1927 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1928 (yy_buffer_stack_max) = num_to_alloc;
1929 }
1930}
1931
1932/** Setup the input buffer state to scan directly from a user-specified character buffer.
1933 * @param base the character buffer
1934 * @param size the size in bytes of the character buffer
1935 *
1936 * @return the newly allocated buffer state object.
1937 */
1938YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1939{
1940 YY_BUFFER_STATE b;
1941
1942 if ( size < 2 ||
1943 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1944 base[size-1] != YY_END_OF_BUFFER_CHAR )
1945 /* They forgot to leave room for the EOB's. */
1946 return 0;
1947
1948 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1949 if ( ! b )
1950 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1951
1952 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1953 b->yy_buf_pos = b->yy_ch_buf = base;
1954 b->yy_is_our_buffer = 0;
1955 b->yy_input_file = 0;
1956 b->yy_n_chars = b->yy_buf_size;
1957 b->yy_is_interactive = 0;
1958 b->yy_at_bol = 1;
1959 b->yy_fill_buffer = 0;
1960 b->yy_buffer_status = YY_BUFFER_NEW;
1961
1962 yy_switch_to_buffer(b );
1963
1964 return b;
1965}
1966
1967/** Setup the input buffer state to scan a string. The next call to yylex() will
1968 * scan from a @e copy of @a str.
1969 * @param yystr a NUL-terminated string to scan
1970 *
1971 * @return the newly allocated buffer state object.
1972 * @note If you want to scan bytes that may contain NUL values, then use
1973 * yy_scan_bytes() instead.
1974 */
1975YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1976{
1977
1978 return yy_scan_bytes(yystr,strlen(yystr) );
1979}
1980
1981/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1982 * scan from a @e copy of @a bytes.
1983 * @param yybytes the byte buffer to scan
1984 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1985 *
1986 * @return the newly allocated buffer state object.
1987 */
1988YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1989{
1990 YY_BUFFER_STATE b;
1991 char *buf;
1992 yy_size_t n;
1993 int i;
1994
1995 /* Get memory for full buffer, including space for trailing EOB's. */
1996 n = _yybytes_len + 2;
1997 buf = (char *) yyalloc(n );
1998 if ( ! buf )
1999 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2000
2001 for ( i = 0; i < _yybytes_len; ++i )
2002 buf[i] = yybytes[i];
2003
2004 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2005
2006 b = yy_scan_buffer(buf,n );
2007 if ( ! b )
2008 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2009
2010 /* It's okay to grow etc. this buffer, and we should throw it
2011 * away when we're done.
2012 */
2013 b->yy_is_our_buffer = 1;
2014
2015 return b;
2016}
2017
2018#ifndef YY_EXIT_FAILURE
2019#define YY_EXIT_FAILURE 2
2020#endif
2021
2022static void yy_fatal_error (yyconst char* msg )
2023{
2024 (void) fprintf( stderr, "%s\n", msg );
2025 exit( YY_EXIT_FAILURE );
2026}
2027
2028/* Redefine yyless() so it works in section 3 code. */
2029
2030#undef yyless
2031#define yyless(n) \
2032 do \
2033 { \
2034 /* Undo effects of setting up yytext. */ \
2035 int yyless_macro_arg = (n); \
2036 YY_LESS_LINENO(yyless_macro_arg);\
2037 yytext[yyleng] = (yy_hold_char); \
2038 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2039 (yy_hold_char) = *(yy_c_buf_p); \
2040 *(yy_c_buf_p) = '\0'; \
2041 yyleng = yyless_macro_arg; \
2042 } \
2043 while ( 0 )
2044
2045/* Accessor methods (get/set functions) to struct members. */
2046
2047/** Get the current line number.
2048 *
2049 */
2050int yyget_lineno (void)
2051{
2052
2053 return yylineno;
2054}
2055
2056/** Get the input stream.
2057 *
2058 */
2059FILE *yyget_in (void)
2060{
2061 return yyin;
2062}
2063
2064/** Get the output stream.
2065 *
2066 */
2067FILE *yyget_out (void)
2068{
2069 return yyout;
2070}
2071
2072/** Get the length of the current token.
2073 *
2074 */
2075int yyget_leng (void)
2076{
2077 return yyleng;
2078}
2079
2080/** Get the current token.
2081 *
2082 */
2083
2084char *yyget_text (void)
2085{
2086 return yytext;
2087}
2088
2089/** Set the current line number.
2090 * @param line_number
2091 *
2092 */
2093void yyset_lineno (int line_number )
2094{
2095
2096 yylineno = line_number;
2097}
2098
2099/** Set the input stream. This does not discard the current
2100 * input buffer.
2101 * @param in_str A readable stream.
2102 *
2103 * @see yy_switch_to_buffer
2104 */
2105void yyset_in (FILE * in_str )
2106{
2107 yyin = in_str ;
2108}
2109
2110void yyset_out (FILE * out_str )
2111{
2112 yyout = out_str ;
2113}
2114
2115int yyget_debug (void)
2116{
2117 return yy_flex_debug;
2118}
2119
2120void yyset_debug (int bdebug )
2121{
2122 yy_flex_debug = bdebug ;
2123}
2124
2125static int yy_init_globals (void)
2126{
2127 /* Initialization is the same as for the non-reentrant scanner.
2128 * This function is called from yylex_destroy(), so don't allocate here.
2129 */
2130
2131 (yy_buffer_stack) = 0;
2132 (yy_buffer_stack_top) = 0;
2133 (yy_buffer_stack_max) = 0;
2134 (yy_c_buf_p) = (char *) 0;
2135 (yy_init) = 0;
2136 (yy_start) = 0;
2137
2138/* Defined in main.c */
2139#ifdef YY_STDINIT
2140 yyin = stdin;
2141 yyout = stdout;
2142#else
2143 yyin = (FILE *) 0;
2144 yyout = (FILE *) 0;
2145#endif
2146
2147 /* For future reference: Set errno on error, since we are called by
2148 * yylex_init()
2149 */
2150 return 0;
2151}
2152
2153/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2154int yylex_destroy (void)
2155{
2156
2157 /* Pop the buffer stack, destroying each element. */
2158 while(YY_CURRENT_BUFFER){
2159 yy_delete_buffer(YY_CURRENT_BUFFER );
2160 YY_CURRENT_BUFFER_LVALUE = NULL;
2161 yypop_buffer_state();
2162 }
2163
2164 /* Destroy the stack itself. */
2165 yyfree((yy_buffer_stack) );
2166 (yy_buffer_stack) = NULL;
2167
2168 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2169 * yylex() is called, initialization will occur. */
2170 yy_init_globals( );
2171
2172 return 0;
2173}
2174
2175/*
2176 * Internal utility routines.
2177 */
2178
2179#ifndef yytext_ptr
2180static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2181{
2182 register int i;
2183 for ( i = 0; i < n; ++i )
2184 s1[i] = s2[i];
2185}
2186#endif
2187
2188#ifdef YY_NEED_STRLEN
2189static int yy_flex_strlen (yyconst char * s )
2190{
2191 register int n;
2192 for ( n = 0; s[n]; ++n )
2193 ;
2194
2195 return n;
2196}
2197#endif
2198
2199void *yyalloc (yy_size_t size )
2200{
2201 return (void *) malloc( size );
2202}
2203
2204void *yyrealloc (void * ptr, yy_size_t size )
2205{
2206 /* The cast to (char *) in the following accommodates both
2207 * implementations that use char* generic pointers, and those
2208 * that use void* generic pointers. It works with the latter
2209 * because both ANSI C and C++ allow castless assignment from
2210 * any pointer type to void*, and deal with argument conversions
2211 * as though doing an assignment.
2212 */
2213 return (void *) realloc( (char *) ptr, size );
2214}
2215
2216void yyfree (void * ptr )
2217{
2218 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2219}
2220
2221#define YYTABLES_NAME "yytables"
2222
2223#line 277 "dtc-lexer.l"
2224
2225
2226
2227static void push_input_file(const char *filename)
2228{
2229 assert(filename);
2230
2231 srcfile_push(filename);
2232
2233 yyin = current_srcfile->f;
2234
2235 yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
2236}
2237
2238
2239static bool pop_input_file(void)
2240{
2241 if (srcfile_pop() == 0)
2242 return false;
2243
2244 yypop_buffer_state();
2245 yyin = current_srcfile->f;
2246
2247 return true;
2248}
2249
2250static void lexical_error(const char *fmt, ...)
2251{
2252 va_list ap;
2253
2254 va_start(ap, fmt);
2255 srcpos_verror(&yylloc, "Lexical error", fmt, ap);
2256 va_end(ap);
2257
2258 treesource_error = true;
2259}
2260