Ejemplo n.º 1
0
  @Override
  public ASTNode visitPicInt(PicIntContext ctx) {
    NineNode a = new NineNode();
    String fstring = ctx.INT().getText();

    // does fstring contain all "999"s ?
    a.setCount(fstring.length());
    return a;
  }
Ejemplo n.º 2
0
  @Override
  public ASTNode visitPicIntCount(PicIntCountContext ctx) {
    String nineText = ctx.INTONE(0).getText();
    if (!nineText.matches("9")) System.out.println("No 9! Not according to specification!");

    int count = 0;
    if (ctx.INT() != null) {
      // System.out.println("We have a two digit int");
      count = Integer.parseInt(ctx.INT().getText());
    } else {
      // System.out.println("We have a one digit int");
      count = Integer.parseInt(ctx.INTONE(1).getText());
    }
    NineNode a = new NineNode();
    a.setCount(count);
    return a;
  }