Table of Contents

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

tokenChar char

The character this factory will recognize and create tokens for.

Fields

Comma

Singleton factory instance for comma tokens.

public static readonly ControlTokenFactory Comma

Field Value

ControlTokenFactory

CommaChar

Character constant for comma separator.

public const char CommaChar = ','

Field Value

char

FuncParamStart

Singleton factory instance for function parameter start tokens.

public static readonly ControlTokenFactory FuncParamStart

Field Value

ControlTokenFactory

FuncParamStartChar

Special character marking the beginning of function parameters in the parsing process.

public const char FuncParamStartChar = '$'

Field Value

char

LeftParenthesis

Singleton factory instance for left parenthesis tokens.

public static readonly ControlTokenFactory LeftParenthesis

Field Value

ControlTokenFactory

LeftParenthesisChar

Character constant for left parenthesis.

public const char LeftParenthesisChar = '('

Field Value

char

RightParenthesis

Singleton factory instance for right parenthesis tokens.

public static readonly ControlTokenFactory RightParenthesis

Field Value

ControlTokenFactory

RightParenthesisChar

Character constant for right parenthesis.

public const char RightParenthesisChar = ')'

Field Value

char

Properties

Token

The control token instance created by this factory.

public ControlToken Token { get; }

Property Value

ControlToken

TokenText

The string representation of the token character.

public string TokenText { get; }

Property Value

string

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

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

ControlToken

The parsed token if successful; otherwise, null.