blob: 750f7a4e3ece0f30a9f958136e1b579a8e3ac49a [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
Rob Herring47605972015-04-29 16:00:05 -050012#define YY_FLEX_SUBMINOR_VERSION 39
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
Rob Herring47605972015-04-29 16:00:05 -0500165#ifndef YY_TYPEDEF_YY_SIZE_T
166#define YY_TYPEDEF_YY_SIZE_T
167typedef size_t yy_size_t;
168#endif
169
170extern yy_size_t yyleng;
David Gibsona4da2e32007-12-18 15:06:42 +1100171
172extern FILE *yyin, *yyout;
173
174#define EOB_ACT_CONTINUE_SCAN 0
175#define EOB_ACT_END_OF_FILE 1
176#define EOB_ACT_LAST_MATCH 2
177
John Bonesio658f29a2010-11-17 15:28:20 -0800178 #define YY_LESS_LINENO(n)
Rob Herring47605972015-04-29 16:00:05 -0500179 #define YY_LINENO_REWIND_TO(ptr)
David Gibsona4da2e32007-12-18 15:06:42 +1100180
181/* Return all but the first "n" matched characters back to the input stream. */
182#define yyless(n) \
183 do \
184 { \
185 /* Undo effects of setting up yytext. */ \
186 int yyless_macro_arg = (n); \
187 YY_LESS_LINENO(yyless_macro_arg);\
188 *yy_cp = (yy_hold_char); \
189 YY_RESTORE_YY_MORE_OFFSET \
190 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
191 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
192 } \
193 while ( 0 )
194
195#define unput(c) yyunput( c, (yytext_ptr) )
196
David Gibsona4da2e32007-12-18 15:06:42 +1100197#ifndef YY_STRUCT_YY_BUFFER_STATE
198#define YY_STRUCT_YY_BUFFER_STATE
199struct yy_buffer_state
200 {
201 FILE *yy_input_file;
202
203 char *yy_ch_buf; /* input buffer */
204 char *yy_buf_pos; /* current position in input buffer */
205
206 /* Size of input buffer in bytes, not including room for EOB
207 * characters.
208 */
209 yy_size_t yy_buf_size;
210
211 /* Number of characters read into yy_ch_buf, not including EOB
212 * characters.
213 */
Rob Herring47605972015-04-29 16:00:05 -0500214 yy_size_t yy_n_chars;
David Gibsona4da2e32007-12-18 15:06:42 +1100215
216 /* Whether we "own" the buffer - i.e., we know we created it,
217 * and can realloc() it to grow it, and should free() it to
218 * delete it.
219 */
220 int yy_is_our_buffer;
221
222 /* Whether this is an "interactive" input source; if so, and
223 * if we're using stdio for input, then we want to use getc()
224 * instead of fread(), to make sure we stop fetching input after
225 * each newline.
226 */
227 int yy_is_interactive;
228
229 /* Whether we're considered to be at the beginning of a line.
230 * If so, '^' rules will be active on the next match, otherwise
231 * not.
232 */
233 int yy_at_bol;
234
235 int yy_bs_lineno; /**< The line count. */
236 int yy_bs_column; /**< The column count. */
237
238 /* Whether to try to fill the input buffer when we reach the
239 * end of it.
240 */
241 int yy_fill_buffer;
242
243 int yy_buffer_status;
244
245#define YY_BUFFER_NEW 0
246#define YY_BUFFER_NORMAL 1
247 /* When an EOF's been seen but there's still some text to process
248 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
249 * shouldn't try reading from the input source any more. We might
250 * still have a bunch of tokens to match, though, because of
251 * possible backing-up.
252 *
253 * When we actually see the EOF, we change the status to "new"
254 * (via yyrestart()), so that the user can continue scanning by
255 * just pointing yyin at a new input file.
256 */
257#define YY_BUFFER_EOF_PENDING 2
258
259 };
260#endif /* !YY_STRUCT_YY_BUFFER_STATE */
261
262/* Stack of input buffers. */
263static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
264static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
265static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
266
267/* We provide macros for accessing buffer states in case in the
268 * future we want to put the buffer states in a more general
269 * "scanner state".
270 *
271 * Returns the top of the stack, or NULL.
272 */
273#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
274 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
275 : NULL)
276
277/* Same as previous macro, but useful when we know that the buffer stack is not
278 * NULL or when we need an lvalue. For internal use only.
279 */
280#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
281
282/* yy_hold_char holds the character lost when yytext is formed. */
283static char yy_hold_char;
Rob Herring47605972015-04-29 16:00:05 -0500284static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
285yy_size_t yyleng;
David Gibsona4da2e32007-12-18 15:06:42 +1100286
287/* Points to current character in buffer. */
288static char *yy_c_buf_p = (char *) 0;
289static int yy_init = 0; /* whether we need to initialize */
290static int yy_start = 0; /* start state number */
291
292/* Flag which is used to allow yywrap()'s to do buffer switches
293 * instead of setting up a fresh yyin. A bit of a hack ...
294 */
295static int yy_did_buffer_switch_on_eof;
296
297void yyrestart (FILE *input_file );
298void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
299YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
300void yy_delete_buffer (YY_BUFFER_STATE b );
301void yy_flush_buffer (YY_BUFFER_STATE b );
302void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
303void yypop_buffer_state (void );
304
305static void yyensure_buffer_stack (void );
306static void yy_load_buffer_state (void );
307static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
308
309#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
310
311YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
312YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
Rob Herring47605972015-04-29 16:00:05 -0500313YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
David Gibsona4da2e32007-12-18 15:06:42 +1100314
315void *yyalloc (yy_size_t );
316void *yyrealloc (void *,yy_size_t );
317void yyfree (void * );
318
319#define yy_new_buffer yy_create_buffer
320
321#define yy_set_interactive(is_interactive) \
322 { \
323 if ( ! YY_CURRENT_BUFFER ){ \
324 yyensure_buffer_stack (); \
325 YY_CURRENT_BUFFER_LVALUE = \
326 yy_create_buffer(yyin,YY_BUF_SIZE ); \
327 } \
328 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
329 }
330
331#define yy_set_bol(at_bol) \
332 { \
333 if ( ! YY_CURRENT_BUFFER ){\
334 yyensure_buffer_stack (); \
335 YY_CURRENT_BUFFER_LVALUE = \
336 yy_create_buffer(yyin,YY_BUF_SIZE ); \
337 } \
338 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
339 }
340
341#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
342
343/* Begin user sect3 */
344
Rob Herring47605972015-04-29 16:00:05 -0500345#define yywrap() 1
David Gibsona4da2e32007-12-18 15:06:42 +1100346#define YY_SKIP_YYWRAP
347
348typedef unsigned char YY_CHAR;
349
350FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
351
352typedef int yy_state_type;
353
354extern int yylineno;
355
356int yylineno = 1;
357
358extern char *yytext;
359#define yytext_ptr yytext
360
361static yy_state_type yy_get_previous_state (void );
362static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
363static int yy_get_next_buffer (void );
364static void yy_fatal_error (yyconst char msg[] );
365
366/* Done after the current pattern has been matched and before the
367 * corresponding action - sets up yytext.
368 */
369#define YY_DO_BEFORE_ACTION \
370 (yytext_ptr) = yy_bp; \
371 yyleng = (size_t) (yy_cp - yy_bp); \
372 (yy_hold_char) = *yy_cp; \
373 *yy_cp = '\0'; \
374 (yy_c_buf_p) = yy_cp;
375
Stephen Warrencd296722012-09-28 21:25:59 +0000376#define YY_NUM_RULES 30
377#define YY_END_OF_BUFFER 31
David Gibsona4da2e32007-12-18 15:06:42 +1100378/* This struct is not used in this scanner,
379 but its presence is necessary. */
380struct yy_trans_info
381 {
382 flex_int32_t yy_verify;
383 flex_int32_t yy_nxt;
384 };
Rob Herring47605972015-04-29 16:00:05 -0500385static yyconst flex_int16_t yy_accept[159] =
David Gibsona4da2e32007-12-18 15:06:42 +1100386 { 0,
Rob Herring47605972015-04-29 16:00:05 -0500387 0, 0, 0, 0, 0, 0, 0, 0, 31, 29,
388 18, 18, 29, 29, 29, 29, 29, 29, 29, 29,
389 29, 29, 29, 29, 29, 29, 15, 16, 16, 29,
390 16, 10, 10, 18, 26, 0, 3, 0, 27, 12,
391 0, 0, 11, 0, 0, 0, 0, 0, 0, 0,
392 21, 23, 25, 24, 22, 0, 9, 28, 0, 0,
393 0, 14, 14, 16, 16, 16, 10, 10, 10, 0,
394 12, 0, 11, 0, 0, 0, 20, 0, 0, 0,
395 0, 0, 0, 0, 0, 16, 10, 10, 10, 0,
396 13, 19, 0, 0, 0, 0, 0, 0, 0, 0,
John Bonesio658f29a2010-11-17 15:28:20 -0800397
Rob Herring47605972015-04-29 16:00:05 -0500398 0, 16, 0, 0, 0, 0, 0, 0, 0, 0,
399 0, 16, 6, 0, 0, 0, 0, 0, 0, 2,
400 0, 0, 0, 0, 0, 0, 0, 0, 4, 17,
401 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
402 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
403 5, 8, 0, 0, 0, 0, 7, 0
David Gibsona4da2e32007-12-18 15:06:42 +1100404 } ;
405
406static yyconst flex_int32_t yy_ec[256] =
407 { 0,
408 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
Grant Likely706b78f2013-06-13 12:57:44 +0100409 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
David Gibsona4da2e32007-12-18 15:06:42 +1100410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Grant Likely706b78f2013-06-13 12:57:44 +0100411 1, 2, 5, 6, 7, 1, 1, 8, 9, 1,
412 1, 10, 11, 11, 12, 11, 13, 14, 15, 16,
413 16, 16, 16, 16, 16, 16, 16, 17, 1, 18,
414 19, 20, 11, 11, 21, 21, 21, 21, 21, 21,
415 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
416 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
417 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
David Gibsona4da2e32007-12-18 15:06:42 +1100418
Grant Likely706b78f2013-06-13 12:57:44 +0100419 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
420 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
421 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
David Gibsona4da2e32007-12-18 15:06:42 +1100422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
433 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435 1, 1, 1, 1, 1
436 } ;
437
Grant Likely706b78f2013-06-13 12:57:44 +0100438static yyconst flex_int32_t yy_meta[47] =
David Gibsona4da2e32007-12-18 15:06:42 +1100439 { 0,
Grant Likely706b78f2013-06-13 12:57:44 +0100440 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
441 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
442 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
443 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
Rob Herring47605972015-04-29 16:00:05 -0500444 8, 8, 8, 3, 1, 4
David Gibsona4da2e32007-12-18 15:06:42 +1100445 } ;
446
Rob Herring47605972015-04-29 16:00:05 -0500447static yyconst flex_int16_t yy_base[173] =
David Gibsona4da2e32007-12-18 15:06:42 +1100448 { 0,
Rob Herring47605972015-04-29 16:00:05 -0500449 0, 383, 34, 382, 65, 381, 37, 105, 387, 391,
450 54, 111, 367, 110, 109, 109, 112, 41, 366, 104,
451 367, 338, 124, 117, 0, 144, 391, 0, 121, 0,
452 135, 155, 140, 179, 391, 160, 391, 379, 391, 0,
453 368, 141, 391, 167, 370, 376, 346, 103, 342, 345,
454 391, 391, 391, 391, 391, 358, 391, 391, 175, 342,
455 338, 391, 355, 0, 185, 339, 184, 347, 346, 0,
456 0, 322, 175, 357, 175, 363, 352, 324, 330, 323,
457 332, 326, 201, 324, 329, 322, 391, 333, 181, 309,
458 391, 341, 340, 313, 320, 338, 178, 311, 146, 317,
David Gibsona4da2e32007-12-18 15:06:42 +1100459
Rob Herring47605972015-04-29 16:00:05 -0500460 314, 315, 335, 331, 303, 300, 309, 299, 308, 188,
461 336, 335, 391, 305, 320, 281, 283, 271, 203, 288,
462 281, 271, 266, 264, 245, 242, 208, 104, 391, 391,
463 244, 218, 204, 219, 206, 224, 201, 212, 204, 229,
464 215, 208, 207, 200, 219, 391, 233, 221, 200, 181,
465 391, 391, 149, 122, 86, 41, 391, 391, 245, 251,
466 259, 263, 267, 273, 280, 284, 292, 300, 304, 310,
467 318, 326
David Gibsona4da2e32007-12-18 15:06:42 +1100468 } ;
469
Rob Herring47605972015-04-29 16:00:05 -0500470static yyconst flex_int16_t yy_def[173] =
David Gibsona4da2e32007-12-18 15:06:42 +1100471 { 0,
Rob Herring47605972015-04-29 16:00:05 -0500472 158, 1, 1, 3, 158, 5, 1, 1, 158, 158,
473 158, 158, 158, 159, 160, 161, 158, 158, 158, 158,
474 162, 158, 158, 158, 163, 162, 158, 164, 165, 164,
475 164, 158, 158, 158, 158, 159, 158, 159, 158, 166,
476 158, 161, 158, 161, 167, 168, 158, 158, 158, 158,
477 158, 158, 158, 158, 158, 162, 158, 158, 158, 158,
478 158, 158, 162, 164, 165, 164, 158, 158, 158, 169,
479 166, 170, 161, 167, 167, 168, 158, 158, 158, 158,
480 158, 158, 158, 158, 158, 164, 158, 158, 169, 170,
481 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
David Gibsona4da2e32007-12-18 15:06:42 +1100482
Rob Herring47605972015-04-29 16:00:05 -0500483 158, 164, 158, 158, 158, 158, 158, 158, 158, 171,
484 158, 164, 158, 158, 158, 158, 158, 158, 171, 158,
485 171, 158, 158, 158, 158, 158, 158, 158, 158, 158,
486 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
487 172, 158, 158, 158, 172, 158, 172, 158, 158, 158,
488 158, 158, 158, 158, 158, 158, 158, 0, 158, 158,
489 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
490 158, 158
David Gibsona4da2e32007-12-18 15:06:42 +1100491 } ;
492
Rob Herring47605972015-04-29 16:00:05 -0500493static yyconst flex_int16_t yy_nxt[438] =
David Gibsona4da2e32007-12-18 15:06:42 +1100494 { 0,
Rob Herring47605972015-04-29 16:00:05 -0500495 10, 11, 12, 11, 13, 14, 10, 15, 16, 10,
496 10, 10, 17, 10, 10, 10, 10, 18, 19, 20,
497 21, 21, 21, 21, 21, 10, 10, 21, 21, 21,
498 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
499 21, 21, 21, 10, 22, 10, 24, 25, 25, 25,
500 32, 33, 33, 157, 26, 34, 34, 34, 51, 52,
501 27, 26, 26, 26, 26, 10, 11, 12, 11, 13,
502 14, 28, 15, 16, 28, 28, 28, 24, 28, 28,
503 28, 10, 18, 19, 20, 29, 29, 29, 29, 29,
504 30, 10, 29, 29, 29, 29, 29, 29, 29, 29,
David Gibsona4da2e32007-12-18 15:06:42 +1100505
Rob Herring47605972015-04-29 16:00:05 -0500506 29, 29, 29, 29, 29, 29, 29, 29, 10, 22,
507 10, 23, 34, 34, 34, 37, 39, 43, 32, 33,
508 33, 45, 54, 55, 46, 59, 45, 64, 156, 46,
509 64, 64, 64, 79, 44, 38, 59, 57, 134, 47,
510 135, 48, 80, 49, 47, 50, 48, 99, 61, 43,
511 50, 110, 41, 67, 67, 67, 60, 63, 63, 63,
512 57, 155, 68, 69, 63, 37, 44, 66, 67, 67,
513 67, 63, 63, 63, 63, 73, 59, 68, 69, 70,
514 34, 34, 34, 43, 75, 38, 154, 92, 83, 83,
515 83, 64, 44, 120, 64, 64, 64, 67, 67, 67,
David Gibsona4da2e32007-12-18 15:06:42 +1100516
Rob Herring47605972015-04-29 16:00:05 -0500517 44, 57, 99, 68, 69, 107, 68, 69, 120, 127,
518 108, 153, 152, 121, 83, 83, 83, 133, 133, 133,
519 146, 133, 133, 133, 146, 140, 140, 140, 121, 141,
520 140, 140, 140, 151, 141, 158, 150, 149, 148, 144,
521 147, 143, 142, 139, 147, 36, 36, 36, 36, 36,
522 36, 36, 36, 40, 138, 137, 136, 40, 40, 42,
523 42, 42, 42, 42, 42, 42, 42, 56, 56, 56,
524 56, 62, 132, 62, 64, 131, 130, 64, 129, 64,
525 64, 65, 128, 158, 65, 65, 65, 65, 71, 127,
526 71, 71, 74, 74, 74, 74, 74, 74, 74, 74,
Stephen Warrencd296722012-09-28 21:25:59 +0000527
Rob Herring47605972015-04-29 16:00:05 -0500528 76, 76, 76, 76, 76, 76, 76, 76, 89, 126,
529 89, 90, 125, 90, 90, 124, 90, 90, 119, 119,
530 119, 119, 119, 119, 119, 119, 145, 145, 145, 145,
531 145, 145, 145, 145, 123, 122, 59, 59, 118, 117,
532 116, 115, 114, 113, 45, 112, 108, 111, 109, 106,
533 105, 104, 46, 103, 91, 87, 102, 101, 100, 98,
534 97, 96, 95, 94, 93, 77, 75, 91, 88, 87,
535 86, 57, 85, 84, 57, 82, 81, 78, 77, 75,
536 72, 158, 58, 57, 53, 35, 158, 31, 23, 23,
537 9, 158, 158, 158, 158, 158, 158, 158, 158, 158,
Stephen Warrencd296722012-09-28 21:25:59 +0000538
Rob Herring47605972015-04-29 16:00:05 -0500539 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
540 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
541 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
542 158, 158, 158, 158, 158, 158, 158
David Gibsona4da2e32007-12-18 15:06:42 +1100543 } ;
544
Rob Herring47605972015-04-29 16:00:05 -0500545static yyconst flex_int16_t yy_chk[438] =
David Gibsona4da2e32007-12-18 15:06:42 +1100546 { 0,
547 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
548 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
549 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Stephen Warrencd296722012-09-28 21:25:59 +0000550 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Rob Herring47605972015-04-29 16:00:05 -0500551 1, 1, 1, 1, 1, 1, 3, 3, 3, 3,
552 7, 7, 7, 156, 3, 11, 11, 11, 18, 18,
553 3, 3, 3, 3, 3, 5, 5, 5, 5, 5,
554 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
555 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
556 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
David Gibsona4da2e32007-12-18 15:06:42 +1100557
Rob Herring47605972015-04-29 16:00:05 -0500558 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
559 5, 8, 12, 12, 12, 14, 15, 16, 8, 8,
560 8, 17, 20, 20, 17, 23, 24, 29, 155, 24,
561 29, 29, 29, 48, 16, 14, 31, 29, 128, 17,
562 128, 17, 48, 17, 24, 17, 24, 99, 24, 42,
563 24, 99, 15, 33, 33, 33, 23, 26, 26, 26,
564 26, 154, 33, 33, 26, 36, 42, 31, 32, 32,
565 32, 26, 26, 26, 26, 44, 59, 32, 32, 32,
566 34, 34, 34, 73, 75, 36, 153, 75, 59, 59,
567 59, 65, 44, 110, 65, 65, 65, 67, 67, 67,
David Gibsona4da2e32007-12-18 15:06:42 +1100568
Rob Herring47605972015-04-29 16:00:05 -0500569 73, 65, 83, 89, 89, 97, 67, 67, 119, 127,
570 97, 150, 149, 110, 83, 83, 83, 133, 133, 133,
571 141, 127, 127, 127, 145, 136, 136, 136, 119, 136,
572 140, 140, 140, 148, 140, 147, 144, 143, 142, 139,
573 141, 138, 137, 135, 145, 159, 159, 159, 159, 159,
574 159, 159, 159, 160, 134, 132, 131, 160, 160, 161,
575 161, 161, 161, 161, 161, 161, 161, 162, 162, 162,
576 162, 163, 126, 163, 164, 125, 124, 164, 123, 164,
577 164, 165, 122, 121, 165, 165, 165, 165, 166, 120,
578 166, 166, 167, 167, 167, 167, 167, 167, 167, 167,
Stephen Warrencd296722012-09-28 21:25:59 +0000579
Rob Herring47605972015-04-29 16:00:05 -0500580 168, 168, 168, 168, 168, 168, 168, 168, 169, 118,
581 169, 170, 117, 170, 170, 116, 170, 170, 171, 171,
582 171, 171, 171, 171, 171, 171, 172, 172, 172, 172,
583 172, 172, 172, 172, 115, 114, 112, 111, 109, 108,
584 107, 106, 105, 104, 103, 102, 101, 100, 98, 96,
585 95, 94, 93, 92, 90, 88, 86, 85, 84, 82,
586 81, 80, 79, 78, 77, 76, 74, 72, 69, 68,
587 66, 63, 61, 60, 56, 50, 49, 47, 46, 45,
588 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
589 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
Stephen Warrencd296722012-09-28 21:25:59 +0000590
Rob Herring47605972015-04-29 16:00:05 -0500591 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
592 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
593 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
594 158, 158, 158, 158, 158, 158, 158
David Gibsona4da2e32007-12-18 15:06:42 +1100595 } ;
596
David Gibsona4da2e32007-12-18 15:06:42 +1100597static yy_state_type yy_last_accepting_state;
598static char *yy_last_accepting_cpos;
599
600extern int yy_flex_debug;
601int yy_flex_debug = 0;
602
603/* The intent behind this definition is that it'll catch
604 * any uses of REJECT which flex missed.
605 */
606#define REJECT reject_used_but_not_detected
607#define yymore() yymore_used_but_not_detected
608#define YY_MORE_ADJ 0
609#define YY_RESTORE_YY_MORE_OFFSET
610char *yytext;
Stephen Warrencd296722012-09-28 21:25:59 +0000611#line 1 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100612/*
613 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
614 *
615 *
616 * This program is free software; you can redistribute it and/or
617 * modify it under the terms of the GNU General Public License as
618 * published by the Free Software Foundation; either version 2 of the
619 * License, or (at your option) any later version.
620 *
621 * This program is distributed in the hope that it will be useful,
622 * but WITHOUT ANY WARRANTY; without even the implied warranty of
623 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
624 * General Public License for more details.
625 *
626 * You should have received a copy of the GNU General Public License
627 * along with this program; if not, write to the Free Software
628 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
629 * USA
630 */
Josh Triplett23c4ace2009-10-16 15:52:06 -0700631#define YY_NO_INPUT 1
David Gibsona4da2e32007-12-18 15:06:42 +1100632
Stephen Warrencd296722012-09-28 21:25:59 +0000633
634
Rob Herring47605972015-04-29 16:00:05 -0500635#line 37 "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
Rob Herring47605972015-04-29 16:00:05 -0500640extern bool treesource_error;
John Bonesio658f29a2010-11-17 15:28:20 -0800641
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);
Rob Herring47605972015-04-29 16:00:05 -0500662static bool pop_input_file(void);
663static void lexical_error(const char *fmt, ...);
664#line 666 "dtc-lexer.lex.c"
David Gibsona4da2e32007-12-18 15:06:42 +1100665
666#define INITIAL 0
Rob Herring47605972015-04-29 16:00:05 -0500667#define BYTESTRING 1
668#define PROPNODENAME 2
669#define V1 3
David Gibsona4da2e32007-12-18 15:06:42 +1100670
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
Rob Herring47605972015-04-29 16:00:05 -0500706yy_size_t yyget_leng (void );
Josh Triplett23c4ace2009-10-16 15:52:06 -0700707
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
David Gibsona4da2e32007-12-18 15:06:42 +1100855 if ( !(yy_init) )
856 {
857 (yy_init) = 1;
858
859#ifdef YY_USER_INIT
860 YY_USER_INIT;
861#endif
862
863 if ( ! (yy_start) )
864 (yy_start) = 1; /* first start state */
865
866 if ( ! yyin )
867 yyin = stdin;
868
869 if ( ! yyout )
870 yyout = stdout;
871
872 if ( ! YY_CURRENT_BUFFER ) {
873 yyensure_buffer_stack ();
874 YY_CURRENT_BUFFER_LVALUE =
875 yy_create_buffer(yyin,YY_BUF_SIZE );
876 }
877
878 yy_load_buffer_state( );
879 }
880
Rob Herring47605972015-04-29 16:00:05 -0500881 {
882#line 68 "dtc-lexer.l"
883
884#line 886 "dtc-lexer.lex.c"
885
David Gibsona4da2e32007-12-18 15:06:42 +1100886 while ( 1 ) /* loops until end-of-file is reached */
887 {
888 yy_cp = (yy_c_buf_p);
889
890 /* Support of yytext. */
891 *yy_cp = (yy_hold_char);
892
893 /* yy_bp points to the position in yy_ch_buf of the start of
894 * the current run.
895 */
896 yy_bp = yy_cp;
897
898 yy_current_state = (yy_start);
Stephen Warrencd296722012-09-28 21:25:59 +0000899 yy_current_state += YY_AT_BOL();
David Gibsona4da2e32007-12-18 15:06:42 +1100900yy_match:
901 do
902 {
Rob Herring47605972015-04-29 16:00:05 -0500903 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
David Gibsona4da2e32007-12-18 15:06:42 +1100904 if ( yy_accept[yy_current_state] )
905 {
906 (yy_last_accepting_state) = yy_current_state;
907 (yy_last_accepting_cpos) = yy_cp;
908 }
909 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
910 {
911 yy_current_state = (int) yy_def[yy_current_state];
Rob Herring47605972015-04-29 16:00:05 -0500912 if ( yy_current_state >= 159 )
David Gibsona4da2e32007-12-18 15:06:42 +1100913 yy_c = yy_meta[(unsigned int) yy_c];
914 }
915 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
916 ++yy_cp;
917 }
Rob Herring47605972015-04-29 16:00:05 -0500918 while ( yy_current_state != 158 );
John Bonesio658f29a2010-11-17 15:28:20 -0800919 yy_cp = (yy_last_accepting_cpos);
920 yy_current_state = (yy_last_accepting_state);
David Gibsona4da2e32007-12-18 15:06:42 +1100921
922yy_find_action:
923 yy_act = yy_accept[yy_current_state];
David Gibsona4da2e32007-12-18 15:06:42 +1100924
925 YY_DO_BEFORE_ACTION;
926
David Gibsona4da2e32007-12-18 15:06:42 +1100927do_action: /* This label is used only to access EOF actions. */
928
929 switch ( yy_act )
930 { /* beginning of action switch */
931 case 0: /* must back up */
932 /* undo the effects of YY_DO_BEFORE_ACTION */
933 *yy_cp = (yy_hold_char);
934 yy_cp = (yy_last_accepting_cpos);
935 yy_current_state = (yy_last_accepting_state);
936 goto yy_find_action;
937
938case 1:
David Gibsoned95d742008-08-07 12:24:17 +1000939/* rule 1 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +1100940YY_RULE_SETUP
Rob Herring47605972015-04-29 16:00:05 -0500941#line 69 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100942{
David Gibsoned95d742008-08-07 12:24:17 +1000943 char *name = strchr(yytext, '\"') + 1;
944 yytext[yyleng-1] = '\0';
945 push_input_file(name);
David Gibsona4da2e32007-12-18 15:06:42 +1100946 }
947 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +0000948case 2:
949/* rule 2 can match eol */
950YY_RULE_SETUP
Rob Herring47605972015-04-29 16:00:05 -0500951#line 75 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +0000952{
Rob Herring91feabc2016-01-26 09:04:11 -0600953 char *line, *fnstart, *fnend;
954 struct data fn;
Stephen Warrencd296722012-09-28 21:25:59 +0000955 /* skip text before line # */
956 line = yytext;
Rob Herring47605972015-04-29 16:00:05 -0500957 while (!isdigit((unsigned char)*line))
Stephen Warrencd296722012-09-28 21:25:59 +0000958 line++;
Rob Herring91feabc2016-01-26 09:04:11 -0600959
960 /* regexp ensures that first and list "
961 * in the whole yytext are those at
962 * beginning and end of the filename string */
963 fnstart = memchr(yytext, '"', yyleng);
964 for (fnend = yytext + yyleng - 1;
965 *fnend != '"'; fnend--)
966 ;
967 assert(fnstart && fnend && (fnend > fnstart));
968
969 fn = data_copy_escape_string(fnstart + 1,
970 fnend - fnstart - 1);
971
972 /* Don't allow nuls in filenames */
973 if (memchr(fn.val, '\0', fn.len - 1))
974 lexical_error("nul in line number directive");
975
Stephen Warrencd296722012-09-28 21:25:59 +0000976 /* -1 since #line is the number of the next line */
Rob Herring91feabc2016-01-26 09:04:11 -0600977 srcpos_set_line(xstrdup(fn.val), atoi(line) - 1);
978 data_free(fn);
Stephen Warrencd296722012-09-28 21:25:59 +0000979 }
980 YY_BREAK
David Gibsona4da2e32007-12-18 15:06:42 +1100981case YY_STATE_EOF(INITIAL):
David Gibsona4da2e32007-12-18 15:06:42 +1100982case YY_STATE_EOF(BYTESTRING):
983case YY_STATE_EOF(PROPNODENAME):
984case YY_STATE_EOF(V1):
Rob Herring91feabc2016-01-26 09:04:11 -0600985#line 104 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100986{
987 if (!pop_input_file()) {
988 yyterminate();
989 }
990 }
991 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +0000992case 3:
993/* rule 3 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +1100994YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -0600995#line 110 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +1100996{
David Gibsona4da2e32007-12-18 15:06:42 +1100997 DPRINT("String: %s\n", yytext);
998 yylval.data = data_copy_escape_string(yytext+1,
999 yyleng-2);
David Gibsona4da2e32007-12-18 15:06:42 +11001000 return DT_STRING;
1001 }
1002 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001003case 4:
David Gibsona4da2e32007-12-18 15:06:42 +11001004YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001005#line 117 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001006{
David Gibsona4da2e32007-12-18 15:06:42 +11001007 DPRINT("Keyword: /dts-v1/\n");
1008 dts_version = 1;
1009 BEGIN_DEFAULT();
1010 return DT_V1;
1011 }
1012 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001013case 5:
David Gibsona4da2e32007-12-18 15:06:42 +11001014YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001015#line 124 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001016{
David Gibsona4da2e32007-12-18 15:06:42 +11001017 DPRINT("Keyword: /memreserve/\n");
1018 BEGIN_DEFAULT();
1019 return DT_MEMRESERVE;
1020 }
1021 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001022case 6:
David Gibsona4da2e32007-12-18 15:06:42 +11001023YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001024#line 130 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001025{
1026 DPRINT("Keyword: /bits/\n");
1027 BEGIN_DEFAULT();
1028 return DT_BITS;
1029 }
1030 YY_BREAK
1031case 7:
1032YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001033#line 136 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001034{
1035 DPRINT("Keyword: /delete-property/\n");
1036 DPRINT("<PROPNODENAME>\n");
1037 BEGIN(PROPNODENAME);
1038 return DT_DEL_PROP;
1039 }
1040 YY_BREAK
1041case 8:
1042YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001043#line 143 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001044{
1045 DPRINT("Keyword: /delete-node/\n");
1046 DPRINT("<PROPNODENAME>\n");
1047 BEGIN(PROPNODENAME);
1048 return DT_DEL_NODE;
1049 }
1050 YY_BREAK
1051case 9:
1052YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001053#line 150 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001054{
David Gibsona4da2e32007-12-18 15:06:42 +11001055 DPRINT("Label: %s\n", yytext);
John Bonesio658f29a2010-11-17 15:28:20 -08001056 yylval.labelref = xstrdup(yytext);
David Gibsona4da2e32007-12-18 15:06:42 +11001057 yylval.labelref[yyleng-1] = '\0';
1058 return DT_LABEL;
1059 }
1060 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001061case 10:
David Gibsona4da2e32007-12-18 15:06:42 +11001062YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001063#line 157 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001064{
Rob Herring47605972015-04-29 16:00:05 -05001065 char *e;
1066 DPRINT("Integer Literal: '%s'\n", yytext);
1067
1068 errno = 0;
1069 yylval.integer = strtoull(yytext, &e, 0);
1070
Rob Herring91feabc2016-01-26 09:04:11 -06001071 if (*e && e[strspn(e, "UL")]) {
1072 lexical_error("Bad integer literal '%s'",
1073 yytext);
1074 }
Rob Herring47605972015-04-29 16:00:05 -05001075
1076 if (errno == ERANGE)
1077 lexical_error("Integer literal '%s' out of range",
1078 yytext);
1079 else
1080 /* ERANGE is the only strtoull error triggerable
1081 * by strings matching the pattern */
1082 assert(errno == 0);
David Gibsona4da2e32007-12-18 15:06:42 +11001083 return DT_LITERAL;
1084 }
1085 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001086case 11:
1087/* rule 11 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001088YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001089#line 179 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001090{
Rob Herring47605972015-04-29 16:00:05 -05001091 struct data d;
1092 DPRINT("Character literal: %s\n", yytext);
1093
1094 d = data_copy_escape_string(yytext+1, yyleng-2);
1095 if (d.len == 1) {
1096 lexical_error("Empty character literal");
1097 yylval.integer = 0;
1098 return DT_CHAR_LITERAL;
1099 }
1100
1101 yylval.integer = (unsigned char)d.val[0];
1102
1103 if (d.len > 2)
1104 lexical_error("Character literal has %d"
1105 " characters instead of 1",
1106 d.len - 1);
1107
Stephen Warrencd296722012-09-28 21:25:59 +00001108 return DT_CHAR_LITERAL;
1109 }
1110 YY_BREAK
1111case 12:
1112YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001113#line 200 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001114{ /* label reference */
David Gibsona4da2e32007-12-18 15:06:42 +11001115 DPRINT("Ref: %s\n", yytext+1);
John Bonesio658f29a2010-11-17 15:28:20 -08001116 yylval.labelref = xstrdup(yytext+1);
David Gibsona4da2e32007-12-18 15:06:42 +11001117 return DT_REF;
1118 }
1119 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001120case 13:
David Gibsona4da2e32007-12-18 15:06:42 +11001121YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001122#line 206 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001123{ /* new-style path reference */
David Gibsona4da2e32007-12-18 15:06:42 +11001124 yytext[yyleng-1] = '\0';
1125 DPRINT("Ref: %s\n", yytext+2);
John Bonesio658f29a2010-11-17 15:28:20 -08001126 yylval.labelref = xstrdup(yytext+2);
David Gibsona4da2e32007-12-18 15:06:42 +11001127 return DT_REF;
1128 }
1129 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001130case 14:
David Gibsona4da2e32007-12-18 15:06:42 +11001131YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001132#line 213 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001133{
David Gibsona4da2e32007-12-18 15:06:42 +11001134 yylval.byte = strtol(yytext, NULL, 16);
1135 DPRINT("Byte: %02x\n", (int)yylval.byte);
1136 return DT_BYTE;
1137 }
1138 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001139case 15:
David Gibsona4da2e32007-12-18 15:06:42 +11001140YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001141#line 219 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001142{
David Gibsona4da2e32007-12-18 15:06:42 +11001143 DPRINT("/BYTESTRING\n");
1144 BEGIN_DEFAULT();
1145 return ']';
1146 }
1147 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001148case 16:
David Gibsona4da2e32007-12-18 15:06:42 +11001149YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001150#line 225 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001151{
David Gibsona4da2e32007-12-18 15:06:42 +11001152 DPRINT("PropNodeName: %s\n", yytext);
Stephen Warrencd296722012-09-28 21:25:59 +00001153 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
1154 yytext + 1 : yytext);
David Gibsona4da2e32007-12-18 15:06:42 +11001155 BEGIN_DEFAULT();
1156 return DT_PROPNODENAME;
1157 }
1158 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001159case 17:
David Gibsoned95d742008-08-07 12:24:17 +10001160YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001161#line 233 "dtc-lexer.l"
David Gibsoned95d742008-08-07 12:24:17 +10001162{
David Gibsoned95d742008-08-07 12:24:17 +10001163 DPRINT("Binary Include\n");
1164 return DT_INCBIN;
1165 }
1166 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001167case 18:
1168/* rule 18 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001169YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001170#line 238 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001171/* eat whitespace */
1172 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001173case 19:
1174/* rule 19 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001175YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001176#line 239 "dtc-lexer.l"
David Gibsoned95d742008-08-07 12:24:17 +10001177/* eat C-style comments */
David Gibsona4da2e32007-12-18 15:06:42 +11001178 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001179case 20:
1180/* rule 20 can match eol */
David Gibsona4da2e32007-12-18 15:06:42 +11001181YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001182#line 240 "dtc-lexer.l"
David Gibsoned95d742008-08-07 12:24:17 +10001183/* eat C++-style comments */
David Gibsona4da2e32007-12-18 15:06:42 +11001184 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001185case 21:
David Gibsona4da2e32007-12-18 15:06:42 +11001186YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001187#line 242 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001188{ return DT_LSHIFT; };
1189 YY_BREAK
1190case 22:
1191YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001192#line 243 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001193{ return DT_RSHIFT; };
1194 YY_BREAK
1195case 23:
1196YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001197#line 244 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001198{ return DT_LE; };
1199 YY_BREAK
1200case 24:
1201YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001202#line 245 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001203{ return DT_GE; };
1204 YY_BREAK
1205case 25:
1206YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001207#line 246 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001208{ return DT_EQ; };
1209 YY_BREAK
1210case 26:
1211YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001212#line 247 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001213{ return DT_NE; };
1214 YY_BREAK
1215case 27:
1216YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001217#line 248 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001218{ return DT_AND; };
1219 YY_BREAK
1220case 28:
1221YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001222#line 249 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00001223{ return DT_OR; };
1224 YY_BREAK
1225case 29:
1226YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001227#line 251 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001228{
David Gibsona4da2e32007-12-18 15:06:42 +11001229 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1230 (unsigned)yytext[0]);
1231 if (yytext[0] == '[') {
1232 DPRINT("<BYTESTRING>\n");
1233 BEGIN(BYTESTRING);
1234 }
1235 if ((yytext[0] == '{')
1236 || (yytext[0] == ';')) {
1237 DPRINT("<PROPNODENAME>\n");
1238 BEGIN(PROPNODENAME);
1239 }
1240 return yytext[0];
1241 }
1242 YY_BREAK
Stephen Warrencd296722012-09-28 21:25:59 +00001243case 30:
David Gibsona4da2e32007-12-18 15:06:42 +11001244YY_RULE_SETUP
Rob Herring91feabc2016-01-26 09:04:11 -06001245#line 266 "dtc-lexer.l"
David Gibsona4da2e32007-12-18 15:06:42 +11001246ECHO;
1247 YY_BREAK
Rob Herring91feabc2016-01-26 09:04:11 -06001248#line 1250 "dtc-lexer.lex.c"
David Gibsona4da2e32007-12-18 15:06:42 +11001249
1250 case YY_END_OF_BUFFER:
1251 {
1252 /* Amount of text matched not including the EOB char. */
1253 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1254
1255 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1256 *yy_cp = (yy_hold_char);
1257 YY_RESTORE_YY_MORE_OFFSET
1258
1259 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1260 {
1261 /* We're scanning a new file or input source. It's
1262 * possible that this happened because the user
1263 * just pointed yyin at a new source and called
1264 * yylex(). If so, then we have to assure
1265 * consistency between YY_CURRENT_BUFFER and our
1266 * globals. Here is the right place to do so, because
1267 * this is the first action (other than possibly a
1268 * back-up) that will match for the new input source.
1269 */
1270 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1271 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1272 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1273 }
1274
1275 /* Note that here we test for yy_c_buf_p "<=" to the position
1276 * of the first EOB in the buffer, since yy_c_buf_p will
1277 * already have been incremented past the NUL character
1278 * (since all states make transitions on EOB to the
1279 * end-of-buffer state). Contrast this with the test
1280 * in input().
1281 */
1282 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1283 { /* This was really a NUL. */
1284 yy_state_type yy_next_state;
1285
1286 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1287
1288 yy_current_state = yy_get_previous_state( );
1289
1290 /* Okay, we're now positioned to make the NUL
1291 * transition. We couldn't have
1292 * yy_get_previous_state() go ahead and do it
1293 * for us because it doesn't know how to deal
1294 * with the possibility of jamming (and we don't
1295 * want to build jamming into it because then it
1296 * will run more slowly).
1297 */
1298
1299 yy_next_state = yy_try_NUL_trans( yy_current_state );
1300
1301 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1302
1303 if ( yy_next_state )
1304 {
1305 /* Consume the NUL. */
1306 yy_cp = ++(yy_c_buf_p);
1307 yy_current_state = yy_next_state;
1308 goto yy_match;
1309 }
1310
1311 else
1312 {
John Bonesio658f29a2010-11-17 15:28:20 -08001313 yy_cp = (yy_last_accepting_cpos);
1314 yy_current_state = (yy_last_accepting_state);
David Gibsona4da2e32007-12-18 15:06:42 +11001315 goto yy_find_action;
1316 }
1317 }
1318
1319 else switch ( yy_get_next_buffer( ) )
1320 {
1321 case EOB_ACT_END_OF_FILE:
1322 {
1323 (yy_did_buffer_switch_on_eof) = 0;
1324
1325 if ( yywrap( ) )
1326 {
1327 /* Note: because we've taken care in
1328 * yy_get_next_buffer() to have set up
1329 * yytext, we can now set up
1330 * yy_c_buf_p so that if some total
1331 * hoser (like flex itself) wants to
1332 * call the scanner after we return the
1333 * YY_NULL, it'll still work - another
1334 * YY_NULL will get returned.
1335 */
1336 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1337
1338 yy_act = YY_STATE_EOF(YY_START);
1339 goto do_action;
1340 }
1341
1342 else
1343 {
1344 if ( ! (yy_did_buffer_switch_on_eof) )
1345 YY_NEW_FILE;
1346 }
1347 break;
1348 }
1349
1350 case EOB_ACT_CONTINUE_SCAN:
1351 (yy_c_buf_p) =
1352 (yytext_ptr) + yy_amount_of_matched_text;
1353
1354 yy_current_state = yy_get_previous_state( );
1355
1356 yy_cp = (yy_c_buf_p);
1357 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1358 goto yy_match;
1359
1360 case EOB_ACT_LAST_MATCH:
1361 (yy_c_buf_p) =
1362 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1363
1364 yy_current_state = yy_get_previous_state( );
1365
1366 yy_cp = (yy_c_buf_p);
1367 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1368 goto yy_find_action;
1369 }
1370 break;
1371 }
1372
1373 default:
1374 YY_FATAL_ERROR(
1375 "fatal flex scanner internal error--no action found" );
1376 } /* end of action switch */
1377 } /* end of scanning one token */
Rob Herring47605972015-04-29 16:00:05 -05001378 } /* end of user's declarations */
David Gibsona4da2e32007-12-18 15:06:42 +11001379} /* end of yylex */
1380
1381/* yy_get_next_buffer - try to read in a new buffer
1382 *
1383 * Returns a code representing an action:
1384 * EOB_ACT_LAST_MATCH -
1385 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1386 * EOB_ACT_END_OF_FILE - end of file
1387 */
1388static int yy_get_next_buffer (void)
1389{
1390 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1391 register char *source = (yytext_ptr);
1392 register int number_to_move, i;
1393 int ret_val;
1394
1395 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1396 YY_FATAL_ERROR(
1397 "fatal flex scanner internal error--end of buffer missed" );
1398
1399 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1400 { /* Don't try to fill the buffer, so this is an EOF. */
1401 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1402 {
1403 /* We matched a single character, the EOB, so
1404 * treat this as a final EOF.
1405 */
1406 return EOB_ACT_END_OF_FILE;
1407 }
1408
1409 else
1410 {
1411 /* We matched some text prior to the EOB, first
1412 * process it.
1413 */
1414 return EOB_ACT_LAST_MATCH;
1415 }
1416 }
1417
1418 /* Try to read more data. */
1419
1420 /* First move last chars to start of buffer. */
1421 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1422
1423 for ( i = 0; i < number_to_move; ++i )
1424 *(dest++) = *(source++);
1425
1426 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1427 /* don't do the read, it's not guaranteed to return an EOF,
1428 * just force an EOF
1429 */
1430 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1431
1432 else
1433 {
Rob Herring47605972015-04-29 16:00:05 -05001434 yy_size_t num_to_read =
David Gibsona4da2e32007-12-18 15:06:42 +11001435 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1436
1437 while ( num_to_read <= 0 )
1438 { /* Not enough room in the buffer - grow it. */
1439
1440 /* just a shorter name for the current buffer */
Rob Herring47605972015-04-29 16:00:05 -05001441 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
David Gibsona4da2e32007-12-18 15:06:42 +11001442
1443 int yy_c_buf_p_offset =
1444 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1445
1446 if ( b->yy_is_our_buffer )
1447 {
Rob Herring47605972015-04-29 16:00:05 -05001448 yy_size_t new_size = b->yy_buf_size * 2;
David Gibsona4da2e32007-12-18 15:06:42 +11001449
1450 if ( new_size <= 0 )
1451 b->yy_buf_size += b->yy_buf_size / 8;
1452 else
1453 b->yy_buf_size *= 2;
1454
1455 b->yy_ch_buf = (char *)
1456 /* Include room in for 2 EOB chars. */
1457 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1458 }
1459 else
1460 /* Can't grow it, we don't own it. */
1461 b->yy_ch_buf = 0;
1462
1463 if ( ! b->yy_ch_buf )
1464 YY_FATAL_ERROR(
1465 "fatal error - scanner input buffer overflow" );
1466
1467 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1468
1469 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1470 number_to_move - 1;
1471
1472 }
1473
1474 if ( num_to_read > YY_READ_BUF_SIZE )
1475 num_to_read = YY_READ_BUF_SIZE;
1476
1477 /* Read in more data. */
1478 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
Rob Herring47605972015-04-29 16:00:05 -05001479 (yy_n_chars), num_to_read );
David Gibsona4da2e32007-12-18 15:06:42 +11001480
1481 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1482 }
1483
1484 if ( (yy_n_chars) == 0 )
1485 {
1486 if ( number_to_move == YY_MORE_ADJ )
1487 {
1488 ret_val = EOB_ACT_END_OF_FILE;
1489 yyrestart(yyin );
1490 }
1491
1492 else
1493 {
1494 ret_val = EOB_ACT_LAST_MATCH;
1495 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1496 YY_BUFFER_EOF_PENDING;
1497 }
1498 }
1499
1500 else
1501 ret_val = EOB_ACT_CONTINUE_SCAN;
1502
David Gibsoned95d742008-08-07 12:24:17 +10001503 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1504 /* Extend the array by 50%, plus the number we really need. */
1505 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1506 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1507 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1508 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1509 }
1510
David Gibsona4da2e32007-12-18 15:06:42 +11001511 (yy_n_chars) += number_to_move;
1512 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1513 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1514
1515 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1516
1517 return ret_val;
1518}
1519
1520/* yy_get_previous_state - get the state just before the EOB char was reached */
1521
1522 static yy_state_type yy_get_previous_state (void)
1523{
1524 register yy_state_type yy_current_state;
1525 register char *yy_cp;
1526
1527 yy_current_state = (yy_start);
Stephen Warrencd296722012-09-28 21:25:59 +00001528 yy_current_state += YY_AT_BOL();
David Gibsona4da2e32007-12-18 15:06:42 +11001529
1530 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1531 {
1532 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1533 if ( yy_accept[yy_current_state] )
1534 {
1535 (yy_last_accepting_state) = yy_current_state;
1536 (yy_last_accepting_cpos) = yy_cp;
1537 }
1538 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1539 {
1540 yy_current_state = (int) yy_def[yy_current_state];
Rob Herring47605972015-04-29 16:00:05 -05001541 if ( yy_current_state >= 159 )
David Gibsona4da2e32007-12-18 15:06:42 +11001542 yy_c = yy_meta[(unsigned int) yy_c];
1543 }
1544 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1545 }
1546
1547 return yy_current_state;
1548}
1549
1550/* yy_try_NUL_trans - try to make a transition on the NUL character
1551 *
1552 * synopsis
1553 * next_state = yy_try_NUL_trans( current_state );
1554 */
1555 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1556{
1557 register int yy_is_jam;
1558 register char *yy_cp = (yy_c_buf_p);
1559
1560 register YY_CHAR yy_c = 1;
1561 if ( yy_accept[yy_current_state] )
1562 {
1563 (yy_last_accepting_state) = yy_current_state;
1564 (yy_last_accepting_cpos) = yy_cp;
1565 }
1566 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1567 {
1568 yy_current_state = (int) yy_def[yy_current_state];
Rob Herring47605972015-04-29 16:00:05 -05001569 if ( yy_current_state >= 159 )
David Gibsona4da2e32007-12-18 15:06:42 +11001570 yy_c = yy_meta[(unsigned int) yy_c];
1571 }
1572 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
Rob Herring47605972015-04-29 16:00:05 -05001573 yy_is_jam = (yy_current_state == 158);
David Gibsona4da2e32007-12-18 15:06:42 +11001574
Rob Herring47605972015-04-29 16:00:05 -05001575 return yy_is_jam ? 0 : yy_current_state;
David Gibsona4da2e32007-12-18 15:06:42 +11001576}
1577
1578#ifndef YY_NO_INPUT
1579#ifdef __cplusplus
1580 static int yyinput (void)
1581#else
1582 static int input (void)
1583#endif
1584
1585{
1586 int c;
1587
1588 *(yy_c_buf_p) = (yy_hold_char);
1589
1590 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1591 {
1592 /* yy_c_buf_p now points to the character we want to return.
1593 * If this occurs *before* the EOB characters, then it's a
1594 * valid NUL; if not, then we've hit the end of the buffer.
1595 */
1596 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1597 /* This was really a NUL. */
1598 *(yy_c_buf_p) = '\0';
1599
1600 else
1601 { /* need more input */
Rob Herring47605972015-04-29 16:00:05 -05001602 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
David Gibsona4da2e32007-12-18 15:06:42 +11001603 ++(yy_c_buf_p);
1604
1605 switch ( yy_get_next_buffer( ) )
1606 {
1607 case EOB_ACT_LAST_MATCH:
1608 /* This happens because yy_g_n_b()
1609 * sees that we've accumulated a
1610 * token and flags that we need to
1611 * try matching the token before
1612 * proceeding. But for input(),
1613 * there's no matching to consider.
1614 * So convert the EOB_ACT_LAST_MATCH
1615 * to EOB_ACT_END_OF_FILE.
1616 */
1617
1618 /* Reset buffer status. */
1619 yyrestart(yyin );
1620
1621 /*FALLTHROUGH*/
1622
1623 case EOB_ACT_END_OF_FILE:
1624 {
1625 if ( yywrap( ) )
1626 return EOF;
1627
1628 if ( ! (yy_did_buffer_switch_on_eof) )
1629 YY_NEW_FILE;
1630#ifdef __cplusplus
1631 return yyinput();
1632#else
1633 return input();
1634#endif
1635 }
1636
1637 case EOB_ACT_CONTINUE_SCAN:
1638 (yy_c_buf_p) = (yytext_ptr) + offset;
1639 break;
1640 }
1641 }
1642 }
1643
1644 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1645 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1646 (yy_hold_char) = *++(yy_c_buf_p);
1647
Stephen Warrencd296722012-09-28 21:25:59 +00001648 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1649
David Gibsona4da2e32007-12-18 15:06:42 +11001650 return c;
1651}
1652#endif /* ifndef YY_NO_INPUT */
1653
1654/** Immediately switch to a different input stream.
1655 * @param input_file A readable stream.
1656 *
1657 * @note This function does not reset the start condition to @c INITIAL .
1658 */
1659 void yyrestart (FILE * input_file )
1660{
1661
1662 if ( ! YY_CURRENT_BUFFER ){
1663 yyensure_buffer_stack ();
1664 YY_CURRENT_BUFFER_LVALUE =
1665 yy_create_buffer(yyin,YY_BUF_SIZE );
1666 }
1667
1668 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1669 yy_load_buffer_state( );
1670}
1671
1672/** Switch to a different input buffer.
1673 * @param new_buffer The new input buffer.
1674 *
1675 */
1676 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1677{
1678
1679 /* TODO. We should be able to replace this entire function body
1680 * with
1681 * yypop_buffer_state();
1682 * yypush_buffer_state(new_buffer);
1683 */
1684 yyensure_buffer_stack ();
1685 if ( YY_CURRENT_BUFFER == new_buffer )
1686 return;
1687
1688 if ( YY_CURRENT_BUFFER )
1689 {
1690 /* Flush out information for old buffer. */
1691 *(yy_c_buf_p) = (yy_hold_char);
1692 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1693 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1694 }
1695
1696 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1697 yy_load_buffer_state( );
1698
1699 /* We don't actually know whether we did this switch during
1700 * EOF (yywrap()) processing, but the only time this flag
1701 * is looked at is after yywrap() is called, so it's safe
1702 * to go ahead and always set it.
1703 */
1704 (yy_did_buffer_switch_on_eof) = 1;
1705}
1706
1707static void yy_load_buffer_state (void)
1708{
1709 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1710 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1711 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1712 (yy_hold_char) = *(yy_c_buf_p);
1713}
1714
1715/** Allocate and initialize an input buffer state.
1716 * @param file A readable stream.
1717 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1718 *
1719 * @return the allocated buffer state.
1720 */
1721 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1722{
1723 YY_BUFFER_STATE b;
1724
1725 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1726 if ( ! b )
1727 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1728
1729 b->yy_buf_size = size;
1730
1731 /* yy_ch_buf has to be 2 characters longer than the size given because
1732 * we need to put in 2 end-of-buffer characters.
1733 */
1734 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1735 if ( ! b->yy_ch_buf )
1736 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1737
1738 b->yy_is_our_buffer = 1;
1739
1740 yy_init_buffer(b,file );
1741
1742 return b;
1743}
1744
1745/** Destroy the buffer.
1746 * @param b a buffer created with yy_create_buffer()
1747 *
1748 */
1749 void yy_delete_buffer (YY_BUFFER_STATE b )
1750{
1751
1752 if ( ! b )
1753 return;
1754
1755 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1756 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1757
1758 if ( b->yy_is_our_buffer )
1759 yyfree((void *) b->yy_ch_buf );
1760
1761 yyfree((void *) b );
1762}
1763
David Gibsona4da2e32007-12-18 15:06:42 +11001764/* Initializes or reinitializes a buffer.
1765 * This function is sometimes called more than once on the same buffer,
1766 * such as during a yyrestart() or at EOF.
1767 */
1768 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1769
1770{
1771 int oerrno = errno;
1772
1773 yy_flush_buffer(b );
1774
1775 b->yy_input_file = file;
1776 b->yy_fill_buffer = 1;
1777
1778 /* If b is the current buffer, then yy_init_buffer was _probably_
1779 * called from yyrestart() or through yy_get_next_buffer.
1780 * In that case, we don't want to reset the lineno or column.
1781 */
1782 if (b != YY_CURRENT_BUFFER){
1783 b->yy_bs_lineno = 1;
1784 b->yy_bs_column = 0;
1785 }
1786
John Bonesio658f29a2010-11-17 15:28:20 -08001787 b->yy_is_interactive = 0;
David Gibsona4da2e32007-12-18 15:06:42 +11001788
1789 errno = oerrno;
1790}
1791
1792/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1793 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1794 *
1795 */
1796 void yy_flush_buffer (YY_BUFFER_STATE b )
1797{
1798 if ( ! b )
1799 return;
1800
1801 b->yy_n_chars = 0;
1802
1803 /* We always need two end-of-buffer characters. The first causes
1804 * a transition to the end-of-buffer state. The second causes
1805 * a jam in that state.
1806 */
1807 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1808 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1809
1810 b->yy_buf_pos = &b->yy_ch_buf[0];
1811
1812 b->yy_at_bol = 1;
1813 b->yy_buffer_status = YY_BUFFER_NEW;
1814
1815 if ( b == YY_CURRENT_BUFFER )
1816 yy_load_buffer_state( );
1817}
1818
1819/** Pushes the new state onto the stack. The new state becomes
1820 * the current state. This function will allocate the stack
1821 * if necessary.
1822 * @param new_buffer The new state.
1823 *
1824 */
1825void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1826{
1827 if (new_buffer == NULL)
1828 return;
1829
1830 yyensure_buffer_stack();
1831
1832 /* This block is copied from yy_switch_to_buffer. */
1833 if ( YY_CURRENT_BUFFER )
1834 {
1835 /* Flush out information for old buffer. */
1836 *(yy_c_buf_p) = (yy_hold_char);
1837 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1838 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1839 }
1840
1841 /* Only push if top exists. Otherwise, replace top. */
1842 if (YY_CURRENT_BUFFER)
1843 (yy_buffer_stack_top)++;
1844 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1845
1846 /* copied from yy_switch_to_buffer. */
1847 yy_load_buffer_state( );
1848 (yy_did_buffer_switch_on_eof) = 1;
1849}
1850
1851/** Removes and deletes the top of the stack, if present.
1852 * The next element becomes the new top.
1853 *
1854 */
1855void yypop_buffer_state (void)
1856{
1857 if (!YY_CURRENT_BUFFER)
1858 return;
1859
1860 yy_delete_buffer(YY_CURRENT_BUFFER );
1861 YY_CURRENT_BUFFER_LVALUE = NULL;
1862 if ((yy_buffer_stack_top) > 0)
1863 --(yy_buffer_stack_top);
1864
1865 if (YY_CURRENT_BUFFER) {
1866 yy_load_buffer_state( );
1867 (yy_did_buffer_switch_on_eof) = 1;
1868 }
1869}
1870
1871/* Allocates the stack if it does not exist.
1872 * Guarantees space for at least one push.
1873 */
1874static void yyensure_buffer_stack (void)
1875{
Rob Herring47605972015-04-29 16:00:05 -05001876 yy_size_t num_to_alloc;
David Gibsona4da2e32007-12-18 15:06:42 +11001877
1878 if (!(yy_buffer_stack)) {
1879
1880 /* First allocation is just for 2 elements, since we don't know if this
1881 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1882 * immediate realloc on the next call.
1883 */
1884 num_to_alloc = 1;
1885 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1886 (num_to_alloc * sizeof(struct yy_buffer_state*)
1887 );
David Gibsoned95d742008-08-07 12:24:17 +10001888 if ( ! (yy_buffer_stack) )
1889 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1890
David Gibsona4da2e32007-12-18 15:06:42 +11001891 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1892
1893 (yy_buffer_stack_max) = num_to_alloc;
1894 (yy_buffer_stack_top) = 0;
1895 return;
1896 }
1897
1898 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1899
1900 /* Increase the buffer to prepare for a possible push. */
1901 int grow_size = 8 /* arbitrary grow size */;
1902
1903 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1904 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1905 ((yy_buffer_stack),
1906 num_to_alloc * sizeof(struct yy_buffer_state*)
1907 );
David Gibsoned95d742008-08-07 12:24:17 +10001908 if ( ! (yy_buffer_stack) )
1909 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
David Gibsona4da2e32007-12-18 15:06:42 +11001910
1911 /* zero only the new slots.*/
1912 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1913 (yy_buffer_stack_max) = num_to_alloc;
1914 }
1915}
1916
1917/** Setup the input buffer state to scan directly from a user-specified character buffer.
1918 * @param base the character buffer
1919 * @param size the size in bytes of the character buffer
1920 *
1921 * @return the newly allocated buffer state object.
1922 */
1923YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1924{
1925 YY_BUFFER_STATE b;
1926
1927 if ( size < 2 ||
1928 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1929 base[size-1] != YY_END_OF_BUFFER_CHAR )
1930 /* They forgot to leave room for the EOB's. */
1931 return 0;
1932
1933 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1934 if ( ! b )
1935 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1936
1937 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1938 b->yy_buf_pos = b->yy_ch_buf = base;
1939 b->yy_is_our_buffer = 0;
1940 b->yy_input_file = 0;
1941 b->yy_n_chars = b->yy_buf_size;
1942 b->yy_is_interactive = 0;
1943 b->yy_at_bol = 1;
1944 b->yy_fill_buffer = 0;
1945 b->yy_buffer_status = YY_BUFFER_NEW;
1946
1947 yy_switch_to_buffer(b );
1948
1949 return b;
1950}
1951
1952/** Setup the input buffer state to scan a string. The next call to yylex() will
1953 * scan from a @e copy of @a str.
1954 * @param yystr a NUL-terminated string to scan
1955 *
1956 * @return the newly allocated buffer state object.
1957 * @note If you want to scan bytes that may contain NUL values, then use
1958 * yy_scan_bytes() instead.
1959 */
1960YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1961{
1962
1963 return yy_scan_bytes(yystr,strlen(yystr) );
1964}
1965
1966/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1967 * scan from a @e copy of @a bytes.
Stephen Warrencd296722012-09-28 21:25:59 +00001968 * @param yybytes the byte buffer to scan
1969 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
David Gibsona4da2e32007-12-18 15:06:42 +11001970 *
1971 * @return the newly allocated buffer state object.
1972 */
Rob Herring47605972015-04-29 16:00:05 -05001973YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
David Gibsona4da2e32007-12-18 15:06:42 +11001974{
1975 YY_BUFFER_STATE b;
1976 char *buf;
1977 yy_size_t n;
Rob Herring47605972015-04-29 16:00:05 -05001978 yy_size_t i;
David Gibsona4da2e32007-12-18 15:06:42 +11001979
1980 /* Get memory for full buffer, including space for trailing EOB's. */
1981 n = _yybytes_len + 2;
1982 buf = (char *) yyalloc(n );
1983 if ( ! buf )
1984 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1985
1986 for ( i = 0; i < _yybytes_len; ++i )
1987 buf[i] = yybytes[i];
1988
1989 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1990
1991 b = yy_scan_buffer(buf,n );
1992 if ( ! b )
1993 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1994
1995 /* It's okay to grow etc. this buffer, and we should throw it
1996 * away when we're done.
1997 */
1998 b->yy_is_our_buffer = 1;
1999
2000 return b;
2001}
2002
2003#ifndef YY_EXIT_FAILURE
2004#define YY_EXIT_FAILURE 2
2005#endif
2006
2007static void yy_fatal_error (yyconst char* msg )
2008{
2009 (void) fprintf( stderr, "%s\n", msg );
2010 exit( YY_EXIT_FAILURE );
2011}
2012
2013/* Redefine yyless() so it works in section 3 code. */
2014
2015#undef yyless
2016#define yyless(n) \
2017 do \
2018 { \
2019 /* Undo effects of setting up yytext. */ \
2020 int yyless_macro_arg = (n); \
2021 YY_LESS_LINENO(yyless_macro_arg);\
2022 yytext[yyleng] = (yy_hold_char); \
2023 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2024 (yy_hold_char) = *(yy_c_buf_p); \
2025 *(yy_c_buf_p) = '\0'; \
2026 yyleng = yyless_macro_arg; \
2027 } \
2028 while ( 0 )
2029
2030/* Accessor methods (get/set functions) to struct members. */
2031
2032/** Get the current line number.
2033 *
2034 */
2035int yyget_lineno (void)
2036{
2037
2038 return yylineno;
2039}
2040
2041/** Get the input stream.
2042 *
2043 */
2044FILE *yyget_in (void)
2045{
2046 return yyin;
2047}
2048
2049/** Get the output stream.
2050 *
2051 */
2052FILE *yyget_out (void)
2053{
2054 return yyout;
2055}
2056
2057/** Get the length of the current token.
2058 *
2059 */
Rob Herring47605972015-04-29 16:00:05 -05002060yy_size_t yyget_leng (void)
David Gibsona4da2e32007-12-18 15:06:42 +11002061{
2062 return yyleng;
2063}
2064
2065/** Get the current token.
2066 *
2067 */
2068
2069char *yyget_text (void)
2070{
2071 return yytext;
2072}
2073
2074/** Set the current line number.
2075 * @param line_number
2076 *
2077 */
2078void yyset_lineno (int line_number )
2079{
2080
2081 yylineno = line_number;
2082}
2083
2084/** Set the input stream. This does not discard the current
2085 * input buffer.
2086 * @param in_str A readable stream.
2087 *
2088 * @see yy_switch_to_buffer
2089 */
2090void yyset_in (FILE * in_str )
2091{
2092 yyin = in_str ;
2093}
2094
2095void yyset_out (FILE * out_str )
2096{
2097 yyout = out_str ;
2098}
2099
2100int yyget_debug (void)
2101{
2102 return yy_flex_debug;
2103}
2104
2105void yyset_debug (int bdebug )
2106{
2107 yy_flex_debug = bdebug ;
2108}
2109
2110static int yy_init_globals (void)
2111{
2112 /* Initialization is the same as for the non-reentrant scanner.
2113 * This function is called from yylex_destroy(), so don't allocate here.
2114 */
2115
David Gibsona4da2e32007-12-18 15:06:42 +11002116 (yy_buffer_stack) = 0;
2117 (yy_buffer_stack_top) = 0;
2118 (yy_buffer_stack_max) = 0;
2119 (yy_c_buf_p) = (char *) 0;
2120 (yy_init) = 0;
2121 (yy_start) = 0;
2122
2123/* Defined in main.c */
2124#ifdef YY_STDINIT
2125 yyin = stdin;
2126 yyout = stdout;
2127#else
2128 yyin = (FILE *) 0;
2129 yyout = (FILE *) 0;
2130#endif
2131
2132 /* For future reference: Set errno on error, since we are called by
2133 * yylex_init()
2134 */
2135 return 0;
2136}
2137
2138/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2139int yylex_destroy (void)
2140{
2141
2142 /* Pop the buffer stack, destroying each element. */
2143 while(YY_CURRENT_BUFFER){
2144 yy_delete_buffer(YY_CURRENT_BUFFER );
2145 YY_CURRENT_BUFFER_LVALUE = NULL;
2146 yypop_buffer_state();
2147 }
2148
2149 /* Destroy the stack itself. */
2150 yyfree((yy_buffer_stack) );
2151 (yy_buffer_stack) = NULL;
2152
2153 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2154 * yylex() is called, initialization will occur. */
2155 yy_init_globals( );
2156
2157 return 0;
2158}
2159
2160/*
2161 * Internal utility routines.
2162 */
2163
2164#ifndef yytext_ptr
2165static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2166{
2167 register int i;
2168 for ( i = 0; i < n; ++i )
2169 s1[i] = s2[i];
2170}
2171#endif
2172
2173#ifdef YY_NEED_STRLEN
2174static int yy_flex_strlen (yyconst char * s )
2175{
2176 register int n;
2177 for ( n = 0; s[n]; ++n )
2178 ;
2179
2180 return n;
2181}
2182#endif
2183
2184void *yyalloc (yy_size_t size )
2185{
2186 return (void *) malloc( size );
2187}
2188
2189void *yyrealloc (void * ptr, yy_size_t size )
2190{
2191 /* The cast to (char *) in the following accommodates both
2192 * implementations that use char* generic pointers, and those
2193 * that use void* generic pointers. It works with the latter
2194 * because both ANSI C and C++ allow castless assignment from
2195 * any pointer type to void*, and deal with argument conversions
2196 * as though doing an assignment.
2197 */
2198 return (void *) realloc( (char *) ptr, size );
2199}
2200
2201void yyfree (void * ptr )
2202{
2203 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2204}
2205
2206#define YYTABLES_NAME "yytables"
2207
Rob Herring91feabc2016-01-26 09:04:11 -06002208#line 265 "dtc-lexer.l"
Stephen Warrencd296722012-09-28 21:25:59 +00002209
2210
2211
David Gibsoned95d742008-08-07 12:24:17 +10002212static void push_input_file(const char *filename)
David Gibsona4da2e32007-12-18 15:06:42 +11002213{
David Gibsoned95d742008-08-07 12:24:17 +10002214 assert(filename);
2215
John Bonesio658f29a2010-11-17 15:28:20 -08002216 srcfile_push(filename);
David Gibsoned95d742008-08-07 12:24:17 +10002217
John Bonesio658f29a2010-11-17 15:28:20 -08002218 yyin = current_srcfile->f;
David Gibsona4da2e32007-12-18 15:06:42 +11002219
John Bonesio658f29a2010-11-17 15:28:20 -08002220 yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
David Gibsona4da2e32007-12-18 15:06:42 +11002221}
2222
Stephen Warrencd296722012-09-28 21:25:59 +00002223
Rob Herring47605972015-04-29 16:00:05 -05002224static bool pop_input_file(void)
David Gibsona4da2e32007-12-18 15:06:42 +11002225{
John Bonesio658f29a2010-11-17 15:28:20 -08002226 if (srcfile_pop() == 0)
Rob Herring47605972015-04-29 16:00:05 -05002227 return false;
David Gibsona4da2e32007-12-18 15:06:42 +11002228
John Bonesio658f29a2010-11-17 15:28:20 -08002229 yypop_buffer_state();
2230 yyin = current_srcfile->f;
David Gibsona4da2e32007-12-18 15:06:42 +11002231
Rob Herring47605972015-04-29 16:00:05 -05002232 return true;
2233}
2234
2235static void lexical_error(const char *fmt, ...)
2236{
2237 va_list ap;
2238
2239 va_start(ap, fmt);
2240 srcpos_verror(&yylloc, "Lexical error", fmt, ap);
2241 va_end(ap);
2242
2243 treesource_error = true;
David Gibsona4da2e32007-12-18 15:06:42 +11002244}
2245