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