Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Issue 1427 - Generated .di files look ugly and are hard to read #538

Merged
merged 1 commit into from over 1 year ago

4 participants

Hara Kenji Adam Wilson Andrei Alexandrescu Walter Bright
Hara Kenji
Collaborator

http://d.puremagic.com/issues/show_bug.cgi?id=1427

Use hard tab '\t' for indentation.

Adam Wilson

I'm working on bringing the DI generation output up to community expectations. Can this be merged? I'd hate to duplicate work.

Adam Wilson

I did some more more work on this and I can verify that under DMD on Windows when calling the void OutBuffer::write(const void *data, unsigned nbytes) function that DMD throws an Out of Memory exception while compiling Phobos. Also I added a bunch more buf->level changes in addition to what Kenji put in.

My guess is that given the size of Phobos, the number of memory reallocations this code produces that something went wrong somewhere. I removed the second reallocation from this function and everything seems to work as expected.

Note: This is under Windows x64.

The new function is as follows:

void OutBuffer::write(const void *data, unsigned nbytes)
{
char t = '\t';
reserve(nbytes + level);
if (doindent && linehead)
{
if (level)
{
for (size_t i=0; i<level; i++)
{
memcpy(this->data + offset, &t, sizeof(t));
offset++;
}
}
linehead = 0;
}
memcpy(this->data + offset, data, nbytes);
offset += nbytes;
}

Andrei Alexandrescu
Owner

LGTM. Please let's review this and merge it in. @LightBender, how does it (a|e)ffect your work?

Adam Wilson

@andralex I actually used parts of this merge in my pull. So I will have to re-merge it and fix the errors that crop-up... But this one does not affect output beyond formatting. Also, I have been unable to locate the cause of the phobos test failure in my pull either...

Brad Roberts braddr referenced this pull request from a commit October 21, 2012
Commit has since been removed from the repository and is no longer available.
Walter Bright WalterBright merged commit 0c93ce2 into from November 19, 2012
Walter Bright WalterBright closed this November 19, 2012
Deleted user Unknown referenced this pull request from a commit December 24, 2013
Commit has since been removed from the repository and is no longer available.
Deleted user Unknown referenced this pull request from a commit December 25, 2013
Commit has since been removed from the repository and is no longer available.
Deleted user Unknown referenced this pull request from a commit December 25, 2013
Commit has since been removed from the repository and is no longer available.
Deleted user Unknown referenced this pull request from a commit December 25, 2013
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 08, 2012
Issue 1427 - Generated .di files look ugly and are hard to read 8664473
This page is out of date. Refresh to see the latest.
16  src/attrib.c
@@ -363,13 +363,13 @@ void AttribDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
363 363
             buf->writenl();
364 364
             buf->writeByte('{');
365 365
             buf->writenl();
  366
+            buf->level++;
366 367
             for (size_t i = 0; i < decl->dim; i++)
367 368
             {
368 369
                 Dsymbol *s = (*decl)[i];
369  
-
370  
-                buf->writestring("    ");
371 370
                 s->toCBuffer(buf, hgs);
372 371
             }
  372
+            buf->level--;
373 373
             buf->writeByte('}');
374 374
         }
375 375
     }
@@ -911,16 +911,16 @@ void AnonDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
911 911
 {
912 912
     buf->printf(isunion ? "union" : "struct");
913 913
     buf->writestring("\n{\n");
  914
+    buf->level++;
914 915
     if (decl)
915 916
     {
916 917
         for (size_t i = 0; i < decl->dim; i++)
917 918
         {
918 919
             Dsymbol *s = (*decl)[i];
919  
-
920  
-            //buf->writestring("    ");
921 920
             s->toCBuffer(buf, hgs);
922 921
         }
923 922
     }
  923
+    buf->level--;
924 924
     buf->writestring("}\n");
925 925
 }
926 926
 
@@ -1355,16 +1355,16 @@ void ConditionalDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
1355 1355
         buf->writenl();
1356 1356
         buf->writeByte('{');
1357 1357
         buf->writenl();
  1358
+        buf->level++;
1358 1359
         if (decl)
