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
boundarycharThe quote character used to delimit string literals.
Fields
DoubleQuote
Singleton factory instance for double-quoted string literals.
public static readonly StringLiteralFactory DoubleQuote
Field Value
SingleQuote
Singleton factory instance for single-quoted string literals.
public static readonly StringLiteralFactory SingleQuote
Field Value
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
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
- StringLiteral
The parsed token if successful; otherwise, null.