Package com.sun.msv.reader
Class RunAwayExpressionChecker
- java.lang.Object
-
- com.sun.msv.reader.RunAwayExpressionChecker
-
- All Implemented Interfaces:
ExpressionVisitorVoid
public class RunAwayExpressionChecker extends java.lang.Object implements ExpressionVisitorVoid
makes sure that the expression does not run away. "run-away" expressions are expressions like this. <hedgeRule label="foo" /> <hedgeRef label="foo" /> </hedgeRule> Apparently, those expressions cannot be expressed in string regular expression. Therefore run-away expressions are prohibited in both RELAX and TREX.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.SetcontentModelExpressions which are used as the content model of current element.protected static java.lang.RuntimeExceptioneurekathis exception is thrown to abort check when a error is found.private GrammarReaderreaderprivate java.util.StackrefStackvisited Expressions.private java.util.SettestedExpsset of ElementExps which are already confirmed as being not a run-away exp.private java.util.StackunprocessedElementExpsQueue of unchecked element exps.
-
Constructor Summary
Constructors Modifier Constructor Description protectedRunAwayExpressionChecker(GrammarReader reader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbinaryVisit(BinaryExp exp)private voidcheck(Expression exp)static voidcheck(GrammarReader reader, Expression exp)private voidenter(Expression exp)private voidleave()voidonAnyString()voidonAttribute(AttributeExp exp)voidonChoice(ChoiceExp exp)voidonConcur(ConcurExp exp)voidonData(DataExp exp)voidonElement(ElementExp exp)voidonEpsilon()voidonInterleave(InterleaveExp exp)voidonList(ListExp exp)voidonMixed(MixedExp exp)voidonNullSet()voidonOneOrMore(OneOrMoreExp exp)voidonOther(OtherExp exp)voidonRef(ReferenceExp exp)voidonSequence(SequenceExp exp)voidonValue(ValueExp exp)protected voidunaryVisit(UnaryExp exp)
-
-
-
Field Detail
-
eureka
protected static final java.lang.RuntimeException eureka
this exception is thrown to abort check when a error is found.
-
testedExps
private final java.util.Set testedExps
set of ElementExps which are already confirmed as being not a run-away exp.
-
contentModel
private java.util.Set contentModel
Expressions which are used as the content model of current element.
-
refStack
private java.util.Stack refStack
visited Expressions. this information is useful for the user to figure out where did they make a mistake.
-
unprocessedElementExps
private java.util.Stack unprocessedElementExps
Queue of unchecked element exps.
-
reader
private final GrammarReader reader
-
-
Constructor Detail
-
RunAwayExpressionChecker
protected RunAwayExpressionChecker(GrammarReader reader)
-
-
Method Detail
-
check
private void check(Expression exp)
-
check
public static void check(GrammarReader reader, Expression exp)
-
onAttribute
public void onAttribute(AttributeExp exp)
- Specified by:
onAttributein interfaceExpressionVisitorVoid
-
onConcur
public void onConcur(ConcurExp exp)
- Specified by:
onConcurin interfaceExpressionVisitorVoid
-
onInterleave
public void onInterleave(InterleaveExp exp)
- Specified by:
onInterleavein interfaceExpressionVisitorVoid
-
onSequence
public void onSequence(SequenceExp exp)
- Specified by:
onSequencein interfaceExpressionVisitorVoid
-
onChoice
public void onChoice(ChoiceExp exp)
- Specified by:
onChoicein interfaceExpressionVisitorVoid
-
onOneOrMore
public void onOneOrMore(OneOrMoreExp exp)
- Specified by:
onOneOrMorein interfaceExpressionVisitorVoid
-
onMixed
public void onMixed(MixedExp exp)
- Specified by:
onMixedin interfaceExpressionVisitorVoid
-
onList
public void onList(ListExp exp)
- Specified by:
onListin interfaceExpressionVisitorVoid
-
onEpsilon
public void onEpsilon()
- Specified by:
onEpsilonin interfaceExpressionVisitorVoid
-
onNullSet
public void onNullSet()
- Specified by:
onNullSetin interfaceExpressionVisitorVoid
-
onAnyString
public void onAnyString()
- Specified by:
onAnyStringin interfaceExpressionVisitorVoid
-
onData
public void onData(DataExp exp)
- Specified by:
onDatain interfaceExpressionVisitorVoid
-
onValue
public void onValue(ValueExp exp)
- Specified by:
onValuein interfaceExpressionVisitorVoid
-
binaryVisit
protected final void binaryVisit(BinaryExp exp)
-
unaryVisit
protected final void unaryVisit(UnaryExp exp)
-
enter
private void enter(Expression exp)
-
leave
private void leave()
-
onRef
public void onRef(ReferenceExp exp)
- Specified by:
onRefin interfaceExpressionVisitorVoid
-
onOther
public void onOther(OtherExp exp)
- Specified by:
onOtherin interfaceExpressionVisitorVoid
-
onElement
public void onElement(ElementExp exp)
- Specified by:
onElementin interfaceExpressionVisitorVoid
-
-