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 java.lang.Object implements ExpressionVisitor
creates a string representation of the expression. useful for debug and dump.
-
-
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 patternjava.lang.ObjectonAnyString()java.lang.ObjectonAttribute(AttributeExp exp)java.lang.ObjectonChoice(ChoiceExp exp)java.lang.ObjectonConcur(ConcurExp exp)java.lang.ObjectonData(DataExp exp)java.lang.ObjectonElement(ElementExp exp)java.lang.ObjectonEpsilon()java.lang.ObjectonInterleave(InterleaveExp exp)java.lang.ObjectonList(ListExp exp)java.lang.ObjectonMixed(MixedExp exp)java.lang.ObjectonNullSet()java.lang.ObjectonOneOrMore(OneOrMoreExp exp)java.lang.ObjectonOther(OtherExp exp)java.lang.ObjectonRef(ReferenceExp exp)java.lang.ObjectonSequence(SequenceExp exp)java.lang.ObjectonValue(ValueExp exp)private java.lang.Objectoptional(Expression exp)protected java.lang.StringprintBinary(BinaryExp exp, java.lang.String op)static java.lang.StringprintContentModel(Expression exp)static java.lang.StringprintFragment(Expression exp)java.lang.StringprintRefContainer(ReferenceContainer cont)dumps all the contents of ReferenceContainer.static java.lang.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 java.lang.String printFragment(Expression exp)
-
printContentModel
public static java.lang.String printContentModel(Expression exp)
-
printSmallest
public static java.lang.String printSmallest(Expression exp)
-
printRefContainer
public java.lang.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
-
printBinary
protected java.lang.String printBinary(BinaryExp exp, java.lang.String op)
-
onAttribute
public java.lang.Object onAttribute(AttributeExp exp)
- Specified by:
onAttributein interfaceExpressionVisitor
-
optional
private java.lang.Object optional(Expression exp)
-
onChoice
public java.lang.Object onChoice(ChoiceExp exp)
- Specified by:
onChoicein interfaceExpressionVisitor
-
onConcur
public java.lang.Object onConcur(ConcurExp exp)
- Specified by:
onConcurin interfaceExpressionVisitor
-
onInterleave
public java.lang.Object onInterleave(InterleaveExp exp)
- Specified by:
onInterleavein interfaceExpressionVisitor
-
onElement
public java.lang.Object onElement(ElementExp exp)
- Specified by:
onElementin interfaceExpressionVisitor
-
onOneOrMore
public java.lang.Object onOneOrMore(OneOrMoreExp exp)
- Specified by:
onOneOrMorein interfaceExpressionVisitor
-
onMixed
public java.lang.Object onMixed(MixedExp exp)
- Specified by:
onMixedin interfaceExpressionVisitor
-
onList
public java.lang.Object onList(ListExp exp)
- Specified by:
onListin interfaceExpressionVisitor
-
onEpsilon
public java.lang.Object onEpsilon()
- Specified by:
onEpsilonin interfaceExpressionVisitor
-
onNullSet
public java.lang.Object onNullSet()
- Specified by:
onNullSetin interfaceExpressionVisitor
-
onAnyString
public java.lang.Object onAnyString()
- Specified by:
onAnyStringin interfaceExpressionVisitor
-
onSequence
public java.lang.Object onSequence(SequenceExp exp)
- Specified by:
onSequencein interfaceExpressionVisitor
-
onData
public java.lang.Object onData(DataExp exp)
- Specified by:
onDatain interfaceExpressionVisitor
-
onValue
public java.lang.Object onValue(ValueExp exp)
- Specified by:
onValuein interfaceExpressionVisitor
-
onOther
public java.lang.Object onOther(OtherExp exp)
- Specified by:
onOtherin interfaceExpressionVisitor
-
onRef
public java.lang.Object onRef(ReferenceExp exp)
- Specified by:
onRefin interfaceExpressionVisitor
-
-