blob: 50c4420b4b2c9c6894d66bc7df30b0203637ec4f [file] [log] [blame]
David Gibsona4da2e32007-12-18 15:06:42 +11001#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
Josh Triplett23c4ace2009-10-16 15:52:06 -070012#define YY_FLEX_SUBMINOR_VERSION 35
David Gibsona4da2e32007-12-18 15:06:42 +110013#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
David Gibsoned95d742008-08-07 12:24:17 +100034#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
David Gibsona4da2e32007-12-18 15:06:42 +110035
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;
David Gibsona4da2e32007-12-18 15:06:42 +110057
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
Josh Triplett23c4ace2009-10-16 15:52:06 -070087#endif /* ! C99 */
88
David Gibsona4da2e32007-12-18 15:06:42 +110089#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
David Gibsoned95d742008-08-07 12:24:17 +100098/* C99 requires __STDC__ to be defined as 1. */
99#if defined (__STDC__)
David Gibsona4da2e32007-12-18 15:06:42 +1100100
101#define YY_USE_CONST
102
David Gibsoned95d742008-08-07 12:24:17 +1000103#endif /* defined (__STDC__) */
David Gibsona4da2e32007-12-18 15:06:42 +1100104#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
Josh Triplett23c4ace2009-10-16 15:52:06 -0700145#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
David Gibsona4da2e32007-12-18 15:06:42 +1100152#define YY_BUF_SIZE 16384
Josh Triplett23c4ace2009-10-16 15:52:06 -0700153#endif /* __ia64__ */
David Gibsona4da2e32007-12-18 15:06:42 +1100154#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
John Bonesio658f29a2010-11-17 15:28:20 -0800173 #define YY_LESS_LINENO(n)
David Gibsona4da2e32007-12-18 15:06:42 +1100174
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
David Gibsona4da2e32007-12-18 15:06:42 +1100191#ifndef YY_TYPEDEF_YY_SIZE_T
192#define YY_TYPEDEF_YY_SIZE_T
David Gibsoned95d742008-08-07 12:24:17 +1000193typedef size_t yy_size_t;
David Gibsona4da2e32007-12-18 15:06:42 +1100194#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
David Gibsoned95d742008-08-07 12:24:17 +1000344#define yywrap(n) 1
David Gibsona4da2e32007-12-18 15:06:42 +1100345#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
John Bonesio658f29a2010-11-17 15:28:20 -0800375#define YY_NUM_RULES 17
376#define YY_END_OF_BUFFER 18
David Gibsona4da2e32007-12-18 15:06:42 +1100377/* 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 };
John Bonesio658f29a2010-11-17 15:28:20 -0800384static yyconst flex_int16_t yy_accept[94] =
David Gibsona4da2e32007-12-18 15:06:42 +1100385 { 0,
386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
John Bonesio658f29a2010-11-17 15:28:20 -0800387 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,
David Gibsoned95d742008-08-07 12:24:17 +1000394 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
David Gibsoned95d742008-08-07 12:24:17 +1000395 0, 4, 0
John Bonesio658f29a2010-11-17 15:28:20 -0800396
David Gibsona4da2e32007-12-18 15:06:42 +1100397 } ;
398
399static 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,
John Bonesio658f29a2010-11-17 15:28:20 -0800405 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,
David Gibsona4da2e32007-12-18 15:06:42 +1100411
John Bonesio658f29a2010-11-17 15:28:20 -0800412 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,
David Gibsona4da2e32007-12-18 15:06:42 +1100415 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,
422
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 } ;
430
John Bonesio658f29a2010-11-17 15:28:20 -0800431static yyconst flex_int32_t yy_meta[34] =
David Gibsona4da2e32007-12-18 15:06:42 +1100432 { 0,
John Bonesio658f29a2010-11-17 15:28:20 -0800433 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
David Gibsona4da2e32007-12-18 15:06:42 +1100437 } ;
438
John Bonesio658f29a2010-11-17 15:28:20 -0800439static yyconst flex_int16_t yy_base[106] =
David Gibsona4da2e32007-12-18 15:06:42 +1100440 { 0,
John Bonesio658f29a2010-11-17 15:28:20 -0800441 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,
David Gibsona4da2e32007-12-18 15:06:42 +1100451
John Bonesio658f29a2010-11-17 15:28:20 -0800452 187, 195, 200, 205, 212
David Gibsona4da2e32007-12-18 15:06:42 +1100453 } ;
454
John Bonesio658f29a2010-11-17 15:28:20 -0800455static yyconst flex_int16_t yy_def[106] =
David Gibsona4da2e32007-12-18 15:06:42 +1100456 { 0,
John Bonesio658f29a2010-11-17 15:28:20 -0800457 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,
David Gibsona4da2e32007-12-18 15:06:42 +1100467
John Bonesio658f29a2010-11-17 15:28:20 -0800468 93, 93, 93, 93, 93
David Gibsona4da2e32007-12-18 15:06:42 +1100469 } ;
470
John Bonesio658f29a2010-11-17 15:28:20 -0800471static yyconst flex_int16_t yy_nxt[281] =
David Gibsona4da2e32007-12-18 15:06:42 +1100472 { 0,
John Bonesio658f29a2010-11-17 15:28:20 -0800473 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,
David Gibsona4da2e32007-12-18 15:06:42 +1100483
John Bonesio658f29a2010-11-17 15:28:20 -0800484 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,
David Gibsona4da2e32007-12-18 15:06:42 +1100494
John Bonesio658f29a2010-11-17 15:28:20 -0800495 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
David Gibsona4da2e32007-12-18 15:06:42 +1100503 } ;
504
John Bonesio658f29a2010-11-17 15:28:20 -0800505static yyconst flex_int16_t yy_chk[281] =
David Gibsona4da2e32007-12-18 15:06:42 +1100506 { 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,
John Bonesio658f29a2010-11-17 15:28:20 -0800510 1, 1, 1, 5, 5, 5, 5, 91, 5, 9,
511 9, 9, 5, 5, 5, 5, 5, 7, 7, 7,
David Gibsoned95d742008-08-07 12:24:17 +1000512 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
David Gibsona4da2e32007-12-18 15:06:42 +1100513 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
514 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
John Bonesio658f29a2010-11-17 15:28:20 -0800515 10, 10, 10, 13, 13, 14, 14, 15, 24, 28,
516 24, 24, 25, 25, 25, 50, 24, 50, 25, 90,
David Gibsona4da2e32007-12-18 15:06:42 +1100517
John Bonesio658f29a2010-11-17 15:28:20 -0800518 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,
David Gibsona4da2e32007-12-18 15:06:42 +1100528
John Bonesio658f29a2010-11-17 15:28:20 -0800529 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
David Gibsona4da2e32007-12-18 15:06:42 +1100537 } ;
538
David Gibsona4da2e32007-12-18 15:06:42 +1100539static yy_state_type yy_last_accepting_state;
540static char *yy_last_accepting_cpos;
541
542extern int yy_flex_debug;
543int yy_flex_debug = 0;
544
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
552char *yytext;
553#line 1 "dtc-lexer.l"
554/*
555 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
556 *
557 *
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.
562 *
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.
567 *
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 */
Josh Triplett23c4ace2009-10-16 15:52:06 -0700573#define YY_NO_INPUT 1
David Gibsona4da2e32007-12-18 15:06:42 +1100574
575
576
577
David Gibsoned95d742008-08-07 12:24:17 +1000578#line 37 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100579#include "dtc.h"
580#include "srcpos.h"
581#include "dtc-parser.tab.h"
582
John Bonesio658f29a2010-11-17 15:28:20 -0800583YYLTYPE yylloc;
584
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 }
David Gibsona4da2e32007-12-18 15:06:42 +1100590
591/*#define LEXDEBUG 1*/
592
593#ifdef LEXDEBUG
594#define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
595#else
596#define DPRINT(fmt, ...) do { } while (0)
597#endif
598
John Bonesio658f29a2010-11-17 15:28:20 -0800599static int dts_version = 1;
David Gibsona4da2e32007-12-18 15:06:42 +1100600
John Bonesio658f29a2010-11-17 15:28:20 -0800601#define BEGIN_DEFAULT() DPRINT("<V1>\n"); \
David Gibsona4da2e32007-12-18 15:06:42 +1100602 BEGIN(V1); \
David Gibsoned95d742008-08-07 12:24:17 +1000603
604static void push_input_file(const char *filename);
605static int pop_input_file(void);
John Bonesio658f29a2010-11-17 15:28:20 -0800606#line 607 "dtc-lexer.lex.c"
David Gibsona4da2e32007-12-18 15:06:42 +1100607
608#define INITIAL 0
609#define INCLUDE 1
610#define BYTESTRING 2
611#define PROPNODENAME 3
612#define V1 4
613
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
621
622#ifndef YY_EXTRA_TYPE
623#define YY_EXTRA_TYPE void *
624#endif
625
626static int yy_init_globals (void );
627
Josh Triplett23c4ace2009-10-16 15:52:06 -0700628/* Accessor methods to globals.
629 These are made visible to non-reentrant scanners for convenience. */
630
631int yylex_destroy (void );
632
633int yyget_debug (void );
634
635void yyset_debug (int debug_flag );
636
637YY_EXTRA_TYPE yyget_extra (void );
638
639void yyset_extra (YY_EXTRA_TYPE user_defined );
640
641FILE *yyget_in (void );
642
643void yyset_in (FILE * in_str );
644
645FILE *yyget_out (void );
646
647void yyset_out (FILE * out_str );
648
649int yyget_leng (void );
650
651char *yyget_text (void );
652
653int yyget_lineno (void );
654
655void yyset_lineno (int line_number );
656
David Gibsona4da2e32007-12-18 15:06:42 +1100657/* Macros after this point can all be overridden by user definitions in
658 * section 1.
659 */
660
661#ifndef YY_SKIP_YYWRAP
662#ifdef __cplusplus
663extern "C" int yywrap (void );
664#else
665extern int yywrap (void );
666#endif
667#endif
668
669#ifndef yytext_ptr
670static void yy_flex_strncpy (char *,yyconst char *,int );
671#endif
672
673#ifdef YY_NEED_STRLEN
674static int yy_flex_strlen (yyconst char * );
675#endif
676
677#ifndef YY_NO_INPUT
678
679#ifdef __cplusplus
680static int yyinput (void );
681#else
682static int input (void );
683#endif
684
685#endif
686
687/* Amount of stuff to slurp up with each read. */
688#ifndef YY_READ_BUF_SIZE
Josh Triplett23c4ace2009-10-16 15:52:06 -0700689#ifdef __ia64__
690/* On IA-64, the buffer size is 16k, not 8k */
691#define YY_READ_BUF_SIZE 16384
692#else
David Gibsona4da2e32007-12-18 15:06:42 +1100693#define YY_READ_BUF_SIZE 8192
Josh Triplett23c4ace2009-10-16 15:52:06 -0700694#endif /* __ia64__ */
David Gibsona4da2e32007-12-18 15:06:42 +1100695#endif
696
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 */
Josh Triplett23c4ace2009-10-16 15:52:06 -0700702#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
David Gibsona4da2e32007-12-18 15:06:42 +1100703#endif
704
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 = '*'; \
Josh Triplett23c4ace2009-10-16 15:52:06 -0700713 size_t n; \
David Gibsona4da2e32007-12-18 15:06:42 +1100714 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 }\
737\
738
739#endif
740
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
748
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
753
754/* Report a fatal error. */
755#ifndef YY_FATAL_ERROR
756#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
757#endif
758
759/* end tables serialization structures and prototypes */
760
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
766
767extern int yylex (void);
768
769#define YY_DECL int yylex (void)
770#endif /* !YY_DECL */
771
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
778
779/* Code executed at the end of each rule. */
780#ifndef YY_BREAK
781#define YY_BREAK break;
782#endif
783
784#define YY_RULE_SETUP \
785 YY_USER_ACTION
786
787/** The main scanner function which does all the work.
788 */
789YY_DECL
790{
791 register yy_state_type yy_current_state;
792 register char *yy_cp, *yy_bp;
793 register int yy_act;
794
John Bonesio658f29a2010-11-17 15:28:20 -0800795#line 66 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100796
John Bonesio658f29a2010-11-17 15:28:20 -0800797#line 798 "dtc-lexer.lex.c"
David Gibsona4da2e32007-12-18 15:06:42 +1100798
799 if ( !(yy_init) )
800 {
801 (yy_init) = 1;
802
803#ifdef YY_USER_INIT
804 YY_USER_INIT;
805#endif
806
807 if ( ! (yy_start) )
808 (yy_start) = 1; /* first start state */
809
810 if ( ! yyin )
811 yyin = stdin;
812
813 if ( ! yyout )
814 yyout = stdout;
815
816 if ( ! YY_CURRENT_BUFFER ) {
817 yyensure_buffer_stack ();
818 YY_CURRENT_BUFFER_LVALUE =
819 yy_create_buffer(yyin,YY_BUF_SIZE );
820 }
821
822 yy_load_buffer_state( );
823 }
824
825 while ( 1 ) /* loops until end-of-file is reached */
826 {
827 yy_cp = (yy_c_buf_p);
828
829 /* Support of yytext. */
830 *yy_cp = (yy_hold_char);
831
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;
836
837 yy_current_state = (yy_start);
838yy_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];
John Bonesio658f29a2010-11-17 15:28:20 -0800850 if ( yy_current_state >= 94 )
David Gibsona4da2e32007-12-18 15:06:42 +1100851 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 }
John Bonesio658f29a2010-11-17 15:28:20 -0800856 while ( yy_current_state != 93 );
857 yy_cp = (yy_last_accepting_cpos);
858 yy_current_state = (yy_last_accepting_state);
David Gibsona4da2e32007-12-18 15:06:42 +1100859
860yy_find_action:
861 yy_act = yy_accept[yy_current_state];
David Gibsona4da2e32007-12-18 15:06:42 +1100862
863 YY_DO_BEFORE_ACTION;
864
David Gibsona4da2e32007-12-18 15:06:42 +1100865do_action: /* This label is used only to access EOF actions. */
866
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;
875
876case 1:
David Gibsoned95d742008-08-07 12:24:17 +1000877/* rule 1 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +1100878YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800879#line 67 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100880{
David Gibsoned95d742008-08-07 12:24:17 +1000881 char *name = strchr(yytext, '\"') + 1;
882 yytext[yyleng-1] = '\0';
883 push_input_file(name);
David Gibsona4da2e32007-12-18 15:06:42 +1100884 }
885 YY_BREAK
886case YY_STATE_EOF(INITIAL):
887case YY_STATE_EOF(INCLUDE):
888case YY_STATE_EOF(BYTESTRING):
889case YY_STATE_EOF(PROPNODENAME):
890case YY_STATE_EOF(V1):
John Bonesio658f29a2010-11-17 15:28:20 -0800891#line 73 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100892{
893 if (!pop_input_file()) {
894 yyterminate();
895 }
896 }
897 YY_BREAK
David Gibsoned95d742008-08-07 12:24:17 +1000898case 2:
899/* rule 2 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +1100900YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800901#line 79 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100902{
David Gibsona4da2e32007-12-18 15:06:42 +1100903 DPRINT("String: %s\n", yytext);
904 yylval.data = data_copy_escape_string(yytext+1,
905 yyleng-2);
David Gibsona4da2e32007-12-18 15:06:42 +1100906 return DT_STRING;
907 }
908 YY_BREAK
David Gibsoned95d742008-08-07 12:24:17 +1000909case 3:
David Gibsona4da2e32007-12-18 15:06:42 +1100910YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800911#line 86 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100912{
David Gibsona4da2e32007-12-18 15:06:42 +1100913 DPRINT("Keyword: /dts-v1/\n");
914 dts_version = 1;
915 BEGIN_DEFAULT();
916 return DT_V1;
917 }
918 YY_BREAK
David Gibsoned95d742008-08-07 12:24:17 +1000919case 4:
David Gibsona4da2e32007-12-18 15:06:42 +1100920YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800921#line 93 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100922{
David Gibsona4da2e32007-12-18 15:06:42 +1100923 DPRINT("Keyword: /memreserve/\n");
924 BEGIN_DEFAULT();
925 return DT_MEMRESERVE;
926 }
927 YY_BREAK
David Gibsoned95d742008-08-07 12:24:17 +1000928case 5:
David Gibsona4da2e32007-12-18 15:06:42 +1100929YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800930#line 99 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100931{
David Gibsona4da2e32007-12-18 15:06:42 +1100932 DPRINT("Label: %s\n", yytext);
John Bonesio658f29a2010-11-17 15:28:20 -0800933 yylval.labelref = xstrdup(yytext);
David Gibsona4da2e32007-12-18 15:06:42 +1100934 yylval.labelref[yyleng-1] = '\0';
935 return DT_LABEL;
936 }
937 YY_BREAK
David Gibsoned95d742008-08-07 12:24:17 +1000938case 6:
David Gibsona4da2e32007-12-18 15:06:42 +1100939YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800940#line 106 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100941{
John Bonesio658f29a2010-11-17 15:28:20 -0800942 yylval.literal = xstrdup(yytext);
David Gibsona4da2e32007-12-18 15:06:42 +1100943 DPRINT("Literal: '%s'\n", yylval.literal);
944 return DT_LITERAL;
945 }
946 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -0800947case 7:
David Gibsona4da2e32007-12-18 15:06:42 +1100948YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800949#line 112 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100950{ /* label reference */
David Gibsona4da2e32007-12-18 15:06:42 +1100951 DPRINT("Ref: %s\n", yytext+1);
John Bonesio658f29a2010-11-17 15:28:20 -0800952 yylval.labelref = xstrdup(yytext+1);
David Gibsona4da2e32007-12-18 15:06:42 +1100953 return DT_REF;
954 }
955 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -0800956case 8:
David Gibsona4da2e32007-12-18 15:06:42 +1100957YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800958#line 118 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100959{ /* new-style path reference */
David Gibsona4da2e32007-12-18 15:06:42 +1100960 yytext[yyleng-1] = '\0';
961 DPRINT("Ref: %s\n", yytext+2);
John Bonesio658f29a2010-11-17 15:28:20 -0800962 yylval.labelref = xstrdup(yytext+2);
David Gibsona4da2e32007-12-18 15:06:42 +1100963 return DT_REF;
964 }
965 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -0800966case 9:
David Gibsona4da2e32007-12-18 15:06:42 +1100967YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800968#line 125 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100969{
David Gibsona4da2e32007-12-18 15:06:42 +1100970 yylval.byte = strtol(yytext, NULL, 16);
971 DPRINT("Byte: %02x\n", (int)yylval.byte);
972 return DT_BYTE;
973 }
974 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -0800975case 10:
David Gibsona4da2e32007-12-18 15:06:42 +1100976YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800977#line 131 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100978{
David Gibsona4da2e32007-12-18 15:06:42 +1100979 DPRINT("/BYTESTRING\n");
980 BEGIN_DEFAULT();
981 return ']';
982 }
983 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -0800984case 11:
David Gibsona4da2e32007-12-18 15:06:42 +1100985YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800986#line 137 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100987{
David Gibsona4da2e32007-12-18 15:06:42 +1100988 DPRINT("PropNodeName: %s\n", yytext);
John Bonesio658f29a2010-11-17 15:28:20 -0800989 yylval.propnodename = xstrdup(yytext);
David Gibsona4da2e32007-12-18 15:06:42 +1100990 BEGIN_DEFAULT();
991 return DT_PROPNODENAME;
992 }
993 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -0800994case 12:
David Gibsoned95d742008-08-07 12:24:17 +1000995YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -0800996#line 144 "dtc-lexer.l"
David Gibsoned95d742008-08-07 12:24:17 +1000997{
David Gibsoned95d742008-08-07 12:24:17 +1000998 DPRINT("Binary Include\n");
999 return DT_INCBIN;
1000 }
1001 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -08001002case 13:
1003/* rule 13 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001004YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -08001005#line 149 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001006/* eat whitespace */
1007 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -08001008case 14:
1009/* rule 14 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001010YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -08001011#line 150 "dtc-lexer.l"
David Gibsoned95d742008-08-07 12:24:17 +10001012/* eat C-style comments */
David Gibsona4da2e32007-12-18 15:06:42 +11001013 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -08001014case 15:
1015/* rule 15 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001016YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -08001017#line 151 "dtc-lexer.l"
David Gibsoned95d742008-08-07 12:24:17 +10001018/* eat C++-style comments */
David Gibsona4da2e32007-12-18 15:06:42 +11001019 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -08001020case 16:
David Gibsona4da2e32007-12-18 15:06:42 +11001021YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -08001022#line 153 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001023{
David Gibsona4da2e32007-12-18 15:06:42 +11001024 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
John Bonesio658f29a2010-11-17 15:28:20 -08001038case 17:
David Gibsona4da2e32007-12-18 15:06:42 +11001039YY_RULE_SETUP
John Bonesio658f29a2010-11-17 15:28:20 -08001040#line 168 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001041ECHO;
1042 YY_BREAK
John Bonesio658f29a2010-11-17 15:28:20 -08001043#line 1044 "dtc-lexer.lex.c"
David Gibsona4da2e32007-12-18 15:06:42 +11001044
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;
1049
1050 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1051 *yy_cp = (yy_hold_char);
1052 YY_RESTORE_YY_MORE_OFFSET
1053
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 }
1069
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;
1080
1081 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1082
1083 yy_current_state = yy_get_previous_state( );
1084
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 */
1093
1094 yy_next_state = yy_try_NUL_trans( yy_current_state );
1095
1096 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1097
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 }
1105
1106 else
1107 {
John Bonesio658f29a2010-11-17 15:28:20 -08001108 yy_cp = (yy_last_accepting_cpos);
1109 yy_current_state = (yy_last_accepting_state);
David Gibsona4da2e32007-12-18 15:06:42 +11001110 goto yy_find_action;
1111 }
1112 }
1113
1114 else switch ( yy_get_next_buffer( ) )
1115 {
1116 case EOB_ACT_END_OF_FILE:
1117 {
1118 (yy_did_buffer_switch_on_eof) = 0;
1119
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;
1132
1133 yy_act = YY_STATE_EOF(YY_START);
1134 goto do_action;
1135 }
1136
1137 else
1138 {
1139 if ( ! (yy_did_buffer_switch_on_eof) )
1140 YY_NEW_FILE;
1141 }
1142 break;
1143 }
1144
1145 case EOB_ACT_CONTINUE_SCAN:
1146 (yy_c_buf_p) =
1147 (yytext_ptr) + yy_amount_of_matched_text;
1148
1149 yy_current_state = yy_get_previous_state( );
1150
1151 yy_cp = (yy_c_buf_p);
1152 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1153 goto yy_match;
1154
1155 case EOB_ACT_LAST_MATCH:
1156 (yy_c_buf_p) =
1157 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1158
1159 yy_current_state = yy_get_previous_state( );
1160
1161 yy_cp = (yy_c_buf_p);
1162 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1163 goto yy_find_action;
1164 }
1165 break;
1166 }
1167
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 */
1174
1175/* yy_get_next_buffer - try to read in a new buffer
1176 *
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 */
1182static int yy_get_next_buffer (void)
1183{
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;
1188
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" );
1192
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 }
1202
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 }
1211
1212 /* Try to read more data. */
1213
1214 /* First move last chars to start of buffer. */
1215 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1216
1217 for ( i = 0; i < number_to_move; ++i )
1218 *(dest++) = *(source++);
1219
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;
1225
1226 else
1227 {
1228 int num_to_read =
1229 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1230
1231 while ( num_to_read <= 0 )
1232 { /* Not enough room in the buffer - grow it. */
1233
1234 /* just a shorter name for the current buffer */
1235 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1236
1237 int yy_c_buf_p_offset =
1238 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1239
1240 if ( b->yy_is_our_buffer )
1241 {
1242 int new_size = b->yy_buf_size * 2;
1243
1244 if ( new_size <= 0 )
1245 b->yy_buf_size += b->yy_buf_size / 8;
1246 else
1247 b->yy_buf_size *= 2;
1248
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;
1256
1257 if ( ! b->yy_ch_buf )
1258 YY_FATAL_ERROR(
1259 "fatal error - scanner input buffer overflow" );
1260
1261 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1262
1263 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1264 number_to_move - 1;
1265
1266 }
1267
1268 if ( num_to_read > YY_READ_BUF_SIZE )
1269 num_to_read = YY_READ_BUF_SIZE;
1270
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 );
1274
1275 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1276 }
1277
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 }
1285
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 }
1293
1294 else
1295 ret_val = EOB_ACT_CONTINUE_SCAN;
1296
David Gibsoned95d742008-08-07 12:24:17 +10001297 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 }
1304
David Gibsona4da2e32007-12-18 15:06:42 +11001305 (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;
1308
1309 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1310
1311 return ret_val;
1312}
1313
1314/* yy_get_previous_state - get the state just before the EOB char was reached */
1315
1316 static yy_state_type yy_get_previous_state (void)
1317{
1318 register yy_state_type yy_current_state;
1319 register char *yy_cp;
1320
1321 yy_current_state = (yy_start);
1322
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];
John Bonesio658f29a2010-11-17 15:28:20 -08001334 if ( yy_current_state >= 94 )
David Gibsona4da2e32007-12-18 15:06:42 +11001335 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 }
1339
1340 return yy_current_state;
1341}
1342
1343/* yy_try_NUL_trans - try to make a transition on the NUL character
1344 *
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 )
1349{
1350 register int yy_is_jam;
1351 register char *yy_cp = (yy_c_buf_p);
1352
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];
John Bonesio658f29a2010-11-17 15:28:20 -08001362 if ( yy_current_state >= 94 )
David Gibsona4da2e32007-12-18 15:06:42 +11001363 yy_c = yy_meta[(unsigned int) yy_c];
1364 }
1365 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
John Bonesio658f29a2010-11-17 15:28:20 -08001366 yy_is_jam = (yy_current_state == 93);
David Gibsona4da2e32007-12-18 15:06:42 +11001367
1368 return yy_is_jam ? 0 : yy_current_state;
1369}
1370
1371#ifndef YY_NO_INPUT
1372#ifdef __cplusplus
1373 static int yyinput (void)
1374#else
1375 static int input (void)
1376#endif
1377
1378{
1379 int c;
1380
1381 *(yy_c_buf_p) = (yy_hold_char);
1382
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';
1392
1393 else
1394 { /* need more input */
1395 int offset = (yy_c_buf_p) - (yytext_ptr);
1396 ++(yy_c_buf_p);
1397
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 */
1410
1411 /* Reset buffer status. */
1412 yyrestart(yyin );
1413
1414 /*FALLTHROUGH*/
1415
1416 case EOB_ACT_END_OF_FILE:
1417 {
1418 if ( yywrap( ) )
1419 return EOF;
1420
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 }
1429
1430 case EOB_ACT_CONTINUE_SCAN:
1431 (yy_c_buf_p) = (yytext_ptr) + offset;
1432 break;
1433 }
1434 }
1435 }
1436
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);
1440
David Gibsona4da2e32007-12-18 15:06:42 +11001441 return c;
1442}
1443#endif /* ifndef YY_NO_INPUT */
1444
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 )
1451{
1452
1453 if ( ! YY_CURRENT_BUFFER ){
1454 yyensure_buffer_stack ();
1455 YY_CURRENT_BUFFER_LVALUE =
1456 yy_create_buffer(yyin,YY_BUF_SIZE );
1457 }
1458
1459 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1460 yy_load_buffer_state( );
1461}
1462
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 )
1468{
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;
1478
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 }
1486
1487 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1488 yy_load_buffer_state( );
1489
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;
1496}
1497
1498static void yy_load_buffer_state (void)
1499{
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);
1504}
1505
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 )
1513{
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()" );
1519
1520 b->yy_buf_size = size;
1521
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()" );
1528
1529 b->yy_is_our_buffer = 1;
1530
1531 yy_init_buffer(b,file );
1532
1533 return b;
1534}
1535
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 )
1541{
1542
1543 if ( ! b )
1544 return;
1545
1546 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1547 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1548
1549 if ( b->yy_is_our_buffer )
1550 yyfree((void *) b->yy_ch_buf );
1551
1552 yyfree((void *) b );
1553}
1554
David Gibsona4da2e32007-12-18 15:06:42 +11001555/* 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 )
1560
1561{
1562 int oerrno = errno;
1563
1564 yy_flush_buffer(b );
1565
1566 b->yy_input_file = file;
1567 b->yy_fill_buffer = 1;
1568
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 }
1577
John Bonesio658f29a2010-11-17 15:28:20 -08001578 b->yy_is_interactive = 0;
David Gibsona4da2e32007-12-18 15:06:42 +11001579
1580 errno = oerrno;
1581}
1582
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 )
1588{
1589 if ( ! b )
1590 return;
1591
1592 b->yy_n_chars = 0;
1593
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;
1600
1601 b->yy_buf_pos = &b->yy_ch_buf[0];
1602
1603 b->yy_at_bol = 1;
1604 b->yy_buffer_status = YY_BUFFER_NEW;
1605
1606 if ( b == YY_CURRENT_BUFFER )
1607 yy_load_buffer_state( );
1608}
1609
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 */
1616void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1617{
1618 if (new_buffer == NULL)
1619 return;
1620
1621 yyensure_buffer_stack();
1622
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 }
1631
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;
1636
1637 /* copied from yy_switch_to_buffer. */
1638 yy_load_buffer_state( );
1639 (yy_did_buffer_switch_on_eof) = 1;
1640}
1641
1642/** Removes and deletes the top of the stack, if present.
1643 * The next element becomes the new top.
1644 *
1645 */
1646void yypop_buffer_state (void)
1647{
1648 if (!YY_CURRENT_BUFFER)
1649 return;
1650
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);
1655
1656 if (YY_CURRENT_BUFFER) {
1657 yy_load_buffer_state( );
1658 (yy_did_buffer_switch_on_eof) = 1;
1659 }
1660}
1661
1662/* Allocates the stack if it does not exist.
1663 * Guarantees space for at least one push.
1664 */
1665static void yyensure_buffer_stack (void)
1666{
1667 int num_to_alloc;
1668
1669 if (!(yy_buffer_stack)) {
1670
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 );
David Gibsoned95d742008-08-07 12:24:17 +10001679 if ( ! (yy_buffer_stack) )
1680 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1681
David Gibsona4da2e32007-12-18 15:06:42 +11001682 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 }
1688
1689 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1690
1691 /* Increase the buffer to prepare for a possible push. */
1692 int grow_size = 8 /* arbitrary grow size */;
1693
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 );
David Gibsoned95d742008-08-07 12:24:17 +10001699 if ( ! (yy_buffer_stack) )
1700 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
David Gibsona4da2e32007-12-18 15:06:42 +11001701
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 }
1706}
1707
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 */
1714YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1715{
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;
1723
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()" );
1727
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;
1737
1738 yy_switch_to_buffer(b );
1739
1740 return b;
1741}
1742
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 */
1751YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1752{
1753
1754 return yy_scan_bytes(yystr,strlen(yystr) );
1755}
1756
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.
Josh Triplett23c4ace2009-10-16 15:52:06 -07001759 * @param yybytes the byte buffer to scan
1760 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
David Gibsona4da2e32007-12-18 15:06:42 +11001761 *
1762 * @return the newly allocated buffer state object.
1763 */
1764YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1765{
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()" );
1776
1777 for ( i = 0; i < _yybytes_len; ++i )
1778 buf[i] = yybytes[i];
1779
1780 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1781
1782 b = yy_scan_buffer(buf,n );
1783 if ( ! b )
1784 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1785
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;
1790
1791 return b;
1792}
1793
1794#ifndef YY_EXIT_FAILURE
1795#define YY_EXIT_FAILURE 2
1796#endif
1797
1798static void yy_fatal_error (yyconst char* msg )
1799{
1800 (void) fprintf( stderr, "%s\n", msg );
1801 exit( YY_EXIT_FAILURE );
1802}
1803
1804/* Redefine yyless() so it works in section 3 code. */
1805
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 )
1820
1821/* Accessor methods (get/set functions) to struct members. */
1822
1823/** Get the current line number.
1824 *
1825 */
1826int yyget_lineno (void)
1827{
1828
1829 return yylineno;
1830}
1831
1832/** Get the input stream.
1833 *
1834 */
1835FILE *yyget_in (void)
1836{
1837 return yyin;
1838}
1839
1840/** Get the output stream.
1841 *
1842 */
1843FILE *yyget_out (void)
1844{
1845 return yyout;
1846}
1847
1848/** Get the length of the current token.
1849 *
1850 */
1851int yyget_leng (void)
1852{
1853 return yyleng;
1854}
1855
1856/** Get the current token.
1857 *
1858 */
1859
1860char *yyget_text (void)
1861{
1862 return yytext;
1863}
1864
1865/** Set the current line number.
1866 * @param line_number
1867 *
1868 */
1869void yyset_lineno (int line_number )
1870{
1871
1872 yylineno = line_number;
1873}
1874
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 */
1881void yyset_in (FILE * in_str )
1882{
1883 yyin = in_str ;
1884}
1885
1886void yyset_out (FILE * out_str )
1887{
1888 yyout = out_str ;
1889}
1890
1891int yyget_debug (void)
1892{
1893 return yy_flex_debug;
1894}
1895
1896void yyset_debug (int bdebug )
1897{
1898 yy_flex_debug = bdebug ;
1899}
1900
1901static int yy_init_globals (void)
1902{
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 */
1906
David Gibsona4da2e32007-12-18 15:06:42 +11001907 (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;
1913
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
1922
1923 /* For future reference: Set errno on error, since we are called by
1924 * yylex_init()
1925 */
1926 return 0;
1927}
1928
1929/* yylex_destroy is for both reentrant and non-reentrant scanners. */
1930int yylex_destroy (void)
1931{
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 }
1939
1940 /* Destroy the stack itself. */
1941 yyfree((yy_buffer_stack) );
1942 (yy_buffer_stack) = NULL;
1943
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( );
1947
1948 return 0;
1949}
1950
1951/*
1952 * Internal utility routines.
1953 */
1954
1955#ifndef yytext_ptr
1956static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1957{
1958 register int i;
1959 for ( i = 0; i < n; ++i )
1960 s1[i] = s2[i];
1961}
1962#endif
1963
1964#ifdef YY_NEED_STRLEN
1965static int yy_flex_strlen (yyconst char * s )
1966{
1967 register int n;
1968 for ( n = 0; s[n]; ++n )
1969 ;
1970
1971 return n;
1972}
1973#endif
1974
1975void *yyalloc (yy_size_t size )
1976{
1977 return (void *) malloc( size );
1978}
1979
1980void *yyrealloc (void * ptr, yy_size_t size )
1981{
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 );
1990}
1991
1992void yyfree (void * ptr )
1993{
1994 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1995}
1996
1997#define YYTABLES_NAME "yytables"
1998
John Bonesio658f29a2010-11-17 15:28:20 -08001999#line 168 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11002000
2001
2002
David Gibsoned95d742008-08-07 12:24:17 +10002003static void push_input_file(const char *filename)
David Gibsona4da2e32007-12-18 15:06:42 +11002004{
David Gibsoned95d742008-08-07 12:24:17 +10002005 assert(filename);
2006
John Bonesio658f29a2010-11-17 15:28:20 -08002007 srcfile_push(filename);
David Gibsoned95d742008-08-07 12:24:17 +10002008
John Bonesio658f29a2010-11-17 15:28:20 -08002009 yyin = current_srcfile->f;
David Gibsona4da2e32007-12-18 15:06:42 +11002010
John Bonesio658f29a2010-11-17 15:28:20 -08002011 yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
David Gibsona4da2e32007-12-18 15:06:42 +11002012}
2013
2014
David Gibsoned95d742008-08-07 12:24:17 +10002015static int pop_input_file(void)
David Gibsona4da2e32007-12-18 15:06:42 +11002016{
John Bonesio658f29a2010-11-17 15:28:20 -08002017 if (srcfile_pop() == 0)
David Gibsona4da2e32007-12-18 15:06:42 +11002018 return 0;
2019
John Bonesio658f29a2010-11-17 15:28:20 -08002020 yypop_buffer_state();
2021 yyin = current_srcfile->f;
David Gibsona4da2e32007-12-18 15:06:42 +11002022
David Gibsona4da2e32007-12-18 15:06:42 +11002023 return 1;
2024}
2025