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