Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.CommonTreeNodeStream.LT()


    CharStream input = this.token.getInputStream();
    GrammarASTAdaptor adaptor = new GrammarASTAdaptor(input);
    CommonTreeNodeStream nodes =
      new CommonTreeNodeStream(adaptor, this);
    StringBuilder buf = new StringBuilder();
    GrammarAST o = (GrammarAST)nodes.LT(1);
    int type = adaptor.getType(o);
    while ( type!=Token.EOF ) {
      buf.append(" ");
      buf.append(o.getText());
      nodes.consume();
View Full Code Here


    int type = adaptor.getType(o);
    while ( type!=Token.EOF ) {
      buf.append(" ");
      buf.append(o.getText());
      nodes.consume();
      o = (GrammarAST)nodes.LT(1);
      type = adaptor.getType(o);
    }
    return buf.toString();
  }
View Full Code Here

    int indexOf107 = 12;
    for (int k=1; k<=indexOf107; k++) { // consume til 107 node
      stream.consume();
    }
    // CALL 102
    assertEquals(107, ((Tree)stream.LT(1)).getType());
    stream.push(indexOf102);
    assertEquals(102, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 102
    assertEquals(Token.DOWN, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume DN
View Full Code Here

      stream.consume();
    }
    // CALL 102
    assertEquals(107, ((Tree)stream.LT(1)).getType());
    stream.push(indexOf102);
    assertEquals(102, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 102
    assertEquals(Token.DOWN, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume DN
    assertEquals(103, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 103
View Full Code Here

    // CALL 102
    assertEquals(107, ((Tree)stream.LT(1)).getType());
    stream.push(indexOf102);
    assertEquals(102, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 102
    assertEquals(Token.DOWN, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume DN
    assertEquals(103, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 103
    assertEquals(Token.UP, ((Tree)stream.LT(1)).getType());
    // RETURN
View Full Code Here

    stream.push(indexOf102);
    assertEquals(102, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 102
    assertEquals(Token.DOWN, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume DN
    assertEquals(103, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 103
    assertEquals(Token.UP, ((Tree)stream.LT(1)).getType());
    // RETURN
    stream.pop();
    assertEquals(107, ((Tree)stream.LT(1)).getType());
View Full Code Here

    stream.consume(); // consume 102
    assertEquals(Token.DOWN, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume DN
    assertEquals(103, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 103
    assertEquals(Token.UP, ((Tree)stream.LT(1)).getType());
    // RETURN
    stream.pop();
    assertEquals(107, ((Tree)stream.LT(1)).getType());
  }
View Full Code Here

    assertEquals(103, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 103
    assertEquals(Token.UP, ((Tree)stream.LT(1)).getType());
    // RETURN
    stream.pop();
    assertEquals(107, ((Tree)stream.LT(1)).getType());
  }

  public void testNestedPushPop() throws Exception {
    // ^(101 ^(102 103) ^(104 105) ^(106 107) 108 109)
    // stream has 9 real + 8 nav nodes
View Full Code Here

    int indexOf102 = 2;
    int indexOf107 = 12;
    for (int k=1; k<=indexOf107; k++) { // consume til 107 node
      stream.consume();
    }
    assertEquals(107, ((Tree)stream.LT(1)).getType());
    // CALL 102
    stream.push(indexOf102);
    assertEquals(102, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 102
    assertEquals(Token.DOWN, ((Tree)stream.LT(1)).getType());
View Full Code Here

      stream.consume();
    }
    assertEquals(107, ((Tree)stream.LT(1)).getType());
    // CALL 102
    stream.push(indexOf102);
    assertEquals(102, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 102
    assertEquals(Token.DOWN, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume DN
    assertEquals(103, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 103
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.