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 Evaluator instance with the provided Environment context and Buffer. The Buffer is used to accumulate the output of the template evaluation.

Properties

buffer Buffer
getter/setter pair
context Environment
final
hashCode int
The hash code for this object.
no setterinherited
nodeMap Map<String, ASTNode>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createInnerEvaluator() Evaluator
Creates a new Evaluator instance with a cloned Environment context and the same Buffer. This allows creating a nested Evaluator instance with its own context, while sharing the same output buffer.
evaluate(ASTNode node) → dynamic
Evaluates the provided AST node by calling its accept method with this Evaluator instance.
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