From e358d0062509c3c37d5f529801ef4d1213411196 Mon Sep 17 00:00:00 2001 From: Constantin Piber <59023762+cpiber@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:35:48 +0100 Subject: [PATCH 1/2] feat(WebShell): Reference local DynamicExpresso and include DE as language (#330) --- DynamicExpressoWebShell.sln | 6 ++++++ .../DynamicExpressoWebShell/DynamicExpressoWebShell.csproj | 5 ++++- sample/DynamicExpressoWebShell/Startup.cs | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/DynamicExpressoWebShell.sln b/DynamicExpressoWebShell.sln index 865ff721..88299bb9 100644 --- a/DynamicExpressoWebShell.sln +++ b/DynamicExpressoWebShell.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.27004.2005 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamicExpressoWebShell", "sample\DynamicExpressoWebShell\DynamicExpressoWebShell.csproj", "{970A9B0D-4DDF-4E8F-A184-89CC202DB542}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamicExpresso.Core", "src\DynamicExpresso.Core\DynamicExpresso.Core.csproj", "{B496A172-45A2-413A-9060-CDBE4142A8F2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {970A9B0D-4DDF-4E8F-A184-89CC202DB542}.Debug|Any CPU.Build.0 = Debug|Any CPU {970A9B0D-4DDF-4E8F-A184-89CC202DB542}.Release|Any CPU.ActiveCfg = Release|Any CPU {970A9B0D-4DDF-4E8F-A184-89CC202DB542}.Release|Any CPU.Build.0 = Release|Any CPU + {B496A172-45A2-413A-9060-CDBE4142A8F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B496A172-45A2-413A-9060-CDBE4142A8F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B496A172-45A2-413A-9060-CDBE4142A8F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B496A172-45A2-413A-9060-CDBE4142A8F2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sample/DynamicExpressoWebShell/DynamicExpressoWebShell.csproj b/sample/DynamicExpressoWebShell/DynamicExpressoWebShell.csproj index 9a46ff5f..c80367d1 100644 --- a/sample/DynamicExpressoWebShell/DynamicExpressoWebShell.csproj +++ b/sample/DynamicExpressoWebShell/DynamicExpressoWebShell.csproj @@ -7,7 +7,6 @@ - @@ -32,4 +31,8 @@ + + + + diff --git a/sample/DynamicExpressoWebShell/Startup.cs b/sample/DynamicExpressoWebShell/Startup.cs index 7d14b1dc..d1cc5c5c 100644 --- a/sample/DynamicExpressoWebShell/Startup.cs +++ b/sample/DynamicExpressoWebShell/Startup.cs @@ -29,6 +29,8 @@ public void ConfigureServices(IServiceCollection services) // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + app.UseRequestLocalization("en", "de"); + if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); From a9bdac0b553e89def98704ed062672a44366be5c Mon Sep 17 00:00:00 2001 From: Constantin Piber <59023762+cpiber@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:40:08 +0100 Subject: [PATCH 2/2] feat(detectIdentifiers): re-introduce boundary check (#332) This improves the regex evaluation back to when we still had `\b` in front, while (hopefully) doing as it should --- src/DynamicExpresso.Core/Detector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DynamicExpresso.Core/Detector.cs b/src/DynamicExpresso.Core/Detector.cs index e325397f..3d58e012 100644 --- a/src/DynamicExpresso.Core/Detector.cs +++ b/src/DynamicExpresso.Core/Detector.cs @@ -12,10 +12,10 @@ internal class Detector private readonly ParserSettings _settings; private static readonly Regex RootIdentifierDetectionRegex = - new Regex(@"(?@?[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*)", RegexOptions.Compiled); + new Regex(@"(?<=[^\w@]|^)(?@?[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*)", RegexOptions.Compiled); private static readonly Regex ChildIdentifierDetectionRegex = new Regex( - @"(?@?[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*)*)", + @"(?<=[^\w@]|^)(?@?[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*)*)", RegexOptions.Compiled);