# HG changeset patch # User Aziz K?ksal # Date 1190487691 -7200 # Node ID 22d65b2bef4fef4970e9572e3050b4f39ac79dda # Parent fcdf7ac5ad270fd35d155196b0d036eb90342f4c Migrated the code that generates the ptable to Tango. diff -r fcdf7ac5ad27 -r 22d65b2bef4f trunk/src/dil/Lexer.d --- a/trunk/src/dil/Lexer.d Sat Sep 22 19:49:54 2007 +0200 +++ b/trunk/src/dil/Lexer.d Sat Sep 22 21:01:31 2007 +0200 @@ -2160,10 +2160,11 @@ static this() { alias ptable p; + assert(p.length == 256); // Initialize character properties table. for (int i; i < p.length; ++i) { - p[i] = 0; + p[i] = 0; // Reset if ('0' <= i && i <= '7') p[i] |= CP.Octal; if ('0' <= i && i <= '9') @@ -2192,11 +2193,10 @@ p['v'] |= 11 << 8; // Print a formatted array literal. char[] array = "[\n"; - for (int i; i < p.length; ++i) + foreach (i, c; ptable) { - int c = p[i]; - array ~= std.string.format(c>255?" 0x%x,":"%2d,", c, ((i+1) % 16) ? "":"\n"); + array ~= Format((c>255?" 0x{0:x},":"{0,2},"), c) ~ (((i+1) % 16) ? "":"\n"); } array[$-2..$] = "\n]"; - writefln(array); + Stdout(array).newline; }