From 8bcb4a545b7fae70bd52ddeae9985db4bafb71e0 Mon Sep 17 00:00:00 2001 From: Timothy Bruce Date: Fri, 23 Oct 2026 23:23:41 -0400 Subject: [PATCH 1/2] test(sed): require Expressions matcher type --- tests/Sed.Tests/src/SedModuleBoundaryTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/Sed.Tests/src/SedModuleBoundaryTests.cs b/tests/Sed.Tests/src/SedModuleBoundaryTests.cs index 92e3e86..194d05a 100644 --- a/tests/Sed.Tests/src/SedModuleBoundaryTests.cs +++ b/tests/Sed.Tests/src/SedModuleBoundaryTests.cs @@ -7,6 +7,15 @@ namespace Icod.LineEditor.Sed.Tests; /// Verifies the public and private boundaries retained by the LE1 source decomposition. /// public sealed class SedModuleBoundaryTests { + /// Verifies Sed's compiled matcher uses the published Expressions type. + [Fact] + public void CompiledRegexUsesExpressionsAssembly() { + var type = typeof( Icod.LineEditor.Sed.Command ).GetNestedType( + "SedCompiledRegularExpression", BindingFlags.NonPublic + )!; + var constructor = type.GetConstructors( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic ).Single(); + Assert.Equal( "Icod.Expressions", constructor.GetParameters()[0].ParameterType.Assembly.GetName().Name ); + } /// /// Verifies that the established synchronous and asynchronous command signatures remain available. From 34acd647da3d36c93c0f84323210a866dba729bd Mon Sep 17 00:00:00 2001 From: Timothy Bruce Date: Fri, 23 Oct 2026 23:26:14 -0400 Subject: [PATCH 2/2] Migrate sed GNU regex to Icod.Expressions --- README.md | 29 ++++++++--------------------- sed/Icod.LineEditor.Sed.csproj | 1 + sed/README.md | 6 +++--- sed/src/SedRegularExpressions.cs | 6 ++++-- sed/src/SedSubstitution.cs | 4 +++- 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 6ad9343..d00df8d 100644 --- a/README.md +++ b/README.md @@ -99,27 +99,14 @@ There is intentionally **no** general `Icod.LineEditor.Shared` project. The comp ## Architecture -The permanent dependency direction is: +The current dependency direction is: -```text -Published neutral foundation - Icod.CommandFramework 2.1.0 - ↓ PackageReference - ┌──────────────────────────────┐ - │ Icod.LineEditor.Ed.Shared │ - └──────────────────────────────┘ - ↓ ProjectReference - ed red - - Icod.CommandFramework 2.1.0 - ↓ PackageReference - sed - - ed red sed - \ | / - lineeditor - distribution router -``` +| Project | Dependencies | +|---|---| +| `Icod.LineEditor.Ed.Shared` | `Icod.CommandFramework 2.1.0`, `Icod.Expressions 0.1.0-alpha.1`, `Icod.Processes 1.2.0` | +| `ed`, `red` | The repository-local Ed engine and aliased Expressions regex providers | +| `sed` | CommandFramework for command and text services, Expressions for GNU regex matching | +| `lineeditor` | Repository-local `ed`, `red`, and `sed` commands | `ed` and `red` deliberately share the Ed engine through repository-local `ProjectReference` relationships. `sed` remains a separate execution engine. The `lineeditor` router references all three command projects only to provide in-process dispatch. No production project in this repository references `Icod.CoreUtils.Shared`. @@ -185,7 +172,7 @@ The solution defines `Debug`, `Staging`, and `Release` configurations. Release b Repository versioning is centralized in the root [`Directory.Build.props`](Directory.Build.props). This branch prepares the unpublished `2.0.0-alpha.1` prerelease: `VersionPrefix` is `2.0.0`, `VersionSuffix` is `alpha.1`, and the package version combines them. `AssemblyVersion` and `FileVersion` remain numeric `2.0.0.0`. -The prerelease moves the `ed`/`red` injectable regex provider from the CommandFramework assembly to `Icod.Expressions 0.1.0-alpha.1`. In-process callers of `EditorEngine` must reference `Icod.Expressions` and pass its provider type; this changes source and binary API identity. The command-line interfaces remain the same. Further API refactoring may occur before stable 2.0. `sed` will migrate in a separate change. +The prerelease moves the `ed`/`red` injectable regex provider and `sed` GNU regex matching from the CommandFramework assembly to `Icod.Expressions 0.1.0-alpha.1`. In-process callers of `EditorEngine` must reference `Icod.Expressions` and pass its provider type; this changes source and binary API identity. The command-line interfaces remain the same. Further API refactoring may occur before stable 2.0. For a tagged release, the `v` tag must agree with the generated NuGet package version. The release workflow selects packages by their actual nuspec version, so a mismatched tag cannot silently publish a differently versioned package. diff --git a/sed/Icod.LineEditor.Sed.csproj b/sed/Icod.LineEditor.Sed.csproj index f1d01de..d23fcf3 100644 --- a/sed/Icod.LineEditor.Sed.csproj +++ b/sed/Icod.LineEditor.Sed.csproj @@ -17,6 +17,7 @@ + diff --git a/sed/README.md b/sed/README.md index 631c135..3d9bd16 100644 --- a/sed/README.md +++ b/sed/README.md @@ -116,9 +116,9 @@ y transliterate characters ## REGULAR EXPRESSIONS -Regular expressions use the managed GNU BRE/ERE providers supplied by `Icod.CommandFramework`. Sed retains command-specific handling for empty-expression reuse, address and substitution modifiers, GNU escape preprocessing, occurrence selection, zero-length match progression, replacement expansion, and diagnostic presentation. +Regular expressions use the managed GNU BRE/ERE providers supplied by `Icod.Expressions`. Sed retains command-specific handling for empty-expression reuse, address and substitution modifiers, GNU escape preprocessing, occurrence selection, zero-length match progression, replacement expansion, and diagnostic presentation. -`--posix` narrows GNU extension handling without replacing the managed regular-expression engine. Locale-sensitive text behavior is selected through the command framework's text and regular-expression contracts. +`--posix` narrows GNU extension handling without replacing the managed regular-expression engine. Locale-sensitive text behavior is selected through the command framework's text contracts and the Expressions regular-expression character classes. ## RECORD AND TEXT SEMANTICS @@ -149,7 +149,7 @@ In-place editing uses the transactional replacement foundation supplied through ## PLATFORM NOTES -The project targets .NET 10 with C# 13 and is tested on Windows, Linux, and macOS. The core stream-editing engine is managed and does not invoke an external `sed` executable. Host-dependent process, filesystem, temporary-file, regular-expression, record, and transactional-replacement mechanics are supplied through .NET and `Icod.CommandFramework`. +The project targets .NET 10 with C# 13 and is tested on Windows, Linux, and macOS. The core stream-editing engine is managed and does not invoke an external `sed` executable. GNU regular expressions come from `Icod.Expressions`; host-dependent process, filesystem, temporary-file, record, text, and transactional-replacement mechanics remain in .NET and `Icod.CommandFramework`. ## AUTHORS diff --git a/sed/src/SedRegularExpressions.cs b/sed/src/SedRegularExpressions.cs index 316f916..08a88f2 100644 --- a/sed/src/SedRegularExpressions.cs +++ b/sed/src/SedRegularExpressions.cs @@ -1,13 +1,15 @@ +extern alias Expressions; + namespace Icod.LineEditor.Sed; using System; using System.Collections.Generic; using System.Globalization; using System.Threading; -using Icod.CommandFramework.RegularExpressions; +using Expressions::Icod.CommandFramework.RegularExpressions; using Icod.CommandFramework.Text; -// Responsibility: Sed-specific regular-expression policy over the Shared GNU provider. +// Responsibility: Sed-specific regular-expression policy over the Icod.Expressions GNU provider. public static partial class Command { private enum SedRegularExpressionContext { diff --git a/sed/src/SedSubstitution.cs b/sed/src/SedSubstitution.cs index 532a178..e6f8d1d 100644 --- a/sed/src/SedSubstitution.cs +++ b/sed/src/SedSubstitution.cs @@ -1,3 +1,5 @@ +extern alias Expressions; + namespace Icod.LineEditor.Sed; using System; @@ -6,7 +8,7 @@ namespace Icod.LineEditor.Sed; using System.IO; using System.Linq; using System.Text; -using Icod.CommandFramework.RegularExpressions; +using Expressions::Icod.CommandFramework.RegularExpressions; using System.Threading; using System.Threading.Tasks; using Icod.CommandFramework.CommandLine;