null.
+ *
+ * @param method
+ * method
+ * @param parameter
+ * parameter
+ */
+ public static void addParameter(MethodDeclaration method, Parameter parameter) {
+ Listnull.
+ *
+ * @param call
+ * method call
+ * @param arg
+ * argument value
+ */
+ public static void addArgument(MethodCallExpr call, Expression arg) {
+ Listnull.
+ *
+ * @param cu
+ * compilation unit
+ * @param type
+ * type declaration
+ */
+ public static void addTypeDeclaration(CompilationUnit cu, TypeDeclaration type) {
+ List0 if is not a array.
+ * @return instanceof {@link ReferenceType}
+ */
+ public static ReferenceType createReferenceType(String name, int arrayCount) {
+ return new ReferenceType(new ClassOrInterfaceType(name), arrayCount);
+ }
+
+ /**
+ * Creates a new {@link ReferenceType} for the given primitive type.
+ *
+ * @param type
+ * primitive type
+ * @param arrayCount
+ * number os arrays or 0 if is not a array.
+ * @return instanceof {@link ReferenceType}
+ */
+ public static ReferenceType createReferenceType(PrimitiveType type, int arrayCount) {
+ return new ReferenceType(type, arrayCount);
+ }
+
+ /**
+ * Adds the given statement to the specified block. The list of statements
+ * will be initialized if it is null.
+ *
+ * @param block
+ * @param stmt
+ */
+ public static void addStmt(BlockStmt block, Statement stmt) {
+ Listnull.
+ *
+ * @param block
+ * @param stmt
+ */
+ public static void addStmt(BlockStmt block, Expression expr) {
+ addStmt(block, new ExpressionStmt(expr));
+ }
+
+ /**
+ * Adds the given declaration to the specified type. The list of members
+ * will be initialized if it is null.
+ *
+ * @param type
+ * type declaration
+ * @param decl
+ * member declaration
+ */
+ public static void addMember(TypeDeclaration type, BodyDeclaration decl) {
+ ListThis class was generated automatically by javacc, do not edit.
+ * @author Júlio Vilmar Gesser + */ +final class ASTParser implements ASTParserConstants { + + 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 List add(int pos, List list, Object obj) { + if (list == null) { + list = new LinkedList(); + } + list.add(pos, obj); + return list; + } + + private class Modifier { + + final int modifiers; + final List annotations; + final int beginLine; + final int beginColumn; + + public Modifier(int beginLine, int beginColumn, int modifiers, List annotations) { + this.beginLine = beginLine; + this.beginColumn = beginColumn; + this.modifiers = modifiers; + this.annotations = annotations; + } + } + + public int addModifier(int modifiers, int mod, Token token) throws ParseException { + if ((ModifierSet.hasModifier(modifiers, mod))) { + throwParseException(token, "Duplicated modifier"); + } + return ModifierSet.addModifier(modifiers, mod); + } + + private void pushJavadoc() { + token_source.pushJavadoc(); + } + + private JavadocComment popJavadoc() { + return token_source.popJavadoc(); + } + + private ListThis 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 ASTParser(in, encoding);
+ } else {
+ parser.reset(in, encoding);
+ }
+ return parser.CompilationUnit();
+ }
+ return new ASTParser(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
+ * @throws IOException
+ */
+ public static CompilationUnit parse(File file, String encoding) throws ParseException, IOException {
+ FileInputStream in = new FileInputStream(file);
+ try {
+ return parse(in, encoding);
+ } finally {
+ in.close();
+ }
+ }
+
+ /**
+ * 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
+ * @throws IOException
+ */
+ public static CompilationUnit parse(File file) throws ParseException, IOException {
+ return parse(file, null);
+ }
+}
diff --git a/parser/html/java/javaparser/src/japa/parser/ParseException.java b/parser/html/java/javaparser/src/japa/parser/ParseException.java
new file mode 100644
index 0000000000..958ce191d3
--- /dev/null
+++ b/parser/html/java/javaparser/src/japa/parser/ParseException.java
@@ -0,0 +1,216 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 4.1 */
+/* JavaCCOptions:KEEP_LINE_COL=null */
+/*
+ * Copyright (C) 2008 Júlio Vilmar Gesser.
+ *
+ * This file is part of Java 1.5 parser and Abstract Syntax Tree.
+ *
+ * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Java 1.5 parser and Abstract Syntax Tree. If not, see + * AST node that represent block comments. + *
+ * Block comments can has multi lines and are delimited by "/*" and + * "*/". + * + * @author Julio Vilmar Gesser + */ +public final class BlockComment extends Comment { + + public BlockComment() { + } + + public BlockComment(String content) { + super(content); + } + + public BlockComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { + super(beginLine, beginColumn, endLine, endColumn, content); + } + + @Override + public+ * This 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 PackageDeclaration pakage;
+
+ private Listnull is returned.
+ *
+ * @return list with all comments of this compilation unit or
+ * null
+ * @see JavadocComment
+ * @see LineComment
+ * @see BlockComment
+ */
+ public Listnull if there is no import.
+ *
+ * @return the list of imports or null if there is no import
+ */
+ public Listnull is returned.
+ *
+ * @return the package declaration or null
+ */
+ public PackageDeclaration getPackage() {
+ return pakage;
+ }
+
+ /**
+ * Return the list of types declared in this compilation unit.null 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.
+ *
+ * @param imports
+ * the list of imports
+ */
+ public void setImports(Listnull to default
+ * package
+ */
+ public void setPackage(PackageDeclaration pakage) {
+ this.pakage = pakage;
+ }
+
+ /**
+ * Sets the list of types declared in this compilation unit.
+ *
+ * @param types
+ * the lis of types
+ */
+ public void setTypes(List+ * This 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 NameExpr name;
+
+ private boolean static_;
+
+ private boolean asterisk;
+
+ public ImportDeclaration() {
+ }
+
+ public ImportDeclaration(NameExpr name, boolean isStatic, boolean isAsterisk) {
+ this.name = name;
+ this.static_ = isStatic;
+ this.asterisk = isAsterisk;
+ }
+
+ public ImportDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, NameExpr name, boolean isStatic, boolean isAsterisk) {
+ super(beginLine, beginColumn, endLine, endColumn);
+ this.name = name;
+ this.static_ = isStatic;
+ this.asterisk = isAsterisk;
+ }
+
+ @Override
+ public true if the import ends with "*", false
+ * otherwise
+ */
+ public boolean isAsterisk() {
+ return asterisk;
+ }
+
+ /**
+ * Return if the import is static.
+ *
+ * @return true if the import is static, false
+ * otherwise
+ */
+ public boolean isStatic() {
+ return static_;
+ }
+
+ /**
+ * Sets if this import is asterisk.
+ *
+ * @param asterisk
+ * true if this import is asterisk
+ */
+ public void setAsterisk(boolean asterisk) {
+ this.asterisk = asterisk;
+ }
+
+ /**
+ * Sets the name this import.
+ *
+ * @param name
+ * the name to set
+ */
+ public void setName(NameExpr name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets if this import is static.
+ *
+ * @param static_
+ * true if this import is static
+ */
+ public void setStatic(boolean static_) {
+ this.static_ = static_;
+ }
+
+}
diff --git a/parser/html/java/javaparser/src/japa/parser/ast/LineComment.java b/parser/html/java/javaparser/src/japa/parser/ast/LineComment.java
new file mode 100644
index 0000000000..18edd8ea75
--- /dev/null
+++ b/parser/html/java/javaparser/src/japa/parser/ast/LineComment.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007 Júlio Vilmar Gesser.
+ *
+ * This file is part of Java 1.5 parser and Abstract Syntax Tree.
+ *
+ * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Java 1.5 parser and Abstract Syntax Tree. If not, see + * 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 final class LineComment extends Comment { + + public LineComment() { + } + + public LineComment(String content) { + super(content); + } + + public LineComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { + super(beginLine, beginColumn, endLine, endColumn, content); + } + + @Override + public+ * This 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 Listnull if there are no annotations.
+ *
+ * @return list of annotations or null
+ */
+ public List+ * This 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 String name;
+
+ private Listnull null if there are no type.
+ *
+ * @return list of types that this paramente extends or null
+ */
+ public List