Package com.sun.msv.grammar

Examples of com.sun.msv.grammar.Expression


        final String combine = startTag.getCollapsedAttribute("combine");
       
        exp = callInterceptExpression(exp);
       
        // combine two patterns
        Expression newexp = doCombine( ref, exp, combine );
        if( newexp==null )
            reader.reportError( TREXBaseReader.ERR_BAD_COMBINE, combine );
            // recover by ignoring this definition
        else
            ref.exp = newexp;
View Full Code Here


public abstract class ExpressionState extends SimpleState
{
    protected void endSelf()
    {
        // creates a expression, then calls a hook of reader,
        Expression exp = reader.interceptExpression( this, makeExpression() );
       
        if( parentState!=null )
            // then finally pass it to the parent
            ((ExpressionOwner)parentState).onEndChild(exp);
       
View Full Code Here

        if( !startTag.containsAttribute("ref") )
            // existance of @ref must be checked before instanciation of this object.
            throw new Error();
       
        // this this tag has @ref.
        Expression exp = reader.resolveQNameRef(
            startTag, "ref",
            new XMLSchemaReader.RefResolver() {
                public ReferenceContainer get( XMLSchemaSchema g ) {
                    return g.elementDecls;
                }
View Full Code Here

            OptimizationTag ot;
            if(exp.verifierTag==null)
                exp.verifierTag = ot = new OptimizationTag();
            else {
                ot = (OptimizationTag)exp.verifierTag;
                Expression residual = (Expression)ot.simpleElementTokenResidual.get(token.acceptedPatterns[0]);
                if(residual!=null)
                    return residual;    // cache hit.
            }
           
            this.token = token;
            Expression residual = exp.visit(this);
            // cache this residual
            ot.simpleElementTokenResidual.put(token.acceptedPatterns[0],residual);
            return residual;
        }
       
View Full Code Here

    public final Expression calcResidual( Expression exp, Token token ) {
        if( token instanceof ElementToken )
            return calcResidual(exp,(ElementToken)token);
       
        this.token=token;
        Expression r = exp.visit(this);

        // if token is ignorable, make expression as so.
        if( token.isIgnorable() )
            r = pool.createChoice(r,exp);
       
View Full Code Here

    }
    public Expression onOther( OtherExp exp ) {
        return exp.exp.visit(this);
    }
    public Expression onSequence( SequenceExp exp ) {
        Expression r = pool.createSequence( exp.exp1.visit(this), exp.exp2 );
       
        if( exp.exp1.isEpsilonReducible() )
            return pool.createChoice( r, exp.exp2.visit(this) );
        else
            return r;
View Full Code Here

        // reduce A+ -> A
        return exp.exp.visit(this);
    }
   
    public Expression onSequence( SequenceExp exp ) {
        Expression ex1 = exp.exp1.visit(this);
        Expression ex2 = exp.exp2.visit(this);
       
        if(ex1.isEpsilonReducible()) {
            if(ex2.isEpsilonReducible())    return Expression.epsilon;
            else                            return ex2;
        }
        else
            return ex1;
    }
View Full Code Here

        else
            return ex1;
    }
   
    public Expression onInterleave( InterleaveExp exp ) {
        Expression ex1 = exp.exp1.visit(this);
        Expression ex2 = exp.exp2.visit(this);
       
        if(ex1.isEpsilonReducible()) {
            if(ex2.isEpsilonReducible())    return Expression.epsilon;
            else                            return ex2;
        } else
            return ex1;
    }
View Full Code Here

        // abandon concur.
        return Expression.epsilon;
    }
   
    public Expression onChoice( ChoiceExp exp ) {
        Expression ex1 = exp.exp1.visit(this);
        Expression ex2 = exp.exp2.visit(this);
        // if one of choice is epsilon-reducible,
        // the entire choice becomes optional.
        // optional attributes have to be removed from the result.
        if( ex1.isEpsilonReducible() || ex2.isEpsilonReducible() )
            return Expression.epsilon;
        return pool.createChoice(ex1,ex2);
    }
View Full Code Here

        firstChild = false;
        return newChild;
    }

    protected Expression annealExpression( Expression contentModel ) {
        Expression e = reader.pool.createAttribute( nameClass, contentModel );
        if(e instanceof AttributeExp)
            reader.setDeclaredLocationOf(e);
        return e;
    }
View Full Code Here

TOP

Related Classes of com.sun.msv.grammar.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.