예제 #1
0
 @Override
 public AstNode labeledStatement(AstNode label, AstNode statement) {
   LabeledStatement s = new LabeledStatement();
   s.addLabel(cast(label, Label.class));
   s.setStatement(statement);
   return s;
 }
예제 #2
0
  public void testLinenoLabel() {
    AstRoot root = parse("\nfoo:\n" + "a = 1;\n" + "bar:\n" + "b = 2;\n");

    LabeledStatement firstStmt = (LabeledStatement) root.getFirstChild();
    LabeledStatement secondStmt = (LabeledStatement) firstStmt.getNext();

    assertEquals(1, firstStmt.getLineno());
    assertEquals(3, secondStmt.getLineno());
  }