xfs [stable only]: restart busy extent search after node removal
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / scripts / dtc / dtc-lexer.lex.c_shipped
blob50c4420b4b2c9c6894d66bc7df30b0203637ec4f
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 */
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
17 /* First, we deal with  platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
25 /* end standard C headers. */
27 /* flex integer type definitions */
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
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. 
38  */
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
41 #endif
43 #include <inttypes.h>
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;
50 #else
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. */
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
87 #endif /* ! C99 */
89 #endif /* ! FLEXINT_H */
91 #ifdef __cplusplus
93 /* The "const" storage-class-modifier is valid. */
94 #define YY_USE_CONST
96 #else   /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
101 #define YY_USE_CONST
103 #endif  /* defined (__STDC__) */
104 #endif  /* ! __cplusplus */
106 #ifdef YY_USE_CONST
107 #define yyconst const
108 #else
109 #define yyconst
110 #endif
112 /* Returned upon end-of-file. */
113 #define YY_NULL 0
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)
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 *
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
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. */
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
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))
160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
161 #define YY_TYPEDEF_YY_BUFFER_STATE
162 typedef struct yy_buffer_state *YY_BUFFER_STATE;
163 #endif
165 extern int yyleng;
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)
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 )
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;
194 #endif
196 #ifndef YY_STRUCT_YY_BUFFER_STATE
197 #define YY_STRUCT_YY_BUFFER_STATE
198 struct yy_buffer_state
199         {
200         FILE *yy_input_file;
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
206          * characters.
207          */
208         yy_size_t yy_buf_size;
210         /* Number of characters read into yy_ch_buf, not including EOB
211          * characters.
212          */
213         int yy_n_chars;
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;
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;
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;
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;
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.
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
258         };
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
268  * "scanner state".
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)
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)]
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 */
284 int yyleng;
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 ...
293  */
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) \
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         }
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         }
340 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
342 /* Begin user sect3 */
344 #define yywrap(n) 1
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;
353 extern int yylineno;
355 int yylineno = 1;
357 extern char *yytext;
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.
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;
375 #define YY_NUM_RULES 17
376 #define YY_END_OF_BUFFER 18
377 /* This struct is not used in this scanner,
378    but its presence is necessary. */
379 struct yy_trans_info
380         {
381         flex_int32_t yy_verify;
382         flex_int32_t yy_nxt;
383         };
384 static yyconst flex_int16_t yy_accept[94] =
385     {   0,
386         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
387        18,   16,   13,   13,   16,   16,   16,   16,   16,   16,
388        16,   10,   11,   11,    6,    6,   13,    0,    2,    0,
389         7,    0,    0,    0,    0,    0,    0,    0,    5,    0,
390         9,    9,   11,   11,    6,    0,    7,    0,    0,    0,
391         0,   15,    0,    0,    0,    0,    6,    0,   14,    0,
392         0,    0,    0,    0,    8,    0,    0,    0,    0,    0,
393         0,    0,    0,    0,    0,    0,    0,    0,    3,   12,
394         0,    0,    0,    0,    0,    0,    0,    0,    1,    0,
395         0,    4,    0
397     } ;
399 static yyconst flex_int32_t yy_ec[256] =
400     {   0,
401         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
402         2,    2,    2,    1,    1,    1,    1,    1,    1,    1,
403         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
404         1,    2,    1,    4,    5,    1,    1,    6,    1,    1,
405         1,    7,    5,    5,    8,    5,    9,   10,   11,   12,
406        12,   12,   12,   12,   12,   12,   12,   13,    1,    1,
407         1,    1,    5,    5,   14,   14,   14,   14,   14,   14,
408        15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
409        15,   15,   15,   15,   15,   15,   15,   16,   15,   15,
410         1,   17,   18,    1,   15,    1,   14,   19,   20,   21,
412        22,   14,   15,   15,   23,   15,   15,   24,   25,   26,
413        15,   15,   15,   27,   28,   29,   30,   31,   15,   16,
414        15,   15,   32,    1,   33,    1,    1,    1,    1,    1,
415         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
416         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
417         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
418         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
419         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
420         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
421         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
429     } ;
431 static yyconst flex_int32_t yy_meta[34] =
432     {   0,
433         1,    1,    1,    1,    2,    1,    2,    2,    3,    4,
434         4,    4,    5,    6,    7,    7,    1,    1,    6,    6,
435         6,    6,    7,    7,    7,    7,    7,    7,    7,    7,
436         7,    8,    1
437     } ;
439 static yyconst flex_int16_t yy_base[106] =
440     {   0,
441         0,    0,  237,  236,   25,    0,   47,    0,   30,   71,
442       244,  247,   82,   84,   84,  211,   95,  229,  218,    0,
443       111,  247,    0,   84,   83,   95,  106,   86,  247,  237,
444         0,  230,  231,  234,  207,  209,  212,  220,  247,  206,
445       247,  218,    0,  106,  116,    0,    0,    0,  223,   89,
446       226,  219,  199,  206,  200,  204,    0,  190,  213,  212,
447       202,   91,  178,  161,  247,  172,  144,  150,  140,  130,
448       140,  124,  128,  120,  138,  137,  123,  122,  247,  247,
449       134,  114,  132,   86,  135,  125,   90,  136,  247,   97,
450        29,  247,  247,  153,  156,  161,  165,  170,  176,  180,
452       187,  195,  200,  205,  212
453     } ;
455 static yyconst flex_int16_t yy_def[106] =
456     {   0,
457        93,    1,    1,    1,    1,    5,   93,    7,    1,    1,
458        93,   93,   93,   93,   94,   95,   93,   96,   17,   97,
459        96,   93,   98,   99,   93,   93,   93,   94,   93,   94,
460       100,   93,  101,  102,   93,   93,   93,   96,   93,   93,
461        93,   96,   98,   99,   93,  103,  100,  104,  101,  101,
462       102,   93,   93,   93,   93,   93,  103,  104,   93,   93,
463        93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
464        93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
465        93,   93,   93,   93,   93,  105,   93,  105,   93,  105,
466        93,   93,    0,   93,   93,   93,   93,   93,   93,   93,
468        93,   93,   93,   93,   93
469     } ;
471 static yyconst flex_int16_t yy_nxt[281] =
472     {   0,
473        12,   13,   14,   15,   12,   16,   12,   12,   17,   12,
474        12,   12,   12,   18,   18,   18,   12,   12,   18,   18,
475        18,   18,   18,   18,   18,   18,   18,   18,   18,   18,
476        18,   12,   12,   19,   20,   20,   20,   92,   21,   25,
477        26,   26,   22,   21,   21,   21,   21,   12,   13,   14,
478        15,   23,   16,   23,   23,   19,   23,   23,   23,   12,
479        24,   24,   24,   12,   12,   24,   24,   24,   24,   24,
480        24,   24,   24,   24,   24,   24,   24,   24,   12,   12,
481        25,   26,   26,   27,   27,   27,   27,   29,   43,   29,
482        43,   43,   45,   45,   45,   50,   39,   59,   46,   93,
484        30,   33,   30,   34,   45,   45,   45,   27,   27,   68,
485        43,   91,   43,   43,   69,   35,   87,   36,   39,   37,
486        42,   42,   42,   39,   42,   45,   45,   45,   89,   42,
487        42,   42,   42,   85,   85,   86,   85,   85,   86,   89,
488        84,   90,   83,   82,   81,   80,   79,   78,   77,   76,
489        75,   74,   90,   28,   28,   28,   28,   28,   28,   28,
490        28,   31,   31,   31,   38,   38,   38,   38,   41,   73,
491        41,   43,   72,   43,   71,   43,   43,   44,   33,   44,
492        44,   44,   44,   47,   69,   47,   47,   49,   49,   49,
493        49,   49,   49,   49,   49,   51,   51,   51,   51,   51,
495        51,   51,   51,   57,   70,   57,   58,   58,   58,   67,
496        58,   58,   88,   88,   88,   88,   88,   88,   88,   88,
497        34,   66,   65,   64,   63,   62,   61,   60,   52,   50,
498        39,   56,   39,   55,   54,   53,   52,   50,   48,   93,
499        40,   39,   32,   93,   19,   19,   11,   93,   93,   93,
500        93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
501        93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
502        93,   93,   93,   93,   93,   93,   93,   93,   93,   93
503     } ;
505 static yyconst flex_int16_t yy_chk[281] =
506     {   0,
507         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
508         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
509         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
510         1,    1,    1,    5,    5,    5,    5,   91,    5,    9,
511         9,    9,    5,    5,    5,    5,    5,    7,    7,    7,
512         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
513         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
514         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
515        10,   10,   10,   13,   13,   14,   14,   15,   24,   28,
516        24,   24,   25,   25,   25,   50,   24,   50,   25,   90,
518        15,   17,   28,   17,   26,   26,   26,   27,   27,   62,
519        44,   87,   44,   44,   62,   17,   84,   17,   44,   17,
520        21,   21,   21,   21,   21,   45,   45,   45,   86,   21,
521        21,   21,   21,   83,   83,   83,   85,   85,   85,   88,
522        82,   86,   81,   78,   77,   76,   75,   74,   73,   72,
523        71,   70,   88,   94,   94,   94,   94,   94,   94,   94,
524        94,   95,   95,   95,   96,   96,   96,   96,   97,   69,
525        97,   98,   68,   98,   67,   98,   98,   99,   66,   99,
526        99,   99,   99,  100,   64,  100,  100,  101,  101,  101,
527       101,  101,  101,  101,  101,  102,  102,  102,  102,  102,
529       102,  102,  102,  103,   63,  103,  104,  104,  104,   61,
530       104,  104,  105,  105,  105,  105,  105,  105,  105,  105,
531        60,   59,   58,   56,   55,   54,   53,   52,   51,   49,
532        42,   40,   38,   37,   36,   35,   34,   33,   32,   30,
533        19,   18,   16,   11,    4,    3,   93,   93,   93,   93,
534        93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
535        93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
536        93,   93,   93,   93,   93,   93,   93,   93,   93,   93
537     } ;
539 static yy_state_type yy_last_accepting_state;
540 static char *yy_last_accepting_cpos;
542 extern int yy_flex_debug;
543 int yy_flex_debug = 0;
545 /* The intent behind this definition is that it'll catch
546  * any uses of REJECT which flex missed.
547  */
548 #define REJECT reject_used_but_not_detected
549 #define yymore() yymore_used_but_not_detected
550 #define YY_MORE_ADJ 0
551 #define YY_RESTORE_YY_MORE_OFFSET
552 char *yytext;
553 #line 1 "dtc-lexer.l"
555  * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation.  2005.
558  * This program is free software; you can redistribute it and/or
559  * modify it under the terms of the GNU General Public License as
560  * published by the Free Software Foundation; either version 2 of the
561  * License, or (at your option) any later version.
563  *  This program is distributed in the hope that it will be useful,
564  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
565  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
566  *  General Public License for more details.
568  *  You should have received a copy of the GNU General Public License
569  *  along with this program; if not, write to the Free Software
570  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
571  *                                                                   USA
572  */
573 #define YY_NO_INPUT 1
578 #line 37 "dtc-lexer.l"
579 #include "dtc.h"
580 #include "srcpos.h"
581 #include "dtc-parser.tab.h"
583 YYLTYPE yylloc;
585 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
586 #define YY_USER_ACTION \
587         { \
588                 srcpos_update(&yylloc, yytext, yyleng); \
589         }
591 /*#define LEXDEBUG      1*/
593 #ifdef LEXDEBUG
594 #define DPRINT(fmt, ...)        fprintf(stderr, fmt, ##__VA_ARGS__)
595 #else
596 #define DPRINT(fmt, ...)        do { } while (0)
597 #endif
599 static int dts_version = 1;
601 #define BEGIN_DEFAULT()         DPRINT("<V1>\n"); \
602                                 BEGIN(V1); \
604 static void push_input_file(const char *filename);
605 static int pop_input_file(void);
606 #line 607 "dtc-lexer.lex.c"
608 #define INITIAL 0
609 #define INCLUDE 1
610 #define BYTESTRING 2
611 #define PROPNODENAME 3
612 #define V1 4
614 #ifndef YY_NO_UNISTD_H
615 /* Special case for "unistd.h", since it is non-ANSI. We include it way
616  * down here because we want the user's section 1 to have been scanned first.
617  * The user has a chance to override it with an option.
618  */
619 #include <unistd.h>
620 #endif
622 #ifndef YY_EXTRA_TYPE
623 #define YY_EXTRA_TYPE void *
624 #endif
626 static int yy_init_globals (void );
628 /* Accessor methods to globals.
629    These are made visible to non-reentrant scanners for convenience. */
631 int yylex_destroy (void );
633 int yyget_debug (void );
635 void yyset_debug (int debug_flag  );
637 YY_EXTRA_TYPE yyget_extra (void );
639 void yyset_extra (YY_EXTRA_TYPE user_defined  );
641 FILE *yyget_in (void );
643 void yyset_in  (FILE * in_str  );
645 FILE *yyget_out (void );
647 void yyset_out  (FILE * out_str  );
649 int yyget_leng (void );
651 char *yyget_text (void );
653 int yyget_lineno (void );
655 void yyset_lineno (int line_number  );
657 /* Macros after this point can all be overridden by user definitions in
658  * section 1.
659  */
661 #ifndef YY_SKIP_YYWRAP
662 #ifdef __cplusplus
663 extern "C" int yywrap (void );
664 #else
665 extern int yywrap (void );
666 #endif
667 #endif
669 #ifndef yytext_ptr
670 static void yy_flex_strncpy (char *,yyconst char *,int );
671 #endif
673 #ifdef YY_NEED_STRLEN
674 static int yy_flex_strlen (yyconst char * );
675 #endif
677 #ifndef YY_NO_INPUT
679 #ifdef __cplusplus
680 static int yyinput (void );
681 #else
682 static int input (void );
683 #endif
685 #endif
687 /* Amount of stuff to slurp up with each read. */
688 #ifndef YY_READ_BUF_SIZE
689 #ifdef __ia64__
690 /* On IA-64, the buffer size is 16k, not 8k */
691 #define YY_READ_BUF_SIZE 16384
692 #else
693 #define YY_READ_BUF_SIZE 8192
694 #endif /* __ia64__ */
695 #endif
697 /* Copy whatever the last rule matched to the standard output. */
698 #ifndef ECHO
699 /* This used to be an fputs(), but since the string might contain NUL's,
700  * we now use fwrite().
701  */
702 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
703 #endif
705 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
706  * is returned in "result".
707  */
708 #ifndef YY_INPUT
709 #define YY_INPUT(buf,result,max_size) \
710         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
711                 { \
712                 int c = '*'; \
713                 size_t n; \
714                 for ( n = 0; n < max_size && \
715                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
716                         buf[n] = (char) c; \
717                 if ( c == '\n' ) \
718                         buf[n++] = (char) c; \
719                 if ( c == EOF && ferror( yyin ) ) \
720                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
721                 result = n; \
722                 } \
723         else \
724                 { \
725                 errno=0; \
726                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
727                         { \
728                         if( errno != EINTR) \
729                                 { \
730                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
731                                 break; \
732                                 } \
733                         errno=0; \
734                         clearerr(yyin); \
735                         } \
736                 }\
739 #endif
741 /* No semi-colon after return; correct usage is to write "yyterminate();" -
742  * we don't want an extra ';' after the "return" because that will cause
743  * some compilers to complain about unreachable statements.
744  */
745 #ifndef yyterminate
746 #define yyterminate() return YY_NULL
747 #endif
749 /* Number of entries by which start-condition stack grows. */
750 #ifndef YY_START_STACK_INCR
751 #define YY_START_STACK_INCR 25
752 #endif
754 /* Report a fatal error. */
755 #ifndef YY_FATAL_ERROR
756 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
757 #endif
759 /* end tables serialization structures and prototypes */
761 /* Default declaration of generated scanner - a define so the user can
762  * easily add parameters.
763  */
764 #ifndef YY_DECL
765 #define YY_DECL_IS_OURS 1
767 extern int yylex (void);
769 #define YY_DECL int yylex (void)
770 #endif /* !YY_DECL */
772 /* Code executed at the beginning of each rule, after yytext and yyleng
773  * have been set up.
774  */
775 #ifndef YY_USER_ACTION
776 #define YY_USER_ACTION
777 #endif
779 /* Code executed at the end of each rule. */
780 #ifndef YY_BREAK
781 #define YY_BREAK break;
782 #endif
784 #define YY_RULE_SETUP \
785         YY_USER_ACTION
787 /** The main scanner function which does all the work.
788  */
789 YY_DECL
791         register yy_state_type yy_current_state;
792         register char *yy_cp, *yy_bp;
793         register int yy_act;
794     
795 #line 66 "dtc-lexer.l"
797 #line 798 "dtc-lexer.lex.c"
799         if ( !(yy_init) )
800                 {
801                 (yy_init) = 1;
803 #ifdef YY_USER_INIT
804                 YY_USER_INIT;
805 #endif
807                 if ( ! (yy_start) )
808                         (yy_start) = 1; /* first start state */
810                 if ( ! yyin )
811                         yyin = stdin;
813                 if ( ! yyout )
814                         yyout = stdout;
816                 if ( ! YY_CURRENT_BUFFER ) {
817                         yyensure_buffer_stack ();
818                         YY_CURRENT_BUFFER_LVALUE =
819                                 yy_create_buffer(yyin,YY_BUF_SIZE );
820                 }
822                 yy_load_buffer_state( );
823                 }
825         while ( 1 )             /* loops until end-of-file is reached */
826                 {
827                 yy_cp = (yy_c_buf_p);
829                 /* Support of yytext. */
830                 *yy_cp = (yy_hold_char);
832                 /* yy_bp points to the position in yy_ch_buf of the start of
833                  * the current run.
834                  */
835                 yy_bp = yy_cp;
837                 yy_current_state = (yy_start);
838 yy_match:
839                 do
840                         {
841                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
842                         if ( yy_accept[yy_current_state] )
843                                 {
844                                 (yy_last_accepting_state) = yy_current_state;
845                                 (yy_last_accepting_cpos) = yy_cp;
846                                 }
847                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
848                                 {
849                                 yy_current_state = (int) yy_def[yy_current_state];
850                                 if ( yy_current_state >= 94 )
851                                         yy_c = yy_meta[(unsigned int) yy_c];
852                                 }
853                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
854                         ++yy_cp;
855                         }
856                 while ( yy_current_state != 93 );
857                 yy_cp = (yy_last_accepting_cpos);
858                 yy_current_state = (yy_last_accepting_state);
860 yy_find_action:
861                 yy_act = yy_accept[yy_current_state];
863                 YY_DO_BEFORE_ACTION;
865 do_action:      /* This label is used only to access EOF actions. */
867                 switch ( yy_act )
868         { /* beginning of action switch */
869                         case 0: /* must back up */
870                         /* undo the effects of YY_DO_BEFORE_ACTION */
871                         *yy_cp = (yy_hold_char);
872                         yy_cp = (yy_last_accepting_cpos);
873                         yy_current_state = (yy_last_accepting_state);
874                         goto yy_find_action;
876 case 1:
877 /* rule 1 can match eol */
878 YY_RULE_SETUP
879 #line 67 "dtc-lexer.l"
881                         char *name = strchr(yytext, '\"') + 1;
882                         yytext[yyleng-1] = '\0';
883                         push_input_file(name);
884                 }
885         YY_BREAK
886 case YY_STATE_EOF(INITIAL):
887 case YY_STATE_EOF(INCLUDE):
888 case YY_STATE_EOF(BYTESTRING):
889 case YY_STATE_EOF(PROPNODENAME):
890 case YY_STATE_EOF(V1):
891 #line 73 "dtc-lexer.l"
893                         if (!pop_input_file()) {
894                                 yyterminate();
895                         }
896                 }
897         YY_BREAK
898 case 2:
899 /* rule 2 can match eol */
900 YY_RULE_SETUP
901 #line 79 "dtc-lexer.l"
903                         DPRINT("String: %s\n", yytext);
904                         yylval.data = data_copy_escape_string(yytext+1,
905                                         yyleng-2);
906                         return DT_STRING;
907                 }
908         YY_BREAK
909 case 3:
910 YY_RULE_SETUP
911 #line 86 "dtc-lexer.l"
913                         DPRINT("Keyword: /dts-v1/\n");
914                         dts_version = 1;
915                         BEGIN_DEFAULT();
916                         return DT_V1;
917                 }
918         YY_BREAK
919 case 4:
920 YY_RULE_SETUP
921 #line 93 "dtc-lexer.l"
923                         DPRINT("Keyword: /memreserve/\n");
924                         BEGIN_DEFAULT();
925                         return DT_MEMRESERVE;
926                 }
927         YY_BREAK
928 case 5:
929 YY_RULE_SETUP
930 #line 99 "dtc-lexer.l"
932                         DPRINT("Label: %s\n", yytext);
933                         yylval.labelref = xstrdup(yytext);
934                         yylval.labelref[yyleng-1] = '\0';
935                         return DT_LABEL;
936                 }
937         YY_BREAK
938 case 6:
939 YY_RULE_SETUP
940 #line 106 "dtc-lexer.l"
942                         yylval.literal = xstrdup(yytext);
943                         DPRINT("Literal: '%s'\n", yylval.literal);
944                         return DT_LITERAL;
945                 }
946         YY_BREAK
947 case 7:
948 YY_RULE_SETUP
949 #line 112 "dtc-lexer.l"
950 {       /* label reference */
951                         DPRINT("Ref: %s\n", yytext+1);
952                         yylval.labelref = xstrdup(yytext+1);
953                         return DT_REF;
954                 }
955         YY_BREAK
956 case 8:
957 YY_RULE_SETUP
958 #line 118 "dtc-lexer.l"
959 {       /* new-style path reference */
960                         yytext[yyleng-1] = '\0';
961                         DPRINT("Ref: %s\n", yytext+2);
962                         yylval.labelref = xstrdup(yytext+2);
963                         return DT_REF;
964                 }
965         YY_BREAK
966 case 9:
967 YY_RULE_SETUP
968 #line 125 "dtc-lexer.l"
970                         yylval.byte = strtol(yytext, NULL, 16);
971                         DPRINT("Byte: %02x\n", (int)yylval.byte);
972                         return DT_BYTE;
973                 }
974         YY_BREAK
975 case 10:
976 YY_RULE_SETUP
977 #line 131 "dtc-lexer.l"
979                         DPRINT("/BYTESTRING\n");
980                         BEGIN_DEFAULT();
981                         return ']';
982                 }
983         YY_BREAK
984 case 11:
985 YY_RULE_SETUP
986 #line 137 "dtc-lexer.l"
988                         DPRINT("PropNodeName: %s\n", yytext);
989                         yylval.propnodename = xstrdup(yytext);
990                         BEGIN_DEFAULT();
991                         return DT_PROPNODENAME;
992                 }
993         YY_BREAK
994 case 12:
995 YY_RULE_SETUP
996 #line 144 "dtc-lexer.l"
998                         DPRINT("Binary Include\n");
999                         return DT_INCBIN;
1000                 }
1001         YY_BREAK
1002 case 13:
1003 /* rule 13 can match eol */
1004 YY_RULE_SETUP
1005 #line 149 "dtc-lexer.l"
1006 /* eat whitespace */
1007         YY_BREAK
1008 case 14:
1009 /* rule 14 can match eol */
1010 YY_RULE_SETUP
1011 #line 150 "dtc-lexer.l"
1012 /* eat C-style comments */
1013         YY_BREAK
1014 case 15:
1015 /* rule 15 can match eol */
1016 YY_RULE_SETUP
1017 #line 151 "dtc-lexer.l"
1018 /* eat C++-style comments */
1019         YY_BREAK
1020 case 16:
1021 YY_RULE_SETUP
1022 #line 153 "dtc-lexer.l"
1024                         DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1025                                 (unsigned)yytext[0]);
1026                         if (yytext[0] == '[') {
1027                                 DPRINT("<BYTESTRING>\n");
1028                                 BEGIN(BYTESTRING);
1029                         }
1030                         if ((yytext[0] == '{')
1031                             || (yytext[0] == ';')) {
1032                                 DPRINT("<PROPNODENAME>\n");
1033                                 BEGIN(PROPNODENAME);
1034                         }
1035                         return yytext[0];
1036                 }
1037         YY_BREAK
1038 case 17:
1039 YY_RULE_SETUP
1040 #line 168 "dtc-lexer.l"
1041 ECHO;
1042         YY_BREAK
1043 #line 1044 "dtc-lexer.lex.c"
1045         case YY_END_OF_BUFFER:
1046                 {
1047                 /* Amount of text matched not including the EOB char. */
1048                 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1050                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1051                 *yy_cp = (yy_hold_char);
1052                 YY_RESTORE_YY_MORE_OFFSET
1054                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1055                         {
1056                         /* We're scanning a new file or input source.  It's
1057                          * possible that this happened because the user
1058                          * just pointed yyin at a new source and called
1059                          * yylex().  If so, then we have to assure
1060                          * consistency between YY_CURRENT_BUFFER and our
1061                          * globals.  Here is the right place to do so, because
1062                          * this is the first action (other than possibly a
1063                          * back-up) that will match for the new input source.
1064                          */
1065                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1066                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1067                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1068                         }
1070                 /* Note that here we test for yy_c_buf_p "<=" to the position
1071                  * of the first EOB in the buffer, since yy_c_buf_p will
1072                  * already have been incremented past the NUL character
1073                  * (since all states make transitions on EOB to the
1074                  * end-of-buffer state).  Contrast this with the test
1075                  * in input().
1076                  */
1077                 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1078                         { /* This was really a NUL. */
1079                         yy_state_type yy_next_state;
1081                         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1083                         yy_current_state = yy_get_previous_state(  );
1085                         /* Okay, we're now positioned to make the NUL
1086                          * transition.  We couldn't have
1087                          * yy_get_previous_state() go ahead and do it
1088                          * for us because it doesn't know how to deal
1089                          * with the possibility of jamming (and we don't
1090                          * want to build jamming into it because then it
1091                          * will run more slowly).
1092                          */
1094                         yy_next_state = yy_try_NUL_trans( yy_current_state );
1096                         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1098                         if ( yy_next_state )
1099                                 {
1100                                 /* Consume the NUL. */
1101                                 yy_cp = ++(yy_c_buf_p);
1102                                 yy_current_state = yy_next_state;
1103                                 goto yy_match;
1104                                 }
1106                         else
1107                                 {
1108                                 yy_cp = (yy_last_accepting_cpos);
1109                                 yy_current_state = (yy_last_accepting_state);
1110                                 goto yy_find_action;
1111                                 }
1112                         }
1114                 else switch ( yy_get_next_buffer(  ) )
1115                         {
1116                         case EOB_ACT_END_OF_FILE:
1117                                 {
1118                                 (yy_did_buffer_switch_on_eof) = 0;
1120                                 if ( yywrap( ) )
1121                                         {
1122                                         /* Note: because we've taken care in
1123                                          * yy_get_next_buffer() to have set up
1124                                          * yytext, we can now set up
1125                                          * yy_c_buf_p so that if some total
1126                                          * hoser (like flex itself) wants to
1127                                          * call the scanner after we return the
1128                                          * YY_NULL, it'll still work - another
1129                                          * YY_NULL will get returned.
1130                                          */
1131                                         (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1133                                         yy_act = YY_STATE_EOF(YY_START);
1134                                         goto do_action;
1135                                         }
1137                                 else
1138                                         {
1139                                         if ( ! (yy_did_buffer_switch_on_eof) )
1140                                                 YY_NEW_FILE;
1141                                         }
1142                                 break;
1143                                 }
1145                         case EOB_ACT_CONTINUE_SCAN:
1146                                 (yy_c_buf_p) =
1147                                         (yytext_ptr) + yy_amount_of_matched_text;
1149                                 yy_current_state = yy_get_previous_state(  );
1151                                 yy_cp = (yy_c_buf_p);
1152                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1153                                 goto yy_match;
1155                         case EOB_ACT_LAST_MATCH:
1156                                 (yy_c_buf_p) =
1157                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1159                                 yy_current_state = yy_get_previous_state(  );
1161                                 yy_cp = (yy_c_buf_p);
1162                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1163                                 goto yy_find_action;
1164                         }
1165                 break;
1166                 }
1168         default:
1169                 YY_FATAL_ERROR(
1170                         "fatal flex scanner internal error--no action found" );
1171         } /* end of action switch */
1172                 } /* end of scanning one token */
1173 } /* end of yylex */
1175 /* yy_get_next_buffer - try to read in a new buffer
1177  * Returns a code representing an action:
1178  *      EOB_ACT_LAST_MATCH -
1179  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1180  *      EOB_ACT_END_OF_FILE - end of file
1181  */
1182 static int yy_get_next_buffer (void)
1184         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1185         register char *source = (yytext_ptr);
1186         register int number_to_move, i;
1187         int ret_val;
1189         if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1190                 YY_FATAL_ERROR(
1191                 "fatal flex scanner internal error--end of buffer missed" );
1193         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1194                 { /* Don't try to fill the buffer, so this is an EOF. */
1195                 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1196                         {
1197                         /* We matched a single character, the EOB, so
1198                          * treat this as a final EOF.
1199                          */
1200                         return EOB_ACT_END_OF_FILE;
1201                         }
1203                 else
1204                         {
1205                         /* We matched some text prior to the EOB, first
1206                          * process it.
1207                          */
1208                         return EOB_ACT_LAST_MATCH;
1209                         }
1210                 }
1212         /* Try to read more data. */
1214         /* First move last chars to start of buffer. */
1215         number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1217         for ( i = 0; i < number_to_move; ++i )
1218                 *(dest++) = *(source++);
1220         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1221                 /* don't do the read, it's not guaranteed to return an EOF,
1222                  * just force an EOF
1223                  */
1224                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1226         else
1227                 {
1228                         int num_to_read =
1229                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1231                 while ( num_to_read <= 0 )
1232                         { /* Not enough room in the buffer - grow it. */
1234                         /* just a shorter name for the current buffer */
1235                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1237                         int yy_c_buf_p_offset =
1238                                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1240                         if ( b->yy_is_our_buffer )
1241                                 {
1242                                 int new_size = b->yy_buf_size * 2;
1244                                 if ( new_size <= 0 )
1245                                         b->yy_buf_size += b->yy_buf_size / 8;
1246                                 else
1247                                         b->yy_buf_size *= 2;
1249                                 b->yy_ch_buf = (char *)
1250                                         /* Include room in for 2 EOB chars. */
1251                                         yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
1252                                 }
1253                         else
1254                                 /* Can't grow it, we don't own it. */
1255                                 b->yy_ch_buf = 0;
1257                         if ( ! b->yy_ch_buf )
1258                                 YY_FATAL_ERROR(
1259                                 "fatal error - scanner input buffer overflow" );
1261                         (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1263                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1264                                                 number_to_move - 1;
1266                         }
1268                 if ( num_to_read > YY_READ_BUF_SIZE )
1269                         num_to_read = YY_READ_BUF_SIZE;
1271                 /* Read in more data. */
1272                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1273                         (yy_n_chars), (size_t) num_to_read );
1275                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1276                 }
1278         if ( (yy_n_chars) == 0 )
1279                 {
1280                 if ( number_to_move == YY_MORE_ADJ )
1281                         {
1282                         ret_val = EOB_ACT_END_OF_FILE;
1283                         yyrestart(yyin  );
1284                         }
1286                 else
1287                         {
1288                         ret_val = EOB_ACT_LAST_MATCH;
1289                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1290                                 YY_BUFFER_EOF_PENDING;
1291                         }
1292                 }
1294         else
1295                 ret_val = EOB_ACT_CONTINUE_SCAN;
1297         if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1298                 /* Extend the array by 50%, plus the number we really need. */
1299                 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1300                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
1301                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1302                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1303         }
1305         (yy_n_chars) += number_to_move;
1306         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1307         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1309         (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1311         return ret_val;
1314 /* yy_get_previous_state - get the state just before the EOB char was reached */
1316     static yy_state_type yy_get_previous_state (void)
1318         register yy_state_type yy_current_state;
1319         register char *yy_cp;
1320     
1321         yy_current_state = (yy_start);
1323         for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1324                 {
1325                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1326                 if ( yy_accept[yy_current_state] )
1327                         {
1328                         (yy_last_accepting_state) = yy_current_state;
1329                         (yy_last_accepting_cpos) = yy_cp;
1330                         }
1331                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1332                         {
1333                         yy_current_state = (int) yy_def[yy_current_state];
1334                         if ( yy_current_state >= 94 )
1335                                 yy_c = yy_meta[(unsigned int) yy_c];
1336                         }
1337                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1338                 }
1340         return yy_current_state;
1343 /* yy_try_NUL_trans - try to make a transition on the NUL character
1345  * synopsis
1346  *      next_state = yy_try_NUL_trans( current_state );
1347  */
1348     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1350         register int yy_is_jam;
1351         register char *yy_cp = (yy_c_buf_p);
1353         register YY_CHAR yy_c = 1;
1354         if ( yy_accept[yy_current_state] )
1355                 {
1356                 (yy_last_accepting_state) = yy_current_state;
1357                 (yy_last_accepting_cpos) = yy_cp;
1358                 }
1359         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1360                 {
1361                 yy_current_state = (int) yy_def[yy_current_state];
1362                 if ( yy_current_state >= 94 )
1363                         yy_c = yy_meta[(unsigned int) yy_c];
1364                 }
1365         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1366         yy_is_jam = (yy_current_state == 93);
1368         return yy_is_jam ? 0 : yy_current_state;
1371 #ifndef YY_NO_INPUT
1372 #ifdef __cplusplus
1373     static int yyinput (void)
1374 #else
1375     static int input  (void)
1376 #endif
1379         int c;
1380     
1381         *(yy_c_buf_p) = (yy_hold_char);
1383         if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1384                 {
1385                 /* yy_c_buf_p now points to the character we want to return.
1386                  * If this occurs *before* the EOB characters, then it's a
1387                  * valid NUL; if not, then we've hit the end of the buffer.
1388                  */
1389                 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1390                         /* This was really a NUL. */
1391                         *(yy_c_buf_p) = '\0';
1393                 else
1394                         { /* need more input */
1395                         int offset = (yy_c_buf_p) - (yytext_ptr);
1396                         ++(yy_c_buf_p);
1398                         switch ( yy_get_next_buffer(  ) )
1399                                 {
1400                                 case EOB_ACT_LAST_MATCH:
1401                                         /* This happens because yy_g_n_b()
1402                                          * sees that we've accumulated a
1403                                          * token and flags that we need to
1404                                          * try matching the token before
1405                                          * proceeding.  But for input(),
1406                                          * there's no matching to consider.
1407                                          * So convert the EOB_ACT_LAST_MATCH
1408                                          * to EOB_ACT_END_OF_FILE.
1409                                          */
1411                                         /* Reset buffer status. */
1412                                         yyrestart(yyin );
1414                                         /*FALLTHROUGH*/
1416                                 case EOB_ACT_END_OF_FILE:
1417                                         {
1418                                         if ( yywrap( ) )
1419                                                 return EOF;
1421                                         if ( ! (yy_did_buffer_switch_on_eof) )
1422                                                 YY_NEW_FILE;
1423 #ifdef __cplusplus
1424                                         return yyinput();
1425 #else
1426                                         return input();
1427 #endif
1428                                         }
1430                                 case EOB_ACT_CONTINUE_SCAN:
1431                                         (yy_c_buf_p) = (yytext_ptr) + offset;
1432                                         break;
1433                                 }
1434                         }
1435                 }
1437         c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
1438         *(yy_c_buf_p) = '\0';   /* preserve yytext */
1439         (yy_hold_char) = *++(yy_c_buf_p);
1441         return c;
1443 #endif  /* ifndef YY_NO_INPUT */
1445 /** Immediately switch to a different input stream.
1446  * @param input_file A readable stream.
1447  * 
1448  * @note This function does not reset the start condition to @c INITIAL .
1449  */
1450     void yyrestart  (FILE * input_file )
1452     
1453         if ( ! YY_CURRENT_BUFFER ){
1454         yyensure_buffer_stack ();
1455                 YY_CURRENT_BUFFER_LVALUE =
1456             yy_create_buffer(yyin,YY_BUF_SIZE );
1457         }
1459         yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1460         yy_load_buffer_state( );
1463 /** Switch to a different input buffer.
1464  * @param new_buffer The new input buffer.
1465  * 
1466  */
1467     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1469     
1470         /* TODO. We should be able to replace this entire function body
1471          * with
1472          *              yypop_buffer_state();
1473          *              yypush_buffer_state(new_buffer);
1474      */
1475         yyensure_buffer_stack ();
1476         if ( YY_CURRENT_BUFFER == new_buffer )
1477                 return;
1479         if ( YY_CURRENT_BUFFER )
1480                 {
1481                 /* Flush out information for old buffer. */
1482                 *(yy_c_buf_p) = (yy_hold_char);
1483                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1484                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1485                 }
1487         YY_CURRENT_BUFFER_LVALUE = new_buffer;
1488         yy_load_buffer_state( );
1490         /* We don't actually know whether we did this switch during
1491          * EOF (yywrap()) processing, but the only time this flag
1492          * is looked at is after yywrap() is called, so it's safe
1493          * to go ahead and always set it.
1494          */
1495         (yy_did_buffer_switch_on_eof) = 1;
1498 static void yy_load_buffer_state  (void)
1500         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1501         (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1502         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1503         (yy_hold_char) = *(yy_c_buf_p);
1506 /** Allocate and initialize an input buffer state.
1507  * @param file A readable stream.
1508  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1509  * 
1510  * @return the allocated buffer state.
1511  */
1512     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
1514         YY_BUFFER_STATE b;
1515     
1516         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1517         if ( ! b )
1518                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1520         b->yy_buf_size = size;
1522         /* yy_ch_buf has to be 2 characters longer than the size given because
1523          * we need to put in 2 end-of-buffer characters.
1524          */
1525         b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
1526         if ( ! b->yy_ch_buf )
1527                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1529         b->yy_is_our_buffer = 1;
1531         yy_init_buffer(b,file );
1533         return b;
1536 /** Destroy the buffer.
1537  * @param b a buffer created with yy_create_buffer()
1538  * 
1539  */
1540     void yy_delete_buffer (YY_BUFFER_STATE  b )
1542     
1543         if ( ! b )
1544                 return;
1546         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1547                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1549         if ( b->yy_is_our_buffer )
1550                 yyfree((void *) b->yy_ch_buf  );
1552         yyfree((void *) b  );
1555 /* Initializes or reinitializes a buffer.
1556  * This function is sometimes called more than once on the same buffer,
1557  * such as during a yyrestart() or at EOF.
1558  */
1559     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
1562         int oerrno = errno;
1563     
1564         yy_flush_buffer(b );
1566         b->yy_input_file = file;
1567         b->yy_fill_buffer = 1;
1569     /* If b is the current buffer, then yy_init_buffer was _probably_
1570      * called from yyrestart() or through yy_get_next_buffer.
1571      * In that case, we don't want to reset the lineno or column.
1572      */
1573     if (b != YY_CURRENT_BUFFER){
1574         b->yy_bs_lineno = 1;
1575         b->yy_bs_column = 0;
1576     }
1578         b->yy_is_interactive = 0;
1579     
1580         errno = oerrno;
1583 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1584  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1585  * 
1586  */
1587     void yy_flush_buffer (YY_BUFFER_STATE  b )
1589         if ( ! b )
1590                 return;
1592         b->yy_n_chars = 0;
1594         /* We always need two end-of-buffer characters.  The first causes
1595          * a transition to the end-of-buffer state.  The second causes
1596          * a jam in that state.
1597          */
1598         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1599         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1601         b->yy_buf_pos = &b->yy_ch_buf[0];
1603         b->yy_at_bol = 1;
1604         b->yy_buffer_status = YY_BUFFER_NEW;
1606         if ( b == YY_CURRENT_BUFFER )
1607                 yy_load_buffer_state( );
1610 /** Pushes the new state onto the stack. The new state becomes
1611  *  the current state. This function will allocate the stack
1612  *  if necessary.
1613  *  @param new_buffer The new state.
1614  *  
1615  */
1616 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1618         if (new_buffer == NULL)
1619                 return;
1621         yyensure_buffer_stack();
1623         /* This block is copied from yy_switch_to_buffer. */
1624         if ( YY_CURRENT_BUFFER )
1625                 {
1626                 /* Flush out information for old buffer. */
1627                 *(yy_c_buf_p) = (yy_hold_char);
1628                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1629                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1630                 }
1632         /* Only push if top exists. Otherwise, replace top. */
1633         if (YY_CURRENT_BUFFER)
1634                 (yy_buffer_stack_top)++;
1635         YY_CURRENT_BUFFER_LVALUE = new_buffer;
1637         /* copied from yy_switch_to_buffer. */
1638         yy_load_buffer_state( );
1639         (yy_did_buffer_switch_on_eof) = 1;
1642 /** Removes and deletes the top of the stack, if present.
1643  *  The next element becomes the new top.
1644  *  
1645  */
1646 void yypop_buffer_state (void)
1648         if (!YY_CURRENT_BUFFER)
1649                 return;
1651         yy_delete_buffer(YY_CURRENT_BUFFER );
1652         YY_CURRENT_BUFFER_LVALUE = NULL;
1653         if ((yy_buffer_stack_top) > 0)
1654                 --(yy_buffer_stack_top);
1656         if (YY_CURRENT_BUFFER) {
1657                 yy_load_buffer_state( );
1658                 (yy_did_buffer_switch_on_eof) = 1;
1659         }
1662 /* Allocates the stack if it does not exist.
1663  *  Guarantees space for at least one push.
1664  */
1665 static void yyensure_buffer_stack (void)
1667         int num_to_alloc;
1668     
1669         if (!(yy_buffer_stack)) {
1671                 /* First allocation is just for 2 elements, since we don't know if this
1672                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1673                  * immediate realloc on the next call.
1674          */
1675                 num_to_alloc = 1;
1676                 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1677                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
1678                                                                 );
1679                 if ( ! (yy_buffer_stack) )
1680                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1681                                                                   
1682                 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1683                                 
1684                 (yy_buffer_stack_max) = num_to_alloc;
1685                 (yy_buffer_stack_top) = 0;
1686                 return;
1687         }
1689         if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1691                 /* Increase the buffer to prepare for a possible push. */
1692                 int grow_size = 8 /* arbitrary grow size */;
1694                 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1695                 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1696                                                                 ((yy_buffer_stack),
1697                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
1698                                                                 );
1699                 if ( ! (yy_buffer_stack) )
1700                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1702                 /* zero only the new slots.*/
1703                 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1704                 (yy_buffer_stack_max) = num_to_alloc;
1705         }
1708 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1709  * @param base the character buffer
1710  * @param size the size in bytes of the character buffer
1711  * 
1712  * @return the newly allocated buffer state object. 
1713  */
1714 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
1716         YY_BUFFER_STATE b;
1717     
1718         if ( size < 2 ||
1719              base[size-2] != YY_END_OF_BUFFER_CHAR ||
1720              base[size-1] != YY_END_OF_BUFFER_CHAR )
1721                 /* They forgot to leave room for the EOB's. */
1722                 return 0;
1724         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1725         if ( ! b )
1726                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1728         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
1729         b->yy_buf_pos = b->yy_ch_buf = base;
1730         b->yy_is_our_buffer = 0;
1731         b->yy_input_file = 0;
1732         b->yy_n_chars = b->yy_buf_size;
1733         b->yy_is_interactive = 0;
1734         b->yy_at_bol = 1;
1735         b->yy_fill_buffer = 0;
1736         b->yy_buffer_status = YY_BUFFER_NEW;
1738         yy_switch_to_buffer(b  );
1740         return b;
1743 /** Setup the input buffer state to scan a string. The next call to yylex() will
1744  * scan from a @e copy of @a str.
1745  * @param yystr a NUL-terminated string to scan
1746  * 
1747  * @return the newly allocated buffer state object.
1748  * @note If you want to scan bytes that may contain NUL values, then use
1749  *       yy_scan_bytes() instead.
1750  */
1751 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1753     
1754         return yy_scan_bytes(yystr,strlen(yystr) );
1757 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1758  * scan from a @e copy of @a bytes.
1759  * @param yybytes the byte buffer to scan
1760  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1761  * 
1762  * @return the newly allocated buffer state object.
1763  */
1764 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
1766         YY_BUFFER_STATE b;
1767         char *buf;
1768         yy_size_t n;
1769         int i;
1770     
1771         /* Get memory for full buffer, including space for trailing EOB's. */
1772         n = _yybytes_len + 2;
1773         buf = (char *) yyalloc(n  );
1774         if ( ! buf )
1775                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1777         for ( i = 0; i < _yybytes_len; ++i )
1778                 buf[i] = yybytes[i];
1780         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1782         b = yy_scan_buffer(buf,n );
1783         if ( ! b )
1784                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1786         /* It's okay to grow etc. this buffer, and we should throw it
1787          * away when we're done.
1788          */
1789         b->yy_is_our_buffer = 1;
1791         return b;
1794 #ifndef YY_EXIT_FAILURE
1795 #define YY_EXIT_FAILURE 2
1796 #endif
1798 static void yy_fatal_error (yyconst char* msg )
1800         (void) fprintf( stderr, "%s\n", msg );
1801         exit( YY_EXIT_FAILURE );
1804 /* Redefine yyless() so it works in section 3 code. */
1806 #undef yyless
1807 #define yyless(n) \
1808         do \
1809                 { \
1810                 /* Undo effects of setting up yytext. */ \
1811         int yyless_macro_arg = (n); \
1812         YY_LESS_LINENO(yyless_macro_arg);\
1813                 yytext[yyleng] = (yy_hold_char); \
1814                 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1815                 (yy_hold_char) = *(yy_c_buf_p); \
1816                 *(yy_c_buf_p) = '\0'; \
1817                 yyleng = yyless_macro_arg; \
1818                 } \
1819         while ( 0 )
1821 /* Accessor  methods (get/set functions) to struct members. */
1823 /** Get the current line number.
1824  * 
1825  */
1826 int yyget_lineno  (void)
1828         
1829     return yylineno;
1832 /** Get the input stream.
1833  * 
1834  */
1835 FILE *yyget_in  (void)
1837         return yyin;
1840 /** Get the output stream.
1841  * 
1842  */
1843 FILE *yyget_out  (void)
1845         return yyout;
1848 /** Get the length of the current token.
1849  * 
1850  */
1851 int yyget_leng  (void)
1853         return yyleng;
1856 /** Get the current token.
1857  * 
1858  */
1860 char *yyget_text  (void)
1862         return yytext;
1865 /** Set the current line number.
1866  * @param line_number
1867  * 
1868  */
1869 void yyset_lineno (int  line_number )
1871     
1872     yylineno = line_number;
1875 /** Set the input stream. This does not discard the current
1876  * input buffer.
1877  * @param in_str A readable stream.
1878  * 
1879  * @see yy_switch_to_buffer
1880  */
1881 void yyset_in (FILE *  in_str )
1883         yyin = in_str ;
1886 void yyset_out (FILE *  out_str )
1888         yyout = out_str ;
1891 int yyget_debug  (void)
1893         return yy_flex_debug;
1896 void yyset_debug (int  bdebug )
1898         yy_flex_debug = bdebug ;
1901 static int yy_init_globals (void)
1903         /* Initialization is the same as for the non-reentrant scanner.
1904      * This function is called from yylex_destroy(), so don't allocate here.
1905      */
1907     (yy_buffer_stack) = 0;
1908     (yy_buffer_stack_top) = 0;
1909     (yy_buffer_stack_max) = 0;
1910     (yy_c_buf_p) = (char *) 0;
1911     (yy_init) = 0;
1912     (yy_start) = 0;
1914 /* Defined in main.c */
1915 #ifdef YY_STDINIT
1916     yyin = stdin;
1917     yyout = stdout;
1918 #else
1919     yyin = (FILE *) 0;
1920     yyout = (FILE *) 0;
1921 #endif
1923     /* For future reference: Set errno on error, since we are called by
1924      * yylex_init()
1925      */
1926     return 0;
1929 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1930 int yylex_destroy  (void)
1932     
1933     /* Pop the buffer stack, destroying each element. */
1934         while(YY_CURRENT_BUFFER){
1935                 yy_delete_buffer(YY_CURRENT_BUFFER  );
1936                 YY_CURRENT_BUFFER_LVALUE = NULL;
1937                 yypop_buffer_state();
1938         }
1940         /* Destroy the stack itself. */
1941         yyfree((yy_buffer_stack) );
1942         (yy_buffer_stack) = NULL;
1944     /* Reset the globals. This is important in a non-reentrant scanner so the next time
1945      * yylex() is called, initialization will occur. */
1946     yy_init_globals( );
1948     return 0;
1952  * Internal utility routines.
1953  */
1955 #ifndef yytext_ptr
1956 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1958         register int i;
1959         for ( i = 0; i < n; ++i )
1960                 s1[i] = s2[i];
1962 #endif
1964 #ifdef YY_NEED_STRLEN
1965 static int yy_flex_strlen (yyconst char * s )
1967         register int n;
1968         for ( n = 0; s[n]; ++n )
1969                 ;
1971         return n;
1973 #endif
1975 void *yyalloc (yy_size_t  size )
1977         return (void *) malloc( size );
1980 void *yyrealloc  (void * ptr, yy_size_t  size )
1982         /* The cast to (char *) in the following accommodates both
1983          * implementations that use char* generic pointers, and those
1984          * that use void* generic pointers.  It works with the latter
1985          * because both ANSI C and C++ allow castless assignment from
1986          * any pointer type to void*, and deal with argument conversions
1987          * as though doing an assignment.
1988          */
1989         return (void *) realloc( (char *) ptr, size );
1992 void yyfree (void * ptr )
1994         free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
1997 #define YYTABLES_NAME "yytables"
1999 #line 168 "dtc-lexer.l"
2003 static void push_input_file(const char *filename)
2005         assert(filename);
2007         srcfile_push(filename);
2009         yyin = current_srcfile->f;
2011         yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
2015 static int pop_input_file(void)
2017         if (srcfile_pop() == 0)
2018                 return 0;
2020         yypop_buffer_state();
2021         yyin = current_srcfile->f;
2023         return 1;