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