public abstract class LanguageWriter extends PrettyWriter implements CodeConstants
LanguageWriter
extends the pretty
writer class with additional features for backend code generation.
The language writer manages block comments and file headers.
Language-specific writers manage formatting for a particular
language.Modifier and Type | Field and Description |
---|---|
protected Context |
d_context |
C_AUTO_GEN_SPLICER, C_AUTO_GEN_WARNING, C_BACKSLASH, C_BEGIN_UNREFERENCED_METHODS, C_COMMENT_CLOSE, C_COMMENT_DOC_OPEN, C_COMMENT_F77, C_COMMENT_F90, C_COMMENT_HASH, C_COMMENT_OPEN, C_COMMENT_SLASH, C_COMMENT_SUBSEQUENT, C_DEFINE, C_DESC_CJNI_PREFIX, C_DESC_HEADER_PREFIX, C_DESC_IMPL_PREFIX, C_DESC_IOR_PREFIX, C_DESC_SJNI_PREFIX, C_DESC_SKEL_PREFIX, C_DESC_STUB_PREFIX, C_END_UNREFERENCED_METHODS, C_F77_IMPL_EXTENSION, C_F77_IMPL_METHOD_SUFFIX, C_F77_METHOD_SUFFIX, C_F77_VERSION, C_F7731_IMPL_EXTENSION, C_F90_ALT_SUFFIX, C_F90_IMPL_EXTENSION, C_F90_IMPL_METHOD_SUFFIX, C_F90_METHOD_SUFFIX, C_F90_VERSION, C_FORTRAN_DESC_STUB_PREFIX, C_FORTRAN_IMPL_MODULE_PREFIX, C_FORTRAN_MODULE_PREFIX, C_FORTRAN_TYPE_MODULE_PREFIX, C_GUARD_CLOSE, C_GUARD_OPEN, C_HASH, C_IFDEFINE_CLOSE, C_IFDEFINE_CXX, C_IFDEFINE_OPEN, C_INCLUDE, C_INSERT_HERE, C_INT_BACKSLASH, C_IS_IMPL, C_IS_NOT_IMPL, C_SLASH, C_UNREFERENCED_COMMENT1, C_UNREFERENCED_COMMENT2, C_UNREFERENCED_COMMENT3, MATLAB_COMMENT_OPEN
Constructor and Description |
---|
LanguageWriter(java.io.PrintWriter writer,
Context context)
Create a
LanguageWriter instance that will send
output to the specified print writer object. |
Modifier and Type | Method and Description |
---|---|
abstract void |
beginBlockComment(boolean is_doc)
Abstract method to begin a block comment.
|
abstract void |
endBlockComment(boolean is_doc)
Abstract method to end a block comment.
|
java.lang.String |
safeCommentString(java.lang.String string)
Convert a string into a string that is safe to include inside
a comment.
|
void |
writeBanner(Symbol symbol,
java.lang.String file,
boolean is_Impl,
java.lang.String desc)
Write a file banner for automatically generated files.
|
void |
writeComment(Comment comment,
boolean is_doc)
Write a comment for a sidl Comment to the pretty writer stream.
|
void |
writeComment(Comment comment,
java.lang.String alt)
Write a comment with an alternative string.
|
void |
writeComment(Method method,
boolean is_doc)
Write a comment for a sidl method to the pretty writer stream.
|
void |
writeComment(Method method,
boolean is_doc,
boolean add_default)
Write a comment for a sidl method to the pretty writer stream.
|
void |
writeComment(java.lang.String s,
boolean is_doc)
Write a single-line block comment to the pretty writer stream.
|
void |
writeComment(Symbol symbol,
boolean is_doc)
Write a comment for a sidl symbol to the pretty writer stream.
|
void |
writeComment(Symbol symbol,
boolean is_doc,
boolean output_sym)
Write a comment for a sidl symbol to the pretty writer stream.
|
abstract void |
writeCommentLine(java.lang.String comment)
Abstract method to output a comment to the pretty writer stream.
|
abstract void |
writeSplicerTagLine(java.lang.String tagLine)
Write the splicer tag as a language-specific comment.
|
backTab, changeTabLevel, close, defineBlockComment, disableBlockComment, disableLineBreak, enableBlockComment, enableLineBreak, enableLineBreak, flushPrintWriter, getPrintWriter, popLineBreak, print, printAligned, println, println, printlnUnformatted, printSpaces, printUnformatted, pushLineBreak, restoreFirstTabStop, setFirstTabStop, setLineBreakString, setStrictBreaking, setTabSpacing, setTemporaryFirstTabStop, tab
protected Context d_context
public LanguageWriter(java.io.PrintWriter writer, Context context)
LanguageWriter
instance that will send
output to the specified print writer object.public abstract void beginBlockComment(boolean is_doc)
public abstract void endBlockComment(boolean is_doc)
public abstract void writeSplicerTagLine(java.lang.String tagLine)
public abstract void writeCommentLine(java.lang.String comment)
Abstract method to output a comment to the pretty writer stream. The comment is not written in a comment block but only on one line of the output stream. The comment should not contain any new line characters. If the comment is null, then nothing is output.
It is assumed that comment is safe for inclusion in a comment for any language.
comment
- a single line comment to include in the outputsafeCommentString(java.lang.String)
public void writeComment(java.lang.String s, boolean is_doc)
Write a single-line block comment to the pretty writer stream. If the string is null or contains no characters, then no comment is written. The documentation flag determines whether this is a documentation comment.
It is assumed that comment is safe for inclusion in a comment for any language.
s
- the comment string to include in the outputis_doc
- true
means that the comment should
be treated as a document-style comment in
languages that have such things.safeCommentString(java.lang.String)
public java.lang.String safeCommentString(java.lang.String string)
*
/
in side a C or Java comment would
prematurely end the comment.string
- the string to make safe for inclusion inside a
comment.public void writeComment(Comment comment, boolean is_doc)
public void writeComment(Symbol symbol, boolean is_doc, boolean output_sym)
public void writeComment(Symbol symbol, boolean is_doc)
public void writeComment(Method method, boolean is_doc, boolean add_default)
public void writeComment(Method method, boolean is_doc)
public void writeComment(Comment comment, java.lang.String alt)
comment
- a comment or nullalt
- an alternate string if comment==null, or null itselfpublic void writeBanner(Symbol symbol, java.lang.String file, boolean is_Impl, java.lang.String desc)