Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.CommonTree.addChild()


    t.sanityCheckParentAndChildIndexes();
  }

  @Test public void testReplaceTwoWithOneAtLeft() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChild = new CommonTree(new CommonToken(99,"x"));
View Full Code Here


  }

  @Test public void testReplaceTwoWithOneAtLeft() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChild = new CommonTree(new CommonToken(99,"x"));

    t.replaceChildren(0, 1, newChild);
View Full Code Here

  @Test public void testReplaceTwoWithOneAtLeft() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChild = new CommonTree(new CommonToken(99,"x"));

    t.replaceChildren(0, 1, newChild);
    String expecting = "(a x d)";
View Full Code Here

    t.sanityCheckParentAndChildIndexes();
  }

  @Test public void testReplaceTwoWithOneAtRight() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChild = new CommonTree(new CommonToken(99,"x"));
View Full Code Here

  }

  @Test public void testReplaceTwoWithOneAtRight() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChild = new CommonTree(new CommonToken(99,"x"));

    t.replaceChildren(1, 2, newChild);
View Full Code Here

  @Test public void testReplaceTwoWithOneAtRight() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChild = new CommonTree(new CommonToken(99,"x"));

    t.replaceChildren(1, 2, newChild);
    String expecting = "(a b x)";
View Full Code Here

    t.sanityCheckParentAndChildIndexes();
  }

  @Test public void testReplaceAllWithOne() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChild = new CommonTree(new CommonToken(99,"x"));
View Full Code Here

  }

  @Test public void testReplaceAllWithOne() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChild = new CommonTree(new CommonToken(99,"x"));

    t.replaceChildren(0, 2, newChild);
View Full Code Here

  @Test public void testReplaceAllWithOne() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChild = new CommonTree(new CommonToken(99,"x"));

    t.replaceChildren(0, 2, newChild);
    String expecting = "(a x)";
View Full Code Here

    t.sanityCheckParentAndChildIndexes();
  }

  @Test public void testReplaceAllWithTwo() throws Exception {
    CommonTree t = new CommonTree(new CommonToken(99, "a"));
    t.addChild(new CommonTree(new CommonToken(99, "b")));
    t.addChild(new CommonTree(new CommonToken(99, "c")));
    t.addChild(new CommonTree(new CommonToken(99, "d")));

    CommonTree newChildren = (CommonTree)adaptor.nil();
    newChildren.addChild(new CommonTree(new CommonToken(99,"x")));
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.