Result<T>

References
public sealed class Result<T> : IResult
The result of a parsing operation.
T

Properties

After

#
public int After { get; }
Gets the index within the source string where the substring for this parse ends, or in the case of a failed parse where the error block ends.
After

Error

#
public string Error { get; }
Failure in case of a unsuccessful parse.
Error
Explicit

IResult.Value

#
Value

Start

#
public int Start { get; }
Gets the index within the source string where the substring for this parse starts, or in he case of a failed parse where the error block starts.
Start

Success

#
public bool Success { get; }
Gets whether the parsing was successful.
Success

Text

#
public string Text { get; }
Gets the substring indicated by this result.
Text

Underlying

#
public string Underlying { get; }

Value

#
public T Value { get; }
Gets the value associated with this result. Only meaningful when Success is true.

Methods

Fail

#
public static Result<T> Fail(string error, string underlying, int start = 0, int after = 2147483647)
Create a new failed parsing result.
error (string)Error message.
underlying (string)The underlying string which was parsed.
start (int = 0)Index of first character.
after (int = 2147483647)Index of first character after span.

Succeed

#
public static Result<T> Succeed(T value, string underlying, int start = 0, int after = 2147483647)
Create a new successful parsing result.
value (T)Value of parsing result.
underlying (string)The underlying string which was parsed.
start (int = 0)Index of first character.
after (int = 2147483647)Index of character after span.

WithValue<Q>

#
public Result<Q> WithValue<Q>(Q newValue)
Create a new result with the same coverage but a different value.
newValue (Q)
WithValue