1359 1360
         {
1360 1361
             for (size_t i = 0; i < decl->dim; i++)
1361 1362
             {
1362 1363
                 Dsymbol *s = (*decl)[i];
1363  
-
1364  
-                buf->writestring("    ");
1365 1364
                 s->toCBuffer(buf, hgs);
1366 1365
             }
1367 1366
         }
  1367
+        buf->level--;
1368 1368
         buf->writeByte('}');
1369 1369
         if (elsedecl)
1370 1370
         {
@@ -1373,13 +1373,13 @@ void ConditionalDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
1373 1373
             buf->writenl();
1374 1374
             buf->writeByte('{');
1375 1375
             buf->writenl();
  1376
+            buf->level++;
1376 1377
             for (size_t i = 0; i < elsedecl->dim; i++)
1377 1378
             {
1378 1379
                 Dsymbol *s = (*elsedecl)[i];
1379  
-
1380  
-                buf->writestring("    ");
1381 1380
                 s->toCBuffer(buf, hgs);
1382 1381
             }
  1382
+            buf->level--;
1383 1383
             buf->writeByte('}');
1384 1384
         }
1385 1385
     }
4  src/class.c
@@ -847,13 +847,13 @@ void ClassDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
847 847
         buf->writenl();
848 848
         buf->writeByte('{');
849 849
         buf->writenl();
  850
+        buf->level++;
850 851
         for (size_t i = 0; i < members->dim; i++)
851 852
         {
852 853
             Dsymbol *s = (*members)[i];
853  
-
854  
-            buf->writestring("    ");
855 854
             s->toCBuffer(buf, hgs);
856 855
         }
  856
+        buf->level--;
857 857
         buf->writestring("}");
858 858
     }
859 859
     else
3  src/enum.c
@@ -347,16 +347,17 @@ void EnumDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
347 347
     buf->writenl();
348 348
     buf->writeByte('{');
349 349
     buf->writenl();
  350
+    buf->level++;
350 351
     for (size_t i = 0; i < members->dim; i++)
351 352
     {
352 353
         EnumMember *em = (*members)[i]->isEnumMember();
353 354
         if (!em)
354 355
             continue;
355  
-        //buf->writestring("    ");
356 356
         em->toCBuffer(buf, hgs);
357 357
         buf->writeByte(',');
358 358
         buf->writenl();
359 359
     }
  360
+    buf->level--;
360 361
     buf->writeByte('}');
361 362
     buf->writenl();
362 363
 }
2  src/func.c
@@ -1814,7 +1814,9 @@ void FuncDeclaration::bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs)
1814 1814
 
1815 1815
         buf->writebyte('{');
1816 1816
         buf->writenl();
  1817
+        buf->level++;
1817 1818
         fbody->toCBuffer(buf, hgs);
  1819
+        buf->level--;
1818 1820
         buf->writebyte('}');
1819 1821
         buf->writenl();
1820 1822
     }
1  src/hdrgen.c
@@ -51,6 +51,7 @@ void argsToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs);
51 51
 void Module::genhdrfile()
52 52
 {
53 53
     OutBuffer hdrbufr;
  54
+    hdrbufr.doindent = 1;
54 55
 
55 56
     hdrbufr.printf("// D import file generated from '%s'", srcfile->toChars());
56 57
     hdrbufr.writenl();
69  src/root/root.c
@@ -1456,6 +1456,10 @@ OutBuffer::OutBuffer()
1456 1456
     data = NULL;
1457 1457
     offset = 0;
1458 1458
     size = 0;
  1459
+
  1460
+    doindent = 0;
  1461
+    level = 0;
  1462
+    linehead = 1;
1459 1463
 }
1460 1464
 
1461 1465
 OutBuffer::~OutBuffer()
@@ -1501,6 +1505,19 @@ void OutBuffer::setsize(unsigned size)
1501 1505
 
1502 1506
 void OutBuffer::write(const void *data, unsigned nbytes)
1503 1507
 {
  1508
+    if (doindent && linehead)
  1509
+    {
  1510
+        if (level)
  1511
+        {
  1512
+            reserve(level);
  1513
+            for (size_t i=0; i<level; i++)
  1514
+            {
  1515
+                this->data[offset] = '\t';
  1516
+                offset++;
  1517
+            }
  1518
+        }
  1519
+        linehead = 0;
  1520
+    }
1504 1521
     reserve(nbytes);
1505 1522
     memcpy(this->data + offset, data, nbytes);
1506 1523
     offset += nbytes;
@@ -1533,10 +1550,26 @@ void OutBuffer::writenl()
1533 1550
 #else
1534 1551
     writeByte('\n');
1535 1552
 #endif
  1553
+    if (doindent)
  1554
+        linehead = 1;
1536 1555
 }
