public final class JavaParser extends Object
This class was generated automatically by javacc, do not edit.
Parse Java 1.5 source code and creates Abstract Syntax Tree classes.
Modifier and Type | Method and Description |
---|---|
static boolean |
getDoNotAssignCommentsPreceedingEmptyLines() |
static boolean |
getDoNotConsiderAnnotationsAsNodeStartForCodeAttribution() |
static CompilationUnit |
parse(File file)
Parses the Java code contained in a
File and returns a
CompilationUnit that represents it. |
static CompilationUnit |
parse(File file,
String encoding) |
static CompilationUnit |
parse(File file,
String encoding,
boolean considerComments)
Parses the Java code contained in a
File and returns a
CompilationUnit that represents it. |
static CompilationUnit |
parse(InputStream in)
Parses the Java code contained in the
InputStream and returns a
CompilationUnit that represents it. |
static CompilationUnit |
parse(InputStream in,
String encoding) |
static CompilationUnit |
parse(InputStream in,
String encoding,
boolean considerComments)
Parses the Java code contained in the
InputStream and returns a
CompilationUnit that represents it. |
static CompilationUnit |
parse(Reader reader,
boolean considerComments) |
static AnnotationExpr |
parseAnnotation(String annotation)
Parses the Java annotation contained in a
String and returns a
AnnotationExpr that represents it. |
static BlockStmt |
parseBlock(String blockStatement)
|
static BodyDeclaration |
parseBodyDeclaration(String body)
Parses the Java body declaration(e.g fields or methods) contained in a
String and returns a BodyDeclaration that represents it. |
static Expression |
parseExpression(String expression)
Parses the Java expression contained in a
String and returns a
Expression that represents it. |
static ImportDeclaration |
parseImport(String importDeclaration)
Parses the Java import contained in a
String and returns a
ImportDeclaration that represents it. |
static Statement |
parseStatement(String statement)
|
static void |
setDoNotAssignCommentsPreceedingEmptyLines(boolean doNotAssignCommentsPreceedingEmptyLines) |
static void |
setDoNotConsiderAnnotationsAsNodeStartForCodeAttribution(boolean doNotConsiderAnnotationsAsNodeStartForCodeAttribution) |
public static boolean getDoNotConsiderAnnotationsAsNodeStartForCodeAttribution()
public static void setDoNotConsiderAnnotationsAsNodeStartForCodeAttribution(boolean doNotConsiderAnnotationsAsNodeStartForCodeAttribution)
public static boolean getDoNotAssignCommentsPreceedingEmptyLines()
public static void setDoNotAssignCommentsPreceedingEmptyLines(boolean doNotAssignCommentsPreceedingEmptyLines)
public static CompilationUnit parse(InputStream in, String encoding) throws ParseException
ParseException
public static CompilationUnit parse(InputStream in, String encoding, boolean considerComments) throws ParseException
InputStream
and returns a
CompilationUnit
that represents it.in
- InputStream
containing Java source codeencoding
- encoding of the source codeParseException
- if the source code has parser errorspublic static CompilationUnit parse(InputStream in) throws ParseException
InputStream
and returns a
CompilationUnit
that represents it.in
- InputStream
containing Java source codeParseException
- if the source code has parser errorspublic static CompilationUnit parse(File file, String encoding) throws ParseException, IOException
ParseException
IOException
public static CompilationUnit parse(File file, String encoding, boolean considerComments) throws ParseException, IOException
File
and returns a
CompilationUnit
that represents it.file
- File
containing Java source codeencoding
- encoding of the source codeParseException
- if the source code has parser errorsIOException
public static CompilationUnit parse(File file) throws ParseException, IOException
File
and returns a
CompilationUnit
that represents it.file
- File
containing Java source codeParseException
- if the source code has parser errorsIOException
public static CompilationUnit parse(Reader reader, boolean considerComments) throws ParseException
ParseException
public static BlockStmt parseBlock(String blockStatement) throws ParseException
blockStatement
- String
containing Java block codeParseException
- if the source code has parser errorspublic static Statement parseStatement(String statement) throws ParseException
statement
- String
containing Java statement codeParseException
- if the source code has parser errorspublic static ImportDeclaration parseImport(String importDeclaration) throws ParseException
String
and returns a
ImportDeclaration
that represents it.importDeclaration
- String
containing Java import codeParseException
- if the source code has parser errorspublic static Expression parseExpression(String expression) throws ParseException
String
and returns a
Expression
that represents it.expression
- String
containing Java expressionParseException
- if the source code has parser errorspublic static AnnotationExpr parseAnnotation(String annotation) throws ParseException
String
and returns a
AnnotationExpr
that represents it.annotation
- String
containing Java annotationParseException
- if the source code has parser errorspublic static BodyDeclaration parseBodyDeclaration(String body) throws ParseException
String
and returns a BodyDeclaration
that represents it.body
- String
containing Java body declarationParseException
- if the source code has parser errorsCopyright © 2007–2016. All rights reserved.