comparison dmd/Lexer.d @ 79:43073c7c7769

updated to 2.035 also implemented a few missing functions still crashes in Import.importAll though
author Trass3r
date Mon, 30 Aug 2010 03:57:51 +0200
parents ef02e2e203c2
children e28b18c23469
comparison
equal deleted inserted replaced
78:b98fa8a4bf04 79:43073c7c7769
2612 dblstate++; 2612 dblstate++;
2613 break; 2613 break;
2614 2614
2615 case 8: // past end of exponent digits 2615 case 8: // past end of exponent digits
2616 goto done; 2616 goto done;
2617
2618 default:
2619 assert(0, "inreal.dblstate has unexpected value");
2617 } 2620 }
2618 break; 2621 break;
2619 } 2622 }
2620 stringbuffer.writeByte(c); 2623 stringbuffer.writeByte(c);
2621 } 2624 }
2770 } 2773 }
2771 2774
2772 return true; 2775 return true;
2773 } 2776 }
2774 2777
2775 /// TODO: reimplement based on strings 2778 /// TODO: use normal string append when GC works
2776 static ubyte* combineComments(ubyte* c1, ubyte* c2) 2779 static string combineComments(const(char)[] c1, const(char)[] c2)
2777 { 2780 {
2778 //printf("Lexer.combineComments('%s', '%s')\n", c1, c2); 2781 //writef("Lexer.combineComments('%s', '%s')\n", c1, c2);
2779 2782
2780 ubyte* c = c2; 2783 char[] c = cast(char[]) c2;
2781 2784
2782 if (c1) 2785 if (c1 !is null)
2783 { 2786 {
2784 c = c1; 2787 c = cast(char[]) c1;
2785 if (c2) 2788 if (c2 !is null)
2786 { 2789 {
2787 size_t len1 = strlen(cast(char*)c1); 2790 c = cast(char[]) (GC.malloc(c1.length + 1 + c2.length)[0 .. c1.length + 1 + c2.length]);
2788 size_t len2 = strlen(cast(char*)c2); 2791 size_t len1 = c1.length;
2789 2792 c[0..len1] = c1[];
2790 c = cast(ubyte*)GC.malloc(len1 + 1 + len2 + 1); 2793 c[len1++] = '\n';
2791 memcpy(c, c1, len1); 2794 c[len1 .. len1 + c2.length] = c2[];
2792 if (len1 && c1[len1 - 1] != '\n')
2793 {
2794 c[len1] = '\n';
2795 len1++;
2796 }
2797 memcpy(c + len1, c2, len2);
2798 c[len1 + len2] = 0;
2799 } 2795 }
2800 } 2796 }
2801 2797
2802 return c; 2798 return cast(string)c;
2803 } 2799 }
2804 } 2800 }