|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cesta.trans.AbstractTransformation org.cesta.trans.java.AbstractRewriteTransformation
public abstract class AbstractRewriteTransformation
Abstract class for Java Card rewrite transformations. So far, all Java Card transformations are similar - Java based tree rewrites with output to templates. Abstract transformation contains common methods.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
generateComments | Boolean | true | whether to generate comments in transformed file |
templatePath | String | "templates" | path to templates, multiple directories separated by ":", directories can be located anywhere on classpath |
templateGroup | String | parser class simple name, e.g. ShadowVariablesParser | name of template group, which should be used to load templates |
javaCard | Boolean | true | optimize transformation for Java Card, example usage is to handle differently runtime exceptions in templates. |
nestedRewrite | Boolean | true | allow nested rewrites (rewrite part of already rewritten code), with some transformations it can cause pretty big overhead |
Field Summary | |
---|---|
protected org.antlr.runtime.TokenRewriteStream |
tokens
|
protected org.antlr.runtime.tree.CommonTree |
tree
|
Fields inherited from class org.cesta.trans.AbstractTransformation |
---|
logger |
Constructor Summary | |
---|---|
AbstractRewriteTransformation()
|
Method Summary | |
---|---|
void |
execute()
Main entry point of the transformation |
java.util.Map<java.lang.String,java.lang.Object> |
getDefaultParams()
Returns default parameters |
protected org.antlr.runtime.tree.TreeNodeStream |
prepareTreeNodeStream(org.antlr.runtime.CharStream inputStream)
Prepares tree node stream from inputStream. |
void |
registerTemplateGroupLoader()
Registers default template group loader. |
abstract void |
transform(MappedFile filePair)
Transforms single file |
Methods inherited from class org.cesta.trans.AbstractTransformation |
---|
addMappedFile, clearParams, getMappedFiles, getParam, getParam, getParamB, getParamB, getParams, getParamS, getParamS, setMappedFiles, setParam, setParams |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.antlr.runtime.TokenRewriteStream tokens
protected org.antlr.runtime.tree.CommonTree tree
Constructor Detail |
---|
public AbstractRewriteTransformation()
Method Detail |
---|
public java.util.Map<java.lang.String,java.lang.Object> getDefaultParams()
getDefaultParams
in class AbstractTransformation
protected org.antlr.runtime.tree.TreeNodeStream prepareTreeNodeStream(org.antlr.runtime.CharStream inputStream) throws TransformationException
inputStream
- input stream
TransformationException
- in case input stream could not be read
or contains errorspublic abstract void transform(MappedFile filePair) throws TransformationException
filePair
- File pair (input/output) to transform
TransformationException
- In case transformation failedpublic void execute() throws TransformationException
execute
in interface Transformation
execute
in class AbstractTransformation
TransformationException
- In case transformation failedpublic void registerTemplateGroupLoader()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |