예제 #1
0
  private void printConstructorParameter(NChoice g) {
    if (g.isList()) out.print("list" + g.getChoiceIdx() + ", ");
    g.accept(
        new NVisitor() {
          public boolean visit(NNonTerminal t) {
            return visitA(t);
          }

          public boolean visit(NValue t) {
            return visitA(t);
          }

          public boolean visit(NTextOnly t) {
            if (t.type != Type.ONE) return visitA(t);
            return true;
          }

          public boolean visitA(NAbstractValue t) {
            if (t.isListElement()) return false;
            out.print(t.genVariableName());
            out.print(", ");
            return true;
          }
        });
  }
예제 #2
0
  @Override
  public void postVisit(NChoice g) {
    out.print("\n\t{return new " + g.genClassname() + "(");
    printConstructorParameter(g);
    out.print("firstToken.next,token);}");

    if (g.getParent().getChoices().indexOf(g) != g.getParent().getChoices().size() - 1)
      out.print(" |");
    super.postVisit(g);
  }