Skip to content

Commit 54d25b6

Browse files
committed
remove GetNamedRegex func
1 parent 4bf9b89 commit 54d25b6

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

src/Domain/HydraScript.Domain.Constants/HydraScript.Domain.Constants.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,4 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
</PropertyGroup>
66

7-
<ItemGroup>
8-
<InternalsVisibleTo Include="HydraScript.Infrastructure.LexerRegexGenerator" />
9-
</ItemGroup>
10-
117
</Project>

src/Domain/HydraScript.Domain.Constants/TokenTypes.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ public record Dto(
66
string Tag,
77
string Pattern,
88
int Priority,
9-
bool CanIgnore = false)
10-
{
11-
internal string GetNamedRegex() => $"(?<{Tag}>{Pattern})";
12-
}
9+
bool CanIgnore = false);
1310

1411
public static IEnumerable<Dto> Stream
1512
{

src/Infrastructure/HydraScript.Infrastructure.LexerRegexGenerator/PatternGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
1515
var tokenTypes = Provider.TokenTypesStream
1616
.OrderBy(x => x.Priority)
1717
.Concat([new TokenTypes.Dto("ERROR", @"\S+", int.MaxValue)]);
18-
var pattern = string.Join("|", tokenTypes.Select(t => t.GetNamedRegex()));
18+
var pattern = string.Join("|", tokenTypes.Select(t => $"(?<{t.Tag}>{t.Pattern})"));
1919

2020
var code = $@"// <auto-generated/>
2121

0 commit comments

Comments
 (0)