Package org.eclipse.php.internal.core.ast.nodes

Examples of org.eclipse.php.internal.core.ast.nodes.Block


    String expected = "<?php if ($a) { $a = 5; $b = 4;}  ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        IfStatement statement = (IfStatement) program.statements().get(
            0);
        Block block = (Block) statement.getTrueStatement();
        block.statements().remove(2);
      }
    });
  }
View Full Code Here


    initialize(str);

    List<TryStatement> statements = getAllOfType(program,
        TryStatement.class);
    Assert.assertTrue("Unexpected list size.", statements.size() == 1);
    Block newBlock = ast.newBlock();
    newBlock.statements().add(
        ast.newEchoStatement(ast.newScalar("'Hello'")));
    statements
        .get(0)
        .catchClauses()
        .add(ast.newCatchClause(ast.newIdentifier("Boobo"),
View Full Code Here

      TargetSourceRangeComputer.SourceRange endRange = sourceRangeComputer
          .computeSourceRange(getEndNode());
      int startPos = startRange.getStartPosition();
      int endPos = endRange.getStartPosition() + endRange.getLength();

      Block internalPlaceholder = getInternalPlaceholder();
      internalPlaceholder.setSourceRange(startPos, endPos - startPos);
    }
View Full Code Here

                                      // of
                                      // a
                                      // range?
        nextInfo.updatePlaceholderSourceRanges(sourceRangeComputer);

        Block internalPlaceholder = nextInfo.getInternalPlaceholder();
        RewriteEvent newEvent;
        if (nextInfo.isMove()) {
          newEvent = new NodeRewriteEvent(internalPlaceholder,
              nextInfo.replacingNode); // remove or replace
        } else {
          newEvent = new NodeRewriteEvent(internalPlaceholder,
              internalPlaceholder); // unchanged
        }
        newChildEvents.add(newEvent);
        if (nextInfo.editGroup != null) {
          setEventEditGroup(newEvent, nextInfo.editGroup);
        }

        newChildrenStack.push(newChildEvents);
        topInfoStack.push(topInfo);

        newChildEvents = new ArrayList(childEvents.length);
        topInfo = nextInfo;

        nextInfo = rangeInfoIterator.hasNext() ? (NodeRangeInfo) rangeInfoIterator
            .next()
            : null;
      }

      newChildEvents.add(event);

      while (topInfo != null && node == topInfo.getEndNode()) {
        RewriteEvent[] placeholderChildEvents = (RewriteEvent[]) newChildEvents
            .toArray(new RewriteEvent[newChildEvents.size()]);
        Block internalPlaceholder = topInfo.getInternalPlaceholder();
        addEvent(internalPlaceholder, Block.STATEMENTS_PROPERTY,
            new ListRewriteEvent(placeholderChildEvents));

        newChildEvents = (List) newChildrenStack.pop();
        topInfo = (NodeRangeInfo) topInfoStack.pop();
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.ast.nodes.Block

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.