1537 1556
 
1538 1557
 void OutBuffer::writeByte(unsigned b)
1539 1558
 {
  1559
+    if (doindent && linehead
  1560
+        && b != '\n')
  1561
+    {
  1562
+        if (level)
  1563
+        {
  1564
+            reserve(level);
  1565
+            for (size_t i=0; i<level; i++)
  1566
+            {
  1567
+                this->data[offset] = '\t';
  1568
+                offset++;
  1569
+            }
  1570
+        }
  1571
+        linehead = 0;
  1572
+    }
1540 1573
     reserve(1);
1541 1574
     this->data[offset] = (unsigned char)b;
1542 1575
     offset++;
@@ -1604,6 +1637,24 @@ void OutBuffer::prependbyte(unsigned b)
1604 1637
 
1605 1638
 void OutBuffer::writeword(unsigned w)
1606 1639
 {
  1640
+    if (doindent && linehead
  1641
+#if _WIN32
  1642
+        && w != 0x0A0D)
  1643
+#else
  1644
+        && w != '\n')
  1645
+#endif
  1646
+    {
  1647
+        if (level)
  1648
+        {
  1649
+            reserve(level);
  1650
+            for (size_t i=0; i<level; i++)
  1651
+            {
  1652
+                this->data[offset] = '\t';
  1653
+                offset++;
  1654
+            }
  1655
+        }
  1656
+        linehead = 0;
  1657
+    }
1607 1658
     reserve(2);
1608 1659
     *(unsigned short *)(this->data + offset) = (unsigned short)w;
1609 1660
     offset += 2;
@@ -1629,6 +1680,24 @@ void OutBuffer::writeUTF16(unsigned w)
1629 1680
 
1630 1681
 void OutBuffer::write4(unsigned w)
1631 1682
 {
  1683
+    if (doindent && linehead
  1684
+#if _WIN32
  1685
+        && w != 0x000A000D)
  1686
+#else
  1687
+        )
  1688
+#endif
  1689
+    {
  1690
+        if (level)
  1691
+        {
  1692
+            reserve(level);
  1693
+            for (size_t i=0; i<level; i++)
  1694
+            {
  1695
+                this->data[offset] = '\t';
  1696
+                offset++;
  1697
+            }
  1698
+        }
  1699
+        linehead = 0;
  1700
+    }
1632 1701
     reserve(4);
1633 1702
     *(unsigned *)(this->data + offset) = w;
1634 1703
     offset += 4;
2  src/root/root.h
@@ -234,6 +234,8 @@ struct OutBuffer : Object
234 234
     unsigned offset;
235 235
     unsigned size;
236 236
 
  237
+    int doindent, level, linehead;
  238
+
237 239
     OutBuffer();
238 240
     ~OutBuffer();
239 241
     char *extractData();
54  src/statement.c
@@ -889,6 +889,7 @@ void UnrolledLoopStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
889 889
 {
890 890
     buf->writestring("unrolled {");
891 891
     buf->writenl();
  892
+    buf->level++;
892 893
 
893 894
     for (size_t i = 0; i < statements->dim; i++)
894 895
     {   Statement *s;
@@ -898,6 +899,7 @@ void UnrolledLoopStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
898 899
             s->toCBuffer(buf, hgs);
899 900
     }
900 901
 
  902
+    buf->level--;
901 903
     buf->writeByte('}');
902 904
     buf->writenl();
903 905
 }
@@ -1050,10 +1052,12 @@ void ScopeStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
1050 1052
 {
1051 1053
     buf->writeByte('{');
1052 1054
     buf->writenl();
  1055
+    buf->level++;
1053 1056
 
1054 1057
     if (statement)
1055 1058
         statement->toCBuffer(buf, hgs);
1056 1059
 
  1060
+    buf->level--;
1057 1061
     buf->writeByte('}');
1058 1062
     buf->writenl();
1059 1063
 }
@@ -1235,6 +1239,7 @@ void DoStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
1235 1239
     buf->writestring("while (");
1236 1240
     condition->toCBuffer(buf, hgs);
1237 1241
     buf->writestring(");");
  1242
+    buf->writenl();
1238 1243
 }
