Table of Contents

Class ParsedExpressionFactory

Namespace
LfrlAnvil.Computable.Expressions
Assembly
LfrlAnvil.Computable.Expressions.dll

Represents a parsed expression factory.

public sealed class ParsedExpressionFactory : IParsedExpressionFactory
Inheritance
ParsedExpressionFactory
Implements
Inherited Members

Properties

Configuration

Configuration of this factory.

public IParsedExpressionFactoryConfiguration Configuration { get; }

Property Value

IParsedExpressionFactoryConfiguration

Methods

Create<TArg, TResult>(string)

Creates a new IParsedExpression<TArg, TResult> instance.

[Pure]
public ParsedExpression<TArg, TResult> Create<TArg, TResult>(string input)

Parameters

input string

Input to parse.

Returns

ParsedExpression<TArg, TResult>

New IParsedExpression<TArg, TResult> instance.

Type Parameters

TArg

Argument type.

TResult

Result type.

Exceptions

ParsedExpressionCreationException

When input parsing failed.

GetBinaryOperatorPrecedence(StringSegment)

Returns the binary operator precedence associated with the provided symbol.

[Pure]
public int? GetBinaryOperatorPrecedence(StringSegment symbol)

Parameters

symbol StringSegment

Symbol to check.

Returns

int?

Binary operator precedence if it exists.

GetConstantExpression(StringSegment)

Returns the ConstantExpression associated with the provided symbol.

[Pure]
public ConstantExpression? GetConstantExpression(StringSegment symbol)

Parameters

symbol StringSegment

Symbol to check.

Returns

ConstantExpression

ConstantExpression if it exists.

GetConstructSymbols()

Creates a new IEnumerable<T> instance that contains all available construct symbols.

[Pure]
public IEnumerable<StringSegment> GetConstructSymbols()

Returns

IEnumerable<StringSegment>

New IEnumerable<T> instance.

GetConstructType(StringSegment)

Returns the ParsedExpressionConstructType of the provided symbol.

[Pure]
public ParsedExpressionConstructType GetConstructType(StringSegment symbol)

Parameters

symbol StringSegment

Construct symbol to check.

Returns

ParsedExpressionConstructType

ParsedExpressionConstructType associated with the provided symbol.

GetFunctionExpressions(StringSegment)

Returns a collection of all function expressions for the provided symbol.

[Pure]
public IEnumerable<LambdaExpression> GetFunctionExpressions(StringSegment symbol)

Parameters

symbol StringSegment

Construct symbol to check.

Returns

IEnumerable<LambdaExpression>

Collection of all function expressions.

GetGenericBinaryOperatorType(StringSegment)

Returns the generic binary operator construct's type for the provided symbol.

[Pure]
public Type? GetGenericBinaryOperatorType(StringSegment symbol)

Parameters

symbol StringSegment

Construct symbol to check.

Returns

Type

Type of the generic binary operator construct's type if it exists.

GetGenericPostfixUnaryConstructType(StringSegment)

Returns the generic postfix unary construct's type for the provided symbol.

[Pure]
public Type? GetGenericPostfixUnaryConstructType(StringSegment symbol)

Parameters

symbol StringSegment

Construct symbol to check.

Returns

Type

Type of the generic postfix unary construct's type if it exists.

GetGenericPrefixUnaryConstructType(StringSegment)

Returns the generic prefix unary construct's type for the provided symbol.

[Pure]
public Type? GetGenericPrefixUnaryConstructType(StringSegment symbol)

Parameters

symbol StringSegment

Construct symbol to check.

Returns

Type

Type of the generic prefix unary construct's type if it exists.

GetPostfixUnaryConstructPrecedence(StringSegment)

Returns the postfix unary construct precedence associated with the provided symbol.

[Pure]
public int? GetPostfixUnaryConstructPrecedence(StringSegment symbol)

Parameters

symbol StringSegment

Symbol to check.

Returns

int?

Postfix unary construct precedence if it exists.

GetPrefixUnaryConstructPrecedence(StringSegment)

Returns the prefix unary construct precedence associated with the provided symbol.

[Pure]
public int? GetPrefixUnaryConstructPrecedence(StringSegment symbol)

Parameters

symbol StringSegment

Symbol to check.

Returns

int?

Prefix unary construct precedence if it exists.

GetSpecializedBinaryOperators(StringSegment)

Returns a collection of all specialized binary operator constructs for the provided symbol.

[Pure]
public IEnumerable<ParsedExpressionBinaryOperatorInfo> GetSpecializedBinaryOperators(StringSegment symbol)

Parameters

symbol StringSegment

Construct symbol to check.

Returns

IEnumerable<ParsedExpressionBinaryOperatorInfo>

Collection of all specialized binary operator constructs.

GetSpecializedPostfixUnaryConstructs(StringSegment)

Returns a collection of all specialized postfix unary constructs for the provided symbol.

[Pure]
public IEnumerable<ParsedExpressionUnaryConstructInfo> GetSpecializedPostfixUnaryConstructs(StringSegment symbol)

Parameters

symbol StringSegment

Construct symbol to check.

Returns

IEnumerable<ParsedExpressionUnaryConstructInfo>

Collection of all specialized postfix unary constructs.

GetSpecializedPrefixUnaryConstructs(StringSegment)

Returns a collection of all specialized prefix unary constructs for the provided symbol.

[Pure]
public IEnumerable<ParsedExpressionUnaryConstructInfo> GetSpecializedPrefixUnaryConstructs(StringSegment symbol)

Parameters

symbol StringSegment

Construct symbol to check.

Returns

IEnumerable<ParsedExpressionUnaryConstructInfo>

Collection of all specialized prefix unary constructs.

GetTypeConverterTargetType(StringSegment)

Returns the type converter's target type associated with the provided symbol.

[Pure]
public Type? GetTypeConverterTargetType(StringSegment symbol)

Parameters

symbol StringSegment

Symbol to check.

Returns

Type

Type converter's target type if it exists.

GetTypeDeclarationType(StringSegment)

Returns the type declaration's type associated with the provided symbol.

[Pure]
public Type? GetTypeDeclarationType(StringSegment symbol)

Parameters

symbol StringSegment

Symbol to check.

Returns

Type

Type declaration's type if it exists.

GetVariadicFunctionType(StringSegment)

Returns the type of the variadic function's construct associated with the provided symbol.

[Pure]
public Type? GetVariadicFunctionType(StringSegment symbol)

Parameters

symbol StringSegment

Symbol to check.

Returns

Type

Type od the variadic function's construct if it exists.

TryCreate<TArg, TResult>(string, out ParsedExpression<TArg, TResult>, out Chain<ParsedExpressionBuilderError>)

Attempts to create a new IParsedExpression<TArg, TResult> instance.

public bool TryCreate<TArg, TResult>(string input, out ParsedExpression<TArg, TResult> result, out Chain<ParsedExpressionBuilderError> errors)

Parameters

input string

Input to parse.

result ParsedExpression<TArg, TResult>

out parameter that returns the created IParsedExpression<TArg, TResult> instance.

errors Chain<ParsedExpressionBuilderError>

out parameter that returns parsing errors.

Returns

bool

true when parsing was successful, otherwise false.

Type Parameters

TArg

Argument type.

TResult

Result type.