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

    }

    @When("the CompilationUnit is visited by the PositionTestVisitor")
    public void whenTheCompilationUnitIsVisitedByThePositionTestVisitor() {
        CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
        compilationUnit.accept(positionTestVisitor, null);
    }

    @Then("the collected variable name is \"$nameUnderTest\"")
    public void thenTheCollectedVariableNameIs(String nameUnderTest) {
        assertThat(collectedVariableName.get(), is(nameUnderTest));
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.