1239 1244
 
1240 1245
 /******************************** ForStatement ***************************/
@@ -1513,7 +1518,9 @@ void ForStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
1513 1518
     buf->writenl();
1514 1519
     buf->writebyte('{');
1515 1520
     buf->writenl();
  1521
+    buf->level++;
1516 1522
     body->toCBuffer(buf, hgs);
  1523
+    buf->level--;
1517 1524
     buf->writebyte('}');
1518 1525
     buf->writenl();
1519 1526
 }
@@ -2426,8 +2433,10 @@ void ForeachStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
2426 2433
     buf->writenl();
2427 2434
     buf->writebyte('{');
2428 2435
     buf->writenl();
  2436
+    buf->level++;
2429 2437
     if (body)
2430 2438
         body->toCBuffer(buf, hgs);
  2439
+    buf->level--;
2431 2440
     buf->writebyte('}');
2432 2441
     buf->writenl();
2433 2442
 }
@@ -2684,8 +2693,10 @@ void ForeachRangeStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
2684 2693
     buf->writenl();
2685 2694
     buf->writebyte('{');
2686 2695
     buf->writenl();
  2696
+    buf->level++;
2687 2697
     if (body)
2688 2698
         body->toCBuffer(buf, hgs);
  2699
+    buf->level--;
2689 2700
     buf->writebyte('}');
2690 2701
     buf->writenl();
2691 2702
 }
@@ -2837,11 +2848,19 @@ void IfStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
2837 2848
     condition->toCBuffer(buf, hgs);
2838 2849
     buf->writebyte(')');
2839 2850
     buf->writenl();
  2851
+    if (!ifbody->isScopeStatement())
  2852
+        buf->level++;
2840 2853
     ifbody->toCBuffer(buf, hgs);
  2854
+    if (!ifbody->isScopeStatement())
  2855
+        buf->level--;
2841 2856
     if (elsebody)
2842 2857
     {   buf->writestring("else");
2843 2858
         buf->writenl();
  2859
+        if (!elsebody->isScopeStatement())
  2860
+            buf->level++;
2844 2861
         elsebody->toCBuffer(buf, hgs);
  2862
+        if (!elsebody->isScopeStatement())
  2863
+            buf->level--;
2845 2864
     }
2846 2865
 }
2847 2866
 
@@ -2934,8 +2953,10 @@ void ConditionalStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
2934 2953
     buf->writenl();
2935 2954
     buf->writeByte('{');
2936 2955
     buf->writenl();
  2956
+    buf->level++;
2937 2957
     if (ifbody)
2938 2958
         ifbody->toCBuffer(buf, hgs);
  2959
+    buf->level--;
2939 2960
     buf->writeByte('}');
2940 2961
     buf->writenl();
2941 2962
     if (elsebody)
@@ -2943,8 +2964,10 @@ void ConditionalStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
2943 2964
         buf->writestring("else");
2944 2965
         buf->writenl();
2945 2966
         buf->writeByte('{');
  2967
+        buf->level++;
2946 2968
         buf->writenl();
2947 2969
         elsebody->toCBuffer(buf, hgs);
  2970
+        buf->level--;
2948 2971
         buf->writeByte('}');
2949 2972
         buf->writenl();
2950 2973
     }
@@ -3100,9 +3123,11 @@ void PragmaStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
3100 3123
         buf->writenl();
3101 3124
         buf->writeByte('{');
3102 3125
         buf->writenl();
  3126
+        buf->level++;
3103 3127
 
3104 3128
         body->toCBuffer(buf, hgs);
3105 3129
 
  3130
+        buf->level--;
3106 3131
         buf->writeByte('}');
3107 3132
         buf->writenl();
3108 3133
     }
@@ -3340,7 +3365,9 @@ void SwitchStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
3340 3365
         if (!body->isScopeStatement())
3341 3366
         {   buf->writebyte('{');
3342 3367
             buf->writenl();
  3368
+            buf->level++;
3343 3369
             body->toCBuffer(buf, hgs);
  3370
+            buf->level--;
3344 3371
             buf->writebyte('}');
3345 3372
             buf->writenl();
3346 3373
         }
