Initial commit

This commit is contained in:
github-classroom[bot] 2025-06-03 15:18:01 +00:00 committed by GitHub
commit 4b1294b32d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 5134 additions and 0 deletions

View file

@ -0,0 +1,40 @@
using System;
namespace MathInterpreter.Core;
/// <summary>
/// Result object of scan operations
/// </summary>
/// <typeparam name="T">Type of the parsed value</typeparam>
public readonly ref struct ScanResult<T> where T : struct
{
/// <summary>
/// Creates a new scan result based on a successfully parsed value - if parsing failed an Exception
/// would have been thrown and this constructor would not be called
/// </summary>
/// <param name="value">Parsed value</param>
/// <param name="length">Number of characters (digits) of the parsed value</param>
/// <param name="remainingExpression">Remaining part of the expression after extracting and parsing the value</param>
/// <exception cref="ArgumentOutOfRangeException">Thrown if an invalid argument is provided</exception>
public ScanResult(T value, int length, ReadOnlySpan<char> remainingExpression)
{
Value = value;
Length = -1; // TODO
RemainingExpression = remainingExpression;
}
/// <summary>
/// Gets the parsed value
/// </summary>
public T Value { get; }
/// <summary>
/// Gets the number of characters (digits) of the parsed value
/// </summary>
public int Length { get; }
/// <summary>
/// Gets the remaining part of the expression after extracting and parsing the value
/// </summary>
public ReadOnlySpan<char> RemainingExpression { get; }
}