public class ProductionFormatter<ELEMENT,TOKEN> extends java.lang.Object implements com.google.common.base.Function<Production<ELEMENT,TOKEN>,java.lang.String>
Modifier and Type | Class and Description |
---|---|
protected static class |
ProductionFormatter.ObjToStrFunction<TOKEN> |
Modifier and Type | Field and Description |
---|---|
protected int |
autoWrapChars |
protected int |
autoWrapChildren |
protected java.lang.String |
indent |
protected com.google.common.base.Function<TOKEN,java.lang.String> |
tokenToString |
Constructor and Description |
---|
ProductionFormatter() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
apply(Production<ELEMENT,TOKEN> from) |
java.lang.String |
format(Production<ELEMENT,TOKEN> adapter) |
java.lang.String |
format(Production<ELEMENT,TOKEN> adapter,
ELEMENT grammarElement) |
java.lang.String |
format(Production<ELEMENT,TOKEN> adapter,
ELEMENT grammarElement,
boolean needParenthesis) |
protected java.lang.String |
format(Production<ELEMENT,TOKEN> adapter,
ELEMENT element,
java.lang.Iterable<ELEMENT> children,
java.lang.String separator,
boolean needWrap,
boolean needParenthesis) |
protected java.lang.String |
getCardinality(Production<ELEMENT,TOKEN> adapter,
ELEMENT ele) |
ProductionFormatter<ELEMENT,TOKEN> |
setAutoWrapChars(int autoWrapChars) |
ProductionFormatter<ELEMENT,TOKEN> |
setAutoWrapChildren(int autoWrapChildren) |
ProductionFormatter<ELEMENT,TOKEN> |
setIndent(java.lang.String indent) |
ProductionFormatter<ELEMENT,TOKEN> |
setTokenToString(com.google.common.base.Function<TOKEN,java.lang.String> tokenToString) |
protected int autoWrapChars
protected int autoWrapChildren
protected java.lang.String indent
protected com.google.common.base.Function<TOKEN,java.lang.String> tokenToString
public java.lang.String apply(Production<ELEMENT,TOKEN> from)
apply
in interface com.google.common.base.Function<Production<ELEMENT,TOKEN>,java.lang.String>
public java.lang.String format(Production<ELEMENT,TOKEN> adapter)
public java.lang.String format(Production<ELEMENT,TOKEN> adapter, ELEMENT grammarElement)
public java.lang.String format(Production<ELEMENT,TOKEN> adapter, ELEMENT grammarElement, boolean needParenthesis)
protected java.lang.String format(Production<ELEMENT,TOKEN> adapter, ELEMENT element, java.lang.Iterable<ELEMENT> children, java.lang.String separator, boolean needWrap, boolean needParenthesis)
protected java.lang.String getCardinality(Production<ELEMENT,TOKEN> adapter, ELEMENT ele)
public ProductionFormatter<ELEMENT,TOKEN> setAutoWrapChars(int autoWrapChars)
public ProductionFormatter<ELEMENT,TOKEN> setAutoWrapChildren(int autoWrapChildren)
public ProductionFormatter<ELEMENT,TOKEN> setIndent(java.lang.String indent)
public ProductionFormatter<ELEMENT,TOKEN> setTokenToString(com.google.common.base.Function<TOKEN,java.lang.String> tokenToString)