public class IlrBRLConverter
extends java.lang.Object
The locale of the target BRL language definition can be different from the syntax tree locale.
Note that this converter is supposed to be used on a well-formed syntax tree and may generate unexpected exceptions if used on a incomplete or erroneous syntax tree.
| Constructor and Description |
|---|
IlrBRLConverter(IlrVocabulary vocabulary,
IlrBRLDefinition definition)
Create a BRL converter from a target vocabulary and a target BRL language definition.
|
IlrBRLConverter(IlrVocabulary vocabulary,
IlrBRLDefinition definition,
IlrBRLVariableProvider variableProvider)
Create a BRL converter from a target vocabulary, a target BRL language definition and a target variable provider.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
bol()
Write a new line and indent that line to the current indentation.
|
java.lang.String |
convert(IlrSyntaxTree syntaxTree)
Convert a syntax tree into a string.
|
protected void |
doConvert(IlrSyntaxTree.Node node)
This method is called internally when converting the root of a syntax tree.
|
protected java.lang.String |
findAutomaticVariableReference(IlrSyntaxTree.Node node,
IlrBRLGrammarContext context) |
protected ilog.rules.brl.semantic.IlrBRLLanguageVariable |
findLanguageVariable(java.lang.String name) |
IlrBRLDefinition |
getDefinition()
Returns the target BRL language definition.
|
java.util.Locale |
getLocale()
Returns the locale used to convert syntax trees.
|
IlrVocabulary |
getVocabulary()
Returns the target vocabulary.
|
protected void |
indent()
Indent by one indentation.
|
protected void |
newline()
Write a newline.
|
protected void |
whiteSpace()
Write a white space, if it is needed (no white space before).
|
protected void |
write(char ch)
Write a character into the conversion buffer.
|
protected void |
write(java.lang.String text)
Write a string into the conversion buffer.
|
public IlrBRLConverter(IlrVocabulary vocabulary, IlrBRLDefinition definition)
vocabulary - The vocabulary.definition - The BRL language definition.public IlrBRLConverter(IlrVocabulary vocabulary, IlrBRLDefinition definition, IlrBRLVariableProvider variableProvider)
vocabulary - The vocabulary.definition - The BRL language definition.variableProvider - The variable provider.public IlrVocabulary getVocabulary()
public IlrBRLDefinition getDefinition()
public java.util.Locale getLocale()
protected void write(char ch)
ch - The character to write.protected void write(java.lang.String text)
text - The string to write.protected void bol()
protected void newline()
protected void indent()
'\t'.protected void whiteSpace()
public java.lang.String convert(IlrSyntaxTree syntaxTree)
The conversion is done using the target BRL language definition. The syntax tree must have the same BRL language definition as the converter, but the locale can be different.
Call to this method can generate unexpected exception if the syntax tree is erroneous or if the target vocabulary is incomplete.
syntaxTree - The syntax tree to convert.protected void doConvert(IlrSyntaxTree.Node node)
node - the root nodeprotected java.lang.String findAutomaticVariableReference(IlrSyntaxTree.Node node, IlrBRLGrammarContext context)
protected ilog.rules.brl.semantic.IlrBRLLanguageVariable findLanguageVariable(java.lang.String name)
© Copyright IBM Corp. 1987, 2017