public class CTemplateParser extends ProceduralTemplateParser
_includeFiles
_codeGenerator, _component, _parseTreeCodeGenerator
Constructor and Description |
---|
CTemplateParser()
Construct the CTemplateParser associated
with the given component and the given adapter.
|
Modifier and Type | Method and Description |
---|---|
protected CCodeGenerator |
_getCodeGenerator()
Get the code generator associated with this adapter class.
|
protected java.lang.String |
_replaceMacro(java.lang.String macro,
java.lang.String parameter)
Return the replacement string of the given macro.
|
java.lang.String |
generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source,
ProgramCodeGeneratorAdapter.Channel sink,
int offset,
java.lang.String alternativeSourceRef)
Generate the type conversion statement for the particular offset of
the two given channels.
|
java.lang.String |
getFunctionInvocation(java.lang.String functionString,
boolean isStatic)
Return the translated token instance function invocation string.
|
ParseTreeCodeGenerator |
getParseTreeCodeGenerator()
Return a new parse tree code generator to use with expressions.
|
generateFireCode, getHeaderFiles, init
_findClosedParen, addFunctionUsed, addNewTypesUsed, escapeName, escapePortName, generateBlockCode, generateTypeConvertMethod, getCodeStream, getNewInvocation, getParameterValue, getPort, getSize, indexOf, parseList, processCode, setCodeGenerator, unescapeName, unescapePortName
public CTemplateParser()
public java.lang.String generateTypeConvertStatement(ProgramCodeGeneratorAdapter.Channel source, ProgramCodeGeneratorAdapter.Channel sink, int offset, java.lang.String alternativeSourceRef) throws IllegalActionException
generateTypeConvertStatement
in class TemplateParser
source
- The given source channel.sink
- The given sink channel.offset
- The given offset.alternativeSourceRef
- The alternative source reference for
the port. If alternativeSourceRef is null, then the adapter for the port
of the source channel is used.zIllegalActionException
- If there is a problem getting the
adapters for the ports or if the conversion cannot be handled.public java.lang.String getFunctionInvocation(java.lang.String functionString, boolean isStatic) throws IllegalActionException
getFunctionInvocation
in class TemplateParser
functionString
- The string within the $tokenFunc() macro.isStatic
- True if the method is static.IllegalActionException
- The given function string is
not well-formed.public ParseTreeCodeGenerator getParseTreeCodeGenerator()
getParseTreeCodeGenerator
in class ProceduralTemplateParser
protected CCodeGenerator _getCodeGenerator()
_getCodeGenerator
in class TemplateParser
TemplateParser.setCodeGenerator(ProgramCodeGenerator)
protected java.lang.String _replaceMacro(java.lang.String macro, java.lang.String parameter) throws IllegalActionException
_replaceMacro
in class TemplateParser
macro
- The given macro.parameter
- The given parameter to the macro.IllegalActionException
- Thrown if the given macro or
parameter is not valid.