Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.TreeWizard.index()


  }

  @Test public void testSingleNodeIndex() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("ID");
    Map<Integer, List<Object>> m = wiz.index(t);
    String found = m.toString();
    String expecting = "{10=[ID]}";
    assertEquals(expecting, found);
  }
View Full Code Here


  }

  @Test public void testNoRepeatsIndex() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("(A B C D)");
    Map<Integer, List<Object>> m = wiz.index(t);
    String found = sortMapToString(m);
        String expecting = "{5=[A], 6=[B], 7=[C], 8=[D]}";
    assertEquals(expecting, found);
  }
View Full Code Here

  }

  @Test public void testRepeatsIndex() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("(A B (A C B) B D D)");
    Map<Integer, List<Object>> m = wiz.index(t);
    String found =  sortMapToString(m);
        String expecting = "{5=[A, A], 6=[B, B, B], 7=[C], 8=[D, D]}";
    assertEquals(expecting, found);
  }
View Full Code Here

  }

  @Test public void testSingleNodeIndex() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("ID");
    Map m = wiz.index(t);
    String found = m.toString();
    String expecting = "{10=[ID]}";
    assertEquals(expecting, found);
  }
View Full Code Here

  }

  @Test public void testNoRepeatsIndex() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("(A B C D)");
    Map m = wiz.index(t);
    String found = sortMapToString(m);
        String expecting = "{5=[A], 6=[B], 7=[C], 8=[D]}";
    assertEquals(expecting, found);
  }
View Full Code Here

  }

  @Test public void testRepeatsIndex() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("(A B (A C B) B D D)");
    Map m = wiz.index(t);
    String found =  sortMapToString(m);
        String expecting = "{5=[A, A], 6=[B, B, B], 7=[C], 8=[D, D]}";
    assertEquals(expecting, found);
  }
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.