Package xbird.xquery.expr

Examples of xbird.xquery.expr.XQExpression


    final public List<Binding> parseLetClause() throws ParseException, XQueryException {
        final List<Binding> lets;
        LetVariable var;
        LetClause clause;
        Type varType = null;
        XQExpression expr = null;
        currentToken = jj_consume_token(LetVariable);
        currentToken = jj_consume_token(VarName);
        QualifiedName varName = QNameUtil.parse(currentToken.image, namespaceContext, currentModule.getNamespace());
        var = new LetVariable(varName);
        currentModule.putVariable(varName, var);
View Full Code Here


    [40] OrderSpec      ::=  ExprSingle OrderModifier
    [41] OrderModifier ::= ("ascending" | "descending")? (<"empty" "greatest"> | <"empty" "least">)? ("collation" URILiteral)?
    ************************************************************************/
    final public OrderSpec parseOrderSpec() throws ParseException, XQueryException {
        final OrderSpec spec;
        final XQExpression keyExpr;
        String collation = null;
        keyExpr = parseExprSingle();
        spec = new OrderSpec(keyExpr);
        locate(spec);
        switch(jj_nt.kind) {
View Full Code Here

    @Override
    public ZeroOrOne staticAnalysis(StaticContext context, List<? extends XQExpression> params)
            throws XQueryException {
        assert (params != null);
        // infer return type from parameter types
        final XQExpression p = params.get(0);
        this._returnType = p.getType().prime();
        assert (Type.Occurrence.OCC_ZERO_OR_ONE.accepts(_returnType.quantifier().getAlignment()));
        return this;
    }
View Full Code Here

        final QuantifiedExpr outermost;
        boolean isEveryQuantifier = false;
        QualifiedName varName;
        QuantifiedVariable var;
        Type varType = null;
        XQExpression valueExpr;
        final XQExpression condExpr;
        currentModule.pushVarScope();
        switch(jj_nt.kind) {
            case Some:
                currentToken = jj_consume_token(Some);
                break;
View Full Code Here

    [43] TypeswitchExpr ::= <"typeswitch" "("> Expr ")" CaseClause+
                "default" ("$" VarName)? "return" ExprSingle
    ************************************************************************/
    final public TypeswitchExpr parseTypeswitchExpr() throws ParseException, XQueryException {
        final TypeswitchExpr switchExpr;
        XQExpression expr = null;
        CaseClause cc = null;
        QualifiedName varName = null;
        currentToken = jj_consume_token(TypeswitchLpar);
        expr = parseExpr();
        switchExpr = new TypeswitchExpr(expr);
View Full Code Here

        this._noFollowBefore = forVar.getBirthId();
    }

    public XQExpression visit(AdditiveExpr op, XQueryContext ctxt) throws XQueryException {
        boolean isLoopInvariant = true;
        XQExpression left = op.getLeftOperand();
        XQExpression left2 = left.visit(this, ctxt);
        if(left2 != left) {
            op.setLeftOperand(left2);
        }
        isLoopInvariant &= left.isLoopInvariant();
        XQExpression right = op.getRightOperand();
        XQExpression right2 = right.visit(this, ctxt);
        if(right2 != right) {
            op.setRightOperand(right2);
        }
        isLoopInvariant &= right.isLoopInvariant();
        if(isLoopInvariant) {
View Full Code Here

    public XQExpression visit(AndExpr andExpr, XQueryContext ctxt) throws XQueryException {
        boolean isLoopInvariant = true;
        List<XQExpression> exprs = andExpr.getExpressions();
        int exprsSize = exprs.size();
        for(int i = 0; i < exprsSize; i++) {
            XQExpression e = exprs.get(i);
            XQExpression e2 = e.visit(this, ctxt);
            if(e2 != e) {
                exprs.set(i, e2);
            }
            isLoopInvariant &= e.isLoopInvariant();
        }
View Full Code Here

    public XQExpression visit(AttributeConstructor constructor, XQueryContext ctxt)
            throws XQueryException {
        boolean isLoopInvariant = true;
        QualifiedName name = constructor.getName();
        if(name == null) {
            XQExpression nameExpr = constructor.getNameExpr();
            XQExpression nameExpr2 = nameExpr.visit(this, ctxt);
            if(nameExpr2 != nameExpr) {
                constructor.setNameExpr(nameExpr2);
            }
            isLoopInvariant &= nameExpr.isLoopInvariant();
        }
        for(XQExpression ve : constructor.getValueExprs()) {
            ve.visit(this, ctxt);
            isLoopInvariant &= ve.isLoopInvariant();
        }
        if(isLoopInvariant) {
            if(name == null) {
                XQExpression nameExpr = constructor.getNameExpr();
                removeInvariants(nameExpr);
            }
            for(XQExpression ve : constructor.getValueExprs()) {
                removeInvariants(ve);
            }
View Full Code Here

        }
        return step;
    }

    public XQExpression visit(BindingVariable variable, XQueryContext ctxt) throws XQueryException {
        XQExpression inExpr = variable.getValue();
        if(inExpr == null) {
            assert (variable instanceof PositionalVariable) : variable.getName();
            return variable; // TODO REVIEWME
        }
        inExpr.visit(this, ctxt);
        boolean isLoopInvariant = inExpr.isLoopInvariant();//TODO REVIEWME
        if(isLoopInvariant) {
            if(variable == _loopForVar || variable == _loopPosVar) {
                removeInvariants(inExpr);
                variable.setLoopInvariant(false);
            } else {
View Full Code Here

    public XQExpression visit(BuiltInFunction function, XQueryContext ctxt) throws XQueryException {
        return null;
    }

    public XQExpression visit(CaseClause clause, XQueryContext ctxt) throws XQueryException {
        XQExpression e = clause.getReturnExpr();
        e.visit(this, ctxt);
        boolean isLoopInvariant = e.isLoopInvariant();
        if(isLoopInvariant) {
            removeInvariants(e);
            return hookLoopInvariant(clause);
        }
        return clause;
View Full Code Here

TOP

Related Classes of xbird.xquery.expr.XQExpression

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.