@@ -3625,7 +3652,8 @@ int DefaultStatement::comeFrom()
3625 3652
 
3626 3653
 void DefaultStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
3627 3654
 {
3628  
-    buf->writestring("default:\n");
  3655
+    buf->writestring("default:");
  3656
+    buf->writenl();
3629 3657
     statement->toCBuffer(buf, hgs);
3630 3658
 }
3631 3659
 
@@ -3659,7 +3687,8 @@ int GotoDefaultStatement::blockExit(bool mustNotThrow)
3659 3687
 
3660 3688
 void GotoDefaultStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
3661 3689
 {
3662  
-    buf->writestring("goto default;\n");
  3690
+    buf->writestring("goto default;");
  3691
+    buf->writenl();
3663 3692
 }
3664 3693
 
3665 3694
 /******************************** GotoCaseStatement ***************************/
@@ -4552,7 +4581,8 @@ void WithStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
4552 4581
 {
4553 4582
     buf->writestring("with (");
4554 4583
     exp->toCBuffer(buf, hgs);
4555  
-    buf->writestring(")\n");
  4584
+    buf->writestring(")");
  4585
+    buf->writenl();
4556 4586
     if (body)
4557 4587
         body->toCBuffer(buf, hgs);
4558 4588
 }
@@ -4775,8 +4805,10 @@ void Catch::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
4775 4805
     buf->writenl();
4776 4806
     buf->writebyte('{');
4777 4807
     buf->writenl();
  4808
+    buf->level++;
4778 4809
     if (handler)
4779 4810
         handler->toCBuffer(buf, hgs);
  4811
+    buf->level--;
4780 4812
     buf->writebyte('}');
4781 4813
     buf->writenl();
4782 4814
 }
@@ -4820,10 +4852,22 @@ Statement *TryFinallyStatement::semantic(Scope *sc)
4820 4852
 
4821 4853
 void TryFinallyStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
4822 4854
 {
4823  
-    buf->printf("try\n{\n");
  4855
+    buf->writestring("try");
  4856
+    buf->writenl();
  4857
+    buf->writebyte('{');
  4858
+    buf->writenl();
  4859
+    buf->level++;
4824 4860
     body->toCBuffer(buf, hgs);
4825  
-    buf->printf("}\nfinally\n{\n");
  4861
+    buf->level--;
  4862
+    buf->writebyte('}');
  4863
+    buf->writenl();
  4864
+    buf->writestring("finally");
  4865
+    buf->writenl();
  4866
+    buf->writebyte('{');
  4867
+    buf->writenl();
  4868
+    buf->level++;
4826 4869
     finalbody->toCBuffer(buf, hgs);
  4870
+    buf->level--;
4827 4871
     buf->writeByte('}');
4828 4872
     buf->writenl();
4829 4873
 }
4  src/struct.c
@@ -795,13 +795,13 @@ void StructDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
795 795
     buf->writenl();
796 796
     buf->writeByte('{');
797 797
     buf->writenl();
  798
+    buf->level++;
798 799
     for (size_t i = 0; i < members->dim; i++)
799 800
     {
800 801
         Dsymbol *s = (*members)[i];
801  
-
802  
-        buf->writestring("    ");
803 802
         s->toCBuffer(buf, hgs);
804 803
     }
  804
+    buf->level--;
805 805
     buf->writeByte('}');
806 806
     buf->writenl();
807 807
 }
2  src/template.c
@@ -2322,11 +2322,13 @@ void TemplateDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
2322 2322
         buf->writenl();
2323 2323
         buf->writebyte('{');
2324 2324
         buf->writenl();
  2325
+        buf->level++;
2325 2326
         for (size_t i = 0; i < members->dim; i++)
2326 2327
         {
2327 2328
             Dsymbol *s = (*members)[i];
2328 2329
             s->toCBuffer(buf, hgs);
2329 2330
         }
  2331
+        buf->level--;
2330 2332
         buf->writebyte('}');
2331 2333
         buf->writenl();
2332 2334
         hgs->tpltMember--;
671  test/compilable/extra-files/header.di
@@ -7,146 +7,147 @@ typedef double mydbl = 10;
7 7
 int main()
