Class CompiledST

  • All Implemented Interfaces:
    Cloneable

    public class CompiledST
    extends Object
    implements Cloneable
    The result of compiling an ST. Contains all the bytecode instructions, string table, bytecode address to source code map, and other bookkeeping info. It's the implementation of an ST you might say. All instances of the same template share a single implementation (ST.impl field).
    • Field Detail

      • prefix

        public String 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 to STGroup.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

        public String 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 templateDefStartToken
        The token that begins template definition; could be <@r> of region.
      • tokens

        public org.antlr.runtime.TokenStream tokens
        Overall token stream for template (debug only).
      • ast

        public org.antlr.runtime.tree.CommonTree ast
        How do we interpret syntax of template? (debug only)
      • hasFormalArgs

        public boolean hasFormalArgs
      • numberOfArgsWithDefaultValues

        public int numberOfArgsWithDefaultValues
      • implicitlyDefinedTemplates

        public List<CompiledST> implicitlyDefinedTemplates
        A list of all regions and subtemplates.
      • nativeGroup

        public STGroup nativeGroup
        The group that physically defines this ST definition. We use it to initiate interpretation via ST.toString(). From there, it becomes field Interpreter.group and is fixed until rendering completes.
      • isRegion

        public boolean isRegion
        Does this template come from a <@region>...<@end> embedded in another template?
      • regionDefType

        public ST.RegionType 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

        public String[] strings
      • instrs

        public byte[] instrs
      • codeSize

        public int codeSize
      • sourceMap

        public Interval[] sourceMap
    • Constructor Detail

      • CompiledST

        public CompiledST()