Examples of LoopStatement


Examples of com.google.test.metric.cpp.dom.LoopStatement

  public void testIfElseAndLoopStatements() throws Exception {
    TranslationUnit unit = parse("void foo() { if (true) { for(;;); } else { while(true); } }");
    FunctionDefinition functionFoo = unit.getChild(0);
    IfStatement ifStatement = functionFoo.getChild(0);
    LoopStatement forStatement = ifStatement.getChild(0);
    assertNotNull(forStatement);
    ElseStatement elseStatement = functionFoo.getChild(1);
    LoopStatement whileStatement = elseStatement.getChild(0);
    assertNotNull(whileStatement);
  }
View Full Code Here

Examples of org.lilystudio.javascript.statement.LoopStatement

    case Token.IFNE:
      return new IfStatement(node, root, scope);

    case Token.LOOP:
      return new LoopStatement(node, root, scope);

    case Token.LOCAL_BLOCK: {
      switch (node.getFirstChild().getType()) {
      case Token.LOOP:
        return new ForinStatement(node, root, scope);
View Full Code Here

Examples of org.teiid.query.sql.proc.LoopStatement

                instruction = new ContinueInstruction();
                break;
            }
            case Statement.TYPE_LOOP:
            {
                LoopStatement loopStmt = (LoopStatement)statement;
                if(debug) {
                  analysisRecord.println("\tLOOP STATEMENT:\n" + statement); //$NON-NLS-1$
                }
                String rsName = loopStmt.getCursorName();

                ProcessorPlan commandPlan = loopStmt.getCommand().getProcessorPlan();

                Program loopProgram = planBlock(parentProcCommand, loopStmt.getBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
                instruction = new LoopInstruction(loopProgram, rsName, commandPlan);
                break;
            }
            case Statement.TYPE_WHILE:
            {
View Full Code Here

Examples of org.teiid.query.sql.proc.LoopStatement

                }
                ResolverVisitor.resolveLanguageObject(whileCrit, null, externalGroups, metadata);
                resolveBlock(command, whileStmt.getBlock(), externalGroups, metadata);
                break;
            case Statement.TYPE_LOOP:
                LoopStatement loopStmt = (LoopStatement) statement;
                String groupName = loopStmt.getCursorName();

                if (metadata.getMetadataStore().getTempGroupID(groupName) != null) {
                    throw new QueryResolverException(QueryPlugin.Util.getString("ERR.015.012.0065")); //$NON-NLS-1$
                }
               
            //check - cursor name should not start with #
            if(GroupSymbol.isTempGroupName(loopStmt.getCursorName())){
              String errorMsg = QueryPlugin.Util.getString("ResolveVariablesVisitor.reserved_word_for_temporary_used", loopStmt.getCursorName()); //$NON-NLS-1$
              throw new QueryResolverException(errorMsg);
            }
                Command cmd = loopStmt.getCommand();
                resolveEmbeddedCommand(metadata, externalGroups, cmd);
                List<SingleElementSymbol> symbols = cmd.getProjectedSymbols();
               
                //add the loop cursor group into its own context
                TempMetadataStore store = new TempMetadataStore(new HashMap(metadata.getMetadataStore().getData()));
                metadata = new TempMetadataAdapter(metadata.getMetadata(), store);
                externalGroups = new GroupContext(externalGroups, null);
               
                ProcedureContainerResolver.addScalarGroup(groupName, store, externalGroups, symbols, false);
               
                resolveBlock(command, loopStmt.getBlock(), externalGroups, metadata);
                break;
            case Statement.TYPE_BREAK:
            case Statement.TYPE_CONTINUE:
                break;
            default:
View Full Code Here

Examples of org.teiid.query.sql.proc.LoopStatement

                        return null;
                    }
        }
                return statement;
            case Statement.TYPE_LOOP:
                LoopStatement loop = (LoopStatement)statement;
               
                rewriteSubqueryContainer(loop, false);
               
                rewriteBlock(loop.getBlock());
               
                if (loop.getBlock().getStatements().isEmpty()) {
                    return null;
                }
               
                return loop;
            case Statement.TYPE_WHILE:
View Full Code Here

Examples of org.teiid.query.sql.proc.LoopStatement

      TeiidComponentException, TeiidProcessingException {
    Block b = new Block();
    b.addStatement(new CommandStatement(newUpdate));
    CreateUpdateProcedureCommand cupc = new CreateUpdateProcedureCommand();
    Block parent = new Block();
    LoopStatement ls = new LoopStatement(b, query, "X"); //$NON-NLS-1$
    parent.addStatement(ls);
    AssignmentStatement as = new AssignmentStatement();
    ElementSymbol rowsUpdate = new ElementSymbol(ProcedureReservedWords.VARIABLES+ElementSymbol.SEPARATOR+ProcedureReservedWords.ROWS_UPDATED);
    as.setVariable(rowsUpdate);
    as.setExpression(new Function("+", new Expression[] {rowsUpdate, new Constant(1)})); //$NON-NLS-1$
View Full Code Here

Examples of org.teiid.query.sql.proc.LoopStatement

        block.addStatement(dStmt);
        block.addStatement(assignmentStmt);
       
        String cursor = "mycursor"; //$NON-NLS-1$
              
        LoopStatement loopStmt = new LoopStatement(block, query, cursor);
                       
        helpStmtTest("LOOP ON (SELECT c1, c2 FROM m.g) AS mycursor BEGIN DECLARE integer x; x=mycursor.c1; END", //$NON-NLS-1$
             "LOOP ON (SELECT c1, c2 FROM m.g) AS mycursor"+"\n"+ "BEGIN"+"\n"+"DECLARE integer x;"+"\n"+"x = mycursor.c1;" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
             +"\n"+"END", loopStmt);      //$NON-NLS-1$ //$NON-NLS-2$
   
View Full Code Here

Examples of org.teiid.query.sql.proc.LoopStatement

        block.addStatement(dStmt);
        block.addStatement(assignmentStmt);
       
        String cursor = "mycursor"; //$NON-NLS-1$
              
        LoopStatement loopStmt = new LoopStatement(block, query, cursor);
                       
        helpStmtTest("LOOP ON (SELECT c1, c2 FROM m.g ORDER BY c1) AS mycursor BEGIN DECLARE integer x; x=mycursor.c1; END", //$NON-NLS-1$
             "LOOP ON (SELECT c1, c2 FROM m.g ORDER BY c1) AS mycursor"+"\n"+ "BEGIN"+"\n"+"DECLARE integer x;"+"\n"+"x = mycursor.c1;" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
             +"\n"+"END", loopStmt);      //$NON-NLS-1$ //$NON-NLS-2$
   
View Full Code Here

Examples of org.teiid.query.sql.proc.LoopStatement

        new Constant(new Integer(5)));
        IfStatement ifStmt = new IfStatement(crit, ifBlock);
        block.addStatement(ifStmt);
       
        String cursor = "mycursor";                //$NON-NLS-1$
        LoopStatement loopStmt = new LoopStatement(block, query, cursor);
       
        block = new Block();       
        block.addStatement(dStmt);
        block.addStatement(loopStmt);
        CommandStatement cmdStmt = new CommandStatement(query);
View Full Code Here

Examples of org.teiid.query.sql.proc.LoopStatement

        return q1;
    }
   
    public static final LoopStatement sample1() {
        Block block = TestBlock.sample1();
        return new LoopStatement(block, query1(), "cursor"); //$NON-NLS-1$
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.