Evaluator class
The Evaluator class is responsible for evaluating Liquid templates.
It provides methods to resolve and parse templates, as well as evaluate
individual AST nodes and a list of nodes.
The Evaluator class takes an Environment context and an optional Buffer
instance, which are used during the evaluation process.
Constructors
- Evaluator(Environment context)
- Evaluator.withBuffer(Environment context, Buffer buffer)
-
Creates a new
Evaluatorinstance with the providedEnvironmentcontext andBuffer. TheBufferis used to accumulate the output of the template evaluation.
Properties
Methods
-
createInnerEvaluator(
) → Evaluator -
Creates a new
Evaluatorinstance with a clonedEnvironmentcontext and the sameBuffer. This allows creating a nestedEvaluatorinstance with its own context, while sharing the same output buffer. -
evaluate(
ASTNode node) → dynamic -
Evaluates the provided AST node by calling its
acceptmethod with thisEvaluatorinstance. -
evaluateNodes(
List< ASTNode> nodes) → dynamic - Evaluates a list of AST nodes and writes the results to the buffer.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolveAndParseTemplate(
String templateName) → List< ASTNode> - Resolves and parses the Liquid template with the given name.
-
toString(
) → String -
A string representation of this object.
inherited
-
visitArrayAccess(
ArrayAccess arrayAccess) → dynamic -
visitAssignment(
Assignment node) → dynamic -
visitBinaryOperation(
BinaryOperation node) → dynamic -
visitDocument(
Document node) → dynamic -
visitFilter(
Filter node) → dynamic -
visitFilterExpression(
FilteredExpression node) → dynamic -
visitGroupedExpression(
GroupedExpression node) → dynamic -
visitIdentifier(
Identifier node) → dynamic -
visitLiteral(
Literal node) → dynamic - Evaluates a literal AST node by returning its value.
-
visitMemberAccess(
MemberAccess node) → dynamic -
visitNamedArgument(
NamedArgument node) → dynamic -
visitTag(
Tag node) → dynamic -
visitTextNode(
TextNode node) → dynamic -
visitUnaryOperation(
UnaryOperation node) → dynamic -
visitVariable(
Variable node) → dynamic
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited