Table of Contents

Class StringLiteralFactory

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

Factory for parsing string literal tokens with support for different quote characters.

public class StringLiteralFactory : IExpressionFactory<StringLiteral>
Inheritance
StringLiteralFactory
Implements
Inherited Members
Extension Methods

Constructors

StringLiteralFactory(char)

Initializes a new instance of the StringLiteralFactory class.

public StringLiteralFactory(char boundary)

Parameters

boundary char

The quote character used to delimit string literals.

Fields

DoubleQuote

Singleton factory instance for double-quoted string literals.

public static readonly StringLiteralFactory DoubleQuote

Field Value

StringLiteralFactory

SingleQuote

Singleton factory instance for single-quoted string literals.

public static readonly StringLiteralFactory SingleQuote

Field Value

StringLiteralFactory

Methods

Parse(string, int, out int)

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

public StringLiteral? 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

StringLiteral

The parsed token if successful; otherwise, null.