mirror of
https://github.com/roytam1/UXP.git
synced 2026-07-20 22:29:10 +00:00
Add the java javaparser
https://github.com/javaparser/javaparser/ Invisible tag: javaparser-1.0.6
This commit is contained in:
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
Binary file not shown.
@@ -0,0 +1,86 @@
|
||||
<project name="JavaParserBuilder" default="all">
|
||||
|
||||
<!-- current version -->
|
||||
<property name="version" value="1.0.6" />
|
||||
|
||||
<!-- package build properties -->
|
||||
<property name="source.dir" location="../" />
|
||||
<property name="temp.dir" value="${user.home}/Desktop/" />
|
||||
<property name="file.name" value="javaparser-${version}" />
|
||||
|
||||
<property name="src.file.name" value="${file.name}-src.zip" />
|
||||
<property name="bin.jar.name" value="${file.name}.jar" />
|
||||
<property name="bin.file.name" value="${file.name}.zip" />
|
||||
|
||||
<property name="src.temp.file" value="${temp.dir}/${src.file.name}" />
|
||||
<property name="bin.temp.file" value="${temp.dir}/${bin.file.name}" />
|
||||
<property name="bin.temp.jar" value="${temp.dir}/${bin.jar.name}" />
|
||||
|
||||
|
||||
<!-- googlecode properties -->
|
||||
<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" classpath="ant-googlecode-0.0.1.jar" name="gcupload" />
|
||||
<property name="googlecode.user" value="jgesser" />
|
||||
<!-- the file must have a property named "googlecode.password" -->
|
||||
<property file="../../JavaParser-ant/pass.txt" />
|
||||
<property name="googlecode.project" value="javaparser" />
|
||||
<property name="googlecode.file.summary.src" value="Java1.5 parser and AST release ${version} (source)" />
|
||||
<property name="googlecode.file.summary.bin" value="Java1.5 parser and AST release ${version} (binary)" />
|
||||
<property name="googlecode.file.labels.src" value="Featured, Type-Source, OpSys-All" />
|
||||
<property name="googlecode.file.labels.bin" value="Featured, Type-Archive, OpSys-All" />
|
||||
|
||||
<target name="build-src">
|
||||
<zip destfile="${src.temp.file}" level="9">
|
||||
<fileset dir="${source.dir}">
|
||||
<exclude name=".*" />
|
||||
<exclude name="bin/**" />
|
||||
<exclude name="ant/**" />
|
||||
<exclude name="test/ignore/**" />
|
||||
</fileset>
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<target name="build-bin">
|
||||
<jar destfile="${bin.temp.jar}">
|
||||
<fileset dir="${source.dir}/bin">
|
||||
<exclude name="TestRunner*.class" />
|
||||
<exclude name="**/test/**/*" />
|
||||
</fileset>
|
||||
</jar>
|
||||
|
||||
<zip destfile="${bin.temp.file}" level="9">
|
||||
<fileset dir="${source.dir}">
|
||||
<include name="COPYING" />
|
||||
<include name="COPYING.LESSER" />
|
||||
<include name="readme.txt" />
|
||||
</fileset>
|
||||
<fileset file="${bin.temp.jar}" />
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<target name="upload-src">
|
||||
<gcupload username="${googlecode.user}" password="${googlecode.password}" projectname="${googlecode.project}" filename="${src.temp.file}" targetfilename="${src.file.name}" summary="${googlecode.file.summary.src}" labels="${googlecode.file.labels.src}" />
|
||||
</target>
|
||||
|
||||
<target name="upload-bin">
|
||||
<gcupload username="${googlecode.user}" password="${googlecode.password}" projectname="${googlecode.project}" filename="${bin.temp.file}" targetfilename="${bin.file.name}" summary="${googlecode.file.summary.bin}" labels="${googlecode.file.labels.bin}" />
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete file="${src.temp.file}" failonerror="true" />
|
||||
<delete file="${bin.temp.file}" failonerror="true" />
|
||||
<delete file="${bin.temp.jar}" failonerror="true" />
|
||||
</target>
|
||||
|
||||
<target name="all" description="default">
|
||||
<antcall target="clean" />
|
||||
|
||||
<antcall target="build-src" />
|
||||
<antcall target="build-bin" />
|
||||
|
||||
<antcall target="upload-src" />
|
||||
<antcall target="upload-bin" />
|
||||
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,138 @@
|
||||
+-------------------------------------------------------------------------------+
|
||||
| Java 1.5 parser and Abstract Syntax Tree. |
|
||||
+-------------------------------------------------------------------------------+
|
||||
| Copyright (C) 2007 Júlio Vilmar Gesser |
|
||||
| jgesser@gmail.com |
|
||||
| http://code.google.com/p/javaparser/ |
|
||||
+-------------------------------------------------------------------------------+
|
||||
| This program 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. |
|
||||
| |
|
||||
| This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||
+-------------------------------------------------------------------------------+
|
||||
|
||||
This package contains a Java 1.5 Parser with AST generation and visitor support.
|
||||
The AST records the source code structure, javadoc and comments. Soon will be
|
||||
possible change the AST nodes or create new ones to modify source code like refactoring.
|
||||
This parser is based on Sreenivasa Viswanadha Java 1.5 parser.
|
||||
|
||||
Visit the project site, there you can get help, view some sample codes, report
|
||||
bugs and feature enhacement and download the latest version:
|
||||
http://code.google.com/p/javaparser/
|
||||
|
||||
|
||||
Version history
|
||||
---------------
|
||||
|
||||
1.0.6 (2009-01-11)
|
||||
- Issue 11 fixed: changed method get/setPakage to get/setPackage in the class CompilationUnit
|
||||
- Created new visitor adapter to help AST modification: ModifierVisitorAdapter
|
||||
- Changed visitor adapters to abstract
|
||||
|
||||
1.0.5 (2008-10-26)
|
||||
- Created simplified constructors in the nodes of the AST (without positional arguments)
|
||||
- Created ASTHelper class with some helpful methods (more methods are still needed)
|
||||
|
||||
1.0.4 (2008-10-07)
|
||||
- Moved to javacc 4.1.
|
||||
- The java_1_5.jj can be build alone without compilation errors
|
||||
|
||||
1.0.3 (2008-09-06)
|
||||
- Removed SuperMemberAccessExpr class, it was no longer used
|
||||
- Removed the methods get/setTypeArgs() from ArrayCreationExpr, this node shouldn't have these methods.
|
||||
- Fixed the bug with start/end position of the nodes IntegerLiteralMinValueExpr and LongLiteralMinValueExpr
|
||||
- The methods get/setAnnotations() from all BodyDeclaration subclasses were pushed down to BodyDeclaration class
|
||||
|
||||
1.0.2 (2008-07-20)
|
||||
Issue fixed: Issue 1: Add support for editing AST nodes or create new ones
|
||||
|
||||
1.0.1 (2008-07-01)
|
||||
- Issue fixed: Issue 5: end line and end column equal to begin line and begin column
|
||||
|
||||
1.0.0 (2008-06-25)
|
||||
- Changed version numbering, starting version 1.0.0
|
||||
- Javadoc done for packages:
|
||||
- japa.parser
|
||||
- japa.parser.ast
|
||||
- Corrected bug when parsing in multithread:
|
||||
- JavaParser.setCacheParser(false) must be called before to use the parser concurrent
|
||||
|
||||
2008-06-19
|
||||
- No code changes, added binary distribution to download page
|
||||
|
||||
2008-06-11
|
||||
- Bug corrected: NPE in VoidVisitorAdapter
|
||||
- http://code.google.com/p/javaparser/issues/detail?id=2
|
||||
|
||||
2008-06-09
|
||||
- Added Adapters for de visitors
|
||||
|
||||
2008-05-28
|
||||
- This project now is published at Google Code:
|
||||
- http://code.google.com/p/javaparser/
|
||||
|
||||
2008-05-25
|
||||
- Added support for comments and javadoc to the tree.
|
||||
- Javadocs are stored directly to members (BodyDeclaration and all deriveds (classes, methods, fields, etc.)), accessible by the method getJavadoc().
|
||||
- All comments are stored in the CompilationUnit, accessible by the method getComments().
|
||||
|
||||
2008-04-01
|
||||
- Changed all nodes public attributes to be private and created getters to access them
|
||||
- Changed the methods of the Node getLine e getColumn to getBeginLine and getBeginColumn
|
||||
- Added the methods getEndLine and getEndColumn to the Node class (works only in the BlockNode)
|
||||
|
||||
2007-12-22
|
||||
- Corrected ConditionalExpression bug
|
||||
|
||||
2007-10-21
|
||||
- Added LGPL License
|
||||
|
||||
2007-10-21
|
||||
- Bugs corrected:
|
||||
- Created PackageDeclaration member of CompilationUnit to add suport for annotations in the package declaration
|
||||
- Parameterized anonymous constructor invocation
|
||||
- Explicit constructor invotation Type Arguments
|
||||
- ctrl+z ("\u001A") ar end of compilation unit
|
||||
|
||||
2007-10-09
|
||||
- EnumConstantDeclaration annotation support corrected
|
||||
- Parssing Java Unicode escape characters suport added
|
||||
|
||||
2007-10-03
|
||||
- Bug corrected: "MotifComboPopup.this.super()" statement was generating parser error
|
||||
|
||||
2007-10-01
|
||||
- Bug corrected: Casting signed primitive values
|
||||
double d = (double) -1;
|
||||
^
|
||||
|
||||
2007-08-06
|
||||
- Bug with the ingle line comments in the final of the unit corrected
|
||||
|
||||
2007-07-31
|
||||
- Fixed the bug with the following expression:
|
||||
Class c = (int.class);
|
||||
|
||||
2007-06-26
|
||||
- Bug fixes from Leon Poyyayil work
|
||||
- suport for hex floating point
|
||||
- unicode digits in indentifier
|
||||
- MemberValueArrayInitializer
|
||||
|
||||
2007-03-09
|
||||
- Long and Integer literal MIN_VALUE bug
|
||||
|
||||
2007-02-24
|
||||
- '\0' bug fixed
|
||||
|
||||
2007-02-01
|
||||
- Many bug fixes
|
||||
- Added line/column to nodes
|
||||
@@ -0,0 +1,264 @@
|
||||
package japa.parser;
|
||||
|
||||
import japa.parser.ast.CompilationUnit;
|
||||
import japa.parser.ast.body.BodyDeclaration;
|
||||
import japa.parser.ast.body.FieldDeclaration;
|
||||
import japa.parser.ast.body.MethodDeclaration;
|
||||
import japa.parser.ast.body.Parameter;
|
||||
import japa.parser.ast.body.TypeDeclaration;
|
||||
import japa.parser.ast.body.VariableDeclarator;
|
||||
import japa.parser.ast.body.VariableDeclaratorId;
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.expr.MethodCallExpr;
|
||||
import japa.parser.ast.expr.NameExpr;
|
||||
import japa.parser.ast.expr.QualifiedNameExpr;
|
||||
import japa.parser.ast.expr.VariableDeclarationExpr;
|
||||
import japa.parser.ast.stmt.BlockStmt;
|
||||
import japa.parser.ast.stmt.ExpressionStmt;
|
||||
import japa.parser.ast.stmt.Statement;
|
||||
import japa.parser.ast.type.ClassOrInterfaceType;
|
||||
import japa.parser.ast.type.PrimitiveType;
|
||||
import japa.parser.ast.type.ReferenceType;
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.type.VoidType;
|
||||
import japa.parser.ast.type.PrimitiveType.Primitive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class helps to construct new nodes.
|
||||
*
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ASTHelper {
|
||||
|
||||
public static final PrimitiveType BYTE_TYPE = new PrimitiveType(Primitive.Byte);
|
||||
|
||||
public static final PrimitiveType SHORT_TYPE = new PrimitiveType(Primitive.Short);
|
||||
|
||||
public static final PrimitiveType INT_TYPE = new PrimitiveType(Primitive.Int);
|
||||
|
||||
public static final PrimitiveType LONG_TYPE = new PrimitiveType(Primitive.Long);
|
||||
|
||||
public static final PrimitiveType FLOAT_TYPE = new PrimitiveType(Primitive.Float);
|
||||
|
||||
public static final PrimitiveType DOUBLE_TYPE = new PrimitiveType(Primitive.Double);
|
||||
|
||||
public static final PrimitiveType BOOLEAN_TYPE = new PrimitiveType(Primitive.Boolean);
|
||||
|
||||
public static final PrimitiveType CHAR_TYPE = new PrimitiveType(Primitive.Char);
|
||||
|
||||
public static final VoidType VOID_TYPE = new VoidType();
|
||||
|
||||
private ASTHelper() {
|
||||
// nop
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link NameExpr} from a qualified name.<br>
|
||||
* The qualified name can contains "." (dot) characters.
|
||||
*
|
||||
* @param qualifiedName
|
||||
* qualified name
|
||||
* @return instanceof {@link NameExpr}
|
||||
*/
|
||||
public static NameExpr createNameExpr(String qualifiedName) {
|
||||
String[] split = qualifiedName.split("\\.");
|
||||
NameExpr ret = new NameExpr(split[0]);
|
||||
for (int i = 1; i < split.length; i++) {
|
||||
ret = new QualifiedNameExpr(ret, split[i]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Parameter}.
|
||||
*
|
||||
* @param type
|
||||
* type of the parameter
|
||||
* @param name
|
||||
* name of the parameter
|
||||
* @return instance of {@link Parameter}
|
||||
*/
|
||||
public static Parameter createParameter(Type type, String name) {
|
||||
return new Parameter(type, new VariableDeclaratorId(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link FieldDeclaration}.
|
||||
*
|
||||
* @param modifiers
|
||||
* modifiers
|
||||
* @param type
|
||||
* type
|
||||
* @param variable
|
||||
* variable declarator
|
||||
* @return instance of {@link FieldDeclaration}
|
||||
*/
|
||||
public static FieldDeclaration createFieldDeclaration(int modifiers, Type type, VariableDeclarator variable) {
|
||||
List<VariableDeclarator> variables = new ArrayList<VariableDeclarator>();
|
||||
variables.add(variable);
|
||||
FieldDeclaration ret = new FieldDeclaration(modifiers, type, variables);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link FieldDeclaration}.
|
||||
*
|
||||
* @param modifiers
|
||||
* modifiers
|
||||
* @param type
|
||||
* type
|
||||
* @param name
|
||||
* field name
|
||||
* @return instance of {@link FieldDeclaration}
|
||||
*/
|
||||
public static FieldDeclaration createFieldDeclaration(int modifiers, Type type, String name) {
|
||||
VariableDeclaratorId id = new VariableDeclaratorId(name);
|
||||
VariableDeclarator variable = new VariableDeclarator(id);
|
||||
return createFieldDeclaration(modifiers, type, variable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link VariableDeclarationExpr}.
|
||||
*
|
||||
* @param type
|
||||
* type
|
||||
* @param name
|
||||
* name
|
||||
* @return instance of {@link VariableDeclarationExpr}
|
||||
*/
|
||||
public static VariableDeclarationExpr createVariableDeclarationExpr(Type type, String name) {
|
||||
List<VariableDeclarator> vars = new ArrayList<VariableDeclarator>();
|
||||
vars.add(new VariableDeclarator(new VariableDeclaratorId(name)));
|
||||
return new VariableDeclarationExpr(type, vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given parameter to the method. The list of parameters will be
|
||||
* initialized if it is <code>null</code>.
|
||||
*
|
||||
* @param method
|
||||
* method
|
||||
* @param parameter
|
||||
* parameter
|
||||
*/
|
||||
public static void addParameter(MethodDeclaration method, Parameter parameter) {
|
||||
List<Parameter> parameters = method.getParameters();
|
||||
if (parameters == null) {
|
||||
parameters = new ArrayList<Parameter>();
|
||||
method.setParameters(parameters);
|
||||
}
|
||||
parameters.add(parameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given argument to the method call. The list of arguments will be
|
||||
* initialized if it is <code>null</code>.
|
||||
*
|
||||
* @param call
|
||||
* method call
|
||||
* @param arg
|
||||
* argument value
|
||||
*/
|
||||
public static void addArgument(MethodCallExpr call, Expression arg) {
|
||||
List<Expression> args = call.getArgs();
|
||||
if (args == null) {
|
||||
args = new ArrayList<Expression>();
|
||||
call.setArgs(args);
|
||||
}
|
||||
args.add(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given type declaration to the compilation unit. The list of
|
||||
* types will be initialized if it is <code>null</code>.
|
||||
*
|
||||
* @param cu
|
||||
* compilation unit
|
||||
* @param type
|
||||
* type declaration
|
||||
*/
|
||||
public static void addTypeDeclaration(CompilationUnit cu, TypeDeclaration type) {
|
||||
List<TypeDeclaration> types = cu.getTypes();
|
||||
if (types == null) {
|
||||
types = new ArrayList<TypeDeclaration>();
|
||||
cu.setTypes(types);
|
||||
}
|
||||
types.add(type);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link ReferenceType} for a class or interface.
|
||||
*
|
||||
* @param name
|
||||
* name of the class or interface
|
||||
* @param arrayCount
|
||||
* number os arrays or <code>0</code> 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 <code>0</code> 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 <code>null</code>.
|
||||
*
|
||||
* @param block
|
||||
* @param stmt
|
||||
*/
|
||||
public static void addStmt(BlockStmt block, Statement stmt) {
|
||||
List<Statement> stmts = block.getStmts();
|
||||
if (stmts == null) {
|
||||
stmts = new ArrayList<Statement>();
|
||||
block.setStmts(stmts);
|
||||
}
|
||||
stmts.add(stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given expression to the specified block. The list of statements
|
||||
* will be initialized if it is <code>null</code>.
|
||||
*
|
||||
* @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 <code>null</code>.
|
||||
*
|
||||
* @param type
|
||||
* type declaration
|
||||
* @param decl
|
||||
* member declaration
|
||||
*/
|
||||
public static void addMember(TypeDeclaration type, BodyDeclaration decl) {
|
||||
List<BodyDeclaration> members = type.getMembers();
|
||||
if (members == null) {
|
||||
members = new ArrayList<BodyDeclaration>();
|
||||
type.setMembers(members);
|
||||
}
|
||||
members.add(decl);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,410 @@
|
||||
/* Generated By:JavaCC: Do not edit this line. ASTParserConstants.java */
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package japa.parser;
|
||||
|
||||
|
||||
/**
|
||||
* Token literal values and constants.
|
||||
* Generated by org.javacc.parser.OtherFilesGen#start()
|
||||
*/
|
||||
public interface ASTParserConstants {
|
||||
|
||||
/** End of File. */
|
||||
int EOF = 0;
|
||||
/** RegularExpression Id. */
|
||||
int SINGLE_LINE_COMMENT = 6;
|
||||
/** RegularExpression Id. */
|
||||
int JAVA_DOC_COMMENT = 9;
|
||||
/** RegularExpression Id. */
|
||||
int MULTI_LINE_COMMENT = 10;
|
||||
/** RegularExpression Id. */
|
||||
int ABSTRACT = 12;
|
||||
/** RegularExpression Id. */
|
||||
int ASSERT = 13;
|
||||
/** RegularExpression Id. */
|
||||
int BOOLEAN = 14;
|
||||
/** RegularExpression Id. */
|
||||
int BREAK = 15;
|
||||
/** RegularExpression Id. */
|
||||
int BYTE = 16;
|
||||
/** RegularExpression Id. */
|
||||
int CASE = 17;
|
||||
/** RegularExpression Id. */
|
||||
int CATCH = 18;
|
||||
/** RegularExpression Id. */
|
||||
int CHAR = 19;
|
||||
/** RegularExpression Id. */
|
||||
int CLASS = 20;
|
||||
/** RegularExpression Id. */
|
||||
int CONST = 21;
|
||||
/** RegularExpression Id. */
|
||||
int CONTINUE = 22;
|
||||
/** RegularExpression Id. */
|
||||
int _DEFAULT = 23;
|
||||
/** RegularExpression Id. */
|
||||
int DO = 24;
|
||||
/** RegularExpression Id. */
|
||||
int DOUBLE = 25;
|
||||
/** RegularExpression Id. */
|
||||
int ELSE = 26;
|
||||
/** RegularExpression Id. */
|
||||
int ENUM = 27;
|
||||
/** RegularExpression Id. */
|
||||
int EXTENDS = 28;
|
||||
/** RegularExpression Id. */
|
||||
int FALSE = 29;
|
||||
/** RegularExpression Id. */
|
||||
int FINAL = 30;
|
||||
/** RegularExpression Id. */
|
||||
int FINALLY = 31;
|
||||
/** RegularExpression Id. */
|
||||
int FLOAT = 32;
|
||||
/** RegularExpression Id. */
|
||||
int FOR = 33;
|
||||
/** RegularExpression Id. */
|
||||
int GOTO = 34;
|
||||
/** RegularExpression Id. */
|
||||
int IF = 35;
|
||||
/** RegularExpression Id. */
|
||||
int IMPLEMENTS = 36;
|
||||
/** RegularExpression Id. */
|
||||
int IMPORT = 37;
|
||||
/** RegularExpression Id. */
|
||||
int INSTANCEOF = 38;
|
||||
/** RegularExpression Id. */
|
||||
int INT = 39;
|
||||
/** RegularExpression Id. */
|
||||
int INTERFACE = 40;
|
||||
/** RegularExpression Id. */
|
||||
int LONG = 41;
|
||||
/** RegularExpression Id. */
|
||||
int NATIVE = 42;
|
||||
/** RegularExpression Id. */
|
||||
int NEW = 43;
|
||||
/** RegularExpression Id. */
|
||||
int NULL = 44;
|
||||
/** RegularExpression Id. */
|
||||
int PACKAGE = 45;
|
||||
/** RegularExpression Id. */
|
||||
int PRIVATE = 46;
|
||||
/** RegularExpression Id. */
|
||||
int PROTECTED = 47;
|
||||
/** RegularExpression Id. */
|
||||
int PUBLIC = 48;
|
||||
/** RegularExpression Id. */
|
||||
int RETURN = 49;
|
||||
/** RegularExpression Id. */
|
||||
int SHORT = 50;
|
||||
/** RegularExpression Id. */
|
||||
int STATIC = 51;
|
||||
/** RegularExpression Id. */
|
||||
int STRICTFP = 52;
|
||||
/** RegularExpression Id. */
|
||||
int SUPER = 53;
|
||||
/** RegularExpression Id. */
|
||||
int SWITCH = 54;
|
||||
/** RegularExpression Id. */
|
||||
int SYNCHRONIZED = 55;
|
||||
/** RegularExpression Id. */
|
||||
int THIS = 56;
|
||||
/** RegularExpression Id. */
|
||||
int THROW = 57;
|
||||
/** RegularExpression Id. */
|
||||
int THROWS = 58;
|
||||
/** RegularExpression Id. */
|
||||
int TRANSIENT = 59;
|
||||
/** RegularExpression Id. */
|
||||
int TRUE = 60;
|
||||
/** RegularExpression Id. */
|
||||
int TRY = 61;
|
||||
/** RegularExpression Id. */
|
||||
int VOID = 62;
|
||||
/** RegularExpression Id. */
|
||||
int VOLATILE = 63;
|
||||
/** RegularExpression Id. */
|
||||
int WHILE = 64;
|
||||
/** RegularExpression Id. */
|
||||
int LONG_LITERAL = 65;
|
||||
/** RegularExpression Id. */
|
||||
int INTEGER_LITERAL = 66;
|
||||
/** RegularExpression Id. */
|
||||
int DECIMAL_LITERAL = 67;
|
||||
/** RegularExpression Id. */
|
||||
int HEX_LITERAL = 68;
|
||||
/** RegularExpression Id. */
|
||||
int OCTAL_LITERAL = 69;
|
||||
/** RegularExpression Id. */
|
||||
int FLOATING_POINT_LITERAL = 70;
|
||||
/** RegularExpression Id. */
|
||||
int DECIMAL_FLOATING_POINT_LITERAL = 71;
|
||||
/** RegularExpression Id. */
|
||||
int DECIMAL_EXPONENT = 72;
|
||||
/** RegularExpression Id. */
|
||||
int HEXADECIMAL_FLOATING_POINT_LITERAL = 73;
|
||||
/** RegularExpression Id. */
|
||||
int HEXADECIMAL_EXPONENT = 74;
|
||||
/** RegularExpression Id. */
|
||||
int CHARACTER_LITERAL = 75;
|
||||
/** RegularExpression Id. */
|
||||
int STRING_LITERAL = 76;
|
||||
/** RegularExpression Id. */
|
||||
int IDENTIFIER = 77;
|
||||
/** RegularExpression Id. */
|
||||
int LETTER = 78;
|
||||
/** RegularExpression Id. */
|
||||
int PART_LETTER = 79;
|
||||
/** RegularExpression Id. */
|
||||
int LPAREN = 80;
|
||||
/** RegularExpression Id. */
|
||||
int RPAREN = 81;
|
||||
/** RegularExpression Id. */
|
||||
int LBRACE = 82;
|
||||
/** RegularExpression Id. */
|
||||
int RBRACE = 83;
|
||||
/** RegularExpression Id. */
|
||||
int LBRACKET = 84;
|
||||
/** RegularExpression Id. */
|
||||
int RBRACKET = 85;
|
||||
/** RegularExpression Id. */
|
||||
int SEMICOLON = 86;
|
||||
/** RegularExpression Id. */
|
||||
int COMMA = 87;
|
||||
/** RegularExpression Id. */
|
||||
int DOT = 88;
|
||||
/** RegularExpression Id. */
|
||||
int AT = 89;
|
||||
/** RegularExpression Id. */
|
||||
int ASSIGN = 90;
|
||||
/** RegularExpression Id. */
|
||||
int LT = 91;
|
||||
/** RegularExpression Id. */
|
||||
int BANG = 92;
|
||||
/** RegularExpression Id. */
|
||||
int TILDE = 93;
|
||||
/** RegularExpression Id. */
|
||||
int HOOK = 94;
|
||||
/** RegularExpression Id. */
|
||||
int COLON = 95;
|
||||
/** RegularExpression Id. */
|
||||
int EQ = 96;
|
||||
/** RegularExpression Id. */
|
||||
int LE = 97;
|
||||
/** RegularExpression Id. */
|
||||
int GE = 98;
|
||||
/** RegularExpression Id. */
|
||||
int NE = 99;
|
||||
/** RegularExpression Id. */
|
||||
int SC_OR = 100;
|
||||
/** RegularExpression Id. */
|
||||
int SC_AND = 101;
|
||||
/** RegularExpression Id. */
|
||||
int INCR = 102;
|
||||
/** RegularExpression Id. */
|
||||
int DECR = 103;
|
||||
/** RegularExpression Id. */
|
||||
int PLUS = 104;
|
||||
/** RegularExpression Id. */
|
||||
int MINUS = 105;
|
||||
/** RegularExpression Id. */
|
||||
int STAR = 106;
|
||||
/** RegularExpression Id. */
|
||||
int SLASH = 107;
|
||||
/** RegularExpression Id. */
|
||||
int BIT_AND = 108;
|
||||
/** RegularExpression Id. */
|
||||
int BIT_OR = 109;
|
||||
/** RegularExpression Id. */
|
||||
int XOR = 110;
|
||||
/** RegularExpression Id. */
|
||||
int REM = 111;
|
||||
/** RegularExpression Id. */
|
||||
int LSHIFT = 112;
|
||||
/** RegularExpression Id. */
|
||||
int PLUSASSIGN = 113;
|
||||
/** RegularExpression Id. */
|
||||
int MINUSASSIGN = 114;
|
||||
/** RegularExpression Id. */
|
||||
int STARASSIGN = 115;
|
||||
/** RegularExpression Id. */
|
||||
int SLASHASSIGN = 116;
|
||||
/** RegularExpression Id. */
|
||||
int ANDASSIGN = 117;
|
||||
/** RegularExpression Id. */
|
||||
int ORASSIGN = 118;
|
||||
/** RegularExpression Id. */
|
||||
int XORASSIGN = 119;
|
||||
/** RegularExpression Id. */
|
||||
int REMASSIGN = 120;
|
||||
/** RegularExpression Id. */
|
||||
int LSHIFTASSIGN = 121;
|
||||
/** RegularExpression Id. */
|
||||
int RSIGNEDSHIFTASSIGN = 122;
|
||||
/** RegularExpression Id. */
|
||||
int RUNSIGNEDSHIFTASSIGN = 123;
|
||||
/** RegularExpression Id. */
|
||||
int ELLIPSIS = 124;
|
||||
/** RegularExpression Id. */
|
||||
int RUNSIGNEDSHIFT = 125;
|
||||
/** RegularExpression Id. */
|
||||
int RSIGNEDSHIFT = 126;
|
||||
/** RegularExpression Id. */
|
||||
int GT = 127;
|
||||
|
||||
/** Lexical state. */
|
||||
int DEFAULT = 0;
|
||||
/** Lexical state. */
|
||||
int IN_JAVA_DOC_COMMENT = 1;
|
||||
/** Lexical state. */
|
||||
int IN_MULTI_LINE_COMMENT = 2;
|
||||
|
||||
/** Literal token values. */
|
||||
String[] tokenImage = {
|
||||
"<EOF>",
|
||||
"\" \"",
|
||||
"\"\\t\"",
|
||||
"\"\\n\"",
|
||||
"\"\\r\"",
|
||||
"\"\\f\"",
|
||||
"<SINGLE_LINE_COMMENT>",
|
||||
"<token of kind 7>",
|
||||
"\"/*\"",
|
||||
"\"*/\"",
|
||||
"\"*/\"",
|
||||
"<token of kind 11>",
|
||||
"\"abstract\"",
|
||||
"\"assert\"",
|
||||
"\"boolean\"",
|
||||
"\"break\"",
|
||||
"\"byte\"",
|
||||
"\"case\"",
|
||||
"\"catch\"",
|
||||
"\"char\"",
|
||||
"\"class\"",
|
||||
"\"const\"",
|
||||
"\"continue\"",
|
||||
"\"default\"",
|
||||
"\"do\"",
|
||||
"\"double\"",
|
||||
"\"else\"",
|
||||
"\"enum\"",
|
||||
"\"extends\"",
|
||||
"\"false\"",
|
||||
"\"final\"",
|
||||
"\"finally\"",
|
||||
"\"float\"",
|
||||
"\"for\"",
|
||||
"\"goto\"",
|
||||
"\"if\"",
|
||||
"\"implements\"",
|
||||
"\"import\"",
|
||||
"\"instanceof\"",
|
||||
"\"int\"",
|
||||
"\"interface\"",
|
||||
"\"long\"",
|
||||
"\"native\"",
|
||||
"\"new\"",
|
||||
"\"null\"",
|
||||
"\"package\"",
|
||||
"\"private\"",
|
||||
"\"protected\"",
|
||||
"\"public\"",
|
||||
"\"return\"",
|
||||
"\"short\"",
|
||||
"\"static\"",
|
||||
"\"strictfp\"",
|
||||
"\"super\"",
|
||||
"\"switch\"",
|
||||
"\"synchronized\"",
|
||||
"\"this\"",
|
||||
"\"throw\"",
|
||||
"\"throws\"",
|
||||
"\"transient\"",
|
||||
"\"true\"",
|
||||
"\"try\"",
|
||||
"\"void\"",
|
||||
"\"volatile\"",
|
||||
"\"while\"",
|
||||
"<LONG_LITERAL>",
|
||||
"<INTEGER_LITERAL>",
|
||||
"<DECIMAL_LITERAL>",
|
||||
"<HEX_LITERAL>",
|
||||
"<OCTAL_LITERAL>",
|
||||
"<FLOATING_POINT_LITERAL>",
|
||||
"<DECIMAL_FLOATING_POINT_LITERAL>",
|
||||
"<DECIMAL_EXPONENT>",
|
||||
"<HEXADECIMAL_FLOATING_POINT_LITERAL>",
|
||||
"<HEXADECIMAL_EXPONENT>",
|
||||
"<CHARACTER_LITERAL>",
|
||||
"<STRING_LITERAL>",
|
||||
"<IDENTIFIER>",
|
||||
"<LETTER>",
|
||||
"<PART_LETTER>",
|
||||
"\"(\"",
|
||||
"\")\"",
|
||||
"\"{\"",
|
||||
"\"}\"",
|
||||
"\"[\"",
|
||||
"\"]\"",
|
||||
"\";\"",
|
||||
"\",\"",
|
||||
"\".\"",
|
||||
"\"@\"",
|
||||
"\"=\"",
|
||||
"\"<\"",
|
||||
"\"!\"",
|
||||
"\"~\"",
|
||||
"\"?\"",
|
||||
"\":\"",
|
||||
"\"==\"",
|
||||
"\"<=\"",
|
||||
"\">=\"",
|
||||
"\"!=\"",
|
||||
"\"||\"",
|
||||
"\"&&\"",
|
||||
"\"++\"",
|
||||
"\"--\"",
|
||||
"\"+\"",
|
||||
"\"-\"",
|
||||
"\"*\"",
|
||||
"\"/\"",
|
||||
"\"&\"",
|
||||
"\"|\"",
|
||||
"\"^\"",
|
||||
"\"%\"",
|
||||
"\"<<\"",
|
||||
"\"+=\"",
|
||||
"\"-=\"",
|
||||
"\"*=\"",
|
||||
"\"/=\"",
|
||||
"\"&=\"",
|
||||
"\"|=\"",
|
||||
"\"^=\"",
|
||||
"\"%=\"",
|
||||
"\"<<=\"",
|
||||
"\">>=\"",
|
||||
"\">>>=\"",
|
||||
"\"...\"",
|
||||
"\">>>\"",
|
||||
"\">>\"",
|
||||
"\">\"",
|
||||
"\"\\u001a\"",
|
||||
};
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,634 @@
|
||||
/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 4.1 */
|
||||
/* JavaCCOptions:STATIC=false */
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package japa.parser;
|
||||
|
||||
/**
|
||||
* An implementation of interface CharStream, where the stream is assumed to
|
||||
* contain only ASCII characters (with java-like unicode escape processing).
|
||||
*/
|
||||
|
||||
public class JavaCharStream
|
||||
{
|
||||
/** Whether parser is static. */
|
||||
public static final boolean staticFlag = false;
|
||||
static final int hexval(char c) throws java.io.IOException {
|
||||
switch(c)
|
||||
{
|
||||
case '0' :
|
||||
return 0;
|
||||
case '1' :
|
||||
return 1;
|
||||
case '2' :
|
||||
return 2;
|
||||
case '3' :
|
||||
return 3;
|
||||
case '4' :
|
||||
return 4;
|
||||
case '5' :
|
||||
return 5;
|
||||
case '6' :
|
||||
return 6;
|
||||
case '7' :
|
||||
return 7;
|
||||
case '8' :
|
||||
return 8;
|
||||
case '9' :
|
||||
return 9;
|
||||
|
||||
case 'a' :
|
||||
case 'A' :
|
||||
return 10;
|
||||
case 'b' :
|
||||
case 'B' :
|
||||
return 11;
|
||||
case 'c' :
|
||||
case 'C' :
|
||||
return 12;
|
||||
case 'd' :
|
||||
case 'D' :
|
||||
return 13;
|
||||
case 'e' :
|
||||
case 'E' :
|
||||
return 14;
|
||||
case 'f' :
|
||||
case 'F' :
|
||||
return 15;
|
||||
}
|
||||
|
||||
throw new java.io.IOException(); // Should never come here
|
||||
}
|
||||
|
||||
/** Position in buffer. */
|
||||
public int bufpos = -1;
|
||||
int bufsize;
|
||||
int available;
|
||||
int tokenBegin;
|
||||
protected int bufline[];
|
||||
protected int bufcolumn[];
|
||||
|
||||
protected int column = 0;
|
||||
protected int line = 1;
|
||||
|
||||
protected boolean prevCharIsCR = false;
|
||||
protected boolean prevCharIsLF = false;
|
||||
|
||||
protected java.io.Reader inputStream;
|
||||
|
||||
protected char[] nextCharBuf;
|
||||
protected char[] buffer;
|
||||
protected int maxNextCharInd = 0;
|
||||
protected int nextCharInd = -1;
|
||||
protected int inBuf = 0;
|
||||
protected int tabSize = 8;
|
||||
|
||||
protected void setTabSize(int i) { tabSize = i; }
|
||||
protected int getTabSize(int i) { return tabSize; }
|
||||
|
||||
protected void ExpandBuff(boolean wrapAround)
|
||||
{
|
||||
char[] newbuffer = new char[bufsize + 2048];
|
||||
int newbufline[] = new int[bufsize + 2048];
|
||||
int newbufcolumn[] = new int[bufsize + 2048];
|
||||
|
||||
try
|
||||
{
|
||||
if (wrapAround)
|
||||
{
|
||||
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
|
||||
System.arraycopy(buffer, 0, newbuffer,
|
||||
bufsize - tokenBegin, bufpos);
|
||||
buffer = newbuffer;
|
||||
|
||||
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
|
||||
System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
|
||||
bufline = newbufline;
|
||||
|
||||
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
|
||||
System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
|
||||
bufcolumn = newbufcolumn;
|
||||
|
||||
bufpos += (bufsize - tokenBegin);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
|
||||
buffer = newbuffer;
|
||||
|
||||
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
|
||||
bufline = newbufline;
|
||||
|
||||
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
|
||||
bufcolumn = newbufcolumn;
|
||||
|
||||
bufpos -= tokenBegin;
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new Error(t.getMessage());
|
||||
}
|
||||
|
||||
available = (bufsize += 2048);
|
||||
tokenBegin = 0;
|
||||
}
|
||||
|
||||
protected void FillBuff() throws java.io.IOException
|
||||
{
|
||||
int i;
|
||||
if (maxNextCharInd == 4096)
|
||||
maxNextCharInd = nextCharInd = 0;
|
||||
|
||||
try {
|
||||
if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
|
||||
4096 - maxNextCharInd)) == -1)
|
||||
{
|
||||
inputStream.close();
|
||||
throw new java.io.IOException();
|
||||
}
|
||||
else
|
||||
maxNextCharInd += i;
|
||||
return;
|
||||
}
|
||||
catch(java.io.IOException e) {
|
||||
if (bufpos != 0)
|
||||
{
|
||||
--bufpos;
|
||||
backup(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bufline[bufpos] = line;
|
||||
bufcolumn[bufpos] = column;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
protected char ReadByte() throws java.io.IOException
|
||||
{
|
||||
if (++nextCharInd >= maxNextCharInd)
|
||||
FillBuff();
|
||||
|
||||
return nextCharBuf[nextCharInd];
|
||||
}
|
||||
|
||||
/** @return starting character for token. */
|
||||
public char BeginToken() throws java.io.IOException
|
||||
{
|
||||
if (inBuf > 0)
|
||||
{
|
||||
--inBuf;
|
||||
|
||||
if (++bufpos == bufsize)
|
||||
bufpos = 0;
|
||||
|
||||
tokenBegin = bufpos;
|
||||
return buffer[bufpos];
|
||||
}
|
||||
|
||||
tokenBegin = 0;
|
||||
bufpos = -1;
|
||||
|
||||
return readChar();
|
||||
}
|
||||
|
||||
protected void AdjustBuffSize()
|
||||
{
|
||||
if (available == bufsize)
|
||||
{
|
||||
if (tokenBegin > 2048)
|
||||
{
|
||||
bufpos = 0;
|
||||
available = tokenBegin;
|
||||
}
|
||||
else
|
||||
ExpandBuff(false);
|
||||
}
|
||||
else if (available > tokenBegin)
|
||||
available = bufsize;
|
||||
else if ((tokenBegin - available) < 2048)
|
||||
ExpandBuff(true);
|
||||
else
|
||||
available = tokenBegin;
|
||||
}
|
||||
|
||||
protected void UpdateLineColumn(char c)
|
||||
{
|
||||
column++;
|
||||
|
||||
if (prevCharIsLF)
|
||||
{
|
||||
prevCharIsLF = false;
|
||||
line += (column = 1);
|
||||
}
|
||||
else if (prevCharIsCR)
|
||||
{
|
||||
prevCharIsCR = false;
|
||||
if (c == '\n')
|
||||
{
|
||||
prevCharIsLF = true;
|
||||
}
|
||||
else
|
||||
line += (column = 1);
|
||||
}
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\r' :
|
||||
prevCharIsCR = true;
|
||||
break;
|
||||
case '\n' :
|
||||
prevCharIsLF = true;
|
||||
break;
|
||||
case '\t' :
|
||||
column--;
|
||||
column += (tabSize - (column % tabSize));
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
bufline[bufpos] = line;
|
||||
bufcolumn[bufpos] = column;
|
||||
}
|
||||
|
||||
/** Read a character. */
|
||||
public char readChar() throws java.io.IOException
|
||||
{
|
||||
if (inBuf > 0)
|
||||
{
|
||||
--inBuf;
|
||||
|
||||
if (++bufpos == bufsize)
|
||||
bufpos = 0;
|
||||
|
||||
return buffer[bufpos];
|
||||
}
|
||||
|
||||
char c;
|
||||
|
||||
if (++bufpos == available)
|
||||
AdjustBuffSize();
|
||||
|
||||
if ((buffer[bufpos] = c = ReadByte()) == '\\')
|
||||
{
|
||||
UpdateLineColumn(c);
|
||||
|
||||
int backSlashCnt = 1;
|
||||
|
||||
for (;;) // Read all the backslashes
|
||||
{
|
||||
if (++bufpos == available)
|
||||
AdjustBuffSize();
|
||||
|
||||
try
|
||||
{
|
||||
if ((buffer[bufpos] = c = ReadByte()) != '\\')
|
||||
{
|
||||
UpdateLineColumn(c);
|
||||
// found a non-backslash char.
|
||||
if ((c == 'u') && ((backSlashCnt & 1) == 1))
|
||||
{
|
||||
if (--bufpos < 0)
|
||||
bufpos = bufsize - 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
backup(backSlashCnt);
|
||||
return '\\';
|
||||
}
|
||||
}
|
||||
catch(java.io.IOException e)
|
||||
{
|
||||
if (backSlashCnt > 1)
|
||||
backup(backSlashCnt-1);
|
||||
|
||||
return '\\';
|
||||
}
|
||||
|
||||
UpdateLineColumn(c);
|
||||
backSlashCnt++;
|
||||
}
|
||||
|
||||
// Here, we have seen an odd number of backslash's followed by a 'u'
|
||||
try
|
||||
{
|
||||
while ((c = ReadByte()) == 'u')
|
||||
++column;
|
||||
|
||||
buffer[bufpos] = c = (char)(hexval(c) << 12 |
|
||||
hexval(ReadByte()) << 8 |
|
||||
hexval(ReadByte()) << 4 |
|
||||
hexval(ReadByte()));
|
||||
|
||||
column += 4;
|
||||
}
|
||||
catch(java.io.IOException e)
|
||||
{
|
||||
throw new Error("Invalid escape character at line " + line +
|
||||
" column " + column + ".");
|
||||
}
|
||||
|
||||
if (backSlashCnt == 1)
|
||||
return c;
|
||||
else
|
||||
{
|
||||
backup(backSlashCnt - 1);
|
||||
return '\\';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateLineColumn(c);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated
|
||||
* @see #getEndColumn
|
||||
*/
|
||||
public int getColumn() {
|
||||
return bufcolumn[bufpos];
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated
|
||||
* @see #getEndLine
|
||||
*/
|
||||
public int getLine() {
|
||||
return bufline[bufpos];
|
||||
}
|
||||
|
||||
/** Get end column. */
|
||||
public int getEndColumn() {
|
||||
return bufcolumn[bufpos];
|
||||
}
|
||||
|
||||
/** Get end line. */
|
||||
public int getEndLine() {
|
||||
return bufline[bufpos];
|
||||
}
|
||||
|
||||
/** @return column of token start */
|
||||
public int getBeginColumn() {
|
||||
return bufcolumn[tokenBegin];
|
||||
}
|
||||
|
||||
/** @return line number of token start */
|
||||
public int getBeginLine() {
|
||||
return bufline[tokenBegin];
|
||||
}
|
||||
|
||||
/** Retreat. */
|
||||
public void backup(int amount) {
|
||||
|
||||
inBuf += amount;
|
||||
if ((bufpos -= amount) < 0)
|
||||
bufpos += bufsize;
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public JavaCharStream(java.io.Reader dstream,
|
||||
int startline, int startcolumn, int buffersize)
|
||||
{
|
||||
inputStream = dstream;
|
||||
line = startline;
|
||||
column = startcolumn - 1;
|
||||
|
||||
available = bufsize = buffersize;
|
||||
buffer = new char[buffersize];
|
||||
bufline = new int[buffersize];
|
||||
bufcolumn = new int[buffersize];
|
||||
nextCharBuf = new char[4096];
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public JavaCharStream(java.io.Reader dstream,
|
||||
int startline, int startcolumn)
|
||||
{
|
||||
this(dstream, startline, startcolumn, 4096);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public JavaCharStream(java.io.Reader dstream)
|
||||
{
|
||||
this(dstream, 1, 1, 4096);
|
||||
}
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.Reader dstream,
|
||||
int startline, int startcolumn, int buffersize)
|
||||
{
|
||||
inputStream = dstream;
|
||||
line = startline;
|
||||
column = startcolumn - 1;
|
||||
|
||||
if (buffer == null || buffersize != buffer.length)
|
||||
{
|
||||
available = bufsize = buffersize;
|
||||
buffer = new char[buffersize];
|
||||
bufline = new int[buffersize];
|
||||
bufcolumn = new int[buffersize];
|
||||
nextCharBuf = new char[4096];
|
||||
}
|
||||
prevCharIsLF = prevCharIsCR = false;
|
||||
tokenBegin = inBuf = maxNextCharInd = 0;
|
||||
nextCharInd = bufpos = -1;
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.Reader dstream,
|
||||
int startline, int startcolumn)
|
||||
{
|
||||
ReInit(dstream, startline, startcolumn, 4096);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.Reader dstream)
|
||||
{
|
||||
ReInit(dstream, 1, 1, 4096);
|
||||
}
|
||||
/** Constructor. */
|
||||
public JavaCharStream(java.io.InputStream dstream, String encoding, int startline,
|
||||
int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public JavaCharStream(java.io.InputStream dstream, int startline,
|
||||
int startcolumn, int buffersize)
|
||||
{
|
||||
this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public JavaCharStream(java.io.InputStream dstream, String encoding, int startline,
|
||||
int startcolumn) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(dstream, encoding, startline, startcolumn, 4096);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public JavaCharStream(java.io.InputStream dstream, int startline,
|
||||
int startcolumn)
|
||||
{
|
||||
this(dstream, startline, startcolumn, 4096);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(dstream, encoding, 1, 1, 4096);
|
||||
}
|
||||
|
||||
/** Constructor. */
|
||||
public JavaCharStream(java.io.InputStream dstream)
|
||||
{
|
||||
this(dstream, 1, 1, 4096);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
|
||||
int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, int startline,
|
||||
int startcolumn, int buffersize)
|
||||
{
|
||||
ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
|
||||
}
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
|
||||
int startcolumn) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
ReInit(dstream, encoding, startline, startcolumn, 4096);
|
||||
}
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, int startline,
|
||||
int startcolumn)
|
||||
{
|
||||
ReInit(dstream, startline, startcolumn, 4096);
|
||||
}
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
ReInit(dstream, encoding, 1, 1, 4096);
|
||||
}
|
||||
|
||||
/** Reinitialise. */
|
||||
public void ReInit(java.io.InputStream dstream)
|
||||
{
|
||||
ReInit(dstream, 1, 1, 4096);
|
||||
}
|
||||
|
||||
/** @return token image as String */
|
||||
public String GetImage()
|
||||
{
|
||||
if (bufpos >= tokenBegin)
|
||||
return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
|
||||
else
|
||||
return new String(buffer, tokenBegin, bufsize - tokenBegin) +
|
||||
new String(buffer, 0, bufpos + 1);
|
||||
}
|
||||
|
||||
/** @return suffix */
|
||||
public char[] GetSuffix(int len)
|
||||
{
|
||||
char[] ret = new char[len];
|
||||
|
||||
if ((bufpos + 1) >= len)
|
||||
System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
|
||||
else
|
||||
{
|
||||
System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
|
||||
len - bufpos - 1);
|
||||
System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Set buffers back to null when finished. */
|
||||
public void Done()
|
||||
{
|
||||
nextCharBuf = null;
|
||||
buffer = null;
|
||||
bufline = null;
|
||||
bufcolumn = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to adjust line and column numbers for the start of a token.
|
||||
*/
|
||||
public void adjustBeginLineColumn(int newLine, int newCol)
|
||||
{
|
||||
int start = tokenBegin;
|
||||
int len;
|
||||
|
||||
if (bufpos >= tokenBegin)
|
||||
{
|
||||
len = bufpos - tokenBegin + inBuf + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
|
||||
}
|
||||
|
||||
int i = 0, j = 0, k = 0;
|
||||
int nextColDiff = 0, columnDiff = 0;
|
||||
|
||||
while (i < len &&
|
||||
bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
|
||||
{
|
||||
bufline[j] = newLine;
|
||||
nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
|
||||
bufcolumn[j] = newCol + columnDiff;
|
||||
columnDiff = nextColDiff;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i < len)
|
||||
{
|
||||
bufline[j] = newLine++;
|
||||
bufcolumn[j] = newCol + columnDiff;
|
||||
|
||||
while (i++ < len)
|
||||
{
|
||||
if (bufline[j = start % bufsize] != bufline[++start % bufsize])
|
||||
bufline[j] = newLine++;
|
||||
else
|
||||
bufline[j] = newLine;
|
||||
}
|
||||
}
|
||||
|
||||
line = bufline[j];
|
||||
column = bufcolumn[j];
|
||||
}
|
||||
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=46aebc46574be349188fc26719761bcb (do not edit this line) */
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser;
|
||||
|
||||
import japa.parser.ast.CompilationUnit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* <p>This class was generated automatically by javacc, do not edit.</p>
|
||||
* <p>Parse Java 1.5 source code and creates Abstract Syntax Tree classes.</p>
|
||||
* <p><b>Note:</b> To use this parser asynchronously, disable de parser cache
|
||||
* by calling the method {@link setCacheParser} with <code>false</code>
|
||||
* as argument.</p>
|
||||
*
|
||||
* @author Júlio Vilmar Gesser
|
||||
*/
|
||||
public final class JavaParser {
|
||||
|
||||
private static ASTParser parser;
|
||||
|
||||
private static boolean cacheParser = true;
|
||||
|
||||
private JavaParser() {
|
||||
// hide the constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the way that the parser acts when starts to parse. If the
|
||||
* parser cache is enabled, only one insance of this object will be
|
||||
* used in every call to parse methods.
|
||||
* If this parser is intend to be used asynchonously, the cache must
|
||||
* be disabled setting this flag to <code>false</code>.
|
||||
* By default, the cache is enabled.
|
||||
* @param value <code>false</code> 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);
|
||||
}
|
||||
}
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package japa.parser;
|
||||
|
||||
/**
|
||||
* This exception is thrown when parse errors are encountered.
|
||||
* You can explicitly create objects of this exception type by
|
||||
* calling the method generateParseException in the generated
|
||||
* parser.
|
||||
*
|
||||
* You can modify this class to customize your error reporting
|
||||
* mechanisms so long as you retain the public fields.
|
||||
*/
|
||||
public class ParseException extends Exception {
|
||||
|
||||
/**
|
||||
* This constructor is used by the method "generateParseException"
|
||||
* in the generated parser. Calling this constructor generates
|
||||
* a new object of this type with the fields "currentToken",
|
||||
* "expectedTokenSequences", and "tokenImage" set. The boolean
|
||||
* flag "specialConstructor" is also set to true to indicate that
|
||||
* this constructor was used to create this object.
|
||||
* This constructor calls its super class with the empty string
|
||||
* to force the "toString" method of parent class "Throwable" to
|
||||
* print the error message in the form:
|
||||
* ParseException: <result of getMessage>
|
||||
*/
|
||||
public ParseException(Token currentTokenVal,
|
||||
int[][] expectedTokenSequencesVal,
|
||||
String[] tokenImageVal
|
||||
)
|
||||
{
|
||||
super("");
|
||||
specialConstructor = true;
|
||||
currentToken = currentTokenVal;
|
||||
expectedTokenSequences = expectedTokenSequencesVal;
|
||||
tokenImage = tokenImageVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* The following constructors are for use by you for whatever
|
||||
* purpose you can think of. Constructing the exception in this
|
||||
* manner makes the exception behave in the normal way - i.e., as
|
||||
* documented in the class "Throwable". The fields "errorToken",
|
||||
* "expectedTokenSequences", and "tokenImage" do not contain
|
||||
* relevant information. The JavaCC generated code does not use
|
||||
* these constructors.
|
||||
*/
|
||||
|
||||
public ParseException() {
|
||||
super();
|
||||
specialConstructor = false;
|
||||
}
|
||||
|
||||
/** Constructor with message. */
|
||||
public ParseException(String message) {
|
||||
super(message);
|
||||
specialConstructor = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This variable determines which constructor was used to create
|
||||
* this object and thereby affects the semantics of the
|
||||
* "getMessage" method (see below).
|
||||
*/
|
||||
protected boolean specialConstructor;
|
||||
|
||||
/**
|
||||
* This is the last token that has been consumed successfully. If
|
||||
* this object has been created due to a parse error, the token
|
||||
* followng this token will (therefore) be the first error token.
|
||||
*/
|
||||
public Token currentToken;
|
||||
|
||||
/**
|
||||
* Each entry in this array is an array of integers. Each array
|
||||
* of integers represents a sequence of tokens (by their ordinal
|
||||
* values) that is expected at this point of the parse.
|
||||
*/
|
||||
public int[][] expectedTokenSequences;
|
||||
|
||||
/**
|
||||
* This is a reference to the "tokenImage" array of the generated
|
||||
* parser within which the parse error occurred. This array is
|
||||
* defined in the generated ...Constants interface.
|
||||
*/
|
||||
public String[] tokenImage;
|
||||
|
||||
/**
|
||||
* This method has the standard behavior when this object has been
|
||||
* created using the standard constructors. Otherwise, it uses
|
||||
* "currentToken" and "expectedTokenSequences" to generate a parse
|
||||
* error message and returns it. If this object has been created
|
||||
* due to a parse error, and you do not catch it (it gets thrown
|
||||
* from the parser), then this method is called during the printing
|
||||
* of the final stack trace, and hence the correct error message
|
||||
* gets displayed.
|
||||
*/
|
||||
public String getMessage() {
|
||||
if (!specialConstructor) {
|
||||
return super.getMessage();
|
||||
}
|
||||
StringBuffer expected = new StringBuffer();
|
||||
int maxSize = 0;
|
||||
for (int i = 0; i < expectedTokenSequences.length; i++) {
|
||||
if (maxSize < expectedTokenSequences[i].length) {
|
||||
maxSize = expectedTokenSequences[i].length;
|
||||
}
|
||||
for (int j = 0; j < expectedTokenSequences[i].length; j++) {
|
||||
expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
|
||||
}
|
||||
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
|
||||
expected.append("...");
|
||||
}
|
||||
expected.append(eol).append(" ");
|
||||
}
|
||||
String retval = "Encountered \"";
|
||||
Token tok = currentToken.next;
|
||||
for (int i = 0; i < maxSize; i++) {
|
||||
if (i != 0) retval += " ";
|
||||
if (tok.kind == 0) {
|
||||
retval += tokenImage[0];
|
||||
break;
|
||||
}
|
||||
retval += " " + tokenImage[tok.kind];
|
||||
retval += " \"";
|
||||
retval += add_escapes(tok.image);
|
||||
retval += " \"";
|
||||
tok = tok.next;
|
||||
}
|
||||
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
|
||||
retval += "." + eol;
|
||||
if (expectedTokenSequences.length == 1) {
|
||||
retval += "Was expecting:" + eol + " ";
|
||||
} else {
|
||||
retval += "Was expecting one of:" + eol + " ";
|
||||
}
|
||||
retval += expected.toString();
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* The end of line string for this machine.
|
||||
*/
|
||||
protected String eol = System.getProperty("line.separator", "\n");
|
||||
|
||||
/**
|
||||
* Used to convert raw characters to their escaped version
|
||||
* when these raw version cannot be used as part of an ASCII
|
||||
* string literal.
|
||||
*/
|
||||
protected String add_escapes(String str) {
|
||||
StringBuffer retval = new StringBuffer();
|
||||
char ch;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
switch (str.charAt(i))
|
||||
{
|
||||
case 0 :
|
||||
continue;
|
||||
case '\b':
|
||||
retval.append("\\b");
|
||||
continue;
|
||||
case '\t':
|
||||
retval.append("\\t");
|
||||
continue;
|
||||
case '\n':
|
||||
retval.append("\\n");
|
||||
continue;
|
||||
case '\f':
|
||||
retval.append("\\f");
|
||||
continue;
|
||||
case '\r':
|
||||
retval.append("\\r");
|
||||
continue;
|
||||
case '\"':
|
||||
retval.append("\\\"");
|
||||
continue;
|
||||
case '\'':
|
||||
retval.append("\\\'");
|
||||
continue;
|
||||
case '\\':
|
||||
retval.append("\\\\");
|
||||
continue;
|
||||
default:
|
||||
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
|
||||
String s = "0000" + Integer.toString(ch, 16);
|
||||
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
|
||||
} else {
|
||||
retval.append(ch);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return retval.toString();
|
||||
}
|
||||
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=1164e36971d84a0433c5f702fcb960dd (do not edit this line) */
|
||||
@@ -0,0 +1,142 @@
|
||||
/* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */
|
||||
/* JavaCCOptions:TOKEN_EXTENDS=,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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package japa.parser;
|
||||
|
||||
/**
|
||||
* Describes the input token stream.
|
||||
*/
|
||||
|
||||
public class Token {
|
||||
|
||||
/**
|
||||
* An integer that describes the kind of this token. This numbering
|
||||
* system is determined by JavaCCParser, and a table of these numbers is
|
||||
* stored in the file ...Constants.java.
|
||||
*/
|
||||
public int kind;
|
||||
|
||||
/** The line number of the first character of this Token. */
|
||||
public int beginLine;
|
||||
/** The column number of the first character of this Token. */
|
||||
public int beginColumn;
|
||||
/** The line number of the last character of this Token. */
|
||||
public int endLine;
|
||||
/** The column number of the last character of this Token. */
|
||||
public int endColumn;
|
||||
|
||||
/**
|
||||
* The string image of the token.
|
||||
*/
|
||||
public String image;
|
||||
|
||||
/**
|
||||
* A reference to the next regular (non-special) token from the input
|
||||
* stream. If this is the last token from the input stream, or if the
|
||||
* token manager has not read tokens beyond this one, this field is
|
||||
* set to null. This is true only if this token is also a regular
|
||||
* token. Otherwise, see below for a description of the contents of
|
||||
* this field.
|
||||
*/
|
||||
public Token next;
|
||||
|
||||
/**
|
||||
* This field is used to access special tokens that occur prior to this
|
||||
* token, but after the immediately preceding regular (non-special) token.
|
||||
* If there are no such special tokens, this field is set to null.
|
||||
* When there are more than one such special token, this field refers
|
||||
* to the last of these special tokens, which in turn refers to the next
|
||||
* previous special token through its specialToken field, and so on
|
||||
* until the first special token (whose specialToken field is null).
|
||||
* The next fields of special tokens refer to other special tokens that
|
||||
* immediately follow it (without an intervening regular token). If there
|
||||
* is no such token, this field is null.
|
||||
*/
|
||||
public Token specialToken;
|
||||
|
||||
/**
|
||||
* An optional attribute value of the Token.
|
||||
* Tokens which are not used as syntactic sugar will often contain
|
||||
* meaningful values that will be used later on by the compiler or
|
||||
* interpreter. This attribute value is often different from the image.
|
||||
* Any subclass of Token that actually wants to return a non-null value can
|
||||
* override this method as appropriate.
|
||||
*/
|
||||
public Object getValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* No-argument constructor
|
||||
*/
|
||||
public Token() {}
|
||||
|
||||
/**
|
||||
* Constructs a new token for the specified Image.
|
||||
*/
|
||||
public Token(int kind)
|
||||
{
|
||||
this(kind, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new token for the specified Image and Kind.
|
||||
*/
|
||||
public Token(int kind, String image)
|
||||
{
|
||||
this.kind = kind;
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the image.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new Token object, by default. However, if you want, you
|
||||
* can create and return subclass objects based on the value of ofKind.
|
||||
* Simply add the cases to the switch for all those special cases.
|
||||
* For example, if you have a subclass of Token called IDToken that
|
||||
* you want to create if ofKind is ID, simply add something like :
|
||||
*
|
||||
* case MyParserConstants.ID : return new IDToken(ofKind, image);
|
||||
*
|
||||
* to the following switch statement. Then you can cast matchedToken
|
||||
* variable to the appropriate type and use sit in your lexical actions.
|
||||
*/
|
||||
public static Token newToken(int ofKind, String image)
|
||||
{
|
||||
switch(ofKind)
|
||||
{
|
||||
default : return new Token(ofKind, image);
|
||||
}
|
||||
}
|
||||
|
||||
public static Token newToken(int ofKind)
|
||||
{
|
||||
return newToken(ofKind, null);
|
||||
}
|
||||
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=36e116391da53a8cb5fc7d23289ae0c7 (do not edit this line) */
|
||||
@@ -0,0 +1,159 @@
|
||||
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 4.1 */
|
||||
/* JavaCCOptions: */
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package japa.parser;
|
||||
|
||||
/** Token Manager Error. */
|
||||
@SuppressWarnings("serial")
|
||||
public class TokenMgrError extends Error
|
||||
{
|
||||
|
||||
/*
|
||||
* Ordinals for various reasons why an Error of this type can be thrown.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Lexical error occurred.
|
||||
*/
|
||||
static final int LEXICAL_ERROR = 0;
|
||||
|
||||
/**
|
||||
* An attempt was made to create a second instance of a static token manager.
|
||||
*/
|
||||
static final int STATIC_LEXER_ERROR = 1;
|
||||
|
||||
/**
|
||||
* Tried to change to an invalid lexical state.
|
||||
*/
|
||||
static final int INVALID_LEXICAL_STATE = 2;
|
||||
|
||||
/**
|
||||
* Detected (and bailed out of) an infinite loop in the token manager.
|
||||
*/
|
||||
static final int LOOP_DETECTED = 3;
|
||||
|
||||
/**
|
||||
* Indicates the reason why the exception is thrown. It will have
|
||||
* one of the above 4 values.
|
||||
*/
|
||||
int errorCode;
|
||||
|
||||
/**
|
||||
* Replaces unprintable characters by their escaped (or unicode escaped)
|
||||
* equivalents in the given string
|
||||
*/
|
||||
protected static final String addEscapes(String str) {
|
||||
StringBuffer retval = new StringBuffer();
|
||||
char ch;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
switch (str.charAt(i))
|
||||
{
|
||||
case 0 :
|
||||
continue;
|
||||
case '\b':
|
||||
retval.append("\\b");
|
||||
continue;
|
||||
case '\t':
|
||||
retval.append("\\t");
|
||||
continue;
|
||||
case '\n':
|
||||
retval.append("\\n");
|
||||
continue;
|
||||
case '\f':
|
||||
retval.append("\\f");
|
||||
continue;
|
||||
case '\r':
|
||||
retval.append("\\r");
|
||||
continue;
|
||||
case '\"':
|
||||
retval.append("\\\"");
|
||||
continue;
|
||||
case '\'':
|
||||
retval.append("\\\'");
|
||||
continue;
|
||||
case '\\':
|
||||
retval.append("\\\\");
|
||||
continue;
|
||||
default:
|
||||
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
|
||||
String s = "0000" + Integer.toString(ch, 16);
|
||||
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
|
||||
} else {
|
||||
retval.append(ch);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return retval.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a detailed message for the Error when it is thrown by the
|
||||
* token manager to indicate a lexical error.
|
||||
* Parameters :
|
||||
* EOFSeen : indicates if EOF caused the lexical error
|
||||
* curLexState : lexical state in which this error occurred
|
||||
* errorLine : line number when the error occurred
|
||||
* errorColumn : column number when the error occurred
|
||||
* errorAfter : prefix that was seen before this error occurred
|
||||
* curchar : the offending character
|
||||
* Note: You can customize the lexical error message by modifying this method.
|
||||
*/
|
||||
protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
|
||||
return("Lexical error at line " +
|
||||
errorLine + ", column " +
|
||||
errorColumn + ". Encountered: " +
|
||||
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
|
||||
"after : \"" + addEscapes(errorAfter) + "\"");
|
||||
}
|
||||
|
||||
/**
|
||||
* You can also modify the body of this method to customize your error messages.
|
||||
* For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
|
||||
* of end-users concern, so you can return something like :
|
||||
*
|
||||
* "Internal Error : Please file a bug report .... "
|
||||
*
|
||||
* from this method for such cases in the release version of your parser.
|
||||
*/
|
||||
public String getMessage() {
|
||||
return super.getMessage();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructors of various flavors follow.
|
||||
*/
|
||||
|
||||
/** No arg constructor. */
|
||||
public TokenMgrError() {
|
||||
}
|
||||
|
||||
/** Constructor with message and reason. */
|
||||
public TokenMgrError(String message, int reason) {
|
||||
super(message);
|
||||
errorCode = reason;
|
||||
}
|
||||
|
||||
/** Full Constructor. */
|
||||
public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
|
||||
this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=c0bde2b885c772c9db66b8a6b4f07329 (do not edit this line) */
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 23/05/2008
|
||||
*/
|
||||
package japa.parser.ast;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* AST node that represent block comments.
|
||||
* </p>
|
||||
* 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 <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 23/05/2008
|
||||
*/
|
||||
package japa.parser.ast;
|
||||
|
||||
import japa.parser.ast.body.JavadocComment;
|
||||
|
||||
/**
|
||||
* Abstract class for all AST nodes that represent comments.
|
||||
*
|
||||
* @see BlockComment
|
||||
* @see LineComment
|
||||
* @see JavadocComment
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class Comment extends Node {
|
||||
|
||||
private String content;
|
||||
|
||||
public Comment() {
|
||||
}
|
||||
|
||||
public Comment(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Comment(int beginLine, int beginColumn, int endLine, int endColumn, String content) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the text of the comment.
|
||||
*
|
||||
* @return text of the comment
|
||||
*/
|
||||
public final String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text of the comment.
|
||||
*
|
||||
* @param content
|
||||
* the text of the comment to set
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast;
|
||||
|
||||
import japa.parser.ast.body.AnnotationDeclaration;
|
||||
import japa.parser.ast.body.ClassOrInterfaceDeclaration;
|
||||
import japa.parser.ast.body.EmptyTypeDeclaration;
|
||||
import japa.parser.ast.body.EnumDeclaration;
|
||||
import japa.parser.ast.body.JavadocComment;
|
||||
import japa.parser.ast.body.TypeDeclaration;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class represents the entire compilation unit. Each java file denotes a
|
||||
* compilation unit.
|
||||
* </p>
|
||||
* The CompilationUnit is constructed following the syntax:<br>
|
||||
* <code>
|
||||
* <table>
|
||||
* <tr valign=baseline>
|
||||
* <td align=right>CompilationUnit</td>
|
||||
* <td align=center>::=</td>
|
||||
* <td align=left>
|
||||
* ( {@link PackageDeclaration} )?<br>
|
||||
* ( {@link ImportDeclaration} )*<br>
|
||||
* ( {@link TypeDeclaration} )*<br>
|
||||
* </td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* </code>
|
||||
*
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class CompilationUnit extends Node {
|
||||
|
||||
private PackageDeclaration pakage;
|
||||
|
||||
private List<ImportDeclaration> imports;
|
||||
|
||||
private List<TypeDeclaration> types;
|
||||
|
||||
private List<Comment> comments;
|
||||
|
||||
public CompilationUnit() {
|
||||
}
|
||||
|
||||
public CompilationUnit(PackageDeclaration pakage, List<ImportDeclaration> imports, List<TypeDeclaration> types, List<Comment> comments) {
|
||||
this.pakage = pakage;
|
||||
this.imports = imports;
|
||||
this.types = types;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public CompilationUnit(int beginLine, int beginColumn, int endLine, int endColumn, PackageDeclaration pakage, List<ImportDeclaration> imports, List<TypeDeclaration> types, List<Comment> comments) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.pakage = pakage;
|
||||
this.imports = imports;
|
||||
this.types = types;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list containing all comments declared in this compilation unit.
|
||||
* Including javadocs, line comments and block comments of all types,
|
||||
* inner-classes and other members.<br>
|
||||
* If there is no comment, <code>null</code> is returned.
|
||||
*
|
||||
* @return list with all comments of this compilation unit or
|
||||
* <code>null</code>
|
||||
* @see JavadocComment
|
||||
* @see LineComment
|
||||
* @see BlockComment
|
||||
*/
|
||||
public List<Comment> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of imports declared in this compilation unit or
|
||||
* <code>null</code> if there is no import.
|
||||
*
|
||||
* @return the list of imports or <code>null</code> if there is no import
|
||||
*/
|
||||
public List<ImportDeclaration> getImports() {
|
||||
return imports;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the package declaration of this compilation unit.<br>
|
||||
* If this compilation unit has no package declaration (default package),
|
||||
* <code>null</code> is returned.
|
||||
*
|
||||
* @return the package declaration or <code>null</code>
|
||||
*/
|
||||
public PackageDeclaration getPackage() {
|
||||
return pakage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of types declared in this compilation unit.<br>
|
||||
* If there is no types declared, <code>null</code> is returned.
|
||||
*
|
||||
* @return the list of types or <code>null</code> null if there is no type
|
||||
* @see AnnotationDeclaration
|
||||
* @see ClassOrInterfaceDeclaration
|
||||
* @see EmptyTypeDeclaration
|
||||
* @see EnumDeclaration
|
||||
*/
|
||||
public List<TypeDeclaration> getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list of comments of this compilation unit.
|
||||
*
|
||||
* @param comments
|
||||
* the list of comments
|
||||
*/
|
||||
public void setComments(List<Comment> comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list of imports of this compilation unit. The list is initially
|
||||
* <code>null</code>.
|
||||
*
|
||||
* @param imports
|
||||
* the list of imports
|
||||
*/
|
||||
public void setImports(List<ImportDeclaration> imports) {
|
||||
this.imports = imports;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or clear the package declarations of this compilation unit.
|
||||
*
|
||||
* @param pakage
|
||||
* the pakage declaration to set or <code>null</code> 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<TypeDeclaration> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast;
|
||||
|
||||
import japa.parser.ast.expr.NameExpr;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class represents a import declaration. Imports are optional for the
|
||||
* {@link CompilationUnit}.
|
||||
* </p>
|
||||
* The ImportDeclaration is constructed following the syntax:<br>
|
||||
* <code>
|
||||
* <table>
|
||||
* <tr valign=baseline>
|
||||
* <td align=right>ImportDeclaration</td>
|
||||
* <td align=center>::=</td>
|
||||
* <td align=left>
|
||||
* "import" ( "static" )? {@link NameExpr} ( "." "*" )? ";"
|
||||
* </td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* </code>
|
||||
*
|
||||
* @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 <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the name of the import.
|
||||
*
|
||||
* @return the name of the import
|
||||
*/
|
||||
public NameExpr getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the import ends with "*".
|
||||
*
|
||||
* @return <code>true</code> if the import ends with "*", <code>false</code>
|
||||
* otherwise
|
||||
*/
|
||||
public boolean isAsterisk() {
|
||||
return asterisk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the import is static.
|
||||
*
|
||||
* @return <code>true</code> if the import is static, <code>false</code>
|
||||
* otherwise
|
||||
*/
|
||||
public boolean isStatic() {
|
||||
return static_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if this import is asterisk.
|
||||
*
|
||||
* @param asterisk
|
||||
* <code>true</code> 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_
|
||||
* <code>true</code> if this import is static
|
||||
*/
|
||||
public void setStatic(boolean static_) {
|
||||
this.static_ = static_;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 23/05/2008
|
||||
*/
|
||||
package japa.parser.ast;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* AST node that represent line comments.
|
||||
* </p>
|
||||
* 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 <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast;
|
||||
|
||||
import japa.parser.ast.visitor.DumpVisitor;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* Abstract class for all nodes of the AST.
|
||||
*
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class Node {
|
||||
|
||||
private int beginLine;
|
||||
|
||||
private int beginColumn;
|
||||
|
||||
private int endLine;
|
||||
|
||||
private int endColumn;
|
||||
|
||||
/**
|
||||
* This attribute can store additional information from semantic analysis.
|
||||
*/
|
||||
private Object data;
|
||||
|
||||
public Node() {
|
||||
}
|
||||
|
||||
public Node(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
this.beginLine = beginLine;
|
||||
this.beginColumn = beginColumn;
|
||||
this.endLine = endLine;
|
||||
this.endColumn = endColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept method for visitor support.
|
||||
*
|
||||
* @param <R>
|
||||
* the type the return value of the visitor
|
||||
* @param <A>
|
||||
* the type the argument passed for the visitor
|
||||
* @param v
|
||||
* the visitor implementation
|
||||
* @param arg
|
||||
* any value relevant for the visitor
|
||||
* @return the result of the visit
|
||||
*/
|
||||
public abstract <R, A> R accept(GenericVisitor<R, A> v, A arg);
|
||||
|
||||
/**
|
||||
* Accept method for visitor support.
|
||||
*
|
||||
* @param <A>
|
||||
* the type the argument passed for the visitor
|
||||
* @param v
|
||||
* the visitor implementation
|
||||
* @param arg
|
||||
* any value relevant for the visitor
|
||||
*/
|
||||
public abstract <A> void accept(VoidVisitor<A> v, A arg);
|
||||
|
||||
/**
|
||||
* Return the begin column of this node.
|
||||
*
|
||||
* @return the begin column of this node
|
||||
*/
|
||||
public final int getBeginColumn() {
|
||||
return beginColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the begin line of this node.
|
||||
*
|
||||
* @return the begin line of this node
|
||||
*/
|
||||
public final int getBeginLine() {
|
||||
return beginLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to retrieve additional information associated to this node.
|
||||
*/
|
||||
public final Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the end column of this node.
|
||||
*
|
||||
* @return the end column of this node
|
||||
*/
|
||||
public final int getEndColumn() {
|
||||
return endColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the end line of this node.
|
||||
*
|
||||
* @return the end line of this node
|
||||
*/
|
||||
public final int getEndLine() {
|
||||
return endLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the begin column of this node.
|
||||
*
|
||||
* @param beginColumn
|
||||
* the begin column of this node
|
||||
*/
|
||||
public final void setBeginColumn(int beginColumn) {
|
||||
this.beginColumn = beginColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the begin line of this node.
|
||||
*
|
||||
* @param beginLine
|
||||
* the begin line of this node
|
||||
*/
|
||||
public final void setBeginLine(int beginLine) {
|
||||
this.beginLine = beginLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to store additional information to this node.
|
||||
*/
|
||||
public final void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the end column of this node.
|
||||
*
|
||||
* @param endColumn
|
||||
* the end column of this node
|
||||
*/
|
||||
public final void setEndColumn(int endColumn) {
|
||||
this.endColumn = endColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the end line of this node.
|
||||
*
|
||||
* @param endLine
|
||||
* the end line of this node
|
||||
*/
|
||||
public final void setEndLine(int endLine) {
|
||||
this.endLine = endLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the String representation of this node.
|
||||
*
|
||||
* @return the String representation of this node
|
||||
*/
|
||||
@Override
|
||||
public final String toString() {
|
||||
DumpVisitor visitor = new DumpVisitor();
|
||||
accept(visitor, null);
|
||||
return visitor.getSource();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 17/10/2007
|
||||
*/
|
||||
package japa.parser.ast;
|
||||
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.expr.NameExpr;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class represents the package declaration. The package declaration is
|
||||
* optional for the {@link CompilationUnit}.
|
||||
* </p>
|
||||
* The PackageDeclaration is constructed following the syntax:<br>
|
||||
* <code>
|
||||
* <table>
|
||||
* <tr valign=baseline>
|
||||
* <td align=right>PackageDeclaration</td>
|
||||
* <td align=center>::=</td>
|
||||
* <td align=left>
|
||||
* ( {@link AnnotationExpr} )* "package" {@link NameExpr} ) ";"
|
||||
* </td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* </code>
|
||||
*
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class PackageDeclaration extends Node {
|
||||
|
||||
private List<AnnotationExpr> annotations;
|
||||
|
||||
private NameExpr name;
|
||||
|
||||
public PackageDeclaration() {
|
||||
}
|
||||
|
||||
public PackageDeclaration(NameExpr name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public PackageDeclaration(List<AnnotationExpr> annotations, NameExpr name) {
|
||||
this.annotations = annotations;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public PackageDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations, NameExpr name) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.annotations = annotations;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of annotations declared before the package
|
||||
* declaration. Return <code>null</code> if there are no annotations.
|
||||
*
|
||||
* @return list of annotations or <code>null</code>
|
||||
*/
|
||||
public List<AnnotationExpr> getAnnotations() {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the package.
|
||||
*
|
||||
* @return the name of the package
|
||||
*/
|
||||
public NameExpr getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param annotations
|
||||
* the annotations to set
|
||||
*/
|
||||
public void setAnnotations(List<AnnotationExpr> annotations) {
|
||||
this.annotations = annotations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of this package declaration.
|
||||
*
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(NameExpr name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast;
|
||||
|
||||
import japa.parser.ast.type.ClassOrInterfaceType;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class represents the declaration of a genetics argument.
|
||||
* </p>
|
||||
* The TypeParameter is constructed following the syntax:<br>
|
||||
* <code>
|
||||
* <table>
|
||||
* <tr valign=baseline>
|
||||
* <td align=right>TypeParameter</td>
|
||||
* <td align=center>::=</td>
|
||||
* <td align=left>
|
||||
* <IDENTIFIER> ( "extends" {@link ClassOrInterfaceType} ( "&" {@link ClassOrInterfaceType} )* )?
|
||||
* </td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* </code>
|
||||
*
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class TypeParameter extends Node {
|
||||
|
||||
private String name;
|
||||
|
||||
private List<ClassOrInterfaceType> typeBound;
|
||||
|
||||
public TypeParameter() {
|
||||
}
|
||||
|
||||
public TypeParameter(String name, List<ClassOrInterfaceType> typeBound) {
|
||||
this.name = name;
|
||||
this.typeBound = typeBound;
|
||||
}
|
||||
|
||||
public TypeParameter(int beginLine, int beginColumn, int endLine, int endColumn, String name, List<ClassOrInterfaceType> typeBound) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.name = name;
|
||||
this.typeBound = typeBound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the paramenter.
|
||||
*
|
||||
* @return the name of the paramenter
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of {@link ClassOrInterfaceType} that this parameter
|
||||
* extends. Return <code>null</code> null if there are no type.
|
||||
*
|
||||
* @return list of types that this paramente extends or <code>null</code>
|
||||
*/
|
||||
public List<ClassOrInterfaceType> getTypeBound() {
|
||||
return typeBound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of this type parameter.
|
||||
*
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list o types.
|
||||
*
|
||||
* @param typeBound
|
||||
* the typeBound to set
|
||||
*/
|
||||
public void setTypeBound(List<ClassOrInterfaceType> typeBound) {
|
||||
this.typeBound = typeBound;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 21/11/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class AnnotationDeclaration extends TypeDeclaration {
|
||||
|
||||
public AnnotationDeclaration() {
|
||||
}
|
||||
|
||||
public AnnotationDeclaration(int modifiers, String name) {
|
||||
super(modifiers, name);
|
||||
}
|
||||
|
||||
public AnnotationDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, String name, List<BodyDeclaration> members) {
|
||||
super(annotations, javaDoc, modifiers, name, members);
|
||||
}
|
||||
|
||||
public AnnotationDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, String name, List<BodyDeclaration> members) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc, modifiers, name, members);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 21/11/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class AnnotationMemberDeclaration extends BodyDeclaration {
|
||||
|
||||
private int modifiers;
|
||||
|
||||
private Type type;
|
||||
|
||||
private String name;
|
||||
|
||||
private Expression defaultValue;
|
||||
|
||||
public AnnotationMemberDeclaration() {
|
||||
}
|
||||
|
||||
public AnnotationMemberDeclaration(int modifiers, Type type, String name, Expression defaultValue) {
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public AnnotationMemberDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, Type type, String name, Expression defaultValue) {
|
||||
super(annotations, javaDoc);
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public AnnotationMemberDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, Type type, String name, Expression defaultValue) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc);
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this member declaration.
|
||||
*
|
||||
* @see ModifierSet
|
||||
* @return modifiers
|
||||
*/
|
||||
public int getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setDefaultValue(Expression defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public void setModifiers(int modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.Node;
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class BodyDeclaration extends Node {
|
||||
|
||||
private JavadocComment javaDoc;
|
||||
|
||||
private List<AnnotationExpr> annotations;
|
||||
|
||||
public BodyDeclaration() {
|
||||
}
|
||||
|
||||
public BodyDeclaration(List<AnnotationExpr> annotations, JavadocComment javaDoc) {
|
||||
this.javaDoc = javaDoc;
|
||||
this.annotations = annotations;
|
||||
}
|
||||
|
||||
public BodyDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations, JavadocComment javaDoc) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.javaDoc = javaDoc;
|
||||
this.annotations = annotations;
|
||||
}
|
||||
|
||||
public final JavadocComment getJavaDoc() {
|
||||
return javaDoc;
|
||||
}
|
||||
|
||||
public final List<AnnotationExpr> getAnnotations() {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
public final void setJavaDoc(JavadocComment javaDoc) {
|
||||
this.javaDoc = javaDoc;
|
||||
}
|
||||
|
||||
public final void setAnnotations(List<AnnotationExpr> annotations) {
|
||||
this.annotations = annotations;
|
||||
}
|
||||
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.TypeParameter;
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.type.ClassOrInterfaceType;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ClassOrInterfaceDeclaration extends TypeDeclaration {
|
||||
|
||||
private boolean interface_;
|
||||
|
||||
private List<TypeParameter> typeParameters;
|
||||
|
||||
private List<ClassOrInterfaceType> extendsList;
|
||||
|
||||
private List<ClassOrInterfaceType> implementsList;
|
||||
|
||||
public ClassOrInterfaceDeclaration() {
|
||||
}
|
||||
|
||||
public ClassOrInterfaceDeclaration(int modifiers, boolean isInterface, String name) {
|
||||
super(modifiers, name);
|
||||
this.interface_ = isInterface;
|
||||
}
|
||||
|
||||
public ClassOrInterfaceDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, boolean isInterface, String name, List<TypeParameter> typeParameters, List<ClassOrInterfaceType> extendsList, List<ClassOrInterfaceType> implementsList, List<BodyDeclaration> members) {
|
||||
super(annotations, javaDoc, modifiers, name, members);
|
||||
this.interface_ = isInterface;
|
||||
this.typeParameters = typeParameters;
|
||||
this.extendsList = extendsList;
|
||||
this.implementsList = implementsList;
|
||||
}
|
||||
|
||||
public ClassOrInterfaceDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, boolean isInterface, String name, List<TypeParameter> typeParameters, List<ClassOrInterfaceType> extendsList, List<ClassOrInterfaceType> implementsList, List<BodyDeclaration> members) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc, modifiers, name, members);
|
||||
this.interface_ = isInterface;
|
||||
this.typeParameters = typeParameters;
|
||||
this.extendsList = extendsList;
|
||||
this.implementsList = implementsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<ClassOrInterfaceType> getExtends() {
|
||||
return extendsList;
|
||||
}
|
||||
|
||||
public List<ClassOrInterfaceType> getImplements() {
|
||||
return implementsList;
|
||||
}
|
||||
|
||||
public List<TypeParameter> getTypeParameters() {
|
||||
return typeParameters;
|
||||
}
|
||||
|
||||
public boolean isInterface() {
|
||||
return interface_;
|
||||
}
|
||||
|
||||
public void setExtends(List<ClassOrInterfaceType> extendsList) {
|
||||
this.extendsList = extendsList;
|
||||
}
|
||||
|
||||
public void setImplements(List<ClassOrInterfaceType> implementsList) {
|
||||
this.implementsList = implementsList;
|
||||
}
|
||||
|
||||
public void setInterface(boolean interface_) {
|
||||
this.interface_ = interface_;
|
||||
}
|
||||
|
||||
public void setTypeParameters(List<TypeParameter> typeParameters) {
|
||||
this.typeParameters = typeParameters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.TypeParameter;
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.expr.NameExpr;
|
||||
import japa.parser.ast.stmt.BlockStmt;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ConstructorDeclaration extends BodyDeclaration {
|
||||
|
||||
private int modifiers;
|
||||
|
||||
private List<TypeParameter> typeParameters;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<Parameter> parameters;
|
||||
|
||||
private List<NameExpr> throws_;
|
||||
|
||||
private BlockStmt block;
|
||||
|
||||
public ConstructorDeclaration() {
|
||||
}
|
||||
|
||||
public ConstructorDeclaration(int modifiers, String name) {
|
||||
this.modifiers = modifiers;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ConstructorDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, String name, List<Parameter> parameters, List<NameExpr> throws_, BlockStmt block) {
|
||||
super(annotations, javaDoc);
|
||||
this.modifiers = modifiers;
|
||||
this.typeParameters = typeParameters;
|
||||
this.name = name;
|
||||
this.parameters = parameters;
|
||||
this.throws_ = throws_;
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public ConstructorDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, String name, List<Parameter> parameters, List<NameExpr> throws_, BlockStmt block) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc);
|
||||
this.modifiers = modifiers;
|
||||
this.typeParameters = typeParameters;
|
||||
this.name = name;
|
||||
this.parameters = parameters;
|
||||
this.throws_ = throws_;
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public BlockStmt getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this member declaration.
|
||||
*
|
||||
* @see ModifierSet
|
||||
* @return modifiers
|
||||
*/
|
||||
public int getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<Parameter> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public List<NameExpr> getThrows() {
|
||||
return throws_;
|
||||
}
|
||||
|
||||
public List<TypeParameter> getTypeParameters() {
|
||||
return typeParameters;
|
||||
}
|
||||
|
||||
public void setBlock(BlockStmt block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public void setModifiers(int modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setParameters(List<Parameter> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public void setThrows(List<NameExpr> throws_) {
|
||||
this.throws_ = throws_;
|
||||
}
|
||||
|
||||
public void setTypeParameters(List<TypeParameter> typeParameters) {
|
||||
this.typeParameters = typeParameters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 07/11/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class EmptyMemberDeclaration extends BodyDeclaration {
|
||||
|
||||
public EmptyMemberDeclaration() {
|
||||
}
|
||||
|
||||
public EmptyMemberDeclaration(JavadocComment javaDoc) {
|
||||
super(null, javaDoc);
|
||||
}
|
||||
|
||||
public EmptyMemberDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, null, javaDoc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 20/01/2007
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class EmptyTypeDeclaration extends TypeDeclaration {
|
||||
|
||||
public EmptyTypeDeclaration() {
|
||||
}
|
||||
|
||||
public EmptyTypeDeclaration(JavadocComment javaDoc) {
|
||||
super(null, javaDoc, 0, null, null);
|
||||
}
|
||||
|
||||
public EmptyTypeDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, null, javaDoc, 0, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/11/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class EnumConstantDeclaration extends BodyDeclaration {
|
||||
|
||||
private String name;
|
||||
|
||||
private List<Expression> args;
|
||||
|
||||
private List<BodyDeclaration> classBody;
|
||||
|
||||
public EnumConstantDeclaration() {
|
||||
}
|
||||
|
||||
public EnumConstantDeclaration(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public EnumConstantDeclaration(JavadocComment javaDoc, List<AnnotationExpr> annotations, String name, List<Expression> args, List<BodyDeclaration> classBody) {
|
||||
super(annotations, javaDoc);
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
this.classBody = classBody;
|
||||
}
|
||||
|
||||
public EnumConstantDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, List<AnnotationExpr> annotations, String name, List<Expression> args, List<BodyDeclaration> classBody) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc);
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
this.classBody = classBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<Expression> getArgs() {
|
||||
return args;
|
||||
}
|
||||
|
||||
public List<BodyDeclaration> getClassBody() {
|
||||
return classBody;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setArgs(List<Expression> args) {
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public void setClassBody(List<BodyDeclaration> classBody) {
|
||||
this.classBody = classBody;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.type.ClassOrInterfaceType;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class EnumDeclaration extends TypeDeclaration {
|
||||
|
||||
private List<ClassOrInterfaceType> implementsList;
|
||||
|
||||
private List<EnumConstantDeclaration> entries;
|
||||
|
||||
public EnumDeclaration() {
|
||||
}
|
||||
|
||||
public EnumDeclaration(int modifiers, String name) {
|
||||
super(modifiers, name);
|
||||
}
|
||||
|
||||
public EnumDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, String name, List<ClassOrInterfaceType> implementsList, List<EnumConstantDeclaration> entries, List<BodyDeclaration> members) {
|
||||
super(annotations, javaDoc, modifiers, name, members);
|
||||
this.implementsList = implementsList;
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
public EnumDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, String name, List<ClassOrInterfaceType> implementsList, List<EnumConstantDeclaration> entries, List<BodyDeclaration> members) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc, modifiers, name, members);
|
||||
this.implementsList = implementsList;
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<EnumConstantDeclaration> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
public List<ClassOrInterfaceType> getImplements() {
|
||||
return implementsList;
|
||||
}
|
||||
|
||||
public void setEntries(List<EnumConstantDeclaration> entries) {
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
public void setImplements(List<ClassOrInterfaceType> implementsList) {
|
||||
this.implementsList = implementsList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class FieldDeclaration extends BodyDeclaration {
|
||||
|
||||
private int modifiers;
|
||||
|
||||
private Type type;
|
||||
|
||||
private List<VariableDeclarator> variables;
|
||||
|
||||
public FieldDeclaration() {
|
||||
}
|
||||
|
||||
public FieldDeclaration(int modifiers, Type type, VariableDeclarator variable) {
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.variables = new ArrayList<VariableDeclarator>();
|
||||
this.variables.add(variable);
|
||||
}
|
||||
|
||||
public FieldDeclaration(int modifiers, Type type, List<VariableDeclarator> variables) {
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.variables = variables;
|
||||
}
|
||||
|
||||
public FieldDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, Type type, List<VariableDeclarator> variables) {
|
||||
super(annotations, javaDoc);
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.variables = variables;
|
||||
}
|
||||
|
||||
public FieldDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, Type type, List<VariableDeclarator> variables) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc);
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.variables = variables;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this member declaration.
|
||||
*
|
||||
* @see ModifierSet
|
||||
* @return modifiers
|
||||
*/
|
||||
public int getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<VariableDeclarator> getVariables() {
|
||||
return variables;
|
||||
}
|
||||
|
||||
public void setModifiers(int modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setVariables(List<VariableDeclarator> variables) {
|
||||
this.variables = variables;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 07/11/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.stmt.BlockStmt;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class InitializerDeclaration extends BodyDeclaration {
|
||||
|
||||
private boolean isStatic;
|
||||
|
||||
private BlockStmt block;
|
||||
|
||||
public InitializerDeclaration() {
|
||||
}
|
||||
|
||||
public InitializerDeclaration(boolean isStatic, BlockStmt block) {
|
||||
this.isStatic = isStatic;
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public InitializerDeclaration(JavadocComment javaDoc, boolean isStatic, BlockStmt block) {
|
||||
super(null, javaDoc);
|
||||
this.isStatic = isStatic;
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public InitializerDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, boolean isStatic, BlockStmt block) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, null, javaDoc);
|
||||
this.isStatic = isStatic;
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public BlockStmt getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
return isStatic;
|
||||
}
|
||||
|
||||
public void setBlock(BlockStmt block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public void setStatic(boolean isStatic) {
|
||||
this.isStatic = isStatic;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 23/05/2008
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.Comment;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class JavadocComment extends Comment {
|
||||
|
||||
public JavadocComment() {
|
||||
}
|
||||
|
||||
public JavadocComment(String content) {
|
||||
super(content);
|
||||
}
|
||||
|
||||
public JavadocComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.TypeParameter;
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.expr.NameExpr;
|
||||
import japa.parser.ast.stmt.BlockStmt;
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class MethodDeclaration extends BodyDeclaration {
|
||||
|
||||
private int modifiers;
|
||||
|
||||
private List<TypeParameter> typeParameters;
|
||||
|
||||
private Type type;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<Parameter> parameters;
|
||||
|
||||
private int arrayCount;
|
||||
|
||||
private List<NameExpr> throws_;
|
||||
|
||||
private BlockStmt body;
|
||||
|
||||
public MethodDeclaration() {
|
||||
}
|
||||
|
||||
public MethodDeclaration(int modifiers, Type type, String name) {
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MethodDeclaration(int modifiers, Type type, String name, List<Parameter> parameters) {
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public MethodDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, Type type, String name, List<Parameter> parameters, int arrayCount, List<NameExpr> throws_, BlockStmt block) {
|
||||
super(annotations, javaDoc);
|
||||
this.modifiers = modifiers;
|
||||
this.typeParameters = typeParameters;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.parameters = parameters;
|
||||
this.arrayCount = arrayCount;
|
||||
this.throws_ = throws_;
|
||||
this.body = block;
|
||||
}
|
||||
|
||||
public MethodDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, Type type, String name, List<Parameter> parameters, int arrayCount, List<NameExpr> throws_, BlockStmt block) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc);
|
||||
this.modifiers = modifiers;
|
||||
this.typeParameters = typeParameters;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.parameters = parameters;
|
||||
this.arrayCount = arrayCount;
|
||||
this.throws_ = throws_;
|
||||
this.body = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public int getArrayCount() {
|
||||
return arrayCount;
|
||||
}
|
||||
|
||||
public BlockStmt getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this member declaration.
|
||||
*
|
||||
* @see ModifierSet
|
||||
* @return modifiers
|
||||
*/
|
||||
public int getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<Parameter> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public List<NameExpr> getThrows() {
|
||||
return throws_;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<TypeParameter> getTypeParameters() {
|
||||
return typeParameters;
|
||||
}
|
||||
|
||||
public void setArrayCount(int arrayCount) {
|
||||
this.arrayCount = arrayCount;
|
||||
}
|
||||
|
||||
public void setBody(BlockStmt body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public void setModifiers(int modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setParameters(List<Parameter> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public void setThrows(List<NameExpr> throws_) {
|
||||
this.throws_ = throws_;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setTypeParameters(List<TypeParameter> typeParameters) {
|
||||
this.typeParameters = typeParameters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
/**
|
||||
* Class to hold modifiers.
|
||||
*/
|
||||
public final class ModifierSet {
|
||||
|
||||
/* Definitions of the bits in the modifiers field. */
|
||||
public static final int PUBLIC = 0x0001;
|
||||
|
||||
public static final int PROTECTED = 0x0002;
|
||||
|
||||
public static final int PRIVATE = 0x0004;
|
||||
|
||||
public static final int ABSTRACT = 0x0008;
|
||||
|
||||
public static final int STATIC = 0x0010;
|
||||
|
||||
public static final int FINAL = 0x0020;
|
||||
|
||||
public static final int SYNCHRONIZED = 0x0040;
|
||||
|
||||
public static final int NATIVE = 0x0080;
|
||||
|
||||
public static final int TRANSIENT = 0x0100;
|
||||
|
||||
public static final int VOLATILE = 0x0200;
|
||||
|
||||
public static final int STRICTFP = 0x1000;
|
||||
|
||||
/**
|
||||
* Adds the given modifier.
|
||||
*/
|
||||
public static int addModifier(int modifiers, int mod) {
|
||||
return modifiers |= mod;
|
||||
}
|
||||
|
||||
public static boolean hasModifier(int modifiers, int modifier) {
|
||||
return (modifiers & modifier) != 0;
|
||||
}
|
||||
|
||||
public static boolean isAbstract(int modifiers) {
|
||||
return (modifiers & ABSTRACT) != 0;
|
||||
}
|
||||
|
||||
public static boolean isFinal(int modifiers) {
|
||||
return (modifiers & FINAL) != 0;
|
||||
}
|
||||
|
||||
public static boolean isNative(int modifiers) {
|
||||
return (modifiers & NATIVE) != 0;
|
||||
}
|
||||
|
||||
public static boolean isPrivate(int modifiers) {
|
||||
return (modifiers & PRIVATE) != 0;
|
||||
}
|
||||
|
||||
public static boolean isProtected(int modifiers) {
|
||||
return (modifiers & PROTECTED) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* A set of accessors that indicate whether the specified modifier is in the
|
||||
* set.
|
||||
*/
|
||||
|
||||
public static boolean isPublic(int modifiers) {
|
||||
return (modifiers & PUBLIC) != 0;
|
||||
}
|
||||
|
||||
public static boolean isStatic(int modifiers) {
|
||||
return (modifiers & STATIC) != 0;
|
||||
}
|
||||
|
||||
public static boolean isStrictfp(int modifiers) {
|
||||
return (modifiers & STRICTFP) != 0;
|
||||
}
|
||||
|
||||
public static boolean isSynchronized(int modifiers) {
|
||||
return (modifiers & SYNCHRONIZED) != 0;
|
||||
}
|
||||
|
||||
public static boolean isTransient(int modifiers) {
|
||||
return (modifiers & TRANSIENT) != 0;
|
||||
}
|
||||
|
||||
public static boolean isVolatile(int modifiers) {
|
||||
return (modifiers & VOLATILE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the given modifier.
|
||||
*/
|
||||
public static int removeModifier(int modifiers, int mod) {
|
||||
return modifiers &= ~mod;
|
||||
}
|
||||
|
||||
private ModifierSet() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 03/11/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.Node;
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class Parameter extends Node {
|
||||
|
||||
private int modifiers;
|
||||
|
||||
private List<AnnotationExpr> annotations;
|
||||
|
||||
private Type type;
|
||||
|
||||
private boolean isVarArgs;
|
||||
|
||||
private VariableDeclaratorId id;
|
||||
|
||||
public Parameter() {
|
||||
}
|
||||
|
||||
public Parameter(Type type, VariableDeclaratorId id) {
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Parameter(int modifiers, Type type, VariableDeclaratorId id) {
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Parameter(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, Type type, boolean isVarArgs, VariableDeclaratorId id) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.modifiers = modifiers;
|
||||
this.annotations = annotations;
|
||||
this.type = type;
|
||||
this.isVarArgs = isVarArgs;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<AnnotationExpr> getAnnotations() {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
public VariableDeclaratorId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this parameter declaration.
|
||||
*
|
||||
* @see ModifierSet
|
||||
* @return modifiers
|
||||
*/
|
||||
public int getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isVarArgs() {
|
||||
return isVarArgs;
|
||||
}
|
||||
|
||||
public void setAnnotations(List<AnnotationExpr> annotations) {
|
||||
this.annotations = annotations;
|
||||
}
|
||||
|
||||
public void setId(VariableDeclaratorId id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setModifiers(int modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setVarArgs(boolean isVarArgs) {
|
||||
this.isVarArgs = isVarArgs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.expr.AnnotationExpr;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class TypeDeclaration extends BodyDeclaration {
|
||||
|
||||
private String name;
|
||||
|
||||
private int modifiers;
|
||||
|
||||
private List<BodyDeclaration> members;
|
||||
|
||||
public TypeDeclaration() {
|
||||
}
|
||||
|
||||
public TypeDeclaration(int modifiers, String name) {
|
||||
this.name = name;
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public TypeDeclaration(List<AnnotationExpr> annotations, JavadocComment javaDoc, int modifiers, String name, List<BodyDeclaration> members) {
|
||||
super(annotations, javaDoc);
|
||||
this.name = name;
|
||||
this.modifiers = modifiers;
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
public TypeDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations, JavadocComment javaDoc, int modifiers, String name, List<BodyDeclaration> members) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc);
|
||||
this.name = name;
|
||||
this.modifiers = modifiers;
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
public final List<BodyDeclaration> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this type declaration.
|
||||
*
|
||||
* @see ModifierSet
|
||||
* @return modifiers
|
||||
*/
|
||||
public final int getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public final String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setMembers(List<BodyDeclaration> members) {
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
public final void setModifiers(int modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public final void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.Node;
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class VariableDeclarator extends Node {
|
||||
|
||||
private VariableDeclaratorId id;
|
||||
|
||||
private Expression init;
|
||||
|
||||
public VariableDeclarator() {
|
||||
}
|
||||
|
||||
public VariableDeclarator(VariableDeclaratorId id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public VariableDeclarator(VariableDeclaratorId id, Expression init) {
|
||||
this.id = id;
|
||||
this.init = init;
|
||||
}
|
||||
|
||||
public VariableDeclarator(int beginLine, int beginColumn, int endLine, int endColumn, VariableDeclaratorId id, Expression init) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.id = id;
|
||||
this.init = init;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public VariableDeclaratorId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Expression getInit() {
|
||||
return init;
|
||||
}
|
||||
|
||||
public void setId(VariableDeclaratorId id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setInit(Expression init) {
|
||||
this.init = init;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.body;
|
||||
|
||||
import japa.parser.ast.Node;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class VariableDeclaratorId extends Node {
|
||||
|
||||
private String name;
|
||||
|
||||
private int arrayCount;
|
||||
|
||||
public VariableDeclaratorId() {
|
||||
}
|
||||
|
||||
public VariableDeclaratorId(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public VariableDeclaratorId(int beginLine, int beginColumn, int endLine, int endColumn, String name, int arrayCount) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.name = name;
|
||||
this.arrayCount = arrayCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public int getArrayCount() {
|
||||
return arrayCount;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setArrayCount(int arrayCount) {
|
||||
this.arrayCount = arrayCount;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 21/11/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class AnnotationExpr extends Expression {
|
||||
|
||||
public AnnotationExpr() {
|
||||
}
|
||||
|
||||
public AnnotationExpr(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ArrayAccessExpr extends Expression {
|
||||
|
||||
private Expression name;
|
||||
|
||||
private Expression index;
|
||||
|
||||
public ArrayAccessExpr() {
|
||||
}
|
||||
|
||||
public ArrayAccessExpr(Expression name, Expression index) {
|
||||
this.name = name;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public ArrayAccessExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression name, Expression index) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.name = name;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public Expression getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setIndex(Expression index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public void setName(Expression name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ArrayCreationExpr extends Expression {
|
||||
|
||||
private Type type;
|
||||
|
||||
private int arrayCount;
|
||||
|
||||
private ArrayInitializerExpr initializer;
|
||||
|
||||
private List<Expression> dimensions;
|
||||
|
||||
public ArrayCreationExpr() {
|
||||
}
|
||||
|
||||
public ArrayCreationExpr(Type type, int arrayCount, ArrayInitializerExpr initializer) {
|
||||
this.type = type;
|
||||
this.arrayCount = arrayCount;
|
||||
this.initializer = initializer;
|
||||
this.dimensions = null;
|
||||
}
|
||||
|
||||
public ArrayCreationExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type, int arrayCount, ArrayInitializerExpr initializer) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.type = type;
|
||||
this.arrayCount = arrayCount;
|
||||
this.initializer = initializer;
|
||||
this.dimensions = null;
|
||||
}
|
||||
|
||||
public ArrayCreationExpr(Type type, List<Expression> dimensions, int arrayCount) {
|
||||
this.type = type;
|
||||
this.arrayCount = arrayCount;
|
||||
this.dimensions = dimensions;
|
||||
this.initializer = null;
|
||||
}
|
||||
|
||||
public ArrayCreationExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type, List<Expression> dimensions, int arrayCount) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.type = type;
|
||||
this.arrayCount = arrayCount;
|
||||
this.dimensions = dimensions;
|
||||
this.initializer = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public int getArrayCount() {
|
||||
return arrayCount;
|
||||
}
|
||||
|
||||
public List<Expression> getDimensions() {
|
||||
return dimensions;
|
||||
}
|
||||
|
||||
public ArrayInitializerExpr getInitializer() {
|
||||
return initializer;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setArrayCount(int arrayCount) {
|
||||
this.arrayCount = arrayCount;
|
||||
}
|
||||
|
||||
public void setDimensions(List<Expression> dimensions) {
|
||||
this.dimensions = dimensions;
|
||||
}
|
||||
|
||||
public void setInitializer(ArrayInitializerExpr initializer) {
|
||||
this.initializer = initializer;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ArrayInitializerExpr extends Expression {
|
||||
|
||||
private List<Expression> values;
|
||||
|
||||
public ArrayInitializerExpr() {
|
||||
}
|
||||
|
||||
public ArrayInitializerExpr(List<Expression> values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public ArrayInitializerExpr(int beginLine, int beginColumn, int endLine, int endColumn, List<Expression> values) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<Expression> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(List<Expression> values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class AssignExpr extends Expression {
|
||||
|
||||
public static enum Operator {
|
||||
assign, // =
|
||||
plus, // +=
|
||||
minus, // -=
|
||||
star, // *=
|
||||
slash, // /=
|
||||
and, // &=
|
||||
or, // |=
|
||||
xor, // ^=
|
||||
rem, // %=
|
||||
lShift, // <<=
|
||||
rSignedShift, // >>=
|
||||
rUnsignedShift, // >>>=
|
||||
}
|
||||
|
||||
private Expression target;
|
||||
|
||||
private Expression value;
|
||||
|
||||
private Operator op;
|
||||
|
||||
public AssignExpr() {
|
||||
}
|
||||
|
||||
public AssignExpr(Expression target, Expression value, Operator op) {
|
||||
this.target = target;
|
||||
this.value = value;
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
public AssignExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression target, Expression value, Operator op) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.target = target;
|
||||
this.value = value;
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Operator getOperator() {
|
||||
return op;
|
||||
}
|
||||
|
||||
public Expression getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public Expression getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setOperator(Operator op) {
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
public void setTarget(Expression target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public void setValue(Expression value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class BinaryExpr extends Expression {
|
||||
|
||||
public static enum Operator {
|
||||
or, // ||
|
||||
and, // &&
|
||||
binOr, // |
|
||||
binAnd, // &
|
||||
xor, // ^
|
||||
equals, // ==
|
||||
notEquals, // !=
|
||||
less, // <
|
||||
greater, // >
|
||||
lessEquals, // <=
|
||||
greaterEquals, // >=
|
||||
lShift, // <<
|
||||
rSignedShift, // >>
|
||||
rUnsignedShift, // >>>
|
||||
plus, // +
|
||||
minus, // -
|
||||
times, // *
|
||||
divide, // /
|
||||
remainder, // %
|
||||
}
|
||||
|
||||
private Expression left;
|
||||
|
||||
private Expression right;
|
||||
|
||||
private Operator op;
|
||||
|
||||
public BinaryExpr() {
|
||||
}
|
||||
|
||||
public BinaryExpr(Expression left, Expression right, Operator op) {
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
public BinaryExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression left, Expression right, Operator op) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public Operator getOperator() {
|
||||
return op;
|
||||
}
|
||||
|
||||
public Expression getRight() {
|
||||
return right;
|
||||
}
|
||||
|
||||
public void setLeft(Expression left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
public void setOperator(Operator op) {
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
public void setRight(Expression right) {
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 02/03/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class BooleanLiteralExpr extends LiteralExpr {
|
||||
|
||||
private boolean value;
|
||||
|
||||
public BooleanLiteralExpr() {
|
||||
}
|
||||
|
||||
public BooleanLiteralExpr(boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public BooleanLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, boolean value) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public boolean getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class CastExpr extends Expression {
|
||||
|
||||
private Type type;
|
||||
|
||||
private Expression expr;
|
||||
|
||||
public CastExpr() {
|
||||
}
|
||||
|
||||
public CastExpr(Type type, Expression expr) {
|
||||
this.type = type;
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
public CastExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type, Expression expr) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.type = type;
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setExpr(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 02/03/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class CharLiteralExpr extends StringLiteralExpr {
|
||||
|
||||
public CharLiteralExpr() {
|
||||
}
|
||||
|
||||
public CharLiteralExpr(String value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public CharLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, String value) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ClassExpr extends Expression {
|
||||
|
||||
private Type type;
|
||||
|
||||
public ClassExpr() {
|
||||
}
|
||||
|
||||
public ClassExpr(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ClassExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ConditionalExpr extends Expression {
|
||||
|
||||
private Expression condition;
|
||||
|
||||
private Expression thenExpr;
|
||||
|
||||
private Expression elseExpr;
|
||||
|
||||
public ConditionalExpr() {
|
||||
}
|
||||
|
||||
public ConditionalExpr(Expression condition, Expression thenExpr, Expression elseExpr) {
|
||||
this.condition = condition;
|
||||
this.thenExpr = thenExpr;
|
||||
this.elseExpr = elseExpr;
|
||||
}
|
||||
|
||||
public ConditionalExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression condition, Expression thenExpr, Expression elseExpr) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.condition = condition;
|
||||
this.thenExpr = thenExpr;
|
||||
this.elseExpr = elseExpr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Expression getElseExpr() {
|
||||
return elseExpr;
|
||||
}
|
||||
|
||||
public Expression getThenExpr() {
|
||||
return thenExpr;
|
||||
}
|
||||
|
||||
public void setCondition(Expression condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
public void setElseExpr(Expression elseExpr) {
|
||||
this.elseExpr = elseExpr;
|
||||
}
|
||||
|
||||
public void setThenExpr(Expression thenExpr) {
|
||||
this.thenExpr = thenExpr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 02/03/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class DoubleLiteralExpr extends StringLiteralExpr {
|
||||
|
||||
public DoubleLiteralExpr() {
|
||||
}
|
||||
|
||||
public DoubleLiteralExpr(String value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public DoubleLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, String value) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class EnclosedExpr extends Expression {
|
||||
|
||||
private Expression inner;
|
||||
|
||||
public EnclosedExpr() {
|
||||
}
|
||||
|
||||
public EnclosedExpr(Expression inner) {
|
||||
this.inner = inner;
|
||||
}
|
||||
|
||||
public EnclosedExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression inner) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.inner = inner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getInner() {
|
||||
return inner;
|
||||
}
|
||||
|
||||
public void setInner(Expression inner) {
|
||||
this.inner = inner;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 10/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.Node;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class Expression extends Node {
|
||||
|
||||
public Expression() {
|
||||
}
|
||||
|
||||
public Expression(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class FieldAccessExpr extends Expression {
|
||||
|
||||
private Expression scope;
|
||||
|
||||
private List<Type> typeArgs;
|
||||
|
||||
private String field;
|
||||
|
||||
public FieldAccessExpr() {
|
||||
}
|
||||
|
||||
public FieldAccessExpr(Expression scope, String field) {
|
||||
this.scope = scope;
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public FieldAccessExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression scope, List<Type> typeArgs, String field) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.scope = scope;
|
||||
this.typeArgs = typeArgs;
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public String getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public Expression getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public List<Type> getTypeArgs() {
|
||||
return typeArgs;
|
||||
}
|
||||
|
||||
public void setField(String field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public void setScope(Expression scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public void setTypeArgs(List<Type> typeArgs) {
|
||||
this.typeArgs = typeArgs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class InstanceOfExpr extends Expression {
|
||||
|
||||
private Expression expr;
|
||||
|
||||
private Type type;
|
||||
|
||||
public InstanceOfExpr() {
|
||||
}
|
||||
|
||||
public InstanceOfExpr(Expression expr, Type type) {
|
||||
this.expr = expr;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public InstanceOfExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression expr, Type type) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.expr = expr;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setExpr(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 02/03/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public class IntegerLiteralExpr extends StringLiteralExpr {
|
||||
|
||||
private static final String UNSIGNED_MIN_VALUE = "2147483648";
|
||||
|
||||
protected static final String MIN_VALUE = "-" + UNSIGNED_MIN_VALUE;
|
||||
|
||||
public IntegerLiteralExpr() {
|
||||
}
|
||||
|
||||
public IntegerLiteralExpr(String value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public IntegerLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, String value) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public final boolean isMinValue() {
|
||||
return value != null && //
|
||||
value.length() == 10 && //
|
||||
value.equals(UNSIGNED_MIN_VALUE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 09/03/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class IntegerLiteralMinValueExpr extends IntegerLiteralExpr {
|
||||
|
||||
public IntegerLiteralMinValueExpr() {
|
||||
super(MIN_VALUE);
|
||||
}
|
||||
|
||||
public IntegerLiteralMinValueExpr(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, MIN_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class LiteralExpr extends Expression {
|
||||
|
||||
public LiteralExpr() {
|
||||
}
|
||||
|
||||
public LiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 02/03/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public class LongLiteralExpr extends StringLiteralExpr {
|
||||
|
||||
private static final String UNSIGNED_MIN_VALUE = "9223372036854775808";
|
||||
|
||||
protected static final String MIN_VALUE = "-" + UNSIGNED_MIN_VALUE + "L";
|
||||
|
||||
public LongLiteralExpr() {
|
||||
}
|
||||
|
||||
public LongLiteralExpr(String value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public LongLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, String value) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public final boolean isMinValue() {
|
||||
return value != null && //
|
||||
value.length() == 20 && //
|
||||
value.startsWith(UNSIGNED_MIN_VALUE) && //
|
||||
(value.charAt(19) == 'L' || value.charAt(19) == 'l');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 09/03/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class LongLiteralMinValueExpr extends LongLiteralExpr {
|
||||
|
||||
public LongLiteralMinValueExpr() {
|
||||
super(MIN_VALUE);
|
||||
}
|
||||
|
||||
public LongLiteralMinValueExpr(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, MIN_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 21/11/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class MarkerAnnotationExpr extends AnnotationExpr {
|
||||
|
||||
private NameExpr name;
|
||||
|
||||
public MarkerAnnotationExpr() {
|
||||
}
|
||||
|
||||
public MarkerAnnotationExpr(NameExpr name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MarkerAnnotationExpr(int beginLine, int beginColumn, int endLine, int endColumn, NameExpr name) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public NameExpr getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(NameExpr name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 21/11/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.Node;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class MemberValuePair extends Node {
|
||||
|
||||
private String name;
|
||||
|
||||
private Expression value;
|
||||
|
||||
public MemberValuePair() {
|
||||
}
|
||||
|
||||
public MemberValuePair(String name, Expression value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public MemberValuePair(int beginLine, int beginColumn, int endLine, int endColumn, String name, Expression value) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Expression getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setValue(Expression value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class MethodCallExpr extends Expression {
|
||||
|
||||
private Expression scope;
|
||||
|
||||
private List<Type> typeArgs;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<Expression> args;
|
||||
|
||||
public MethodCallExpr() {
|
||||
}
|
||||
|
||||
public MethodCallExpr(Expression scope, String name) {
|
||||
this.scope = scope;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MethodCallExpr(Expression scope, String name, List<Expression> args) {
|
||||
this.scope = scope;
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public MethodCallExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression scope, List<Type> typeArgs, String name, List<Expression> args) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.scope = scope;
|
||||
this.typeArgs = typeArgs;
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<Expression> getArgs() {
|
||||
return args;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Expression getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public List<Type> getTypeArgs() {
|
||||
return typeArgs;
|
||||
}
|
||||
|
||||
public void setArgs(List<Expression> args) {
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setScope(Expression scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public void setTypeArgs(List<Type> typeArgs) {
|
||||
this.typeArgs = typeArgs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public class NameExpr extends Expression {
|
||||
|
||||
private String name;
|
||||
|
||||
public NameExpr() {
|
||||
}
|
||||
|
||||
public NameExpr(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public NameExpr(int beginLine, int beginColumn, int endLine, int endColumn, String name) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public final String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public final void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 21/11/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class NormalAnnotationExpr extends AnnotationExpr {
|
||||
|
||||
private NameExpr name;
|
||||
|
||||
private List<MemberValuePair> pairs;
|
||||
|
||||
public NormalAnnotationExpr() {
|
||||
}
|
||||
|
||||
public NormalAnnotationExpr(NameExpr name, List<MemberValuePair> pairs) {
|
||||
this.name = name;
|
||||
this.pairs = pairs;
|
||||
}
|
||||
|
||||
public NormalAnnotationExpr(int beginLine, int beginColumn, int endLine, int endColumn, NameExpr name, List<MemberValuePair> pairs) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.name = name;
|
||||
this.pairs = pairs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public NameExpr getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<MemberValuePair> getPairs() {
|
||||
return pairs;
|
||||
}
|
||||
|
||||
public void setName(NameExpr name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setPairs(List<MemberValuePair> pairs) {
|
||||
this.pairs = pairs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 02/03/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class NullLiteralExpr extends LiteralExpr {
|
||||
|
||||
public NullLiteralExpr() {
|
||||
}
|
||||
|
||||
public NullLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.body.BodyDeclaration;
|
||||
import japa.parser.ast.type.ClassOrInterfaceType;
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ObjectCreationExpr extends Expression {
|
||||
|
||||
private Expression scope;
|
||||
|
||||
private ClassOrInterfaceType type;
|
||||
|
||||
private List<Type> typeArgs;
|
||||
|
||||
private List<Expression> args;
|
||||
|
||||
private List<BodyDeclaration> anonymousClassBody;
|
||||
|
||||
public ObjectCreationExpr() {
|
||||
}
|
||||
|
||||
public ObjectCreationExpr(Expression scope, ClassOrInterfaceType type, List<Expression> args) {
|
||||
this.scope = scope;
|
||||
this.type = type;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public ObjectCreationExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression scope, ClassOrInterfaceType type, List<Type> typeArgs, List<Expression> args, List<BodyDeclaration> anonymousBody) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.scope = scope;
|
||||
this.type = type;
|
||||
this.typeArgs = typeArgs;
|
||||
this.args = args;
|
||||
this.anonymousClassBody = anonymousBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<BodyDeclaration> getAnonymousClassBody() {
|
||||
return anonymousClassBody;
|
||||
}
|
||||
|
||||
public List<Expression> getArgs() {
|
||||
return args;
|
||||
}
|
||||
|
||||
public Expression getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public ClassOrInterfaceType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<Type> getTypeArgs() {
|
||||
return typeArgs;
|
||||
}
|
||||
|
||||
public void setAnonymousClassBody(List<BodyDeclaration> anonymousClassBody) {
|
||||
this.anonymousClassBody = anonymousClassBody;
|
||||
}
|
||||
|
||||
public void setArgs(List<Expression> args) {
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public void setScope(Expression scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public void setType(ClassOrInterfaceType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setTypeArgs(List<Type> typeArgs) {
|
||||
this.typeArgs = typeArgs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class QualifiedNameExpr extends NameExpr {
|
||||
|
||||
private NameExpr qualifier;
|
||||
|
||||
public QualifiedNameExpr() {
|
||||
}
|
||||
|
||||
public QualifiedNameExpr(NameExpr scope, String name) {
|
||||
super(name);
|
||||
this.qualifier = scope;
|
||||
}
|
||||
|
||||
public QualifiedNameExpr(int beginLine, int beginColumn, int endLine, int endColumn, NameExpr scope, String name) {
|
||||
super(beginLine, beginColumn, endLine, endColumn, name);
|
||||
this.qualifier = scope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public NameExpr getQualifier() {
|
||||
return qualifier;
|
||||
}
|
||||
|
||||
public void setQualifier(NameExpr qualifier) {
|
||||
this.qualifier = qualifier;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 21/11/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class SingleMemberAnnotationExpr extends AnnotationExpr {
|
||||
|
||||
private NameExpr name;
|
||||
|
||||
private Expression memberValue;
|
||||
|
||||
public SingleMemberAnnotationExpr() {
|
||||
}
|
||||
|
||||
public SingleMemberAnnotationExpr(NameExpr name, Expression memberValue) {
|
||||
this.name = name;
|
||||
this.memberValue = memberValue;
|
||||
}
|
||||
|
||||
public SingleMemberAnnotationExpr(int beginLine, int beginColumn, int endLine, int endColumn, NameExpr name, Expression memberValue) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.name = name;
|
||||
this.memberValue = memberValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getMemberValue() {
|
||||
return memberValue;
|
||||
}
|
||||
|
||||
public NameExpr getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setMemberValue(Expression memberValue) {
|
||||
this.memberValue = memberValue;
|
||||
}
|
||||
|
||||
public void setName(NameExpr name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 02/03/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public class StringLiteralExpr extends LiteralExpr {
|
||||
|
||||
protected String value;
|
||||
|
||||
public StringLiteralExpr() {
|
||||
}
|
||||
|
||||
public StringLiteralExpr(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public StringLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, String value) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public final String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public final void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 20/01/2007
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class SuperExpr extends Expression {
|
||||
|
||||
private Expression classExpr;
|
||||
|
||||
public SuperExpr() {
|
||||
}
|
||||
|
||||
public SuperExpr(Expression classExpr) {
|
||||
this.classExpr = classExpr;
|
||||
}
|
||||
|
||||
public SuperExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression classExpr) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.classExpr = classExpr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getClassExpr() {
|
||||
return classExpr;
|
||||
}
|
||||
|
||||
public void setClassExpr(Expression classExpr) {
|
||||
this.classExpr = classExpr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ThisExpr extends Expression {
|
||||
|
||||
private Expression classExpr;
|
||||
|
||||
public ThisExpr() {
|
||||
}
|
||||
|
||||
public ThisExpr(Expression classExpr) {
|
||||
this.classExpr = classExpr;
|
||||
}
|
||||
|
||||
public ThisExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression classExpr) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.classExpr = classExpr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getClassExpr() {
|
||||
return classExpr;
|
||||
}
|
||||
|
||||
public void setClassExpr(Expression classExpr) {
|
||||
this.classExpr = classExpr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class UnaryExpr extends Expression {
|
||||
|
||||
public static enum Operator {
|
||||
positive, // +
|
||||
negative, // -
|
||||
preIncrement, // ++
|
||||
preDecrement, // --
|
||||
not, // !
|
||||
inverse, // ~
|
||||
posIncrement, // ++
|
||||
posDecrement, // --
|
||||
}
|
||||
|
||||
private Expression expr;
|
||||
|
||||
private Operator op;
|
||||
|
||||
public UnaryExpr() {
|
||||
}
|
||||
|
||||
public UnaryExpr(Expression expr, Operator op) {
|
||||
this.expr = expr;
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
public UnaryExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression expr, Operator op) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.expr = expr;
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public Operator getOperator() {
|
||||
return op;
|
||||
}
|
||||
|
||||
public void setExpr(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
public void setOperator(Operator op) {
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 03/11/2006
|
||||
*/
|
||||
package japa.parser.ast.expr;
|
||||
|
||||
import japa.parser.ast.body.ModifierSet;
|
||||
import japa.parser.ast.body.VariableDeclarator;
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class VariableDeclarationExpr extends Expression {
|
||||
|
||||
private int modifiers;
|
||||
|
||||
private List<AnnotationExpr> annotations;
|
||||
|
||||
private Type type;
|
||||
|
||||
private List<VariableDeclarator> vars;
|
||||
|
||||
public VariableDeclarationExpr() {
|
||||
}
|
||||
|
||||
public VariableDeclarationExpr(Type type, List<VariableDeclarator> vars) {
|
||||
this.type = type;
|
||||
this.vars = vars;
|
||||
}
|
||||
|
||||
public VariableDeclarationExpr(int modifiers, Type type, List<VariableDeclarator> vars) {
|
||||
this.modifiers = modifiers;
|
||||
this.type = type;
|
||||
this.vars = vars;
|
||||
}
|
||||
|
||||
public VariableDeclarationExpr(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, Type type, List<VariableDeclarator> vars) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.modifiers = modifiers;
|
||||
this.annotations = annotations;
|
||||
this.type = type;
|
||||
this.vars = vars;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<AnnotationExpr> getAnnotations() {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modifiers of this variable declaration.
|
||||
*
|
||||
* @see ModifierSet
|
||||
* @return modifiers
|
||||
*/
|
||||
public int getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<VariableDeclarator> getVars() {
|
||||
return vars;
|
||||
}
|
||||
|
||||
public void setAnnotations(List<AnnotationExpr> annotations) {
|
||||
this.annotations = annotations;
|
||||
}
|
||||
|
||||
public void setModifiers(int modifiers) {
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setVars(List<VariableDeclarator> vars) {
|
||||
this.vars = vars;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class AssertStmt extends Statement {
|
||||
|
||||
private Expression check;
|
||||
|
||||
private Expression msg;
|
||||
|
||||
public AssertStmt() {
|
||||
}
|
||||
|
||||
public AssertStmt(Expression check) {
|
||||
this.check = check;
|
||||
}
|
||||
|
||||
public AssertStmt(Expression check, Expression msg) {
|
||||
this.check = check;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public AssertStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression check, Expression msg) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.check = check;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getCheck() {
|
||||
return check;
|
||||
}
|
||||
|
||||
public Expression getMessage() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setCheck(Expression check) {
|
||||
this.check = check;
|
||||
}
|
||||
|
||||
public void setMessage(Expression msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class BlockStmt extends Statement {
|
||||
|
||||
private List<Statement> stmts;
|
||||
|
||||
public BlockStmt() {
|
||||
}
|
||||
|
||||
public BlockStmt(List<Statement> stmts) {
|
||||
this.stmts = stmts;
|
||||
}
|
||||
|
||||
public BlockStmt(int beginLine, int beginColumn, int endLine, int endColumn, List<Statement> stmts) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.stmts = stmts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<Statement> getStmts() {
|
||||
return stmts;
|
||||
}
|
||||
|
||||
public void setStmts(List<Statement> stmts) {
|
||||
this.stmts = stmts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class BreakStmt extends Statement {
|
||||
|
||||
private String id;
|
||||
|
||||
public BreakStmt() {
|
||||
}
|
||||
|
||||
public BreakStmt(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public BreakStmt(int beginLine, int beginColumn, int endLine, int endColumn, String id) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 18/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.Node;
|
||||
import japa.parser.ast.body.Parameter;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class CatchClause extends Node {
|
||||
|
||||
private Parameter except;
|
||||
|
||||
private BlockStmt catchBlock;
|
||||
|
||||
public CatchClause() {
|
||||
}
|
||||
|
||||
public CatchClause(Parameter except, BlockStmt catchBlock) {
|
||||
this.except = except;
|
||||
this.catchBlock = catchBlock;
|
||||
}
|
||||
|
||||
public CatchClause(int beginLine, int beginColumn, int endLine, int endColumn, Parameter except, BlockStmt catchBlock) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.except = except;
|
||||
this.catchBlock = catchBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public BlockStmt getCatchBlock() {
|
||||
return catchBlock;
|
||||
}
|
||||
|
||||
public Parameter getExcept() {
|
||||
return except;
|
||||
}
|
||||
|
||||
public void setCatchBlock(BlockStmt catchBlock) {
|
||||
this.catchBlock = catchBlock;
|
||||
}
|
||||
|
||||
public void setExcept(Parameter except) {
|
||||
this.except = except;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 07/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ContinueStmt extends Statement {
|
||||
|
||||
private String id;
|
||||
|
||||
public ContinueStmt() {
|
||||
}
|
||||
|
||||
public ContinueStmt(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ContinueStmt(int beginLine, int beginColumn, int endLine, int endColumn, String id) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 07/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class DoStmt extends Statement {
|
||||
|
||||
private Statement body;
|
||||
|
||||
private Expression condition;
|
||||
|
||||
public DoStmt() {
|
||||
}
|
||||
|
||||
public DoStmt(Statement body, Expression condition) {
|
||||
this.body = body;
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
public DoStmt(int beginLine, int beginColumn, int endLine, int endColumn, Statement body, Expression condition) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.body = body;
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Statement getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public Expression getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public void setBody(Statement body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public void setCondition(Expression condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class EmptyStmt extends Statement {
|
||||
|
||||
public EmptyStmt() {
|
||||
}
|
||||
|
||||
public EmptyStmt(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 03/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.type.Type;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ExplicitConstructorInvocationStmt extends Statement {
|
||||
|
||||
private List<Type> typeArgs;
|
||||
|
||||
private boolean isThis;
|
||||
|
||||
private Expression expr;
|
||||
|
||||
private List<Expression> args;
|
||||
|
||||
public ExplicitConstructorInvocationStmt() {
|
||||
}
|
||||
|
||||
public ExplicitConstructorInvocationStmt(boolean isThis, Expression expr, List<Expression> args) {
|
||||
this.isThis = isThis;
|
||||
this.expr = expr;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public ExplicitConstructorInvocationStmt(int beginLine, int beginColumn, int endLine, int endColumn, List<Type> typeArgs, boolean isThis, Expression expr, List<Expression> args) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.typeArgs = typeArgs;
|
||||
this.isThis = isThis;
|
||||
this.expr = expr;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<Expression> getArgs() {
|
||||
return args;
|
||||
}
|
||||
|
||||
public Expression getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public List<Type> getTypeArgs() {
|
||||
return typeArgs;
|
||||
}
|
||||
|
||||
public boolean isThis() {
|
||||
return isThis;
|
||||
}
|
||||
|
||||
public void setArgs(List<Expression> args) {
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public void setExpr(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
public void setThis(boolean isThis) {
|
||||
this.isThis = isThis;
|
||||
}
|
||||
|
||||
public void setTypeArgs(List<Type> typeArgs) {
|
||||
this.typeArgs = typeArgs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ExpressionStmt extends Statement {
|
||||
|
||||
private Expression expr;
|
||||
|
||||
public ExpressionStmt() {
|
||||
}
|
||||
|
||||
public ExpressionStmt(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
public ExpressionStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression expr) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getExpression() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public void setExpression(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 07/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ForStmt extends Statement {
|
||||
|
||||
private List<Expression> init;
|
||||
|
||||
private Expression compare;
|
||||
|
||||
private List<Expression> update;
|
||||
|
||||
private Statement body;
|
||||
|
||||
public ForStmt() {
|
||||
}
|
||||
|
||||
public ForStmt(List<Expression> init, Expression compare, List<Expression> update, Statement body) {
|
||||
this.compare = compare;
|
||||
this.init = init;
|
||||
this.update = update;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public ForStmt(int beginLine, int beginColumn, int endLine, int endColumn, List<Expression> init, Expression compare, List<Expression> update, Statement body) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.compare = compare;
|
||||
this.init = init;
|
||||
this.update = update;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Statement getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public Expression getCompare() {
|
||||
return compare;
|
||||
}
|
||||
|
||||
public List<Expression> getInit() {
|
||||
return init;
|
||||
}
|
||||
|
||||
public List<Expression> getUpdate() {
|
||||
return update;
|
||||
}
|
||||
|
||||
public void setBody(Statement body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public void setCompare(Expression compare) {
|
||||
this.compare = compare;
|
||||
}
|
||||
|
||||
public void setInit(List<Expression> init) {
|
||||
this.init = init;
|
||||
}
|
||||
|
||||
public void setUpdate(List<Expression> update) {
|
||||
this.update = update;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 07/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.expr.VariableDeclarationExpr;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ForeachStmt extends Statement {
|
||||
|
||||
private VariableDeclarationExpr var;
|
||||
|
||||
private Expression iterable;
|
||||
|
||||
private Statement body;
|
||||
|
||||
public ForeachStmt() {
|
||||
}
|
||||
|
||||
public ForeachStmt(VariableDeclarationExpr var, Expression iterable, Statement body) {
|
||||
this.var = var;
|
||||
this.iterable = iterable;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public ForeachStmt(int beginLine, int beginColumn, int endLine, int endColumn, VariableDeclarationExpr var, Expression iterable, Statement body) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.var = var;
|
||||
this.iterable = iterable;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Statement getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public Expression getIterable() {
|
||||
return iterable;
|
||||
}
|
||||
|
||||
public VariableDeclarationExpr getVariable() {
|
||||
return var;
|
||||
}
|
||||
|
||||
public void setBody(Statement body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public void setIterable(Expression iterable) {
|
||||
this.iterable = iterable;
|
||||
}
|
||||
|
||||
public void setVariable(VariableDeclarationExpr var) {
|
||||
this.var = var;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 07/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class IfStmt extends Statement {
|
||||
|
||||
private Expression condition;
|
||||
|
||||
private Statement thenStmt;
|
||||
|
||||
private Statement elseStmt;
|
||||
|
||||
public IfStmt() {
|
||||
}
|
||||
|
||||
public IfStmt(Expression condition, Statement thenStmt, Statement elseStmt) {
|
||||
this.condition = condition;
|
||||
this.thenStmt = thenStmt;
|
||||
this.elseStmt = elseStmt;
|
||||
}
|
||||
|
||||
public IfStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression condition, Statement thenStmt, Statement elseStmt) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.condition = condition;
|
||||
this.thenStmt = thenStmt;
|
||||
this.elseStmt = elseStmt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Statement getElseStmt() {
|
||||
return elseStmt;
|
||||
}
|
||||
|
||||
public Statement getThenStmt() {
|
||||
return thenStmt;
|
||||
}
|
||||
|
||||
public void setCondition(Expression condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
public void setElseStmt(Statement elseStmt) {
|
||||
this.elseStmt = elseStmt;
|
||||
}
|
||||
|
||||
public void setThenStmt(Statement thenStmt) {
|
||||
this.thenStmt = thenStmt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class LabeledStmt extends Statement {
|
||||
|
||||
private String label;
|
||||
|
||||
private Statement stmt;
|
||||
|
||||
public LabeledStmt() {
|
||||
}
|
||||
|
||||
public LabeledStmt(String label, Statement stmt) {
|
||||
this.label = label;
|
||||
this.stmt = stmt;
|
||||
}
|
||||
|
||||
public LabeledStmt(int beginLine, int beginColumn, int endLine, int endColumn, String label, Statement stmt) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.label = label;
|
||||
this.stmt = stmt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public Statement getStmt() {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public void setStmt(Statement stmt) {
|
||||
this.stmt = stmt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ReturnStmt extends Statement {
|
||||
|
||||
private Expression expr;
|
||||
|
||||
public ReturnStmt() {
|
||||
}
|
||||
|
||||
public ReturnStmt(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
public ReturnStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression expr) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public void setExpr(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 03/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.Node;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class Statement extends Node {
|
||||
|
||||
public Statement() {
|
||||
}
|
||||
|
||||
public Statement(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class SwitchEntryStmt extends Statement {
|
||||
|
||||
private Expression label;
|
||||
|
||||
private List<Statement> stmts;
|
||||
|
||||
public SwitchEntryStmt() {
|
||||
}
|
||||
|
||||
public SwitchEntryStmt(Expression label, List<Statement> stmts) {
|
||||
this.label = label;
|
||||
this.stmts = stmts;
|
||||
}
|
||||
|
||||
public SwitchEntryStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression label, List<Statement> stmts) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.label = label;
|
||||
this.stmts = stmts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public List<Statement> getStmts() {
|
||||
return stmts;
|
||||
}
|
||||
|
||||
public void setLabel(Expression label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public void setStmts(List<Statement> stmts) {
|
||||
this.stmts = stmts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class SwitchStmt extends Statement {
|
||||
|
||||
private Expression selector;
|
||||
|
||||
private List<SwitchEntryStmt> entries;
|
||||
|
||||
public SwitchStmt() {
|
||||
}
|
||||
|
||||
public SwitchStmt(Expression selector, List<SwitchEntryStmt> entries) {
|
||||
this.selector = selector;
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
public SwitchStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression selector, List<SwitchEntryStmt> entries) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.selector = selector;
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<SwitchEntryStmt> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
public Expression getSelector() {
|
||||
return selector;
|
||||
}
|
||||
|
||||
public void setEntries(List<SwitchEntryStmt> entries) {
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
public void setSelector(Expression selector) {
|
||||
this.selector = selector;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 18/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class SynchronizedStmt extends Statement {
|
||||
|
||||
private Expression expr;
|
||||
|
||||
private BlockStmt block;
|
||||
|
||||
public SynchronizedStmt() {
|
||||
}
|
||||
|
||||
public SynchronizedStmt(Expression expr, BlockStmt block) {
|
||||
this.expr = expr;
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public SynchronizedStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression expr, BlockStmt block) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.expr = expr;
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public BlockStmt getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public Expression getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public void setBlock(BlockStmt block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public void setExpr(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 18/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ThrowStmt extends Statement {
|
||||
|
||||
private Expression expr;
|
||||
|
||||
public ThrowStmt() {
|
||||
}
|
||||
|
||||
public ThrowStmt(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
public ThrowStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression expr) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Expression getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public void setExpr(Expression expr) {
|
||||
this.expr = expr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 18/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class TryStmt extends Statement {
|
||||
|
||||
private BlockStmt tryBlock;
|
||||
|
||||
private List<CatchClause> catchs;
|
||||
|
||||
private BlockStmt finallyBlock;
|
||||
|
||||
public TryStmt() {
|
||||
}
|
||||
|
||||
public TryStmt(BlockStmt tryBlock, List<CatchClause> catchs, BlockStmt finallyBlock) {
|
||||
this.tryBlock = tryBlock;
|
||||
this.catchs = catchs;
|
||||
this.finallyBlock = finallyBlock;
|
||||
}
|
||||
|
||||
public TryStmt(int beginLine, int beginColumn, int endLine, int endColumn, BlockStmt tryBlock, List<CatchClause> catchs, BlockStmt finallyBlock) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.tryBlock = tryBlock;
|
||||
this.catchs = catchs;
|
||||
this.finallyBlock = finallyBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public List<CatchClause> getCatchs() {
|
||||
return catchs;
|
||||
}
|
||||
|
||||
public BlockStmt getFinallyBlock() {
|
||||
return finallyBlock;
|
||||
}
|
||||
|
||||
public BlockStmt getTryBlock() {
|
||||
return tryBlock;
|
||||
}
|
||||
|
||||
public void setCatchs(List<CatchClause> catchs) {
|
||||
this.catchs = catchs;
|
||||
}
|
||||
|
||||
public void setFinallyBlock(BlockStmt finallyBlock) {
|
||||
this.finallyBlock = finallyBlock;
|
||||
}
|
||||
|
||||
public void setTryBlock(BlockStmt tryBlock) {
|
||||
this.tryBlock = tryBlock;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 04/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.body.TypeDeclaration;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class TypeDeclarationStmt extends Statement {
|
||||
|
||||
private TypeDeclaration typeDecl;
|
||||
|
||||
public TypeDeclarationStmt() {
|
||||
}
|
||||
|
||||
public TypeDeclarationStmt(TypeDeclaration typeDecl) {
|
||||
this.typeDecl = typeDecl;
|
||||
}
|
||||
|
||||
public TypeDeclarationStmt(int beginLine, int beginColumn, int endLine, int endColumn, TypeDeclaration typeDecl) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.typeDecl = typeDecl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public TypeDeclaration getTypeDeclaration() {
|
||||
return typeDecl;
|
||||
}
|
||||
|
||||
public void setTypeDeclaration(TypeDeclaration typeDecl) {
|
||||
this.typeDecl = typeDecl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 07/11/2006
|
||||
*/
|
||||
package japa.parser.ast.stmt;
|
||||
|
||||
import japa.parser.ast.expr.Expression;
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class WhileStmt extends Statement {
|
||||
|
||||
private Expression condition;
|
||||
|
||||
private Statement body;
|
||||
|
||||
public WhileStmt() {
|
||||
}
|
||||
|
||||
public WhileStmt(Expression condition, Statement body) {
|
||||
this.condition = condition;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public WhileStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression condition, Statement body) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.condition = condition;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Statement getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public Expression getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public void setBody(Statement body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public void setCondition(Expression condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.type;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ClassOrInterfaceType extends Type {
|
||||
|
||||
private ClassOrInterfaceType scope;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<Type> typeArgs;
|
||||
|
||||
public ClassOrInterfaceType() {
|
||||
}
|
||||
|
||||
public ClassOrInterfaceType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ClassOrInterfaceType(ClassOrInterfaceType scope, String name) {
|
||||
this.scope = scope;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ClassOrInterfaceType(int beginLine, int beginColumn, int endLine, int endColumn, ClassOrInterfaceType scope, String name, List<Type> typeArgs) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.scope = scope;
|
||||
this.name = name;
|
||||
this.typeArgs = typeArgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ClassOrInterfaceType getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public List<Type> getTypeArgs() {
|
||||
return typeArgs;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setScope(ClassOrInterfaceType scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public void setTypeArgs(List<Type> typeArgs) {
|
||||
this.typeArgs = typeArgs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.type;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class PrimitiveType extends Type {
|
||||
|
||||
public enum Primitive {
|
||||
Boolean, Char, Byte, Short, Int, Long, Float, Double
|
||||
}
|
||||
|
||||
private Primitive type;
|
||||
|
||||
public PrimitiveType() {
|
||||
}
|
||||
|
||||
public PrimitiveType(Primitive type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public PrimitiveType(int beginLine, int beginColumn, int endLine, int endColumn, Primitive type) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public Primitive getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Primitive type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.type;
|
||||
|
||||
import japa.parser.ast.visitor.GenericVisitor;
|
||||
import japa.parser.ast.visitor.VoidVisitor;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public final class ReferenceType extends Type {
|
||||
|
||||
private Type type;
|
||||
|
||||
private int arrayCount;
|
||||
|
||||
public ReferenceType() {
|
||||
}
|
||||
|
||||
public ReferenceType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ReferenceType(Type type, int arrayCount) {
|
||||
this.type = type;
|
||||
this.arrayCount = arrayCount;
|
||||
}
|
||||
|
||||
public ReferenceType(int beginLine, int beginColumn, int endLine, int endColumn, Type type, int arrayCount) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
this.type = type;
|
||||
this.arrayCount = arrayCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
|
||||
return v.visit(this, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> void accept(VoidVisitor<A> v, A arg) {
|
||||
v.visit(this, arg);
|
||||
}
|
||||
|
||||
public int getArrayCount() {
|
||||
return arrayCount;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setArrayCount(int arrayCount) {
|
||||
this.arrayCount = arrayCount;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Created on 05/10/2006
|
||||
*/
|
||||
package japa.parser.ast.type;
|
||||
|
||||
import japa.parser.ast.Node;
|
||||
|
||||
/**
|
||||
* @author Julio Vilmar Gesser
|
||||
*/
|
||||
public abstract class Type extends Node {
|
||||
|
||||
public Type() {
|
||||
}
|
||||
|
||||
public Type(int beginLine, int beginColumn, int endLine, int endColumn) {
|
||||
super(beginLine, beginColumn, endLine, endColumn);
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user