|
ILOG JRules | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.rules.brl.translation.codegen.IlrAbstractCodeGenerator
public abstract class IlrAbstractCodeGenerator
Generic base class for Code Generators.
Provides a set of printXXX methods and a simple code generator extension mechanism.
| Field Summary | |
|---|---|
IlrRuleStatement |
currentRuleStatement
Public attribute for the current rule statement cursor. |
| Constructor Summary | |
|---|---|
IlrAbstractCodeGenerator()
Creates a new IlrAbstractCodeGenerator. |
|
| Method Summary | |
|---|---|
void |
addIndent(int count)
Increments the indentation by the given amount. |
void |
close()
Closes the stream. |
void |
flush()
Flushes the stream. |
void |
generateCode(IlrIntermediateForm iform,
Writer writer)
Generates the code for the specified IlrIntermediateForm instance,
and into the provided writer. |
IlrCodeGeneratorExtender |
getExtender(IlrSyntaxTree.Node node)
Returns the extender registered for the grammar node of node. |
int |
getIndent()
Gets the indentation multiplied by the indent size. |
int |
getIndentSize()
Gets the indent size. |
IlrTranslationSupport |
getTranslationSupport()
Gets the translation support. |
IlrBRLTranslator |
getTranslator()
Returns the translator of this code generator. |
IlrVocabulary |
getVocabulary()
Returns the vocabulary. |
boolean |
ignoreNewline()
Returns the value of the IgnoreLine flag. |
void |
ignoreNewline(boolean flag)
Sets the IgnoreNewline flag. |
void |
indent()
Prints getIndent() white spaces. |
void |
indent(int count)
Prints the given number of white spaces. |
void |
newline()
Prints a newline. |
void |
print(char ch)
Prints a character. |
void |
print(String text)
Prints a string. |
void |
println(String str)
Prints a string followed by a newline. |
boolean |
reportDuplicateVariables()
This method returns whether this code generator should reprot duplicate variables |
void |
reportDuplicateVariables(boolean flag)
this method set whether this code generator should report duplicate variables |
protected void |
reset()
Resets this code generator and prepare it for a new code generation. |
void |
setIndentSize(int size)
Sets the indent size. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ilog.rules.brl.translation.codegen.IlrCodeGenerator |
|---|
getTargetLanguage, setTranslator |
| Methods inherited from interface ilog.rules.brl.translation.IlrIntermediateForm.Visitor |
|---|
visit, visit, visit, visit, visit, visit, visit, visit, visit |
| Field Detail |
|---|
public IlrRuleStatement currentRuleStatement
| Constructor Detail |
|---|
public IlrAbstractCodeGenerator()
IlrAbstractCodeGenerator.
| Method Detail |
|---|
protected void reset()
public void generateCode(IlrIntermediateForm iform,
Writer writer)
IlrIntermediateForm instance,
and into the provided writer.
generateCode in interface IlrCodeGeneratoriform - The intermediate form.writer - The writer.public void reportDuplicateVariables(boolean flag)
public boolean reportDuplicateVariables()
public IlrBRLTranslator getTranslator()
getTranslator in interface IlrCodeGeneratorpublic IlrTranslationSupport getTranslationSupport()
public IlrVocabulary getVocabulary()
public IlrCodeGeneratorExtender getExtender(IlrSyntaxTree.Node node)
node.
node - The node.
null if no code generator extender
has been registered for this node.public void print(String text)
text - The string to print.public void println(String str)
str - The string to print.public void print(char ch)
ch - The character to print.public void indent(int count)
count - The number of white space characters to print.public void indent()
public int getIndent()
public void addIndent(int count)
count - The amount by which the indentation is to be increased.public void setIndentSize(int size)
size - The size of the indent.public int getIndentSize()
public void newline()
public void ignoreNewline(boolean flag)
When true, the newLine property is not taken in account by the printToken() methods.
flag - The new value for the IgnoreNewline flag.public boolean ignoreNewline()
ignoreNewline(boolean)public void flush()
public void close()
|
ILOG JRules | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||