blob: 2d30f41778b7270b074798b4439952dca28d9c53 [file] [log] [blame]
Stephen Warrencd296722012-09-28 21:25:59 +00001#line 2 "dtc-lexer.lex.c"
David Gibsona4da2e32007-12-18 15:06:42 +11002
Stephen Warrencd296722012-09-28 21:25:59 +00003#line 4 "dtc-lexer.lex.c"
David Gibsona4da2e32007-12-18 15:06:42 +11004
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
Stephen Warrencd296722012-09-28 21:25:59 +000087#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
Stephen Warrencd296722012-09-28 21:25:59 +0000145#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
Stephen Warrencd296722012-09-28 21:25:59 +0000153#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
Stephen Warrencd296722012-09-28 21:25:59 +0000375#define YY_NUM_RULES 30
376#define YY_END_OF_BUFFER 31
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 };
Stephen Warrencd296722012-09-28 21:25:59 +0000384static yyconst flex_int16_t yy_accept[161] =
David Gibsona4da2e32007-12-18 15:06:42 +1100385 { 0,
386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Stephen Warrencd296722012-09-28 21:25:59 +0000387 31, 29, 18, 18, 29, 29, 29, 29, 29, 29,
388 29, 29, 29, 29, 29, 29, 29, 29, 15, 16,
389 16, 29, 16, 10, 10, 18, 26, 0, 3, 0,
390 27, 12, 0, 0, 11, 0, 0, 0, 0, 0,
391 0, 0, 21, 23, 25, 24, 22, 0, 9, 28,
392 0, 0, 0, 14, 14, 16, 16, 16, 10, 10,
393 10, 0, 12, 0, 11, 0, 0, 0, 20, 0,
394 0, 0, 0, 0, 0, 0, 0, 16, 10, 10,
395 10, 0, 19, 0, 0, 0, 0, 0, 0, 0,
John Bonesio658f29a2010-11-17 15:28:20 -0800396
Stephen Warrencd296722012-09-28 21:25:59 +0000397 0, 0, 16, 13, 0, 0, 0, 0, 0, 0,
398 0, 0, 0, 16, 6, 0, 0, 0, 0, 0,
399 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
400 4, 17, 0, 0, 2, 0, 0, 0, 0, 0,
401 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
402 0, 0, 5, 8, 0, 0, 0, 0, 7, 0
David Gibsona4da2e32007-12-18 15:06:42 +1100403 } ;
404
405static yyconst flex_int32_t yy_ec[256] =
406 { 0,
407 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
Grant Likely706b78f2013-06-13 12:57:44 +0100408 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
David Gibsona4da2e32007-12-18 15:06:42 +1100409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Grant Likely706b78f2013-06-13 12:57:44 +0100410 1, 2, 5, 6, 7, 1, 1, 8, 9, 1,
411 1, 10, 11, 11, 12, 11, 13, 14, 15, 16,
412 16, 16, 16, 16, 16, 16, 16, 17, 1, 18,
413 19, 20, 11, 11, 21, 21, 21, 21, 21, 21,
414 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
415 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
416 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
David Gibsona4da2e32007-12-18 15:06:42 +1100417
Grant Likely706b78f2013-06-13 12:57:44 +0100418 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
419 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
420 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
David Gibsona4da2e32007-12-18 15:06:42 +1100421 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
433 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434 1, 1, 1, 1, 1
435 } ;
436
Grant Likely706b78f2013-06-13 12:57:44 +0100437static yyconst flex_int32_t yy_meta[47] =
David Gibsona4da2e32007-12-18 15:06:42 +1100438 { 0,
Grant Likely706b78f2013-06-13 12:57:44 +0100439 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
440 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
441 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
442 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
443 8, 8, 8, 3, 1, 1
David Gibsona4da2e32007-12-18 15:06:42 +1100444 } ;
445
Stephen Warrencd296722012-09-28 21:25:59 +0000446static yyconst flex_int16_t yy_base[175] =
David Gibsona4da2e32007-12-18 15:06:42 +1100447 { 0,
Grant Likely706b78f2013-06-13 12:57:44 +0100448 0, 385, 378, 40, 41, 383, 72, 382, 34, 44,
449 388, 393, 61, 117, 368, 116, 115, 115, 115, 48,
450 367, 107, 368, 339, 127, 120, 0, 147, 393, 0,
451 127, 0, 133, 156, 168, 153, 393, 125, 393, 380,
452 393, 0, 369, 127, 393, 160, 371, 377, 347, 21,
453 343, 346, 393, 393, 393, 393, 393, 359, 393, 393,
454 183, 343, 339, 393, 356, 0, 183, 340, 187, 348,
455 347, 0, 0, 0, 178, 359, 195, 365, 354, 326,
456 332, 325, 334, 328, 204, 326, 331, 324, 393, 335,
457 150, 311, 343, 342, 315, 322, 340, 179, 313, 207,
David Gibsona4da2e32007-12-18 15:06:42 +1100458
Grant Likely706b78f2013-06-13 12:57:44 +0100459 319, 316, 317, 393, 337, 333, 305, 302, 311, 301,
460 310, 190, 338, 337, 393, 307, 322, 301, 305, 277,
461 208, 311, 307, 278, 271, 270, 248, 246, 213, 130,
462 393, 393, 263, 235, 207, 221, 218, 229, 213, 213,
463 206, 234, 218, 210, 208, 193, 219, 393, 223, 204,
464 176, 157, 393, 393, 120, 106, 97, 119, 393, 393,
465 245, 251, 259, 263, 267, 273, 280, 284, 292, 300,
466 304, 310, 318, 326
David Gibsona4da2e32007-12-18 15:06:42 +1100467 } ;
468
Stephen Warrencd296722012-09-28 21:25:59 +0000469static yyconst flex_int16_t yy_def[175] =
David Gibsona4da2e32007-12-18 15:06:42 +1100470 { 0,
Stephen Warrencd296722012-09-28 21:25:59 +0000471 160, 1, 1, 1, 1, 5, 160, 7, 1, 1,
472 160, 160, 160, 160, 160, 161, 162, 163, 160, 160,
473 160, 160, 164, 160, 160, 160, 165, 164, 160, 166,
474 167, 166, 166, 160, 160, 160, 160, 161, 160, 161,
475 160, 168, 160, 163, 160, 163, 169, 170, 160, 160,
476 160, 160, 160, 160, 160, 160, 160, 164, 160, 160,
477 160, 160, 160, 160, 164, 166, 167, 166, 160, 160,
478 160, 171, 168, 172, 163, 169, 169, 170, 160, 160,
479 160, 160, 160, 160, 160, 160, 160, 166, 160, 160,
480 171, 172, 160, 160, 160, 160, 160, 160, 160, 160,
David Gibsona4da2e32007-12-18 15:06:42 +1100481
Stephen Warrencd296722012-09-28 21:25:59 +0000482 160, 160, 166, 160, 160, 160, 160, 160, 160, 160,
483 160, 173, 160, 166, 160, 160, 160, 160, 160, 160,
484 173, 160, 173, 160, 160, 160, 160, 160, 160, 160,
485 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
486 160, 160, 174, 160, 160, 160, 174, 160, 174, 160,
487 160, 160, 160, 160, 160, 160, 160, 160, 160, 0,
488 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
489 160, 160, 160, 160
David Gibsona4da2e32007-12-18 15:06:42 +1100490 } ;
491
Grant Likely706b78f2013-06-13 12:57:44 +0100492static yyconst flex_int16_t yy_nxt[440] =
David Gibsona4da2e32007-12-18 15:06:42 +1100493 { 0,
Grant Likely706b78f2013-06-13 12:57:44 +0100494 12, 13, 14, 13, 15, 16, 12, 17, 18, 12,
495 12, 12, 19, 12, 12, 12, 12, 20, 21, 22,
496 23, 23, 23, 23, 23, 12, 12, 23, 23, 23,
Stephen Warrencd296722012-09-28 21:25:59 +0000497 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
Grant Likely706b78f2013-06-13 12:57:44 +0100498 23, 23, 23, 12, 24, 12, 25, 34, 35, 35,
499 25, 81, 26, 26, 27, 27, 27, 34, 35, 35,
500 82, 28, 36, 36, 36, 53, 54, 29, 28, 28,
501 28, 28, 12, 13, 14, 13, 15, 16, 30, 17,
502 18, 30, 30, 30, 26, 30, 30, 30, 12, 20,
503 21, 22, 31, 31, 31, 31, 31, 32, 12, 31,
David Gibsona4da2e32007-12-18 15:06:42 +1100504
Stephen Warrencd296722012-09-28 21:25:59 +0000505 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
Grant Likely706b78f2013-06-13 12:57:44 +0100506 31, 31, 31, 31, 31, 12, 24, 12, 36, 36,
507 36, 39, 41, 45, 47, 56, 57, 48, 61, 47,
508 39, 159, 48, 66, 61, 45, 66, 66, 66, 158,
509 46, 40, 49, 59, 50, 157, 51, 49, 52, 50,
510 40, 63, 46, 52, 36, 36, 36, 156, 43, 62,
511 65, 65, 65, 59, 136, 68, 137, 65, 75, 69,
512 69, 69, 70, 71, 65, 65, 65, 65, 70, 71,
513 72, 69, 69, 69, 61, 46, 45, 155, 154, 66,
514 70, 71, 66, 66, 66, 122, 85, 85, 85, 59,
David Gibsona4da2e32007-12-18 15:06:42 +1100515
Grant Likely706b78f2013-06-13 12:57:44 +0100516 69, 69, 69, 46, 77, 100, 109, 93, 100, 70,
517 71, 110, 112, 122, 129, 123, 153, 85, 85, 85,
518 135, 135, 135, 148, 148, 160, 135, 135, 135, 152,
519 142, 142, 142, 123, 143, 142, 142, 142, 151, 143,
520 150, 146, 145, 149, 149, 38, 38, 38, 38, 38,
521 38, 38, 38, 42, 144, 141, 140, 42, 42, 44,
522 44, 44, 44, 44, 44, 44, 44, 58, 58, 58,
523 58, 64, 139, 64, 66, 138, 134, 66, 133, 66,
524 66, 67, 132, 131, 67, 67, 67, 67, 73, 130,
525 73, 73, 76, 76, 76, 76, 76, 76, 76, 76,
Stephen Warrencd296722012-09-28 21:25:59 +0000526
Grant Likely706b78f2013-06-13 12:57:44 +0100527 78, 78, 78, 78, 78, 78, 78, 78, 91, 160,
528 91, 92, 129, 92, 92, 128, 92, 92, 121, 121,
529 121, 121, 121, 121, 121, 121, 147, 147, 147, 147,
530 147, 147, 147, 147, 127, 126, 125, 124, 61, 61,
531 120, 119, 118, 117, 116, 115, 47, 114, 110, 113,
532 111, 108, 107, 106, 48, 105, 104, 89, 103, 102,
533 101, 99, 98, 97, 96, 95, 94, 79, 77, 90,
534 89, 88, 59, 87, 86, 59, 84, 83, 80, 79,
535 77, 74, 160, 60, 59, 55, 37, 160, 33, 25,
536 26, 25, 11, 160, 160, 160, 160, 160, 160, 160,
Stephen Warrencd296722012-09-28 21:25:59 +0000537
538 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
539 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
540 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
Grant Likely706b78f2013-06-13 12:57:44 +0100541 160, 160, 160, 160, 160, 160, 160, 160, 160
David Gibsona4da2e32007-12-18 15:06:42 +1100542 } ;
543
Grant Likely706b78f2013-06-13 12:57:44 +0100544static yyconst flex_int16_t yy_chk[440] =
David Gibsona4da2e32007-12-18 15:06:42 +1100545 { 0,
546 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
547 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
548 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Stephen Warrencd296722012-09-28 21:25:59 +0000549 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Grant Likely706b78f2013-06-13 12:57:44 +0100550 1, 1, 1, 1, 1, 1, 4, 9, 9, 9,
551 10, 50, 4, 5, 5, 5, 5, 10, 10, 10,
552 50, 5, 13, 13, 13, 20, 20, 5, 5, 5,
553 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
David Gibsoned95d742008-08-07 12:24:17 +1000554 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
David Gibsona4da2e32007-12-18 15:06:42 +1100555 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
David Gibsona4da2e32007-12-18 15:06:42 +1100556
Stephen Warrencd296722012-09-28 21:25:59 +0000557 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
Grant Likely706b78f2013-06-13 12:57:44 +0100558 7, 7, 7, 7, 7, 7, 7, 7, 14, 14,
559 14, 16, 17, 18, 19, 22, 22, 19, 25, 26,
560 38, 158, 26, 31, 33, 44, 31, 31, 31, 157,
561 18, 16, 19, 31, 19, 156, 19, 26, 19, 26,
562 38, 26, 44, 26, 36, 36, 36, 155, 17, 25,
563 28, 28, 28, 28, 130, 33, 130, 28, 46, 34,
564 34, 34, 91, 91, 28, 28, 28, 28, 34, 34,
565 34, 35, 35, 35, 61, 46, 75, 152, 151, 67,
566 35, 35, 67, 67, 67, 112, 61, 61, 61, 67,
David Gibsona4da2e32007-12-18 15:06:42 +1100567
Grant Likely706b78f2013-06-13 12:57:44 +0100568 69, 69, 69, 75, 77, 85, 98, 77, 100, 69,
569 69, 98, 100, 121, 129, 112, 150, 85, 85, 85,
570 135, 135, 135, 143, 147, 149, 129, 129, 129, 146,
571 138, 138, 138, 121, 138, 142, 142, 142, 145, 142,
572 144, 141, 140, 143, 147, 161, 161, 161, 161, 161,
573 161, 161, 161, 162, 139, 137, 136, 162, 162, 163,
574 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
575 164, 165, 134, 165, 166, 133, 128, 166, 127, 166,
576 166, 167, 126, 125, 167, 167, 167, 167, 168, 124,
577 168, 168, 169, 169, 169, 169, 169, 169, 169, 169,
Stephen Warrencd296722012-09-28 21:25:59 +0000578
Grant Likely706b78f2013-06-13 12:57:44 +0100579 170, 170, 170, 170, 170, 170, 170, 170, 171, 123,
580 171, 172, 122, 172, 172, 120, 172, 172, 173, 173,
581 173, 173, 173, 173, 173, 173, 174, 174, 174, 174,
582 174, 174, 174, 174, 119, 118, 117, 116, 114, 113,
583 111, 110, 109, 108, 107, 106, 105, 103, 102, 101,
584 99, 97, 96, 95, 94, 93, 92, 90, 88, 87,
585 86, 84, 83, 82, 81, 80, 79, 78, 76, 71,
586 70, 68, 65, 63, 62, 58, 52, 51, 49, 48,
587 47, 43, 40, 24, 23, 21, 15, 11, 8, 6,
588 3, 2, 160, 160, 160, 160, 160, 160, 160, 160,
Stephen Warrencd296722012-09-28 21:25:59 +0000589
590 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
591 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
592 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
Grant Likely706b78f2013-06-13 12:57:44 +0100593 160, 160, 160, 160, 160, 160, 160, 160, 160
David Gibsona4da2e32007-12-18 15:06:42 +1100594 } ;
595
David Gibsona4da2e32007-12-18 15:06:42 +1100596static yy_state_type yy_last_accepting_state;
597static char *yy_last_accepting_cpos;
598
599extern int yy_flex_debug;
600int yy_flex_debug = 0;
601
602/* The intent behind this definition is that it'll catch
603 * any uses of REJECT which flex missed.
604 */
605#define REJECT reject_used_but_not_detected
606#define yymore() yymore_used_but_not_detected
607#define YY_MORE_ADJ 0
608#define YY_RESTORE_YY_MORE_OFFSET
609char *yytext;
Stephen Warrencd296722012-09-28 21:25:59 +0000610#line 1 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100611/*
612 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
613 *
614 *
615 * This program is free software; you can redistribute it and/or
616 * modify it under the terms of the GNU General Public License as
617 * published by the Free Software Foundation; either version 2 of the
618 * License, or (at your option) any later version.
619 *
620 * This program is distributed in the hope that it will be useful,
621 * but WITHOUT ANY WARRANTY; without even the implied warranty of
622 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
623 * General Public License for more details.
624 *
625 * You should have received a copy of the GNU General Public License
626 * along with this program; if not, write to the Free Software
627 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
628 * USA
629 */
Josh Triplett23c4ace2009-10-16 15:52:06 -0700630#define YY_NO_INPUT 1
David Gibsona4da2e32007-12-18 15:06:42 +1100631
Stephen Warrencd296722012-09-28 21:25:59 +0000632
633
634
635#line 38 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100636#include "dtc.h"
637#include "srcpos.h"
638#include "dtc-parser.tab.h"
639
John Bonesio658f29a2010-11-17 15:28:20 -0800640YYLTYPE yylloc;
641
642/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
643#define YY_USER_ACTION \
644 { \
645 srcpos_update(&yylloc, yytext, yyleng); \
646 }
David Gibsona4da2e32007-12-18 15:06:42 +1100647
648/*#define LEXDEBUG 1*/
649
650#ifdef LEXDEBUG
651#define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
652#else
653#define DPRINT(fmt, ...) do { } while (0)
654#endif
655
John Bonesio658f29a2010-11-17 15:28:20 -0800656static int dts_version = 1;
David Gibsona4da2e32007-12-18 15:06:42 +1100657
John Bonesio658f29a2010-11-17 15:28:20 -0800658#define BEGIN_DEFAULT() DPRINT("<V1>\n"); \
David Gibsona4da2e32007-12-18 15:06:42 +1100659 BEGIN(V1); \
David Gibsoned95d742008-08-07 12:24:17 +1000660
661static void push_input_file(const char *filename);
662static int pop_input_file(void);
Stephen Warrencd296722012-09-28 21:25:59 +0000663#line 664 "dtc-lexer.lex.c"
David Gibsona4da2e32007-12-18 15:06:42 +1100664
665#define INITIAL 0
666#define INCLUDE 1
667#define BYTESTRING 2
668#define PROPNODENAME 3
669#define V1 4
670
671#ifndef YY_NO_UNISTD_H
672/* Special case for "unistd.h", since it is non-ANSI. We include it way
673 * down here because we want the user's section 1 to have been scanned first.
674 * The user has a chance to override it with an option.
675 */
676#include <unistd.h>
677#endif
678
679#ifndef YY_EXTRA_TYPE
680#define YY_EXTRA_TYPE void *
681#endif
682
683static int yy_init_globals (void );
684
Josh Triplett23c4ace2009-10-16 15:52:06 -0700685/* Accessor methods to globals.
686 These are made visible to non-reentrant scanners for convenience. */
687
688int yylex_destroy (void );
689
690int yyget_debug (void );
691
692void yyset_debug (int debug_flag );
693
694YY_EXTRA_TYPE yyget_extra (void );
695
696void yyset_extra (YY_EXTRA_TYPE user_defined );
697
698FILE *yyget_in (void );
699
700void yyset_in (FILE * in_str );
701
702FILE *yyget_out (void );
703
704void yyset_out (FILE * out_str );
705
706int yyget_leng (void );
707
708char *yyget_text (void );
709
710int yyget_lineno (void );
711
712void yyset_lineno (int line_number );
713
David Gibsona4da2e32007-12-18 15:06:42 +1100714/* Macros after this point can all be overridden by user definitions in
715 * section 1.
716 */
717
718#ifndef YY_SKIP_YYWRAP
719#ifdef __cplusplus
720extern "C" int yywrap (void );
721#else
722extern int yywrap (void );
723#endif
724#endif
725
726#ifndef yytext_ptr
727static void yy_flex_strncpy (char *,yyconst char *,int );
728#endif
729
730#ifdef YY_NEED_STRLEN
731static int yy_flex_strlen (yyconst char * );
732#endif
733
734#ifndef YY_NO_INPUT
735
736#ifdef __cplusplus
737static int yyinput (void );
738#else
739static int input (void );
740#endif
741
742#endif
743
744/* Amount of stuff to slurp up with each read. */
745#ifndef YY_READ_BUF_SIZE
Stephen Warrencd296722012-09-28 21:25:59 +0000746#ifdef __ia64__
747/* On IA-64, the buffer size is 16k, not 8k */
748#define YY_READ_BUF_SIZE 16384
749#else
David Gibsona4da2e32007-12-18 15:06:42 +1100750#define YY_READ_BUF_SIZE 8192
Stephen Warrencd296722012-09-28 21:25:59 +0000751#endif /* __ia64__ */
David Gibsona4da2e32007-12-18 15:06:42 +1100752#endif
753
754/* Copy whatever the last rule matched to the standard output. */
755#ifndef ECHO
756/* This used to be an fputs(), but since the string might contain NUL's,
757 * we now use fwrite().
758 */
Josh Triplett23c4ace2009-10-16 15:52:06 -0700759#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
David Gibsona4da2e32007-12-18 15:06:42 +1100760#endif
761
762/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
763 * is returned in "result".
764 */
765#ifndef YY_INPUT
766#define YY_INPUT(buf,result,max_size) \
767 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
768 { \
769 int c = '*'; \
Stephen Warrencd296722012-09-28 21:25:59 +0000770 size_t n; \
David Gibsona4da2e32007-12-18 15:06:42 +1100771 for ( n = 0; n < max_size && \
772 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
773 buf[n] = (char) c; \
774 if ( c == '\n' ) \
775 buf[n++] = (char) c; \
776 if ( c == EOF && ferror( yyin ) ) \
777 YY_FATAL_ERROR( "input in flex scanner failed" ); \
778 result = n; \
779 } \
780 else \
781 { \
782 errno=0; \
783 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
784 { \
785 if( errno != EINTR) \
786 { \
787 YY_FATAL_ERROR( "input in flex scanner failed" ); \
788 break; \
789 } \
790 errno=0; \
791 clearerr(yyin); \
792 } \
793 }\
794\
795
796#endif
797
798/* No semi-colon after return; correct usage is to write "yyterminate();" -
799 * we don't want an extra ';' after the "return" because that will cause
800 * some compilers to complain about unreachable statements.
801 */
802#ifndef yyterminate
803#define yyterminate() return YY_NULL
804#endif
805
806/* Number of entries by which start-condition stack grows. */
807#ifndef YY_START_STACK_INCR
808#define YY_START_STACK_INCR 25
809#endif
810
811/* Report a fatal error. */
812#ifndef YY_FATAL_ERROR
813#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
814#endif
815
816/* end tables serialization structures and prototypes */
817
818/* Default declaration of generated scanner - a define so the user can
819 * easily add parameters.
820 */
821#ifndef YY_DECL
822#define YY_DECL_IS_OURS 1
823
824extern int yylex (void);
825
826#define YY_DECL int yylex (void)
827#endif /* !YY_DECL */
828
829/* Code executed at the beginning of each rule, after yytext and yyleng
830 * have been set up.
831 */
832#ifndef YY_USER_ACTION
833#define YY_USER_ACTION
834#endif
835
836/* Code executed at the end of each rule. */
837#ifndef YY_BREAK
838#define YY_BREAK break;
839#endif
840
841#define YY_RULE_SETUP \
Stephen Warrencd296722012-09-28 21:25:59 +0000842 if ( yyleng > 0 ) \
843 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
844 (yytext[yyleng - 1] == '\n'); \
David Gibsona4da2e32007-12-18 15:06:42 +1100845 YY_USER_ACTION
846
847/** The main scanner function which does all the work.
848 */
849YY_DECL
850{
851 register yy_state_type yy_current_state;
852 register char *yy_cp, *yy_bp;
853 register int yy_act;
854
Stephen Warrencd296722012-09-28 21:25:59 +0000855#line 67 "dtc-lexer.l"
856
857#line 858 "dtc-lexer.lex.c"
858
David Gibsona4da2e32007-12-18 15:06:42 +1100859 if ( !(yy_init) )
860 {
861 (yy_init) = 1;
862
863#ifdef YY_USER_INIT
864 YY_USER_INIT;
865#endif
866
867 if ( ! (yy_start) )
868 (yy_start) = 1; /* first start state */
869
870 if ( ! yyin )
871 yyin = stdin;
872
873 if ( ! yyout )
874 yyout = stdout;
875
876 if ( ! YY_CURRENT_BUFFER ) {
877 yyensure_buffer_stack ();
878 YY_CURRENT_BUFFER_LVALUE =
879 yy_create_buffer(yyin,YY_BUF_SIZE );
880 }
881
882 yy_load_buffer_state( );
883 }
884
885 while ( 1 ) /* loops until end-of-file is reached */
886 {
887 yy_cp = (yy_c_buf_p);
888
889 /* Support of yytext. */
890 *yy_cp = (yy_hold_char);
891
892 /* yy_bp points to the position in yy_ch_buf of the start of
893 * the current run.
894 */
895 yy_bp = yy_cp;
896
897 yy_current_state = (yy_start);
Stephen Warrencd296722012-09-28 21:25:59 +0000898 yy_current_state += YY_AT_BOL();
David Gibsona4da2e32007-12-18 15:06:42 +1100899yy_match:
900 do
901 {
902 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
903 if ( yy_accept[yy_current_state] )
904 {
905 (yy_last_accepting_state) = yy_current_state;
906 (yy_last_accepting_cpos) = yy_cp;
907 }
908 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
909 {
910 yy_current_state = (int) yy_def[yy_current_state];
Stephen Warrencd296722012-09-28 21:25:59 +0000911 if ( yy_current_state >= 161 )
David Gibsona4da2e32007-12-18 15:06:42 +1100912 yy_c = yy_meta[(unsigned int) yy_c];
913 }
914 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
915 ++yy_cp;
916 }
Stephen Warrencd296722012-09-28 21:25:59 +0000917 while ( yy_current_state != 160 );
John Bonesio658f29a2010-11-17 15:28:20 -0800918 yy_cp = (yy_last_accepting_cpos);
919 yy_current_state = (yy_last_accepting_state);
David Gibsona4da2e32007-12-18 15:06:42 +1100920
921yy_find_action:
922 yy_act = yy_accept[yy_current_state];
David Gibsona4da2e32007-12-18 15:06:42 +1100923
924 YY_DO_BEFORE_ACTION;
925
David Gibsona4da2e32007-12-18 15:06:42 +1100926do_action: /* This label is used only to access EOF actions. */
927
928 switch ( yy_act )
929 { /* beginning of action switch */
930 case 0: /* must back up */
931 /* undo the effects of YY_DO_BEFORE_ACTION */
932 *yy_cp = (yy_hold_char);
933 yy_cp = (yy_last_accepting_cpos);
934 yy_current_state = (yy_last_accepting_state);
935 goto yy_find_action;
936
937case 1:
David Gibsoned95d742008-08-07 12:24:17 +1000938/* rule 1 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +1100939YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +0000940#line 68 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100941{
David Gibsoned95d742008-08-07 12:24:17 +1000942 char *name = strchr(yytext, '\"') + 1;
943 yytext[yyleng-1] = '\0';
944 push_input_file(name);
David Gibsona4da2e32007-12-18 15:06:42 +1100945 }
946 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +0000947case 2:
948/* rule 2 can match eol */
949YY_RULE_SETUP
950#line 74 "dtc-lexer.l"
951{
952 char *line, *tmp, *fn;
953 /* skip text before line # */
954 line = yytext;
955 while (!isdigit(*line))
956 line++;
957 /* skip digits in line # */
958 tmp = line;
959 while (!isspace(*tmp))
960 tmp++;
961 /* "NULL"-terminate line # */
962 *tmp = '\0';
963 /* start of filename */
964 fn = strchr(tmp + 1, '"') + 1;
965 /* strip trailing " from filename */
966 tmp = strchr(fn, '"');
967 *tmp = 0;
968 /* -1 since #line is the number of the next line */
969 srcpos_set_line(xstrdup(fn), atoi(line) - 1);
970 }
971 YY_BREAK
David Gibsona4da2e32007-12-18 15:06:42 +1100972case YY_STATE_EOF(INITIAL):
973case YY_STATE_EOF(INCLUDE):
974case YY_STATE_EOF(BYTESTRING):
975case YY_STATE_EOF(PROPNODENAME):
976case YY_STATE_EOF(V1):
Stephen Warrencd296722012-09-28 21:25:59 +0000977#line 95 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100978{
979 if (!pop_input_file()) {
980 yyterminate();
981 }
982 }
983 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +0000984case 3:
985/* rule 3 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +1100986YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +0000987#line 101 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100988{
David Gibsona4da2e32007-12-18 15:06:42 +1100989 DPRINT("String: %s\n", yytext);
990 yylval.data = data_copy_escape_string(yytext+1,
991 yyleng-2);
David Gibsona4da2e32007-12-18 15:06:42 +1100992 return DT_STRING;
993 }
994 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +0000995case 4:
David Gibsona4da2e32007-12-18 15:06:42 +1100996YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +0000997#line 108 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100998{
David Gibsona4da2e32007-12-18 15:06:42 +1100999 DPRINT("Keyword: /dts-v1/\n");
1000 dts_version = 1;
1001 BEGIN_DEFAULT();
1002 return DT_V1;
1003 }
1004 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001005case 5:
David Gibsona4da2e32007-12-18 15:06:42 +11001006YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001007#line 115 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001008{
David Gibsona4da2e32007-12-18 15:06:42 +11001009 DPRINT("Keyword: /memreserve/\n");
1010 BEGIN_DEFAULT();
1011 return DT_MEMRESERVE;
1012 }
1013 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001014case 6:
David Gibsona4da2e32007-12-18 15:06:42 +11001015YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001016#line 121 "dtc-lexer.l"
1017{
1018 DPRINT("Keyword: /bits/\n");
1019 BEGIN_DEFAULT();
1020 return DT_BITS;
1021 }
1022 YY_BREAK
1023case 7:
1024YY_RULE_SETUP
1025#line 127 "dtc-lexer.l"
1026{
1027 DPRINT("Keyword: /delete-property/\n");
1028 DPRINT("<PROPNODENAME>\n");
1029 BEGIN(PROPNODENAME);
1030 return DT_DEL_PROP;
1031 }
1032 YY_BREAK
1033case 8:
1034YY_RULE_SETUP
1035#line 134 "dtc-lexer.l"
1036{
1037 DPRINT("Keyword: /delete-node/\n");
1038 DPRINT("<PROPNODENAME>\n");
1039 BEGIN(PROPNODENAME);
1040 return DT_DEL_NODE;
1041 }
1042 YY_BREAK
1043case 9:
1044YY_RULE_SETUP
1045#line 141 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001046{
David Gibsona4da2e32007-12-18 15:06:42 +11001047 DPRINT("Label: %s\n", yytext);
John Bonesio658f29a2010-11-17 15:28:20 -08001048 yylval.labelref = xstrdup(yytext);
David Gibsona4da2e32007-12-18 15:06:42 +11001049 yylval.labelref[yyleng-1] = '\0';
1050 return DT_LABEL;
1051 }
1052 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001053case 10:
David Gibsona4da2e32007-12-18 15:06:42 +11001054YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001055#line 148 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001056{
John Bonesio658f29a2010-11-17 15:28:20 -08001057 yylval.literal = xstrdup(yytext);
David Gibsona4da2e32007-12-18 15:06:42 +11001058 DPRINT("Literal: '%s'\n", yylval.literal);
1059 return DT_LITERAL;
1060 }
1061 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001062case 11:
1063/* rule 11 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001064YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001065#line 154 "dtc-lexer.l"
1066{
1067 yytext[yyleng-1] = '\0';
1068 yylval.literal = xstrdup(yytext+1);
1069 DPRINT("Character literal: %s\n", yylval.literal);
1070 return DT_CHAR_LITERAL;
1071 }
1072 YY_BREAK
1073case 12:
1074YY_RULE_SETUP
1075#line 161 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001076{ /* label reference */
David Gibsona4da2e32007-12-18 15:06:42 +11001077 DPRINT("Ref: %s\n", yytext+1);
John Bonesio658f29a2010-11-17 15:28:20 -08001078 yylval.labelref = xstrdup(yytext+1);
David Gibsona4da2e32007-12-18 15:06:42 +11001079 return DT_REF;
1080 }
1081 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001082case 13:
David Gibsona4da2e32007-12-18 15:06:42 +11001083YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001084#line 167 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001085{ /* new-style path reference */
David Gibsona4da2e32007-12-18 15:06:42 +11001086 yytext[yyleng-1] = '\0';
1087 DPRINT("Ref: %s\n", yytext+2);
John Bonesio658f29a2010-11-17 15:28:20 -08001088 yylval.labelref = xstrdup(yytext+2);
David Gibsona4da2e32007-12-18 15:06:42 +11001089 return DT_REF;
1090 }
1091 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001092case 14:
David Gibsona4da2e32007-12-18 15:06:42 +11001093YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001094#line 174 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001095{
David Gibsona4da2e32007-12-18 15:06:42 +11001096 yylval.byte = strtol(yytext, NULL, 16);
1097 DPRINT("Byte: %02x\n", (int)yylval.byte);
1098 return DT_BYTE;
1099 }
1100 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001101case 15:
David Gibsona4da2e32007-12-18 15:06:42 +11001102YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001103#line 180 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001104{
David Gibsona4da2e32007-12-18 15:06:42 +11001105 DPRINT("/BYTESTRING\n");
1106 BEGIN_DEFAULT();
1107 return ']';
1108 }
1109 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001110case 16:
David Gibsona4da2e32007-12-18 15:06:42 +11001111YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001112#line 186 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001113{
David Gibsona4da2e32007-12-18 15:06:42 +11001114 DPRINT("PropNodeName: %s\n", yytext);
Stephen Warrencd296722012-09-28 21:25:59 +00001115 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
1116 yytext + 1 : yytext);
David Gibsona4da2e32007-12-18 15:06:42 +11001117 BEGIN_DEFAULT();
1118 return DT_PROPNODENAME;
1119 }
1120 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001121case 17:
David Gibsoned95d742008-08-07 12:24:17 +10001122YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001123#line 194 "dtc-lexer.l"
David Gibsoned95d742008-08-07 12:24:17 +10001124{
David Gibsoned95d742008-08-07 12:24:17 +10001125 DPRINT("Binary Include\n");
1126 return DT_INCBIN;
1127 }
1128 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001129case 18:
1130/* rule 18 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001131YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001132#line 199 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001133/* eat whitespace */
1134 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001135case 19:
1136/* rule 19 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001137YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001138#line 200 "dtc-lexer.l"
David Gibsoned95d742008-08-07 12:24:17 +10001139/* eat C-style comments */
David Gibsona4da2e32007-12-18 15:06:42 +11001140 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001141case 20:
1142/* rule 20 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001143YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001144#line 201 "dtc-lexer.l"
David Gibsoned95d742008-08-07 12:24:17 +10001145/* eat C++-style comments */
David Gibsona4da2e32007-12-18 15:06:42 +11001146 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001147case 21:
David Gibsona4da2e32007-12-18 15:06:42 +11001148YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001149#line 203 "dtc-lexer.l"
1150{ return DT_LSHIFT; };
1151 YY_BREAK
1152case 22:
1153YY_RULE_SETUP
1154#line 204 "dtc-lexer.l"
1155{ return DT_RSHIFT; };
1156 YY_BREAK
1157case 23:
1158YY_RULE_SETUP
1159#line 205 "dtc-lexer.l"
1160{ return DT_LE; };
1161 YY_BREAK
1162case 24:
1163YY_RULE_SETUP
1164#line 206 "dtc-lexer.l"
1165{ return DT_GE; };
1166 YY_BREAK
1167case 25:
1168YY_RULE_SETUP
1169#line 207 "dtc-lexer.l"
1170{ return DT_EQ; };
1171 YY_BREAK
1172case 26:
1173YY_RULE_SETUP
1174#line 208 "dtc-lexer.l"
1175{ return DT_NE; };
1176 YY_BREAK
1177case 27:
1178YY_RULE_SETUP
1179#line 209 "dtc-lexer.l"
1180{ return DT_AND; };
1181 YY_BREAK
1182case 28:
1183YY_RULE_SETUP
1184#line 210 "dtc-lexer.l"
1185{ return DT_OR; };
1186 YY_BREAK
1187case 29:
1188YY_RULE_SETUP
1189#line 212 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001190{
David Gibsona4da2e32007-12-18 15:06:42 +11001191 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1192 (unsigned)yytext[0]);
1193 if (yytext[0] == '[') {
1194 DPRINT("<BYTESTRING>\n");
1195 BEGIN(BYTESTRING);
1196 }
1197 if ((yytext[0] == '{')
1198 || (yytext[0] == ';')) {
1199 DPRINT("<PROPNODENAME>\n");
1200 BEGIN(PROPNODENAME);
1201 }
1202 return yytext[0];
1203 }
1204 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001205case 30:
David Gibsona4da2e32007-12-18 15:06:42 +11001206YY_RULE_SETUP
Stephen Warrencd296722012-09-28 21:25:59 +00001207#line 227 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001208ECHO;
1209 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001210#line 1211 "dtc-lexer.lex.c"
David Gibsona4da2e32007-12-18 15:06:42 +11001211
1212 case YY_END_OF_BUFFER:
1213 {
1214 /* Amount of text matched not including the EOB char. */
1215 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1216
1217 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1218 *yy_cp = (yy_hold_char);
1219 YY_RESTORE_YY_MORE_OFFSET
1220
1221 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1222 {
1223 /* We're scanning a new file or input source. It's
1224 * possible that this happened because the user
1225 * just pointed yyin at a new source and called
1226 * yylex(). If so, then we have to assure
1227 * consistency between YY_CURRENT_BUFFER and our
1228 * globals. Here is the right place to do so, because
1229 * this is the first action (other than possibly a
1230 * back-up) that will match for the new input source.
1231 */
1232 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1233 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1234 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1235 }
1236
1237 /* Note that here we test for yy_c_buf_p "<=" to the position
1238 * of the first EOB in the buffer, since yy_c_buf_p will
1239 * already have been incremented past the NUL character
1240 * (since all states make transitions on EOB to the
1241 * end-of-buffer state). Contrast this with the test
1242 * in input().
1243 */
1244 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1245 { /* This was really a NUL. */
1246 yy_state_type yy_next_state;
1247
1248 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1249
1250 yy_current_state = yy_get_previous_state( );
1251
1252 /* Okay, we're now positioned to make the NUL
1253 * transition. We couldn't have
1254 * yy_get_previous_state() go ahead and do it
1255 * for us because it doesn't know how to deal
1256 * with the possibility of jamming (and we don't
1257 * want to build jamming into it because then it
1258 * will run more slowly).
1259 */
1260
1261 yy_next_state = yy_try_NUL_trans( yy_current_state );
1262
1263 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1264
1265 if ( yy_next_state )
1266 {
1267 /* Consume the NUL. */
1268 yy_cp = ++(yy_c_buf_p);
1269 yy_current_state = yy_next_state;
1270 goto yy_match;
1271 }
1272
1273 else
1274 {
John Bonesio658f29a2010-11-17 15:28:20 -08001275 yy_cp = (yy_last_accepting_cpos);
1276 yy_current_state = (yy_last_accepting_state);
David Gibsona4da2e32007-12-18 15:06:42 +11001277 goto yy_find_action;
1278 }
1279 }
1280
1281 else switch ( yy_get_next_buffer( ) )
1282 {
1283 case EOB_ACT_END_OF_FILE:
1284 {
1285 (yy_did_buffer_switch_on_eof) = 0;
1286
1287 if ( yywrap( ) )
1288 {
1289 /* Note: because we've taken care in
1290 * yy_get_next_buffer() to have set up
1291 * yytext, we can now set up
1292 * yy_c_buf_p so that if some total
1293 * hoser (like flex itself) wants to
1294 * call the scanner after we return the
1295 * YY_NULL, it'll still work - another
1296 * YY_NULL will get returned.
1297 */
1298 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1299
1300 yy_act = YY_STATE_EOF(YY_START);
1301 goto do_action;
1302 }
1303
1304 else
1305 {
1306 if ( ! (yy_did_buffer_switch_on_eof) )
1307 YY_NEW_FILE;
1308 }
1309 break;
1310 }
1311
1312 case EOB_ACT_CONTINUE_SCAN:
1313 (yy_c_buf_p) =
1314 (yytext_ptr) + yy_amount_of_matched_text;
1315
1316 yy_current_state = yy_get_previous_state( );
1317
1318 yy_cp = (yy_c_buf_p);
1319 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1320 goto yy_match;
1321
1322 case EOB_ACT_LAST_MATCH:
1323 (yy_c_buf_p) =
1324 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1325
1326 yy_current_state = yy_get_previous_state( );
1327
1328 yy_cp = (yy_c_buf_p);
1329 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1330 goto yy_find_action;
1331 }
1332 break;
1333 }
1334
1335 default:
1336 YY_FATAL_ERROR(
1337 "fatal flex scanner internal error--no action found" );
1338 } /* end of action switch */
1339 } /* end of scanning one token */
1340} /* end of yylex */
1341
1342/* yy_get_next_buffer - try to read in a new buffer
1343 *
1344 * Returns a code representing an action:
1345 * EOB_ACT_LAST_MATCH -
1346 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1347 * EOB_ACT_END_OF_FILE - end of file
1348 */
1349static int yy_get_next_buffer (void)
1350{
1351 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1352 register char *source = (yytext_ptr);
1353 register int number_to_move, i;
1354 int ret_val;
1355
1356 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1357 YY_FATAL_ERROR(
1358 "fatal flex scanner internal error--end of buffer missed" );
1359
1360 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1361 { /* Don't try to fill the buffer, so this is an EOF. */
1362 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1363 {
1364 /* We matched a single character, the EOB, so
1365 * treat this as a final EOF.
1366 */
1367 return EOB_ACT_END_OF_FILE;
1368 }
1369
1370 else
1371 {
1372 /* We matched some text prior to the EOB, first
1373 * process it.
1374 */
1375 return EOB_ACT_LAST_MATCH;
1376 }
1377 }
1378
1379 /* Try to read more data. */
1380
1381 /* First move last chars to start of buffer. */
1382 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1383
1384 for ( i = 0; i < number_to_move; ++i )
1385 *(dest++) = *(source++);
1386
1387 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1388 /* don't do the read, it's not guaranteed to return an EOF,
1389 * just force an EOF
1390 */
1391 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1392
1393 else
1394 {
1395 int num_to_read =
1396 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1397
1398 while ( num_to_read <= 0 )
1399 { /* Not enough room in the buffer - grow it. */
1400
1401 /* just a shorter name for the current buffer */
1402 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1403
1404 int yy_c_buf_p_offset =
1405 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1406
1407 if ( b->yy_is_our_buffer )
1408 {
1409 int new_size = b->yy_buf_size * 2;
1410
1411 if ( new_size <= 0 )
1412 b->yy_buf_size += b->yy_buf_size / 8;
1413 else
1414 b->yy_buf_size *= 2;
1415
1416 b->yy_ch_buf = (char *)
1417 /* Include room in for 2 EOB chars. */
1418 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1419 }
1420 else
1421 /* Can't grow it, we don't own it. */
1422 b->yy_ch_buf = 0;
1423
1424 if ( ! b->yy_ch_buf )
1425 YY_FATAL_ERROR(
1426 "fatal error - scanner input buffer overflow" );
1427
1428 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1429
1430 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1431 number_to_move - 1;
1432
1433 }
1434
1435 if ( num_to_read > YY_READ_BUF_SIZE )
1436 num_to_read = YY_READ_BUF_SIZE;
1437
1438 /* Read in more data. */
1439 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1440 (yy_n_chars), (size_t) num_to_read );
1441
1442 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1443 }
1444
1445 if ( (yy_n_chars) == 0 )
1446 {
1447 if ( number_to_move == YY_MORE_ADJ )
1448 {
1449 ret_val = EOB_ACT_END_OF_FILE;
1450 yyrestart(yyin );
1451 }
1452
1453 else
1454 {
1455 ret_val = EOB_ACT_LAST_MATCH;
1456 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1457 YY_BUFFER_EOF_PENDING;
1458 }
1459 }
1460
1461 else
1462 ret_val = EOB_ACT_CONTINUE_SCAN;
1463
David Gibsoned95d742008-08-07 12:24:17 +10001464 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1465 /* Extend the array by 50%, plus the number we really need. */
1466 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1467 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1468 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1469 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1470 }
1471
David Gibsona4da2e32007-12-18 15:06:42 +11001472 (yy_n_chars) += number_to_move;
1473 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1474 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1475
1476 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1477
1478 return ret_val;
1479}
1480
1481/* yy_get_previous_state - get the state just before the EOB char was reached */
1482
1483 static yy_state_type yy_get_previous_state (void)
1484{
1485 register yy_state_type yy_current_state;
1486 register char *yy_cp;
1487
1488 yy_current_state = (yy_start);
Stephen Warrencd296722012-09-28 21:25:59 +00001489 yy_current_state += YY_AT_BOL();
David Gibsona4da2e32007-12-18 15:06:42 +11001490
1491 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1492 {
1493 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1494 if ( yy_accept[yy_current_state] )
1495 {
1496 (yy_last_accepting_state) = yy_current_state;
1497 (yy_last_accepting_cpos) = yy_cp;
1498 }
1499 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1500 {
1501 yy_current_state = (int) yy_def[yy_current_state];
Stephen Warrencd296722012-09-28 21:25:59 +00001502 if ( yy_current_state >= 161 )
David Gibsona4da2e32007-12-18 15:06:42 +11001503 yy_c = yy_meta[(unsigned int) yy_c];
1504 }
1505 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1506 }
1507
1508 return yy_current_state;
1509}
1510
1511/* yy_try_NUL_trans - try to make a transition on the NUL character
1512 *
1513 * synopsis
1514 * next_state = yy_try_NUL_trans( current_state );
1515 */
1516 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1517{
1518 register int yy_is_jam;
1519 register char *yy_cp = (yy_c_buf_p);
1520
1521 register YY_CHAR yy_c = 1;
1522 if ( yy_accept[yy_current_state] )
1523 {
1524 (yy_last_accepting_state) = yy_current_state;
1525 (yy_last_accepting_cpos) = yy_cp;
1526 }
1527 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1528 {
1529 yy_current_state = (int) yy_def[yy_current_state];
Stephen Warrencd296722012-09-28 21:25:59 +00001530 if ( yy_current_state >= 161 )
David Gibsona4da2e32007-12-18 15:06:42 +11001531 yy_c = yy_meta[(unsigned int) yy_c];
1532 }
1533 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
Stephen Warrencd296722012-09-28 21:25:59 +00001534 yy_is_jam = (yy_current_state == 160);
David Gibsona4da2e32007-12-18 15:06:42 +11001535
1536 return yy_is_jam ? 0 : yy_current_state;
1537}
1538
1539#ifndef YY_NO_INPUT
1540#ifdef __cplusplus
1541 static int yyinput (void)
1542#else
1543 static int input (void)
1544#endif
1545
1546{
1547 int c;
1548
1549 *(yy_c_buf_p) = (yy_hold_char);
1550
1551 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1552 {
1553 /* yy_c_buf_p now points to the character we want to return.
1554 * If this occurs *before* the EOB characters, then it's a
1555 * valid NUL; if not, then we've hit the end of the buffer.
1556 */
1557 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1558 /* This was really a NUL. */
1559 *(yy_c_buf_p) = '\0';
1560
1561 else
1562 { /* need more input */
1563 int offset = (yy_c_buf_p) - (yytext_ptr);
1564 ++(yy_c_buf_p);
1565
1566 switch ( yy_get_next_buffer( ) )
1567 {
1568 case EOB_ACT_LAST_MATCH:
1569 /* This happens because yy_g_n_b()
1570 * sees that we've accumulated a
1571 * token and flags that we need to
1572 * try matching the token before
1573 * proceeding. But for input(),
1574 * there's no matching to consider.
1575 * So convert the EOB_ACT_LAST_MATCH
1576 * to EOB_ACT_END_OF_FILE.
1577 */
1578
1579 /* Reset buffer status. */
1580 yyrestart(yyin );
1581
1582 /*FALLTHROUGH*/
1583
1584 case EOB_ACT_END_OF_FILE:
1585 {
1586 if ( yywrap( ) )
1587 return EOF;
1588
1589 if ( ! (yy_did_buffer_switch_on_eof) )
1590 YY_NEW_FILE;
1591#ifdef __cplusplus
1592 return yyinput();
1593#else
1594 return input();
1595#endif
1596 }
1597
1598 case EOB_ACT_CONTINUE_SCAN:
1599 (yy_c_buf_p) = (yytext_ptr) + offset;
1600 break;
1601 }
1602 }
1603 }
1604
1605 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1606 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1607 (yy_hold_char) = *++(yy_c_buf_p);
1608
Stephen Warrencd296722012-09-28 21:25:59 +00001609 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1610
David Gibsona4da2e32007-12-18 15:06:42 +11001611 return c;
1612}
1613#endif /* ifndef YY_NO_INPUT */
1614
1615/** Immediately switch to a different input stream.
1616 * @param input_file A readable stream.
1617 *
1618 * @note This function does not reset the start condition to @c INITIAL .
1619 */
1620 void yyrestart (FILE * input_file )
1621{
1622
1623 if ( ! YY_CURRENT_BUFFER ){
1624 yyensure_buffer_stack ();
1625 YY_CURRENT_BUFFER_LVALUE =
1626 yy_create_buffer(yyin,YY_BUF_SIZE );
1627 }
1628
1629 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1630 yy_load_buffer_state( );
1631}
1632
1633/** Switch to a different input buffer.
1634 * @param new_buffer The new input buffer.
1635 *
1636 */
1637 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1638{
1639
1640 /* TODO. We should be able to replace this entire function body
1641 * with
1642 * yypop_buffer_state();
1643 * yypush_buffer_state(new_buffer);
1644 */
1645 yyensure_buffer_stack ();
1646 if ( YY_CURRENT_BUFFER == new_buffer )
1647 return;
1648
1649 if ( YY_CURRENT_BUFFER )
1650 {
1651 /* Flush out information for old buffer. */
1652 *(yy_c_buf_p) = (yy_hold_char);
1653 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1654 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1655 }
1656
1657 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1658 yy_load_buffer_state( );
1659
1660 /* We don't actually know whether we did this switch during
1661 * EOF (yywrap()) processing, but the only time this flag
1662 * is looked at is after yywrap() is called, so it's safe
1663 * to go ahead and always set it.
1664 */
1665 (yy_did_buffer_switch_on_eof) = 1;
1666}
1667
1668static void yy_load_buffer_state (void)
1669{
1670 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1671 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1672 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1673 (yy_hold_char) = *(yy_c_buf_p);
1674}
1675
1676/** Allocate and initialize an input buffer state.
1677 * @param file A readable stream.
1678 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1679 *
1680 * @return the allocated buffer state.
1681 */
1682 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1683{
1684 YY_BUFFER_STATE b;
1685
1686 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1687 if ( ! b )
1688 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1689
1690 b->yy_buf_size = size;
1691
1692 /* yy_ch_buf has to be 2 characters longer than the size given because
1693 * we need to put in 2 end-of-buffer characters.
1694 */
1695 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1696 if ( ! b->yy_ch_buf )
1697 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1698
1699 b->yy_is_our_buffer = 1;
1700
1701 yy_init_buffer(b,file );
1702
1703 return b;
1704}
1705
1706/** Destroy the buffer.
1707 * @param b a buffer created with yy_create_buffer()
1708 *
1709 */
1710 void yy_delete_buffer (YY_BUFFER_STATE b )
1711{
1712
1713 if ( ! b )
1714 return;
1715
1716 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1717 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1718
1719 if ( b->yy_is_our_buffer )
1720 yyfree((void *) b->yy_ch_buf );
1721
1722 yyfree((void *) b );
1723}
1724
David Gibsona4da2e32007-12-18 15:06:42 +11001725/* Initializes or reinitializes a buffer.
1726 * This function is sometimes called more than once on the same buffer,
1727 * such as during a yyrestart() or at EOF.
1728 */
1729 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1730
1731{
1732 int oerrno = errno;
1733
1734 yy_flush_buffer(b );
1735
1736 b->yy_input_file = file;
1737 b->yy_fill_buffer = 1;
1738
1739 /* If b is the current buffer, then yy_init_buffer was _probably_
1740 * called from yyrestart() or through yy_get_next_buffer.
1741 * In that case, we don't want to reset the lineno or column.
1742 */
1743 if (b != YY_CURRENT_BUFFER){
1744 b->yy_bs_lineno = 1;
1745 b->yy_bs_column = 0;
1746 }
1747
John Bonesio658f29a2010-11-17 15:28:20 -08001748 b->yy_is_interactive = 0;
David Gibsona4da2e32007-12-18 15:06:42 +11001749
1750 errno = oerrno;
1751}
1752
1753/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1754 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1755 *
1756 */
1757 void yy_flush_buffer (YY_BUFFER_STATE b )
1758{
1759 if ( ! b )
1760 return;
1761
1762 b->yy_n_chars = 0;
1763
1764 /* We always need two end-of-buffer characters. The first causes
1765 * a transition to the end-of-buffer state. The second causes
1766 * a jam in that state.
1767 */
1768 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1769 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1770
1771 b->yy_buf_pos = &b->yy_ch_buf[0];
1772
1773 b->yy_at_bol = 1;
1774 b->yy_buffer_status = YY_BUFFER_NEW;
1775
1776 if ( b == YY_CURRENT_BUFFER )
1777 yy_load_buffer_state( );
1778}
1779
1780/** Pushes the new state onto the stack. The new state becomes
1781 * the current state. This function will allocate the stack
1782 * if necessary.
1783 * @param new_buffer The new state.
1784 *
1785 */
1786void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1787{
1788 if (new_buffer == NULL)
1789 return;
1790
1791 yyensure_buffer_stack();
1792
1793 /* This block is copied from yy_switch_to_buffer. */
1794 if ( YY_CURRENT_BUFFER )
1795 {
1796 /* Flush out information for old buffer. */
1797 *(yy_c_buf_p) = (yy_hold_char);
1798 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1799 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1800 }
1801
1802 /* Only push if top exists. Otherwise, replace top. */
1803 if (YY_CURRENT_BUFFER)
1804 (yy_buffer_stack_top)++;
1805 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1806
1807 /* copied from yy_switch_to_buffer. */
1808 yy_load_buffer_state( );
1809 (yy_did_buffer_switch_on_eof) = 1;
1810}
1811
1812/** Removes and deletes the top of the stack, if present.
1813 * The next element becomes the new top.
1814 *
1815 */
1816void yypop_buffer_state (void)
1817{
1818 if (!YY_CURRENT_BUFFER)
1819 return;
1820
1821 yy_delete_buffer(YY_CURRENT_BUFFER );
1822 YY_CURRENT_BUFFER_LVALUE = NULL;
1823 if ((yy_buffer_stack_top) > 0)
1824 --(yy_buffer_stack_top);
1825
1826 if (YY_CURRENT_BUFFER) {
1827 yy_load_buffer_state( );
1828 (yy_did_buffer_switch_on_eof) = 1;
1829 }
1830}
1831
1832/* Allocates the stack if it does not exist.
1833 * Guarantees space for at least one push.
1834 */
1835static void yyensure_buffer_stack (void)
1836{
1837 int num_to_alloc;
1838
1839 if (!(yy_buffer_stack)) {
1840
1841 /* First allocation is just for 2 elements, since we don't know if this
1842 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1843 * immediate realloc on the next call.
1844 */
1845 num_to_alloc = 1;
1846 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1847 (num_to_alloc * sizeof(struct yy_buffer_state*)
1848 );
David Gibsoned95d742008-08-07 12:24:17 +10001849 if ( ! (yy_buffer_stack) )
1850 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1851
David Gibsona4da2e32007-12-18 15:06:42 +11001852 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1853
1854 (yy_buffer_stack_max) = num_to_alloc;
1855 (yy_buffer_stack_top) = 0;
1856 return;
1857 }
1858
1859 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1860
1861 /* Increase the buffer to prepare for a possible push. */
1862 int grow_size = 8 /* arbitrary grow size */;
1863
1864 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1865 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1866 ((yy_buffer_stack),
1867 num_to_alloc * sizeof(struct yy_buffer_state*)
1868 );
David Gibsoned95d742008-08-07 12:24:17 +10001869 if ( ! (yy_buffer_stack) )
1870 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
David Gibsona4da2e32007-12-18 15:06:42 +11001871
1872 /* zero only the new slots.*/
1873 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1874 (yy_buffer_stack_max) = num_to_alloc;
1875 }
1876}
1877
1878/** Setup the input buffer state to scan directly from a user-specified character buffer.
1879 * @param base the character buffer
1880 * @param size the size in bytes of the character buffer
1881 *
1882 * @return the newly allocated buffer state object.
1883 */
1884YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1885{
1886 YY_BUFFER_STATE b;
1887
1888 if ( size < 2 ||
1889 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1890 base[size-1] != YY_END_OF_BUFFER_CHAR )
1891 /* They forgot to leave room for the EOB's. */
1892 return 0;
1893
1894 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1895 if ( ! b )
1896 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1897
1898 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1899 b->yy_buf_pos = b->yy_ch_buf = base;
1900 b->yy_is_our_buffer = 0;
1901 b->yy_input_file = 0;
1902 b->yy_n_chars = b->yy_buf_size;
1903 b->yy_is_interactive = 0;
1904 b->yy_at_bol = 1;
1905 b->yy_fill_buffer = 0;
1906 b->yy_buffer_status = YY_BUFFER_NEW;
1907
1908 yy_switch_to_buffer(b );
1909
1910 return b;
1911}
1912
1913/** Setup the input buffer state to scan a string. The next call to yylex() will
1914 * scan from a @e copy of @a str.
1915 * @param yystr a NUL-terminated string to scan
1916 *
1917 * @return the newly allocated buffer state object.
1918 * @note If you want to scan bytes that may contain NUL values, then use
1919 * yy_scan_bytes() instead.
1920 */
1921YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1922{
1923
1924 return yy_scan_bytes(yystr,strlen(yystr) );
1925}
1926
1927/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1928 * scan from a @e copy of @a bytes.
Stephen Warrencd296722012-09-28 21:25:59 +00001929 * @param yybytes the byte buffer to scan
1930 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
David Gibsona4da2e32007-12-18 15:06:42 +11001931 *
1932 * @return the newly allocated buffer state object.
1933 */
1934YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1935{
1936 YY_BUFFER_STATE b;
1937 char *buf;
1938 yy_size_t n;
1939 int i;
1940
1941 /* Get memory for full buffer, including space for trailing EOB's. */
1942 n = _yybytes_len + 2;
1943 buf = (char *) yyalloc(n );
1944 if ( ! buf )
1945 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1946
1947 for ( i = 0; i < _yybytes_len; ++i )
1948 buf[i] = yybytes[i];
1949
1950 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1951
1952 b = yy_scan_buffer(buf,n );
1953 if ( ! b )
1954 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1955
1956 /* It's okay to grow etc. this buffer, and we should throw it
1957 * away when we're done.
1958 */
1959 b->yy_is_our_buffer = 1;
1960
1961 return b;
1962}
1963
1964#ifndef YY_EXIT_FAILURE
1965#define YY_EXIT_FAILURE 2
1966#endif
1967
1968static void yy_fatal_error (yyconst char* msg )
1969{
1970 (void) fprintf( stderr, "%s\n", msg );
1971 exit( YY_EXIT_FAILURE );
1972}
1973
1974/* Redefine yyless() so it works in section 3 code. */
1975
1976#undef yyless
1977#define yyless(n) \
1978 do \
1979 { \
1980 /* Undo effects of setting up yytext. */ \
1981 int yyless_macro_arg = (n); \
1982 YY_LESS_LINENO(yyless_macro_arg);\
1983 yytext[yyleng] = (yy_hold_char); \
1984 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1985 (yy_hold_char) = *(yy_c_buf_p); \
1986 *(yy_c_buf_p) = '\0'; \
1987 yyleng = yyless_macro_arg; \
1988 } \
1989 while ( 0 )
1990
1991/* Accessor methods (get/set functions) to struct members. */
1992
1993/** Get the current line number.
1994 *
1995 */
1996int yyget_lineno (void)
1997{
1998
1999 return yylineno;
2000}
2001
2002/** Get the input stream.
2003 *
2004 */
2005FILE *yyget_in (void)
2006{
2007 return yyin;
2008}
2009
2010/** Get the output stream.
2011 *
2012 */
2013FILE *yyget_out (void)
2014{
2015 return yyout;
2016}
2017
2018/** Get the length of the current token.
2019 *
2020 */
2021int yyget_leng (void)
2022{
2023 return yyleng;
2024}
2025
2026/** Get the current token.
2027 *
2028 */
2029
2030char *yyget_text (void)
2031{
2032 return yytext;
2033}
2034
2035/** Set the current line number.
2036 * @param line_number
2037 *
2038 */
2039void yyset_lineno (int line_number )
2040{
2041
2042 yylineno = line_number;
2043}
2044
2045/** Set the input stream. This does not discard the current
2046 * input buffer.
2047 * @param in_str A readable stream.
2048 *
2049 * @see yy_switch_to_buffer
2050 */
2051void yyset_in (FILE * in_str )
2052{
2053 yyin = in_str ;
2054}
2055
2056void yyset_out (FILE * out_str )
2057{
2058 yyout = out_str ;
2059}
2060
2061int yyget_debug (void)
2062{
2063 return yy_flex_debug;
2064}
2065
2066void yyset_debug (int bdebug )
2067{
2068 yy_flex_debug = bdebug ;
2069}
2070
2071static int yy_init_globals (void)
2072{
2073 /* Initialization is the same as for the non-reentrant scanner.
2074 * This function is called from yylex_destroy(), so don't allocate here.
2075 */
2076
David Gibsona4da2e32007-12-18 15:06:42 +11002077 (yy_buffer_stack) = 0;
2078 (yy_buffer_stack_top) = 0;
2079 (yy_buffer_stack_max) = 0;
2080 (yy_c_buf_p) = (char *) 0;
2081 (yy_init) = 0;
2082 (yy_start) = 0;
2083
2084/* Defined in main.c */
2085#ifdef YY_STDINIT
2086 yyin = stdin;
2087 yyout = stdout;
2088#else
2089 yyin = (FILE *) 0;
2090 yyout = (FILE *) 0;
2091#endif
2092
2093 /* For future reference: Set errno on error, since we are called by
2094 * yylex_init()
2095 */
2096 return 0;
2097}
2098
2099/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2100int yylex_destroy (void)
2101{
2102
2103 /* Pop the buffer stack, destroying each element. */
2104 while(YY_CURRENT_BUFFER){
2105 yy_delete_buffer(YY_CURRENT_BUFFER );
2106 YY_CURRENT_BUFFER_LVALUE = NULL;
2107 yypop_buffer_state();
2108 }
2109
2110 /* Destroy the stack itself. */
2111 yyfree((yy_buffer_stack) );
2112 (yy_buffer_stack) = NULL;
2113
2114 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2115 * yylex() is called, initialization will occur. */
2116 yy_init_globals( );
2117
2118 return 0;
2119}
2120
2121/*
2122 * Internal utility routines.
2123 */
2124
2125#ifndef yytext_ptr
2126static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2127{
2128 register int i;
2129 for ( i = 0; i < n; ++i )
2130 s1[i] = s2[i];
2131}
2132#endif
2133
2134#ifdef YY_NEED_STRLEN
2135static int yy_flex_strlen (yyconst char * s )
2136{
2137 register int n;
2138 for ( n = 0; s[n]; ++n )
2139 ;
2140
2141 return n;
2142}
2143#endif
2144
2145void *yyalloc (yy_size_t size )
2146{
2147 return (void *) malloc( size );
2148}
2149
2150void *yyrealloc (void * ptr, yy_size_t size )
2151{
2152 /* The cast to (char *) in the following accommodates both
2153 * implementations that use char* generic pointers, and those
2154 * that use void* generic pointers. It works with the latter
2155 * because both ANSI C and C++ allow castless assignment from
2156 * any pointer type to void*, and deal with argument conversions
2157 * as though doing an assignment.
2158 */
2159 return (void *) realloc( (char *) ptr, size );
2160}
2161
2162void yyfree (void * ptr )
2163{
2164 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2165}
2166
2167#define YYTABLES_NAME "yytables"
2168
Stephen Warrencd296722012-09-28 21:25:59 +00002169#line 227 "dtc-lexer.l"
2170
2171
2172
David Gibsoned95d742008-08-07 12:24:17 +10002173static void push_input_file(const char *filename)
David Gibsona4da2e32007-12-18 15:06:42 +11002174{
David Gibsoned95d742008-08-07 12:24:17 +10002175 assert(filename);
2176
John Bonesio658f29a2010-11-17 15:28:20 -08002177 srcfile_push(filename);
David Gibsoned95d742008-08-07 12:24:17 +10002178
John Bonesio658f29a2010-11-17 15:28:20 -08002179 yyin = current_srcfile->f;
David Gibsona4da2e32007-12-18 15:06:42 +11002180
John Bonesio658f29a2010-11-17 15:28:20 -08002181 yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
David Gibsona4da2e32007-12-18 15:06:42 +11002182}
2183
Stephen Warrencd296722012-09-28 21:25:59 +00002184
David Gibsoned95d742008-08-07 12:24:17 +10002185static int pop_input_file(void)
David Gibsona4da2e32007-12-18 15:06:42 +11002186{
John Bonesio658f29a2010-11-17 15:28:20 -08002187 if (srcfile_pop() == 0)
David Gibsona4da2e32007-12-18 15:06:42 +11002188 return 0;
2189
John Bonesio658f29a2010-11-17 15:28:20 -08002190 yypop_buffer_state();
2191 yyin = current_srcfile->f;
David Gibsona4da2e32007-12-18 15:06:42 +11002192
David Gibsona4da2e32007-12-18 15:06:42 +11002193 return 1;
2194}
2195