Skip to content

Commit

Permalink
Merge pull request #419 from Dimsday/patch-1
Browse files Browse the repository at this point in the history
Allow letters from any language in names
  • Loading branch information
mganss authored Sep 27, 2023
2 parents 5fe6e28 + 9597973 commit 3b6810c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions XmlSchemaClassGenerator/CodeUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ namespace XmlSchemaClassGenerator
{
public static class CodeUtilities
{
private static readonly Regex invalidCharsRgx = new("[^_a-zA-Z0-9]");
private static readonly Regex invalidCharsRgx = new(@"[^_\p{L}\p{N}]");
private static readonly Regex whiteSpace = new(@"(?<=\s)");
private static readonly Regex startsWithLowerCaseChar = new("^[a-z]");
private static readonly Regex firstCharFollowedByUpperCasesOnly = new("(?<=[A-Z])[A-Z0-9]+$", RegexOptions.None, TimeSpan.FromSeconds(1));
private static readonly Regex lowerCaseNextToNumber = new("(?<=[0-9])[a-z]");
private static readonly Regex upperCaseInside = new("(?<=[A-Z])[A-Z]+?((?=[A-Z][a-z])|(?=[0-9]))", RegexOptions.None, TimeSpan.FromSeconds(1));
private static readonly Regex startsWithLowerCaseChar = new(@"^\p{Ll}");
private static readonly Regex firstCharFollowedByUpperCasesOnly = new(@"(?<=\p{Lu})[\p{Lu}\p{N}]+$", RegexOptions.None, TimeSpan.FromSeconds(1));
private static readonly Regex lowerCaseNextToNumber = new(@"(?<=\p{N})\p{Ll}");
private static readonly Regex upperCaseInside = new(@"(?<=\p{Lu})\p{Lu}+?((?=\p{Lu}\p{Ll})|(?=\p{N}))", RegexOptions.None, TimeSpan.FromSeconds(1));

// Credits: chviLadislav
// https://stackoverflow.com/questions/18627112/how-can-i-convert-text-to-pascal-case
Expand Down Expand Up @@ -485,4 +485,4 @@ private static TypeInfo Make(string @namespace, [CallerMemberName] string name =
}

//Fixes a bug with VS2019 (https://developercommunity.visualstudio.com/content/problem/1244809/error-cs0518-predefined-type-systemruntimecompiler.html)
namespace System.Runtime.CompilerServices { internal static class IsExternalInit { } }
namespace System.Runtime.CompilerServices { internal static class IsExternalInit { } }

0 comments on commit 3b6810c

Please sign in to comment.