Class Macro
- java.lang.Object
-
- com.google.auto.value.processor.escapevelocity.Macro
-
class Macro extends java.lang.Object
A macro definition. Macros appear in templates using the syntax#macro (m $x $y) ... #end
and each one produces an instance of this class. Evaluating a macro involves setting the parameters (here {$x $y)} and evaluating the macro body. Macro arguments are call-by-name, which means that we need to set each parameter variable to the node in the parse tree that corresponds to it, and arrange for that node to be evaluated when the variable is actually referenced.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
Macro.MacroEvaluationContext
The context for evaluation within macros.
-
Field Summary
Fields Modifier and Type Field Description private Node
body
private int
definitionLineNumber
private java.lang.String
name
private com.google.common.collect.ImmutableList<java.lang.String>
parameterNames
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.Object
evaluate(EvaluationContext context, java.util.List<Node> thunks)
(package private) java.lang.String
name()
(package private) int
parameterCount()
-
-
-
Field Detail
-
definitionLineNumber
private final int definitionLineNumber
-
name
private final java.lang.String name
-
parameterNames
private final com.google.common.collect.ImmutableList<java.lang.String> parameterNames
-
body
private final Node body
-
-
Constructor Detail
-
Macro
Macro(int definitionLineNumber, java.lang.String name, java.util.List<java.lang.String> parameterNames, Node body)
-
-
Method Detail
-
name
java.lang.String name()
-
parameterCount
int parameterCount()
-
evaluate
java.lang.Object evaluate(EvaluationContext context, java.util.List<Node> thunks)
-
-