Table of Contents

Class GenericPrefixExpressionFactory

Namespace
Albatross.Expression.Parsing
Assembly
Albatross.Expression.dll

Factory for parsing generic prefix expressions by name lookup from a registered collection.

public class GenericPrefixExpressionFactory : IExpressionFactory<IPrefixExpression>
Inheritance
GenericPrefixExpressionFactory
Implements
Inherited Members
Extension Methods

Constructors

GenericPrefixExpressionFactory(bool)

Initializes a new instance of the GenericPrefixExpressionFactory class.

public GenericPrefixExpressionFactory(bool caseSensitive = false)

Parameters

caseSensitive bool

Whether prefix expression names should be matched case-sensitively.

Properties

RegisteredExpressions

Gets the collection of registered prefix expressions by name.

public IReadOnlyDictionary<string, Func<IPrefixExpression>> RegisteredExpressions { get; }

Property Value

IReadOnlyDictionary<string, Func<IPrefixExpression>>

Methods

Add<T>()

Adds a prefix expression to the factory's registered collection.

public void Add<T>() where T : IPrefixExpression, new()

Type Parameters

T

The type of prefix expression to add.

Parse(string, int, out int)

Attempts to parse a token from the given text starting at the specified position.

public IPrefixExpression? Parse(string text, int start, out int next)

Parameters

text string

The expression text to parse.

start int

The starting position in the text to begin parsing.

next int

When this method returns, contains the position after the parsed token, or the original start position if parsing failed.

Returns

IPrefixExpression

The parsed token if successful; otherwise, null.