Mercurial > projects > ldc
comparison dmd/lexer.c @ 336:aaade6ded589 trunk
[svn r357] Merged DMD 1.033
author | lindquist |
---|---|
date | Sat, 12 Jul 2008 19:38:31 +0200 |
parents | 2b72433d5c8c |
children | 1d3026702f65 |
comparison
equal
deleted
inserted
replaced
335:17b844102023 | 336:aaade6ded589 |
---|---|
566 goto case_ident; | 566 goto case_ident; |
567 p++; | 567 p++; |
568 t->value = hexStringConstant(t); | 568 t->value = hexStringConstant(t); |
569 return; | 569 return; |
570 | 570 |
571 #if V2 | 571 #if DMDV2 |
572 case 'q': | 572 case 'q': |
573 if (p[1] == '"') | 573 if (p[1] == '"') |
574 { | 574 { |
575 p++; | 575 p++; |
576 t->value = delimitedStringConstant(t); | 576 t->value = delimitedStringConstant(t); |
625 case 'L': | 625 case 'L': |
626 #endif | 626 #endif |
627 case 'a': case 'b': case 'c': case 'd': case 'e': | 627 case 'a': case 'b': case 'c': case 'd': case 'e': |
628 case 'f': case 'g': case 'h': case 'i': case 'j': | 628 case 'f': case 'g': case 'h': case 'i': case 'j': |
629 case 'k': case 'm': case 'n': case 'o': | 629 case 'k': case 'm': case 'n': case 'o': |
630 #if V2 | 630 #if DMDV2 |
631 case 'p': /*case 'q': case 'r':*/ case 's': case 't': | 631 case 'p': /*case 'q': case 'r':*/ case 's': case 't': |
632 #else | 632 #else |
633 case 'p': case 'q': /*case 'r':*/ case 's': case 't': | 633 case 'p': case 'q': /*case 'r':*/ case 's': case 't': |
634 #endif | 634 #endif |
635 case 'u': case 'v': case 'w': /*case 'x':*/ case 'y': | 635 case 'u': case 'v': case 'w': /*case 'x':*/ case 'y': |
675 sprintf(date, "%.6s %.4s", p + 4, p + 20); | 675 sprintf(date, "%.6s %.4s", p + 4, p + 20); |
676 sprintf(time, "%.8s", p + 11); | 676 sprintf(time, "%.8s", p + 11); |
677 sprintf(timestamp, "%.24s", p); | 677 sprintf(timestamp, "%.24s", p); |
678 } | 678 } |
679 | 679 |
680 #if DMDV1 | |
680 if (mod && id == Id::FILE) | 681 if (mod && id == Id::FILE) |
681 { | 682 { |
682 t->ustring = (unsigned char *)(loc.filename ? loc.filename : mod->ident->toChars()); | 683 t->ustring = (unsigned char *)(loc.filename ? loc.filename : mod->ident->toChars()); |
683 goto Lstring; | 684 goto Lstring; |
684 } | 685 } |
685 else if (mod && id == Id::LINE) | 686 else if (mod && id == Id::LINE) |
686 { | 687 { |
687 t->value = TOKint64v; | 688 t->value = TOKint64v; |
688 t->uns64value = loc.linnum; | 689 t->uns64value = loc.linnum; |
689 } | 690 } |
690 else if (id == Id::DATE) | 691 else |
692 #endif | |
693 if (id == Id::DATE) | |
691 { | 694 { |
692 t->ustring = (unsigned char *)date; | 695 t->ustring = (unsigned char *)date; |
693 goto Lstring; | 696 goto Lstring; |
694 } | 697 } |
695 else if (id == Id::TIME) | 698 else if (id == Id::TIME) |
728 break; | 731 break; |
729 } | 732 } |
730 t->value = TOKint64v; | 733 t->value = TOKint64v; |
731 t->uns64value = major * 1000 + minor; | 734 t->uns64value = major * 1000 + minor; |
732 } | 735 } |
733 #if V2 | 736 #if DMDV2 |
734 else if (id == Id::EOFX) | 737 else if (id == Id::EOFX) |
735 { | 738 { |
736 t->value = TOKeof; | 739 t->value = TOKeof; |
737 // Advance scanner to end of file | 740 // Advance scanner to end of file |
738 while (!(*p == 0 || *p == 0x1A)) | 741 while (!(*p == 0 || *p == 0x1A)) |
1474 } | 1477 } |
1475 } | 1478 } |
1476 } | 1479 } |
1477 | 1480 |
1478 | 1481 |
1479 #if V2 | 1482 #if DMDV2 |
1480 /************************************** | 1483 /************************************** |
1481 * Lex delimited strings: | 1484 * Lex delimited strings: |
1482 * q"(foo(xxx))" // "foo(xxx)" | 1485 * q"(foo(xxx))" // "foo(xxx)" |
1483 * q"[foo(]" // "foo(" | 1486 * q"[foo(]" // "foo(" |
1484 * q"/foo]/" // "foo]" | 1487 * q"/foo]/" // "foo]" |
2915 //{ "manifest", TOKmanifest }, | 2918 //{ "manifest", TOKmanifest }, |
2916 | 2919 |
2917 // Added after 1.0 | 2920 // Added after 1.0 |
2918 { "ref", TOKref }, | 2921 { "ref", TOKref }, |
2919 { "macro", TOKmacro }, | 2922 { "macro", TOKmacro }, |
2920 #if V2 | 2923 #if DMDV2 |
2921 { "pure", TOKpure }, | 2924 { "pure", TOKpure }, |
2922 { "nothrow", TOKnothrow }, | 2925 { "nothrow", TOKnothrow }, |
2926 { "__thread", TOKtls }, | |
2923 { "__traits", TOKtraits }, | 2927 { "__traits", TOKtraits }, |
2924 { "__overloadset", TOKoverloadset }, | 2928 { "__overloadset", TOKoverloadset }, |
2929 { "__FILE__", TOKfile }, | |
2930 { "__LINE__", TOKline }, | |
2925 #endif | 2931 #endif |
2926 }; | 2932 }; |
2927 | 2933 |
2928 int Token::isKeyword() | 2934 int Token::isKeyword() |
2929 { | 2935 { |
2972 Token::tochars[TOKdot] = "."; | 2978 Token::tochars[TOKdot] = "."; |
2973 Token::tochars[TOKxor] = "^"; | 2979 Token::tochars[TOKxor] = "^"; |
2974 Token::tochars[TOKxorass] = "^="; | 2980 Token::tochars[TOKxorass] = "^="; |
2975 Token::tochars[TOKassign] = "="; | 2981 Token::tochars[TOKassign] = "="; |
2976 Token::tochars[TOKconstruct] = "="; | 2982 Token::tochars[TOKconstruct] = "="; |
2977 #if V2 | 2983 #if DMDV2 |
2978 Token::tochars[TOKblit] = "="; | 2984 Token::tochars[TOKblit] = "="; |
2979 #endif | 2985 #endif |
2980 Token::tochars[TOKlt] = "<"; | 2986 Token::tochars[TOKlt] = "<"; |
2981 Token::tochars[TOKgt] = ">"; | 2987 Token::tochars[TOKgt] = ">"; |
2982 Token::tochars[TOKle] = "<="; | 2988 Token::tochars[TOKle] = "<="; |