Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
burner committed Jan 9, 2024
1 parent 84239aa commit 617db5f
Show file tree
Hide file tree
Showing 67 changed files with 253 additions and 251 deletions.
19 changes: 10 additions & 9 deletions fakerjs2generator/source/generator.d
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ string genMustacheAA(Out)(Mustache[string] m, ref Out o, string[] path
iformat(o, 1, "%sstring %s(%sEnum which) {\n", overWrite ? "override " : ""
, pathToFuncName(path), enumName
);
iformat(o, 2, "final switch(which) {\n", m.length);
iformat(o, 2, "switch(which) {\n", m.length);
foreach(it; m.byKeyValue()) {
iformat(o, 3, "case %sEnum.%s: return ", enumName, it.key);
buildSingleMustache(o, it.value);
Expand All @@ -392,7 +392,7 @@ string genChemicalUnit(Out)(ChemicalUnit[] m, ref Out o, string[] path
{
string ret = pathToFuncName(path);
iformat(o, 1, "%sChemicalUnit %s() {\n", overWrite ? "override " : "", ret);
iformat(o, 2, "final switch(uniform(0, %s, this.rnd)) {\n", m.length);
iformat(o, 2, "switch(uniform(0, %s, this.rnd)) {\n", m.length);
foreach(idx, it; m) {
iformat(o, 3, "case %s: return ChemicalUnit(%s, %s)", idx
, `q"{` ~ it.name ~ `}"`
Expand All @@ -410,7 +410,7 @@ string genChemicalElement(Out)(ChemicalElement[] m, ref Out o, string[] path
{
string ret = pathToFuncName(path);
iformat(o, 1, "%sChemicalElement %s() {\n", overWrite ? "override " : "", ret);
iformat(o, 2, "final switch(uniform(0, %s, this.rnd)) {\n", m.length);
iformat(o, 2, "switch(uniform(0, %s, this.rnd)) {\n", m.length);
foreach(idx, it; m) {
iformat(o, 3, "case %s: return ChemicalElement(%s, %s, %s)", idx
, `q"{` ~ it.symbol ~ `}"`
Expand All @@ -429,7 +429,7 @@ string genCurrency(Out)(Currency[] m, ref Out o, string[] path
{
string ret = pathToFuncName(path);
iformat(o, 1, "%sCurrency %s() {\n", overWrite ? "override " : "", pathToFuncName(path));
iformat(o, 2, "final switch(uniform(0, %s, this.rnd)) {\n", m.length);
iformat(o, 2, "switch(uniform(0, %s, this.rnd)) {\n", m.length);
foreach(idx, it; m) {
iformat(o, 3, "case %s: return Currency(%s, %s, %s)", idx
, `q"{` ~ it.name ~ `}"`
Expand All @@ -448,7 +448,7 @@ string genAirplane(Out)(Airplane[] m, ref Out o, string[] path
{
string ret = pathToFuncName(path);
iformat(o, 1, "%sAirplane %s() {\n", overWrite ? "override " : "", ret);
iformat(o, 2, "final switch(uniform(0, %s, this.rnd)) {\n", m.length);
iformat(o, 2, "switch(uniform(0, %s, this.rnd)) {\n", m.length);
foreach(idx, it; m) {
iformat(o, 3, "case %s: return Airplane(%s, %s)", idx
, it.name.isNull()
Expand All @@ -470,7 +470,7 @@ string genAirport(Out)(Airport[] m, ref Out o, string[] path
{
string ret = pathToFuncName(path);
iformat(o, 1, "%sAirport %s() {\n", overWrite ? "override " : "", ret);
iformat(o, 2, "final switch(uniform(0, %s, this.rnd)) {\n", m.length);
iformat(o, 2, "switch(uniform(0, %s, this.rnd)) {\n", m.length);
foreach(idx, it; m) {
iformat(o, 3, "case %s: return Airport(%s, %s)", idx
, it.name.isNull()
Expand All @@ -492,7 +492,7 @@ string genAirline(Out)(Airline[] m, ref Out o, string[] path
{
string ret = pathToFuncName(path);
iformat(o, 1, "%sAirline %s() {\n", overWrite ? "override " : "", ret);
iformat(o, 2, "final switch(uniform(0, %s, this.rnd)) {\n", m.length);
iformat(o, 2, "switch(uniform(0, %s, this.rnd)) {\n", m.length);
foreach(idx, it; m) {
iformat(o, 3, "case %s: return Airline(%s, %s)", idx
, it.name.isNull()
Expand All @@ -514,7 +514,7 @@ string genMustache(Out)(Mustache[] m, ref Out o, string[] path
{
string ret = pathToFuncName(path);
iformat(o, 1, "%sstring %s() {\n", overWrite ? "override " : "", ret);
iformat(o, 2, "final switch(uniform(0, %s, this.rnd)) {\n", m.length);
iformat(o, 2, "switch(uniform(0, %s, this.rnd)) {\n", m.length);
foreach(idx, it; m) {
iformat(o, 3, "case %s: return ", idx);
buildSingleMustache(o, it);
Expand Down Expand Up @@ -665,7 +665,7 @@ class Faker_base {
}
final string internetEmoji() {
final switch(uniform(0, 10, this.rnd)) {
switch(uniform(0, 10, this.rnd)) {
case 0: return this.internetEmojiSmiley();
case 1: return this.internetEmojiBody();
case 2: return this.internetEmojiPerson();
Expand All @@ -677,6 +677,7 @@ class Faker_base {
case 8: return this.internetEmojiSymbol();
case 9: return this.internetEmojiFlag();
}
return "";
}
`);
Expand Down
4 changes: 2 additions & 2 deletions source/faked/faker_af_za.d
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Faker_af_za : Faker_en {
}

override string locationCityPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationCityName();
}
return "";
Expand Down Expand Up @@ -82,7 +82,7 @@ class Faker_af_za : Faker_en {
}

override string locationStreetPattern() {
final switch(uniform(0, 2, this.rnd)) {
switch(uniform(0, 2, this.rnd)) {
case 0: return personFirstName() ~ " " ~ locationStreetSuffix();
case 1: return personLastName() ~ " " ~ locationStreetSuffix();
}
Expand Down
8 changes: 4 additions & 4 deletions source/faked/faker_ar.d
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Faker_ar : Faker_en {
}

override string locationCityPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationCityName();
}
return "";
Expand Down Expand Up @@ -261,15 +261,15 @@ class Faker_ar : Faker_en {
}

override string locationStreetAddress(LocationStreetAddressEnum which) {
final switch(which) {
switch(which) {
case LocationStreetAddressEnum.normal: return locationBuildingNumber() ~ " " ~ locationStreet();
case LocationStreetAddressEnum.full: return locationBuildingNumber() ~ " " ~ locationStreet() ~ " " ~ locationSecondaryAddress();
}
return "";
}

override string locationStreetPattern() {
final switch(uniform(0, 2, this.rnd)) {
switch(uniform(0, 2, this.rnd)) {
case 0: return locationStreetPrefix() ~ " " ~ personFirstName();
case 1: return locationStreetPrefix() ~ " " ~ personLastName();
}
Expand Down Expand Up @@ -669,7 +669,7 @@ class Faker_ar : Faker_en {
}

override string teamName() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationState() ~ " " ~ teamCreature();
}
return "";
Expand Down
8 changes: 4 additions & 4 deletions source/faked/faker_az.d
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Faker_az : Faker_en {
}

override string companyNamePattern() {
final switch(uniform(0, 3, this.rnd)) {
switch(uniform(0, 3, this.rnd)) {
case 0: return companyPrefix() ~ " " ~ personFemaleFirstName();
case 1: return companyPrefix() ~ " " ~ personMaleFirstName();
case 2: return companyPrefix() ~ " " ~ personMaleLastName();
Expand Down Expand Up @@ -139,7 +139,7 @@ class Faker_az : Faker_en {
}

override string locationCityPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationCityName();
}
return "";
Expand Down Expand Up @@ -220,7 +220,7 @@ class Faker_az : Faker_en {
}

override string locationStreetAddress(LocationStreetAddressEnum which) {
final switch(which) {
switch(which) {
case LocationStreetAddressEnum.normal: return locationStreet() ~ ", " ~ locationBuildingNumber();
case LocationStreetAddressEnum.full: return locationStreet() ~ ", " ~ locationBuildingNumber() ~ " " ~ locationSecondaryAddress();
}
Expand Down Expand Up @@ -293,7 +293,7 @@ class Faker_az : Faker_en {
}

override string locationStreetPattern() {
final switch(uniform(0, 2, this.rnd)) {
switch(uniform(0, 2, this.rnd)) {
case 0: return locationStreetSuffix() ~ " " ~ locationStreetName();
case 1: return locationStreetName() ~ " " ~ locationStreetSuffix();
}
Expand Down
3 changes: 2 additions & 1 deletion source/faked/faker_base.d
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Faker_base {
}

final string internetEmoji() {
final switch(uniform(0, 10, this.rnd)) {
switch(uniform(0, 10, this.rnd)) {
case 0: return this.internetEmojiSmiley();
case 1: return this.internetEmojiBody();
case 2: return this.internetEmojiPerson();
Expand All @@ -61,6 +61,7 @@ class Faker_base {
case 8: return this.internetEmojiSymbol();
case 9: return this.internetEmojiFlag();
}
return "";
}

string databaseCollation() {
Expand Down
8 changes: 4 additions & 4 deletions source/faked/faker_cs_cz.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Faker_cs_cz : Faker_en {
}

override string companyNamePattern() {
final switch(uniform(0, 2, this.rnd)) {
switch(uniform(0, 2, this.rnd)) {
case 0: return personLastName() ~ " " ~ companySuffix();
case 1: return personMaleLastName() ~ " a " ~ personMaleLastName() ~ " " ~ companySuffix();
}
Expand Down Expand Up @@ -208,7 +208,7 @@ class Faker_cs_cz : Faker_en {
}

override string locationCityPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationCityName();
}
return "";
Expand Down Expand Up @@ -289,7 +289,7 @@ class Faker_cs_cz : Faker_en {
}

override string locationStreetAddress(LocationStreetAddressEnum which) {
final switch(which) {
switch(which) {
case LocationStreetAddressEnum.normal: return locationStreet() ~ " " ~ locationBuildingNumber();
case LocationStreetAddressEnum.full: return locationStreet() ~ " " ~ locationBuildingNumber() ~ " " ~ locationSecondaryAddress();
}
Expand Down Expand Up @@ -1756,7 +1756,7 @@ class Faker_cs_cz : Faker_en {
}

override string locationStreetPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationStreetName();
}
return "";
Expand Down
8 changes: 4 additions & 4 deletions source/faked/faker_da.d
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class Faker_da : Faker_en {
}

override string companyNamePattern() {
final switch(uniform(0, 2, this.rnd)) {
switch(uniform(0, 2, this.rnd)) {
case 0: return companyCompanyName();
case 1: return personLastName() ~ " " ~ commerceDepartment() ~ " " ~ companySuffix();
}
Expand Down Expand Up @@ -337,7 +337,7 @@ class Faker_da : Faker_en {
}

override string locationCityPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationCityName();
}
return "";
Expand Down Expand Up @@ -433,7 +433,7 @@ class Faker_da : Faker_en {
}

override string locationStreetAddress(LocationStreetAddressEnum which) {
final switch(which) {
switch(which) {
case LocationStreetAddressEnum.normal: return locationStreet() ~ " " ~ locationBuildingNumber();
case LocationStreetAddressEnum.full: return locationStreet() ~ " " ~ locationBuildingNumber() ~ ", " ~ locationSecondaryAddress();
}
Expand Down Expand Up @@ -475,7 +475,7 @@ class Faker_da : Faker_en {
}

override string locationStreetPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationStreetName();
}
return "";
Expand Down
8 changes: 4 additions & 4 deletions source/faked/faker_de.d
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Faker_de : Faker_en {
}

override string companyNamePattern() {
final switch(uniform(0, 3, this.rnd)) {
switch(uniform(0, 3, this.rnd)) {
case 0: return personLastName() ~ " " ~ companySuffix();
case 1: return personLastName() ~ "-" ~ personLastName();
case 2: return personLastName() ~ ", " ~ personLastName() ~ " und " ~ personLastName();
Expand Down Expand Up @@ -145,7 +145,7 @@ class Faker_de : Faker_en {
}

override string locationCityPattern() {
final switch(uniform(0, 5, this.rnd)) {
switch(uniform(0, 5, this.rnd)) {
case 0: return locationCityPrefix() ~ " " ~ personFirstName() ~ locationCitySuffix();
case 1: return locationCityPrefix() ~ " " ~ personFirstName();
case 2: return personFirstName() ~ locationCitySuffix();
Expand Down Expand Up @@ -264,7 +264,7 @@ class Faker_de : Faker_en {
}

override string locationStreetAddress(LocationStreetAddressEnum which) {
final switch(which) {
switch(which) {
case LocationStreetAddressEnum.normal: return locationStreet() ~ " " ~ locationBuildingNumber();
case LocationStreetAddressEnum.full: return locationStreet() ~ " " ~ locationBuildingNumber() ~ " " ~ locationSecondaryAddress();
}
Expand Down Expand Up @@ -501,7 +501,7 @@ class Faker_de : Faker_en {
}

override string locationStreetPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationStreetName();
}
return "";
Expand Down
8 changes: 4 additions & 4 deletions source/faked/faker_de_at.d
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Faker_de_at : Faker_de {
}

override string companyNamePattern() {
final switch(uniform(0, 3, this.rnd)) {
switch(uniform(0, 3, this.rnd)) {
case 0: return personLastName() ~ " " ~ companySuffix();
case 1: return personLastName() ~ "-" ~ personLastName();
case 2: return personLastName() ~ ", " ~ personLastName() ~ " und " ~ personLastName();
Expand Down Expand Up @@ -97,7 +97,7 @@ class Faker_de_at : Faker_de {
}

override string locationCityPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationCityName();
}
return "";
Expand Down Expand Up @@ -195,7 +195,7 @@ class Faker_de_at : Faker_de {
}

override string locationStreetAddress(LocationStreetAddressEnum which) {
final switch(which) {
switch(which) {
case LocationStreetAddressEnum.normal: return locationStreet() ~ " " ~ locationBuildingNumber();
case LocationStreetAddressEnum.full: return locationStreet() ~ " " ~ locationBuildingNumber() ~ " " ~ locationSecondaryAddress();
}
Expand Down Expand Up @@ -251,7 +251,7 @@ class Faker_de_at : Faker_de {
}

override string locationStreetPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationStreetName();
}
return "";
Expand Down
6 changes: 3 additions & 3 deletions source/faked/faker_de_ch.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Faker_de_ch : Faker_de {
}

override string companyNamePattern() {
final switch(uniform(0, 3, this.rnd)) {
switch(uniform(0, 3, this.rnd)) {
case 0: return personLastName() ~ " " ~ companySuffix();
case 1: return personLastName() ~ "-" ~ personLastName();
case 2: return personLastName() ~ ", " ~ personLastName() ~ " und " ~ personLastName();
Expand Down Expand Up @@ -66,7 +66,7 @@ class Faker_de_ch : Faker_de {
}

override string locationCityPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationCityName();
}
return "";
Expand Down Expand Up @@ -118,7 +118,7 @@ class Faker_de_ch : Faker_de {
}

override string locationStreetPattern() {
final switch(uniform(0, 1, this.rnd)) {
switch(uniform(0, 1, this.rnd)) {
case 0: return locationStreetName();
}
return "";
Expand Down
6 changes: 3 additions & 3 deletions source/faked/faker_dv.d
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Faker_dv : Faker_en {
}

override string companyNamePattern() {
final switch(uniform(0, 5, this.rnd)) {
switch(uniform(0, 5, this.rnd)) {
case 0: return personFirstName() ~ " " ~ companySuffix();
case 1: return personLastName() ~ " " ~ companySuffix();
case 2: return personLastName() ~ " & " ~ personLastName() ~ " " ~ companyNoun() ~ " " ~ companySuffix();
Expand Down Expand Up @@ -129,7 +129,7 @@ class Faker_dv : Faker_en {
}

override string locationCityPattern() {
final switch(uniform(0, 6, this.rnd)) {
switch(uniform(0, 6, this.rnd)) {
case 0: return locationCityPrefix() ~ " " ~ companyNoun() ~ locationCitySuffix();
case 1: return companyAdjective() ~ companyNoun() ~ locationCitySuffix();
case 2: return locationCityPrefix() ~ " " ~ personFirstName();
Expand Down Expand Up @@ -169,7 +169,7 @@ class Faker_dv : Faker_en {
}

override string locationStreetPattern() {
final switch(uniform(0, 3, this.rnd)) {
switch(uniform(0, 3, this.rnd)) {
case 0: return personFirstName() ~ " " ~ locationStreetSuffix();
case 1: return personLastName() ~ " " ~ locationStreetSuffix();
case 2: return companyAdjective() ~ " " ~ companyNoun() ~ " " ~ locationStreetSuffix();
Expand Down
Loading

0 comments on commit 617db5f

Please sign in to comment.