public class CParseTreeCodeGenerator extends AbstractParseTreeVisitor
ASTPtRootNode| Red (cxh) |
| Red (neuendor) |
| Modifier and Type | Field and Description |
|---|---|
protected int |
_nodeNumber
The node number, used to create unique node names.
|
protected java.util.HashMap |
_nodeToLocalName
A map from node to local node name.
|
| Constructor and Description |
|---|
CParseTreeCodeGenerator() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_assert(boolean flag,
ASTPtRootNode node,
java.lang.String message)
Assert that the given boolean value, which describes the given
parse tree node is true.
|
protected void |
_generateAllChildren(ASTPtRootNode node)
Loop through all of the children of this node,
visiting each one of them, which will cause their token
value to be determined.
|
protected void |
_generateChild(ASTPtRootNode node,
int i)
Visit the child with the given index of the given node.
|
protected java.lang.String |
_getLocalNameForName(java.lang.String name)
Get the local name for this this name.
|
protected boolean |
_isValidName(java.lang.String name)
Return true if the name is a valid name.
|
void |
generateCode(ASTPtRootNode node)
Generate code for a node.
|
void |
visitArrayConstructNode(ASTPtArrayConstructNode node) |
void |
visitBitwiseNode(ASTPtBitwiseNode node) |
void |
visitFunctionalIfNode(ASTPtFunctionalIfNode node) |
void |
visitFunctionApplicationNode(ASTPtFunctionApplicationNode node) |
void |
visitFunctionDefinitionNode(ASTPtFunctionDefinitionNode node) |
void |
visitLeafNode(ASTPtLeafNode node) |
void |
visitLogicalNode(ASTPtLogicalNode node) |
void |
visitMatrixConstructNode(ASTPtMatrixConstructNode node) |
void |
visitMethodCallNode(ASTPtMethodCallNode node) |
void |
visitPowerNode(ASTPtPowerNode node) |
void |
visitProductNode(ASTPtProductNode node) |
void |
visitRecordConstructNode(ASTPtRecordConstructNode node) |
void |
visitRelationalNode(ASTPtRelationalNode node) |
void |
visitShiftNode(ASTPtShiftNode node) |
void |
visitSumNode(ASTPtSumNode node) |
void |
visitUnaryNode(ASTPtUnaryNode node) |
_unsupportedVisitException, _visitAllChildren, _visitChild, visitAssignmentNode, visitUnionConstructNodeprotected java.util.HashMap _nodeToLocalName
protected int _nodeNumber
public void generateCode(ASTPtRootNode node) throws IllegalActionException
node - The node for which code is generated.IllegalActionException - If type inference fails.public void visitArrayConstructNode(ASTPtArrayConstructNode node) throws IllegalActionException
visitArrayConstructNode in interface ParseTreeVisitorvisitArrayConstructNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitBitwiseNode(ASTPtBitwiseNode node) throws IllegalActionException
visitBitwiseNode in interface ParseTreeVisitorvisitBitwiseNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitFunctionApplicationNode(ASTPtFunctionApplicationNode node) throws IllegalActionException
visitFunctionApplicationNode in interface ParseTreeVisitorvisitFunctionApplicationNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitFunctionalIfNode(ASTPtFunctionalIfNode node) throws IllegalActionException
visitFunctionalIfNode in interface ParseTreeVisitorvisitFunctionalIfNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitFunctionDefinitionNode(ASTPtFunctionDefinitionNode node) throws IllegalActionException
visitFunctionDefinitionNode in interface ParseTreeVisitorvisitFunctionDefinitionNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException
visitLeafNode in interface ParseTreeVisitorvisitLeafNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitLogicalNode(ASTPtLogicalNode node) throws IllegalActionException
visitLogicalNode in interface ParseTreeVisitorvisitLogicalNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitMatrixConstructNode(ASTPtMatrixConstructNode node) throws IllegalActionException
visitMatrixConstructNode in interface ParseTreeVisitorvisitMatrixConstructNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitMethodCallNode(ASTPtMethodCallNode node) throws IllegalActionException
visitMethodCallNode in interface ParseTreeVisitorvisitMethodCallNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitPowerNode(ASTPtPowerNode node) throws IllegalActionException
visitPowerNode in interface ParseTreeVisitorvisitPowerNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitProductNode(ASTPtProductNode node) throws IllegalActionException
visitProductNode in interface ParseTreeVisitorvisitProductNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitRecordConstructNode(ASTPtRecordConstructNode node) throws IllegalActionException
visitRecordConstructNode in interface ParseTreeVisitorvisitRecordConstructNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitRelationalNode(ASTPtRelationalNode node) throws IllegalActionException
visitRelationalNode in interface ParseTreeVisitorvisitRelationalNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitShiftNode(ASTPtShiftNode node) throws IllegalActionException
visitShiftNode in interface ParseTreeVisitorvisitShiftNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitSumNode(ASTPtSumNode node) throws IllegalActionException
visitSumNode in interface ParseTreeVisitorvisitSumNode in class AbstractParseTreeVisitorIllegalActionExceptionpublic void visitUnaryNode(ASTPtUnaryNode node) throws IllegalActionException
visitUnaryNode in interface ParseTreeVisitorvisitUnaryNode in class AbstractParseTreeVisitorIllegalActionExceptionprotected void _assert(boolean flag,
ASTPtRootNode node,
java.lang.String message)
flag - The value to be checked. If false, then an
InternalErrorException is thrown.node - The node.message - The error message to be included in the exception
if the flag parameter is false.protected void _generateAllChildren(ASTPtRootNode node) throws IllegalActionException
node - The node.IllegalActionExceptionprotected void _generateChild(ASTPtRootNode node, int i) throws IllegalActionException
node - The node.i - The index of the child to be visited.IllegalActionException - If thrown while visiting a child
node.protected java.lang.String _getLocalNameForName(java.lang.String name)
throws IllegalActionException
name - The name to be looked up.IllegalActionException - Always thrown in this base class.protected boolean _isValidName(java.lang.String name)
throws IllegalActionException
name - The name to be looked up.IllegalActionException - Not thrown in this base class.