Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1 | #line 2 "dtc-lexer.lex.c" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2 | |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 3 | #line 4 "dtc-lexer.lex.c" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 4 | |
| 5 | #define YY_INT_ALIGNED short int |
| 6 | |
| 7 | /* A lexical scanner generated by flex */ |
| 8 | |
| 9 | #define FLEX_SCANNER |
| 10 | #define YY_FLEX_MAJOR_VERSION 2 |
| 11 | #define YY_FLEX_MINOR_VERSION 5 |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 12 | #define YY_FLEX_SUBMINOR_VERSION 39 |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 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 | |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 34 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 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> |
| 44 | typedef int8_t flex_int8_t; |
| 45 | typedef uint8_t flex_uint8_t; |
| 46 | typedef int16_t flex_int16_t; |
| 47 | typedef uint16_t flex_uint16_t; |
| 48 | typedef int32_t flex_int32_t; |
| 49 | typedef uint32_t flex_uint32_t; |
| 50 | #else |
| 51 | typedef signed char flex_int8_t; |
| 52 | typedef short int flex_int16_t; |
| 53 | typedef int flex_int32_t; |
| 54 | typedef unsigned char flex_uint8_t; |
| 55 | typedef unsigned short int flex_uint16_t; |
| 56 | typedef unsigned int flex_uint32_t; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 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 | |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 87 | #endif /* ! C99 */ |
| 88 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 89 | #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 Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 98 | /* C99 requires __STDC__ to be defined as 1. */ |
| 99 | #if defined (__STDC__) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 100 | |
| 101 | #define YY_USE_CONST |
| 102 | |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 103 | #endif /* defined (__STDC__) */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 104 | #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 Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 145 | #ifdef __ia64__ |
| 146 | /* On IA-64, the buffer size is 16k, not 8k. |
| 147 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
| 148 | * Ditto for the __ia64__ case accordingly. |
| 149 | */ |
| 150 | #define YY_BUF_SIZE 32768 |
| 151 | #else |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 152 | #define YY_BUF_SIZE 16384 |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 153 | #endif /* __ia64__ */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 154 | #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 |
| 162 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
| 163 | #endif |
| 164 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 165 | #ifndef YY_TYPEDEF_YY_SIZE_T |
| 166 | #define YY_TYPEDEF_YY_SIZE_T |
| 167 | typedef size_t yy_size_t; |
| 168 | #endif |
| 169 | |
| 170 | extern yy_size_t yyleng; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 171 | |
| 172 | extern 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 Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 178 | #define YY_LESS_LINENO(n) |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 179 | #define YY_LINENO_REWIND_TO(ptr) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 180 | |
| 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 197 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
| 198 | #define YY_STRUCT_YY_BUFFER_STATE |
| 199 | struct 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 Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 214 | yy_size_t yy_n_chars; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 215 | |
| 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. */ |
| 263 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ |
| 264 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ |
| 265 | static 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. */ |
| 283 | static char yy_hold_char; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 284 | static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ |
| 285 | yy_size_t yyleng; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 286 | |
| 287 | /* Points to current character in buffer. */ |
| 288 | static char *yy_c_buf_p = (char *) 0; |
| 289 | static int yy_init = 0; /* whether we need to initialize */ |
| 290 | static 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 | */ |
| 295 | static int yy_did_buffer_switch_on_eof; |
| 296 | |
| 297 | void yyrestart (FILE *input_file ); |
| 298 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); |
| 299 | YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); |
| 300 | void yy_delete_buffer (YY_BUFFER_STATE b ); |
| 301 | void yy_flush_buffer (YY_BUFFER_STATE b ); |
| 302 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); |
| 303 | void yypop_buffer_state (void ); |
| 304 | |
| 305 | static void yyensure_buffer_stack (void ); |
| 306 | static void yy_load_buffer_state (void ); |
| 307 | static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); |
| 308 | |
| 309 | #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) |
| 310 | |
| 311 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); |
| 312 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 313 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 314 | |
| 315 | void *yyalloc (yy_size_t ); |
| 316 | void *yyrealloc (void *,yy_size_t ); |
| 317 | void 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 Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 345 | #define yywrap() 1 |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 346 | #define YY_SKIP_YYWRAP |
| 347 | |
| 348 | typedef unsigned char YY_CHAR; |
| 349 | |
| 350 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; |
| 351 | |
| 352 | typedef int yy_state_type; |
| 353 | |
| 354 | extern int yylineno; |
| 355 | |
| 356 | int yylineno = 1; |
| 357 | |
| 358 | extern char *yytext; |
| 359 | #define yytext_ptr yytext |
| 360 | |
| 361 | static yy_state_type yy_get_previous_state (void ); |
| 362 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); |
| 363 | static int yy_get_next_buffer (void ); |
| 364 | static 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 Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 376 | #define YY_NUM_RULES 30 |
| 377 | #define YY_END_OF_BUFFER 31 |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 378 | /* This struct is not used in this scanner, |
| 379 | but its presence is necessary. */ |
| 380 | struct yy_trans_info |
| 381 | { |
| 382 | flex_int32_t yy_verify; |
| 383 | flex_int32_t yy_nxt; |
| 384 | }; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 385 | static yyconst flex_int16_t yy_accept[159] = |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 386 | { 0, |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 387 | 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 Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 397 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 398 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 404 | } ; |
| 405 | |
| 406 | static yyconst flex_int32_t yy_ec[256] = |
| 407 | { 0, |
| 408 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
Grant Likely | 706b78f | 2013-06-13 12:57:44 +0100 | [diff] [blame] | 409 | 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 410 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Grant Likely | 706b78f | 2013-06-13 12:57:44 +0100 | [diff] [blame] | 411 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 418 | |
Grant Likely | 706b78f | 2013-06-13 12:57:44 +0100 | [diff] [blame] | 419 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 422 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 423 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 424 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 425 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 426 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 427 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 428 | 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 Likely | 706b78f | 2013-06-13 12:57:44 +0100 | [diff] [blame] | 438 | static yyconst flex_int32_t yy_meta[47] = |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 439 | { 0, |
Grant Likely | 706b78f | 2013-06-13 12:57:44 +0100 | [diff] [blame] | 440 | 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 Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 444 | 8, 8, 8, 3, 1, 4 |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 445 | } ; |
| 446 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 447 | static yyconst flex_int16_t yy_base[173] = |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 448 | { 0, |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 449 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 459 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 460 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 468 | } ; |
| 469 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 470 | static yyconst flex_int16_t yy_def[173] = |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 471 | { 0, |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 472 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 482 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 483 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 491 | } ; |
| 492 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 493 | static yyconst flex_int16_t yy_nxt[438] = |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 494 | { 0, |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 495 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 505 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 506 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 516 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 517 | 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 Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 527 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 528 | 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 Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 538 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 539 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 543 | } ; |
| 544 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 545 | static yyconst flex_int16_t yy_chk[438] = |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 546 | { 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 Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 550 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 551 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 557 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 558 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 568 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 569 | 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 Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 579 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 580 | 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 Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 590 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 591 | 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 Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 595 | } ; |
| 596 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 597 | static yy_state_type yy_last_accepting_state; |
| 598 | static char *yy_last_accepting_cpos; |
| 599 | |
| 600 | extern int yy_flex_debug; |
| 601 | int 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 |
| 610 | char *yytext; |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 611 | #line 1 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 612 | /* |
| 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 Triplett | 23c4ace | 2009-10-16 15:52:06 -0700 | [diff] [blame] | 631 | #define YY_NO_INPUT 1 |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 632 | |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 633 | |
| 634 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 635 | #line 37 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 636 | #include "dtc.h" |
| 637 | #include "srcpos.h" |
| 638 | #include "dtc-parser.tab.h" |
| 639 | |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 640 | YYLTYPE yylloc; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 641 | extern bool treesource_error; |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 642 | |
| 643 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ |
| 644 | #define YY_USER_ACTION \ |
| 645 | { \ |
| 646 | srcpos_update(&yylloc, yytext, yyleng); \ |
| 647 | } |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 648 | |
| 649 | /*#define LEXDEBUG 1*/ |
| 650 | |
| 651 | #ifdef LEXDEBUG |
| 652 | #define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) |
| 653 | #else |
| 654 | #define DPRINT(fmt, ...) do { } while (0) |
| 655 | #endif |
| 656 | |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 657 | static int dts_version = 1; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 658 | |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 659 | #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 660 | BEGIN(V1); \ |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 661 | |
| 662 | static void push_input_file(const char *filename); |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 663 | static bool pop_input_file(void); |
| 664 | static void lexical_error(const char *fmt, ...); |
| 665 | #line 666 "dtc-lexer.lex.c" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 666 | |
| 667 | #define INITIAL 0 |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 668 | #define BYTESTRING 1 |
| 669 | #define PROPNODENAME 2 |
| 670 | #define V1 3 |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 671 | |
| 672 | #ifndef YY_NO_UNISTD_H |
| 673 | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
| 674 | * down here because we want the user's section 1 to have been scanned first. |
| 675 | * The user has a chance to override it with an option. |
| 676 | */ |
| 677 | #include <unistd.h> |
| 678 | #endif |
| 679 | |
| 680 | #ifndef YY_EXTRA_TYPE |
| 681 | #define YY_EXTRA_TYPE void * |
| 682 | #endif |
| 683 | |
| 684 | static int yy_init_globals (void ); |
| 685 | |
Josh Triplett | 23c4ace | 2009-10-16 15:52:06 -0700 | [diff] [blame] | 686 | /* Accessor methods to globals. |
| 687 | These are made visible to non-reentrant scanners for convenience. */ |
| 688 | |
| 689 | int yylex_destroy (void ); |
| 690 | |
| 691 | int yyget_debug (void ); |
| 692 | |
| 693 | void yyset_debug (int debug_flag ); |
| 694 | |
| 695 | YY_EXTRA_TYPE yyget_extra (void ); |
| 696 | |
| 697 | void yyset_extra (YY_EXTRA_TYPE user_defined ); |
| 698 | |
| 699 | FILE *yyget_in (void ); |
| 700 | |
| 701 | void yyset_in (FILE * in_str ); |
| 702 | |
| 703 | FILE *yyget_out (void ); |
| 704 | |
| 705 | void yyset_out (FILE * out_str ); |
| 706 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 707 | yy_size_t yyget_leng (void ); |
Josh Triplett | 23c4ace | 2009-10-16 15:52:06 -0700 | [diff] [blame] | 708 | |
| 709 | char *yyget_text (void ); |
| 710 | |
| 711 | int yyget_lineno (void ); |
| 712 | |
| 713 | void yyset_lineno (int line_number ); |
| 714 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 715 | /* Macros after this point can all be overridden by user definitions in |
| 716 | * section 1. |
| 717 | */ |
| 718 | |
| 719 | #ifndef YY_SKIP_YYWRAP |
| 720 | #ifdef __cplusplus |
| 721 | extern "C" int yywrap (void ); |
| 722 | #else |
| 723 | extern int yywrap (void ); |
| 724 | #endif |
| 725 | #endif |
| 726 | |
| 727 | #ifndef yytext_ptr |
| 728 | static void yy_flex_strncpy (char *,yyconst char *,int ); |
| 729 | #endif |
| 730 | |
| 731 | #ifdef YY_NEED_STRLEN |
| 732 | static int yy_flex_strlen (yyconst char * ); |
| 733 | #endif |
| 734 | |
| 735 | #ifndef YY_NO_INPUT |
| 736 | |
| 737 | #ifdef __cplusplus |
| 738 | static int yyinput (void ); |
| 739 | #else |
| 740 | static int input (void ); |
| 741 | #endif |
| 742 | |
| 743 | #endif |
| 744 | |
| 745 | /* Amount of stuff to slurp up with each read. */ |
| 746 | #ifndef YY_READ_BUF_SIZE |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 747 | #ifdef __ia64__ |
| 748 | /* On IA-64, the buffer size is 16k, not 8k */ |
| 749 | #define YY_READ_BUF_SIZE 16384 |
| 750 | #else |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 751 | #define YY_READ_BUF_SIZE 8192 |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 752 | #endif /* __ia64__ */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 753 | #endif |
| 754 | |
| 755 | /* Copy whatever the last rule matched to the standard output. */ |
| 756 | #ifndef ECHO |
| 757 | /* This used to be an fputs(), but since the string might contain NUL's, |
| 758 | * we now use fwrite(). |
| 759 | */ |
Josh Triplett | 23c4ace | 2009-10-16 15:52:06 -0700 | [diff] [blame] | 760 | #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 761 | #endif |
| 762 | |
| 763 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
| 764 | * is returned in "result". |
| 765 | */ |
| 766 | #ifndef YY_INPUT |
| 767 | #define YY_INPUT(buf,result,max_size) \ |
| 768 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
| 769 | { \ |
| 770 | int c = '*'; \ |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 771 | size_t n; \ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 772 | for ( n = 0; n < max_size && \ |
| 773 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
| 774 | buf[n] = (char) c; \ |
| 775 | if ( c == '\n' ) \ |
| 776 | buf[n++] = (char) c; \ |
| 777 | if ( c == EOF && ferror( yyin ) ) \ |
| 778 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
| 779 | result = n; \ |
| 780 | } \ |
| 781 | else \ |
| 782 | { \ |
| 783 | errno=0; \ |
| 784 | while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ |
| 785 | { \ |
| 786 | if( errno != EINTR) \ |
| 787 | { \ |
| 788 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
| 789 | break; \ |
| 790 | } \ |
| 791 | errno=0; \ |
| 792 | clearerr(yyin); \ |
| 793 | } \ |
| 794 | }\ |
| 795 | \ |
| 796 | |
| 797 | #endif |
| 798 | |
| 799 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
| 800 | * we don't want an extra ';' after the "return" because that will cause |
| 801 | * some compilers to complain about unreachable statements. |
| 802 | */ |
| 803 | #ifndef yyterminate |
| 804 | #define yyterminate() return YY_NULL |
| 805 | #endif |
| 806 | |
| 807 | /* Number of entries by which start-condition stack grows. */ |
| 808 | #ifndef YY_START_STACK_INCR |
| 809 | #define YY_START_STACK_INCR 25 |
| 810 | #endif |
| 811 | |
| 812 | /* Report a fatal error. */ |
| 813 | #ifndef YY_FATAL_ERROR |
| 814 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) |
| 815 | #endif |
| 816 | |
| 817 | /* end tables serialization structures and prototypes */ |
| 818 | |
| 819 | /* Default declaration of generated scanner - a define so the user can |
| 820 | * easily add parameters. |
| 821 | */ |
| 822 | #ifndef YY_DECL |
| 823 | #define YY_DECL_IS_OURS 1 |
| 824 | |
| 825 | extern int yylex (void); |
| 826 | |
| 827 | #define YY_DECL int yylex (void) |
| 828 | #endif /* !YY_DECL */ |
| 829 | |
| 830 | /* Code executed at the beginning of each rule, after yytext and yyleng |
| 831 | * have been set up. |
| 832 | */ |
| 833 | #ifndef YY_USER_ACTION |
| 834 | #define YY_USER_ACTION |
| 835 | #endif |
| 836 | |
| 837 | /* Code executed at the end of each rule. */ |
| 838 | #ifndef YY_BREAK |
| 839 | #define YY_BREAK break; |
| 840 | #endif |
| 841 | |
| 842 | #define YY_RULE_SETUP \ |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 843 | if ( yyleng > 0 ) \ |
| 844 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ |
| 845 | (yytext[yyleng - 1] == '\n'); \ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 846 | YY_USER_ACTION |
| 847 | |
| 848 | /** The main scanner function which does all the work. |
| 849 | */ |
| 850 | YY_DECL |
| 851 | { |
| 852 | register yy_state_type yy_current_state; |
| 853 | register char *yy_cp, *yy_bp; |
| 854 | register int yy_act; |
| 855 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 856 | if ( !(yy_init) ) |
| 857 | { |
| 858 | (yy_init) = 1; |
| 859 | |
| 860 | #ifdef YY_USER_INIT |
| 861 | YY_USER_INIT; |
| 862 | #endif |
| 863 | |
| 864 | if ( ! (yy_start) ) |
| 865 | (yy_start) = 1; /* first start state */ |
| 866 | |
| 867 | if ( ! yyin ) |
| 868 | yyin = stdin; |
| 869 | |
| 870 | if ( ! yyout ) |
| 871 | yyout = stdout; |
| 872 | |
| 873 | if ( ! YY_CURRENT_BUFFER ) { |
| 874 | yyensure_buffer_stack (); |
| 875 | YY_CURRENT_BUFFER_LVALUE = |
| 876 | yy_create_buffer(yyin,YY_BUF_SIZE ); |
| 877 | } |
| 878 | |
| 879 | yy_load_buffer_state( ); |
| 880 | } |
| 881 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 882 | { |
| 883 | #line 68 "dtc-lexer.l" |
| 884 | |
| 885 | #line 886 "dtc-lexer.lex.c" |
| 886 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 887 | while ( 1 ) /* loops until end-of-file is reached */ |
| 888 | { |
| 889 | yy_cp = (yy_c_buf_p); |
| 890 | |
| 891 | /* Support of yytext. */ |
| 892 | *yy_cp = (yy_hold_char); |
| 893 | |
| 894 | /* yy_bp points to the position in yy_ch_buf of the start of |
| 895 | * the current run. |
| 896 | */ |
| 897 | yy_bp = yy_cp; |
| 898 | |
| 899 | yy_current_state = (yy_start); |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 900 | yy_current_state += YY_AT_BOL(); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 901 | yy_match: |
| 902 | do |
| 903 | { |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 904 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 905 | if ( yy_accept[yy_current_state] ) |
| 906 | { |
| 907 | (yy_last_accepting_state) = yy_current_state; |
| 908 | (yy_last_accepting_cpos) = yy_cp; |
| 909 | } |
| 910 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 911 | { |
| 912 | yy_current_state = (int) yy_def[yy_current_state]; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 913 | if ( yy_current_state >= 159 ) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 914 | yy_c = yy_meta[(unsigned int) yy_c]; |
| 915 | } |
| 916 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
| 917 | ++yy_cp; |
| 918 | } |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 919 | while ( yy_current_state != 158 ); |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 920 | yy_cp = (yy_last_accepting_cpos); |
| 921 | yy_current_state = (yy_last_accepting_state); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 922 | |
| 923 | yy_find_action: |
| 924 | yy_act = yy_accept[yy_current_state]; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 925 | |
| 926 | YY_DO_BEFORE_ACTION; |
| 927 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 928 | do_action: /* This label is used only to access EOF actions. */ |
| 929 | |
| 930 | switch ( yy_act ) |
| 931 | { /* beginning of action switch */ |
| 932 | case 0: /* must back up */ |
| 933 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
| 934 | *yy_cp = (yy_hold_char); |
| 935 | yy_cp = (yy_last_accepting_cpos); |
| 936 | yy_current_state = (yy_last_accepting_state); |
| 937 | goto yy_find_action; |
| 938 | |
| 939 | case 1: |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 940 | /* rule 1 can match eol */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 941 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 942 | #line 69 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 943 | { |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 944 | char *name = strchr(yytext, '\"') + 1; |
| 945 | yytext[yyleng-1] = '\0'; |
| 946 | push_input_file(name); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 947 | } |
| 948 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 949 | case 2: |
| 950 | /* rule 2 can match eol */ |
| 951 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 952 | #line 75 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 953 | { |
| 954 | char *line, *tmp, *fn; |
| 955 | /* skip text before line # */ |
| 956 | line = yytext; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 957 | while (!isdigit((unsigned char)*line)) |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 958 | line++; |
| 959 | /* skip digits in line # */ |
| 960 | tmp = line; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 961 | while (!isspace((unsigned char)*tmp)) |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 962 | tmp++; |
| 963 | /* "NULL"-terminate line # */ |
| 964 | *tmp = '\0'; |
| 965 | /* start of filename */ |
| 966 | fn = strchr(tmp + 1, '"') + 1; |
| 967 | /* strip trailing " from filename */ |
| 968 | tmp = strchr(fn, '"'); |
| 969 | *tmp = 0; |
| 970 | /* -1 since #line is the number of the next line */ |
| 971 | srcpos_set_line(xstrdup(fn), atoi(line) - 1); |
| 972 | } |
| 973 | YY_BREAK |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 974 | case YY_STATE_EOF(INITIAL): |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 975 | case YY_STATE_EOF(BYTESTRING): |
| 976 | case YY_STATE_EOF(PROPNODENAME): |
| 977 | case YY_STATE_EOF(V1): |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 978 | #line 96 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 979 | { |
| 980 | if (!pop_input_file()) { |
| 981 | yyterminate(); |
| 982 | } |
| 983 | } |
| 984 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 985 | case 3: |
| 986 | /* rule 3 can match eol */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 987 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 988 | #line 102 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 989 | { |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 990 | DPRINT("String: %s\n", yytext); |
| 991 | yylval.data = data_copy_escape_string(yytext+1, |
| 992 | yyleng-2); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 993 | return DT_STRING; |
| 994 | } |
| 995 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 996 | case 4: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 997 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 998 | #line 109 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 999 | { |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1000 | DPRINT("Keyword: /dts-v1/\n"); |
| 1001 | dts_version = 1; |
| 1002 | BEGIN_DEFAULT(); |
| 1003 | return DT_V1; |
| 1004 | } |
| 1005 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1006 | case 5: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1007 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1008 | #line 116 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1009 | { |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1010 | DPRINT("Keyword: /memreserve/\n"); |
| 1011 | BEGIN_DEFAULT(); |
| 1012 | return DT_MEMRESERVE; |
| 1013 | } |
| 1014 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1015 | case 6: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1016 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1017 | #line 122 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1018 | { |
| 1019 | DPRINT("Keyword: /bits/\n"); |
| 1020 | BEGIN_DEFAULT(); |
| 1021 | return DT_BITS; |
| 1022 | } |
| 1023 | YY_BREAK |
| 1024 | case 7: |
| 1025 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1026 | #line 128 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1027 | { |
| 1028 | DPRINT("Keyword: /delete-property/\n"); |
| 1029 | DPRINT("<PROPNODENAME>\n"); |
| 1030 | BEGIN(PROPNODENAME); |
| 1031 | return DT_DEL_PROP; |
| 1032 | } |
| 1033 | YY_BREAK |
| 1034 | case 8: |
| 1035 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1036 | #line 135 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1037 | { |
| 1038 | DPRINT("Keyword: /delete-node/\n"); |
| 1039 | DPRINT("<PROPNODENAME>\n"); |
| 1040 | BEGIN(PROPNODENAME); |
| 1041 | return DT_DEL_NODE; |
| 1042 | } |
| 1043 | YY_BREAK |
| 1044 | case 9: |
| 1045 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1046 | #line 142 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1047 | { |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1048 | DPRINT("Label: %s\n", yytext); |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 1049 | yylval.labelref = xstrdup(yytext); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1050 | yylval.labelref[yyleng-1] = '\0'; |
| 1051 | return DT_LABEL; |
| 1052 | } |
| 1053 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1054 | case 10: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1055 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1056 | #line 149 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1057 | { |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1058 | char *e; |
| 1059 | DPRINT("Integer Literal: '%s'\n", yytext); |
| 1060 | |
| 1061 | errno = 0; |
| 1062 | yylval.integer = strtoull(yytext, &e, 0); |
| 1063 | |
| 1064 | assert(!(*e) || !e[strspn(e, "UL")]); |
| 1065 | |
| 1066 | if (errno == ERANGE) |
| 1067 | lexical_error("Integer literal '%s' out of range", |
| 1068 | yytext); |
| 1069 | else |
| 1070 | /* ERANGE is the only strtoull error triggerable |
| 1071 | * by strings matching the pattern */ |
| 1072 | assert(errno == 0); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1073 | return DT_LITERAL; |
| 1074 | } |
| 1075 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1076 | case 11: |
| 1077 | /* rule 11 can match eol */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1078 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1079 | #line 168 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1080 | { |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1081 | struct data d; |
| 1082 | DPRINT("Character literal: %s\n", yytext); |
| 1083 | |
| 1084 | d = data_copy_escape_string(yytext+1, yyleng-2); |
| 1085 | if (d.len == 1) { |
| 1086 | lexical_error("Empty character literal"); |
| 1087 | yylval.integer = 0; |
| 1088 | return DT_CHAR_LITERAL; |
| 1089 | } |
| 1090 | |
| 1091 | yylval.integer = (unsigned char)d.val[0]; |
| 1092 | |
| 1093 | if (d.len > 2) |
| 1094 | lexical_error("Character literal has %d" |
| 1095 | " characters instead of 1", |
| 1096 | d.len - 1); |
| 1097 | |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1098 | return DT_CHAR_LITERAL; |
| 1099 | } |
| 1100 | YY_BREAK |
| 1101 | case 12: |
| 1102 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1103 | #line 189 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1104 | { /* label reference */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1105 | DPRINT("Ref: %s\n", yytext+1); |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 1106 | yylval.labelref = xstrdup(yytext+1); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1107 | return DT_REF; |
| 1108 | } |
| 1109 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1110 | case 13: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1111 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1112 | #line 195 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1113 | { /* new-style path reference */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1114 | yytext[yyleng-1] = '\0'; |
| 1115 | DPRINT("Ref: %s\n", yytext+2); |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 1116 | yylval.labelref = xstrdup(yytext+2); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1117 | return DT_REF; |
| 1118 | } |
| 1119 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1120 | case 14: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1121 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1122 | #line 202 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1123 | { |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1124 | yylval.byte = strtol(yytext, NULL, 16); |
| 1125 | DPRINT("Byte: %02x\n", (int)yylval.byte); |
| 1126 | return DT_BYTE; |
| 1127 | } |
| 1128 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1129 | case 15: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1130 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1131 | #line 208 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1132 | { |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1133 | DPRINT("/BYTESTRING\n"); |
| 1134 | BEGIN_DEFAULT(); |
| 1135 | return ']'; |
| 1136 | } |
| 1137 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1138 | case 16: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1139 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1140 | #line 214 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1141 | { |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1142 | DPRINT("PropNodeName: %s\n", yytext); |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1143 | yylval.propnodename = xstrdup((yytext[0] == '\\') ? |
| 1144 | yytext + 1 : yytext); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1145 | BEGIN_DEFAULT(); |
| 1146 | return DT_PROPNODENAME; |
| 1147 | } |
| 1148 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1149 | case 17: |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 1150 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1151 | #line 222 "dtc-lexer.l" |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 1152 | { |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 1153 | DPRINT("Binary Include\n"); |
| 1154 | return DT_INCBIN; |
| 1155 | } |
| 1156 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1157 | case 18: |
| 1158 | /* rule 18 can match eol */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1159 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1160 | #line 227 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1161 | /* eat whitespace */ |
| 1162 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1163 | case 19: |
| 1164 | /* rule 19 can match eol */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1165 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1166 | #line 228 "dtc-lexer.l" |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 1167 | /* eat C-style comments */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1168 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1169 | case 20: |
| 1170 | /* rule 20 can match eol */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1171 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1172 | #line 229 "dtc-lexer.l" |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 1173 | /* eat C++-style comments */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1174 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1175 | case 21: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1176 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1177 | #line 231 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1178 | { return DT_LSHIFT; }; |
| 1179 | YY_BREAK |
| 1180 | case 22: |
| 1181 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1182 | #line 232 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1183 | { return DT_RSHIFT; }; |
| 1184 | YY_BREAK |
| 1185 | case 23: |
| 1186 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1187 | #line 233 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1188 | { return DT_LE; }; |
| 1189 | YY_BREAK |
| 1190 | case 24: |
| 1191 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1192 | #line 234 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1193 | { return DT_GE; }; |
| 1194 | YY_BREAK |
| 1195 | case 25: |
| 1196 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1197 | #line 235 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1198 | { return DT_EQ; }; |
| 1199 | YY_BREAK |
| 1200 | case 26: |
| 1201 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1202 | #line 236 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1203 | { return DT_NE; }; |
| 1204 | YY_BREAK |
| 1205 | case 27: |
| 1206 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1207 | #line 237 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1208 | { return DT_AND; }; |
| 1209 | YY_BREAK |
| 1210 | case 28: |
| 1211 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1212 | #line 238 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1213 | { return DT_OR; }; |
| 1214 | YY_BREAK |
| 1215 | case 29: |
| 1216 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1217 | #line 240 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1218 | { |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1219 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], |
| 1220 | (unsigned)yytext[0]); |
| 1221 | if (yytext[0] == '[') { |
| 1222 | DPRINT("<BYTESTRING>\n"); |
| 1223 | BEGIN(BYTESTRING); |
| 1224 | } |
| 1225 | if ((yytext[0] == '{') |
| 1226 | || (yytext[0] == ';')) { |
| 1227 | DPRINT("<PROPNODENAME>\n"); |
| 1228 | BEGIN(PROPNODENAME); |
| 1229 | } |
| 1230 | return yytext[0]; |
| 1231 | } |
| 1232 | YY_BREAK |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1233 | case 30: |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1234 | YY_RULE_SETUP |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1235 | #line 255 "dtc-lexer.l" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1236 | ECHO; |
| 1237 | YY_BREAK |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1238 | #line 1239 "dtc-lexer.lex.c" |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1239 | |
| 1240 | case YY_END_OF_BUFFER: |
| 1241 | { |
| 1242 | /* Amount of text matched not including the EOB char. */ |
| 1243 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; |
| 1244 | |
| 1245 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
| 1246 | *yy_cp = (yy_hold_char); |
| 1247 | YY_RESTORE_YY_MORE_OFFSET |
| 1248 | |
| 1249 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) |
| 1250 | { |
| 1251 | /* We're scanning a new file or input source. It's |
| 1252 | * possible that this happened because the user |
| 1253 | * just pointed yyin at a new source and called |
| 1254 | * yylex(). If so, then we have to assure |
| 1255 | * consistency between YY_CURRENT_BUFFER and our |
| 1256 | * globals. Here is the right place to do so, because |
| 1257 | * this is the first action (other than possibly a |
| 1258 | * back-up) that will match for the new input source. |
| 1259 | */ |
| 1260 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
| 1261 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
| 1262 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
| 1263 | } |
| 1264 | |
| 1265 | /* Note that here we test for yy_c_buf_p "<=" to the position |
| 1266 | * of the first EOB in the buffer, since yy_c_buf_p will |
| 1267 | * already have been incremented past the NUL character |
| 1268 | * (since all states make transitions on EOB to the |
| 1269 | * end-of-buffer state). Contrast this with the test |
| 1270 | * in input(). |
| 1271 | */ |
| 1272 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) |
| 1273 | { /* This was really a NUL. */ |
| 1274 | yy_state_type yy_next_state; |
| 1275 | |
| 1276 | (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; |
| 1277 | |
| 1278 | yy_current_state = yy_get_previous_state( ); |
| 1279 | |
| 1280 | /* Okay, we're now positioned to make the NUL |
| 1281 | * transition. We couldn't have |
| 1282 | * yy_get_previous_state() go ahead and do it |
| 1283 | * for us because it doesn't know how to deal |
| 1284 | * with the possibility of jamming (and we don't |
| 1285 | * want to build jamming into it because then it |
| 1286 | * will run more slowly). |
| 1287 | */ |
| 1288 | |
| 1289 | yy_next_state = yy_try_NUL_trans( yy_current_state ); |
| 1290 | |
| 1291 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; |
| 1292 | |
| 1293 | if ( yy_next_state ) |
| 1294 | { |
| 1295 | /* Consume the NUL. */ |
| 1296 | yy_cp = ++(yy_c_buf_p); |
| 1297 | yy_current_state = yy_next_state; |
| 1298 | goto yy_match; |
| 1299 | } |
| 1300 | |
| 1301 | else |
| 1302 | { |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 1303 | yy_cp = (yy_last_accepting_cpos); |
| 1304 | yy_current_state = (yy_last_accepting_state); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1305 | goto yy_find_action; |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | else switch ( yy_get_next_buffer( ) ) |
| 1310 | { |
| 1311 | case EOB_ACT_END_OF_FILE: |
| 1312 | { |
| 1313 | (yy_did_buffer_switch_on_eof) = 0; |
| 1314 | |
| 1315 | if ( yywrap( ) ) |
| 1316 | { |
| 1317 | /* Note: because we've taken care in |
| 1318 | * yy_get_next_buffer() to have set up |
| 1319 | * yytext, we can now set up |
| 1320 | * yy_c_buf_p so that if some total |
| 1321 | * hoser (like flex itself) wants to |
| 1322 | * call the scanner after we return the |
| 1323 | * YY_NULL, it'll still work - another |
| 1324 | * YY_NULL will get returned. |
| 1325 | */ |
| 1326 | (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; |
| 1327 | |
| 1328 | yy_act = YY_STATE_EOF(YY_START); |
| 1329 | goto do_action; |
| 1330 | } |
| 1331 | |
| 1332 | else |
| 1333 | { |
| 1334 | if ( ! (yy_did_buffer_switch_on_eof) ) |
| 1335 | YY_NEW_FILE; |
| 1336 | } |
| 1337 | break; |
| 1338 | } |
| 1339 | |
| 1340 | case EOB_ACT_CONTINUE_SCAN: |
| 1341 | (yy_c_buf_p) = |
| 1342 | (yytext_ptr) + yy_amount_of_matched_text; |
| 1343 | |
| 1344 | yy_current_state = yy_get_previous_state( ); |
| 1345 | |
| 1346 | yy_cp = (yy_c_buf_p); |
| 1347 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; |
| 1348 | goto yy_match; |
| 1349 | |
| 1350 | case EOB_ACT_LAST_MATCH: |
| 1351 | (yy_c_buf_p) = |
| 1352 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; |
| 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_find_action; |
| 1359 | } |
| 1360 | break; |
| 1361 | } |
| 1362 | |
| 1363 | default: |
| 1364 | YY_FATAL_ERROR( |
| 1365 | "fatal flex scanner internal error--no action found" ); |
| 1366 | } /* end of action switch */ |
| 1367 | } /* end of scanning one token */ |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1368 | } /* end of user's declarations */ |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1369 | } /* end of yylex */ |
| 1370 | |
| 1371 | /* yy_get_next_buffer - try to read in a new buffer |
| 1372 | * |
| 1373 | * Returns a code representing an action: |
| 1374 | * EOB_ACT_LAST_MATCH - |
| 1375 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
| 1376 | * EOB_ACT_END_OF_FILE - end of file |
| 1377 | */ |
| 1378 | static int yy_get_next_buffer (void) |
| 1379 | { |
| 1380 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
| 1381 | register char *source = (yytext_ptr); |
| 1382 | register int number_to_move, i; |
| 1383 | int ret_val; |
| 1384 | |
| 1385 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) |
| 1386 | YY_FATAL_ERROR( |
| 1387 | "fatal flex scanner internal error--end of buffer missed" ); |
| 1388 | |
| 1389 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
| 1390 | { /* Don't try to fill the buffer, so this is an EOF. */ |
| 1391 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) |
| 1392 | { |
| 1393 | /* We matched a single character, the EOB, so |
| 1394 | * treat this as a final EOF. |
| 1395 | */ |
| 1396 | return EOB_ACT_END_OF_FILE; |
| 1397 | } |
| 1398 | |
| 1399 | else |
| 1400 | { |
| 1401 | /* We matched some text prior to the EOB, first |
| 1402 | * process it. |
| 1403 | */ |
| 1404 | return EOB_ACT_LAST_MATCH; |
| 1405 | } |
| 1406 | } |
| 1407 | |
| 1408 | /* Try to read more data. */ |
| 1409 | |
| 1410 | /* First move last chars to start of buffer. */ |
| 1411 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; |
| 1412 | |
| 1413 | for ( i = 0; i < number_to_move; ++i ) |
| 1414 | *(dest++) = *(source++); |
| 1415 | |
| 1416 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
| 1417 | /* don't do the read, it's not guaranteed to return an EOF, |
| 1418 | * just force an EOF |
| 1419 | */ |
| 1420 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; |
| 1421 | |
| 1422 | else |
| 1423 | { |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1424 | yy_size_t num_to_read = |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1425 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
| 1426 | |
| 1427 | while ( num_to_read <= 0 ) |
| 1428 | { /* Not enough room in the buffer - grow it. */ |
| 1429 | |
| 1430 | /* just a shorter name for the current buffer */ |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1431 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1432 | |
| 1433 | int yy_c_buf_p_offset = |
| 1434 | (int) ((yy_c_buf_p) - b->yy_ch_buf); |
| 1435 | |
| 1436 | if ( b->yy_is_our_buffer ) |
| 1437 | { |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1438 | yy_size_t new_size = b->yy_buf_size * 2; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1439 | |
| 1440 | if ( new_size <= 0 ) |
| 1441 | b->yy_buf_size += b->yy_buf_size / 8; |
| 1442 | else |
| 1443 | b->yy_buf_size *= 2; |
| 1444 | |
| 1445 | b->yy_ch_buf = (char *) |
| 1446 | /* Include room in for 2 EOB chars. */ |
| 1447 | yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); |
| 1448 | } |
| 1449 | else |
| 1450 | /* Can't grow it, we don't own it. */ |
| 1451 | b->yy_ch_buf = 0; |
| 1452 | |
| 1453 | if ( ! b->yy_ch_buf ) |
| 1454 | YY_FATAL_ERROR( |
| 1455 | "fatal error - scanner input buffer overflow" ); |
| 1456 | |
| 1457 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; |
| 1458 | |
| 1459 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - |
| 1460 | number_to_move - 1; |
| 1461 | |
| 1462 | } |
| 1463 | |
| 1464 | if ( num_to_read > YY_READ_BUF_SIZE ) |
| 1465 | num_to_read = YY_READ_BUF_SIZE; |
| 1466 | |
| 1467 | /* Read in more data. */ |
| 1468 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1469 | (yy_n_chars), num_to_read ); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1470 | |
| 1471 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
| 1472 | } |
| 1473 | |
| 1474 | if ( (yy_n_chars) == 0 ) |
| 1475 | { |
| 1476 | if ( number_to_move == YY_MORE_ADJ ) |
| 1477 | { |
| 1478 | ret_val = EOB_ACT_END_OF_FILE; |
| 1479 | yyrestart(yyin ); |
| 1480 | } |
| 1481 | |
| 1482 | else |
| 1483 | { |
| 1484 | ret_val = EOB_ACT_LAST_MATCH; |
| 1485 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = |
| 1486 | YY_BUFFER_EOF_PENDING; |
| 1487 | } |
| 1488 | } |
| 1489 | |
| 1490 | else |
| 1491 | ret_val = EOB_ACT_CONTINUE_SCAN; |
| 1492 | |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 1493 | if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { |
| 1494 | /* Extend the array by 50%, plus the number we really need. */ |
| 1495 | yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); |
| 1496 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); |
| 1497 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
| 1498 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); |
| 1499 | } |
| 1500 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1501 | (yy_n_chars) += number_to_move; |
| 1502 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; |
| 1503 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; |
| 1504 | |
| 1505 | (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
| 1506 | |
| 1507 | return ret_val; |
| 1508 | } |
| 1509 | |
| 1510 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
| 1511 | |
| 1512 | static yy_state_type yy_get_previous_state (void) |
| 1513 | { |
| 1514 | register yy_state_type yy_current_state; |
| 1515 | register char *yy_cp; |
| 1516 | |
| 1517 | yy_current_state = (yy_start); |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1518 | yy_current_state += YY_AT_BOL(); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1519 | |
| 1520 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) |
| 1521 | { |
| 1522 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
| 1523 | if ( yy_accept[yy_current_state] ) |
| 1524 | { |
| 1525 | (yy_last_accepting_state) = yy_current_state; |
| 1526 | (yy_last_accepting_cpos) = yy_cp; |
| 1527 | } |
| 1528 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 1529 | { |
| 1530 | yy_current_state = (int) yy_def[yy_current_state]; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1531 | if ( yy_current_state >= 159 ) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1532 | yy_c = yy_meta[(unsigned int) yy_c]; |
| 1533 | } |
| 1534 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
| 1535 | } |
| 1536 | |
| 1537 | return yy_current_state; |
| 1538 | } |
| 1539 | |
| 1540 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
| 1541 | * |
| 1542 | * synopsis |
| 1543 | * next_state = yy_try_NUL_trans( current_state ); |
| 1544 | */ |
| 1545 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) |
| 1546 | { |
| 1547 | register int yy_is_jam; |
| 1548 | register char *yy_cp = (yy_c_buf_p); |
| 1549 | |
| 1550 | register YY_CHAR yy_c = 1; |
| 1551 | if ( yy_accept[yy_current_state] ) |
| 1552 | { |
| 1553 | (yy_last_accepting_state) = yy_current_state; |
| 1554 | (yy_last_accepting_cpos) = yy_cp; |
| 1555 | } |
| 1556 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 1557 | { |
| 1558 | yy_current_state = (int) yy_def[yy_current_state]; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1559 | if ( yy_current_state >= 159 ) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1560 | yy_c = yy_meta[(unsigned int) yy_c]; |
| 1561 | } |
| 1562 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1563 | yy_is_jam = (yy_current_state == 158); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1564 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1565 | return yy_is_jam ? 0 : yy_current_state; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1566 | } |
| 1567 | |
| 1568 | #ifndef YY_NO_INPUT |
| 1569 | #ifdef __cplusplus |
| 1570 | static int yyinput (void) |
| 1571 | #else |
| 1572 | static int input (void) |
| 1573 | #endif |
| 1574 | |
| 1575 | { |
| 1576 | int c; |
| 1577 | |
| 1578 | *(yy_c_buf_p) = (yy_hold_char); |
| 1579 | |
| 1580 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) |
| 1581 | { |
| 1582 | /* yy_c_buf_p now points to the character we want to return. |
| 1583 | * If this occurs *before* the EOB characters, then it's a |
| 1584 | * valid NUL; if not, then we've hit the end of the buffer. |
| 1585 | */ |
| 1586 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) |
| 1587 | /* This was really a NUL. */ |
| 1588 | *(yy_c_buf_p) = '\0'; |
| 1589 | |
| 1590 | else |
| 1591 | { /* need more input */ |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1592 | yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1593 | ++(yy_c_buf_p); |
| 1594 | |
| 1595 | switch ( yy_get_next_buffer( ) ) |
| 1596 | { |
| 1597 | case EOB_ACT_LAST_MATCH: |
| 1598 | /* This happens because yy_g_n_b() |
| 1599 | * sees that we've accumulated a |
| 1600 | * token and flags that we need to |
| 1601 | * try matching the token before |
| 1602 | * proceeding. But for input(), |
| 1603 | * there's no matching to consider. |
| 1604 | * So convert the EOB_ACT_LAST_MATCH |
| 1605 | * to EOB_ACT_END_OF_FILE. |
| 1606 | */ |
| 1607 | |
| 1608 | /* Reset buffer status. */ |
| 1609 | yyrestart(yyin ); |
| 1610 | |
| 1611 | /*FALLTHROUGH*/ |
| 1612 | |
| 1613 | case EOB_ACT_END_OF_FILE: |
| 1614 | { |
| 1615 | if ( yywrap( ) ) |
| 1616 | return EOF; |
| 1617 | |
| 1618 | if ( ! (yy_did_buffer_switch_on_eof) ) |
| 1619 | YY_NEW_FILE; |
| 1620 | #ifdef __cplusplus |
| 1621 | return yyinput(); |
| 1622 | #else |
| 1623 | return input(); |
| 1624 | #endif |
| 1625 | } |
| 1626 | |
| 1627 | case EOB_ACT_CONTINUE_SCAN: |
| 1628 | (yy_c_buf_p) = (yytext_ptr) + offset; |
| 1629 | break; |
| 1630 | } |
| 1631 | } |
| 1632 | } |
| 1633 | |
| 1634 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ |
| 1635 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ |
| 1636 | (yy_hold_char) = *++(yy_c_buf_p); |
| 1637 | |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1638 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); |
| 1639 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1640 | return c; |
| 1641 | } |
| 1642 | #endif /* ifndef YY_NO_INPUT */ |
| 1643 | |
| 1644 | /** Immediately switch to a different input stream. |
| 1645 | * @param input_file A readable stream. |
| 1646 | * |
| 1647 | * @note This function does not reset the start condition to @c INITIAL . |
| 1648 | */ |
| 1649 | void yyrestart (FILE * input_file ) |
| 1650 | { |
| 1651 | |
| 1652 | if ( ! YY_CURRENT_BUFFER ){ |
| 1653 | yyensure_buffer_stack (); |
| 1654 | YY_CURRENT_BUFFER_LVALUE = |
| 1655 | yy_create_buffer(yyin,YY_BUF_SIZE ); |
| 1656 | } |
| 1657 | |
| 1658 | yy_init_buffer(YY_CURRENT_BUFFER,input_file ); |
| 1659 | yy_load_buffer_state( ); |
| 1660 | } |
| 1661 | |
| 1662 | /** Switch to a different input buffer. |
| 1663 | * @param new_buffer The new input buffer. |
| 1664 | * |
| 1665 | */ |
| 1666 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) |
| 1667 | { |
| 1668 | |
| 1669 | /* TODO. We should be able to replace this entire function body |
| 1670 | * with |
| 1671 | * yypop_buffer_state(); |
| 1672 | * yypush_buffer_state(new_buffer); |
| 1673 | */ |
| 1674 | yyensure_buffer_stack (); |
| 1675 | if ( YY_CURRENT_BUFFER == new_buffer ) |
| 1676 | return; |
| 1677 | |
| 1678 | if ( YY_CURRENT_BUFFER ) |
| 1679 | { |
| 1680 | /* Flush out information for old buffer. */ |
| 1681 | *(yy_c_buf_p) = (yy_hold_char); |
| 1682 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); |
| 1683 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
| 1684 | } |
| 1685 | |
| 1686 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
| 1687 | yy_load_buffer_state( ); |
| 1688 | |
| 1689 | /* We don't actually know whether we did this switch during |
| 1690 | * EOF (yywrap()) processing, but the only time this flag |
| 1691 | * is looked at is after yywrap() is called, so it's safe |
| 1692 | * to go ahead and always set it. |
| 1693 | */ |
| 1694 | (yy_did_buffer_switch_on_eof) = 1; |
| 1695 | } |
| 1696 | |
| 1697 | static void yy_load_buffer_state (void) |
| 1698 | { |
| 1699 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
| 1700 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
| 1701 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
| 1702 | (yy_hold_char) = *(yy_c_buf_p); |
| 1703 | } |
| 1704 | |
| 1705 | /** Allocate and initialize an input buffer state. |
| 1706 | * @param file A readable stream. |
| 1707 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
| 1708 | * |
| 1709 | * @return the allocated buffer state. |
| 1710 | */ |
| 1711 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) |
| 1712 | { |
| 1713 | YY_BUFFER_STATE b; |
| 1714 | |
| 1715 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); |
| 1716 | if ( ! b ) |
| 1717 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 1718 | |
| 1719 | b->yy_buf_size = size; |
| 1720 | |
| 1721 | /* yy_ch_buf has to be 2 characters longer than the size given because |
| 1722 | * we need to put in 2 end-of-buffer characters. |
| 1723 | */ |
| 1724 | b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); |
| 1725 | if ( ! b->yy_ch_buf ) |
| 1726 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 1727 | |
| 1728 | b->yy_is_our_buffer = 1; |
| 1729 | |
| 1730 | yy_init_buffer(b,file ); |
| 1731 | |
| 1732 | return b; |
| 1733 | } |
| 1734 | |
| 1735 | /** Destroy the buffer. |
| 1736 | * @param b a buffer created with yy_create_buffer() |
| 1737 | * |
| 1738 | */ |
| 1739 | void yy_delete_buffer (YY_BUFFER_STATE b ) |
| 1740 | { |
| 1741 | |
| 1742 | if ( ! b ) |
| 1743 | return; |
| 1744 | |
| 1745 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ |
| 1746 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; |
| 1747 | |
| 1748 | if ( b->yy_is_our_buffer ) |
| 1749 | yyfree((void *) b->yy_ch_buf ); |
| 1750 | |
| 1751 | yyfree((void *) b ); |
| 1752 | } |
| 1753 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1754 | /* Initializes or reinitializes a buffer. |
| 1755 | * This function is sometimes called more than once on the same buffer, |
| 1756 | * such as during a yyrestart() or at EOF. |
| 1757 | */ |
| 1758 | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) |
| 1759 | |
| 1760 | { |
| 1761 | int oerrno = errno; |
| 1762 | |
| 1763 | yy_flush_buffer(b ); |
| 1764 | |
| 1765 | b->yy_input_file = file; |
| 1766 | b->yy_fill_buffer = 1; |
| 1767 | |
| 1768 | /* If b is the current buffer, then yy_init_buffer was _probably_ |
| 1769 | * called from yyrestart() or through yy_get_next_buffer. |
| 1770 | * In that case, we don't want to reset the lineno or column. |
| 1771 | */ |
| 1772 | if (b != YY_CURRENT_BUFFER){ |
| 1773 | b->yy_bs_lineno = 1; |
| 1774 | b->yy_bs_column = 0; |
| 1775 | } |
| 1776 | |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 1777 | b->yy_is_interactive = 0; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1778 | |
| 1779 | errno = oerrno; |
| 1780 | } |
| 1781 | |
| 1782 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
| 1783 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
| 1784 | * |
| 1785 | */ |
| 1786 | void yy_flush_buffer (YY_BUFFER_STATE b ) |
| 1787 | { |
| 1788 | if ( ! b ) |
| 1789 | return; |
| 1790 | |
| 1791 | b->yy_n_chars = 0; |
| 1792 | |
| 1793 | /* We always need two end-of-buffer characters. The first causes |
| 1794 | * a transition to the end-of-buffer state. The second causes |
| 1795 | * a jam in that state. |
| 1796 | */ |
| 1797 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
| 1798 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
| 1799 | |
| 1800 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
| 1801 | |
| 1802 | b->yy_at_bol = 1; |
| 1803 | b->yy_buffer_status = YY_BUFFER_NEW; |
| 1804 | |
| 1805 | if ( b == YY_CURRENT_BUFFER ) |
| 1806 | yy_load_buffer_state( ); |
| 1807 | } |
| 1808 | |
| 1809 | /** Pushes the new state onto the stack. The new state becomes |
| 1810 | * the current state. This function will allocate the stack |
| 1811 | * if necessary. |
| 1812 | * @param new_buffer The new state. |
| 1813 | * |
| 1814 | */ |
| 1815 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) |
| 1816 | { |
| 1817 | if (new_buffer == NULL) |
| 1818 | return; |
| 1819 | |
| 1820 | yyensure_buffer_stack(); |
| 1821 | |
| 1822 | /* This block is copied from yy_switch_to_buffer. */ |
| 1823 | if ( YY_CURRENT_BUFFER ) |
| 1824 | { |
| 1825 | /* Flush out information for old buffer. */ |
| 1826 | *(yy_c_buf_p) = (yy_hold_char); |
| 1827 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); |
| 1828 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
| 1829 | } |
| 1830 | |
| 1831 | /* Only push if top exists. Otherwise, replace top. */ |
| 1832 | if (YY_CURRENT_BUFFER) |
| 1833 | (yy_buffer_stack_top)++; |
| 1834 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
| 1835 | |
| 1836 | /* copied from yy_switch_to_buffer. */ |
| 1837 | yy_load_buffer_state( ); |
| 1838 | (yy_did_buffer_switch_on_eof) = 1; |
| 1839 | } |
| 1840 | |
| 1841 | /** Removes and deletes the top of the stack, if present. |
| 1842 | * The next element becomes the new top. |
| 1843 | * |
| 1844 | */ |
| 1845 | void yypop_buffer_state (void) |
| 1846 | { |
| 1847 | if (!YY_CURRENT_BUFFER) |
| 1848 | return; |
| 1849 | |
| 1850 | yy_delete_buffer(YY_CURRENT_BUFFER ); |
| 1851 | YY_CURRENT_BUFFER_LVALUE = NULL; |
| 1852 | if ((yy_buffer_stack_top) > 0) |
| 1853 | --(yy_buffer_stack_top); |
| 1854 | |
| 1855 | if (YY_CURRENT_BUFFER) { |
| 1856 | yy_load_buffer_state( ); |
| 1857 | (yy_did_buffer_switch_on_eof) = 1; |
| 1858 | } |
| 1859 | } |
| 1860 | |
| 1861 | /* Allocates the stack if it does not exist. |
| 1862 | * Guarantees space for at least one push. |
| 1863 | */ |
| 1864 | static void yyensure_buffer_stack (void) |
| 1865 | { |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1866 | yy_size_t num_to_alloc; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1867 | |
| 1868 | if (!(yy_buffer_stack)) { |
| 1869 | |
| 1870 | /* First allocation is just for 2 elements, since we don't know if this |
| 1871 | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
| 1872 | * immediate realloc on the next call. |
| 1873 | */ |
| 1874 | num_to_alloc = 1; |
| 1875 | (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc |
| 1876 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
| 1877 | ); |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 1878 | if ( ! (yy_buffer_stack) ) |
| 1879 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
| 1880 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1881 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
| 1882 | |
| 1883 | (yy_buffer_stack_max) = num_to_alloc; |
| 1884 | (yy_buffer_stack_top) = 0; |
| 1885 | return; |
| 1886 | } |
| 1887 | |
| 1888 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ |
| 1889 | |
| 1890 | /* Increase the buffer to prepare for a possible push. */ |
| 1891 | int grow_size = 8 /* arbitrary grow size */; |
| 1892 | |
| 1893 | num_to_alloc = (yy_buffer_stack_max) + grow_size; |
| 1894 | (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc |
| 1895 | ((yy_buffer_stack), |
| 1896 | num_to_alloc * sizeof(struct yy_buffer_state*) |
| 1897 | ); |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 1898 | if ( ! (yy_buffer_stack) ) |
| 1899 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1900 | |
| 1901 | /* zero only the new slots.*/ |
| 1902 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); |
| 1903 | (yy_buffer_stack_max) = num_to_alloc; |
| 1904 | } |
| 1905 | } |
| 1906 | |
| 1907 | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
| 1908 | * @param base the character buffer |
| 1909 | * @param size the size in bytes of the character buffer |
| 1910 | * |
| 1911 | * @return the newly allocated buffer state object. |
| 1912 | */ |
| 1913 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) |
| 1914 | { |
| 1915 | YY_BUFFER_STATE b; |
| 1916 | |
| 1917 | if ( size < 2 || |
| 1918 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
| 1919 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
| 1920 | /* They forgot to leave room for the EOB's. */ |
| 1921 | return 0; |
| 1922 | |
| 1923 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); |
| 1924 | if ( ! b ) |
| 1925 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
| 1926 | |
| 1927 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
| 1928 | b->yy_buf_pos = b->yy_ch_buf = base; |
| 1929 | b->yy_is_our_buffer = 0; |
| 1930 | b->yy_input_file = 0; |
| 1931 | b->yy_n_chars = b->yy_buf_size; |
| 1932 | b->yy_is_interactive = 0; |
| 1933 | b->yy_at_bol = 1; |
| 1934 | b->yy_fill_buffer = 0; |
| 1935 | b->yy_buffer_status = YY_BUFFER_NEW; |
| 1936 | |
| 1937 | yy_switch_to_buffer(b ); |
| 1938 | |
| 1939 | return b; |
| 1940 | } |
| 1941 | |
| 1942 | /** Setup the input buffer state to scan a string. The next call to yylex() will |
| 1943 | * scan from a @e copy of @a str. |
| 1944 | * @param yystr a NUL-terminated string to scan |
| 1945 | * |
| 1946 | * @return the newly allocated buffer state object. |
| 1947 | * @note If you want to scan bytes that may contain NUL values, then use |
| 1948 | * yy_scan_bytes() instead. |
| 1949 | */ |
| 1950 | YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) |
| 1951 | { |
| 1952 | |
| 1953 | return yy_scan_bytes(yystr,strlen(yystr) ); |
| 1954 | } |
| 1955 | |
| 1956 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
| 1957 | * scan from a @e copy of @a bytes. |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 1958 | * @param yybytes the byte buffer to scan |
| 1959 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1960 | * |
| 1961 | * @return the newly allocated buffer state object. |
| 1962 | */ |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1963 | YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1964 | { |
| 1965 | YY_BUFFER_STATE b; |
| 1966 | char *buf; |
| 1967 | yy_size_t n; |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 1968 | yy_size_t i; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 1969 | |
| 1970 | /* Get memory for full buffer, including space for trailing EOB's. */ |
| 1971 | n = _yybytes_len + 2; |
| 1972 | buf = (char *) yyalloc(n ); |
| 1973 | if ( ! buf ) |
| 1974 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
| 1975 | |
| 1976 | for ( i = 0; i < _yybytes_len; ++i ) |
| 1977 | buf[i] = yybytes[i]; |
| 1978 | |
| 1979 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
| 1980 | |
| 1981 | b = yy_scan_buffer(buf,n ); |
| 1982 | if ( ! b ) |
| 1983 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
| 1984 | |
| 1985 | /* It's okay to grow etc. this buffer, and we should throw it |
| 1986 | * away when we're done. |
| 1987 | */ |
| 1988 | b->yy_is_our_buffer = 1; |
| 1989 | |
| 1990 | return b; |
| 1991 | } |
| 1992 | |
| 1993 | #ifndef YY_EXIT_FAILURE |
| 1994 | #define YY_EXIT_FAILURE 2 |
| 1995 | #endif |
| 1996 | |
| 1997 | static void yy_fatal_error (yyconst char* msg ) |
| 1998 | { |
| 1999 | (void) fprintf( stderr, "%s\n", msg ); |
| 2000 | exit( YY_EXIT_FAILURE ); |
| 2001 | } |
| 2002 | |
| 2003 | /* Redefine yyless() so it works in section 3 code. */ |
| 2004 | |
| 2005 | #undef yyless |
| 2006 | #define yyless(n) \ |
| 2007 | do \ |
| 2008 | { \ |
| 2009 | /* Undo effects of setting up yytext. */ \ |
| 2010 | int yyless_macro_arg = (n); \ |
| 2011 | YY_LESS_LINENO(yyless_macro_arg);\ |
| 2012 | yytext[yyleng] = (yy_hold_char); \ |
| 2013 | (yy_c_buf_p) = yytext + yyless_macro_arg; \ |
| 2014 | (yy_hold_char) = *(yy_c_buf_p); \ |
| 2015 | *(yy_c_buf_p) = '\0'; \ |
| 2016 | yyleng = yyless_macro_arg; \ |
| 2017 | } \ |
| 2018 | while ( 0 ) |
| 2019 | |
| 2020 | /* Accessor methods (get/set functions) to struct members. */ |
| 2021 | |
| 2022 | /** Get the current line number. |
| 2023 | * |
| 2024 | */ |
| 2025 | int yyget_lineno (void) |
| 2026 | { |
| 2027 | |
| 2028 | return yylineno; |
| 2029 | } |
| 2030 | |
| 2031 | /** Get the input stream. |
| 2032 | * |
| 2033 | */ |
| 2034 | FILE *yyget_in (void) |
| 2035 | { |
| 2036 | return yyin; |
| 2037 | } |
| 2038 | |
| 2039 | /** Get the output stream. |
| 2040 | * |
| 2041 | */ |
| 2042 | FILE *yyget_out (void) |
| 2043 | { |
| 2044 | return yyout; |
| 2045 | } |
| 2046 | |
| 2047 | /** Get the length of the current token. |
| 2048 | * |
| 2049 | */ |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 2050 | yy_size_t yyget_leng (void) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2051 | { |
| 2052 | return yyleng; |
| 2053 | } |
| 2054 | |
| 2055 | /** Get the current token. |
| 2056 | * |
| 2057 | */ |
| 2058 | |
| 2059 | char *yyget_text (void) |
| 2060 | { |
| 2061 | return yytext; |
| 2062 | } |
| 2063 | |
| 2064 | /** Set the current line number. |
| 2065 | * @param line_number |
| 2066 | * |
| 2067 | */ |
| 2068 | void yyset_lineno (int line_number ) |
| 2069 | { |
| 2070 | |
| 2071 | yylineno = line_number; |
| 2072 | } |
| 2073 | |
| 2074 | /** Set the input stream. This does not discard the current |
| 2075 | * input buffer. |
| 2076 | * @param in_str A readable stream. |
| 2077 | * |
| 2078 | * @see yy_switch_to_buffer |
| 2079 | */ |
| 2080 | void yyset_in (FILE * in_str ) |
| 2081 | { |
| 2082 | yyin = in_str ; |
| 2083 | } |
| 2084 | |
| 2085 | void yyset_out (FILE * out_str ) |
| 2086 | { |
| 2087 | yyout = out_str ; |
| 2088 | } |
| 2089 | |
| 2090 | int yyget_debug (void) |
| 2091 | { |
| 2092 | return yy_flex_debug; |
| 2093 | } |
| 2094 | |
| 2095 | void yyset_debug (int bdebug ) |
| 2096 | { |
| 2097 | yy_flex_debug = bdebug ; |
| 2098 | } |
| 2099 | |
| 2100 | static int yy_init_globals (void) |
| 2101 | { |
| 2102 | /* Initialization is the same as for the non-reentrant scanner. |
| 2103 | * This function is called from yylex_destroy(), so don't allocate here. |
| 2104 | */ |
| 2105 | |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2106 | (yy_buffer_stack) = 0; |
| 2107 | (yy_buffer_stack_top) = 0; |
| 2108 | (yy_buffer_stack_max) = 0; |
| 2109 | (yy_c_buf_p) = (char *) 0; |
| 2110 | (yy_init) = 0; |
| 2111 | (yy_start) = 0; |
| 2112 | |
| 2113 | /* Defined in main.c */ |
| 2114 | #ifdef YY_STDINIT |
| 2115 | yyin = stdin; |
| 2116 | yyout = stdout; |
| 2117 | #else |
| 2118 | yyin = (FILE *) 0; |
| 2119 | yyout = (FILE *) 0; |
| 2120 | #endif |
| 2121 | |
| 2122 | /* For future reference: Set errno on error, since we are called by |
| 2123 | * yylex_init() |
| 2124 | */ |
| 2125 | return 0; |
| 2126 | } |
| 2127 | |
| 2128 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
| 2129 | int yylex_destroy (void) |
| 2130 | { |
| 2131 | |
| 2132 | /* Pop the buffer stack, destroying each element. */ |
| 2133 | while(YY_CURRENT_BUFFER){ |
| 2134 | yy_delete_buffer(YY_CURRENT_BUFFER ); |
| 2135 | YY_CURRENT_BUFFER_LVALUE = NULL; |
| 2136 | yypop_buffer_state(); |
| 2137 | } |
| 2138 | |
| 2139 | /* Destroy the stack itself. */ |
| 2140 | yyfree((yy_buffer_stack) ); |
| 2141 | (yy_buffer_stack) = NULL; |
| 2142 | |
| 2143 | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
| 2144 | * yylex() is called, initialization will occur. */ |
| 2145 | yy_init_globals( ); |
| 2146 | |
| 2147 | return 0; |
| 2148 | } |
| 2149 | |
| 2150 | /* |
| 2151 | * Internal utility routines. |
| 2152 | */ |
| 2153 | |
| 2154 | #ifndef yytext_ptr |
| 2155 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) |
| 2156 | { |
| 2157 | register int i; |
| 2158 | for ( i = 0; i < n; ++i ) |
| 2159 | s1[i] = s2[i]; |
| 2160 | } |
| 2161 | #endif |
| 2162 | |
| 2163 | #ifdef YY_NEED_STRLEN |
| 2164 | static int yy_flex_strlen (yyconst char * s ) |
| 2165 | { |
| 2166 | register int n; |
| 2167 | for ( n = 0; s[n]; ++n ) |
| 2168 | ; |
| 2169 | |
| 2170 | return n; |
| 2171 | } |
| 2172 | #endif |
| 2173 | |
| 2174 | void *yyalloc (yy_size_t size ) |
| 2175 | { |
| 2176 | return (void *) malloc( size ); |
| 2177 | } |
| 2178 | |
| 2179 | void *yyrealloc (void * ptr, yy_size_t size ) |
| 2180 | { |
| 2181 | /* The cast to (char *) in the following accommodates both |
| 2182 | * implementations that use char* generic pointers, and those |
| 2183 | * that use void* generic pointers. It works with the latter |
| 2184 | * because both ANSI C and C++ allow castless assignment from |
| 2185 | * any pointer type to void*, and deal with argument conversions |
| 2186 | * as though doing an assignment. |
| 2187 | */ |
| 2188 | return (void *) realloc( (char *) ptr, size ); |
| 2189 | } |
| 2190 | |
| 2191 | void yyfree (void * ptr ) |
| 2192 | { |
| 2193 | free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ |
| 2194 | } |
| 2195 | |
| 2196 | #define YYTABLES_NAME "yytables" |
| 2197 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 2198 | #line 254 "dtc-lexer.l" |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 2199 | |
| 2200 | |
| 2201 | |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 2202 | static void push_input_file(const char *filename) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2203 | { |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 2204 | assert(filename); |
| 2205 | |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 2206 | srcfile_push(filename); |
David Gibson | ed95d74 | 2008-08-07 12:24:17 +1000 | [diff] [blame] | 2207 | |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 2208 | yyin = current_srcfile->f; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2209 | |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 2210 | yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE)); |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2211 | } |
| 2212 | |
Stephen Warren | cd29672 | 2012-09-28 21:25:59 +0000 | [diff] [blame] | 2213 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 2214 | static bool pop_input_file(void) |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2215 | { |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 2216 | if (srcfile_pop() == 0) |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 2217 | return false; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2218 | |
John Bonesio | 658f29a | 2010-11-17 15:28:20 -0800 | [diff] [blame] | 2219 | yypop_buffer_state(); |
| 2220 | yyin = current_srcfile->f; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2221 | |
Rob Herring | 4760597 | 2015-04-29 16:00:05 -0500 | [diff] [blame] | 2222 | return true; |
| 2223 | } |
| 2224 | |
| 2225 | static void lexical_error(const char *fmt, ...) |
| 2226 | { |
| 2227 | va_list ap; |
| 2228 | |
| 2229 | va_start(ap, fmt); |
| 2230 | srcpos_verror(&yylloc, "Lexical error", fmt, ap); |
| 2231 | va_end(ap); |
| 2232 | |
| 2233 | treesource_error = true; |
David Gibson | a4da2e3 | 2007-12-18 15:06:42 +1100 | [diff] [blame] | 2234 | } |
| 2235 | |