8 8
 in
9 9
 {
10  
-assert(1 + (2 + 3) == -(1 - 2 * 3));
  10
+	assert(1 + (2 + 3) == -(1 - 2 * 3));
11 11
 }
12 12
 out(result)
13 13
 {
14  
-assert(result == 0);
  14
+	assert(result == 0);
15 15
 }
16 16
 body
17 17
 {
18  
-float f = (float).infinity;
19  
-int i = cast(int)f;
20  
-writeln((i , 1), 2);
21  
-writeln(cast(int)(float).max);
22  
-assert(i == cast(int)(float).max);
23  
-assert(i == 2147483648u);
24  
-return 0;
  18
+	float f = (float).infinity;
  19
+	int i = cast(int)f;
  20
+	writeln((i , 1), 2);
  21
+	writeln(cast(int)(float).max);
  22
+	assert(i == cast(int)(float).max);
  23
+	assert(i == 2147483648u);
  24
+	return 0;
25 25
 }
26 26
 template Foo(T, int V)
27 27
 {
28  
-int bar(double d, int x)
29  
-{
30  
-if (d)
31  
-{
32  
-d++;
33  
-}
34  
-else
35  
-d--;
36  
-asm { naked; }
37  
-asm { mov EAX,3; }
38  
-for (;;)
39  
-{
40  
-{
41  
-d = d + 1;
42  
-}
43  
-}
44  
-{
45  
-for (int i = 0;
46  
- i < 10; i++)
47  
-{
48  
-{
49  
-d = i ? d + 1 : 5;
50  
-}
51  
-}
52  
-}
53  
-char[] s;
54  
-foreach (char c; s)
55  
-{
56  
-d *= 2;
57  
-if (d)
58  
-break;
59  
-else
60  
-continue;
61  
-}
62  
-switch (V)
63  
-{
64  
-case 1:
65  
-{
66  
-}
67  
-case 2:
68  
-{
69  
-break;
70  
-}
71  
-case 3:
72  
-{
73  
-goto case 1;
74  
-}
75  
-case 4:
76  
-{
77  
-goto default;
78  
-}
79  
-default:
80  
-{
81  
-d /= 8;
82  
-break;
83  
-}
84  
-}
85  
-enum Label 
86  
-{
87  
-A,
88  
-B,
89  
-C,
90  
-}
91  
-;
92  
-void fswitch(Label l)
93  
-{
94  
-final switch (l)
95  
-{
96  
-case A:
97  
-{
98  
-break;
99  
-}
100  
-case B:
101  
-{
102  
-break;
103  
-}
104  
-case C:
105  
-{
106  
-break;
107  
-}
108  
-}
109  
-}
110  
-loop:
111  
-while (x)
112  
-{
113  
-x--;
114  
-if (x)
115  
-break loop;
116  
-else
117  
-continue loop;
118  
-}
119  
-do
120  
-{
121  
-x++;
122  
-}
123  
-while (x < 10);try
124  
-{
125  
-try
126  
-{
127  
-bar(1, 2);
128  
-}
129  
-catch(Object o)
130  
-{
131  
-x++;
132  
-}
133  
-}
134  
-finally
135  
-{
136  
-x--;
137  
-}
138  
-Object o;
139  
-synchronized(o) {
140  
-x = ~x;
141  
-}
142  
-synchronized {
143  
-x = x < 3;
144  
-}
145  
-with (o)
146  
-{
147  
-toString();
148  
-}
149  
-}
  28
+	int bar(double d, int x)
  29
+	{
  30
+		if (d)
  31
+		{
  32
+			d++;
  33
+		}
  34
+		else
  35
+			d--;
  36
+		asm { naked; }
  37
+		asm { mov EAX,3; }
  38
+		for (;;)
  39
+		{
  40
+			{
  41
+				d = d + 1;
  42
+			}
  43
+		}
  44
+		{
  45
+			for (int i = 0;
  46
+			 i < 10; i++)
  47
+			{
  48
+				{
  49
+					d = i ? d + 1 : 5;
  50
+				}
  51
+			}
  52
+		}
  53
+		char[] s;
  54
+		foreach (char c; s)
  55
+		{
  56
+			d *= 2;
  57
+			if (d)
  58
+				break;
  59
+			else
  60
+				continue;
  61
+		}
  62
+		switch (V)
  63
+		{
  64
+			case 1:
  65
+			{
  66
+			}
  67
+			case 2:
  68
+			{
  69
+				break;
  70
+			}
  71
+			case 3:
  72
+			{
  73
+				goto case 1;
  74
+			}
  75
+			case 4:
  76
+			{
  77
+				goto default;
  78
+			}
  79
+			default:
  80
+			{
  81
+				d /= 8;
  82
+				break;
  83
+			}
  84
+		}
  85
+		enum Label 
  86
+		{
  87
+			A,
  88
+			B,
  89
+			C,
  90
+		}
  91
+		;
  92
+		void fswitch(Label l)
  93
+		{
  94
+			final switch (l)
  95
+			{
  96
+				case A:
  97
+				{
  98
+					break;
  99
+				}
  100
+				case B:
  101
+				{
  102
+					break;
  103
+				}
  104
+				case C:
  105
+				{
  106
+					break;
  107
+				}
  108
+			}
  109
+		}
  110
+		loop:
  111
+		while (x)
  112
+		{
  113
+			x--;
  114
+			if (x)
  115
+				break loop;
  116
+			else
  117
+				continue loop;
  118
+		}
  119
+		do
  120
+		{
  121
+			x++;
  122
+		}
  123
+		while (x < 10);
  124
+		try
  125
+		{
  126
+			try
  127
+			{
  128
+				bar(1, 2);
  129
+			}
  130
+			catch(Object o)
  131
+			{
  132
+				x++;
  133
+			}
  134
+		}
  135
+		finally
  136
+		{
  137
+			x--;
  138
+		}
  139
+		Object o;
  140
+		synchronized(o) {
  141
+			x = ~x;
  142
+		}
  143
+		synchronized {
  144
+			x = x < 3;
  145
+		}
  146
+		with (o)
  147
+		{
  148
+			toString();
  149
+		}
  150
+	}
150 151
 }
