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