Class ControlTokenFactory
- Namespace
- Albatross.Expression.Parsing
- Assembly
- Albatross.Expression.dll
Factory for creating control tokens used in expression parsing (parentheses, commas, etc.).
public class ControlTokenFactory : IExpressionFactory<ControlToken>
- Inheritance
-
ControlTokenFactory
- Implements
- Inherited Members
- Extension Methods
Constructors
ControlTokenFactory(char)
Initializes a new instance of the ControlTokenFactory class.
public ControlTokenFactory(char tokenChar)
Parameters
tokenCharcharThe character this factory will recognize and create tokens for.
Fields
Comma
Singleton factory instance for comma tokens.
public static readonly ControlTokenFactory Comma
Field Value
CommaChar
Character constant for comma separator.
public const char CommaChar = ','
Field Value
FuncParamStart
Singleton factory instance for function parameter start tokens.
public static readonly ControlTokenFactory FuncParamStart
Field Value
FuncParamStartChar
Special character marking the beginning of function parameters in the parsing process.
public const char FuncParamStartChar = '$'
Field Value
LeftParenthesis
Singleton factory instance for left parenthesis tokens.
public static readonly ControlTokenFactory LeftParenthesis
Field Value
LeftParenthesisChar
Character constant for left parenthesis.
public const char LeftParenthesisChar = '('
Field Value
RightParenthesis
Singleton factory instance for right parenthesis tokens.
public static readonly ControlTokenFactory RightParenthesis
Field Value
RightParenthesisChar
Character constant for right parenthesis.
public const char RightParenthesisChar = ')'
Field Value
Properties
Token
The control token instance created by this factory.
public ControlToken Token { get; }
Property Value
TokenText
The string representation of the token character.
public string TokenText { get; }
Property Value
Methods
Parse(string, int, out int)
Attempts to parse a token from the given text starting at the specified position.
public ControlToken? 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
- ControlToken
The parsed token if successful; otherwise, null.