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.CommonTreeHow do we interpret syntax of template? (debug only)intbooleanA list of all regions and subtemplates.byte[]booleanbooleanDoes this template come from a<@region>...<@end>embedded in another template?The group that physically defines thisSTdefinition.intEvery 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.TokenThe token that begins template definition; could be<@r>of region.org.antlr.runtime.TokenStreamOverall token stream for template (debug only). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidUsed byST.add(java.lang.String, java.lang.Object)to add args one by one without turning on full formal args definition signal.voidclone()Cloning theCompiledSTfor anSTinstance allowsST.add(java.lang.String, java.lang.Object)to be called safely during interpretation for templates that do not contain formal arguments.voidvoiddefineFormalArgs(List<FormalArgument> args) voiddisasm()voiddump()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 thisSTdefinition. We use it to initiate interpretation viaST.toString(). From there, it becomes fieldInterpreter.groupand 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
isRegionwe 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 theCompiledSTfor anSTinstance allowsST.add(java.lang.String, java.lang.Object)to be called safely during interpretation for templates that do not contain formal arguments.- Overrides:
clonein classObject- Returns:
- A copy of the current
CompiledSTinstance. The copy is a shallow copy, with the exception of theformalArgumentsfield 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
-