COPYING0000644000000000000000000010575711132421232010615 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Java 1.5 parser and Abstract Syntax Tree Copyright (C) 2007 Júlio Vilmar Gesser This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Java 1.5 parser and Abstract Syntax Tree Copyright (C) 2007 Júlio Vilmar Gesser This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . COPYING.LESSER0000644000000000000000000001717411132421226011607 0ustar rootroot GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. 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. readme.txt0000644000000000000000000001417111324636542011564 0ustar rootroot+-------------------------------------------------------------------------------+ | 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 . | +-------------------------------------------------------------------------------+ 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.8 (2010-01-17) - Fixed issues: - Issue 17: A refactor suggestion for AnnotationExpr and its subclasses - Issue 21: Java 5 JavaParser compiled JARs - Issue 22: Please use java.lang.reflect.Modifier constants in japa.parser.ast.body.ModifierSet - Issue 27: Implement the "equal" method - Issue 30: equals and hashCode methods 1.0.7 (2009-04-12) - Issue 19 fixed: - Tests changed to run with junit 4 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 nodessrc/0000755000000000000000000000000011245341320010336 5ustar rootrootsrc/japa/0000755000000000000000000000000011245341316011256 5ustar rootrootsrc/japa/parser/0000755000000000000000000000000011245341316012552 5ustar rootrootsrc/japa/parser/ast/0000755000000000000000000000000011245341316013341 5ustar rootrootsrc/japa/parser/ast/body/0000755000000000000000000000000011245341316014276 5ustar rootrootsrc/japa/parser/ast/body/AnnotationDeclaration.java0000644000000000000000000000420311132421230021405 0ustar rootroot/* * 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 . */ /* * 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 annotations, String name, List members) { super(annotations, javaDoc, modifiers, name, members); } public AnnotationDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, JavadocComment javaDoc, int modifiers, List annotations, String name, List members) { super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc, modifiers, name, members); } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/body/AnnotationMemberDeclaration.java0000644000000000000000000000671511132421230022547 0ustar rootroot/* * 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 . */ /* * 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 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 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/body/BodyDeclaration.java0000644000000000000000000000415711132421230020200 0ustar rootroot/* * 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 . */ /* * 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 annotations; public BodyDeclaration() { } public BodyDeclaration(List annotations, JavadocComment javaDoc) { this.javaDoc = javaDoc; this.annotations = annotations; } public BodyDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List annotations, JavadocComment javaDoc) { super(beginLine, beginColumn, endLine, endColumn); this.javaDoc = javaDoc; this.annotations = annotations; } public final JavadocComment getJavaDoc() { return javaDoc; } public final List getAnnotations() { return annotations; } public final void setJavaDoc(JavadocComment javaDoc) { this.javaDoc = javaDoc; } public final void setAnnotations(List annotations) { this.annotations = annotations; } } src/japa/parser/ast/body/ClassOrInterfaceDeclaration.java0000644000000000000000000000767211132421230022477 0ustar rootroot/* * 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 . */ /* * 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 typeParameters; private List extendsList; private List implementsList; public ClassOrInterfaceDeclaration() { } public ClassOrInterfaceDeclaration(int modifiers, boolean isInterface, String name) { super(modifiers, name); this.interface_ = isInterface; } public ClassOrInterfaceDeclaration(JavadocComment javaDoc, int modifiers, List annotations, boolean isInterface, String name, List typeParameters, List extendsList, List implementsList, List 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 annotations, boolean isInterface, String name, List typeParameters, List extendsList, List implementsList, List 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getExtends() { return extendsList; } public List getImplements() { return implementsList; } public List getTypeParameters() { return typeParameters; } public boolean isInterface() { return interface_; } public void setExtends(List extendsList) { this.extendsList = extendsList; } public void setImplements(List implementsList) { this.implementsList = implementsList; } public void setInterface(boolean interface_) { this.interface_ = interface_; } public void setTypeParameters(List typeParameters) { this.typeParameters = typeParameters; } } src/japa/parser/ast/body/ConstructorDeclaration.java0000644000000000000000000001022511132421230021621 0ustar rootroot/* * 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 . */ /* * 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 typeParameters; private String name; private List parameters; private List 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 annotations, List typeParameters, String name, List parameters, List 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 annotations, List typeParameters, String name, List parameters, List 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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 getParameters() { return parameters; } public List getThrows() { return throws_; } public List 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 parameters) { this.parameters = parameters; } public void setThrows(List throws_) { this.throws_ = throws_; } public void setTypeParameters(List typeParameters) { this.typeParameters = typeParameters; } } src/japa/parser/ast/body/EmptyMemberDeclaration.java0000644000000000000000000000333011132421230021521 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/body/EmptyTypeDeclaration.java0000644000000000000000000000335611132421230021243 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/body/EnumConstantDeclaration.java0000644000000000000000000000562511132421230021722 0ustar rootroot/* * 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 . */ /* * 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 args; private List classBody; public EnumConstantDeclaration() { } public EnumConstantDeclaration(String name) { this.name = name; } public EnumConstantDeclaration(JavadocComment javaDoc, List annotations, String name, List args, List 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 annotations, String name, List args, List classBody) { super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc); this.name = name; this.args = args; this.classBody = classBody; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getArgs() { return args; } public List getClassBody() { return classBody; } public String getName() { return name; } public void setArgs(List args) { this.args = args; } public void setClassBody(List classBody) { this.classBody = classBody; } public void setName(String name) { this.name = name; } } src/japa/parser/ast/body/EnumDeclaration.java0000644000000000000000000000577211132421230020213 0ustar rootroot/* * 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 . */ /* * 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 implementsList; private List entries; public EnumDeclaration() { } public EnumDeclaration(int modifiers, String name) { super(modifiers, name); } public EnumDeclaration(JavadocComment javaDoc, int modifiers, List annotations, String name, List implementsList, List entries, List 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 annotations, String name, List implementsList, List entries, List members) { super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc, modifiers, name, members); this.implementsList = implementsList; this.entries = entries; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getEntries() { return entries; } public List getImplements() { return implementsList; } public void setEntries(List entries) { this.entries = entries; } public void setImplements(List implementsList) { this.implementsList = implementsList; } } src/japa/parser/ast/body/FieldDeclaration.java0000644000000000000000000000662511132421230020330 0ustar rootroot/* * 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 . */ /* * 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 variables; public FieldDeclaration() { } public FieldDeclaration(int modifiers, Type type, VariableDeclarator variable) { this.modifiers = modifiers; this.type = type; this.variables = new ArrayList(); this.variables.add(variable); } public FieldDeclaration(int modifiers, Type type, List variables) { this.modifiers = modifiers; this.type = type; this.variables = variables; } public FieldDeclaration(JavadocComment javaDoc, int modifiers, List annotations, Type type, List 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 annotations, Type type, List variables) { super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc); this.modifiers = modifiers; this.type = type; this.variables = variables; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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 getVariables() { return variables; } public void setModifiers(int modifiers) { this.modifiers = modifiers; } public void setType(Type type) { this.type = type; } public void setVariables(List variables) { this.variables = variables; } } src/japa/parser/ast/body/InitializerDeclaration.java0000644000000000000000000000471511132421230021566 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/body/JavadocComment.java0000644000000000000000000000326511132421230020026 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/body/MethodDeclaration.java0000644000000000000000000001171311132421230020517 0ustar rootroot/* * 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 . */ /* * 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 typeParameters; private Type type; private String name; private List parameters; private int arrayCount; private List 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 parameters) { this.modifiers = modifiers; this.type = type; this.name = name; this.parameters = parameters; } public MethodDeclaration(JavadocComment javaDoc, int modifiers, List annotations, List typeParameters, Type type, String name, List parameters, int arrayCount, List 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 annotations, List typeParameters, Type type, String name, List parameters, int arrayCount, List 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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 getParameters() { return parameters; } public List getThrows() { return throws_; } public Type getType() { return type; } public List 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 parameters) { this.parameters = parameters; } public void setThrows(List throws_) { this.throws_ = throws_; } public void setType(Type type) { this.type = type; } public void setTypeParameters(List typeParameters) { this.typeParameters = typeParameters; } } src/japa/parser/ast/body/ModifierSet.java0000644000000000000000000000707711324635206017370 0ustar rootroot/* * 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 . */ package japa.parser.ast.body; import java.lang.reflect.Modifier; /** * Class to hold modifiers.
* The modifier constants declared here holds equivalent values to * {@link Modifier} constants. */ public final class ModifierSet { /* Definitions of the bits in the modifiers field. */ public static final int PUBLIC = Modifier.PUBLIC; public static final int PRIVATE = Modifier.PRIVATE; public static final int PROTECTED = Modifier.PROTECTED; public static final int STATIC = Modifier.STATIC; public static final int FINAL = Modifier.FINAL; public static final int SYNCHRONIZED = Modifier.SYNCHRONIZED; public static final int VOLATILE = Modifier.VOLATILE; public static final int TRANSIENT = Modifier.TRANSIENT; public static final int NATIVE = Modifier.NATIVE; public static final int ABSTRACT = Modifier.ABSTRACT; public static final int STRICTFP = Modifier.STRICT; /** * 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() { } }src/japa/parser/ast/body/Parameter.java0000644000000000000000000000650511132421230017054 0ustar rootroot/* * 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 . */ /* * 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 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 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public
void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List 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 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; } } src/japa/parser/ast/body/TypeDeclaration.java0000644000000000000000000000530211132421230020215 0ustar rootroot/* * 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 . */ /* * 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 members; public TypeDeclaration() { } public TypeDeclaration(int modifiers, String name) { this.name = name; this.modifiers = modifiers; } public TypeDeclaration(List annotations, JavadocComment javaDoc, int modifiers, String name, List members) { super(annotations, javaDoc); this.name = name; this.modifiers = modifiers; this.members = members; } public TypeDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List annotations, JavadocComment javaDoc, int modifiers, String name, List members) { super(beginLine, beginColumn, endLine, endColumn, annotations, javaDoc); this.name = name; this.modifiers = modifiers; this.members = members; } public final List 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 members) { this.members = members; } public final void setModifiers(int modifiers) { this.modifiers = modifiers; } public final void setName(String name) { this.name = name; } } src/japa/parser/ast/body/VariableDeclarator.java0000644000000000000000000000445611132421230020665 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/body/VariableDeclaratorId.java0000644000000000000000000000417311132421230021136 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/expr/0000755000000000000000000000000011245341316014317 5ustar rootrootsrc/japa/parser/ast/expr/AnnotationExpr.java0000644000000000000000000000263611324635764020155 0ustar rootroot/* * 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 . */ /* * Created on 21/11/2006 */ package japa.parser.ast.expr; /** * @author Julio Vilmar Gesser */ public abstract class AnnotationExpr extends Expression { protected NameExpr name; public AnnotationExpr() { } public AnnotationExpr(int beginLine, int beginColumn, int endLine, int endColumn) { super(beginLine, beginColumn, endLine, endColumn); } public NameExpr getName() { return name; } public void setName(NameExpr name) { this.name = name; } } src/japa/parser/ast/expr/ArrayAccessExpr.java0000644000000000000000000000417411132421230020214 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/expr/ArrayCreationExpr.java0000644000000000000000000000673011132421230020557 0ustar rootroot/* * 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 . */ /* * 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 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 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 dimensions, int arrayCount) { super(beginLine, beginColumn, endLine, endColumn); this.type = type; this.arrayCount = arrayCount; this.dimensions = dimensions; this.initializer = null; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public int getArrayCount() { return arrayCount; } public List 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 dimensions) { this.dimensions = dimensions; } public void setInitializer(ArrayInitializerExpr initializer) { this.initializer = initializer; } public void setType(Type type) { this.type = type; } } src/japa/parser/ast/expr/ArrayInitializerExpr.java0000644000000000000000000000371311132421230021274 0ustar rootroot/* * 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 . */ /* * 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 values; public ArrayInitializerExpr() { } public ArrayInitializerExpr(List values) { this.values = values; } public ArrayInitializerExpr(int beginLine, int beginColumn, int endLine, int endColumn, List values) { super(beginLine, beginColumn, endLine, endColumn); this.values = values; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getValues() { return values; } public void setValues(List values) { this.values = values; } } src/japa/parser/ast/expr/AssignExpr.java0000644000000000000000000000526211132421230017237 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/expr/BinaryExpr.java0000644000000000000000000000550111132421230017233 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/expr/BooleanLiteralExpr.java0000644000000000000000000000355611132421230020713 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public boolean getValue() { return value; } public void setValue(boolean value) { this.value = value; } } src/japa/parser/ast/expr/CastExpr.java0000644000000000000000000000413011132421230016676 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/expr/CharLiteralExpr.java0000644000000000000000000000323211132421230020200 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/expr/ClassExpr.java0000644000000000000000000000352211132421230017055 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Type getType() { return type; } public void setType(Type type) { this.type = type; } } src/japa/parser/ast/expr/ConditionalExpr.java0000644000000000000000000000504211132421230020252 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/expr/DoubleLiteralExpr.java0000644000000000000000000000324211132421230020536 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/expr/EnclosedExpr.java0000644000000000000000000000354611132421230017552 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Expression getInner() { return inner; } public void setInner(Expression inner) { this.inner = inner; } } src/japa/parser/ast/expr/Expression.java0000644000000000000000000000237611132421230017316 0ustar rootroot/* * 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 . */ /* * 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); } } src/japa/parser/ast/expr/FieldAccessExpr.java0000644000000000000000000000467011132421230020162 0ustar rootroot/* * 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 . */ /* * 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 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 typeArgs, String field) { super(beginLine, beginColumn, endLine, endColumn); this.scope = scope; this.typeArgs = typeArgs; this.field = field; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public String getField() { return field; } public Expression getScope() { return scope; } public List getTypeArgs() { return typeArgs; } public void setField(String field) { this.field = field; } public void setScope(Expression scope) { this.scope = scope; } public void setTypeArgs(List typeArgs) { this.typeArgs = typeArgs; } } src/japa/parser/ast/expr/InstanceOfExpr.java0000644000000000000000000000416011132421230020040 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/expr/IntegerLiteralExpr.java0000644000000000000000000000374611132421230020732 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public final boolean isMinValue() { return value != null && // value.length() == 10 && // value.equals(UNSIGNED_MIN_VALUE); } } src/japa/parser/ast/expr/IntegerLiteralMinValueExpr.java0000644000000000000000000000320311132421230022357 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/expr/LiteralExpr.java0000644000000000000000000000234511132421230017406 0ustar rootroot/* * 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 . */ /* * 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); } } src/japa/parser/ast/expr/LongLiteralExpr.java0000644000000000000000000000407111132421230020224 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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'); } } src/japa/parser/ast/expr/LongLiteralMinValueExpr.java0000644000000000000000000000316711132421230021672 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/expr/MarkerAnnotationExpr.java0000644000000000000000000000330711324635764021313 0ustar rootroot/* * 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 . */ /* * 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 { 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/expr/MemberValuePair.java0000644000000000000000000000420011132421230020163 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/expr/MethodCallExpr.java0000644000000000000000000000551411132421230020027 0ustar rootroot/* * 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 . */ /* * 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 typeArgs; private String name; private List args; public MethodCallExpr() { } public MethodCallExpr(Expression scope, String name) { this.scope = scope; this.name = name; } public MethodCallExpr(Expression scope, String name, List args) { this.scope = scope; this.name = name; this.args = args; } public MethodCallExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression scope, List typeArgs, String name, List args) { super(beginLine, beginColumn, endLine, endColumn); this.scope = scope; this.typeArgs = typeArgs; this.name = name; this.args = args; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getArgs() { return args; } public String getName() { return name; } public Expression getScope() { return scope; } public List getTypeArgs() { return typeArgs; } public void setArgs(List args) { this.args = args; } public void setName(String name) { this.name = name; } public void setScope(Expression scope) { this.scope = scope; } public void setTypeArgs(List typeArgs) { this.typeArgs = typeArgs; } } src/japa/parser/ast/expr/NameExpr.java0000644000000000000000000000347311132421230016675 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } } src/japa/parser/ast/expr/NormalAnnotationExpr.java0000644000000000000000000000405711324635766021327 0ustar rootroot/* * 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 . */ /* * 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 List pairs; public NormalAnnotationExpr() { } public NormalAnnotationExpr(NameExpr name, List pairs) { this.name = name; this.pairs = pairs; } public NormalAnnotationExpr(int beginLine, int beginColumn, int endLine, int endColumn, NameExpr name, List pairs) { super(beginLine, beginColumn, endLine, endColumn); this.name = name; this.pairs = pairs; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getPairs() { return pairs; } public void setPairs(List pairs) { this.pairs = pairs; } } src/japa/parser/ast/expr/NullLiteralExpr.java0000644000000000000000000000306311132421230020237 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/expr/ObjectCreationExpr.java0000644000000000000000000000642211132421230020705 0ustar rootroot/* * 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 . */ /* * 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 typeArgs; private List args; private List anonymousClassBody; public ObjectCreationExpr() { } public ObjectCreationExpr(Expression scope, ClassOrInterfaceType type, List 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 typeArgs, List args, List anonymousBody) { super(beginLine, beginColumn, endLine, endColumn); this.scope = scope; this.type = type; this.typeArgs = typeArgs; this.args = args; this.anonymousClassBody = anonymousBody; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getAnonymousClassBody() { return anonymousClassBody; } public List getArgs() { return args; } public Expression getScope() { return scope; } public ClassOrInterfaceType getType() { return type; } public List getTypeArgs() { return typeArgs; } public void setAnonymousClassBody(List anonymousClassBody) { this.anonymousClassBody = anonymousClassBody; } public void setArgs(List args) { this.args = args; } public void setScope(Expression scope) { this.scope = scope; } public void setType(ClassOrInterfaceType type) { this.type = type; } public void setTypeArgs(List typeArgs) { this.typeArgs = typeArgs; } } src/japa/parser/ast/expr/QualifiedNameExpr.java0000644000000000000000000000371011132421230020513 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public NameExpr getQualifier() { return qualifier; } public void setQualifier(NameExpr qualifier) { this.qualifier = qualifier; } } src/japa/parser/ast/expr/SingleMemberAnnotationExpr.java0000644000000000000000000000410411324635766022441 0ustar rootroot/* * 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 . */ /* * 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 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Expression getMemberValue() { return memberValue; } public void setMemberValue(Expression memberValue) { this.memberValue = memberValue; } } src/japa/parser/ast/expr/StringLiteralExpr.java0000644000000000000000000000355511132421230020601 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public final String getValue() { return value; } public final void setValue(String value) { this.value = value; } } src/japa/parser/ast/expr/SuperExpr.java0000644000000000000000000000361611132421230017112 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Expression getClassExpr() { return classExpr; } public void setClassExpr(Expression classExpr) { this.classExpr = classExpr; } } src/japa/parser/ast/expr/ThisExpr.java0000644000000000000000000000361211132421230016717 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Expression getClassExpr() { return classExpr; } public void setClassExpr(Expression classExpr) { this.classExpr = classExpr; } } src/japa/parser/ast/expr/UnaryExpr.java0000644000000000000000000000447111132421230017112 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/expr/VariableDeclarationExpr.java0000644000000000000000000000633111132421230021704 0ustar rootroot/* * 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 . */ /* * 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 annotations; private Type type; private List vars; public VariableDeclarationExpr() { } public VariableDeclarationExpr(Type type, List vars) { this.type = type; this.vars = vars; } public VariableDeclarationExpr(int modifiers, Type type, List vars) { this.modifiers = modifiers; this.type = type; this.vars = vars; } public VariableDeclarationExpr(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List annotations, Type type, List vars) { super(beginLine, beginColumn, endLine, endColumn); this.modifiers = modifiers; this.annotations = annotations; this.type = type; this.vars = vars; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List 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 getVars() { return vars; } public void setAnnotations(List annotations) { this.annotations = annotations; } public void setModifiers(int modifiers) { this.modifiers = modifiers; } public void setType(Type type) { this.type = type; } public void setVars(List vars) { this.vars = vars; } } src/japa/parser/ast/stmt/0000755000000000000000000000000011245341314014326 5ustar rootrootsrc/japa/parser/ast/stmt/AssertStmt.java0000644000000000000000000000433211132421226017300 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/stmt/BlockStmt.java0000644000000000000000000000361211132421226017071 0ustar rootroot/* * 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 . */ /* * 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 stmts; public BlockStmt() { } public BlockStmt(List stmts) { this.stmts = stmts; } public BlockStmt(int beginLine, int beginColumn, int endLine, int endColumn, List stmts) { super(beginLine, beginColumn, endLine, endColumn); this.stmts = stmts; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getStmts() { return stmts; } public void setStmts(List stmts) { this.stmts = stmts; } } src/japa/parser/ast/stmt/BreakStmt.java0000644000000000000000000000343411132421230017060 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public String getId() { return id; } public void setId(String id) { this.id = id; } } src/japa/parser/ast/stmt/CatchClause.java0000644000000000000000000000437311132421226017353 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/stmt/ContinueStmt.java0000644000000000000000000000345011132421230017616 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public String getId() { return id; } public void setId(String id) { this.id = id; } } src/japa/parser/ast/stmt/DoStmt.java0000644000000000000000000000425511132421226016405 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/stmt/EmptyStmt.java0000644000000000000000000000303711132421226017136 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/stmt/ExplicitConstructorInvocationStmt.java0000644000000000000000000000551611132421226024125 0ustar rootroot/* * 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 . */ /* * 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 typeArgs; private boolean isThis; private Expression expr; private List args; public ExplicitConstructorInvocationStmt() { } public ExplicitConstructorInvocationStmt(boolean isThis, Expression expr, List args) { this.isThis = isThis; this.expr = expr; this.args = args; } public ExplicitConstructorInvocationStmt(int beginLine, int beginColumn, int endLine, int endColumn, List typeArgs, boolean isThis, Expression expr, List args) { super(beginLine, beginColumn, endLine, endColumn); this.typeArgs = typeArgs; this.isThis = isThis; this.expr = expr; this.args = args; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getArgs() { return args; } public Expression getExpr() { return expr; } public List getTypeArgs() { return typeArgs; } public boolean isThis() { return isThis; } public void setArgs(List args) { this.args = args; } public void setExpr(Expression expr) { this.expr = expr; } public void setThis(boolean isThis) { this.isThis = isThis; } public void setTypeArgs(List typeArgs) { this.typeArgs = typeArgs; } } src/japa/parser/ast/stmt/ExpressionStmt.java0000644000000000000000000000362311132421226020200 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Expression getExpression() { return expr; } public void setExpression(Expression expr) { this.expr = expr; } } src/japa/parser/ast/stmt/ForStmt.java0000644000000000000000000000543311132421230016563 0ustar rootroot/* * 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 . */ /* * 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 init; private Expression compare; private List update; private Statement body; public ForStmt() { } public ForStmt(List init, Expression compare, List 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 init, Expression compare, List update, Statement body) { super(beginLine, beginColumn, endLine, endColumn); this.compare = compare; this.init = init; this.update = update; this.body = body; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Statement getBody() { return body; } public Expression getCompare() { return compare; } public List getInit() { return init; } public List getUpdate() { return update; } public void setBody(Statement body) { this.body = body; } public void setCompare(Expression compare) { this.compare = compare; } public void setInit(List init) { this.init = init; } public void setUpdate(List update) { this.update = update; } } src/japa/parser/ast/stmt/ForeachStmt.java0000644000000000000000000000506211132421226017407 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/stmt/IfStmt.java0000644000000000000000000000503211132421226016373 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/stmt/LabeledStmt.java0000644000000000000000000000412011132421226017362 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/stmt/ReturnStmt.java0000644000000000000000000000356711132421226017327 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Expression getExpr() { return expr; } public void setExpr(Expression expr) { this.expr = expr; } } src/japa/parser/ast/stmt/Statement.java0000644000000000000000000000237211132421226017135 0ustar rootroot/* * 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 . */ /* * 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); } } src/japa/parser/ast/stmt/SwitchEntryStmt.java0000644000000000000000000000434211132421230020316 0ustar rootroot/* * 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 . */ /* * 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 stmts; public SwitchEntryStmt() { } public SwitchEntryStmt(Expression label, List stmts) { this.label = label; this.stmts = stmts; } public SwitchEntryStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression label, List stmts) { super(beginLine, beginColumn, endLine, endColumn); this.label = label; this.stmts = stmts; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Expression getLabel() { return label; } public List getStmts() { return stmts; } public void setLabel(Expression label) { this.label = label; } public void setStmts(List stmts) { this.stmts = stmts; } } src/japa/parser/ast/stmt/SwitchStmt.java0000644000000000000000000000445511132421226017306 0ustar rootroot/* * 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 . */ /* * 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 entries; public SwitchStmt() { } public SwitchStmt(Expression selector, List entries) { this.selector = selector; this.entries = entries; } public SwitchStmt(int beginLine, int beginColumn, int endLine, int endColumn, Expression selector, List entries) { super(beginLine, beginColumn, endLine, endColumn); this.selector = selector; this.entries = entries; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getEntries() { return entries; } public Expression getSelector() { return selector; } public void setEntries(List entries) { this.entries = entries; } public void setSelector(Expression selector) { this.selector = selector; } } src/japa/parser/ast/stmt/SynchronizedStmt.java0000644000000000000000000000424311132421226020517 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/stmt/ThrowStmt.java0000644000000000000000000000356311132421226017147 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Expression getExpr() { return expr; } public void setExpr(Expression expr) { this.expr = expr; } } src/japa/parser/ast/stmt/TryStmt.java0000644000000000000000000000507711132421226016624 0ustar rootroot/* * 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 . */ /* * 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 catchs; private BlockStmt finallyBlock; public TryStmt() { } public TryStmt(BlockStmt tryBlock, List 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 catchs, BlockStmt finallyBlock) { super(beginLine, beginColumn, endLine, endColumn); this.tryBlock = tryBlock; this.catchs = catchs; this.finallyBlock = finallyBlock; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public List getCatchs() { return catchs; } public BlockStmt getFinallyBlock() { return finallyBlock; } public BlockStmt getTryBlock() { return tryBlock; } public void setCatchs(List catchs) { this.catchs = catchs; } public void setFinallyBlock(BlockStmt finallyBlock) { this.finallyBlock = finallyBlock; } public void setTryBlock(BlockStmt tryBlock) { this.tryBlock = tryBlock; } } src/japa/parser/ast/stmt/TypeDeclarationStmt.java0000644000000000000000000000377311132421226021136 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public TypeDeclaration getTypeDeclaration() { return typeDecl; } public void setTypeDeclaration(TypeDeclaration typeDecl) { this.typeDecl = typeDecl; } } src/japa/parser/ast/stmt/WhileStmt.java0000644000000000000000000000427111132421226017111 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/type/0000755000000000000000000000000011245341314014320 5ustar rootrootsrc/japa/parser/ast/type/ClassOrInterfaceType.java0000644000000000000000000000503211132421226021210 0ustar rootroot/* * 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 . */ /* * 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 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 typeArgs) { super(beginLine, beginColumn, endLine, endColumn); this.scope = scope; this.name = name; this.typeArgs = typeArgs; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public String getName() { return name; } public ClassOrInterfaceType getScope() { return scope; } public List getTypeArgs() { return typeArgs; } public void setName(String name) { this.name = name; } public void setScope(ClassOrInterfaceType scope) { this.scope = scope; } public void setTypeArgs(List typeArgs) { this.typeArgs = typeArgs; } } src/japa/parser/ast/type/PrimitiveType.java0000644000000000000000000000366611132421226020004 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public Primitive getType() { return type; } public void setType(Primitive type) { this.type = type; } } src/japa/parser/ast/type/ReferenceType.java0000644000000000000000000000427111132421226017723 0ustar rootroot/* * 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 . */ /* * 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 accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor 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; } } src/japa/parser/ast/type/Type.java0000644000000000000000000000235411132421226016104 0ustar rootroot/* * 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 . */ /* * 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); } } src/japa/parser/ast/type/VoidType.java0000644000000000000000000000303111132421226016717 0ustar rootroot/* * 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 . */ /* * 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 VoidType extends Type { public VoidType() { } public VoidType(int beginLine, int beginColumn, int endLine, int endColumn) { super(beginLine, beginColumn, endLine, endColumn); } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/type/WildcardType.java0000644000000000000000000000427511132421226017562 0ustar rootroot/* * 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 . */ /* * 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 WildcardType extends Type { private ReferenceType ext; private ReferenceType sup; public WildcardType() { } public WildcardType(ReferenceType ext) { this.ext = ext; } public WildcardType(ReferenceType ext, ReferenceType sup) { this.ext = ext; this.sup = sup; } public WildcardType(int beginLine, int beginColumn, int endLine, int endColumn, ReferenceType ext, ReferenceType sup) { super(beginLine, beginColumn, endLine, endColumn); this.ext = ext; this.sup = sup; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } public ReferenceType getExtends() { return ext; } public ReferenceType getSuper() { return sup; } public void setExtends(ReferenceType ext) { this.ext = ext; } public void setSuper(ReferenceType sup) { this.sup = sup; } } src/japa/parser/ast/visitor/0000755000000000000000000000000011324603060015033 5ustar rootrootsrc/japa/parser/ast/visitor/DumpVisitor.java0000644000000000000000000011666411244033112020175 0ustar rootroot/* * 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 . */ /* * Created on 05/10/2006 */ package japa.parser.ast.visitor; import japa.parser.ast.BlockComment; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.LineComment; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.TypeParameter; import japa.parser.ast.body.AnnotationDeclaration; import japa.parser.ast.body.AnnotationMemberDeclaration; import japa.parser.ast.body.BodyDeclaration; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.ConstructorDeclaration; import japa.parser.ast.body.EmptyMemberDeclaration; import japa.parser.ast.body.EmptyTypeDeclaration; import japa.parser.ast.body.EnumConstantDeclaration; import japa.parser.ast.body.EnumDeclaration; import japa.parser.ast.body.FieldDeclaration; import japa.parser.ast.body.InitializerDeclaration; import japa.parser.ast.body.JavadocComment; import japa.parser.ast.body.MethodDeclaration; import japa.parser.ast.body.ModifierSet; 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.AnnotationExpr; import japa.parser.ast.expr.ArrayAccessExpr; import japa.parser.ast.expr.ArrayCreationExpr; import japa.parser.ast.expr.ArrayInitializerExpr; import japa.parser.ast.expr.AssignExpr; import japa.parser.ast.expr.BinaryExpr; import japa.parser.ast.expr.BooleanLiteralExpr; import japa.parser.ast.expr.CastExpr; import japa.parser.ast.expr.CharLiteralExpr; import japa.parser.ast.expr.ClassExpr; import japa.parser.ast.expr.ConditionalExpr; import japa.parser.ast.expr.DoubleLiteralExpr; import japa.parser.ast.expr.EnclosedExpr; import japa.parser.ast.expr.Expression; import japa.parser.ast.expr.FieldAccessExpr; import japa.parser.ast.expr.InstanceOfExpr; import japa.parser.ast.expr.IntegerLiteralExpr; import japa.parser.ast.expr.IntegerLiteralMinValueExpr; import japa.parser.ast.expr.LongLiteralExpr; import japa.parser.ast.expr.LongLiteralMinValueExpr; import japa.parser.ast.expr.MarkerAnnotationExpr; import japa.parser.ast.expr.MemberValuePair; import japa.parser.ast.expr.MethodCallExpr; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.expr.NormalAnnotationExpr; import japa.parser.ast.expr.NullLiteralExpr; import japa.parser.ast.expr.ObjectCreationExpr; import japa.parser.ast.expr.QualifiedNameExpr; import japa.parser.ast.expr.SingleMemberAnnotationExpr; import japa.parser.ast.expr.StringLiteralExpr; import japa.parser.ast.expr.SuperExpr; import japa.parser.ast.expr.ThisExpr; import japa.parser.ast.expr.UnaryExpr; import japa.parser.ast.expr.VariableDeclarationExpr; import japa.parser.ast.stmt.AssertStmt; import japa.parser.ast.stmt.BlockStmt; import japa.parser.ast.stmt.BreakStmt; import japa.parser.ast.stmt.CatchClause; import japa.parser.ast.stmt.ContinueStmt; import japa.parser.ast.stmt.DoStmt; import japa.parser.ast.stmt.EmptyStmt; import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; import japa.parser.ast.stmt.ExpressionStmt; import japa.parser.ast.stmt.ForStmt; import japa.parser.ast.stmt.ForeachStmt; import japa.parser.ast.stmt.IfStmt; import japa.parser.ast.stmt.LabeledStmt; import japa.parser.ast.stmt.ReturnStmt; import japa.parser.ast.stmt.Statement; import japa.parser.ast.stmt.SwitchEntryStmt; import japa.parser.ast.stmt.SwitchStmt; import japa.parser.ast.stmt.SynchronizedStmt; import japa.parser.ast.stmt.ThrowStmt; import japa.parser.ast.stmt.TryStmt; import japa.parser.ast.stmt.TypeDeclarationStmt; import japa.parser.ast.stmt.WhileStmt; 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.WildcardType; import java.util.Iterator; import java.util.List; /** * @author Julio Vilmar Gesser */ public final class DumpVisitor implements VoidVisitor { private static class SourcePrinter { private int level = 0; private boolean indented = false; private final StringBuilder buf = new StringBuilder(); public void indent() { level++; } public void unindent() { level--; } private void makeIndent() { for (int i = 0; i < level; i++) { buf.append(" "); } } public void print(String arg) { if (!indented) { makeIndent(); indented = true; } buf.append(arg); } public void printLn(String arg) { print(arg); printLn(); } public void printLn() { buf.append("\n"); indented = false; } public String getSource() { return buf.toString(); } @Override public String toString() { return getSource(); } } private final SourcePrinter printer = new SourcePrinter(); public String getSource() { return printer.getSource(); } private void printModifiers(int modifiers) { if (ModifierSet.isPrivate(modifiers)) { printer.print("private "); } if (ModifierSet.isProtected(modifiers)) { printer.print("protected "); } if (ModifierSet.isPublic(modifiers)) { printer.print("public "); } if (ModifierSet.isAbstract(modifiers)) { printer.print("abstract "); } if (ModifierSet.isStatic(modifiers)) { printer.print("static "); } if (ModifierSet.isFinal(modifiers)) { printer.print("final "); } if (ModifierSet.isNative(modifiers)) { printer.print("native "); } if (ModifierSet.isStrictfp(modifiers)) { printer.print("strictfp "); } if (ModifierSet.isSynchronized(modifiers)) { printer.print("synchronized "); } if (ModifierSet.isTransient(modifiers)) { printer.print("transient "); } if (ModifierSet.isVolatile(modifiers)) { printer.print("volatile "); } } private void printMembers(List members, Object arg) { for (BodyDeclaration member : members) { printer.printLn(); member.accept(this, arg); printer.printLn(); } } private void printMemberAnnotations(List annotations, Object arg) { if (annotations != null) { for (AnnotationExpr a : annotations) { a.accept(this, arg); printer.printLn(); } } } private void printAnnotations(List annotations, Object arg) { if (annotations != null) { for (AnnotationExpr a : annotations) { a.accept(this, arg); printer.print(" "); } } } private void printTypeArgs(List args, Object arg) { if (args != null) { printer.print("<"); for (Iterator i = args.iterator(); i.hasNext();) { Type t = i.next(); t.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } printer.print(">"); } } private void printTypeParameters(List args, Object arg) { if (args != null) { printer.print("<"); for (Iterator i = args.iterator(); i.hasNext();) { TypeParameter t = i.next(); t.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } printer.print(">"); } } private void printArguments(List args, Object arg) { printer.print("("); if (args != null) { for (Iterator i = args.iterator(); i.hasNext();) { Expression e = i.next(); e.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print(")"); } private void printJavadoc(JavadocComment javadoc, Object arg) { if (javadoc != null) { javadoc.accept(this, arg); } } public void visit(CompilationUnit n, Object arg) { if (n.getPackage() != null) { n.getPackage().accept(this, arg); } if (n.getImports() != null) { for (ImportDeclaration i : n.getImports()) { i.accept(this, arg); } printer.printLn(); } if (n.getTypes() != null) { for (Iterator i = n.getTypes().iterator(); i.hasNext();) { i.next().accept(this, arg); printer.printLn(); if (i.hasNext()) { printer.printLn(); } } } } public void visit(PackageDeclaration n, Object arg) { printAnnotations(n.getAnnotations(), arg); printer.print("package "); n.getName().accept(this, arg); printer.printLn(";"); printer.printLn(); } public void visit(NameExpr n, Object arg) { printer.print(n.getName()); } public void visit(QualifiedNameExpr n, Object arg) { n.getQualifier().accept(this, arg); printer.print("."); printer.print(n.getName()); } public void visit(ImportDeclaration n, Object arg) { printer.print("import "); if (n.isStatic()) { printer.print("static "); } n.getName().accept(this, arg); if (n.isAsterisk()) { printer.print(".*"); } printer.printLn(";"); } public void visit(ClassOrInterfaceDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); if (n.isInterface()) { printer.print("interface "); } else { printer.print("class "); } printer.print(n.getName()); printTypeParameters(n.getTypeParameters(), arg); if (n.getExtends() != null) { printer.print(" extends "); for (Iterator i = n.getExtends().iterator(); i.hasNext();) { ClassOrInterfaceType c = i.next(); c.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } if (n.getImplements() != null) { printer.print(" implements "); for (Iterator i = n.getImplements().iterator(); i.hasNext();) { ClassOrInterfaceType c = i.next(); c.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.printLn(" {"); printer.indent(); if (n.getMembers() != null) { printMembers(n.getMembers(), arg); } printer.unindent(); printer.print("}"); } public void visit(EmptyTypeDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printer.print(";"); } public void visit(JavadocComment n, Object arg) { printer.print("/**"); printer.print(n.getContent()); printer.printLn("*/"); } public void visit(ClassOrInterfaceType n, Object arg) { if (n.getScope() != null) { n.getScope().accept(this, arg); printer.print("."); } printer.print(n.getName()); printTypeArgs(n.getTypeArgs(), arg); } public void visit(TypeParameter n, Object arg) { printer.print(n.getName()); if (n.getTypeBound() != null) { printer.print(" extends "); for (Iterator i = n.getTypeBound().iterator(); i.hasNext();) { ClassOrInterfaceType c = i.next(); c.accept(this, arg); if (i.hasNext()) { printer.print(" & "); } } } } public void visit(PrimitiveType n, Object arg) { switch (n.getType()) { case Boolean: printer.print("boolean"); break; case Byte: printer.print("byte"); break; case Char: printer.print("char"); break; case Double: printer.print("double"); break; case Float: printer.print("float"); break; case Int: printer.print("int"); break; case Long: printer.print("long"); break; case Short: printer.print("short"); break; } } public void visit(ReferenceType n, Object arg) { n.getType().accept(this, arg); for (int i = 0; i < n.getArrayCount(); i++) { printer.print("[]"); } } public void visit(WildcardType n, Object arg) { printer.print("?"); if (n.getExtends() != null) { printer.print(" extends "); n.getExtends().accept(this, arg); } if (n.getSuper() != null) { printer.print(" super "); n.getSuper().accept(this, arg); } } public void visit(FieldDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); n.getType().accept(this, arg); printer.print(" "); for (Iterator i = n.getVariables().iterator(); i.hasNext();) { VariableDeclarator var = i.next(); var.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } printer.print(";"); } public void visit(VariableDeclarator n, Object arg) { n.getId().accept(this, arg); if (n.getInit() != null) { printer.print(" = "); n.getInit().accept(this, arg); } } public void visit(VariableDeclaratorId n, Object arg) { printer.print(n.getName()); for (int i = 0; i < n.getArrayCount(); i++) { printer.print("[]"); } } public void visit(ArrayInitializerExpr n, Object arg) { printer.print("{"); if (n.getValues() != null) { printer.print(" "); for (Iterator i = n.getValues().iterator(); i.hasNext();) { Expression expr = i.next(); expr.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } printer.print(" "); } printer.print("}"); } public void visit(VoidType n, Object arg) { printer.print("void"); } public void visit(ArrayAccessExpr n, Object arg) { n.getName().accept(this, arg); printer.print("["); n.getIndex().accept(this, arg); printer.print("]"); } public void visit(ArrayCreationExpr n, Object arg) { printer.print("new "); n.getType().accept(this, arg); if (n.getDimensions() != null) { for (Expression dim : n.getDimensions()) { printer.print("["); dim.accept(this, arg); printer.print("]"); } for (int i = 0; i < n.getArrayCount(); i++) { printer.print("[]"); } } else { for (int i = 0; i < n.getArrayCount(); i++) { printer.print("[]"); } printer.print(" "); n.getInitializer().accept(this, arg); } } public void visit(AssignExpr n, Object arg) { n.getTarget().accept(this, arg); printer.print(" "); switch (n.getOperator()) { case assign: printer.print("="); break; case and: printer.print("&="); break; case or: printer.print("|="); break; case xor: printer.print("^="); break; case plus: printer.print("+="); break; case minus: printer.print("-="); break; case rem: printer.print("%="); break; case slash: printer.print("/="); break; case star: printer.print("*="); break; case lShift: printer.print("<<="); break; case rSignedShift: printer.print(">>="); break; case rUnsignedShift: printer.print(">>>="); break; } printer.print(" "); n.getValue().accept(this, arg); } public void visit(BinaryExpr n, Object arg) { n.getLeft().accept(this, arg); printer.print(" "); switch (n.getOperator()) { case or: printer.print("||"); break; case and: printer.print("&&"); break; case binOr: printer.print("|"); break; case binAnd: printer.print("&"); break; case xor: printer.print("^"); break; case equals: printer.print("=="); break; case notEquals: printer.print("!="); break; case less: printer.print("<"); break; case greater: printer.print(">"); break; case lessEquals: printer.print("<="); break; case greaterEquals: printer.print(">="); break; case lShift: printer.print("<<"); break; case rSignedShift: printer.print(">>"); break; case rUnsignedShift: printer.print(">>>"); break; case plus: printer.print("+"); break; case minus: printer.print("-"); break; case times: printer.print("*"); break; case divide: printer.print("/"); break; case remainder: printer.print("%"); break; } printer.print(" "); n.getRight().accept(this, arg); } public void visit(CastExpr n, Object arg) { printer.print("("); n.getType().accept(this, arg); printer.print(") "); n.getExpr().accept(this, arg); } public void visit(ClassExpr n, Object arg) { n.getType().accept(this, arg); printer.print(".class"); } public void visit(ConditionalExpr n, Object arg) { n.getCondition().accept(this, arg); printer.print(" ? "); n.getThenExpr().accept(this, arg); printer.print(" : "); n.getElseExpr().accept(this, arg); } public void visit(EnclosedExpr n, Object arg) { printer.print("("); n.getInner().accept(this, arg); printer.print(")"); } public void visit(FieldAccessExpr n, Object arg) { n.getScope().accept(this, arg); printer.print("."); printer.print(n.getField()); } public void visit(InstanceOfExpr n, Object arg) { n.getExpr().accept(this, arg); printer.print(" instanceof "); n.getType().accept(this, arg); } public void visit(CharLiteralExpr n, Object arg) { printer.print("'"); printer.print(n.getValue()); printer.print("'"); } public void visit(DoubleLiteralExpr n, Object arg) { printer.print(n.getValue()); } public void visit(IntegerLiteralExpr n, Object arg) { printer.print(n.getValue()); } public void visit(LongLiteralExpr n, Object arg) { printer.print(n.getValue()); } public void visit(IntegerLiteralMinValueExpr n, Object arg) { printer.print(n.getValue()); } public void visit(LongLiteralMinValueExpr n, Object arg) { printer.print(n.getValue()); } public void visit(StringLiteralExpr n, Object arg) { printer.print("\""); printer.print(n.getValue()); printer.print("\""); } public void visit(BooleanLiteralExpr n, Object arg) { printer.print(String.valueOf(n.getValue())); } public void visit(NullLiteralExpr n, Object arg) { printer.print("null"); } public void visit(ThisExpr n, Object arg) { if (n.getClassExpr() != null) { n.getClassExpr().accept(this, arg); printer.print("."); } printer.print("this"); } public void visit(SuperExpr n, Object arg) { if (n.getClassExpr() != null) { n.getClassExpr().accept(this, arg); printer.print("."); } printer.print("super"); } public void visit(MethodCallExpr n, Object arg) { if (n.getScope() != null) { n.getScope().accept(this, arg); printer.print("."); } printTypeArgs(n.getTypeArgs(), arg); printer.print(n.getName()); printArguments(n.getArgs(), arg); } public void visit(ObjectCreationExpr n, Object arg) { if (n.getScope() != null) { n.getScope().accept(this, arg); printer.print("."); } printer.print("new "); printTypeArgs(n.getTypeArgs(), arg); n.getType().accept(this, arg); printArguments(n.getArgs(), arg); if (n.getAnonymousClassBody() != null) { printer.printLn(" {"); printer.indent(); printMembers(n.getAnonymousClassBody(), arg); printer.unindent(); printer.print("}"); } } public void visit(UnaryExpr n, Object arg) { switch (n.getOperator()) { case positive: printer.print("+"); break; case negative: printer.print("-"); break; case inverse: printer.print("~"); break; case not: printer.print("!"); break; case preIncrement: printer.print("++"); break; case preDecrement: printer.print("--"); break; } n.getExpr().accept(this, arg); switch (n.getOperator()) { case posIncrement: printer.print("++"); break; case posDecrement: printer.print("--"); break; } } public void visit(ConstructorDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); printTypeParameters(n.getTypeParameters(), arg); if (n.getTypeParameters() != null) { printer.print(" "); } printer.print(n.getName()); printer.print("("); if (n.getParameters() != null) { for (Iterator i = n.getParameters().iterator(); i.hasNext();) { Parameter p = i.next(); p.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print(")"); if (n.getThrows() != null) { printer.print(" throws "); for (Iterator i = n.getThrows().iterator(); i.hasNext();) { NameExpr name = i.next(); name.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print(" "); n.getBlock().accept(this, arg); } public void visit(MethodDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); printTypeParameters(n.getTypeParameters(), arg); if (n.getTypeParameters() != null) { printer.print(" "); } n.getType().accept(this, arg); printer.print(" "); printer.print(n.getName()); printer.print("("); if (n.getParameters() != null) { for (Iterator i = n.getParameters().iterator(); i.hasNext();) { Parameter p = i.next(); p.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print(")"); for (int i = 0; i < n.getArrayCount(); i++) { printer.print("[]"); } if (n.getThrows() != null) { printer.print(" throws "); for (Iterator i = n.getThrows().iterator(); i.hasNext();) { NameExpr name = i.next(); name.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } if (n.getBody() == null) { printer.print(";"); } else { printer.print(" "); n.getBody().accept(this, arg); } } public void visit(Parameter n, Object arg) { printAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); n.getType().accept(this, arg); if (n.isVarArgs()) { printer.print("..."); } printer.print(" "); n.getId().accept(this, arg); } public void visit(ExplicitConstructorInvocationStmt n, Object arg) { if (n.isThis()) { printTypeArgs(n.getTypeArgs(), arg); printer.print("this"); } else { if (n.getExpr() != null) { n.getExpr().accept(this, arg); printer.print("."); } printTypeArgs(n.getTypeArgs(), arg); printer.print("super"); } printArguments(n.getArgs(), arg); printer.print(";"); } public void visit(VariableDeclarationExpr n, Object arg) { printAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); n.getType().accept(this, arg); printer.print(" "); for (Iterator i = n.getVars().iterator(); i.hasNext();) { VariableDeclarator v = i.next(); v.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } public void visit(TypeDeclarationStmt n, Object arg) { n.getTypeDeclaration().accept(this, arg); } public void visit(AssertStmt n, Object arg) { printer.print("assert "); n.getCheck().accept(this, arg); if (n.getMessage() != null) { printer.print(" : "); n.getMessage().accept(this, arg); } printer.print(";"); } public void visit(BlockStmt n, Object arg) { printer.printLn("{"); if (n.getStmts() != null) { printer.indent(); for (Statement s : n.getStmts()) { s.accept(this, arg); printer.printLn(); } printer.unindent(); } printer.print("}"); } public void visit(LabeledStmt n, Object arg) { printer.print(n.getLabel()); printer.print(": "); n.getStmt().accept(this, arg); } public void visit(EmptyStmt n, Object arg) { printer.print(";"); } public void visit(ExpressionStmt n, Object arg) { n.getExpression().accept(this, arg); printer.print(";"); } public void visit(SwitchStmt n, Object arg) { printer.print("switch("); n.getSelector().accept(this, arg); printer.printLn(") {"); if (n.getEntries() != null) { printer.indent(); for (SwitchEntryStmt e : n.getEntries()) { e.accept(this, arg); } printer.unindent(); } printer.print("}"); } public void visit(SwitchEntryStmt n, Object arg) { if (n.getLabel() != null) { printer.print("case "); n.getLabel().accept(this, arg); printer.print(":"); } else { printer.print("default:"); } printer.printLn(); printer.indent(); if (n.getStmts() != null) { for (Statement s : n.getStmts()) { s.accept(this, arg); printer.printLn(); } } printer.unindent(); } public void visit(BreakStmt n, Object arg) { printer.print("break"); if (n.getId() != null) { printer.print(" "); printer.print(n.getId()); } printer.print(";"); } public void visit(ReturnStmt n, Object arg) { printer.print("return"); if (n.getExpr() != null) { printer.print(" "); n.getExpr().accept(this, arg); } printer.print(";"); } public void visit(EnumDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); printer.print("enum "); printer.print(n.getName()); if (n.getImplements() != null) { printer.print(" implements "); for (Iterator i = n.getImplements().iterator(); i.hasNext();) { ClassOrInterfaceType c = i.next(); c.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.printLn(" {"); printer.indent(); if (n.getEntries() != null) { printer.printLn(); for (Iterator i = n.getEntries().iterator(); i.hasNext();) { EnumConstantDeclaration e = i.next(); e.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } if (n.getMembers() != null) { printer.printLn(";"); printMembers(n.getMembers(), arg); } else { if (n.getEntries() != null) { printer.printLn(); } } printer.unindent(); printer.print("}"); } public void visit(EnumConstantDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printMemberAnnotations(n.getAnnotations(), arg); printer.print(n.getName()); if (n.getArgs() != null) { printArguments(n.getArgs(), arg); } if (n.getClassBody() != null) { printer.printLn(" {"); printer.indent(); printMembers(n.getClassBody(), arg); printer.unindent(); printer.printLn("}"); } } public void visit(EmptyMemberDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printer.print(";"); } public void visit(InitializerDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); if (n.isStatic()) { printer.print("static "); } n.getBlock().accept(this, arg); } public void visit(IfStmt n, Object arg) { printer.print("if ("); n.getCondition().accept(this, arg); printer.print(") "); n.getThenStmt().accept(this, arg); if (n.getElseStmt() != null) { printer.print(" else "); n.getElseStmt().accept(this, arg); } } public void visit(WhileStmt n, Object arg) { printer.print("while ("); n.getCondition().accept(this, arg); printer.print(") "); n.getBody().accept(this, arg); } public void visit(ContinueStmt n, Object arg) { printer.print("continue"); if (n.getId() != null) { printer.print(" "); printer.print(n.getId()); } printer.print(";"); } public void visit(DoStmt n, Object arg) { printer.print("do "); n.getBody().accept(this, arg); printer.print(" while ("); n.getCondition().accept(this, arg); printer.print(");"); } public void visit(ForeachStmt n, Object arg) { printer.print("for ("); n.getVariable().accept(this, arg); printer.print(" : "); n.getIterable().accept(this, arg); printer.print(") "); n.getBody().accept(this, arg); } public void visit(ForStmt n, Object arg) { printer.print("for ("); if (n.getInit() != null) { for (Iterator i = n.getInit().iterator(); i.hasNext();) { Expression e = i.next(); e.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print("; "); if (n.getCompare() != null) { n.getCompare().accept(this, arg); } printer.print("; "); if (n.getUpdate() != null) { for (Iterator i = n.getUpdate().iterator(); i.hasNext();) { Expression e = i.next(); e.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print(") "); n.getBody().accept(this, arg); } public void visit(ThrowStmt n, Object arg) { printer.print("throw "); n.getExpr().accept(this, arg); printer.print(";"); } public void visit(SynchronizedStmt n, Object arg) { printer.print("synchronized ("); n.getExpr().accept(this, arg); printer.print(") "); n.getBlock().accept(this, arg); } public void visit(TryStmt n, Object arg) { printer.print("try "); n.getTryBlock().accept(this, arg); if (n.getCatchs() != null) { for (CatchClause c : n.getCatchs()) { c.accept(this, arg); } } if (n.getFinallyBlock() != null) { printer.print(" finally "); n.getFinallyBlock().accept(this, arg); } } public void visit(CatchClause n, Object arg) { printer.print(" catch ("); n.getExcept().accept(this, arg); printer.print(") "); n.getCatchBlock().accept(this, arg); } public void visit(AnnotationDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); printer.print("@interface "); printer.print(n.getName()); printer.printLn(" {"); printer.indent(); if (n.getMembers() != null) { printMembers(n.getMembers(), arg); } printer.unindent(); printer.print("}"); } public void visit(AnnotationMemberDeclaration n, Object arg) { printJavadoc(n.getJavaDoc(), arg); printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); n.getType().accept(this, arg); printer.print(" "); printer.print(n.getName()); printer.print("()"); if (n.getDefaultValue() != null) { printer.print(" default "); n.getDefaultValue().accept(this, arg); } printer.print(";"); } public void visit(MarkerAnnotationExpr n, Object arg) { printer.print("@"); n.getName().accept(this, arg); } public void visit(SingleMemberAnnotationExpr n, Object arg) { printer.print("@"); n.getName().accept(this, arg); printer.print("("); n.getMemberValue().accept(this, arg); printer.print(")"); } public void visit(NormalAnnotationExpr n, Object arg) { printer.print("@"); n.getName().accept(this, arg); printer.print("("); if (n.getPairs() != null) { for (Iterator i = n.getPairs().iterator(); i.hasNext();) { MemberValuePair m = i.next(); m.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print(")"); } public void visit(MemberValuePair n, Object arg) { printer.print(n.getName()); printer.print(" = "); n.getValue().accept(this, arg); } public void visit(LineComment n, Object arg) { printer.print("//"); printer.printLn(n.getContent()); } public void visit(BlockComment n, Object arg) { printer.print("/*"); printer.print(n.getContent()); printer.printLn("*/"); } } src/japa/parser/ast/visitor/EqualsVisitor.java0000644000000000000000000010744711324631224020530 0ustar rootroot/* * Created on 17/01/2010 */ package japa.parser.ast.visitor; import japa.parser.ast.BlockComment; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.LineComment; import japa.parser.ast.Node; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.TypeParameter; import japa.parser.ast.body.AnnotationDeclaration; import japa.parser.ast.body.AnnotationMemberDeclaration; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.ConstructorDeclaration; import japa.parser.ast.body.EmptyMemberDeclaration; import japa.parser.ast.body.EmptyTypeDeclaration; import japa.parser.ast.body.EnumConstantDeclaration; import japa.parser.ast.body.EnumDeclaration; import japa.parser.ast.body.FieldDeclaration; import japa.parser.ast.body.InitializerDeclaration; import japa.parser.ast.body.JavadocComment; import japa.parser.ast.body.MethodDeclaration; import japa.parser.ast.body.Parameter; import japa.parser.ast.body.VariableDeclarator; import japa.parser.ast.body.VariableDeclaratorId; import japa.parser.ast.expr.ArrayAccessExpr; import japa.parser.ast.expr.ArrayCreationExpr; import japa.parser.ast.expr.ArrayInitializerExpr; import japa.parser.ast.expr.AssignExpr; import japa.parser.ast.expr.BinaryExpr; import japa.parser.ast.expr.BooleanLiteralExpr; import japa.parser.ast.expr.CastExpr; import japa.parser.ast.expr.CharLiteralExpr; import japa.parser.ast.expr.ClassExpr; import japa.parser.ast.expr.ConditionalExpr; import japa.parser.ast.expr.DoubleLiteralExpr; import japa.parser.ast.expr.EnclosedExpr; import japa.parser.ast.expr.FieldAccessExpr; import japa.parser.ast.expr.InstanceOfExpr; import japa.parser.ast.expr.IntegerLiteralExpr; import japa.parser.ast.expr.IntegerLiteralMinValueExpr; import japa.parser.ast.expr.LongLiteralExpr; import japa.parser.ast.expr.LongLiteralMinValueExpr; import japa.parser.ast.expr.MarkerAnnotationExpr; import japa.parser.ast.expr.MemberValuePair; import japa.parser.ast.expr.MethodCallExpr; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.expr.NormalAnnotationExpr; import japa.parser.ast.expr.NullLiteralExpr; import japa.parser.ast.expr.ObjectCreationExpr; import japa.parser.ast.expr.QualifiedNameExpr; import japa.parser.ast.expr.SingleMemberAnnotationExpr; import japa.parser.ast.expr.StringLiteralExpr; import japa.parser.ast.expr.SuperExpr; import japa.parser.ast.expr.ThisExpr; import japa.parser.ast.expr.UnaryExpr; import japa.parser.ast.expr.VariableDeclarationExpr; import japa.parser.ast.stmt.AssertStmt; import japa.parser.ast.stmt.BlockStmt; import japa.parser.ast.stmt.BreakStmt; import japa.parser.ast.stmt.CatchClause; import japa.parser.ast.stmt.ContinueStmt; import japa.parser.ast.stmt.DoStmt; import japa.parser.ast.stmt.EmptyStmt; import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; import japa.parser.ast.stmt.ExpressionStmt; import japa.parser.ast.stmt.ForStmt; import japa.parser.ast.stmt.ForeachStmt; import japa.parser.ast.stmt.IfStmt; import japa.parser.ast.stmt.LabeledStmt; import japa.parser.ast.stmt.ReturnStmt; import japa.parser.ast.stmt.SwitchEntryStmt; import japa.parser.ast.stmt.SwitchStmt; import japa.parser.ast.stmt.SynchronizedStmt; import japa.parser.ast.stmt.ThrowStmt; import japa.parser.ast.stmt.TryStmt; import japa.parser.ast.stmt.TypeDeclarationStmt; import japa.parser.ast.stmt.WhileStmt; import japa.parser.ast.type.ClassOrInterfaceType; import japa.parser.ast.type.PrimitiveType; import japa.parser.ast.type.ReferenceType; import japa.parser.ast.type.VoidType; import japa.parser.ast.type.WildcardType; import java.util.List; /** * @author Julio Vilmar Gesser */ public class EqualsVisitor implements GenericVisitor { private static final EqualsVisitor SINGLETON = new EqualsVisitor(); public static boolean equals(Node n1, Node n2) { return SINGLETON.nodeEquals(n1, n2); } private EqualsVisitor() { // hide constructor } private boolean nodesEquals(List nodes1, List nodes2) { if (nodes1 == null) { if (nodes2 == null) { return true; } return false; } else if (nodes2 == null) { return false; } if (nodes1.size() != nodes2.size()) { return false; } for (int i = 0; i < nodes1.size(); i++) { if (!nodeEquals(nodes1.get(i), nodes2.get(i))) { return false; } } return true; } private boolean nodeEquals(T n1, T n2) { if (n1 == n2) { return true; } if (n1 == null) { if (n2 == null) { return true; } return false; } else if (n2 == null) { return false; } if (n1.getClass() != n2.getClass()) { return false; } return n1.accept(this, n2).booleanValue(); } private boolean objEquals(Object n1, Object n2) { if (n1 == n2) { return true; } if (n1 == null) { if (n2 == null) { return true; } return false; } else if (n2 == null) { return false; } return n1.equals(n2); } public Boolean visit(CompilationUnit n1, Node arg) { CompilationUnit n2 = (CompilationUnit) arg; if (!nodeEquals(n1.getPackage(), n2.getPackage())) { return Boolean.FALSE; } if (!nodesEquals(n1.getImports(), n2.getImports())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypes(), n2.getTypes())) { return Boolean.FALSE; } if (!nodesEquals(n1.getComments(), n2.getComments())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(PackageDeclaration n1, Node arg) { PackageDeclaration n2 = (PackageDeclaration) arg; if (!nodeEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ImportDeclaration n1, Node arg) { ImportDeclaration n2 = (ImportDeclaration) arg; if (!nodeEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(TypeParameter n1, Node arg) { TypeParameter n2 = (TypeParameter) arg; if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypeBound(), n2.getTypeBound())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(LineComment n1, Node arg) { LineComment n2 = (LineComment) arg; if (!objEquals(n1.getContent(), n2.getContent())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(BlockComment n1, Node arg) { BlockComment n2 = (BlockComment) arg; if (!objEquals(n1.getContent(), n2.getContent())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ClassOrInterfaceDeclaration n1, Node arg) { ClassOrInterfaceDeclaration n2 = (ClassOrInterfaceDeclaration) arg; // javadoc are checked at CompilationUnit if (n1.getModifiers() != n2.getModifiers()) { return Boolean.FALSE; } if (n1.isInterface() != n2.isInterface()) { return Boolean.FALSE; } if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) { return Boolean.FALSE; } if (!nodesEquals(n1.getExtends(), n2.getExtends())) { return Boolean.FALSE; } if (!nodesEquals(n1.getImplements(), n2.getImplements())) { return Boolean.FALSE; } if (!nodesEquals(n1.getMembers(), n2.getMembers())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(EnumDeclaration n1, Node arg) { EnumDeclaration n2 = (EnumDeclaration) arg; // javadoc are checked at CompilationUnit if (n1.getModifiers() != n2.getModifiers()) { return Boolean.FALSE; } if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } if (!nodesEquals(n1.getImplements(), n2.getImplements())) { return Boolean.FALSE; } if (!nodesEquals(n1.getEntries(), n2.getEntries())) { return Boolean.FALSE; } if (!nodesEquals(n1.getMembers(), n2.getMembers())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(EmptyTypeDeclaration n1, Node arg) { return Boolean.TRUE; } public Boolean visit(EnumConstantDeclaration n1, Node arg) { EnumConstantDeclaration n2 = (EnumConstantDeclaration) arg; // javadoc are checked at CompilationUnit if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } if (!nodesEquals(n1.getArgs(), n2.getArgs())) { return Boolean.FALSE; } if (!nodesEquals(n1.getClassBody(), n2.getClassBody())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(AnnotationDeclaration n1, Node arg) { AnnotationDeclaration n2 = (AnnotationDeclaration) arg; // javadoc are checked at CompilationUnit if (n1.getModifiers() != n2.getModifiers()) { return Boolean.FALSE; } if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } if (!nodesEquals(n1.getMembers(), n2.getMembers())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(AnnotationMemberDeclaration n1, Node arg) { AnnotationMemberDeclaration n2 = (AnnotationMemberDeclaration) arg; // javadoc are checked at CompilationUnit if (n1.getModifiers() != n2.getModifiers()) { return Boolean.FALSE; } if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } if (!nodeEquals(n1.getDefaultValue(), n2.getDefaultValue())) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(FieldDeclaration n1, Node arg) { FieldDeclaration n2 = (FieldDeclaration) arg; // javadoc are checked at CompilationUnit if (n1.getModifiers() != n2.getModifiers()) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } if (!nodesEquals(n1.getVariables(), n2.getVariables())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(VariableDeclarator n1, Node arg) { VariableDeclarator n2 = (VariableDeclarator) arg; if (!nodeEquals(n1.getId(), n2.getId())) { return Boolean.FALSE; } if (!nodeEquals(n1.getInit(), n2.getInit())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(VariableDeclaratorId n1, Node arg) { VariableDeclaratorId n2 = (VariableDeclaratorId) arg; if (n1.getArrayCount() != n2.getArrayCount()) { return Boolean.FALSE; } if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ConstructorDeclaration n1, Node arg) { ConstructorDeclaration n2 = (ConstructorDeclaration) arg; // javadoc are checked at CompilationUnit if (n1.getModifiers() != n2.getModifiers()) { return Boolean.FALSE; } if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } if (!nodeEquals(n1.getBlock(), n2.getBlock())) { return Boolean.FALSE; } if (!nodesEquals(n1.getParameters(), n2.getParameters())) { return Boolean.FALSE; } if (!nodesEquals(n1.getThrows(), n2.getThrows())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(MethodDeclaration n1, Node arg) { MethodDeclaration n2 = (MethodDeclaration) arg; // javadoc are checked at CompilationUnit if (n1.getModifiers() != n2.getModifiers()) { return Boolean.FALSE; } if (n1.getArrayCount() != n2.getArrayCount()) { return Boolean.FALSE; } if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } if (!nodeEquals(n1.getBody(), n2.getBody())) { return Boolean.FALSE; } if (!nodesEquals(n1.getParameters(), n2.getParameters())) { return Boolean.FALSE; } if (!nodesEquals(n1.getThrows(), n2.getThrows())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(Parameter n1, Node arg) { Parameter n2 = (Parameter) arg; if (n1.getModifiers() != n2.getModifiers()) { return Boolean.FALSE; } if (!nodeEquals(n1.getId(), n2.getId())) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(EmptyMemberDeclaration n1, Node arg) { return Boolean.TRUE; } public Boolean visit(InitializerDeclaration n1, Node arg) { InitializerDeclaration n2 = (InitializerDeclaration) arg; if (!nodeEquals(n1.getBlock(), n2.getBlock())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(JavadocComment n1, Node arg) { JavadocComment n2 = (JavadocComment) arg; if (!objEquals(n1.getContent(), n2.getContent())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ClassOrInterfaceType n1, Node arg) { ClassOrInterfaceType n2 = (ClassOrInterfaceType) arg; if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodeEquals(n1.getScope(), n2.getScope())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(PrimitiveType n1, Node arg) { PrimitiveType n2 = (PrimitiveType) arg; if (n1.getType() != n2.getType()) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ReferenceType n1, Node arg) { ReferenceType n2 = (ReferenceType) arg; if (n1.getArrayCount() != n2.getArrayCount()) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(VoidType n1, Node arg) { return Boolean.TRUE; } public Boolean visit(WildcardType n1, Node arg) { WildcardType n2 = (WildcardType) arg; if (!nodeEquals(n1.getExtends(), n2.getExtends())) { return Boolean.FALSE; } if (!nodeEquals(n1.getSuper(), n2.getSuper())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ArrayAccessExpr n1, Node arg) { ArrayAccessExpr n2 = (ArrayAccessExpr) arg; if (!nodeEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodeEquals(n1.getIndex(), n2.getIndex())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ArrayCreationExpr n1, Node arg) { ArrayCreationExpr n2 = (ArrayCreationExpr) arg; if (n1.getArrayCount() != n2.getArrayCount()) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } if (!nodeEquals(n1.getInitializer(), n2.getInitializer())) { return Boolean.FALSE; } if (!nodesEquals(n1.getDimensions(), n2.getDimensions())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ArrayInitializerExpr n1, Node arg) { ArrayInitializerExpr n2 = (ArrayInitializerExpr) arg; if (!nodesEquals(n1.getValues(), n2.getValues())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(AssignExpr n1, Node arg) { AssignExpr n2 = (AssignExpr) arg; if (n1.getOperator() != n2.getOperator()) { return Boolean.FALSE; } if (!nodeEquals(n1.getTarget(), n2.getTarget())) { return Boolean.FALSE; } if (!nodeEquals(n1.getValue(), n2.getValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(BinaryExpr n1, Node arg) { BinaryExpr n2 = (BinaryExpr) arg; if (n1.getOperator() != n2.getOperator()) { return Boolean.FALSE; } if (!nodeEquals(n1.getLeft(), n2.getLeft())) { return Boolean.FALSE; } if (!nodeEquals(n1.getRight(), n2.getRight())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(CastExpr n1, Node arg) { CastExpr n2 = (CastExpr) arg; if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } if (!nodeEquals(n1.getExpr(), n2.getExpr())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ClassExpr n1, Node arg) { ClassExpr n2 = (ClassExpr) arg; if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ConditionalExpr n1, Node arg) { ConditionalExpr n2 = (ConditionalExpr) arg; if (!nodeEquals(n1.getCondition(), n2.getCondition())) { return Boolean.FALSE; } if (!nodeEquals(n1.getThenExpr(), n2.getThenExpr())) { return Boolean.FALSE; } if (!nodeEquals(n1.getElseExpr(), n2.getElseExpr())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(EnclosedExpr n1, Node arg) { EnclosedExpr n2 = (EnclosedExpr) arg; if (!nodeEquals(n1.getInner(), n2.getInner())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(FieldAccessExpr n1, Node arg) { FieldAccessExpr n2 = (FieldAccessExpr) arg; if (!nodeEquals(n1.getScope(), n2.getScope())) { return Boolean.FALSE; } if (!objEquals(n1.getField(), n2.getField())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(InstanceOfExpr n1, Node arg) { InstanceOfExpr n2 = (InstanceOfExpr) arg; if (!nodeEquals(n1.getExpr(), n2.getExpr())) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(StringLiteralExpr n1, Node arg) { StringLiteralExpr n2 = (StringLiteralExpr) arg; if (!objEquals(n1.getValue(), n2.getValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(IntegerLiteralExpr n1, Node arg) { IntegerLiteralExpr n2 = (IntegerLiteralExpr) arg; if (!objEquals(n1.getValue(), n2.getValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(LongLiteralExpr n1, Node arg) { LongLiteralExpr n2 = (LongLiteralExpr) arg; if (!objEquals(n1.getValue(), n2.getValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(IntegerLiteralMinValueExpr n1, Node arg) { IntegerLiteralMinValueExpr n2 = (IntegerLiteralMinValueExpr) arg; if (!objEquals(n1.getValue(), n2.getValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(LongLiteralMinValueExpr n1, Node arg) { LongLiteralMinValueExpr n2 = (LongLiteralMinValueExpr) arg; if (!objEquals(n1.getValue(), n2.getValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(CharLiteralExpr n1, Node arg) { CharLiteralExpr n2 = (CharLiteralExpr) arg; if (!objEquals(n1.getValue(), n2.getValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(DoubleLiteralExpr n1, Node arg) { DoubleLiteralExpr n2 = (DoubleLiteralExpr) arg; if (!objEquals(n1.getValue(), n2.getValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(BooleanLiteralExpr n1, Node arg) { BooleanLiteralExpr n2 = (BooleanLiteralExpr) arg; if (n1.getValue() != n2.getValue()) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(NullLiteralExpr n1, Node arg) { return Boolean.TRUE; } public Boolean visit(MethodCallExpr n1, Node arg) { MethodCallExpr n2 = (MethodCallExpr) arg; if (!nodeEquals(n1.getScope(), n2.getScope())) { return Boolean.FALSE; } if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getArgs(), n2.getArgs())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(NameExpr n1, Node arg) { NameExpr n2 = (NameExpr) arg; if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ObjectCreationExpr n1, Node arg) { ObjectCreationExpr n2 = (ObjectCreationExpr) arg; if (!nodeEquals(n1.getScope(), n2.getScope())) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnonymousClassBody(), n2.getAnonymousClassBody())) { return Boolean.FALSE; } if (!nodesEquals(n1.getArgs(), n2.getArgs())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(QualifiedNameExpr n1, Node arg) { QualifiedNameExpr n2 = (QualifiedNameExpr) arg; if (!nodeEquals(n1.getQualifier(), n2.getQualifier())) { return Boolean.FALSE; } if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ThisExpr n1, Node arg) { ThisExpr n2 = (ThisExpr) arg; if (!nodeEquals(n1.getClassExpr(), n2.getClassExpr())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(SuperExpr n1, Node arg) { SuperExpr n2 = (SuperExpr) arg; if (!nodeEquals(n1.getClassExpr(), n2.getClassExpr())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(UnaryExpr n1, Node arg) { UnaryExpr n2 = (UnaryExpr) arg; if (n1.getOperator() != n2.getOperator()) { return Boolean.FALSE; } if (!nodeEquals(n1.getExpr(), n2.getExpr())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(VariableDeclarationExpr n1, Node arg) { VariableDeclarationExpr n2 = (VariableDeclarationExpr) arg; if (n1.getModifiers() != n2.getModifiers()) { return Boolean.FALSE; } if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) { return Boolean.FALSE; } if (!nodeEquals(n1.getType(), n2.getType())) { return Boolean.FALSE; } if (!nodesEquals(n1.getVars(), n2.getVars())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(MarkerAnnotationExpr n1, Node arg) { MarkerAnnotationExpr n2 = (MarkerAnnotationExpr) arg; if (!nodeEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(SingleMemberAnnotationExpr n1, Node arg) { SingleMemberAnnotationExpr n2 = (SingleMemberAnnotationExpr) arg; if (!nodeEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodeEquals(n1.getMemberValue(), n2.getMemberValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(NormalAnnotationExpr n1, Node arg) { NormalAnnotationExpr n2 = (NormalAnnotationExpr) arg; if (!nodeEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodesEquals(n1.getPairs(), n2.getPairs())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(MemberValuePair n1, Node arg) { MemberValuePair n2 = (MemberValuePair) arg; if (!objEquals(n1.getName(), n2.getName())) { return Boolean.FALSE; } if (!nodeEquals(n1.getValue(), n2.getValue())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ExplicitConstructorInvocationStmt n1, Node arg) { ExplicitConstructorInvocationStmt n2 = (ExplicitConstructorInvocationStmt) arg; if (!nodeEquals(n1.getExpr(), n2.getExpr())) { return Boolean.FALSE; } if (!nodesEquals(n1.getArgs(), n2.getArgs())) { return Boolean.FALSE; } if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(TypeDeclarationStmt n1, Node arg) { TypeDeclarationStmt n2 = (TypeDeclarationStmt) arg; if (!nodeEquals(n1.getTypeDeclaration(), n2.getTypeDeclaration())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(AssertStmt n1, Node arg) { AssertStmt n2 = (AssertStmt) arg; if (!nodeEquals(n1.getCheck(), n2.getCheck())) { return Boolean.FALSE; } if (!nodeEquals(n1.getMessage(), n2.getMessage())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(BlockStmt n1, Node arg) { BlockStmt n2 = (BlockStmt) arg; if (!nodesEquals(n1.getStmts(), n2.getStmts())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(LabeledStmt n1, Node arg) { LabeledStmt n2 = (LabeledStmt) arg; if (!nodeEquals(n1.getStmt(), n2.getStmt())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(EmptyStmt n1, Node arg) { return Boolean.TRUE; } public Boolean visit(ExpressionStmt n1, Node arg) { ExpressionStmt n2 = (ExpressionStmt) arg; if (!nodeEquals(n1.getExpression(), n2.getExpression())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(SwitchStmt n1, Node arg) { SwitchStmt n2 = (SwitchStmt) arg; if (!nodeEquals(n1.getSelector(), n2.getSelector())) { return Boolean.FALSE; } if (!nodesEquals(n1.getEntries(), n2.getEntries())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(SwitchEntryStmt n1, Node arg) { SwitchEntryStmt n2 = (SwitchEntryStmt) arg; if (!nodeEquals(n1.getLabel(), n2.getLabel())) { return Boolean.FALSE; } if (!nodesEquals(n1.getStmts(), n2.getStmts())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(BreakStmt n1, Node arg) { BreakStmt n2 = (BreakStmt) arg; if (!objEquals(n1.getId(), n2.getId())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ReturnStmt n1, Node arg) { ReturnStmt n2 = (ReturnStmt) arg; if (!nodeEquals(n1.getExpr(), n2.getExpr())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(IfStmt n1, Node arg) { IfStmt n2 = (IfStmt) arg; if (!nodeEquals(n1.getCondition(), n2.getCondition())) { return Boolean.FALSE; } if (!nodeEquals(n1.getThenStmt(), n2.getThenStmt())) { return Boolean.FALSE; } if (!nodeEquals(n1.getElseStmt(), n2.getElseStmt())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(WhileStmt n1, Node arg) { WhileStmt n2 = (WhileStmt) arg; if (!nodeEquals(n1.getCondition(), n2.getCondition())) { return Boolean.FALSE; } if (!nodeEquals(n1.getBody(), n2.getBody())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ContinueStmt n1, Node arg) { ContinueStmt n2 = (ContinueStmt) arg; if (!objEquals(n1.getId(), n2.getId())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(DoStmt n1, Node arg) { DoStmt n2 = (DoStmt) arg; if (!nodeEquals(n1.getBody(), n2.getBody())) { return Boolean.FALSE; } if (!nodeEquals(n1.getCondition(), n2.getCondition())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ForeachStmt n1, Node arg) { ForeachStmt n2 = (ForeachStmt) arg; if (!nodeEquals(n1.getVariable(), n2.getVariable())) { return Boolean.FALSE; } if (!nodeEquals(n1.getIterable(), n2.getIterable())) { return Boolean.FALSE; } if (!nodeEquals(n1.getBody(), n2.getBody())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ForStmt n1, Node arg) { ForStmt n2 = (ForStmt) arg; if (!nodesEquals(n1.getInit(), n2.getInit())) { return Boolean.FALSE; } if (!nodeEquals(n1.getCompare(), n2.getCompare())) { return Boolean.FALSE; } if (!nodesEquals(n1.getUpdate(), n2.getUpdate())) { return Boolean.FALSE; } if (!nodeEquals(n1.getBody(), n2.getBody())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(ThrowStmt n1, Node arg) { ThrowStmt n2 = (ThrowStmt) arg; if (!nodeEquals(n1.getExpr(), n2.getExpr())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(SynchronizedStmt n1, Node arg) { SynchronizedStmt n2 = (SynchronizedStmt) arg; if (!nodeEquals(n1.getExpr(), n2.getExpr())) { return Boolean.FALSE; } if (!nodeEquals(n1.getBlock(), n2.getBlock())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(TryStmt n1, Node arg) { TryStmt n2 = (TryStmt) arg; if (!nodeEquals(n1.getTryBlock(), n2.getTryBlock())) { return Boolean.FALSE; } if (!nodesEquals(n1.getCatchs(), n2.getCatchs())) { return Boolean.FALSE; } if (!nodeEquals(n1.getFinallyBlock(), n2.getFinallyBlock())) { return Boolean.FALSE; } return Boolean.TRUE; } public Boolean visit(CatchClause n1, Node arg) { CatchClause n2 = (CatchClause) arg; if (!nodeEquals(n1.getExcept(), n2.getExcept())) { return Boolean.FALSE; } if (!nodeEquals(n1.getCatchBlock(), n2.getCatchBlock())) { return Boolean.FALSE; } return Boolean.TRUE; } } src/japa/parser/ast/visitor/GenericVisitor.java0000644000000000000000000002121111132421226020626 0ustar rootroot/* * 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 . */ /* * Created on 05/10/2006 */ package japa.parser.ast.visitor; import japa.parser.ast.BlockComment; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.LineComment; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.TypeParameter; import japa.parser.ast.body.AnnotationDeclaration; import japa.parser.ast.body.AnnotationMemberDeclaration; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.ConstructorDeclaration; import japa.parser.ast.body.EmptyMemberDeclaration; import japa.parser.ast.body.EmptyTypeDeclaration; import japa.parser.ast.body.EnumConstantDeclaration; import japa.parser.ast.body.EnumDeclaration; import japa.parser.ast.body.FieldDeclaration; import japa.parser.ast.body.InitializerDeclaration; import japa.parser.ast.body.JavadocComment; import japa.parser.ast.body.MethodDeclaration; import japa.parser.ast.body.Parameter; import japa.parser.ast.body.VariableDeclarator; import japa.parser.ast.body.VariableDeclaratorId; import japa.parser.ast.expr.ArrayAccessExpr; import japa.parser.ast.expr.ArrayCreationExpr; import japa.parser.ast.expr.ArrayInitializerExpr; import japa.parser.ast.expr.AssignExpr; import japa.parser.ast.expr.BinaryExpr; import japa.parser.ast.expr.BooleanLiteralExpr; import japa.parser.ast.expr.CastExpr; import japa.parser.ast.expr.CharLiteralExpr; import japa.parser.ast.expr.ClassExpr; import japa.parser.ast.expr.ConditionalExpr; import japa.parser.ast.expr.DoubleLiteralExpr; import japa.parser.ast.expr.EnclosedExpr; import japa.parser.ast.expr.FieldAccessExpr; import japa.parser.ast.expr.InstanceOfExpr; import japa.parser.ast.expr.IntegerLiteralExpr; import japa.parser.ast.expr.IntegerLiteralMinValueExpr; import japa.parser.ast.expr.LongLiteralExpr; import japa.parser.ast.expr.LongLiteralMinValueExpr; import japa.parser.ast.expr.MarkerAnnotationExpr; import japa.parser.ast.expr.MemberValuePair; import japa.parser.ast.expr.MethodCallExpr; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.expr.NormalAnnotationExpr; import japa.parser.ast.expr.NullLiteralExpr; import japa.parser.ast.expr.ObjectCreationExpr; import japa.parser.ast.expr.QualifiedNameExpr; import japa.parser.ast.expr.SingleMemberAnnotationExpr; import japa.parser.ast.expr.StringLiteralExpr; import japa.parser.ast.expr.SuperExpr; import japa.parser.ast.expr.ThisExpr; import japa.parser.ast.expr.UnaryExpr; import japa.parser.ast.expr.VariableDeclarationExpr; import japa.parser.ast.stmt.AssertStmt; import japa.parser.ast.stmt.BlockStmt; import japa.parser.ast.stmt.BreakStmt; import japa.parser.ast.stmt.CatchClause; import japa.parser.ast.stmt.ContinueStmt; import japa.parser.ast.stmt.DoStmt; import japa.parser.ast.stmt.EmptyStmt; import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; import japa.parser.ast.stmt.ExpressionStmt; import japa.parser.ast.stmt.ForStmt; import japa.parser.ast.stmt.ForeachStmt; import japa.parser.ast.stmt.IfStmt; import japa.parser.ast.stmt.LabeledStmt; import japa.parser.ast.stmt.ReturnStmt; import japa.parser.ast.stmt.SwitchEntryStmt; import japa.parser.ast.stmt.SwitchStmt; import japa.parser.ast.stmt.SynchronizedStmt; import japa.parser.ast.stmt.ThrowStmt; import japa.parser.ast.stmt.TryStmt; import japa.parser.ast.stmt.TypeDeclarationStmt; import japa.parser.ast.stmt.WhileStmt; import japa.parser.ast.type.ClassOrInterfaceType; import japa.parser.ast.type.PrimitiveType; import japa.parser.ast.type.ReferenceType; import japa.parser.ast.type.VoidType; import japa.parser.ast.type.WildcardType; /** * @author Julio Vilmar Gesser */ public interface GenericVisitor { //- Compilation Unit ---------------------------------- public R visit(CompilationUnit n, A arg); public R visit(PackageDeclaration n, A arg); public R visit(ImportDeclaration n, A arg); public R visit(TypeParameter n, A arg); public R visit(LineComment n, A arg); public R visit(BlockComment n, A arg); //- Body ---------------------------------------------- public R visit(ClassOrInterfaceDeclaration n, A arg); public R visit(EnumDeclaration n, A arg); public R visit(EmptyTypeDeclaration n, A arg); public R visit(EnumConstantDeclaration n, A arg); public R visit(AnnotationDeclaration n, A arg); public R visit(AnnotationMemberDeclaration n, A arg); public R visit(FieldDeclaration n, A arg); public R visit(VariableDeclarator n, A arg); public R visit(VariableDeclaratorId n, A arg); public R visit(ConstructorDeclaration n, A arg); public R visit(MethodDeclaration n, A arg); public R visit(Parameter n, A arg); public R visit(EmptyMemberDeclaration n, A arg); public R visit(InitializerDeclaration n, A arg); public R visit(JavadocComment n, A arg); //- Type ---------------------------------------------- public R visit(ClassOrInterfaceType n, A arg); public R visit(PrimitiveType n, A arg); public R visit(ReferenceType n, A arg); public R visit(VoidType n, A arg); public R visit(WildcardType n, A arg); //- Expression ---------------------------------------- public R visit(ArrayAccessExpr n, A arg); public R visit(ArrayCreationExpr n, A arg); public R visit(ArrayInitializerExpr n, A arg); public R visit(AssignExpr n, A arg); public R visit(BinaryExpr n, A arg); public R visit(CastExpr n, A arg); public R visit(ClassExpr n, A arg); public R visit(ConditionalExpr n, A arg); public R visit(EnclosedExpr n, A arg); public R visit(FieldAccessExpr n, A arg); public R visit(InstanceOfExpr n, A arg); public R visit(StringLiteralExpr n, A arg); public R visit(IntegerLiteralExpr n, A arg); public R visit(LongLiteralExpr n, A arg); public R visit(IntegerLiteralMinValueExpr n, A arg); public R visit(LongLiteralMinValueExpr n, A arg); public R visit(CharLiteralExpr n, A arg); public R visit(DoubleLiteralExpr n, A arg); public R visit(BooleanLiteralExpr n, A arg); public R visit(NullLiteralExpr n, A arg); public R visit(MethodCallExpr n, A arg); public R visit(NameExpr n, A arg); public R visit(ObjectCreationExpr n, A arg); public R visit(QualifiedNameExpr n, A arg); public R visit(ThisExpr n, A arg); public R visit(SuperExpr n, A arg); public R visit(UnaryExpr n, A arg); public R visit(VariableDeclarationExpr n, A arg); public R visit(MarkerAnnotationExpr n, A arg); public R visit(SingleMemberAnnotationExpr n, A arg); public R visit(NormalAnnotationExpr n, A arg); public R visit(MemberValuePair n, A arg); //- Statements ---------------------------------------- public R visit(ExplicitConstructorInvocationStmt n, A arg); public R visit(TypeDeclarationStmt n, A arg); public R visit(AssertStmt n, A arg); public R visit(BlockStmt n, A arg); public R visit(LabeledStmt n, A arg); public R visit(EmptyStmt n, A arg); public R visit(ExpressionStmt n, A arg); public R visit(SwitchStmt n, A arg); public R visit(SwitchEntryStmt n, A arg); public R visit(BreakStmt n, A arg); public R visit(ReturnStmt n, A arg); public R visit(IfStmt n, A arg); public R visit(WhileStmt n, A arg); public R visit(ContinueStmt n, A arg); public R visit(DoStmt n, A arg); public R visit(ForeachStmt n, A arg); public R visit(ForStmt n, A arg); public R visit(ThrowStmt n, A arg); public R visit(SynchronizedStmt n, A arg); public R visit(TryStmt n, A arg); public R visit(CatchClause n, A arg); } src/japa/parser/ast/visitor/GenericVisitorAdapter.java0000644000000000000000000005742211221455522022151 0ustar rootroot/* * 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 . */ /* * Created on 09/06/2008 */ package japa.parser.ast.visitor; import japa.parser.ast.BlockComment; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.LineComment; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.TypeParameter; import japa.parser.ast.body.AnnotationDeclaration; import japa.parser.ast.body.AnnotationMemberDeclaration; import japa.parser.ast.body.BodyDeclaration; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.ConstructorDeclaration; import japa.parser.ast.body.EmptyMemberDeclaration; import japa.parser.ast.body.EmptyTypeDeclaration; import japa.parser.ast.body.EnumConstantDeclaration; import japa.parser.ast.body.EnumDeclaration; import japa.parser.ast.body.FieldDeclaration; import japa.parser.ast.body.InitializerDeclaration; import japa.parser.ast.body.JavadocComment; 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.AnnotationExpr; import japa.parser.ast.expr.ArrayAccessExpr; import japa.parser.ast.expr.ArrayCreationExpr; import japa.parser.ast.expr.ArrayInitializerExpr; import japa.parser.ast.expr.AssignExpr; import japa.parser.ast.expr.BinaryExpr; import japa.parser.ast.expr.BooleanLiteralExpr; import japa.parser.ast.expr.CastExpr; import japa.parser.ast.expr.CharLiteralExpr; import japa.parser.ast.expr.ClassExpr; import japa.parser.ast.expr.ConditionalExpr; import japa.parser.ast.expr.DoubleLiteralExpr; import japa.parser.ast.expr.EnclosedExpr; import japa.parser.ast.expr.Expression; import japa.parser.ast.expr.FieldAccessExpr; import japa.parser.ast.expr.InstanceOfExpr; import japa.parser.ast.expr.IntegerLiteralExpr; import japa.parser.ast.expr.IntegerLiteralMinValueExpr; import japa.parser.ast.expr.LongLiteralExpr; import japa.parser.ast.expr.LongLiteralMinValueExpr; import japa.parser.ast.expr.MarkerAnnotationExpr; import japa.parser.ast.expr.MemberValuePair; import japa.parser.ast.expr.MethodCallExpr; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.expr.NormalAnnotationExpr; import japa.parser.ast.expr.NullLiteralExpr; import japa.parser.ast.expr.ObjectCreationExpr; import japa.parser.ast.expr.QualifiedNameExpr; import japa.parser.ast.expr.SingleMemberAnnotationExpr; import japa.parser.ast.expr.StringLiteralExpr; import japa.parser.ast.expr.SuperExpr; import japa.parser.ast.expr.ThisExpr; import japa.parser.ast.expr.UnaryExpr; import japa.parser.ast.expr.VariableDeclarationExpr; import japa.parser.ast.stmt.AssertStmt; import japa.parser.ast.stmt.BlockStmt; import japa.parser.ast.stmt.BreakStmt; import japa.parser.ast.stmt.CatchClause; import japa.parser.ast.stmt.ContinueStmt; import japa.parser.ast.stmt.DoStmt; import japa.parser.ast.stmt.EmptyStmt; import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; import japa.parser.ast.stmt.ExpressionStmt; import japa.parser.ast.stmt.ForStmt; import japa.parser.ast.stmt.ForeachStmt; import japa.parser.ast.stmt.IfStmt; import japa.parser.ast.stmt.LabeledStmt; import japa.parser.ast.stmt.ReturnStmt; import japa.parser.ast.stmt.Statement; import japa.parser.ast.stmt.SwitchEntryStmt; import japa.parser.ast.stmt.SwitchStmt; import japa.parser.ast.stmt.SynchronizedStmt; import japa.parser.ast.stmt.ThrowStmt; import japa.parser.ast.stmt.TryStmt; import japa.parser.ast.stmt.TypeDeclarationStmt; import japa.parser.ast.stmt.WhileStmt; 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.WildcardType; /** * @author Julio Vilmar Gesser */ public abstract class GenericVisitorAdapter implements GenericVisitor { public R visit(AnnotationDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getMembers() != null) { for (BodyDeclaration member : n.getMembers()) { member.accept(this, arg); } } return null; } public R visit(AnnotationMemberDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getType().accept(this, arg); if (n.getDefaultValue() != null) { n.getDefaultValue().accept(this, arg); } return null; } public R visit(ArrayAccessExpr n, A arg) { n.getName().accept(this, arg); n.getIndex().accept(this, arg); return null; } public R visit(ArrayCreationExpr n, A arg) { n.getType().accept(this, arg); if (n.getDimensions() != null) { for (Expression dim : n.getDimensions()) { dim.accept(this, arg); } } else { n.getInitializer().accept(this, arg); } return null; } public R visit(ArrayInitializerExpr n, A arg) { if (n.getValues() != null) { for (Expression expr : n.getValues()) { expr.accept(this, arg); } } return null; } public R visit(AssertStmt n, A arg) { n.getCheck().accept(this, arg); if (n.getMessage() != null) { n.getMessage().accept(this, arg); } return null; } public R visit(AssignExpr n, A arg) { n.getTarget().accept(this, arg); n.getValue().accept(this, arg); return null; } public R visit(BinaryExpr n, A arg) { n.getLeft().accept(this, arg); n.getRight().accept(this, arg); return null; } public R visit(BlockStmt n, A arg) { if (n.getStmts() != null) { for (Statement s : n.getStmts()) { s.accept(this, arg); } } return null; } public R visit(BooleanLiteralExpr n, A arg) { return null; } public R visit(BreakStmt n, A arg) { return null; } public R visit(CastExpr n, A arg) { n.getType().accept(this, arg); n.getExpr().accept(this, arg); return null; } public R visit(CatchClause n, A arg) { n.getExcept().accept(this, arg); n.getCatchBlock().accept(this, arg); return null; } public R visit(CharLiteralExpr n, A arg) { return null; } public R visit(ClassExpr n, A arg) { n.getType().accept(this, arg); return null; } public R visit(ClassOrInterfaceDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getTypeParameters() != null) { for (TypeParameter t : n.getTypeParameters()) { t.accept(this, arg); } } if (n.getExtends() != null) { for (ClassOrInterfaceType c : n.getExtends()) { c.accept(this, arg); } } if (n.getImplements() != null) { for (ClassOrInterfaceType c : n.getImplements()) { c.accept(this, arg); } } if (n.getMembers() != null) { for (BodyDeclaration member : n.getMembers()) { member.accept(this, arg); } } return null; } public R visit(ClassOrInterfaceType n, A arg) { if (n.getScope() != null) { n.getScope().accept(this, arg); } if (n.getTypeArgs() != null) { for (Type t : n.getTypeArgs()) { t.accept(this, arg); } } return null; } public R visit(CompilationUnit n, A arg) { if (n.getPackage() != null) { n.getPackage().accept(this, arg); } if (n.getImports() != null) { for (ImportDeclaration i : n.getImports()) { i.accept(this, arg); } } if (n.getTypes() != null) { for (TypeDeclaration typeDeclaration : n.getTypes()) { typeDeclaration.accept(this, arg); } } return null; } public R visit(ConditionalExpr n, A arg) { n.getCondition().accept(this, arg); n.getThenExpr().accept(this, arg); n.getElseExpr().accept(this, arg); return null; } public R visit(ConstructorDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getTypeParameters() != null) { for (TypeParameter t : n.getTypeParameters()) { t.accept(this, arg); } } if (n.getParameters() != null) { for (Parameter p : n.getParameters()) { p.accept(this, arg); } } if (n.getThrows() != null) { for (NameExpr name : n.getThrows()) { name.accept(this, arg); } } n.getBlock().accept(this, arg); return null; } public R visit(ContinueStmt n, A arg) { return null; } public R visit(DoStmt n, A arg) { n.getBody().accept(this, arg); n.getCondition().accept(this, arg); return null; } public R visit(DoubleLiteralExpr n, A arg) { return null; } public R visit(EmptyMemberDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } return null; } public R visit(EmptyStmt n, A arg) { return null; } public R visit(EmptyTypeDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } return null; } public R visit(EnclosedExpr n, A arg) { n.getInner().accept(this, arg); return null; } public R visit(EnumConstantDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getArgs() != null) { for (Expression e : n.getArgs()) { e.accept(this, arg); } } if (n.getClassBody() != null) { for (BodyDeclaration member : n.getClassBody()) { member.accept(this, arg); } } return null; } public R visit(EnumDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getImplements() != null) { for (ClassOrInterfaceType c : n.getImplements()) { c.accept(this, arg); } } if (n.getEntries() != null) { for (EnumConstantDeclaration e : n.getEntries()) { e.accept(this, arg); } } if (n.getMembers() != null) { for (BodyDeclaration member : n.getMembers()) { member.accept(this, arg); } } return null; } public R visit(ExplicitConstructorInvocationStmt n, A arg) { if (!n.isThis()) { if (n.getExpr() != null) { n.getExpr().accept(this, arg); } } if (n.getTypeArgs() != null) { for (Type t : n.getTypeArgs()) { t.accept(this, arg); } } if (n.getArgs() != null) { for (Expression e : n.getArgs()) { e.accept(this, arg); } } return null; } public R visit(ExpressionStmt n, A arg) { n.getExpression().accept(this, arg); return null; } public R visit(FieldAccessExpr n, A arg) { n.getScope().accept(this, arg); return null; } public R visit(FieldDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getType().accept(this, arg); for (VariableDeclarator var : n.getVariables()) { var.accept(this, arg); } return null; } public R visit(ForeachStmt n, A arg) { n.getVariable().accept(this, arg); n.getIterable().accept(this, arg); n.getBody().accept(this, arg); return null; } public R visit(ForStmt n, A arg) { if (n.getInit() != null) { for (Expression e : n.getInit()) { e.accept(this, arg); } } if (n.getCompare() != null) { n.getCompare().accept(this, arg); } if (n.getUpdate() != null) { for (Expression e : n.getUpdate()) { e.accept(this, arg); } } n.getBody().accept(this, arg); return null; } public R visit(IfStmt n, A arg) { n.getCondition().accept(this, arg); n.getThenStmt().accept(this, arg); if (n.getElseStmt() != null) { n.getElseStmt().accept(this, arg); } return null; } public R visit(ImportDeclaration n, A arg) { n.getName().accept(this, arg); return null; } public R visit(InitializerDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } n.getBlock().accept(this, arg); return null; } public R visit(InstanceOfExpr n, A arg) { n.getExpr().accept(this, arg); n.getType().accept(this, arg); return null; } public R visit(IntegerLiteralExpr n, A arg) { return null; } public R visit(IntegerLiteralMinValueExpr n, A arg) { return null; } public R visit(JavadocComment n, A arg) { return null; } public R visit(LabeledStmt n, A arg) { n.getStmt().accept(this, arg); return null; } public R visit(LongLiteralExpr n, A arg) { return null; } public R visit(LongLiteralMinValueExpr n, A arg) { return null; } public R visit(MarkerAnnotationExpr n, A arg) { n.getName().accept(this, arg); return null; } public R visit(MemberValuePair n, A arg) { n.getValue().accept(this, arg); return null; } public R visit(MethodCallExpr n, A arg) { if (n.getScope() != null) { n.getScope().accept(this, arg); } if (n.getTypeArgs() != null) { for (Type t : n.getTypeArgs()) { t.accept(this, arg); } } if (n.getArgs() != null) { for (Expression e : n.getArgs()) { e.accept(this, arg); } } return null; } public R visit(MethodDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getTypeParameters() != null) { for (TypeParameter t : n.getTypeParameters()) { t.accept(this, arg); } } n.getType().accept(this, arg); if (n.getParameters() != null) { for (Parameter p : n.getParameters()) { p.accept(this, arg); } } if (n.getThrows() != null) { for (NameExpr name : n.getThrows()) { name.accept(this, arg); } } if (n.getBody() != null) { n.getBody().accept(this, arg); } return null; } public R visit(NameExpr n, A arg) { return null; } public R visit(NormalAnnotationExpr n, A arg) { n.getName().accept(this, arg); if (n.getPairs() != null) { for (MemberValuePair m : n.getPairs()) { m.accept(this, arg); } } return null; } public R visit(NullLiteralExpr n, A arg) { return null; } public R visit(ObjectCreationExpr n, A arg) { if (n.getScope() != null) { n.getScope().accept(this, arg); } if (n.getTypeArgs() != null) { for (Type t : n.getTypeArgs()) { t.accept(this, arg); } } n.getType().accept(this, arg); if (n.getArgs() != null) { for (Expression e : n.getArgs()) { e.accept(this, arg); } } if (n.getAnonymousClassBody() != null) { for (BodyDeclaration member : n.getAnonymousClassBody()) { member.accept(this, arg); } } return null; } public R visit(PackageDeclaration n, A arg) { if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getName().accept(this, arg); return null; } public R visit(Parameter n, A arg) { if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getType().accept(this, arg); n.getId().accept(this, arg); return null; } public R visit(PrimitiveType n, A arg) { return null; } public R visit(QualifiedNameExpr n, A arg) { n.getQualifier().accept(this, arg); return null; } public R visit(ReferenceType n, A arg) { n.getType().accept(this, arg); return null; } public R visit(ReturnStmt n, A arg) { if (n.getExpr() != null) { n.getExpr().accept(this, arg); } return null; } public R visit(SingleMemberAnnotationExpr n, A arg) { n.getName().accept(this, arg); n.getMemberValue().accept(this, arg); return null; } public R visit(StringLiteralExpr n, A arg) { return null; } public R visit(SuperExpr n, A arg) { if (n.getClassExpr() != null) { n.getClassExpr().accept(this, arg); } return null; } public R visit(SwitchEntryStmt n, A arg) { if (n.getLabel() != null) { n.getLabel().accept(this, arg); } if (n.getStmts() != null) { for (Statement s : n.getStmts()) { s.accept(this, arg); } } return null; } public R visit(SwitchStmt n, A arg) { n.getSelector().accept(this, arg); if (n.getEntries() != null) { for (SwitchEntryStmt e : n.getEntries()) { e.accept(this, arg); } } return null; } public R visit(SynchronizedStmt n, A arg) { n.getExpr().accept(this, arg); n.getBlock().accept(this, arg); return null; } public R visit(ThisExpr n, A arg) { if (n.getClassExpr() != null) { n.getClassExpr().accept(this, arg); } return null; } public R visit(ThrowStmt n, A arg) { n.getExpr().accept(this, arg); return null; } public R visit(TryStmt n, A arg) { n.getTryBlock().accept(this, arg); if (n.getCatchs() != null) { for (CatchClause c : n.getCatchs()) { c.accept(this, arg); } } if (n.getFinallyBlock() != null) { n.getFinallyBlock().accept(this, arg); } return null; } public R visit(TypeDeclarationStmt n, A arg) { n.getTypeDeclaration().accept(this, arg); return null; } public R visit(TypeParameter n, A arg) { if (n.getTypeBound() != null) { for (ClassOrInterfaceType c : n.getTypeBound()) { c.accept(this, arg); } } return null; } public R visit(UnaryExpr n, A arg) { n.getExpr().accept(this, arg); return null; } public R visit(VariableDeclarationExpr n, A arg) { if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getType().accept(this, arg); for (VariableDeclarator v : n.getVars()) { v.accept(this, arg); } return null; } public R visit(VariableDeclarator n, A arg) { n.getId().accept(this, arg); if (n.getInit() != null) { n.getInit().accept(this, arg); } return null; } public R visit(VariableDeclaratorId n, A arg) { return null; } public R visit(VoidType n, A arg) { return null; } public R visit(WhileStmt n, A arg) { n.getCondition().accept(this, arg); n.getBody().accept(this, arg); return null; } public R visit(WildcardType n, A arg) { if (n.getExtends() != null) { n.getExtends().accept(this, arg); } if (n.getSuper() != null) { n.getSuper().accept(this, arg); } return null; } public R visit(BlockComment n, A arg) { return null; } public R visit(LineComment n, A arg) { return null; } } src/japa/parser/ast/visitor/ModifierVisitorAdapter.java0000644000000000000000000010222311132473140022316 0ustar rootroot/* * 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 . */ /* * Created on 09/06/2008 */ package japa.parser.ast.visitor; import japa.parser.ast.BlockComment; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.LineComment; import japa.parser.ast.Node; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.TypeParameter; import japa.parser.ast.body.AnnotationDeclaration; import japa.parser.ast.body.AnnotationMemberDeclaration; import japa.parser.ast.body.BodyDeclaration; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.ConstructorDeclaration; import japa.parser.ast.body.EmptyMemberDeclaration; import japa.parser.ast.body.EmptyTypeDeclaration; import japa.parser.ast.body.EnumConstantDeclaration; import japa.parser.ast.body.EnumDeclaration; import japa.parser.ast.body.FieldDeclaration; import japa.parser.ast.body.InitializerDeclaration; import japa.parser.ast.body.JavadocComment; 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.AnnotationExpr; import japa.parser.ast.expr.ArrayAccessExpr; import japa.parser.ast.expr.ArrayCreationExpr; import japa.parser.ast.expr.ArrayInitializerExpr; import japa.parser.ast.expr.AssignExpr; import japa.parser.ast.expr.BinaryExpr; import japa.parser.ast.expr.BooleanLiteralExpr; import japa.parser.ast.expr.CastExpr; import japa.parser.ast.expr.CharLiteralExpr; import japa.parser.ast.expr.ClassExpr; import japa.parser.ast.expr.ConditionalExpr; import japa.parser.ast.expr.DoubleLiteralExpr; import japa.parser.ast.expr.EnclosedExpr; import japa.parser.ast.expr.Expression; import japa.parser.ast.expr.FieldAccessExpr; import japa.parser.ast.expr.InstanceOfExpr; import japa.parser.ast.expr.IntegerLiteralExpr; import japa.parser.ast.expr.IntegerLiteralMinValueExpr; import japa.parser.ast.expr.LongLiteralExpr; import japa.parser.ast.expr.LongLiteralMinValueExpr; import japa.parser.ast.expr.MarkerAnnotationExpr; import japa.parser.ast.expr.MemberValuePair; import japa.parser.ast.expr.MethodCallExpr; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.expr.NormalAnnotationExpr; import japa.parser.ast.expr.NullLiteralExpr; import japa.parser.ast.expr.ObjectCreationExpr; import japa.parser.ast.expr.QualifiedNameExpr; import japa.parser.ast.expr.SingleMemberAnnotationExpr; import japa.parser.ast.expr.StringLiteralExpr; import japa.parser.ast.expr.SuperExpr; import japa.parser.ast.expr.ThisExpr; import japa.parser.ast.expr.UnaryExpr; import japa.parser.ast.expr.VariableDeclarationExpr; import japa.parser.ast.stmt.AssertStmt; import japa.parser.ast.stmt.BlockStmt; import japa.parser.ast.stmt.BreakStmt; import japa.parser.ast.stmt.CatchClause; import japa.parser.ast.stmt.ContinueStmt; import japa.parser.ast.stmt.DoStmt; import japa.parser.ast.stmt.EmptyStmt; import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; import japa.parser.ast.stmt.ExpressionStmt; import japa.parser.ast.stmt.ForStmt; import japa.parser.ast.stmt.ForeachStmt; import japa.parser.ast.stmt.IfStmt; import japa.parser.ast.stmt.LabeledStmt; import japa.parser.ast.stmt.ReturnStmt; import japa.parser.ast.stmt.Statement; import japa.parser.ast.stmt.SwitchEntryStmt; import japa.parser.ast.stmt.SwitchStmt; import japa.parser.ast.stmt.SynchronizedStmt; import japa.parser.ast.stmt.ThrowStmt; import japa.parser.ast.stmt.TryStmt; import japa.parser.ast.stmt.TypeDeclarationStmt; import japa.parser.ast.stmt.WhileStmt; 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.WildcardType; import java.util.List; /** * This visitor adapter can be used to save time when some specific nodes needs * to be changed. To do that just extend this class and override the methods * from the nodes who needs to be changed, returning the changed node. * * @author Julio Vilmar Gesser */ public abstract class ModifierVisitorAdapter implements GenericVisitor { private void removeNulls(List< ? > list) { for (int i = list.size() - 1; i >= 0; i--) { if (list.get(i) == null) { list.remove(i); } } } public Node visit(AnnotationDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } List members = n.getMembers(); if (members != null) { for (int i = 0; i < members.size(); i++) { members.set(i, (BodyDeclaration) members.get(i).accept(this, arg)); } removeNulls(members); } return n; } public Node visit(AnnotationMemberDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } n.setType((Type) n.getType().accept(this, arg)); if (n.getDefaultValue() != null) { n.setDefaultValue((Expression) n.getDefaultValue().accept(this, arg)); } return n; } public Node visit(ArrayAccessExpr n, A arg) { n.setName((Expression) n.getName().accept(this, arg)); n.setIndex((Expression) n.getIndex().accept(this, arg)); return n; } public Node visit(ArrayCreationExpr n, A arg) { n.setType((Type) n.getType().accept(this, arg)); if (n.getDimensions() != null) { List dimensions = n.getDimensions(); if (dimensions != null) { for (int i = 0; i < dimensions.size(); i++) { dimensions.set(i, (Expression) dimensions.get(i).accept(this, arg)); } removeNulls(dimensions); } } else { n.setInitializer((ArrayInitializerExpr) n.getInitializer().accept(this, arg)); } return n; } public Node visit(ArrayInitializerExpr n, A arg) { if (n.getValues() != null) { List values = n.getValues(); if (values != null) { for (int i = 0; i < values.size(); i++) { values.set(i, (Expression) values.get(i).accept(this, arg)); } removeNulls(values); } } return n; } public Node visit(AssertStmt n, A arg) { n.setCheck((Expression) n.getCheck().accept(this, arg)); if (n.getMessage() != null) { n.setMessage((Expression) n.getMessage().accept(this, arg)); } return n; } public Node visit(AssignExpr n, A arg) { n.setTarget((Expression) n.getTarget().accept(this, arg)); n.setValue((Expression) n.getValue().accept(this, arg)); return n; } public Node visit(BinaryExpr n, A arg) { n.setLeft((Expression) n.getLeft().accept(this, arg)); n.setRight((Expression) n.getRight().accept(this, arg)); return n; } public Node visit(BlockStmt n, A arg) { List stmts = n.getStmts(); if (stmts != null) { for (int i = 0; i < stmts.size(); i++) { stmts.set(i, (Statement) stmts.get(i).accept(this, arg)); } removeNulls(stmts); } return n; } public Node visit(BooleanLiteralExpr n, A arg) { return n; } public Node visit(BreakStmt n, A arg) { return n; } public Node visit(CastExpr n, A arg) { n.setType((Type) n.getType().accept(this, arg)); n.setExpr((Expression) n.getExpr().accept(this, arg)); return n; } public Node visit(CatchClause n, A arg) { n.setExcept((Parameter) n.getExcept().accept(this, arg)); n.setCatchBlock((BlockStmt) n.getCatchBlock().accept(this, arg)); return n; } public Node visit(CharLiteralExpr n, A arg) { return n; } public Node visit(ClassExpr n, A arg) { n.setType((Type) n.getType().accept(this, arg)); return n; } public Node visit(ClassOrInterfaceDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } List typeParameters = n.getTypeParameters(); if (typeParameters != null) { for (int i = 0; i < typeParameters.size(); i++) { typeParameters.set(i, (TypeParameter) typeParameters.get(i).accept(this, arg)); } removeNulls(typeParameters); } List extendz = n.getExtends(); if (extendz != null) { for (int i = 0; i < extendz.size(); i++) { extendz.set(i, (ClassOrInterfaceType) extendz.get(i).accept(this, arg)); } removeNulls(extendz); } List implementz = n.getImplements(); if (implementz != null) { for (int i = 0; i < implementz.size(); i++) { implementz.set(i, (ClassOrInterfaceType) implementz.get(i).accept(this, arg)); } removeNulls(implementz); } List members = n.getMembers(); if (members != null) { for (int i = 0; i < members.size(); i++) { members.set(i, (BodyDeclaration) members.get(i).accept(this, arg)); } removeNulls(members); } return n; } public Node visit(ClassOrInterfaceType n, A arg) { if (n.getScope() != null) { n.setScope((ClassOrInterfaceType) n.getScope().accept(this, arg)); } List typeArgs = n.getTypeArgs(); if (typeArgs != null) { for (int i = 0; i < typeArgs.size(); i++) { typeArgs.set(i, (Type) typeArgs.get(i).accept(this, arg)); } removeNulls(typeArgs); } return n; } public Node visit(CompilationUnit n, A arg) { if (n.getPackage() != null) { n.setPackage((PackageDeclaration) n.getPackage().accept(this, arg)); } List imports = n.getImports(); if (imports != null) { for (int i = 0; i < imports.size(); i++) { imports.set(i, (ImportDeclaration) imports.get(i).accept(this, arg)); } removeNulls(imports); } List types = n.getTypes(); if (types != null) { for (int i = 0; i < types.size(); i++) { types.set(i, (TypeDeclaration) types.get(i).accept(this, arg)); } removeNulls(types); } return n; } public Node visit(ConditionalExpr n, A arg) { n.setCondition((Expression) n.getCondition().accept(this, arg)); n.setThenExpr((Expression) n.getThenExpr().accept(this, arg)); n.setElseExpr((Expression) n.getElseExpr().accept(this, arg)); return n; } public Node visit(ConstructorDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } List typeParameters = n.getTypeParameters(); if (typeParameters != null) { for (int i = 0; i < typeParameters.size(); i++) { typeParameters.set(i, (TypeParameter) typeParameters.get(i).accept(this, arg)); } removeNulls(typeParameters); } List parameters = n.getParameters(); if (parameters != null) { for (int i = 0; i < parameters.size(); i++) { parameters.set(i, (Parameter) parameters.get(i).accept(this, arg)); } removeNulls(parameters); } List throwz = n.getThrows(); if (throwz != null) { for (int i = 0; i < throwz.size(); i++) { throwz.set(i, (NameExpr) throwz.get(i).accept(this, arg)); } removeNulls(throwz); } n.setBlock((BlockStmt) n.getBlock().accept(this, arg)); return n; } public Node visit(ContinueStmt n, A arg) { return n; } public Node visit(DoStmt n, A arg) { n.setBody((Statement) n.getBody().accept(this, arg)); n.setCondition((Expression) n.getCondition().accept(this, arg)); return n; } public Node visit(DoubleLiteralExpr n, A arg) { return n; } public Node visit(EmptyMemberDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } return n; } public Node visit(EmptyStmt n, A arg) { return n; } public Node visit(EmptyTypeDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } return n; } public Node visit(EnclosedExpr n, A arg) { n.setInner((Expression) n.getInner().accept(this, arg)); return n; } public Node visit(EnumConstantDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } List args = n.getArgs(); if (args != null) { for (int i = 0; i < args.size(); i++) { args.set(i, (Expression) args.get(i).accept(this, arg)); } removeNulls(args); } List classBody = n.getClassBody(); if (classBody != null) { for (int i = 0; i < classBody.size(); i++) { classBody.set(i, (BodyDeclaration) classBody.get(i).accept(this, arg)); } removeNulls(classBody); } return n; } public Node visit(EnumDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } List implementz = n.getImplements(); if (implementz != null) { for (int i = 0; i < implementz.size(); i++) { implementz.set(i, (ClassOrInterfaceType) implementz.get(i).accept(this, arg)); } removeNulls(implementz); } List entries = n.getEntries(); if (entries != null) { for (int i = 0; i < entries.size(); i++) { entries.set(i, (EnumConstantDeclaration) entries.get(i).accept(this, arg)); } removeNulls(entries); } List members = n.getMembers(); if (members != null) { for (int i = 0; i < members.size(); i++) { members.set(i, (BodyDeclaration) members.get(i).accept(this, arg)); } removeNulls(members); } return n; } public Node visit(ExplicitConstructorInvocationStmt n, A arg) { if (!n.isThis()) { if (n.getExpr() != null) { n.setExpr((Expression) n.getExpr().accept(this, arg)); } } List typeArgs = n.getTypeArgs(); if (typeArgs != null) { for (int i = 0; i < typeArgs.size(); i++) { typeArgs.set(i, (Type) typeArgs.get(i).accept(this, arg)); } removeNulls(typeArgs); } List args = n.getArgs(); if (args != null) { for (int i = 0; i < args.size(); i++) { args.set(i, (Expression) args.get(i).accept(this, arg)); } removeNulls(args); } return n; } public Node visit(ExpressionStmt n, A arg) { n.setExpression((Expression) n.getExpression().accept(this, arg)); return n; } public Node visit(FieldAccessExpr n, A arg) { n.setScope((Expression) n.getScope().accept(this, arg)); return n; } public Node visit(FieldDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } n.setType((Type) n.getType().accept(this, arg)); List variables = n.getVariables(); for (int i = 0; i < variables.size(); i++) { variables.set(i, (VariableDeclarator) variables.get(i).accept(this, arg)); } removeNulls(variables); return n; } public Node visit(ForeachStmt n, A arg) { n.setVariable((VariableDeclarationExpr) n.getVariable().accept(this, arg)); n.setIterable((Expression) n.getIterable().accept(this, arg)); n.setBody((Statement) n.getBody().accept(this, arg)); return n; } public Node visit(ForStmt n, A arg) { List init = n.getInit(); if (init != null) { for (int i = 0; i < init.size(); i++) { init.set(i, (Expression) init.get(i).accept(this, arg)); } removeNulls(init); } if (n.getCompare() != null) { n.setCompare((Expression) n.getCompare().accept(this, arg)); } List update = n.getUpdate(); if (update != null) { for (int i = 0; i < update.size(); i++) { update.set(i, (Expression) update.get(i).accept(this, arg)); } removeNulls(update); } n.setBody((Statement) n.getBody().accept(this, arg)); return n; } public Node visit(IfStmt n, A arg) { n.setCondition((Expression) n.getCondition().accept(this, arg)); n.setThenStmt((Statement) n.getThenStmt().accept(this, arg)); if (n.getElseStmt() != null) { n.setElseStmt((Statement) n.getElseStmt().accept(this, arg)); } return n; } public Node visit(ImportDeclaration n, A arg) { n.setName((NameExpr) n.getName().accept(this, arg)); return n; } public Node visit(InitializerDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } n.setBlock((BlockStmt) n.getBlock().accept(this, arg)); return n; } public Node visit(InstanceOfExpr n, A arg) { n.setExpr((Expression) n.getExpr().accept(this, arg)); n.setType((Type) n.getType().accept(this, arg)); return n; } public Node visit(IntegerLiteralExpr n, A arg) { return n; } public Node visit(IntegerLiteralMinValueExpr n, A arg) { return n; } public Node visit(JavadocComment n, A arg) { return n; } public Node visit(LabeledStmt n, A arg) { n.setStmt((Statement) n.getStmt().accept(this, arg)); return n; } public Node visit(LongLiteralExpr n, A arg) { return n; } public Node visit(LongLiteralMinValueExpr n, A arg) { return n; } public Node visit(MarkerAnnotationExpr n, A arg) { n.setName((NameExpr) n.getName().accept(this, arg)); return n; } public Node visit(MemberValuePair n, A arg) { n.setValue((Expression) n.getValue().accept(this, arg)); return n; } public Node visit(MethodCallExpr n, A arg) { if (n.getScope() != null) { n.setScope((Expression) n.getScope().accept(this, arg)); } List typeArgs = n.getTypeArgs(); if (typeArgs != null) { for (int i = 0; i < typeArgs.size(); i++) { typeArgs.set(i, (Type) typeArgs.get(i).accept(this, arg)); } removeNulls(typeArgs); } List args = n.getArgs(); if (args != null) { for (int i = 0; i < args.size(); i++) { args.set(i, (Expression) args.get(i).accept(this, arg)); } removeNulls(args); } return n; } public Node visit(MethodDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } List typeParameters = n.getTypeParameters(); if (typeParameters != null) { for (int i = 0; i < typeParameters.size(); i++) { typeParameters.set(i, (TypeParameter) typeParameters.get(i).accept(this, arg)); } removeNulls(typeParameters); } n.setType((Type) n.getType().accept(this, arg)); List parameters = n.getParameters(); if (parameters != null) { for (int i = 0; i < parameters.size(); i++) { parameters.set(i, (Parameter) parameters.get(i).accept(this, arg)); } removeNulls(parameters); } List throwz = n.getThrows(); if (throwz != null) { for (int i = 0; i < throwz.size(); i++) { throwz.set(i, (NameExpr) throwz.get(i).accept(this, arg)); } removeNulls(throwz); } if (n.getBody() != null) { n.setBody((BlockStmt) n.getBody().accept(this, arg)); } return n; } public Node visit(NameExpr n, A arg) { return n; } public Node visit(NormalAnnotationExpr n, A arg) { n.setName((NameExpr) n.getName().accept(this, arg)); List pairs = n.getPairs(); if (pairs != null) { for (int i = 0; i < pairs.size(); i++) { pairs.set(i, (MemberValuePair) pairs.get(i).accept(this, arg)); } removeNulls(pairs); } return n; } public Node visit(NullLiteralExpr n, A arg) { return n; } public Node visit(ObjectCreationExpr n, A arg) { if (n.getScope() != null) { n.setScope((Expression) n.getScope().accept(this, arg)); } List typeArgs = n.getTypeArgs(); if (typeArgs != null) { for (int i = 0; i < typeArgs.size(); i++) { typeArgs.set(i, (Type) typeArgs.get(i).accept(this, arg)); } removeNulls(typeArgs); } n.setType((ClassOrInterfaceType) n.getType().accept(this, arg)); List args = n.getArgs(); if (args != null) { for (int i = 0; i < args.size(); i++) { args.set(i, (Expression) args.get(i).accept(this, arg)); } removeNulls(args); } List anonymousClassBody = n.getAnonymousClassBody(); if (anonymousClassBody != null) { for (int i = 0; i < anonymousClassBody.size(); i++) { anonymousClassBody.set(i, (BodyDeclaration) anonymousClassBody.get(i).accept(this, arg)); } removeNulls(anonymousClassBody); } return n; } public Node visit(PackageDeclaration n, A arg) { List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } n.setName((NameExpr) n.getName().accept(this, arg)); return n; } public Node visit(Parameter n, A arg) { List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } n.setType((Type) n.getType().accept(this, arg)); n.setId((VariableDeclaratorId) n.getId().accept(this, arg)); return n; } public Node visit(PrimitiveType n, A arg) { return n; } public Node visit(QualifiedNameExpr n, A arg) { n.setQualifier((NameExpr) n.getQualifier().accept(this, arg)); return n; } public Node visit(ReferenceType n, A arg) { n.setType((Type) n.getType().accept(this, arg)); return n; } public Node visit(ReturnStmt n, A arg) { if (n.getExpr() != null) { n.setExpr((Expression) n.getExpr().accept(this, arg)); } return n; } public Node visit(SingleMemberAnnotationExpr n, A arg) { n.setName((NameExpr) n.getName().accept(this, arg)); n.setMemberValue((Expression) n.getMemberValue().accept(this, arg)); return n; } public Node visit(StringLiteralExpr n, A arg) { return n; } public Node visit(SuperExpr n, A arg) { if (n.getClassExpr() != null) { n.setClassExpr((Expression) n.getClassExpr().accept(this, arg)); } return n; } public Node visit(SwitchEntryStmt n, A arg) { if (n.getLabel() != null) { n.setLabel((Expression) n.getLabel().accept(this, arg)); } List stmts = n.getStmts(); if (stmts != null) { for (int i = 0; i < stmts.size(); i++) { stmts.set(i, (Statement) stmts.get(i).accept(this, arg)); } removeNulls(stmts); } return n; } public Node visit(SwitchStmt n, A arg) { n.setSelector((Expression) n.getSelector().accept(this, arg)); List entries = n.getEntries(); if (entries != null) { for (int i = 0; i < entries.size(); i++) { entries.set(i, (SwitchEntryStmt) entries.get(i).accept(this, arg)); } removeNulls(entries); } return n; } public Node visit(SynchronizedStmt n, A arg) { n.setExpr((Expression) n.getExpr().accept(this, arg)); n.setBlock((BlockStmt) n.getBlock().accept(this, arg)); return n; } public Node visit(ThisExpr n, A arg) { if (n.getClassExpr() != null) { n.setClassExpr((Expression) n.getClassExpr().accept(this, arg)); } return n; } public Node visit(ThrowStmt n, A arg) { n.setExpr((Expression) n.getExpr().accept(this, arg)); return n; } public Node visit(TryStmt n, A arg) { n.setTryBlock((BlockStmt) n.getTryBlock().accept(this, arg)); List catchs = n.getCatchs(); if (catchs != null) { for (int i = 0; i < catchs.size(); i++) { catchs.set(i, (CatchClause) catchs.get(i).accept(this, arg)); } removeNulls(catchs); } if (n.getFinallyBlock() != null) { n.setFinallyBlock((BlockStmt) n.getFinallyBlock().accept(this, arg)); } return n; } public Node visit(TypeDeclarationStmt n, A arg) { n.setTypeDeclaration((TypeDeclaration) n.getTypeDeclaration().accept(this, arg)); return n; } public Node visit(TypeParameter n, A arg) { List typeBound = n.getTypeBound(); if (typeBound != null) { for (int i = 0; i < typeBound.size(); i++) { typeBound.set(i, (ClassOrInterfaceType) typeBound.get(i).accept(this, arg)); } removeNulls(typeBound); } return n; } public Node visit(UnaryExpr n, A arg) { n.setExpr((Expression) n.getExpr().accept(this, arg)); return n; } public Node visit(VariableDeclarationExpr n, A arg) { List annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } n.setType((Type) n.getType().accept(this, arg)); List vars = n.getVars(); for (int i = 0; i < vars.size(); i++) { vars.set(i, (VariableDeclarator) vars.get(i).accept(this, arg)); } removeNulls(vars); return n; } public Node visit(VariableDeclarator n, A arg) { n.setId((VariableDeclaratorId) n.getId().accept(this, arg)); if (n.getInit() != null) { n.setInit((Expression) n.getInit().accept(this, arg)); } return n; } public Node visit(VariableDeclaratorId n, A arg) { return n; } public Node visit(VoidType n, A arg) { return n; } public Node visit(WhileStmt n, A arg) { n.setCondition((Expression) n.getCondition().accept(this, arg)); n.setBody((Statement) n.getBody().accept(this, arg)); return n; } public Node visit(WildcardType n, A arg) { if (n.getExtends() != null) { n.setExtends((ReferenceType) n.getExtends().accept(this, arg)); } if (n.getSuper() != null) { n.setSuper((ReferenceType) n.getSuper().accept(this, arg)); } return n; } public Node visit(BlockComment n, A arg) { return n; } public Node visit(LineComment n, A arg) { return n; } } src/japa/parser/ast/visitor/VoidVisitor.java0000644000000000000000000002156011132421226020162 0ustar rootroot/* * 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 . */ /* * Created on 05/10/2006 */ package japa.parser.ast.visitor; import japa.parser.ast.BlockComment; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.LineComment; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.TypeParameter; import japa.parser.ast.body.AnnotationDeclaration; import japa.parser.ast.body.AnnotationMemberDeclaration; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.ConstructorDeclaration; import japa.parser.ast.body.EmptyMemberDeclaration; import japa.parser.ast.body.EmptyTypeDeclaration; import japa.parser.ast.body.EnumConstantDeclaration; import japa.parser.ast.body.EnumDeclaration; import japa.parser.ast.body.FieldDeclaration; import japa.parser.ast.body.InitializerDeclaration; import japa.parser.ast.body.JavadocComment; import japa.parser.ast.body.MethodDeclaration; import japa.parser.ast.body.Parameter; import japa.parser.ast.body.VariableDeclarator; import japa.parser.ast.body.VariableDeclaratorId; import japa.parser.ast.expr.ArrayAccessExpr; import japa.parser.ast.expr.ArrayCreationExpr; import japa.parser.ast.expr.ArrayInitializerExpr; import japa.parser.ast.expr.AssignExpr; import japa.parser.ast.expr.BinaryExpr; import japa.parser.ast.expr.BooleanLiteralExpr; import japa.parser.ast.expr.CastExpr; import japa.parser.ast.expr.CharLiteralExpr; import japa.parser.ast.expr.ClassExpr; import japa.parser.ast.expr.ConditionalExpr; import japa.parser.ast.expr.DoubleLiteralExpr; import japa.parser.ast.expr.EnclosedExpr; import japa.parser.ast.expr.FieldAccessExpr; import japa.parser.ast.expr.InstanceOfExpr; import japa.parser.ast.expr.IntegerLiteralExpr; import japa.parser.ast.expr.IntegerLiteralMinValueExpr; import japa.parser.ast.expr.LongLiteralExpr; import japa.parser.ast.expr.LongLiteralMinValueExpr; import japa.parser.ast.expr.MarkerAnnotationExpr; import japa.parser.ast.expr.MemberValuePair; import japa.parser.ast.expr.MethodCallExpr; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.expr.NormalAnnotationExpr; import japa.parser.ast.expr.NullLiteralExpr; import japa.parser.ast.expr.ObjectCreationExpr; import japa.parser.ast.expr.QualifiedNameExpr; import japa.parser.ast.expr.SingleMemberAnnotationExpr; import japa.parser.ast.expr.StringLiteralExpr; import japa.parser.ast.expr.SuperExpr; import japa.parser.ast.expr.ThisExpr; import japa.parser.ast.expr.UnaryExpr; import japa.parser.ast.expr.VariableDeclarationExpr; import japa.parser.ast.stmt.AssertStmt; import japa.parser.ast.stmt.BlockStmt; import japa.parser.ast.stmt.BreakStmt; import japa.parser.ast.stmt.CatchClause; import japa.parser.ast.stmt.ContinueStmt; import japa.parser.ast.stmt.DoStmt; import japa.parser.ast.stmt.EmptyStmt; import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; import japa.parser.ast.stmt.ExpressionStmt; import japa.parser.ast.stmt.ForStmt; import japa.parser.ast.stmt.ForeachStmt; import japa.parser.ast.stmt.IfStmt; import japa.parser.ast.stmt.LabeledStmt; import japa.parser.ast.stmt.ReturnStmt; import japa.parser.ast.stmt.SwitchEntryStmt; import japa.parser.ast.stmt.SwitchStmt; import japa.parser.ast.stmt.SynchronizedStmt; import japa.parser.ast.stmt.ThrowStmt; import japa.parser.ast.stmt.TryStmt; import japa.parser.ast.stmt.TypeDeclarationStmt; import japa.parser.ast.stmt.WhileStmt; import japa.parser.ast.type.ClassOrInterfaceType; import japa.parser.ast.type.PrimitiveType; import japa.parser.ast.type.ReferenceType; import japa.parser.ast.type.VoidType; import japa.parser.ast.type.WildcardType; /** * @author Julio Vilmar Gesser */ public interface VoidVisitor { //- Compilation Unit ---------------------------------- public void visit(CompilationUnit n, A arg); public void visit(PackageDeclaration n, A arg); public void visit(ImportDeclaration n, A arg); public void visit(TypeParameter n, A arg); public void visit(LineComment n, A arg); public void visit(BlockComment n, A arg); //- Body ---------------------------------------------- public void visit(ClassOrInterfaceDeclaration n, A arg); public void visit(EnumDeclaration n, A arg); public void visit(EmptyTypeDeclaration n, A arg); public void visit(EnumConstantDeclaration n, A arg); public void visit(AnnotationDeclaration n, A arg); public void visit(AnnotationMemberDeclaration n, A arg); public void visit(FieldDeclaration n, A arg); public void visit(VariableDeclarator n, A arg); public void visit(VariableDeclaratorId n, A arg); public void visit(ConstructorDeclaration n, A arg); public void visit(MethodDeclaration n, A arg); public void visit(Parameter n, A arg); public void visit(EmptyMemberDeclaration n, A arg); public void visit(InitializerDeclaration n, A arg); public void visit(JavadocComment n, A arg); //- Type ---------------------------------------------- public void visit(ClassOrInterfaceType n, A arg); public void visit(PrimitiveType n, A arg); public void visit(ReferenceType n, A arg); public void visit(VoidType n, A arg); public void visit(WildcardType n, A arg); //- Expression ---------------------------------------- public void visit(ArrayAccessExpr n, A arg); public void visit(ArrayCreationExpr n, A arg); public void visit(ArrayInitializerExpr n, A arg); public void visit(AssignExpr n, A arg); public void visit(BinaryExpr n, A arg); public void visit(CastExpr n, A arg); public void visit(ClassExpr n, A arg); public void visit(ConditionalExpr n, A arg); public void visit(EnclosedExpr n, A arg); public void visit(FieldAccessExpr n, A arg); public void visit(InstanceOfExpr n, A arg); public void visit(StringLiteralExpr n, A arg); public void visit(IntegerLiteralExpr n, A arg); public void visit(LongLiteralExpr n, A arg); public void visit(IntegerLiteralMinValueExpr n, A arg); public void visit(LongLiteralMinValueExpr n, A arg); public void visit(CharLiteralExpr n, A arg); public void visit(DoubleLiteralExpr n, A arg); public void visit(BooleanLiteralExpr n, A arg); public void visit(NullLiteralExpr n, A arg); public void visit(MethodCallExpr n, A arg); public void visit(NameExpr n, A arg); public void visit(ObjectCreationExpr n, A arg); public void visit(QualifiedNameExpr n, A arg); public void visit(ThisExpr n, A arg); public void visit(SuperExpr n, A arg); public void visit(UnaryExpr n, A arg); public void visit(VariableDeclarationExpr n, A arg); public void visit(MarkerAnnotationExpr n, A arg); public void visit(SingleMemberAnnotationExpr n, A arg); public void visit(NormalAnnotationExpr n, A arg); public void visit(MemberValuePair n, A arg); //- Statements ---------------------------------------- public void visit(ExplicitConstructorInvocationStmt n, A arg); public void visit(TypeDeclarationStmt n, A arg); public void visit(AssertStmt n, A arg); public void visit(BlockStmt n, A arg); public void visit(LabeledStmt n, A arg); public void visit(EmptyStmt n, A arg); public void visit(ExpressionStmt n, A arg); public void visit(SwitchStmt n, A arg); public void visit(SwitchEntryStmt n, A arg); public void visit(BreakStmt n, A arg); public void visit(ReturnStmt n, A arg); public void visit(IfStmt n, A arg); public void visit(WhileStmt n, A arg); public void visit(ContinueStmt n, A arg); public void visit(DoStmt n, A arg); public void visit(ForeachStmt n, A arg); public void visit(ForStmt n, A arg); public void visit(ThrowStmt n, A arg); public void visit(SynchronizedStmt n, A arg); public void visit(TryStmt n, A arg); public void visit(CatchClause n, A arg); } src/japa/parser/ast/visitor/VoidVisitorAdapter.java0000644000000000000000000005444311132472724021502 0ustar rootroot/* * 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 . */ /* * Created on 09/06/2008 */ package japa.parser.ast.visitor; import japa.parser.ast.BlockComment; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.LineComment; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.TypeParameter; import japa.parser.ast.body.AnnotationDeclaration; import japa.parser.ast.body.AnnotationMemberDeclaration; import japa.parser.ast.body.BodyDeclaration; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.ConstructorDeclaration; import japa.parser.ast.body.EmptyMemberDeclaration; import japa.parser.ast.body.EmptyTypeDeclaration; import japa.parser.ast.body.EnumConstantDeclaration; import japa.parser.ast.body.EnumDeclaration; import japa.parser.ast.body.FieldDeclaration; import japa.parser.ast.body.InitializerDeclaration; import japa.parser.ast.body.JavadocComment; 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.AnnotationExpr; import japa.parser.ast.expr.ArrayAccessExpr; import japa.parser.ast.expr.ArrayCreationExpr; import japa.parser.ast.expr.ArrayInitializerExpr; import japa.parser.ast.expr.AssignExpr; import japa.parser.ast.expr.BinaryExpr; import japa.parser.ast.expr.BooleanLiteralExpr; import japa.parser.ast.expr.CastExpr; import japa.parser.ast.expr.CharLiteralExpr; import japa.parser.ast.expr.ClassExpr; import japa.parser.ast.expr.ConditionalExpr; import japa.parser.ast.expr.DoubleLiteralExpr; import japa.parser.ast.expr.EnclosedExpr; import japa.parser.ast.expr.Expression; import japa.parser.ast.expr.FieldAccessExpr; import japa.parser.ast.expr.InstanceOfExpr; import japa.parser.ast.expr.IntegerLiteralExpr; import japa.parser.ast.expr.IntegerLiteralMinValueExpr; import japa.parser.ast.expr.LongLiteralExpr; import japa.parser.ast.expr.LongLiteralMinValueExpr; import japa.parser.ast.expr.MarkerAnnotationExpr; import japa.parser.ast.expr.MemberValuePair; import japa.parser.ast.expr.MethodCallExpr; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.expr.NormalAnnotationExpr; import japa.parser.ast.expr.NullLiteralExpr; import japa.parser.ast.expr.ObjectCreationExpr; import japa.parser.ast.expr.QualifiedNameExpr; import japa.parser.ast.expr.SingleMemberAnnotationExpr; import japa.parser.ast.expr.StringLiteralExpr; import japa.parser.ast.expr.SuperExpr; import japa.parser.ast.expr.ThisExpr; import japa.parser.ast.expr.UnaryExpr; import japa.parser.ast.expr.VariableDeclarationExpr; import japa.parser.ast.stmt.AssertStmt; import japa.parser.ast.stmt.BlockStmt; import japa.parser.ast.stmt.BreakStmt; import japa.parser.ast.stmt.CatchClause; import japa.parser.ast.stmt.ContinueStmt; import japa.parser.ast.stmt.DoStmt; import japa.parser.ast.stmt.EmptyStmt; import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; import japa.parser.ast.stmt.ExpressionStmt; import japa.parser.ast.stmt.ForStmt; import japa.parser.ast.stmt.ForeachStmt; import japa.parser.ast.stmt.IfStmt; import japa.parser.ast.stmt.LabeledStmt; import japa.parser.ast.stmt.ReturnStmt; import japa.parser.ast.stmt.Statement; import japa.parser.ast.stmt.SwitchEntryStmt; import japa.parser.ast.stmt.SwitchStmt; import japa.parser.ast.stmt.SynchronizedStmt; import japa.parser.ast.stmt.ThrowStmt; import japa.parser.ast.stmt.TryStmt; import japa.parser.ast.stmt.TypeDeclarationStmt; import japa.parser.ast.stmt.WhileStmt; 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.WildcardType; /** * @author Julio Vilmar Gesser */ public abstract class VoidVisitorAdapter implements VoidVisitor { public void visit(AnnotationDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getMembers() != null) { for (BodyDeclaration member : n.getMembers()) { member.accept(this, arg); } } } public void visit(AnnotationMemberDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getType().accept(this, arg); if (n.getDefaultValue() != null) { n.getDefaultValue().accept(this, arg); } } public void visit(ArrayAccessExpr n, A arg) { n.getName().accept(this, arg); n.getIndex().accept(this, arg); } public void visit(ArrayCreationExpr n, A arg) { n.getType().accept(this, arg); if (n.getDimensions() != null) { for (Expression dim : n.getDimensions()) { dim.accept(this, arg); } } else { n.getInitializer().accept(this, arg); } } public void visit(ArrayInitializerExpr n, A arg) { if (n.getValues() != null) { for (Expression expr : n.getValues()) { expr.accept(this, arg); } } } public void visit(AssertStmt n, A arg) { n.getCheck().accept(this, arg); if (n.getMessage() != null) { n.getMessage().accept(this, arg); } } public void visit(AssignExpr n, A arg) { n.getTarget().accept(this, arg); n.getValue().accept(this, arg); } public void visit(BinaryExpr n, A arg) { n.getLeft().accept(this, arg); n.getRight().accept(this, arg); } public void visit(BlockComment n, A arg) { } public void visit(BlockStmt n, A arg) { if (n.getStmts() != null) { for (Statement s : n.getStmts()) { s.accept(this, arg); } } } public void visit(BooleanLiteralExpr n, A arg) { } public void visit(BreakStmt n, A arg) { } public void visit(CastExpr n, A arg) { n.getType().accept(this, arg); n.getExpr().accept(this, arg); } public void visit(CatchClause n, A arg) { n.getExcept().accept(this, arg); n.getCatchBlock().accept(this, arg); } public void visit(CharLiteralExpr n, A arg) { } public void visit(ClassExpr n, A arg) { n.getType().accept(this, arg); } public void visit(ClassOrInterfaceDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getTypeParameters() != null) { for (TypeParameter t : n.getTypeParameters()) { t.accept(this, arg); } } if (n.getExtends() != null) { for (ClassOrInterfaceType c : n.getExtends()) { c.accept(this, arg); } } if (n.getImplements() != null) { for (ClassOrInterfaceType c : n.getImplements()) { c.accept(this, arg); } } if (n.getMembers() != null) { for (BodyDeclaration member : n.getMembers()) { member.accept(this, arg); } } } public void visit(ClassOrInterfaceType n, A arg) { if (n.getScope() != null) { n.getScope().accept(this, arg); } if (n.getTypeArgs() != null) { for (Type t : n.getTypeArgs()) { t.accept(this, arg); } } } public void visit(CompilationUnit n, A arg) { if (n.getPackage() != null) { n.getPackage().accept(this, arg); } if (n.getImports() != null) { for (ImportDeclaration i : n.getImports()) { i.accept(this, arg); } } if (n.getTypes() != null) { for (TypeDeclaration typeDeclaration : n.getTypes()) { typeDeclaration.accept(this, arg); } } } public void visit(ConditionalExpr n, A arg) { n.getCondition().accept(this, arg); n.getThenExpr().accept(this, arg); n.getElseExpr().accept(this, arg); } public void visit(ConstructorDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getTypeParameters() != null) { for (TypeParameter t : n.getTypeParameters()) { t.accept(this, arg); } } if (n.getParameters() != null) { for (Parameter p : n.getParameters()) { p.accept(this, arg); } } if (n.getThrows() != null) { for (NameExpr name : n.getThrows()) { name.accept(this, arg); } } n.getBlock().accept(this, arg); } public void visit(ContinueStmt n, A arg) { } public void visit(DoStmt n, A arg) { n.getBody().accept(this, arg); n.getCondition().accept(this, arg); } public void visit(DoubleLiteralExpr n, A arg) { } public void visit(EmptyMemberDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } } public void visit(EmptyStmt n, A arg) { } public void visit(EmptyTypeDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } } public void visit(EnclosedExpr n, A arg) { n.getInner().accept(this, arg); } public void visit(EnumConstantDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getArgs() != null) { for (Expression e : n.getArgs()) { e.accept(this, arg); } } if (n.getClassBody() != null) { for (BodyDeclaration member : n.getClassBody()) { member.accept(this, arg); } } } public void visit(EnumDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getImplements() != null) { for (ClassOrInterfaceType c : n.getImplements()) { c.accept(this, arg); } } if (n.getEntries() != null) { for (EnumConstantDeclaration e : n.getEntries()) { e.accept(this, arg); } } if (n.getMembers() != null) { for (BodyDeclaration member : n.getMembers()) { member.accept(this, arg); } } } public void visit(ExplicitConstructorInvocationStmt n, A arg) { if (!n.isThis()) { if (n.getExpr() != null) { n.getExpr().accept(this, arg); } } if (n.getTypeArgs() != null) { for (Type t : n.getTypeArgs()) { t.accept(this, arg); } } if (n.getArgs() != null) { for (Expression e : n.getArgs()) { e.accept(this, arg); } } } public void visit(ExpressionStmt n, A arg) { n.getExpression().accept(this, arg); } public void visit(FieldAccessExpr n, A arg) { n.getScope().accept(this, arg); } public void visit(FieldDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getType().accept(this, arg); for (VariableDeclarator var : n.getVariables()) { var.accept(this, arg); } } public void visit(ForeachStmt n, A arg) { n.getVariable().accept(this, arg); n.getIterable().accept(this, arg); n.getBody().accept(this, arg); } public void visit(ForStmt n, A arg) { if (n.getInit() != null) { for (Expression e : n.getInit()) { e.accept(this, arg); } } if (n.getCompare() != null) { n.getCompare().accept(this, arg); } if (n.getUpdate() != null) { for (Expression e : n.getUpdate()) { e.accept(this, arg); } } n.getBody().accept(this, arg); } public void visit(IfStmt n, A arg) { n.getCondition().accept(this, arg); n.getThenStmt().accept(this, arg); if (n.getElseStmt() != null) { n.getElseStmt().accept(this, arg); } } public void visit(ImportDeclaration n, A arg) { n.getName().accept(this, arg); } public void visit(InitializerDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } n.getBlock().accept(this, arg); } public void visit(InstanceOfExpr n, A arg) { n.getExpr().accept(this, arg); n.getType().accept(this, arg); } public void visit(IntegerLiteralExpr n, A arg) { } public void visit(IntegerLiteralMinValueExpr n, A arg) { } public void visit(JavadocComment n, A arg) { } public void visit(LabeledStmt n, A arg) { n.getStmt().accept(this, arg); } public void visit(LineComment n, A arg) { } public void visit(LongLiteralExpr n, A arg) { } public void visit(LongLiteralMinValueExpr n, A arg) { } public void visit(MarkerAnnotationExpr n, A arg) { n.getName().accept(this, arg); } public void visit(MemberValuePair n, A arg) { n.getValue().accept(this, arg); } public void visit(MethodCallExpr n, A arg) { if (n.getScope() != null) { n.getScope().accept(this, arg); } if (n.getTypeArgs() != null) { for (Type t : n.getTypeArgs()) { t.accept(this, arg); } } if (n.getArgs() != null) { for (Expression e : n.getArgs()) { e.accept(this, arg); } } } public void visit(MethodDeclaration n, A arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getTypeParameters() != null) { for (TypeParameter t : n.getTypeParameters()) { t.accept(this, arg); } } n.getType().accept(this, arg); if (n.getParameters() != null) { for (Parameter p : n.getParameters()) { p.accept(this, arg); } } if (n.getThrows() != null) { for (NameExpr name : n.getThrows()) { name.accept(this, arg); } } if (n.getBody() != null) { n.getBody().accept(this, arg); } } public void visit(NameExpr n, A arg) { } public void visit(NormalAnnotationExpr n, A arg) { n.getName().accept(this, arg); if (n.getPairs() != null) { for (MemberValuePair m : n.getPairs()) { m.accept(this, arg); } } } public void visit(NullLiteralExpr n, A arg) { } public void visit(ObjectCreationExpr n, A arg) { if (n.getScope() != null) { n.getScope().accept(this, arg); } if (n.getTypeArgs() != null) { for (Type t : n.getTypeArgs()) { t.accept(this, arg); } } n.getType().accept(this, arg); if (n.getArgs() != null) { for (Expression e : n.getArgs()) { e.accept(this, arg); } } if (n.getAnonymousClassBody() != null) { for (BodyDeclaration member : n.getAnonymousClassBody()) { member.accept(this, arg); } } } public void visit(PackageDeclaration n, A arg) { if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getName().accept(this, arg); } public void visit(Parameter n, A arg) { if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getType().accept(this, arg); n.getId().accept(this, arg); } public void visit(PrimitiveType n, A arg) { } public void visit(QualifiedNameExpr n, A arg) { n.getQualifier().accept(this, arg); } public void visit(ReferenceType n, A arg) { n.getType().accept(this, arg); } public void visit(ReturnStmt n, A arg) { if (n.getExpr() != null) { n.getExpr().accept(this, arg); } } public void visit(SingleMemberAnnotationExpr n, A arg) { n.getName().accept(this, arg); n.getMemberValue().accept(this, arg); } public void visit(StringLiteralExpr n, A arg) { } public void visit(SuperExpr n, A arg) { if (n.getClassExpr() != null) { n.getClassExpr().accept(this, arg); } } public void visit(SwitchEntryStmt n, A arg) { if (n.getLabel() != null) { n.getLabel().accept(this, arg); } if (n.getStmts() != null) { for (Statement s : n.getStmts()) { s.accept(this, arg); } } } public void visit(SwitchStmt n, A arg) { n.getSelector().accept(this, arg); if (n.getEntries() != null) { for (SwitchEntryStmt e : n.getEntries()) { e.accept(this, arg); } } } public void visit(SynchronizedStmt n, A arg) { n.getExpr().accept(this, arg); n.getBlock().accept(this, arg); } public void visit(ThisExpr n, A arg) { if (n.getClassExpr() != null) { n.getClassExpr().accept(this, arg); } } public void visit(ThrowStmt n, A arg) { n.getExpr().accept(this, arg); } public void visit(TryStmt n, A arg) { n.getTryBlock().accept(this, arg); if (n.getCatchs() != null) { for (CatchClause c : n.getCatchs()) { c.accept(this, arg); } } if (n.getFinallyBlock() != null) { n.getFinallyBlock().accept(this, arg); } } public void visit(TypeDeclarationStmt n, A arg) { n.getTypeDeclaration().accept(this, arg); } public void visit(TypeParameter n, A arg) { if (n.getTypeBound() != null) { for (ClassOrInterfaceType c : n.getTypeBound()) { c.accept(this, arg); } } } public void visit(UnaryExpr n, A arg) { n.getExpr().accept(this, arg); } public void visit(VariableDeclarationExpr n, A arg) { if (n.getAnnotations() != null) { for (AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } n.getType().accept(this, arg); for (VariableDeclarator v : n.getVars()) { v.accept(this, arg); } } public void visit(VariableDeclarator n, A arg) { n.getId().accept(this, arg); if (n.getInit() != null) { n.getInit().accept(this, arg); } } public void visit(VariableDeclaratorId n, A arg) { } public void visit(VoidType n, A arg) { } public void visit(WhileStmt n, A arg) { n.getCondition().accept(this, arg); n.getBody().accept(this, arg); } public void visit(WildcardType n, A arg) { if (n.getExtends() != null) { n.getExtends().accept(this, arg); } if (n.getSuper() != null) { n.getSuper().accept(this, arg); } } } src/japa/parser/ast/BlockComment.java0000644000000000000000000000344011132421230016547 0ustar rootroot/* * 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 . */ /* * Created on 23/05/2008 */ package japa.parser.ast; import japa.parser.ast.visitor.GenericVisitor; import japa.parser.ast.visitor.VoidVisitor; /** *

* AST node that represent block comments. *

* Block comments can has multi lines and are delimited by "/*" and * "*/". * * @author Julio Vilmar Gesser */ public final class BlockComment extends Comment { public BlockComment() { } public BlockComment(String content) { super(content); } public BlockComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { super(beginLine, beginColumn, endLine, endColumn, content); } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public
void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/Comment.java0000644000000000000000000000366611132421226015613 0ustar rootroot/* * 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 . */ /* * 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; } } src/japa/parser/ast/CompilationUnit.java0000644000000000000000000001342711132421230017316 0ustar rootroot/* * 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 . */ /* * 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; /** *

* This class represents the entire compilation unit. Each java file denotes a * compilation unit. *

* The CompilationUnit is constructed following the syntax:
* * * * * * * *
CompilationUnit::= * ( {@link PackageDeclaration} )?
* ( {@link ImportDeclaration} )*
* ( {@link TypeDeclaration} )*
*
*
* * @author Julio Vilmar Gesser */ public final class CompilationUnit extends Node { private PackageDeclaration pakage; private List imports; private List types; private List comments; public CompilationUnit() { } public CompilationUnit(PackageDeclaration pakage, List imports, List types, List 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 imports, List types, List comments) { super(beginLine, beginColumn, endLine, endColumn); this.pakage = pakage; this.imports = imports; this.types = types; this.comments = comments; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public
void accept(VoidVisitor 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.
* If there is no comment, null is returned. * * @return list with all comments of this compilation unit or * null * @see JavadocComment * @see LineComment * @see BlockComment */ public List getComments() { return comments; } /** * Retrieves the list of imports declared in this compilation unit or * null if there is no import. * * @return the list of imports or null if there is no import */ public List getImports() { return imports; } /** * Retrieves the package declaration of this compilation unit.
* If this compilation unit has no package declaration (default package), * null is returned. * * @return the package declaration or null */ public PackageDeclaration getPackage() { return pakage; } /** * Return the list of types declared in this compilation unit.
* If there is no types declared, null is returned. * * @return the list of types or null null if there is no type * @see AnnotationDeclaration * @see ClassOrInterfaceDeclaration * @see EmptyTypeDeclaration * @see EnumDeclaration */ public List getTypes() { return types; } /** * Sets the list of comments of this compilation unit. * * @param comments * the list of comments */ public void setComments(List comments) { this.comments = comments; } /** * Sets the list of imports of this compilation unit. The list is initially * null. * * @param imports * the list of imports */ public void setImports(List imports) { this.imports = imports; } /** * Sets or clear the package declarations of this compilation unit. * * @param pakage * the pakage declaration to set or null 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 types) { this.types = types; } } src/japa/parser/ast/ImportDeclaration.java0000644000000000000000000000742311132421226017624 0ustar rootroot/* * 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 . */ /* * 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; /** *

* This class represents a import declaration. Imports are optional for the * {@link CompilationUnit}. *

* The ImportDeclaration is constructed following the syntax:
* * * * * * * *
ImportDeclaration::= * "import" ( "static" )? {@link NameExpr} ( "." "*" )? ";" *
*
* * @author Julio Vilmar Gesser */ public final class ImportDeclaration extends Node { private NameExpr name; private boolean static_; private boolean asterisk; public ImportDeclaration() { } public ImportDeclaration(NameExpr name, boolean isStatic, boolean isAsterisk) { this.name = name; this.static_ = isStatic; this.asterisk = isAsterisk; } public ImportDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, NameExpr name, boolean isStatic, boolean isAsterisk) { super(beginLine, beginColumn, endLine, endColumn); this.name = name; this.static_ = isStatic; this.asterisk = isAsterisk; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public
void accept(VoidVisitor 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 true if the import ends with "*", false * otherwise */ public boolean isAsterisk() { return asterisk; } /** * Return if the import is static. * * @return true if the import is static, false * otherwise */ public boolean isStatic() { return static_; } /** * Sets if this import is asterisk. * * @param asterisk * true if this import is asterisk */ public void setAsterisk(boolean asterisk) { this.asterisk = asterisk; } /** * Sets the name this import. * * @param name * the name to set */ public void setName(NameExpr name) { this.name = name; } /** * Sets if this import is static. * * @param static_ * true if this import is static */ public void setStatic(boolean static_) { this.static_ = static_; } } src/japa/parser/ast/LineComment.java0000644000000000000000000000342611132421230016410 0ustar rootroot/* * 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 . */ /* * Created on 23/05/2008 */ package japa.parser.ast; import japa.parser.ast.visitor.GenericVisitor; import japa.parser.ast.visitor.VoidVisitor; /** *

* AST node that represent line comments. *

* Line comments are started with "//" and finish at the end of the line ("\n"). * * @author Julio Vilmar Gesser */ public final class LineComment extends Comment { public LineComment() { } public LineComment(String content) { super(content); } public LineComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { super(beginLine, beginColumn, endLine, endColumn, content); } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public
void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } src/japa/parser/ast/Node.java0000644000000000000000000001211411324632556015077 0ustar rootroot/* * 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 . */ /* * Created on 05/10/2006 */ package japa.parser.ast; import japa.parser.ast.visitor.DumpVisitor; import japa.parser.ast.visitor.EqualsVisitor; 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 * the type the return value of the visitor * @param * 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 accept(GenericVisitor v, A arg); /** * Accept method for visitor support. * * @param * the type the argument passed for the visitor * @param v * the visitor implementation * @param arg * any value relevant for the visitor */ public abstract void accept(VoidVisitor 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(); } @Override public final int hashCode() { return toString().hashCode(); } @Override public boolean equals(Object obj) { return EqualsVisitor.equals(this, (Node) obj); } } src/japa/parser/ast/PackageDeclaration.java0000644000000000000000000000670211132421226017704 0ustar rootroot/* * 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 . */ /* * 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; /** *

* This class represents the package declaration. The package declaration is * optional for the {@link CompilationUnit}. *

* The PackageDeclaration is constructed following the syntax:
* * * * * * * *
PackageDeclaration::= * ( {@link AnnotationExpr} )* "package" {@link NameExpr} ) ";" *
*
* * @author Julio Vilmar Gesser */ public final class PackageDeclaration extends Node { private List annotations; private NameExpr name; public PackageDeclaration() { } public PackageDeclaration(NameExpr name) { this.name = name; } public PackageDeclaration(List annotations, NameExpr name) { this.annotations = annotations; this.name = name; } public PackageDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List annotations, NameExpr name) { super(beginLine, beginColumn, endLine, endColumn); this.annotations = annotations; this.name = name; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public
void accept(VoidVisitor v, A arg) { v.visit(this, arg); } /** * Retrieves the list of annotations declared before the package * declaration. Return null if there are no annotations. * * @return list of annotations or null */ public List 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 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; } } src/japa/parser/ast/TypeParameter.java0000644000000000000000000000652211132421226016765 0ustar rootroot/* * 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 . */ /* * 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; /** *

* This class represents the declaration of a genetics argument. *

* The TypeParameter is constructed following the syntax:
* * * * * * * *
TypeParameter::= * <IDENTIFIER> ( "extends" {@link ClassOrInterfaceType} ( "&" {@link ClassOrInterfaceType} )* )? *
*
* * @author Julio Vilmar Gesser */ public final class TypeParameter extends Node { private String name; private List typeBound; public TypeParameter() { } public TypeParameter(String name, List typeBound) { this.name = name; this.typeBound = typeBound; } public TypeParameter(int beginLine, int beginColumn, int endLine, int endColumn, String name, List typeBound) { super(beginLine, beginColumn, endLine, endColumn); this.name = name; this.typeBound = typeBound; } @Override public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } @Override public
void accept(VoidVisitor 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 null null if there are no type. * * @return list of types that this paramente extends or null */ public List 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 typeBound) { this.typeBound = typeBound; } } src/japa/parser/ASTHelper.java0000644000000000000000000002116211132421230015173 0ustar rootrootpackage 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.
* 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 variables = new ArrayList(); 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 vars = new ArrayList(); 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 null. * * @param method * method * @param parameter * parameter */ public static void addParameter(MethodDeclaration method, Parameter parameter) { List parameters = method.getParameters(); if (parameters == null) { parameters = new ArrayList(); method.setParameters(parameters); } parameters.add(parameter); } /** * Adds the given argument to the method call. The list of arguments will be * initialized if it is null. * * @param call * method call * @param arg * argument value */ public static void addArgument(MethodCallExpr call, Expression arg) { List args = call.getArgs(); if (args == null) { args = new ArrayList(); 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 null. * * @param cu * compilation unit * @param type * type declaration */ public static void addTypeDeclaration(CompilationUnit cu, TypeDeclaration type) { List types = cu.getTypes(); if (types == null) { types = new ArrayList(); 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 0 if is not a array. * @return instanceof {@link ReferenceType} */ public static ReferenceType createReferenceType(String name, int arrayCount) { return new ReferenceType(new ClassOrInterfaceType(name), arrayCount); } /** * Creates a new {@link ReferenceType} for the given primitive type. * * @param type * primitive type * @param arrayCount * number os arrays or 0 if is not a array. * @return instanceof {@link ReferenceType} */ public static ReferenceType createReferenceType(PrimitiveType type, int arrayCount) { return new ReferenceType(type, arrayCount); } /** * Adds the given statement to the specified block. The list of statements * will be initialized if it is null. * * @param block * @param stmt */ public static void addStmt(BlockStmt block, Statement stmt) { List stmts = block.getStmts(); if (stmts == null) { stmts = new ArrayList(); block.setStmts(stmts); } stmts.add(stmt); } /** * Adds the given expression to the specified block. The list of statements * will be initialized if it is null. * * @param block * @param stmt */ public static void addStmt(BlockStmt block, Expression expr) { addStmt(block, new ExpressionStmt(expr)); } /** * Adds the given declaration to the specified type. The list of members * will be initialized if it is null. * * @param type * type declaration * @param decl * member declaration */ public static void addMember(TypeDeclaration type, BodyDeclaration decl) { List members = type.getMembers(); if (members == null) { members = new ArrayList(); type.setMembers(members); } members.add(decl); } } src/japa/parser/ASTParser.java0000644000000000000000000110736411244033154015232 0ustar rootroot/* Generated By:JavaCC: Do not edit this line. ASTParser.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 . */ package japa.parser; import japa.parser.ast.Comment; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.TypeParameter; import japa.parser.ast.body.AnnotationDeclaration; import japa.parser.ast.body.AnnotationMemberDeclaration; import japa.parser.ast.body.BodyDeclaration; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.ConstructorDeclaration; import japa.parser.ast.body.EmptyMemberDeclaration; import japa.parser.ast.body.EmptyTypeDeclaration; import japa.parser.ast.body.EnumConstantDeclaration; import japa.parser.ast.body.EnumDeclaration; import japa.parser.ast.body.FieldDeclaration; import japa.parser.ast.body.InitializerDeclaration; import japa.parser.ast.body.JavadocComment; import japa.parser.ast.body.MethodDeclaration; import japa.parser.ast.body.ModifierSet; 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.AnnotationExpr; import japa.parser.ast.expr.ArrayAccessExpr; import japa.parser.ast.expr.ArrayCreationExpr; import japa.parser.ast.expr.ArrayInitializerExpr; import japa.parser.ast.expr.AssignExpr; import japa.parser.ast.expr.BinaryExpr; import japa.parser.ast.expr.BooleanLiteralExpr; import japa.parser.ast.expr.CastExpr; import japa.parser.ast.expr.CharLiteralExpr; import japa.parser.ast.expr.ClassExpr; import japa.parser.ast.expr.ConditionalExpr; import japa.parser.ast.expr.DoubleLiteralExpr; import japa.parser.ast.expr.EnclosedExpr; import japa.parser.ast.expr.Expression; import japa.parser.ast.expr.FieldAccessExpr; import japa.parser.ast.expr.InstanceOfExpr; import japa.parser.ast.expr.IntegerLiteralExpr; import japa.parser.ast.expr.IntegerLiteralMinValueExpr; import japa.parser.ast.expr.LongLiteralExpr; import japa.parser.ast.expr.LongLiteralMinValueExpr; import japa.parser.ast.expr.MarkerAnnotationExpr; import japa.parser.ast.expr.MemberValuePair; import japa.parser.ast.expr.MethodCallExpr; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.expr.NormalAnnotationExpr; import japa.parser.ast.expr.NullLiteralExpr; import japa.parser.ast.expr.ObjectCreationExpr; import japa.parser.ast.expr.QualifiedNameExpr; import japa.parser.ast.expr.SingleMemberAnnotationExpr; import japa.parser.ast.expr.StringLiteralExpr; import japa.parser.ast.expr.SuperExpr; import japa.parser.ast.expr.ThisExpr; import japa.parser.ast.expr.UnaryExpr; import japa.parser.ast.expr.VariableDeclarationExpr; import japa.parser.ast.stmt.AssertStmt; import japa.parser.ast.stmt.BlockStmt; import japa.parser.ast.stmt.BreakStmt; import japa.parser.ast.stmt.CatchClause; import japa.parser.ast.stmt.ContinueStmt; import japa.parser.ast.stmt.DoStmt; import japa.parser.ast.stmt.EmptyStmt; import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; import japa.parser.ast.stmt.ExpressionStmt; import japa.parser.ast.stmt.ForStmt; import japa.parser.ast.stmt.ForeachStmt; import japa.parser.ast.stmt.IfStmt; import japa.parser.ast.stmt.LabeledStmt; import japa.parser.ast.stmt.ReturnStmt; import japa.parser.ast.stmt.Statement; import japa.parser.ast.stmt.SwitchEntryStmt; import japa.parser.ast.stmt.SwitchStmt; import japa.parser.ast.stmt.SynchronizedStmt; import japa.parser.ast.stmt.ThrowStmt; import japa.parser.ast.stmt.TryStmt; import japa.parser.ast.stmt.TypeDeclarationStmt; import japa.parser.ast.stmt.WhileStmt; 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.WildcardType; import java.io.InputStream; import java.util.LinkedList; import java.util.List; /** *

* This class was generated automatically by javacc, do not edit. *

* * @author Júlio Vilmar Gesser */ final class ASTParser implements ASTParserConstants { void reset(InputStream in, String encoding) { ReInit(in, encoding); token_source.clearComments(); } private List add(List list, Object obj) { if (list == null) { list = new LinkedList(); } list.add(obj); return list; } private List add(int pos, List list, Object obj) { if (list == null) { list = new LinkedList(); } list.add(pos, obj); return list; } private static class Modifier { final int modifiers; final List annotations; final int beginLine; final int beginColumn; public Modifier(int beginLine, int beginColumn, int modifiers, List annotations) { this.beginLine = beginLine; this.beginColumn = beginColumn; this.modifiers = modifiers; this.annotations = annotations; } } public int addModifier(int modifiers, int mod, Token token) throws ParseException { if ((ModifierSet.hasModifier(modifiers, mod))) { throwParseException(token, "Duplicated modifier"); } return ModifierSet.addModifier(modifiers, mod); } private void pushJavadoc() { token_source.pushJavadoc(); } private JavadocComment popJavadoc() { return token_source.popJavadoc(); } private List getComments() { return token_source.getComments(); } private void throwParseException(Token token, String message) throws ParseException { StringBuilder buf = new StringBuilder(); buf.append(message); buf.append(": \""); buf.append(token.image); buf.append("\" at line "); buf.append(token.beginLine); buf.append(", column "); buf.append(token.beginColumn); ParseException e = new ParseException(buf.toString()); e.currentToken = token; throw e; } static final class GTToken extends Token { int realKind = ASTParserConstants.GT; GTToken(int kind, String image) { this.kind = kind; this.image = image; } public static Token newToken(int kind, String image) { return new GTToken(kind, image); } } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ final public CompilationUnit CompilationUnit() throws ParseException { PackageDeclaration pakage = null; List imports = null; ImportDeclaration in = null; List types = null; TypeDeclaration tn = null; int line = -1; int column = 0; if (jj_2_1(2147483647)) { pakage = PackageDeclaration(); line = pakage.getBeginLine(); column = pakage.getBeginColumn(); } else { ; } label_1: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IMPORT: ; break; default: jj_la1[0] = jj_gen; break label_1; } in = ImportDeclaration(); if (line == -1) { line = in.getBeginLine(); column = in.getBeginColumn(); } imports = add(imports, in); } label_2: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ABSTRACT: case CLASS: case ENUM: case FINAL: case INTERFACE: case NATIVE: case PRIVATE: case PROTECTED: case PUBLIC: case STATIC: case STRICTFP: case SYNCHRONIZED: case TRANSIENT: case VOLATILE: case SEMICOLON: case AT: ; break; default: jj_la1[1] = jj_gen; break label_2; } tn = TypeDeclaration(); if (line == -1) { line = tn.getBeginLine(); column = tn.getBeginColumn(); } types = add(types, tn); } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 0: jj_consume_token(0); break; case 128: jj_consume_token(128); break; default: jj_la1[2] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return new CompilationUnit(line == -1 ? 0 : line, column, token.endLine, token.endColumn, pakage, imports, types, getComments()); } } throw new Error("Missing return statement in function"); } final public PackageDeclaration PackageDeclaration() throws ParseException { List annotations = null; AnnotationExpr ann; NameExpr name; int line; int column; label_3: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case AT: ; break; default: jj_la1[3] = jj_gen; break label_3; } ann = Annotation(); annotations = add(annotations, ann); } jj_consume_token(PACKAGE); line = token.beginLine; column = token.beginColumn; name = Name(); jj_consume_token(SEMICOLON); { if (true) { return new PackageDeclaration(line, column, token.endLine, token.endColumn, annotations, name); } } throw new Error("Missing return statement in function"); } final public ImportDeclaration ImportDeclaration() throws ParseException { NameExpr name; boolean isStatic = false; boolean isAsterisk = false; int line; int column; jj_consume_token(IMPORT); line = token.beginLine; column = token.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case STATIC: jj_consume_token(STATIC); isStatic = true; break; default: jj_la1[4] = jj_gen; ; } name = Name(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case DOT: jj_consume_token(DOT); jj_consume_token(STAR); isAsterisk = true; break; default: jj_la1[5] = jj_gen; ; } jj_consume_token(SEMICOLON); { if (true) { return new ImportDeclaration(line, column, token.endLine, token.endColumn, name, isStatic, isAsterisk); } } throw new Error("Missing return statement in function"); } /* * Modifiers. We match all modifiers in a single rule to reduce the chances of * syntax errors for simple modifier mistakes. It will also enable us to give * better error messages. */ final public Modifier Modifiers() throws ParseException { int beginLine = -1; int beginColumn = -1; int modifiers = 0; List annotations = null; AnnotationExpr ann; label_4: while (true) { if (jj_2_2(2)) { ; } else { break label_4; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case PUBLIC: jj_consume_token(PUBLIC); modifiers = addModifier(modifiers, ModifierSet.PUBLIC, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case STATIC: jj_consume_token(STATIC); modifiers = addModifier(modifiers, ModifierSet.STATIC, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case PROTECTED: jj_consume_token(PROTECTED); modifiers = addModifier(modifiers, ModifierSet.PROTECTED, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case PRIVATE: jj_consume_token(PRIVATE); modifiers = addModifier(modifiers, ModifierSet.PRIVATE, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case FINAL: jj_consume_token(FINAL); modifiers = addModifier(modifiers, ModifierSet.FINAL, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case ABSTRACT: jj_consume_token(ABSTRACT); modifiers = addModifier(modifiers, ModifierSet.ABSTRACT, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case SYNCHRONIZED: jj_consume_token(SYNCHRONIZED); modifiers = addModifier(modifiers, ModifierSet.SYNCHRONIZED, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case NATIVE: jj_consume_token(NATIVE); modifiers = addModifier(modifiers, ModifierSet.NATIVE, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case TRANSIENT: jj_consume_token(TRANSIENT); modifiers = addModifier(modifiers, ModifierSet.TRANSIENT, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case VOLATILE: jj_consume_token(VOLATILE); modifiers = addModifier(modifiers, ModifierSet.VOLATILE, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case STRICTFP: jj_consume_token(STRICTFP); modifiers = addModifier(modifiers, ModifierSet.STRICTFP, token); if (beginLine == -1) { beginLine = token.beginLine; beginColumn = token.beginColumn; } break; case AT: ann = Annotation(); annotations = add(annotations, ann); if (beginLine == -1) { beginLine = ann.getBeginLine(); beginColumn = ann.getBeginColumn(); } break; default: jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return new Modifier(beginLine, beginColumn, modifiers, annotations); } } throw new Error("Missing return statement in function"); } /* * Declaration syntax follows. */ final public TypeDeclaration TypeDeclaration() throws ParseException { Modifier modifier; TypeDeclaration ret; pushJavadoc(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case SEMICOLON: jj_consume_token(SEMICOLON); ret = new EmptyTypeDeclaration(token.beginLine, token.beginColumn, token.endLine, token.endColumn, popJavadoc()); break; case ABSTRACT: case CLASS: case ENUM: case FINAL: case INTERFACE: case NATIVE: case PRIVATE: case PROTECTED: case PUBLIC: case STATIC: case STRICTFP: case SYNCHRONIZED: case TRANSIENT: case VOLATILE: case AT: modifier = Modifiers(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case CLASS: case INTERFACE: ret = ClassOrInterfaceDeclaration(modifier); break; case ENUM: ret = EnumDeclaration(modifier); break; case AT: ret = AnnotationTypeDeclaration(modifier); break; default: jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: jj_la1[8] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public ClassOrInterfaceDeclaration ClassOrInterfaceDeclaration(Modifier modifier) throws ParseException { boolean isInterface = false; String name; List typePar = null; List extList = null; List impList = null; List members; int line = modifier.beginLine; int column = modifier.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case CLASS: jj_consume_token(CLASS); break; case INTERFACE: jj_consume_token(INTERFACE); isInterface = true; break; default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } if (line == -1) { line = token.beginLine; column = token.beginColumn; } jj_consume_token(IDENTIFIER); name = token.image; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: typePar = TypeParameters(); typePar.remove(0); break; default: jj_la1[10] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case EXTENDS: extList = ExtendsList(isInterface); break; default: jj_la1[11] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IMPLEMENTS: impList = ImplementsList(isInterface); break; default: jj_la1[12] = jj_gen; ; } members = ClassOrInterfaceBody(isInterface); { if (true) { return new ClassOrInterfaceDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, isInterface, name, typePar, extList, impList, members); } } throw new Error("Missing return statement in function"); } final public List ExtendsList(boolean isInterface) throws ParseException { boolean extendsMoreThanOne = false; List ret = new LinkedList(); ClassOrInterfaceType cit; jj_consume_token(EXTENDS); cit = ClassOrInterfaceType(); ret.add(cit); label_5: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[13] = jj_gen; break label_5; } jj_consume_token(COMMA); cit = ClassOrInterfaceType(); ret.add(cit); extendsMoreThanOne = true; } if (extendsMoreThanOne && !isInterface) { throwParseException(token, "A class cannot extend more than one other class"); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public List ImplementsList(boolean isInterface) throws ParseException { List ret = new LinkedList(); ClassOrInterfaceType cit; jj_consume_token(IMPLEMENTS); cit = ClassOrInterfaceType(); ret.add(cit); label_6: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[14] = jj_gen; break label_6; } jj_consume_token(COMMA); cit = ClassOrInterfaceType(); ret.add(cit); } if (isInterface) { throwParseException(token, "An interface cannot implement other interfaces"); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public EnumDeclaration EnumDeclaration(Modifier modifier) throws ParseException { String name; List impList = null; EnumConstantDeclaration entry; List entries = null; BodyDeclaration member; List members = null; int line = modifier.beginLine; int column = modifier.beginColumn; jj_consume_token(ENUM); if (line == -1) { line = token.beginLine; column = token.beginColumn; } jj_consume_token(IDENTIFIER); name = token.image; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IMPLEMENTS: impList = ImplementsList(false); break; default: jj_la1[15] = jj_gen; ; } jj_consume_token(LBRACE); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IDENTIFIER: case AT: entries = new LinkedList(); entry = EnumConstantDeclaration(); entries.add(entry); label_7: while (true) { if (jj_2_3(2)) { ; } else { break label_7; } jj_consume_token(COMMA); entry = EnumConstantDeclaration(); entries.add(entry); } break; default: jj_la1[16] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: jj_consume_token(COMMA); break; default: jj_la1[17] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case SEMICOLON: jj_consume_token(SEMICOLON); label_8: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ABSTRACT: case BOOLEAN: case BYTE: case CHAR: case CLASS: case DOUBLE: case ENUM: case FINAL: case FLOAT: case INT: case INTERFACE: case LONG: case NATIVE: case PRIVATE: case PROTECTED: case PUBLIC: case SHORT: case STATIC: case STRICTFP: case SYNCHRONIZED: case TRANSIENT: case VOID: case VOLATILE: case IDENTIFIER: case LBRACE: case SEMICOLON: case AT: case LT: ; break; default: jj_la1[18] = jj_gen; break label_8; } member = ClassOrInterfaceBodyDeclaration(false); members = add(members, member); } break; default: jj_la1[19] = jj_gen; ; } jj_consume_token(RBRACE); { if (true) { return new EnumDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, name, impList, entries, members); } } throw new Error("Missing return statement in function"); } final public EnumConstantDeclaration EnumConstantDeclaration() throws ParseException { List annotations = null; AnnotationExpr ann; String name; List args = null; List classBody = null; int line = -1; int column = -1; pushJavadoc(); label_9: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case AT: ; break; default: jj_la1[20] = jj_gen; break label_9; } ann = Annotation(); annotations = add(annotations, ann); if (line == -1) { line = ann.getBeginLine(); column = ann.getBeginColumn(); } } jj_consume_token(IDENTIFIER); name = token.image; if (line == -1) { line = token.beginLine; column = token.beginColumn; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LPAREN: args = Arguments(); break; default: jj_la1[21] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LBRACE: classBody = ClassOrInterfaceBody(false); break; default: jj_la1[22] = jj_gen; ; } { if (true) { return new EnumConstantDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), annotations, name, args, classBody); } } throw new Error("Missing return statement in function"); } final public List TypeParameters() throws ParseException { List ret = new LinkedList(); TypeParameter tp; jj_consume_token(LT); ret.add(new int[] { token.beginLine, token.beginColumn }); tp = TypeParameter(); ret.add(tp); label_10: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[23] = jj_gen; break label_10; } jj_consume_token(COMMA); tp = TypeParameter(); ret.add(tp); } jj_consume_token(GT); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public TypeParameter TypeParameter() throws ParseException { String name; List typeBound = null; int line; int column; jj_consume_token(IDENTIFIER); name = token.image; line = token.beginLine; column = token.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case EXTENDS: typeBound = TypeBound(); break; default: jj_la1[24] = jj_gen; ; } { if (true) { return new TypeParameter(line, column, token.endLine, token.endColumn, name, typeBound); } } throw new Error("Missing return statement in function"); } final public List TypeBound() throws ParseException { List ret = new LinkedList(); ClassOrInterfaceType cit; jj_consume_token(EXTENDS); cit = ClassOrInterfaceType(); ret.add(cit); label_11: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BIT_AND: ; break; default: jj_la1[25] = jj_gen; break label_11; } jj_consume_token(BIT_AND); cit = ClassOrInterfaceType(); ret.add(cit); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public List ClassOrInterfaceBody(boolean isInterface) throws ParseException { List ret = new LinkedList(); BodyDeclaration member; jj_consume_token(LBRACE); label_12: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ABSTRACT: case BOOLEAN: case BYTE: case CHAR: case CLASS: case DOUBLE: case ENUM: case FINAL: case FLOAT: case INT: case INTERFACE: case LONG: case NATIVE: case PRIVATE: case PROTECTED: case PUBLIC: case SHORT: case STATIC: case STRICTFP: case SYNCHRONIZED: case TRANSIENT: case VOID: case VOLATILE: case IDENTIFIER: case LBRACE: case SEMICOLON: case AT: case LT: ; break; default: jj_la1[26] = jj_gen; break label_12; } member = ClassOrInterfaceBodyDeclaration(isInterface); ret.add(member); } jj_consume_token(RBRACE); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public BodyDeclaration ClassOrInterfaceBodyDeclaration(boolean isInterface) throws ParseException { boolean isNestedInterface = false; Modifier modifier; BodyDeclaration ret; pushJavadoc(); if (jj_2_6(2)) { ret = InitializerDeclaration(); if (isInterface) { throwParseException(token, "An interface cannot have initializers"); } } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ABSTRACT: case BOOLEAN: case BYTE: case CHAR: case CLASS: case DOUBLE: case ENUM: case FINAL: case FLOAT: case INT: case INTERFACE: case LONG: case NATIVE: case PRIVATE: case PROTECTED: case PUBLIC: case SHORT: case STATIC: case STRICTFP: case SYNCHRONIZED: case TRANSIENT: case VOID: case VOLATILE: case IDENTIFIER: case AT: case LT: modifier = Modifiers(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case CLASS: case INTERFACE: ret = ClassOrInterfaceDeclaration(modifier); break; case ENUM: ret = EnumDeclaration(modifier); break; case AT: ret = AnnotationTypeDeclaration(modifier); break; default: jj_la1[27] = jj_gen; if (jj_2_4(2147483647)) { ret = ConstructorDeclaration(modifier); } else if (jj_2_5(2147483647)) { ret = FieldDeclaration(modifier); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: case VOID: case IDENTIFIER: case LT: ret = MethodDeclaration(modifier); break; default: jj_la1[28] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } break; case SEMICOLON: jj_consume_token(SEMICOLON); ret = new EmptyMemberDeclaration(token.beginLine, token.beginColumn, token.endLine, token.endColumn, popJavadoc()); break; default: jj_la1[29] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public FieldDeclaration FieldDeclaration(Modifier modifier) throws ParseException { Type type; List variables = new LinkedList(); VariableDeclarator val; // Modifiers are already matched in the caller type = Type(); val = VariableDeclarator(); variables.add(val); label_13: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[30] = jj_gen; break label_13; } jj_consume_token(COMMA); val = VariableDeclarator(); variables.add(val); } jj_consume_token(SEMICOLON); int line = modifier.beginLine; int column = modifier.beginColumn; if (line == -1) { line = type.getBeginLine(); column = type.getBeginColumn(); } { if (true) { return new FieldDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, type, variables); } } throw new Error("Missing return statement in function"); } final public VariableDeclarator VariableDeclarator() throws ParseException { VariableDeclaratorId id; Expression init = null; id = VariableDeclaratorId(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ASSIGN: jj_consume_token(ASSIGN); init = VariableInitializer(); break; default: jj_la1[31] = jj_gen; ; } { if (true) { return new VariableDeclarator(id.getBeginLine(), id.getBeginColumn(), token.endLine, token.endColumn, id, init); } } throw new Error("Missing return statement in function"); } final public VariableDeclaratorId VariableDeclaratorId() throws ParseException { String name; int arrayCount = 0; int line; int column; jj_consume_token(IDENTIFIER); name = token.image; line = token.beginLine; column = token.beginColumn; label_14: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LBRACKET: ; break; default: jj_la1[32] = jj_gen; break label_14; } jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); arrayCount++; } { if (true) { return new VariableDeclaratorId(line, column, token.endLine, token.endColumn, name, arrayCount); } } throw new Error("Missing return statement in function"); } final public Expression VariableInitializer() throws ParseException { Expression ret; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LBRACE: ret = ArrayInitializer(); break; case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: ret = Expression(); break; default: jj_la1[33] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public ArrayInitializerExpr ArrayInitializer() throws ParseException { List values = null; Expression val; int line; int column; jj_consume_token(LBRACE); line = token.beginLine; column = token.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case LBRACE: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: val = VariableInitializer(); values = add(values, val); label_15: while (true) { if (jj_2_7(2)) { ; } else { break label_15; } jj_consume_token(COMMA); val = VariableInitializer(); values = add(values, val); } break; default: jj_la1[34] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: jj_consume_token(COMMA); break; default: jj_la1[35] = jj_gen; ; } jj_consume_token(RBRACE); { if (true) { return new ArrayInitializerExpr(line, column, token.endLine, token.endColumn, values); } } throw new Error("Missing return statement in function"); } final public MethodDeclaration MethodDeclaration(Modifier modifier) throws ParseException { List typeParameters = null; Type type; String name; List parameters; int arrayCount = 0; List throws_ = null; BlockStmt block = null; int line = modifier.beginLine; int column = modifier.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: typeParameters = TypeParameters(); int[] lineCol = (int[]) typeParameters.remove(0); if (line == -1) { line = lineCol[0]; column = lineCol[1]; } break; default: jj_la1[36] = jj_gen; ; } type = ResultType(); if (line == -1) { line = type.getBeginLine(); column = type.getBeginColumn(); } jj_consume_token(IDENTIFIER); name = token.image; parameters = FormalParameters(); label_16: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LBRACKET: ; break; default: jj_la1[37] = jj_gen; break label_16; } jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); arrayCount++; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case THROWS: jj_consume_token(THROWS); throws_ = NameList(); break; default: jj_la1[38] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LBRACE: block = Block(); break; case SEMICOLON: jj_consume_token(SEMICOLON); break; default: jj_la1[39] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return new MethodDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, typeParameters, type, name, parameters, arrayCount, throws_, block); } } throw new Error("Missing return statement in function"); } final public List FormalParameters() throws ParseException { List ret = null; Parameter par; jj_consume_token(LPAREN); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ABSTRACT: case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FINAL: case FLOAT: case INT: case LONG: case NATIVE: case PRIVATE: case PROTECTED: case PUBLIC: case SHORT: case STATIC: case STRICTFP: case SYNCHRONIZED: case TRANSIENT: case VOLATILE: case IDENTIFIER: case AT: par = FormalParameter(); ret = add(ret, par); label_17: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[40] = jj_gen; break label_17; } jj_consume_token(COMMA); par = FormalParameter(); ret = add(ret, par); } break; default: jj_la1[41] = jj_gen; ; } jj_consume_token(RPAREN); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Parameter FormalParameter() throws ParseException { Modifier modifier; Type type; boolean isVarArg = false; VariableDeclaratorId id; modifier = Modifiers(); type = Type(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ELLIPSIS: jj_consume_token(ELLIPSIS); isVarArg = true; break; default: jj_la1[42] = jj_gen; ; } id = VariableDeclaratorId(); int line = modifier.beginLine; int column = modifier.beginColumn; if (line == -1) { line = type.getBeginLine(); column = type.getBeginColumn(); } { if (true) { return new Parameter(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, isVarArg, id); } } throw new Error("Missing return statement in function"); } final public ConstructorDeclaration ConstructorDeclaration(Modifier modifier) throws ParseException { List typeParameters = null; String name; List parameters; List throws_ = null; ExplicitConstructorInvocationStmt exConsInv = null; List stmts; int line = modifier.beginLine; int column = modifier.beginColumn; int bbLine = 0; int bbColumn = 0; int beLine = 0; int beColumn = 0; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: typeParameters = TypeParameters(); int[] lineCol = (int[]) typeParameters.remove(0); if (line == -1) { line = lineCol[0]; column = lineCol[1]; } break; default: jj_la1[43] = jj_gen; ; } jj_consume_token(IDENTIFIER); name = token.image; if (line == -1) { line = token.beginLine; column = token.beginColumn; } parameters = FormalParameters(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case THROWS: jj_consume_token(THROWS); throws_ = NameList(); break; default: jj_la1[44] = jj_gen; ; } jj_consume_token(LBRACE); bbLine = token.beginLine; bbColumn = token.beginColumn; if (jj_2_8(2147483647)) { exConsInv = ExplicitConstructorInvocation(); } else { ; } stmts = Statements(); jj_consume_token(RBRACE); if (exConsInv != null) { stmts = add(0, stmts, exConsInv); } { if (true) { return new ConstructorDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, typeParameters, name, parameters, throws_, new BlockStmt(bbLine, bbColumn, token.endLine, token.endColumn, stmts)); } } throw new Error("Missing return statement in function"); } final public ExplicitConstructorInvocationStmt ExplicitConstructorInvocation() throws ParseException { boolean isThis = false; List args; Expression expr = null; List typeArgs = null; int line = -1; int column = 0; if (jj_2_10(2147483647)) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: typeArgs = TypeArguments(); int[] lineCol = (int[]) typeArgs.remove(0); line = lineCol[0]; column = lineCol[1]; break; default: jj_la1[45] = jj_gen; ; } jj_consume_token(THIS); if (line == -1) { line = token.beginLine; column = token.beginColumn; } isThis = true; args = Arguments(); jj_consume_token(SEMICOLON); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case LT: if (jj_2_9(2147483647)) { expr = PrimaryExpressionWithoutSuperSuffix(); jj_consume_token(DOT); line = expr.getBeginLine(); column = expr.getBeginColumn(); } else { ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: typeArgs = TypeArguments(); int[] lineCol = (int[]) typeArgs.remove(0); if (line == -1) { line = lineCol[0]; column = lineCol[1]; } break; default: jj_la1[46] = jj_gen; ; } jj_consume_token(SUPER); if (line == -1) { line = token.beginLine; column = token.beginColumn; } args = Arguments(); jj_consume_token(SEMICOLON); break; default: jj_la1[47] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return new ExplicitConstructorInvocationStmt(line, column, token.endLine, token.endColumn, typeArgs, isThis, expr, args); } } throw new Error("Missing return statement in function"); } final public List Statements() throws ParseException { List ret = null; Statement stmt; label_18: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ABSTRACT: case ASSERT: case BOOLEAN: case BREAK: case BYTE: case CHAR: case CLASS: case CONTINUE: case DO: case DOUBLE: case FALSE: case FINAL: case FLOAT: case FOR: case IF: case INT: case INTERFACE: case LONG: case NATIVE: case NEW: case NULL: case PRIVATE: case PROTECTED: case PUBLIC: case RETURN: case SHORT: case STATIC: case STRICTFP: case SUPER: case SWITCH: case SYNCHRONIZED: case THIS: case THROW: case TRANSIENT: case TRUE: case TRY: case VOID: case VOLATILE: case WHILE: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case LBRACE: case SEMICOLON: case AT: case INCR: case DECR: ; break; default: jj_la1[48] = jj_gen; break label_18; } stmt = BlockStatement(); ret = add(ret, stmt); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public InitializerDeclaration InitializerDeclaration() throws ParseException { BlockStmt block; int line = -1; int column = 0; boolean isStatic = false; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case STATIC: jj_consume_token(STATIC); isStatic = true; line = token.beginLine; column = token.beginColumn; break; default: jj_la1[49] = jj_gen; ; } block = Block(); if (line == -1) { line = block.getBeginLine(); column = block.getBeginColumn(); } { if (true) { return new InitializerDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), isStatic, block); } } throw new Error("Missing return statement in function"); } /* * Type, name and expression syntax follows. */ final public Type Type() throws ParseException { Type ret; if (jj_2_11(2)) { ret = ReferenceType(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: ret = PrimitiveType(); break; default: jj_la1[50] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public ReferenceType ReferenceType() throws ParseException { Type type; int arrayCount = 0; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: type = PrimitiveType(); label_19: while (true) { jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); arrayCount++; if (jj_2_12(2)) { ; } else { break label_19; } } break; case IDENTIFIER: type = ClassOrInterfaceType(); label_20: while (true) { if (jj_2_13(2)) { ; } else { break label_20; } jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); arrayCount++; } break; default: jj_la1[51] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return new ReferenceType(type.getBeginLine(), type.getBeginColumn(), token.endLine, token.endColumn, type, arrayCount); } } throw new Error("Missing return statement in function"); } final public ClassOrInterfaceType ClassOrInterfaceType() throws ParseException { ClassOrInterfaceType ret; String name; List typeArgs = null; int line; int column; jj_consume_token(IDENTIFIER); line = token.beginLine; column = token.beginColumn; name = token.image; if (jj_2_14(2)) { typeArgs = TypeArguments(); typeArgs.remove(0); } else { ; } ret = new ClassOrInterfaceType(line, column, token.endLine, token.endColumn, null, name, typeArgs); label_21: while (true) { if (jj_2_15(2)) { ; } else { break label_21; } jj_consume_token(DOT); jj_consume_token(IDENTIFIER); name = token.image; if (jj_2_16(2)) { typeArgs = TypeArguments(); typeArgs.remove(0); } else { ; } ret = new ClassOrInterfaceType(line, column, token.endLine, token.endColumn, ret, name, typeArgs); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public List TypeArguments() throws ParseException { List ret = new LinkedList(); Type type; jj_consume_token(LT); ret.add(new int[] { token.beginLine, token.beginColumn }); type = TypeArgument(); ret.add(type); label_22: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[52] = jj_gen; break label_22; } jj_consume_token(COMMA); type = TypeArgument(); ret.add(type); } jj_consume_token(GT); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Type TypeArgument() throws ParseException { Type ret; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: case IDENTIFIER: ret = ReferenceType(); break; case HOOK: ret = Wildcard(); break; default: jj_la1[53] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public WildcardType Wildcard() throws ParseException { ReferenceType ext = null; ReferenceType sup = null; int line; int column; jj_consume_token(HOOK); line = token.beginLine; column = token.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case EXTENDS: case SUPER: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case EXTENDS: jj_consume_token(EXTENDS); ext = ReferenceType(); break; case SUPER: jj_consume_token(SUPER); sup = ReferenceType(); break; default: jj_la1[54] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: jj_la1[55] = jj_gen; ; } { if (true) { return new WildcardType(line, column, token.endLine, token.endColumn, ext, sup); } } throw new Error("Missing return statement in function"); } final public PrimitiveType PrimitiveType() throws ParseException { PrimitiveType ret; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: jj_consume_token(BOOLEAN); ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Boolean); break; case CHAR: jj_consume_token(CHAR); ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Char); break; case BYTE: jj_consume_token(BYTE); ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Byte); break; case SHORT: jj_consume_token(SHORT); ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Short); break; case INT: jj_consume_token(INT); ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Int); break; case LONG: jj_consume_token(LONG); ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Long); break; case FLOAT: jj_consume_token(FLOAT); ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Float); break; case DOUBLE: jj_consume_token(DOUBLE); ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Double); break; default: jj_la1[56] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Type ResultType() throws ParseException { Type ret; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case VOID: jj_consume_token(VOID); ret = new VoidType(token.beginLine, token.beginColumn, token.endLine, token.endColumn); break; case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: case IDENTIFIER: ret = Type(); break; default: jj_la1[57] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public NameExpr Name() throws ParseException { NameExpr ret; jj_consume_token(IDENTIFIER); ret = new NameExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); label_23: while (true) { if (jj_2_17(2)) { ; } else { break label_23; } jj_consume_token(DOT); jj_consume_token(IDENTIFIER); ret = new QualifiedNameExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, token.image); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public List NameList() throws ParseException { List ret = new LinkedList(); NameExpr name; name = Name(); ret.add(name); label_24: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[58] = jj_gen; break label_24; } jj_consume_token(COMMA); name = Name(); ret.add(name); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } /* * Expression syntax follows. */ final public Expression Expression() throws ParseException { Expression ret; AssignExpr.Operator op; Expression value; ret = ConditionalExpression(); if (jj_2_18(2)) { op = AssignmentOperator(); value = Expression(); ret = new AssignExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, value, op); } else { ; } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public AssignExpr.Operator AssignmentOperator() throws ParseException { AssignExpr.Operator ret; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ASSIGN: jj_consume_token(ASSIGN); ret = AssignExpr.Operator.assign; break; case STARASSIGN: jj_consume_token(STARASSIGN); ret = AssignExpr.Operator.star; break; case SLASHASSIGN: jj_consume_token(SLASHASSIGN); ret = AssignExpr.Operator.slash; break; case REMASSIGN: jj_consume_token(REMASSIGN); ret = AssignExpr.Operator.rem; break; case PLUSASSIGN: jj_consume_token(PLUSASSIGN); ret = AssignExpr.Operator.plus; break; case MINUSASSIGN: jj_consume_token(MINUSASSIGN); ret = AssignExpr.Operator.minus; break; case LSHIFTASSIGN: jj_consume_token(LSHIFTASSIGN); ret = AssignExpr.Operator.lShift; break; case RSIGNEDSHIFTASSIGN: jj_consume_token(RSIGNEDSHIFTASSIGN); ret = AssignExpr.Operator.rSignedShift; break; case RUNSIGNEDSHIFTASSIGN: jj_consume_token(RUNSIGNEDSHIFTASSIGN); ret = AssignExpr.Operator.rUnsignedShift; break; case ANDASSIGN: jj_consume_token(ANDASSIGN); ret = AssignExpr.Operator.and; break; case XORASSIGN: jj_consume_token(XORASSIGN); ret = AssignExpr.Operator.xor; break; case ORASSIGN: jj_consume_token(ORASSIGN); ret = AssignExpr.Operator.or; break; default: jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression ConditionalExpression() throws ParseException { Expression ret; Expression left; Expression right; ret = ConditionalOrExpression(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case HOOK: jj_consume_token(HOOK); left = Expression(); jj_consume_token(COLON); right = ConditionalExpression(); ret = new ConditionalExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, left, right); break; default: jj_la1[60] = jj_gen; ; } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression ConditionalOrExpression() throws ParseException { Expression ret; Expression right; ret = ConditionalAndExpression(); label_25: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case SC_OR: ; break; default: jj_la1[61] = jj_gen; break label_25; } jj_consume_token(SC_OR); right = ConditionalAndExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.or); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression ConditionalAndExpression() throws ParseException { Expression ret; Expression right; ret = InclusiveOrExpression(); label_26: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case SC_AND: ; break; default: jj_la1[62] = jj_gen; break label_26; } jj_consume_token(SC_AND); right = InclusiveOrExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.and); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression InclusiveOrExpression() throws ParseException { Expression ret; Expression right; ret = ExclusiveOrExpression(); label_27: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BIT_OR: ; break; default: jj_la1[63] = jj_gen; break label_27; } jj_consume_token(BIT_OR); right = ExclusiveOrExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binOr); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression ExclusiveOrExpression() throws ParseException { Expression ret; Expression right; ret = AndExpression(); label_28: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case XOR: ; break; default: jj_la1[64] = jj_gen; break label_28; } jj_consume_token(XOR); right = AndExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.xor); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression AndExpression() throws ParseException { Expression ret; Expression right; ret = EqualityExpression(); label_29: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BIT_AND: ; break; default: jj_la1[65] = jj_gen; break label_29; } jj_consume_token(BIT_AND); right = EqualityExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binAnd); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression EqualityExpression() throws ParseException { Expression ret; Expression right; BinaryExpr.Operator op; ret = InstanceOfExpression(); label_30: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case EQ: case NE: ; break; default: jj_la1[66] = jj_gen; break label_30; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case EQ: jj_consume_token(EQ); op = BinaryExpr.Operator.equals; break; case NE: jj_consume_token(NE); op = BinaryExpr.Operator.notEquals; break; default: jj_la1[67] = jj_gen; jj_consume_token(-1); throw new ParseException(); } right = InstanceOfExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression InstanceOfExpression() throws ParseException { Expression ret; Type type; ret = RelationalExpression(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INSTANCEOF: jj_consume_token(INSTANCEOF); type = Type(); ret = new InstanceOfExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, type); break; default: jj_la1[68] = jj_gen; ; } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression RelationalExpression() throws ParseException { Expression ret; Expression right; BinaryExpr.Operator op; ret = ShiftExpression(); label_31: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: case LE: case GE: case GT: ; break; default: jj_la1[69] = jj_gen; break label_31; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: jj_consume_token(LT); op = BinaryExpr.Operator.less; break; case GT: jj_consume_token(GT); op = BinaryExpr.Operator.greater; break; case LE: jj_consume_token(LE); op = BinaryExpr.Operator.lessEquals; break; case GE: jj_consume_token(GE); op = BinaryExpr.Operator.greaterEquals; break; default: jj_la1[70] = jj_gen; jj_consume_token(-1); throw new ParseException(); } right = ShiftExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression ShiftExpression() throws ParseException { Expression ret; Expression right; BinaryExpr.Operator op; ret = AdditiveExpression(); label_32: while (true) { if (jj_2_19(1)) { ; } else { break label_32; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LSHIFT: jj_consume_token(LSHIFT); op = BinaryExpr.Operator.lShift; break; default: jj_la1[71] = jj_gen; if (jj_2_20(1)) { RSIGNEDSHIFT(); op = BinaryExpr.Operator.rSignedShift; } else if (jj_2_21(1)) { RUNSIGNEDSHIFT(); op = BinaryExpr.Operator.rUnsignedShift; } else { jj_consume_token(-1); throw new ParseException(); } } right = AdditiveExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression AdditiveExpression() throws ParseException { Expression ret; Expression right; BinaryExpr.Operator op; ret = MultiplicativeExpression(); label_33: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case PLUS: case MINUS: ; break; default: jj_la1[72] = jj_gen; break label_33; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case PLUS: jj_consume_token(PLUS); op = BinaryExpr.Operator.plus; break; case MINUS: jj_consume_token(MINUS); op = BinaryExpr.Operator.minus; break; default: jj_la1[73] = jj_gen; jj_consume_token(-1); throw new ParseException(); } right = MultiplicativeExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression MultiplicativeExpression() throws ParseException { Expression ret; Expression right; BinaryExpr.Operator op; ret = UnaryExpression(); label_34: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case STAR: case SLASH: case REM: ; break; default: jj_la1[74] = jj_gen; break label_34; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case STAR: jj_consume_token(STAR); op = BinaryExpr.Operator.times; break; case SLASH: jj_consume_token(SLASH); op = BinaryExpr.Operator.divide; break; case REM: jj_consume_token(REM); op = BinaryExpr.Operator.remainder; break; default: jj_la1[75] = jj_gen; jj_consume_token(-1); throw new ParseException(); } right = UnaryExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression UnaryExpression() throws ParseException { Expression ret; UnaryExpr.Operator op; int line = 0; int column = 0; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INCR: ret = PreIncrementExpression(); break; case DECR: ret = PreDecrementExpression(); break; case PLUS: case MINUS: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case PLUS: jj_consume_token(PLUS); op = UnaryExpr.Operator.positive; line = token.beginLine; column = token.beginColumn; break; case MINUS: jj_consume_token(MINUS); op = UnaryExpr.Operator.negative; line = token.beginLine; column = token.beginColumn; break; default: jj_la1[76] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ret = UnaryExpression(); if (op == UnaryExpr.Operator.negative) { if (ret instanceof IntegerLiteralExpr && ((IntegerLiteralExpr) ret).isMinValue()) { ret = new IntegerLiteralMinValueExpr(line, column, token.endLine, token.endColumn); } else if (ret instanceof LongLiteralExpr && ((LongLiteralExpr) ret).isMinValue()) { ret = new LongLiteralMinValueExpr(line, column, token.endLine, token.endColumn); } else { ret = new UnaryExpr(line, column, token.endLine, token.endColumn, ret, op); } } else { ret = new UnaryExpr(line, column, token.endLine, token.endColumn, ret, op); } break; case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case BANG: case TILDE: ret = UnaryExpressionNotPlusMinus(); break; default: jj_la1[77] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression PreIncrementExpression() throws ParseException { Expression ret; int line; int column; jj_consume_token(INCR); line = token.beginLine; column = token.beginColumn; ret = UnaryExpression(); ret = new UnaryExpr(line, column, token.endLine, token.endColumn, ret, UnaryExpr.Operator.preIncrement); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression PreDecrementExpression() throws ParseException { Expression ret; int line; int column; jj_consume_token(DECR); line = token.beginLine; column = token.beginColumn; ret = UnaryExpression(); ret = new UnaryExpr(line, column, token.endLine, token.endColumn, ret, UnaryExpr.Operator.preDecrement); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression UnaryExpressionNotPlusMinus() throws ParseException { Expression ret; UnaryExpr.Operator op; int line = 0; int column = 0; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BANG: case TILDE: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case TILDE: jj_consume_token(TILDE); op = UnaryExpr.Operator.inverse; line = token.beginLine; column = token.beginColumn; break; case BANG: jj_consume_token(BANG); op = UnaryExpr.Operator.not; line = token.beginLine; column = token.beginColumn; break; default: jj_la1[78] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ret = UnaryExpression(); ret = new UnaryExpr(line, column, token.endLine, token.endColumn, ret, op); break; default: jj_la1[79] = jj_gen; if (jj_2_22(2147483647)) { ret = CastExpression(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: ret = PostfixExpression(); break; default: jj_la1[80] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression PostfixExpression() throws ParseException { Expression ret; UnaryExpr.Operator op; ret = PrimaryExpression(); if (jj_2_23(2)) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INCR: jj_consume_token(INCR); op = UnaryExpr.Operator.posIncrement; break; case DECR: jj_consume_token(DECR); op = UnaryExpr.Operator.posDecrement; break; default: jj_la1[81] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ret = new UnaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, op); } else { ; } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression CastExpression() throws ParseException { Expression ret; Type type; int line; int column; jj_consume_token(LPAREN); line = token.beginLine; column = token.beginColumn; if (jj_2_24(2)) { type = PrimitiveType(); jj_consume_token(RPAREN); ret = UnaryExpression(); ret = new CastExpr(line, column, token.endLine, token.endColumn, type, ret); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: case IDENTIFIER: type = ReferenceType(); jj_consume_token(RPAREN); ret = UnaryExpressionNotPlusMinus(); ret = new CastExpr(line, column, token.endLine, token.endColumn, type, ret); break; default: jj_la1[82] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression PrimaryExpression() throws ParseException { Expression ret; Expression inner; ret = PrimaryPrefix(); label_35: while (true) { if (jj_2_25(2)) { ; } else { break label_35; } ret = PrimarySuffix(ret); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression PrimaryExpressionWithoutSuperSuffix() throws ParseException { Expression ret; Expression inner; ret = PrimaryPrefix(); label_36: while (true) { if (jj_2_26(2147483647)) { ; } else { break label_36; } ret = PrimarySuffixWithoutSuper(ret); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression PrimaryPrefix() throws ParseException { Expression ret; String name; List typeArgs = null; List args = null; boolean hasArgs = false; Type type; int line; int column; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case FALSE: case NULL: case TRUE: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: ret = Literal(); break; case THIS: jj_consume_token(THIS); ret = new ThisExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, null); break; case SUPER: jj_consume_token(SUPER); ret = new SuperExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, null); jj_consume_token(DOT); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: typeArgs = TypeArguments(); typeArgs.remove(0); break; default: jj_la1[83] = jj_gen; ; } jj_consume_token(IDENTIFIER); name = token.image; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LPAREN: args = Arguments(); hasArgs = true; break; default: jj_la1[84] = jj_gen; ; } ret = hasArgs ? new MethodCallExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, typeArgs, name, args) : new FieldAccessExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, null, name); break; case LPAREN: jj_consume_token(LPAREN); line = token.beginLine; column = token.beginColumn; ret = Expression(); jj_consume_token(RPAREN); ret = new EnclosedExpr(line, column, token.endLine, token.endColumn, ret); break; case NEW: ret = AllocationExpression(null); break; default: jj_la1[86] = jj_gen; if (jj_2_27(2147483647)) { type = ResultType(); jj_consume_token(DOT); jj_consume_token(CLASS); ret = new ClassExpr(type.getBeginLine(), type.getBeginColumn(), token.endLine, token.endColumn, type); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IDENTIFIER: jj_consume_token(IDENTIFIER); name = token.image; line = token.beginLine; column = token.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LPAREN: args = Arguments(); hasArgs = true; break; default: jj_la1[85] = jj_gen; ; } ret = hasArgs ? new MethodCallExpr(line, column, token.endLine, token.endColumn, null, null, name, args) : new NameExpr(line, column, token.endLine, token.endColumn, name); break; default: jj_la1[87] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression PrimarySuffix(Expression scope) throws ParseException { Expression ret; if (jj_2_28(2)) { ret = PrimarySuffixWithoutSuper(scope); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case DOT: jj_consume_token(DOT); jj_consume_token(SUPER); ret = new SuperExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope); break; default: jj_la1[88] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression PrimarySuffixWithoutSuper(Expression scope) throws ParseException { Expression ret; List typeArgs = null; List args = null; boolean hasArgs = false; String name; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case DOT: jj_consume_token(DOT); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case THIS: jj_consume_token(THIS); ret = new ThisExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope); break; case NEW: ret = AllocationExpression(scope); break; default: jj_la1[91] = jj_gen; if (jj_2_29(2147483647)) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: typeArgs = TypeArguments(); typeArgs.remove(0); break; default: jj_la1[89] = jj_gen; ; } jj_consume_token(IDENTIFIER); name = token.image; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LPAREN: args = Arguments(); hasArgs = true; break; default: jj_la1[90] = jj_gen; ; } ret = hasArgs ? new MethodCallExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, typeArgs, name, args) : new FieldAccessExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, typeArgs, name); } else { jj_consume_token(-1); throw new ParseException(); } } break; case LBRACKET: jj_consume_token(LBRACKET); ret = Expression(); jj_consume_token(RBRACKET); ret = new ArrayAccessExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, ret); break; default: jj_la1[92] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression Literal() throws ParseException { Expression ret; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: jj_consume_token(INTEGER_LITERAL); ret = new IntegerLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); break; case LONG_LITERAL: jj_consume_token(LONG_LITERAL); ret = new LongLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); break; case FLOATING_POINT_LITERAL: jj_consume_token(FLOATING_POINT_LITERAL); ret = new DoubleLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); break; case CHARACTER_LITERAL: jj_consume_token(CHARACTER_LITERAL); ret = new CharLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image.substring(1, token.image.length() - 1)); break; case STRING_LITERAL: jj_consume_token(STRING_LITERAL); ret = new StringLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image.substring(1, token.image.length() - 1)); break; case FALSE: case TRUE: ret = BooleanLiteral(); break; case NULL: ret = NullLiteral(); break; default: jj_la1[93] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression BooleanLiteral() throws ParseException { Expression ret; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case TRUE: jj_consume_token(TRUE); ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, true); break; case FALSE: jj_consume_token(FALSE); ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, false); break; default: jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression NullLiteral() throws ParseException { jj_consume_token(NULL); { if (true) { return new NullLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn); } } throw new Error("Missing return statement in function"); } final public List Arguments() throws ParseException { List ret = null; jj_consume_token(LPAREN); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: ret = ArgumentList(); break; default: jj_la1[95] = jj_gen; ; } jj_consume_token(RPAREN); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public List ArgumentList() throws ParseException { List ret = new LinkedList(); Expression expr; expr = Expression(); ret.add(expr); label_37: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[96] = jj_gen; break label_37; } jj_consume_token(COMMA); expr = Expression(); ret.add(expr); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression AllocationExpression(Expression scope) throws ParseException { Expression ret; Type type; Object[] arr = null; List typeArgs = null; List anonymousBody = null; List args; int line; int column; jj_consume_token(NEW); if (scope == null) { line = token.beginLine; column = token.beginColumn; } else { line = scope.getBeginLine(); column = scope.getBeginColumn(); } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: type = PrimitiveType(); arr = ArrayDimsAndInits(); if (arr[0] instanceof Integer) { ret = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, ((Integer) arr[0]).intValue(), (ArrayInitializerExpr) arr[1]); } else { ret = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, (List) arr[0], ((Integer) arr[1]).intValue()); } break; default: jj_la1[98] = jj_gen; if (jj_2_31(2147483647)) { type = ClassOrInterfaceType(); arr = ArrayDimsAndInits(); if (arr[0] instanceof Integer) { ret = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, ((Integer) arr[0]).intValue(), (ArrayInitializerExpr) arr[1]); } else { ret = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, (List) arr[0], ((Integer) arr[1]).intValue()); } } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IDENTIFIER: case LT: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LT: typeArgs = TypeArguments(); typeArgs.remove(0); break; default: jj_la1[97] = jj_gen; ; } type = ClassOrInterfaceType(); args = Arguments(); if (jj_2_30(2)) { anonymousBody = ClassOrInterfaceBody(false); } else { ; } ret = new ObjectCreationExpr(line, column, token.endLine, token.endColumn, scope, (ClassOrInterfaceType) type, typeArgs, args, anonymousBody); break; default: jj_la1[99] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ final public Object[] ArrayDimsAndInits() throws ParseException { Object[] ret = new Object[2]; Expression expr; List inits = null; int i = 0; if (jj_2_34(2)) { label_38: while (true) { jj_consume_token(LBRACKET); expr = Expression(); inits = add(inits, expr); jj_consume_token(RBRACKET); if (jj_2_32(2)) { ; } else { break label_38; } } label_39: while (true) { if (jj_2_33(2)) { ; } else { break label_39; } jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); i++; } ret[0] = inits; ret[1] = new Integer(i); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LBRACKET: label_40: while (true) { jj_consume_token(LBRACKET); jj_consume_token(RBRACKET); i++; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case LBRACKET: ; break; default: jj_la1[100] = jj_gen; break label_40; } } expr = ArrayInitializer(); ret[0] = new Integer(i); ret[1] = expr; break; default: jj_la1[101] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } /* * Statement syntax follows. */ final public Statement Statement() throws ParseException { Statement ret; if (jj_2_35(2)) { ret = LabeledStatement(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ASSERT: ret = AssertStatement(); break; case LBRACE: ret = Block(); break; case SEMICOLON: ret = EmptyStatement(); break; case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case INCR: case DECR: ret = StatementExpression(); break; case SWITCH: ret = SwitchStatement(); break; case IF: ret = IfStatement(); break; case WHILE: ret = WhileStatement(); break; case DO: ret = DoStatement(); break; case FOR: ret = ForStatement(); break; case BREAK: ret = BreakStatement(); break; case CONTINUE: ret = ContinueStatement(); break; case RETURN: ret = ReturnStatement(); break; case THROW: ret = ThrowStatement(); break; case SYNCHRONIZED: ret = SynchronizedStatement(); break; case TRY: ret = TryStatement(); break; default: jj_la1[102] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public AssertStmt AssertStatement() throws ParseException { Expression check; Expression msg = null; int line; int column; jj_consume_token(ASSERT); line = token.beginLine; column = token.beginColumn; check = Expression(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COLON: jj_consume_token(COLON); msg = Expression(); break; default: jj_la1[103] = jj_gen; ; } jj_consume_token(SEMICOLON); { if (true) { return new AssertStmt(line, column, token.endLine, token.endColumn, check, msg); } } throw new Error("Missing return statement in function"); } final public LabeledStmt LabeledStatement() throws ParseException { String label; Statement stmt; int line; int column; jj_consume_token(IDENTIFIER); line = token.beginLine; column = token.beginColumn; label = token.image; jj_consume_token(COLON); stmt = Statement(); { if (true) { return new LabeledStmt(line, column, token.endLine, token.endColumn, label, stmt); } } throw new Error("Missing return statement in function"); } final public BlockStmt Block() throws ParseException { List stmts; int beginLine; int beginColumn; jj_consume_token(LBRACE); beginLine = token.beginLine; beginColumn = token.beginColumn; stmts = Statements(); jj_consume_token(RBRACE); { if (true) { return new BlockStmt(beginLine, beginColumn, token.endLine, token.endColumn, stmts); } } throw new Error("Missing return statement in function"); } /* * Classes inside block stametents can only be abstract or final. The semantic must check it. */ final public Statement BlockStatement() throws ParseException { Statement ret; Expression expr; ClassOrInterfaceDeclaration typeDecl; Modifier modifier; if (jj_2_36(2147483647)) { pushJavadoc(); modifier = Modifiers(); typeDecl = ClassOrInterfaceDeclaration(modifier); ret = new TypeDeclarationStmt(typeDecl.getBeginLine(), typeDecl.getBeginColumn(), token.endLine, token.endColumn, typeDecl); } else if (jj_2_37(2147483647)) { expr = VariableDeclarationExpression(); jj_consume_token(SEMICOLON); ret = new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ASSERT: case BOOLEAN: case BREAK: case BYTE: case CHAR: case CONTINUE: case DO: case DOUBLE: case FALSE: case FLOAT: case FOR: case IF: case INT: case LONG: case NEW: case NULL: case RETURN: case SHORT: case SUPER: case SWITCH: case SYNCHRONIZED: case THIS: case THROW: case TRUE: case TRY: case VOID: case WHILE: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case LBRACE: case SEMICOLON: case INCR: case DECR: ret = Statement(); break; default: jj_la1[104] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public VariableDeclarationExpr VariableDeclarationExpression() throws ParseException { Modifier modifier; Type type; List vars = new LinkedList(); VariableDeclarator var; modifier = Modifiers(); type = Type(); var = VariableDeclarator(); vars.add(var); label_41: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[105] = jj_gen; break label_41; } jj_consume_token(COMMA); var = VariableDeclarator(); vars.add(var); } int line = modifier.beginLine; int column = modifier.beginColumn; if (line == -1) { line = type.getBeginLine(); column = type.getBeginColumn(); } { if (true) { return new VariableDeclarationExpr(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, vars); } } throw new Error("Missing return statement in function"); } final public EmptyStmt EmptyStatement() throws ParseException { jj_consume_token(SEMICOLON); { if (true) { return new EmptyStmt(token.beginLine, token.beginColumn, token.endLine, token.endColumn); } } throw new Error("Missing return statement in function"); } final public ExpressionStmt StatementExpression() throws ParseException { Expression expr; AssignExpr.Operator op; Expression value; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INCR: expr = PreIncrementExpression(); break; case DECR: expr = PreDecrementExpression(); break; case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: expr = PrimaryExpression(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ASSIGN: case INCR: case DECR: case PLUSASSIGN: case MINUSASSIGN: case STARASSIGN: case SLASHASSIGN: case ANDASSIGN: case ORASSIGN: case XORASSIGN: case REMASSIGN: case LSHIFTASSIGN: case RSIGNEDSHIFTASSIGN: case RUNSIGNEDSHIFTASSIGN: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INCR: jj_consume_token(INCR); expr = new UnaryExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, UnaryExpr.Operator.posIncrement); break; case DECR: jj_consume_token(DECR); expr = new UnaryExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, UnaryExpr.Operator.posDecrement); break; case ASSIGN: case PLUSASSIGN: case MINUSASSIGN: case STARASSIGN: case SLASHASSIGN: case ANDASSIGN: case ORASSIGN: case XORASSIGN: case REMASSIGN: case LSHIFTASSIGN: case RSIGNEDSHIFTASSIGN: case RUNSIGNEDSHIFTASSIGN: op = AssignmentOperator(); value = Expression(); expr = new AssignExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, value, op); break; default: jj_la1[106] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: jj_la1[107] = jj_gen; ; } break; default: jj_la1[108] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(SEMICOLON); { if (true) { return new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr); } } throw new Error("Missing return statement in function"); } final public SwitchStmt SwitchStatement() throws ParseException { Expression selector; SwitchEntryStmt entry; List entries = null; int line; int column; jj_consume_token(SWITCH); line = token.beginLine; column = token.beginColumn; jj_consume_token(LPAREN); selector = Expression(); jj_consume_token(RPAREN); jj_consume_token(LBRACE); label_42: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case CASE: case _DEFAULT: ; break; default: jj_la1[109] = jj_gen; break label_42; } entry = SwitchEntry(); entries = add(entries, entry); } jj_consume_token(RBRACE); { if (true) { return new SwitchStmt(line, column, token.endLine, token.endColumn, selector, entries); } } throw new Error("Missing return statement in function"); } final public SwitchEntryStmt SwitchEntry() throws ParseException { Expression label = null; List stmts; int line; int column; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case CASE: jj_consume_token(CASE); line = token.beginLine; column = token.beginColumn; label = Expression(); break; case _DEFAULT: jj_consume_token(_DEFAULT); line = token.beginLine; column = token.beginColumn; break; default: jj_la1[110] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(COLON); stmts = Statements(); { if (true) { return new SwitchEntryStmt(line, column, token.endLine, token.endColumn, label, stmts); } } throw new Error("Missing return statement in function"); } final public IfStmt IfStatement() throws ParseException { Expression condition; Statement thenStmt; Statement elseStmt = null; int line; int column; jj_consume_token(IF); line = token.beginLine; column = token.beginColumn; jj_consume_token(LPAREN); condition = Expression(); jj_consume_token(RPAREN); thenStmt = Statement(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ELSE: jj_consume_token(ELSE); elseStmt = Statement(); break; default: jj_la1[111] = jj_gen; ; } { if (true) { return new IfStmt(line, column, token.endLine, token.endColumn, condition, thenStmt, elseStmt); } } throw new Error("Missing return statement in function"); } final public WhileStmt WhileStatement() throws ParseException { Expression condition; Statement body; int line; int column; jj_consume_token(WHILE); line = token.beginLine; column = token.beginColumn; jj_consume_token(LPAREN); condition = Expression(); jj_consume_token(RPAREN); body = Statement(); { if (true) { return new WhileStmt(line, column, token.endLine, token.endColumn, condition, body); } } throw new Error("Missing return statement in function"); } final public DoStmt DoStatement() throws ParseException { Expression condition; Statement body; int line; int column; jj_consume_token(DO); line = token.beginLine; column = token.beginColumn; body = Statement(); jj_consume_token(WHILE); jj_consume_token(LPAREN); condition = Expression(); jj_consume_token(RPAREN); jj_consume_token(SEMICOLON); { if (true) { return new DoStmt(line, column, token.endLine, token.endColumn, body, condition); } } throw new Error("Missing return statement in function"); } final public Statement ForStatement() throws ParseException { String id = null; VariableDeclarationExpr varExpr = null; Expression expr = null; List init = null; List update = null; Statement body; int line; int column; jj_consume_token(FOR); line = token.beginLine; column = token.beginColumn; jj_consume_token(LPAREN); if (jj_2_38(2147483647)) { varExpr = VariableDeclarationExpression(); jj_consume_token(COLON); expr = Expression(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ABSTRACT: case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FINAL: case FLOAT: case INT: case LONG: case NATIVE: case NEW: case NULL: case PRIVATE: case PROTECTED: case PUBLIC: case SHORT: case STATIC: case STRICTFP: case SUPER: case SYNCHRONIZED: case THIS: case TRANSIENT: case TRUE: case VOID: case VOLATILE: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case SEMICOLON: case AT: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ABSTRACT: case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FINAL: case FLOAT: case INT: case LONG: case NATIVE: case NEW: case NULL: case PRIVATE: case PROTECTED: case PUBLIC: case SHORT: case STATIC: case STRICTFP: case SUPER: case SYNCHRONIZED: case THIS: case TRANSIENT: case TRUE: case VOID: case VOLATILE: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case AT: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: init = ForInit(); break; default: jj_la1[112] = jj_gen; ; } jj_consume_token(SEMICOLON); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: expr = Expression(); break; default: jj_la1[113] = jj_gen; ; } jj_consume_token(SEMICOLON); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: update = ForUpdate(); break; default: jj_la1[114] = jj_gen; ; } break; default: jj_la1[115] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(RPAREN); body = Statement(); if (varExpr != null) { { if (true) { return new ForeachStmt(line, column, token.endLine, token.endColumn, varExpr, expr, body); } } } { if (true) { return new ForStmt(line, column, token.endLine, token.endColumn, init, expr, update, body); } } throw new Error("Missing return statement in function"); } final public List ForInit() throws ParseException { List ret; Expression expr; if (jj_2_39(2147483647)) { expr = VariableDeclarationExpression(); ret = new LinkedList(); ret.add(expr); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: ret = ExpressionList(); break; default: jj_la1[116] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public List ExpressionList() throws ParseException { List ret = new LinkedList(); Expression expr; expr = Expression(); ret.add(expr); label_43: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[117] = jj_gen; break label_43; } jj_consume_token(COMMA); expr = Expression(); ret.add(expr); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public List ForUpdate() throws ParseException { List ret; ret = ExpressionList(); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public BreakStmt BreakStatement() throws ParseException { String id = null; int line; int column; jj_consume_token(BREAK); line = token.beginLine; column = token.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IDENTIFIER: jj_consume_token(IDENTIFIER); id = token.image; break; default: jj_la1[118] = jj_gen; ; } jj_consume_token(SEMICOLON); { if (true) { return new BreakStmt(line, column, token.endLine, token.endColumn, id); } } throw new Error("Missing return statement in function"); } final public ContinueStmt ContinueStatement() throws ParseException { String id = null; int line; int column; jj_consume_token(CONTINUE); line = token.beginLine; column = token.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IDENTIFIER: jj_consume_token(IDENTIFIER); id = token.image; break; default: jj_la1[119] = jj_gen; ; } jj_consume_token(SEMICOLON); { if (true) { return new ContinueStmt(line, column, token.endLine, token.endColumn, id); } } throw new Error("Missing return statement in function"); } final public ReturnStmt ReturnStatement() throws ParseException { Expression expr = null; int line; int column; jj_consume_token(RETURN); line = token.beginLine; column = token.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: expr = Expression(); break; default: jj_la1[120] = jj_gen; ; } jj_consume_token(SEMICOLON); { if (true) { return new ReturnStmt(line, column, token.endLine, token.endColumn, expr); } } throw new Error("Missing return statement in function"); } final public ThrowStmt ThrowStatement() throws ParseException { Expression expr; int line; int column; jj_consume_token(THROW); line = token.beginLine; column = token.beginColumn; expr = Expression(); jj_consume_token(SEMICOLON); { if (true) { return new ThrowStmt(line, column, token.endLine, token.endColumn, expr); } } throw new Error("Missing return statement in function"); } final public SynchronizedStmt SynchronizedStatement() throws ParseException { Expression expr; BlockStmt block; int line; int column; jj_consume_token(SYNCHRONIZED); line = token.beginLine; column = token.beginColumn; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); block = Block(); { if (true) { return new SynchronizedStmt(line, column, token.endLine, token.endColumn, expr, block); } } throw new Error("Missing return statement in function"); } final public TryStmt TryStatement() throws ParseException { BlockStmt tryBlock; BlockStmt finallyBlock = null; List catchs = null; Parameter except; BlockStmt catchBlock; int line; int column; int cLine; int cColumn; jj_consume_token(TRY); line = token.beginLine; column = token.beginColumn; tryBlock = Block(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case CATCH: label_44: while (true) { jj_consume_token(CATCH); cLine = token.beginLine; cColumn = token.beginColumn; jj_consume_token(LPAREN); except = FormalParameter(); jj_consume_token(RPAREN); catchBlock = Block(); catchs = add(catchs, new CatchClause(cLine, cColumn, token.endLine, token.endColumn, except, catchBlock)); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case CATCH: ; break; default: jj_la1[121] = jj_gen; break label_44; } } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case FINALLY: jj_consume_token(FINALLY); finallyBlock = Block(); break; default: jj_la1[122] = jj_gen; ; } break; case FINALLY: jj_consume_token(FINALLY); finallyBlock = Block(); break; default: jj_la1[123] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return new TryStmt(line, column, token.endLine, token.endColumn, tryBlock, catchs, finallyBlock); } } throw new Error("Missing return statement in function"); } /* We use productions to match >>>, >> and > so that we can keep the * type declaration syntax with generics clean */ final public void RUNSIGNEDSHIFT() throws ParseException { if (getToken(1).kind == GT && ((GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT) { } else { jj_consume_token(-1); throw new ParseException(); } jj_consume_token(GT); jj_consume_token(GT); jj_consume_token(GT); } final public void RSIGNEDSHIFT() throws ParseException { if (getToken(1).kind == GT && ((GTToken) getToken(1)).realKind == RSIGNEDSHIFT) { } else { jj_consume_token(-1); throw new ParseException(); } jj_consume_token(GT); jj_consume_token(GT); } /* Annotation syntax follows. */ final public AnnotationExpr Annotation() throws ParseException { AnnotationExpr ret; if (jj_2_40(2147483647)) { ret = NormalAnnotation(); } else if (jj_2_41(2147483647)) { ret = SingleMemberAnnotation(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case AT: ret = MarkerAnnotation(); break; default: jj_la1[124] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public NormalAnnotationExpr NormalAnnotation() throws ParseException { NameExpr name; List pairs = null; int line; int column; jj_consume_token(AT); line = token.beginLine; column = token.beginColumn; name = Name(); jj_consume_token(LPAREN); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IDENTIFIER: pairs = MemberValuePairs(); break; default: jj_la1[125] = jj_gen; ; } jj_consume_token(RPAREN); { if (true) { return new NormalAnnotationExpr(line, column, token.endLine, token.endColumn, name, pairs); } } throw new Error("Missing return statement in function"); } final public MarkerAnnotationExpr MarkerAnnotation() throws ParseException { NameExpr name; int line; int column; jj_consume_token(AT); line = token.beginLine; column = token.beginColumn; name = Name(); { if (true) { return new MarkerAnnotationExpr(line, column, token.endLine, token.endColumn, name); } } throw new Error("Missing return statement in function"); } final public SingleMemberAnnotationExpr SingleMemberAnnotation() throws ParseException { NameExpr name; Expression memberVal; int line; int column; jj_consume_token(AT); line = token.beginLine; column = token.beginColumn; name = Name(); jj_consume_token(LPAREN); memberVal = MemberValue(); jj_consume_token(RPAREN); { if (true) { return new SingleMemberAnnotationExpr(line, column, token.endLine, token.endColumn, name, memberVal); } } throw new Error("Missing return statement in function"); } final public List MemberValuePairs() throws ParseException { List ret = new LinkedList(); MemberValuePair pair; pair = MemberValuePair(); ret.add(pair); label_45: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[126] = jj_gen; break label_45; } jj_consume_token(COMMA); pair = MemberValuePair(); ret.add(pair); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public MemberValuePair MemberValuePair() throws ParseException { String name; Expression value; int line; int column; jj_consume_token(IDENTIFIER); name = token.image; line = token.beginLine; column = token.beginColumn; jj_consume_token(ASSIGN); value = MemberValue(); { if (true) { return new MemberValuePair(line, column, token.endLine, token.endColumn, name, value); } } throw new Error("Missing return statement in function"); } final public Expression MemberValue() throws ParseException { Expression ret; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case AT: ret = Annotation(); break; case LBRACE: ret = MemberValueArrayInitializer(); break; case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: ret = ConditionalExpression(); break; default: jj_la1[127] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public Expression MemberValueArrayInitializer() throws ParseException { List ret = new LinkedList(); Expression member; int line; int column; jj_consume_token(LBRACE); line = token.beginLine; column = token.beginColumn; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FALSE: case FLOAT: case INT: case LONG: case NEW: case NULL: case SHORT: case SUPER: case THIS: case TRUE: case VOID: case LONG_LITERAL: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case IDENTIFIER: case LPAREN: case LBRACE: case AT: case BANG: case TILDE: case INCR: case DECR: case PLUS: case MINUS: member = MemberValue(); ret.add(member); label_46: while (true) { if (jj_2_42(2)) { ; } else { break label_46; } jj_consume_token(COMMA); member = MemberValue(); ret.add(member); } break; default: jj_la1[128] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: jj_consume_token(COMMA); break; default: jj_la1[129] = jj_gen; ; } jj_consume_token(RBRACE); { if (true) { return new ArrayInitializerExpr(line, column, token.endLine, token.endColumn, ret); } } throw new Error("Missing return statement in function"); } /* Annotation Types. */ final public AnnotationDeclaration AnnotationTypeDeclaration(Modifier modifier) throws ParseException { String name; List members; int line = modifier.beginLine; int column = modifier.beginColumn; jj_consume_token(AT); if (line == -1) { line = token.beginLine; column = token.beginColumn; } jj_consume_token(INTERFACE); jj_consume_token(IDENTIFIER); name = token.image; members = AnnotationTypeBody(); { if (true) { return new AnnotationDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, name, members); } } throw new Error("Missing return statement in function"); } final public List AnnotationTypeBody() throws ParseException { List ret = null; BodyDeclaration member; jj_consume_token(LBRACE); label_47: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ABSTRACT: case BOOLEAN: case BYTE: case CHAR: case CLASS: case DOUBLE: case ENUM: case FINAL: case FLOAT: case INT: case INTERFACE: case LONG: case NATIVE: case PRIVATE: case PROTECTED: case PUBLIC: case SHORT: case STATIC: case STRICTFP: case SYNCHRONIZED: case TRANSIENT: case VOLATILE: case IDENTIFIER: case SEMICOLON: case AT: ; break; default: jj_la1[130] = jj_gen; break label_47; } member = AnnotationBodyDeclaration(); ret = add(ret, member); } jj_consume_token(RBRACE); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public BodyDeclaration AnnotationBodyDeclaration() throws ParseException { Modifier modifier; BodyDeclaration ret; pushJavadoc(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case SEMICOLON: jj_consume_token(SEMICOLON); ret = new EmptyTypeDeclaration(token.beginLine, token.beginColumn, token.endLine, token.endColumn, popJavadoc()); break; case ABSTRACT: case BOOLEAN: case BYTE: case CHAR: case CLASS: case DOUBLE: case ENUM: case FINAL: case FLOAT: case INT: case INTERFACE: case LONG: case NATIVE: case PRIVATE: case PROTECTED: case PUBLIC: case SHORT: case STATIC: case STRICTFP: case SYNCHRONIZED: case TRANSIENT: case VOLATILE: case IDENTIFIER: case AT: modifier = Modifiers(); if (jj_2_43(2147483647)) { ret = AnnotationTypeMemberDeclaration(modifier); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case CLASS: case INTERFACE: ret = ClassOrInterfaceDeclaration(modifier); break; case ENUM: ret = EnumDeclaration(modifier); break; case AT: ret = AnnotationTypeDeclaration(modifier); break; case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: case IDENTIFIER: ret = FieldDeclaration(modifier); break; default: jj_la1[131] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; default: jj_la1[132] = jj_gen; jj_consume_token(-1); throw new ParseException(); } { if (true) { return ret; } } throw new Error("Missing return statement in function"); } final public AnnotationMemberDeclaration AnnotationTypeMemberDeclaration(Modifier modifier) throws ParseException { Type type; String name; Expression defaultVal = null; type = Type(); jj_consume_token(IDENTIFIER); name = token.image; jj_consume_token(LPAREN); jj_consume_token(RPAREN); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case _DEFAULT: defaultVal = DefaultValue(); break; default: jj_la1[133] = jj_gen; ; } jj_consume_token(SEMICOLON); int line = modifier.beginLine; int column = modifier.beginColumn; { if (line == -1) { line = type.getBeginLine(); column = type.getBeginColumn(); } } { if (true) { return new AnnotationMemberDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, type, name, defaultVal); } } throw new Error("Missing return statement in function"); } final public Expression DefaultValue() throws ParseException { Expression ret; jj_consume_token(_DEFAULT); ret = MemberValue(); { if (true) { return ret; } } throw new Error("Missing return statement in function"); } private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_2(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_3(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_4(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_5(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } } private boolean jj_2_6(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_6(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(5, xla); } } private boolean jj_2_7(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_7(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(6, xla); } } private boolean jj_2_8(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_8(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(7, xla); } } private boolean jj_2_9(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_9(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(8, xla); } } private boolean jj_2_10(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_10(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(9, xla); } } private boolean jj_2_11(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_11(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(10, xla); } } private boolean jj_2_12(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_12(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(11, xla); } } private boolean jj_2_13(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_13(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(12, xla); } } private boolean jj_2_14(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_14(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(13, xla); } } private boolean jj_2_15(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_15(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(14, xla); } } private boolean jj_2_16(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_16(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(15, xla); } } private boolean jj_2_17(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_17(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(16, xla); } } private boolean jj_2_18(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_18(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(17, xla); } } private boolean jj_2_19(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_19(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(18, xla); } } private boolean jj_2_20(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_20(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(19, xla); } } private boolean jj_2_21(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_21(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(20, xla); } } private boolean jj_2_22(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_22(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(21, xla); } } private boolean jj_2_23(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_23(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(22, xla); } } private boolean jj_2_24(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_24(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(23, xla); } } private boolean jj_2_25(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_25(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(24, xla); } } private boolean jj_2_26(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_26(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(25, xla); } } private boolean jj_2_27(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_27(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(26, xla); } } private boolean jj_2_28(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_28(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(27, xla); } } private boolean jj_2_29(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_29(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(28, xla); } } private boolean jj_2_30(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_30(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(29, xla); } } private boolean jj_2_31(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_31(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(30, xla); } } private boolean jj_2_32(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_32(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(31, xla); } } private boolean jj_2_33(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_33(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(32, xla); } } private boolean jj_2_34(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_34(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(33, xla); } } private boolean jj_2_35(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_35(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(34, xla); } } private boolean jj_2_36(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_36(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(35, xla); } } private boolean jj_2_37(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_37(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(36, xla); } } private boolean jj_2_38(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_38(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(37, xla); } } private boolean jj_2_39(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_39(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(38, xla); } } private boolean jj_2_40(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_40(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(39, xla); } } private boolean jj_2_41(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_41(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(40, xla); } } private boolean jj_2_42(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_42(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(41, xla); } } private boolean jj_2_43(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_43(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(42, xla); } } private boolean jj_3R_101() { if (jj_3R_152()) { return true; } return false; } private boolean jj_3R_176() { if (jj_scan_token(ASSIGN)) { return true; } if (jj_3R_66()) { return true; } return false; } private boolean jj_3R_212() { if (jj_3R_238()) { return true; } return false; } private boolean jj_3R_211() { if (jj_scan_token(STRING_LITERAL)) { return true; } return false; } private boolean jj_3R_210() { if (jj_scan_token(CHARACTER_LITERAL)) { return true; } return false; } private boolean jj_3R_66() { Token xsp; xsp = jj_scanpos; if (jj_3R_101()) { jj_scanpos = xsp; if (jj_3R_102()) { return true; } } return false; } private boolean jj_3R_209() { if (jj_scan_token(FLOATING_POINT_LITERAL)) { return true; } return false; } private boolean jj_3R_208() { if (jj_scan_token(LONG_LITERAL)) { return true; } return false; } private boolean jj_3R_175() { if (jj_scan_token(IDENTIFIER)) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_203()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_359() { if (jj_3R_370()) { return true; } return false; } private boolean jj_3R_207() { if (jj_scan_token(INTEGER_LITERAL)) { return true; } return false; } private boolean jj_3R_64() { if (jj_scan_token(LBRACKET)) { return true; } if (jj_scan_token(RBRACKET)) { return true; } return false; } private boolean jj_3R_84() { if (jj_3R_71()) { return true; } return false; } private boolean jj_3_29() { Token xsp; xsp = jj_scanpos; if (jj_3R_84()) { jj_scanpos = xsp; } if (jj_scan_token(IDENTIFIER)) { return true; } return false; } private boolean jj_3R_184() { Token xsp; xsp = jj_scanpos; if (jj_3R_207()) { jj_scanpos = xsp; if (jj_3R_208()) { jj_scanpos = xsp; if (jj_3R_209()) { jj_scanpos = xsp; if (jj_3R_210()) { jj_scanpos = xsp; if (jj_3R_211()) { jj_scanpos = xsp; if (jj_3R_212()) { jj_scanpos = xsp; if (jj_3R_213()) { return true; } } } } } } } return false; } private boolean jj_3R_141() { if (jj_3R_175()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_176()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_136() { if (jj_scan_token(LBRACKET)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(RBRACKET)) { return true; } return false; } private boolean jj_3R_199() { if (jj_3R_154()) { return true; } return false; } private boolean jj_3R_181() { if (jj_3R_204()) { return true; } return false; } private boolean jj_3R_198() { if (jj_3R_71()) { return true; } return false; } private boolean jj_3R_172() { Token xsp; xsp = jj_scanpos; if (jj_3R_198()) { jj_scanpos = xsp; } if (jj_scan_token(IDENTIFIER)) { return true; } xsp = jj_scanpos; if (jj_3R_199()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_171() { if (jj_3R_187()) { return true; } return false; } private boolean jj_3R_170() { if (jj_scan_token(THIS)) { return true; } return false; } private boolean jj_3R_319() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_141()) { return true; } return false; } private boolean jj_3_5() { if (jj_3R_63()) { return true; } if (jj_scan_token(IDENTIFIER)) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_64()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; if (jj_scan_token(87)) { jj_scanpos = xsp; if (jj_scan_token(90)) { jj_scanpos = xsp; if (jj_scan_token(86)) { return true; } } } return false; } private boolean jj_3R_62() { if (jj_3R_97()) { return true; } return false; } private boolean jj_3_4() { Token xsp; xsp = jj_scanpos; if (jj_3R_62()) { jj_scanpos = xsp; } if (jj_scan_token(IDENTIFIER)) { return true; } if (jj_scan_token(LPAREN)) { return true; } return false; } private boolean jj_3R_249() { if (jj_3R_63()) { return true; } if (jj_3R_141()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_319()) { jj_scanpos = xsp; break; } } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_135() { if (jj_scan_token(DOT)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_170()) { jj_scanpos = xsp; if (jj_3R_171()) { jj_scanpos = xsp; if (jj_3R_172()) { return true; } } } return false; } private boolean jj_3R_231() { if (jj_3R_250()) { return true; } return false; } private boolean jj_3R_201() { if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_230() { if (jj_3R_249()) { return true; } return false; } private boolean jj_3R_229() { if (jj_3R_248()) { return true; } return false; } private boolean jj_3R_82() { Token xsp; xsp = jj_scanpos; if (jj_3R_135()) { jj_scanpos = xsp; if (jj_3R_136()) { return true; } } return false; } private boolean jj_3R_228() { if (jj_3R_247()) { return true; } return false; } private boolean jj_3R_227() { if (jj_3R_246()) { return true; } return false; } private boolean jj_3R_226() { if (jj_3R_245()) { return true; } return false; } private boolean jj_3R_370() { if (jj_scan_token(_DEFAULT)) { return true; } if (jj_3R_93()) { return true; } return false; } private boolean jj_3R_134() { if (jj_scan_token(DOT)) { return true; } if (jj_scan_token(SUPER)) { return true; } return false; } private boolean jj_3_28() { if (jj_3R_82()) { return true; } return false; } private boolean jj_3R_200() { if (jj_3R_89()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_226()) { jj_scanpos = xsp; if (jj_3R_227()) { jj_scanpos = xsp; if (jj_3R_228()) { jj_scanpos = xsp; if (jj_3R_229()) { jj_scanpos = xsp; if (jj_3R_230()) { jj_scanpos = xsp; if (jj_3R_231()) { return true; } } } } } } return false; } private boolean jj_3R_188() { if (jj_3R_154()) { return true; } return false; } private boolean jj_3R_81() { Token xsp; xsp = jj_scanpos; if (jj_3_28()) { jj_scanpos = xsp; if (jj_3R_134()) { return true; } } return false; } private boolean jj_3_27() { if (jj_3R_83()) { return true; } if (jj_scan_token(DOT)) { return true; } if (jj_scan_token(CLASS)) { return true; } return false; } private boolean jj_3_6() { if (jj_3R_65()) { return true; } return false; } private boolean jj_3R_163() { if (jj_scan_token(IDENTIFIER)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_188()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_358() { if (jj_3R_63()) { return true; } if (jj_scan_token(IDENTIFIER)) { return true; } if (jj_scan_token(LPAREN)) { return true; } if (jj_scan_token(RPAREN)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_359()) { jj_scanpos = xsp; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3_43() { if (jj_3R_63()) { return true; } if (jj_scan_token(IDENTIFIER)) { return true; } if (jj_scan_token(LPAREN)) { return true; } return false; } private boolean jj_3R_354() { if (jj_3R_249()) { return true; } return false; } private boolean jj_3R_353() { if (jj_3R_247()) { return true; } return false; } private boolean jj_3R_162() { if (jj_3R_83()) { return true; } if (jj_scan_token(DOT)) { return true; } if (jj_scan_token(CLASS)) { return true; } return false; } private boolean jj_3R_352() { if (jj_3R_246()) { return true; } return false; } private boolean jj_3R_173() { Token xsp; xsp = jj_scanpos; if (jj_3_6()) { jj_scanpos = xsp; if (jj_3R_200()) { jj_scanpos = xsp; if (jj_3R_201()) { return true; } } } return false; } private boolean jj_3R_161() { if (jj_3R_187()) { return true; } return false; } private boolean jj_3R_351() { if (jj_3R_245()) { return true; } return false; } private boolean jj_3R_160() { if (jj_scan_token(LPAREN)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(RPAREN)) { return true; } return false; } private boolean jj_3R_350() { if (jj_3R_358()) { return true; } return false; } private boolean jj_3R_139() { if (jj_3R_173()) { return true; } return false; } private boolean jj_3_42() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_93()) { return true; } return false; } private boolean jj_3_26() { if (jj_3R_82()) { return true; } return false; } private boolean jj_3R_186() { if (jj_3R_154()) { return true; } return false; } private boolean jj_3R_185() { if (jj_3R_71()) { return true; } return false; } private boolean jj_3R_85() { if (jj_scan_token(LBRACE)) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_139()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RBRACE)) { return true; } return false; } private boolean jj_3R_344() { if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_345() { if (jj_3R_89()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_350()) { jj_scanpos = xsp; if (jj_3R_351()) { jj_scanpos = xsp; if (jj_3R_352()) { jj_scanpos = xsp; if (jj_3R_353()) { jj_scanpos = xsp; if (jj_3R_354()) { return true; } } } } } return false; } private boolean jj_3R_159() { if (jj_scan_token(SUPER)) { return true; } if (jj_scan_token(DOT)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_185()) { jj_scanpos = xsp; } if (jj_scan_token(IDENTIFIER)) { return true; } xsp = jj_scanpos; if (jj_3R_186()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_158() { if (jj_scan_token(THIS)) { return true; } return false; } private boolean jj_3_3() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_61()) { return true; } return false; } private boolean jj_3R_233() { if (jj_scan_token(BIT_AND)) { return true; } if (jj_3R_86()) { return true; } return false; } private boolean jj_3R_157() { if (jj_3R_184()) { return true; } return false; } private boolean jj_3R_106() { if (jj_3R_82()) { return true; } return false; } private boolean jj_3R_339() { Token xsp; xsp = jj_scanpos; if (jj_3R_344()) { jj_scanpos = xsp; if (jj_3R_345()) { return true; } } return false; } private boolean jj_3R_204() { if (jj_scan_token(EXTENDS)) { return true; } if (jj_3R_86()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_233()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_328() { if (jj_3R_339()) { return true; } return false; } private boolean jj_3R_105() { Token xsp; xsp = jj_scanpos; if (jj_3R_157()) { jj_scanpos = xsp; if (jj_3R_158()) { jj_scanpos = xsp; if (jj_3R_159()) { jj_scanpos = xsp; if (jj_3R_160()) { jj_scanpos = xsp; if (jj_3R_161()) { jj_scanpos = xsp; if (jj_3R_162()) { jj_scanpos = xsp; if (jj_3R_163()) { return true; } } } } } } } return false; } private boolean jj_3_25() { if (jj_3R_81()) { return true; } return false; } private boolean jj_3R_315() { if (jj_scan_token(LBRACE)) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_328()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RBRACE)) { return true; } return false; } private boolean jj_3R_149() { if (jj_scan_token(IDENTIFIER)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_181()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_338() { if (jj_3R_85()) { return true; } return false; } private boolean jj_3R_150() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_149()) { return true; } return false; } private boolean jj_3R_68() { if (jj_3R_105()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_106()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_247() { if (jj_scan_token(AT)) { return true; } if (jj_scan_token(INTERFACE)) { return true; } if (jj_scan_token(IDENTIFIER)) { return true; } if (jj_3R_315()) { return true; } return false; } private boolean jj_3R_97() { if (jj_scan_token(LT)) { return true; } if (jj_3R_149()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_150()) { jj_scanpos = xsp; break; } } if (jj_scan_token(GT)) { return true; } return false; } private boolean jj_3R_263() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_262()) { return true; } return false; } private boolean jj_3R_243() { if (jj_3R_105()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_25()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_281() { if (jj_3R_93()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_42()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_337() { if (jj_3R_154()) { return true; } return false; } private boolean jj_3R_125() { if (jj_3R_70()) { return true; } if (jj_scan_token(RPAREN)) { return true; } if (jj_3R_169()) { return true; } return false; } private boolean jj_3R_327() { if (jj_3R_173()) { return true; } return false; } private boolean jj_3R_96() { if (jj_3R_95()) { return true; } return false; } private boolean jj_3R_232() { if (jj_3R_251()) { return true; } return false; } private boolean jj_3_24() { if (jj_3R_80()) { return true; } if (jj_scan_token(RPAREN)) { return true; } if (jj_3R_168()) { return true; } return false; } private boolean jj_3R_61() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_96()) { jj_scanpos = xsp; break; } } if (jj_scan_token(IDENTIFIER)) { return true; } xsp = jj_scanpos; if (jj_3R_337()) { jj_scanpos = xsp; } xsp = jj_scanpos; if (jj_3R_338()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_177() { if (jj_scan_token(LBRACE)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_281()) { jj_scanpos = xsp; } xsp = jj_scanpos; if (jj_scan_token(87)) { jj_scanpos = xsp; } if (jj_scan_token(RBRACE)) { return true; } return false; } private boolean jj_3R_145() { if (jj_3R_122()) { return true; } return false; } private boolean jj_3R_314() { if (jj_scan_token(SEMICOLON)) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_327()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_144() { if (jj_3R_177()) { return true; } return false; } private boolean jj_3R_143() { if (jj_3R_95()) { return true; } return false; } private boolean jj_3R_77() { if (jj_scan_token(LPAREN)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3_24()) { jj_scanpos = xsp; if (jj_3R_125()) { return true; } } return false; } private boolean jj_3R_313() { if (jj_3R_61()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_3()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_93() { Token xsp; xsp = jj_scanpos; if (jj_3R_143()) { jj_scanpos = xsp; if (jj_3R_144()) { jj_scanpos = xsp; if (jj_3R_145()) { return true; } } } return false; } private boolean jj_3R_79() { if (jj_scan_token(DECR)) { return true; } return false; } private boolean jj_3_23() { Token xsp; xsp = jj_scanpos; if (jj_3R_78()) { jj_scanpos = xsp; if (jj_3R_79()) { return true; } } return false; } private boolean jj_3R_78() { if (jj_scan_token(INCR)) { return true; } return false; } private boolean jj_3_22() { if (jj_3R_77()) { return true; } return false; } private boolean jj_3R_312() { if (jj_3R_326()) { return true; } return false; } private boolean jj_3R_262() { if (jj_scan_token(IDENTIFIER)) { return true; } if (jj_scan_token(ASSIGN)) { return true; } if (jj_3R_93()) { return true; } return false; } private boolean jj_3R_224() { if (jj_3R_243()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3_23()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_246() { if (jj_scan_token(ENUM)) { return true; } if (jj_scan_token(IDENTIFIER)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_312()) { jj_scanpos = xsp; } if (jj_scan_token(LBRACE)) { return true; } xsp = jj_scanpos; if (jj_3R_313()) { jj_scanpos = xsp; } xsp = jj_scanpos; if (jj_scan_token(87)) { jj_scanpos = xsp; } xsp = jj_scanpos; if (jj_3R_314()) { jj_scanpos = xsp; } if (jj_scan_token(RBRACE)) { return true; } return false; } private boolean jj_3R_196() { if (jj_3R_77()) { return true; } return false; } private boolean jj_3R_197() { if (jj_3R_224()) { return true; } return false; } private boolean jj_3R_223() { if (jj_scan_token(BANG)) { return true; } return false; } private boolean jj_3R_222() { if (jj_scan_token(TILDE)) { return true; } return false; } private boolean jj_3R_195() { Token xsp; xsp = jj_scanpos; if (jj_3R_222()) { jj_scanpos = xsp; if (jj_3R_223()) { return true; } } if (jj_3R_168()) { return true; } return false; } private boolean jj_3R_251() { if (jj_3R_262()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_263()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_336() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_86()) { return true; } return false; } private boolean jj_3R_169() { Token xsp; xsp = jj_scanpos; if (jj_3R_195()) { jj_scanpos = xsp; if (jj_3R_196()) { jj_scanpos = xsp; if (jj_3R_197()) { return true; } } } return false; } private boolean jj_3R_326() { if (jj_scan_token(IMPLEMENTS)) { return true; } if (jj_3R_86()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_336()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_179() { if (jj_scan_token(AT)) { return true; } if (jj_3R_91()) { return true; } if (jj_scan_token(LPAREN)) { return true; } if (jj_3R_93()) { return true; } if (jj_scan_token(RPAREN)) { return true; } return false; } private boolean jj_3R_92() { if (jj_scan_token(IDENTIFIER)) { return true; } if (jj_scan_token(ASSIGN)) { return true; } return false; } private boolean jj_3R_219() { if (jj_scan_token(DECR)) { return true; } if (jj_3R_168()) { return true; } return false; } private boolean jj_3R_335() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_86()) { return true; } return false; } private boolean jj_3R_180() { if (jj_scan_token(AT)) { return true; } if (jj_3R_91()) { return true; } return false; } private boolean jj_3R_325() { if (jj_scan_token(EXTENDS)) { return true; } if (jj_3R_86()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_335()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3_41() { if (jj_scan_token(AT)) { return true; } if (jj_3R_91()) { return true; } if (jj_scan_token(LPAREN)) { return true; } return false; } private boolean jj_3R_218() { if (jj_scan_token(INCR)) { return true; } if (jj_3R_168()) { return true; } return false; } private boolean jj_3R_259() { if (jj_scan_token(INTERFACE)) { return true; } return false; } private boolean jj_3_40() { if (jj_scan_token(AT)) { return true; } if (jj_3R_91()) { return true; } if (jj_scan_token(LPAREN)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_92()) { jj_scanpos = xsp; if (jj_scan_token(81)) { return true; } } return false; } private boolean jj_3R_178() { if (jj_scan_token(AT)) { return true; } if (jj_3R_91()) { return true; } if (jj_scan_token(LPAREN)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_232()) { jj_scanpos = xsp; } if (jj_scan_token(RPAREN)) { return true; } return false; } private boolean jj_3R_194() { if (jj_3R_169()) { return true; } return false; } private boolean jj_3R_311() { if (jj_3R_326()) { return true; } return false; } private boolean jj_3R_148() { if (jj_3R_180()) { return true; } return false; } private boolean jj_3R_310() { if (jj_3R_325()) { return true; } return false; } private boolean jj_3R_309() { if (jj_3R_97()) { return true; } return false; } private boolean jj_3R_147() { if (jj_3R_179()) { return true; } return false; } private boolean jj_3R_245() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(20)) { jj_scanpos = xsp; if (jj_3R_259()) { return true; } } if (jj_scan_token(IDENTIFIER)) { return true; } xsp = jj_scanpos; if (jj_3R_309()) { jj_scanpos = xsp; } xsp = jj_scanpos; if (jj_3R_310()) { jj_scanpos = xsp; } xsp = jj_scanpos; if (jj_3R_311()) { jj_scanpos = xsp; } if (jj_3R_85()) { return true; } return false; } private boolean jj_3R_146() { if (jj_3R_178()) { return true; } return false; } private boolean jj_3R_221() { if (jj_scan_token(MINUS)) { return true; } return false; } private boolean jj_3R_220() { if (jj_scan_token(PLUS)) { return true; } return false; } private boolean jj_3R_193() { Token xsp; xsp = jj_scanpos; if (jj_3R_220()) { jj_scanpos = xsp; if (jj_3R_221()) { return true; } } if (jj_3R_168()) { return true; } return false; } private boolean jj_3R_192() { if (jj_3R_219()) { return true; } return false; } private boolean jj_3R_95() { Token xsp; xsp = jj_scanpos; if (jj_3R_146()) { jj_scanpos = xsp; if (jj_3R_147()) { jj_scanpos = xsp; if (jj_3R_148()) { return true; } } } return false; } private boolean jj_3R_123() { return false; } private boolean jj_3R_191() { if (jj_3R_218()) { return true; } return false; } private boolean jj_3R_124() { return false; } private boolean jj_3R_168() { Token xsp; xsp = jj_scanpos; if (jj_3R_191()) { jj_scanpos = xsp; if (jj_3R_192()) { jj_scanpos = xsp; if (jj_3R_193()) { jj_scanpos = xsp; if (jj_3R_194()) { return true; } } } } return false; } private boolean jj_3R_75() { jj_lookingAhead = true; jj_semLA = getToken(1).kind == GT && ((GTToken) getToken(1)).realKind == RSIGNEDSHIFT; jj_lookingAhead = false; if (!jj_semLA || jj_3R_123()) { return true; } if (jj_scan_token(GT)) { return true; } if (jj_scan_token(GT)) { return true; } return false; } private boolean jj_3R_357() { if (jj_scan_token(REM)) { return true; } return false; } private boolean jj_3R_356() { if (jj_scan_token(SLASH)) { return true; } return false; } private boolean jj_3R_355() { if (jj_scan_token(STAR)) { return true; } return false; } private boolean jj_3R_376() { if (jj_scan_token(CATCH)) { return true; } if (jj_scan_token(LPAREN)) { return true; } if (jj_3R_340()) { return true; } if (jj_scan_token(RPAREN)) { return true; } if (jj_3R_100()) { return true; } return false; } private boolean jj_3R_347() { Token xsp; xsp = jj_scanpos; if (jj_3R_355()) { jj_scanpos = xsp; if (jj_3R_356()) { jj_scanpos = xsp; if (jj_3R_357()) { return true; } } } if (jj_3R_168()) { return true; } return false; } private boolean jj_3R_377() { if (jj_scan_token(FINALLY)) { return true; } if (jj_3R_100()) { return true; } return false; } private boolean jj_3R_369() { if (jj_scan_token(FINALLY)) { return true; } if (jj_3R_100()) { return true; } return false; } private boolean jj_3R_76() { jj_lookingAhead = true; jj_semLA = getToken(1).kind == GT && ((GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT; jj_lookingAhead = false; if (!jj_semLA || jj_3R_124()) { return true; } if (jj_scan_token(GT)) { return true; } if (jj_scan_token(GT)) { return true; } if (jj_scan_token(GT)) { return true; } return false; } private boolean jj_3R_367() { if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_368() { Token xsp; if (jj_3R_376()) { return true; } while (true) { xsp = jj_scanpos; if (jj_3R_376()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; if (jj_3R_377()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_323() { if (jj_3R_168()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_347()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_349() { if (jj_scan_token(MINUS)) { return true; } return false; } private boolean jj_3R_348() { if (jj_scan_token(PLUS)) { return true; } return false; } private boolean jj_3R_60() { if (jj_3R_95()) { return true; } return false; } private boolean jj_3R_366() { if (jj_scan_token(IDENTIFIER)) { return true; } return false; } private boolean jj_3R_343() { Token xsp; xsp = jj_scanpos; if (jj_3R_348()) { jj_scanpos = xsp; if (jj_3R_349()) { return true; } } if (jj_3R_323()) { return true; } return false; } private boolean jj_3R_59() { if (jj_scan_token(STRICTFP)) { return true; } return false; } private boolean jj_3R_58() { if (jj_scan_token(VOLATILE)) { return true; } return false; } private boolean jj_3R_57() { if (jj_scan_token(TRANSIENT)) { return true; } return false; } private boolean jj_3R_56() { if (jj_scan_token(NATIVE)) { return true; } return false; } private boolean jj_3R_305() { if (jj_3R_323()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_343()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_295() { if (jj_scan_token(TRY)) { return true; } if (jj_3R_100()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_368()) { jj_scanpos = xsp; if (jj_3R_369()) { return true; } } return false; } private boolean jj_3R_55() { if (jj_scan_token(SYNCHRONIZED)) { return true; } return false; } private boolean jj_3R_54() { if (jj_scan_token(ABSTRACT)) { return true; } return false; } private boolean jj_3R_53() { if (jj_scan_token(FINAL)) { return true; } return false; } private boolean jj_3_21() { if (jj_3R_76()) { return true; } return false; } private boolean jj_3R_365() { if (jj_scan_token(IDENTIFIER)) { return true; } return false; } private boolean jj_3_20() { if (jj_3R_75()) { return true; } return false; } private boolean jj_3R_52() { if (jj_scan_token(PRIVATE)) { return true; } return false; } private boolean jj_3R_74() { if (jj_scan_token(LSHIFT)) { return true; } return false; } private boolean jj_3R_51() { if (jj_scan_token(PROTECTED)) { return true; } return false; } private boolean jj_3_19() { Token xsp; xsp = jj_scanpos; if (jj_3R_74()) { jj_scanpos = xsp; if (jj_3_20()) { jj_scanpos = xsp; if (jj_3_21()) { return true; } } } if (jj_3R_305()) { return true; } return false; } private boolean jj_3R_50() { if (jj_scan_token(STATIC)) { return true; } return false; } private boolean jj_3R_49() { if (jj_scan_token(PUBLIC)) { return true; } return false; } private boolean jj_3R_306() { if (jj_scan_token(INSTANCEOF)) { return true; } if (jj_3R_63()) { return true; } return false; } private boolean jj_3_2() { Token xsp; xsp = jj_scanpos; if (jj_3R_49()) { jj_scanpos = xsp; if (jj_3R_50()) { jj_scanpos = xsp; if (jj_3R_51()) { jj_scanpos = xsp; if (jj_3R_52()) { jj_scanpos = xsp; if (jj_3R_53()) { jj_scanpos = xsp; if (jj_3R_54()) { jj_scanpos = xsp; if (jj_3R_55()) { jj_scanpos = xsp; if (jj_3R_56()) { jj_scanpos = xsp; if (jj_3R_57()) { jj_scanpos = xsp; if (jj_3R_58()) { jj_scanpos = xsp; if (jj_3R_59()) { jj_scanpos = xsp; if (jj_3R_60()) { return true; } } } } } } } } } } } } return false; } private boolean jj_3R_303() { if (jj_3R_305()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_19()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_89() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_2()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_294() { if (jj_scan_token(SYNCHRONIZED)) { return true; } if (jj_scan_token(LPAREN)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(RPAREN)) { return true; } if (jj_3R_100()) { return true; } return false; } private boolean jj_3R_334() { if (jj_scan_token(GE)) { return true; } return false; } private boolean jj_3R_333() { if (jj_scan_token(LE)) { return true; } return false; } private boolean jj_3R_332() { if (jj_scan_token(GT)) { return true; } return false; } private boolean jj_3R_331() { if (jj_scan_token(LT)) { return true; } return false; } private boolean jj_3R_324() { Token xsp; xsp = jj_scanpos; if (jj_3R_331()) { jj_scanpos = xsp; if (jj_3R_332()) { jj_scanpos = xsp; if (jj_3R_333()) { jj_scanpos = xsp; if (jj_3R_334()) { return true; } } } } if (jj_3R_303()) { return true; } return false; } private boolean jj_3R_293() { if (jj_scan_token(THROW)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_301() { if (jj_3R_303()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_324()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_302() { if (jj_scan_token(BIT_AND)) { return true; } if (jj_3R_279()) { return true; } return false; } private boolean jj_3R_292() { if (jj_scan_token(RETURN)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_367()) { jj_scanpos = xsp; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_296() { if (jj_3R_301()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_306()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_388() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_94() { if (jj_3R_95()) { return true; } return false; } private boolean jj_3R_48() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_94()) { jj_scanpos = xsp; break; } } if (jj_scan_token(PACKAGE)) { return true; } if (jj_3R_91()) { return true; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_308() { if (jj_scan_token(NE)) { return true; } return false; } private boolean jj_3_1() { if (jj_3R_48()) { return true; } return false; } private boolean jj_3R_362() { if (jj_scan_token(ELSE)) { return true; } if (jj_3R_252()) { return true; } return false; } private boolean jj_3R_307() { if (jj_scan_token(EQ)) { return true; } return false; } private boolean jj_3R_291() { if (jj_scan_token(CONTINUE)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_366()) { jj_scanpos = xsp; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_304() { Token xsp; xsp = jj_scanpos; if (jj_3R_307()) { jj_scanpos = xsp; if (jj_3R_308()) { return true; } } if (jj_3R_296()) { return true; } return false; } private boolean jj_3R_297() { if (jj_scan_token(XOR)) { return true; } if (jj_3R_257()) { return true; } return false; } private boolean jj_3R_280() { if (jj_scan_token(BIT_OR)) { return true; } if (jj_3R_242()) { return true; } return false; } private boolean jj_3R_279() { if (jj_3R_296()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_304()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_375() { if (jj_3R_384()) { return true; } return false; } private boolean jj_3R_290() { if (jj_scan_token(BREAK)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_365()) { jj_scanpos = xsp; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_258() { if (jj_scan_token(SC_AND)) { return true; } if (jj_3R_217()) { return true; } return false; } private boolean jj_3R_257() { if (jj_3R_279()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_302()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_244() { if (jj_scan_token(SC_OR)) { return true; } if (jj_3R_190()) { return true; } return false; } private boolean jj_3R_384() { if (jj_3R_387()) { return true; } return false; } private boolean jj_3R_242() { if (jj_3R_257()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_297()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3_39() { if (jj_3R_89()) { return true; } if (jj_3R_63()) { return true; } if (jj_scan_token(IDENTIFIER)) { return true; } return false; } private boolean jj_3R_387() { if (jj_3R_73()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_388()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_386() { if (jj_3R_387()) { return true; } return false; } private boolean jj_3R_374() { if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_217() { if (jj_3R_242()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_280()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_385() { if (jj_3R_90()) { return true; } return false; } private boolean jj_3R_190() { if (jj_3R_217()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_258()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_383() { Token xsp; xsp = jj_scanpos; if (jj_3R_385()) { jj_scanpos = xsp; if (jj_3R_386()) { return true; } } return false; } private boolean jj_3_38() { if (jj_3R_90()) { return true; } if (jj_scan_token(COLON)) { return true; } return false; } private boolean jj_3R_167() { if (jj_3R_190()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_244()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_373() { if (jj_3R_383()) { return true; } return false; } private boolean jj_3R_364() { Token xsp; xsp = jj_scanpos; if (jj_3R_373()) { jj_scanpos = xsp; } if (jj_scan_token(SEMICOLON)) { return true; } xsp = jj_scanpos; if (jj_3R_374()) { jj_scanpos = xsp; } if (jj_scan_token(SEMICOLON)) { return true; } xsp = jj_scanpos; if (jj_3R_375()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_225() { if (jj_scan_token(HOOK)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(COLON)) { return true; } if (jj_3R_122()) { return true; } return false; } private boolean jj_3R_363() { if (jj_3R_90()) { return true; } if (jj_scan_token(COLON)) { return true; } if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_122() { if (jj_3R_167()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_225()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_289() { if (jj_scan_token(FOR)) { return true; } if (jj_scan_token(LPAREN)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_363()) { jj_scanpos = xsp; if (jj_3R_364()) { return true; } } if (jj_scan_token(RPAREN)) { return true; } if (jj_3R_252()) { return true; } return false; } private boolean jj_3R_121() { if (jj_scan_token(ORASSIGN)) { return true; } return false; } private boolean jj_3R_120() { if (jj_scan_token(XORASSIGN)) { return true; } return false; } private boolean jj_3R_119() { if (jj_scan_token(ANDASSIGN)) { return true; } return false; } private boolean jj_3R_118() { if (jj_scan_token(RUNSIGNEDSHIFTASSIGN)) { return true; } return false; } private boolean jj_3R_117() { if (jj_scan_token(RSIGNEDSHIFTASSIGN)) { return true; } return false; } private boolean jj_3R_116() { if (jj_scan_token(LSHIFTASSIGN)) { return true; } return false; } private boolean jj_3R_115() { if (jj_scan_token(MINUSASSIGN)) { return true; } return false; } private boolean jj_3R_114() { if (jj_scan_token(PLUSASSIGN)) { return true; } return false; } private boolean jj_3R_113() { if (jj_scan_token(REMASSIGN)) { return true; } return false; } private boolean jj_3R_112() { if (jj_scan_token(SLASHASSIGN)) { return true; } return false; } private boolean jj_3R_111() { if (jj_scan_token(STARASSIGN)) { return true; } return false; } private boolean jj_3R_110() { if (jj_scan_token(ASSIGN)) { return true; } return false; } private boolean jj_3R_288() { if (jj_scan_token(DO)) { return true; } if (jj_3R_252()) { return true; } if (jj_scan_token(WHILE)) { return true; } if (jj_scan_token(LPAREN)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(RPAREN)) { return true; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_72() { Token xsp; xsp = jj_scanpos; if (jj_3R_110()) { jj_scanpos = xsp; if (jj_3R_111()) { jj_scanpos = xsp; if (jj_3R_112()) { jj_scanpos = xsp; if (jj_3R_113()) { jj_scanpos = xsp; if (jj_3R_114()) { jj_scanpos = xsp; if (jj_3R_115()) { jj_scanpos = xsp; if (jj_3R_116()) { jj_scanpos = xsp; if (jj_3R_117()) { jj_scanpos = xsp; if (jj_3R_118()) { jj_scanpos = xsp; if (jj_3R_119()) { jj_scanpos = xsp; if (jj_3R_120()) { jj_scanpos = xsp; if (jj_3R_121()) { return true; } } } } } } } } } } } } return false; } private boolean jj_3R_342() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_91()) { return true; } return false; } private boolean jj_3_18() { if (jj_3R_72()) { return true; } if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_287() { if (jj_scan_token(WHILE)) { return true; } if (jj_scan_token(LPAREN)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(RPAREN)) { return true; } if (jj_3R_252()) { return true; } return false; } private boolean jj_3R_73() { if (jj_3R_122()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3_18()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_286() { if (jj_scan_token(IF)) { return true; } if (jj_scan_token(LPAREN)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(RPAREN)) { return true; } if (jj_3R_252()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_362()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_142() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_141()) { return true; } return false; } private boolean jj_3R_382() { if (jj_scan_token(_DEFAULT)) { return true; } return false; } private boolean jj_3R_381() { if (jj_scan_token(CASE)) { return true; } if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_330() { if (jj_3R_91()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_342()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_372() { Token xsp; xsp = jj_scanpos; if (jj_3R_381()) { jj_scanpos = xsp; if (jj_3R_382()) { return true; } } if (jj_scan_token(COLON)) { return true; } if (jj_3R_151()) { return true; } return false; } private boolean jj_3_17() { if (jj_scan_token(DOT)) { return true; } if (jj_scan_token(IDENTIFIER)) { return true; } return false; } private boolean jj_3R_91() { if (jj_scan_token(IDENTIFIER)) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_17()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_361() { if (jj_3R_372()) { return true; } return false; } private boolean jj_3R_138() { if (jj_3R_63()) { return true; } return false; } private boolean jj_3R_137() { if (jj_scan_token(VOID)) { return true; } return false; } private boolean jj_3R_285() { if (jj_scan_token(SWITCH)) { return true; } if (jj_scan_token(LPAREN)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(RPAREN)) { return true; } if (jj_scan_token(LBRACE)) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_361()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RBRACE)) { return true; } return false; } private boolean jj_3R_380() { if (jj_3R_72()) { return true; } if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_83() { Token xsp; xsp = jj_scanpos; if (jj_3R_137()) { jj_scanpos = xsp; if (jj_3R_138()) { return true; } } return false; } private boolean jj_3R_379() { if (jj_scan_token(DECR)) { return true; } return false; } private boolean jj_3R_378() { if (jj_scan_token(INCR)) { return true; } return false; } private boolean jj_3R_371() { Token xsp; xsp = jj_scanpos; if (jj_3R_378()) { jj_scanpos = xsp; if (jj_3R_379()) { jj_scanpos = xsp; if (jj_3R_380()) { return true; } } } return false; } private boolean jj_3R_300() { if (jj_3R_243()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_371()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_299() { if (jj_3R_219()) { return true; } return false; } private boolean jj_3R_133() { if (jj_scan_token(DOUBLE)) { return true; } return false; } private boolean jj_3R_298() { if (jj_3R_218()) { return true; } return false; } private boolean jj_3R_132() { if (jj_scan_token(FLOAT)) { return true; } return false; } private boolean jj_3R_131() { if (jj_scan_token(LONG)) { return true; } return false; } private boolean jj_3R_130() { if (jj_scan_token(INT)) { return true; } return false; } private boolean jj_3R_129() { if (jj_scan_token(SHORT)) { return true; } return false; } private boolean jj_3R_128() { if (jj_scan_token(BYTE)) { return true; } return false; } private boolean jj_3R_284() { Token xsp; xsp = jj_scanpos; if (jj_3R_298()) { jj_scanpos = xsp; if (jj_3R_299()) { jj_scanpos = xsp; if (jj_3R_300()) { return true; } } } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_164() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_109()) { return true; } return false; } private boolean jj_3R_256() { if (jj_scan_token(SUPER)) { return true; } if (jj_3R_70()) { return true; } return false; } private boolean jj_3R_127() { if (jj_scan_token(CHAR)) { return true; } return false; } private boolean jj_3R_241() { Token xsp; xsp = jj_scanpos; if (jj_3R_255()) { jj_scanpos = xsp; if (jj_3R_256()) { return true; } } return false; } private boolean jj_3R_255() { if (jj_scan_token(EXTENDS)) { return true; } if (jj_3R_70()) { return true; } return false; } private boolean jj_3R_126() { if (jj_scan_token(BOOLEAN)) { return true; } return false; } private boolean jj_3R_80() { Token xsp; xsp = jj_scanpos; if (jj_3R_126()) { jj_scanpos = xsp; if (jj_3R_127()) { jj_scanpos = xsp; if (jj_3R_128()) { jj_scanpos = xsp; if (jj_3R_129()) { jj_scanpos = xsp; if (jj_3R_130()) { jj_scanpos = xsp; if (jj_3R_131()) { jj_scanpos = xsp; if (jj_3R_132()) { jj_scanpos = xsp; if (jj_3R_133()) { return true; } } } } } } } } return false; } private boolean jj_3R_360() { if (jj_scan_token(COLON)) { return true; } if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_283() { if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_189() { if (jj_scan_token(HOOK)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_241()) { jj_scanpos = xsp; } return false; } private boolean jj_3_37() { if (jj_3R_90()) { return true; } return false; } private boolean jj_3R_90() { if (jj_3R_89()) { return true; } if (jj_3R_63()) { return true; } if (jj_3R_141()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_142()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_166() { if (jj_3R_189()) { return true; } return false; } private boolean jj_3_36() { if (jj_3R_89()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_scan_token(20)) { jj_scanpos = xsp; if (jj_scan_token(40)) { return true; } } return false; } private boolean jj_3R_165() { if (jj_3R_70()) { return true; } return false; } private boolean jj_3R_236() { if (jj_3R_252()) { return true; } return false; } private boolean jj_3R_317() { if (jj_scan_token(THROWS)) { return true; } if (jj_3R_330()) { return true; } return false; } private boolean jj_3R_109() { Token xsp; xsp = jj_scanpos; if (jj_3R_165()) { jj_scanpos = xsp; if (jj_3R_166()) { return true; } } return false; } private boolean jj_3R_235() { if (jj_3R_90()) { return true; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_234() { if (jj_3R_89()) { return true; } if (jj_3R_245()) { return true; } return false; } private boolean jj_3_13() { if (jj_scan_token(LBRACKET)) { return true; } if (jj_scan_token(RBRACKET)) { return true; } return false; } private boolean jj_3R_71() { if (jj_scan_token(LT)) { return true; } if (jj_3R_109()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_164()) { jj_scanpos = xsp; break; } } if (jj_scan_token(GT)) { return true; } return false; } private boolean jj_3_16() { if (jj_3R_71()) { return true; } return false; } private boolean jj_3_15() { if (jj_scan_token(DOT)) { return true; } if (jj_scan_token(IDENTIFIER)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3_16()) { jj_scanpos = xsp; } return false; } private boolean jj_3R_205() { Token xsp; xsp = jj_scanpos; if (jj_3R_234()) { jj_scanpos = xsp; if (jj_3R_235()) { jj_scanpos = xsp; if (jj_3R_236()) { return true; } } } return false; } private boolean jj_3_12() { if (jj_scan_token(LBRACKET)) { return true; } if (jj_scan_token(RBRACKET)) { return true; } return false; } private boolean jj_3_14() { if (jj_3R_71()) { return true; } return false; } private boolean jj_3R_86() { if (jj_scan_token(IDENTIFIER)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3_14()) { jj_scanpos = xsp; } while (true) { xsp = jj_scanpos; if (jj_3_15()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3_33() { if (jj_scan_token(LBRACKET)) { return true; } if (jj_scan_token(RBRACKET)) { return true; } return false; } private boolean jj_3R_100() { if (jj_scan_token(LBRACE)) { return true; } if (jj_3R_151()) { return true; } if (jj_scan_token(RBRACE)) { return true; } return false; } private boolean jj_3R_108() { if (jj_3R_86()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_13()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_107() { if (jj_3R_80()) { return true; } Token xsp; if (jj_3_12()) { return true; } while (true) { xsp = jj_scanpos; if (jj_3_12()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_70() { Token xsp; xsp = jj_scanpos; if (jj_3R_107()) { jj_scanpos = xsp; if (jj_3R_108()) { return true; } } return false; } private boolean jj_3R_88() { if (jj_scan_token(IDENTIFIER)) { return true; } if (jj_scan_token(COLON)) { return true; } if (jj_3R_252()) { return true; } return false; } private boolean jj_3R_98() { if (jj_3R_80()) { return true; } return false; } private boolean jj_3_11() { if (jj_3R_70()) { return true; } return false; } private boolean jj_3R_282() { if (jj_scan_token(ASSERT)) { return true; } if (jj_3R_73()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_360()) { jj_scanpos = xsp; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_63() { Token xsp; xsp = jj_scanpos; if (jj_3_11()) { jj_scanpos = xsp; if (jj_3R_98()) { return true; } } return false; } private boolean jj_3R_278() { if (jj_3R_295()) { return true; } return false; } private boolean jj_3R_277() { if (jj_3R_294()) { return true; } return false; } private boolean jj_3R_276() { if (jj_3R_293()) { return true; } return false; } private boolean jj_3R_275() { if (jj_3R_292()) { return true; } return false; } private boolean jj_3R_274() { if (jj_3R_291()) { return true; } return false; } private boolean jj_3R_99() { if (jj_scan_token(STATIC)) { return true; } return false; } private boolean jj_3R_273() { if (jj_3R_290()) { return true; } return false; } private boolean jj_3R_65() { Token xsp; xsp = jj_scanpos; if (jj_3R_99()) { jj_scanpos = xsp; } if (jj_3R_100()) { return true; } return false; } private boolean jj_3R_272() { if (jj_3R_289()) { return true; } return false; } private boolean jj_3R_271() { if (jj_3R_288()) { return true; } return false; } private boolean jj_3R_182() { if (jj_3R_205()) { return true; } return false; } private boolean jj_3R_270() { if (jj_3R_287()) { return true; } return false; } private boolean jj_3R_151() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_182()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_269() { if (jj_3R_286()) { return true; } return false; } private boolean jj_3_9() { if (jj_3R_68()) { return true; } if (jj_scan_token(DOT)) { return true; } return false; } private boolean jj_3R_268() { if (jj_3R_285()) { return true; } return false; } private boolean jj_3R_267() { if (jj_3R_284()) { return true; } return false; } private boolean jj_3R_266() { if (jj_3R_283()) { return true; } return false; } private boolean jj_3R_69() { if (jj_3R_71()) { return true; } return false; } private boolean jj_3R_156() { if (jj_3R_71()) { return true; } return false; } private boolean jj_3R_265() { if (jj_3R_100()) { return true; } return false; } private boolean jj_3_7() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_66()) { return true; } return false; } private boolean jj_3_10() { Token xsp; xsp = jj_scanpos; if (jj_3R_69()) { jj_scanpos = xsp; } if (jj_scan_token(THIS)) { return true; } if (jj_scan_token(LPAREN)) { return true; } return false; } private boolean jj_3R_264() { if (jj_3R_282()) { return true; } return false; } private boolean jj_3R_155() { if (jj_3R_68()) { return true; } if (jj_scan_token(DOT)) { return true; } return false; } private boolean jj_3_35() { if (jj_3R_88()) { return true; } return false; } private boolean jj_3R_104() { Token xsp; xsp = jj_scanpos; if (jj_3R_155()) { jj_scanpos = xsp; } xsp = jj_scanpos; if (jj_3R_156()) { jj_scanpos = xsp; } if (jj_scan_token(SUPER)) { return true; } if (jj_3R_154()) { return true; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_153() { if (jj_3R_71()) { return true; } return false; } private boolean jj_3R_103() { Token xsp; xsp = jj_scanpos; if (jj_3R_153()) { jj_scanpos = xsp; } if (jj_scan_token(THIS)) { return true; } if (jj_3R_154()) { return true; } if (jj_scan_token(SEMICOLON)) { return true; } return false; } private boolean jj_3R_252() { Token xsp; xsp = jj_scanpos; if (jj_3_35()) { jj_scanpos = xsp; if (jj_3R_264()) { jj_scanpos = xsp; if (jj_3R_265()) { jj_scanpos = xsp; if (jj_3R_266()) { jj_scanpos = xsp; if (jj_3R_267()) { jj_scanpos = xsp; if (jj_3R_268()) { jj_scanpos = xsp; if (jj_3R_269()) { jj_scanpos = xsp; if (jj_3R_270()) { jj_scanpos = xsp; if (jj_3R_271()) { jj_scanpos = xsp; if (jj_3R_272()) { jj_scanpos = xsp; if (jj_3R_273()) { jj_scanpos = xsp; if (jj_3R_274()) { jj_scanpos = xsp; if (jj_3R_275()) { jj_scanpos = xsp; if (jj_3R_276()) { jj_scanpos = xsp; if (jj_3R_277()) { jj_scanpos = xsp; if (jj_3R_278()) { return true; } } } } } } } } } } } } } } } } return false; } private boolean jj_3R_174() { if (jj_scan_token(LBRACKET)) { return true; } if (jj_scan_token(RBRACKET)) { return true; } return false; } private boolean jj_3R_67() { Token xsp; xsp = jj_scanpos; if (jj_3R_103()) { jj_scanpos = xsp; if (jj_3R_104()) { return true; } } return false; } private boolean jj_3R_140() { Token xsp; if (jj_3R_174()) { return true; } while (true) { xsp = jj_scanpos; if (jj_3R_174()) { jj_scanpos = xsp; break; } } if (jj_3R_152()) { return true; } return false; } private boolean jj_3_32() { if (jj_scan_token(LBRACKET)) { return true; } if (jj_3R_73()) { return true; } if (jj_scan_token(RBRACKET)) { return true; } return false; } private boolean jj_3_34() { Token xsp; if (jj_3_32()) { return true; } while (true) { xsp = jj_scanpos; if (jj_3_32()) { jj_scanpos = xsp; break; } } while (true) { xsp = jj_scanpos; if (jj_3_33()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3_30() { if (jj_3R_85()) { return true; } return false; } private boolean jj_3R_320() { if (jj_scan_token(LBRACKET)) { return true; } if (jj_scan_token(RBRACKET)) { return true; } return false; } private boolean jj_3R_341() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_340()) { return true; } return false; } private boolean jj_3_8() { if (jj_3R_67()) { return true; } return false; } private boolean jj_3R_87() { Token xsp; xsp = jj_scanpos; if (jj_3_34()) { jj_scanpos = xsp; if (jj_3R_140()) { return true; } } return false; } private boolean jj_3R_346() { if (jj_scan_token(ELLIPSIS)) { return true; } return false; } private boolean jj_3R_318() { if (jj_3R_67()) { return true; } return false; } private boolean jj_3R_240() { if (jj_3R_71()) { return true; } return false; } private boolean jj_3R_260() { if (jj_3R_97()) { return true; } return false; } private boolean jj_3R_216() { Token xsp; xsp = jj_scanpos; if (jj_3R_240()) { jj_scanpos = xsp; } if (jj_3R_86()) { return true; } if (jj_3R_154()) { return true; } xsp = jj_scanpos; if (jj_3_30()) { jj_scanpos = xsp; } return false; } private boolean jj_3_31() { if (jj_3R_86()) { return true; } if (jj_3R_87()) { return true; } return false; } private boolean jj_3R_248() { Token xsp; xsp = jj_scanpos; if (jj_3R_260()) { jj_scanpos = xsp; } if (jj_scan_token(IDENTIFIER)) { return true; } if (jj_3R_316()) { return true; } xsp = jj_scanpos; if (jj_3R_317()) { jj_scanpos = xsp; } if (jj_scan_token(LBRACE)) { return true; } xsp = jj_scanpos; if (jj_3R_318()) { jj_scanpos = xsp; } if (jj_3R_151()) { return true; } if (jj_scan_token(RBRACE)) { return true; } return false; } private boolean jj_3R_237() { if (jj_scan_token(COMMA)) { return true; } if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_215() { if (jj_3R_86()) { return true; } if (jj_3R_87()) { return true; } return false; } private boolean jj_3R_203() { if (jj_scan_token(LBRACKET)) { return true; } if (jj_scan_token(RBRACKET)) { return true; } return false; } private boolean jj_3R_202() { if (jj_3R_66()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_7()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_214() { if (jj_3R_80()) { return true; } if (jj_3R_87()) { return true; } return false; } private boolean jj_3R_340() { if (jj_3R_89()) { return true; } if (jj_3R_63()) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_346()) { jj_scanpos = xsp; } if (jj_3R_175()) { return true; } return false; } private boolean jj_3R_187() { if (jj_scan_token(NEW)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_214()) { jj_scanpos = xsp; if (jj_3R_215()) { jj_scanpos = xsp; if (jj_3R_216()) { return true; } } } return false; } private boolean jj_3R_329() { if (jj_3R_340()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_341()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_316() { if (jj_scan_token(LPAREN)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_329()) { jj_scanpos = xsp; } if (jj_scan_token(RPAREN)) { return true; } return false; } private boolean jj_3R_206() { if (jj_3R_73()) { return true; } Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_237()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_322() { if (jj_3R_100()) { return true; } return false; } private boolean jj_3R_321() { if (jj_scan_token(THROWS)) { return true; } if (jj_3R_330()) { return true; } return false; } private boolean jj_3R_183() { if (jj_3R_206()) { return true; } return false; } private boolean jj_3R_261() { if (jj_3R_97()) { return true; } return false; } private boolean jj_3R_250() { Token xsp; xsp = jj_scanpos; if (jj_3R_261()) { jj_scanpos = xsp; } if (jj_3R_83()) { return true; } if (jj_scan_token(IDENTIFIER)) { return true; } if (jj_3R_316()) { return true; } while (true) { xsp = jj_scanpos; if (jj_3R_320()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; if (jj_3R_321()) { jj_scanpos = xsp; } xsp = jj_scanpos; if (jj_3R_322()) { jj_scanpos = xsp; if (jj_scan_token(86)) { return true; } } return false; } private boolean jj_3R_154() { if (jj_scan_token(LPAREN)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_183()) { jj_scanpos = xsp; } if (jj_scan_token(RPAREN)) { return true; } return false; } private boolean jj_3R_239() { if (jj_scan_token(NULL)) { return true; } return false; } private boolean jj_3R_254() { if (jj_scan_token(FALSE)) { return true; } return false; } private boolean jj_3R_253() { if (jj_scan_token(TRUE)) { return true; } return false; } private boolean jj_3R_152() { if (jj_scan_token(LBRACE)) { return true; } Token xsp; xsp = jj_scanpos; if (jj_3R_202()) { jj_scanpos = xsp; } xsp = jj_scanpos; if (jj_scan_token(87)) { jj_scanpos = xsp; } if (jj_scan_token(RBRACE)) { return true; } return false; } private boolean jj_3R_238() { Token xsp; xsp = jj_scanpos; if (jj_3R_253()) { jj_scanpos = xsp; if (jj_3R_254()) { return true; } } return false; } private boolean jj_3R_102() { if (jj_3R_73()) { return true; } return false; } private boolean jj_3R_213() { if (jj_3R_239()) { return true; } return false; } /** Generated Token Manager. */ public ASTParserTokenManager token_source; JavaCharStream jj_input_stream; /** Current token. */ public Token token; /** Next token. */ public Token jj_nt; private int jj_ntk; private Token jj_scanpos, jj_lastpos; private int jj_la; /** Whether we are looking ahead. */ private boolean jj_lookingAhead = false; private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[134]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; static private int[] jj_la1_3; static private int[] jj_la1_4; static { jj_la1_init_0(); jj_la1_init_1(); jj_la1_init_2(); jj_la1_init_3(); jj_la1_init_4(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] { 0x0, 0x48101000, 0x1, 0x0, 0x0, 0x0, 0x40001000, 0x8100000, 0x48101000, 0x100000, 0x0, 0x10000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4a195000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0x0, 0x4a195000, 0x8100000, 0x2094000, 0x4a195000, 0x0, 0x0, 0x0, 0x22094000, 0x22094000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x42095000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x22094000, 0x6359f000, 0x0, 0x2094000, 0x2094000, 0x0, 0x2094000, 0x10000000, 0x10000000, 0x2094000, 0x2094000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x22094000, 0x0, 0x0, 0x22094000, 0x0, 0x2094000, 0x0, 0x0, 0x0, 0x20000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20000000, 0x20000000, 0x22094000, 0x0, 0x0, 0x2094000, 0x0, 0x0, 0x0, 0x2349e000, 0x0, 0x2349e000, 0x0, 0x0, 0x0, 0x22094000, 0x820000, 0x820000, 0x4000000, 0x62095000, 0x22094000, 0x22094000, 0x62095000, 0x22094000, 0x0, 0x0, 0x0, 0x22094000, 0x40000, 0x80000000, 0x80040000, 0x0, 0x0, 0x0, 0x22094000, 0x22094000, 0x0, 0x4a195000, 0xa194000, 0x4a195000, 0x800000, }; } private static void jj_la1_init_1() { jj_la1_1 = new int[] { 0x20, 0x8899c500, 0x0, 0x0, 0x80000, 0x0, 0x8899c400, 0x100, 0x8899c500, 0x100, 0x0, 0x0, 0x10, 0x0, 0x0, 0x10, 0x0, 0x0, 0xc89dc781, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc89dc781, 0x100, 0x40040281, 0xc89dc781, 0x0, 0x0, 0x0, 0x51241a81, 0x51241a81, 0x0, 0x0, 0x0, 0x4000000, 0x0, 0x0, 0x889dc681, 0x0, 0x0, 0x4000000, 0x0, 0x0, 0x51241a81, 0xfbffdf8b, 0x80000, 0x40281, 0x40281, 0x0, 0x40281, 0x200000, 0x200000, 0x40281, 0x40040281, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x51241a81, 0x0, 0x0, 0x51241a81, 0x0, 0x40281, 0x0, 0x0, 0x0, 0x11201800, 0x0, 0x0, 0x0, 0x0, 0x1000800, 0x0, 0x10001000, 0x10000000, 0x51241a81, 0x0, 0x0, 0x40281, 0x0, 0x0, 0x0, 0x73e61a8b, 0x0, 0x73e61a8b, 0x0, 0x0, 0x0, 0x51241a81, 0x0, 0x0, 0x0, 0xd9bdde81, 0x51241a81, 0x51241a81, 0xd9bdde81, 0x51241a81, 0x0, 0x0, 0x0, 0x51241a81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x51241a81, 0x51241a81, 0x0, 0x889dc781, 0x40381, 0x889dc781, 0x0, }; } private static void jj_la1_init_2() { jj_la1_2 = new int[] { 0x0, 0x2400000, 0x0, 0x2000000, 0x0, 0x1000000, 0x2000000, 0x2000000, 0x2400000, 0x0, 0x8000000, 0x0, 0x0, 0x800000, 0x800000, 0x0, 0x2002000, 0x800000, 0xa442000, 0x400000, 0x2000000, 0x10000, 0x40000, 0x800000, 0x0, 0x0, 0xa442000, 0x2000000, 0x8002000, 0xa402000, 0x800000, 0x4000000, 0x100000, 0x30053846, 0x30053846, 0x800000, 0x8000000, 0x100000, 0x0, 0x440000, 0x800000, 0x2002000, 0x0, 0x8000000, 0x0, 0x8000000, 0x8000000, 0x8013846, 0x2453847, 0x0, 0x0, 0x2000, 0x800000, 0x40002000, 0x0, 0x0, 0x0, 0x2000, 0x800000, 0x4000000, 0x40000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8000000, 0x8000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30013846, 0x30000000, 0x30000000, 0x13846, 0x0, 0x2000, 0x8000000, 0x10000, 0x10000, 0x11846, 0x2000, 0x1000000, 0x8000000, 0x10000, 0x0, 0x1100000, 0x1846, 0x0, 0x30013846, 0x800000, 0x8000000, 0x0, 0x8002000, 0x100000, 0x100000, 0x453847, 0x80000000, 0x453847, 0x800000, 0x4000000, 0x4000000, 0x13846, 0x0, 0x0, 0x0, 0x32013846, 0x30013846, 0x30013846, 0x32413846, 0x30013846, 0x800000, 0x2000, 0x2000, 0x30013846, 0x0, 0x0, 0x0, 0x2000000, 0x2000, 0x800000, 0x32053846, 0x32053846, 0x800000, 0x2402000, 0x2002000, 0x2402000, 0x0, }; } private static void jj_la1_init_3() { jj_la1_3 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3c0, 0x3c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffe0000, 0x0, 0x10, 0x20, 0x2000, 0x4000, 0x1000, 0x9, 0x9, 0x0, 0x80000006, 0x80000006, 0x10000, 0x300, 0x300, 0x8c00, 0x8c00, 0x300, 0x3c0, 0x0, 0x0, 0x0, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0, 0x0, 0xc0, 0x0, 0xffe00c0, 0xffe00c0, 0xc0, 0x0, 0x0, 0x0, 0x3c0, 0x3c0, 0x3c0, 0x3c0, 0x3c0, 0x0, 0x0, 0x0, 0x3c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3c0, 0x3c0, 0x0, 0x0, 0x0, 0x0, 0x0, }; } private static void jj_la1_init_4() { jj_la1_4 = new int[] { 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; } final private JJCalls[] jj_2_rtns = new JJCalls[43]; private boolean jj_rescan = false; private int jj_gc = 0; /** Constructor with InputStream. */ public ASTParser(java.io.InputStream stream) { this(stream, null); } /** Constructor with InputStream and supplied encoding */ public ASTParser(java.io.InputStream stream, String encoding) { try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch (java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new ASTParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 134; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { jj_2_rtns[i] = new JJCalls(); } } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch (java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 134; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { jj_2_rtns[i] = new JJCalls(); } } /** Constructor. */ public ASTParser(java.io.Reader stream) { jj_input_stream = new JavaCharStream(stream, 1, 1); token_source = new ASTParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 134; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { jj_2_rtns[i] = new JJCalls(); } } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 134; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { jj_2_rtns[i] = new JJCalls(); } } /** Constructor with generated Token Manager. */ public ASTParser(ASTParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 134; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { jj_2_rtns[i] = new JJCalls(); } } /** Reinitialise. */ public void ReInit(ASTParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 134; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { jj_2_rtns[i] = new JJCalls(); } } private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) { token = token.next; } else { token = token.next = token_source.getNextToken(); } jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (JJCalls jj_2Rtn : jj_2_rtns) { JJCalls c = jj_2Rtn; while (c != null) { if (c.gen < jj_gen) { c.first = null; } c = c.next; } } } return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } static private final class LookaheadSuccess extends java.lang.Error { } final private LookaheadSuccess jj_ls = new LookaheadSuccess(); private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_scanpos.next; } if (jj_rescan) { int i = 0; Token tok = token; while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } if (tok != null) { jj_add_error_token(kind, i); } } if (jj_scanpos.kind != kind) { return true; } if (jj_la == 0 && jj_scanpos == jj_lastpos) { throw jj_ls; } return false; } /** Get the next Token. */ final public Token getNextToken() { if (token.next != null) { token = token.next; } else { token = token.next = token_source.getNextToken(); } jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ final public Token getToken(int index) { Token t = jj_lookingAhead ? jj_scanpos : token; for (int i = 0; i < index; i++) { if (t.next != null) { t = t.next; } else { t = t.next = token_source.getNextToken(); } } return t; } private int jj_ntk() { if ((jj_nt = token.next) == null) { return (jj_ntk = (token.next = token_source.getNextToken()).kind); } else { return (jj_ntk = jj_nt.kind); } } private final java.util.List jj_expentries = new java.util.ArrayList(); private int[] jj_expentry; private int jj_kind = -1; private final int[] jj_lasttokens = new int[100]; private int jj_endpos; private void jj_add_error_token(int kind, int pos) { if (pos >= 100) { return; } if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } jj_entries_loop: for (Object element : jj_expentries) { int[] oldentry = (int[]) (element); if (oldentry.length == jj_expentry.length) { for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { continue jj_entries_loop; } } jj_expentries.add(jj_expentry); break jj_entries_loop; } } if (pos != 0) { jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } } /** Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[129]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 134; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1 << j)) != 0) { la1tokens[j] = true; } if ((jj_la1_1[i] & (1 << j)) != 0) { la1tokens[32 + j] = true; } if ((jj_la1_2[i] & (1 << j)) != 0) { la1tokens[64 + j] = true; } if ((jj_la1_3[i] & (1 << j)) != 0) { la1tokens[96 + j] = true; } if ((jj_la1_4[i] & (1 << j)) != 0) { la1tokens[128 + j] = true; } } } } for (int i = 0; i < 129; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; jj_expentries.add(jj_expentry); } } jj_endpos = 0; jj_rescan_token(); jj_add_error_token(0, 0); int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { exptokseq[i] = jj_expentries.get(i); } return new ParseException(token, exptokseq, tokenImage); } /** Enable tracing. */ final public void enable_tracing() { } /** Disable tracing. */ final public void disable_tracing() { } private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 43; i++) { try { JJCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; case 1: jj_3_2(); break; case 2: jj_3_3(); break; case 3: jj_3_4(); break; case 4: jj_3_5(); break; case 5: jj_3_6(); break; case 6: jj_3_7(); break; case 7: jj_3_8(); break; case 8: jj_3_9(); break; case 9: jj_3_10(); break; case 10: jj_3_11(); break; case 11: jj_3_12(); break; case 12: jj_3_13(); break; case 13: jj_3_14(); break; case 14: jj_3_15(); break; case 15: jj_3_16(); break; case 16: jj_3_17(); break; case 17: jj_3_18(); break; case 18: jj_3_19(); break; case 19: jj_3_20(); break; case 20: jj_3_21(); break; case 21: jj_3_22(); break; case 22: jj_3_23(); break; case 23: jj_3_24(); break; case 24: jj_3_25(); break; case 25: jj_3_26(); break; case 26: jj_3_27(); break; case 27: jj_3_28(); break; case 28: jj_3_29(); break; case 29: jj_3_30(); break; case 30: jj_3_31(); break; case 31: jj_3_32(); break; case 32: jj_3_33(); break; case 33: jj_3_34(); break; case 34: jj_3_35(); break; case 35: jj_3_36(); break; case 36: jj_3_37(); break; case 37: jj_3_38(); break; case 38: jj_3_39(); break; case 39: jj_3_40(); break; case 40: jj_3_41(); break; case 41: jj_3_42(); break; case 42: jj_3_43(); break; } } p = p.next; } while (p != null); } catch (LookaheadSuccess ls) { } } jj_rescan = false; } private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } p = p.next; } p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { int gen; Token first; int arg; JJCalls next; } } src/japa/parser/ASTParserConstants.java0000644000000000000000000002370311225177012017121 0ustar rootroot/* 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 . */ 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 = { "", "\" \"", "\"\\t\"", "\"\\n\"", "\"\\r\"", "\"\\f\"", "", "", "\"/*\"", "\"*/\"", "\"*/\"", "", "\"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\"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\"(\"", "\")\"", "\"{\"", "\"}\"", "\"[\"", "\"]\"", "\";\"", "\",\"", "\".\"", "\"@\"", "\"=\"", "\"<\"", "\"!\"", "\"~\"", "\"?\"", "\":\"", "\"==\"", "\"<=\"", "\">=\"", "\"!=\"", "\"||\"", "\"&&\"", "\"++\"", "\"--\"", "\"+\"", "\"-\"", "\"*\"", "\"/\"", "\"&\"", "\"|\"", "\"^\"", "\"%\"", "\"<<\"", "\"+=\"", "\"-=\"", "\"*=\"", "\"/=\"", "\"&=\"", "\"|=\"", "\"^=\"", "\"%=\"", "\"<<=\"", "\">>=\"", "\">>>=\"", "\"...\"", "\">>>\"", "\">>\"", "\">\"", "\"\\u001a\"", }; } src/japa/parser/ASTParserTokenManager.java0000644000000000000000000023542711225177012017530 0ustar rootroot/* Generated By:JavaCC: Do not edit this line. ASTParserTokenManager.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 . */ package japa.parser; import java.io.*; import java.util.*; import japa.parser.ast.*; import japa.parser.ast.body.*; import japa.parser.ast.expr.*; import japa.parser.ast.stmt.*; import japa.parser.ast.type.*; /** Token Manager. */ public class ASTParserTokenManager implements ASTParserConstants { private List comments; private final Stack javadocStack = new Stack(); private JavadocComment lastJavadoc; void pushJavadoc() { javadocStack.push(lastJavadoc); } JavadocComment popJavadoc() { return javadocStack.pop(); } List getComments() { return comments; } void clearComments() { comments = null; javadocStack.clear(); lastJavadoc = null; } private void CommonTokenAction(Token token) { lastJavadoc = null; if (token.specialToken != null) { if(comments == null) { comments = new LinkedList(); } Token special = token.specialToken; if(special.kind == JAVA_DOC_COMMENT) { lastJavadoc = new JavadocComment(special.beginLine, special.beginColumn, special.endLine, special.endColumn, special.image.substring(3, special.image.length()-2)); comments.add(lastJavadoc); } else if(special.kind == SINGLE_LINE_COMMENT) { LineComment comment = new LineComment(special.beginLine, special.beginColumn, special.endLine, special.endColumn, special.image.substring(2)); comments.add(comment); } else if(special.kind == MULTI_LINE_COMMENT) { BlockComment comment = new BlockComment(special.beginLine, special.beginColumn, special.endLine, special.endColumn, special.image.substring(2, special.image.length()-2)); comments.add(comment); } } } /** Debug output. */ public java.io.PrintStream debugStream = System.out; /** Set debug output. */ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1, long active2) { switch (pos) { case 0: if ((active0 & 0xfffffffffffff000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 77; return 37; } if ((active1 & 0x1000000001000000L) != 0L) return 1; if ((active0 & 0x100L) != 0L || (active1 & 0x10080000000000L) != 0L) return 54; return -1; case 1: if ((active0 & 0x100L) != 0L) return 59; if ((active0 & 0x803000000L) != 0L) return 37; if ((active0 & 0xfffffff7fcfff000L) != 0L || (active1 & 0x1L) != 0L) { if (jjmatchedPos != 1) { jjmatchedKind = 77; jjmatchedPos = 1; } return 37; } return -1; case 2: if ((active0 & 0xdffff675fefff000L) != 0L || (active1 & 0x1L) != 0L) { if (jjmatchedPos != 2) { jjmatchedKind = 77; jjmatchedPos = 2; } return 37; } if ((active0 & 0x2000098200000000L) != 0L) return 37; return -1; case 3: if ((active0 & 0x8effe571f2f4f000L) != 0L || (active1 & 0x1L) != 0L) { jjmatchedKind = 77; jjmatchedPos = 3; return 37; } if ((active0 & 0x510012040c0b0000L) != 0L) return 37; return -1; case 4: if ((active0 & 0x88dbe57012c07000L) != 0L) { if (jjmatchedPos != 4) { jjmatchedKind = 77; jjmatchedPos = 4; } return 37; } if ((active0 & 0x6240001e0348000L) != 0L || (active1 & 0x1L) != 0L) return 37; return -1; case 5: if ((active0 & 0x8890e15090c05000L) != 0L) { jjmatchedKind = 77; jjmatchedPos = 5; return 37; } if ((active0 & 0x44b042002002000L) != 0L) return 37; return -1; case 6: if ((active0 & 0x8890815000401000L) != 0L) { jjmatchedKind = 77; jjmatchedPos = 6; return 37; } if ((active0 & 0x600090804000L) != 0L) return 37; return -1; case 7: if ((active0 & 0x880815000000000L) != 0L) { jjmatchedKind = 77; jjmatchedPos = 7; return 37; } if ((active0 & 0x8010000000401000L) != 0L) return 37; return -1; case 8: if ((active0 & 0x800810000000000L) != 0L) return 37; if ((active0 & 0x80005000000000L) != 0L) { jjmatchedKind = 77; jjmatchedPos = 8; return 37; } return -1; case 9: if ((active0 & 0x80000000000000L) != 0L) { jjmatchedKind = 77; jjmatchedPos = 9; return 37; } if ((active0 & 0x5000000000L) != 0L) return 37; return -1; case 10: if ((active0 & 0x80000000000000L) != 0L) { jjmatchedKind = 77; jjmatchedPos = 10; return 37; } return -1; default : return -1; } } private final int jjStartNfa_0(int pos, long active0, long active1, long active2) { return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1, active2), pos + 1); } private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 26: return jjStopAtPos(0, 128); case 33: jjmatchedKind = 92; return jjMoveStringLiteralDfa1_0(0x0L, 0x800000000L); case 37: jjmatchedKind = 111; return jjMoveStringLiteralDfa1_0(0x0L, 0x100000000000000L); case 38: jjmatchedKind = 108; return jjMoveStringLiteralDfa1_0(0x0L, 0x20002000000000L); case 40: return jjStopAtPos(0, 80); case 41: return jjStopAtPos(0, 81); case 42: jjmatchedKind = 106; return jjMoveStringLiteralDfa1_0(0x0L, 0x8000000000000L); case 43: jjmatchedKind = 104; return jjMoveStringLiteralDfa1_0(0x0L, 0x2004000000000L); case 44: return jjStopAtPos(0, 87); case 45: jjmatchedKind = 105; return jjMoveStringLiteralDfa1_0(0x0L, 0x4008000000000L); case 46: jjmatchedKind = 88; return jjMoveStringLiteralDfa1_0(0x0L, 0x1000000000000000L); case 47: jjmatchedKind = 107; return jjMoveStringLiteralDfa1_0(0x100L, 0x10000000000000L); case 58: return jjStopAtPos(0, 95); case 59: return jjStopAtPos(0, 86); case 60: jjmatchedKind = 91; return jjMoveStringLiteralDfa1_0(0x0L, 0x201000200000000L); case 61: jjmatchedKind = 90; return jjMoveStringLiteralDfa1_0(0x0L, 0x100000000L); case 62: jjmatchedKind = 127; return jjMoveStringLiteralDfa1_0(0x0L, 0x6c00000400000000L); case 63: return jjStopAtPos(0, 94); case 64: return jjStopAtPos(0, 89); case 91: return jjStopAtPos(0, 84); case 93: return jjStopAtPos(0, 85); case 94: jjmatchedKind = 110; return jjMoveStringLiteralDfa1_0(0x0L, 0x80000000000000L); case 97: return jjMoveStringLiteralDfa1_0(0x3000L, 0x0L); case 98: return jjMoveStringLiteralDfa1_0(0x1c000L, 0x0L); case 99: return jjMoveStringLiteralDfa1_0(0x7e0000L, 0x0L); case 100: return jjMoveStringLiteralDfa1_0(0x3800000L, 0x0L); case 101: return jjMoveStringLiteralDfa1_0(0x1c000000L, 0x0L); case 102: return jjMoveStringLiteralDfa1_0(0x3e0000000L, 0x0L); case 103: return jjMoveStringLiteralDfa1_0(0x400000000L, 0x0L); case 105: return jjMoveStringLiteralDfa1_0(0x1f800000000L, 0x0L); case 108: return jjMoveStringLiteralDfa1_0(0x20000000000L, 0x0L); case 110: return jjMoveStringLiteralDfa1_0(0x1c0000000000L, 0x0L); case 112: return jjMoveStringLiteralDfa1_0(0x1e00000000000L, 0x0L); case 114: return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0x0L); case 115: return jjMoveStringLiteralDfa1_0(0xfc000000000000L, 0x0L); case 116: return jjMoveStringLiteralDfa1_0(0x3f00000000000000L, 0x0L); case 118: return jjMoveStringLiteralDfa1_0(0xc000000000000000L, 0x0L); case 119: return jjMoveStringLiteralDfa1_0(0x0L, 0x1L); case 123: return jjStopAtPos(0, 82); case 124: jjmatchedKind = 109; return jjMoveStringLiteralDfa1_0(0x0L, 0x40001000000000L); case 125: return jjStopAtPos(0, 83); case 126: return jjStopAtPos(0, 93); default : return jjMoveNfa_0(0, 0); } } private int jjMoveStringLiteralDfa1_0(long active0, long active1) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(0, active0, active1, 0L); return 1; } switch(curChar) { case 38: if ((active1 & 0x2000000000L) != 0L) return jjStopAtPos(1, 101); break; case 42: if ((active0 & 0x100L) != 0L) return jjStartNfaWithStates_0(1, 8, 59); break; case 43: if ((active1 & 0x4000000000L) != 0L) return jjStopAtPos(1, 102); break; case 45: if ((active1 & 0x8000000000L) != 0L) return jjStopAtPos(1, 103); break; case 46: return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x1000000000000000L); case 60: if ((active1 & 0x1000000000000L) != 0L) { jjmatchedKind = 112; jjmatchedPos = 1; } return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x200000000000000L); case 61: if ((active1 & 0x100000000L) != 0L) return jjStopAtPos(1, 96); else if ((active1 & 0x200000000L) != 0L) return jjStopAtPos(1, 97); else if ((active1 & 0x400000000L) != 0L) return jjStopAtPos(1, 98); else if ((active1 & 0x800000000L) != 0L) return jjStopAtPos(1, 99); else if ((active1 & 0x2000000000000L) != 0L) return jjStopAtPos(1, 113); else if ((active1 & 0x4000000000000L) != 0L) return jjStopAtPos(1, 114); else if ((active1 & 0x8000000000000L) != 0L) return jjStopAtPos(1, 115); else if ((active1 & 0x10000000000000L) != 0L) return jjStopAtPos(1, 116); else if ((active1 & 0x20000000000000L) != 0L) return jjStopAtPos(1, 117); else if ((active1 & 0x40000000000000L) != 0L) return jjStopAtPos(1, 118); else if ((active1 & 0x80000000000000L) != 0L) return jjStopAtPos(1, 119); else if ((active1 & 0x100000000000000L) != 0L) return jjStopAtPos(1, 120); break; case 62: if ((active1 & 0x4000000000000000L) != 0L) { jjmatchedKind = 126; jjmatchedPos = 1; } return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2c00000000000000L); case 97: return jjMoveStringLiteralDfa2_0(active0, 0x240020060000L, active1, 0L); case 98: return jjMoveStringLiteralDfa2_0(active0, 0x1000L, active1, 0L); case 101: return jjMoveStringLiteralDfa2_0(active0, 0x2080000800000L, active1, 0L); case 102: if ((active0 & 0x800000000L) != 0L) return jjStartNfaWithStates_0(1, 35, 37); break; case 104: return jjMoveStringLiteralDfa2_0(active0, 0x704000000080000L, active1, 0x1L); case 105: return jjMoveStringLiteralDfa2_0(active0, 0xc0000000L, active1, 0L); case 108: return jjMoveStringLiteralDfa2_0(active0, 0x104100000L, active1, 0L); case 109: return jjMoveStringLiteralDfa2_0(active0, 0x3000000000L, active1, 0L); case 110: return jjMoveStringLiteralDfa2_0(active0, 0x1c008000000L, active1, 0L); case 111: if ((active0 & 0x1000000L) != 0L) { jjmatchedKind = 24; jjmatchedPos = 1; } return jjMoveStringLiteralDfa2_0(active0, 0xc000020602604000L, active1, 0L); case 114: return jjMoveStringLiteralDfa2_0(active0, 0x3800c00000008000L, active1, 0L); case 115: return jjMoveStringLiteralDfa2_0(active0, 0x2000L, active1, 0L); case 116: return jjMoveStringLiteralDfa2_0(active0, 0x18000000000000L, active1, 0L); case 117: return jjMoveStringLiteralDfa2_0(active0, 0x21100000000000L, active1, 0L); case 119: return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0L); case 120: return jjMoveStringLiteralDfa2_0(active0, 0x10000000L, active1, 0L); case 121: return jjMoveStringLiteralDfa2_0(active0, 0x80000000010000L, active1, 0L); case 124: if ((active1 & 0x1000000000L) != 0L) return jjStopAtPos(1, 100); break; default : break; } return jjStartNfa_0(0, active0, active1, 0L); } private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(0, old0, old1, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0, active1, 0L); return 2; } switch(curChar) { case 46: if ((active1 & 0x1000000000000000L) != 0L) return jjStopAtPos(2, 124); break; case 61: if ((active1 & 0x200000000000000L) != 0L) return jjStopAtPos(2, 121); else if ((active1 & 0x400000000000000L) != 0L) return jjStopAtPos(2, 122); break; case 62: if ((active1 & 0x2000000000000000L) != 0L) { jjmatchedKind = 125; jjmatchedPos = 2; } return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x800000000000000L); case 97: return jjMoveStringLiteralDfa3_0(active0, 0x808000000180000L, active1, 0L); case 98: return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L, active1, 0L); case 99: return jjMoveStringLiteralDfa3_0(active0, 0x200000000000L, active1, 0L); case 101: return jjMoveStringLiteralDfa3_0(active0, 0x8000L, active1, 0L); case 102: return jjMoveStringLiteralDfa3_0(active0, 0x800000L, active1, 0L); case 105: return jjMoveStringLiteralDfa3_0(active0, 0x4140400000000000L, active1, 0x1L); case 108: return jjMoveStringLiteralDfa3_0(active0, 0x8000100020000000L, active1, 0L); case 110: return jjMoveStringLiteralDfa3_0(active0, 0x800200c0600000L, active1, 0L); case 111: return jjMoveStringLiteralDfa3_0(active0, 0x4800100004000L, active1, 0L); case 112: return jjMoveStringLiteralDfa3_0(active0, 0x20003000000000L, active1, 0L); case 114: if ((active0 & 0x200000000L) != 0L) return jjStartNfaWithStates_0(2, 33, 37); return jjMoveStringLiteralDfa3_0(active0, 0x610000000000000L, active1, 0L); case 115: return jjMoveStringLiteralDfa3_0(active0, 0x4004023000L, active1, 0L); case 116: if ((active0 & 0x8000000000L) != 0L) { jjmatchedKind = 39; jjmatchedPos = 2; } return jjMoveStringLiteralDfa3_0(active0, 0x2050410050000L, active1, 0L); case 117: return jjMoveStringLiteralDfa3_0(active0, 0x100000000a000000L, active1, 0L); case 119: if ((active0 & 0x80000000000L) != 0L) return jjStartNfaWithStates_0(2, 43, 37); break; case 121: if ((active0 & 0x2000000000000000L) != 0L) return jjStartNfaWithStates_0(2, 61, 37); break; default : break; } return jjStartNfa_0(1, active0, active1, 0L); } private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(1, old0, old1, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0, active1, 0L); return 3; } switch(curChar) { case 61: if ((active1 & 0x800000000000000L) != 0L) return jjStopAtPos(3, 123); break; case 97: return jjMoveStringLiteralDfa4_0(active0, 0x80000001c0808000L, active1, 0L); case 98: return jjMoveStringLiteralDfa4_0(active0, 0x2000000L, active1, 0L); case 99: return jjMoveStringLiteralDfa4_0(active0, 0x80000000040000L, active1, 0L); case 100: if ((active0 & 0x4000000000000000L) != 0L) return jjStartNfaWithStates_0(3, 62, 37); break; case 101: if ((active0 & 0x10000L) != 0L) return jjStartNfaWithStates_0(3, 16, 37); else if ((active0 & 0x20000L) != 0L) return jjStartNfaWithStates_0(3, 17, 37); else if ((active0 & 0x4000000L) != 0L) return jjStartNfaWithStates_0(3, 26, 37); else if ((active0 & 0x1000000000000000L) != 0L) return jjStartNfaWithStates_0(3, 60, 37); return jjMoveStringLiteralDfa4_0(active0, 0x20010010002000L, active1, 0L); case 103: if ((active0 & 0x20000000000L) != 0L) return jjStartNfaWithStates_0(3, 41, 37); break; case 105: return jjMoveStringLiteralDfa4_0(active0, 0x10040000000000L, active1, 0L); case 107: return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L, active1, 0L); case 108: if ((active0 & 0x100000000000L) != 0L) return jjStartNfaWithStates_0(3, 44, 37); return jjMoveStringLiteralDfa4_0(active0, 0x1001000004000L, active1, 0x1L); case 109: if ((active0 & 0x8000000L) != 0L) return jjStartNfaWithStates_0(3, 27, 37); break; case 110: return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L, active1, 0L); case 111: if ((active0 & 0x400000000L) != 0L) return jjStartNfaWithStates_0(3, 34, 37); return jjMoveStringLiteralDfa4_0(active0, 0x600002000000000L, active1, 0L); case 114: if ((active0 & 0x80000L) != 0L) return jjStartNfaWithStates_0(3, 19, 37); return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L, active1, 0L); case 115: if ((active0 & 0x100000000000000L) != 0L) return jjStartNfaWithStates_0(3, 56, 37); return jjMoveStringLiteralDfa4_0(active0, 0x20300000L, active1, 0L); case 116: return jjMoveStringLiteralDfa4_0(active0, 0x48804000401000L, active1, 0L); case 117: return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000L, active1, 0L); case 118: return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L); default : break; } return jjStartNfa_0(2, active0, active1, 0L); } private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(2, old0, old1, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0, active1, 0L); return 4; } switch(curChar) { case 97: return jjMoveStringLiteralDfa5_0(active0, 0x604000000000L, active1, 0L); case 99: return jjMoveStringLiteralDfa5_0(active0, 0x50000000000000L, active1, 0L); case 101: if ((active0 & 0x20000000L) != 0L) return jjStartNfaWithStates_0(4, 29, 37); else if ((active1 & 0x1L) != 0L) return jjStartNfaWithStates_0(4, 64, 37); return jjMoveStringLiteralDfa5_0(active0, 0x801000004000L, active1, 0L); case 104: if ((active0 & 0x40000L) != 0L) return jjStartNfaWithStates_0(4, 18, 37); return jjMoveStringLiteralDfa5_0(active0, 0x80000000000000L, active1, 0L); case 105: return jjMoveStringLiteralDfa5_0(active0, 0x9000000400000L, active1, 0L); case 107: if ((active0 & 0x8000L) != 0L) return jjStartNfaWithStates_0(4, 15, 37); break; case 108: if ((active0 & 0x40000000L) != 0L) { jjmatchedKind = 30; jjmatchedPos = 4; } return jjMoveStringLiteralDfa5_0(active0, 0x82000000L, active1, 0L); case 110: return jjMoveStringLiteralDfa5_0(active0, 0x10000000L, active1, 0L); case 114: if ((active0 & 0x20000000000000L) != 0L) return jjStartNfaWithStates_0(4, 53, 37); return jjMoveStringLiteralDfa5_0(active0, 0x2012000003000L, active1, 0L); case 115: if ((active0 & 0x100000L) != 0L) return jjStartNfaWithStates_0(4, 20, 37); return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L, active1, 0L); case 116: if ((active0 & 0x200000L) != 0L) return jjStartNfaWithStates_0(4, 21, 37); else if ((active0 & 0x100000000L) != 0L) return jjStartNfaWithStates_0(4, 32, 37); else if ((active0 & 0x4000000000000L) != 0L) return jjStartNfaWithStates_0(4, 50, 37); return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000000L, active1, 0L); case 117: return jjMoveStringLiteralDfa5_0(active0, 0x800000L, active1, 0L); case 118: return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L); case 119: if ((active0 & 0x200000000000000L) != 0L) { jjmatchedKind = 57; jjmatchedPos = 4; } return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L, active1, 0L); default : break; } return jjStartNfa_0(3, active0, active1, 0L); } private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(3, old0, old1, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0, 0L, 0L); return 5; } switch(curChar) { case 97: return jjMoveStringLiteralDfa6_0(active0, 0x5000L); case 99: if ((active0 & 0x1000000000000L) != 0L) return jjStartNfaWithStates_0(5, 48, 37); else if ((active0 & 0x8000000000000L) != 0L) return jjStartNfaWithStates_0(5, 51, 37); return jjMoveStringLiteralDfa6_0(active0, 0x800000000000L); case 100: return jjMoveStringLiteralDfa6_0(active0, 0x10000000L); case 101: if ((active0 & 0x2000000L) != 0L) return jjStartNfaWithStates_0(5, 25, 37); else if ((active0 & 0x40000000000L) != 0L) return jjStartNfaWithStates_0(5, 42, 37); break; case 102: return jjMoveStringLiteralDfa6_0(active0, 0x10000000000L); case 103: return jjMoveStringLiteralDfa6_0(active0, 0x200000000000L); case 104: if ((active0 & 0x40000000000000L) != 0L) return jjStartNfaWithStates_0(5, 54, 37); break; case 105: return jjMoveStringLiteralDfa6_0(active0, 0x8800000000000000L); case 108: return jjMoveStringLiteralDfa6_0(active0, 0x80800000L); case 109: return jjMoveStringLiteralDfa6_0(active0, 0x1000000000L); case 110: if ((active0 & 0x2000000000000L) != 0L) return jjStartNfaWithStates_0(5, 49, 37); return jjMoveStringLiteralDfa6_0(active0, 0x4000400000L); case 114: return jjMoveStringLiteralDfa6_0(active0, 0x80000000000000L); case 115: if ((active0 & 0x400000000000000L) != 0L) return jjStartNfaWithStates_0(5, 58, 37); break; case 116: if ((active0 & 0x2000L) != 0L) return jjStartNfaWithStates_0(5, 13, 37); else if ((active0 & 0x2000000000L) != 0L) return jjStartNfaWithStates_0(5, 37, 37); return jjMoveStringLiteralDfa6_0(active0, 0x10400000000000L); default : break; } return jjStartNfa_0(4, active0, 0L, 0L); } private int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0, 0L, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0, 0L, 0L); return 6; } switch(curChar) { case 97: return jjMoveStringLiteralDfa7_0(active0, 0x10000000000L); case 99: return jjMoveStringLiteralDfa7_0(active0, 0x4000001000L); case 101: if ((active0 & 0x200000000000L) != 0L) return jjStartNfaWithStates_0(6, 45, 37); else if ((active0 & 0x400000000000L) != 0L) return jjStartNfaWithStates_0(6, 46, 37); return jjMoveStringLiteralDfa7_0(active0, 0x800001000000000L); case 102: return jjMoveStringLiteralDfa7_0(active0, 0x10000000000000L); case 108: return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000000L); case 110: if ((active0 & 0x4000L) != 0L) return jjStartNfaWithStates_0(6, 14, 37); break; case 111: return jjMoveStringLiteralDfa7_0(active0, 0x80000000000000L); case 115: if ((active0 & 0x10000000L) != 0L) return jjStartNfaWithStates_0(6, 28, 37); break; case 116: if ((active0 & 0x800000L) != 0L) return jjStartNfaWithStates_0(6, 23, 37); return jjMoveStringLiteralDfa7_0(active0, 0x800000000000L); case 117: return jjMoveStringLiteralDfa7_0(active0, 0x400000L); case 121: if ((active0 & 0x80000000L) != 0L) return jjStartNfaWithStates_0(6, 31, 37); break; default : break; } return jjStartNfa_0(5, active0, 0L, 0L); } private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0, 0L, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0, 0L, 0L); return 7; } switch(curChar) { case 99: return jjMoveStringLiteralDfa8_0(active0, 0x10000000000L); case 101: if ((active0 & 0x400000L) != 0L) return jjStartNfaWithStates_0(7, 22, 37); else if ((active0 & 0x8000000000000000L) != 0L) return jjStartNfaWithStates_0(7, 63, 37); return jjMoveStringLiteralDfa8_0(active0, 0x804000000000L); case 110: return jjMoveStringLiteralDfa8_0(active0, 0x880001000000000L); case 112: if ((active0 & 0x10000000000000L) != 0L) return jjStartNfaWithStates_0(7, 52, 37); break; case 116: if ((active0 & 0x1000L) != 0L) return jjStartNfaWithStates_0(7, 12, 37); break; default : break; } return jjStartNfa_0(6, active0, 0L, 0L); } private int jjMoveStringLiteralDfa8_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(6, old0, 0L, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(7, active0, 0L, 0L); return 8; } switch(curChar) { case 100: if ((active0 & 0x800000000000L) != 0L) return jjStartNfaWithStates_0(8, 47, 37); break; case 101: if ((active0 & 0x10000000000L) != 0L) return jjStartNfaWithStates_0(8, 40, 37); break; case 105: return jjMoveStringLiteralDfa9_0(active0, 0x80000000000000L); case 111: return jjMoveStringLiteralDfa9_0(active0, 0x4000000000L); case 116: if ((active0 & 0x800000000000000L) != 0L) return jjStartNfaWithStates_0(8, 59, 37); return jjMoveStringLiteralDfa9_0(active0, 0x1000000000L); default : break; } return jjStartNfa_0(7, active0, 0L, 0L); } private int jjMoveStringLiteralDfa9_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(7, old0, 0L, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(8, active0, 0L, 0L); return 9; } switch(curChar) { case 102: if ((active0 & 0x4000000000L) != 0L) return jjStartNfaWithStates_0(9, 38, 37); break; case 115: if ((active0 & 0x1000000000L) != 0L) return jjStartNfaWithStates_0(9, 36, 37); break; case 122: return jjMoveStringLiteralDfa10_0(active0, 0x80000000000000L); default : break; } return jjStartNfa_0(8, active0, 0L, 0L); } private int jjMoveStringLiteralDfa10_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(8, old0, 0L, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(9, active0, 0L, 0L); return 10; } switch(curChar) { case 101: return jjMoveStringLiteralDfa11_0(active0, 0x80000000000000L); default : break; } return jjStartNfa_0(9, active0, 0L, 0L); } private int jjMoveStringLiteralDfa11_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(9, old0, 0L, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(10, active0, 0L, 0L); return 11; } switch(curChar) { case 100: if ((active0 & 0x80000000000000L) != 0L) return jjStartNfaWithStates_0(11, 55, 37); break; default : break; } return jjStartNfa_0(10, active0, 0L, 0L); } private int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); } static final long[] jjbitVec0 = { 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; static final long[] jjbitVec3 = { 0xfff0000000200002L, 0xffffffffffffdfffL, 0xfffff00f7fffffffL, 0x12000000007fffffL }; static final long[] jjbitVec4 = { 0x0L, 0x0L, 0x420043c00000000L, 0xff7fffffff7fffffL }; static final long[] jjbitVec5 = { 0x7fffffffffffffL, 0xffffffffffff0000L, 0xffffffffffffffffL, 0x401f0003ffc3L }; static final long[] jjbitVec6 = { 0x0L, 0x400000000000000L, 0xfffffffbffffd740L, 0xfbfffffffff7fffL }; static final long[] jjbitVec7 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffffc03L, 0x33fffffffff7fffL }; static final long[] jjbitVec8 = { 0xfffe00000000ffffL, 0xfffffffe027fffffL, 0xffL, 0x707ffffff0000L }; static final long[] jjbitVec9 = { 0x7fffffe00000000L, 0xfffec000000007ffL, 0xffffffffffffffffL, 0x9c00c060002fffffL }; static final long[] jjbitVec10 = { 0xfffffffd0000L, 0xe000L, 0x2003fffffffffL, 0x0L }; static final long[] jjbitVec11 = { 0x23fffffffffffff0L, 0x3ff010000L, 0x23c5fdfffff99fe0L, 0xf0003b0000000L }; static final long[] jjbitVec12 = { 0x36dfdfffff987e0L, 0x1c00005e000000L, 0x23edfdfffffbbfe0L, 0x2000300010000L }; static final long[] jjbitVec13 = { 0x23edfdfffff99fe0L, 0x20003b0000000L, 0x3bfc718d63dc7e8L, 0x200000000000000L }; static final long[] jjbitVec14 = { 0x3effdfffffddfe0L, 0x300000000L, 0x23effdfffffddfe0L, 0x340000000L }; static final long[] jjbitVec15 = { 0x3fffdfffffddfe0L, 0x300000000L, 0x2ffbfffffc7fffe0L, 0x7fL }; static final long[] jjbitVec16 = { 0x800dfffffffffffeL, 0x7fL, 0x200decaefef02596L, 0x3000005fL }; static final long[] jjbitVec17 = { 0x1L, 0x7fffffffeffL, 0xf00L, 0x0L }; static final long[] jjbitVec18 = { 0x6fbffffffffL, 0x3f0000L, 0xffffffff00000000L, 0x1ffffffffff003fL }; static final long[] jjbitVec19 = { 0xffffffffffffffffL, 0xffffffff83ffffffL, 0xffffff07ffffffffL, 0x3ffffffffffffffL }; static final long[] jjbitVec20 = { 0xffffffffffffff7fL, 0xffffffff3d7f3d7fL, 0x7f3d7fffffff3d7fL, 0xffff7fffff7f7f3dL }; static final long[] jjbitVec21 = { 0xffffffff7f3d7fffL, 0x7ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL }; static final long[] jjbitVec22 = { 0xffffffffffffffffL, 0x7f9fffffffffffL, 0xffffffff07fffffeL, 0x1c7ffffffffffL }; static final long[] jjbitVec23 = { 0x3ffff0003dfffL, 0x1dfff0003ffffL, 0xfffffffffffffL, 0x18800000L }; static final long[] jjbitVec24 = { 0xffffffff00000000L, 0xffffffffffffffL, 0x1ffffffffffL, 0x0L }; static final long[] jjbitVec25 = { 0x1fffffffL, 0x1f3fffffff0000L, 0x0L, 0x0L }; static final long[] jjbitVec26 = { 0xffffffffffffffffL, 0xfffffffffffL, 0x0L, 0x0L }; static final long[] jjbitVec27 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffff0fffffffL, 0x3ffffffffffffffL }; static final long[] jjbitVec28 = { 0xffffffff3f3fffffL, 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL, 0x1fdc1fff0fcf1fdcL }; static final long[] jjbitVec29 = { 0x8000000000000000L, 0x8002000000100001L, 0x3ffff00000000L, 0x0L }; static final long[] jjbitVec30 = { 0xe3fbbd503e2ffc84L, 0xffffffff000003e0L, 0xfL, 0x0L }; static final long[] jjbitVec31 = { 0x1f3e03fe000000e0L, 0xfffffffffffffffeL, 0xfffffffee07fffffL, 0xffffffffffffffffL }; static final long[] jjbitVec32 = { 0xfffe1fffffffffe0L, 0xffffffffffffffffL, 0xffffff00007fffL, 0xffff000000000000L }; static final long[] jjbitVec33 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffffffL, 0x0L }; static final long[] jjbitVec34 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffL, 0x0L }; static final long[] jjbitVec35 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0x1fffL, 0x0L }; static final long[] jjbitVec36 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffL, 0x0L }; static final long[] jjbitVec37 = { 0x6L, 0x0L, 0x0L, 0x0L }; static final long[] jjbitVec38 = { 0xffff3fffffffffffL, 0x7ffffffffffL, 0x0L, 0x0L }; static final long[] jjbitVec39 = { 0x5f7ffdffa0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L }; static final long[] jjbitVec40 = { 0x3fffffffffffffffL, 0xffffffffffff0000L, 0xfffffffffffcffffL, 0x1fff0000000000ffL }; static final long[] jjbitVec41 = { 0x18000000000000L, 0xffdf02000000e000L, 0xffffffffffffffffL, 0x1fffffffffffffffL }; static final long[] jjbitVec42 = { 0x87fffffe00000010L, 0xffffffe007fffffeL, 0x7fffffffffffffffL, 0x631cfcfcfcL }; static final long[] jjbitVec43 = { 0x0L, 0x0L, 0x420243cffffffffL, 0xff7fffffff7fffffL }; static final long[] jjbitVec44 = { 0xffffffffffffffffL, 0x400ffffe0ffffffL, 0xfffffffbffffd740L, 0xfbfffffffff7fffL }; static final long[] jjbitVec45 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffffc7bL, 0x33fffffffff7fffL }; static final long[] jjbitVec46 = { 0xfffe00000000ffffL, 0xfffffffe027fffffL, 0xbbfffffbfffe00ffL, 0x707ffffff0016L }; static final long[] jjbitVec47 = { 0x7fffffe003f000fL, 0xffffc3ff01ffffffL, 0xffffffffffffffffL, 0x9ffffdffbfefffffL }; static final long[] jjbitVec48 = { 0xffffffffffff8000L, 0xe7ffL, 0x3ffffffffffffL, 0x0L }; static final long[] jjbitVec49 = { 0xf3fffffffffffffeL, 0xffcfff1f3fffL, 0xf3c5fdfffff99feeL, 0xfffcfb080399fL }; static final long[] jjbitVec50 = { 0xd36dfdfffff987eeL, 0x1fffc05e003987L, 0xf3edfdfffffbbfeeL, 0x2ffcf00013bbfL }; static final long[] jjbitVec51 = { 0xf3edfdfffff99feeL, 0x2ffc3b0c0398fL, 0xc3bfc718d63dc7ecL, 0x200ff8000803dc7L }; static final long[] jjbitVec52 = { 0xc3effdfffffddfeeL, 0xffc300603ddfL, 0xf3effdfffffddfecL, 0xffc340603ddfL }; static final long[] jjbitVec53 = { 0xc3fffdfffffddfecL, 0xffc300803dcfL, 0x2ffbfffffc7fffecL, 0xc0000ff5f847fL }; static final long[] jjbitVec54 = { 0x87fffffffffffffeL, 0x3ff7fffL, 0x3bffecaefef02596L, 0x33ff3f5fL }; static final long[] jjbitVec55 = { 0xc2a003ff03000001L, 0xfffe07fffffffeffL, 0x1ffffffffeff0fdfL, 0x40L }; static final long[] jjbitVec56 = { 0x3c7f6fbffffffffL, 0x3ff03ffL, 0xffffffff00000000L, 0x1ffffffffff003fL }; static final long[] jjbitVec57 = { 0xffffffff7f3d7fffL, 0x3fe0007ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL }; static final long[] jjbitVec58 = { 0x1fffff001fdfffL, 0xddfff000fffffL, 0xffffffffffffffffL, 0x3ff388fffffL }; static final long[] jjbitVec59 = { 0xffffffff03ff3800L, 0xffffffffffffffL, 0x3ffffffffffL, 0x0L }; static final long[] jjbitVec60 = { 0xfff0fff1fffffffL, 0x1f3fffffffffc0L, 0x0L, 0x0L }; static final long[] jjbitVec61 = { 0x80007c000000f000L, 0x8002fc0f00100001L, 0x3ffff00000000L, 0x7e21fff0000L }; static final long[] jjbitVec62 = { 0x1f3efffe000000e0L, 0xfffffffffffffffeL, 0xfffffffee67fffffL, 0xffffffffffffffffL }; static final long[] jjbitVec63 = { 0x10000000000006L, 0x0L, 0x0L, 0x0L }; static final long[] jjbitVec64 = { 0x3L, 0x0L, 0x0L, 0x0L }; static final long[] jjbitVec65 = { 0x0L, 0x800000000000000L, 0x0L, 0x0L }; static final long[] jjbitVec66 = { 0x5f7ffdffe0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L }; static final long[] jjbitVec67 = { 0x18000f0000ffffL, 0xffdf02000000e000L, 0xffffffffffffffffL, 0x9fffffffffffffffL }; static final long[] jjbitVec68 = { 0x87fffffe03ff0010L, 0xffffffe007fffffeL, 0x7fffffffffffffffL, 0xe0000631cfcfcfcL }; private int jjMoveNfa_0(int startState, int curPos) { int startsAt = 0; jjnewStateCnt = 86; int i = 1; jjstateSet[0] = startState; int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; do { switch(jjstateSet[--i]) { case 54: if (curChar == 42) jjstateSet[jjnewStateCnt++] = 59; else if (curChar == 47) { if (kind > 6) kind = 6; jjCheckNAddStates(0, 2); } break; case 0: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(3, 9); else if (curChar == 47) jjAddStates(10, 11); else if (curChar == 36) { if (kind > 77) kind = 77; jjCheckNAdd(37); } else if (curChar == 34) jjCheckNAddStates(12, 15); else if (curChar == 39) jjAddStates(16, 18); else if (curChar == 46) jjCheckNAdd(1); if ((0x3fe000000000000L & l) != 0L) { if (kind > 66) kind = 66; jjCheckNAddStates(19, 21); } else if (curChar == 48) { if (kind > 66) kind = 66; jjCheckNAddStates(22, 28); } break; case 1: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 70) kind = 70; jjCheckNAddStates(29, 31); break; case 3: if ((0x280000000000L & l) != 0L) jjCheckNAdd(4); break; case 4: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 70) kind = 70; jjCheckNAddTwoStates(4, 5); break; case 6: if (curChar == 39) jjAddStates(16, 18); break; case 7: if ((0xffffff7fffffdbffL & l) != 0L) jjCheckNAdd(8); break; case 8: if (curChar == 39 && kind > 75) kind = 75; break; case 10: if ((0x8400000000L & l) != 0L) jjCheckNAdd(8); break; case 11: if ((0xff000000000000L & l) != 0L) jjCheckNAddTwoStates(12, 8); break; case 12: if ((0xff000000000000L & l) != 0L) jjCheckNAdd(8); break; case 13: if ((0xf000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 14; break; case 14: if ((0xff000000000000L & l) != 0L) jjCheckNAdd(12); break; case 16: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 17; break; case 17: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 18; break; case 18: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 19; break; case 19: if ((0x3ff000000000000L & l) != 0L) jjCheckNAdd(8); break; case 21: if (curChar == 34) jjCheckNAddStates(12, 15); break; case 22: if ((0xfffffffbffffdbffL & l) != 0L) jjCheckNAddStates(12, 15); break; case 24: if ((0x8400000000L & l) != 0L) jjCheckNAddStates(12, 15); break; case 26: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 27; break; case 27: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 28; break; case 28: if ((0x3ff000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 29; break; case 29: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(12, 15); break; case 31: if (curChar == 34 && kind > 76) kind = 76; break; case 32: if ((0xff000000000000L & l) != 0L) jjCheckNAddStates(32, 36); break; case 33: if ((0xff000000000000L & l) != 0L) jjCheckNAddStates(12, 15); break; case 34: if ((0xf000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 35; break; case 35: if ((0xff000000000000L & l) != 0L) jjCheckNAdd(33); break; case 36: if (curChar != 36) break; if (kind > 77) kind = 77; jjCheckNAdd(37); break; case 37: if ((0x3ff00100fffc1ffL & l) == 0L) break; if (kind > 77) kind = 77; jjCheckNAdd(37); break; case 38: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(3, 9); break; case 39: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(37, 39); break; case 41: if ((0x280000000000L & l) != 0L) jjCheckNAdd(42); break; case 42: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(42, 5); break; case 43: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(43, 44); break; case 45: if ((0x280000000000L & l) != 0L) jjCheckNAdd(46); break; case 46: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 70) kind = 70; jjCheckNAddTwoStates(46, 5); break; case 47: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(47, 48); break; case 48: if (curChar != 46) break; if (kind > 70) kind = 70; jjCheckNAddStates(40, 42); break; case 49: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 70) kind = 70; jjCheckNAddStates(40, 42); break; case 51: if ((0x280000000000L & l) != 0L) jjCheckNAdd(52); break; case 52: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 70) kind = 70; jjCheckNAddTwoStates(52, 5); break; case 53: if (curChar == 47) jjAddStates(10, 11); break; case 55: if ((0xffffffffffffdbffL & l) == 0L) break; if (kind > 6) kind = 6; jjCheckNAddStates(0, 2); break; case 56: if ((0x2400L & l) != 0L && kind > 6) kind = 6; break; case 57: if (curChar == 10 && kind > 6) kind = 6; break; case 58: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 57; break; case 59: if (curChar == 42) jjstateSet[jjnewStateCnt++] = 60; break; case 60: if ((0xffff7fffffffffffL & l) != 0L && kind > 7) kind = 7; break; case 61: if (curChar == 42) jjstateSet[jjnewStateCnt++] = 59; break; case 62: if ((0x3fe000000000000L & l) == 0L) break; if (kind > 66) kind = 66; jjCheckNAddStates(19, 21); break; case 63: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(63, 64); break; case 65: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 66) kind = 66; jjCheckNAdd(65); break; case 66: if (curChar != 48) break; if (kind > 66) kind = 66; jjCheckNAddStates(22, 28); break; case 68: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(68, 64); break; case 69: if ((0xff000000000000L & l) != 0L) jjCheckNAddTwoStates(69, 64); break; case 71: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 66) kind = 66; jjstateSet[jjnewStateCnt++] = 71; break; case 72: if ((0xff000000000000L & l) == 0L) break; if (kind > 66) kind = 66; jjCheckNAdd(72); break; case 74: if ((0x3ff000000000000L & l) != 0L) jjAddStates(43, 44); break; case 75: if (curChar == 46) jjCheckNAdd(76); break; case 76: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(76, 77); break; case 78: if ((0x280000000000L & l) != 0L) jjCheckNAdd(79); break; case 79: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 70) kind = 70; jjCheckNAddTwoStates(79, 5); break; case 81: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(45, 47); break; case 82: if (curChar == 46) jjCheckNAdd(83); break; case 84: if ((0x280000000000L & l) != 0L) jjCheckNAdd(85); break; case 85: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 70) kind = 70; jjCheckNAddTwoStates(85, 5); break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 77) kind = 77; jjCheckNAdd(37); break; case 2: if ((0x2000000020L & l) != 0L) jjAddStates(48, 49); break; case 5: if ((0x5000000050L & l) != 0L && kind > 70) kind = 70; break; case 7: if ((0xffffffffefffffffL & l) != 0L) jjCheckNAdd(8); break; case 9: if (curChar == 92) jjAddStates(50, 52); break; case 10: if ((0x14404410000000L & l) != 0L) jjCheckNAdd(8); break; case 15: if (curChar == 117) jjstateSet[jjnewStateCnt++] = 16; break; case 16: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 17; break; case 17: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 18; break; case 18: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 19; break; case 19: if ((0x7e0000007eL & l) != 0L) jjCheckNAdd(8); break; case 20: if (curChar == 92) jjstateSet[jjnewStateCnt++] = 15; break; case 22: if ((0xffffffffefffffffL & l) != 0L) jjCheckNAddStates(12, 15); break; case 23: if (curChar == 92) jjAddStates(53, 55); break; case 24: if ((0x14404410000000L & l) != 0L) jjCheckNAddStates(12, 15); break; case 25: if (curChar == 117) jjstateSet[jjnewStateCnt++] = 26; break; case 26: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 27; break; case 27: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 28; break; case 28: if ((0x7e0000007eL & l) != 0L) jjstateSet[jjnewStateCnt++] = 29; break; case 29: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(12, 15); break; case 30: if (curChar == 92) jjstateSet[jjnewStateCnt++] = 25; break; case 37: if ((0x87fffffe87fffffeL & l) == 0L) break; if (kind > 77) kind = 77; jjCheckNAdd(37); break; case 40: if ((0x2000000020L & l) != 0L) jjAddStates(56, 57); break; case 44: if ((0x2000000020L & l) != 0L) jjAddStates(58, 59); break; case 50: if ((0x2000000020L & l) != 0L) jjAddStates(60, 61); break; case 55: if (kind > 6) kind = 6; jjAddStates(0, 2); break; case 60: if (kind > 7) kind = 7; break; case 64: if ((0x100000001000L & l) != 0L && kind > 65) kind = 65; break; case 67: if ((0x100000001000000L & l) != 0L) jjCheckNAdd(68); break; case 68: if ((0x7e0000007eL & l) != 0L) jjCheckNAddTwoStates(68, 64); break; case 70: if ((0x100000001000000L & l) != 0L) jjCheckNAdd(71); break; case 71: if ((0x7e0000007eL & l) == 0L) break; if (kind > 66) kind = 66; jjCheckNAdd(71); break; case 73: if ((0x100000001000000L & l) != 0L) jjCheckNAddTwoStates(74, 75); break; case 74: if ((0x7e0000007eL & l) != 0L) jjCheckNAddTwoStates(74, 75); break; case 76: if ((0x7e0000007eL & l) != 0L) jjAddStates(62, 63); break; case 77: if ((0x1000000010000L & l) != 0L) jjAddStates(64, 65); break; case 80: if ((0x100000001000000L & l) != 0L) jjCheckNAdd(81); break; case 81: if ((0x7e0000007eL & l) != 0L) jjCheckNAddStates(45, 47); break; case 83: if ((0x1000000010000L & l) != 0L) jjAddStates(66, 67); break; default : break; } } while(i != startsAt); } else { int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 77) kind = 77; jjCheckNAdd(37); break; case 7: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjstateSet[jjnewStateCnt++] = 8; break; case 22: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(12, 15); break; case 37: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 77) kind = 77; jjCheckNAdd(37); break; case 55: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 6) kind = 6; jjAddStates(0, 2); break; case 60: if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 7) kind = 7; break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 86 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } private int jjMoveStringLiteralDfa0_2() { switch(curChar) { case 42: return jjMoveStringLiteralDfa1_2(0x400L); default : return 1; } } private int jjMoveStringLiteralDfa1_2(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return 1; } switch(curChar) { case 47: if ((active0 & 0x400L) != 0L) return jjStopAtPos(1, 10); break; default : return 2; } return 2; } private int jjMoveStringLiteralDfa0_1() { switch(curChar) { case 42: return jjMoveStringLiteralDfa1_1(0x200L); default : return 1; } } private int jjMoveStringLiteralDfa1_1(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return 1; } switch(curChar) { case 47: if ((active0 & 0x200L) != 0L) return jjStopAtPos(1, 9); break; default : return 2; } return 2; } static final int[] jjnextStates = { 55, 56, 58, 39, 40, 5, 43, 44, 47, 48, 54, 61, 22, 23, 30, 31, 7, 9, 20, 63, 64, 65, 67, 69, 64, 70, 72, 73, 80, 1, 2, 5, 22, 23, 33, 30, 31, 39, 40, 5, 49, 50, 5, 74, 75, 81, 82, 83, 3, 4, 10, 11, 13, 24, 32, 34, 41, 42, 45, 46, 51, 52, 76, 77, 78, 79, 84, 85, }; private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec2[i2] & l2) != 0L); default : if ((jjbitVec0[i1] & l1) != 0L) return true; return false; } } private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec4[i2] & l2) != 0L); case 2: return ((jjbitVec5[i2] & l2) != 0L); case 3: return ((jjbitVec6[i2] & l2) != 0L); case 4: return ((jjbitVec7[i2] & l2) != 0L); case 5: return ((jjbitVec8[i2] & l2) != 0L); case 6: return ((jjbitVec9[i2] & l2) != 0L); case 7: return ((jjbitVec10[i2] & l2) != 0L); case 9: return ((jjbitVec11[i2] & l2) != 0L); case 10: return ((jjbitVec12[i2] & l2) != 0L); case 11: return ((jjbitVec13[i2] & l2) != 0L); case 12: return ((jjbitVec14[i2] & l2) != 0L); case 13: return ((jjbitVec15[i2] & l2) != 0L); case 14: return ((jjbitVec16[i2] & l2) != 0L); case 15: return ((jjbitVec17[i2] & l2) != 0L); case 16: return ((jjbitVec18[i2] & l2) != 0L); case 17: return ((jjbitVec19[i2] & l2) != 0L); case 18: return ((jjbitVec20[i2] & l2) != 0L); case 19: return ((jjbitVec21[i2] & l2) != 0L); case 20: return ((jjbitVec0[i2] & l2) != 0L); case 22: return ((jjbitVec22[i2] & l2) != 0L); case 23: return ((jjbitVec23[i2] & l2) != 0L); case 24: return ((jjbitVec24[i2] & l2) != 0L); case 25: return ((jjbitVec25[i2] & l2) != 0L); case 29: return ((jjbitVec26[i2] & l2) != 0L); case 30: return ((jjbitVec27[i2] & l2) != 0L); case 31: return ((jjbitVec28[i2] & l2) != 0L); case 32: return ((jjbitVec29[i2] & l2) != 0L); case 33: return ((jjbitVec30[i2] & l2) != 0L); case 48: return ((jjbitVec31[i2] & l2) != 0L); case 49: return ((jjbitVec32[i2] & l2) != 0L); case 77: return ((jjbitVec33[i2] & l2) != 0L); case 159: return ((jjbitVec34[i2] & l2) != 0L); case 164: return ((jjbitVec35[i2] & l2) != 0L); case 215: return ((jjbitVec36[i2] & l2) != 0L); case 216: return ((jjbitVec37[i2] & l2) != 0L); case 250: return ((jjbitVec38[i2] & l2) != 0L); case 251: return ((jjbitVec39[i2] & l2) != 0L); case 253: return ((jjbitVec40[i2] & l2) != 0L); case 254: return ((jjbitVec41[i2] & l2) != 0L); case 255: return ((jjbitVec42[i2] & l2) != 0L); default : if ((jjbitVec3[i1] & l1) != 0L) return true; return false; } } private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec43[i2] & l2) != 0L); case 2: return ((jjbitVec5[i2] & l2) != 0L); case 3: return ((jjbitVec44[i2] & l2) != 0L); case 4: return ((jjbitVec45[i2] & l2) != 0L); case 5: return ((jjbitVec46[i2] & l2) != 0L); case 6: return ((jjbitVec47[i2] & l2) != 0L); case 7: return ((jjbitVec48[i2] & l2) != 0L); case 9: return ((jjbitVec49[i2] & l2) != 0L); case 10: return ((jjbitVec50[i2] & l2) != 0L); case 11: return ((jjbitVec51[i2] & l2) != 0L); case 12: return ((jjbitVec52[i2] & l2) != 0L); case 13: return ((jjbitVec53[i2] & l2) != 0L); case 14: return ((jjbitVec54[i2] & l2) != 0L); case 15: return ((jjbitVec55[i2] & l2) != 0L); case 16: return ((jjbitVec56[i2] & l2) != 0L); case 17: return ((jjbitVec19[i2] & l2) != 0L); case 18: return ((jjbitVec20[i2] & l2) != 0L); case 19: return ((jjbitVec57[i2] & l2) != 0L); case 20: return ((jjbitVec0[i2] & l2) != 0L); case 22: return ((jjbitVec22[i2] & l2) != 0L); case 23: return ((jjbitVec58[i2] & l2) != 0L); case 24: return ((jjbitVec59[i2] & l2) != 0L); case 25: return ((jjbitVec60[i2] & l2) != 0L); case 29: return ((jjbitVec26[i2] & l2) != 0L); case 30: return ((jjbitVec27[i2] & l2) != 0L); case 31: return ((jjbitVec28[i2] & l2) != 0L); case 32: return ((jjbitVec61[i2] & l2) != 0L); case 33: return ((jjbitVec30[i2] & l2) != 0L); case 48: return ((jjbitVec62[i2] & l2) != 0L); case 49: return ((jjbitVec32[i2] & l2) != 0L); case 77: return ((jjbitVec33[i2] & l2) != 0L); case 159: return ((jjbitVec34[i2] & l2) != 0L); case 164: return ((jjbitVec35[i2] & l2) != 0L); case 215: return ((jjbitVec36[i2] & l2) != 0L); case 216: return ((jjbitVec63[i2] & l2) != 0L); case 220: return ((jjbitVec64[i2] & l2) != 0L); case 221: return ((jjbitVec65[i2] & l2) != 0L); case 250: return ((jjbitVec38[i2] & l2) != 0L); case 251: return ((jjbitVec66[i2] & l2) != 0L); case 253: return ((jjbitVec40[i2] & l2) != 0L); case 254: return ((jjbitVec67[i2] & l2) != 0L); case 255: return ((jjbitVec68[i2] & l2) != 0L); default : if ((jjbitVec3[i1] & l1) != 0L) return true; return false; } } /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, null, null, null, null, "\141\142\163\164\162\141\143\164", "\141\163\163\145\162\164", "\142\157\157\154\145\141\156", "\142\162\145\141\153", "\142\171\164\145", "\143\141\163\145", "\143\141\164\143\150", "\143\150\141\162", "\143\154\141\163\163", "\143\157\156\163\164", "\143\157\156\164\151\156\165\145", "\144\145\146\141\165\154\164", "\144\157", "\144\157\165\142\154\145", "\145\154\163\145", "\145\156\165\155", "\145\170\164\145\156\144\163", "\146\141\154\163\145", "\146\151\156\141\154", "\146\151\156\141\154\154\171", "\146\154\157\141\164", "\146\157\162", "\147\157\164\157", "\151\146", "\151\155\160\154\145\155\145\156\164\163", "\151\155\160\157\162\164", "\151\156\163\164\141\156\143\145\157\146", "\151\156\164", "\151\156\164\145\162\146\141\143\145", "\154\157\156\147", "\156\141\164\151\166\145", "\156\145\167", "\156\165\154\154", "\160\141\143\153\141\147\145", "\160\162\151\166\141\164\145", "\160\162\157\164\145\143\164\145\144", "\160\165\142\154\151\143", "\162\145\164\165\162\156", "\163\150\157\162\164", "\163\164\141\164\151\143", "\163\164\162\151\143\164\146\160", "\163\165\160\145\162", "\163\167\151\164\143\150", "\163\171\156\143\150\162\157\156\151\172\145\144", "\164\150\151\163", "\164\150\162\157\167", "\164\150\162\157\167\163", "\164\162\141\156\163\151\145\156\164", "\164\162\165\145", "\164\162\171", "\166\157\151\144", "\166\157\154\141\164\151\154\145", "\167\150\151\154\145", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "\50", "\51", "\173", "\175", "\133", "\135", "\73", "\54", "\56", "\100", "\75", "\74", "\41", "\176", "\77", "\72", "\75\75", "\74\75", "\76\75", "\41\75", "\174\174", "\46\46", "\53\53", "\55\55", "\53", "\55", "\52", "\57", "\46", "\174", "\136", "\45", "\74\74", "\53\75", "\55\75", "\52\75", "\57\75", "\46\75", "\174\75", "\136\75", "\45\75", "\74\74\75", "\76\76\75", "\76\76\76\75", "\56\56\56", "\76\76\76", "\76\76", "\76", "\32", }; /** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", "IN_JAVA_DOC_COMMENT", "IN_MULTI_LINE_COMMENT", }; /** Lex State array. */ public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, -1, -1, 1, 2, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; static final long[] jjtoToken = { 0xfffffffffffff001L, 0xffffffffffff3847L, 0x1L, }; static final long[] jjtoSkip = { 0x67eL, 0x0L, 0x0L, }; static final long[] jjtoSpecial = { 0x640L, 0x0L, 0x0L, }; static final long[] jjtoMore = { 0x980L, 0x0L, 0x0L, }; protected JavaCharStream input_stream; private final int[] jjrounds = new int[86]; private final int[] jjstateSet = new int[172]; private final StringBuilder jjimage = new StringBuilder(); private StringBuilder image = jjimage; private int jjimageLen; private int lengthOfMatch; protected char curChar; /** Constructor. */ public ASTParserTokenManager(JavaCharStream stream){ if (JavaCharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream; } /** Constructor. */ public ASTParserTokenManager(JavaCharStream stream, int lexState){ this(stream); SwitchTo(lexState); } /** Reinitialise parser. */ public void ReInit(JavaCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 86; i-- > 0;) jjrounds[i] = 0x80000000; } /** Reinitialise parser. */ public void ReInit(JavaCharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } /** Switch to specified lex state. */ public void SwitchTo(int lexState) { if (lexState >= 3 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } protected Token jjFillToken() { final Token t; final String curTokenImage; final int beginLine; final int endLine; final int beginColumn; final int endColumn; String im = jjstrLiteralImages[jjmatchedKind]; curTokenImage = (im == null) ? input_stream.GetImage() : im; beginLine = input_stream.getBeginLine(); beginColumn = input_stream.getBeginColumn(); endLine = input_stream.getEndLine(); endColumn = input_stream.getEndColumn(); t = ASTParser.GTToken.newToken(jjmatchedKind, curTokenImage); t.beginLine = beginLine; t.endLine = endLine; t.beginColumn = beginColumn; t.endColumn = endColumn; return t; } int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; int jjround; int jjmatchedPos; int jjmatchedKind; /** Get the next Token. */ public Token getNextToken() { Token specialToken = null; Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; CommonTokenAction(matchedToken); return matchedToken; } image = jjimage; image.setLength(0); jjimageLen = 0; for (;;) { switch(curLexState) { case 0: try { input_stream.backup(0); while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L) curChar = input_stream.BeginToken(); } catch (java.io.IOException e1) { continue EOFLoop; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); break; case 1: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_1(); if (jjmatchedPos == 0 && jjmatchedKind > 11) { jjmatchedKind = 11; } break; case 2: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_2(); if (jjmatchedPos == 0 && jjmatchedKind > 11) { jjmatchedKind = 11; } break; } if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; TokenLexicalActions(matchedToken); if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; CommonTokenAction(matchedToken); return matchedToken; } else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); if (specialToken == null) specialToken = matchedToken; else { matchedToken.specialToken = specialToken; specialToken = (specialToken.next = matchedToken); } SkipLexicalActions(matchedToken); } else SkipLexicalActions(null); if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; continue EOFLoop; } MoreLexicalActions(); if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; curPos = 0; jjmatchedKind = 0x7fffffff; try { curChar = input_stream.readChar(); continue; } catch (java.io.IOException e1) { } } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } } void SkipLexicalActions(Token matchedToken) { switch(jjmatchedKind) { default : break; } } void MoreLexicalActions() { jjimageLen += (lengthOfMatch = jjmatchedPos + 1); switch(jjmatchedKind) { case 7 : image.append(input_stream.GetSuffix(jjimageLen)); jjimageLen = 0; input_stream.backup(1); break; default : break; } } void TokenLexicalActions(Token matchedToken) { switch(jjmatchedKind) { case 125 : image.append(jjstrLiteralImages[125]); lengthOfMatch = jjstrLiteralImages[125].length(); matchedToken.kind = GT; ((ASTParser.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; input_stream.backup(2); break; case 126 : image.append(jjstrLiteralImages[126]); lengthOfMatch = jjstrLiteralImages[126].length(); matchedToken.kind = GT; ((ASTParser.GTToken)matchedToken).realKind = RSIGNEDSHIFT; input_stream.backup(1); break; default : break; } } private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } private void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } private void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } private void jjCheckNAddStates(int start, int end) { do { jjCheckNAdd(jjnextStates[start]); } while (start++ != end); } } src/japa/parser/JavaCharStream.java0000644000000000000000000004051211225177012016250 0ustar rootroot/* 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 . */ 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) */ src/japa/parser/JavaParser.java0000644000000000000000000001131511132421232015443 0ustar rootroot/* * 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 . */ /* * 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; /** *

This class was generated automatically by javacc, do not edit.

*

Parse Java 1.5 source code and creates Abstract Syntax Tree classes.

*

Note: To use this parser asynchronously, disable de parser cache * by calling the method {@link setCacheParser} with false * as argument.

* * @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 false. * By default, the cache is enabled. * @param value false to disable the parser instance cache. */ public static void setCacheParser(boolean value) { cacheParser = value; if (!value) { parser = null; } } /** * Parses the Java code contained in the {@link InputStream} and returns * a {@link CompilationUnit} that represents it. * @param in {@link InputStream} containing Java source code * @param encoding encoding of the source code * @return CompilationUnit representing the Java source code * @throws ParseException if the source code has parser errors */ public static CompilationUnit parse(InputStream in, String encoding) throws ParseException { if (cacheParser) { if (parser == null) { parser = new ASTParser(in, encoding); } else { parser.reset(in, encoding); } return parser.CompilationUnit(); } return new ASTParser(in, encoding).CompilationUnit(); } /** * Parses the Java code contained in the {@link InputStream} and returns * a {@link CompilationUnit} that represents it. * @param in {@link InputStream} containing Java source code * @return CompilationUnit representing the Java source code * @throws ParseException if the source code has parser errors */ public static CompilationUnit parse(InputStream in) throws ParseException { return parse(in, null); } /** * Parses the Java code contained in a {@link File} and returns * a {@link CompilationUnit} that represents it. * @param file {@link File} containing Java source code * @param encoding encoding of the source code * @return CompilationUnit representing the Java source code * @throws ParseException if the source code has parser errors * @throws IOException */ public static CompilationUnit parse(File file, String encoding) throws ParseException, IOException { FileInputStream in = new FileInputStream(file); try { return parse(in, encoding); } finally { in.close(); } } /** * Parses the Java code contained in a {@link File} and returns * a {@link CompilationUnit} that represents it. * @param file {@link File} containing Java source code * @return CompilationUnit representing the Java source code * @throws ParseException if the source code has parser errors * @throws IOException */ public static CompilationUnit parse(File file) throws ParseException, IOException { return parse(file, null); } } src/japa/parser/ParseException.java0000644000000000000000000001711711225177012016353 0ustar rootroot/* 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 . */ 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: */ 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) */ src/japa/parser/Token.java0000644000000000000000000001134311225177012014475 0ustar rootroot/* 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 . */ 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) */ src/japa/parser/TokenMgrError.java0000644000000000000000000001261011225177012016153 0ustar rootroot/* 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 . */ 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 ? " " : ("\"" + 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) */ src/japa/parser/java_1_5.jj0000644000000000000000000024305411173146640014477 0ustar rootroot/* * 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 . */ options { LOOKAHEAD=1; STATIC=false; JAVA_UNICODE_ESCAPE=true; COMMON_TOKEN_ACTION=true; //SUPPORT_CLASS_VISIBILITY_PUBLIC=false; JDK_VERSION = "1.5"; TOKEN_FACTORY = "ASTParser.GTToken"; } PARSER_BEGIN(ASTParser) /* * 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 . */ package japa.parser; import java.io.*; import java.util.*; import japa.parser.ast.*; import japa.parser.ast.body.*; import japa.parser.ast.expr.*; import japa.parser.ast.stmt.*; import japa.parser.ast.type.*; /** *

This class was generated automatically by javacc, do not edit.

* @author Júlio Vilmar Gesser */ final class ASTParser { void reset(InputStream in, String encoding) { ReInit(in, encoding); token_source.clearComments(); } private List add(List list, Object obj) { if (list == null) { list = new LinkedList(); } list.add(obj); return list; } private List add(int pos, List list, Object obj) { if (list == null) { list = new LinkedList(); } list.add(pos, obj); return list; } private class Modifier { final int modifiers; final List annotations; final int beginLine; final int beginColumn; public Modifier(int beginLine, int beginColumn, int modifiers, List annotations) { this.beginLine = beginLine; this.beginColumn = beginColumn; this.modifiers = modifiers; this.annotations = annotations; } } public int addModifier(int modifiers, int mod, Token token) throws ParseException { if ((ModifierSet.hasModifier(modifiers, mod))) { throwParseException(token, "Duplicated modifier"); } return ModifierSet.addModifier(modifiers, mod); } private void pushJavadoc() { token_source.pushJavadoc(); } private JavadocComment popJavadoc() { return token_source.popJavadoc(); } private List getComments() { return token_source.getComments(); } private void throwParseException(Token token, String message) throws ParseException { StringBuilder buf = new StringBuilder(); buf.append(message); buf.append(": \""); buf.append(token.image); buf.append("\" at line "); buf.append(token.beginLine); buf.append(", column "); buf.append(token.beginColumn); ParseException e = new ParseException(buf.toString()); e.currentToken = token; throw e; } static final class GTToken extends Token { int realKind = ASTParserConstants.GT; GTToken(int kind, String image) { this.kind = kind; this.image = image; } public static Token newToken(int kind, String image) { return new GTToken(kind, image); } } } PARSER_END(ASTParser) /* WHITE SPACE */ SKIP : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ TOKEN_MGR_DECLS : { private List comments; private final Stack javadocStack = new Stack(); private JavadocComment lastJavadoc; void pushJavadoc() { javadocStack.push(lastJavadoc); } JavadocComment popJavadoc() { return javadocStack.pop(); } List getComments() { return comments; } void clearComments() { comments = null; javadocStack.clear(); lastJavadoc = null; } private void CommonTokenAction(Token token) { lastJavadoc = null; if (token.specialToken != null) { if(comments == null) { comments = new LinkedList(); } Token special = token.specialToken; if(special.kind == JAVA_DOC_COMMENT) { lastJavadoc = new JavadocComment(special.beginLine, special.beginColumn, special.endLine, special.endColumn, special.image.substring(3, special.image.length()-2)); comments.add(lastJavadoc); } else if(special.kind == SINGLE_LINE_COMMENT) { LineComment comment = new LineComment(special.beginLine, special.beginColumn, special.endLine, special.endColumn, special.image.substring(2)); comments.add(comment); } else if(special.kind == MULTI_LINE_COMMENT) { BlockComment comment = new BlockComment(special.beginLine, special.beginColumn, special.endLine, special.endColumn, special.image.substring(2, special.image.length()-2)); comments.add(comment); } } } } SPECIAL_TOKEN : { } MORE : { <"/**" ~["/"]> { input_stream.backup(1); } : IN_JAVA_DOC_COMMENT | <"/*"> : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < ASSERT: "assert" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < ENUM: "enum" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < STRICTFP: "strictfp" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* LITERALS */ TOKEN : { < LONG_LITERAL: (["l","L"]) | (["l","L"]) | (["l","L"]) > | < INTEGER_LITERAL: | | > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: | > | < #DECIMAL_FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < #HEXADECIMAL_FLOATING_POINT_LITERAL: "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? (["f","F","d","D"])? | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ (["f","F","d","D"])? > | < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) | ("\\u" ["0"-"9","A"-"F","a"-"f"] ["0"-"9","A"-"F","a"-"f"] ["0"-"9","A"-"F","a"-"f"] ["0"-"9","A"-"F","a"-"f"] ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) | ("\\u" ["0"-"9","A"-"F","a"-"f"] ["0"-"9","A"-"F","a"-"f"] ["0"-"9","A"-"F","a"-"f"] ["0"-"9","A"-"F","a"-"f"] ) )* "\"" > } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: ()* > | < #LETTER: [ // all chars for which Character.isIdentifierStart is true "\u0024", // "$" "\u0041"-"\u005a", // "A"-"Z" "\u005f", // "_" "\u0061"-"\u007a", // "a"-"z" "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u0236", "\u0250"-"\u02c1", "\u02c6"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03f5", "\u03f7"-"\u03fb", "\u0400"-"\u0481", "\u048a"-"\u04ce", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0500"-"\u050f", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u064a", "\u066e"-"\u066f", "\u0671"-"\u06d3", "\u06d5", "\u06e5"-"\u06e6", "\u06ee"-"\u06ef", "\u06fa"-"\u06fc", "\u06ff", "\u0710", "\u0712"-"\u072f", "\u074d"-"\u074f", "\u0780"-"\u07a5", "\u07b1", "\u0904"-"\u0939", "\u093d", "\u0950", "\u0958"-"\u0961", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09bd", "\u09dc"-"\u09dd", "\u09df"-"\u09e1", "\u09f0"-"\u09f3", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a72"-"\u0a74", "\u0a85"-"\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abd", "\u0ad0", "\u0ae0"-"\u0ae1", "\u0af1", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b35"-"\u0b39", "\u0b3d", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b71", "\u0b83", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0bf9", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c60"-"\u0c61", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cbd", "\u0cde", "\u0ce0"-"\u0ce1", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d60"-"\u0d61", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0e01"-"\u0e30", "\u0e32"-"\u0e33", "\u0e3f"-"\u0e46", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb0", "\u0eb2"-"\u0eb3", "\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0edc"-"\u0edd", "\u0f00", "\u0f40"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f88"-"\u0f8b", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u1050"-"\u1055", "\u10a0"-"\u10c5", "\u10d0"-"\u10f8", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u16ee"-"\u16f0", "\u1700"-"\u170c", "\u170e"-"\u1711", "\u1720"-"\u1731", "\u1740"-"\u1751", "\u1760"-"\u176c", "\u176e"-"\u1770", "\u1780"-"\u17b3", "\u17d7", "\u17db"-"\u17dc", "\u1820"-"\u1877", "\u1880"-"\u18a8", "\u1900"-"\u191c", "\u1950"-"\u196d", "\u1970"-"\u1974", "\u1d00"-"\u1d6b", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u203f"-"\u2040", "\u2054", "\u2071", "\u207f", "\u20a0"-"\u20b1", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u213d"-"\u213f", "\u2145"-"\u2149", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u3029", "\u3031"-"\u3035", "\u3038"-"\u303c", "\u3041"-"\u3096", "\u309d"-"\u309f", "\u30a1"-"\u30ff", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u31f0"-"\u31ff", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\ud801", //for supplementary characters suport "\ud802", //for supplementary characters suport "\uf900"-"\ufa2d", "\ufa30"-"\ufa6a", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d", "\ufb1f"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfc", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe74", "\ufe76"-"\ufefc", "\uff04", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6" ] > | < #PART_LETTER: [ // all chars for which Character.isIdentifierPart is true "\u0000"-"\u0008", "\u000e"-"\u001b", "\u0024", // "$" "\u0030"-"\u0039", // "0"-"9" "\u0041"-"\u005a", // "A"-"Z" "\u005f", // "_" "\u0061"-"\u007a", // "a"-"z" "\u007f"-"\u009f", "\u00a2"-"\u00a5", "\u00aa", "\u00ad", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u0236", "\u0250"-"\u02c1", "\u02c6"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u0300"-"\u0357", "\u035d"-"\u036f", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03f5", "\u03f7"-"\u03fb", "\u0400"-"\u0481", "\u0483"-"\u0486", "\u048a"-"\u04ce", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0500"-"\u050f", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u0591"-"\u05a1", "\u05a3"-"\u05b9", "\u05bb"-"\u05bd", "\u05bf", "\u05c1"-"\u05c2", "\u05c4", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0600"-"\u0603", "\u0610"-"\u0615", "\u0621"-"\u063a", "\u0640"-"\u0658", "\u0660"-"\u0669", "\u066e"-"\u06d3", "\u06d5"-"\u06dd", "\u06df"-"\u06e8", "\u06ea"-"\u06fc", "\u06ff", "\u070f"-"\u074a", "\u074d"-"\u074f", "\u0780"-"\u07b1", "\u0901"-"\u0939", "\u093c"-"\u094d", "\u0950"-"\u0954", "\u0958"-"\u0963", "\u0966"-"\u096f", "\u0981"-"\u0983", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09bc"-"\u09c4", "\u09c7"-"\u09c8", "\u09cb"-"\u09cd", "\u09d7", "\u09dc"-"\u09dd", "\u09df"-"\u09e3", "\u09e6"-"\u09f3", "\u0a01"-"\u0a03", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a3c", "\u0a3e"-"\u0a42", "\u0a47"-"\u0a48", "\u0a4b"-"\u0a4d", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a66"-"\u0a74", "\u0a81"-"\u0a83", "\u0a85"-"\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abc"-"\u0ac5", "\u0ac7"-"\u0ac9", "\u0acb"-"\u0acd", "\u0ad0", "\u0ae0"-"\u0ae3", "\u0ae6"-"\u0aef", "\u0af1", "\u0b01"-"\u0b03", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b35"-"\u0b39", "\u0b3c"-"\u0b43", "\u0b47"-"\u0b48", "\u0b4b"-"\u0b4d", "\u0b56"-"\u0b57", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b66"-"\u0b6f", "\u0b71", "\u0b82"-"\u0b83", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0bbe"-"\u0bc2", "\u0bc6"-"\u0bc8", "\u0bca"-"\u0bcd", "\u0bd7", "\u0be7"-"\u0bef", "\u0bf9", "\u0c01"-"\u0c03", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c3e"-"\u0c44", "\u0c46"-"\u0c48", "\u0c4a"-"\u0c4d", "\u0c55"-"\u0c56", "\u0c60"-"\u0c61", "\u0c66"-"\u0c6f", "\u0c82"-"\u0c83", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cbc"-"\u0cc4", "\u0cc6"-"\u0cc8", "\u0cca"-"\u0ccd", "\u0cd5"-"\u0cd6", "\u0cde", "\u0ce0"-"\u0ce1", "\u0ce6"-"\u0cef", "\u0d02"-"\u0d03", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d3e"-"\u0d43", "\u0d46"-"\u0d48", "\u0d4a"-"\u0d4d", "\u0d57", "\u0d60"-"\u0d61", "\u0d66"-"\u0d6f", "\u0d82"-"\u0d83", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0dca", "\u0dcf"-"\u0dd4", "\u0dd6", "\u0dd8"-"\u0ddf", "\u0df2"-"\u0df3", "\u0e01"-"\u0e3a", "\u0e3f"-"\u0e4e", "\u0e50"-"\u0e59", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb9", "\u0ebb"-"\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0ec8"-"\u0ecd", "\u0ed0"-"\u0ed9", "\u0edc"-"\u0edd", "\u0f00", "\u0f18"-"\u0f19", "\u0f20"-"\u0f29", "\u0f35", "\u0f37", "\u0f39", "\u0f3e"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f71"-"\u0f84", "\u0f86"-"\u0f8b", "\u0f90"-"\u0f97", "\u0f99"-"\u0fbc", "\u0fc6", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u102c"-"\u1032", "\u1036"-"\u1039", "\u1040"-"\u1049", "\u1050"-"\u1059", "\u10a0"-"\u10c5", "\u10d0"-"\u10f8", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u1369"-"\u1371", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u16ee"-"\u16f0", "\u1700"-"\u170c", "\u170e"-"\u1714", "\u1720"-"\u1734", "\u1740"-"\u1753", "\u1760"-"\u176c", "\u176e"-"\u1770", "\u1772"-"\u1773", "\u1780"-"\u17d3", "\u17d7", "\u17db"-"\u17dd", "\u17e0"-"\u17e9", "\u180b"-"\u180d", "\u1810"-"\u1819", "\u1820"-"\u1877", "\u1880"-"\u18a9", "\u1900"-"\u191c", "\u1920"-"\u192b", "\u1930"-"\u193b", "\u1946"-"\u196d", "\u1970"-"\u1974", "\u1d00"-"\u1d6b", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u200c"-"\u200f", "\u202a"-"\u202e", "\u203f"-"\u2040", "\u2054", "\u2060"-"\u2063", "\u206a"-"\u206f", "\u2071", "\u207f", "\u20a0"-"\u20b1", "\u20d0"-"\u20dc", "\u20e1", "\u20e5"-"\u20ea", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u213d"-"\u213f", "\u2145"-"\u2149", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u302f", "\u3031"-"\u3035", "\u3038"-"\u303c", "\u3041"-"\u3096", "\u3099"-"\u309a", "\u309d"-"\u309f", "\u30a1"-"\u30ff", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u31f0"-"\u31ff", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\ud801", //for supplementary characters suport "\ud802", //for supplementary characters suport "\ud834", //for supplementary characters suport "\udc00", //for supplementary characters suport "\udc01", //for supplementary characters suport "\udd7b", //for supplementary characters suport "\uf900"-"\ufa2d", "\ufa30"-"\ufa6a", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfc", "\ufe00"-"\ufe0f", "\ufe20"-"\ufe23", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe74", "\ufe76"-"\ufefc", "\ufeff", "\uff04", "\uff10"-"\uff19", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6", "\ufff9"-"\ufffb" ] > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > | < AT: "@" > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > | < LSHIFT: "<<" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > | < LSHIFTASSIGN: "<<=" > | < RSIGNEDSHIFTASSIGN: ">>=" > | < RUNSIGNEDSHIFTASSIGN: ">>>=" > | < ELLIPSIS: "..." > } /* >'s need special attention due to generics syntax. */ TOKEN : { < RUNSIGNEDSHIFT: ">>>" > { matchedToken.kind = GT; ((ASTParser.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; input_stream.backup(2); } | < RSIGNEDSHIFT: ">>" > { matchedToken.kind = GT; ((ASTParser.GTToken)matchedToken).realKind = RSIGNEDSHIFT; input_stream.backup(1); } | < GT: ">" > } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ CompilationUnit CompilationUnit(): { PackageDeclaration pakage = null; List imports = null; ImportDeclaration in = null; List types = null; TypeDeclaration tn = null; int line = -1; int column = 0; } { [ LOOKAHEAD(PackageDeclaration()) pakage = PackageDeclaration() {line = pakage.getBeginLine(); column = pakage.getBeginColumn();} ] ( in = ImportDeclaration() { if(line==-1){line = in.getBeginLine(); column = in.getBeginColumn();} imports = add(imports, in); } )* ( tn = TypeDeclaration() { if(line==-1){line = tn.getBeginLine(); column = tn.getBeginColumn();} types = add(types, tn); } )* ( | "\u001A" /** ctrl+z char **/) { return new CompilationUnit(line == -1 ? 0 : line, column, token.endLine, token.endColumn,pakage, imports, types, getComments()); } } PackageDeclaration PackageDeclaration(): { List annotations = null; AnnotationExpr ann; NameExpr name; int line; int column; } { ( ann = Annotation() { annotations = add(annotations, ann); } )* "package" {line=token.beginLine; column=token.beginColumn;} name = Name() ";" { return new PackageDeclaration(line, column, token.endLine, token.endColumn,annotations, name); } } ImportDeclaration ImportDeclaration(): { NameExpr name; boolean isStatic = false; boolean isAsterisk = false; int line; int column; } { "import" {line=token.beginLine; column=token.beginColumn;} [ "static" { isStatic = true; } ] name = Name() [ "." "*" { isAsterisk = true; } ] ";" { return new ImportDeclaration(line, column, token.endLine, token.endColumn,name, isStatic, isAsterisk); } } /* * Modifiers. We match all modifiers in a single rule to reduce the chances of * syntax errors for simple modifier mistakes. It will also enable us to give * better error messages. */ Modifier Modifiers(): { int beginLine = -1; int beginColumn = -1; int modifiers = 0; List annotations = null; AnnotationExpr ann; } { ( LOOKAHEAD(2) ( "public" { modifiers = addModifier(modifiers, ModifierSet.PUBLIC, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "static" { modifiers = addModifier(modifiers, ModifierSet.STATIC, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "protected" { modifiers = addModifier(modifiers, ModifierSet.PROTECTED, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "private" { modifiers = addModifier(modifiers, ModifierSet.PRIVATE, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "final" { modifiers = addModifier(modifiers, ModifierSet.FINAL, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "abstract" { modifiers = addModifier(modifiers, ModifierSet.ABSTRACT, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "synchronized" { modifiers = addModifier(modifiers, ModifierSet.SYNCHRONIZED, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "native" { modifiers = addModifier(modifiers, ModifierSet.NATIVE, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "transient" { modifiers = addModifier(modifiers, ModifierSet.TRANSIENT, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "volatile" { modifiers = addModifier(modifiers, ModifierSet.VOLATILE, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | "strictfp" { modifiers = addModifier(modifiers, ModifierSet.STRICTFP, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} } | ann = Annotation() { annotations = add(annotations, ann); if(beginLine==-1) {beginLine=ann.getBeginLine(); beginColumn=ann.getBeginColumn();} } ) )* { return new Modifier(beginLine, beginColumn, modifiers, annotations); } } /* * Declaration syntax follows. */ TypeDeclaration TypeDeclaration(): { Modifier modifier; TypeDeclaration ret; } { { pushJavadoc(); } ( ";" { ret = new EmptyTypeDeclaration(token.beginLine, token.beginColumn, token.endLine, token.endColumn, popJavadoc()); } | modifier = Modifiers() ( ret = ClassOrInterfaceDeclaration(modifier) | ret = EnumDeclaration(modifier) | ret = AnnotationTypeDeclaration(modifier) ) ) { return ret; } } ClassOrInterfaceDeclaration ClassOrInterfaceDeclaration(Modifier modifier): { boolean isInterface = false; String name; List typePar = null; List extList = null; List impList = null; List members; int line = modifier.beginLine; int column = modifier.beginColumn; } { ( "class" | "interface" { isInterface = true; } ) { if (line == -1) {line=token.beginLine; column=token.beginColumn;} } { name = token.image; } [ typePar = TypeParameters() {typePar.remove(0);} ] [ extList = ExtendsList(isInterface) ] [ impList = ImplementsList(isInterface) ] members = ClassOrInterfaceBody(isInterface) { return new ClassOrInterfaceDeclaration(line, column, token.endLine, token.endColumn,popJavadoc(), modifier.modifiers, modifier.annotations, isInterface, name, typePar, extList, impList, members); } } List ExtendsList(boolean isInterface): { boolean extendsMoreThanOne = false; List ret = new LinkedList(); ClassOrInterfaceType cit; } { "extends" cit = ClassOrInterfaceType() { ret.add(cit); } ( "," cit = ClassOrInterfaceType() { ret.add(cit); extendsMoreThanOne = true; } )* { if (extendsMoreThanOne && !isInterface) throwParseException(token, "A class cannot extend more than one other class"); } { return ret; } } List ImplementsList(boolean isInterface): { List ret = new LinkedList(); ClassOrInterfaceType cit; } { "implements" cit = ClassOrInterfaceType() { ret.add(cit); } ( "," cit = ClassOrInterfaceType() { ret.add(cit); } )* { if (isInterface) throwParseException(token, "An interface cannot implement other interfaces"); } { return ret; } } EnumDeclaration EnumDeclaration(Modifier modifier): { String name; List impList = null; EnumConstantDeclaration entry; List entries = null; BodyDeclaration member; List members = null; int line = modifier.beginLine; int column = modifier.beginColumn; } { "enum" { if (line == -1) {line=token.beginLine; column=token.beginColumn;} } { name = token.image; } [ impList = ImplementsList(false) ] "{" [ { entries = new LinkedList(); } entry = EnumConstantDeclaration() { entries.add(entry); } ( LOOKAHEAD(2) "," entry = EnumConstantDeclaration() { entries.add(entry); } )* ] [ "," ] [ ( ";" ( member = ClassOrInterfaceBodyDeclaration(false) { members = add(members, member); } )* ) ] "}" { return new EnumDeclaration(line, column, token.endLine, token.endColumn,popJavadoc(), modifier.modifiers, modifier.annotations, name, impList, entries, members); } } EnumConstantDeclaration EnumConstantDeclaration(): { List annotations = null; AnnotationExpr ann; String name; List args = null; List classBody = null; int line = -1; int column = -1; } { { pushJavadoc(); } ( ann = Annotation() { annotations = add(annotations, ann); if(line==-1){line=ann.getBeginLine(); column=ann.getBeginColumn();} } )* { name = token.image; if(line==-1){line=token.beginLine; column=token.beginColumn;} } [ args = Arguments() ] [ classBody = ClassOrInterfaceBody(false) ] { return new EnumConstantDeclaration(line, column, token.endLine, token.endColumn,popJavadoc(), annotations, name, args, classBody); } } List TypeParameters(): { List ret = new LinkedList(); TypeParameter tp; } { "<" { ret.add(new int[]{token.beginLine, token.beginColumn}); } tp = TypeParameter() { ret.add(tp); } ( "," tp = TypeParameter() { ret.add(tp); } )* ">" { return ret; } } TypeParameter TypeParameter(): { String name; List typeBound = null; int line; int column; } { { name = token.image; line=token.beginLine; column=token.beginColumn;} [ typeBound = TypeBound() ] { return new TypeParameter(line, column, token.endLine, token.endColumn,name, typeBound); } } List TypeBound(): { List ret = new LinkedList(); ClassOrInterfaceType cit; } { "extends" cit = ClassOrInterfaceType() { ret.add(cit); } ( "&" cit = ClassOrInterfaceType() { ret.add(cit); } )* { return ret; } } List ClassOrInterfaceBody(boolean isInterface): { List ret = new LinkedList(); BodyDeclaration member; } { "{" ( member = ClassOrInterfaceBodyDeclaration(isInterface) { ret.add(member); } )* "}" { return ret; } } BodyDeclaration ClassOrInterfaceBodyDeclaration(boolean isInterface): { boolean isNestedInterface = false; Modifier modifier; BodyDeclaration ret; } { { pushJavadoc(); } ( LOOKAHEAD(2) ret = InitializerDeclaration() { if (isInterface) throwParseException(token, "An interface cannot have initializers"); } | modifier = Modifiers() // Just get all the modifiers out of the way. If you want to do // more checks, pass the modifiers down to the member ( ret = ClassOrInterfaceDeclaration(modifier) | ret = EnumDeclaration(modifier) | ret = AnnotationTypeDeclaration(modifier) | LOOKAHEAD( [ TypeParameters() ] "(" ) ret = ConstructorDeclaration(modifier) | LOOKAHEAD( Type() ( "[" "]" )* ( "," | "=" | ";" ) ) ret = FieldDeclaration(modifier) | ret = MethodDeclaration(modifier) ) | ";" { ret = new EmptyMemberDeclaration(token.beginLine, token.beginColumn, token.endLine, token.endColumn, popJavadoc()); } ) { return ret; } } FieldDeclaration FieldDeclaration(Modifier modifier): { Type type; List variables = new LinkedList(); VariableDeclarator val; } { // Modifiers are already matched in the caller type = Type() val = VariableDeclarator() { variables.add(val); } ( "," val = VariableDeclarator() { variables.add(val); } )* ";" { int line = modifier.beginLine; int column = modifier.beginColumn; if (line == -1) { line=type.getBeginLine(); column=type.getBeginColumn(); } return new FieldDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, type, variables); } } VariableDeclarator VariableDeclarator(): { VariableDeclaratorId id; Expression init = null; } { id = VariableDeclaratorId() [ "=" init = VariableInitializer() ] { return new VariableDeclarator(id.getBeginLine(), id.getBeginColumn(), token.endLine, token.endColumn, id, init); } } VariableDeclaratorId VariableDeclaratorId(): { String name; int arrayCount = 0; int line; int column; } { { name = token.image; line=token.beginLine; column=token.beginColumn;} ( "[" "]" { arrayCount++; } )* { return new VariableDeclaratorId(line, column, token.endLine, token.endColumn,name, arrayCount); } } Expression VariableInitializer(): { Expression ret; } { ( ret = ArrayInitializer() | ret = Expression() ) { return ret;} } ArrayInitializerExpr ArrayInitializer(): { List values = null; Expression val; int line; int column; } { "{" {line=token.beginLine; column=token.beginColumn;} [ val = VariableInitializer() { values = add(values, val); } ( LOOKAHEAD(2) "," val = VariableInitializer() { values = add(values, val); } )* ] [ "," ] "}" { return new ArrayInitializerExpr(line, column, token.endLine, token.endColumn,values); } } MethodDeclaration MethodDeclaration(Modifier modifier): { List typeParameters = null; Type type; String name; List parameters; int arrayCount = 0; List throws_ = null; BlockStmt block = null; int line = modifier.beginLine; int column = modifier.beginColumn; } { // Modifiers already matched in the caller! [ typeParameters = TypeParameters() { int[] lineCol=(int[])typeParameters.remove(0); if(line==-1){ line=lineCol[0]; column=lineCol[1];} } ] type = ResultType() { if(line==-1){line=type.getBeginLine(); column=type.getBeginColumn();}} { name = token.image; } parameters = FormalParameters() ( "[" "]" { arrayCount++; } )* [ "throws" throws_ = NameList() ] ( block = Block() | ";" ) { return new MethodDeclaration(line, column, token.endLine, token.endColumn,popJavadoc(), modifier.modifiers, modifier.annotations, typeParameters, type, name, parameters, arrayCount, throws_, block); } } List FormalParameters(): { List ret = null; Parameter par; } { "(" [ par = FormalParameter() { ret = add(ret, par); } ( "," par = FormalParameter() { ret = add(ret, par); } )* ] ")" { return ret; } } Parameter FormalParameter(): { Modifier modifier; Type type; boolean isVarArg = false; VariableDeclaratorId id; } { modifier = Modifiers() type = Type() [ "..." { isVarArg = true;} ] id = VariableDeclaratorId() { int line = modifier.beginLine; int column = modifier.beginColumn; if(line==-1){ line=type.getBeginLine(); column=type.getBeginColumn(); } return new Parameter(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, isVarArg, id); } } ConstructorDeclaration ConstructorDeclaration(Modifier modifier): { List typeParameters = null; String name; List parameters; List throws_ = null; ExplicitConstructorInvocationStmt exConsInv = null; List stmts; int line = modifier.beginLine; int column = modifier.beginColumn; int bbLine = 0; int bbColumn = 0; int beLine = 0; int beColumn = 0; } { [ typeParameters = TypeParameters() { int[] lineCol=(int[])typeParameters.remove(0); if(line==-1){ line=lineCol[0]; column=lineCol[1];} } ] // Modifiers matched in the caller { name = token.image; if(line==-1){line=token.beginLine; column=token.beginColumn;}} parameters = FormalParameters() [ "throws" throws_ = NameList() ] "{" { bbLine=token.beginLine; bbColumn=token.beginColumn; } [ LOOKAHEAD(ExplicitConstructorInvocation()) exConsInv = ExplicitConstructorInvocation() ] stmts = Statements() "}" { if (exConsInv != null) { stmts = add(0, stmts, exConsInv); } return new ConstructorDeclaration(line, column, token.endLine, token.endColumn,popJavadoc(), modifier.modifiers, modifier.annotations, typeParameters, name, parameters, throws_, new BlockStmt(bbLine, bbColumn, token.endLine, token.endColumn, stmts)); } } ExplicitConstructorInvocationStmt ExplicitConstructorInvocation(): { boolean isThis = false; List args; Expression expr = null; List typeArgs = null; int line = -1; int column = 0; } { ( LOOKAHEAD([ TypeArguments() ] "this" "(") [ typeArgs = TypeArguments() { int[] lineCol=(int[])typeArgs.remove(0); line=lineCol[0]; column=lineCol[1]; } ] "this" { if (line == -1) {line=token.beginLine; column=token.beginColumn;} isThis = true; } args = Arguments() ";" | [ LOOKAHEAD( PrimaryExpressionWithoutSuperSuffix() "." ) expr = PrimaryExpressionWithoutSuperSuffix() "." { line=expr.getBeginLine(); column=expr.getBeginColumn(); } ] [ typeArgs = TypeArguments() {int[] lineCol=(int[])typeArgs.remove(0); if (line == -1) {line=lineCol[0]; column=lineCol[1];}} ] "super" {if (line == -1) {line=token.beginLine; column=token.beginColumn;}} args = Arguments() ";" ) { return new ExplicitConstructorInvocationStmt(line, column, token.endLine, token.endColumn,typeArgs, isThis, expr, args); } } List Statements(): { List ret = null; Statement stmt; } { ( stmt = BlockStatement() { ret = add(ret, stmt); } )* { return ret; } } InitializerDeclaration InitializerDeclaration(): { BlockStmt block; int line = -1; int column = 0; boolean isStatic = false; } { [ "static" { isStatic = true; line=token.beginLine; column=token.beginColumn;} ] block = Block() {if(line==-1){line=block.getBeginLine(); column=block.getBeginColumn();}} { return new InitializerDeclaration(line, column, token.endLine, token.endColumn,popJavadoc(), isStatic, block); } } /* * Type, name and expression syntax follows. */ Type Type(): { Type ret; } { ( LOOKAHEAD(2) ret = ReferenceType() | ret = PrimitiveType() ) { return ret; } } ReferenceType ReferenceType(): { Type type; int arrayCount = 0; } { ( type = PrimitiveType() ( LOOKAHEAD(2) "[" "]" { arrayCount++; } )+ | type = ClassOrInterfaceType() ( LOOKAHEAD(2) "[" "]" { arrayCount++; } )* ) { return new ReferenceType(type.getBeginLine(), type.getBeginColumn(), token.endLine, token.endColumn, type, arrayCount); } } ClassOrInterfaceType ClassOrInterfaceType(): { ClassOrInterfaceType ret; String name; List typeArgs = null; int line; int column; } { {line=token.beginLine; column=token.beginColumn;} { name = token.image; } [ LOOKAHEAD(2) typeArgs = TypeArguments() {typeArgs.remove(0);} ] { ret = new ClassOrInterfaceType(line, column, token.endLine, token.endColumn,null, name, typeArgs); } ( LOOKAHEAD(2) "." { name = token.image; } [ LOOKAHEAD(2) typeArgs = TypeArguments() {typeArgs.remove(0);} ] { ret = new ClassOrInterfaceType(line, column, token.endLine, token.endColumn,ret, name, typeArgs); } )* { return ret; } } List TypeArguments(): { List ret = new LinkedList(); Type type; } { "<" { ret.add(new int[]{token.beginLine, token.beginColumn}); } type = TypeArgument() { ret.add(type); } ( "," type = TypeArgument() { ret.add(type); } )* ">" { return ret; } } Type TypeArgument(): { Type ret; } { ( ret = ReferenceType() | ret = Wildcard() ) { return ret; } } WildcardType Wildcard(): { ReferenceType ext = null; ReferenceType sup = null; int line; int column; } { "?" {line=token.beginLine; column=token.beginColumn;} [ "extends" ext = ReferenceType() | "super" sup = ReferenceType() ] { return new WildcardType(line, column, token.endLine, token.endColumn,ext, sup); } } PrimitiveType PrimitiveType(): { PrimitiveType ret; } { ( "boolean" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Boolean); } | "char" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Char); } | "byte" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Byte); } | "short" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Short); } | "int" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Int); } | "long" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Long); } | "float" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Float); } | "double" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Double); } ) { return ret; } } Type ResultType(): { Type ret; } { ( "void" { ret = new VoidType(token.beginLine, token.beginColumn, token.endLine, token.endColumn); } | ret = Type() ) { return ret; } } NameExpr Name(): /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ { NameExpr ret; } { { ret = new NameExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); } ( LOOKAHEAD(2) "." { ret = new QualifiedNameExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, token.image); } )* { return ret; } } List NameList(): { List ret = new LinkedList(); NameExpr name; } { name = Name() { ret.add(name); } ( "," name = Name() { ret.add(name); } )* { return ret; } } /* * Expression syntax follows. */ Expression Expression(): /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ { Expression ret; AssignExpr.Operator op; Expression value; } { ret = ConditionalExpression() [ LOOKAHEAD(2) op = AssignmentOperator() value = Expression() { ret = new AssignExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, value, op); } ] { return ret; } } AssignExpr.Operator AssignmentOperator(): { AssignExpr.Operator ret; } { ( "=" { ret = AssignExpr.Operator.assign; } | "*=" { ret = AssignExpr.Operator.star; } | "/=" { ret = AssignExpr.Operator.slash; } | "%=" { ret = AssignExpr.Operator.rem; } | "+=" { ret = AssignExpr.Operator.plus; } | "-=" { ret = AssignExpr.Operator.minus; } | "<<=" { ret = AssignExpr.Operator.lShift; } | ">>=" { ret = AssignExpr.Operator.rSignedShift; } | ">>>=" { ret = AssignExpr.Operator.rUnsignedShift; } | "&=" { ret = AssignExpr.Operator.and; } | "^=" { ret = AssignExpr.Operator.xor; } | "|=" { ret = AssignExpr.Operator.or; } ) { return ret; } } Expression ConditionalExpression(): { Expression ret; Expression left; Expression right; } { ret = ConditionalOrExpression() [ "?" left = Expression() ":" right = ConditionalExpression() { ret = new ConditionalExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, left, right); } ] { return ret; } } Expression ConditionalOrExpression(): { Expression ret; Expression right; } { ret = ConditionalAndExpression() ( "||" right = ConditionalAndExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.or); } )* { return ret; } } Expression ConditionalAndExpression(): { Expression ret; Expression right; } { ret = InclusiveOrExpression() ( "&&" right = InclusiveOrExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.and); } )* { return ret; } } Expression InclusiveOrExpression(): { Expression ret; Expression right; } { ret = ExclusiveOrExpression() ( "|" right = ExclusiveOrExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binOr); } )* { return ret; } } Expression ExclusiveOrExpression(): { Expression ret; Expression right; } { ret = AndExpression() ( "^" right = AndExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.xor); } )* { return ret; } } Expression AndExpression(): { Expression ret; Expression right; } { ret = EqualityExpression() ( "&" right = EqualityExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binAnd); } )* { return ret; } } Expression EqualityExpression(): { Expression ret; Expression right; BinaryExpr.Operator op; } { ret = InstanceOfExpression() ( ( "==" { op = BinaryExpr.Operator.equals; } | "!=" { op = BinaryExpr.Operator.notEquals; } ) right = InstanceOfExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } )* { return ret; } } Expression InstanceOfExpression(): { Expression ret; Type type; } { ret = RelationalExpression() [ "instanceof" type = Type() { ret = new InstanceOfExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, type); } ] { return ret; } } Expression RelationalExpression(): { Expression ret; Expression right; BinaryExpr.Operator op; } { ret = ShiftExpression() ( ( "<" { op = BinaryExpr.Operator.less; } | ">" { op = BinaryExpr.Operator.greater; } | "<=" { op = BinaryExpr.Operator.lessEquals; } | ">=" { op = BinaryExpr.Operator.greaterEquals; } ) right = ShiftExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } )* { return ret; } } Expression ShiftExpression(): { Expression ret; Expression right; BinaryExpr.Operator op; } { ret = AdditiveExpression() ( ( "<<" { op = BinaryExpr.Operator.lShift; } | RSIGNEDSHIFT() { op = BinaryExpr.Operator.rSignedShift; } | RUNSIGNEDSHIFT() { op = BinaryExpr.Operator.rUnsignedShift; } ) right = AdditiveExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } )* { return ret; } } Expression AdditiveExpression(): { Expression ret; Expression right; BinaryExpr.Operator op; } { ret = MultiplicativeExpression() ( ( "+" { op = BinaryExpr.Operator.plus; } | "-" { op = BinaryExpr.Operator.minus; } ) right = MultiplicativeExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } )* { return ret; } } Expression MultiplicativeExpression(): { Expression ret; Expression right; BinaryExpr.Operator op; } { ret = UnaryExpression() ( ( "*" { op = BinaryExpr.Operator.times; } | "/" { op = BinaryExpr.Operator.divide; } | "%" { op = BinaryExpr.Operator.remainder; } ) right = UnaryExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); } )* { return ret; } } Expression UnaryExpression(): { Expression ret; UnaryExpr.Operator op; int line = 0; int column = 0; } { ( ret = PreIncrementExpression() | ret = PreDecrementExpression() | ( "+" { op = UnaryExpr.Operator.positive; line=token.beginLine; column=token.beginColumn;} | "-" { op = UnaryExpr.Operator.negative; line=token.beginLine; column=token.beginColumn;} ) ret = UnaryExpression() { if(op == UnaryExpr.Operator.negative) { if (ret instanceof IntegerLiteralExpr && ((IntegerLiteralExpr)ret).isMinValue()) { ret = new IntegerLiteralMinValueExpr(line, column, token.endLine, token.endColumn); } else if (ret instanceof LongLiteralExpr && ((LongLiteralExpr)ret).isMinValue()) { ret = new LongLiteralMinValueExpr(line, column, token.endLine, token.endColumn); } else { ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, op); } } else { ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, op); } } | ret = UnaryExpressionNotPlusMinus() ) { return ret; } } Expression PreIncrementExpression(): { Expression ret; int line; int column; } { "++" {line=token.beginLine; column=token.beginColumn;} ret = UnaryExpression() { ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, UnaryExpr.Operator.preIncrement); } { return ret; } } Expression PreDecrementExpression(): { Expression ret; int line; int column; } { "--" {line=token.beginLine; column=token.beginColumn;} ret = UnaryExpression() { ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, UnaryExpr.Operator.preDecrement); } { return ret; } } Expression UnaryExpressionNotPlusMinus(): { Expression ret; UnaryExpr.Operator op; int line = 0; int column = 0; } { ( ( "~" { op = UnaryExpr.Operator.inverse; line=token.beginLine; column=token.beginColumn;} | "!" { op = UnaryExpr.Operator.not; line=token.beginLine; column=token.beginColumn;} ) ret = UnaryExpression() { ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, op); } | LOOKAHEAD( CastExpression() ) ret = CastExpression() | ret = PostfixExpression() ) { return ret; } } Expression PostfixExpression(): { Expression ret; UnaryExpr.Operator op; } { ret = PrimaryExpression() [ LOOKAHEAD(2) ( "++" { op = UnaryExpr.Operator.posIncrement; } | "--" { op = UnaryExpr.Operator.posDecrement; } ) { ret = new UnaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, op); } ] { return ret; } } Expression CastExpression(): { Expression ret; Type type; int line; int column; } { "(" {line=token.beginLine; column=token.beginColumn;} ( LOOKAHEAD(2) type = PrimitiveType() ")" ret = UnaryExpression() { ret = new CastExpr(line, column, token.endLine, token.endColumn,type, ret); } | type = ReferenceType() ")" ret = UnaryExpressionNotPlusMinus() { ret = new CastExpr(line, column, token.endLine, token.endColumn,type, ret); } ) { return ret; } } Expression PrimaryExpression(): { Expression ret; Expression inner; } { ret = PrimaryPrefix() ( LOOKAHEAD(2) ret = PrimarySuffix(ret) )* { return ret; } } Expression PrimaryExpressionWithoutSuperSuffix(): { Expression ret; Expression inner; } { ret = PrimaryPrefix() ( LOOKAHEAD( PrimarySuffixWithoutSuper(null) ) ret = PrimarySuffixWithoutSuper(ret) )* { return ret; } } Expression PrimaryPrefix(): { Expression ret; String name; List typeArgs = null; List args = null; boolean hasArgs = false; Type type; int line; int column; } { ( ret = Literal() | "this" { ret = new ThisExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, null); } | "super" { ret = new SuperExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, null); } "." [ typeArgs = TypeArguments() {typeArgs.remove(0);} ] { name = token.image; } [ args = Arguments() {hasArgs=true;} ] { ret = hasArgs ? new MethodCallExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, typeArgs, name, args) : new FieldAccessExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, null, name); } | "(" {line=token.beginLine; column=token.beginColumn;} ret = Expression() ")" { ret = new EnclosedExpr(line, column, token.endLine, token.endColumn,ret); } | ret = AllocationExpression(null) | LOOKAHEAD( ResultType() "." "class" ) type = ResultType() "." "class" { ret = new ClassExpr(type.getBeginLine(), type.getBeginColumn(), token.endLine, token.endColumn, type); } | { name = token.image; line=token.beginLine; column=token.beginColumn; } [ args = Arguments() {hasArgs=true;} ] { ret = hasArgs ? new MethodCallExpr(line, column, token.endLine, token.endColumn, null, null, name, args) : new NameExpr(line, column, token.endLine, token.endColumn, name); } ) { return ret; } } Expression PrimarySuffix(Expression scope): { Expression ret; } { ( LOOKAHEAD(2) ret = PrimarySuffixWithoutSuper(scope) | "." "super" { ret = new SuperExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope); } ) { return ret; } } Expression PrimarySuffixWithoutSuper(Expression scope): { Expression ret; List typeArgs = null; List args = null; boolean hasArgs = false; String name; } { ( "." ( // TODO: está deixando passar "this.this", verificar na JLS se é possível "this" { ret = new ThisExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope); } | ret = AllocationExpression(scope) | LOOKAHEAD( [ TypeArguments() ] ) [ typeArgs = TypeArguments() {typeArgs.remove(0);} ] { name = token.image; } [ args = Arguments() {hasArgs=true;} ] { ret = hasArgs ? new MethodCallExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, typeArgs, name, args) : new FieldAccessExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, typeArgs, name); } ) | "["ret = Expression() "]" { ret = new ArrayAccessExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, ret); } ) { return ret; } } Expression Literal(): { Expression ret; } { ( { ret = new IntegerLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); } | { ret = new LongLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); } | { ret = new DoubleLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); } | { ret = new CharLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image.substring(1, token.image.length()-1)); } | { ret = new StringLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image.substring(1, token.image.length()-1)); } | ret = BooleanLiteral() | ret = NullLiteral() ) { return ret; } } Expression BooleanLiteral(): { Expression ret; } { ( "true" { ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, true); } | "false" { ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, false); } ) { return ret; } } Expression NullLiteral(): {} { "null" { return new NullLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn); } } List Arguments(): { List ret = null; } { "(" [ ret = ArgumentList() ] ")" { return ret; } } List ArgumentList(): { List ret = new LinkedList(); Expression expr; } { expr = Expression() { ret.add(expr); } ( "," expr = Expression() { ret.add(expr); } )* { return ret; } } Expression AllocationExpression(Expression scope): { Expression ret; Type type; Object[] arr = null; List typeArgs = null; List anonymousBody = null; List args; int line; int column; } { "new" { if(scope==null) {line=token.beginLine; column=token.beginColumn;} else {line=scope.getBeginLine(); column=scope.getBeginColumn();} } ( type = PrimitiveType() arr = ArrayDimsAndInits() { if (arr[0] instanceof Integer) { ret = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, ((Integer)arr[0]).intValue(), (ArrayInitializerExpr)arr[1]); } else { ret = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, (List)arr[0], ((Integer)arr[1]).intValue()); } } | LOOKAHEAD(ClassOrInterfaceType() ArrayDimsAndInits()) type = ClassOrInterfaceType() arr = ArrayDimsAndInits() { if (arr[0] instanceof Integer) { ret = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, ((Integer)arr[0]).intValue(), (ArrayInitializerExpr)arr[1]); } else { ret = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, (List)arr[0], ((Integer)arr[1]).intValue()); } } | [ typeArgs = TypeArguments() {typeArgs.remove(0);} ] type = ClassOrInterfaceType() args = Arguments() [ LOOKAHEAD(2) anonymousBody = ClassOrInterfaceBody(false) ] { ret = new ObjectCreationExpr(line, column, token.endLine, token.endColumn, scope, (ClassOrInterfaceType) type, typeArgs, args, anonymousBody); } ) { return ret; } } /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ Object[] ArrayDimsAndInits(): { Object[] ret = new Object[2]; Expression expr; List inits = null; int i = 0; } { ( LOOKAHEAD(2) ( LOOKAHEAD(2) "[" expr = Expression() { inits = add(inits, expr); } "]" )+ ( LOOKAHEAD(2) "[" "]" { i++; } )* { ret[0] = inits; ret[1] = new Integer(i); } | ( "[" "]" { i++; } )+ expr = ArrayInitializer() { ret[0] = new Integer(i); ret[1] = expr; } ) { return ret; } } /* * Statement syntax follows. */ Statement Statement(): { Statement ret; } { ( LOOKAHEAD(2) ret = LabeledStatement() | ret = AssertStatement() | ret = Block() | ret = EmptyStatement() | ret = StatementExpression() | ret = SwitchStatement() | ret = IfStatement() | ret = WhileStatement() | ret = DoStatement() | ret = ForStatement() | ret = BreakStatement() | ret = ContinueStatement() | ret = ReturnStatement() | ret = ThrowStatement() | ret = SynchronizedStatement() | ret = TryStatement() ) { return ret; } } AssertStmt AssertStatement(): { Expression check; Expression msg = null; int line; int column; } { "assert" {line=token.beginLine; column=token.beginColumn;} check = Expression() [ ":" msg = Expression() ] ";" { return new AssertStmt(line, column, token.endLine, token.endColumn,check, msg); } } LabeledStmt LabeledStatement(): { String label; Statement stmt; int line; int column; } { {line=token.beginLine; column=token.beginColumn;} { label = token.image; } ":" stmt = Statement() { return new LabeledStmt(line, column, token.endLine, token.endColumn,label, stmt); } } BlockStmt Block(): { List stmts; int beginLine; int beginColumn; } { "{" {beginLine=token.beginLine; beginColumn=token.beginColumn;} stmts = Statements() "}" { return new BlockStmt(beginLine, beginColumn, token.endLine, token.endColumn, stmts); } } /* * Classes inside block stametents can only be abstract or final. The semantic must check it. */ Statement BlockStatement(): { Statement ret; Expression expr; ClassOrInterfaceDeclaration typeDecl; Modifier modifier; } { ( LOOKAHEAD( Modifiers() ("class" | "interface") ) { pushJavadoc(); } modifier = Modifiers() typeDecl = ClassOrInterfaceDeclaration(modifier) { ret = new TypeDeclarationStmt(typeDecl.getBeginLine(), typeDecl.getBeginColumn(), token.endLine, token.endColumn, typeDecl); } | LOOKAHEAD(VariableDeclarationExpression() ) expr = VariableDeclarationExpression() ";" { ret = new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr); } | ret = Statement() ) { return ret; } } VariableDeclarationExpr VariableDeclarationExpression(): { Modifier modifier; Type type; List vars = new LinkedList(); VariableDeclarator var; } { modifier = Modifiers() type = Type() var = VariableDeclarator() { vars.add(var); } ( "," var = VariableDeclarator() { vars.add(var); } )* { int line = modifier.beginLine; int column = modifier.beginColumn; if(line==-1) {line=type.getBeginLine(); column=type.getBeginColumn(); } return new VariableDeclarationExpr(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, vars); } } EmptyStmt EmptyStatement(): {} { ";" { return new EmptyStmt(token.beginLine, token.beginColumn, token.endLine, token.endColumn); } } ExpressionStmt StatementExpression(): /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ { Expression expr; AssignExpr.Operator op; Expression value; } { ( expr = PreIncrementExpression() | expr = PreDecrementExpression() | expr = PrimaryExpression() [ "++" { expr = new UnaryExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, UnaryExpr.Operator.posIncrement); } | "--" { expr = new UnaryExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, UnaryExpr.Operator.posDecrement); } | op = AssignmentOperator() value = Expression() { expr = new AssignExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, value, op); } ] ) ";" { return new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr); } } SwitchStmt SwitchStatement(): { Expression selector; SwitchEntryStmt entry; List entries = null; int line; int column; } { "switch" {line=token.beginLine; column=token.beginColumn;} "(" selector = Expression() ")" "{" ( entry = SwitchEntry() { entries = add(entries, entry); } )* "}" { return new SwitchStmt(line, column, token.endLine, token.endColumn,selector, entries); } } SwitchEntryStmt SwitchEntry(): { Expression label = null; List stmts; int line; int column; } { ( "case" {line=token.beginLine; column=token.beginColumn;} label = Expression() | "default" {line=token.beginLine; column=token.beginColumn;} ) ":" stmts = Statements() { return new SwitchEntryStmt(line, column, token.endLine, token.endColumn,label, stmts); } } IfStmt IfStatement(): /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ { Expression condition; Statement thenStmt; Statement elseStmt = null; int line; int column; } { "if" {line=token.beginLine; column=token.beginColumn;} "(" condition = Expression() ")" thenStmt = Statement() [ LOOKAHEAD(1) "else" elseStmt = Statement() ] { return new IfStmt(line, column, token.endLine, token.endColumn,condition, thenStmt, elseStmt); } } WhileStmt WhileStatement(): { Expression condition; Statement body; int line; int column; } { "while" {line=token.beginLine; column=token.beginColumn;} "(" condition = Expression() ")" body = Statement() { return new WhileStmt(line, column, token.endLine, token.endColumn,condition, body); } } DoStmt DoStatement(): { Expression condition; Statement body; int line; int column; } { "do" {line=token.beginLine; column=token.beginColumn;} body = Statement() "while" "(" condition = Expression() ")" ";" { return new DoStmt(line, column, token.endLine, token.endColumn,body, condition); } } Statement ForStatement(): { String id = null; VariableDeclarationExpr varExpr = null; Expression expr = null; List init = null; List update = null; Statement body; int line; int column; } { "for" {line=token.beginLine; column=token.beginColumn;} "(" ( LOOKAHEAD(VariableDeclarationExpression() ":") varExpr = VariableDeclarationExpression() ":" expr = Expression() | [ init = ForInit() ] ";" [ expr = Expression() ] ";" [ update = ForUpdate() ] ) ")" body = Statement() { if (varExpr != null) { return new ForeachStmt(line, column, token.endLine, token.endColumn,varExpr, expr, body); } return new ForStmt(line, column, token.endLine, token.endColumn,init, expr, update, body); } } List ForInit(): { List ret; Expression expr; } { ( LOOKAHEAD( Modifiers() Type() ) expr = VariableDeclarationExpression() { ret = new LinkedList(); ret.add(expr); } | ret = ExpressionList() ) { return ret; } } List ExpressionList(): { List ret = new LinkedList(); Expression expr; } { expr = Expression() { ret.add(expr); } ( "," expr = Expression() { ret.add(expr); } )* { return ret; } } List ForUpdate(): { List ret; } { ret = ExpressionList() { return ret; } } BreakStmt BreakStatement(): { String id = null; int line; int column; } { "break" {line=token.beginLine; column=token.beginColumn;} [ { id = token.image; } ] ";" { return new BreakStmt(line, column, token.endLine, token.endColumn,id); } } ContinueStmt ContinueStatement(): { String id = null; int line; int column; } { "continue" {line=token.beginLine; column=token.beginColumn;} [ { id = token.image; } ] ";" { return new ContinueStmt(line, column, token.endLine, token.endColumn,id); } } ReturnStmt ReturnStatement(): { Expression expr = null; int line; int column; } { "return" {line=token.beginLine; column=token.beginColumn;} [ expr = Expression() ] ";" { return new ReturnStmt(line, column, token.endLine, token.endColumn,expr); } } ThrowStmt ThrowStatement(): { Expression expr; int line; int column; } { "throw" {line=token.beginLine; column=token.beginColumn;} expr = Expression() ";" { return new ThrowStmt(line, column, token.endLine, token.endColumn,expr); } } SynchronizedStmt SynchronizedStatement(): { Expression expr; BlockStmt block; int line; int column; } { "synchronized" {line=token.beginLine; column=token.beginColumn;} "(" expr = Expression() ")" block = Block() { return new SynchronizedStmt(line, column, token.endLine, token.endColumn,expr, block); } } TryStmt TryStatement(): /* * Semantic check required here to make sure that at least one * finally/catch is present. */ { BlockStmt tryBlock; BlockStmt finallyBlock = null; List catchs = null; Parameter except; BlockStmt catchBlock; int line; int column; int cLine; int cColumn; } { "try" {line=token.beginLine; column=token.beginColumn;} tryBlock = Block() ( ( "catch" {cLine=token.beginLine; cColumn=token.beginColumn;} "(" except = FormalParameter() ")" catchBlock = Block() { catchs = add(catchs, new CatchClause(cLine, cColumn, token.endLine, token.endColumn, except, catchBlock)); } )+ [ "finally" finallyBlock = Block() ] | "finally" finallyBlock = Block() ) { return new TryStmt(line, column, token.endLine, token.endColumn,tryBlock, catchs, finallyBlock); } } /* We use productions to match >>>, >> and > so that we can keep the * type declaration syntax with generics clean */ void RUNSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) ">" ">" ">" ) } void RSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((GTToken)getToken(1)).realKind == RSIGNEDSHIFT} ) ">" ">" ) } /* Annotation syntax follows. */ AnnotationExpr Annotation(): { AnnotationExpr ret; } { ( LOOKAHEAD( "@" Name() "(" ( "=" | ")" )) ret = NormalAnnotation() | LOOKAHEAD( "@" Name() "(" ) ret = SingleMemberAnnotation() | ret = MarkerAnnotation() ) { return ret; } } NormalAnnotationExpr NormalAnnotation(): { NameExpr name; List pairs = null; int line; int column; } { "@" {line=token.beginLine; column=token.beginColumn;} name = Name() "(" [ pairs = MemberValuePairs() ] ")" { return new NormalAnnotationExpr(line, column, token.endLine, token.endColumn,name, pairs); } } MarkerAnnotationExpr MarkerAnnotation(): { NameExpr name; int line; int column; } { "@" {line=token.beginLine; column=token.beginColumn;} name = Name() { return new MarkerAnnotationExpr(line, column, token.endLine, token.endColumn,name); } } SingleMemberAnnotationExpr SingleMemberAnnotation(): { NameExpr name; Expression memberVal; int line; int column; } { "@" {line=token.beginLine; column=token.beginColumn;} name = Name() "(" memberVal = MemberValue() ")" { return new SingleMemberAnnotationExpr(line, column, token.endLine, token.endColumn,name, memberVal); } } List MemberValuePairs(): { List ret = new LinkedList(); MemberValuePair pair; } { pair = MemberValuePair() { ret.add(pair); } ( "," pair = MemberValuePair() { ret.add(pair); } )* { return ret; } } MemberValuePair MemberValuePair(): { String name; Expression value; int line; int column; } { { name = token.image; line=token.beginLine; column=token.beginColumn;} "=" value = MemberValue() { return new MemberValuePair(line, column, token.endLine, token.endColumn,name, value); } } Expression MemberValue(): { Expression ret; } { ( ret = Annotation() | ret = MemberValueArrayInitializer() | ret = ConditionalExpression() ) { return ret; } } Expression MemberValueArrayInitializer(): { List ret = new LinkedList(); Expression member; int line; int column; } { "{" {line=token.beginLine; column=token.beginColumn;} ( member = MemberValue() { ret.add(member); } ( LOOKAHEAD(2) "," member = MemberValue() { ret.add(member); } )* )? [ "," ] "}" { return new ArrayInitializerExpr(line, column, token.endLine, token.endColumn,ret); } } /* Annotation Types. */ AnnotationDeclaration AnnotationTypeDeclaration(Modifier modifier): { String name; List members; int line = modifier.beginLine; int column = modifier.beginColumn; } { "@" { if (line == -1) {line=token.beginLine; column=token.beginColumn;} } "interface" { name = token.image; } members = AnnotationTypeBody() { return new AnnotationDeclaration(line, column, token.endLine, token.endColumn,popJavadoc(), modifier.modifiers, modifier.annotations, name, members); } } List AnnotationTypeBody(): { List ret = null; BodyDeclaration member; } { "{" ( member = AnnotationBodyDeclaration() { ret = add(ret, member); } )* "}" { return ret; } } BodyDeclaration AnnotationBodyDeclaration(): { Modifier modifier; BodyDeclaration ret; } { { pushJavadoc(); } ( ";" { ret = new EmptyTypeDeclaration(token.beginLine, token.beginColumn, token.endLine, token.endColumn, popJavadoc()); } | modifier = Modifiers() ( LOOKAHEAD(Type() "(") ret = AnnotationTypeMemberDeclaration(modifier) | ret = ClassOrInterfaceDeclaration(modifier) | ret = EnumDeclaration(modifier) | ret = AnnotationTypeDeclaration(modifier) | ret = FieldDeclaration(modifier) ) ) { return ret; } } AnnotationMemberDeclaration AnnotationTypeMemberDeclaration(Modifier modifier): { Type type; String name; Expression defaultVal = null; } { type = Type() { name = token.image; } "(" ")" [ defaultVal = DefaultValue() ] ";" { int line = modifier.beginLine; int column = modifier.beginColumn; { if (line == -1) {line=type.getBeginLine(); column=type.getBeginColumn();} } return new AnnotationMemberDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, type, name, defaultVal); } } Expression DefaultValue(): { Expression ret; } { "default" ret = MemberValue() { return ret; } } test/0000755000000000000000000000000011245341314010531 5ustar rootroottest/japa/0000755000000000000000000000000011245341314011444 5ustar rootroottest/japa/parser/0000755000000000000000000000000011245341314012740 5ustar rootroottest/japa/parser/ast/0000755000000000000000000000000011245341314013527 5ustar rootroottest/japa/parser/ast/test/0000755000000000000000000000000011324603762014514 5ustar rootroottest/japa/parser/ast/test/classes/0000755000000000000000000000000011324634520016145 5ustar rootroottest/japa/parser/ast/test/classes/DumperTestClass.java0000644000000000000000000002110311324606212022064 0ustar rootrootpackage japa.parser.ast.test.classes; import japa.parser.JavaParser; import japa.parser.ParseException; import japa.parser.ast.CompilationUnit; import java.io.File; import java.io.IOException; import java.io.Serializable; import java.lang.annotation.Documented; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Map; import static java.util.Map.Entry; import java.applet.*; @Deprecated public class DumperTestClass, X> extends Base implements Serializable { static Class clz1 = String.class; protected Class clz2 = (String.class); Class clz3 = int.class; Class clz4 = (int.class); int[] arr = new int[10]; byte bye = 0; byte byebye[] = null; short sh1, sh2 = 1; List[][] arrLS = (List[][]) new List[10][]; ; { int z = 0, y = 0; int a = (z) + y; a = (+z) + y; byte b = (byte) +y; } @Deprecated() static class Ugly { static int x = 0; public static void main(String[] args) { x = +x; x = ~x; --x; boolean b = !false; x &= 2; x |= 2; x ^= 2; x -= 2; x %= 2; x /= 2; x *= 2; x <<= 2; x >>= 2; x >>>= 2; b = b || false; b = b | false; b = b & false; b = b ^ false; b = b != false; b = x > 1; b = x < 1; b = x >= 1; b = x <= 1; x = x << 1; x = x >> 1; x = x >>> 1; x = x - 1; x = x * 1; x = x % 1; x = x / 1; } } ; @Deprecated() int[][][][] arr2 = new int[10][2][1][0]; volatile float fff = 0x1.fffeP+127f; char cc = 'a'; int[][] arr3 = { { 1, 2 }, { 3, 4 } }; static int[] arr4[] = {}; public static DumperTestClass t; static { arr4 = new int[][] { { 2 }, { 1 } }; } { arr3 = new int[][] { { 2 }, { 1 } }; } public enum Teste { asc, def } public static enum Sexo { m, @Deprecated f; public static enum Sexo_ implements Serializable, Cloneable { } private Sexo() { } } @Deprecated public static enum Enum { m(1) { @Override void mm() { } } , f(2) { void mm() { } } ; native void nnn(); transient int x; private Enum(int x) { this.x = x; } abstract void mm(); } strictfp double ddd() { return 0.0; } public DumperTestClass(int x) { this.arr[0] = x; T val1 = null; E val2 = null; super.check2(val1, val2); boolean b = true, y = false; abstract class X { int i = 0; public X() { } public void m() { } } @Deprecated final class Y extends X { public Y() { super(); DumperTestClass.this.cc = 'c'; super.i = 1; Y.super.m(); } public Y(int y) { t.super(); } public Y(long x) { this(); } } } public DumperTestClass(String str) { } private class QWE extends DumperTestClass, String> { @Deprecated final int z = 0; int i = (int) -1; public QWE(String... x) { super(x[0]); } public QWE(int... x) { super(x[0]); i = x[0]; assert true; assert 1 == 1 : 2; { int iii = 3; iii += 3; } label: { int iii = 1; } ; ; int min = -2147483648; long sl = 123123123123l; long minl = -9223372036854775808L; switch(i) { } ll: switch(i) { case 1: System.out.println(1); break ll; default: { System.out.println("default"); break; } case 2: if (t instanceof Base) { System.out.println(1); } i++; ++i; } } private synchronized int doSomething()[] { List x = new ArrayList(); return new int[] { 1 }; } } public static void main(String[] args) throws ParseException, IOException { int x = 2; CompilationUnit cu = parse(new File("src/japa/parser/javacc/Parser.java")); System.out.println(cu); DumperTestClass teste = new DumperTestClass(2); DumperTestClass.QWE qwe = teste.new QWE(1); if (1 + 1 == 2) { teste = null; teste = new DumperTestClass(1); } else { x = 3; teste = new DumperTestClass(1); x = x == 0 ? 2 : 4; } if (true) x = 1; else x = 3; while (true) { xxx: while (x == 3) continue xxx; break; } do { x++; } while (x < 100); do x++; while (x < 100); for (@Deprecated int i : arr4[0]) { x--; } for (@Deprecated final int i = 0, j = 1; i < 10; x++) { break; } int i, j; for (i = 0, j = 1; i < 10 && j < 2; i++, j--) { break; } } @AnnotationTest(value = "x") public static CompilationUnit parse(@Deprecated File file) throws ParseException, IOException { String a = ((String) "qwe"); String x = ((String) clz1.getName()); int y = ((Integer) (Object) x).intValue(); synchronized (file) { file = null; file = new File(""); } try { if (file == null) { throw new NullPointerException("blah"); } } catch (final NullPointerException e) { System.out.println("catch"); } catch (RuntimeException e) { System.out.println("catch"); } finally { System.out.println("finally"); } try { if (file == null) { throw new NullPointerException("blah"); } } finally { System.out.println("finally"); } try { if (file == null) { throw new NullPointerException("blah"); } } catch (RuntimeException e) { System.out.println("catch"); } return JavaParser.parse(file); } class A implements XXX, Serializable { @AnnotationTest public A(Integer integer, ABC string) throws Exception, IOException { } } private void x(Map x) { @Deprecated Comparator c = new Comparator() { public int compare(Object o1, Object o2) { try { A a = new A(new Integer(11), "foo") { }; } catch (Exception e) { } return 0; } @Override public boolean equals(Object obj) { return super.equals(obj); } }; } @Documented public @interface AnnotationTest { String value() default "asd"; @Deprecated int[] valueI() default { 1, 2 }; AnnotationTest valueA1() default @AnnotationTest; AnnotationTest valueA2() default @AnnotationTest("qwe"); AnnotationTest valueA3() default @AnnotationTest(value = "qwe", valueI = { 1 }); } ; } class Base { public void check2(A val1, B val2) { } } interface XXX extends Serializable, Cloneable { }test/japa/parser/ast/test/classes/JavadocTestClass.java0000644000000000000000000000275011132421226022203 0ustar rootrootpackage japa.parser.ast.test.classes; /** * Javadoc 1 * @author Julio Vilmar Gesser */ public abstract class JavadocTestClass { ; /** * 1.1 */ ; private static int x; /** * 1.2 */ private int y[]; /** * 1.3 */ @Annotation(x = 10) private int z; private static final int m(int x) { return 0; } /** * 1.4 * @param x * @return */ private static final int m2(int x) { x = 10; /** * 1.4.1 * @author jgesser */ class Teste { /** * 1.4.1.1 */ int x; } return 0; } /** * 1.5 */ public JavadocTestClass() { } /** * 1.5 */ public JavadocTestClass(int x) { } /** * 1.6 * init */ { z = 10; } /** * 1.6 * init */ static { x = 10; } } /** * Javadoc 2 */ @Deprecated @SuppressWarnings(value = "") abstract class Class2 { } /** * Javadoc 3 */ ; /** * Javadoc 4 */ enum Enum { /** * 4.1 */ item1, item2, item3, /** * 4.2 */ item4 } /** * Javadoc 5 */ @interface Annotation { ; /** * Javadoc 5.1 * @return */ int x(); /** * Javadoc 5.2 */ ; }test/japa/parser/ast/test/AllTests.java0000644000000000000000000000067111324606126017113 0ustar rootroot/* * Created on 11/01/2009 */ package japa.parser.ast.test; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; /** * @author Julio Vilmar Gesser */ @RunWith(value = Suite.class) @SuiteClasses(value = {// TestAdapters.class, // TestNodePositions.class, // TestDumper.class, // TestHashCodeEquals.class }) public class AllTests { } test/japa/parser/ast/test/Helper.java0000644000000000000000000000341411260226250016570 0ustar rootroot/* * Created on 30/06/2008 */ package japa.parser.ast.test; import japa.parser.JavaParser; import japa.parser.ParseException; import japa.parser.ast.CompilationUnit; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.StringBufferInputStream; /** * @author Julio Vilmar Gesser */ final class Helper { private Helper() { // hide the constructor } private static File getFile(String sourceFolder, Class clazz) { return new File(sourceFolder, clazz.getName().replace('.', '/') + ".java"); } public static CompilationUnit parserClass(String sourceFolder, Class clazz) throws ParseException { try { return JavaParser.parse(getFile(sourceFolder, clazz)); } catch (IOException e) { throw new RuntimeException(e); } } public static CompilationUnit parserString(String source) throws ParseException { return JavaParser.parse(new StringBufferInputStream(source)); } public static String readFile(File file) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); try { StringBuilder ret = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { ret.append(line); ret.append("\n"); } return ret.toString(); } finally { reader.close(); } } public static String readClass(String sourceFolder, Class clazz) throws IOException { return readFile(getFile(sourceFolder, clazz)); } } test/japa/parser/ast/test/TestAdapters.java0000644000000000000000000000536611260226250017764 0ustar rootroot/* * 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 . */ /* * Created on 11/06/2008 */ package japa.parser.ast.test; import japa.parser.ParseException; import japa.parser.ast.CompilationUnit; import japa.parser.ast.test.classes.DumperTestClass; import japa.parser.ast.test.classes.JavadocTestClass; import japa.parser.ast.visitor.GenericVisitor; import japa.parser.ast.visitor.GenericVisitorAdapter; import japa.parser.ast.visitor.ModifierVisitorAdapter; import japa.parser.ast.visitor.VoidVisitor; import japa.parser.ast.visitor.VoidVisitorAdapter; import org.junit.Test; /** * @author Julio Vilmar Gesser */ public class TestAdapters { static class ConcreteVoidVisitorAdapter extends VoidVisitorAdapter { } static class ConcreteGenericVisitorAdapter extends GenericVisitorAdapter { } static class ConcreteModifierVisitorAdapter extends ModifierVisitorAdapter { } private void doTest(VoidVisitor< ? > visitor) throws ParseException { CompilationUnit cu = Helper.parserClass("./test", DumperTestClass.class); cu.accept(visitor, null); cu = Helper.parserClass("./test", JavadocTestClass.class); cu.accept(visitor, null); } private void doTest(GenericVisitor< ? , ? > visitor) throws ParseException { CompilationUnit cu = Helper.parserClass("./test", DumperTestClass.class); cu.accept(visitor, null); cu = Helper.parserClass("./test", JavadocTestClass.class); cu.accept(visitor, null); } @Test public void testVoidVisitorAdapter() throws Exception { doTest(new ConcreteVoidVisitorAdapter()); } @Test public void testGenericVisitorAdapter() throws Exception { doTest(new ConcreteGenericVisitorAdapter()); } @Test public void testModifierVisitorAdapter() throws Exception { doTest(new ConcreteModifierVisitorAdapter()); } } test/japa/parser/ast/test/TestDumper.java0000644000000000000000000000637711324634514017467 0ustar rootroot/* * 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 . */ /* * Created on 22/11/2006 */ package japa.parser.ast.test; import static org.junit.Assert.assertEquals; import japa.parser.ast.CompilationUnit; import japa.parser.ast.test.classes.DumperTestClass; import japa.parser.ast.test.classes.JavadocTestClass; import org.junit.Test; /** * @author Julio Vilmar Gesser */ public class TestDumper { @Test public void testDumpVisitor() throws Exception { String source = Helper.readClass("./test", DumperTestClass.class); CompilationUnit cu = Helper.parserString(source); assertEquals(source, cu.toString()); } @Test public void testJavadoc() throws Exception { String source = Helper.readClass("./test", JavadocTestClass.class); CompilationUnit cu = Helper.parserString(source); assertEquals(source, cu.toString()); assertEquals(19, cu.getComments().size()); } @Test public void testComments() throws Exception { final String source_with_comment = // "package japa.parser.javacc;\n" + // "public class Teste {\n" + // "//line comment\n" + // "int a = 0;" + // "//line comment\r\n" + // "int b = 0;" + // "//line comment\r" + // "int c = 0;" + // "/* multi-line\n comment\n*/" + // "int d = 0;" + // "/** multi-line\r\n javadoc\n*/" + // "int e = 0;" + // "}\n" + // "//final comment" + // ""; final String source_without_comment = // "package japa.parser.javacc;\n" + // "\n" + // "public class Teste {\n" + // "\n" + // " int a = 0;\n" + // "\n" + // " int b = 0;\n" + // "\n" + // " int c = 0;\n" + // "\n" + // " int d = 0;\n" + // "\n" + // " /** multi-line\r\n javadoc\n*/\n" + // " int e = 0;\n" + // "}\n" + // ""; CompilationUnit cu = Helper.parserString(source_with_comment); assertEquals(source_without_comment, cu.toString()); assertEquals(6, cu.getComments().size()); } }test/japa/parser/ast/test/TestHashCodeEquals.java0000644000000000000000000001215311324631762021053 0ustar rootroot/* * 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 . */ /* * Created on 22/11/2006 */ package japa.parser.ast.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import japa.parser.ast.CompilationUnit; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.test.classes.DumperTestClass; import japa.parser.ast.test.classes.JavadocTestClass; import org.junit.Test; /** * @author Julio Vilmar Gesser */ public class TestHashCodeEquals { private void assertEqualsAndHashCode(Object o1, Object o2) { assertEquals(o1, o2); assertEquals(o1.hashCode(), o2.hashCode()); } private void assertNotEqualsAndHashCode(Object o1, Object o2) { assertFalse("Not different equals", o1.equals(o2)); assertFalse("Not different hashCode", o1.hashCode() == o2.hashCode()); } private void assertNotEquals(Object o1, Object o2) { assertFalse("Not different equals", o1.equals(o2)); } @Test public void tesCompilationUnitEqual() throws Exception { String source = Helper.readClass("./test", DumperTestClass.class); CompilationUnit cu1 = Helper.parserString(source); CompilationUnit cu2 = Helper.parserString(source); assertEqualsAndHashCode(cu1, cu2); } @Test public void tesCompilationUnitNotEqual() throws Exception { String source = Helper.readClass("./test", DumperTestClass.class); CompilationUnit cu1 = Helper.parserString(source); CompilationUnit cu2 = Helper.parserString(source); cu2.setPackage(new PackageDeclaration(new NameExpr("diff_package"))); assertNotEqualsAndHashCode(cu1, cu2); } @Test public void testDiffClasses() throws Exception { final String source_with_comment = // "package japa.parser.javacc; " + // "public class Teste {}"; final String source_without_comment = // "package japa.parser.javacc; " + // "public enum Teste {}"; CompilationUnit cu1 = Helper.parserString(source_with_comment); CompilationUnit cu2 = Helper.parserString(source_without_comment); assertNotEqualsAndHashCode(cu1, cu2); } @Test public void testJavadoc() throws Exception { String source = Helper.readClass("./test", JavadocTestClass.class); CompilationUnit cu1 = Helper.parserString(source); CompilationUnit cu2 = Helper.parserString(source); assertEqualsAndHashCode(cu1, cu2); } private final String source_with_comment = // "package japa.parser.javacc;\n" + // "public class Teste {\n" + // "//line comment\n" + // "int a = 0;" + // "//line comment\r\n" + // "int b = 0;" + // "//line comment\r" + // "int c = 0;" + // "/* multi-line\n comment\n*/" + // "int d = 0;" + // "/** multi-line\r\n javadoc\n*/" + // "int e = 0;" + // "}\n" + // "//final comment" + // ""; private final String source_without_comment = // "package japa.parser.javacc;\n" + // "\n" + // "public class Teste {\n" + // "\n" + // " int a = 0;\n" + // "\n" + // " int b = 0;\n" + // "\n" + // " int c = 0;\n" + // "\n" + // " int d = 0;\n" + // "\n" + // " /** multi-line\r\n javadoc\n*/\n" + // " int e = 0;\n" + // "}\n" + // ""; @Test public void testCommentsDiff() throws Exception { CompilationUnit cu1 = Helper.parserString(source_with_comment); CompilationUnit cu2 = Helper.parserString(source_without_comment); // hashcode can be the same, equals() shall return false assertNotEquals(cu1, cu2); } @Test public void testCommentsEquals() throws Exception { CompilationUnit cu1 = Helper.parserString(source_with_comment); CompilationUnit cu2 = Helper.parserString(source_with_comment); assertEqualsAndHashCode(cu1, cu2); } }test/japa/parser/ast/test/TestNodePositions.java0000644000000000000000000004475111260226250021017 0ustar rootroot/* * Created on 30/06/2008 */ package japa.parser.ast.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import japa.parser.ast.BlockComment; import japa.parser.ast.CompilationUnit; import japa.parser.ast.ImportDeclaration; import japa.parser.ast.LineComment; import japa.parser.ast.Node; import japa.parser.ast.PackageDeclaration; import japa.parser.ast.TypeParameter; import japa.parser.ast.body.AnnotationDeclaration; import japa.parser.ast.body.AnnotationMemberDeclaration; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.ConstructorDeclaration; import japa.parser.ast.body.EmptyMemberDeclaration; import japa.parser.ast.body.EmptyTypeDeclaration; import japa.parser.ast.body.EnumConstantDeclaration; import japa.parser.ast.body.EnumDeclaration; import japa.parser.ast.body.FieldDeclaration; import japa.parser.ast.body.InitializerDeclaration; import japa.parser.ast.body.JavadocComment; import japa.parser.ast.body.MethodDeclaration; import japa.parser.ast.body.Parameter; import japa.parser.ast.body.VariableDeclarator; import japa.parser.ast.body.VariableDeclaratorId; import japa.parser.ast.expr.ArrayAccessExpr; import japa.parser.ast.expr.ArrayCreationExpr; import japa.parser.ast.expr.ArrayInitializerExpr; import japa.parser.ast.expr.AssignExpr; import japa.parser.ast.expr.BinaryExpr; import japa.parser.ast.expr.BooleanLiteralExpr; import japa.parser.ast.expr.CastExpr; import japa.parser.ast.expr.CharLiteralExpr; import japa.parser.ast.expr.ClassExpr; import japa.parser.ast.expr.ConditionalExpr; import japa.parser.ast.expr.DoubleLiteralExpr; import japa.parser.ast.expr.EnclosedExpr; import japa.parser.ast.expr.FieldAccessExpr; import japa.parser.ast.expr.InstanceOfExpr; import japa.parser.ast.expr.IntegerLiteralExpr; import japa.parser.ast.expr.IntegerLiteralMinValueExpr; import japa.parser.ast.expr.LongLiteralExpr; import japa.parser.ast.expr.LongLiteralMinValueExpr; import japa.parser.ast.expr.MarkerAnnotationExpr; import japa.parser.ast.expr.MemberValuePair; import japa.parser.ast.expr.MethodCallExpr; import japa.parser.ast.expr.NameExpr; import japa.parser.ast.expr.NormalAnnotationExpr; import japa.parser.ast.expr.NullLiteralExpr; import japa.parser.ast.expr.ObjectCreationExpr; import japa.parser.ast.expr.QualifiedNameExpr; import japa.parser.ast.expr.SingleMemberAnnotationExpr; import japa.parser.ast.expr.StringLiteralExpr; import japa.parser.ast.expr.SuperExpr; import japa.parser.ast.expr.ThisExpr; import japa.parser.ast.expr.UnaryExpr; import japa.parser.ast.expr.VariableDeclarationExpr; import japa.parser.ast.stmt.AssertStmt; import japa.parser.ast.stmt.BlockStmt; import japa.parser.ast.stmt.BreakStmt; import japa.parser.ast.stmt.CatchClause; import japa.parser.ast.stmt.ContinueStmt; import japa.parser.ast.stmt.DoStmt; import japa.parser.ast.stmt.EmptyStmt; import japa.parser.ast.stmt.ExplicitConstructorInvocationStmt; import japa.parser.ast.stmt.ExpressionStmt; import japa.parser.ast.stmt.ForStmt; import japa.parser.ast.stmt.ForeachStmt; import japa.parser.ast.stmt.IfStmt; import japa.parser.ast.stmt.LabeledStmt; import japa.parser.ast.stmt.ReturnStmt; import japa.parser.ast.stmt.SwitchEntryStmt; import japa.parser.ast.stmt.SwitchStmt; import japa.parser.ast.stmt.SynchronizedStmt; import japa.parser.ast.stmt.ThrowStmt; import japa.parser.ast.stmt.TryStmt; import japa.parser.ast.stmt.TypeDeclarationStmt; import japa.parser.ast.stmt.WhileStmt; import japa.parser.ast.test.classes.DumperTestClass; import japa.parser.ast.type.ClassOrInterfaceType; import japa.parser.ast.type.PrimitiveType; import japa.parser.ast.type.ReferenceType; import japa.parser.ast.type.VoidType; import japa.parser.ast.type.WildcardType; import japa.parser.ast.visitor.VoidVisitorAdapter; import org.junit.Test; /** * @author Julio Vilmar Gesser */ public class TestNodePositions { @Test public void testNodePositions() throws Exception { String source = Helper.readClass("./test", DumperTestClass.class); CompilationUnit cu = Helper.parserString(source); cu.accept(new TestVisitor(source), null); } void doTest(String source, Node node) { String parsed = node.toString(); assertTrue(node.getClass().getName() + ": " + parsed, node.getBeginLine() >= 0); assertTrue(node.getClass().getName() + ": " + parsed, node.getBeginColumn() >= 0); assertTrue(node.getClass().getName() + ": " + parsed, node.getEndLine() >= 0); assertTrue(node.getClass().getName() + ": " + parsed, node.getEndColumn() >= 0); if (node.getBeginLine() == node.getEndLine()) { assertTrue(node.getClass().getName() + ": " + parsed, node.getBeginColumn() <= node.getEndColumn()); } else { assertTrue(node.getClass().getName() + ": " + parsed, node.getBeginLine() <= node.getEndLine()); } String substr = substring(source, node.getBeginLine(), node.getBeginColumn(), node.getEndLine(), node.getEndColumn()); assertEquals(node.getClass().getName(), trimLines(parsed), trimLines(substr)); } private String trimLines(String str) { String[] split = str.split("\n"); StringBuilder ret = new StringBuilder(); for (int i = 0; i < split.length; i++) { ret.append(split[i].trim()); if (i < split.length - 1) { ret.append("\n"); } } return ret.toString(); } private String substring(String source, int beginLine, int beginColumn, int endLine, int endColumn) { int pos = 0; while (beginLine > 1) { if (source.charAt(pos) == '\n') { beginLine--; endLine--; } pos++; } int start = pos + beginColumn - 1; while (endLine > 1) { if (source.charAt(pos) == '\n') { endLine--; } pos++; } int end = pos + endColumn; return source.substring(start, end); } class TestVisitor extends VoidVisitorAdapter { private final String source; public TestVisitor(String source) { this.source = source; } @Override public void visit(AnnotationDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(AnnotationMemberDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ArrayAccessExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ArrayCreationExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ArrayInitializerExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(AssertStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(AssignExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(BinaryExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(BlockComment n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(BlockStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(BooleanLiteralExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(BreakStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(CastExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(CatchClause n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(CharLiteralExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ClassExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ClassOrInterfaceDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ClassOrInterfaceType n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(CompilationUnit n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ConditionalExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ConstructorDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ContinueStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(DoStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(DoubleLiteralExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(EmptyMemberDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(EmptyStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(EmptyTypeDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(EnclosedExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(EnumConstantDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(EnumDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ExplicitConstructorInvocationStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ExpressionStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(FieldAccessExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(FieldDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ForeachStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ForStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(IfStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ImportDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(InitializerDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(InstanceOfExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(IntegerLiteralExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(IntegerLiteralMinValueExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(JavadocComment n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(LabeledStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(LineComment n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(LongLiteralExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(LongLiteralMinValueExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(MarkerAnnotationExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(MemberValuePair n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(MethodCallExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(MethodDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(NameExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(NormalAnnotationExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(NullLiteralExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ObjectCreationExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(PackageDeclaration n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(Parameter n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(PrimitiveType n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(QualifiedNameExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ReferenceType n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ReturnStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(SingleMemberAnnotationExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(StringLiteralExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(SuperExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(SwitchEntryStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(SwitchStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(SynchronizedStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ThisExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(ThrowStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(TryStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(TypeDeclarationStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(TypeParameter n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(UnaryExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(VariableDeclarationExpr n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(VariableDeclarator n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(VariableDeclaratorId n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(VoidType n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(WhileStmt n, Object arg) { doTest(source, n); super.visit(n, arg); } @Override public void visit(WildcardType n, Object arg) { doTest(source, n); super.visit(n, arg); } } }