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 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 patternObject
onAnyString()
Object
onAttribute(AttributeExp exp)
Object
onChoice(ChoiceExp exp)
Object
onConcur(ConcurExp exp)
Object
onData(DataExp exp)
Object
onElement(ElementExp exp)
Object
onEpsilon()
Object
onInterleave(InterleaveExp exp)
Object
onList(ListExp exp)
Object
onMixed(MixedExp exp)
Object
onNullSet()
Object
onOneOrMore(OneOrMoreExp exp)
Object
onOther(OtherExp exp)
Object
onRef(ReferenceExp exp)
Object
onSequence(SequenceExp exp)
Object
onValue(ValueExp exp)
protected String
printBinary(BinaryExp exp, String op)
static String
printContentModel(Expression exp)
static String
printFragment(Expression exp)
String
printRefContainer(ReferenceContainer cont)
dumps all the contents of ReferenceContainer.static 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 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:
onAttribute
in interfaceExpressionVisitor
-
onChoice
public Object onChoice(ChoiceExp exp)
- Specified by:
onChoice
in interfaceExpressionVisitor
-
onConcur
public Object onConcur(ConcurExp exp)
- Specified by:
onConcur
in interfaceExpressionVisitor
-
onInterleave
public Object onInterleave(InterleaveExp exp)
- Specified by:
onInterleave
in interfaceExpressionVisitor
-
onElement
public Object onElement(ElementExp exp)
- Specified by:
onElement
in interfaceExpressionVisitor
-
onOneOrMore
public Object onOneOrMore(OneOrMoreExp exp)
- Specified by:
onOneOrMore
in interfaceExpressionVisitor
-
onMixed
public Object onMixed(MixedExp exp)
- Specified by:
onMixed
in interfaceExpressionVisitor
-
onList
public Object onList(ListExp exp)
- Specified by:
onList
in interfaceExpressionVisitor
-
onEpsilon
public Object onEpsilon()
- Specified by:
onEpsilon
in interfaceExpressionVisitor
-
onNullSet
public Object onNullSet()
- Specified by:
onNullSet
in interfaceExpressionVisitor
-
onAnyString
public Object onAnyString()
- Specified by:
onAnyString
in interfaceExpressionVisitor
-
onSequence
public Object onSequence(SequenceExp exp)
- Specified by:
onSequence
in interfaceExpressionVisitor
-
onData
public Object onData(DataExp exp)
- Specified by:
onData
in interfaceExpressionVisitor
-
onValue
public Object onValue(ValueExp exp)
- Specified by:
onValue
in interfaceExpressionVisitor
-
onOther
public Object onOther(OtherExp exp)
- Specified by:
onOther
in interfaceExpressionVisitor
-
onRef
public Object onRef(ReferenceExp exp)
- Specified by:
onRef
in interfaceExpressionVisitor
-
-