Class PostfixExpression<T>
- Namespace
- RandomizerCore.StringParsing
- Assembly
- RandomizerCore.dll
A postfix expression (postfix operator applied to a nested expression)
public abstract record PostfixExpression<T> : IExpression<T>, IEquatable<PostfixExpression<T>>
Type Parameters
T
- Inheritance
-
PostfixExpression<T>
- Implements
-
IExpression<T>
- Derived
- Inherited Members
Constructors
PostfixExpression(IExpression<T>, OperatorToken)
A postfix expression (postfix operator applied to a nested expression)
protected PostfixExpression(IExpression<T> Operand, OperatorToken Operator)
Parameters
Operand
IExpression<T>The operand expression
Operator
OperatorTokenThe operator token
Properties
EndChar
public int EndChar { get; }
Property Value
Operand
The operand expression
public IExpression<T> Operand { get; init; }
Property Value
- IExpression<T>
Operator
The operator token
public OperatorToken Operator { 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 abstract 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 abstract 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.