This class was generated automatically by javacc, do not edit.
+ *Parse Java 1.5 source code and creates Abstract Syntax Tree classes.
+ *Note: To use this parser asynchronously, disable de parser cache
+ * by calling the method {@link setCacheParser} with false
+ * as argument.
false.
+ * By default, the cache is enabled.
+ * @param value false to disable the parser instance cache.
+ */
+ public static void setCacheParser(boolean value) {
+ cacheParser = value;
+ if(!value) {
+ parser = null;
+ }
+ }
+
+ /**
+ * Parses the Java code contained in the {@link InputStream} and returns
+ * a {@link CompilationUnit} that represents it.
+ * @param in {@link InputStream} containing Java source code
+ * @param encoding encoding of the source code
+ * @return CompilationUnit representing the Java source code
+ * @throws ParseException if the source code has parser errors
+ */
+ public static CompilationUnit parse(InputStream in, String encoding) throws ParseException {
+ if(cacheParser) {
+ if (parser == null) {
+ parser = new JavaParser(in, encoding);
+ } else {
+ parser.reset(in, encoding);
+ }
+ return parser.CompilationUnit();
+ }
+ return new JavaParser(in, encoding).CompilationUnit();
+ }
+
+ /**
+ * Parses the Java code contained in the {@link InputStream} and returns
+ * a {@link CompilationUnit} that represents it.
+ * @param in {@link InputStream} containing Java source code
+ * @return CompilationUnit representing the Java source code
+ * @throws ParseException if the source code has parser errors
+ */
+ public static CompilationUnit parse(InputStream in) throws ParseException {
+ return parse(in, null);
+ }
+
+ /**
+ * Parses the Java code contained in a {@link File} and returns
+ * a {@link CompilationUnit} that represents it.
+ * @param file {@link File} containing Java source code
+ * @param encoding encoding of the source code
+ * @return CompilationUnit representing the Java source code
+ * @throws ParseException if the source code has parser errors
+ */
+ public static CompilationUnit parse(File file, String encoding) throws ParseException {
+ try {
+ FileInputStream in = new FileInputStream(file);
+ try {
+ return parse(in, encoding);
+ } finally {
+ in.close();
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Parses the Java code contained in a {@link File} and returns
+ * a {@link CompilationUnit} that represents it.
+ * @param file {@link File} containing Java source code
+ * @return CompilationUnit representing the Java source code
+ * @throws ParseException if the source code has parser errors
+ */
+ public static CompilationUnit parse(File file) throws ParseException {
+ return parse(file, null);
+ }
+
+ private void reset(InputStream in, String encoding) {
+ ReInit(in, encoding);
+ token_source.clearComments();
+ }
+
+ private List add(List list, Object obj) {
+ if (list == null) {
+ list = new LinkedList();
+ }
+ list.add(obj);
+ return list;
+ }
+
+ private class Modifier {
+
+ final int modifiers;
+ final List annotations;
+
+ public Modifier(int modifiers, List annotations) {
+ this.modifiers = modifiers;
+ this.annotations = annotations;
+ }
+
+ }
+
+ private void pushJavadoc() {
+ token_source.pushJavadoc();
+ }
+
+ private JavadocComment popJavadoc() {
+ return token_source.popJavadoc();
+ }
+
+ ListAST node that represent block comments.
+ * + * Block comments can has multi lines and are delimited + * by "/*" and "*/". + * + * @author Julio Vilmar Gesser + */ +public class BlockComment extends Comment { + + public BlockComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { + super(beginLine, beginColumn, endLine, endColumn, content); + } + + @Override + public void accept(VoidVisitor v, A arg) { + v.visit(this, arg); + } + + @Override + publicThis class represents the entire compilation unit. Each java + * file denotes a compilation unit.
+ * + * The CompilationUnit is constructed following the syntax:
+ *
+ *
+ * CompilationUnit
+ * ::=
+ *
+ * ( {@link PackageDeclaration} )?
+ * ( {@link ImportDeclaration} )*
+ * ( {@link TypeDeclaration} )*
+ *
+ *
+ *
+ *
+ *
+ * @author Julio Vilmar Gesser
+ */
+public final class CompilationUnit extends Node {
+
+ private final PackageDeclaration pakage;
+
+ private final Listnull is returned.
+ * @return the package declaration or null
+ */
+ public PackageDeclaration getPakage() {
+ return pakage;
+ }
+
+ /**
+ * Retrieves the list of imports declared in this compilation unit or
+ * null if there is no import.
+ * @return the list of imports or null if there is no import
+ */
+ public Listnull is returned.
+ * @return the list of types or null null if there is no type
+ * @see AnnotationDeclaration
+ * @see ClassOrInterfaceDeclaration
+ * @see EmptyTypeDeclaration
+ * @see EnumDeclaration
+ */
+ public Listnull is returned.
+ * @return list with all comments of this compilation unit of null
+ * @see JavadocComment
+ * @see LineComment
+ * @see BlockComment
+ */
+ public ListThis class represents a import declaration. Imports are + * optional for the {@link CompilationUnit}.
+ * + * The ImportDeclaration is constructed following the syntax:
+ *
+ *
+ * ImportDeclaration
+ * ::=
+ *
+ * "import" ( "static" )? {@link NameExpr} ( "." "*" )? ";"
+ *
+ *
+ *
+ *
+ *
+ * @author Julio Vilmar Gesser
+ */
+public final class ImportDeclaration extends Node {
+
+ private final NameExpr name;
+
+ private final boolean isStatic;
+
+ private final boolean isAsterisk;
+
+ public ImportDeclaration(int line, int column, NameExpr name, boolean isStatic, boolean isAsterisk) {
+ super(line, column);
+ this.name = name;
+ this.isStatic = isStatic;
+ this.isAsterisk = isAsterisk;
+ }
+
+ /**
+ * Retrieves the name of the import.
+ * @return the name of the import
+ */
+ public NameExpr getName() {
+ return name;
+ }
+
+ /**
+ * Return if the import is static.
+ * @return true if the import is static, false otherwise
+ */
+ public boolean isStatic() {
+ return isStatic;
+ }
+
+ /**
+ * Return if the import ends with "*".
+ * @return true if the import ends with "*", false otherwise
+ */
+ public boolean isAsterisk() {
+ return isAsterisk;
+ }
+
+ @Override
+ public void accept(VoidVisitor v, A arg) {
+ v.visit(this, arg);
+ }
+
+ @Override
+ public AST node that represent line comments.
+ * + * Line comments are started with "//" and finish at + * the end of the line ("\n"). + * + * @author Julio Vilmar Gesser + */ +public class LineComment extends Comment { + + public LineComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { + super(beginLine, beginColumn, endLine, endColumn, content); + } + + @Override + public void accept(VoidVisitor v, A arg) { + v.visit(this, arg); + } + + @Override + publicThis class represents the package declaration. The package + * declaration is optional for the {@link CompilationUnit}.
+ * + * The PackageDeclaration is constructed following the syntax:
+ *
+ *
+ * PackageDeclaration
+ * ::=
+ *
+ * ( {@link AnnotationExpr} )* "package" {@link NameExpr} ) ";"
+ *
+ *
+ *
+ *
+ *
+ * @author Julio Vilmar Gesser
+ */
+public final class PackageDeclaration extends Node {
+
+ private final Listnull if there are no annotations.
+ * @return list of annotations or null
+ */
+ public ListThis class represents the declaration of a genetics argument.
+ * + * The TypeParameter is constructed following the syntax:
+ *
+ *
+ * TypeParameter
+ * ::=
+ *
+ * <IDENTIFIER> ( "extends" {@link ClassOrInterfaceType} ( "&" {@link ClassOrInterfaceType} )* )?
+ *
+ *
+ *
+ *
+ *
+ * @author Julio Vilmar Gesser
+ */
+public final class TypeParameter extends Node {
+
+ private final String name;
+
+ private final Listnull null if there are no type.
+ * @return list of types that this paramente extends or null
+ */
+ public List