Table of Contents

Class StringLiteral

Namespace
Albatross.Expression.Nodes
Assembly
Albatross.Expression.dll

Represents a string literal enclosed by quotes with support for escape sequences.

public class StringLiteral : ValueToken, IStringLiteral, IValueToken, IExpression, IToken
Inheritance
StringLiteral
Implements
Inherited Members
Extension Methods

Constructors

StringLiteral(char, string)

Initializes a new instance of the StringLiteral class.

public StringLiteral(char boundary, string value)

Parameters

boundary char

The boundary character used to delimit the string.

value string

The raw string value including boundary characters.

Fields

EscapeChar

The character used to escape special characters within the string literal.

public const char EscapeChar = '\\'

Field Value

char

Properties

Boundary

The boundary character (quote type) that delimits this string literal.

public char Boundary { get; }

Property Value

char

Methods

Eval(Func<string, object>)

Evaluates the expression synchronously using the provided context function.

public object Eval(Func<string, object> context)

Parameters

context Func<string, object>

A function that resolves variable names to their values.

Returns

object

The result of evaluating the expression.

EvalAsync(Func<string, Task<object>>)

Evaluates the expression asynchronously using the provided context function.

public Task<object> EvalAsync(Func<string, Task<object>> context)

Parameters

context Func<string, Task<object>>

A function that asynchronously resolves variable names to their values.

Returns

Task<object>

A task containing the result of evaluating the expression.