Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow letters from any language in names #419

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 { } }