Top Description Fields Constructors Methods
org.stringtemplate.v4.compiler

public Class CompilationState

extends Object
Class Inheritance
Imports
org.antlr.runtime.*, org.antlr.runtime.tree.CommonTree, org.stringtemplate.v4.Interpreter, org.stringtemplate.v4.misc.*

Temporary data used during construction and functions that fill it / use it. Result is impl CompiledST object.

Field Summary

Modifier and TypeField and Description
pack-priv ErrorManager
pack-priv CompiledST
impl

The compiled code implementation to fill in.

pack-priv int
ip

Track instruction location within impl.

pack-priv StringTable
stringtable

Track unique strings; copy into CompiledST#strings after compilation.

pack-priv TokenStream

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
public void
emit(short opcode)

public void
emit(CommonTree opAST, short opcode)

public void
emit1(CommonTree opAST, short opcode, int arg)

public void
emit1(CommonTree opAST, short opcode, String s)

public void
emit2(CommonTree opAST, short opcode, int arg, int arg2)

public void
emit2(CommonTree opAST, short opcode, String s, int arg2)

protected void
public void
func(Token templateToken, CommonTree id)

public void
public void
insert(int addr, short opcode, String s)

public void
refAttr(Token templateToken, CommonTree id)

public void
public void
write(int addr, short value)

public static void
writeShort(byte[] memory, int index, short value)

Write value at index into a byte array highest to lowest byte, left to right.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

errMgrback to summary
pack-priv ErrorManager errMgr
implback to summary
pack-priv CompiledST impl

The compiled code implementation to fill in.

ipback to summary
pack-priv int ip

Track instruction location within impl.instrs array; this is next address to write to. Byte-addressable memory.

stringtableback to summary
pack-priv StringTable stringtable

Track unique strings; copy into CompiledST#strings after compilation.

tokensback to summary
pack-priv TokenStream tokens

Constructor Detail

CompilationStateback to summary
public CompilationState(ErrorManager errMgr, String name, TokenStream tokens)

Method Detail

defineStringback to summary
public int defineString(String s)
emitback to summary
public void emit(short opcode)
emitback to summary
public void emit(CommonTree opAST, short opcode)
emit1back to summary
public void emit1(CommonTree opAST, short opcode, int arg)
emit1back to summary
public void emit1(CommonTree opAST, short opcode, String s)
emit2back to summary
public void emit2(CommonTree opAST, short opcode, int arg, int arg2)
emit2back to summary
public void emit2(CommonTree opAST, short opcode, String s, int arg2)
ensureCapacityback to summary
protected void ensureCapacity(int n)
funcback to summary
public void func(Token templateToken, CommonTree id)
indentback to summary
public void indent(CommonTree indent)
insertback to summary
public void insert(int addr, short opcode, String s)
refAttrback to summary
public void refAttr(Token templateToken, CommonTree id)
setOptionback to summary
public void setOption(CommonTree id)
writeback to summary
public void write(int addr, short value)
writeShortback to summary
public static void writeShort(byte[] memory, int index, short value)

Write value at index into a byte array highest to lowest byte, left to right.