Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions Sources/SynKit/Libraries/Lexer.Generator/RegExParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ public static string Escape(string str) =>
'n' => '\n',
'r' => '\r',
't' => '\t',
'v' => '\v',
'f' => '\f',
'0' => '\0',
'\\' => '\\',
_ => null,
Expand Down
14 changes: 14 additions & 0 deletions Sources/SynKit/Tests/Lexer.Tests/RegexesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ internal partial class Issue145Lexer
{
}

public enum SpecialEscapeSequences
{
[End] End,
[Error] Error,
[Regex("[\\f\\v]")] Feed,
}

[Lexer(typeof(SpecialEscapeSequences))]
internal partial class SpecialEscapeSequencesLexer
{
}

[Theory]

[InlineData("foo", typeof(Identifier), true, typeof(IdentifierLexer))]
Expand Down Expand Up @@ -229,6 +241,8 @@ internal partial class Issue145Lexer
[InlineData(@"'hello \' bye'", typeof(Issue140Token), true, typeof(Issue140Lexer))]

[InlineData(@"]", typeof(EscapingInsideSingleLiteralRangeToken), true, typeof(Issue145Lexer))]
[InlineData("\v", typeof(SpecialEscapeSequences), true, typeof(SpecialEscapeSequencesLexer))]
[InlineData("\f", typeof(SpecialEscapeSequences), true, typeof(SpecialEscapeSequencesLexer))]
public void SingleTokenAcceptance(string input, Type enumType, bool shouldAccept, Type lexerType)
{
dynamic lexer = Activator.CreateInstance(lexerType, input)!;
Expand Down