Class GroupingExpression<T>
- Namespace
- RandomizerCore.StringParsing
- Assembly
- RandomizerCore.dll
A parenthesized nested expression.
public record GroupingExpression<T> : IExpression<T>, IEquatable<GroupingExpression<T>>
Type Parameters
T
- Inheritance
-
GroupingExpression<T>
- Implements
-
IExpression<T>
- Inherited Members
Constructors
GroupingExpression(StructuralToken, IExpression<T>, StructuralToken)
A parenthesized nested expression.
public GroupingExpression(StructuralToken OpenParenthesis, IExpression<T> Nested, StructuralToken CloseParenthesis)
Parameters
OpenParenthesis
StructuralTokenThe open parenthesis token
Nested
IExpression<T>The nested expression
CloseParenthesis
StructuralTokenThe close parenthesis token
Properties
CloseParenthesis
The close parenthesis token
public StructuralToken CloseParenthesis { get; init; }
Property Value
EndChar
public int EndChar { get; }
Property Value
Nested
The nested expression
public IExpression<T> Nested { get; init; }
Property Value
- IExpression<T>
OpenParenthesis
The open parenthesis token
public StructuralToken OpenParenthesis { get; init; }
Property Value
StartChar
public int StartChar { get; }
Property Value
Methods
Evaluate()
Speculates possible types for an expression. If the result { T.A, T.B } is returned, then the result is to be interpreted as "A or B".
public IEnumerable<T> Evaluate()
Returns
- IEnumerable<T>
Print()
Reconstructs the original string representation of the expression
public string Print()
Returns
Validate(ExpressionValidator<T>)
Validates whether the expression is structurally and semantically valid and aggregates any errors using the provided expression validator.
public bool Validate(ExpressionValidator<T> validator)
Parameters
validator
ExpressionValidator<T>The validator to use to aggregate errors.
Returns
- bool
Whether the expression is valid or not.