Skip to content
Merged
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: 1 addition & 1 deletion src/Parlot/Character.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static partial class Character
{
private static ReadOnlySpan<byte> _characterData => new byte[]
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 8, 8, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 8, 8, 12, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand Down
1 change: 1 addition & 0 deletions test/Parlot.Tests/CharMaskGeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public static bool IsWhiteSpaceOrNewLine(char ch)
return (ch <= 32 &&
((ch == 32) || // space
(ch == '\n') ||
(ch == '\f') ||
(ch == '\r') ||
(ch == '\t') || // horizontal tab
(ch == '\v')))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastienros thanks for fixing this.
Since these are consecutive now, is it worth checking the range instead? I mean something like ch >= 0x09 && ch <= 0x0d

0x09 9 HT Horizontal Tab
0x0a 10 LF Line Feed
0x0b 11 VT Vertical Tab
0x0c 12 FF Form Feed
0x0d 13 CR Carriage Return

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a test it doesn't matter to me. On the contrary even since what it's checking it more obvious (again at least to me).

Expand Down
6 changes: 4 additions & 2 deletions test/Parlot.Tests/CharacterTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Xunit;
using Xunit;

namespace Parlot.Tests;

Expand Down Expand Up @@ -32,6 +32,7 @@ public void ShouldDecodeStringInBuffer()
[InlineData('\x09', true)]
[InlineData('\x20', true)]
[InlineData('\xa0', true)]
[InlineData('\f', true)]
[InlineData('\v', false)]
[InlineData('\n', false)]
[InlineData('\r', false)]
Expand All @@ -42,9 +43,10 @@ public void ShouldDetectWhiteSpace(char c, bool isWhiteSpace)
}

[Theory]
[InlineData('\x09', true)]
[InlineData('\t', true)]
[InlineData('\x20', true)]
[InlineData('\xa0', true)]
[InlineData('\f', true)]
[InlineData('\v', true)]
[InlineData('\n', true)]
[InlineData('\r', true)]
Expand Down
4 changes: 2 additions & 2 deletions test/Parlot.Tests/CompileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ public void ShouldCompileNonWhiteSpace()
[Fact]
public void ShouldCompileWhiteSpace()
{
Assert.Equal("\n\r\v ", Literals.WhiteSpace(true).Compile().Parse("\n\r\v a"));
Assert.Equal(" ", Literals.WhiteSpace(false).Compile().Parse(" \n\r\v a"));
Assert.Equal("\n\r\v\f ", Literals.WhiteSpace(true).Compile().Parse("\n\r\v\f a"));
Assert.Equal(" ", Literals.WhiteSpace(false).Compile().Parse(" \n\r\v\f a"));
}

[Theory]
Expand Down
4 changes: 2 additions & 2 deletions test/Parlot.Tests/FluentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ public void NonWhiteSpaceShouldStopAtSpaceOrEof()
[Fact]
public void ShouldParseWhiteSpace()
{
Assert.Equal("\n\r\v ", Literals.WhiteSpace(true).Parse("\n\r\v a"));
Assert.Equal(" ", Literals.WhiteSpace(false).Parse(" \n\r\v a"));
Assert.Equal("\n\r\v\f ", Literals.WhiteSpace(true).Parse("\n\r\v\f a"));
Assert.Equal(" \f", Literals.WhiteSpace(false).Parse(" \f\n\r\v a"));
}

[Fact]
Expand Down