public class ASEmitter extends Object implements IASEmitter, IEmitter
| Constructor and Description |
|---|
ASEmitter(FilterWriter out) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
emitAccessorKeyword(IKeywordNode node) |
void |
emitArguments(IContainerNode node) |
void |
emitAsOperator(IBinaryOperatorNode node) |
protected void |
emitAssignedValue(IExpressionNode node) |
void |
emitBinaryOperator(IBinaryOperatorNode node)
Emit an operator statement.
|
void |
emitBlockClose(IContainerNode node) |
void |
emitBlockOpen(IContainerNode node) |
void |
emitCatch(ICatchNode node)
Emit a
catch(){} statement. |
void |
emitClass(IClassNode node)
Emit a Class.
|
void |
emitContainer(IContainerNode node) |
void |
emitDeclarationName(IDefinitionNode node) |
void |
emitDoLoop(IWhileLoopNode node)
Emit a
do{}while() statement. |
void |
emitDynamicAccess(IDynamicAccessNode node) |
void |
emitE4XFilter(IMemberAccessExpressionNode node) |
void |
emitField(IVariableNode node)
Emit a full Class field member.
|
void |
emitFieldDocumentation(IVariableNode node)
Emit a documentation comment for a Class field or constant
IVariableNode. |
void |
emitForEachLoop(IForLoopNode node)
Emit a
for each statement. |
void |
emitForLoop(IForLoopNode node)
Emit a
for statement. |
void |
emitFunctionBlockHeader(IFunctionNode node)
Emit a header at the start of a function block.
|
void |
emitFunctionCall(IFunctionCallNode node)
Emit a function call like
new Foo() or foo(42). |
void |
emitFunctionObject(IFunctionObjectNode node)
Emit an anonymous
IFunctionObjectNode. |
protected void |
emitFunctionScope(IScopedNode node) |
void |
emitGetAccessor(IGetterNode node)
Emit a full Class getter member.
|
void |
emitGetAccessorDocumentation(IGetterNode node)
Emit a documentation comment for a Class method
IGetterNode. |
void |
emitIdentifier(IIdentifierNode node) |
void |
emitIf(IIfNode node)
Emit a
if(){}else if(){}else{} statement. |
void |
emitImport(IImportNode node) |
void |
emitInterface(IInterfaceNode node)
Emit an Interface.
|
void |
emitIsOperator(IBinaryOperatorNode node) |
void |
emitIterationFlow(IIterationFlowNode node) |
void |
emitKeyword(IKeywordNode node) |
void |
emitLabelStatement(LabeledStatementNode node)
Emit a
foo:{} statement. |
void |
emitLanguageIdentifier(ILanguageIdentifierNode node) |
void |
emitLiteral(ILiteralNode node) |
void |
emitLiteralContainer(ILiteralContainerNode node) |
void |
emitLocalNamedFunction(IFunctionNode node)
Emit an local named function
IFunctionNode. |
void |
emitMemberAccessExpression(IMemberAccessExpressionNode node) |
void |
emitMemberKeyword(IDefinitionNode node) |
protected void |
emitMemberName(IDefinitionNode node) |
void |
emitMetaTag(IMetaTagNode node) |
void |
emitMethod(IFunctionNode node)
Emit a full Class or Interface method member.
|
void |
emitMethodDocumentation(IFunctionNode node)
Emit a documentation comment for a Class method
IFunctionNode. |
void |
emitMethodScope(IScopedNode node) |
protected void |
emitModifiers(IDefinition definition) |
void |
emitNamespace(INamespaceNode node)
Emit a namespace member.
|
void |
emitNamespaceAccessExpression(INamespaceAccessExpressionNode node) |
protected void |
emitNamespaceIdentifier(IDefinitionNode node) |
void |
emitNumericLiteral(INumericLiteralNode node) |
void |
emitObjectLiteralValuePair(IObjectLiteralValuePairNode node) |
void |
emitPackageContents(IPackageDefinition definition) |
void |
emitPackageFooter(IPackageDefinition definition) |
void |
emitPackageHeader(IPackageDefinition definition) |
void |
emitPackageHeaderContents(IPackageDefinition definition) |
void |
emitParameter(IParameterNode node) |
void |
emitParameters(IContainerNode node) |
void |
emitReturn(IReturnNode node) |
void |
emitSetAccessor(ISetterNode node)
Emit a full Class setter member.
|
void |
emitSetAccessorDocumentation(ISetterNode node)
Emit a documentation comment for a Class accessor
IGetterNode. |
void |
emitStatement(IASNode node)
Emit a statement found within an
IBlockNode. |
void |
emitSwitch(ISwitchNode node)
Emit a
switch(){} statement. |
void |
emitTernaryOperator(ITernaryOperatorNode node) |
void |
emitThrow(IThrowNode node)
Emit a
throw statement. |
void |
emitTry(ITryNode node)
Emit a
try{} statement. |
protected void |
emitType(IExpressionNode node) |
void |
emitTypedExpression(ITypedExpressionNode node) |
void |
emitUnaryOperator(IUnaryOperatorNode node) |
void |
emitUseNamespace(IUseNamespaceNode node) |
void |
emitVarDeclaration(IVariableNode node)
Emit a variable declaration found in expression statements within scoped
blocks.
|
void |
emitVariableExpression(IVariableExpressionNode node) |
void |
emitWhileLoop(IWhileLoopNode node)
Emit a
while(){} statement. |
void |
emitWith(IWithNode node)
Emit a
with(){} statement. |
protected ITypeDefinition |
findType(Collection<IDefinition> definitions) |
protected ITypeNode |
findTypeNode(IPackageNode node) |
protected void |
flushBuilder() |
protected StringBuilder |
getBuilder() |
protected static IFunctionNode |
getConstructor(IDefinitionNode[] members) |
protected int |
getCurrentColumn() |
protected int |
getCurrentIndent() |
protected int |
getCurrentLine() |
IDocEmitter |
getDocEmitter() |
protected String |
getIndent(int numIndent) |
List<ICompilerProblem> |
getProblems() |
IBlockWalker |
getWalker() |
void |
indentPop()
Pops an indent from the emitter so after newlines are emitted, the output
is correctly formatted.
|
void |
indentPush()
Pushes an indent into the emitter so after newlines are emitted, the
output is correctly formatted.
|
protected boolean |
isBufferWrite() |
protected static boolean |
isImplicit(IContainerNode node) |
protected static boolean |
isLastStatement(IASNode node) |
String |
postProcess(String output) |
void |
setBufferWrite(boolean value) |
protected void |
setBuilder(StringBuilder sb) |
void |
setDocEmitter(IDocEmitter value) |
void |
setWalker(IBlockWalker value) |
String |
stringifyNode(IASNode node)
Takes the node argument and created a String representation if it using
the buffer temporarily.
|
protected void |
visitForBody(IContainerNode node) |
void |
write(IEmitterTokens value)
Writes a string to the writer.
|
void |
write(String value) |
protected void |
writeIndent() |
void |
writeNewline()
Writes newline character(s)
|
void |
writeNewline(IEmitterTokens value)
Writes the
value and then a newline which will automatically
have the indent applied after the \n character. |
void |
writeNewline(IEmitterTokens value,
boolean pushIndent)
Writes the
value after a push or pop of the indent. |
void |
writeNewline(String value) |
void |
writeNewline(String value,
boolean pushIndent) |
void |
writeSymbol(String value) |
void |
writeToken(IEmitterTokens value)
Writes a
ASEmitterTokens character to the buffer and appends a
space after automatically. |
void |
writeToken(String value) |
public ASEmitter(FilterWriter out)
protected boolean isBufferWrite()
public void setBufferWrite(boolean value)
protected StringBuilder getBuilder()
protected void setBuilder(StringBuilder sb)
protected void flushBuilder()
public List<ICompilerProblem> getProblems()
protected int getCurrentIndent()
protected void writeIndent()
public IBlockWalker getWalker()
getWalker in interface IASEmitterpublic void setWalker(IBlockWalker value)
setWalker in interface IASEmitterpublic IDocEmitter getDocEmitter()
getDocEmitter in interface IASEmitterpublic void setDocEmitter(IDocEmitter value)
setDocEmitter in interface IASEmitterprotected int getCurrentLine()
protected int getCurrentColumn()
public String postProcess(String output)
postProcess in interface IASEmitterpublic void write(IEmitterTokens value)
IEmitterprotected String getIndent(int numIndent)
public void indentPush()
IEmitterindentPush in interface IEmitterpublic void indentPop()
IEmitterpublic void writeNewline()
IEmitterwriteNewline in interface IEmitterpublic void writeNewline(IEmitterTokens value)
IEmittervalue and then a newline which will automatically
have the indent applied after the \n character.writeNewline in interface IEmittervalue - The String value to write before the \n is appended.public void writeNewline(String value)
writeNewline in interface IEmitterpublic void writeNewline(IEmitterTokens value, boolean pushIndent)
IEmittervalue after a push or pop of the indent.
This method effectively lets you write a value and then indent our
outdent. The method can be useful in the following where your cursor
writer is at [0], you write
writeNewline("if (foo) {", true); and the cursor after the
call will end up at [1].
[0]if (foo) {
[1]this.something;
}
writeNewline in interface IEmittervalue - The String value to write before the \n is appended.pushIndent - Whether to push indent true or pop indent
false.public void writeNewline(String value, boolean pushIndent)
writeNewline in interface IEmitterpublic void writeSymbol(String value)
public void writeToken(IEmitterTokens value)
IEmitterASEmitterTokens character to the buffer and appends a
space after automatically.writeToken in interface IEmittervalue - The ASEmitterTokens value.public void writeToken(String value)
writeToken in interface IEmitterpublic void emitImport(IImportNode node)
emitImport in interface IASEmitterpublic void emitPackageHeader(IPackageDefinition definition)
emitPackageHeader in interface IASEmitterpublic void emitPackageHeaderContents(IPackageDefinition definition)
emitPackageHeaderContents in interface IASEmitterpublic void emitPackageContents(IPackageDefinition definition)
emitPackageContents in interface IASEmitterpublic void emitPackageFooter(IPackageDefinition definition)
emitPackageFooter in interface IASEmitterpublic void emitClass(IClassNode node)
IASEmitteremitClass in interface IASEmitternode - The IClassNode class.public void emitInterface(IInterfaceNode node)
IASEmitteremitInterface in interface IASEmitternode - The IInterfaceNode class.public void emitVarDeclaration(IVariableNode node)
IASEmitteremitVarDeclaration in interface IASEmitternode - The IVariableNode or chain of variable nodes.public void emitFieldDocumentation(IVariableNode node)
IASEmitterIVariableNode.emitFieldDocumentation in interface IASEmitternode - The IVariableNode class field member.public void emitField(IVariableNode node)
IASEmitteremitField in interface IASEmitternode - The IVariableNode class field member.public void emitMethodDocumentation(IFunctionNode node)
IASEmitterIFunctionNode.emitMethodDocumentation in interface IASEmitternode - The IFunctionNode class method member.public void emitMethod(IFunctionNode node)
IASEmitteremitMethod in interface IASEmitternode - The IFunctionNode class method member.public void emitGetAccessorDocumentation(IGetterNode node)
IASEmitterIGetterNode.emitGetAccessorDocumentation in interface IASEmitternode - The IGetterNode class accessor member.public void emitGetAccessor(IGetterNode node)
IASEmitteremitGetAccessor in interface IASEmitternode - The IVariableNode class getter member.public void emitSetAccessorDocumentation(ISetterNode node)
IASEmitterIGetterNode.emitSetAccessorDocumentation in interface IASEmitternode - The ISetterNode class accessor member.public void emitSetAccessor(ISetterNode node)
IASEmitteremitSetAccessor in interface IASEmitternode - The ISetterNode class setter member.public void emitLocalNamedFunction(IFunctionNode node)
IASEmitterIFunctionNode.emitLocalNamedFunction in interface IASEmitternode - The local named function IFunctionNode.public void emitFunctionObject(IFunctionObjectNode node)
IASEmitterIFunctionObjectNode.emitFunctionObject in interface IASEmitternode - The anonymous IFunctionObjectNode.public void emitNamespace(INamespaceNode node)
IASEmitteremitNamespace in interface IASEmitternode - The INamespaceNode class member.protected void emitNamespaceIdentifier(IDefinitionNode node)
protected void emitModifiers(IDefinition definition)
public void emitMemberKeyword(IDefinitionNode node)
protected void emitMemberName(IDefinitionNode node)
public void emitDeclarationName(IDefinitionNode node)
public void emitParameters(IContainerNode node)
public void emitParameter(IParameterNode node)
emitParameter in interface IASEmitterprotected void emitType(IExpressionNode node)
protected void emitAssignedValue(IExpressionNode node)
public void emitFunctionBlockHeader(IFunctionNode node)
IASEmitteremitFunctionBlockHeader in interface IASEmitternode - The IFunctionNode node.public void emitMethodScope(IScopedNode node)
protected void emitAccessorKeyword(IKeywordNode node)
protected void emitFunctionScope(IScopedNode node)
public void emitStatement(IASNode node)
IASEmitterIBlockNode.emitStatement in interface IASEmitternode - The IASNode statement.public void emitIf(IIfNode node)
IASEmitterif(){}else if(){}else{} statement.emitIf in interface IASEmitternode - The IIfNode node.public void emitForEachLoop(IForLoopNode node)
IASEmitterfor each statement.emitForEachLoop in interface IASEmitternode - The IForLoopNode node.public void emitForLoop(IForLoopNode node)
IASEmitterfor statement.emitForLoop in interface IASEmitternode - The IForLoopNode node.public void emitSwitch(ISwitchNode node)
IASEmitterswitch(){} statement.emitSwitch in interface IASEmitternode - The ISwitchNode node.public void emitWhileLoop(IWhileLoopNode node)
IASEmitterwhile(){} statement.emitWhileLoop in interface IASEmitternode - The IWhileLoopNode node.public void emitDoLoop(IWhileLoopNode node)
IASEmitterdo{}while() statement.emitDoLoop in interface IASEmitternode - The IWhileLoopNode node.public void emitWith(IWithNode node)
IASEmitterwith(){} statement.emitWith in interface IASEmitternode - The IWithNode node.public void emitThrow(IThrowNode node)
IASEmitterthrow statement.emitThrow in interface IASEmitternode - The IThrowNode node.public void emitTry(ITryNode node)
IASEmittertry{} statement.emitTry in interface IASEmitternode - The ITryNode node.public void emitCatch(ICatchNode node)
IASEmittercatch(){} statement.emitCatch in interface IASEmitternode - The ICatchNode node.public void emitReturn(IReturnNode node)
emitReturn in interface IASEmitterpublic void emitFunctionCall(IFunctionCallNode node)
IASEmitternew Foo() or foo(42).emitFunctionCall in interface IASEmitternode - The IFunctionCallNode node.public void emitArguments(IContainerNode node)
emitArguments in interface IASEmitterpublic void emitAsOperator(IBinaryOperatorNode node)
emitAsOperator in interface IASEmitterpublic void emitIsOperator(IBinaryOperatorNode node)
emitIsOperator in interface IASEmitterpublic void emitBinaryOperator(IBinaryOperatorNode node)
IASEmitteremitBinaryOperator in interface IASEmitternode - The IBinaryOperatorNode or chain of variable nodes.protected ITypeNode findTypeNode(IPackageNode node)
protected ITypeDefinition findType(Collection<IDefinition> definitions)
protected static IFunctionNode getConstructor(IDefinitionNode[] members)
protected static boolean isLastStatement(IASNode node)
protected static final boolean isImplicit(IContainerNode node)
protected void visitForBody(IContainerNode node)
public void emitLiteral(ILiteralNode node)
emitLiteral in interface IASEmitterpublic void emitLiteralContainer(ILiteralContainerNode node)
emitLiteralContainer in interface IASEmitterpublic void emitIdentifier(IIdentifierNode node)
emitIdentifier in interface IASEmitterpublic void emitNumericLiteral(INumericLiteralNode node)
emitNumericLiteral in interface IASEmitterpublic void emitKeyword(IKeywordNode node)
emitKeyword in interface IASEmitterpublic void emitIterationFlow(IIterationFlowNode node)
emitIterationFlow in interface IASEmitterpublic void emitMemberAccessExpression(IMemberAccessExpressionNode node)
emitMemberAccessExpression in interface IASEmitterpublic void emitDynamicAccess(IDynamicAccessNode node)
emitDynamicAccess in interface IASEmitterpublic void emitTypedExpression(ITypedExpressionNode node)
emitTypedExpression in interface IASEmitterpublic void emitVariableExpression(IVariableExpressionNode node)
emitVariableExpression in interface IASEmitterpublic void emitTernaryOperator(ITernaryOperatorNode node)
emitTernaryOperator in interface IASEmitterpublic void emitObjectLiteralValuePair(IObjectLiteralValuePairNode node)
emitObjectLiteralValuePair in interface IASEmitterpublic void emitLabelStatement(LabeledStatementNode node)
IASEmitterfoo:{} statement.emitLabelStatement in interface IASEmitternode - The LabeledStatementNode node.public void emitNamespaceAccessExpression(INamespaceAccessExpressionNode node)
emitNamespaceAccessExpression in interface IASEmitterpublic void emitUnaryOperator(IUnaryOperatorNode node)
emitUnaryOperator in interface IASEmitterpublic void emitLanguageIdentifier(ILanguageIdentifierNode node)
emitLanguageIdentifier in interface IASEmitterpublic void emitMetaTag(IMetaTagNode node)
emitMetaTag in interface IASEmitterpublic void emitContainer(IContainerNode node)
emitContainer in interface IASEmitterpublic void emitE4XFilter(IMemberAccessExpressionNode node)
emitE4XFilter in interface IASEmitterpublic void emitUseNamespace(IUseNamespaceNode node)
emitUseNamespace in interface IASEmitterpublic void emitBlockOpen(IContainerNode node)
emitBlockOpen in interface IASEmitterpublic void emitBlockClose(IContainerNode node)
emitBlockClose in interface IASEmitterpublic String stringifyNode(IASNode node)
IEmitterNote; This method is still beta, it need more logic if an emitter is actually using the buffer!
stringifyNode in interface IEmitternode - The node walk and create a String for.Copyright © 2016 The Apache Software Foundation. All rights reserved.