151 152
 static this();
152 153
 interface iFoo
@@ -157,277 +158,277 @@ class xFoo : iFoo
157 158
 }
158 159
 class Foo3
159 160
 {
160  
-    this(int a, ...);
161  
-    this(int* a)
162  
-{
163  
-}
  161
+	this(int a, ...);
  162
+	this(int* a)
  163
+	{
  164
+	}
164 165
 }
165 166
 alias int myint;
166 167
 static notquit = 1;
167 168
 class Test
168 169
 {
169  
-    void a()
170  
-{
171  
-}
172  
-    void b()
173  
-{
174  
-}
175  
-    void c()
176  
-{
177  
-}
178  
-    void d()
179  
-{
180  
-}
181  
-    void e()
182  
-{
183  
-}
184  
-    void f()
185  
-{
186  
-}
187  
-    void g()
188  
-{
189  
-}
190  
-    void h()
191  
-{
192  
-}
193  
-    void i()
194  
-{
195  
-}
196  
-    void j()
197  
-{
198  
-}
199  
-    void k()
200  
-{
201  
-}
202  
-    void l()
203  
-{
204  
-}
205  
-    void m()
206  
-{
207  
-}
208  
-    void n()
209  
-{
210  
-}
211  
-    void o()
212  
-{
213  
-}
214  
-    void p()
215  
-{
216  
-}
217  
-    void q()
218  
-{
219  
-}
220  
-    void r()
221  
-{
222  
-}
223  
-    void s()
224  
-{
225  
-}
226  
-    void t()
227  
-{
228  
-}
229  
-    void u()
230  
-{
231  
-}
232  
-    void v()
233  
-{
234  
-}
235  
-    void w()
236  
-{
237  
-}
238  
-    void x()
239  
-{
240  
-}
241  
-    void y()
242  
-{
243  
-}
244  
-    void z()
245  
-{
246  
-}
247  
-    void aa()
248  
-{
249  
-}
250  
-    void bb()
251  
-{
252  
-}
253  
-    void cc()
254  
-{
255  
-}
256  
-    void dd()
257  
-{
258  
-}
259  
-    void ee()
260  
-{
261  
-}
262  
-    template A(T)
263  
-{
264  
-}
265  
-    alias A!(uint) getHUint;
266  
-    alias A!(int) getHInt;
267  
-    alias A!(float) getHFloat;
268  
-    alias A!(ulong) getHUlong;
269  
-    alias A!(long) getHLong;
270  
-    alias A!(double) getHDouble;
271  
-    alias A!(byte) getHByte;
272  
-    alias A!(ubyte) getHUbyte;
273  
-    alias A!(short) getHShort;
274  
-    alias A!(ushort) getHUShort;
275  
-    alias A!(real) getHReal;
  170
+	void a()
  171
+	{
  172
+	}
  173
+	void b()
  174
+	{
  175
+	}
  176
+	void c()
  177
+	{
  178
+	}
  179
+	void d()
  180
+	{
  181
+	}
  182
+	void e()
  183
+	{
  184
+	}
  185
+	void f()
  186
+	{
  187
+	}
  188
+	void g()
  189
+	{
  190
+	}
  191
+	void h()
  192
+	{
  193
+	}
  194
+	void i()
  195
+	{
  196
+	}
  197
+	void j()
  198
+	{
  199
+	}
  200
+	void k()
  201
+	{
  202
+	}
  203
+	void l()
  204
+	{
  205
+	}
  206
+	void m()
  207
+	{
  208
+	}
  209
+	void n()
  210
+	{
  211
+	}
  212
+	void o()
  213
+	{
  214
+	}
  215
+	void p()
  216
+	{
  217
+	}
  218
+	void q()
  219
+	{
  220
+	}
  221
+	void r()
  222
+	{
  223
+	}
  224
+	void s()
  225
+	{
  226
+	}
  227
+	void t()
  228
+	{
  229
+	}
  230
+	void u()
  231
+	{
  232
+	}
  233
+	void v()
  234
+	{
  235
+	}
  236
+	void w()
  237
+	{
  238
+	}
  239
+	void x()
  240
+	{
  241
+	}
  242
+	void y()
  243
+	{
  244
+	}
  245
+	void z()
  246
+	{
  247
+	}
  248
+	void aa()
  249
+	{
  250
+	}
  251
+	void bb()
  252
+	{
  253
+	}
  254
+	void cc()
  255
+	{
  256
+	}
  257
+	void dd()
  258
+	{
  259
+	}
  260
+	void ee()
  261
+	{
  262
+	}
  263
+	template A(T)
  264
+	{
  265
+	}
  266
+	alias A!(uint) getHUint;
  267
+	alias A!(int) getHInt;
  268
+	alias A!(float) getHFloat;
  269
+	alias A!(ulong) getHUlong;
  270
+	alias A!(long) getHLong;
  271
+	alias A!(double) getHDouble;
  272
+	alias A!(byte) getHByte;
  273
+	alias A!(ubyte) getHUbyte;
  274
+	alias A!(short) getHShort;
  275
+	alias A!(ushort) getHUShort;
  276
+	alias A!(real) getHReal;
276 277
 }
