Package xbird.xquery.expr.flwr

Examples of xbird.xquery.expr.flwr.LetClause


            if(flwr.isTransformed()) {
                if(type == Binding.FOR_CLAUSE) {
                    // no need to analyze
                    return flwr;
                } else {
                    LetClause lc = (LetClause) b;
                    lc.visit(this, ctxt);
                    if(lc.isLoopInvariant()) {
                        _pullup.put(lc, bindings);
                    }
                }
            } else {
                if(type == Binding.FOR_CLAUSE) {
View Full Code Here


        }

        if(!_pullup.isEmpty()) {
            final Set<Entry<LetClause, List<Binding>>> entries = _pullup.entrySet();
            for(Entry<LetClause, List<Binding>> e : entries) {
                final LetClause lc = e.getKey();
                clauses.add(insertionPoint, lc);
                final List<Binding> srcClauses = e.getValue();
                srcClauses.remove(lc);
            }
            _pullup.clear();
        }

        final Collection<ExpressionProxy> proxys = _invarients.values();
        if(!proxys.isEmpty()) {
            for(ExpressionProxy proxy : proxys) {
                final XQExpression orig = proxy.getOriginalExpr();
                final LetVariable lv = new LoopInvariantLetVariable(orig);
                proxy.setReplacedExpr(lv);
                final LetClause lc = new LetClause(lv);
                clauses.add(insertionPoint, lc);
            }
            _invarients.clear();
        }
    }
View Full Code Here

                                    assert (bsize > 0) : bsize;
                                    boolean found = false;
                                    for(int i = 0; i < bsize; i++) {
                                        Binding binding = _currentBindings.get(i);
                                        if(binding == _currentForClause) {
                                            LetClause lc = new LetClause(lv);
                                            _currentBindings.add(i, lc);
                                            found = true;
                                            break;
                                        }
                                    }
View Full Code Here

    [110] TypeDeclaration ::= "as" SequenceType
    ************************************************************************/
    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);
        clause = new LetClause(var);
        locate(clause);
        switch(jj_nt.kind) {
            case As:
                currentToken = jj_consume_token(As);
                varType = parseSequenceType();
                var.setType(varType);
                break;
            default:
                jj_la1[73] = jj_gen;
                ;
        }
        currentToken = jj_consume_token(ColonEquals);
        expr = parseExprSingle();
        var.setValue(expr);
        lets = new LinkedList<Binding>();
        lets.add(clause);
        label_11: while(true) {
            switch(jj_nt.kind) {
                case Comma:
                    ;
                    break;
                default:
                    jj_la1[74] = jj_gen;
                    break label_11;
            }
            //("," "$" VarName TypeDeclaration? ":=" ExprSingle)*
            currentToken = jj_consume_token(Comma);
            currentToken = jj_consume_token(VariableIndicator);
            currentToken = jj_consume_token(VarName);
            varName = QNameUtil.parse(currentToken.image, namespaceContext, currentModule.getNamespace());
            var = new LetVariable(varName);
            currentModule.putVariable(varName, var);
            clause = new LetClause(var);
            switch(jj_nt.kind) {
                case As:
                    currentToken = jj_consume_token(As);
                    varType = parseSequenceType();
                    var.setType(varType);
View Full Code Here

            if(flwr.isTransformed()) {
                if(type == Binding.FOR_CLAUSE) {
                    // no need to analyze
                    return flwr;
                } else {
                    LetClause lc = (LetClause) b;
                    lc.visit(this, ctxt);
                    if(lc.isLoopInvariant()) {
                        _pullup.put(lc, bindings);
                    }
                }
            } else {
                if(type == Binding.FOR_CLAUSE) {
View Full Code Here

        }

        if(!_pullup.isEmpty()) {
            final Set<Entry<LetClause, List<Binding>>> entries = _pullup.entrySet();
            for(Entry<LetClause, List<Binding>> e : entries) {
                final LetClause lc = e.getKey();
                clauses.add(insertionPoint, lc);
                final List<Binding> srcClauses = e.getValue();
                srcClauses.remove(lc);
            }
            _pullup.clear();
        }

        final Collection<ExpressionProxy> proxys = _invarients.values();
        if(!proxys.isEmpty()) {
            for(ExpressionProxy proxy : proxys) {
                final XQExpression orig = proxy.getOriginalExpr();
                final LetVariable lv = new LoopInvariantLetVariable(orig);
                proxy.setReplacedExpr(lv);
                final LetClause lc = new LetClause(lv);
                clauses.add(insertionPoint, lc);
            }
            _invarients.clear();
        }
    }
View Full Code Here

     [110] TypeDeclaration ::= "as" SequenceType
     ************************************************************************/
    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);
        clause = new LetClause(var);
        locate(clause);
        switch(jj_nt.kind) {
            case As:
                currentToken = jj_consume_token(As);
                varType = parseSequenceType();
                var.setType(varType);
                break;
            default:
                jj_la1[70] = jj_gen;
                ;
        }
        currentToken = jj_consume_token(ColonEquals);
        expr = parseExprSingle();
        var.setValue(expr);
        lets = new LinkedList<Binding>();
        lets.add(clause);
        label_10: while(true) {
            switch(jj_nt.kind) {
                case Comma:
                    ;
                    break;
                default:
                    jj_la1[71] = jj_gen;
                    break label_10;
            }
            //("," "$" VarName TypeDeclaration? ":=" ExprSingle)*
            currentToken = jj_consume_token(Comma);
            currentToken = jj_consume_token(VariableIndicator);
            currentToken = jj_consume_token(VarName);
            varName = QNameUtil.parse(currentToken.image, namespaceContext, currentModule.getNamespace());
            var = new LetVariable(varName);
            currentModule.putVariable(varName, var);
            clause = new LetClause(var);
            switch(jj_nt.kind) {
                case As:
                    currentToken = jj_consume_token(As);
                    varType = parseSequenceType();
                    var.setType(varType);
View Full Code Here

                                    assert (bsize > 0) : bsize;
                                    boolean found = false;
                                    for(int i = 0; i < bsize; i++) {
                                        Binding binding = _currentBindings.get(i);
                                        if(binding == _currentForClause) {
                                            LetClause lc = new LetClause(lv);
                                            _currentBindings.add(i, lc);
                                            found = true;
                                            break;
                                        }
                                    }
View Full Code Here

TOP

Related Classes of xbird.xquery.expr.flwr.LetClause

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.