Package lombok.ast.grammar

Examples of lombok.ast.grammar.Source


   
    if (verbose && !saveIntermediate) {
      System.out.printf("Processing: %s to %s\n", in.getCanonicalPath(), out == null ? "sysout" : out.getCanonicalPath());
    }
   
    Source source = new Source(Files.toString(in, charset), in.getCanonicalPath());
    Object transfer = null;
    String chain = "/";
   
    try {
      for (Operation<Object, Object> programElem : program) {
View Full Code Here


   * </ul>
   *
   * Note that neither annotation method declarations nor enum constants will be parsed properly by this method.
   */
  public static TypeMember parseMember(String source) throws AstException {
    Source s = new Source(source, "memberSnippet");
    s.parseMember();
    return process(s, "type member", TypeMember.class);
  }
View Full Code Here

    s.parseMember();
    return process(s, "type member", TypeMember.class);
  }
 
  public static MethodDeclaration parseMethod(String source) throws AstException {
    Source s = new Source(source, "methodSnippet");
    s.parseMember();
    return process(s, "method", MethodDeclaration.class);
  }
View Full Code Here

    s.parseMember();
    return process(s, "method", MethodDeclaration.class);
  }
 
  public static ConstructorDeclaration parseConstructor(String source) throws AstException {
    Source s = new Source(source, "constructorSnippet");
    s.parseMember();
    return process(s, "constructor", ConstructorDeclaration.class);
  }
View Full Code Here

    s.parseMember();
    return process(s, "constructor", ConstructorDeclaration.class);
  }
 
  public static VariableDeclaration parseField(String source) throws AstException {
    Source s = new Source(source, "fieldSnippet");
    s.parseMember();
    return process(s, "field", VariableDeclaration.class);
  }
View Full Code Here

    s.parseMember();
    return process(s, "field", VariableDeclaration.class);
  }
 
  public static VariableDefinition parseVariableDefinition(String source) throws AstException {
    Source s = new Source(source, "vardefSnippet");
    s.parseMember();
    return process(s, "vardef", VariableDefinition.class);
  }
View Full Code Here

    s.parseMember();
    return process(s, "vardef", VariableDefinition.class);
  }
 
  public static Statement parseStatement(String source) throws AstException {
    Source s = new Source(source, "statementSnippet");
    s.parseStatement();
    return process(s, "statement", Statement.class);
  }
View Full Code Here

    s.parseStatement();
    return process(s, "statement", Statement.class);
  }
 
  public static Expression parseExpression(String source) throws AstException {
    Source s = new Source(source, "expressionSnippet");
    s.parseExpression();
    return process(s, "expression", Expression.class);
  }
View Full Code Here

public class LombokParser implements IJavaParser {

    @Override
    public Node parseJava(@NonNull JavaContext context) {
        try {
            Source source = new Source(context.getContents(), context.file.getName());
            List<Node> nodes = source.getNodes();

            // Don't analyze files containing errors
            List<ParseProblem> problems = source.getProblems();
            if (problems != null && !problems.isEmpty()) {
                context.getDriver().setHasParserErrors(true);

                /* Silently ignore the errors. There are still some bugs in Lombok/Parboiled
                 * (triggered if you run lint on the AOSP framework directory for example),
View Full Code Here

      "}\n";
 
  @Test
  public void testBasicTypesMatch() {
    final AtomicInteger hit = new AtomicInteger();
    Source s = new Source(SIMPLE_SOURCE, "SimpleTypesMatchTest.java");
    s.parseCompilationUnit();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertTrue("typesMatch with star import should match but fails:" + node.astReturnTypeReference(),
            new Resolver().typesMatch("java.util.List", node.astReturnTypeReference()));
        assertFalse("typesMatch with no relevant imports should fail but matches",
            new Resolver().typesMatch("java.awt.List", node.astReturnTypeReference()));
View Full Code Here

TOP

Related Classes of lombok.ast.grammar.Source

Copyright © 2018 www.massapicom. 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.