Package org.stringtemplate.v4.compiler
Class CompiledST
java.lang.Object
org.stringtemplate.v4.compiler.CompiledST
- All Implemented Interfaces:
Cloneable
-
Field Summary
FieldsModifier and TypeFieldDescriptionorg.antlr.runtime.tree.CommonTree
How do we interpret syntax of template? (debug only)int
boolean
A list of all regions and subtemplates.byte[]
boolean
boolean
Does this template come from a<@region>...<@end>
embedded in another template?The group that physically defines thisST
definition.int
Every template knows where it is relative to the group that loaded it.If someone refs<@r()>
in template t, an implicitInterval[]
String[]
The original, immutable pattern (not really used again after initial "compilation").org.antlr.runtime.Token
The token that begins template definition; could be<@r>
of region.org.antlr.runtime.TokenStream
Overall token stream for template (debug only). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Used byST.add(java.lang.String, java.lang.Object)
to add args one by one without turning on full formal args definition signal.void
clone()
Cloning theCompiledST
for anST
instance allowsST.add(java.lang.String, java.lang.Object)
to be called safely during interpretation for templates that do not contain formal arguments.void
void
defineFormalArgs
(List<FormalArgument> args) void
disasm()
void
dump()
instrs()
-
Field Details
-
name
-
prefix
Every template knows where it is relative to the group that loaded it. The prefix is the relative path from the root."/prefix/name"
is the fully qualified name of this template. All calls toSTGroup.getInstanceOf(java.lang.String)
calls must use fully qualified names. A"/"
is added to the front if you don't specify one. Template references within template code, however, uses relative names, unless of course the name starts with"/"
.This has nothing to do with the outer filesystem path to the group dir or group file.
We set this as we load/compile the template.
Always ends with
"/"
. -
template
The original, immutable pattern (not really used again after initial "compilation"). Useful for debugging. Even for subtemplates, this is entire overall template. -
templateDefStartToken
public org.antlr.runtime.Token templateDefStartTokenThe token that begins template definition; could be<@r>
of region. -
tokens
public org.antlr.runtime.TokenStream tokensOverall token stream for template (debug only). -
ast
public org.antlr.runtime.tree.CommonTree astHow do we interpret syntax of template? (debug only) -
formalArguments
-
hasFormalArgs
public boolean hasFormalArgs -
numberOfArgsWithDefaultValues
public int numberOfArgsWithDefaultValues -
implicitlyDefinedTemplates
A list of all regions and subtemplates. -
nativeGroup
The group that physically defines thisST
definition. We use it to initiate interpretation viaST.toString()
. From there, it becomes fieldInterpreter.group
and is fixed until rendering completes. -
isRegion
public boolean isRegionDoes this template come from a<@region>...<@end>
embedded in another template? -
regionDefType
If someone refs<@r()>
in template t, an implicit@t.r() ::= ""
is defined, but you can overwrite this def by defining your own. We need to prevent more than one manual def though. Between this var and
isRegion
we can determine these cases. -
isAnonSubtemplate
public boolean isAnonSubtemplate -
strings
-
instrs
public byte[] instrs -
codeSize
public int codeSize -
sourceMap
-
-
Constructor Details
-
CompiledST
public CompiledST()
-
-
Method Details
-
clone
Cloning theCompiledST
for anST
instance allowsST.add(java.lang.String, java.lang.Object)
to be called safely during interpretation for templates that do not contain formal arguments.- Overrides:
clone
in classObject
- Returns:
- A copy of the current
CompiledST
instance. The copy is a shallow copy, with the exception of theformalArguments
field which is also cloned. - Throws:
CloneNotSupportedException
- If the current instance cannot be cloned.
-
addImplicitlyDefinedTemplate
-
defineArgDefaultValueTemplates
-
defineFormalArgs
-
addArg
Used byST.add(java.lang.String, java.lang.Object)
to add args one by one without turning on full formal args definition signal. -
defineImplicitlyDefinedTemplates
-
getTemplateSource
-
getTemplateRange
-
instrs
-
dump
public void dump() -
disasm
-