277 278
 template templ(T)
278 279
 {
279  
-void templ(T val)
280  
-{
281  
-pragma (msg, "Invalid destination type.");
282  
-}
  280
+	void templ(T val)
  281
+	{
  282
+		pragma (msg, "Invalid destination type.");
  283
+	}
283 284
 }
284 285
 static char[] charArray = ['"','\''];
285 286
 
286 287
 class Point
287 288
 {
288  
-    auto x = 10;
289  
-    uint y = 20;
  289
+	auto x = 10;
  290
+	uint y = 20;
290 291
 }
291 292
 template Foo2(bool bar)
292 293
 {
293  
-void test()
294  
-{
295  
-static if(bar)
296  
-{
297  
-int i;
298  
-}
299  
-else
300  
-{
301  
-}
  294
+	void test()
  295
+	{
  296
+		static if(bar)
  297
+		{
  298
+			int i;
  299
+		}
  300
+		else
  301
+		{
  302
+		}
302 303
 
303  
-static if(!bar)
304  
-{
305  
-}
306  
-else
307  
-{
308  
-}
  304
+		static if(!bar)
  305
+		{
  306
+		}
  307
+		else
  308
+		{
  309
+		}
309 310
 
310  
-}
  311
+	}
311 312
 }
312 313
 template Foo4()
313 314
 {
314  
-void bar()