diff options
Diffstat (limited to 'scripts/dtc/dtc-lexer.lex.c_shipped')
-rw-r--r-- | scripts/dtc/dtc-lexer.lex.c_shipped | 551 |
1 files changed, 176 insertions, 375 deletions
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped index e27cc636e32..50c4420b4b2 100644 --- a/scripts/dtc/dtc-lexer.lex.c_shipped +++ b/scripts/dtc/dtc-lexer.lex.c_shipped | |||
@@ -170,20 +170,7 @@ extern FILE *yyin, *yyout; | |||
170 | #define EOB_ACT_END_OF_FILE 1 | 170 | #define EOB_ACT_END_OF_FILE 1 |
171 | #define EOB_ACT_LAST_MATCH 2 | 171 | #define EOB_ACT_LAST_MATCH 2 |
172 | 172 | ||
173 | /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires | 173 | #define YY_LESS_LINENO(n) |
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 | 174 | ||
188 | /* Return all but the first "n" matched characters back to the input stream. */ | 175 | /* Return all but the first "n" matched characters back to the input stream. */ |
189 | #define yyless(n) \ | 176 | #define yyless(n) \ |
@@ -385,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); | |||
385 | *yy_cp = '\0'; \ | 372 | *yy_cp = '\0'; \ |
386 | (yy_c_buf_p) = yy_cp; | 373 | (yy_c_buf_p) = yy_cp; |
387 | 374 | ||
388 | #define YY_NUM_RULES 20 | 375 | #define YY_NUM_RULES 17 |
389 | #define YY_END_OF_BUFFER 21 | 376 | #define YY_END_OF_BUFFER 18 |
390 | /* This struct is not used in this scanner, | 377 | /* This struct is not used in this scanner, |
391 | but its presence is necessary. */ | 378 | but its presence is necessary. */ |
392 | struct yy_trans_info | 379 | struct yy_trans_info |
@@ -394,20 +381,19 @@ struct yy_trans_info | |||
394 | flex_int32_t yy_verify; | 381 | flex_int32_t yy_verify; |
395 | flex_int32_t yy_nxt; | 382 | flex_int32_t yy_nxt; |
396 | }; | 383 | }; |
397 | static yyconst flex_int16_t yy_accept[104] = | 384 | static yyconst flex_int16_t yy_accept[94] = |
398 | { 0, | 385 | { 0, |
399 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 386 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
400 | 21, 19, 16, 16, 19, 19, 19, 7, 7, 19, | 387 | 18, 16, 13, 13, 16, 16, 16, 16, 16, 16, |
401 | 7, 19, 19, 19, 19, 13, 14, 14, 19, 8, | 388 | 16, 10, 11, 11, 6, 6, 13, 0, 2, 0, |
402 | 8, 16, 0, 2, 0, 0, 9, 0, 0, 0, | 389 | 7, 0, 0, 0, 0, 0, 0, 0, 5, 0, |
403 | 0, 0, 0, 7, 7, 5, 0, 6, 0, 12, | 390 | 9, 9, 11, 11, 6, 0, 7, 0, 0, 0, |
404 | 12, 14, 14, 8, 0, 11, 9, 0, 0, 0, | 391 | 0, 15, 0, 0, 0, 0, 6, 0, 14, 0, |
405 | 0, 18, 0, 0, 0, 0, 8, 0, 17, 0, | 392 | 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, |
406 | 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, | 393 | 0, 0, 0, 0, 0, 0, 0, 0, 3, 12, |
407 | 0, 0, 0, 0, 0, 0, 0, 0, 3, 15, | ||
408 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, | 394 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, |
409 | |||
410 | 0, 4, 0 | 395 | 0, 4, 0 |
396 | |||
411 | } ; | 397 | } ; |
412 | 398 | ||
413 | static yyconst flex_int32_t yy_ec[256] = | 399 | static yyconst flex_int32_t yy_ec[256] = |
@@ -416,16 +402,16 @@ static yyconst flex_int32_t yy_ec[256] = | |||
416 | 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, | 402 | 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, |
417 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 403 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
418 | 1, 2, 1, 4, 5, 1, 1, 6, 1, 1, | 404 | 1, 2, 1, 4, 5, 1, 1, 6, 1, 1, |
419 | 1, 7, 8, 8, 9, 8, 10, 11, 12, 13, | 405 | 1, 7, 5, 5, 8, 5, 9, 10, 11, 12, |
420 | 13, 13, 13, 13, 13, 13, 13, 14, 1, 1, | 406 | 12, 12, 12, 12, 12, 12, 12, 13, 1, 1, |
421 | 1, 1, 8, 8, 15, 15, 15, 15, 15, 15, | 407 | 1, 1, 5, 5, 14, 14, 14, 14, 14, 14, |
422 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, | 408 | 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, |
423 | 16, 16, 16, 16, 16, 16, 16, 17, 16, 16, | 409 | 15, 15, 15, 15, 15, 15, 15, 16, 15, 15, |
424 | 1, 18, 19, 1, 16, 1, 15, 20, 21, 22, | 410 | 1, 17, 18, 1, 15, 1, 14, 19, 20, 21, |
425 | 411 | ||
426 | 23, 15, 16, 24, 25, 16, 16, 26, 27, 28, | 412 | 22, 14, 15, 15, 23, 15, 15, 24, 25, 26, |
427 | 24, 16, 16, 29, 30, 31, 32, 33, 16, 17, | 413 | 15, 15, 15, 27, 28, 29, 30, 31, 15, 16, |
428 | 16, 16, 34, 1, 35, 1, 1, 1, 1, 1, | 414 | 15, 15, 32, 1, 33, 1, 1, 1, 1, 1, |
429 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 415 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
430 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 416 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
431 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 417 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
@@ -442,136 +428,114 @@ static yyconst flex_int32_t yy_ec[256] = | |||
442 | 1, 1, 1, 1, 1 | 428 | 1, 1, 1, 1, 1 |
443 | } ; | 429 | } ; |
444 | 430 | ||
445 | static yyconst flex_int32_t yy_meta[36] = | 431 | static yyconst flex_int32_t yy_meta[34] = |
446 | { 0, | 432 | { 0, |
447 | 1, 1, 1, 1, 2, 1, 2, 2, 2, 3, | 433 | 1, 1, 1, 1, 2, 1, 2, 2, 3, 4, |
448 | 4, 4, 4, 5, 6, 7, 7, 1, 1, 6, | 434 | 4, 4, 5, 6, 7, 7, 1, 1, 6, 6, |
449 | 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, | 435 | 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, |
450 | 7, 7, 7, 8, 1 | 436 | 7, 8, 1 |
451 | } ; | 437 | } ; |
452 | 438 | ||
453 | static yyconst flex_int16_t yy_base[117] = | 439 | static yyconst flex_int16_t yy_base[106] = |
454 | { 0, | 440 | { 0, |
455 | 0, 0, 30, 0, 44, 0, 67, 0, 97, 105, | 441 | 0, 0, 237, 236, 25, 0, 47, 0, 30, 71, |
456 | 302, 303, 35, 44, 40, 94, 112, 0, 129, 152, | 442 | 244, 247, 82, 84, 84, 211, 95, 229, 218, 0, |
457 | 296, 295, 159, 0, 176, 303, 0, 116, 95, 165, | 443 | 111, 247, 0, 84, 83, 95, 106, 86, 247, 237, |
458 | 49, 46, 102, 303, 296, 0, 0, 288, 290, 293, | 444 | 0, 230, 231, 234, 207, 209, 212, 220, 247, 206, |
459 | 264, 266, 270, 0, 0, 303, 0, 303, 264, 303, | 445 | 247, 218, 0, 106, 116, 0, 0, 0, 223, 89, |
460 | 0, 0, 195, 101, 0, 0, 0, 0, 284, 125, | 446 | 226, 219, 199, 206, 200, 204, 0, 190, 213, 212, |
461 | 277, 265, 225, 230, 216, 218, 0, 202, 224, 221, | 447 | 202, 91, 178, 161, 247, 172, 144, 150, 140, 130, |
462 | 217, 107, 196, 188, 303, 206, 179, 186, 178, 185, | 448 | 140, 124, 128, 120, 138, 137, 123, 122, 247, 247, |
463 | 183, 162, 161, 150, 169, 160, 145, 125, 303, 303, | 449 | 134, 114, 132, 86, 135, 125, 90, 136, 247, 97, |
464 | 137, 109, 190, 103, 203, 167, 108, 197, 303, 123, | 450 | 29, 247, 247, 153, 156, 161, 165, 170, 176, 180, |
465 | 451 | ||
466 | 29, 303, 303, 215, 221, 226, 229, 234, 240, 246, | 452 | 187, 195, 200, 205, 212 |
467 | 250, 257, 265, 270, 275, 282 | ||
468 | } ; | 453 | } ; |
469 | 454 | ||
470 | static yyconst flex_int16_t yy_def[117] = | 455 | static yyconst flex_int16_t yy_def[106] = |
471 | { 0, | 456 | { 0, |
472 | 103, 1, 1, 3, 3, 5, 103, 7, 3, 3, | 457 | 93, 1, 1, 1, 1, 5, 93, 7, 1, 1, |
473 | 103, 103, 103, 103, 104, 105, 103, 106, 103, 19, | 458 | 93, 93, 93, 93, 94, 95, 93, 96, 17, 97, |
474 | 19, 20, 103, 107, 20, 103, 108, 109, 105, 103, | 459 | 96, 93, 98, 99, 93, 93, 93, 94, 93, 94, |
475 | 103, 103, 104, 103, 104, 110, 111, 103, 112, 113, | 460 | 100, 93, 101, 102, 93, 93, 93, 96, 93, 93, |
476 | 103, 103, 103, 106, 19, 103, 20, 103, 103, 103, | 461 | 93, 96, 98, 99, 93, 103, 100, 104, 101, 101, |
477 | 20, 108, 109, 103, 114, 110, 111, 115, 112, 112, | 462 | 102, 93, 93, 93, 93, 93, 103, 104, 93, 93, |
478 | 113, 103, 103, 103, 103, 103, 114, 115, 103, 103, | 463 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
479 | 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, | 464 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
480 | 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, | 465 | 93, 93, 93, 93, 93, 105, 93, 105, 93, 105, |
481 | 103, 103, 103, 103, 103, 116, 103, 116, 103, 116, | 466 | 93, 93, 0, 93, 93, 93, 93, 93, 93, 93, |
482 | 467 | ||
483 | 103, 103, 0, 103, 103, 103, 103, 103, 103, 103, | 468 | 93, 93, 93, 93, 93 |
484 | 103, 103, 103, 103, 103, 103 | ||
485 | } ; | 469 | } ; |
486 | 470 | ||
487 | static yyconst flex_int16_t yy_nxt[339] = | 471 | static yyconst flex_int16_t yy_nxt[281] = |
488 | { 0, | 472 | { 0, |
489 | 12, 13, 14, 15, 12, 16, 12, 12, 12, 17, | 473 | 12, 13, 14, 15, 12, 16, 12, 12, 17, 12, |
490 | 18, 18, 18, 12, 19, 20, 20, 12, 12, 21, | 474 | 12, 12, 12, 18, 18, 18, 12, 12, 18, 18, |
491 | 19, 21, 19, 22, 20, 20, 20, 20, 20, 20, | 475 | 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, |
492 | 20, 20, 20, 12, 12, 12, 32, 32, 102, 23, | 476 | 18, 12, 12, 19, 20, 20, 20, 92, 21, 25, |
493 | 12, 12, 12, 34, 20, 32, 32, 32, 32, 20, | 477 | 26, 26, 22, 21, 21, 21, 21, 12, 13, 14, |
494 | 20, 20, 20, 20, 24, 24, 24, 35, 25, 54, | 478 | 15, 23, 16, 23, 23, 19, 23, 23, 23, 12, |
495 | 54, 54, 26, 25, 25, 25, 25, 12, 13, 14, | 479 | 24, 24, 24, 12, 12, 24, 24, 24, 24, 24, |
496 | 15, 27, 12, 27, 27, 27, 23, 27, 27, 27, | 480 | 24, 24, 24, 24, 24, 24, 24, 24, 12, 12, |
497 | 12, 28, 28, 28, 12, 12, 28, 28, 28, 28, | 481 | 25, 26, 26, 27, 27, 27, 27, 29, 43, 29, |
498 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, | 482 | 43, 43, 45, 45, 45, 50, 39, 59, 46, 93, |
499 | 483 | ||
500 | 12, 12, 29, 36, 103, 34, 17, 30, 31, 31, | 484 | 30, 33, 30, 34, 45, 45, 45, 27, 27, 68, |
501 | 29, 54, 54, 54, 17, 30, 31, 31, 39, 35, | 485 | 43, 91, 43, 43, 69, 35, 87, 36, 39, 37, |
502 | 52, 40, 52, 52, 52, 103, 78, 38, 38, 46, | 486 | 42, 42, 42, 39, 42, 45, 45, 45, 89, 42, |
503 | 101, 60, 79, 41, 69, 97, 42, 94, 43, 45, | 487 | 42, 42, 42, 85, 85, 86, 85, 85, 86, 89, |
504 | 45, 45, 46, 45, 47, 47, 93, 92, 45, 45, | 488 | 84, 90, 83, 82, 81, 80, 79, 78, 77, 76, |
505 | 45, 45, 47, 47, 47, 47, 47, 47, 47, 47, | 489 | 75, 74, 90, 28, 28, 28, 28, 28, 28, 28, |
506 | 47, 47, 47, 47, 47, 39, 47, 91, 40, 90, | 490 | 28, 31, 31, 31, 38, 38, 38, 38, 41, 73, |
507 | 99, 47, 47, 47, 47, 54, 54, 54, 89, 88, | 491 | 41, 43, 72, 43, 71, 43, 43, 44, 33, 44, |
508 | 41, 55, 87, 49, 100, 43, 51, 51, 51, 86, | 492 | 44, 44, 44, 47, 69, 47, 47, 49, 49, 49, |
509 | 51, 95, 95, 96, 85, 51, 51, 51, 51, 52, | 493 | 49, 49, 49, 49, 49, 51, 51, 51, 51, 51, |
510 | 494 | ||
511 | 99, 52, 52, 52, 95, 95, 96, 84, 46, 83, | 495 | 51, 51, 51, 57, 70, 57, 58, 58, 58, 67, |
512 | 82, 81, 39, 79, 100, 33, 33, 33, 33, 33, | 496 | 58, 58, 88, 88, 88, 88, 88, 88, 88, 88, |
513 | 33, 33, 33, 37, 80, 77, 37, 37, 37, 44, | 497 | 34, 66, 65, 64, 63, 62, 61, 60, 52, 50, |
514 | 40, 44, 50, 76, 50, 52, 75, 52, 74, 52, | 498 | 39, 56, 39, 55, 54, 53, 52, 50, 48, 93, |
515 | 52, 53, 73, 53, 53, 53, 53, 56, 56, 56, | 499 | 40, 39, 32, 93, 19, 19, 11, 93, 93, 93, |
516 | 72, 56, 56, 57, 71, 57, 57, 59, 59, 59, | 500 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
517 | 59, 59, 59, 59, 59, 61, 61, 61, 61, 61, | 501 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
518 | 61, 61, 61, 67, 70, 67, 68, 68, 68, 62, | 502 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93 |
519 | 68, 68, 98, 98, 98, 98, 98, 98, 98, 98, | ||
520 | 60, 66, 65, 64, 63, 62, 60, 58, 103, 48, | ||
521 | |||
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 | ||
526 | } ; | 503 | } ; |
527 | 504 | ||
528 | static yyconst flex_int16_t yy_chk[339] = | 505 | static yyconst flex_int16_t yy_chk[281] = |
529 | { 0, | 506 | { 0, |
530 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 507 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
531 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 508 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
532 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 509 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
533 | 1, 1, 1, 1, 1, 3, 13, 13, 101, 3, | 510 | 1, 1, 1, 5, 5, 5, 5, 91, 5, 9, |
534 | 3, 3, 3, 15, 3, 14, 14, 32, 32, 3, | 511 | 9, 9, 5, 5, 5, 5, 5, 7, 7, 7, |
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, | 512 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
538 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 513 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
539 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 514 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
540 | 515 | 10, 10, 10, 13, 13, 14, 14, 15, 24, 28, | |
541 | 7, 7, 9, 16, 29, 33, 9, 9, 9, 9, | 516 | 24, 24, 25, 25, 25, 50, 24, 50, 25, 90, |
542 | 10, 54, 54, 54, 10, 10, 10, 10, 17, 33, | 517 | |
543 | 28, 17, 28, 28, 28, 100, 72, 16, 29, 28, | 518 | 15, 17, 28, 17, 26, 26, 26, 27, 27, 62, |
544 | 97, 60, 72, 17, 60, 94, 17, 92, 17, 19, | 519 | 44, 87, 44, 44, 62, 17, 84, 17, 44, 17, |
545 | 19, 19, 19, 19, 19, 19, 91, 88, 19, 19, | 520 | 21, 21, 21, 21, 21, 45, 45, 45, 86, 21, |
546 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, | 521 | 21, 21, 21, 83, 83, 83, 85, 85, 85, 88, |
547 | 19, 19, 20, 20, 20, 23, 20, 87, 23, 86, | 522 | 82, 86, 81, 78, 77, 76, 75, 74, 73, 72, |
548 | 96, 20, 20, 20, 20, 30, 30, 30, 85, 84, | 523 | 71, 70, 88, 94, 94, 94, 94, 94, 94, 94, |
549 | 23, 30, 83, 23, 96, 23, 25, 25, 25, 82, | 524 | 94, 95, 95, 95, 96, 96, 96, 96, 97, 69, |
550 | 25, 93, 93, 93, 81, 25, 25, 25, 25, 53, | 525 | 97, 98, 68, 98, 67, 98, 98, 99, 66, 99, |
551 | 526 | 99, 99, 99, 100, 64, 100, 100, 101, 101, 101, | |
552 | 98, 53, 53, 53, 95, 95, 95, 80, 53, 79, | 527 | 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, |
553 | 78, 77, 76, 74, 98, 104, 104, 104, 104, 104, | 528 | |
554 | 104, 104, 104, 105, 73, 71, 105, 105, 105, 106, | 529 | 102, 102, 102, 103, 63, 103, 104, 104, 104, 61, |
555 | 70, 106, 107, 69, 107, 108, 68, 108, 66, 108, | 530 | 104, 104, 105, 105, 105, 105, 105, 105, 105, 105, |
556 | 108, 109, 65, 109, 109, 109, 109, 110, 110, 110, | 531 | 60, 59, 58, 56, 55, 54, 53, 52, 51, 49, |
557 | 64, 110, 110, 111, 63, 111, 111, 112, 112, 112, | 532 | 42, 40, 38, 37, 36, 35, 34, 33, 32, 30, |
558 | 112, 112, 112, 112, 112, 113, 113, 113, 113, 113, | 533 | 19, 18, 16, 11, 4, 3, 93, 93, 93, 93, |
559 | 113, 113, 113, 114, 62, 114, 115, 115, 115, 61, | 534 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
560 | 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, | 535 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, |
561 | 59, 49, 43, 42, 41, 40, 39, 38, 35, 22, | 536 | 93, 93, 93, 93, 93, 93, 93, 93, 93, 93 |
562 | |||
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 | ||
567 | } ; | 537 | } ; |
568 | 538 | ||
569 | /* Table of booleans, true if rule could match eol. */ | ||
570 | static yyconst flex_int32_t yy_rule_can_match_eol[21] = | ||
571 | { 0, | ||
572 | 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, | ||
573 | 0, }; | ||
574 | |||
575 | static yy_state_type yy_last_accepting_state; | 539 | static yy_state_type yy_last_accepting_state; |
576 | static char *yy_last_accepting_cpos; | 540 | static char *yy_last_accepting_cpos; |
577 | 541 | ||
@@ -616,6 +580,13 @@ char *yytext; | |||
616 | #include "srcpos.h" | 580 | #include "srcpos.h" |
617 | #include "dtc-parser.tab.h" | 581 | #include "dtc-parser.tab.h" |
618 | 582 | ||
583 | YYLTYPE yylloc; | ||
584 | |||
585 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ | ||
586 | #define YY_USER_ACTION \ | ||
587 | { \ | ||
588 | srcpos_update(&yylloc, yytext, yyleng); \ | ||
589 | } | ||
619 | 590 | ||
620 | /*#define LEXDEBUG 1*/ | 591 | /*#define LEXDEBUG 1*/ |
621 | 592 | ||
@@ -625,19 +596,14 @@ char *yytext; | |||
625 | #define DPRINT(fmt, ...) do { } while (0) | 596 | #define DPRINT(fmt, ...) do { } while (0) |
626 | #endif | 597 | #endif |
627 | 598 | ||
628 | static int dts_version; /* = 0 */ | 599 | static int dts_version = 1; |
629 | 600 | ||
630 | #define BEGIN_DEFAULT() if (dts_version == 0) { \ | 601 | #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \ |
631 | DPRINT("<INITIAL>\n"); \ | ||
632 | BEGIN(INITIAL); \ | ||
633 | } else { \ | ||
634 | DPRINT("<V1>\n"); \ | ||
635 | BEGIN(V1); \ | 602 | BEGIN(V1); \ |
636 | } | ||
637 | 603 | ||
638 | static void push_input_file(const char *filename); | 604 | static void push_input_file(const char *filename); |
639 | static int pop_input_file(void); | 605 | static int pop_input_file(void); |
640 | #line 641 "dtc-lexer.lex.c" | 606 | #line 607 "dtc-lexer.lex.c" |
641 | 607 | ||
642 | #define INITIAL 0 | 608 | #define INITIAL 0 |
643 | #define INCLUDE 1 | 609 | #define INCLUDE 1 |
@@ -826,9 +792,9 @@ YY_DECL | |||
826 | register char *yy_cp, *yy_bp; | 792 | register char *yy_cp, *yy_bp; |
827 | register int yy_act; | 793 | register int yy_act; |
828 | 794 | ||
829 | #line 64 "dtc-lexer.l" | 795 | #line 66 "dtc-lexer.l" |
830 | 796 | ||
831 | #line 832 "dtc-lexer.lex.c" | 797 | #line 798 "dtc-lexer.lex.c" |
832 | 798 | ||
833 | if ( !(yy_init) ) | 799 | if ( !(yy_init) ) |
834 | { | 800 | { |
@@ -881,35 +847,21 @@ yy_match: | |||
881 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 847 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
882 | { | 848 | { |
883 | yy_current_state = (int) yy_def[yy_current_state]; | 849 | yy_current_state = (int) yy_def[yy_current_state]; |
884 | if ( yy_current_state >= 104 ) | 850 | if ( yy_current_state >= 94 ) |
885 | yy_c = yy_meta[(unsigned int) yy_c]; | 851 | yy_c = yy_meta[(unsigned int) yy_c]; |
886 | } | 852 | } |
887 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 853 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
888 | ++yy_cp; | 854 | ++yy_cp; |
889 | } | 855 | } |
890 | while ( yy_base[yy_current_state] != 303 ); | 856 | while ( yy_current_state != 93 ); |
857 | yy_cp = (yy_last_accepting_cpos); | ||
858 | yy_current_state = (yy_last_accepting_state); | ||
891 | 859 | ||
892 | yy_find_action: | 860 | yy_find_action: |
893 | yy_act = yy_accept[yy_current_state]; | 861 | 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 | 862 | ||
901 | YY_DO_BEFORE_ACTION; | 863 | YY_DO_BEFORE_ACTION; |
902 | 864 | ||
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. */ | 865 | do_action: /* This label is used only to access EOF actions. */ |
914 | 866 | ||
915 | switch ( yy_act ) | 867 | switch ( yy_act ) |
@@ -924,7 +876,7 @@ do_action: /* This label is used only to access EOF actions. */ | |||
924 | case 1: | 876 | case 1: |
925 | /* rule 1 can match eol */ | 877 | /* rule 1 can match eol */ |
926 | YY_RULE_SETUP | 878 | YY_RULE_SETUP |
927 | #line 65 "dtc-lexer.l" | 879 | #line 67 "dtc-lexer.l" |
928 | { | 880 | { |
929 | char *name = strchr(yytext, '\"') + 1; | 881 | char *name = strchr(yytext, '\"') + 1; |
930 | yytext[yyleng-1] = '\0'; | 882 | yytext[yyleng-1] = '\0'; |
@@ -936,7 +888,7 @@ case YY_STATE_EOF(INCLUDE): | |||
936 | case YY_STATE_EOF(BYTESTRING): | 888 | case YY_STATE_EOF(BYTESTRING): |
937 | case YY_STATE_EOF(PROPNODENAME): | 889 | case YY_STATE_EOF(PROPNODENAME): |
938 | case YY_STATE_EOF(V1): | 890 | case YY_STATE_EOF(V1): |
939 | #line 71 "dtc-lexer.l" | 891 | #line 73 "dtc-lexer.l" |
940 | { | 892 | { |
941 | if (!pop_input_file()) { | 893 | if (!pop_input_file()) { |
942 | yyterminate(); | 894 | yyterminate(); |
@@ -946,23 +898,18 @@ case YY_STATE_EOF(V1): | |||
946 | case 2: | 898 | case 2: |
947 | /* rule 2 can match eol */ | 899 | /* rule 2 can match eol */ |
948 | YY_RULE_SETUP | 900 | YY_RULE_SETUP |
949 | #line 77 "dtc-lexer.l" | 901 | #line 79 "dtc-lexer.l" |
950 | { | 902 | { |
951 | yylloc.file = srcpos_file; | ||
952 | yylloc.first_line = yylineno; | ||
953 | DPRINT("String: %s\n", yytext); | 903 | DPRINT("String: %s\n", yytext); |
954 | yylval.data = data_copy_escape_string(yytext+1, | 904 | yylval.data = data_copy_escape_string(yytext+1, |
955 | yyleng-2); | 905 | yyleng-2); |
956 | yylloc.first_line = yylineno; | ||
957 | return DT_STRING; | 906 | return DT_STRING; |
958 | } | 907 | } |
959 | YY_BREAK | 908 | YY_BREAK |
960 | case 3: | 909 | case 3: |
961 | YY_RULE_SETUP | 910 | YY_RULE_SETUP |
962 | #line 87 "dtc-lexer.l" | 911 | #line 86 "dtc-lexer.l" |
963 | { | 912 | { |
964 | yylloc.file = srcpos_file; | ||
965 | yylloc.first_line = yylineno; | ||
966 | DPRINT("Keyword: /dts-v1/\n"); | 913 | DPRINT("Keyword: /dts-v1/\n"); |
967 | dts_version = 1; | 914 | dts_version = 1; |
968 | BEGIN_DEFAULT(); | 915 | BEGIN_DEFAULT(); |
@@ -971,10 +918,8 @@ YY_RULE_SETUP | |||
971 | YY_BREAK | 918 | YY_BREAK |
972 | case 4: | 919 | case 4: |
973 | YY_RULE_SETUP | 920 | YY_RULE_SETUP |
974 | #line 96 "dtc-lexer.l" | 921 | #line 93 "dtc-lexer.l" |
975 | { | 922 | { |
976 | yylloc.file = srcpos_file; | ||
977 | yylloc.first_line = yylineno; | ||
978 | DPRINT("Keyword: /memreserve/\n"); | 923 | DPRINT("Keyword: /memreserve/\n"); |
979 | BEGIN_DEFAULT(); | 924 | BEGIN_DEFAULT(); |
980 | return DT_MEMRESERVE; | 925 | return DT_MEMRESERVE; |
@@ -982,158 +927,100 @@ YY_RULE_SETUP | |||
982 | YY_BREAK | 927 | YY_BREAK |
983 | case 5: | 928 | case 5: |
984 | YY_RULE_SETUP | 929 | YY_RULE_SETUP |
985 | #line 104 "dtc-lexer.l" | 930 | #line 99 "dtc-lexer.l" |
986 | { | 931 | { |
987 | yylloc.file = srcpos_file; | ||
988 | yylloc.first_line = yylineno; | ||
989 | DPRINT("Label: %s\n", yytext); | 932 | DPRINT("Label: %s\n", yytext); |
990 | yylval.labelref = strdup(yytext); | 933 | yylval.labelref = xstrdup(yytext); |
991 | yylval.labelref[yyleng-1] = '\0'; | 934 | yylval.labelref[yyleng-1] = '\0'; |
992 | return DT_LABEL; | 935 | return DT_LABEL; |
993 | } | 936 | } |
994 | YY_BREAK | 937 | YY_BREAK |
995 | case 6: | 938 | case 6: |
996 | YY_RULE_SETUP | 939 | YY_RULE_SETUP |
997 | #line 113 "dtc-lexer.l" | 940 | #line 106 "dtc-lexer.l" |
998 | { | ||
999 | yylloc.file = srcpos_file; | ||
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 | ||
1013 | case 7: | ||
1014 | YY_RULE_SETUP | ||
1015 | #line 128 "dtc-lexer.l" | ||
1016 | { | 941 | { |
1017 | yylloc.file = srcpos_file; | 942 | yylval.literal = xstrdup(yytext); |
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 | ||
1024 | case 8: | ||
1025 | YY_RULE_SETUP | ||
1026 | #line 136 "dtc-lexer.l" | ||
1027 | { | ||
1028 | yylloc.file = srcpos_file; | ||
1029 | yylloc.first_line = yylineno; | ||
1030 | yylval.literal = strdup(yytext); | ||
1031 | DPRINT("Literal: '%s'\n", yylval.literal); | 943 | DPRINT("Literal: '%s'\n", yylval.literal); |
1032 | return DT_LITERAL; | 944 | return DT_LITERAL; |
1033 | } | 945 | } |
1034 | YY_BREAK | 946 | YY_BREAK |
1035 | case 9: | 947 | case 7: |
1036 | YY_RULE_SETUP | 948 | YY_RULE_SETUP |
1037 | #line 144 "dtc-lexer.l" | 949 | #line 112 "dtc-lexer.l" |
1038 | { /* label reference */ | 950 | { /* label reference */ |
1039 | yylloc.file = srcpos_file; | ||
1040 | yylloc.first_line = yylineno; | ||
1041 | DPRINT("Ref: %s\n", yytext+1); | 951 | DPRINT("Ref: %s\n", yytext+1); |
1042 | yylval.labelref = strdup(yytext+1); | 952 | yylval.labelref = xstrdup(yytext+1); |
1043 | return DT_REF; | 953 | return DT_REF; |
1044 | } | 954 | } |
1045 | YY_BREAK | 955 | YY_BREAK |
1046 | case 10: | 956 | case 8: |
1047 | YY_RULE_SETUP | 957 | YY_RULE_SETUP |
1048 | #line 152 "dtc-lexer.l" | 958 | #line 118 "dtc-lexer.l" |
1049 | { /* new-style path reference */ | 959 | { /* new-style path reference */ |
1050 | yylloc.file = srcpos_file; | ||
1051 | yylloc.first_line = yylineno; | ||
1052 | yytext[yyleng-1] = '\0'; | 960 | yytext[yyleng-1] = '\0'; |
1053 | DPRINT("Ref: %s\n", yytext+2); | 961 | DPRINT("Ref: %s\n", yytext+2); |
1054 | yylval.labelref = strdup(yytext+2); | 962 | yylval.labelref = xstrdup(yytext+2); |
1055 | return DT_REF; | 963 | return DT_REF; |
1056 | } | 964 | } |
1057 | YY_BREAK | 965 | YY_BREAK |
1058 | case 11: | 966 | case 9: |
1059 | YY_RULE_SETUP | ||
1060 | #line 161 "dtc-lexer.l" | ||
1061 | { /* old-style path reference */ | ||
1062 | yylloc.file = srcpos_file; | ||
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 | ||
1069 | case 12: | ||
1070 | YY_RULE_SETUP | 967 | YY_RULE_SETUP |
1071 | #line 169 "dtc-lexer.l" | 968 | #line 125 "dtc-lexer.l" |
1072 | { | 969 | { |
1073 | yylloc.file = srcpos_file; | ||
1074 | yylloc.first_line = yylineno; | ||
1075 | yylval.byte = strtol(yytext, NULL, 16); | 970 | yylval.byte = strtol(yytext, NULL, 16); |
1076 | DPRINT("Byte: %02x\n", (int)yylval.byte); | 971 | DPRINT("Byte: %02x\n", (int)yylval.byte); |
1077 | return DT_BYTE; | 972 | return DT_BYTE; |
1078 | } | 973 | } |
1079 | YY_BREAK | 974 | YY_BREAK |
1080 | case 13: | 975 | case 10: |
1081 | YY_RULE_SETUP | 976 | YY_RULE_SETUP |
1082 | #line 177 "dtc-lexer.l" | 977 | #line 131 "dtc-lexer.l" |
1083 | { | 978 | { |
1084 | yylloc.file = srcpos_file; | ||
1085 | yylloc.first_line = yylineno; | ||
1086 | DPRINT("/BYTESTRING\n"); | 979 | DPRINT("/BYTESTRING\n"); |
1087 | BEGIN_DEFAULT(); | 980 | BEGIN_DEFAULT(); |
1088 | return ']'; | 981 | return ']'; |
1089 | } | 982 | } |
1090 | YY_BREAK | 983 | YY_BREAK |
1091 | case 14: | 984 | case 11: |
1092 | YY_RULE_SETUP | 985 | YY_RULE_SETUP |
1093 | #line 185 "dtc-lexer.l" | 986 | #line 137 "dtc-lexer.l" |
1094 | { | 987 | { |
1095 | yylloc.file = srcpos_file; | ||
1096 | yylloc.first_line = yylineno; | ||
1097 | DPRINT("PropNodeName: %s\n", yytext); | 988 | DPRINT("PropNodeName: %s\n", yytext); |
1098 | yylval.propnodename = strdup(yytext); | 989 | yylval.propnodename = xstrdup(yytext); |
1099 | BEGIN_DEFAULT(); | 990 | BEGIN_DEFAULT(); |
1100 | return DT_PROPNODENAME; | 991 | return DT_PROPNODENAME; |
1101 | } | 992 | } |
1102 | YY_BREAK | 993 | YY_BREAK |
1103 | case 15: | 994 | case 12: |
1104 | YY_RULE_SETUP | 995 | YY_RULE_SETUP |
1105 | #line 194 "dtc-lexer.l" | 996 | #line 144 "dtc-lexer.l" |
1106 | { | 997 | { |
1107 | yylloc.file = srcpos_file; | ||
1108 | yylloc.first_line = yylineno; | ||
1109 | DPRINT("Binary Include\n"); | 998 | DPRINT("Binary Include\n"); |
1110 | return DT_INCBIN; | 999 | return DT_INCBIN; |
1111 | } | 1000 | } |
1112 | YY_BREAK | 1001 | YY_BREAK |
1113 | case 16: | 1002 | case 13: |
1114 | /* rule 16 can match eol */ | 1003 | /* rule 13 can match eol */ |
1115 | YY_RULE_SETUP | 1004 | YY_RULE_SETUP |
1116 | #line 201 "dtc-lexer.l" | 1005 | #line 149 "dtc-lexer.l" |
1117 | /* eat whitespace */ | 1006 | /* eat whitespace */ |
1118 | YY_BREAK | 1007 | YY_BREAK |
1119 | case 17: | 1008 | case 14: |
1120 | /* rule 17 can match eol */ | 1009 | /* rule 14 can match eol */ |
1121 | YY_RULE_SETUP | 1010 | YY_RULE_SETUP |
1122 | #line 202 "dtc-lexer.l" | 1011 | #line 150 "dtc-lexer.l" |
1123 | /* eat C-style comments */ | 1012 | /* eat C-style comments */ |
1124 | YY_BREAK | 1013 | YY_BREAK |
1125 | case 18: | 1014 | case 15: |
1126 | /* rule 18 can match eol */ | 1015 | /* rule 15 can match eol */ |
1127 | YY_RULE_SETUP | 1016 | YY_RULE_SETUP |
1128 | #line 203 "dtc-lexer.l" | 1017 | #line 151 "dtc-lexer.l" |
1129 | /* eat C++-style comments */ | 1018 | /* eat C++-style comments */ |
1130 | YY_BREAK | 1019 | YY_BREAK |
1131 | case 19: | 1020 | case 16: |
1132 | YY_RULE_SETUP | 1021 | YY_RULE_SETUP |
1133 | #line 205 "dtc-lexer.l" | 1022 | #line 153 "dtc-lexer.l" |
1134 | { | 1023 | { |
1135 | yylloc.file = srcpos_file; | ||
1136 | yylloc.first_line = yylineno; | ||
1137 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], | 1024 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], |
1138 | (unsigned)yytext[0]); | 1025 | (unsigned)yytext[0]); |
1139 | if (yytext[0] == '[') { | 1026 | if (yytext[0] == '[') { |
@@ -1148,12 +1035,12 @@ YY_RULE_SETUP | |||
1148 | return yytext[0]; | 1035 | return yytext[0]; |
1149 | } | 1036 | } |
1150 | YY_BREAK | 1037 | YY_BREAK |
1151 | case 20: | 1038 | case 17: |
1152 | YY_RULE_SETUP | 1039 | YY_RULE_SETUP |
1153 | #line 222 "dtc-lexer.l" | 1040 | #line 168 "dtc-lexer.l" |
1154 | ECHO; | 1041 | ECHO; |
1155 | YY_BREAK | 1042 | YY_BREAK |
1156 | #line 1157 "dtc-lexer.lex.c" | 1043 | #line 1044 "dtc-lexer.lex.c" |
1157 | 1044 | ||
1158 | case YY_END_OF_BUFFER: | 1045 | case YY_END_OF_BUFFER: |
1159 | { | 1046 | { |
@@ -1218,7 +1105,8 @@ ECHO; | |||
1218 | 1105 | ||
1219 | else | 1106 | else |
1220 | { | 1107 | { |
1221 | yy_cp = (yy_c_buf_p); | 1108 | yy_cp = (yy_last_accepting_cpos); |
1109 | yy_current_state = (yy_last_accepting_state); | ||
1222 | goto yy_find_action; | 1110 | goto yy_find_action; |
1223 | } | 1111 | } |
1224 | } | 1112 | } |
@@ -1443,7 +1331,7 @@ static int yy_get_next_buffer (void) | |||
1443 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1331 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1444 | { | 1332 | { |
1445 | yy_current_state = (int) yy_def[yy_current_state]; | 1333 | yy_current_state = (int) yy_def[yy_current_state]; |
1446 | if ( yy_current_state >= 104 ) | 1334 | if ( yy_current_state >= 94 ) |
1447 | yy_c = yy_meta[(unsigned int) yy_c]; | 1335 | yy_c = yy_meta[(unsigned int) yy_c]; |
1448 | } | 1336 | } |
1449 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1337 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
@@ -1471,11 +1359,11 @@ static int yy_get_next_buffer (void) | |||
1471 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1359 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1472 | { | 1360 | { |
1473 | yy_current_state = (int) yy_def[yy_current_state]; | 1361 | yy_current_state = (int) yy_def[yy_current_state]; |
1474 | if ( yy_current_state >= 104 ) | 1362 | if ( yy_current_state >= 94 ) |
1475 | yy_c = yy_meta[(unsigned int) yy_c]; | 1363 | yy_c = yy_meta[(unsigned int) yy_c]; |
1476 | } | 1364 | } |
1477 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1365 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
1478 | yy_is_jam = (yy_current_state == 103); | 1366 | yy_is_jam = (yy_current_state == 93); |
1479 | 1367 | ||
1480 | return yy_is_jam ? 0 : yy_current_state; | 1368 | return yy_is_jam ? 0 : yy_current_state; |
1481 | } | 1369 | } |
@@ -1550,11 +1438,6 @@ static int yy_get_next_buffer (void) | |||
1550 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ | 1438 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ |
1551 | (yy_hold_char) = *++(yy_c_buf_p); | 1439 | (yy_hold_char) = *++(yy_c_buf_p); |
1552 | 1440 | ||
1553 | if ( c == '\n' ) | ||
1554 | |||
1555 | yylineno++; | ||
1556 | ; | ||
1557 | |||
1558 | return c; | 1441 | return c; |
1559 | } | 1442 | } |
1560 | #endif /* ifndef YY_NO_INPUT */ | 1443 | #endif /* ifndef YY_NO_INPUT */ |
@@ -1669,10 +1552,6 @@ static void yy_load_buffer_state (void) | |||
1669 | yyfree((void *) b ); | 1552 | yyfree((void *) b ); |
1670 | } | 1553 | } |
1671 | 1554 | ||
1672 | #ifndef __cplusplus | ||
1673 | extern int isatty (int ); | ||
1674 | #endif /* __cplusplus */ | ||
1675 | |||
1676 | /* Initializes or reinitializes a buffer. | 1555 | /* Initializes or reinitializes a buffer. |
1677 | * This function is sometimes called more than once on the same buffer, | 1556 | * This function is sometimes called more than once on the same buffer, |
1678 | * such as during a yyrestart() or at EOF. | 1557 | * such as during a yyrestart() or at EOF. |
@@ -1696,7 +1575,7 @@ extern int isatty (int ); | |||
1696 | b->yy_bs_column = 0; | 1575 | b->yy_bs_column = 0; |
1697 | } | 1576 | } |
1698 | 1577 | ||
1699 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | 1578 | b->yy_is_interactive = 0; |
1700 | 1579 | ||
1701 | errno = oerrno; | 1580 | errno = oerrno; |
1702 | } | 1581 | } |
@@ -2025,9 +1904,6 @@ static int yy_init_globals (void) | |||
2025 | * This function is called from yylex_destroy(), so don't allocate here. | 1904 | * This function is called from yylex_destroy(), so don't allocate here. |
2026 | */ | 1905 | */ |
2027 | 1906 | ||
2028 | /* We do not touch yylineno unless the option is enabled. */ | ||
2029 | yylineno = 1; | ||
2030 | |||
2031 | (yy_buffer_stack) = 0; | 1907 | (yy_buffer_stack) = 0; |
2032 | (yy_buffer_stack_top) = 0; | 1908 | (yy_buffer_stack_top) = 0; |
2033 | (yy_buffer_stack_max) = 0; | 1909 | (yy_buffer_stack_max) = 0; |
@@ -2120,104 +1996,29 @@ void yyfree (void * ptr ) | |||
2120 | 1996 | ||
2121 | #define YYTABLES_NAME "yytables" | 1997 | #define YYTABLES_NAME "yytables" |
2122 | 1998 | ||
2123 | #line 222 "dtc-lexer.l" | 1999 | #line 168 "dtc-lexer.l" |
2124 | |||
2125 | |||
2126 | |||
2127 | |||
2128 | /* | ||
2129 | * Stack of nested include file contexts. | ||
2130 | */ | ||
2131 | |||
2132 | struct incl_file { | ||
2133 | struct dtc_file *file; | ||
2134 | YY_BUFFER_STATE yy_prev_buf; | ||
2135 | int yy_prev_lineno; | ||
2136 | struct incl_file *prev; | ||
2137 | }; | ||
2138 | |||
2139 | static struct incl_file *incl_file_stack; | ||
2140 | 2000 | ||
2141 | 2001 | ||
2142 | /* | ||
2143 | * Detect infinite include recursion. | ||
2144 | */ | ||
2145 | #define MAX_INCLUDE_DEPTH (100) | ||
2146 | |||
2147 | static int incl_depth = 0; | ||
2148 | |||
2149 | 2002 | ||
2150 | static void push_input_file(const char *filename) | 2003 | static void push_input_file(const char *filename) |
2151 | { | 2004 | { |
2152 | struct incl_file *incl_file; | ||
2153 | struct dtc_file *newfile; | ||
2154 | struct search_path search, *searchptr = NULL; | ||
2155 | |||
2156 | assert(filename); | 2005 | assert(filename); |
2157 | 2006 | ||
2158 | if (incl_depth++ >= MAX_INCLUDE_DEPTH) | 2007 | srcfile_push(filename); |
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; | ||
2166 | } | ||
2167 | |||
2168 | newfile = dtc_open_file(filename, searchptr); | ||
2169 | 2008 | ||
2170 | incl_file = xmalloc(sizeof(struct incl_file)); | 2009 | yyin = current_srcfile->f; |
2171 | 2010 | ||
2172 | /* | 2011 | yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE)); |
2173 | * Save current context. | ||
2174 | */ | ||
2175 | incl_file->yy_prev_buf = YY_CURRENT_BUFFER; | ||
2176 | incl_file->yy_prev_lineno = yylineno; | ||
2177 | incl_file->file = srcpos_file; | ||
2178 | incl_file->prev = incl_file_stack; | ||
2179 | |||
2180 | incl_file_stack = incl_file; | ||
2181 | |||
2182 | /* | ||
2183 | * Establish new context. | ||
2184 | */ | ||
2185 | srcpos_file = newfile; | ||
2186 | yylineno = 1; | ||
2187 | yyin = newfile->file; | ||
2188 | yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); | ||
2189 | } | 2012 | } |
2190 | 2013 | ||
2191 | 2014 | ||
2192 | static int pop_input_file(void) | 2015 | static int pop_input_file(void) |
2193 | { | 2016 | { |
2194 | struct incl_file *incl_file; | 2017 | if (srcfile_pop() == 0) |
2195 | |||
2196 | if (incl_file_stack == 0) | ||
2197 | return 0; | 2018 | return 0; |
2198 | 2019 | ||
2199 | dtc_close_file(srcpos_file); | 2020 | yypop_buffer_state(); |
2200 | 2021 | yyin = current_srcfile->f; | |
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; | ||
2214 | srcpos_file = incl_file->file; | ||
2215 | yyin = incl_file->file ? incl_file->file->file : NULL; | ||
2216 | |||
2217 | /* | ||
2218 | * Free old state. | ||
2219 | */ | ||
2220 | free(incl_file); | ||
2221 | 2022 | ||
2222 | return 1; | 2023 | return 1; |
2223 | } | 2024 | } |