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 int
CONTENTMODEL
in this mode, element declaration is one of the terminal symbol of stringnization.static ExpressionPrinter
contentModelInstance
static int
FRAGMENT
in this mode, reference to other expression is one of the terminal symbol of stringnization.static ExpressionPrinter
fragmentInstance
protected int
mode
this flag controls how expression will be stringnizedstatic ExpressionPrinter
smallestInstance
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExpressionPrinter(int mode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static boolean
isComplex(Expression exp)
determines whether brackets should be used to represent the patternjava.lang.Object
onAnyString()
java.lang.Object
onAttribute(AttributeExp exp)
java.lang.Object
onChoice(ChoiceExp exp)
java.lang.Object
onConcur(ConcurExp exp)
java.lang.Object
onData(DataExp exp)
java.lang.Object
onElement(ElementExp exp)
java.lang.Object
onEpsilon()
java.lang.Object
onInterleave(InterleaveExp exp)
java.lang.Object
onList(ListExp exp)
java.lang.Object
onMixed(MixedExp exp)
java.lang.Object
onNullSet()
java.lang.Object
onOneOrMore(OneOrMoreExp exp)
java.lang.Object
onOther(OtherExp exp)
java.lang.Object
onRef(ReferenceExp exp)
java.lang.Object
onSequence(SequenceExp exp)
java.lang.Object
onValue(ValueExp exp)
private java.lang.Object
optional(Expression exp)
protected java.lang.String
printBinary(BinaryExp exp, java.lang.String op)
static java.lang.String
printContentModel(Expression exp)
static java.lang.String
printFragment(Expression exp)
java.lang.String
printRefContainer(ReferenceContainer cont)
dumps all the contents of ReferenceContainer.static java.lang.String
printSmallest(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:
onAttribute
in interfaceExpressionVisitor
-
optional
private java.lang.Object optional(Expression exp)
-
onChoice
public java.lang.Object onChoice(ChoiceExp exp)
- Specified by:
onChoice
in interfaceExpressionVisitor
-
onConcur
public java.lang.Object onConcur(ConcurExp exp)
- Specified by:
onConcur
in interfaceExpressionVisitor
-
onInterleave
public java.lang.Object onInterleave(InterleaveExp exp)
- Specified by:
onInterleave
in interfaceExpressionVisitor
-
onElement
public java.lang.Object onElement(ElementExp exp)
- Specified by:
onElement
in interfaceExpressionVisitor
-
onOneOrMore
public java.lang.Object onOneOrMore(OneOrMoreExp exp)
- Specified by:
onOneOrMore
in interfaceExpressionVisitor
-
onMixed
public java.lang.Object onMixed(MixedExp exp)
- Specified by:
onMixed
in interfaceExpressionVisitor
-
onList
public java.lang.Object onList(ListExp exp)
- Specified by:
onList
in interfaceExpressionVisitor
-
onEpsilon
public java.lang.Object onEpsilon()
- Specified by:
onEpsilon
in interfaceExpressionVisitor
-
onNullSet
public java.lang.Object onNullSet()
- Specified by:
onNullSet
in interfaceExpressionVisitor
-
onAnyString
public java.lang.Object onAnyString()
- Specified by:
onAnyString
in interfaceExpressionVisitor
-
onSequence
public java.lang.Object onSequence(SequenceExp exp)
- Specified by:
onSequence
in interfaceExpressionVisitor
-
onData
public java.lang.Object onData(DataExp exp)
- Specified by:
onData
in interfaceExpressionVisitor
-
onValue
public java.lang.Object onValue(ValueExp exp)
- Specified by:
onValue
in interfaceExpressionVisitor
-
onOther
public java.lang.Object onOther(OtherExp exp)
- Specified by:
onOther
in interfaceExpressionVisitor
-
onRef
public java.lang.Object onRef(ReferenceExp exp)
- Specified by:
onRef
in interfaceExpressionVisitor
-
-