Skip to content

Commit

Permalink
Merge pull request #83
Browse files Browse the repository at this point in the history
* Перейти на FrozenDictionary в Structure.

* Убран пробел.

* I have read the CLA Document and I hereby sign the CLA
  • Loading branch information
FoxTes authored Aug 11, 2024
1 parent 3b88d54 commit 76991aa
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections;
using System.Collections.Frozen;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Text.RegularExpressions;
Expand All @@ -9,9 +10,9 @@ namespace HydraScript.Domain.FrontEnd.Lexer.Impl;
public class Structure<TContainer>(ITokenTypesProvider provider) : IStructure
where TContainer : IGeneratedRegexContainer
{
private Dictionary<string, TokenType> Types { get; } = provider.GetTokenTypes()
private FrozenDictionary<string, TokenType> Types { get; } = provider.GetTokenTypes()
.Concat([new EndOfProgramType(), new ErrorType()])
.ToDictionary(x => x.Tag);
.ToFrozenDictionary(x => x.Tag);

public Regex Regex { get; } = TContainer.GetRegex();

Expand All @@ -24,7 +25,7 @@ public override string ToString() =>
.ToString();

public IEnumerator<TokenType> GetEnumerator() =>
Types.Values.GetEnumerator();
Types.Values.AsEnumerable().GetEnumerator();

[ExcludeFromCodeCoverage]
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
Expand Down

0 comments on commit 76991aa

Please sign in to comment.