# HG changeset patch # User Aziz K?ksal # Date 1200694304 -3600 # Node ID cedfc67faabf7075e6b73eec4d7106951f10fad4 # Parent 118971211c4cca30f314fcba8673fb0651ee7fab Improved GermantTranslator. diff -r 118971211c4c -r cedfc67faabf trunk/src/dil/translator/German.d --- a/trunk/src/dil/translator/German.d Fri Jan 18 22:40:06 2008 +0100 +++ b/trunk/src/dil/translator/German.d Fri Jan 18 23:11:44 2008 +0100 @@ -27,7 +27,8 @@ Declaration inAggregate; /// Current aggregate. Declaration inFunc; /// Current function. - bool pluralize; /// Whether to use the plural in the next type. + bool pluralize; /// Whether to use the plural when printing the next types. + bool pointer; /// Whether next types should consider the previous pointer. /++ Construct a GermanTranslator. @@ -283,9 +284,8 @@ { char[] c1 = "s", c2 = ""; if (pluralize) - (pluralize = false), (c1 = "n"), (c2 = "s"); - // Types after arrays should be in plural. - pluralize = true; + (c1 = pointer ? ""[] : "n"), (c2 = "s"); + pointer = false; if (n.assocType) put.format("assoziative{} Array{} von ", c1, c2); // visitT(n.assocType); @@ -299,15 +299,17 @@ } else put.format("dynamische{} Array{} von ", c1, c2); + // Types following arrays should be in plural. + pluralize = true; visitT(n.next); + pluralize = false; return n; } TypeNode visit(PointerType n) { - char[] c = ""; - if (pluralize) - (pluralize = false), c = "n"; + char[] c = pluralize ? (pointer ? ""[] : "n") : ""; + pointer = true; put.format("Zeiger{} auf ", c), visitT(n.next); return n; } @@ -328,14 +330,10 @@ TypeNode visit(IntegralType n) { - char[] c = ""; - if (pluralize) - { - (pluralize = false), c = "s"; - if (n.tok == TOK.Void) // Avoid pluralizing "void" - c = ""; - } - put.format(n.begin.srcText, c); + char[] c = pluralize ? "s"[] : ""; + if (n.tok == TOK.Void) // Avoid pluralizing "void" + c = ""; + put.format("{}{}", n.begin.srcText, c); return n; } }