Class ParsedExpressionFactoryBuilder
- Namespace
- LfrlAnvil.Computable.Expressions
- Assembly
- LfrlAnvil.Computable.Expressions.dll
Represents a builder of IParsedExpressionFactory instances.
public sealed class ParsedExpressionFactoryBuilder
- Inheritance
-
ParsedExpressionFactoryBuilder
- Inherited Members
- Extension Methods
-
ParsedExpressionFactoryBuilderExtensions.AddFloatArithmeticOperators(ParsedExpressionFactoryBuilder)ParsedExpressionFactoryBuilderExtensions.AddInt32ArithmeticOperators(ParsedExpressionFactoryBuilder)
Constructors
ParsedExpressionFactoryBuilder()
Creates a new ParsedExpressionFactoryBuilder instance.
public ParsedExpressionFactoryBuilder()
Methods
AddBinaryOperator(StringSegment, ParsedExpressionBinaryOperator)
Adds a binary operator construct.
public ParsedExpressionFactoryBuilder AddBinaryOperator(StringSegment symbol, ParsedExpressionBinaryOperator @operator)
Parameters
symbolStringSegmentConstruct's symbol.
operatorParsedExpressionBinaryOperatorOperator to add.
Returns
AddConstant(StringSegment, ParsedExpressionConstant)
Adds a constant construct.
public ParsedExpressionFactoryBuilder AddConstant(StringSegment symbol, ParsedExpressionConstant constant)
Parameters
symbolStringSegmentConstruct's symbol.
constantParsedExpressionConstantConstant to add.
Returns
AddFunction(StringSegment, ParsedExpressionFunction)
Adds a function construct.
public ParsedExpressionFactoryBuilder AddFunction(StringSegment symbol, ParsedExpressionFunction function)
Parameters
symbolStringSegmentConstruct's symbol.
functionParsedExpressionFunctionFunction to add.
Returns
AddPostfixTypeConverter(StringSegment, ParsedExpressionTypeConverter)
Adds a postfix type converter construct.
public ParsedExpressionFactoryBuilder AddPostfixTypeConverter(StringSegment symbol, ParsedExpressionTypeConverter converter)
Parameters
symbolStringSegmentConstruct's symbol.
converterParsedExpressionTypeConverterConverter to add.
Returns
AddPostfixUnaryOperator(StringSegment, ParsedExpressionUnaryOperator)
Adds a postfix unary operator construct.
public ParsedExpressionFactoryBuilder AddPostfixUnaryOperator(StringSegment symbol, ParsedExpressionUnaryOperator @operator)
Parameters
symbolStringSegmentConstruct's symbol.
operatorParsedExpressionUnaryOperatorOperator to add.
Returns
AddPrefixTypeConverter(StringSegment, ParsedExpressionTypeConverter)
Adds a prefix type converter construct.
public ParsedExpressionFactoryBuilder AddPrefixTypeConverter(StringSegment symbol, ParsedExpressionTypeConverter converter)
Parameters
symbolStringSegmentConstruct's symbol.
converterParsedExpressionTypeConverterConverter to add.
Returns
AddPrefixUnaryOperator(StringSegment, ParsedExpressionUnaryOperator)
Adds a prefix unary operator construct.
public ParsedExpressionFactoryBuilder AddPrefixUnaryOperator(StringSegment symbol, ParsedExpressionUnaryOperator @operator)
Parameters
symbolStringSegmentConstruct's symbol.
operatorParsedExpressionUnaryOperatorOperator to add.
Returns
AddTypeDeclaration(StringSegment, Type)
Adds a type declaration construct.
public ParsedExpressionFactoryBuilder AddTypeDeclaration(StringSegment name, Type type)
Parameters
nameStringSegmentConstruct's symbol.
typeTypeType to add.
Returns
AddTypeDeclaration<T>(StringSegment)
Adds a type declaration construct.
public ParsedExpressionFactoryBuilder AddTypeDeclaration<T>(StringSegment name)
Parameters
nameStringSegmentConstruct's symbol.
Returns
Type Parameters
TType to add.
AddVariadicFunction(StringSegment, ParsedExpressionVariadicFunction)
Adds a variadic function construct.
public ParsedExpressionFactoryBuilder AddVariadicFunction(StringSegment symbol, ParsedExpressionVariadicFunction function)
Parameters
symbolStringSegmentConstruct's symbol.
functionParsedExpressionVariadicFunctionFunction to add.
Returns
Build()
Creates a new ParsedExpressionFactory instance.
[Pure]
public ParsedExpressionFactory Build()
Returns
- ParsedExpressionFactory
New ParsedExpressionFactory instance.
Exceptions
- ParsedExpressionFactoryBuilderException
When configuration is invalid.
GetBinaryOperatorPrecedences()
Creates a new IEnumerable<T> instance that contains information about all registered binary operator precedences.
[Pure]
public IEnumerable<KeyValuePair<StringSegment, int>> GetBinaryOperatorPrecedences()
Returns
- IEnumerable<KeyValuePair<StringSegment, int>>
New IEnumerable<T> instance.
GetConfiguration()
Returns the current IParsedExpressionFactoryConfiguration instance.
[Pure]
public IParsedExpressionFactoryConfiguration? GetConfiguration()
Returns
- IParsedExpressionFactoryConfiguration
Current IParsedExpressionFactoryConfiguration instance.
GetConstructs()
Creates a new IEnumerable<T> instance that contains information about all registered constructs.
[Pure]
public IEnumerable<ParsedExpressionConstructInfo> GetConstructs()
Returns
- IEnumerable<ParsedExpressionConstructInfo>
New IEnumerable<T> instance.
GetCtorCallProvider()
Returns the current constructor call provider instance.
[Pure]
public Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>? GetCtorCallProvider()
Returns
- Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>
Current constructor call provider instance.
GetIndexerCallProvider()
Returns the current indexer call provider instance.
[Pure]
public Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>? GetIndexerCallProvider()
Returns
- Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>
Current indexer call provider instance.
GetInvokeProvider()
Returns the current invoke provider instance.
[Pure]
public Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>? GetInvokeProvider()
Returns
- Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>
Current invoke provider instance.
GetMakeArrayProvider()
Returns the current make array provider instance.
[Pure]
public Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>? GetMakeArrayProvider()
Returns
- Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>
Current make array provider instance.
GetMemberAccessProvider()
Returns the current member access provider instance.
[Pure]
public Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>? GetMemberAccessProvider()
Returns
- Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>
Current member access provider instance.
GetMethodCallProvider()
Returns the current method call provider instance.
[Pure]
public Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>? GetMethodCallProvider()
Returns
- Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>
Current method call provider instance.
GetNumberParserProvider()
Returns the current IParsedExpressionNumberParser provider instance.
[Pure]
public Func<ParsedExpressionNumberParserParams, IParsedExpressionNumberParser>? GetNumberParserProvider()
Returns
- Func<ParsedExpressionNumberParserParams, IParsedExpressionNumberParser>
Current IParsedExpressionNumberParser provider instance.
GetPostfixUnaryConstructPrecedences()
Creates a new IEnumerable<T> instance that contains information about all registered postfix unary construct precedences.
[Pure]
public IEnumerable<KeyValuePair<StringSegment, int>> GetPostfixUnaryConstructPrecedences()
Returns
- IEnumerable<KeyValuePair<StringSegment, int>>
New IEnumerable<T> instance.
GetPrefixUnaryConstructPrecedences()
Creates a new IEnumerable<T> instance that contains information about all registered prefix unary construct precedences.
[Pure]
public IEnumerable<KeyValuePair<StringSegment, int>> GetPrefixUnaryConstructPrecedences()
Returns
- IEnumerable<KeyValuePair<StringSegment, int>>
New IEnumerable<T> instance.
SetBinaryOperatorPrecedence(StringSegment, int)
Sets binary operator's precedence.
public ParsedExpressionFactoryBuilder SetBinaryOperatorPrecedence(StringSegment symbol, int precedence)
Parameters
symbolStringSegmentConstruct's symbol.
precedenceintPrecedence value to set.
Returns
SetConfiguration(IParsedExpressionFactoryConfiguration)
Sets the IParsedExpressionFactoryConfiguration instance to the provided value.
public ParsedExpressionFactoryBuilder SetConfiguration(IParsedExpressionFactoryConfiguration configuration)
Parameters
configurationIParsedExpressionFactoryConfigurationValue to set.
Returns
SetCtorCallProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>)
Sets the constructor call provider instance to the provided value.
public ParsedExpressionFactoryBuilder SetCtorCallProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction> ctorCallProvider)
Parameters
ctorCallProviderFunc<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>Value to set.
Returns
SetDefaultConfiguration()
Sets the IParsedExpressionFactoryConfiguration instance to default value.
public ParsedExpressionFactoryBuilder SetDefaultConfiguration()
Returns
Remarks
See ParsedExpressionFactoryDefaultConfiguration for more information.
SetDefaultCtorCallProvider()
Sets the constructor call provider instance to default value.
public ParsedExpressionFactoryBuilder SetDefaultCtorCallProvider()
Returns
Remarks
Default provider will use the ParsedExpressionConstructorCall construct.
SetDefaultIndexerCallProvider()
Sets the indexer call provider instance to default value.
public ParsedExpressionFactoryBuilder SetDefaultIndexerCallProvider()
Returns
Remarks
Default provider will use the ParsedExpressionIndexerCall construct.
SetDefaultInvokeProvider()
Sets the invoke provider instance to default value.
public ParsedExpressionFactoryBuilder SetDefaultInvokeProvider()
Returns
Remarks
Default provider will use the ParsedExpressionInvoke construct.
SetDefaultMakeArrayProvider()
Sets the make array provider instance to default value.
public ParsedExpressionFactoryBuilder SetDefaultMakeArrayProvider()
Returns
Remarks
Default provider will use the ParsedExpressionMakeArray construct.
SetDefaultMemberAccessProvider()
Sets the member access provider instance to default value.
public ParsedExpressionFactoryBuilder SetDefaultMemberAccessProvider()
Returns
Remarks
Default provider will use the ParsedExpressionMemberAccess construct.
SetDefaultMethodCallProvider()
Sets the method call provider instance to default value.
public ParsedExpressionFactoryBuilder SetDefaultMethodCallProvider()
Returns
Remarks
Default provider will use the ParsedExpressionMethodCall construct.
SetDefaultNumberParserProvider()
Sets the IParsedExpressionNumberParser provider instance to default value.
public ParsedExpressionFactoryBuilder SetDefaultNumberParserProvider()
Returns
Remarks
Default provider will parse all numbers as decimal type.
SetIndexerCallProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>)
Sets the indexer call provider instance to the provided value.
public ParsedExpressionFactoryBuilder SetIndexerCallProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction> indexerCallProvider)
Parameters
indexerCallProviderFunc<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>Value to set.
Returns
SetInvokeProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>)
Sets the invoke provider instance to the provided value.
public ParsedExpressionFactoryBuilder SetInvokeProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction> invokeProvider)
Parameters
invokeProviderFunc<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>Value to set.
Returns
SetMakeArrayProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>)
Sets the make array provider instance to the provided value.
public ParsedExpressionFactoryBuilder SetMakeArrayProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction> makeArrayProvider)
Parameters
makeArrayProviderFunc<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>Value to set.
Returns
SetMemberAccessProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>)
Sets the member access provider instance to the provided value.
public ParsedExpressionFactoryBuilder SetMemberAccessProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction> memberAccessProvider)
Parameters
memberAccessProviderFunc<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>Value to set.
Returns
SetMethodCallProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>)
Sets the method call provider instance to the provided value.
public ParsedExpressionFactoryBuilder SetMethodCallProvider(Func<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction> methodCallProvider)
Parameters
methodCallProviderFunc<ParsedExpressionFactoryInternalConfiguration, ParsedExpressionVariadicFunction>Value to set.
Returns
SetNumberParserProvider(Func<ParsedExpressionNumberParserParams, IParsedExpressionNumberParser>)
Sets the IParsedExpressionNumberParser provider instance to the provided value.
public ParsedExpressionFactoryBuilder SetNumberParserProvider(Func<ParsedExpressionNumberParserParams, IParsedExpressionNumberParser> numberParserProvider)
Parameters
numberParserProviderFunc<ParsedExpressionNumberParserParams, IParsedExpressionNumberParser>Value to set.
Returns
SetPostfixUnaryConstructPrecedence(StringSegment, int)
Sets postfix unary construct's precedence.
public ParsedExpressionFactoryBuilder SetPostfixUnaryConstructPrecedence(StringSegment symbol, int precedence)
Parameters
symbolStringSegmentConstruct's symbol.
precedenceintPrecedence value to set.
Returns
SetPrefixUnaryConstructPrecedence(StringSegment, int)
Sets prefix unary construct's precedence.
public ParsedExpressionFactoryBuilder SetPrefixUnaryConstructPrecedence(StringSegment symbol, int precedence)
Parameters
symbolStringSegmentConstruct's symbol.
precedenceintPrecedence value to set.