public class Interpreter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Interpreter.Option |
Modifier and Type | Field and Description |
---|---|
InstanceScope |
currentScope
Stack of enclosing instances (scopes).
|
boolean |
debug
Track events inside templates and in this.events
|
static int |
DEFAULT_OPERAND_STACK_SIZE |
static java.util.Set<java.lang.String> |
predefinedAnonSubtemplateAttributes |
static boolean |
trace
Dump bytecode instructions as we execute them? mainly for parrt
|
Constructor and Description |
---|
Interpreter(STGroup group,
boolean debug) |
Interpreter(STGroup group,
ErrorManager errMgr,
boolean debug) |
Interpreter(STGroup group,
java.util.Locale locale,
boolean debug) |
Interpreter(STGroup group,
java.util.Locale locale,
ErrorManager errMgr,
boolean debug) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
convertAnythingIteratableToIterator(java.lang.Object o) |
java.util.Iterator |
convertAnythingToIterator(java.lang.Object o) |
int |
exec(STWriter out,
ST self)
Execute template self and return how many characters it wrote to out
|
java.lang.Object |
first(java.lang.Object v)
Return the first attribute if multiple valued or the attribute
itself if single-valued.
|
java.lang.Object |
getAttribute(ST self,
java.lang.String name)
Find an attr via dynamic scoping up enclosing scope chain.
|
java.lang.Object |
getDictionary(STGroup g,
java.lang.String name) |
static java.util.List<ST> |
getEnclosingInstanceStack(InstanceScope scope,
boolean topdown) |
static java.lang.String |
getEnclosingInstanceStackString(InstanceScope scope)
If an instance of x is enclosed in a y which is in a z, return
a String of these instance names in order from topmost to lowest;
here that would be "[z y x]".
|
static java.util.List<EvalTemplateEvent> |
getEvalTemplateEventStack(InstanceScope scope,
boolean topdown) |
java.util.List<InterpEvent> |
getEvents() |
java.util.List<java.lang.String> |
getExecutionTrace() |
static java.util.List<InstanceScope> |
getScopeStack(InstanceScope scope,
boolean topdown) |
static int |
getShort(byte[] memory,
int index) |
java.lang.Object |
last(java.lang.Object v)
Return the last attribute if multiple valued or the attribute
itself if single-valued.
|
java.lang.Object |
length(java.lang.Object v)
Return the length of a mult-valued attribute or 1 if it is a
single attribute.
|
java.lang.Object |
rest(java.lang.Object v)
Return everything but the first attribute if multiple valued
or null if single-valued.
|
java.lang.Object |
reverse(java.lang.Object v)
Return a list with the same elements as v but in reverse order.
|
void |
setDefaultArguments(STWriter out,
ST invokedST)
Set any default argument values that were not set by the
invoking template or by setAttribute directly.
|
java.lang.Object |
strip(java.lang.Object v)
Return a new list w/o null values.
|
java.lang.Object |
trunc(java.lang.Object v)
Return all but the last element.
|
public static final int DEFAULT_OPERAND_STACK_SIZE
public static final java.util.Set<java.lang.String> predefinedAnonSubtemplateAttributes
public InstanceScope currentScope
public static boolean trace
public boolean debug
public Interpreter(STGroup group, boolean debug)
public Interpreter(STGroup group, java.util.Locale locale, boolean debug)
public Interpreter(STGroup group, ErrorManager errMgr, boolean debug)
public Interpreter(STGroup group, java.util.Locale locale, ErrorManager errMgr, boolean debug)
public int exec(STWriter out, ST self)
public java.lang.Object first(java.lang.Object v)
public java.lang.Object last(java.lang.Object v)
public java.lang.Object rest(java.lang.Object v)
public java.lang.Object trunc(java.lang.Object v)
public java.lang.Object strip(java.lang.Object v)
public java.lang.Object reverse(java.lang.Object v)
public java.lang.Object length(java.lang.Object v)
public java.lang.Object convertAnythingIteratableToIterator(java.lang.Object o)
public java.util.Iterator convertAnythingToIterator(java.lang.Object o)
public java.lang.Object getAttribute(ST self, java.lang.String name)
public java.lang.Object getDictionary(STGroup g, java.lang.String name)
public void setDefaultArguments(STWriter out, ST invokedST)
public static java.lang.String getEnclosingInstanceStackString(InstanceScope scope)
public static java.util.List<ST> getEnclosingInstanceStack(InstanceScope scope, boolean topdown)
public static java.util.List<InstanceScope> getScopeStack(InstanceScope scope, boolean topdown)
public static java.util.List<EvalTemplateEvent> getEvalTemplateEventStack(InstanceScope scope, boolean topdown)
public java.util.List<InterpEvent> getEvents()
public java.util.List<java.lang.String> getExecutionTrace()
public static int getShort(byte[] memory, int index)