Package com.sun.msv.grammar.util
Class ExpressionPrinter
- java.lang.Object
-
- com.sun.msv.grammar.util.ExpressionPrinter
-
- All Implemented Interfaces:
ExpressionVisitor
public class ExpressionPrinter extends Object implements ExpressionVisitor
creates a string representation of the expression. useful for debug and dump.- Author:
- Kohsuke KAWAGUCHI
-
-
Field Summary
Fields Modifier and Type Field Description static intCONTENTMODELin this mode, element declaration is one of the terminal symbol of stringnization.static ExpressionPrintercontentModelInstancestatic intFRAGMENTin this mode, reference to other expression is one of the terminal symbol of stringnization.static ExpressionPrinterfragmentInstanceprotected intmodethis flag controls how expression will be stringnizedstatic ExpressionPrintersmallestInstance
-
Constructor Summary
Constructors Modifier Constructor Description protectedExpressionPrinter(int mode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static booleanisComplex(Expression exp)determines whether brackets should be used to represent the patternObjectonAnyString()ObjectonAttribute(AttributeExp exp)ObjectonChoice(ChoiceExp exp)ObjectonConcur(ConcurExp exp)ObjectonData(DataExp exp)ObjectonElement(ElementExp exp)ObjectonEpsilon()ObjectonInterleave(InterleaveExp exp)ObjectonList(ListExp exp)ObjectonMixed(MixedExp exp)ObjectonNullSet()ObjectonOneOrMore(OneOrMoreExp exp)ObjectonOther(OtherExp exp)ObjectonRef(ReferenceExp exp)ObjectonSequence(SequenceExp exp)ObjectonValue(ValueExp exp)protected StringprintBinary(BinaryExp exp, String op)static StringprintContentModel(Expression exp)static StringprintFragment(Expression exp)StringprintRefContainer(ReferenceContainer cont)dumps all the contents of ReferenceContainer.static StringprintSmallest(Expression exp)
-
-
-
Field Detail
-
FRAGMENT
public static final int FRAGMENT
in this mode, reference to other expression is one of the terminal symbol of stringnization. Suitable to dump the entire grammar- See Also:
- Constant Field Values
-
CONTENTMODEL
public static final int CONTENTMODEL
in this mode, element declaration is one of the terminal symbol of stringnization. Suitable to dump the content model of element declarations.- See Also:
- Constant Field Values
-
fragmentInstance
public static final ExpressionPrinter fragmentInstance
-
contentModelInstance
public static final ExpressionPrinter contentModelInstance
-
smallestInstance
public static final ExpressionPrinter smallestInstance
-
mode
protected final int mode
this flag controls how expression will be stringnized
-
-
Method Detail
-
printFragment
public static String printFragment(Expression exp)
-
printContentModel
public static String printContentModel(Expression exp)
-
printSmallest
public static String printSmallest(Expression exp)
-
printRefContainer
public String printRefContainer(ReferenceContainer cont)
dumps all the contents of ReferenceContainer. this method is a useful piece to dump the entire grammar.
-
isComplex
protected static boolean isComplex(Expression exp)
determines whether brackets should be used to represent the pattern
-
onAttribute
public Object onAttribute(AttributeExp exp)
- Specified by:
onAttributein interfaceExpressionVisitor
-
onChoice
public Object onChoice(ChoiceExp exp)
- Specified by:
onChoicein interfaceExpressionVisitor
-
onConcur
public Object onConcur(ConcurExp exp)
- Specified by:
onConcurin interfaceExpressionVisitor
-
onInterleave
public Object onInterleave(InterleaveExp exp)
- Specified by:
onInterleavein interfaceExpressionVisitor
-
onElement
public Object onElement(ElementExp exp)
- Specified by:
onElementin interfaceExpressionVisitor
-
onOneOrMore
public Object onOneOrMore(OneOrMoreExp exp)
- Specified by:
onOneOrMorein interfaceExpressionVisitor
-
onMixed
public Object onMixed(MixedExp exp)
- Specified by:
onMixedin interfaceExpressionVisitor
-
onList
public Object onList(ListExp exp)
- Specified by:
onListin interfaceExpressionVisitor
-
onEpsilon
public Object onEpsilon()
- Specified by:
onEpsilonin interfaceExpressionVisitor
-
onNullSet
public Object onNullSet()
- Specified by:
onNullSetin interfaceExpressionVisitor
-
onAnyString
public Object onAnyString()
- Specified by:
onAnyStringin interfaceExpressionVisitor
-
onSequence
public Object onSequence(SequenceExp exp)
- Specified by:
onSequencein interfaceExpressionVisitor
-
onData
public Object onData(DataExp exp)
- Specified by:
onDatain interfaceExpressionVisitor
-
onValue
public Object onValue(ValueExp exp)
- Specified by:
onValuein interfaceExpressionVisitor
-
onOther
public Object onOther(OtherExp exp)
- Specified by:
onOtherin interfaceExpressionVisitor
-
onRef
public Object onRef(ReferenceExp exp)
- Specified by:
onRefin interfaceExpressionVisitor
-
-