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
caseSensitiveboolWhether 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
Methods
Add<T>()
Adds a prefix expression to the factory's registered collection.
public void Add<T>() where T : IPrefixExpression, new()
Type Parameters
TThe 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
textstringThe expression text to parse.
startintThe starting position in the text to begin parsing.
nextintWhen 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.