Package org.antlr.runtime.tree

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


    GrammarAST o = (GrammarAST)nodes.LT(1);
    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


    // Assume we want to hit node 107 and then "call 102" then return

    int indexOf102 = 2;
    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());
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());
View Full Code Here

    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
    stream.pop();
View Full Code Here

    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

    // calls 104, then return

    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());
View Full Code Here

    }
    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

    // 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

    // CALL 104
    int indexOf104 = 6;
View Full Code Here

    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

    // CALL 104
    int indexOf104 = 6;
    stream.push(indexOf104);
    assertEquals(104, ((Tree)stream.LT(1)).getType());
View Full Code Here

    // CALL 104
    int indexOf104 = 6;
    stream.push(indexOf104);
    assertEquals(104, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 102
    assertEquals(Token.DOWN, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume DN
    assertEquals(105, ((Tree)stream.LT(1)).getType());
    stream.consume(); // consume 103
    assertEquals(Token.UP, ((Tree)stream.LT(1)).getType());
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.