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
11 changes: 10 additions & 1 deletion src/Parlot/Scanner.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;

using Parlot.Fluent;

using System.Linq;

#if NET8_0_OR_GREATER
Expand Down Expand Up @@ -168,6 +170,7 @@ public bool ReadDecimal(bool allowLeadingSign, bool allowDecimalSeparator, bool
// Number can be empty if we have a decimal separator directly, in this case don't expect group separators
if (!number.IsEmpty && allowGroupSeparator && Cursor.Current == groupSeparator)
{
var savedCursor = Cursor.Position;
// Group separators can be repeated as many times
while (true)
{
Expand All @@ -177,7 +180,13 @@ public bool ReadDecimal(bool allowLeadingSign, bool allowDecimalSeparator, bool
}
else if (!ReadInteger())
{
// it was not a group separator, really, so go back where the symbol was and stop
Cursor.ResetPosition(savedCursor);
break;
}
else
{
savedCursor = Cursor.Position;
}
}
}
Expand Down Expand Up @@ -435,7 +444,7 @@ public bool ReadAnyOf(ReadOnlySpan<char> chars, out ReadOnlySpan<char> result)
/// Reads the specific expected chars.
/// </summary>
/// <remarks>
/// This overload uses <see cref="SearchValues"/> as this shouldn't be created on every call. The actual implementation of
/// This overload uses <see cref="SearchValues"/> as this shouldn't be created on every call. The actual implementation of
/// <see cref="SearchValues"/> is chosen based on the constituents of the list. The caller should thus reuse the instance.
/// </remarks>
public bool ReadAnyOf(SearchValues<char> values, out ReadOnlySpan<char> result)
Expand Down
Loading