Package japa.parser.ast

Examples of japa.parser.ast.CompilationUnit.accept()


        @Override
        public void visit(Parameter p, Object arg) {
          ret.add(p);
        }
      };
      cu.accept(visitor, null);
    } catch (ParseException e) {
      throw new RuntimeException(
          "the line does not seem to be a valid param list declaration: "
              + line);
    }
View Full Code Here


    if (line.startsWith("(")){
      // perhaps it's in the form of (...)
      String cl = String.format(classTempForArgsNoParenthesis, line);
      try {
        CompilationUnit cu = parse(cl);
        cu.accept(visitor, null);
        return ret;
      } catch (ParseException e) {
        // perhaps not really (...). fall through
      }
    }
View Full Code Here

    }
   
    String cl = String.format(classTempForArgs, line);
    try {
      CompilationUnit cu = parse(cl);
      cu.accept(visitor, null);
    } catch (ParseException e) {
      throw new RuntimeException(
          "the line does not seem to be a valid arg list: " + line);
    }
    return ret;
View Full Code Here

                hasUnNamed = true;
              }
            }
        }
      };
      cu.accept(visitor, null);
    } catch (ParseException e) {
      throw new RuntimeException(
          "the line does not seem to be a valid arg list: " + line
              + ". ");
    }
View Full Code Here

    String classString = String.format(classTempForMeth, line);
    try {
      CompilationUnit cu = parse(classString);
      VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
      };
      cu.accept(visitor, null);
    } catch (ParseException e) {
      throw new RuntimeException(
          "the line does not seem to be a valid method declaration: "
              + line + ". Was expecting something like foo(int a, String b).");
    }
View Full Code Here

          nodes.add(new CodeNode(nested++, n)); super.visit(n, arg); nested--;
        }
       
      };
      cu.accept(visitor, null);
      return nodes;
    } catch (ParseException e) {
      throw new RuntimeException(
          "invalid Java code: " + code + ". " + e);
    }
View Full Code Here

        @Override
        public void visit(Parameter p, Object arg) {
          ret.add(p);
        }
      };
      cu.accept(visitor, null);
    } catch (ParseException e) {
      throw new RuntimeException("the line does not seem to be a valid param declaration list: " + line);
    }
    return ret;
  }
View Full Code Here

            for (Expression e : args) {
              ret.add(e.toString());
            }
        }
      };
      cu.accept(visitor, null);
    } catch (ParseException e) {
      throw new RuntimeException("the line does not seem to be a valid arg list: " + line);
    }
    return ret;
  }
View Full Code Here

      is.close();
    }

    MethodParametersVisitor visitor = new MethodParametersVisitor();

    cu.accept(visitor, cache);

  }
}
View Full Code Here

         is = javaFileFinder.openJavaFile(methodOrConstructor);
         if (is != null) {
            // visit .java file using our custom GenericVisitorAdapter
            CompilationUnit cu = JavaParser.parse(is);
            MethodParametersVisitor visitor = new MethodParametersVisitor();
            cu.accept(visitor, cache);
         }
      } catch (Exception e) {
         throw new ParameterNamesNotFoundException(
                  "Error while trying to read parameter names from the Java file which contains the declaration of "
                           + methodOrConstructor.toString(), e);
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.