Show / Hide Table of Contents

Class ParsedExtensions

Wrapper for static extension methods on the IParsed interface. You shouldn't have to refer to this class directly.

Inheritance
Object
ParsedExtensions
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Mangrove.Parsing.Extensions
Assembly: Mangrove.Parsing.dll
Syntax
public static class ParsedExtensions

Methods

View Source

Combine<T>(IEnumerable<IParsed<T>>)

Return the collection of results if no member of the collection has an error, otherwise return a single failed parse.

Declaration
public static IParsed<IReadOnlyList<T>> Combine<T>(this IEnumerable<IParsed<T>> parsed)
    where T : class
Parameters
Type Name Description
IEnumerable<IParsed<T>> parsed
Returns
Type Description
IParsed<IReadOnlyList<T>>
Type Parameters
Name Description
T
View Source

Lookup<TKey, TValue>(IDictionary<TKey, TValue>, TKey, Nullable<ErrorKind>, String)

Treat looking up a key in a dictionary as parsing, with possible injected error kind and message when it does not exist.

Declaration
public static IParsed<TValue> Lookup<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, ErrorKind? error = default(ErrorKind? ), string message = null)
    where TValue : class
Parameters
Type Name Description
IDictionary<TKey, TValue> dict
TKey key
Nullable<ErrorKind> error
String message
Returns
Type Description
IParsed<TValue>
Type Parameters
Name Description
TKey
TValue
View Source

SearchWith<T, R>(T, Func<T, IParsed<R>>)

Using search function through node and its direct and indirect parents in a BFS manner and return the first successful one.

Declaration
public static IParsed<R> SearchWith<T, R>(this T node, Func<T, IParsed<R>> search)
    where T : IDirectedAcyclicGraph<T> where R : class
Parameters
Type Name Description
T node
Func<T, IParsed<R>> search
Returns
Type Description
IParsed<R>
Type Parameters
Name Description
T
R
View Source

Success<T>(IParsed<T>)

Declaration
public static bool Success<T>(this IParsed<T> parsed)
    where T : class
Parameters
Type Name Description
IParsed<T> parsed
Returns
Type Description
Boolean
Type Parameters
Name Description
T
View Source

When<T>(IParsed<T>, Action<T>, Action<IDiagnostics>)

Invoke the appropriate function depending on whether parsed is a success or not.

Declaration
public static IParsed<T> When<T>(this IParsed<T> parsed, Action<T> success, Action<IDiagnostics> failure = null)
    where T : class
Parameters
Type Name Description
IParsed<T> parsed
Action<T> success
Action<IDiagnostics> failure
Returns
Type Description
IParsed<T>
Type Parameters
Name Description
T
View Source

With<T, TResult>(IParsed<T>, Func<T, TResult>)

Return the result of evaluating success on the result, with the natural default failure function.

Declaration
public static IParsed<TResult> With<T, TResult>(this IParsed<T> parsed, Func<T, TResult> success)
    where T : class where TResult : class
Parameters
Type Name Description
IParsed<T> parsed
Func<T, TResult> success
Returns
Type Description
IParsed<TResult>
Type Parameters
Name Description
T
TResult
View Source

With<T, TResult>(IParsed<T>, Func<T, TResult>, Func<IDiagnostics, TResult>)

Return the result of evaluating the appropriate function on the content of parsed.

Declaration
public static TResult With<T, TResult>(this IParsed<T> parsed, Func<T, TResult> success, Func<IDiagnostics, TResult> failure)
    where T : class where TResult : class
Parameters
Type Name Description
IParsed<T> parsed
Func<T, TResult> success
Func<IDiagnostics, TResult> failure
Returns
Type Description
TResult
Type Parameters
Name Description
T
TResult
View Source

With<T, TResult>(IParsed<T>, Func<T, IParsed<TResult>>)

Return the result of evaluating success on the result, with the natural default failure function.

Declaration
public static IParsed<TResult> With<T, TResult>(this IParsed<T> parsed, Func<T, IParsed<TResult>> success)
    where T : class where TResult : class
Parameters
Type Name Description
IParsed<T> parsed
Func<T, IParsed<TResult>> success
Returns
Type Description
IParsed<TResult>
Type Parameters
Name Description
T
TResult
  • View Source
Back to top Generated by DocFX