| 1 | /* |
|---|---|
| 2 | * Copyright (C) 2007-2010 JĂșlio Vilmar Gesser. |
| 3 | * Copyright (C) 2011, 2013-2020 The JavaParser Team. |
| 4 | * |
| 5 | * This file is part of JavaParser. |
| 6 | * |
| 7 | * JavaParser can be used either under the terms of |
| 8 | * a) the GNU Lesser General Public License as published by |
| 9 | * the Free Software Foundation, either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * b) the terms of the Apache License |
| 12 | * |
| 13 | * You should have received a copy of both licenses in LICENCE.LGPL and |
| 14 | * LICENCE.APACHE. Please refer to those files for details. |
| 15 | * |
| 16 | * JavaParser is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU Lesser General Public License for more details. |
| 20 | */ |
| 21 | |
| 22 | package com.github.javaparser; |
| 23 | |
| 24 | import com.github.javaparser.ast.CompilationUnit; |
| 25 | import com.github.javaparser.ast.ImportDeclaration; |
| 26 | import com.github.javaparser.ast.PackageDeclaration; |
| 27 | import com.github.javaparser.ast.body.BodyDeclaration; |
| 28 | import com.github.javaparser.ast.body.MethodDeclaration; |
| 29 | import com.github.javaparser.ast.body.Parameter; |
| 30 | import com.github.javaparser.ast.body.TypeDeclaration; |
| 31 | import com.github.javaparser.ast.expr.*; |
| 32 | import com.github.javaparser.ast.modules.ModuleDeclaration; |
| 33 | import com.github.javaparser.ast.modules.ModuleDirective; |
| 34 | import com.github.javaparser.ast.stmt.BlockStmt; |
| 35 | import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; |
| 36 | import com.github.javaparser.ast.stmt.Statement; |
| 37 | import com.github.javaparser.ast.type.ClassOrInterfaceType; |
| 38 | import com.github.javaparser.ast.type.Type; |
| 39 | import com.github.javaparser.ast.type.TypeParameter; |
| 40 | |
| 41 | /** |
| 42 | * The start production for JavaParser. |
| 43 | * Tells JavaParser what piece of Java code it can expect. |
| 44 | * For example, |
| 45 | * COMPILATION_UNIT indicates a complete Java file, |
| 46 | * and CLASS_BODY would indicate the part of a class that is within { and }. |
| 47 | * |
| 48 | * @see JavaParser#parse(ParseStart, Provider) |
| 49 | */ |
| 50 | @FunctionalInterface |
| 51 | public interface ParseStart<R> { |
| 52 | ParseStart<CompilationUnit> COMPILATION_UNIT = GeneratedJavaParser::CompilationUnit; |
| 53 | ParseStart<BlockStmt> BLOCK = GeneratedJavaParser::BlockParseStart; |
| 54 | ParseStart<Statement> STATEMENT = GeneratedJavaParser::BlockStatementParseStart; |
| 55 | ParseStart<ImportDeclaration> IMPORT_DECLARATION = GeneratedJavaParser::ImportDeclarationParseStart; |
| 56 | ParseStart<Expression> EXPRESSION = GeneratedJavaParser::ExpressionParseStart; |
| 57 | ParseStart<AnnotationExpr> ANNOTATION = GeneratedJavaParser::AnnotationParseStart; |
| 58 | ParseStart<BodyDeclaration<?>> ANNOTATION_BODY = GeneratedJavaParser::AnnotationBodyDeclarationParseStart; |
| 59 | ParseStart<BodyDeclaration<?>> CLASS_BODY = GeneratedJavaParser::ClassOrInterfaceBodyDeclarationParseStart; |
| 60 | ParseStart<ClassOrInterfaceType> CLASS_OR_INTERFACE_TYPE = GeneratedJavaParser::ClassOrInterfaceTypeParseStart; |
| 61 | ParseStart<Type> TYPE = GeneratedJavaParser::ResultTypeParseStart; |
| 62 | ParseStart<TypeParameter> TYPE_PARAMETER = GeneratedJavaParser::TypeParameterParseStart; |
| 63 | ParseStart<VariableDeclarationExpr> VARIABLE_DECLARATION_EXPR = GeneratedJavaParser::VariableDeclarationExpressionParseStart; |
| 64 | ParseStart<ExplicitConstructorInvocationStmt> EXPLICIT_CONSTRUCTOR_INVOCATION_STMT = GeneratedJavaParser::ExplicitConstructorInvocationParseStart; |
| 65 | ParseStart<Name> NAME = GeneratedJavaParser::NameParseStart; |
| 66 | ParseStart<SimpleName> SIMPLE_NAME = GeneratedJavaParser::SimpleNameParseStart; |
| 67 | ParseStart<Parameter> PARAMETER = GeneratedJavaParser::ParameterParseStart; |
| 68 | ParseStart<PackageDeclaration> PACKAGE_DECLARATION = GeneratedJavaParser::PackageDeclarationParseStart; |
| 69 | ParseStart<TypeDeclaration<?>> TYPE_DECLARATION = GeneratedJavaParser::TypeDeclarationParseStart; |
| 70 | ParseStart<ModuleDeclaration> MODULE_DECLARATION = GeneratedJavaParser::ModuleDeclarationParseStart; |
| 71 | ParseStart<ModuleDirective> MODULE_DIRECTIVE = GeneratedJavaParser::ModuleDirectiveParseStart; |
| 72 | ParseStart<MethodDeclaration> METHOD_DECLARATION = GeneratedJavaParser::MethodDeclarationParseStart; |
| 73 | |
| 74 | R parse(GeneratedJavaParser parser) throws ParseException; |
| 75 | } |
| 76 |
Members