コード例 #1
0
 public boolean visit(FSTNonTerminal nonTerminal) {
   if (nonTerminal.getType().equals("CompilationUnit")) {
     printFeatures(nonTerminal, true);
     {
       FSTNode v = getChild(nonTerminal, "LayerDeclaration");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "PackageDeclaration");
       if (v != null) {
         v.accept(this);
       }
     }
     for (FSTNode v : getChildren(nonTerminal, "ImportDeclaration")) {
       v.accept(this);
     }
     for (FSTNode v : getChildren(nonTerminal, "TypeDeclaration")) {
       v.accept(this);
     }
     printFeatures(nonTerminal, false);
     return false;
   }
   if (nonTerminal.getType().equals("AnnotationTypeDeclaration")) {
     printFeatures(nonTerminal, true);
     {
       FSTNode v = getChild(nonTerminal, "Modifiers");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("@");
     printToken("interface");
     {
       FSTNode v = getChild(nonTerminal, "Id");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("{");
     for (FSTNode v : getChildren(nonTerminal, "AnnotationTypeMemberDeclaration")) {
       v.accept(this);
     }
     printToken("}");
     printFeatures(nonTerminal, false);
     return false;
   }
   if (nonTerminal.getType().equals("ClassDeclaration")) {
     printFeatures(nonTerminal, true);
     {
       FSTNode v = getChild(nonTerminal, "Modifiers");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ClassOrInterface");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "Id");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "TypeParameters");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ExtendsList");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ImplementsList");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("{");
     hintIncIndent();
     hintNewLine();
     for (FSTNode v : getChildren(nonTerminal, "ClassOrInterfaceBodyDeclaration")) {
       v.accept(this);
       hintNewLine();
       hintNewLine();
     }
     hintDecIndent();
     hintNewLine();
     printToken("}");
     printFeatures(nonTerminal, false);
     return false;
   }
   if (nonTerminal.getType().equals("EnumDecl")) {
     printFeatures(nonTerminal, true);
     Iterator<FSTNode> listElements = getChildren(nonTerminal, "EnumConstant").iterator();
     {
       FSTNode v = getChild(nonTerminal, "Modifiers");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("enum");
     {
       FSTNode v = getChild(nonTerminal, "Id");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ImplementsList");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("{");
     if (listElements.hasNext()) {
       listElements.next().accept(this);
     }
     while (listElements.hasNext()) {
       printToken(",");
       listElements.next().accept(this);
     }
     {
       FSTNode v = getChild(nonTerminal, "EnumBodyInternal");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("}");
     printFeatures(nonTerminal, false);
     return false;
   }
   if (nonTerminal.getType().equals("EnumBodyInternal")) {
     printFeatures(nonTerminal, true);
     printToken(";");
     for (FSTNode v : getChildren(nonTerminal, "ClassOrInterfaceBodyDeclaration")) {
       v.accept(this);
     }
     printFeatures(nonTerminal, false);
     return false;
   }
   if (nonTerminal.getType().equals("InnerClassDecl")) {
     printFeatures(nonTerminal, true);
     {
       FSTNode v = getChild(nonTerminal, "Modifiers");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ClassOrInterface");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "Id");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "TypeParameters");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ExtendsList");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ImplementsList");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("{");
     hintIncIndent();
     hintNewLine();
     for (FSTNode v : getChildren(nonTerminal, "ClassOrInterfaceBodyDeclaration")) {
       v.accept(this);
       hintNewLine();
       hintNewLine();
     }
     hintDecIndent();
     hintNewLine();
     printToken("}");
     printFeatures(nonTerminal, false);
     return false;
   }
   if (nonTerminal.getType().equals("InnerEnumDecl")) {
     printFeatures(nonTerminal, true);
     Iterator<FSTNode> listElements = getChildren(nonTerminal, "EnumConstant").iterator();
     {
       FSTNode v = getChild(nonTerminal, "Modifiers");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("enum");
     {
       FSTNode v = getChild(nonTerminal, "Id");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ImplementsList");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("{");
     if (listElements.hasNext()) {
       listElements.next().accept(this);
     }
     while (listElements.hasNext()) {
       printToken(",");
       listElements.next().accept(this);
     }
     {
       FSTNode v = getChild(nonTerminal, "EnumBodyInternal");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("}");
     printFeatures(nonTerminal, false);
     return false;
   }
   if (nonTerminal.getType().equals("AnnotationInnerAnnotation")) {
     printFeatures(nonTerminal, true);
     {
       FSTNode v = getChild(nonTerminal, "Modifiers");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("@");
     printToken("interface");
     {
       FSTNode v = getChild(nonTerminal, "Id");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("{");
     for (FSTNode v : getChildren(nonTerminal, "AnnotationTypeMemberDeclaration")) {
       v.accept(this);
     }
     printToken("}");
     printFeatures(nonTerminal, false);
     return false;
   }
   if (nonTerminal.getType().equals("AnnotationInnerClass")) {
     printFeatures(nonTerminal, true);
     {
       FSTNode v = getChild(nonTerminal, "Modifiers");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ClassOrInterface");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "Id");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "TypeParameters");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ExtendsList");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ImplementsList");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("{");
     hintIncIndent();
     hintNewLine();
     for (FSTNode v : getChildren(nonTerminal, "ClassOrInterfaceBodyDeclaration")) {
       v.accept(this);
       hintNewLine();
       hintNewLine();
     }
     hintDecIndent();
     hintNewLine();
     printToken("}");
     printFeatures(nonTerminal, false);
     return false;
   }
   if (nonTerminal.getType().equals("AnnotationInnerEnum")) {
     printFeatures(nonTerminal, true);
     Iterator<FSTNode> listElements = getChildren(nonTerminal, "EnumConstant").iterator();
     {
       FSTNode v = getChild(nonTerminal, "Modifiers");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("enum");
     {
       FSTNode v = getChild(nonTerminal, "Id");
       if (v != null) {
         v.accept(this);
       }
     }
     {
       FSTNode v = getChild(nonTerminal, "ImplementsList");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("{");
     if (listElements.hasNext()) {
       listElements.next().accept(this);
     }
     while (listElements.hasNext()) {
       printToken(",");
       listElements.next().accept(this);
     }
     {
       FSTNode v = getChild(nonTerminal, "EnumBodyInternal");
       if (v != null) {
         v.accept(this);
       }
     }
     printToken("}");
     printFeatures(nonTerminal, false);
     return false;
   }
   throw new RuntimeException("Unknown Non Terminal in FST " + nonTerminal);
 }