diff --git a/bin/COPYING b/bin/COPYING new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/bin/COPYING @@ -0,0 +1,674 @@ + 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. + + + Copyright (C) + + 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: + + Copyright (C) + 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 +. diff --git a/bin/COPYING.LESSER b/bin/COPYING.LESSER new file mode 100644 index 00000000..65c5ca88 --- /dev/null +++ b/bin/COPYING.LESSER @@ -0,0 +1,165 @@ + 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. diff --git a/bin/cds/util/AsciiTable.class b/bin/cds/util/AsciiTable.class new file mode 100644 index 00000000..61469e87 Binary files /dev/null and b/bin/cds/util/AsciiTable.class differ diff --git a/bin/cds/util/LargeAsciiTable$1.class b/bin/cds/util/LargeAsciiTable$1.class new file mode 100644 index 00000000..355119f7 Binary files /dev/null and b/bin/cds/util/LargeAsciiTable$1.class differ diff --git a/bin/cds/util/LargeAsciiTable$AsciiTableIterator.class b/bin/cds/util/LargeAsciiTable$AsciiTableIterator.class new file mode 100644 index 00000000..a43a770e Binary files /dev/null and b/bin/cds/util/LargeAsciiTable$AsciiTableIterator.class differ diff --git a/bin/cds/util/LargeAsciiTable$FileAsciiTableIterator.class b/bin/cds/util/LargeAsciiTable$FileAsciiTableIterator.class new file mode 100644 index 00000000..320a0f9c Binary files /dev/null and b/bin/cds/util/LargeAsciiTable$FileAsciiTableIterator.class differ diff --git a/bin/cds/util/LargeAsciiTable$LineProcessor.class b/bin/cds/util/LargeAsciiTable$LineProcessor.class new file mode 100644 index 00000000..f8c399ab Binary files /dev/null and b/bin/cds/util/LargeAsciiTable$LineProcessor.class differ diff --git a/bin/cds/util/LargeAsciiTable$LineProcessorException.class b/bin/cds/util/LargeAsciiTable$LineProcessorException.class new file mode 100644 index 00000000..cd01315b Binary files /dev/null and b/bin/cds/util/LargeAsciiTable$LineProcessorException.class differ diff --git a/bin/cds/util/LargeAsciiTable$MemoryAsciiTableIterator.class b/bin/cds/util/LargeAsciiTable$MemoryAsciiTableIterator.class new file mode 100644 index 00000000..c7788840 Binary files /dev/null and b/bin/cds/util/LargeAsciiTable$MemoryAsciiTableIterator.class differ diff --git a/bin/cds/util/LargeAsciiTable.class b/bin/cds/util/LargeAsciiTable.class new file mode 100644 index 00000000..227007d3 Binary files /dev/null and b/bin/cds/util/LargeAsciiTable.class differ diff --git a/bin/cds/utils/TextualSearchList$DefaultKeyExtractor.class b/bin/cds/utils/TextualSearchList$DefaultKeyExtractor.class new file mode 100644 index 00000000..f1036ab5 Binary files /dev/null and b/bin/cds/utils/TextualSearchList$DefaultKeyExtractor.class differ diff --git a/bin/cds/utils/TextualSearchList$KeyExtractor.class b/bin/cds/utils/TextualSearchList$KeyExtractor.class new file mode 100644 index 00000000..7a9c2800 Binary files /dev/null and b/bin/cds/utils/TextualSearchList$KeyExtractor.class differ diff --git a/bin/cds/utils/TextualSearchList.class b/bin/cds/utils/TextualSearchList.class new file mode 100644 index 00000000..37647af9 Binary files /dev/null and b/bin/cds/utils/TextualSearchList.class differ diff --git a/bin/org/json/Json4Uws.class b/bin/org/json/Json4Uws.class new file mode 100644 index 00000000..6f9dcab3 Binary files /dev/null and b/bin/org/json/Json4Uws.class differ diff --git a/lib/jaxb-api-2.3.1.jar b/lib/jaxb-api-2.3.1.jar new file mode 100644 index 00000000..45658654 Binary files /dev/null and b/lib/jaxb-api-2.3.1.jar differ diff --git a/lib/postgresql-42.1.4.jar b/lib/postgresql-42.1.4.jar new file mode 100644 index 00000000..08a54b10 Binary files /dev/null and b/lib/postgresql-42.1.4.jar differ diff --git a/src/adql/db/DBChecker.java.save b/src/adql/db/DBChecker.java.save new file mode 100644 index 00000000..d9fa0cf9 --- /dev/null +++ b/src/adql/db/DBChecker.java.save @@ -0,0 +1,1529 @@ +package adql.db; + +/* + * This file is part of ADQLLibrary. + * + * ADQLLibrary 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. + * + * ADQLLibrary 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 ADQLLibrary. If not, see . + * + * Copyright 2011-2017 - UDS/Centre de Données astronomiques de Strasbourg (CDS), + * Astronomisches Rechen Institut (ARI) + */ + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Stack; + +import adql.db.STCS.CoordSys; +import adql.db.STCS.Region; +import adql.db.STCS.RegionType; +import adql.db.exception.UnresolvedColumnException; +import adql.db.exception.UnresolvedFunctionException; +import adql.db.exception.UnresolvedIdentifiersException; +import adql.db.exception.UnresolvedTableException; +import adql.parser.ParseException; +import adql.parser.QueryChecker; +import adql.query.ADQLIterator; +import adql.query.ADQLObject; +import adql.query.ADQLQuery; +import adql.query.ClauseSelect; +import adql.query.ColumnReference; +import adql.query.IdentifierField; +import adql.query.SelectAllColumns; +import adql.query.SelectItem; +import adql.query.from.ADQLTable; +import adql.query.from.FromContent; +import adql.query.operand.ADQLColumn; +import adql.query.operand.ADQLOperand; +import adql.query.operand.StringConstant; +import adql.query.operand.UnknownType; +import adql.query.operand.function.ADQLFunction; +import adql.query.operand.function.DefaultUDF; +import adql.query.operand.function.UserDefinedFunction; +import adql.query.operand.function.geometry.BoxFunction; +import adql.query.operand.function.geometry.CircleFunction; +import adql.query.operand.function.geometry.GeometryFunction; +import adql.query.operand.function.geometry.PointFunction; +import adql.query.operand.function.geometry.PolygonFunction; +import adql.query.operand.function.geometry.RegionFunction; +import adql.search.ISearchHandler; +import adql.search.SearchColumnHandler; +import adql.search.SimpleReplaceHandler; +import adql.search.SimpleSearchHandler; + +/** + * This {@link QueryChecker} implementation is able to do the following verifications on an ADQL query: + *
    + *
  1. Check the existence of all table and column references found in a query
  2. + *
  3. Resolve all unknown functions as supported User Defined Functions (UDFs)
  4. + *
  5. Check whether all used geometrical functions are supported
  6. + *
  7. Check whether all used coordinate systems are supported
  8. + *
  9. Check that types of columns and UDFs match with their context
  10. + *
+ * + *

Check tables and columns

+ *

+ * In addition to check the existence of tables and columns referenced in the query, + * this checked will also attach database metadata on these references ({@link ADQLTable} + * and {@link ADQLColumn} instances when they are resolved. + *

+ * + *

These information are:

+ *
    + *
  • the corresponding {@link DBTable} or {@link DBColumn} (see getter and setter for DBLink in {@link ADQLTable} and {@link ADQLColumn})
  • + *
  • the link between an {@link ADQLColumn} and its {@link ADQLTable}
  • + *
+ * + *

Note: + * Knowing DB metadata of {@link ADQLTable} and {@link ADQLColumn} is particularly useful for the translation of the ADQL query to SQL, + * because the ADQL name of columns and tables can be replaced in SQL by their DB name, if different. This mapping is done automatically + * by {@link adql.translator.JDBCTranslator}. + *

+ * + * @author Grégory Mantelet (CDS;ARI) + * @version 1.4 (03/2017) + * + * TODO: needs merge (Updated by G.Landais for VizieR) + * - resolveTables (set dbname) + */ +public class DBChecker implements QueryChecker { + + /** List of all available tables ({@link DBTable}). */ + protected SearchTableList lstTables; + + /**

List of all allowed geometrical functions (i.e. CONTAINS, REGION, POINT, COORD2, ...).

+ *

+ * If this list is NULL, all geometrical functions are allowed. + * However, if not, all items of this list must be the only allowed geometrical functions. + * So, if the list is empty, no such function is allowed. + *

+ * @since 1.3 */ + protected String[] allowedGeo = null; + + /**

List of all allowed coordinate systems.

+ *

+ * Each item of this list must be of the form: "{frame} {refpos} {flavor}". + * Each of these 3 items can be either of value, a list of values expressed with the syntax "({value1}|{value2}|...)" + * or a '*' to mean all possible values. + *

+ *

Note: since a default value (corresponding to the empty string - '') should always be possible for each part of a coordinate system, + * the checker will always add the default value (UNKNOWNFRAME, UNKNOWNREFPOS or SPHERICAL2) into the given list of possible values for each coord. sys. part.

+ *

+ * If this list is NULL, all coordinates systems are allowed. + * However, if not, all items of this list must be the only allowed coordinate systems. + * So, if the list is empty, none is allowed. + *

+ * @since 1.3 */ + protected String[] allowedCoordSys = null; + + /**

A regular expression built using the list of allowed coordinate systems. + * With this regex, it is possible to known whether a coordinate system expression is allowed or not.

+ *

If NULL, all coordinate systems are allowed.

+ * @since 1.3 */ + protected String coordSysRegExp = null; + + /**

List of all allowed User Defined Functions (UDFs).

+ *

+ * If this list is NULL, any encountered UDF will be allowed. + * However, if not, all items of this list must be the only allowed UDFs. + * So, if the list is empty, no UDF is allowed. + *

+ * @since 1.3 */ + protected FunctionDef[] allowedUdfs = null; + + /* ************ */ + /* CONSTRUCTORS */ + /* ************ */ + /** + *

Builds a {@link DBChecker} with an empty list of tables.

+ * + *

Verifications done by this object after creation:

+ *
    + *
  • Existence of tables and columns: NO (even unknown or fake tables and columns are allowed)
  • + *
  • Existence of User Defined Functions (UDFs): NO (any "unknown" function is allowed)
  • + *
  • Support of geometrical functions: NO (all valid geometrical functions are allowed)
  • + *
  • Support of coordinate systems: NO (all valid coordinate systems are allowed)
  • + *
+ */ + public DBChecker(){ + this(null, null); + } + + /** + *

Builds a {@link DBChecker} with the given list of known tables.

+ * + *

Verifications done by this object after creation:

+ *
    + *
  • Existence of tables and columns: OK
  • + *
  • Existence of User Defined Functions (UDFs): NO (any "unknown" function is allowed)
  • + *
  • Support of geometrical functions: NO (all valid geometrical functions are allowed)
  • + *
  • Support of coordinate systems: NO (all valid coordinate systems are allowed)
  • + *
+ * + * @param tables List of all available tables. + */ + public DBChecker(final Collection tables){ + this(tables, null); + } + + /** + *

Builds a {@link DBChecker} with the given list of known tables and with a restricted list of user defined functions.

+ * + *

Verifications done by this object after creation:

+ *
    + *
  • Existence of tables and columns: OK
  • + *
  • Existence of User Defined Functions (UDFs): OK
  • + *
  • Support of geometrical functions: NO (all valid geometrical functions are allowed)
  • + *
  • Support of coordinate systems: NO (all valid coordinate systems are allowed)
  • + *
+ * + * @param tables List of all available tables. + * @param allowedUdfs List of all allowed user defined functions. + * If NULL, no verification will be done (and so, all UDFs are allowed). + * If empty list, no "unknown" (or UDF) is allowed. + * Note: match with items of this list are done case insensitively. + * + * @since 1.3 + */ + public DBChecker(final Collection tables, final Collection allowedUdfs){ + // Sort and store the given tables: + setTables(tables); + + Object[] tmp; + int cnt; + + // Store all allowed UDFs in a sorted array: + if (allowedUdfs != null){ + // Remove all NULL and empty strings: + tmp = new FunctionDef[allowedUdfs.size()]; + cnt = 0; + for(FunctionDef udf : allowedUdfs){ + if (udf != null && udf.name.trim().length() > 0) + tmp[cnt++] = udf; + } + // make a copy of the array: + this.allowedUdfs = new FunctionDef[cnt]; + System.arraycopy(tmp, 0, this.allowedUdfs, 0, cnt); + + tmp = null; + // sort the values: + Arrays.sort(this.allowedUdfs); + } + } + + /** + *

Builds a {@link DBChecker} with the given list of known tables and with a restricted list of user defined functions.

+ * + *

Verifications done by this object after creation:

+ *
    + *
  • Existence of tables and columns: OK
  • + *
  • Existence of User Defined Functions (UDFs): NO (any "unknown" function is allowed)
  • + *
  • Support of geometrical functions: OK
  • + *
  • Support of coordinate systems: OK
  • + *
+ * + * @param tables List of all available tables. + * @param allowedGeoFcts List of all allowed geometrical functions (i.e. CONTAINS, POINT, UNION, CIRCLE, COORD1). + * If NULL, no verification will be done (and so, all geometries are allowed). + * If empty list, no geometry function is allowed. + * Note: match with items of this list are done case insensitively. + * @param allowedCoordSys List of all allowed coordinate system patterns. The syntax of a such pattern is the following: + * "{frame} {refpos} {flavor}" ; on the contrary to a coordinate system expression, here no part is optional. + * Each part of this pattern can be one the possible values (case insensitive), a list of possible values + * expressed with the syntax "({value1}|{value2}|...)", or a '*' for any valid value. + * For instance: "ICRS (GEOCENTER|heliocenter) *". + * If the given list is NULL, no verification will be done (and so, all coordinate systems are allowed). + * If it is empty, no coordinate system is allowed (except the default values - generally expressed by an empty string: ''). + * + * @since 1.3 + */ + public DBChecker(final Collection tables, final Collection allowedGeoFcts, final Collection allowedCoordSys) throws ParseException{ + this(tables, null, allowedGeoFcts, allowedCoordSys); + } + + /** + *

Builds a {@link DBChecker}.

+ * + *

Verifications done by this object after creation:

+ *
    + *
  • Existence of tables and columns: OK
  • + *
  • Existence of User Defined Functions (UDFs): OK
  • + *
  • Support of geometrical functions: OK
  • + *
  • Support of coordinate systems: OK
  • + *
+ * + * @param tables List of all available tables. + * @param allowedUdfs List of all allowed user defined functions. + * If NULL, no verification will be done (and so, all UDFs are allowed). + * If empty list, no "unknown" (or UDF) is allowed. + * Note: match with items of this list are done case insensitively. + * @param allowedGeoFcts List of all allowed geometrical functions (i.e. CONTAINS, POINT, UNION, CIRCLE, COORD1). + * If NULL, no verification will be done (and so, all geometries are allowed). + * If empty list, no geometry function is allowed. + * Note: match with items of this list are done case insensitively. + * @param allowedCoordSys List of all allowed coordinate system patterns. The syntax of a such pattern is the following: + * "{frame} {refpos} {flavor}" ; on the contrary to a coordinate system expression, here no part is optional. + * Each part of this pattern can be one the possible values (case insensitive), a list of possible values + * expressed with the syntax "({value1}|{value2}|...)", or a '*' for any valid value. + * For instance: "ICRS (GEOCENTER|heliocenter) *". + * If the given list is NULL, no verification will be done (and so, all coordinate systems are allowed). + * If it is empty, no coordinate system is allowed (except the default values - generally expressed by an empty string: ''). + * + * @since 1.3 + */ + public DBChecker(final Collection tables, final Collection allowedUdfs, final Collection allowedGeoFcts, final Collection allowedCoordSys) throws ParseException{ + // Set the list of available tables + Set the list of all known UDFs: + this(tables, allowedUdfs); + + // Set the list of allowed geometrical functions: + allowedGeo = specialSort(allowedGeoFcts); + + // Set the list of allowed coordinate systems: + this.allowedCoordSys = specialSort(allowedCoordSys); + coordSysRegExp = STCS.buildCoordSysRegExp(this.allowedCoordSys); + } + + /** + * Transform the given collection of string elements in a sorted array. + * Only non-NULL and non-empty strings are kept. + * + * @param items Items to copy and sort. + * + * @return A sorted array containing all - except NULL and empty strings - items of the given collection. + * + * @since 1.3 + */ + protected final static String[] specialSort(final Collection items){ + // Nothing to do if the array is NULL: + if (items == null) + return null; + + // Keep only valid items (not NULL and not empty string): + String[] tmp = new String[items.size()]; + int cnt = 0; + for(String item : items){ + if (item != null && item.trim().length() > 0) + tmp[cnt++] = item; + } + + // Make an adjusted array copy: + String[] copy = new String[cnt]; + System.arraycopy(tmp, 0, copy, 0, cnt); + + // Sort the values: + Arrays.sort(copy); + + return copy; + } + + /* ****** */ + /* SETTER */ + /* ****** */ + /** + *

Sets the list of all available tables.

+ * + *

Note: + * Only if the given collection is NOT an instance of {@link SearchTableList}, + * the collection will be copied inside a new {@link SearchTableList}, otherwise it is used as provided. + *

+ * + * @param tables List of {@link DBTable}s. + */ + public final void setTables(final Collection tables){ + if (tables == null) + lstTables = new SearchTableList(); + else if (tables instanceof SearchTableList) + lstTables = (SearchTableList)tables; + else + lstTables = new SearchTableList(tables); + } + + /* ************* */ + /* CHECK METHODS */ + /* ************* */ + /** + *

Check all the columns, tables and UDFs references inside the given query.

+ * + *

+ * Note: This query has already been parsed ; thus it is already syntactically correct. + * Only the consistency with the published tables, columns and all the defined UDFs must be checked. + *

+ * + * @param query The query to check. + * + * @throws ParseException An {@link UnresolvedIdentifiersException} if some tables or columns can not be resolved. + * + * @see #check(ADQLQuery, Stack) + */ + @Override + public final void check(final ADQLQuery query) throws ParseException{ + check(query, null); + } + + /** + *

Process several (semantic) verifications in the given ADQL query.

+ * + *

Main verifications done in this function:

+ *
    + *
  1. Existence of DB items (tables and columns)
  2. + *
  3. Semantic verification of sub-queries
  4. + *
  5. Support of every encountered User Defined Functions (UDFs - functions unknown by the syntactic parser)
  6. + *
  7. Support of every encountered geometries (functions, coordinate systems and STC-S expressions)
  8. + *
  9. Consistency of types still unknown (because the syntactic parser could not yet resolve them)
  10. + *
+ * + * @param query The query to check. + * @param fathersList List of all columns available in the father queries and that should be accessed in sub-queries. + * Each item of this stack is a list of columns available in each father-level query. + * Note: this parameter is NULL if this function is called with the root/father query as parameter. + * + * @throws UnresolvedIdentifiersException An {@link UnresolvedIdentifiersException} if one or several of the above listed tests have detected + * some semantic errors (i.e. unresolved table, columns, function). + * + * @since 1.2 + * + * @see #checkDBItems(ADQLQuery, Stack, UnresolvedIdentifiersException) + * @see #checkSubQueries(ADQLQuery, Stack, SearchColumnList, UnresolvedIdentifiersException) + * @see #checkUDFs(ADQLQuery, UnresolvedIdentifiersException) + * @see #checkGeometries(ADQLQuery, UnresolvedIdentifiersException) + * @see #checkTypes(ADQLQuery, UnresolvedIdentifiersException) + */ + protected void check(final ADQLQuery query, final Stack fathersList) throws UnresolvedIdentifiersException{ + UnresolvedIdentifiersException errors = new UnresolvedIdentifiersException(); + + // A. Check DB items (tables and columns): + SearchColumnList availableColumns = checkDBItems(query, fathersList, errors); + + // B. Check UDFs: + if (allowedUdfs != null) + checkUDFs(query, errors); + + // C. Check geometries: + checkGeometries(query, errors); + + // D. Check types: + checkTypes(query, errors); + + // E. Check sub-queries: + checkSubQueries(query, fathersList, availableColumns, errors); + + // Throw all errors, if any: + if (errors.getNbErrors() > 0) + throw errors; + } + + /* ************************************************ */ + /* CHECKING METHODS FOR DB ITEMS (TABLES & COLUMNS) */ + /* ************************************************ */ + + /** + *

Check DB items (tables and columns) used in the given ADQL query.

+ * + *

Operations done in this function:

+ *
    + *
  1. Resolve all found tables
  2. + *
  3. Get the whole list of all available columns Note: this list is returned by this function.
  4. + *
  5. Resolve all found columns
  6. + *
+ * + * @param query Query in which the existence of DB items must be checked. + * @param fathersList List of all columns available in the father queries and that should be accessed in sub-queries. + * Each item of this stack is a list of columns available in each father-level query. + * Note: this parameter is NULL if this function is called with the root/father query as parameter. + * @param errors List of errors to complete in this function each time an unknown table or column is encountered. + * + * @return List of all columns available in the given query. + * + * @see #resolveTables(ADQLQuery, Stack, UnresolvedIdentifiersException) + * @see FromContent#getDBColumns() + * @see #resolveColumns(ADQLQuery, Stack, Map, SearchColumnList, UnresolvedIdentifiersException) + * + * @since 1.3 + */ + protected SearchColumnList checkDBItems(final ADQLQuery query, final Stack fathersList, final UnresolvedIdentifiersException errors){ + // a. Resolve all tables: + Map mapTables = resolveTables(query, fathersList, errors); + + // b. Get the list of all columns made available in the clause FROM: + SearchColumnList availableColumns; + try{ + availableColumns = query.getFrom().getDBColumns(); + }catch(ParseException pe){ + errors.addException(pe); + availableColumns = new SearchColumnList(); + } + + // c. Resolve all columns: + resolveColumns(query, fathersList, mapTables, availableColumns, errors); + + return availableColumns; + } + + /** + *

Search all table references inside the given query, resolve them against the available tables, and if there is only one match, + * attach the matching metadata to them.

+ * + * Management of sub-query tables + *

+ * If a table is not a DB table reference but a sub-query, this latter is first checked (using {@link #check(ADQLQuery, Stack)} ; + * but the father list must not contain tables of the given query, because on the same level) and then corresponding table metadata + * are generated (using {@link #generateDBTable(ADQLQuery, String)}) and attached to it. + *

+ * + * Management of "{table}.*" in the SELECT clause + *

+ * For each of this SELECT item, this function tries to resolve the table name. If only one match is found, the corresponding ADQL table object + * is got from the list of resolved tables and attached to this SELECT item (thus, the joker item will also have the good metadata, + * particularly if the referenced table is a sub-query). + *

+ * + * @param query Query in which the existence of tables must be checked. + * @param fathersList List of all columns available in the father queries and that should be accessed in sub-queries. + * Each item of this stack is a list of columns available in each father-level query. + * Note: this parameter is NULL if this function is called with the root/father query as parameter. + * @param errors List of errors to complete in this function each time an unknown table or column is encountered. + * + * @return An associative map of all the resolved tables. + */ + public Map resolveTables(final ADQLQuery query, final Stack fathersList, final UnresolvedIdentifiersException errors){ + HashMap mapTables = new HashMap(); + ISearchHandler sHandler; + + // Check the existence of all tables: + sHandler = new SearchTableHandler(); + sHandler.search(query.getFrom()); + for(ADQLObject result : sHandler){ + try{ + ADQLTable table = (ADQLTable)result; + + // resolve the table: + DBTable dbTable = null; + if (table.isSubQuery()){ + // check the sub-query tables: + check(table.getSubQuery(), fathersList); + // generate its DBTable: + dbTable = generateDBTable(table.getSubQuery(), table.getAlias()); + }else{ + dbTable = resolveTable(table); + if (table.hasAlias()) + dbTable = dbTable.copy(dbTable.getDBName(), table.getAlias()); + } + + // link with the matched DBTable: + table.setDBLink(dbTable); + mapTables.put(dbTable, table); + }catch(ParseException pe){ + errors.addException(pe); + } + } + + // Attach table information on wildcards with the syntax "{tableName}.*" of the SELECT clause: + /* Note: no need to check the table name among the father tables, because there is + * no interest to select a father column in a sub-query + * (which can return only one column ; besides, no aggregate is allowed + * in sub-queries).*/ + sHandler = new SearchWildCardHandler(); + sHandler.search(query.getSelect()); + for(ADQLObject result : sHandler){ + try{ + SelectAllColumns wildcard = (SelectAllColumns)result; + ADQLTable table = wildcard.getAdqlTable(); + DBTable dbTable = null; + + // first, try to resolve the table by table alias: + if (table.getTableName() != null && table.getSchemaName() == null){ + ArrayList tables = query.getFrom().getTablesByAlias(table.getTableName(), table.isCaseSensitive(IdentifierField.TABLE)); + if (tables.size() == 1) + dbTable = tables.get(0).getDBLink(); + } + + // then try to resolve the table reference by table name: + if (dbTable == null) + dbTable = resolveTable(table); + + // set the corresponding tables among the list of resolved tables: + wildcard.setAdqlTable(mapTables.get(dbTable)); + }catch(ParseException pe){ + errors.addException(pe); + } + } + + return mapTables; + } + + /** + * Resolve the given table, that's to say search for the corresponding {@link DBTable}. + * + * @param table The table to resolve. + * + * @return The corresponding {@link DBTable} if found, null otherwise. + * + * @throws ParseException An {@link UnresolvedTableException} if the given table can't be resolved. + */ + protected DBTable resolveTable(final ADQLTable table) throws ParseException{ + ArrayList tables = lstTables.search(table); + + // good if only one table has been found: + if (tables.size() == 1) + return tables.get(0); + // but if more than one: ambiguous table name ! + else if (tables.size() > 1) + throw new UnresolvedTableException(table, (tables.get(0).getADQLSchemaName() == null ? "" : tables.get(0).getADQLSchemaName() + ".") + tables.get(0).getADQLName(), (tables.get(1).getADQLSchemaName() == null ? "" : tables.get(1).getADQLSchemaName() + ".") + tables.get(1).getADQLName()); + // otherwise (no match): unknown table ! + else + throw new UnresolvedTableException(table); + } + + /** + *

Search all column references inside the given query, resolve them thanks to the given tables' metadata, + * and if there is only one match, attach the matching metadata to them.

+ * + * Management of selected columns' references + *

+ * A column reference is not only a direct reference to a table column using a column name. + * It can also be a reference to an item of the SELECT clause (which will then call a "selected column"). + * That kind of reference can be either an index (an unsigned integer starting from 1 to N, where N is the + * number selected columns), or the name/alias of the column. + *

+ *

+ * These references are also checked, in a second step, in this function. Thus, column metadata are + * also attached to them, as common columns. + *

+ * + * @param query Query in which the existence of tables must be checked. + * @param fathersList List of all columns available in the father queries and that should be accessed in sub-queries. + * Each item of this stack is a list of columns available in each father-level query. + * Note: this parameter is NULL if this function is called with the root/father query as parameter. + * @param mapTables List of all resolved tables. + * @param list List of column metadata to complete in this function each time a column reference is resolved. + * @param errors List of errors to complete in this function each time an unknown table or column is encountered. + */ + protected void resolveColumns(final ADQLQuery query, final Stack fathersList, final Map mapTables, final SearchColumnList list, final UnresolvedIdentifiersException errors){ + ISearchHandler sHandler; + + // Check the existence of all columns: + sHandler = new SearchColumnHandler(); + sHandler.search(query); + for(ADQLObject result : sHandler){ + try{ + ADQLColumn adqlColumn = (ADQLColumn)result; + // resolve the column: + DBColumn dbColumn = resolveColumn(adqlColumn, list, fathersList); + // link with the matched DBColumn: + adqlColumn.setDBLink(dbColumn); + adqlColumn.setAdqlTable(mapTables.get(dbColumn.getTable())); + }catch(ParseException pe){ + errors.addException(pe); + } + } + + // Check the correctness of all column references (= references to selected columns): + /* Note: no need to provide the father tables when resolving column references, + * because no father column can be used in ORDER BY and/or GROUP BY. */ + sHandler = new SearchColReferenceHandler(); + sHandler.search(query); + ClauseSelect select = query.getSelect(); + for(ADQLObject result : sHandler){ + try{ + ColumnReference colRef = (ColumnReference)result; + // resolve the column reference: + DBColumn dbColumn = checkColumnReference(colRef, select, list); + // link with the matched DBColumn: + colRef.setDBLink(dbColumn); + if (dbColumn != null) + colRef.setAdqlTable(mapTables.get(dbColumn.getTable())); + }catch(ParseException pe){ + errors.addException(pe); + } + } + } + + /** + *

Resolve the given column, that's to say search for the corresponding {@link DBColumn}.

+ * + *

+ * The third parameter is used only if this function is called inside a sub-query. In this case, + * the column is tried to be resolved with the first list (dbColumns). If no match is found, + * the resolution is tried with the father columns list (fathersList). + *

+ * + * @param column The column to resolve. + * @param dbColumns List of all available {@link DBColumn}s. + * @param fathersList List of all columns available in the father queries and that should be accessed in sub-queries. + * Each item of this stack is a list of columns available in each father-level query. + * Note: this parameter is NULL if this function is called with the root/father query as parameter. + * + * @return The corresponding {@link DBColumn} if found. Otherwise an exception is thrown. + * + * @throws ParseException An {@link UnresolvedColumnException} if the given column can't be resolved + * or an {@link UnresolvedTableException} if its table reference can't be resolved. + */ + protected DBColumn resolveColumn(final ADQLColumn column, final SearchColumnList dbColumns, Stack fathersList) throws ParseException{ + ArrayList foundColumns = dbColumns.search(column); + + // good if only one column has been found: + if (foundColumns.size() == 1) + return foundColumns.get(0); + // but if more than one: ambiguous table reference ! + else if (foundColumns.size() > 1){ + if (column.getTableName() == null) + throw new UnresolvedColumnException(column, (foundColumns.get(0).getTable() == null) ? "" : (foundColumns.get(0).getTable().getADQLName() + "." + foundColumns.get(0).getADQLName()), (foundColumns.get(1).getTable() == null) ? "" : (foundColumns.get(1).getTable().getADQLName() + "." + foundColumns.get(1).getADQLName())); + else + throw new UnresolvedTableException(column, (foundColumns.get(0).getTable() == null) ? "" : foundColumns.get(0).getTable().getADQLName(), (foundColumns.get(1).getTable() == null) ? "" : foundColumns.get(1).getTable().getADQLName()); + }// otherwise (no match): unknown column ! + else{ + if (fathersList == null || fathersList.isEmpty()) + throw new UnresolvedColumnException(column); + else{ + Stack subStack = new Stack(); + subStack.addAll(fathersList.subList(0, fathersList.size() - 1)); + return resolveColumn(column, fathersList.peek(), subStack); + } + } + } + + /** + * Check whether the given column reference corresponds to a selected item (column or an expression with an alias) + * or to an existing column. + * + * @param colRef The column reference which must be checked. + * @param select The SELECT clause of the ADQL query. + * @param dbColumns The list of all available columns. + * + * @return The corresponding {@link DBColumn} if this reference is actually the name of a column, null otherwise. + * + * @throws ParseException An {@link UnresolvedColumnException} if the given column can't be resolved + * or an {@link UnresolvedTableException} if its table reference can't be resolved. + * + * @see ClauseSelect#searchByAlias(String) + * @see #resolveColumn(ADQLColumn, SearchColumnList, Stack) + */ + protected DBColumn checkColumnReference(final ColumnReference colRef, final ClauseSelect select, final SearchColumnList dbColumns) throws ParseException{ + if (colRef.isIndex()){ + int index = colRef.getColumnIndex(); + if (index > 0 && index <= select.size()){ + SelectItem item = select.get(index - 1); + if (item.getOperand() instanceof ADQLColumn) + return ((ADQLColumn)item.getOperand()).getDBLink(); + else + return null; + }else + throw new ParseException("Column index out of bounds: " + index + " (must be between 1 and " + select.size() + ") !", colRef.getPosition()); + }else{ + ADQLColumn col = new ADQLColumn(null, colRef.getColumnName()); + col.setCaseSensitive(colRef.isCaseSensitive()); + col.setPosition(colRef.getPosition()); + + // search among the select_item aliases: + ArrayList founds = select.searchByAlias(colRef.getColumnName(), colRef.isCaseSensitive()); + if (founds.size() == 1) + return null; + else if (founds.size() > 1) + throw new UnresolvedColumnException(col, founds.get(0).getAlias(), founds.get(1).getAlias()); + + // check the corresponding column: + return resolveColumn(col, dbColumns, null); + } + } + + /** + * Generate a {@link DBTable} corresponding to the given sub-query with the given table name. + * This {@link DBTable} will contain all {@link DBColumn} returned by {@link ADQLQuery#getResultingColumns()}. + * + * @param subQuery Sub-query in which the specified table must be searched. + * @param tableName Name of the table to search. + * + * @return The corresponding {@link DBTable} if the table has been found in the given sub-query, null otherwise. + * + * @throws ParseException Can be used to explain why the table has not been found. Note: not used by default. + */ + public static DBTable generateDBTable(final ADQLQuery subQuery, final String tableName) throws ParseException{ + DefaultDBTable dbTable = new DefaultDBTable(tableName); + + DBColumn[] columns = subQuery.getResultingColumns(); + for(DBColumn dbCol : columns) + dbTable.addColumn(dbCol.copy(dbCol.getADQLName(), dbCol.getADQLName(), dbTable)); + + return dbTable; + } + + /* ************************* */ + /* CHECKING METHODS FOR UDFs */ + /* ************************* */ + + /** + *

Search all UDFs (User Defined Functions) inside the given query, and then + * check their signature against the list of allowed UDFs.

+ * + *

Note: + * When more than one allowed function match, the function is considered as correct + * and no error is added. + * However, in case of multiple matches, the return type of matching functions could + * be different and in this case, there would be an error while checking later + * the types. In such case, throwing an error could make sense, but the user would + * then need to cast some parameters to help the parser identifying the right function. + * But the type-casting ability is not yet possible in ADQL. + *

+ * + * @param query Query in which UDFs must be checked. + * @param errors List of errors to complete in this function each time a UDF does not match to any of the allowed UDFs. + * + * @since 1.3 + */ + protected void checkUDFs(final ADQLQuery query, final UnresolvedIdentifiersException errors){ + // 1. Search all UDFs: + ISearchHandler sHandler = new SearchUDFHandler(); + sHandler.search(query); + + // If no UDF are allowed, throw immediately an error: + if (allowedUdfs.length == 0){ + for(ADQLObject result : sHandler) + errors.addException(new UnresolvedFunctionException((UserDefinedFunction)result)); + } + // 2. Try to resolve all of them: + else{ + ArrayList toResolveLater = new ArrayList(); + UserDefinedFunction udf; + int match; + BinarySearch binSearch = new BinarySearch(){ + @Override + protected int compare(UserDefinedFunction searchItem, FunctionDef arrayItem){ + return arrayItem.compareTo(searchItem) * -1; + } + }; + + // Try to resolve all the found UDFs: + /* Note: at this stage, it can happen that UDFs can not be yet resolved because the building of + * their signature depends of other UDFs. That's why, these special cases should be kept + * for a later resolution try. */ + for(ADQLObject result : sHandler){ + udf = (UserDefinedFunction)result; + // if the type of not all parameters are resolved, postpone the resolution: + if (!isAllParamTypesResolved(udf)) + toResolveLater.add(udf); + // otherwise: + else{ + // search for a match: + match = binSearch.search(udf, allowedUdfs); + // if no match... + if (match < 0) + errors.addException(new UnresolvedFunctionException(udf)); + // if there is a match, metadata may be attached (particularly if the function is built automatically by the syntactic parser): + else if (udf instanceof DefaultUDF) + ((DefaultUDF)udf).setDefinition(allowedUdfs[match]); + } + } + + // Try to resolve UDFs whose some parameter types are depending of other UDFs: + /* Note: we need to iterate from the end in order to resolve first the most wrapped functions + * (e.g. fct1(fct2(...)) ; fct2 must be resolved before fct1). */ + for(int i = toResolveLater.size() - 1; i >= 0; i--){ + udf = toResolveLater.get(i); + // search for a match: + match = binSearch.search(udf, allowedUdfs); + // if no match, add an error: + if (match < 0) + errors.addException(new UnresolvedFunctionException(udf)); + // otherwise, metadata may be attached (particularly if the function is built automatically by the syntactic parser): + else if (udf instanceof DefaultUDF) + ((DefaultUDF)udf).setDefinition(allowedUdfs[match]); + } + + // 3. Replace all the resolved DefaultUDF by an instance of the class associated with the set signature: + (new ReplaceDefaultUDFHandler(errors)).searchAndReplace(query); + } + } + + /** + *

Tell whether the type of all parameters of the given ADQL function + * is resolved.

+ * + *

A parameter type may not be resolved for 2 main reasons:

+ *
    + *
  • the parameter is a column, but this column has not been successfully resolved. Thus its type is still unknown.
  • + *
  • the parameter is a UDF, but this UDF has not been already resolved. Thus, as for the column, its return type is still unknown. + * But it could be known later if the UDF is resolved later ; a second try should be done afterwards.
  • + *
+ * + * @param fct ADQL function whose the parameters' type should be checked. + * + * @return true if the type of all parameters is known, false otherwise. + * + * @since 1.3 + */ + protected final boolean isAllParamTypesResolved(final ADQLFunction fct){ + for(ADQLOperand op : fct.getParameters()){ + if (op.isGeometry() == op.isNumeric() && op.isNumeric() == op.isString()) + return false; + } + return true; + } + + /* ************************************************************************************************* */ + /* METHODS CHECKING THE GEOMETRIES (geometrical functions, coordinate systems and STC-S expressions) */ + /* ************************************************************************************************* */ + + /** + *

Check all geometries.

+ * + *

Operations done in this function:

+ *
    + *
  1. Check that all geometrical functions are supported
  2. + *
  3. Check that all explicit (string constant) coordinate system definitions are supported
  4. + *
  5. Check all STC-S expressions (only in {@link RegionFunction} for the moment) and + * Apply the 2 previous checks on them
  6. + *
+ * + * @param query Query in which geometries must be checked. + * @param errors List of errors to complete in this function each time a geometry item is not supported. + * + * @see #resolveGeometryFunctions(ADQLQuery, BinarySearch, UnresolvedIdentifiersException) + * @see #resolveCoordinateSystems(ADQLQuery, UnresolvedIdentifiersException) + * @see #resolveSTCSExpressions(ADQLQuery, BinarySearch, UnresolvedIdentifiersException) + * + * @since 1.3 + */ + protected void checkGeometries(final ADQLQuery query, final UnresolvedIdentifiersException errors){ + BinarySearch binSearch = new BinarySearch(){ + @Override + protected int compare(String searchItem, String arrayItem){ + return searchItem.compareToIgnoreCase(arrayItem); + } + }; + + // a. Ensure that all used geometry functions are allowed: + if (allowedGeo != null) + resolveGeometryFunctions(query, binSearch, errors); + + // b. Check whether the coordinate systems are allowed: + if (allowedCoordSys != null) + resolveCoordinateSystems(query, errors); + + // c. Check all STC-S expressions (in RegionFunctions only) + the used coordinate systems (if StringConstant only): + if (allowedGeo == null || (allowedGeo.length > 0 && binSearch.search("REGION", allowedGeo) >= 0)) + resolveSTCSExpressions(query, binSearch, errors); + } + + /** + * Search for all geometrical functions and check whether they are allowed. + * + * @param query Query in which geometrical functions must be checked. + * @param errors List of errors to complete in this function each time a geometrical function is not supported. + * + * @see #checkGeometryFunction(String, ADQLFunction, BinarySearch, UnresolvedIdentifiersException) + * + * @since 1.3 + */ + protected void resolveGeometryFunctions(final ADQLQuery query, final BinarySearch binSearch, final UnresolvedIdentifiersException errors){ + ISearchHandler sHandler = new SearchGeometryHandler(); + sHandler.search(query); + + String fctName; + for(ADQLObject result : sHandler){ + fctName = result.getName(); + checkGeometryFunction(fctName, (ADQLFunction)result, binSearch, errors); + } + } + + /** + *

Check whether the specified geometrical function is allowed by this implementation.

+ * + *

Note: + * If the list of allowed geometrical functions is empty, this function will always add an errors to the given list. + * Indeed, it means that no geometrical function is allowed and so that the specified function is automatically not supported. + *

+ * + * @param fctName Name of the geometrical function to test. + * @param fct The function instance being or containing the geometrical function to check. Note: this function can be the function to test or a function embedding the function under test (i.e. RegionFunction). + * @param binSearch The object to use in order to search a function name inside the list of allowed functions. + * It is able to perform a binary search inside a sorted array of String objects. The interest of + * this object is its compare function which must be overridden and tells how to compare the item + * to search and the items of the array (basically, a non-case-sensitive comparison between 2 strings). + * @param errors List of errors to complete in this function each time a geometrical function is not supported. + * + * @since 1.3 + */ + protected void checkGeometryFunction(final String fctName, final ADQLFunction fct, final BinarySearch binSearch, final UnresolvedIdentifiersException errors){ + int match = -1; + if (allowedGeo.length != 0) + match = binSearch.search(fctName, allowedGeo); + if (match < 0) + errors.addException(new UnresolvedFunctionException("The geometrical function \"" + fctName + "\" is not available in this implementation!", fct)); + } + + /** + *

Search all explicit coordinate system declarations, check their syntax and whether they are allowed by this implementation.

+ * + *

Note: + * "explicit" means here that all {@link StringConstant} instances. Only coordinate systems expressed as string can + * be parsed and so checked. So if a coordinate system is specified by a column, no check can be done at this stage... + * it will be possible to perform such test only at the execution. + *

+ * + * @param query Query in which coordinate systems must be checked. + * @param errors List of errors to complete in this function each time a coordinate system has a wrong syntax or is not supported. + * + * @see #checkCoordinateSystem(StringConstant, UnresolvedIdentifiersException) + * + * @since 1.3 + */ + protected void resolveCoordinateSystems(final ADQLQuery query, final UnresolvedIdentifiersException errors){ + ISearchHandler sHandler = new SearchCoordSysHandler(); + sHandler.search(query); + for(ADQLObject result : sHandler) + checkCoordinateSystem((StringConstant)result, errors); + } + + /** + * Parse and then check the coordinate system contained in the given {@link StringConstant} instance. + * + * @param adqlCoordSys The {@link StringConstant} object containing the coordinate system to check. + * @param errors List of errors to complete in this function each time a coordinate system has a wrong syntax or is not supported. + * + * @see STCS#parseCoordSys(String) + * @see #checkCoordinateSystem(adql.db.STCS.CoordSys, ADQLOperand, UnresolvedIdentifiersException) + * + * @since 1.3 + */ + protected void checkCoordinateSystem(final StringConstant adqlCoordSys, final UnresolvedIdentifiersException errors){ + String coordSysStr = adqlCoordSys.getValue(); + try{ + checkCoordinateSystem(STCS.parseCoordSys(coordSysStr), adqlCoordSys, errors); + }catch(ParseException pe){ + errors.addException(new ParseException(pe.getMessage(), adqlCoordSys.getPosition())); + } + } + + /** + * Check whether the given coordinate system is allowed by this implementation. + * + * @param coordSys Coordinate system to test. + * @param operand The operand representing or containing the coordinate system under test. + * @param errors List of errors to complete in this function each time a coordinate system is not supported. + * + * @since 1.3 + */ + protected void checkCoordinateSystem(final CoordSys coordSys, final ADQLOperand operand, final UnresolvedIdentifiersException errors){ + if (coordSysRegExp != null && coordSys != null && !coordSys.toFullSTCS().matches(coordSysRegExp)){ + StringBuffer buf = new StringBuffer(); + if (allowedCoordSys != null){ + for(String cs : allowedCoordSys){ + if (buf.length() > 0) + buf.append(", "); + buf.append(cs); + } + } + if (buf.length() == 0) + buf.append("No coordinate system is allowed!"); + else + buf.insert(0, "Allowed coordinate systems are: "); + errors.addException(new ParseException("Coordinate system \"" + ((operand instanceof StringConstant) ? ((StringConstant)operand).getValue() : coordSys.toString()) + "\" (= \"" + coordSys.toFullSTCS() + "\") not allowed in this implementation. " + buf.toString(), operand.getPosition())); + } + } + + /** + *

Search all STC-S expressions inside the given query, parse them (and so check their syntax) and then determine + * whether the declared coordinate system and the expressed region are allowed in this implementation.

+ * + *

Note: + * In the current ADQL language definition, STC-S expressions can be found only as only parameter of the REGION function. + *

+ * + * @param query Query in which STC-S expressions must be checked. + * @param binSearch The object to use in order to search a region name inside the list of allowed functions/regions. + * It is able to perform a binary search inside a sorted array of String objects. The interest of + * this object is its compare function which must be overridden and tells how to compare the item + * to search and the items of the array (basically, a non-case-sensitive comparison between 2 strings). + * @param errors List of errors to complete in this function each time the STC-S syntax is wrong or each time the declared coordinate system or region is not supported. + * + * @see STCS#parseRegion(String) + * @see #checkRegion(adql.db.STCS.Region, RegionFunction, BinarySearch, UnresolvedIdentifiersException) + * + * @since 1.3 + */ + protected void resolveSTCSExpressions(final ADQLQuery query, final BinarySearch binSearch, final UnresolvedIdentifiersException errors){ + // Search REGION functions: + ISearchHandler sHandler = new SearchRegionHandler(); + sHandler.search(query); + + // Parse and check their STC-S expression: + String stcs; + Region region; + for(ADQLObject result : sHandler){ + try{ + // get the STC-S expression: + stcs = ((StringConstant)((RegionFunction)result).getParameter(0)).getValue(); + + // parse the STC-S expression (and so check the syntax): + region = STCS.parseRegion(stcs); + + // check whether the regions (this one + the possible inner ones) and the coordinate systems are allowed: + checkRegion(region, (RegionFunction)result, binSearch, errors); + }catch(ParseException pe){ + errors.addException(new ParseException(pe.getMessage(), result.getPosition())); + } + } + } + + /** + *

Check the given region.

+ * + *

The following points are checked in this function:

+ *
    + *
  • whether the coordinate system is allowed
  • + *
  • whether the type of region is allowed
  • + *
  • whether the inner regions are correct (here this function is called recursively on each inner region).
  • + *
+ * + * @param r The region to check. + * @param fct The REGION function containing the region to check. + * @param errors List of errors to complete in this function if the given region or its inner regions are not supported. + * + * @see #checkCoordinateSystem(adql.db.STCS.CoordSys, ADQLOperand, UnresolvedIdentifiersException) + * @see #checkGeometryFunction(String, ADQLFunction, BinarySearch, UnresolvedIdentifiersException) + * @see #checkRegion(adql.db.STCS.Region, RegionFunction, BinarySearch, UnresolvedIdentifiersException) + * + * @since 1.3 + */ + protected void checkRegion(final Region r, final RegionFunction fct, final BinarySearch binSearch, final UnresolvedIdentifiersException errors){ + if (r == null) + return; + + // Check the coordinate system (if any): + if (r.coordSys != null) + checkCoordinateSystem(r.coordSys, fct, errors); + + // Check that the region type is allowed: + if (allowedGeo != null){ + if (allowedGeo.length == 0) + errors.addException(new UnresolvedFunctionException("The region type \"" + r.type + "\" is not available in this implementation!", fct)); + else + checkGeometryFunction((r.type == RegionType.POSITION) ? "POINT" : r.type.toString(), fct, binSearch, errors); + } + + // Check all the inner regions: + if (r.regions != null){ + for(Region innerR : r.regions) + checkRegion(innerR, fct, binSearch, errors); + } + } + + /* **************************************************** */ + /* METHODS CHECKING TYPES UNKNOWN WHILE CHECKING SYNTAX */ + /* **************************************************** */ + + /** + *

Search all operands whose the type is not yet known and try to resolve it now + * and to check whether it matches the type expected by the syntactic parser.

+ * + *

+ * Only two operands may have an unresolved type: columns and user defined functions. + * Indeed, their type can be resolved only if the list of available columns and UDFs is known, + * and if columns and UDFs used in the query are resolved successfully. + *

+ * + *

+ * When an operand type is still unknown, they will own the three kinds of type and + * so this function won't raise an error: it is thus automatically on the expected type. + * This behavior is perfectly correct because if the type is not resolved + * that means the item/operand has not been resolved in the previous steps and so that + * an error about this item has already been raised. + *

+ * + *

Important note: + * This function does not check the types exactly, but just roughly by considering only three categories: + * string, numeric and geometry. + *

+ * + * @param query Query in which unknown types must be resolved and checked. + * @param errors List of errors to complete in this function each time a types does not match to the expected one. + * + * @see UnknownType + * + * @since 1.3 + */ + protected void checkTypes(final ADQLQuery query, final UnresolvedIdentifiersException errors){ + // Search all unknown types: + ISearchHandler sHandler = new SearchUnknownTypeHandler(); + sHandler.search(query); + + // Check whether their type matches the expected one: + UnknownType unknown; + for(ADQLObject result : sHandler){ + unknown = (UnknownType)result; + switch(unknown.getExpectedType()){ + case 'G': + case 'g': + if (!unknown.isGeometry()) + errors.addException(new ParseException("Type mismatch! A geometry was expected instead of \"" + unknown.toADQL() + "\".", result.getPosition())); + break; + case 'N': + case 'n': + if (!unknown.isNumeric()) + errors.addException(new ParseException("Type mismatch! A numeric value was expected instead of \"" + unknown.toADQL() + "\".", result.getPosition())); + break; + case 'S': + case 's': + if (!unknown.isString()) + errors.addException(new ParseException("Type mismatch! A string value was expected instead of \"" + unknown.toADQL() + "\".", result.getPosition())); + break; + } + } + } + + /* ******************************** */ + /* METHODS CHECKING THE SUB-QUERIES */ + /* ******************************** */ + + /** + *

Search all sub-queries found in the given query but not in the clause FROM. + * These sub-queries are then checked using {@link #check(ADQLQuery, Stack)}.

+ * + * Fathers stack + *

+ * Each time a sub-query must be checked with {@link #check(ADQLQuery, Stack)}, + * the list of all columns available in each of its father queries must be provided. + * This function is composing itself this stack by adding the given list of available + * columns (= all columns resolved in the given query) at the end of the given stack. + * If this stack is given empty, then a new stack is created. + *

+ *

+ * This modification of the given stack is just the execution time of this function. + * Before returning, this function removes the last item of the stack. + *

+ * + * + * @param query Query in which sub-queries must be checked. + * @param fathersList List of all columns available in the father queries and that should be accessed in sub-queries. + * Each item of this stack is a list of columns available in each father-level query. + * Note: this parameter is NULL if this function is called with the root/father query as parameter. + * @param availableColumns List of all columns resolved in the given query. + * @param errors List of errors to complete in this function each time a semantic error is encountered. + * + * @since 1.3 + */ + protected void checkSubQueries(final ADQLQuery query, Stack fathersList, final SearchColumnList availableColumns, final UnresolvedIdentifiersException errors){ + // Check sub-queries outside the clause FROM: + ISearchHandler sHandler = new SearchSubQueryHandler(); + sHandler.search(query); + if (sHandler.getNbMatch() > 0){ + + // Push the list of columns into the father columns stack: + if (fathersList == null) + fathersList = new Stack(); + fathersList.push(availableColumns); + + // Check each found sub-query: + for(ADQLObject result : sHandler){ + try{ + check((ADQLQuery)result, fathersList); + }catch(UnresolvedIdentifiersException uie){ + Iterator itPe = uie.getErrors(); + while(itPe.hasNext()) + errors.addException(itPe.next()); + } + } + + // Pop the list of columns from the father columns stack: + fathersList.pop(); + } + } + + /* *************** */ + /* SEARCH HANDLERS */ + /* *************** */ + /** + * Lets searching all tables. + * + * @author Grégory Mantelet (CDS) + * @version 1.0 (07/2011) + */ + private static class SearchTableHandler extends SimpleSearchHandler { + @Override + public boolean match(final ADQLObject obj){ + return obj instanceof ADQLTable; + } + } + + /** + * Lets searching all wildcards. + * + * @author Grégory Mantelet (CDS) + * @version 1.0 (09/2011) + */ + private static class SearchWildCardHandler extends SimpleSearchHandler { + @Override + public boolean match(final ADQLObject obj){ + return (obj instanceof SelectAllColumns) && (((SelectAllColumns)obj).getAdqlTable() != null); + } + } + + /** + * Lets searching column references. + * + * @author Grégory Mantelet (CDS) + * @version 1.0 (11/2011) + */ + private static class SearchColReferenceHandler extends SimpleSearchHandler { + @Override + public boolean match(final ADQLObject obj){ + return (obj instanceof ColumnReference); + } + } + + /** + *

Lets searching subqueries in every clause except the FROM one (hence the modification of the {@link #goInto(ADQLObject)}.

+ * + *

+ * Note: The function {@link #addMatch(ADQLObject, ADQLIterator)} has been modified in order to + * not have the root search object (here: the main query) in the list of results. + *

+ * + * @author Grégory Mantelet (ARI) + * @version 1.2 (12/2013) + * @since 1.2 + */ + private static class SearchSubQueryHandler extends SimpleSearchHandler { + @Override + protected void addMatch(ADQLObject matchObj, ADQLIterator it){ + if (it != null) + super.addMatch(matchObj, it); + } + + @Override + protected boolean goInto(ADQLObject obj){ + return super.goInto(obj) && !(obj instanceof FromContent); + } + + @Override + protected boolean match(ADQLObject obj){ + return (obj instanceof ADQLQuery); + } + } + + /** + * Let searching user defined functions. + * + * @author Grégory Mantelet (ARI) + * @version 1.3 (10/2014) + * @since 1.3 + */ + private static class SearchUDFHandler extends SimpleSearchHandler { + @Override + protected boolean match(ADQLObject obj){ + return (obj instanceof UserDefinedFunction); + } + } + + /** + *

Let replacing every {@link DefaultUDF}s whose a {@link FunctionDef} is set by their corresponding {@link UserDefinedFunction} class.

+ * + *

Important note: + * If the replacer can not be created using the class returned by {@link FunctionDef#getUDFClass()}, no replacement is performed. + *

+ * + * @author Grégory Mantelet (ARI) + * @version 1.3 (02/2015) + * @since 1.3 + */ + private static class ReplaceDefaultUDFHandler extends SimpleReplaceHandler { + private final UnresolvedIdentifiersException errors; + + public ReplaceDefaultUDFHandler(final UnresolvedIdentifiersException errorsContainer){ + errors = errorsContainer; + } + + @Override + protected boolean match(ADQLObject obj){ + return (obj.getClass().getName().equals(DefaultUDF.class.getName())) && (((DefaultUDF)obj).getDefinition() != null) && (((DefaultUDF)obj).getDefinition().getUDFClass() != null); + /* Note: detection of DefaultUDF is done on the exact class name rather than using "instanceof" in order to have only direct instances of DefaultUDF, + * and not extensions of it. Indeed, DefaultUDFs are generally created automatically by the ADQLQueryFactory ; so, extensions of it can only be custom + * UserDefinedFunctions. */ + } + + @Override + protected ADQLObject getReplacer(ADQLObject objToReplace) throws UnsupportedOperationException{ + try{ + // get the associated UDF class: + Class udfClass = ((DefaultUDF)objToReplace).getDefinition().getUDFClass(); + // get the constructor with a single parameter of type ADQLOperand[]: + Constructor constructor = udfClass.getConstructor(ADQLOperand[].class); + // create a new instance of this UDF class with the operands stored in the object to replace: + return constructor.newInstance((Object)(((DefaultUDF)objToReplace).getParameters())); /* note: without this class, each item of the given array will be considered as a single parameter. */ + }catch(Exception ex){ + // IF NO INSTANCE CAN BE CREATED... + // ...keep the error for further report: + errors.addException(new UnresolvedFunctionException("Impossible to represent the function \"" + ((DefaultUDF)objToReplace).getName() + "\": the following error occured while creating this representation: \"" + ((ex instanceof InvocationTargetException) ? "[" + ex.getCause().getClass().getSimpleName() + "] " + ex.getCause().getMessage() : ex.getMessage()) + "\"", (DefaultUDF)objToReplace)); + // ...keep the same object (i.e. no replacement): + return objToReplace; + } + } + } + + /** + * Let searching geometrical functions. + * + * @author Grégory Mantelet (ARI) + * @version 1.3 (10/2014) + * @since 1.3 + */ + private static class SearchGeometryHandler extends SimpleSearchHandler { + @Override + protected boolean match(ADQLObject obj){ + return (obj instanceof GeometryFunction); + } + } + + /** + *

Let searching all ADQL objects whose the type was not known while checking the syntax of the ADQL query. + * These objects are {@link ADQLColumn}s and {@link UserDefinedFunction}s.

+ * + *

Important note: + * Only {@link UnknownType} instances having an expected type equals to 'S' (or 's' ; for string) or 'N' (or 'n' ; for numeric) + * are kept by this handler. Others are ignored. + *

+ * + * @author Grégory Mantelet (ARI) + * @version 1.3 (10/2014) + * @since 1.3 + */ + private static class SearchUnknownTypeHandler extends SimpleSearchHandler { + @Override + protected boolean match(ADQLObject obj){ + if (obj instanceof UnknownType){ + char expected = ((UnknownType)obj).getExpectedType(); + return (expected == 'G' || expected == 'g' || expected == 'S' || expected == 's' || expected == 'N' || expected == 'n'); + }else + return false; + } + } + + /** + * Let searching all explicit declaration of coordinate systems. + * So, only {@link StringConstant} objects will be returned. + * + * @author Grégory Mantelet (ARI) + * @version 1.3 (10/2014) + * @since 1.3 + */ + private static class SearchCoordSysHandler extends SimpleSearchHandler { + @Override + protected boolean match(ADQLObject obj){ + if (obj instanceof PointFunction || obj instanceof BoxFunction || obj instanceof CircleFunction || obj instanceof PolygonFunction) + return (((GeometryFunction)obj).getCoordinateSystem() instanceof StringConstant); + else + return false; + } + + @Override + protected void addMatch(ADQLObject matchObj, ADQLIterator it){ + results.add(((GeometryFunction)matchObj).getCoordinateSystem()); + } + + } + + /** + * Let searching all {@link RegionFunction}s. + * + * @author Grégory Mantelet (ARI) + * @version 1.3 (10/2014) + * @since 1.3 + */ + private static class SearchRegionHandler extends SimpleSearchHandler { + @Override + protected boolean match(ADQLObject obj){ + if (obj instanceof RegionFunction) + return (((RegionFunction)obj).getParameter(0) instanceof StringConstant); + else + return false; + } + + } + + /** + *

Implement the binary search algorithm over a sorted array.

+ * + *

+ * The only difference with the standard implementation of Java is + * that this object lets perform research with a different type + * of object than the types of array items. + *

+ * + *

+ * For that reason, the "compare" function must always be implemented. + *

+ * + * @author Grégory Mantelet (ARI) + * @version 1.3 (10/2014) + * + * @param Type of items stored in the array. + * @param Type of the item to search. + * + * @since 1.3 + */ + protected static abstract class BinarySearch< T, S > { + private int s, e, m, comp; + + /** + *

Search the given item in the given array.

+ * + *

+ * In case the given object matches to several items of the array, + * this function will return the smallest index, pointing thus to the first + * of all matches. + *

+ * + * @param searchItem Object for which a corresponding array item must be searched. + * @param array Array in which the given object must be searched. + * + * @return The array index of the first item of all matches. + */ + public int search(final S searchItem, final T[] array){ + s = 0; + e = array.length - 1; + while(s < e){ + // middle of the sorted array: + m = s + ((e - s) / 2); + // compare the fct with the middle item of the array: + comp = compare(searchItem, array[m]); + // if the fct is after, trigger the inspection of the right part of the array: + if (comp > 0) + s = m + 1; + // otherwise, the left part: + else + e = m; + } + if (s != e || compare(searchItem, array[s]) != 0) + return -1; + else + return s; + } + + /** + * Compare the search item and the array item. + * + * @param searchItem Item whose a corresponding value must be found in the array. + * @param arrayItem An item of the array. + * + * @return Negative value if searchItem is less than arrayItem, 0 if they are equals, or a positive value if searchItem is greater. + */ + protected abstract int compare(final S searchItem, final T arrayItem); + } + +} diff --git a/src/adql/parser/ADQLParser.java b/src/adql/parser/ADQLParser.java index 48614bf1..2e008ef8 100644 --- a/src/adql/parser/ADQLParser.java +++ b/src/adql/parser/ADQLParser.java @@ -1,57 +1,37 @@ /* Generated By:JavaCC: Do not edit this line. ADQLParser.java */ package adql.parser; -import java.io.IOException; -import java.util.ArrayList; import java.util.Stack; import java.util.Vector; +import java.util.ArrayList; +import java.util.Collection; + +import java.io.FileReader; +import java.io.IOException; import adql.db.exception.UnresolvedIdentifiersException; -import adql.parser.ADQLQueryFactory.JoinType; + import adql.parser.IdentifierItems.IdentifierItem; -import adql.query.ADQLOrder; -import adql.query.ADQLQuery; -import adql.query.ClauseADQL; -import adql.query.ClauseConstraints; -import adql.query.ClauseSelect; -import adql.query.SelectAllColumns; -import adql.query.SelectItem; -import adql.query.TextPosition; -import adql.query.constraint.ADQLConstraint; -import adql.query.constraint.Between; -import adql.query.constraint.Comparison; -import adql.query.constraint.ComparisonOperator; -import adql.query.constraint.ConstraintsGroup; -import adql.query.constraint.Exists; -import adql.query.constraint.In; -import adql.query.constraint.IsNull; -import adql.query.constraint.NotConstraint; -import adql.query.from.ADQLJoin; -import adql.query.from.FromContent; -import adql.query.operand.ADQLColumn; -import adql.query.operand.ADQLOperand; -import adql.query.operand.Concatenation; -import adql.query.operand.NegativeOperand; -import adql.query.operand.NumericConstant; -import adql.query.operand.Operation; -import adql.query.operand.OperationType; -import adql.query.operand.StringConstant; -import adql.query.operand.WrappedOperand; -import adql.query.operand.function.ADQLFunction; -import adql.query.operand.function.MathFunction; -import adql.query.operand.function.MathFunctionType; -import adql.query.operand.function.SQLFunction; -import adql.query.operand.function.SQLFunctionType; -import adql.query.operand.function.UserDefinedFunction; -import adql.query.operand.function.geometry.GeometryFunction; + +import adql.parser.ADQLQueryFactory.JoinType; + +import adql.query.*; +import adql.query.from.*; +import adql.query.constraint.*; + +import adql.query.operand.*; + +import adql.query.operand.function.*; + +import adql.query.operand.function.geometry.*; import adql.query.operand.function.geometry.GeometryFunction.GeometryValue; -import adql.query.operand.function.geometry.PointFunction; + import adql.translator.PostgreSQLTranslator; import adql.translator.TranslationException; /** * Parses an ADQL query thanks to the {@link ADQLParser#Query()} function. -* +* *

* This parser is able, thanks to a {@link QueryChecker} object, to check each * {@link ADQLQuery} just after its generation. It could be used to check the @@ -60,7 +40,7 @@ * you must extend {@link QueryChecker} to check semantically all generated * ADQLQuery objects. *

-* +* *

* To create an object representation of the given ADQL query, this parser uses * a {@link ADQLQueryFactory} object. So if you want customize some object @@ -79,7 +59,7 @@ * issues with ADQL queries (e.g. Unicode confusable characters, * unescaped ADQL identifiers, SQL reserved keywords, ...) * -* +* *

WARNING: * To modify this class it's strongly encouraged to modify the .jj file in the * section between PARSER_BEGIN and PARSER_END and to re-compile @@ -94,33 +74,33 @@ */ public class ADQLParser implements ADQLParserConstants { - /** Tools to build the object representation of the ADQL query. */ - private ADQLQueryFactory queryFactory = new ADQLQueryFactory(); + /** Tools to build the object representation of the ADQL query. */ + private ADQLQueryFactory queryFactory = new ADQLQueryFactory(); - /** The stack of queries (because there may be some sub-queries). */ - private Stack stackQuery = new Stack(); + /** The stack of queries (because there may be some sub-queries). */ + private Stack stackQuery = new Stack(); - /** The object representation of the ADQL query to parse. - * (ONLY USED DURING THE PARSING, else it is always null). */ - private ADQLQuery query = null; + /** The object representation of the ADQL query to parse. + * (ONLY USED DURING THE PARSING, else it is always null). */ + private ADQLQuery query = null; - /** Checks each {@link ADQLQuery} (sub-query or not) just after their - * generation. */ - private QueryChecker queryChecker = null; + /** Checks each {@link ADQLQuery} (sub-query or not) just after their + * generation. */ + private QueryChecker queryChecker = null; - /** The first token of a table/column name. This token is extracted by - * {@link #Identifier()}. */ - private Token currentIdentifierToken = null; + /** The first token of a table/column name. This token is extracted by + * {@link #Identifier()}. */ + private Token currentIdentifierToken = null; - /** + /** * Builds an ADQL parser without a query to parse. */ - public ADQLParser() { - this(new java.io.ByteArrayInputStream("".getBytes())); - setDebug(false); - } + public ADQLParser(){ + this(new java.io.ByteArrayInputStream("".getBytes())); + setDebug(false); + } - /** + /** * Builds an ADQL parser without a query to parse but with a * {@link QueryChecker} and a {@link ADQLQueryFactory}. * @@ -128,37 +108,37 @@ public ADQLParser() { * @param factory The object to use to build an object representation of * the given ADQL query. */ - public ADQLParser(QueryChecker checker, ADQLQueryFactory factory) { - this(); + public ADQLParser(QueryChecker checker, ADQLQueryFactory factory) { + this(); - queryChecker = checker; + queryChecker = checker; - if (factory != null) - queryFactory = factory; - } + if (factory != null) + queryFactory = factory; + } - /** + /** * Builds an ADQL parser without a query to parse but with a * {@link QueryChecker}. * * @param checker The object to use to check each {@link ADQLQuery}. */ - public ADQLParser(QueryChecker checker) { - this(checker, null); - } + public ADQLParser(QueryChecker checker) { + this(checker, null); + } - /** + /** * Builds an ADQL parser without a query to parse but with a * {@link ADQLQueryFactory}. * * @param factory The object to use to build an object representation of * the given ADQL query. */ - public ADQLParser(ADQLQueryFactory factory) { - this((QueryChecker)null, factory); - } + public ADQLParser(ADQLQueryFactory factory) { + this((QueryChecker)null, factory); + } - /** + /** * Builds a parser with a stream containing the query to parse. * * @param stream The stream in which the ADQL query to parse is given. @@ -166,40 +146,40 @@ public ADQLParser(ADQLQueryFactory factory) { * @param factory The object to use to build an object representation of * the given ADQL query. */ - public ADQLParser(java.io.InputStream stream, QueryChecker checker, ADQLQueryFactory factory) { - this(stream); - setDebug(false); + public ADQLParser(java.io.InputStream stream, QueryChecker checker, ADQLQueryFactory factory) { + this(stream); + setDebug(false); - setDebug(false); + setDebug(false); - queryChecker = checker; + queryChecker = checker; - if (factory != null) - queryFactory = factory; - } + if (factory != null) + queryFactory = factory; + } - /** + /** * Builds a parser with a stream containing the query to parse. * * @param stream The stream in which the ADQL query to parse is given. * @param checker The object to use to check each {@link ADQLQuery}. */ - public ADQLParser(java.io.InputStream stream, QueryChecker checker) { - this(stream, checker, null); - } + public ADQLParser(java.io.InputStream stream, QueryChecker checker) { + this(stream, checker, null); + } - /** + /** * Builds a parser with a stream containing the query to parse. * * @param stream The stream in which the ADQL query to parse is given. * @param factory The object to use to build an object representation of * the given ADQL query. */ - public ADQLParser(java.io.InputStream stream, ADQLQueryFactory factory) { - this(stream, (QueryChecker)null, factory); - } + public ADQLParser(java.io.InputStream stream, ADQLQueryFactory factory) { + this(stream, (QueryChecker)null, factory); + } - /** + /** * Builds a parser with a stream containing the query to parse. * * @param stream The stream in which the ADQL query to parse is given. @@ -208,28 +188,28 @@ public ADQLParser(java.io.InputStream stream, ADQLQueryFactory factory) { * @param factory The object to use to build an object representation * of the given ADQL query. */ - public ADQLParser(java.io.InputStream stream, String encoding, QueryChecker checker, ADQLQueryFactory factory) { - this(stream, encoding); - setDebug(false); + public ADQLParser(java.io.InputStream stream, String encoding, QueryChecker checker, ADQLQueryFactory factory) { + this(stream, encoding); + setDebug(false); - queryChecker = checker; + queryChecker = checker; - if (factory != null) - queryFactory = factory; - } + if (factory != null) + queryFactory = factory; + } - /** + /** * Builds a parser with a stream containing the query to parse. * * @param stream The stream in which the ADQL query to parse is given. * @param encoding The supplied encoding. * @param checker The object to use to check each {@link ADQLQuery}. */ - public ADQLParser(java.io.InputStream stream, String encoding, QueryChecker checker) { - this(stream, encoding, checker, null); - } + public ADQLParser(java.io.InputStream stream, String encoding, QueryChecker checker) { + this(stream, encoding, checker, null); + } - /** + /** * Builds a parser with a stream containing the query to parse. * * @param stream The stream in which the ADQL query to parse is given. @@ -237,11 +217,11 @@ public ADQLParser(java.io.InputStream stream, String encoding, QueryChecker chec * @param factory The object to use to build an object representation * of the given ADQL query. */ - public ADQLParser(java.io.InputStream stream, String encoding, ADQLQueryFactory factory) { - this(stream, encoding, null, factory); - } + public ADQLParser(java.io.InputStream stream, String encoding, ADQLQueryFactory factory) { + this(stream, encoding, null, factory); + } - /** + /** * Builds a parser with a reader containing the query to parse. * * @param reader The reader in which the ADQL query to parse is given. @@ -249,40 +229,40 @@ public ADQLParser(java.io.InputStream stream, String encoding, ADQLQueryFactory * @param factory The object to use to build an object representation * of the given ADQL query. */ - public ADQLParser(java.io.Reader reader, QueryChecker checker, ADQLQueryFactory factory) { - this(reader); - setDebug(false); + public ADQLParser(java.io.Reader reader, QueryChecker checker, ADQLQueryFactory factory) { + this(reader); + setDebug(false); - setDebug(false); + setDebug(false); - queryChecker = checker; + queryChecker = checker; - if (factory != null) - queryFactory = factory; - } + if (factory != null) + queryFactory = factory; + } - /** + /** * Builds a parser with a reader containing the query to parse. * * @param reader The reader in which the ADQL query to parse is given. * @param checker The object to use to check each {@link ADQLQuery}. */ - public ADQLParser(java.io.Reader reader, QueryChecker checker) { - this(reader, checker, null); - } + public ADQLParser(java.io.Reader reader, QueryChecker checker) { + this(reader, checker, null); + } - /** + /** * Builds a parser with a reader containing the query to parse. * * @param reader The reader in which the ADQL query to parse is given. * @param factory The object to use to build an object representation * of the given ADQL query. */ - public ADQLParser(java.io.Reader reader, ADQLQueryFactory factory) { - this(reader, null, factory); - } + public ADQLParser(java.io.Reader reader, ADQLQueryFactory factory) { + this(reader, null, factory); + } - /** + /** * Builds a parser with another token manager. * * @param tm The manager which associates a token to a numeric code. @@ -290,6189 +270,5301 @@ public ADQLParser(java.io.Reader reader, ADQLQueryFactory factory) { * @param factory The object to use to build an object representation * of the given ADQL query. */ - public ADQLParser(ADQLParserTokenManager tm, QueryChecker checker, ADQLQueryFactory factory) { - this(tm); - setDebug(false); + public ADQLParser(ADQLParserTokenManager tm, QueryChecker checker, ADQLQueryFactory factory) { + this(tm); + setDebug(false); - setDebug(false); + setDebug(false); - queryChecker = checker; + queryChecker = checker; - if (factory != null) - queryFactory = factory; - } + if (factory != null) + queryFactory = factory; + } - /** + /** * Builds a parser with another token manager. * * @param tm The manager which associates a token to a numeric code. * @param checker The object to use to check each {@link ADQLQuery}. */ - public ADQLParser(ADQLParserTokenManager tm, QueryChecker checker) { - this(tm, checker, null); - } + public ADQLParser(ADQLParserTokenManager tm, QueryChecker checker) { + this(tm, checker, null); + } - /** + /** * Builds a parser with another token manager. * * @param tm The manager which associates a token to a numeric code. * @param factory The object to use to build an object representation of * the given ADQL query. */ - public ADQLParser(ADQLParserTokenManager tm, ADQLQueryFactory factory) { - this(tm, null, factory); - } - - /* ADDITIONAL GETTERS & SETTERS */ - - public final void setDebug(boolean debug) { - if (debug) - enable_tracing(); - else - disable_tracing(); - } - - public final QueryChecker getQueryChecker() { - return queryChecker; - } - - public final void setQueryChecker(QueryChecker checker) { - queryChecker = checker; - } - - public final ADQLQueryFactory getQueryFactory() { - return queryFactory; - } - - public final void setQueryFactory(ADQLQueryFactory factory) { - queryFactory = (factory != null) ? factory : (new ADQLQueryFactory()); - } - - /* EXCEPTION HELPER FUNCTION */ - - private final ParseException generateParseException(Exception ex) { - if (!(ex instanceof ParseException)) { - ParseException pex = new ParseException("[" + ex.getClass().getName() + "] " + ex.getMessage()); - pex.setStackTrace(ex.getStackTrace()); - return pex; - } else - return (ParseException)ex; - } - - /* QUERY PARSING FUNCTIONS */ - - /** - * Tell whether the given string is a valid ADQL regular identifier. - * - *

- * According to the ADQL-2.0's BNF, a regular identifier (i.e. not delimited - * ; not between double quotes) must be a letter followed by a letter, digit - * or underscore. So, the following regular expression: - *

- *
[a-zA-Z]+[a-zA-Z0-9_]*
- * - *

This is what this function tests on the given string.

- * - * @param idCandidate The string to test. - * - * @return true if the given string is a valid regular - * identifier, - * false otherwise. - * - * @see #testRegularIdentifier(adql.parser.Token) - * - * @since 1.5 - */ - public final boolean isRegularIdentifier(final String idCandidate) { - return idCandidate.matches("[a-zA-Z]+[a-zA-Z0-9_]*"); - } - - /** - * Test the given token as an ADQL's regular identifier. - * - *

- * This function uses {@link #isRegularIdentifier(java.lang.String)} to - * test the given token's image. If the test fails, a - * {@link adql.parser.ParseException} is thrown. - *

- * - * @param token The token to test. - * - * @throws ParseException If the given token is not a valid ADQL regular - * identifier. - * - * @see #isRegularIdentifier(java.lang.String) - * - * @since 1.5 - */ - public final void testRegularIdentifier(final Token token) throws ParseException { - if (!isRegularIdentifier(token.image)) - throw new ParseException("Invalid ADQL regular identifier: \u005c"" + token.image + "\u005c"! If it aims to be a column/table name/alias, you should write it between double quotes.", new TextPosition(token)); - } + public ADQLParser(ADQLParserTokenManager tm, ADQLQueryFactory factory) { + this(tm, null, factory); + } + + /* ADDITIONAL GETTERS & SETTERS */ + + public final void setDebug(boolean debug){ + if (debug) enable_tracing(); + else disable_tracing(); + } + + public final QueryChecker getQueryChecker(){ + return queryChecker; + } + + public final void setQueryChecker(QueryChecker checker){ + queryChecker = checker; + } + + public final ADQLQueryFactory getQueryFactory(){ + return queryFactory; + } + + public final void setQueryFactory(ADQLQueryFactory factory){ + queryFactory = (factory!=null)?factory:(new ADQLQueryFactory()); + } + + /* EXCEPTION HELPER FUNCTION */ + + private final ParseException generateParseException(Exception ex){ + if (!(ex instanceof ParseException)){ + ParseException pex = new ParseException("["+ex.getClass().getName()+"] "+ex.getMessage()); + pex.setStackTrace(ex.getStackTrace()); + return pex; + }else + return (ParseException)ex; + } + + /* QUERY PARSING FUNCTIONS */ + + /** + * Tell whether the given string is a valid ADQL regular identifier. + * + *

+ * According to the ADQL-2.0's BNF, a regular identifier (i.e. not delimited + * ; not between double quotes) must be a letter followed by a letter, digit + * or underscore. So, the following regular expression: + *

+ *
[a-zA-Z]+[a-zA-Z0-9_]*
+ * + *

This is what this function tests on the given string.

+ * + * @param idCandidate The string to test. + * + * @return true if the given string is a valid regular + * identifier, + * false otherwise. + * + * @see #testRegularIdentifier(adql.parser.Token) + * + * @since 1.5 + */ + public final boolean isRegularIdentifier(final String idCandidate) { + return idCandidate.matches("[a-zA-Z]+[a-zA-Z0-9_]*"); + } + + /** + * Test the given token as an ADQL's regular identifier. + * + *

+ * This function uses {@link #isRegularIdentifier(java.lang.String)} to + * test the given token's image. If the test fails, a + * {@link adql.parser.ParseException} is thrown. + *

+ * + * @param token The token to test. + * + * @throws ParseException If the given token is not a valid ADQL regular + * identifier. + * + * @see #isRegularIdentifier(java.lang.String) + * + * @since 1.5 + */ + public final void testRegularIdentifier(final Token token) throws ParseException { + if (!isRegularIdentifier(token.image)) + throw new ParseException("Invalid ADQL regular identifier: \u005c""+token.image+"\u005c"! If it aims to be a column/table name/alias, you should write it between double quotes.", new TextPosition(token)); + } - /** + /** * Parses the query given at the creation of this parser or in the * ReInit functions. * * @return The object representation of the given ADQL query. - * + * * @throws ParseException If there is at least one syntactic error. * * @see ADQLParser#Query() */ - public final ADQLQuery parseQuery() throws ParseException { - stackQuery.clear(); - query = null; - try { - return Query(); - } catch(TokenMgrError tme) { - throw new ParseException(tme); - } - } - - /** + public final ADQLQuery parseQuery() throws ParseException { + stackQuery.clear(); + query = null; + try { + return Query(); + }catch(TokenMgrError tme) { + throw new ParseException(tme); + } + } + + /** * Parses the query given in parameter. * * @param q The ADQL query to parse. - * + * * @return The object representation of the given ADQL query. - * + * * @throws ParseException If there is at least one syntactic error. * * @see ADQLParser#ReInit(java.io.InputStream) * @see ADQLParser#setDebug(boolean) * @see ADQLParser#Query() */ - public final ADQLQuery parseQuery(String q) throws ParseException { - stackQuery.clear(); - query = null; - ReInit(new java.io.ByteArrayInputStream(q.getBytes())); - try { - return Query(); - } catch(TokenMgrError tme) { - throw new ParseException(tme); - } - } - - /** + public final ADQLQuery parseQuery(String q) throws ParseException { + stackQuery.clear(); + query = null; + ReInit(new java.io.ByteArrayInputStream(q.getBytes())); + try { + return Query(); + }catch(TokenMgrError tme) { + throw new ParseException(tme); + } + } + + /** * Parses the query contained in the stream given in parameter. * * @param stream The stream which contains the ADQL query to parse. - * + * * @return The object representation of the given ADQL query. - * + * * @throws ParseException If there is at least one syntactic error. * * @see ADQLParser#ReInit(java.io.InputStream) * @see ADQLParser#setDebug(boolean) * @see ADQLParser#Query() */ - public final ADQLQuery parseQuery(java.io.InputStream stream) throws ParseException { - stackQuery.clear(); - query = null; - ReInit(stream); - try { - return Query(); - } catch(TokenMgrError tme) { - throw new ParseException(tme); - } - } - - /* CORRECTION SUGGESTION */ - - /** - * Try fixing tokens/terms of the input ADQL query. - * - *

- * This function does not try to fix syntactical or semantical errors. - * It just try to fix the most common issues in ADQL queries, such as: - *

- *
    - *
  • some Unicode characters confusable with ASCII characters (like a - * space, a dash, ...) ; this function replace them by their ASCII - * alternative,
  • - *
  • any of the following are double quoted: - *
      - *
    • non regular ADQL identifiers - * (e.g. _RAJ2000),
    • - *
    • ADQL function names used as identifiers - * (e.g. distance)
    • - *
    • and SQL reserved keywords - * (e.g. public).
    • - *
    - *
  • - *
- * - *

Note 1: - * The given stream is NOT closed by this function even if the EOF is - * reached. It is the responsibility of the caller to close it. - *

- * - *

Note 2: - * This function does not use any instance variable of this parser - * (especially the InputStream or Reader provided at initialisation or - * ReInit). - *

- * - * @param input Stream containing the input ADQL query to fix. - * - * @return The suggested correction of the input ADQL query. - * - * @throws java.io.IOException If there is any error while reading from the - * given input stream. - * @throws ParseException If any unrecognised character is encountered, - * or if anything else prevented the tokenization - * of some characters/words/terms. - * - * @see #tryQuickFix(java.lang.String) - * - * @since 1.5 - */ - public final String tryQuickFix(final java.io.InputStream input) throws java.io.IOException, ParseException { - // Fetch everything into a single string: - StringBuffer buf = new StringBuffer(); - byte[] cBuf = new byte[1024]; - int nbChar; - while((nbChar = input.read(cBuf)) > -1) { - buf.append(new String(cBuf, 0, nbChar)); - } - - // Convert the buffer into a String and now try to fix it: - return tryQuickFix(buf.toString()); - } - - /** - * Try fixing tokens/terms of the given ADQL query. - * - *

- * This function does not try to fix syntactical or semantical errors. - * It just try to fix the most common issues in ADQL queries, such as: - *

- *
    - *
  • some Unicode characters confusable with ASCII characters (like a - * space, a dash, ...) ; this function replace them by their ASCII - * alternative,
  • - *
  • any of the following are double quoted: - *
      - *
    • non regular ADQL identifiers - * (e.g. _RAJ2000),
    • - *
    • ADQL function names used as identifiers - * (e.g. distance)
    • - *
    • and SQL reserved keywords - * (e.g. public).
    • - *
    - *
  • - *
- * - *

Note: - * This function does not use any instance variable of this parser - * (especially the InputStream or Reader provided at initialisation or - * ReInit). - *

- * - * @param adqlQuery The input ADQL query to fix. - * - * @return The suggested correction of the given ADQL query. - * - * @throws ParseException If any unrecognised character is encountered, - * or if anything else prevented the tokenization - * of some characters/words/terms. - * - * @since 1.5 - */ - public String tryQuickFix(String adqlQuery) throws ParseException { - StringBuffer suggestedQuery = new StringBuffer(); - - // 1. Replace all Unicode confusable characters: - adqlQuery = replaceUnicodeConfusables(adqlQuery); - - /* 1.bis. Normalise new lines and tabulations - * (to simplify the column counting): */ - adqlQuery = adqlQuery.replaceAll("(\u005cr\u005cn|\u005cr|\u005cn)", System.getProperty("line.separator")).replaceAll("\u005ct", " "); - - // 2. Analyse the query token by token: - ADQLParserTokenManager parser = new ADQLParserTokenManager(new SimpleCharStream(new java.io.ByteArrayInputStream(adqlQuery.getBytes()))); - - final String[] lines = adqlQuery.split(System.getProperty("line.separator")); - - try { - String suggestedToken; - int lastLine = 1, lastCol = 1; - - Token token = null, nextToken = parser.getNextToken(); - // for all tokens until the EOF or EOQ: - do { - // get the next token: - token = nextToken; - nextToken = (isEnd(token) ? null : parser.getNextToken()); - - // 3. Double quote any suspect token: - if (mustEscape(token, nextToken)) { - suggestedToken = "\u005c"" + token.image + "\u005c""; - } else - suggestedToken = token.image; - - /* 4. Append all space characters (and comments) before the - * token: */ - /* same line, just get the space characters between the last - * token and the one to append: */ - if (lastLine == token.beginLine) { - if (token.kind == ADQLParserConstants.EOF) - suggestedQuery.append(lines[lastLine - 1].substring(lastCol - 1)); - else - suggestedQuery.append(lines[lastLine - 1].substring(lastCol - 1, token.beginColumn - (isEnd(token) ? 0 : 1))); - lastCol = token.endColumn + 1; - } - // not the same line... - else { - /* append all remaining space characters until the position - * of the token to append: */ - do { - suggestedQuery.append(lines[lastLine - 1].substring(lastCol - 1)).append('\u005cn'); - lastLine++; - lastCol = 1; - } while(lastLine < token.beginLine); - /* if there are still space characters before the token, - * append them as well: */ - if (lastCol < token.beginColumn) - suggestedQuery.append(lines[lastLine - 1].substring(lastCol - 1, token.beginColumn - 1)); - // finally, set the correct column position: - lastCol = token.endColumn + 1; - } - - // 5. Append the suggested token: - suggestedQuery.append(suggestedToken); - - } while(!isEnd(token)); - - } catch(TokenMgrError err) { - // wrap such errors and propagate them: - throw new ParseException(err); - } - - return suggestedQuery.toString(); - } - - /** - * All of the most common Unicode confusable characters and their - * ASCII/UTF-8 alternative. - * - *

- * Keys of this map represent the ASCII character while the values are the - * regular expression for all possible Unicode alternatives. - *

- * - *

Note: - * All of them have been listed using - * Unicode Utilities: Confusables. - *

- * - * @since 1.5 - */ - protected final static java.util.Map REGEX_UNICODE_CONFUSABLES = new java.util.HashMap(10); - /** Regular expression matching all Unicode alternatives for -. - * @since 1.5 */ - protected final static String REGEX_DASH = "[-\u02d7\u06d4\u2010\u2011\u2012\u2013\u2043\u2212\u2796\u2cba\ufe58\u2014\u2015\u207b\u208b\u0096\u058a\ufe63\uff0d]"; - /** Regular expression matching all Unicode alternatives for _. - * @since 1.5 */ - protected final static String REGEX_UNDERSCORE = "[_\u07fa\ufe4d\ufe4e\ufe4f]"; - /** Regular expression matching all Unicode alternatives for '. - * @since 1.5 */ - protected final static String REGEX_QUOTE = "['`\u00b4\u02b9\u02bb\u02bc\u02bd\u02be\u02c8\u02ca\u02cb\u02f4\u0374\u0384\u055a\u055d\u05d9\u05f3\u07f4\u07f5\u144a\u16cc\u1fbd\u1fbf\u1fef\u1ffd\u1ffe\u2018\u2019\u201b\u2032\u2035\ua78c\uff07\uff40]"; - /** Regular expression matching all Unicode alternatives for ". - * @since 1.5 */ - protected final static String REGEX_DOUBLE_QUOTE = "[\u02ba\u02dd\u02ee\u02f6\u05f2\u05f4\u1cd3\u201c\u201d\u201f\u2033\u2036\u3003\uff02]"; - /** Regular expression matching all Unicode alternatives for .. - * @since 1.5 */ - protected final static String REGEX_STOP = "[.\u0660\u06f0\u0701\u0702\u2024\ua4f8\ua60e]"; - /** Regular expression matching all Unicode alternatives for +. - * @since 1.5 */ - protected final static String REGEX_PLUS = "[+\u16ed\u2795]"; - /** Regular expression matching all Unicode alternatives for . - * @since 1.5 */ - protected final static String REGEX_SPACE = "[ \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f]"; - /** Regular expression matching all Unicode alternatives for <. - * @since 1.5 */ - protected final static String REGEX_LESS_THAN = "[<\u02c2\u1438\u16b2\u2039\u276e]"; - /** Regular expression matching all Unicode alternatives for >. - * @since 1.5 */ - protected final static String REGEX_GREATER_THAN = "[>\u02c3\u1433\u203a\u276f]"; - /** Regular expression matching all Unicode alternatives for =. - * @since 1.5 */ - protected final static String REGEX_EQUAL = "[=\u1400\u2e40\u30a0\ua4ff]"; - static { - REGEX_UNICODE_CONFUSABLES.put("-", REGEX_DASH); - REGEX_UNICODE_CONFUSABLES.put("_", REGEX_UNDERSCORE); - REGEX_UNICODE_CONFUSABLES.put("'", REGEX_QUOTE); - REGEX_UNICODE_CONFUSABLES.put("\u005c"", REGEX_DOUBLE_QUOTE); - REGEX_UNICODE_CONFUSABLES.put(".", REGEX_STOP); - REGEX_UNICODE_CONFUSABLES.put("+", REGEX_PLUS); - REGEX_UNICODE_CONFUSABLES.put(" ", REGEX_SPACE); - REGEX_UNICODE_CONFUSABLES.put("<", REGEX_LESS_THAN); - REGEX_UNICODE_CONFUSABLES.put(">", REGEX_GREATER_THAN); - REGEX_UNICODE_CONFUSABLES.put("=", REGEX_EQUAL); - } - - /** - * Replace all Unicode characters that can be confused with other ASCI/UTF-8 - * characters (e.g. different spaces, dashes, ...) in their ASCII version. - * - * @param adqlQuery The ADQL query string in which Unicode confusable - * characters must be replaced. - * - * @return The same query without the most common Unicode confusable - * characters. - * - * @since 1.5 - */ - protected String replaceUnicodeConfusables(final String adqlQuery) { - String newAdqlQuery = adqlQuery; - for(java.util.Map.Entry confusable : REGEX_UNICODE_CONFUSABLES.entrySet()) - newAdqlQuery = newAdqlQuery.replaceAll(confusable.getValue(), confusable.getKey()); - return newAdqlQuery; - } - - /** - * Tell whether the given token represents the end of an ADQL query. - * - * @param token Token to analyze. - * - * @return true if the given token represents a query end, - * false otherwise. - * - * @since 1.5 - */ - protected boolean isEnd(final Token token) { - return token.kind == ADQLParserConstants.EOF || token.kind == ADQLParserConstants.EOQ; - } - - /** - * Tell whether the given token must be double quoted. - * - *

- * This function considers all the following as terms to double quote: - *

- *
    - *
  • SQL reserved keywords
  • , - *
  • unrecognised regular identifiers (e.g. neither a delimited nor a - * valid ADQL regular identifier)
  • - *
  • and ADQL function name without a parameters list.
  • - *
- * - * @param token The token to analyze. - * @param nextToken The following token. (useful to detect the start of a - * function's parameters list) - * - * @return true if the given token must be double quoted, - * false to keep it as provided. - * - * @since 1.5 - */ - protected boolean mustEscape(final Token token, final Token nextToken) { - switch(token.kind) { - case ADQLParserConstants.SQL_RESERVED_WORD: - return true; - case ADQLParserConstants.REGULAR_IDENTIFIER_CANDIDATE: - return !isRegularIdentifier(token.image); - default: - return isFunctionName(token) && (nextToken == null || nextToken.kind != ADQLParserConstants.LEFT_PAR); - } - } - - /** - * Tell whether the given token matches to an ADQL function name. - * - * @param token The token to analyze. - * - * @return true if the given token is an ADQL function name, - * false otherwise. - * - * @since 1.5 - */ - protected boolean isFunctionName(final Token token) { - switch(token.kind) { - case ADQLParserConstants.COUNT: - case ADQLParserConstants.EXISTS: - case ADQLParserConstants.AVG: - case ADQLParserConstants.MAX: - case ADQLParserConstants.MIN: - case ADQLParserConstants.SUM: - case ADQLParserConstants.BOX: - case ADQLParserConstants.CENTROID: - case ADQLParserConstants.CIRCLE: - case ADQLParserConstants.POINT: - case ADQLParserConstants.POLYGON: - case ADQLParserConstants.REGION: - case ADQLParserConstants.CONTAINS: - case ADQLParserConstants.INTERSECTS: - case ADQLParserConstants.AREA: - case ADQLParserConstants.COORD1: - case ADQLParserConstants.COORD2: - case ADQLParserConstants.COORDSYS: - case ADQLParserConstants.DISTANCE: - case ADQLParserConstants.ABS: - case ADQLParserConstants.CEILING: - case ADQLParserConstants.DEGREES: - case ADQLParserConstants.EXP: - case ADQLParserConstants.FLOOR: - case ADQLParserConstants.LOG: - case ADQLParserConstants.LOG10: - case ADQLParserConstants.MOD: - case ADQLParserConstants.PI: - case ADQLParserConstants.POWER: - case ADQLParserConstants.RADIANS: - case ADQLParserConstants.RAND: - case ADQLParserConstants.ROUND: - case ADQLParserConstants.SQRT: - case ADQLParserConstants.TRUNCATE: - case ADQLParserConstants.ACOS: - case ADQLParserConstants.ASIN: - case ADQLParserConstants.ATAN: - case ADQLParserConstants.ATAN2: - case ADQLParserConstants.COS: - case ADQLParserConstants.COT: - case ADQLParserConstants.SIN: - case ADQLParserConstants.TAN: - case ADQLParserConstants.USING: - return true; - default: - return false; - } - } - - /* MAIN PROGRAM */ - - /** + public final ADQLQuery parseQuery(java.io.InputStream stream) throws ParseException { + stackQuery.clear(); + query = null; + ReInit(stream); + try { + return Query(); + }catch(TokenMgrError tme) { + throw new ParseException(tme); + } + } + + /* CORRECTION SUGGESTION */ + + /** + * Try fixing tokens/terms of the input ADQL query. + * + *

+ * This function does not try to fix syntactical or semantical errors. + * It just try to fix the most common issues in ADQL queries, such as: + *

+ *
    + *
  • some Unicode characters confusable with ASCII characters (like a + * space, a dash, ...) ; this function replace them by their ASCII + * alternative,
  • + *
  • any of the following are double quoted: + *
      + *
    • non regular ADQL identifiers + * (e.g. _RAJ2000),
    • + *
    • ADQL function names used as identifiers + * (e.g. distance)
    • + *
    • and SQL reserved keywords + * (e.g. public).
    • + *
    + *
  • + *
+ * + *

Note 1: + * The given stream is NOT closed by this function even if the EOF is + * reached. It is the responsibility of the caller to close it. + *

+ * + *

Note 2: + * This function does not use any instance variable of this parser + * (especially the InputStream or Reader provided at initialisation or + * ReInit). + *

+ * + * @param input Stream containing the input ADQL query to fix. + * + * @return The suggested correction of the input ADQL query. + * + * @throws java.io.IOException If there is any error while reading from the + * given input stream. + * @throws ParseException If any unrecognised character is encountered, + * or if anything else prevented the tokenization + * of some characters/words/terms. + * + * @see #tryQuickFix(java.lang.String) + * + * @since 1.5 + */ + public final String tryQuickFix(final java.io.InputStream input) throws java.io.IOException, ParseException { + // Fetch everything into a single string: + StringBuffer buf = new StringBuffer(); + byte[] cBuf = new byte[1024]; + int nbChar; + while((nbChar = input.read(cBuf)) > -1){ + buf.append(new String(cBuf, 0, nbChar)); + } + + // Convert the buffer into a String and now try to fix it: + return tryQuickFix(buf.toString()); + } + + /** + * Try fixing tokens/terms of the given ADQL query. + * + *

+ * This function does not try to fix syntactical or semantical errors. + * It just try to fix the most common issues in ADQL queries, such as: + *

+ *
    + *
  • some Unicode characters confusable with ASCII characters (like a + * space, a dash, ...) ; this function replace them by their ASCII + * alternative,
  • + *
  • any of the following are double quoted: + *
      + *
    • non regular ADQL identifiers + * (e.g. _RAJ2000),
    • + *
    • ADQL function names used as identifiers + * (e.g. distance)
    • + *
    • and SQL reserved keywords + * (e.g. public).
    • + *
    + *
  • + *
+ * + *

Note: + * This function does not use any instance variable of this parser + * (especially the InputStream or Reader provided at initialisation or + * ReInit). + *

+ * + * @param adqlQuery The input ADQL query to fix. + * + * @return The suggested correction of the given ADQL query. + * + * @throws ParseException If any unrecognised character is encountered, + * or if anything else prevented the tokenization + * of some characters/words/terms. + * + * @since 1.5 + */ + public String tryQuickFix(String adqlQuery) throws ParseException { + StringBuffer suggestedQuery = new StringBuffer(); + + // 1. Replace all Unicode confusable characters: + adqlQuery = replaceUnicodeConfusables(adqlQuery); + + /* 1.bis. Normalise new lines and tabulations + * (to simplify the column counting): */ + adqlQuery = adqlQuery.replaceAll("(\u005cr\u005cn|\u005cr|\u005cn)", System.getProperty("line.separator")).replaceAll("\u005ct", " "); + + // 2. Analyse the query token by token: + ADQLParserTokenManager parser = new ADQLParserTokenManager(new SimpleCharStream(new java.io.ByteArrayInputStream(adqlQuery.getBytes()))); + + final String[] lines = adqlQuery.split(System.getProperty("line.separator")); + + try{ + String suggestedToken; + int lastLine = 1, lastCol = 1; + + Token token = null, nextToken = parser.getNextToken(); + // for all tokens until the EOF or EOQ: + do{ + // get the next token: + token = nextToken; + nextToken = (isEnd(token) ? null : parser.getNextToken()); + + // 3. Double quote any suspect token: + if (mustEscape(token, nextToken)){ + suggestedToken = "\u005c"" + token.image + "\u005c""; + }else + suggestedToken = token.image; + + /* 4. Append all space characters (and comments) before the + * token: */ + /* same line, just get the space characters between the last + * token and the one to append: */ + if (lastLine == token.beginLine){ + if (token.kind == ADQLParserConstants.EOF) + suggestedQuery.append(lines[lastLine - 1].substring(lastCol - 1)); + else + suggestedQuery.append(lines[lastLine - 1].substring(lastCol - 1, token.beginColumn - (isEnd(token) ? 0 : 1))); + lastCol = token.endColumn + 1; + } + // not the same line... + else{ + /* append all remaining space characters until the position + * of the token to append: */ + do{ + suggestedQuery.append(lines[lastLine - 1].substring(lastCol - 1)).append('\u005cn'); + lastLine++; + lastCol = 1; + }while(lastLine < token.beginLine); + /* if there are still space characters before the token, + * append them as well: */ + if (lastCol < token.beginColumn) + suggestedQuery.append(lines[lastLine - 1].substring(lastCol - 1, token.beginColumn - 1)); + // finally, set the correct column position: + lastCol = token.endColumn + 1; + } + + // 5. Append the suggested token: + suggestedQuery.append(suggestedToken); + + }while(!isEnd(token)); + + }catch(TokenMgrError err){ + // wrap such errors and propagate them: + throw new ParseException(err); + } + + return suggestedQuery.toString(); + } + + /** + * All of the most common Unicode confusable characters and their + * ASCII/UTF-8 alternative. + * + *

+ * Keys of this map represent the ASCII character while the values are the + * regular expression for all possible Unicode alternatives. + *

+ * + *

Note: + * All of them have been listed using + * Unicode Utilities: Confusables. + *

+ * + * @since 1.5 + */ + protected final static java.util.Map REGEX_UNICODE_CONFUSABLES = new java.util.HashMap(10); + /** Regular expression matching all Unicode alternatives for -. + * @since 1.5 */ + protected final static String REGEX_DASH = "[-\u02d7\u06d4\u2010\u2011\u2012\u2013\u2043\u2212\u2796\u2cba\ufe58\u2014\u2015\u207b\u208b\u0096\u058a\ufe63\uff0d]"; + /** Regular expression matching all Unicode alternatives for _. + * @since 1.5 */ + protected final static String REGEX_UNDERSCORE = "[_\u07fa\ufe4d\ufe4e\ufe4f]"; + /** Regular expression matching all Unicode alternatives for '. + * @since 1.5 */ + protected final static String REGEX_QUOTE = "['`\u00b4\u02b9\u02bb\u02bc\u02bd\u02be\u02c8\u02ca\u02cb\u02f4\u0374\u0384\u055a\u055d\u05d9\u05f3\u07f4\u07f5\u144a\u16cc\u1fbd\u1fbf\u1fef\u1ffd\u1ffe\u2018\u2019\u201b\u2032\u2035\ua78c\uff07\uff40]"; + /** Regular expression matching all Unicode alternatives for ". + * @since 1.5 */ + protected final static String REGEX_DOUBLE_QUOTE = "[\u02ba\u02dd\u02ee\u02f6\u05f2\u05f4\u1cd3\u201c\u201d\u201f\u2033\u2036\u3003\uff02]"; + /** Regular expression matching all Unicode alternatives for .. + * @since 1.5 */ + protected final static String REGEX_STOP = "[.\u0660\u06f0\u0701\u0702\u2024\ua4f8\ua60e]"; + /** Regular expression matching all Unicode alternatives for +. + * @since 1.5 */ + protected final static String REGEX_PLUS = "[+\u16ed\u2795]"; + /** Regular expression matching all Unicode alternatives for . + * @since 1.5 */ + protected final static String REGEX_SPACE = "[ \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f]"; + /** Regular expression matching all Unicode alternatives for <. + * @since 1.5 */ + protected final static String REGEX_LESS_THAN = "[<\u02c2\u1438\u16b2\u2039\u276e]"; + /** Regular expression matching all Unicode alternatives for >. + * @since 1.5 */ + protected final static String REGEX_GREATER_THAN = "[>\u02c3\u1433\u203a\u276f]"; + /** Regular expression matching all Unicode alternatives for =. + * @since 1.5 */ + protected final static String REGEX_EQUAL = "[=\u1400\u2e40\u30a0\ua4ff]"; + static { + REGEX_UNICODE_CONFUSABLES.put("-", REGEX_DASH); + REGEX_UNICODE_CONFUSABLES.put("_", REGEX_UNDERSCORE); + REGEX_UNICODE_CONFUSABLES.put("'", REGEX_QUOTE); + REGEX_UNICODE_CONFUSABLES.put("\u005c"", REGEX_DOUBLE_QUOTE); + REGEX_UNICODE_CONFUSABLES.put(".", REGEX_STOP); + REGEX_UNICODE_CONFUSABLES.put("+", REGEX_PLUS); + REGEX_UNICODE_CONFUSABLES.put(" ", REGEX_SPACE); + REGEX_UNICODE_CONFUSABLES.put("<", REGEX_LESS_THAN); + REGEX_UNICODE_CONFUSABLES.put(">", REGEX_GREATER_THAN); + REGEX_UNICODE_CONFUSABLES.put("=", REGEX_EQUAL); + } + + /** + * Replace all Unicode characters that can be confused with other ASCI/UTF-8 + * characters (e.g. different spaces, dashes, ...) in their ASCII version. + * + * @param adqlQuery The ADQL query string in which Unicode confusable + * characters must be replaced. + * + * @return The same query without the most common Unicode confusable + * characters. + * + * @since 1.5 + */ + protected String replaceUnicodeConfusables(final String adqlQuery){ + String newAdqlQuery = adqlQuery; + for(java.util.Map.Entry confusable : REGEX_UNICODE_CONFUSABLES.entrySet()) + newAdqlQuery = newAdqlQuery.replaceAll(confusable.getValue(), confusable.getKey()); + return newAdqlQuery; + } + + /** + * Tell whether the given token represents the end of an ADQL query. + * + * @param token Token to analyze. + * + * @return true if the given token represents a query end, + * false otherwise. + * + * @since 1.5 + */ + protected boolean isEnd(final Token token){ + return token.kind == ADQLParserConstants.EOF || token.kind == ADQLParserConstants.EOQ; + } + + /** + * Tell whether the given token must be double quoted. + * + *

+ * This function considers all the following as terms to double quote: + *

+ *
    + *
  • SQL reserved keywords
  • , + *
  • unrecognised regular identifiers (e.g. neither a delimited nor a + * valid ADQL regular identifier)
  • + *
  • and ADQL function name without a parameters list.
  • + *
+ * + * @param token The token to analyze. + * @param nextToken The following token. (useful to detect the start of a + * function's parameters list) + * + * @return true if the given token must be double quoted, + * false to keep it as provided. + * + * @since 1.5 + */ + protected boolean mustEscape(final Token token, final Token nextToken){ + switch(token.kind){ + case ADQLParserConstants.SQL_RESERVED_WORD: + return true; + case ADQLParserConstants.REGULAR_IDENTIFIER_CANDIDATE: + return !isRegularIdentifier(token.image); + default: + return isFunctionName(token) && (nextToken == null || nextToken.kind != ADQLParserConstants.LEFT_PAR); + } + } + + /** + * Tell whether the given token matches to an ADQL function name. + * + * @param token The token to analyze. + * + * @return true if the given token is an ADQL function name, + * false otherwise. + * + * @since 1.5 + */ + protected boolean isFunctionName(final Token token){ + switch(token.kind){ + case ADQLParserConstants.COUNT: + case ADQLParserConstants.EXISTS: + case ADQLParserConstants.AVG: + case ADQLParserConstants.MAX: + case ADQLParserConstants.MIN: + case ADQLParserConstants.SUM: + case ADQLParserConstants.BOX: + case ADQLParserConstants.CENTROID: + case ADQLParserConstants.CIRCLE: + case ADQLParserConstants.POINT: + case ADQLParserConstants.POLYGON: + case ADQLParserConstants.REGION: + case ADQLParserConstants.CONTAINS: + case ADQLParserConstants.INTERSECTS: + case ADQLParserConstants.AREA: + case ADQLParserConstants.COORD1: + case ADQLParserConstants.COORD2: + case ADQLParserConstants.COORDSYS: + case ADQLParserConstants.DISTANCE: + case ADQLParserConstants.ABS: + case ADQLParserConstants.CEILING: + case ADQLParserConstants.DEGREES: + case ADQLParserConstants.EXP: + case ADQLParserConstants.FLOOR: + case ADQLParserConstants.LOG: + case ADQLParserConstants.LOG10: + case ADQLParserConstants.MOD: + case ADQLParserConstants.PI: + case ADQLParserConstants.POWER: + case ADQLParserConstants.RADIANS: + case ADQLParserConstants.RAND: + case ADQLParserConstants.ROUND: + case ADQLParserConstants.SQRT: + case ADQLParserConstants.TRUNCATE: + case ADQLParserConstants.ACOS: + case ADQLParserConstants.ASIN: + case ADQLParserConstants.ATAN: + case ADQLParserConstants.ATAN2: + case ADQLParserConstants.COS: + case ADQLParserConstants.COT: + case ADQLParserConstants.SIN: + case ADQLParserConstants.TAN: + case ADQLParserConstants.USING: + return true; + default: + return false; + } + } + + /* MAIN PROGRAM */ + + /** * Gets the specified ADQL query and parses the given ADQL query. The SQL * translation is then printed if the syntax is correct. - * + * *

* ONLY the syntax is checked: the query is NOT EXECUTED ! *

* * @param args - + * @throws Exception */ - public static final void main(String[] args) throws Exception { - final String USAGE = "Usage:\u005cn adqlParser.jar [-d] [-v] [-e] [-a|-s] [-f] [|]\u005cn\u005cnNOTE: If no file or URL is given, the ADQL query is expected in the standard\u005cn input. This query must end with a ';' or !\u005cn\u005cnParameters:\u005cn -v or --verbose : Print the main steps of the parsing\u005cn -d or --debug : Print stack traces when a grave error occurs\u005cn -e or --explain : Explain the ADQL parsing (or Expand the parsing tree)\u005cn -a or --adql : Display the understood ADQL query\u005cn -s or --sql : Ask the SQL translation of the given ADQL query\u005cn (SQL compatible with PostgreSQL)\u005cn -f or --try-fix : Try fixing the most common ADQL query issues before\u005cn attempting to parse the query.\u005cn\u005cnReturn:\u005cn By default: nothing if the query is correct. Otherwise a message explaining\u005cn why the query is not correct is displayed.\u005cn With the -s option, the SQL translation of the given ADQL query will be\u005cn returned.\u005cn With the -a option, the ADQL query is returned as it has been understood.\u005cn\u005cnExit status:\u005cn 0 OK !\u005cn 1 Parameter error (missing or incorrect parameter)\u005cn 2 File error (incorrect file/url, reading error, ...)\u005cn 3 Parsing error (syntactic or semantic error)\u005cn 4 Translation error (a problem has occurred during the translation of the\u005cn given ADQL query in SQL)."; - - ADQLParser parser; - - final String urlRegex = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"; - - String file = null, metaFile = null; - short mode = -1; - boolean verbose = false, debug = false, explain = false, tryFix = false; - - // Parameters reading: - for(int i = 0; i < args.length; i++) { - if (args[i].equalsIgnoreCase("-d") || args[i].equalsIgnoreCase("--debug")) - debug = true; - else if (args[i].equalsIgnoreCase("-v") || args[i].equalsIgnoreCase("--verbose")) - verbose = true; - else if (args[i].equalsIgnoreCase("-e") || args[i].equalsIgnoreCase("--explain")) - explain = true; - else if (args[i].equalsIgnoreCase("-a") || args[i].equalsIgnoreCase("--adql")) { - if (mode != -1) { - System.err.println("((!)) Too much parameter: you must choose between -s, -c, -a or nothing ((!))\u005cn" + USAGE); - System.exit(1); - } else - mode = 1; - } else if (args[i].equalsIgnoreCase("-s") || args[i].equalsIgnoreCase("--sql")) { - if (mode != -1) { - System.err.println("((!)) Too much parameter: you must choose between -s, -c, -a or nothing ((!))\u005cn" + USAGE); - System.exit(1); - } else - mode = 2; - } else if (args[i].equalsIgnoreCase("-f") || args[i].equalsIgnoreCase("--try-fix")) - tryFix = true; - else if (args[i].equalsIgnoreCase("-h") || args[i].equalsIgnoreCase("--help")) { - System.out.println(USAGE); - System.exit(0); - } else if (args[i].startsWith("-")) { - System.err.println("((!)) Unknown parameter: \u005c"" + args[i] + "\u005c" ((!))\u005cn" + USAGE); - System.exit(1); - } else - file = args[i].trim(); - } - - try { - - // Try fixing the query, if asked: - if (tryFix) { - if (verbose) - System.out.println("((i)) Trying to automatically fix the query..."); - - String query; - java.io.InputStream in = null; - try { - // get the input stream... - if (file == null || file.length() == 0) - in = System.in; - else if (file.matches(urlRegex)) - in = (new java.net.URL(file)).openStream(); - else - in = new java.io.FileInputStream(file); - - // ...and try fixing the query: - query = (new ADQLParser()).tryQuickFix(in); - } finally { - // close the stream (if opened): - if (in != null) - in.close(); - in = null; - } - - if (verbose) - System.out.println("((i)) SUGGESTED QUERY:\u005cn" + query); - - // Initialise the parser with this fixed query: - parser = new ADQLParser(new java.io.ByteArrayInputStream(query.getBytes())); - } - // Otherwise, take the query as provided: - else { - // Initialise the parser with the specified input: - if (file == null || file.length() == 0) - parser = new ADQLParser(System.in); - else if (file.matches(urlRegex)) - parser = new ADQLParser((new java.net.URL(file)).openStream()); - else - parser = new ADQLParser(new java.io.FileInputStream(file)); - } - - // Enable/Disable the debugging in function of the parameters: - parser.setDebug(explain); - - // Query parsing: - try { - if (verbose) - System.out.print("((i)) Parsing ADQL query..."); - ADQLQuery q = parser.parseQuery(); - if (verbose) - System.out.println("((i)) CORRECT ADQL QUERY ((i))"); - if (mode == 2) { - PostgreSQLTranslator translator = new PostgreSQLTranslator(); - if (verbose) - System.out.print("((i)) Translating in SQL..."); - String sql = translator.translate(q); - if (verbose) - System.out.println("ok"); - System.out.println(sql); - } else if (mode == 1) { - System.out.println(q.toADQL()); - } - } catch(UnresolvedIdentifiersException uie) { - System.err.println("((X)) " + uie.getNbErrors() + " unresolved identifiers:"); - for(ParseException pe : uie) - System.err.println("\u005ct - at " + pe.getPosition() + ": " + uie.getMessage()); - if (debug) - uie.printStackTrace(System.err); - System.exit(3); - } catch(ParseException pe) { - System.err.println("((X)) Syntax error: " + pe.getMessage() + " ((X))"); - if (debug) - pe.printStackTrace(System.err); - System.exit(3); - } catch(TranslationException te) { - if (verbose) - System.out.println("error"); - System.err.println("((X)) Translation error: " + te.getMessage() + " ((X))"); - if (debug) - te.printStackTrace(System.err); - System.exit(4); - } - - } catch(IOException ioe) { - System.err.println("\u005cn((X)) Error while reading the file \u005c"" + file + "\u005c": " + ioe.getMessage() + " ((X))"); - if (debug) - ioe.printStackTrace(System.err); - System.exit(2); - } - - } - - /* ########## */ - /* # SYNTAX # */ - /* ########## */ - - /* ******************* */ - /* GENERAL ADQL SYNTAX */ - /* ******************* */ - /** - * Parses the ADQL query given at the parser creation or in the {@link ADQLParser#ReInit(java.io.InputStream)} - * or in the parseQuery functions. - * - * @return The object representation of the query. - * @throws ParseException If the query syntax is incorrect. - */ - final public ADQLQuery Query() throws ParseException { - trace_call("Query"); - try { - ADQLQuery q = null; - q = QueryExpression(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 0: - jj_consume_token(0); - break; - case EOQ: - jj_consume_token(EOQ); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - // check the query: - if (queryChecker != null) - queryChecker.check(q); - - { - if (true) - return q; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("Query"); - } - } - - final public ADQLQuery QueryExpression() throws ParseException { - trace_call("QueryExpression"); - try { - TextPosition endPos = null; - try { - // create the query: - query = queryFactory.createQuery(); - stackQuery.push(query); - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - Select(); - From(); - endPos = query.getFrom().getPosition(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case WHERE: - Where(); - endPos = query.getWhere().getPosition(); - break; - default: - jj_la1[1] = jj_gen; - ; - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case GROUP: - GroupBy(); - endPos = query.getGroupBy().getPosition(); - break; - default: - jj_la1[2] = jj_gen; - ; - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case HAVING: - Having(); - endPos = query.getHaving().getPosition(); - break; - default: - jj_la1[3] = jj_gen; - ; - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ORDER: - OrderBy(); - endPos = query.getOrderBy().getPosition(); - break; - default: - jj_la1[4] = jj_gen; - ; - } - // set the position of the query: - query.setPosition(new TextPosition(query.getSelect().getPosition(), endPos)); - - // get the previous query (!= null if the current query is a sub-query): - ADQLQuery previousQuery = stackQuery.pop(); - if (stackQuery.isEmpty()) - query = null; - else - query = stackQuery.peek(); - - { - if (true) - return previousQuery; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("QueryExpression"); - } - } - - final public ADQLQuery SubQueryExpression() throws ParseException { - trace_call("SubQueryExpression"); - try { - ADQLQuery q = null; - Token start, end; - start = jj_consume_token(LEFT_PAR); - q = QueryExpression(); - end = jj_consume_token(RIGHT_PAR); - q.setPosition(new TextPosition(start, end)); - { - if (true) - return q; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("SubQueryExpression"); - } - } - - final public void Select() throws ParseException { - trace_call("Select"); - try { - ClauseSelect select = query.getSelect(); - SelectItem item = null; - Token start, t = null; - start = jj_consume_token(SELECT); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case QUANTIFIER: - t = jj_consume_token(QUANTIFIER); - select.setDistinctColumns(t.image.equalsIgnoreCase("DISTINCT")); - break; - default: - jj_la1[5] = jj_gen; - ; - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case TOP: - jj_consume_token(TOP); - t = jj_consume_token(UNSIGNED_INTEGER); - try { - select.setLimit(Integer.parseInt(t.image)); - } catch(NumberFormatException nfe) { - { - if (true) - throw new ParseException("[l." + t.beginLine + ";c." + t.beginColumn + "] The TOP limit (\u005c"" + t.image + "\u005c") isn't a regular unsigned integer !"); - } - } - break; - default: - jj_la1[6] = jj_gen; - ; - } - item = SelectItem(); - select.add(item); - label_1: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[7] = jj_gen; - break label_1; - } - jj_consume_token(COMMA); - item = SelectItem(); - select.add(item); - } - TextPosition lastItemPos = query.getSelect().get(query.getSelect().size() - 1).getPosition(); - select.setPosition(new TextPosition(start.beginLine, start.beginColumn, lastItemPos.endLine, lastItemPos.endColumn)); - } finally { - trace_return("Select"); - } - } - - final public SelectItem SelectItem() throws ParseException { - trace_call("SelectItem"); - try { - IdentifierItems identifiers = new IdentifierItems(true); - IdentifierItem id = null, label = null; - ADQLOperand op = null; - SelectItem item; - Token starToken; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASTERISK: - starToken = jj_consume_token(ASTERISK); - item = new SelectAllColumns(query); - item.setPosition(new TextPosition(starToken)); { - if (true) - return item; - } - break; - default: - jj_la1[12] = jj_gen; - if (jj_2_1(7)) { - id = Identifier(); - jj_consume_token(DOT); - identifiers.append(id); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - id = Identifier(); - jj_consume_token(DOT); - identifiers.append(id); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - id = Identifier(); - jj_consume_token(DOT); - identifiers.append(id); - break; - default: - jj_la1[8] = jj_gen; - ; - } - break; - default: - jj_la1[9] = jj_gen; - ; - } - starToken = jj_consume_token(ASTERISK); - try { - item = new SelectAllColumns(queryFactory.createTable(identifiers, null)); - TextPosition firstPos = identifiers.get(0).position; - item.setPosition(new TextPosition(firstPos.beginLine, firstPos.beginColumn, starToken.endLine, (starToken.endColumn < 0) ? -1 : (starToken.endColumn + 1))); - { - if (true) - return item; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - } else { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT_PAR: - case PLUS: - case MINUS: - case AVG: - case MAX: - case MIN: - case SUM: - case COUNT: - case BOX: - case CENTROID: - case CIRCLE: - case POINT: - case POLYGON: - case REGION: - case CONTAINS: - case INTERSECTS: - case AREA: - case COORD1: - case COORD2: - case COORDSYS: - case DISTANCE: - case ABS: - case CEILING: - case DEGREES: - case EXP: - case FLOOR: - case LOG: - case LOG10: - case MOD: - case PI: - case POWER: - case RADIANS: - case RAND: - case ROUND: - case SQRT: - case TRUNCATE: - case ACOS: - case ASIN: - case ATAN: - case ATAN2: - case COS: - case COT: - case SIN: - case TAN: - case STRING_LITERAL: - case SCIENTIFIC_NUMBER: - case UNSIGNED_FLOAT: - case UNSIGNED_INTEGER: - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - op = ValueExpression(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AS: - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AS: - jj_consume_token(AS); - break; - default: - jj_la1[10] = jj_gen; - ; - } - label = Identifier(); - break; - default: - jj_la1[11] = jj_gen; - ; - } - break; - default: - jj_la1[13] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - try { - item = queryFactory.createSelectItem(op, (label == null) ? null : label.identifier); - if (label != null) { - item.setCaseSensitive(label.caseSensitivity); - item.setPosition(new TextPosition(op.getPosition(), label.position)); - } else - item.setPosition(new TextPosition(op.getPosition())); - { - if (true) - return item; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("SelectItem"); - } - } - - final public void From() throws ParseException { - trace_call("From"); - try { - FromContent content = null, content2 = null; - try { - jj_consume_token(FROM); - content = TableRef(); - label_2: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[14] = jj_gen; - break label_2; - } - jj_consume_token(COMMA); - content2 = TableRef(); - TextPosition startPos = content.getPosition(), endPos = content2.getPosition(); - content = queryFactory.createJoin(JoinType.CROSS, content, content2); - content.setPosition(new TextPosition(startPos, endPos)); - } - query.setFrom(content); - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - } finally { - trace_return("From"); - } - } - - final public void Where() throws ParseException { - trace_call("Where"); - try { - ClauseConstraints where = query.getWhere(); - ADQLConstraint condition; - Token start; - start = jj_consume_token(WHERE); - ConditionsList(where); - TextPosition endPosition = where.getPosition(); - where.setPosition(new TextPosition(start.beginLine, start.beginColumn, endPosition.endLine, endPosition.endColumn)); - } finally { - trace_return("Where"); - } - } - - final public void GroupBy() throws ParseException { - trace_call("GroupBy"); - try { - ClauseADQL groupBy = query.getGroupBy(); - ADQLColumn colRef = null; - Token start; - start = jj_consume_token(GROUP); - jj_consume_token(BY); - colRef = Column(); - groupBy.add(colRef); - label_3: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[15] = jj_gen; - break label_3; - } - jj_consume_token(COMMA); - colRef = Column(); - groupBy.add(colRef); - } - groupBy.setPosition(new TextPosition(start.beginLine, start.beginColumn, colRef.getPosition().endLine, colRef.getPosition().endColumn)); - } finally { - trace_return("GroupBy"); - } - } - - final public void Having() throws ParseException { - trace_call("Having"); - try { - ClauseConstraints having = query.getHaving(); - Token start; - start = jj_consume_token(HAVING); - ConditionsList(having); - TextPosition endPosition = having.getPosition(); - having.setPosition(new TextPosition(start.beginLine, start.beginColumn, endPosition.endLine, endPosition.endColumn)); - } finally { - trace_return("Having"); - } - } - - final public void OrderBy() throws ParseException { - trace_call("OrderBy"); - try { - ClauseADQL orderBy = query.getOrderBy(); - ADQLOrder order = null; - Token start; - start = jj_consume_token(ORDER); - jj_consume_token(BY); - order = OrderItem(); - orderBy.add(order); - label_4: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[16] = jj_gen; - break label_4; - } - jj_consume_token(COMMA); - order = OrderItem(); - orderBy.add(order); - } - orderBy.setPosition(new TextPosition(start, token)); - } finally { - trace_return("OrderBy"); - } - } - - /* *************************** */ - /* COLUMN AND TABLE REFERENCES */ - /* *************************** */ - final public IdentifierItem Identifier() throws ParseException { - trace_call("Identifier"); - try { - Token t; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case REGULAR_IDENTIFIER_CANDIDATE: - t = jj_consume_token(REGULAR_IDENTIFIER_CANDIDATE); - testRegularIdentifier(t); { - if (true) - return new IdentifierItem(t, false); - } - break; - case DELIMITED_IDENTIFIER: - t = jj_consume_token(DELIMITED_IDENTIFIER); { - if (true) - return new IdentifierItem(t, true); - } - break; - default: - jj_la1[17] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("Identifier"); - } - } - - /** - * Extracts the name of a table with its possible catalog and schema prefixes. - * - * @return A {@link IdentifierItems} which contains at most three items: catalogName, schemaName and tableName. - */ - final public IdentifierItems TableName() throws ParseException { - trace_call("TableName"); - try { - IdentifierItems identifiers = new IdentifierItems(true); - IdentifierItem id = null; - id = Identifier(); - identifiers.append(id); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DOT: - jj_consume_token(DOT); - id = Identifier(); - identifiers.append(id); - break; - default: - jj_la1[18] = jj_gen; - ; - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DOT: - jj_consume_token(DOT); - id = Identifier(); - identifiers.append(id); - break; - default: - jj_la1[19] = jj_gen; - ; - } - { - if (true) - return identifiers; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("TableName"); - } - } - - /** - * Extracts the name of a column with its possible catalog, schema and table prefixes. - * - * @return A {@link IdentifierItems} which contains at most four items: catalogName, schemaName, tableName and columnName. - */ - final public IdentifierItems ColumnName() throws ParseException { - trace_call("ColumnName"); - try { - IdentifierItem id; - IdentifierItems table = null, identifiers = new IdentifierItems(false); - id = Identifier(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DOT: - jj_consume_token(DOT); - table = TableName(); - break; - default: - jj_la1[20] = jj_gen; - ; - } - identifiers.append(id); - if (table != null) { - for(int i = 0; i < table.size(); i++) - identifiers.append(table.get(i)); - } - { - if (true) - return identifiers; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("ColumnName"); - } - } - - final public ADQLColumn Column() throws ParseException { - trace_call("Column"); - try { - IdentifierItems identifiers; - identifiers = ColumnName(); - try { - { - if (true) - return queryFactory.createColumn(identifiers); - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("Column"); - } - } - - final public ADQLOrder OrderItem() throws ParseException { - trace_call("OrderItem"); - try { - IdentifierItem identifier = null; - Token ind = null, desc = null; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - identifier = Identifier(); - break; - case UNSIGNED_INTEGER: - ind = jj_consume_token(UNSIGNED_INTEGER); - break; - default: - jj_la1[21] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASC: - case DESC: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASC: - jj_consume_token(ASC); - break; - case DESC: - desc = jj_consume_token(DESC); - break; - default: - jj_la1[22] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - default: - jj_la1[23] = jj_gen; - ; - } - try { - ADQLOrder order = null; - if (identifier != null) { - order = queryFactory.createOrder(identifier, desc != null); - order.setPosition(identifier.position); - } else { - order = queryFactory.createOrder(Integer.parseInt(ind.image), desc != null); - order.setPosition(new TextPosition(ind)); - } - { - if (true) - return order; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("OrderItem"); - } - } - - final public FromContent SimpleTableRef() throws ParseException { - trace_call("SimpleTableRef"); - try { - IdentifierItem alias = null; - IdentifierItems identifiers = null; - ADQLQuery subQuery = null; - FromContent content = null; - Token start, end; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - identifiers = TableName(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AS: - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AS: - jj_consume_token(AS); - break; - default: - jj_la1[24] = jj_gen; - ; - } - alias = Identifier(); - break; - default: - jj_la1[25] = jj_gen; - ; - } - content = queryFactory.createTable(identifiers, alias); - if (alias == null) - content.setPosition(new TextPosition(identifiers.get(0).position, identifiers.get(identifiers.size() - 1).position)); - else - content.setPosition(new TextPosition(identifiers.get(0).position, alias.position)); { - if (true) - return content; - } - break; - default: - jj_la1[27] = jj_gen; - if (jj_2_2(2)) { - subQuery = SubQueryExpression(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AS: - jj_consume_token(AS); - break; - default: - jj_la1[26] = jj_gen; - ; - } - alias = Identifier(); - content = queryFactory.createTable(subQuery, alias); - if (alias == null) - content.setPosition(new TextPosition(subQuery.getPosition())); - else - content.setPosition(new TextPosition(subQuery.getPosition(), alias.position)); - { - if (true) - return content; - } - } else { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT_PAR: - start = jj_consume_token(LEFT_PAR); - content = JoinedTable(); - end = jj_consume_token(RIGHT_PAR); - content.setPosition(new TextPosition(start, end)); { - if (true) - return content; - } - break; - default: - jj_la1[28] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("SimpleTableRef"); - } - } - - final public FromContent TableRef() throws ParseException { - trace_call("TableRef"); - try { - FromContent content; - content = SimpleTableRef(); - label_5: while(true) { - if (jj_2_3(2)) { - ; - } else { - break label_5; - } - content = JoinSpecification(content); - } - { - if (true) - return content; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("TableRef"); - } - } - - final public FromContent JoinedTable() throws ParseException { - trace_call("JoinedTable"); - try { - FromContent content; - content = SimpleTableRef(); - label_6: while(true) { - content = JoinSpecification(content); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NATURAL: - case INNER: - case RIGHT: - case LEFT: - case FULL: - case JOIN: - ; - break; - default: - jj_la1[29] = jj_gen; - break label_6; - } - } - { - if (true) - return content; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("JoinedTable"); - } - } - - final public ADQLJoin JoinSpecification(FromContent leftTable) throws ParseException { - trace_call("JoinSpecification"); - try { - boolean natural = false; - JoinType type = JoinType.INNER; - ClauseConstraints condition = new ClauseConstraints("ON"); - ArrayList lstColumns = new ArrayList(); - IdentifierItem id; - FromContent rightTable; - ADQLJoin join; - Token lastPar; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NATURAL: - jj_consume_token(NATURAL); - natural = true; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INNER: - case RIGHT: - case LEFT: - case FULL: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INNER: - jj_consume_token(INNER); - break; - case RIGHT: - case LEFT: - case FULL: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT: - jj_consume_token(LEFT); - type = JoinType.OUTER_LEFT; - break; - case RIGHT: - jj_consume_token(RIGHT); - type = JoinType.OUTER_RIGHT; - break; - case FULL: - jj_consume_token(FULL); - type = JoinType.OUTER_FULL; - break; - default: - jj_la1[30] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case OUTER: - jj_consume_token(OUTER); - break; - default: - jj_la1[31] = jj_gen; - ; - } - break; - default: - jj_la1[32] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - default: - jj_la1[33] = jj_gen; - ; - } - jj_consume_token(JOIN); - rightTable = SimpleTableRef(); - join = queryFactory.createJoin(type, leftTable, rightTable); - join.setPosition(new TextPosition(leftTable.getPosition(), rightTable.getPosition())); { - if (true) - return join; - } - break; - case INNER: - case RIGHT: - case LEFT: - case FULL: - case JOIN: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INNER: - case RIGHT: - case LEFT: - case FULL: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INNER: - jj_consume_token(INNER); - break; - case RIGHT: - case LEFT: - case FULL: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT: - jj_consume_token(LEFT); - type = JoinType.OUTER_LEFT; - break; - case RIGHT: - jj_consume_token(RIGHT); - type = JoinType.OUTER_RIGHT; - break; - case FULL: - jj_consume_token(FULL); - type = JoinType.OUTER_FULL; - break; - default: - jj_la1[34] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case OUTER: - jj_consume_token(OUTER); - break; - default: - jj_la1[35] = jj_gen; - ; - } - break; - default: - jj_la1[36] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - default: - jj_la1[37] = jj_gen; - ; - } - jj_consume_token(JOIN); - rightTable = SimpleTableRef(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ON: - jj_consume_token(ON); - ConditionsList(condition); - join = queryFactory.createJoin(type, leftTable, rightTable, condition); - join.setPosition(new TextPosition(leftTable.getPosition(), condition.getPosition())); { - if (true) - return join; - } - break; - case USING: - jj_consume_token(USING); - jj_consume_token(LEFT_PAR); - id = Identifier(); - lstColumns.add(queryFactory.createColumn(id)); - label_7: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[38] = jj_gen; - break label_7; - } - jj_consume_token(COMMA); - id = Identifier(); - lstColumns.add(queryFactory.createColumn(id)); - } - lastPar = jj_consume_token(RIGHT_PAR); - join = queryFactory.createJoin(type, leftTable, rightTable, lstColumns); - join.setPosition(new TextPosition(leftTable.getPosition().beginLine, leftTable.getPosition().beginColumn, lastPar.endLine, (lastPar.endColumn < 0) ? -1 : (lastPar.endColumn + 1))); { - if (true) - return join; - } - break; - default: - jj_la1[39] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - default: - jj_la1[40] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("JoinSpecification"); - } - } - - /* ****** */ - /* STRING */ - /* ****** */ - final public StringConstant String() throws ParseException { - trace_call("String"); - try { - Token t, start = null; - String str = ""; - StringConstant cst; - label_8: while(true) { - t = jj_consume_token(STRING_LITERAL); - str += t.image.substring(1, t.image.length() - 1).replaceAll("''", "'"); - if (start == null) - start = t; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case STRING_LITERAL: - ; - break; - default: - jj_la1[41] = jj_gen; - break label_8; - } - } - try { - cst = queryFactory.createStringConstant(str); - cst.setPosition(new TextPosition(start, t)); - { - if (true) - return cst; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("String"); - } - } - - /* ************* */ - /* NUMERIC TYPES */ - /* ************* */ - final public NumericConstant UnsignedNumeric() throws ParseException { - trace_call("UnsignedNumeric"); - try { - Token t; - NumericConstant cst; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SCIENTIFIC_NUMBER: - t = jj_consume_token(SCIENTIFIC_NUMBER); - break; - case UNSIGNED_FLOAT: - t = jj_consume_token(UNSIGNED_FLOAT); - break; - case UNSIGNED_INTEGER: - t = jj_consume_token(UNSIGNED_INTEGER); - break; - default: - jj_la1[42] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - try { - cst = queryFactory.createNumericConstant(t.image); - cst.setPosition(new TextPosition(t)); - { - if (true) - return cst; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("UnsignedNumeric"); - } - } - - final public NumericConstant UnsignedFloat() throws ParseException { - trace_call("UnsignedFloat"); - try { - Token t; - NumericConstant cst; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case UNSIGNED_INTEGER: - t = jj_consume_token(UNSIGNED_INTEGER); - break; - case UNSIGNED_FLOAT: - t = jj_consume_token(UNSIGNED_FLOAT); - break; - default: - jj_la1[43] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - try { - cst = queryFactory.createNumericConstant(t.image); - cst.setPosition(new TextPosition(t)); - { - if (true) - return cst; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("UnsignedFloat"); - } - } - - final public NumericConstant SignedInteger() throws ParseException { - trace_call("SignedInteger"); - try { - Token sign = null, number; - NumericConstant cst; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - case MINUS: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - sign = jj_consume_token(PLUS); - break; - case MINUS: - sign = jj_consume_token(MINUS); - break; - default: - jj_la1[44] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - default: - jj_la1[45] = jj_gen; - ; - } - number = jj_consume_token(UNSIGNED_INTEGER); - try { - if (sign == null) { - cst = queryFactory.createNumericConstant(number.image); - cst.setPosition(new TextPosition(number)); - } else { - cst = queryFactory.createNumericConstant(sign.image + number.image); - cst.setPosition(new TextPosition(sign, number)); - } - { - if (true) - return cst; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("SignedInteger"); - } - } - - /* *********** */ - /* EXPRESSIONS */ - /* *********** */ - final public ADQLOperand NumericValueExpressionPrimary() throws ParseException { - trace_call("NumericValueExpressionPrimary"); - try { - ADQLColumn column; - ADQLOperand op; - Token left, right; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SCIENTIFIC_NUMBER: - case UNSIGNED_FLOAT: - case UNSIGNED_INTEGER: - // unsigned_value_specification - op = UnsignedNumeric(); { - if (true) - return op; - } - break; - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - column = Column(); - column.setExpectedType('N'); { - if (true) - return column; - } - break; - case AVG: - case MAX: - case MIN: - case SUM: - case COUNT: - op = SqlFunction(); { - if (true) - return op; - } - break; - case LEFT_PAR: - left = jj_consume_token(LEFT_PAR); - op = NumericExpression(); - right = jj_consume_token(RIGHT_PAR); - WrappedOperand wop = queryFactory.createWrappedOperand(op); - wop.setPosition(new TextPosition(left, right)); { - if (true) - return wop; - } - break; - default: - jj_la1[46] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("NumericValueExpressionPrimary"); - } - } - - final public ADQLOperand StringValueExpressionPrimary() throws ParseException { - trace_call("StringValueExpressionPrimary"); - try { - StringConstant expr; - ADQLColumn column; - ADQLOperand op; - Token left, right; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case STRING_LITERAL: - // string - expr = String(); { - if (true) - return expr; - } - break; - case SCIENTIFIC_NUMBER: - case UNSIGNED_FLOAT: - case UNSIGNED_INTEGER: - op = UnsignedNumeric(); { - if (true) - return op; - } - break; - case AVG: - case MAX: - case MIN: - case SUM: - case COUNT: - op = SqlFunction(); { - if (true) - return op; - } - break; - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - column = Column(); - column.setExpectedType('*'); { - if (true) - return column; - } - break; - case LEFT_PAR: - left = jj_consume_token(LEFT_PAR); - op = ValueExpression(); - right = jj_consume_token(RIGHT_PAR); - WrappedOperand wop = queryFactory.createWrappedOperand(op); - wop.setPosition(new TextPosition(left, right)); { - if (true) - return wop; - } - break; - default: - jj_la1[47] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("StringValueExpressionPrimary"); - } - } - - final public ADQLOperand ValueExpression() throws ParseException { - trace_call("ValueExpression"); - try { - ADQLOperand valueExpr = null; - Token left, right; - try { - if (jj_2_4(2147483647)) { - valueExpr = NumericExpression(); - } else if (jj_2_5(2147483647)) { - valueExpr = StringExpression(); - } else if (jj_2_6(2147483647)) { - left = jj_consume_token(LEFT_PAR); - valueExpr = ValueExpression(); - right = jj_consume_token(RIGHT_PAR); - valueExpr = queryFactory.createWrappedOperand(valueExpr); - ((WrappedOperand)valueExpr).setPosition(new TextPosition(left, right)); - } else if (jj_2_7(2147483647)) { - valueExpr = UserDefinedFunction(); - } else if (jj_2_8(2)) { - valueExpr = GeometryValueFunction(); - } else if (jj_2_9(2147483647)) { - valueExpr = Column(); - } else if (jj_2_10(2147483647)) { - valueExpr = StringFactor(); - } else if (jj_2_11(3)) { - valueExpr = Factor(); - } else { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - valueExpr = Column(); - break; - default: - jj_la1[48] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - { - if (true) - return valueExpr; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("ValueExpression"); - } - } - - final public ADQLOperand NumericExpression() throws ParseException { - trace_call("NumericExpression"); - try { - Token sign = null; - ADQLOperand leftOp, rightOp = null; - leftOp = NumericTerm(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - case MINUS: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - sign = jj_consume_token(PLUS); - break; - case MINUS: - sign = jj_consume_token(MINUS); - break; - default: - jj_la1[49] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - rightOp = NumericExpression(); - break; - default: - jj_la1[50] = jj_gen; - ; - } - if (sign == null) { - if (true) - return leftOp; - } else { - try { - Operation operation = queryFactory.createOperation(leftOp, OperationType.getOperator(sign.image), rightOp); - operation.setPosition(new TextPosition(leftOp.getPosition(), rightOp.getPosition())); - { - if (true) - return operation; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("NumericExpression"); - } - } - - final public ADQLOperand NumericTerm() throws ParseException { - trace_call("NumericTerm"); - try { - Token sign = null; - ADQLOperand leftOp, rightOp = null; - leftOp = Factor(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASTERISK: - case DIVIDE: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASTERISK: - sign = jj_consume_token(ASTERISK); - break; - case DIVIDE: - sign = jj_consume_token(DIVIDE); - break; - default: - jj_la1[51] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - rightOp = NumericTerm(); - break; - default: - jj_la1[52] = jj_gen; - ; - } - if (sign == null) { - if (true) - return leftOp; - } else { - try { - Operation operation = queryFactory.createOperation(leftOp, OperationType.getOperator(sign.image), rightOp); - operation.setPosition(new TextPosition(leftOp.getPosition(), rightOp.getPosition())); - { - if (true) - return operation; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("NumericTerm"); - } - } - - final public ADQLOperand Factor() throws ParseException { - trace_call("Factor"); - try { - boolean negative = false; - Token minusSign = null; - ADQLOperand op; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - case MINUS: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - jj_consume_token(PLUS); - break; - case MINUS: - minusSign = jj_consume_token(MINUS); - negative = true; - break; - default: - jj_la1[53] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - default: - jj_la1[54] = jj_gen; - ; - } - if (jj_2_12(2)) { - op = NumericFunction(); - } else { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT_PAR: - case AVG: - case MAX: - case MIN: - case SUM: - case COUNT: - case SCIENTIFIC_NUMBER: - case UNSIGNED_FLOAT: - case UNSIGNED_INTEGER: - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - op = NumericValueExpressionPrimary(); - break; - default: - jj_la1[55] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - if (negative) { - try { - TextPosition position = op.getPosition(); - op = queryFactory.createNegativeOperand(op); - NegativeOperand negativeOp = (NegativeOperand)op; - if (minusSign != null) - negativeOp.setPosition(new TextPosition(minusSign.beginLine, minusSign.beginColumn, position.endLine, position.endColumn)); - else - negativeOp.setPosition(position); - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - } - - { - if (true) - return op; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("Factor"); - } - } - - final public ADQLOperand StringExpression() throws ParseException { - trace_call("StringExpression"); - try { - ADQLOperand leftOp; - ADQLOperand rightOp = null; - leftOp = StringFactor(); - label_9: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CONCAT: - ; - break; - default: - jj_la1[56] = jj_gen; - break label_9; - } - jj_consume_token(CONCAT); - rightOp = StringFactor(); - if (!(leftOp instanceof Concatenation)) { - try { - ADQLOperand temp = leftOp; - leftOp = queryFactory.createConcatenation(); - ((Concatenation)leftOp).add(temp); - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - } - ((Concatenation)leftOp).add(rightOp); - } - if (leftOp instanceof Concatenation) { - Concatenation concat = (Concatenation)leftOp; - concat.setPosition(new TextPosition(concat.get(0).getPosition(), concat.get(concat.size() - 1).getPosition())); - } - { - if (true) - return leftOp; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("StringExpression"); - } - } - - final public ADQLOperand StringFactor() throws ParseException { - trace_call("StringFactor"); - try { - ADQLOperand op; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COORDSYS: - op = ExtractCoordSys(); - break; - default: - jj_la1[57] = jj_gen; - if (jj_2_13(2)) { - op = UserDefinedFunction(); - ((UserDefinedFunction)op).setExpectedType('S'); - } else { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT_PAR: - case AVG: - case MAX: - case MIN: - case SUM: - case COUNT: - case STRING_LITERAL: - case SCIENTIFIC_NUMBER: - case UNSIGNED_FLOAT: - case UNSIGNED_INTEGER: - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - op = StringValueExpressionPrimary(); - break; - default: - jj_la1[58] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - { - if (true) - return op; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("StringFactor"); - } - } - - final public GeometryValue GeometryExpression() throws ParseException { - trace_call("GeometryExpression"); - try { - ADQLColumn col = null; - GeometryFunction gf = null; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - col = Column(); - break; - case BOX: - case CENTROID: - case CIRCLE: - case POINT: - case POLYGON: - case REGION: - gf = GeometryValueFunction(); - break; - default: - jj_la1[59] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (col != null) { - col.setExpectedType('G'); - { - if (true) - return new GeometryValue(col); - } - } else { - if (true) - return new GeometryValue(gf); - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("GeometryExpression"); - } - } - - /* ********************************** */ - /* BOOLEAN EXPRESSIONS (WHERE clause) */ - /* ********************************** */ - final public ClauseConstraints ConditionsList(ClauseConstraints clause) throws ParseException { - trace_call("ConditionsList"); - try { - ADQLConstraint constraint = null; - Token op = null; - boolean notOp = false; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NOT: - op = jj_consume_token(NOT); - notOp = true; - break; - default: - jj_la1[60] = jj_gen; - ; - } - constraint = Constraint(); - if (notOp) { - TextPosition oldPos = constraint.getPosition(); - constraint = queryFactory.createNot(constraint); - ((NotConstraint)constraint).setPosition(new TextPosition(op.beginLine, op.beginColumn, oldPos.endLine, oldPos.endColumn)); - } - notOp = false; - - if (clause instanceof ADQLConstraint) - clause.add(constraint); - else - clause.add(constraint); - label_10: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AND: - case OR: - ; - break; - default: - jj_la1[61] = jj_gen; - break label_10; - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AND: - op = jj_consume_token(AND); - break; - case OR: - op = jj_consume_token(OR); - break; - default: - jj_la1[62] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NOT: - jj_consume_token(NOT); - notOp = true; - break; - default: - jj_la1[63] = jj_gen; - ; - } - constraint = Constraint(); - if (notOp) { - TextPosition oldPos = constraint.getPosition(); - constraint = queryFactory.createNot(constraint); - ((NotConstraint)constraint).setPosition(new TextPosition(op.beginLine, op.beginColumn, oldPos.endLine, oldPos.endColumn)); - } - notOp = false; - - if (clause instanceof ADQLConstraint) - clause.add(op.image, constraint); - else - clause.add(op.image, constraint); - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - if (!clause.isEmpty()) { - TextPosition start = clause.get(0).getPosition(); - TextPosition end = clause.get(clause.size() - 1).getPosition(); - clause.setPosition(new TextPosition(start, end)); - } - { - if (true) - return clause; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("ConditionsList"); - } - } - - final public ADQLConstraint Constraint() throws ParseException { - trace_call("Constraint"); - try { - ADQLConstraint constraint = null; - Token start, end; - if (jj_2_14(2147483647)) { - constraint = Predicate(); - } else { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT_PAR: - start = jj_consume_token(LEFT_PAR); - try { - constraint = queryFactory.createGroupOfConstraints(); - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - ConditionsList((ConstraintsGroup)constraint); - end = jj_consume_token(RIGHT_PAR); - ((ConstraintsGroup)constraint).setPosition(new TextPosition(start, end)); - break; - default: - jj_la1[64] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - { - if (true) - return constraint; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("Constraint"); - } - } - - final public ADQLConstraint Predicate() throws ParseException { - trace_call("Predicate"); - try { - ADQLQuery q = null; - ADQLColumn column = null; - ADQLOperand strExpr1 = null, strExpr2 = null; - ADQLOperand op; - Token start, notToken = null, end; - ADQLConstraint constraint = null; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EXISTS: - start = jj_consume_token(EXISTS); - q = SubQueryExpression(); - Exists e = queryFactory.createExists(q); - e.setPosition(new TextPosition(start.beginLine, start.beginColumn, q.getPosition().endLine, q.getPosition().endColumn)); { - if (true) - return e; - } - break; - default: - jj_la1[69] = jj_gen; - if (jj_2_16(2147483647)) { - column = Column(); - jj_consume_token(IS); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NOT: - notToken = jj_consume_token(NOT); - break; - default: - jj_la1[65] = jj_gen; - ; - } - end = jj_consume_token(NULL); - IsNull in = queryFactory.createIsNull((notToken != null), column); - in.setPosition(new TextPosition(column.getPosition().beginLine, column.getPosition().beginColumn, end.endLine, (end.endColumn < 0) ? -1 : (end.endColumn + 1))); - { - if (true) - return in; - } - } else if (jj_2_17(2147483647)) { - strExpr1 = StringExpression(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NOT: - notToken = jj_consume_token(NOT); - break; - default: - jj_la1[66] = jj_gen; - ; - } - jj_consume_token(LIKE); - strExpr2 = StringExpression(); - Comparison comp = queryFactory.createComparison(strExpr1, (notToken == null) ? ComparisonOperator.LIKE : ComparisonOperator.NOTLIKE, strExpr2); - comp.setPosition(new TextPosition(strExpr1.getPosition(), strExpr2.getPosition())); - { - if (true) - return comp; - } - } else { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT_PAR: - case PLUS: - case MINUS: - case AVG: - case MAX: - case MIN: - case SUM: - case COUNT: - case BOX: - case CENTROID: - case CIRCLE: - case POINT: - case POLYGON: - case REGION: - case CONTAINS: - case INTERSECTS: - case AREA: - case COORD1: - case COORD2: - case COORDSYS: - case DISTANCE: - case ABS: - case CEILING: - case DEGREES: - case EXP: - case FLOOR: - case LOG: - case LOG10: - case MOD: - case PI: - case POWER: - case RADIANS: - case RAND: - case ROUND: - case SQRT: - case TRUNCATE: - case ACOS: - case ASIN: - case ATAN: - case ATAN2: - case COS: - case COT: - case SIN: - case TAN: - case STRING_LITERAL: - case SCIENTIFIC_NUMBER: - case UNSIGNED_FLOAT: - case UNSIGNED_INTEGER: - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - op = ValueExpression(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EQUAL: - case NOT_EQUAL: - case LESS_THAN: - case LESS_EQUAL_THAN: - case GREATER_THAN: - case GREATER_EQUAL_THAN: - constraint = ComparisonEnd(op); - break; - default: - jj_la1[67] = jj_gen; - if (jj_2_15(2)) { - constraint = BetweenEnd(op); - } else { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NOT: - case IN: - constraint = InEnd(op); - break; - default: - jj_la1[68] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - break; - default: - jj_la1[70] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - { - if (true) - return constraint; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("Predicate"); - } - } - - final public Comparison ComparisonEnd(ADQLOperand leftOp) throws ParseException { - trace_call("ComparisonEnd"); - try { - Token comp; - ADQLOperand rightOp; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EQUAL: - comp = jj_consume_token(EQUAL); - break; - case NOT_EQUAL: - comp = jj_consume_token(NOT_EQUAL); - break; - case LESS_THAN: - comp = jj_consume_token(LESS_THAN); - break; - case LESS_EQUAL_THAN: - comp = jj_consume_token(LESS_EQUAL_THAN); - break; - case GREATER_THAN: - comp = jj_consume_token(GREATER_THAN); - break; - case GREATER_EQUAL_THAN: - comp = jj_consume_token(GREATER_EQUAL_THAN); - break; - default: - jj_la1[71] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - rightOp = ValueExpression(); - try { - Comparison comparison = queryFactory.createComparison(leftOp, ComparisonOperator.getOperator(comp.image), rightOp); - comparison.setPosition(new TextPosition(leftOp.getPosition(), rightOp.getPosition())); - { - if (true) - return comparison; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("ComparisonEnd"); - } - } - - final public Between BetweenEnd(ADQLOperand leftOp) throws ParseException { - trace_call("BetweenEnd"); - try { - Token start, notToken = null; - ADQLOperand min, max; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NOT: - notToken = jj_consume_token(NOT); - break; - default: - jj_la1[72] = jj_gen; - ; - } - start = jj_consume_token(BETWEEN); - min = ValueExpression(); - jj_consume_token(AND); - max = ValueExpression(); - try { - Between bet = queryFactory.createBetween((notToken != null), leftOp, min, max); - if (notToken != null) - start = notToken; - bet.setPosition(new TextPosition(start.beginLine, start.beginColumn, max.getPosition().endLine, max.getPosition().endColumn)); - { - if (true) - return bet; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("BetweenEnd"); - } - } - - final public In InEnd(ADQLOperand leftOp) throws ParseException { - trace_call("InEnd"); - try { - Token not = null, start; - ADQLQuery q = null; - ADQLOperand item; - Vector items = new Vector(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NOT: - not = jj_consume_token(NOT); - break; - default: - jj_la1[73] = jj_gen; - ; - } - start = jj_consume_token(IN); - if (jj_2_18(2)) { - q = SubQueryExpression(); - } else { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT_PAR: - jj_consume_token(LEFT_PAR); - item = ValueExpression(); - items.add(item); - label_11: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[74] = jj_gen; - break label_11; - } - jj_consume_token(COMMA); - item = ValueExpression(); - items.add(item); - } - jj_consume_token(RIGHT_PAR); - break; - default: - jj_la1[75] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - try { - In in; - start = (not != null) ? not : start; - if (q != null) { - in = queryFactory.createIn(leftOp, q, not != null); - in.setPosition(new TextPosition(start.beginLine, start.beginColumn, q.getPosition().endLine, q.getPosition().endColumn)); - } else { - ADQLOperand[] list = new ADQLOperand[items.size()]; - int i = 0; - for(ADQLOperand op : items) - list[i++] = op; - in = queryFactory.createIn(leftOp, list, not != null); - in.setPosition(new TextPosition(start.beginLine, start.beginColumn, list[list.length - 1].getPosition().endLine, list[list.length - 1].getPosition().endColumn)); - } - { - if (true) - return in; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("InEnd"); - } - } - - /* ************* */ - /* SQL FUNCTIONS */ - /* ************* */ - final public SQLFunction SqlFunction() throws ParseException { - trace_call("SqlFunction"); - try { - Token fct, all = null, distinct = null, end; - ADQLOperand op = null; - SQLFunction funct = null; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COUNT: - fct = jj_consume_token(COUNT); - jj_consume_token(LEFT_PAR); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case QUANTIFIER: - distinct = jj_consume_token(QUANTIFIER); - break; - default: - jj_la1[76] = jj_gen; - ; - } - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASTERISK: - all = jj_consume_token(ASTERISK); - break; - case LEFT_PAR: - case PLUS: - case MINUS: - case AVG: - case MAX: - case MIN: - case SUM: - case COUNT: - case BOX: - case CENTROID: - case CIRCLE: - case POINT: - case POLYGON: - case REGION: - case CONTAINS: - case INTERSECTS: - case AREA: - case COORD1: - case COORD2: - case COORDSYS: - case DISTANCE: - case ABS: - case CEILING: - case DEGREES: - case EXP: - case FLOOR: - case LOG: - case LOG10: - case MOD: - case PI: - case POWER: - case RADIANS: - case RAND: - case ROUND: - case SQRT: - case TRUNCATE: - case ACOS: - case ASIN: - case ATAN: - case ATAN2: - case COS: - case COT: - case SIN: - case TAN: - case STRING_LITERAL: - case SCIENTIFIC_NUMBER: - case UNSIGNED_FLOAT: - case UNSIGNED_INTEGER: - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - op = ValueExpression(); - break; - default: - jj_la1[77] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - end = jj_consume_token(RIGHT_PAR); - funct = queryFactory.createSQLFunction((all != null) ? SQLFunctionType.COUNT_ALL : SQLFunctionType.COUNT, op, distinct != null && distinct.image.equalsIgnoreCase("distinct")); - funct.setPosition(new TextPosition(fct, end)); - break; - case AVG: - case MAX: - case MIN: - case SUM: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AVG: - fct = jj_consume_token(AVG); - break; - case MAX: - fct = jj_consume_token(MAX); - break; - case MIN: - fct = jj_consume_token(MIN); - break; - case SUM: - fct = jj_consume_token(SUM); - break; - default: - jj_la1[78] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - jj_consume_token(LEFT_PAR); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case QUANTIFIER: - distinct = jj_consume_token(QUANTIFIER); - break; - default: - jj_la1[79] = jj_gen; - ; - } - op = ValueExpression(); - end = jj_consume_token(RIGHT_PAR); - funct = queryFactory.createSQLFunction(SQLFunctionType.valueOf(fct.image.toUpperCase()), op, distinct != null && distinct.image.equalsIgnoreCase("distinct")); - funct.setPosition(new TextPosition(fct, end)); - break; - default: - jj_la1[80] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - { - if (true) - return funct; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("SqlFunction"); - } - } - - /* ************** */ - /* ADQL FUNCTIONS */ - /* ************** */ - final public ADQLOperand[] Coordinates() throws ParseException { - trace_call("Coordinates"); - try { - ADQLOperand[] ops = new ADQLOperand[2]; - ops[0] = NumericExpression(); - jj_consume_token(COMMA); - ops[1] = NumericExpression(); - { - if (true) - return ops; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("Coordinates"); - } - } - - final public GeometryFunction GeometryFunction() throws ParseException { - trace_call("GeometryFunction"); - try { - Token fct = null, end; - GeometryValue gvf1, gvf2; - GeometryValue gvp1, gvp2; - GeometryFunction gf = null; - PointFunction p1 = null, p2 = null; - ADQLColumn col1 = null, col2 = null; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CONTAINS: - case INTERSECTS: - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CONTAINS: - fct = jj_consume_token(CONTAINS); - break; - case INTERSECTS: - fct = jj_consume_token(INTERSECTS); - break; - default: - jj_la1[81] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - jj_consume_token(LEFT_PAR); - gvf1 = GeometryExpression(); - jj_consume_token(COMMA); - gvf2 = GeometryExpression(); - end = jj_consume_token(RIGHT_PAR); - if (fct.image.equalsIgnoreCase("contains")) - gf = queryFactory.createContains(gvf1, gvf2); - else - gf = queryFactory.createIntersects(gvf1, gvf2); - break; - case AREA: - fct = jj_consume_token(AREA); - jj_consume_token(LEFT_PAR); - gvf1 = GeometryExpression(); - end = jj_consume_token(RIGHT_PAR); - gf = queryFactory.createArea(gvf1); - break; - case COORD1: - fct = jj_consume_token(COORD1); - jj_consume_token(LEFT_PAR); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case POINT: - p1 = Point(); - gf = queryFactory.createCoord1(p1); - break; - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - col1 = Column(); - col1.setExpectedType('G'); - gf = queryFactory.createCoord1(col1); - break; - default: - jj_la1[82] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - end = jj_consume_token(RIGHT_PAR); - break; - case COORD2: - fct = jj_consume_token(COORD2); - jj_consume_token(LEFT_PAR); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case POINT: - p1 = Point(); - gf = queryFactory.createCoord2(p1); - break; - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - col1 = Column(); - col1.setExpectedType('G'); - gf = queryFactory.createCoord2(col1); - break; - default: - jj_la1[83] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - end = jj_consume_token(RIGHT_PAR); - break; - case DISTANCE: - fct = jj_consume_token(DISTANCE); - jj_consume_token(LEFT_PAR); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case POINT: - p1 = Point(); - break; - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - col1 = Column(); - break; - default: - jj_la1[84] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (p1 != null) - gvp1 = new GeometryValue(p1); - else { - col1.setExpectedType('G'); - gvp1 = new GeometryValue(col1); - } - jj_consume_token(COMMA); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case POINT: - p2 = Point(); - break; - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - col2 = Column(); - break; - default: - jj_la1[85] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (p2 != null) - gvp2 = new GeometryValue(p2); - else { - col2.setExpectedType('G'); - gvp2 = new GeometryValue(col2); - } - end = jj_consume_token(RIGHT_PAR); - gf = queryFactory.createDistance(gvp1, gvp2); - break; - default: - jj_la1[86] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - gf.setPosition(new TextPosition(fct, end)); - { - if (true) - return gf; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("GeometryFunction"); - } - } - - final public ADQLOperand CoordinateSystem() throws ParseException { - trace_call("CoordinateSystem"); - try { - ADQLOperand coordSys = null; - coordSys = StringExpression(); - { - if (true) - return coordSys; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("CoordinateSystem"); - } - } - - final public GeometryFunction GeometryValueFunction() throws ParseException { - trace_call("GeometryValueFunction"); - try { - Token fct = null, end = null; - ADQLOperand coordSys; - ADQLOperand width, height; - ADQLOperand[] coords, tmp; - Vector vCoords; - ADQLOperand op = null; - GeometryValue gvf = null; - GeometryFunction gf = null; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOX: - fct = jj_consume_token(BOX); - jj_consume_token(LEFT_PAR); - coordSys = CoordinateSystem(); - jj_consume_token(COMMA); - coords = Coordinates(); - jj_consume_token(COMMA); - width = NumericExpression(); - jj_consume_token(COMMA); - height = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - gf = queryFactory.createBox(coordSys, coords[0], coords[1], width, height); - break; - case CENTROID: - fct = jj_consume_token(CENTROID); - jj_consume_token(LEFT_PAR); - gvf = GeometryExpression(); - end = jj_consume_token(RIGHT_PAR); - gf = queryFactory.createCentroid(gvf); - break; - case CIRCLE: - fct = jj_consume_token(CIRCLE); - jj_consume_token(LEFT_PAR); - coordSys = CoordinateSystem(); - jj_consume_token(COMMA); - coords = Coordinates(); - jj_consume_token(COMMA); - width = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - gf = queryFactory.createCircle(coordSys, coords[0], coords[1], width); - break; - case POINT: - gf = Point(); - break; - case POLYGON: - fct = jj_consume_token(POLYGON); - jj_consume_token(LEFT_PAR); - coordSys = CoordinateSystem(); - vCoords = new Vector(); - jj_consume_token(COMMA); - tmp = Coordinates(); - vCoords.add(tmp[0]); - vCoords.add(tmp[1]); - jj_consume_token(COMMA); - tmp = Coordinates(); - vCoords.add(tmp[0]); - vCoords.add(tmp[1]); - jj_consume_token(COMMA); - tmp = Coordinates(); - vCoords.add(tmp[0]); - vCoords.add(tmp[1]); - label_12: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[87] = jj_gen; - break label_12; - } - jj_consume_token(COMMA); - tmp = Coordinates(); - vCoords.add(tmp[0]); - vCoords.add(tmp[1]); - } - end = jj_consume_token(RIGHT_PAR); - gf = queryFactory.createPolygon(coordSys, vCoords); - break; - case REGION: - fct = jj_consume_token(REGION); - jj_consume_token(LEFT_PAR); - op = StringExpression(); - end = jj_consume_token(RIGHT_PAR); - gf = queryFactory.createRegion(op); - break; - default: - jj_la1[88] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - if (fct != null && end != null) // = !(gf instanceof Point) - gf.setPosition(new TextPosition(fct, end)); - { - if (true) - return gf; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("GeometryValueFunction"); - } - } - - final public PointFunction Point() throws ParseException { - trace_call("Point"); - try { - Token start, end; - ADQLOperand coordSys; - ADQLOperand[] coords; - start = jj_consume_token(POINT); - jj_consume_token(LEFT_PAR); - coordSys = CoordinateSystem(); - jj_consume_token(COMMA); - coords = Coordinates(); - end = jj_consume_token(RIGHT_PAR); - try { - PointFunction pf = queryFactory.createPoint(coordSys, coords[0], coords[1]); - pf.setPosition(new TextPosition(start, end)); - { - if (true) - return pf; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("Point"); - } - } - - final public GeometryFunction ExtractCoordSys() throws ParseException { - trace_call("ExtractCoordSys"); - try { - Token start, end; - GeometryValue gvf; - start = jj_consume_token(COORDSYS); - jj_consume_token(LEFT_PAR); - gvf = GeometryExpression(); - end = jj_consume_token(RIGHT_PAR); - try { - GeometryFunction gf = queryFactory.createExtractCoordSys(gvf); - gf.setPosition(new TextPosition(start, end)); - { - if (true) - return gf; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("ExtractCoordSys"); - } - } - - /* ***************** */ - /* NUMERIC FUNCTIONS */ - /* ***************** */ - final public ADQLFunction NumericFunction() throws ParseException { - trace_call("NumericFunction"); - try { - ADQLFunction fct; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABS: - case CEILING: - case DEGREES: - case EXP: - case FLOOR: - case LOG: - case LOG10: - case MOD: - case PI: - case POWER: - case RADIANS: - case RAND: - case ROUND: - case SQRT: - case TRUNCATE: - fct = MathFunction(); - break; - case ACOS: - case ASIN: - case ATAN: - case ATAN2: - case COS: - case COT: - case SIN: - case TAN: - fct = TrigFunction(); - break; - case CONTAINS: - case INTERSECTS: - case AREA: - case COORD1: - case COORD2: - case DISTANCE: - fct = GeometryFunction(); - break; - case REGULAR_IDENTIFIER_CANDIDATE: - fct = UserDefinedFunction(); - ((UserDefinedFunction)fct).setExpectedType('N'); - break; - default: - jj_la1[89] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - { - if (true) - return fct; - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("NumericFunction"); - } - } - - final public MathFunction MathFunction() throws ParseException { - trace_call("MathFunction"); - try { - Token fct = null, end; - ADQLOperand param1 = null, param2 = null; - NumericConstant integerValue = null; - try { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABS: - fct = jj_consume_token(ABS); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case CEILING: - fct = jj_consume_token(CEILING); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case DEGREES: - fct = jj_consume_token(DEGREES); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case EXP: - fct = jj_consume_token(EXP); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case FLOOR: - fct = jj_consume_token(FLOOR); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case LOG: - fct = jj_consume_token(LOG); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case LOG10: - fct = jj_consume_token(LOG10); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case MOD: - fct = jj_consume_token(MOD); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - jj_consume_token(COMMA); - param2 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case PI: - fct = jj_consume_token(PI); - jj_consume_token(LEFT_PAR); - end = jj_consume_token(RIGHT_PAR); - break; - case POWER: - fct = jj_consume_token(POWER); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - jj_consume_token(COMMA); - param2 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case RADIANS: - fct = jj_consume_token(RADIANS); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case RAND: - fct = jj_consume_token(RAND); - jj_consume_token(LEFT_PAR); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT_PAR: - case PLUS: - case MINUS: - case AVG: - case MAX: - case MIN: - case SUM: - case COUNT: - case CONTAINS: - case INTERSECTS: - case AREA: - case COORD1: - case COORD2: - case DISTANCE: - case ABS: - case CEILING: - case DEGREES: - case EXP: - case FLOOR: - case LOG: - case LOG10: - case MOD: - case PI: - case POWER: - case RADIANS: - case RAND: - case ROUND: - case SQRT: - case TRUNCATE: - case ACOS: - case ASIN: - case ATAN: - case ATAN2: - case COS: - case COT: - case SIN: - case TAN: - case SCIENTIFIC_NUMBER: - case UNSIGNED_FLOAT: - case UNSIGNED_INTEGER: - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - param1 = NumericExpression(); - break; - default: - jj_la1[90] = jj_gen; - ; - } - end = jj_consume_token(RIGHT_PAR); - break; - case ROUND: - fct = jj_consume_token(ROUND); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - jj_consume_token(COMMA); - param2 = SignedInteger(); - break; - default: - jj_la1[91] = jj_gen; - ; - } - end = jj_consume_token(RIGHT_PAR); - break; - case SQRT: - fct = jj_consume_token(SQRT); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case TRUNCATE: - fct = jj_consume_token(TRUNCATE); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - jj_consume_token(COMMA); - param2 = SignedInteger(); - break; - default: - jj_la1[92] = jj_gen; - ; - } - end = jj_consume_token(RIGHT_PAR); - break; - default: - jj_la1[93] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - MathFunction mf = queryFactory.createMathFunction(MathFunctionType.valueOf(fct.image.toUpperCase()), param1, param2); - mf.setPosition(new TextPosition(fct, end)); - { - if (true) - return mf; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("MathFunction"); - } - } - - final public MathFunction TrigFunction() throws ParseException { - trace_call("TrigFunction"); - try { - Token fct = null, end; - ADQLOperand param1 = null, param2 = null; - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ACOS: - fct = jj_consume_token(ACOS); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case ASIN: - fct = jj_consume_token(ASIN); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case ATAN: - fct = jj_consume_token(ATAN); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case ATAN2: - fct = jj_consume_token(ATAN2); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - jj_consume_token(COMMA); - param2 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case COS: - fct = jj_consume_token(COS); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case COT: - fct = jj_consume_token(COT); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case SIN: - fct = jj_consume_token(SIN); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - case TAN: - fct = jj_consume_token(TAN); - jj_consume_token(LEFT_PAR); - param1 = NumericExpression(); - end = jj_consume_token(RIGHT_PAR); - break; - default: - jj_la1[94] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - try { - MathFunction mf = queryFactory.createMathFunction(MathFunctionType.valueOf(fct.image.toUpperCase()), param1, param2); - mf.setPosition(new TextPosition(fct, end)); - { - if (true) - return mf; - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("TrigFunction"); - } - } - - final public UserDefinedFunction UserDefinedFunction() throws ParseException { - trace_call("UserDefinedFunction"); - try { - Token fct, end; - Vector params = new Vector(); - ADQLOperand op; - fct = jj_consume_token(REGULAR_IDENTIFIER_CANDIDATE); - jj_consume_token(LEFT_PAR); - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LEFT_PAR: - case PLUS: - case MINUS: - case AVG: - case MAX: - case MIN: - case SUM: - case COUNT: - case BOX: - case CENTROID: - case CIRCLE: - case POINT: - case POLYGON: - case REGION: - case CONTAINS: - case INTERSECTS: - case AREA: - case COORD1: - case COORD2: - case COORDSYS: - case DISTANCE: - case ABS: - case CEILING: - case DEGREES: - case EXP: - case FLOOR: - case LOG: - case LOG10: - case MOD: - case PI: - case POWER: - case RADIANS: - case RAND: - case ROUND: - case SQRT: - case TRUNCATE: - case ACOS: - case ASIN: - case ATAN: - case ATAN2: - case COS: - case COT: - case SIN: - case TAN: - case STRING_LITERAL: - case SCIENTIFIC_NUMBER: - case UNSIGNED_FLOAT: - case UNSIGNED_INTEGER: - case DELIMITED_IDENTIFIER: - case REGULAR_IDENTIFIER_CANDIDATE: - op = ValueExpression(); - params.add(op); - label_13: while(true) { - switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[95] = jj_gen; - break label_13; - } - jj_consume_token(COMMA); - op = ValueExpression(); - params.add(op); - } - break; - default: - jj_la1[96] = jj_gen; - ; - } - end = jj_consume_token(RIGHT_PAR); - // Ensure the given function name is valid: - if (!isRegularIdentifier(fct.image)) { - if (true) - throw new ParseException("Invalid (User Defined) Function name: \u005c"" + fct.image + "\u005c"!", new TextPosition(fct)); - } - - //System.out.println("INFO [ADQLParser]: \""+fct.image+"\" (from line "+fct.beginLine+" and column "+fct.beginColumn+" to line "+token.endLine+" and column "+(token.endColumn+1)+") is considered as an user defined function !"); - - try { - // Build the parameters list: - ADQLOperand[] parameters = new ADQLOperand[params.size()]; - for(int i = 0; i < params.size(); i++) - parameters[i] = params.get(i); - - // Create the UDF function: - UserDefinedFunction udf = queryFactory.createUserDefinedFunction(fct.image, parameters); - udf.setPosition(new TextPosition(fct, end)); - { - if (true) - return udf; - } - - } catch(UnsupportedOperationException uoe) { - /* This catch clause is just for backward compatibility: - * if the createUserDefinedFunction(...) is overridden and - * the function can not be identified a such exception may be thrown). */ - { - if (true) - throw new ParseException(uoe.getMessage(), new TextPosition(fct, token)); - } - } catch(Exception ex) { - { - if (true) - throw generateParseException(ex); - } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("UserDefinedFunction"); - } - } - - 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_3R_76() { - if (jj_scan_token(LEFT_PAR)) - return true; - return false; - } - - private boolean jj_3_3() { - if (jj_3R_17()) - return true; - return false; - } - - private boolean jj_3_16() { - if (jj_3R_22()) - return true; - if (jj_scan_token(IS)) - return true; - return false; - } - - private boolean jj_3R_134() { - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_51()) - return true; - return false; - } - - private boolean jj_3_2() { - if (jj_3R_16()) - return true; - return false; - } - - private boolean jj_3R_75() { - if (jj_3R_79()) - return true; - return false; - } - - private boolean jj_3R_27() { - if (jj_3R_51()) - return true; - return false; - } - - private boolean jj_3R_56() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_75()) { - jj_scanpos = xsp; - if (jj_3_2()) { - jj_scanpos = xsp; - if (jj_3R_76()) - return true; - } - } - return false; - } - - private boolean jj_3_14() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(42)) { - jj_scanpos = xsp; - if (jj_3R_27()) - return true; - } - return false; - } - - private boolean jj_3R_120() { - if (jj_3R_51()) - return true; - Token xsp; - while(true) { - xsp = jj_scanpos; - if (jj_3R_134()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - private boolean jj_3R_60() { - if (jj_scan_token(DOT)) - return true; - if (jj_3R_79()) - return true; - return false; - } - - private boolean jj_3R_22() { - if (jj_3R_43()) - return true; - return false; - } - - private boolean jj_3R_150() { - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_153()) - return true; - return false; - } - - private boolean jj_3R_149() { - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_153()) - return true; - return false; - } - - private boolean jj_3R_43() { - if (jj_3R_14()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_60()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_127() { - if (jj_scan_token(DOT)) - return true; - if (jj_3R_14()) - return true; - return false; - } - - private boolean jj_3R_126() { - if (jj_scan_token(DOT)) - return true; - if (jj_3R_14()) - return true; - return false; - } - - private boolean jj_3R_79() { - if (jj_3R_14()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_126()) - jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_127()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_31() { - if (jj_scan_token(DELIMITED_IDENTIFIER)) - return true; - return false; - } - - private boolean jj_3R_133() { - if (jj_3R_21()) - return true; - return false; - } - - private boolean jj_3R_30() { - if (jj_scan_token(REGULAR_IDENTIFIER_CANDIDATE)) - return true; - return false; - } - - private boolean jj_3R_26() { - if (jj_scan_token(REGULAR_IDENTIFIER_CANDIDATE)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_120()) - jj_scanpos = xsp; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_141() { - if (jj_3R_112()) - return true; - return false; - } - - private boolean jj_3R_14() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_30()) { - jj_scanpos = xsp; - if (jj_3R_31()) - return true; - } - return false; - } - - private boolean jj_3R_132() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3R_119() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_132()) { - jj_scanpos = xsp; - if (jj_3R_133()) - return true; - } - return false; - } - - private boolean jj_3R_106() { - if (jj_scan_token(TAN)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_105() { - if (jj_scan_token(SIN)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_58() { - if (jj_3R_78()) - return true; - return false; - } - - private boolean jj_3R_104() { - if (jj_scan_token(COT)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3_13() { - if (jj_3R_26()) - return true; - return false; - } - - private boolean jj_3R_103() { - if (jj_scan_token(COS)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_102() { - if (jj_scan_token(ATAN2)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_57() { - if (jj_3R_77()) - return true; - return false; - } - - private boolean jj_3R_101() { - if (jj_scan_token(ATAN)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_36() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_57()) { - jj_scanpos = xsp; - if (jj_3_13()) { - jj_scanpos = xsp; - if (jj_3R_58()) - return true; - } - } - return false; - } - - private boolean jj_3R_100() { - if (jj_scan_token(ASIN)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_99() { - if (jj_scan_token(ACOS)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_64() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_99()) { - jj_scanpos = xsp; - if (jj_3R_100()) { - jj_scanpos = xsp; - if (jj_3R_101()) { - jj_scanpos = xsp; - if (jj_3R_102()) { - jj_scanpos = xsp; - if (jj_3R_103()) { - jj_scanpos = xsp; - if (jj_3R_104()) { - jj_scanpos = xsp; - if (jj_3R_105()) { - jj_scanpos = xsp; - if (jj_3R_106()) - return true; - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_46() { - if (jj_3R_62()) - return true; - return false; - } - - private boolean jj_3R_98() { - if (jj_scan_token(TRUNCATE)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_150()) - jj_scanpos = xsp; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_97() { - if (jj_scan_token(SQRT)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_96() { - if (jj_scan_token(ROUND)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_149()) - jj_scanpos = xsp; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_95() { - if (jj_scan_token(RAND)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_141()) - jj_scanpos = xsp; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_94() { - if (jj_scan_token(RADIANS)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_93() { - if (jj_scan_token(POWER)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_92() { - if (jj_scan_token(PI)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_91() { - if (jj_scan_token(MOD)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_90() { - if (jj_scan_token(LOG10)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_89() { - if (jj_scan_token(LOG)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_88() { - if (jj_scan_token(FLOOR)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_87() { - if (jj_scan_token(EXP)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_52() { - if (jj_scan_token(CONCAT)) - return true; - if (jj_3R_36()) - return true; - return false; - } - - private boolean jj_3R_86() { - if (jj_scan_token(DEGREES)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_85() { - if (jj_scan_token(CEILING)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_84() { - if (jj_scan_token(ABS)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_29() { - if (jj_3R_36()) - return true; - Token xsp; - while(true) { - xsp = jj_scanpos; - if (jj_3R_52()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - private boolean jj_3R_63() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_84()) { - jj_scanpos = xsp; - if (jj_3R_85()) { - jj_scanpos = xsp; - if (jj_3R_86()) { - jj_scanpos = xsp; - if (jj_3R_87()) { - jj_scanpos = xsp; - if (jj_3R_88()) { - jj_scanpos = xsp; - if (jj_3R_89()) { - jj_scanpos = xsp; - if (jj_3R_90()) { - jj_scanpos = xsp; - if (jj_3R_91()) { - jj_scanpos = xsp; - if (jj_3R_92()) { - jj_scanpos = xsp; - if (jj_3R_93()) { - jj_scanpos = xsp; - if (jj_3R_94()) { - jj_scanpos = xsp; - if (jj_3R_95()) { - jj_scanpos = xsp; - if (jj_3R_96()) { - jj_scanpos = xsp; - if (jj_3R_97()) { - jj_scanpos = xsp; - if (jj_3R_98()) - return true; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_61() { - if (jj_scan_token(MINUS)) - return true; - return false; - } - - private boolean jj_3R_50() { - if (jj_3R_26()) - return true; - return false; - } - - private boolean jj_3R_49() { - if (jj_3R_65()) - return true; - return false; - } - - private boolean jj_3R_48() { - if (jj_3R_64()) - return true; - return false; - } - - private boolean jj_3R_47() { - if (jj_3R_63()) - return true; - return false; - } - - private boolean jj_3R_25() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_47()) { - jj_scanpos = xsp; - if (jj_3R_48()) { - jj_scanpos = xsp; - if (jj_3R_49()) { - jj_scanpos = xsp; - if (jj_3R_50()) - return true; - } - } - } - return false; - } - - private boolean jj_3_12() { - if (jj_3R_25()) - return true; - return false; - } - - private boolean jj_3R_45() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(9)) { - jj_scanpos = xsp; - if (jj_3R_61()) - return true; - } - return false; - } - - private boolean jj_3R_32() { - if (jj_3R_14()) - return true; - if (jj_scan_token(DOT)) - return true; - return false; - } - - private boolean jj_3R_137() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(11)) { - jj_scanpos = xsp; - if (jj_scan_token(12)) - return true; - } - if (jj_3R_130()) - return true; - return false; - } - - private boolean jj_3R_24() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_45()) - jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3_12()) { - jj_scanpos = xsp; - if (jj_3R_46()) - return true; - } - return false; - } - - private boolean jj_3R_15() { - if (jj_3R_14()) - return true; - if (jj_scan_token(DOT)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_32()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_77() { - if (jj_scan_token(COORDSYS)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_119()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_145() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3R_143() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3R_140() { - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_139()) - return true; - return false; - } - - private boolean jj_3R_131() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(9)) { - jj_scanpos = xsp; - if (jj_scan_token(10)) - return true; - } - if (jj_3R_112()) - return true; - return false; - } - - private boolean jj_3R_59() { - if (jj_scan_token(POINT)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_138()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_139()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_130() { - if (jj_3R_24()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_137()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_42() { - if (jj_scan_token(REGION)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_29()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_19() { - if (jj_3R_24()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(9)) { - jj_scanpos = xsp; - if (jj_scan_token(10)) { - jj_scanpos = xsp; - if (jj_scan_token(11)) { - jj_scanpos = xsp; - if (jj_scan_token(12)) - return true; - } - } - } - return false; - } - - private boolean jj_3R_20() { - if (jj_3R_36()) - return true; - if (jj_scan_token(CONCAT)) - return true; - return false; - } - - private boolean jj_3_1() { - if (jj_3R_14()) - return true; - if (jj_scan_token(DOT)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_15()) - jj_scanpos = xsp; - if (jj_scan_token(ASTERISK)) - return true; - return false; - } - - private boolean jj_3R_41() { - if (jj_scan_token(POLYGON)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_138()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_139()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_139()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_139()) - return true; - Token xsp; - while(true) { - xsp = jj_scanpos; - if (jj_3R_140()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_72() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3R_40() { - if (jj_3R_59()) - return true; - return false; - } - - private boolean jj_3_10() { - if (jj_3R_23()) - return true; - return false; - } - - private boolean jj_3R_112() { - if (jj_3R_130()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_131()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3_9() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3_7() { - if (jj_scan_token(REGULAR_IDENTIFIER_CANDIDATE)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - return false; - } - - private boolean jj_3_6() { - if (jj_scan_token(LEFT_PAR)) - return true; - return false; - } - - private boolean jj_3R_39() { - if (jj_scan_token(CIRCLE)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_138()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_139()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3_5() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(65)) { - jj_scanpos = xsp; - if (jj_3R_20()) - return true; - } - return false; - } - - private boolean jj_3_4() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_18()) { - jj_scanpos = xsp; - if (jj_3R_19()) - return true; - } - return false; - } - - private boolean jj_3R_18() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(9)) { - jj_scanpos = xsp; - if (jj_scan_token(10)) - return true; - } - return false; - } - - private boolean jj_3R_38() { - if (jj_scan_token(CENTROID)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_119()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3_11() { - if (jj_3R_24()) - return true; - return false; - } - - private boolean jj_3R_71() { - if (jj_3R_36()) - return true; - return false; - } - - private boolean jj_3R_70() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3_8() { - if (jj_3R_21()) - return true; - return false; - } - - private boolean jj_3R_69() { - if (jj_3R_26()) - return true; - return false; - } - - private boolean jj_3R_68() { - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_51()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_37() { - if (jj_scan_token(BOX)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_138()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_139()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_67() { - if (jj_3R_29()) - return true; - return false; - } - - private boolean jj_3R_66() { - if (jj_3R_112()) - return true; - return false; - } - - private boolean jj_3R_152() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3R_53() { - if (jj_scan_token(SELECT)) - return true; - return false; - } - - private boolean jj_3R_125() { - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_51()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_144() { - if (jj_3R_59()) - return true; - return false; - } - - private boolean jj_3R_21() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_37()) { - jj_scanpos = xsp; - if (jj_3R_38()) { - jj_scanpos = xsp; - if (jj_3R_39()) { - jj_scanpos = xsp; - if (jj_3R_40()) { - jj_scanpos = xsp; - if (jj_3R_41()) { - jj_scanpos = xsp; - if (jj_3R_42()) - return true; - } - } - } - } - } - return false; - } - - private boolean jj_3R_148() { - if (jj_3R_51()) - return true; - return false; - } - - private boolean jj_3R_142() { - if (jj_3R_59()) - return true; - return false; - } - - private boolean jj_3R_124() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3R_51() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_66()) { - jj_scanpos = xsp; - if (jj_3R_67()) { - jj_scanpos = xsp; - if (jj_3R_68()) { - jj_scanpos = xsp; - if (jj_3R_69()) { - jj_scanpos = xsp; - if (jj_3_8()) { - jj_scanpos = xsp; - if (jj_3R_70()) { - jj_scanpos = xsp; - if (jj_3R_71()) { - jj_scanpos = xsp; - if (jj_3_11()) { - jj_scanpos = xsp; - if (jj_3R_72()) - return true; - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_147() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3R_123() { - if (jj_3R_129()) - return true; - return false; - } - - private boolean jj_3R_151() { - if (jj_3R_59()) - return true; - return false; - } - - private boolean jj_3R_138() { - if (jj_3R_29()) - return true; - return false; - } - - private boolean jj_3R_122() { - if (jj_3R_128()) - return true; - return false; - } - - private boolean jj_3R_16() { - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_33()) - return true; - return false; - } - - private boolean jj_3R_121() { - if (jj_3R_23()) - return true; - return false; - } - - private boolean jj_3R_115() { - if (jj_scan_token(FULL)) - return true; - return false; - } - - private boolean jj_3R_146() { - if (jj_3R_59()) - return true; - return false; - } - - private boolean jj_3R_83() { - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_112()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_82() { - if (jj_3R_129()) - return true; - return false; - } - - private boolean jj_3R_78() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_121()) { - jj_scanpos = xsp; - if (jj_3R_122()) { - jj_scanpos = xsp; - if (jj_3R_123()) { - jj_scanpos = xsp; - if (jj_3R_124()) { - jj_scanpos = xsp; - if (jj_3R_125()) - return true; - } - } - } - } - return false; - } - - private boolean jj_3R_81() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3R_80() { - if (jj_3R_128()) - return true; - return false; - } - - private boolean jj_3R_111() { - if (jj_scan_token(DISTANCE)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_146()) { - jj_scanpos = xsp; - if (jj_3R_147()) - return true; - } - if (jj_scan_token(COMMA)) - return true; - xsp = jj_scanpos; - if (jj_3R_151()) { - jj_scanpos = xsp; - if (jj_3R_152()) - return true; - } - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_110() { - if (jj_scan_token(COORD2)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_144()) { - jj_scanpos = xsp; - if (jj_3R_145()) - return true; - } - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_109() { - if (jj_scan_token(COORD1)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_142()) { - jj_scanpos = xsp; - if (jj_3R_143()) - return true; - } - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_108() { - if (jj_scan_token(AREA)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_119()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_118() { - if (jj_scan_token(FULL)) - return true; - return false; - } - - private boolean jj_3R_62() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_80()) { - jj_scanpos = xsp; - if (jj_3R_81()) { - jj_scanpos = xsp; - if (jj_3R_82()) { - jj_scanpos = xsp; - if (jj_3R_83()) - return true; - } - } - } - return false; - } - - private boolean jj_3R_107() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(60)) { - jj_scanpos = xsp; - if (jj_scan_token(61)) - return true; - } - if (jj_scan_token(LEFT_PAR)) - return true; - if (jj_3R_119()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_119()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_33() { - if (jj_3R_53()) - return true; - return false; - } - - private boolean jj_3R_114() { - if (jj_scan_token(RIGHT)) - return true; - return false; - } - - private boolean jj_3R_154() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(9)) { - jj_scanpos = xsp; - if (jj_scan_token(10)) - return true; - } - return false; - } - - private boolean jj_3R_153() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_154()) - jj_scanpos = xsp; - if (jj_scan_token(UNSIGNED_INTEGER)) - return true; - return false; - } - - private boolean jj_3R_65() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_107()) { - jj_scanpos = xsp; - if (jj_3R_108()) { - jj_scanpos = xsp; - if (jj_3R_109()) { - jj_scanpos = xsp; - if (jj_3R_110()) { - jj_scanpos = xsp; - if (jj_3R_111()) - return true; - } - } - } - } - return false; - } - - private boolean jj_3R_139() { - if (jj_3R_112()) - return true; - if (jj_scan_token(COMMA)) - return true; - if (jj_3R_112()) - return true; - return false; - } - - private boolean jj_3R_136() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(49)) { - jj_scanpos = xsp; - if (jj_scan_token(50)) { - jj_scanpos = xsp; - if (jj_scan_token(51)) { - jj_scanpos = xsp; - if (jj_scan_token(52)) - return true; - } - } - } - if (jj_scan_token(LEFT_PAR)) - return true; - xsp = jj_scanpos; - if (jj_scan_token(20)) - jj_scanpos = xsp; - if (jj_3R_51()) - return true; - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_135() { - if (jj_scan_token(COUNT)) - return true; - if (jj_scan_token(LEFT_PAR)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(20)) - jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_scan_token(11)) { - jj_scanpos = xsp; - if (jj_3R_148()) - return true; - } - if (jj_scan_token(RIGHT_PAR)) - return true; - return false; - } - - private boolean jj_3R_117() { - if (jj_scan_token(RIGHT)) - return true; - return false; - } - - private boolean jj_3R_128() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(94)) { - jj_scanpos = xsp; - if (jj_scan_token(95)) { - jj_scanpos = xsp; - if (jj_scan_token(96)) - return true; - } - } - return false; - } - - private boolean jj_3R_129() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_135()) { - jj_scanpos = xsp; - if (jj_3R_136()) - return true; - } - return false; - } - - private boolean jj_3R_113() { - if (jj_scan_token(LEFT)) - return true; - return false; - } - - private boolean jj_3R_73() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_113()) { - jj_scanpos = xsp; - if (jj_3R_114()) { - jj_scanpos = xsp; - if (jj_3R_115()) - return true; - } - } - return false; - } - - private boolean jj_3R_54() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(25)) { - jj_scanpos = xsp; - if (jj_3R_73()) - return true; - } - return false; - } - - private boolean jj_3R_44() { - if (jj_scan_token(STRING_LITERAL)) - return true; - return false; - } - - private boolean jj_3R_23() { - Token xsp; - if (jj_3R_44()) - return true; - while(true) { - xsp = jj_scanpos; - if (jj_3R_44()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - private boolean jj_3R_116() { - if (jj_scan_token(LEFT)) - return true; - return false; - } - - private boolean jj_3R_74() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_116()) { - jj_scanpos = xsp; - if (jj_3R_117()) { - jj_scanpos = xsp; - if (jj_3R_118()) - return true; - } - } - xsp = jj_scanpos; - if (jj_scan_token(26)) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3_18() { - if (jj_3R_16()) - return true; - return false; - } - - private boolean jj_3R_55() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(25)) { - jj_scanpos = xsp; - if (jj_3R_74()) - return true; - } - return false; - } - - private boolean jj_3R_35() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_55()) - jj_scanpos = xsp; - if (jj_scan_token(JOIN)) - return true; - if (jj_3R_56()) - return true; - return false; - } - - private boolean jj_3R_34() { - if (jj_scan_token(NATURAL)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_54()) - jj_scanpos = xsp; - if (jj_scan_token(JOIN)) - return true; - return false; - } - - private boolean jj_3R_28() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(36)) - jj_scanpos = xsp; - if (jj_scan_token(BETWEEN)) - return true; - if (jj_3R_51()) - return true; - return false; - } - - private boolean jj_3_15() { - if (jj_3R_28()) - return true; - return false; - } - - private boolean jj_3R_17() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_34()) { - jj_scanpos = xsp; - if (jj_3R_35()) - return true; - } - return false; - } - - private boolean jj_3_17() { - if (jj_3R_29()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(36)) - jj_scanpos = xsp; - if (jj_scan_token(LIKE)) - return true; - return false; - } - - /** Generated Token Manager. */ - public ADQLParserTokenManager token_source; - SimpleCharStream 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; - private int jj_gen; - final private int[] jj_la1 = new int[97]; - 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 { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - jj_la1_init_3(); - } - - private static void jj_la1_init_0() { - jj_la1_0 = new int[]{ 0x81, 0x0, 0x0, 0x0, 0x0, 0x100000, 0x200000, 0x40, 0x0, 0x0, 0x800000, 0x800000, 0x800, 0x608, 0x40, 0x40, 0x40, 0x0, 0x20, 0x20, 0x20, 0x0, 0x0, 0x0, 0x800000, 0x800000, 0x800000, 0x0, 0x8, 0x7b000000, 0x38000000, 0x4000000, 0x3a000000, 0x3a000000, 0x38000000, 0x4000000, 0x3a000000, 0x3a000000, 0x40, 0x80000000, 0x7b000000, 0x0, 0x0, 0x0, 0x600, 0x600, 0x8, 0x8, 0x0, 0x600, 0x600, 0x1800, 0x1800, 0x600, 0x600, 0x8, 0x100, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x7e000, 0x0, 0x0, 0x608, 0x7e000, 0x0, 0x0, 0x40, 0x8, 0x100000, 0xe08, 0x0, 0x100000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x608, 0x40, 0x40, 0x0, 0x0, 0x40, 0x608, }; - } - - private static void jj_la1_init_1() { - jj_la1_1 = new int[]{ 0x0, 0x2, 0x1000, 0x2000, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfffe0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18000, 0x18000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3e0000, 0x3e0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3e0000, 0x0, 0x0, 0x3e0000, 0xfc00000, 0x10, 0xc, 0xc, 0x10, 0x0, 0x10, 0x10, 0x0, 0x210, 0x400, 0xfffe0000, 0x0, 0x10, 0x10, 0x0, 0x0, 0x0, 0xfffe0000, 0x1e0000, 0x0, 0x3e0000, 0x30000000, 0x2000000, 0x2000000, 0x2000000, 0x2000000, 0xf0000000, 0x0, 0xfc00000, 0xf0000000, 0xf03e0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfffe0000, }; - } - - private static void jj_la1_init_2() { - jj_la1_2 = new int[]{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe3ffffff, 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, 0x20000000, 0xc0000000, 0x80000000, 0x0, 0x0, 0xc0000000, 0xe0000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0x0, 0x2, 0xe0000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe3ffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe3ffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x3fffffd, 0xc3fffffd, 0x0, 0x0, 0x3fff8, 0x3fc0000, 0x0, 0xe3ffffff, }; - } - - private static void jj_la1_init_3() { - jj_la1_3 = new int[]{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30, 0x30, 0x0, 0x30, 0x0, 0x31, 0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0x31, 0x0, 0x0, 0x0, 0x30, 0x0, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x31, 0x31, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x31, 0x0, 0x0, 0x31, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x31, 0x0, 0x0, 0x0, 0x0, 0x30, 0x30, 0x30, 0x30, 0x0, 0x0, 0x0, 0x20, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0, 0x31, }; - } - - final private JJCalls[] jj_2_rtns = new JJCalls[18]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - /** Constructor with InputStream. */ - public ADQLParser(java.io.InputStream stream) { - this(stream, (String)null); - } - - /** Constructor with InputStream and supplied encoding */ - public ADQLParser(java.io.InputStream stream, String encoding) { - try { - jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); - } catch(java.io.UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - token_source = new ADQLParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for(int i = 0; i < 97; 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 < 97; i++) - jj_la1[i] = -1; - for(int i = 0; i < jj_2_rtns.length; i++) - jj_2_rtns[i] = new JJCalls(); - } - - /** Constructor. */ - public ADQLParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new ADQLParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for(int i = 0; i < 97; 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 < 97; 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 ADQLParser(ADQLParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for(int i = 0; i < 97; 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(ADQLParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for(int i = 0; i < 97; 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(int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while(c != null) { - if (c.gen < jj_gen) - c.first = null; - c = c.next; - } - } - } - trace_token(token, ""); - 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++; - trace_token(token, " (in getNextToken)"); - return token; - } - - /** Get the specific Token. */ - final public Token getToken(int index) { - Token t = 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 java.util.List jj_expentries = new java.util.ArrayList(); - private int[] jj_expentry; - private int jj_kind = -1; - private 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(java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { - int[] oldentry = (int[])(it.next()); - 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[103]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for(int i = 0; i < 97; 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; - } - } - } - } - for(int i = 0; i < 103; 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); - } - - private int trace_indent = 0; - private boolean trace_enabled = true; - - /** Enable tracing. */ - final public void enable_tracing() { - trace_enabled = true; - } - - /** Disable tracing. */ - final public void disable_tracing() { - trace_enabled = false; - } - - private void trace_call(String s) { - if (trace_enabled) { - for(int i = 0; i < trace_indent; i++) { - System.out.print(" "); - } - System.out.println("Call: " + s); - } - trace_indent = trace_indent + 2; - } - - private void trace_return(String s) { - trace_indent = trace_indent - 2; - if (trace_enabled) { - for(int i = 0; i < trace_indent; i++) { - System.out.print(" "); - } - System.out.println("Return: " + s); - } - } - - private void trace_token(Token t, String where) { - if (trace_enabled) { - for(int i = 0; i < trace_indent; i++) { - System.out.print(" "); - } - System.out.print("Consumed token: <" + tokenImage[t.kind]); - if (t.kind != 0 && !tokenImage[t.kind].equals("\"" + t.image + "\"")) { - System.out.print(": \"" + t.image + "\""); - } - System.out.println(" at line " + t.beginLine + " column " + t.beginColumn + ">" + where); - } - } - - private void trace_scan(Token t1, int t2) { - if (trace_enabled) { - for(int i = 0; i < trace_indent; i++) { - System.out.print(" "); - } - System.out.print("Visited token: <" + tokenImage[t1.kind]); - if (t1.kind != 0 && !tokenImage[t1.kind].equals("\"" + t1.image + "\"")) { - System.out.print(": \"" + t1.image + "\""); - } - System.out.println(" at line " + t1.beginLine + " column " + t1.beginColumn + ">; Expected token: <" + tokenImage[t2] + ">"); - } - } - - private void jj_rescan_token() { - jj_rescan = true; - for(int i = 0; i < 18; 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; - } - } - 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; - } + public static final void main(String[] args) throws Exception { + final String USAGE = "Usage:\u005cn adqlParser.jar [-d] [-v] [-e] [-a|-s] [-f] [|]\u005cn\u005cnNOTE: If no file or URL is given, the ADQL query is expected in the standard\u005cn input. This query must end with a ';' or !\u005cn\u005cnParameters:\u005cn -v or --verbose : Print the main steps of the parsing\u005cn -d or --debug : Print stack traces when a grave error occurs\u005cn -e or --explain : Explain the ADQL parsing (or Expand the parsing tree)\u005cn -a or --adql : Display the understood ADQL query\u005cn -s or --sql : Ask the SQL translation of the given ADQL query\u005cn (SQL compatible with PostgreSQL)\u005cn -f or --try-fix : Try fixing the most common ADQL query issues before\u005cn attempting to parse the query.\u005cn\u005cnReturn:\u005cn By default: nothing if the query is correct. Otherwise a message explaining\u005cn why the query is not correct is displayed.\u005cn With the -s option, the SQL translation of the given ADQL query will be\u005cn returned.\u005cn With the -a option, the ADQL query is returned as it has been understood.\u005cn\u005cnExit status:\u005cn 0 OK !\u005cn 1 Parameter error (missing or incorrect parameter)\u005cn 2 File error (incorrect file/url, reading error, ...)\u005cn 3 Parsing error (syntactic or semantic error)\u005cn 4 Translation error (a problem has occurred during the translation of the\u005cn given ADQL query in SQL)."; + + ADQLParser parser; + + final String urlRegex = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"; + + String file = null, metaFile = null; + short mode = -1; + boolean verbose=false, debug=false, explain=false, tryFix=false; + + // Parameters reading: + for(int i=0; iparseQuery
functions. +* +* @return The object representation of the query. +* @throws ParseException If the query syntax is incorrect. +*/ + final public ADQLQuery Query() throws ParseException { + trace_call("Query"); + try { + ADQLQuery q = null; + q = QueryExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 0: + jj_consume_token(0); + break; + case EOQ: + jj_consume_token(EOQ); + break; + default: + jj_la1[0] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + // check the query: + if (queryChecker != null) + queryChecker.check(q); + + {if (true) return q;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("Query"); + } + } + + final public ADQLQuery QueryExpression() throws ParseException { + trace_call("QueryExpression"); + try { + TextPosition endPos = null; + try{ + // create the query: + query = queryFactory.createQuery(); + stackQuery.push(query); + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + Select(); + From(); + endPos = query.getFrom().getPosition(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WHERE: + Where(); + endPos = query.getWhere().getPosition(); + break; + default: + jj_la1[1] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GROUP: + GroupBy(); + endPos = query.getGroupBy().getPosition(); + break; + default: + jj_la1[2] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case HAVING: + Having(); + endPos = query.getHaving().getPosition(); + break; + default: + jj_la1[3] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ORDER: + OrderBy(); + endPos = query.getOrderBy().getPosition(); + break; + default: + jj_la1[4] = jj_gen; + ; + } + // set the position of the query: + query.setPosition(new TextPosition(query.getSelect().getPosition(), endPos)); + + // get the previous query (!= null if the current query is a sub-query): + ADQLQuery previousQuery = stackQuery.pop(); + if (stackQuery.isEmpty()) + query = null; + else + query = stackQuery.peek(); + + {if (true) return previousQuery;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("QueryExpression"); + } + } + + final public ADQLQuery SubQueryExpression() throws ParseException { + trace_call("SubQueryExpression"); + try { + ADQLQuery q = null; Token start, end; + start = jj_consume_token(LEFT_PAR); + q = QueryExpression(); + end = jj_consume_token(RIGHT_PAR); + q.setPosition(new TextPosition(start, end)); + {if (true) return q;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("SubQueryExpression"); + } + } + + final public void Select() throws ParseException { + trace_call("Select"); + try { + ClauseSelect select = query.getSelect(); SelectItem item=null; Token start,t = null; + start = jj_consume_token(SELECT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QUANTIFIER: + t = jj_consume_token(QUANTIFIER); + select.setDistinctColumns(t.image.equalsIgnoreCase("DISTINCT")); + break; + default: + jj_la1[5] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TOP: + jj_consume_token(TOP); + t = jj_consume_token(UNSIGNED_INTEGER); + try{ + select.setLimit(Integer.parseInt(t.image)); + }catch(NumberFormatException nfe){ + {if (true) throw new ParseException("[l."+t.beginLine+";c."+t.beginColumn+"] The TOP limit (\u005c""+t.image+"\u005c") isn't a regular unsigned integer !");} + } + break; + default: + jj_la1[6] = jj_gen; + ; + } + item = SelectItem(); + select.add(item); + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[7] = jj_gen; + break label_1; + } + jj_consume_token(COMMA); + item = SelectItem(); + select.add(item); + } + TextPosition lastItemPos = query.getSelect().get(query.getSelect().size()-1).getPosition(); + select.setPosition(new TextPosition(start.beginLine, start.beginColumn, lastItemPos.endLine, lastItemPos.endColumn)); + } finally { + trace_return("Select"); + } + } + + final public SelectItem SelectItem() throws ParseException { + trace_call("SelectItem"); + try { + IdentifierItems identifiers = new IdentifierItems(true); IdentifierItem id = null, label = null; ADQLOperand op = null; SelectItem item; Token starToken; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASTERISK: + starToken = jj_consume_token(ASTERISK); + item = new SelectAllColumns(query); + item.setPosition(new TextPosition(starToken)); + {if (true) return item;} + break; + default: + jj_la1[12] = jj_gen; + if (jj_2_1(7)) { + id = Identifier(); + jj_consume_token(DOT); + identifiers.append(id); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + id = Identifier(); + jj_consume_token(DOT); + identifiers.append(id); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + id = Identifier(); + jj_consume_token(DOT); + identifiers.append(id); + break; + default: + jj_la1[8] = jj_gen; + ; + } + break; + default: + jj_la1[9] = jj_gen; + ; + } + starToken = jj_consume_token(ASTERISK); + try{ + item = new SelectAllColumns( queryFactory.createTable(identifiers, null) ); + TextPosition firstPos = identifiers.get(0).position; + item.setPosition(new TextPosition(firstPos.beginLine, firstPos.beginColumn, starToken.endLine, (starToken.endColumn < 0) ? -1 : (starToken.endColumn + 1))); + {if (true) return item;} + }catch(Exception ex) { + {if (true) throw generateParseException(ex);} + } + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_PAR: + case PLUS: + case MINUS: + case AVG: + case MAX: + case MIN: + case SUM: + case COUNT: + case BOX: + case CENTROID: + case CIRCLE: + case POINT: + case POLYGON: + case REGION: + case CONTAINS: + case INTERSECTS: + case AREA: + case COORD1: + case COORD2: + case COORDSYS: + case DISTANCE: + case ABS: + case CEILING: + case DEGREES: + case EXP: + case FLOOR: + case LOG: + case LOG10: + case MOD: + case PI: + case POWER: + case RADIANS: + case RAND: + case ROUND: + case SQRT: + case TRUNCATE: + case ACOS: + case ASIN: + case ATAN: + case ATAN2: + case COS: + case COT: + case SIN: + case TAN: + case STRING_LITERAL: + case SCIENTIFIC_NUMBER: + case UNSIGNED_FLOAT: + case UNSIGNED_INTEGER: + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + op = ValueExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: + jj_consume_token(AS); + break; + default: + jj_la1[10] = jj_gen; + ; + } + label = Identifier(); + break; + default: + jj_la1[11] = jj_gen; + ; + } + break; + default: + jj_la1[13] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + try{ + item = queryFactory.createSelectItem(op, (label==null)?null:label.identifier); + if (label != null){ + item.setCaseSensitive(label.caseSensitivity); + item.setPosition(new TextPosition(op.getPosition(), label.position)); + }else + item.setPosition(new TextPosition(op.getPosition())); + {if (true) return item;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("SelectItem"); + } + } + + final public void From() throws ParseException { + trace_call("From"); + try { + FromContent content = null, content2 = null; + try { + jj_consume_token(FROM); + content = TableRef(); + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[14] = jj_gen; + break label_2; + } + jj_consume_token(COMMA); + content2 = TableRef(); + TextPosition startPos = content.getPosition(), endPos = content2.getPosition(); + content = queryFactory.createJoin(JoinType.CROSS, content, content2); + content.setPosition(new TextPosition(startPos, endPos)); + } + query.setFrom(content); + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + } finally { + trace_return("From"); + } + } + + final public void Where() throws ParseException { + trace_call("Where"); + try { + ClauseConstraints where = query.getWhere(); ADQLConstraint condition; Token start; + start = jj_consume_token(WHERE); + ConditionsList(where); + TextPosition endPosition = where.getPosition(); + where.setPosition(new TextPosition(start.beginLine, start.beginColumn, endPosition.endLine, endPosition.endColumn)); + } finally { + trace_return("Where"); + } + } + + final public void GroupBy() throws ParseException { + trace_call("GroupBy"); + try { + ClauseADQL groupBy = query.getGroupBy(); ADQLColumn colRef = null; Token start; + start = jj_consume_token(GROUP); + jj_consume_token(BY); + colRef = Column(); + groupBy.add(colRef); + label_3: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[15] = jj_gen; + break label_3; + } + jj_consume_token(COMMA); + colRef = Column(); + groupBy.add(colRef); + } + groupBy.setPosition(new TextPosition(start.beginLine, start.beginColumn, colRef.getPosition().endLine, colRef.getPosition().endColumn)); + } finally { + trace_return("GroupBy"); + } + } + + final public void Having() throws ParseException { + trace_call("Having"); + try { + ClauseConstraints having = query.getHaving(); Token start; + start = jj_consume_token(HAVING); + ConditionsList(having); + TextPosition endPosition = having.getPosition(); + having.setPosition(new TextPosition(start.beginLine, start.beginColumn, endPosition.endLine, endPosition.endColumn)); + } finally { + trace_return("Having"); + } + } + + final public void OrderBy() throws ParseException { + trace_call("OrderBy"); + try { + ClauseADQL orderBy = query.getOrderBy(); ADQLOrder order = null; Token start; + start = jj_consume_token(ORDER); + jj_consume_token(BY); + order = OrderItem(); + orderBy.add(order); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[16] = jj_gen; + break label_4; + } + jj_consume_token(COMMA); + order = OrderItem(); + orderBy.add(order); + } + orderBy.setPosition(new TextPosition(start, token)); + } finally { + trace_return("OrderBy"); + } + } + +/* *************************** */ +/* COLUMN AND TABLE REFERENCES */ +/* *************************** */ + final public IdentifierItem Identifier() throws ParseException { + trace_call("Identifier"); + try { + Token t; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case REGULAR_IDENTIFIER_CANDIDATE: + t = jj_consume_token(REGULAR_IDENTIFIER_CANDIDATE); + testRegularIdentifier(t); + {if (true) return new IdentifierItem(t, false);} + break; + case DELIMITED_IDENTIFIER: + t = jj_consume_token(DELIMITED_IDENTIFIER); + {if (true) return new IdentifierItem(t, true);} + break; + default: + jj_la1[17] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("Identifier"); + } + } + +/** + * Extracts the name of a table with its possible catalog and schema prefixes. + * + * @return A {@link IdentifierItems} which contains at most three items: catalogName, schemaName and tableName. + */ + final public IdentifierItems TableName() throws ParseException { + trace_call("TableName"); + try { + IdentifierItems identifiers=new IdentifierItems(true); IdentifierItem id=null; + id = Identifier(); + identifiers.append(id); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: + jj_consume_token(DOT); + id = Identifier(); + identifiers.append(id); + break; + default: + jj_la1[18] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: + jj_consume_token(DOT); + id = Identifier(); + identifiers.append(id); + break; + default: + jj_la1[19] = jj_gen; + ; + } + {if (true) return identifiers;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("TableName"); + } + } + +/** + * Extracts the name of a column with its possible catalog, schema and table prefixes. + * + * @return A {@link IdentifierItems} which contains at most four items: catalogName, schemaName, tableName and columnName. + */ + final public IdentifierItems ColumnName() throws ParseException { + trace_call("ColumnName"); + try { + IdentifierItem id; IdentifierItems table=null, identifiers=new IdentifierItems(false); + id = Identifier(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: + jj_consume_token(DOT); + table = TableName(); + break; + default: + jj_la1[20] = jj_gen; + ; + } + identifiers.append(id); + if (table != null){ + for(int i=0; i lstColumns=new ArrayList(); IdentifierItem id; FromContent rightTable; ADQLJoin join; Token lastPar; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NATURAL: + jj_consume_token(NATURAL); + natural=true; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INNER: + case RIGHT: + case LEFT: + case FULL: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INNER: + jj_consume_token(INNER); + break; + case RIGHT: + case LEFT: + case FULL: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT: + jj_consume_token(LEFT); + type = JoinType.OUTER_LEFT; + break; + case RIGHT: + jj_consume_token(RIGHT); + type = JoinType.OUTER_RIGHT; + break; + case FULL: + jj_consume_token(FULL); + type = JoinType.OUTER_FULL; + break; + default: + jj_la1[30] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case OUTER: + jj_consume_token(OUTER); + break; + default: + jj_la1[31] = jj_gen; + ; + } + break; + default: + jj_la1[32] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[33] = jj_gen; + ; + } + jj_consume_token(JOIN); + rightTable = SimpleTableRef(); + join = queryFactory.createJoin(type, leftTable, rightTable); + join.setPosition(new TextPosition(leftTable.getPosition(), rightTable.getPosition())); + {if (true) return join;} + break; + case INNER: + case RIGHT: + case LEFT: + case FULL: + case JOIN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INNER: + case RIGHT: + case LEFT: + case FULL: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INNER: + jj_consume_token(INNER); + break; + case RIGHT: + case LEFT: + case FULL: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT: + jj_consume_token(LEFT); + type = JoinType.OUTER_LEFT; + break; + case RIGHT: + jj_consume_token(RIGHT); + type = JoinType.OUTER_RIGHT; + break; + case FULL: + jj_consume_token(FULL); + type = JoinType.OUTER_FULL; + break; + default: + jj_la1[34] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case OUTER: + jj_consume_token(OUTER); + break; + default: + jj_la1[35] = jj_gen; + ; + } + break; + default: + jj_la1[36] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[37] = jj_gen; + ; + } + jj_consume_token(JOIN); + rightTable = SimpleTableRef(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ON: + jj_consume_token(ON); + ConditionsList(condition); + join = queryFactory.createJoin(type, leftTable, rightTable, condition); + join.setPosition(new TextPosition(leftTable.getPosition(), condition.getPosition())); + {if (true) return join;} + break; + case USING: + jj_consume_token(USING); + jj_consume_token(LEFT_PAR); + id = Identifier(); + lstColumns.add( queryFactory.createColumn(id) ); + label_7: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[38] = jj_gen; + break label_7; + } + jj_consume_token(COMMA); + id = Identifier(); + lstColumns.add( queryFactory.createColumn(id) ); + } + lastPar = jj_consume_token(RIGHT_PAR); + join = queryFactory.createJoin(type, leftTable, rightTable, lstColumns); + join.setPosition(new TextPosition(leftTable.getPosition().beginLine, leftTable.getPosition().beginColumn, lastPar.endLine, (lastPar.endColumn < 0) ? -1 : (lastPar.endColumn + 1))); + {if (true) return join;} + break; + default: + jj_la1[39] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[40] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("JoinSpecification"); + } + } + +/* ****** */ +/* STRING */ +/* ****** */ + final public StringConstant String() throws ParseException { + trace_call("String"); + try { + Token t, start=null; String str=""; StringConstant cst; + label_8: + while (true) { + t = jj_consume_token(STRING_LITERAL); + str += t.image.substring(1, t.image.length()-1).replaceAll("''", "'"); + if (start == null) + start = t; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL: + ; + break; + default: + jj_la1[41] = jj_gen; + break label_8; + } + } + try{ + cst = queryFactory.createStringConstant(str); + cst.setPosition(new TextPosition(start, t)); + {if (true) return cst;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("String"); + } + } + +/* ************* */ +/* NUMERIC TYPES */ +/* ************* */ + final public NumericConstant UnsignedNumeric() throws ParseException { + trace_call("UnsignedNumeric"); + try { + Token t; NumericConstant cst; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SCIENTIFIC_NUMBER: + t = jj_consume_token(SCIENTIFIC_NUMBER); + break; + case UNSIGNED_FLOAT: + t = jj_consume_token(UNSIGNED_FLOAT); + break; + case UNSIGNED_INTEGER: + t = jj_consume_token(UNSIGNED_INTEGER); + break; + default: + jj_la1[42] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + try{ + cst = queryFactory.createNumericConstant(t.image); + cst.setPosition(new TextPosition(t)); + {if (true) return cst;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("UnsignedNumeric"); + } + } + + final public NumericConstant UnsignedFloat() throws ParseException { + trace_call("UnsignedFloat"); + try { + Token t; NumericConstant cst; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNSIGNED_INTEGER: + t = jj_consume_token(UNSIGNED_INTEGER); + break; + case UNSIGNED_FLOAT: + t = jj_consume_token(UNSIGNED_FLOAT); + break; + default: + jj_la1[43] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + try{ + cst = queryFactory.createNumericConstant(t.image); + cst.setPosition(new TextPosition(t)); + {if (true) return cst;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("UnsignedFloat"); + } + } + + final public NumericConstant SignedInteger() throws ParseException { + trace_call("SignedInteger"); + try { + Token sign=null, number; NumericConstant cst; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + case MINUS: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + sign = jj_consume_token(PLUS); + break; + case MINUS: + sign = jj_consume_token(MINUS); + break; + default: + jj_la1[44] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[45] = jj_gen; + ; + } + number = jj_consume_token(UNSIGNED_INTEGER); + try{ + if (sign == null){ cst = queryFactory.createNumericConstant(number.image); + cst.setPosition(new TextPosition(number)); + }else{ cst = queryFactory.createNumericConstant(sign.image+number.image); + cst.setPosition(new TextPosition(sign, number)); + } + {if (true) return cst;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("SignedInteger"); + } + } + +/* *********** */ +/* EXPRESSIONS */ +/* *********** */ + final public ADQLOperand NumericValueExpressionPrimary() throws ParseException { + trace_call("NumericValueExpressionPrimary"); + try { + ADQLColumn column; ADQLOperand op; Token left, right; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SCIENTIFIC_NUMBER: + case UNSIGNED_FLOAT: + case UNSIGNED_INTEGER: + // unsigned_value_specification + op = UnsignedNumeric(); + {if (true) return op;} + break; + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + column = Column(); + column.setExpectedType('N'); {if (true) return column;} + break; + case AVG: + case MAX: + case MIN: + case SUM: + case COUNT: + op = SqlFunction(); + {if (true) return op;} + break; + case LEFT_PAR: + left = jj_consume_token(LEFT_PAR); + op = NumericExpression(); + right = jj_consume_token(RIGHT_PAR); + WrappedOperand wop = queryFactory.createWrappedOperand(op); wop.setPosition(new TextPosition(left, right)); {if (true) return wop;} + break; + default: + jj_la1[46] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("NumericValueExpressionPrimary"); + } + } + + final public ADQLOperand StringValueExpressionPrimary() throws ParseException { + trace_call("StringValueExpressionPrimary"); + try { + StringConstant expr; ADQLColumn column; ADQLOperand op; Token left, right; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL: + // string + expr = String(); + {if (true) return expr;} + break; + case SCIENTIFIC_NUMBER: + case UNSIGNED_FLOAT: + case UNSIGNED_INTEGER: + op = UnsignedNumeric(); + {if (true) return op;} + break; + case AVG: + case MAX: + case MIN: + case SUM: + case COUNT: + op = SqlFunction(); + {if (true) return op;} + break; + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + column = Column(); + column.setExpectedType('*'); {if (true) return column;} + break; + case LEFT_PAR: + left = jj_consume_token(LEFT_PAR); + op = ValueExpression(); + right = jj_consume_token(RIGHT_PAR); + WrappedOperand wop = queryFactory.createWrappedOperand(op); wop.setPosition(new TextPosition(left, right)); {if (true) return wop;} + break; + default: + jj_la1[47] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("StringValueExpressionPrimary"); + } + } + +/*****TODO G.Landais update AND/OR *********/ + final public ADQLOperand ValueExpression() throws ParseException { + trace_call("ValueExpression"); + try { + ADQLOperand valueExpr = null; Token left, right; + try { + if (jj_2_4(2147483647)) { + valueExpr = NumericExpression(); + } else if (jj_2_5(2147483647)) { + valueExpr = StringExpression(); + } else if (jj_2_6(2147483647)) { + left = jj_consume_token(LEFT_PAR); + valueExpr = ValueExpression(); + right = jj_consume_token(RIGHT_PAR); + valueExpr = queryFactory.createWrappedOperand(valueExpr); ((WrappedOperand)valueExpr).setPosition(new TextPosition(left, right)); + } else if (jj_2_7(2147483647)) { + valueExpr = UserDefinedFunction(); + } else if (jj_2_8(2)) { + valueExpr = GeometryValueFunction(); + } else if (jj_2_9(2147483647)) { + valueExpr = Column(); + } else if (jj_2_10(2147483647)) { + valueExpr = StringFactor(); + } else if (jj_2_11(3)) { + valueExpr = Factor(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + valueExpr = Column(); + break; + default: + jj_la1[48] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + {if (true) return valueExpr;} + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("ValueExpression"); + } + } + + final public ADQLOperand NumericExpression() throws ParseException { + trace_call("NumericExpression"); + try { + Token sign=null; ADQLOperand leftOp, rightOp=null; + leftOp = NumericTerm(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + case MINUS: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + sign = jj_consume_token(PLUS); + break; + case MINUS: + sign = jj_consume_token(MINUS); + break; + default: + jj_la1[49] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + rightOp = NumericExpression(); + break; + default: + jj_la1[50] = jj_gen; + ; + } + if (sign == null) + {if (true) return leftOp;} + else{ + try{ + Operation operation = queryFactory.createOperation(leftOp, OperationType.getOperator(sign.image), rightOp); + operation.setPosition(new TextPosition(leftOp.getPosition(), rightOp.getPosition())); + {if (true) return operation;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("NumericExpression"); + } + } + +/*****TODO G.Landais update AND/OR *********/ + final public ADQLOperand NumericTerm() throws ParseException { + trace_call("NumericTerm"); + try { + Token sign=null; ADQLOperand leftOp, rightOp=null; + leftOp = Factor(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASTERISK: + case DIVIDE: + case LOGIC_AND: + case LOGIC_OR: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASTERISK: + sign = jj_consume_token(ASTERISK); + break; + case DIVIDE: + sign = jj_consume_token(DIVIDE); + break; + case LOGIC_AND: + sign = jj_consume_token(LOGIC_AND); + break; + case LOGIC_OR: + sign = jj_consume_token(LOGIC_OR); + break; + default: + jj_la1[51] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + rightOp = NumericTerm(); + break; + default: + jj_la1[52] = jj_gen; + ; + } + if (sign == null) + {if (true) return leftOp;} + else{ + try{ + Operation operation = queryFactory.createOperation(leftOp, OperationType.getOperator(sign.image), rightOp); + operation.setPosition(new TextPosition(leftOp.getPosition(), rightOp.getPosition())); + {if (true) return operation;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("NumericTerm"); + } + } + + final public ADQLOperand Factor() throws ParseException { + trace_call("Factor"); + try { + boolean negative = false; Token minusSign = null; ADQLOperand op; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + case MINUS: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + jj_consume_token(PLUS); + break; + case MINUS: + minusSign = jj_consume_token(MINUS); + negative = true; + break; + default: + jj_la1[53] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[54] = jj_gen; + ; + } + if (jj_2_12(2)) { + op = NumericFunction(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_PAR: + case AVG: + case MAX: + case MIN: + case SUM: + case COUNT: + case SCIENTIFIC_NUMBER: + case UNSIGNED_FLOAT: + case UNSIGNED_INTEGER: + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + op = NumericValueExpressionPrimary(); + break; + default: + jj_la1[55] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + if (negative){ + try{ + TextPosition position = op.getPosition(); + op = queryFactory.createNegativeOperand(op); + NegativeOperand negativeOp = (NegativeOperand)op; + if (minusSign != null) + negativeOp.setPosition(new TextPosition(minusSign.beginLine, minusSign.beginColumn, position.endLine, position.endColumn)); + else + negativeOp.setPosition(position); + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + } + + {if (true) return op;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("Factor"); + } + } + +/*****TODO G.Landais updateTRIM function *********/ + final public ADQLOperand StringExpression() throws ParseException { + trace_call("StringExpression"); + try { + ADQLOperand leftOp; ADQLOperand rightOp = null; + leftOp = StringFactor(); + label_9: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CONCAT: + ; + break; + default: + jj_la1[56] = jj_gen; + break label_9; + } + jj_consume_token(CONCAT); + rightOp = StringFactor(); + if (!(leftOp instanceof Concatenation)){ + try{ + ADQLOperand temp = leftOp; + leftOp = queryFactory.createConcatenation(); + ((Concatenation)leftOp).add(temp); + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + } + ((Concatenation)leftOp).add(rightOp); + } + if (leftOp instanceof Concatenation){ + Concatenation concat = (Concatenation)leftOp; + concat.setPosition(new TextPosition(concat.get(0).getPosition(), concat.get(concat.size()-1).getPosition())); + } + {if (true) return leftOp;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("StringExpression"); + } + } + + final public ADQLOperand StringFactor() throws ParseException { + trace_call("StringFactor"); + try { + ADQLOperand op; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COORDSYS: + op = ExtractCoordSys(); + break; + default: + jj_la1[57] = jj_gen; + if (jj_2_13(2)) { + op = UserDefinedFunction(); + ((UserDefinedFunction)op).setExpectedType('S'); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_PAR: + case AVG: + case MAX: + case MIN: + case SUM: + case COUNT: + case STRING_LITERAL: + case SCIENTIFIC_NUMBER: + case UNSIGNED_FLOAT: + case UNSIGNED_INTEGER: + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + op = StringValueExpressionPrimary(); + break; + default: + jj_la1[58] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + {if (true) return op;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("StringFactor"); + } + } + + final public GeometryValue GeometryExpression() throws ParseException { + trace_call("GeometryExpression"); + try { + ADQLColumn col = null; GeometryFunction gf = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + col = Column(); + break; + case BOX: + case CENTROID: + case CIRCLE: + case POINT: + case POLYGON: + case REGION: + gf = GeometryValueFunction(); + break; + default: + jj_la1[59] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if (col != null){ + col.setExpectedType('G'); + {if (true) return new GeometryValue(col);} + }else + {if (true) return new GeometryValue(gf);} + throw new Error("Missing return statement in function"); + } finally { + trace_return("GeometryExpression"); + } + } + +/* ********************************** */ +/* BOOLEAN EXPRESSIONS (WHERE clause) */ +/* ********************************** */ + final public ClauseConstraints ConditionsList(ClauseConstraints clause) throws ParseException { + trace_call("ConditionsList"); + try { + ADQLConstraint constraint = null; Token op = null; boolean notOp = false; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NOT: + op = jj_consume_token(NOT); + notOp = true; + break; + default: + jj_la1[60] = jj_gen; + ; + } + constraint = Constraint(); + if (notOp){ + TextPosition oldPos = constraint.getPosition(); + constraint = queryFactory.createNot(constraint); + ((NotConstraint)constraint).setPosition(new TextPosition(op.beginLine, op.beginColumn, oldPos.endLine, oldPos.endColumn)); + } + notOp = false; + + if (clause instanceof ADQLConstraint) + clause.add(constraint); + else + clause.add(constraint); + label_10: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AND: + case OR: + ; + break; + default: + jj_la1[61] = jj_gen; + break label_10; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AND: + op = jj_consume_token(AND); + break; + case OR: + op = jj_consume_token(OR); + break; + default: + jj_la1[62] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NOT: + jj_consume_token(NOT); + notOp = true; + break; + default: + jj_la1[63] = jj_gen; + ; + } + constraint = Constraint(); + if (notOp){ + TextPosition oldPos = constraint.getPosition(); + constraint = queryFactory.createNot(constraint); + ((NotConstraint)constraint).setPosition(new TextPosition(op.beginLine, op.beginColumn, oldPos.endLine, oldPos.endColumn)); + } + notOp = false; + + if (clause instanceof ADQLConstraint) + clause.add(op.image, constraint); + else + clause.add(op.image, constraint); + } + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + if (!clause.isEmpty()){ + TextPosition start = clause.get(0).getPosition(); + TextPosition end = clause.get(clause.size()-1).getPosition(); + clause.setPosition(new TextPosition(start, end)); + } + {if (true) return clause;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("ConditionsList"); + } + } + + final public ADQLConstraint Constraint() throws ParseException { + trace_call("Constraint"); + try { + ADQLConstraint constraint = null; Token start, end; + if (jj_2_14(2147483647)) { + constraint = Predicate(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_PAR: + start = jj_consume_token(LEFT_PAR); + try{ + constraint = queryFactory.createGroupOfConstraints(); + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + ConditionsList((ConstraintsGroup)constraint); + end = jj_consume_token(RIGHT_PAR); + ((ConstraintsGroup)constraint).setPosition(new TextPosition(start, end)); + break; + default: + jj_la1[64] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + {if (true) return constraint;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("Constraint"); + } + } + + final public ADQLConstraint Predicate() throws ParseException { + trace_call("Predicate"); + try { + ADQLQuery q=null; ADQLColumn column=null; ADQLOperand strExpr1=null, strExpr2=null; ADQLOperand op; Token start, notToken = null, end; ADQLConstraint constraint = null; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EXISTS: + start = jj_consume_token(EXISTS); + q = SubQueryExpression(); + Exists e = queryFactory.createExists(q); + e.setPosition(new TextPosition(start.beginLine, start.beginColumn, q.getPosition().endLine, q.getPosition().endColumn)); + {if (true) return e;} + break; + default: + jj_la1[69] = jj_gen; + if (jj_2_16(2147483647)) { + column = Column(); + jj_consume_token(IS); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NOT: + notToken = jj_consume_token(NOT); + break; + default: + jj_la1[65] = jj_gen; + ; + } + end = jj_consume_token(NULL); + IsNull in = queryFactory.createIsNull((notToken!=null), column); + in.setPosition(new TextPosition(column.getPosition().beginLine, column.getPosition().beginColumn, end.endLine, (end.endColumn < 0) ? -1 : (end.endColumn + 1))); + {if (true) return in;} + } else if (jj_2_17(2147483647)) { + strExpr1 = StringExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NOT: + notToken = jj_consume_token(NOT); + break; + default: + jj_la1[66] = jj_gen; + ; + } + jj_consume_token(LIKE); + strExpr2 = StringExpression(); + Comparison comp = queryFactory.createComparison(strExpr1, (notToken==null)?ComparisonOperator.LIKE:ComparisonOperator.NOTLIKE, strExpr2); + comp.setPosition(new TextPosition(strExpr1.getPosition(), strExpr2.getPosition())); + {if (true) return comp;} + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_PAR: + case PLUS: + case MINUS: + case AVG: + case MAX: + case MIN: + case SUM: + case COUNT: + case BOX: + case CENTROID: + case CIRCLE: + case POINT: + case POLYGON: + case REGION: + case CONTAINS: + case INTERSECTS: + case AREA: + case COORD1: + case COORD2: + case COORDSYS: + case DISTANCE: + case ABS: + case CEILING: + case DEGREES: + case EXP: + case FLOOR: + case LOG: + case LOG10: + case MOD: + case PI: + case POWER: + case RADIANS: + case RAND: + case ROUND: + case SQRT: + case TRUNCATE: + case ACOS: + case ASIN: + case ATAN: + case ATAN2: + case COS: + case COT: + case SIN: + case TAN: + case STRING_LITERAL: + case SCIENTIFIC_NUMBER: + case UNSIGNED_FLOAT: + case UNSIGNED_INTEGER: + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + op = ValueExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQUAL: + case NOT_EQUAL: + case LESS_THAN: + case LESS_EQUAL_THAN: + case GREATER_THAN: + case GREATER_EQUAL_THAN: + constraint = ComparisonEnd(op); + break; + default: + jj_la1[67] = jj_gen; + if (jj_2_15(2)) { + constraint = BetweenEnd(op); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NOT: + case IN: + constraint = InEnd(op); + break; + default: + jj_la1[68] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + break; + default: + jj_la1[70] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + {if (true) return constraint;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("Predicate"); + } + } + + final public Comparison ComparisonEnd(ADQLOperand leftOp) throws ParseException { + trace_call("ComparisonEnd"); + try { + Token comp; ADQLOperand rightOp; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQUAL: + comp = jj_consume_token(EQUAL); + break; + case NOT_EQUAL: + comp = jj_consume_token(NOT_EQUAL); + break; + case LESS_THAN: + comp = jj_consume_token(LESS_THAN); + break; + case LESS_EQUAL_THAN: + comp = jj_consume_token(LESS_EQUAL_THAN); + break; + case GREATER_THAN: + comp = jj_consume_token(GREATER_THAN); + break; + case GREATER_EQUAL_THAN: + comp = jj_consume_token(GREATER_EQUAL_THAN); + break; + default: + jj_la1[71] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + rightOp = ValueExpression(); + try{ + Comparison comparison = queryFactory.createComparison(leftOp, ComparisonOperator.getOperator(comp.image), rightOp); + comparison.setPosition(new TextPosition(leftOp.getPosition(), rightOp.getPosition())); + {if (true) return comparison;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("ComparisonEnd"); + } + } + + final public Between BetweenEnd(ADQLOperand leftOp) throws ParseException { + trace_call("BetweenEnd"); + try { + Token start,notToken=null; ADQLOperand min, max; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NOT: + notToken = jj_consume_token(NOT); + break; + default: + jj_la1[72] = jj_gen; + ; + } + start = jj_consume_token(BETWEEN); + min = ValueExpression(); + jj_consume_token(AND); + max = ValueExpression(); + try{ + Between bet = queryFactory.createBetween((notToken!=null), leftOp, min, max); + if (notToken != null) start = notToken; + bet.setPosition(new TextPosition(start.beginLine, start.beginColumn, max.getPosition().endLine, max.getPosition().endColumn)); + {if (true) return bet;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("BetweenEnd"); + } + } + + final public In InEnd(ADQLOperand leftOp) throws ParseException { + trace_call("InEnd"); + try { + Token not=null, start; ADQLQuery q = null; ADQLOperand item; Vector items = new Vector(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NOT: + not = jj_consume_token(NOT); + break; + default: + jj_la1[73] = jj_gen; + ; + } + start = jj_consume_token(IN); + if (jj_2_18(2)) { + q = SubQueryExpression(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_PAR: + jj_consume_token(LEFT_PAR); + item = ValueExpression(); + items.add(item); + label_11: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[74] = jj_gen; + break label_11; + } + jj_consume_token(COMMA); + item = ValueExpression(); + items.add(item); + } + jj_consume_token(RIGHT_PAR); + break; + default: + jj_la1[75] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + try{ + In in; + start = (not!=null) ? not : start; + if (q != null){ + in = queryFactory.createIn(leftOp, q, not!=null); + in.setPosition(new TextPosition(start.beginLine, start.beginColumn, q.getPosition().endLine, q.getPosition().endColumn)); + }else{ + ADQLOperand[] list = new ADQLOperand[items.size()]; + int i=0; + for(ADQLOperand op : items) + list[i++] = op; + in = queryFactory.createIn(leftOp, list, not!=null); + in.setPosition(new TextPosition(start.beginLine, start.beginColumn, list[list.length-1].getPosition().endLine, list[list.length-1].getPosition().endColumn)); + } + {if (true) return in;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("InEnd"); + } + } + +/* ************* */ +/* SQL FUNCTIONS */ +/* ************* */ + final public SQLFunction SqlFunction() throws ParseException { + trace_call("SqlFunction"); + try { + Token fct, all=null, distinct=null, end; ADQLOperand op=null; SQLFunction funct = null; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COUNT: + fct = jj_consume_token(COUNT); + jj_consume_token(LEFT_PAR); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QUANTIFIER: + distinct = jj_consume_token(QUANTIFIER); + break; + default: + jj_la1[76] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASTERISK: + all = jj_consume_token(ASTERISK); + break; + case LEFT_PAR: + case PLUS: + case MINUS: + case AVG: + case MAX: + case MIN: + case SUM: + case COUNT: + case BOX: + case CENTROID: + case CIRCLE: + case POINT: + case POLYGON: + case REGION: + case CONTAINS: + case INTERSECTS: + case AREA: + case COORD1: + case COORD2: + case COORDSYS: + case DISTANCE: + case ABS: + case CEILING: + case DEGREES: + case EXP: + case FLOOR: + case LOG: + case LOG10: + case MOD: + case PI: + case POWER: + case RADIANS: + case RAND: + case ROUND: + case SQRT: + case TRUNCATE: + case ACOS: + case ASIN: + case ATAN: + case ATAN2: + case COS: + case COT: + case SIN: + case TAN: + case STRING_LITERAL: + case SCIENTIFIC_NUMBER: + case UNSIGNED_FLOAT: + case UNSIGNED_INTEGER: + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + op = ValueExpression(); + break; + default: + jj_la1[77] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + end = jj_consume_token(RIGHT_PAR); + funct = queryFactory.createSQLFunction((all!=null)?SQLFunctionType.COUNT_ALL:SQLFunctionType.COUNT, op, distinct != null && distinct.image.equalsIgnoreCase("distinct")); + funct.setPosition(new TextPosition(fct, end)); + break; + case AVG: + case MAX: + case MIN: + case SUM: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AVG: + fct = jj_consume_token(AVG); + break; + case MAX: + fct = jj_consume_token(MAX); + break; + case MIN: + fct = jj_consume_token(MIN); + break; + case SUM: + fct = jj_consume_token(SUM); + break; + default: + jj_la1[78] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(LEFT_PAR); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QUANTIFIER: + distinct = jj_consume_token(QUANTIFIER); + break; + default: + jj_la1[79] = jj_gen; + ; + } + op = ValueExpression(); + end = jj_consume_token(RIGHT_PAR); + funct = queryFactory.createSQLFunction(SQLFunctionType.valueOf(fct.image.toUpperCase()), op, distinct != null && distinct.image.equalsIgnoreCase("distinct")); + funct.setPosition(new TextPosition(fct, end)); + break; + default: + jj_la1[80] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + {if (true) return funct;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("SqlFunction"); + } + } + +/* ************** */ +/* ADQL FUNCTIONS */ +/* ************** */ + final public ADQLOperand[] Coordinates() throws ParseException { + trace_call("Coordinates"); + try { + ADQLOperand[] ops = new ADQLOperand[2]; + ops[0] = NumericExpression(); + jj_consume_token(COMMA); + ops[1] = NumericExpression(); + {if (true) return ops;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("Coordinates"); + } + } + + final public GeometryFunction GeometryFunction() throws ParseException { + trace_call("GeometryFunction"); + try { + Token fct=null, end; GeometryValue gvf1, gvf2; GeometryValue gvp1, gvp2; GeometryFunction gf = null; PointFunction p1=null, p2=null; ADQLColumn col1 = null, col2 = null; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CONTAINS: + case INTERSECTS: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CONTAINS: + fct = jj_consume_token(CONTAINS); + break; + case INTERSECTS: + fct = jj_consume_token(INTERSECTS); + break; + default: + jj_la1[81] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(LEFT_PAR); + gvf1 = GeometryExpression(); + jj_consume_token(COMMA); + gvf2 = GeometryExpression(); + end = jj_consume_token(RIGHT_PAR); + if (fct.image.equalsIgnoreCase("contains")) + gf = queryFactory.createContains(gvf1, gvf2); + else + gf = queryFactory.createIntersects(gvf1, gvf2); + break; + case AREA: + fct = jj_consume_token(AREA); + jj_consume_token(LEFT_PAR); + gvf1 = GeometryExpression(); + end = jj_consume_token(RIGHT_PAR); + gf = queryFactory.createArea(gvf1); + break; + case COORD1: + fct = jj_consume_token(COORD1); + jj_consume_token(LEFT_PAR); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case POINT: + p1 = Point(); + gf = queryFactory.createCoord1(p1); + break; + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + col1 = Column(); + col1.setExpectedType('G'); gf = queryFactory.createCoord1(col1); + break; + default: + jj_la1[82] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + end = jj_consume_token(RIGHT_PAR); + break; + case COORD2: + fct = jj_consume_token(COORD2); + jj_consume_token(LEFT_PAR); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case POINT: + p1 = Point(); + gf = queryFactory.createCoord2(p1); + break; + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + col1 = Column(); + col1.setExpectedType('G'); gf = queryFactory.createCoord2(col1); + break; + default: + jj_la1[83] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + end = jj_consume_token(RIGHT_PAR); + break; + case DISTANCE: + fct = jj_consume_token(DISTANCE); + jj_consume_token(LEFT_PAR); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case POINT: + p1 = Point(); + break; + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + col1 = Column(); + break; + default: + jj_la1[84] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if (p1 != null) + gvp1 = new GeometryValue(p1); + else{ + col1.setExpectedType('G'); + gvp1 = new GeometryValue(col1); + } + jj_consume_token(COMMA); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case POINT: + p2 = Point(); + break; + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + col2 = Column(); + break; + default: + jj_la1[85] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if (p2 != null) + gvp2 = new GeometryValue(p2); + else{ + col2.setExpectedType('G'); + gvp2 = new GeometryValue(col2); + } + end = jj_consume_token(RIGHT_PAR); + gf = queryFactory.createDistance(gvp1, gvp2); + break; + default: + jj_la1[86] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + gf.setPosition(new TextPosition(fct, end)); + {if (true) return gf;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("GeometryFunction"); + } + } + + final public ADQLOperand CoordinateSystem() throws ParseException { + trace_call("CoordinateSystem"); + try { + ADQLOperand coordSys=null; + coordSys = StringExpression(); + {if (true) return coordSys;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("CoordinateSystem"); + } + } + + final public GeometryFunction GeometryValueFunction() throws ParseException { + trace_call("GeometryValueFunction"); + try { + Token fct=null, end=null; ADQLOperand coordSys; ADQLOperand width, height; ADQLOperand[] coords, tmp; Vector vCoords; ADQLOperand op=null; GeometryValue gvf = null; GeometryFunction gf = null; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BOX: + fct = jj_consume_token(BOX); + jj_consume_token(LEFT_PAR); + coordSys = CoordinateSystem(); + jj_consume_token(COMMA); + coords = Coordinates(); + jj_consume_token(COMMA); + width = NumericExpression(); + jj_consume_token(COMMA); + height = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + gf = queryFactory.createBox(coordSys, coords[0], coords[1], width, height); + break; + case CENTROID: + fct = jj_consume_token(CENTROID); + jj_consume_token(LEFT_PAR); + gvf = GeometryExpression(); + end = jj_consume_token(RIGHT_PAR); + gf = queryFactory.createCentroid(gvf); + break; + case CIRCLE: + fct = jj_consume_token(CIRCLE); + jj_consume_token(LEFT_PAR); + coordSys = CoordinateSystem(); + jj_consume_token(COMMA); + coords = Coordinates(); + jj_consume_token(COMMA); + width = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + gf = queryFactory.createCircle(coordSys, coords[0], coords[1], width); + break; + case POINT: + gf = Point(); + break; + case POLYGON: + fct = jj_consume_token(POLYGON); + jj_consume_token(LEFT_PAR); + coordSys = CoordinateSystem(); + vCoords = new Vector(); + jj_consume_token(COMMA); + tmp = Coordinates(); + vCoords.add(tmp[0]); vCoords.add(tmp[1]); + jj_consume_token(COMMA); + tmp = Coordinates(); + vCoords.add(tmp[0]); vCoords.add(tmp[1]); + jj_consume_token(COMMA); + tmp = Coordinates(); + vCoords.add(tmp[0]); vCoords.add(tmp[1]); + label_12: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[87] = jj_gen; + break label_12; + } + jj_consume_token(COMMA); + tmp = Coordinates(); + vCoords.add(tmp[0]); vCoords.add(tmp[1]); + } + end = jj_consume_token(RIGHT_PAR); + gf = queryFactory.createPolygon(coordSys, vCoords); + break; + case REGION: + fct = jj_consume_token(REGION); + jj_consume_token(LEFT_PAR); + op = StringExpression(); + end = jj_consume_token(RIGHT_PAR); + gf = queryFactory.createRegion(op); + break; + default: + jj_la1[88] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + if (fct != null && end != null) // = !(gf instanceof Point) + gf.setPosition(new TextPosition(fct, end)); + {if (true) return gf;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("GeometryValueFunction"); + } + } + + final public PointFunction Point() throws ParseException { + trace_call("Point"); + try { + Token start, end; ADQLOperand coordSys; ADQLOperand[] coords; + start = jj_consume_token(POINT); + jj_consume_token(LEFT_PAR); + coordSys = CoordinateSystem(); + jj_consume_token(COMMA); + coords = Coordinates(); + end = jj_consume_token(RIGHT_PAR); + try{ + PointFunction pf = queryFactory.createPoint(coordSys, coords[0], coords[1]); + pf.setPosition(new TextPosition(start, end)); + {if (true) return pf;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("Point"); + } + } + + final public GeometryFunction ExtractCoordSys() throws ParseException { + trace_call("ExtractCoordSys"); + try { + Token start, end; GeometryValue gvf; + start = jj_consume_token(COORDSYS); + jj_consume_token(LEFT_PAR); + gvf = GeometryExpression(); + end = jj_consume_token(RIGHT_PAR); + try{ + GeometryFunction gf = queryFactory.createExtractCoordSys(gvf); + gf.setPosition(new TextPosition(start, end)); + {if (true) return gf;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("ExtractCoordSys"); + } + } + +/* ***************** */ +/* NUMERIC FUNCTIONS */ +/* ***************** */ + final public ADQLFunction NumericFunction() throws ParseException { + trace_call("NumericFunction"); + try { + ADQLFunction fct; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ABS: + case CEILING: + case DEGREES: + case EXP: + case FLOOR: + case LOG: + case LOG10: + case MOD: + case PI: + case POWER: + case RADIANS: + case RAND: + case ROUND: + case SQRT: + case TRUNCATE: + fct = MathFunction(); + break; + case ACOS: + case ASIN: + case ATAN: + case ATAN2: + case COS: + case COT: + case SIN: + case TAN: + fct = TrigFunction(); + break; + case CONTAINS: + case INTERSECTS: + case AREA: + case COORD1: + case COORD2: + case DISTANCE: + fct = GeometryFunction(); + break; + case REGULAR_IDENTIFIER_CANDIDATE: + fct = UserDefinedFunction(); + ((UserDefinedFunction)fct).setExpectedType('N'); + break; + default: + jj_la1[89] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return fct;} + throw new Error("Missing return statement in function"); + } finally { + trace_return("NumericFunction"); + } + } + + final public MathFunction MathFunction() throws ParseException { + trace_call("MathFunction"); + try { + Token fct=null, end; ADQLOperand param1=null, param2=null; NumericConstant integerValue = null; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ABS: + fct = jj_consume_token(ABS); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case CEILING: + fct = jj_consume_token(CEILING); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case DEGREES: + fct = jj_consume_token(DEGREES); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case EXP: + fct = jj_consume_token(EXP); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case FLOOR: + fct = jj_consume_token(FLOOR); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case LOG: + fct = jj_consume_token(LOG); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case LOG10: + fct = jj_consume_token(LOG10); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case MOD: + fct = jj_consume_token(MOD); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + jj_consume_token(COMMA); + param2 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case PI: + fct = jj_consume_token(PI); + jj_consume_token(LEFT_PAR); + end = jj_consume_token(RIGHT_PAR); + break; + case POWER: + fct = jj_consume_token(POWER); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + jj_consume_token(COMMA); + param2 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case RADIANS: + fct = jj_consume_token(RADIANS); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case RAND: + fct = jj_consume_token(RAND); + jj_consume_token(LEFT_PAR); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_PAR: + case PLUS: + case MINUS: + case AVG: + case MAX: + case MIN: + case SUM: + case COUNT: + case CONTAINS: + case INTERSECTS: + case AREA: + case COORD1: + case COORD2: + case DISTANCE: + case ABS: + case CEILING: + case DEGREES: + case EXP: + case FLOOR: + case LOG: + case LOG10: + case MOD: + case PI: + case POWER: + case RADIANS: + case RAND: + case ROUND: + case SQRT: + case TRUNCATE: + case ACOS: + case ASIN: + case ATAN: + case ATAN2: + case COS: + case COT: + case SIN: + case TAN: + case SCIENTIFIC_NUMBER: + case UNSIGNED_FLOAT: + case UNSIGNED_INTEGER: + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + param1 = NumericExpression(); + break; + default: + jj_la1[90] = jj_gen; + ; + } + end = jj_consume_token(RIGHT_PAR); + break; + case ROUND: + fct = jj_consume_token(ROUND); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + param2 = SignedInteger(); + break; + default: + jj_la1[91] = jj_gen; + ; + } + end = jj_consume_token(RIGHT_PAR); + break; + case SQRT: + fct = jj_consume_token(SQRT); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case TRUNCATE: + fct = jj_consume_token(TRUNCATE); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + param2 = SignedInteger(); + break; + default: + jj_la1[92] = jj_gen; + ; + } + end = jj_consume_token(RIGHT_PAR); + break; + default: + jj_la1[93] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + MathFunction mf = queryFactory.createMathFunction(MathFunctionType.valueOf(fct.image.toUpperCase()), param1, param2); + mf.setPosition(new TextPosition(fct, end)); + {if (true) return mf;} + } catch (Exception ex) { + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("MathFunction"); + } + } + + final public MathFunction TrigFunction() throws ParseException { + trace_call("TrigFunction"); + try { + Token fct=null, end; ADQLOperand param1=null, param2=null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ACOS: + fct = jj_consume_token(ACOS); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case ASIN: + fct = jj_consume_token(ASIN); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case ATAN: + fct = jj_consume_token(ATAN); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case ATAN2: + fct = jj_consume_token(ATAN2); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + jj_consume_token(COMMA); + param2 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case COS: + fct = jj_consume_token(COS); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case COT: + fct = jj_consume_token(COT); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case SIN: + fct = jj_consume_token(SIN); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + case TAN: + fct = jj_consume_token(TAN); + jj_consume_token(LEFT_PAR); + param1 = NumericExpression(); + end = jj_consume_token(RIGHT_PAR); + break; + default: + jj_la1[94] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + try{ + MathFunction mf = queryFactory.createMathFunction(MathFunctionType.valueOf(fct.image.toUpperCase()), param1, param2); + mf.setPosition(new TextPosition(fct, end)); + {if (true) return mf;} + }catch(Exception ex){ + {if (true) throw generateParseException(ex);} + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("TrigFunction"); + } + } + + final public UserDefinedFunction UserDefinedFunction() throws ParseException { + trace_call("UserDefinedFunction"); + try { + Token fct, end; Vector params = new Vector(); ADQLOperand op; + fct = jj_consume_token(REGULAR_IDENTIFIER_CANDIDATE); + jj_consume_token(LEFT_PAR); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_PAR: + case PLUS: + case MINUS: + case AVG: + case MAX: + case MIN: + case SUM: + case COUNT: + case BOX: + case CENTROID: + case CIRCLE: + case POINT: + case POLYGON: + case REGION: + case CONTAINS: + case INTERSECTS: + case AREA: + case COORD1: + case COORD2: + case COORDSYS: + case DISTANCE: + case ABS: + case CEILING: + case DEGREES: + case EXP: + case FLOOR: + case LOG: + case LOG10: + case MOD: + case PI: + case POWER: + case RADIANS: + case RAND: + case ROUND: + case SQRT: + case TRUNCATE: + case ACOS: + case ASIN: + case ATAN: + case ATAN2: + case COS: + case COT: + case SIN: + case TAN: + case STRING_LITERAL: + case SCIENTIFIC_NUMBER: + case UNSIGNED_FLOAT: + case UNSIGNED_INTEGER: + case DELIMITED_IDENTIFIER: + case REGULAR_IDENTIFIER_CANDIDATE: + op = ValueExpression(); + params.add(op); + label_13: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[95] = jj_gen; + break label_13; + } + jj_consume_token(COMMA); + op = ValueExpression(); + params.add(op); + } + break; + default: + jj_la1[96] = jj_gen; + ; + } + end = jj_consume_token(RIGHT_PAR); + // Ensure the given function name is valid: + if (!isRegularIdentifier(fct.image)) + {if (true) throw new ParseException("Invalid (User Defined) Function name: \u005c""+fct.image+"\u005c"!", new TextPosition(fct));} + + //System.out.println("INFO [ADQLParser]: \""+fct.image+"\" (from line "+fct.beginLine+" and column "+fct.beginColumn+" to line "+token.endLine+" and column "+(token.endColumn+1)+") is considered as an user defined function !"); + + try{ + // Build the parameters list: + ADQLOperand[] parameters = new ADQLOperand[params.size()]; + for(int i=0; i 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + trace_token(token, ""); + 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++; + trace_token(token, " (in getNextToken)"); + return token; + } + +/** Get the specific Token. */ + final public Token getToken(int index) { + Token t = 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 java.util.List jj_expentries = new java.util.ArrayList(); + private int[] jj_expentry; + private int jj_kind = -1; + private 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]; + } + boolean exists = false; + for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + exists = true; + int[] oldentry = (int[])(it.next()); + if (oldentry.length == jj_expentry.length) { + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + exists = false; + break; + } + } + if (exists) break; + } + } + if (!exists) jj_expentries.add(jj_expentry); + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } + } + + /** Generate ParseException. */ + public ParseException generateParseException() { + jj_expentries.clear(); + boolean[] la1tokens = new boolean[105]; + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 97; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1<" + where); + } + } + + private void trace_scan(Token t1, int t2) { + if (trace_enabled) { + for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } + System.out.print("Visited token: <" + tokenImage[t1.kind]); + if (t1.kind != 0 && !tokenImage[t1.kind].equals("\"" + t1.image + "\"")) { + System.out.print(": \"" + t1.image + "\""); + } + System.out.println(" at line " + t1.beginLine + " column " + t1.beginColumn + ">; Expected token: <" + tokenImage[t2] + ">"); + } + } + + private void jj_rescan_token() { + jj_rescan = true; + for (int i = 0; i < 18; 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; + } + } + 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; + } } diff --git a/src/adql/parser/ADQLParserConstants.java b/src/adql/parser/ADQLParserConstants.java index 7d09b7bc..79015436 100644 --- a/src/adql/parser/ADQLParserConstants.java +++ b/src/adql/parser/ADQLParserConstants.java @@ -33,175 +33,179 @@ public interface ADQLParserConstants { /** RegularExpression Id. */ int DIVIDE = 12; /** RegularExpression Id. */ - int EQUAL = 13; + int LOGIC_AND = 13; /** RegularExpression Id. */ - int NOT_EQUAL = 14; + int LOGIC_OR = 14; /** RegularExpression Id. */ - int LESS_THAN = 15; + int EQUAL = 15; /** RegularExpression Id. */ - int LESS_EQUAL_THAN = 16; + int NOT_EQUAL = 16; /** RegularExpression Id. */ - int GREATER_THAN = 17; + int LESS_THAN = 17; /** RegularExpression Id. */ - int GREATER_EQUAL_THAN = 18; + int LESS_EQUAL_THAN = 18; /** RegularExpression Id. */ - int SELECT = 19; + int GREATER_THAN = 19; /** RegularExpression Id. */ - int QUANTIFIER = 20; + int GREATER_EQUAL_THAN = 20; /** RegularExpression Id. */ - int TOP = 21; + int SELECT = 21; /** RegularExpression Id. */ - int FROM = 22; + int QUANTIFIER = 22; /** RegularExpression Id. */ - int AS = 23; + int TOP = 23; /** RegularExpression Id. */ - int NATURAL = 24; + int FROM = 24; /** RegularExpression Id. */ - int INNER = 25; + int AS = 25; /** RegularExpression Id. */ - int OUTER = 26; + int NATURAL = 26; /** RegularExpression Id. */ - int RIGHT = 27; + int INNER = 27; /** RegularExpression Id. */ - int LEFT = 28; + int OUTER = 28; /** RegularExpression Id. */ - int FULL = 29; + int RIGHT = 29; /** RegularExpression Id. */ - int JOIN = 30; + int LEFT = 30; /** RegularExpression Id. */ - int ON = 31; + int FULL = 31; /** RegularExpression Id. */ - int USING = 32; + int JOIN = 32; /** RegularExpression Id. */ - int WHERE = 33; + int ON = 33; /** RegularExpression Id. */ - int AND = 34; + int USING = 34; /** RegularExpression Id. */ - int OR = 35; + int WHERE = 35; /** RegularExpression Id. */ - int NOT = 36; + int AND = 36; /** RegularExpression Id. */ - int IS = 37; + int OR = 37; /** RegularExpression Id. */ - int NULL = 38; + int NOT = 38; /** RegularExpression Id. */ - int BETWEEN = 39; + int IS = 39; /** RegularExpression Id. */ - int LIKE = 40; + int NULL = 40; /** RegularExpression Id. */ - int IN = 41; + int BETWEEN = 41; /** RegularExpression Id. */ - int EXISTS = 42; + int LIKE = 42; /** RegularExpression Id. */ - int BY = 43; + int IN = 43; /** RegularExpression Id. */ - int GROUP = 44; + int EXISTS = 44; /** RegularExpression Id. */ - int HAVING = 45; + int BY = 45; /** RegularExpression Id. */ - int ORDER = 46; + int GROUP = 46; /** RegularExpression Id. */ - int ASC = 47; + int HAVING = 47; /** RegularExpression Id. */ - int DESC = 48; + int ORDER = 48; /** RegularExpression Id. */ - int AVG = 49; + int ASC = 49; /** RegularExpression Id. */ - int MAX = 50; + int DESC = 50; /** RegularExpression Id. */ - int MIN = 51; + int AVG = 51; /** RegularExpression Id. */ - int SUM = 52; + int MAX = 52; /** RegularExpression Id. */ - int COUNT = 53; + int MIN = 53; /** RegularExpression Id. */ - int BOX = 54; + int SUM = 54; /** RegularExpression Id. */ - int CENTROID = 55; + int COUNT = 55; /** RegularExpression Id. */ - int CIRCLE = 56; + int BOX = 56; /** RegularExpression Id. */ - int POINT = 57; + int CENTROID = 57; /** RegularExpression Id. */ - int POLYGON = 58; + int CIRCLE = 58; /** RegularExpression Id. */ - int REGION = 59; + int POINT = 59; /** RegularExpression Id. */ - int CONTAINS = 60; + int POLYGON = 60; /** RegularExpression Id. */ - int INTERSECTS = 61; + int REGION = 61; /** RegularExpression Id. */ - int AREA = 62; + int CONTAINS = 62; /** RegularExpression Id. */ - int COORD1 = 63; + int INTERSECTS = 63; /** RegularExpression Id. */ - int COORD2 = 64; + int AREA = 64; /** RegularExpression Id. */ - int COORDSYS = 65; + int COORD1 = 65; /** RegularExpression Id. */ - int DISTANCE = 66; + int COORD2 = 66; /** RegularExpression Id. */ - int ABS = 67; + int COORDSYS = 67; /** RegularExpression Id. */ - int CEILING = 68; + int DISTANCE = 68; /** RegularExpression Id. */ - int DEGREES = 69; + int ABS = 69; /** RegularExpression Id. */ - int EXP = 70; + int CEILING = 70; /** RegularExpression Id. */ - int FLOOR = 71; + int DEGREES = 71; /** RegularExpression Id. */ - int LOG = 72; + int EXP = 72; /** RegularExpression Id. */ - int LOG10 = 73; + int FLOOR = 73; /** RegularExpression Id. */ - int MOD = 74; + int LOG = 74; /** RegularExpression Id. */ - int PI = 75; + int LOG10 = 75; /** RegularExpression Id. */ - int POWER = 76; + int MOD = 76; /** RegularExpression Id. */ - int RADIANS = 77; + int PI = 77; /** RegularExpression Id. */ - int RAND = 78; + int POWER = 78; /** RegularExpression Id. */ - int ROUND = 79; + int RADIANS = 79; /** RegularExpression Id. */ - int SQRT = 80; + int RAND = 80; /** RegularExpression Id. */ - int TRUNCATE = 81; + int ROUND = 81; /** RegularExpression Id. */ - int ACOS = 82; + int SQRT = 82; /** RegularExpression Id. */ - int ASIN = 83; + int TRUNCATE = 83; /** RegularExpression Id. */ - int ATAN = 84; + int ACOS = 84; /** RegularExpression Id. */ - int ATAN2 = 85; + int ASIN = 85; /** RegularExpression Id. */ - int COS = 86; + int ATAN = 86; /** RegularExpression Id. */ - int COT = 87; + int ATAN2 = 87; /** RegularExpression Id. */ - int SIN = 88; + int COS = 88; /** RegularExpression Id. */ - int TAN = 89; + int COT = 89; /** RegularExpression Id. */ - int STRING_LITERAL = 93; + int SIN = 90; /** RegularExpression Id. */ - int SCIENTIFIC_NUMBER = 94; + int TAN = 91; /** RegularExpression Id. */ - int UNSIGNED_FLOAT = 95; + int STRING_LITERAL = 95; /** RegularExpression Id. */ - int UNSIGNED_INTEGER = 96; + int SCIENTIFIC_NUMBER = 96; /** RegularExpression Id. */ - int DIGIT = 97; + int UNSIGNED_FLOAT = 97; /** RegularExpression Id. */ - int DELIMITED_IDENTIFIER = 100; + int UNSIGNED_INTEGER = 98; /** RegularExpression Id. */ - int REGULAR_IDENTIFIER_CANDIDATE = 101; + int DIGIT = 99; /** RegularExpression Id. */ - int Letter = 102; + int DELIMITED_IDENTIFIER = 102; + /** RegularExpression Id. */ + int REGULAR_IDENTIFIER_CANDIDATE = 103; + /** RegularExpression Id. */ + int Letter = 104; /** Lexical state. */ int DEFAULT = 0; @@ -225,6 +229,8 @@ public interface ADQLParserConstants { "\"-\"", "\"*\"", "\"/\"", + "\"&\"", + "\"|\"", "\"=\"", "", "\"<\"", @@ -302,16 +308,16 @@ public interface ADQLParserConstants { "\"COT\"", "\"SIN\"", "\"TAN\"", - "", - "\"\\\'\"", "", "\"\\\'\"", + "", + "\"\\\'\"", "", "", "", "", "\"\\\"\"", - "", + "", "\"\\\"\"", "", "", diff --git a/src/adql/parser/ADQLParserTokenManager.java b/src/adql/parser/ADQLParserTokenManager.java index 0a090be2..9ff1ad75 100644 --- a/src/adql/parser/ADQLParserTokenManager.java +++ b/src/adql/parser/ADQLParserTokenManager.java @@ -50,7 +50,7 @@ private int jjMoveStringLiteralDfa0_2() switch(curChar) { case 34: - return jjStartNfaWithStates_2(0, 100, 1); + return jjStartNfaWithStates_2(0, 102, 1); default : return jjMoveNfa_2(0, 0); } @@ -87,15 +87,15 @@ private int jjMoveNfa_2(int startState, int curPos) case 0: if ((0xfffffffbffffffffL & l) != 0L) { - if (kind > 99) - kind = 99; + if (kind > 101) + kind = 101; } else if (curChar == 34) jjstateSet[jjnewStateCnt++] = 1; break; case 1: - if (curChar == 34 && kind > 99) - kind = 99; + if (curChar == 34 && kind > 101) + kind = 101; break; case 2: if (curChar == 34) @@ -113,7 +113,7 @@ else if (curChar < 128) switch(jjstateSet[--i]) { case 0: - kind = 99; + kind = 101; break; default : break; } @@ -128,8 +128,8 @@ else if (curChar < 128) switch(jjstateSet[--i]) { case 0: - if ((jjbitVec0[i2] & l2) != 0L && kind > 99) - kind = 99; + if ((jjbitVec0[i2] & l2) != 0L && kind > 101) + kind = 101; break; default : break; } @@ -153,446 +153,446 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) switch (pos) { case 0: - if ((active0 & 0x600000000000000L) != 0L || (active1 & 0x1800L) != 0L) + if ((active0 & 0x14004000000L) != 0L) { - jjmatchedKind = 101; - return 491; - } - if ((active0 & 0x10010000000L) != 0L || (active1 & 0x300L) != 0L) - { - jjmatchedKind = 101; - return 404; + jjmatchedKind = 103; + return 439; } - if ((active0 & 0x200000L) != 0L || (active1 & 0x2020000L) != 0L) + if ((active0 & 0x4680000000000000L) != 0L || (active1 & 0x300004eL) != 0L) { - jjmatchedKind = 101; - return 670; + jjmatchedKind = 103; + return 52; } - if ((active0 & 0x5001000000L) != 0L) + if ((active0 & 0x800000000000L) != 0L) { - jjmatchedKind = 101; - return 439; + jjmatchedKind = 103; + return 5; } - if ((active0 & 0x2000022002000000L) != 0L) + if ((active0 & 0x8000088008000000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; return 332; } - if ((active0 & 0x4002800400800000L) != 0L || (active1 & 0x3c0008L) != 0L) + if ((active0 & 0xa001002000000L) != 0L || (active1 & 0xf00021L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; return 910; } - if ((active0 & 0x40000000L) != 0L) + if ((active0 & 0x40000000200000L) != 0L || (active1 & 0x4040000L) != 0L) { - jjmatchedKind = 101; - return 965; + jjmatchedKind = 103; + return 590; } - if ((active0 & 0x20L) != 0L) - return 966; - if ((active0 & 0x100000000L) != 0L) + if ((active0 & 0x400000000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; return 752; } - if ((active0 & 0x1000000000000L) != 0L || (active1 & 0x24L) != 0L) + if ((active0 & 0x800000L) != 0L || (active1 & 0x8080000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; + return 670; + } + if ((active0 & 0x4000000000000L) != 0L || (active1 & 0x90L) != 0L) + { + jjmatchedKind = 103; return 813; } - if ((active0 & 0x100000000000L) != 0L) + if ((active0 & 0x81000000L) != 0L || (active1 & 0x200L) != 0L) { - jjmatchedKind = 101; - return 315; + jjmatchedKind = 103; + return 295; + } + if ((active0 & 0x2000000020000000L) != 0L || (active1 & 0x38000L) != 0L) + { + jjmatchedKind = 103; + return 550; } - if ((active0 & 0x18000L) != 0L) + if ((active0 & 0x20L) != 0L) + return 965; + if ((active0 & 0x60000L) != 0L) return 17; if ((active0 & 0x400L) != 0L) return 22; - if ((active0 & 0x40088000000000L) != 0L) - { - jjmatchedKind = 101; - return 33; - } - if ((active0 & 0x20400000L) != 0L || (active1 & 0x80L) != 0L) + if ((active0 & 0x1800000000000000L) != 0L || (active1 & 0x6000L) != 0L) { - jjmatchedKind = 101; - return 295; + jjmatchedKind = 103; + return 491; } - if ((active0 & 0xc000000000000L) != 0L || (active1 & 0x400L) != 0L) + if ((active0 & 0x100220000000000L) != 0L) { - jjmatchedKind = 101; - return 424; + jjmatchedKind = 103; + return 33; } - if ((active0 & 0x91a0000000000000L) != 0L || (active1 & 0xc00013L) != 0L) + if ((active0 & 0x40040000000L) != 0L || (active1 & 0xc00L) != 0L) { - jjmatchedKind = 101; - return 52; + jjmatchedKind = 103; + return 404; } - if ((active0 & 0x800000008000000L) != 0L || (active1 & 0xe000L) != 0L) + if ((active0 & 0x100000000L) != 0L) { - jjmatchedKind = 101; - return 550; + jjmatchedKind = 103; + return 966; } - if ((active0 & 0x10000000080000L) != 0L || (active1 & 0x1010000L) != 0L) + if ((active0 & 0x100000000000L) != 0L || (active1 & 0x100L) != 0L) { - jjmatchedKind = 101; - return 590; + jjmatchedKind = 103; + return 249; } - if ((active0 & 0x40000000000L) != 0L || (active1 & 0x40L) != 0L) + if ((active0 & 0x1002210000000L) != 0L) { - jjmatchedKind = 101; - return 249; + jjmatchedKind = 103; + return 471; } - if ((active0 & 0x200000000L) != 0L) + if ((active0 & 0x800000000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; return 797; } - if ((active0 & 0x400884000000L) != 0L) + if ((active0 & 0x30000000000000L) != 0L || (active1 & 0x1000L) != 0L) { - jjmatchedKind = 101; - return 471; + jjmatchedKind = 103; + return 424; } - if ((active0 & 0x200000000000L) != 0L) + if ((active0 & 0x400000000000L) != 0L) { - jjmatchedKind = 101; - return 5; + jjmatchedKind = 103; + return 315; } return -1; case 1: - if ((active0 & 0x2000020002000000L) != 0L) + if ((active0 & 0x8000080008000000L) != 0L) return 345; - if ((active0 & 0x40000000000000L) != 0L) + if ((active1 & 0x1000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 45; + return 431; } - if ((active1 & 0x40000L) != 0L) + if ((active1 & 0xc00L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 913; + return 416; } - if ((active1 & 0x2000000L) != 0L) + if ((active1 & 0x100000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 669; + return 913; } - if ((active0 & 0x8000000000L) != 0L) + if ((active1 & 0x8000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 32; + return 669; } - if ((active0 & 0x1000000L) != 0L) + if ((active0 & 0x4000000000000L) != 0L || (active1 & 0x80L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 438; + return 821; } - if ((active0 & 0x10000000000000L) != 0L) + if ((active0 & 0x100000000000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 656; + return 45; } - if ((active0 & 0x100000000L) != 0L) + if ((active0 & 0x800000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 770; + return 796; } - if ((active0 & 0x800000000000000L) != 0L) + if ((active0 & 0x40000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 549; + return 410; } - if ((active0 & 0x2000000000L) != 0L) - return 396; - if ((active1 & 0x400L) != 0L) + if ((active0 & 0x2000000000000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 431; + return 549; } - if ((active1 & 0x10000L) != 0L) + if ((active0 & 0x40000000000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 637; + return 656; } - if ((active0 & 0x4000000000000000L) != 0L) + if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 967; + return 32; } - if ((active0 & 0x4000000L) != 0L) + if ((active1 & 0x20000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 482; + return 581; } - if ((active0 & 0x400000000L) != 0L) + if ((active0 & 0x8000000000L) != 0L) + return 396; + if ((active1 & 0x40000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 968; + return 637; } - if ((active1 & 0x300L) != 0L) + if ((active1 & 0x10L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 416; + return 877; } - if ((active0 & 0x600000000000000L) != 0L || (active1 & 0x1000L) != 0L) + if ((active0 & 0x10000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 501; + return 482; } - if ((active1 & 0x8L) != 0L) + if ((active0 & 0x10000000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 909; + return 454; } - if ((active0 & 0x200000000L) != 0L) + if ((active0 & 0x6088401a1000000L) != 0L || (active1 & 0x18040L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 796; + return 966; } - if ((active0 & 0x8000000000000L) != 0L) + if ((active0 & 0x200000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 427; + return 597; } - if ((active0 & 0x182210068400000L) != 0L || (active1 & 0x6010L) != 0L) + if ((active0 & 0x1800000000000000L) != 0L || (active1 & 0x4000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 965; + return 501; } - if ((active0 & 0x10000000L) != 0L) + if ((active0 & 0x1000000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 410; + return 967; } - if ((active0 & 0x1000000000000L) != 0L || (active1 & 0x20L) != 0L) + if ((active1 & 0x1L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 821; + return 968; } - if ((active1 & 0x4L) != 0L) + if ((active0 & 0x20000000000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 877; + return 427; } - if ((active0 & 0x480800000000L) != 0L || (active1 & 0x800L) != 0L) - return 965; - if ((active1 & 0x20000L) != 0L) + if ((active1 & 0x20L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 717; + return 909; } - if ((active1 & 0x80L) != 0L) + if ((active0 & 0x4080000000000000L) != 0L || (active1 & 0x300000eL) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 303; + return 113; } - if ((active0 & 0x40000000000L) != 0L || (active1 & 0x40L) != 0L) + if ((active0 & 0x100000000000L) != 0L || (active1 & 0x100L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } return 264; } - if ((active1 & 0x8000L) != 0L) + if ((active1 & 0x80000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 581; + return 717; } - if ((active0 & 0x80000000L) != 0L) - return 472; - if ((active0 & 0x4000000000000L) != 0L) + if ((active0 & 0x1202000000000L) != 0L || (active1 & 0x2000L) != 0L) + return 966; + if ((active1 & 0x200L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 423; + return 303; } - if ((active0 & 0x1000200000L) != 0L || (active1 & 0x300000L) != 0L) + if ((active0 & 0x200000000L) != 0L) + return 472; + if ((active0 & 0x10000000000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 2; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 965; + return 423; } - if ((active0 & 0x4000000000L) != 0L) + if ((active0 & 0x4000800000L) != 0L || (active1 & 0xc00000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 2; jjmatchedPos = 1; } - return 454; + return 966; } - if ((active0 & 0x100000000000L) != 0L) + if ((active0 & 0x4000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 324; + return 438; } - if ((active0 & 0x800000800000L) != 0L || (active1 & 0x80000L) != 0L) + if ((active0 & 0x2000002000000L) != 0L || (active1 & 0x200000L) != 0L) return 932; - if ((active1 & 0x1000000L) != 0L) + if ((active0 & 0x400000000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 620; + return 324; } - if ((active0 & 0x80000L) != 0L) + if ((active1 & 0x4000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 597; + return 620; } - if ((active0 & 0x9020000000000000L) != 0L || (active1 & 0xc00003L) != 0L) + if ((active0 & 0x400000000L) != 0L) { if (jjmatchedPos != 1) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 1; } - return 113; + return 770; } return -1; case 2: - if ((active0 & 0x56801400200000L) != 0L || (active1 & 0x3c00340L) != 0L) - return 965; - if ((active0 & 0x8fa075817a480000L) != 0L || (active1 & 0x3df033L) != 0L) + if ((active0 & 0x15a005000800000L) != 0L || (active1 & 0xf000d00L) != 0L) + return 966; + if ((active1 & 0x80000L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 2; } - return 965; + return 968; } - if ((active0 & 0x1000000000000L) != 0L) + if ((active0 & 0x20000000000000L) != 0L) + return 426; + if ((active1 & 0x10L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 2; } - return 859; + return 884; } - if ((active0 & 0x8000000000000L) != 0L) - return 426; - if ((active0 & 0x2000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { if (jjmatchedPos != 2) { @@ -601,213 +601,213 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) } return 373; } - if ((active0 & 0x4000000000L) != 0L) + if ((active0 & 0x10000000L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 2; } - return 453; + return 481; } - if ((active1 & 0x4L) != 0L) + if ((active1 & 0x1000L) != 0L) + return 430; + if ((active0 & 0x4000000L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 2; } - return 884; + return 443; } - if ((active1 & 0x400L) != 0L) - return 430; - if ((active1 & 0x8L) != 0L) - return 908; - if ((active0 & 0x200000000L) != 0L) + if ((active0 & 0x800000000L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 2; } return 801; } - if ((active0 & 0x4000000L) != 0L) + if ((active1 & 0x20L) != 0L) + return 908; + if ((active1 & 0x200L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 2; } - return 481; + return 302; } - if ((active1 & 0x20000L) != 0L) + if ((active0 & 0x4000000000000000L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 2; } - return 967; + return 137; } - if ((active0 & 0x4000000000000000L) != 0L) + if ((active0 & 0x3e81d605e9200000L) != 0L || (active1 & 0xf7c0ceL) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 2; + jjmatchedKind = 103; jjmatchedPos = 2; } - return 965; + return 966; } - if ((active0 & 0x1000000L) != 0L) + if ((active1 & 0x1L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 2; jjmatchedPos = 2; } - return 443; + return 966; } - if ((active0 & 0x1000000000000000L) != 0L) + if ((active0 & 0x4000000000000L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 2; } - return 137; + return 859; } - if ((active1 & 0x80L) != 0L) + if ((active0 & 0x10000000000L) != 0L) { if (jjmatchedPos != 2) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 2; } - return 302; + return 453; } return -1; case 3: - if ((active1 & 0x4L) != 0L) + if ((active0 & 0x10000000000L) != 0L) + return 452; + if ((active0 & 0x3e81d20c3c200000L) != 0L || (active1 & 0xac2ceL) != 0L) { if (jjmatchedPos != 3) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 3; } - return 900; + return 966; } - if ((active0 & 0x8fa074830f080000L) != 0L || (active1 & 0x2b0b3L) != 0L) + if ((active1 & 0x10L) != 0L) { if (jjmatchedPos != 3) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 3; } - return 965; + return 900; } - if ((active0 & 0x1000000000000000L) != 0L) + if ((active0 & 0x401c1000000L) != 0L || (active1 & 0xf50001L) != 0L) + return 966; + if ((active0 & 0x8000000000000000L) != 0L) { if (jjmatchedPos != 3) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 3; } - return 168; + return 372; } - if ((active0 & 0x4000000000L) != 0L) - return 452; - if ((active0 & 0x2000000000000000L) != 0L) + if ((active1 & 0x800L) != 0L) { if (jjmatchedPos != 3) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 3; } - return 372; + return 28; } - if ((active0 & 0x4000010070400000L) != 0L || (active1 & 0x3d4000L) != 0L) - return 965; - if ((active1 & 0x200L) != 0L) + if ((active0 & 0x4000000000000000L) != 0L) { if (jjmatchedPos != 3) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 3; } - return 28; + return 168; } - if ((active0 & 0x1000000000000L) != 0L) + if ((active0 & 0x4000000000000L) != 0L) return 858; return -1; case 4: - if ((active0 & 0x9d80248001080000L) != 0L || (active1 & 0x22037L) != 0L) + if ((active1 & 0x800800L) != 0L) + return 28; + if ((active0 & 0x7600920004200000L) != 0L || (active1 & 0x880deL) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 4; - return 965; + return 966; } - if ((active1 & 0x200200L) != 0L) - return 28; - if ((active0 & 0x2000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 4; return 378; } - if ((active0 & 0x22050030e000000L) != 0L || (active1 & 0x9080L) != 0L) - return 965; + if ((active0 & 0x881400c38000000L) != 0L || (active1 & 0x24200L) != 0L) + return 966; return -1; case 5: - if ((active0 & 0x8000000000000000L) != 0L || (active1 & 0x1L) != 0L) - return 28; - if ((active0 & 0x2000000000000000L) != 0L) + if ((active0 & 0x5200020004000000L) != 0L || (active1 & 0x880d8L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 5; - return 377; + return 966; } - if ((active0 & 0x900240000080000L) != 0L) - return 965; - if ((active0 & 0x1480008001000000L) != 0L || (active1 & 0x22036L) != 0L) + if ((active1 & 0x6L) != 0L) + return 28; + if ((active0 & 0x2400900000200000L) != 0L) + return 966; + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 5; - return 965; + return 377; } return -1; case 6: - if ((active0 & 0x2000000000000000L) != 0L) + if ((active0 & 0x4200000000000000L) != 0L || (active1 & 0x80018L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 6; - return 376; + return 966; } - if ((active0 & 0x1080000000000000L) != 0L || (active1 & 0x20006L) != 0L) + if ((active0 & 0x1000020004000000L) != 0L || (active1 & 0x80c0L) != 0L) + return 966; + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 6; - return 965; + return 376; } - if ((active0 & 0x400008001000000L) != 0L || (active1 & 0x2030L) != 0L) - return 965; return -1; case 7: - if ((active0 & 0x1080000000000000L) != 0L || (active1 & 0x20006L) != 0L) - return 965; - if ((active0 & 0x2000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 103; jjmatchedPos = 7; return 969; } + if ((active0 & 0x4200000000000000L) != 0L || (active1 & 0x80018L) != 0L) + return 966; return -1; case 8: - if ((active0 & 0x2000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { jjmatchedKind = 2; jjmatchedPos = 8; - return 965; + return 966; } return -1; default : @@ -823,9 +823,11 @@ private int jjMoveStringLiteralDfa0_0() switch(curChar) { case 34: - return jjStopAtPos(0, 98); + return jjStopAtPos(0, 100); + case 38: + return jjStopAtPos(0, 13); case 39: - return jjStopAtPos(0, 91); + return jjStopAtPos(0, 93); case 40: return jjStopAtPos(0, 3); case 41: @@ -839,80 +841,81 @@ private int jjMoveStringLiteralDfa0_0() case 45: return jjStartNfaWithStates_0(0, 10, 22); case 46: - return jjStartNfaWithStates_0(0, 5, 966); + return jjStartNfaWithStates_0(0, 5, 965); case 47: return jjStopAtPos(0, 12); case 59: return jjStopAtPos(0, 7); case 60: - jjmatchedKind = 15; - return jjMoveStringLiteralDfa1_0(0x10000L, 0x0L); - case 61: - return jjStopAtPos(0, 13); - case 62: jjmatchedKind = 17; return jjMoveStringLiteralDfa1_0(0x40000L, 0x0L); + case 61: + return jjStopAtPos(0, 15); + case 62: + jjmatchedKind = 19; + return jjMoveStringLiteralDfa1_0(0x100000L, 0x0L); case 65: case 97: - return jjMoveStringLiteralDfa1_0(0x4002800400800000L, 0x3c0008L); + return jjMoveStringLiteralDfa1_0(0xa001002000000L, 0xf00021L); case 66: case 98: - return jjMoveStringLiteralDfa1_0(0x40088000000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x100220000000000L, 0x0L); case 67: case 99: - return jjMoveStringLiteralDfa1_0(0x91a0000000000000L, 0xc00013L); + return jjMoveStringLiteralDfa1_0(0x4680000000000000L, 0x300004eL); case 68: case 100: - return jjMoveStringLiteralDfa1_0(0x1000000000000L, 0x24L); + return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x90L); case 69: case 101: - return jjMoveStringLiteralDfa1_0(0x40000000000L, 0x40L); + return jjMoveStringLiteralDfa1_0(0x100000000000L, 0x100L); case 70: case 102: - return jjMoveStringLiteralDfa1_0(0x20400000L, 0x80L); + return jjMoveStringLiteralDfa1_0(0x81000000L, 0x200L); case 71: case 103: - return jjMoveStringLiteralDfa1_0(0x100000000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400000000000L, 0x0L); case 72: case 104: - return jjMoveStringLiteralDfa1_0(0x200000000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x800000000000L, 0x0L); case 73: case 105: - return jjMoveStringLiteralDfa1_0(0x2000022002000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000088008000000L, 0x0L); case 74: case 106: - return jjMoveStringLiteralDfa1_0(0x40000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x100000000L, 0x0L); case 76: case 108: - return jjMoveStringLiteralDfa1_0(0x10010000000L, 0x300L); + return jjMoveStringLiteralDfa1_0(0x40040000000L, 0xc00L); case 77: case 109: - return jjMoveStringLiteralDfa1_0(0xc000000000000L, 0x400L); + return jjMoveStringLiteralDfa1_0(0x30000000000000L, 0x1000L); case 78: case 110: - return jjMoveStringLiteralDfa1_0(0x5001000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x14004000000L, 0x0L); case 79: case 111: - return jjMoveStringLiteralDfa1_0(0x400884000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1002210000000L, 0x0L); case 80: case 112: - return jjMoveStringLiteralDfa1_0(0x600000000000000L, 0x1800L); + return jjMoveStringLiteralDfa1_0(0x1800000000000000L, 0x6000L); case 82: case 114: - return jjMoveStringLiteralDfa1_0(0x800000008000000L, 0xe000L); + return jjMoveStringLiteralDfa1_0(0x2000000020000000L, 0x38000L); case 83: case 115: - return jjMoveStringLiteralDfa1_0(0x10000000080000L, 0x1010000L); + return jjMoveStringLiteralDfa1_0(0x40000000200000L, 0x4040000L); case 84: case 116: - return jjMoveStringLiteralDfa1_0(0x200000L, 0x2020000L); + return jjMoveStringLiteralDfa1_0(0x800000L, 0x8080000L); case 85: case 117: - return jjMoveStringLiteralDfa1_0(0x100000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400000000L, 0x0L); case 87: case 119: - return jjMoveStringLiteralDfa1_0(0x200000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x800000000L, 0x0L); case 124: + jjmatchedKind = 14; return jjMoveStringLiteralDfa1_0(0x100L, 0x0L); default : return jjMoveNfa_0(0, 0); @@ -928,84 +931,84 @@ private int jjMoveStringLiteralDfa1_0(long active0, long active1) switch(curChar) { case 61: - if ((active0 & 0x10000L) != 0L) - return jjStopAtPos(1, 16); - else if ((active0 & 0x40000L) != 0L) + if ((active0 & 0x40000L) != 0L) return jjStopAtPos(1, 18); + else if ((active0 & 0x100000L) != 0L) + return jjStopAtPos(1, 20); break; case 65: case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x4200001000000L, active1, 0x2006000L); + return jjMoveStringLiteralDfa2_0(active0, 0x10800004000000L, active1, 0x8018000L); case 66: case 98: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x8L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x20L); case 67: case 99: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x40000L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x100000L); case 69: case 101: - return jjMoveStringLiteralDfa2_0(active0, 0x881008010080000L, active1, 0x30L); + return jjMoveStringLiteralDfa2_0(active0, 0x2204020040200000L, active1, 0xc0L); case 72: case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x200000000L, active1, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x800000000L, active1, 0L); case 73: case 105: - if ((active1 & 0x800L) != 0L) - return jjStartNfaWithStates_0(1, 75, 965); - return jjMoveStringLiteralDfa2_0(active0, 0x108010008000000L, active1, 0x1000004L); + if ((active1 & 0x2000L) != 0L) + return jjStartNfaWithStates_0(1, 77, 966); + return jjMoveStringLiteralDfa2_0(active0, 0x420040020000000L, active1, 0x4000010L); case 76: case 108: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x200L); case 78: case 110: - if ((active0 & 0x80000000L) != 0L) - return jjStartNfaWithStates_0(1, 31, 472); - else if ((active0 & 0x20000000000L) != 0L) + if ((active0 & 0x200000000L) != 0L) + return jjStartNfaWithStates_0(1, 33, 472); + else if ((active0 & 0x80000000000L) != 0L) { - jjmatchedKind = 41; + jjmatchedKind = 43; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x2000000402000000L, active1, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000001008000000L, active1, 0L); case 79: case 111: - return jjMoveStringLiteralDfa2_0(active0, 0x9660001040200000L, active1, 0xc09703L); + return jjMoveStringLiteralDfa2_0(active0, 0x5980004100800000L, active1, 0x3025c0eL); case 81: case 113: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x40000L); case 82: case 114: - if ((active0 & 0x800000000L) != 0L) + if ((active0 & 0x2000000000L) != 0L) { - jjmatchedKind = 35; + jjmatchedKind = 37; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x4000500000400000L, active1, 0x20000L); + return jjMoveStringLiteralDfa2_0(active0, 0x1400001000000L, active1, 0x80001L); case 83: case 115: - if ((active0 & 0x800000L) != 0L) + if ((active0 & 0x2000000L) != 0L) { - jjmatchedKind = 23; + jjmatchedKind = 25; jjmatchedPos = 1; } - else if ((active0 & 0x2000000000L) != 0L) - return jjStartNfaWithStates_0(1, 37, 396); - return jjMoveStringLiteralDfa2_0(active0, 0x800100000000L, active1, 0x80000L); + else if ((active0 & 0x8000000000L) != 0L) + return jjStartNfaWithStates_0(1, 39, 396); + return jjMoveStringLiteralDfa2_0(active0, 0x2000400000000L, active1, 0x200000L); case 84: case 116: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x300000L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xc00000L); case 85: case 117: - return jjMoveStringLiteralDfa2_0(active0, 0x10004024000000L, active1, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x40010090000000L, active1, 0L); case 86: case 118: - return jjMoveStringLiteralDfa2_0(active0, 0x2000000000000L, active1, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000000000000L, active1, 0L); case 88: case 120: - return jjMoveStringLiteralDfa2_0(active0, 0x40000000000L, active1, 0x40L); + return jjMoveStringLiteralDfa2_0(active0, 0x100000000000L, active1, 0x100L); case 89: case 121: - if ((active0 & 0x80000000000L) != 0L) - return jjStartNfaWithStates_0(1, 43, 965); + if ((active0 & 0x200000000000L) != 0L) + return jjStartNfaWithStates_0(1, 45, 966); break; case 124: if ((active0 & 0x100L) != 0L) @@ -1029,100 +1032,100 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long a { case 65: case 97: - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x300000L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0xc00000L); case 67: case 99: - if ((active0 & 0x800000000000L) != 0L) - return jjStartNfaWithStates_0(2, 47, 965); + if ((active0 & 0x2000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 49, 966); break; case 68: case 100: - if ((active0 & 0x400000000L) != 0L) - return jjStartNfaWithStates_0(2, 34, 965); - else if ((active1 & 0x400L) != 0L) - return jjStartNfaWithStates_0(2, 74, 430); - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0x2000L); + if ((active0 & 0x1000000000L) != 0L) + return jjStartNfaWithStates_0(2, 36, 966); + else if ((active1 & 0x1000L) != 0L) + return jjStartNfaWithStates_0(2, 76, 430); + return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L, active1, 0x8000L); case 69: case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x4000000200000000L, active1, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x800000000L, active1, 0x1L); case 70: case 102: - return jjMoveStringLiteralDfa3_0(active0, 0x10000000L, active1, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x40000000L, active1, 0L); case 71: case 103: - if ((active0 & 0x2000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 49, 965); - else if ((active1 & 0x100L) != 0L) + if ((active0 & 0x8000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 51, 966); + else if ((active1 & 0x400L) != 0L) { - jjmatchedKind = 72; + jjmatchedKind = 74; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x800000008000000L, active1, 0x220L); + return jjMoveStringLiteralDfa3_0(active0, 0x2000000020000000L, active1, 0x880L); case 73: case 105: - return jjMoveStringLiteralDfa3_0(active0, 0x200040140000000L, active1, 0x80010L); + return jjMoveStringLiteralDfa3_0(active0, 0x800100500000000L, active1, 0x200040L); case 75: case 107: - return jjMoveStringLiteralDfa3_0(active0, 0x10000000000L, active1, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x40000000000L, active1, 0L); case 76: case 108: - return jjMoveStringLiteralDfa3_0(active0, 0x400004020080000L, active1, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x1000010080200000L, active1, 0L); case 77: case 109: - if ((active0 & 0x10000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 52, 965); + if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 54, 966); break; case 78: case 110: - if ((active0 & 0x8000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 51, 426); - else if ((active1 & 0x1000000L) != 0L) - return jjStartNfaWithStates_0(2, 88, 965); - else if ((active1 & 0x2000000L) != 0L) - return jjStartNfaWithStates_0(2, 89, 965); - return jjMoveStringLiteralDfa3_0(active0, 0x1080000002000000L, active1, 0x4000L); + if ((active0 & 0x20000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 53, 426); + else if ((active1 & 0x4000000L) != 0L) + return jjStartNfaWithStates_0(2, 90, 966); + else if ((active1 & 0x8000000L) != 0L) + return jjStartNfaWithStates_0(2, 91, 966); + return jjMoveStringLiteralDfa3_0(active0, 0x4200000008000000L, active1, 0x10000L); case 79: case 111: - return jjMoveStringLiteralDfa3_0(active0, 0x8000100000400000L, active1, 0x40083L); + return jjMoveStringLiteralDfa3_0(active0, 0x400001000000L, active1, 0x10020eL); case 80: case 112: - if ((active0 & 0x200000L) != 0L) - return jjStartNfaWithStates_0(2, 21, 965); - else if ((active1 & 0x40L) != 0L) - return jjStartNfaWithStates_0(2, 70, 965); + if ((active0 & 0x800000L) != 0L) + return jjStartNfaWithStates_0(2, 23, 966); + else if ((active1 & 0x100L) != 0L) + return jjStartNfaWithStates_0(2, 72, 966); break; case 82: case 114: - return jjMoveStringLiteralDfa3_0(active0, 0x100000000000000L, active1, 0x10000L); + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0x40000L); case 83: case 115: - if ((active1 & 0x8L) != 0L) - return jjStartNfaWithStates_0(2, 67, 908); - else if ((active1 & 0x400000L) != 0L) - return jjStartNfaWithStates_0(2, 86, 965); - return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L, active1, 0x4L); + if ((active1 & 0x20L) != 0L) + return jjStartNfaWithStates_0(2, 69, 908); + else if ((active1 & 0x1000000L) != 0L) + return jjStartNfaWithStates_0(2, 88, 966); + return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L, active1, 0x10L); case 84: case 116: - if ((active0 & 0x1000000000L) != 0L) - return jjStartNfaWithStates_0(2, 36, 965); - else if ((active1 & 0x800000L) != 0L) - return jjStartNfaWithStates_0(2, 87, 965); - return jjMoveStringLiteralDfa3_0(active0, 0x2000008005000000L, active1, 0L); + if ((active0 & 0x4000000000L) != 0L) + return jjStartNfaWithStates_0(2, 38, 966); + else if ((active1 & 0x2000000L) != 0L) + return jjStartNfaWithStates_0(2, 89, 966); + return jjMoveStringLiteralDfa3_0(active0, 0x8000020014000000L, active1, 0L); case 85: case 117: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L, active1, 0x28000L); + return jjMoveStringLiteralDfa3_0(active0, 0x80000000000000L, active1, 0xa0000L); case 86: case 118: - return jjMoveStringLiteralDfa3_0(active0, 0x200000000000L, active1, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x800000000000L, active1, 0L); case 87: case 119: - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x1000L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x4000L); case 88: case 120: - if ((active0 & 0x4000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 50, 965); - else if ((active0 & 0x40000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 54, 965); + if ((active0 & 0x10000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 52, 966); + else if ((active0 & 0x100000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 56, 966); break; default : break; @@ -1141,84 +1144,84 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long a switch(curChar) { case 49: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x200L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x800L); case 65: case 97: - if ((active0 & 0x4000000000000000L) != 0L) - return jjStartNfaWithStates_0(3, 62, 965); + if ((active1 & 0x1L) != 0L) + return jjStartNfaWithStates_0(3, 64, 966); break; case 67: case 99: - if ((active0 & 0x1000000000000L) != 0L) - return jjStartNfaWithStates_0(3, 48, 858); - return jjMoveStringLiteralDfa4_0(active0, 0x100000000000000L, active1, 0L); + if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 50, 858); + return jjMoveStringLiteralDfa4_0(active0, 0x400000000000000L, active1, 0L); case 68: case 100: - if ((active1 & 0x4000L) != 0L) - return jjStartNfaWithStates_0(3, 78, 965); + if ((active1 & 0x10000L) != 0L) + return jjStartNfaWithStates_0(3, 80, 966); break; case 69: case 101: - if ((active0 & 0x10000000000L) != 0L) - return jjStartNfaWithStates_0(3, 40, 965); - return jjMoveStringLiteralDfa4_0(active0, 0x2000400006080000L, active1, 0x1000L); + if ((active0 & 0x40000000000L) != 0L) + return jjStartNfaWithStates_0(3, 42, 966); + return jjMoveStringLiteralDfa4_0(active0, 0x8001000018200000L, active1, 0x4000L); case 72: case 104: - return jjMoveStringLiteralDfa4_0(active0, 0x8000000L, active1, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x20000000L, active1, 0L); case 73: case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x800200000000000L, active1, 0x2000L); + return jjMoveStringLiteralDfa4_0(active0, 0x2000800000000000L, active1, 0x8000L); case 76: case 108: - if ((active0 & 0x20000000L) != 0L) - return jjStartNfaWithStates_0(3, 29, 965); - else if ((active0 & 0x4000000000L) != 0L) - return jjStartNfaWithStates_0(3, 38, 452); - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x10L); + if ((active0 & 0x80000000L) != 0L) + return jjStartNfaWithStates_0(3, 31, 966); + else if ((active0 & 0x10000000000L) != 0L) + return jjStartNfaWithStates_0(3, 40, 452); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x40L); case 77: case 109: - if ((active0 & 0x400000L) != 0L) - return jjStartNfaWithStates_0(3, 22, 965); + if ((active0 & 0x1000000L) != 0L) + return jjStartNfaWithStates_0(3, 24, 966); break; case 78: case 110: - if ((active0 & 0x40000000L) != 0L) - return jjStartNfaWithStates_0(3, 30, 965); - else if ((active1 & 0x80000L) != 0L) - return jjStartNfaWithStates_0(3, 83, 965); - else if ((active1 & 0x100000L) != 0L) + if ((active0 & 0x100000000L) != 0L) + return jjStartNfaWithStates_0(3, 32, 966); + else if ((active1 & 0x200000L) != 0L) + return jjStartNfaWithStates_0(3, 85, 966); + else if ((active1 & 0x400000L) != 0L) { - jjmatchedKind = 84; + jjmatchedKind = 86; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x220000100000000L, active1, 0x228000L); + return jjMoveStringLiteralDfa4_0(active0, 0x880000400000000L, active1, 0x8a0000L); case 79: case 111: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x80L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x200L); case 82: case 114: - return jjMoveStringLiteralDfa4_0(active0, 0x8000000200000000L, active1, 0x23L); + return jjMoveStringLiteralDfa4_0(active0, 0x800000000L, active1, 0x8eL); case 83: case 115: - if ((active1 & 0x40000L) != 0L) - return jjStartNfaWithStates_0(3, 82, 965); - return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L, active1, 0L); + if ((active1 & 0x100000L) != 0L) + return jjStartNfaWithStates_0(3, 84, 966); + return jjMoveStringLiteralDfa4_0(active0, 0x100000000000L, active1, 0L); case 84: case 116: - if ((active0 & 0x10000000L) != 0L) - return jjStartNfaWithStates_0(3, 28, 965); - else if ((active1 & 0x10000L) != 0L) - return jjStartNfaWithStates_0(3, 80, 965); - return jjMoveStringLiteralDfa4_0(active0, 0x1080000000000000L, active1, 0x4L); + if ((active0 & 0x40000000L) != 0L) + return jjStartNfaWithStates_0(3, 30, 966); + else if ((active1 & 0x40000L) != 0L) + return jjStartNfaWithStates_0(3, 82, 966); + return jjMoveStringLiteralDfa4_0(active0, 0x4200000000000000L, active1, 0x10L); case 85: case 117: - return jjMoveStringLiteralDfa4_0(active0, 0x100001000000L, active1, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x400004000000L, active1, 0L); case 87: case 119: - return jjMoveStringLiteralDfa4_0(active0, 0x8000000000L, active1, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x20000000000L, active1, 0L); case 89: case 121: - return jjMoveStringLiteralDfa4_0(active0, 0x400000000000000L, active1, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0L); default : break; } @@ -1236,73 +1239,73 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long a switch(curChar) { case 48: - if ((active1 & 0x200L) != 0L) - return jjStartNfaWithStates_0(4, 73, 28); + if ((active1 & 0x800L) != 0L) + return jjStartNfaWithStates_0(4, 75, 28); break; case 50: - if ((active1 & 0x200000L) != 0L) - return jjStartNfaWithStates_0(4, 85, 28); + if ((active1 & 0x800000L) != 0L) + return jjStartNfaWithStates_0(4, 87, 28); break; case 65: case 97: - return jjMoveStringLiteralDfa5_0(active0, 0x1000000000000000L, active1, 0x2004L); + return jjMoveStringLiteralDfa5_0(active0, 0x4000000000000000L, active1, 0x8010L); case 67: case 99: - return jjMoveStringLiteralDfa5_0(active0, 0x80000L, active1, 0x20000L); + return jjMoveStringLiteralDfa5_0(active0, 0x200000L, active1, 0x80000L); case 68: case 100: - if ((active1 & 0x8000L) != 0L) - return jjStartNfaWithStates_0(4, 79, 965); - return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000000L, active1, 0x3L); + if ((active1 & 0x20000L) != 0L) + return jjStartNfaWithStates_0(4, 81, 966); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xeL); case 69: case 101: - if ((active0 & 0x200000000L) != 0L) - return jjStartNfaWithStates_0(4, 33, 965); - return jjMoveStringLiteralDfa5_0(active0, 0x8000000000L, active1, 0x20L); + if ((active0 & 0x800000000L) != 0L) + return jjStartNfaWithStates_0(4, 35, 966); + return jjMoveStringLiteralDfa5_0(active0, 0x20000000000L, active1, 0x80L); case 71: case 103: - if ((active0 & 0x100000000L) != 0L) - return jjStartNfaWithStates_0(4, 32, 965); - return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L, active1, 0L); + if ((active0 & 0x400000000L) != 0L) + return jjStartNfaWithStates_0(4, 34, 966); + return jjMoveStringLiteralDfa5_0(active0, 0x1000000000000000L, active1, 0L); case 73: case 105: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x10L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x40L); case 76: case 108: - return jjMoveStringLiteralDfa5_0(active0, 0x100000000000000L, active1, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L, active1, 0L); case 78: case 110: - return jjMoveStringLiteralDfa5_0(active0, 0x200000000000L, active1, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x800000000000L, active1, 0L); case 79: case 111: - return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L, active1, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000000L, active1, 0L); case 80: case 112: - if ((active0 & 0x100000000000L) != 0L) - return jjStartNfaWithStates_0(4, 44, 965); + if ((active0 & 0x400000000000L) != 0L) + return jjStartNfaWithStates_0(4, 46, 966); break; case 82: case 114: - if ((active0 & 0x2000000L) != 0L) - return jjStartNfaWithStates_0(4, 25, 965); - else if ((active0 & 0x4000000L) != 0L) - return jjStartNfaWithStates_0(4, 26, 965); - else if ((active0 & 0x400000000000L) != 0L) - return jjStartNfaWithStates_0(4, 46, 965); - else if ((active1 & 0x80L) != 0L) - return jjStartNfaWithStates_0(4, 71, 965); - else if ((active1 & 0x1000L) != 0L) - return jjStartNfaWithStates_0(4, 76, 965); - return jjMoveStringLiteralDfa5_0(active0, 0x2080000001000000L, active1, 0L); + if ((active0 & 0x8000000L) != 0L) + return jjStartNfaWithStates_0(4, 27, 966); + else if ((active0 & 0x10000000L) != 0L) + return jjStartNfaWithStates_0(4, 28, 966); + else if ((active0 & 0x1000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 48, 966); + else if ((active1 & 0x200L) != 0L) + return jjStartNfaWithStates_0(4, 73, 966); + else if ((active1 & 0x4000L) != 0L) + return jjStartNfaWithStates_0(4, 78, 966); + return jjMoveStringLiteralDfa5_0(active0, 0x8200000004000000L, active1, 0L); case 84: case 116: - if ((active0 & 0x8000000L) != 0L) - return jjStartNfaWithStates_0(4, 27, 965); - else if ((active0 & 0x20000000000000L) != 0L) - return jjStartNfaWithStates_0(4, 53, 965); - else if ((active0 & 0x200000000000000L) != 0L) - return jjStartNfaWithStates_0(4, 57, 965); - return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L); + if ((active0 & 0x20000000L) != 0L) + return jjStartNfaWithStates_0(4, 29, 966); + else if ((active0 & 0x80000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 55, 966); + else if ((active0 & 0x800000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 59, 966); + return jjMoveStringLiteralDfa5_0(active0, 0x100000000000L, active1, 0L); default : break; } @@ -1320,46 +1323,46 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long a switch(curChar) { case 49: - if ((active0 & 0x8000000000000000L) != 0L) - return jjStartNfaWithStates_0(5, 63, 28); + if ((active1 & 0x2L) != 0L) + return jjStartNfaWithStates_0(5, 65, 28); break; case 50: - if ((active1 & 0x1L) != 0L) - return jjStartNfaWithStates_0(5, 64, 28); + if ((active1 & 0x4L) != 0L) + return jjStartNfaWithStates_0(5, 66, 28); break; case 65: case 97: - return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x20000L); + return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x80000L); case 69: case 101: - if ((active0 & 0x100000000000000L) != 0L) - return jjStartNfaWithStates_0(5, 56, 965); - return jjMoveStringLiteralDfa6_0(active0, 0x8000000000L, active1, 0x20L); + if ((active0 & 0x400000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 58, 966); + return jjMoveStringLiteralDfa6_0(active0, 0x20000000000L, active1, 0x80L); case 71: case 103: - if ((active0 & 0x200000000000L) != 0L) - return jjStartNfaWithStates_0(5, 45, 965); + if ((active0 & 0x800000000000L) != 0L) + return jjStartNfaWithStates_0(5, 47, 966); break; case 73: case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x1000000000000000L, active1, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000000L, active1, 0L); case 78: case 110: - if ((active0 & 0x800000000000000L) != 0L) - return jjStartNfaWithStates_0(5, 59, 965); - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2014L); + if ((active0 & 0x2000000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 61, 966); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8050L); case 79: case 111: - return jjMoveStringLiteralDfa6_0(active0, 0x480000000000000L, active1, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1200000000000000L, active1, 0L); case 83: case 115: - if ((active0 & 0x40000000000L) != 0L) - return jjStartNfaWithStates_0(5, 42, 965); - return jjMoveStringLiteralDfa6_0(active0, 0x2000000000000000L, active1, 0x2L); + if ((active0 & 0x100000000000L) != 0L) + return jjStartNfaWithStates_0(5, 44, 966); + return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000000L, active1, 0x8L); case 84: case 116: - if ((active0 & 0x80000L) != 0L) - return jjStartNfaWithStates_0(5, 19, 965); + if ((active0 & 0x200000L) != 0L) + return jjStartNfaWithStates_0(5, 21, 966); break; default : break; @@ -1379,43 +1382,43 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long a { case 67: case 99: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x10L); case 69: case 101: - return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000000L, active1, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000000L, active1, 0L); case 71: case 103: - if ((active1 & 0x10L) != 0L) - return jjStartNfaWithStates_0(6, 68, 965); + if ((active1 & 0x40L) != 0L) + return jjStartNfaWithStates_0(6, 70, 966); break; case 73: case 105: - return jjMoveStringLiteralDfa7_0(active0, 0x80000000000000L, active1, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x200000000000000L, active1, 0L); case 76: case 108: - if ((active0 & 0x1000000L) != 0L) - return jjStartNfaWithStates_0(6, 24, 965); + if ((active0 & 0x4000000L) != 0L) + return jjStartNfaWithStates_0(6, 26, 966); break; case 78: case 110: - if ((active0 & 0x8000000000L) != 0L) - return jjStartNfaWithStates_0(6, 39, 965); - else if ((active0 & 0x400000000000000L) != 0L) - return jjStartNfaWithStates_0(6, 58, 965); - return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000000L, active1, 0L); + if ((active0 & 0x20000000000L) != 0L) + return jjStartNfaWithStates_0(6, 41, 966); + else if ((active0 & 0x1000000000000000L) != 0L) + return jjStartNfaWithStates_0(6, 60, 966); + return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000000L, active1, 0L); case 83: case 115: - if ((active1 & 0x20L) != 0L) - return jjStartNfaWithStates_0(6, 69, 965); - else if ((active1 & 0x2000L) != 0L) - return jjStartNfaWithStates_0(6, 77, 965); + if ((active1 & 0x80L) != 0L) + return jjStartNfaWithStates_0(6, 71, 966); + else if ((active1 & 0x8000L) != 0L) + return jjStartNfaWithStates_0(6, 79, 966); break; case 84: case 116: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000L); case 89: case 121: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x8L); default : break; } @@ -1434,25 +1437,25 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long a { case 67: case 99: - return jjMoveStringLiteralDfa8_0(active0, 0x2000000000000000L, active1, 0L); + return jjMoveStringLiteralDfa8_0(active0, 0x8000000000000000L, active1, 0L); case 68: case 100: - if ((active0 & 0x80000000000000L) != 0L) - return jjStartNfaWithStates_0(7, 55, 965); + if ((active0 & 0x200000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 57, 966); break; case 69: case 101: - if ((active1 & 0x4L) != 0L) - return jjStartNfaWithStates_0(7, 66, 965); - else if ((active1 & 0x20000L) != 0L) - return jjStartNfaWithStates_0(7, 81, 965); + if ((active1 & 0x10L) != 0L) + return jjStartNfaWithStates_0(7, 68, 966); + else if ((active1 & 0x80000L) != 0L) + return jjStartNfaWithStates_0(7, 83, 966); break; case 83: case 115: - if ((active0 & 0x1000000000000000L) != 0L) - return jjStartNfaWithStates_0(7, 60, 965); - else if ((active1 & 0x2L) != 0L) - return jjStartNfaWithStates_0(7, 65, 965); + if ((active0 & 0x4000000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 62, 966); + else if ((active1 & 0x8L) != 0L) + return jjStartNfaWithStates_0(7, 67, 966); break; default : break; @@ -1472,7 +1475,7 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long a { case 84: case 116: - return jjMoveStringLiteralDfa9_0(active0, 0x2000000000000000L); + return jjMoveStringLiteralDfa9_0(active0, 0x8000000000000000L); default : break; } @@ -1491,8 +1494,8 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0) { case 83: case 115: - if ((active0 & 0x2000000000000000L) != 0L) - return jjStartNfaWithStates_0(9, 61, 965); + if ((active0 & 0x8000000000000000L) != 0L) + return jjStartNfaWithStates_0(9, 63, 966); break; default : break; @@ -1528,78 +1531,78 @@ private int jjMoveNfa_0(int startState, int curPos) case 590: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 620: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 656: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 373: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 376: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; - case 966: + case 965: if ((0x3ff000000000000L & l) != 0L) { - if (kind > 95) - kind = 95; + if (kind > 97) + kind = 97; jjCheckNAdd(952); } if ((0x3ff000000000000L & l) != 0L) @@ -1608,456 +1611,456 @@ private int jjMoveNfa_0(int startState, int curPos) case 303: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 431: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 5: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 168: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 669: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 137: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 324: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 910: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 295: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 33: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 877: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 423: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 908: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 932: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 249: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 821: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 491: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 637: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; - case 967: + case 968: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 813: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 501: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 481: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 452: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 410: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 372: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 752: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 969: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 859: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 315: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 32: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 52: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 426: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 0: if ((0x3ff000000000000L & l) != 0L) { - if (kind > 96) - kind = 96; + if (kind > 98) + kind = 98; jjCheckNAddStates(0, 8); } else if ((0x100002600L & l) != 0L) @@ -2067,8 +2070,8 @@ else if ((0x100002600L & l) != 0L) } else if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } else if (curChar == 46) @@ -2085,546 +2088,546 @@ else if (curChar == 60) case 332: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 377: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 404: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 45: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 717: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 345: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 909: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 378: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 302: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 454: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 416: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 670: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 797: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 482: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 453: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 439: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 396: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 550: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 597: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 471: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 770: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 549: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 430: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; - case 965: + case 966: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 438: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 801: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 581: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 858: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 472: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 913: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 796: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 427: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 443: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 424: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 900: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 264: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; - case 968: + case 967: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 113: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 884: if ((0x83ff001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x8000001800000000L & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; @@ -2637,16 +2640,16 @@ else if (curChar == 60) jjstateSet[jjnewStateCnt++] = 1; break; case 17: - if (curChar == 62 && kind > 14) - kind = 14; + if (curChar == 62 && kind > 16) + kind = 16; break; case 18: if (curChar == 60) jjstateSet[jjnewStateCnt++] = 17; break; case 19: - if (curChar == 61 && kind > 14) - kind = 14; + if (curChar == 61 && kind > 16) + kind = 16; break; case 20: if (curChar == 33) @@ -2659,24 +2662,24 @@ else if (curChar == 60) case 22: if (curChar != 45) break; - if (kind > 90) - kind = 90; + if (kind > 92) + kind = 92; jjCheckNAddStates(9, 11); break; case 23: if ((0xffffffffffffdbffL & l) == 0L) break; - if (kind > 90) - kind = 90; + if (kind > 92) + kind = 92; jjCheckNAddStates(9, 11); break; case 24: - if ((0x2400L & l) != 0L && kind > 90) - kind = 90; + if ((0x2400L & l) != 0L && kind > 92) + kind = 92; break; case 25: - if (curChar == 10 && kind > 90) - kind = 90; + if (curChar == 10 && kind > 92) + kind = 92; break; case 26: if (curChar == 13) @@ -2685,15 +2688,15 @@ else if (curChar == 60) case 27: if ((0x8000001800000000L & l) == 0L) break; - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); break; case 28: if ((0x83ff001800000000L & l) == 0L) break; - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); break; case 255: @@ -2715,22 +2718,22 @@ else if (curChar == 60) case 951: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 94) - kind = 94; + if (kind > 96) + kind = 96; jjCheckNAdd(951); break; case 952: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 95) - kind = 95; + if (kind > 97) + kind = 97; jjCheckNAdd(952); break; case 953: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 96) - kind = 96; + if (kind > 98) + kind = 98; jjCheckNAddStates(0, 8); break; case 954: @@ -2756,22 +2759,22 @@ else if (curChar == 60) case 959: if (curChar != 46) break; - if (kind > 95) - kind = 95; + if (kind > 97) + kind = 97; jjCheckNAdd(960); break; case 960: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 95) - kind = 95; + if (kind > 97) + kind = 97; jjCheckNAdd(960); break; case 961: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 96) - kind = 96; + if (kind > 98) + kind = 98; jjCheckNAdd(961); break; case 962: @@ -2781,15 +2784,15 @@ else if (curChar == 60) case 963: if ((0x8000001800000000L & l) == 0L) break; - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(964); break; case 964: if ((0x83ff001800000000L & l) == 0L) break; - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(964); break; default : break; @@ -2806,14 +2809,14 @@ else if (curChar < 128) case 590: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x200000002000000L & l) != 0L) @@ -2854,14 +2857,14 @@ else if ((0x2000000020L & l) != 0L) case 620: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x400000004000000L & l) != 0L) @@ -2870,14 +2873,14 @@ else if ((0x2000000020L & l) != 0L) case 656: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x400000004L & l) != 0L) @@ -2886,14 +2889,14 @@ else if ((0x2000000020L & l) != 0L) case 373: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -2911,14 +2914,14 @@ else if ((0x2000000020L & l) != 0L) case 376: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008L & l) != 0L) @@ -2927,14 +2930,14 @@ else if ((0x2000000020L & l) != 0L) case 303: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -2943,14 +2946,14 @@ else if ((0x2000000020L & l) != 0L) case 431: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x400000004000L & l) != 0L) @@ -2961,14 +2964,14 @@ else if ((0x1000000010L & l) != 0L) case 5: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -2977,14 +2980,14 @@ else if ((0x1000000010L & l) != 0L) case 168: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200L & l) != 0L) @@ -2993,14 +2996,14 @@ else if ((0x1000000010L & l) != 0L) case 669: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x400000004L & l) != 0L) @@ -3009,14 +3012,14 @@ else if ((0x1000000010L & l) != 0L) case 137: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x40000000400000L & l) != 0L) @@ -3035,14 +3038,14 @@ else if ((0x400000004000L & l) != 0L) case 324: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x200000002L & l) != 0L) @@ -3051,14 +3054,14 @@ else if ((0x400000004000L & l) != 0L) case 910: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x100000001000L & l) != 0L) @@ -3090,14 +3093,14 @@ else if ((0x400000004L & l) != 0L) case 295: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -3118,14 +3121,14 @@ else if ((0x200000002L & l) != 0L) case 33: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -3140,14 +3143,14 @@ else if ((0x2000000020L & l) != 0L) case 877: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x8000000080000L & l) != 0L) @@ -3159,15 +3162,15 @@ else if ((0x200000002L & l) != 0L) break; case 423: if ((0x6fffffffefffffffL & l) != 0L) - { - if (kind > 101) - kind = 101; + { + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -3176,14 +3179,14 @@ else if ((0x200000002L & l) != 0L) case 908: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -3192,14 +3195,14 @@ else if ((0x200000002L & l) != 0L) case 932: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x8000000080000L & l) != 0L) @@ -3208,14 +3211,14 @@ else if ((0x200000002L & l) != 0L) case 249: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x100000001000000L & l) != 0L) @@ -3242,14 +3245,14 @@ else if ((0x400000004000L & l) != 0L) case 821: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x8000000080000L & l) != 0L) @@ -3274,14 +3277,14 @@ else if ((0x800000008L & l) != 0L) case 491: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200000L & l) != 0L) @@ -3310,14 +3313,14 @@ else if ((0x200000002L & l) != 0L) case 637: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x100000001000L & l) != 0L) @@ -3332,17 +3335,17 @@ else if ((0x200000002L & l) != 0L) kind = 2; } break; - case 967: + case 968: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x2000000020L & l) != 0L) @@ -3354,14 +3357,14 @@ else if ((0x200000002L & l) != 0L) case 813: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200L & l) != 0L) @@ -3402,14 +3405,14 @@ else if ((0x2000000020L & l) != 0L) case 501: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x8000000080000L & l) != 0L) @@ -3418,14 +3421,14 @@ else if ((0x2000000020L & l) != 0L) case 481: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x1000000010000L & l) != 0L) @@ -3434,14 +3437,14 @@ else if ((0x2000000020L & l) != 0L) case 452: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200L & l) != 0L) @@ -3450,14 +3453,14 @@ else if ((0x2000000020L & l) != 0L) case 410: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x40000000400000L & l) != 0L) @@ -3468,14 +3471,14 @@ else if ((0x200000002L & l) != 0L) case 372: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x4000000040000L & l) != 0L) @@ -3488,14 +3491,14 @@ else if ((0x8000000080L & l) != 0L) case 752: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x8000000080000L & l) != 0L) @@ -3516,14 +3519,14 @@ else if ((0x400000004000L & l) != 0L) case 969: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -3535,14 +3538,14 @@ else if ((0x400000004000L & l) != 0L) case 859: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008L & l) != 0L) @@ -3553,14 +3556,14 @@ else if ((0x400000004000L & l) != 0L) case 315: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x4000000040000L & l) != 0L) @@ -3580,14 +3583,14 @@ else if ((0x2000000020L & l) != 0L) case 32: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x8000000080L & l) != 0L) @@ -3596,14 +3599,14 @@ else if ((0x2000000020L & l) != 0L) case 52: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200000L & l) != 0L) @@ -3670,14 +3673,14 @@ else if ((0x800000008000L & l) != 0L) case 426: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200000L & l) != 0L) @@ -3686,8 +3689,8 @@ else if ((0x800000008000L & l) != 0L) case 0: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x200000002L & l) != 0L) @@ -3740,14 +3743,14 @@ else if ((0x10000000100L & l) != 0L) case 332: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x8000000080000L & l) != 0L) @@ -3780,14 +3783,14 @@ else if ((0x1000000010L & l) != 0L) case 377: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x2000000020L & l) != 0L) @@ -3796,14 +3799,14 @@ else if ((0x1000000010L & l) != 0L) case 404: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -3822,14 +3825,14 @@ else if ((0x200000002L & l) != 0L) case 45: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -3838,14 +3841,14 @@ else if ((0x200000002L & l) != 0L) case 717: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200000L & l) != 0L) @@ -3864,14 +3867,14 @@ else if ((0x200000002L & l) != 0L) case 345: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -3901,14 +3904,14 @@ else if ((0x8000000080000L & l) != 0L) case 909: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x8000000080000L & l) != 0L) @@ -3917,14 +3920,14 @@ else if ((0x8000000080000L & l) != 0L) case 378: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x40000000400000L & l) != 0L) @@ -3935,14 +3938,14 @@ else if ((0x8000000080000L & l) != 0L) case 302: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x200000002L & l) != 0L) @@ -3951,14 +3954,14 @@ else if ((0x8000000080000L & l) != 0L) case 454: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x200000002000L & l) != 0L) @@ -3969,14 +3972,14 @@ else if ((0x100000001000L & l) != 0L) case 416: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x80000000800000L & l) != 0L) @@ -3987,14 +3990,14 @@ else if ((0x800000008L & l) != 0L) case 670: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x4000000040000L & l) != 0L) @@ -4032,14 +4035,14 @@ else if ((0x20000000200L & l) != 0L) case 797: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x4000000040000L & l) != 0L) @@ -4056,14 +4059,14 @@ else if ((0x10000000100L & l) != 0L) case 482: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -4072,14 +4075,14 @@ else if ((0x10000000100L & l) != 0L) case 453: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x100000001000L & l) != 0L) @@ -4088,14 +4091,14 @@ else if ((0x10000000100L & l) != 0L) case 439: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200000L & l) != 0L) @@ -4119,14 +4122,14 @@ else if ((0x200000002L & l) != 0L) case 396: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -4135,14 +4138,14 @@ else if ((0x200000002L & l) != 0L) case 550: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -4165,14 +4168,14 @@ else if ((0x2000000020L & l) != 0L) case 597: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -4192,14 +4195,14 @@ else if ((0x800000008L & l) != 0L) case 471: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x40000000400000L & l) != 0L) @@ -4223,14 +4226,14 @@ else if ((0x800000008L & l) != 0L) case 770: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x2000000020L & l) != 0L) @@ -4241,14 +4244,14 @@ else if ((0x200000002L & l) != 0L) case 549: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x40000000400000L & l) != 0L) @@ -4267,44 +4270,44 @@ else if ((0x200000002L & l) != 0L) case 430: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 429; break; - case 965: + case 966: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } break; case 438: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -4315,14 +4318,14 @@ else if ((0x200000002000L & l) != 0L) case 801: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x400000004000L & l) != 0L) @@ -4336,14 +4339,14 @@ else if ((0x200000002000L & l) != 0L) case 581: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x80000000800000L & l) != 0L) @@ -4354,14 +4357,14 @@ else if ((0x100000001000L & l) != 0L) case 858: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x4000000040000L & l) != 0L) @@ -4372,14 +4375,14 @@ else if ((0x100000001000L & l) != 0L) case 472: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x100000001000L & l) != 0L) @@ -4388,14 +4391,14 @@ else if ((0x100000001000L & l) != 0L) case 913: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -4404,14 +4407,14 @@ else if ((0x100000001000L & l) != 0L) case 796: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x2000000020L & l) != 0L) @@ -4422,14 +4425,14 @@ else if ((0x100000001000L & l) != 0L) case 427: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x400000004000L & l) != 0L) @@ -4438,14 +4441,14 @@ else if ((0x100000001000L & l) != 0L) case 443: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200L & l) != 0L) @@ -4454,14 +4457,14 @@ else if ((0x100000001000L & l) != 0L) case 424: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x800000008000L & l) != 0L) @@ -4476,14 +4479,14 @@ else if ((0x200000002L & l) != 0L) case 900: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x20000000200L & l) != 0L) @@ -4492,14 +4495,14 @@ else if ((0x200000002L & l) != 0L) case 264: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -4515,17 +4518,17 @@ else if ((0x2000000020L & l) != 0L) else if ((0x800000008L & l) != 0L) jjstateSet[jjnewStateCnt++] = 263; break; - case 968: + case 967: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x200000002000000L & l) != 0L) @@ -4537,14 +4540,14 @@ else if ((0x800000008L & l) != 0L) case 113: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x4000000040000L & l) != 0L) @@ -4575,14 +4578,14 @@ else if ((0x100000001000L & l) != 0L) case 884: if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); } if ((0x6fffffffefffffffL & l) != 0L) { - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); } if ((0x10000000100000L & l) != 0L) @@ -4647,22 +4650,22 @@ else if ((0x800000008L & l) != 0L) jjstateSet[jjnewStateCnt++] = 15; break; case 23: - if (kind > 90) - kind = 90; + if (kind > 92) + kind = 92; jjAddStates(9, 11); break; case 27: if ((0x6fffffffefffffffL & l) == 0L) break; - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAddTwoStates(27, 28); break; case 28: if ((0x6fffffffefffffffL & l) == 0L) break; - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(28); break; case 29: @@ -7591,8 +7594,8 @@ else if ((0x800000008L & l) != 0L) jjstateSet[jjnewStateCnt++] = 895; break; case 897: - if ((0x10000000100000L & l) != 0L && kind > 20) - kind = 20; + if ((0x10000000100000L & l) != 0L && kind > 22) + kind = 22; break; case 898: if ((0x800000008L & l) != 0L) @@ -7735,8 +7738,8 @@ else if ((0x800000008L & l) != 0L) jjstateSet[jjnewStateCnt++] = 943; break; case 945: - if ((0x100000001000L & l) != 0L && kind > 20) - kind = 20; + if ((0x100000001000L & l) != 0L && kind > 22) + kind = 22; break; case 946: if ((0x100000001000L & l) != 0L) @@ -7750,8 +7753,8 @@ else if ((0x800000008L & l) != 0L) case 964: if ((0x6fffffffefffffffL & l) == 0L) break; - if (kind > 101) - kind = 101; + if (kind > 103) + kind = 103; jjCheckNAdd(964); break; default : break; @@ -7769,8 +7772,8 @@ else if ((0x800000008L & l) != 0L) case 23: if ((jjbitVec0[i2] & l2) == 0L) break; - if (kind > 90) - kind = 90; + if (kind > 92) + kind = 92; jjAddStates(9, 11); break; default : break; @@ -7807,7 +7810,7 @@ private int jjMoveStringLiteralDfa0_1() switch(curChar) { case 39: - return jjStartNfaWithStates_1(0, 93, 1); + return jjStartNfaWithStates_1(0, 95, 1); default : return jjMoveNfa_1(0, 0); } @@ -7841,15 +7844,15 @@ private int jjMoveNfa_1(int startState, int curPos) case 0: if ((0xffffff7fffffffffL & l) != 0L) { - if (kind > 92) - kind = 92; + if (kind > 94) + kind = 94; } else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 1; break; case 1: - if (curChar == 39 && kind > 92) - kind = 92; + if (curChar == 39 && kind > 94) + kind = 94; break; case 2: if (curChar == 39) @@ -7867,7 +7870,7 @@ else if (curChar < 128) switch(jjstateSet[--i]) { case 0: - kind = 92; + kind = 94; break; default : break; } @@ -7882,8 +7885,8 @@ else if (curChar < 128) switch(jjstateSet[--i]) { case 0: - if ((jjbitVec0[i2] & l2) != 0L && kind > 92) - kind = 92; + if ((jjbitVec0[i2] & l2) != 0L && kind > 94) + kind = 94; break; default : break; } @@ -7921,13 +7924,13 @@ else if (curChar < 128) /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", null, null, "\50", "\51", "\56", "\54", "\73", "\174\174", "\53", "\55", -"\52", "\57", "\75", null, "\74", "\74\75", "\76", "\76\75", null, null, null, null, +"\52", "\57", "\46", "\174", "\75", null, "\74", "\74\75", "\76", "\76\75", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, }; +null, null, null, null, null, null, null, null, null, null, null, null, null, }; /** Lexer state names. */ public static final String[] lexStateNames = { @@ -7941,17 +7944,17 @@ else if (curChar < 128) -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, 0, -1, -1, -1, -1, 2, -1, - 0, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 0, -1, -1, -1, -1, + 2, -1, 0, -1, -1, }; static final long[] jjtoToken = { - 0xfffffffffffffffdL, 0x31e3ffffffL, + 0xfffffffffffffffdL, 0xc78fffffffL, }; static final long[] jjtoSkip = { - 0x2L, 0x4000000L, + 0x2L, 0x10000000L, }; static final long[] jjtoMore = { - 0x0L, 0xc18000000L, + 0x0L, 0x3060000000L, }; protected SimpleCharStream input_stream; private final int[] jjrounds = new int[965]; diff --git a/src/adql/parser/adqlGrammar.jj b/src/adql/parser/adqlGrammar.jj index f3c6eb47..62606532 100644 --- a/src/adql/parser/adqlGrammar.jj +++ b/src/adql/parser/adqlGrammar.jj @@ -16,6 +16,8 @@ * * Copyright 2012-2019 - UDS/Centre de Données astronomiques de Strasbourg (CDS), * Astronomisches Rechen Institute (ARI) + * + * TODO: needs merge (Updated by G.Landais for VizieR) */ /* @@ -31,7 +33,10 @@ * printed else it will be the message "Correct syntax". * * Author: Grégory Mantelet (CDS;ARI) +* * Version: 1.5-2 (10/2020) +* TODO: needs merge (Updated by G.Landais for VizieR) +* - BINARY operator */ /* ########### */ @@ -1058,6 +1063,15 @@ TOKEN : { | < DIVIDE: "/" > } +/*****TODO G.Landais - *********/ +/* ************************************************* */ +/* Logic operators (added by G.Landais : 21/05/2013) */ +/* ************************************************* */ +TOKEN : { + < LOGIC_AND: "&" > +| < LOGIC_OR: "|" > +} + /* ******************** */ /* Comparison operators */ /* ******************** */ @@ -1666,9 +1680,10 @@ ADQLOperand StringValueExpressionPrimary(): {StringConstant expr; ADQLColumn col } } +/*****TODO G.Landais update AND/OR *********/ ADQLOperand ValueExpression(): {ADQLOperand valueExpr = null; Token left, right; } { try{ - (LOOKAHEAD((|) | (Factor() (|||))) valueExpr=NumericExpression() + (LOOKAHEAD((|) | (Factor() (|||||))) valueExpr=NumericExpression() | LOOKAHEAD( | (StringFactor() )) valueExpr=StringExpression() | LOOKAHEAD() left= valueExpr=ValueExpression() right= { valueExpr = queryFactory.createWrappedOperand(valueExpr); ((WrappedOperand)valueExpr).setPosition(new TextPosition(left, right)); } | LOOKAHEAD( ) valueExpr=UserDefinedFunction() @@ -1710,8 +1725,9 @@ ADQLOperand NumericExpression(): {Token sign=null; ADQLOperand leftOp, rightOp=n } } +/*****TODO G.Landais update AND/OR *********/ ADQLOperand NumericTerm(): {Token sign=null; ADQLOperand leftOp, rightOp=null;} { - (leftOp=Factor() ((sign= | sign=) rightOp=NumericTerm())?) + (leftOp=Factor() ((sign= | sign= | sign= | sign=) rightOp=NumericTerm())?) { if (sign == null) return leftOp; @@ -1752,8 +1768,9 @@ ADQLOperand Factor(): {boolean negative = false; Token minusSign = null; ADQLOpe } } +/*****TODO G.Landais updateTRIM function *********/ ADQLOperand StringExpression(): {ADQLOperand leftOp; ADQLOperand rightOp = null;} { - leftOp=StringFactor() + leftOp=StringFactor() ( rightOp=StringFactor() diff --git a/src/adql/parser/adqlGrammar.jj.greg b/src/adql/parser/adqlGrammar.jj.greg new file mode 100644 index 00000000..c0106f9e --- /dev/null +++ b/src/adql/parser/adqlGrammar.jj.greg @@ -0,0 +1,1652 @@ +/* + * This file is part of ADQLLibrary. + * + * ADQLLibrary 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. + * + * ADQLLibrary 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 ADQLLibrary. If not, see . + * + * Copyright 2012-2017 - UDS/Centre de Données astronomiques de Strasbourg (CDS), + * Astronomisches Rechen Institute (ARI) + */ + +/* +* This JavaCC file implements the BNF definition of ADQL v2.0 (IVOA Recommendation 30 Oct 2008 - http://www.ivoa.net/Documents/cover/ADQL-20081030.html). +* To generate the parser with this file use JavaCC. This .jj file has been successfully tested with JavaCC 6.0. +* +* The generated parser checks the syntax of the given ADQL query and generates an object representation but no coherence with any database is done. +* If the syntax is not conform to the ADQL definition an error message is printed else it will be the message "Correct syntax". +* +* Author: Grégory Mantelet (CDS;ARI) - gmantele@ari.uni-heidelberg.de +* Version: 1.4 (03/2017) +*/ + + /* ########### */ + /* # OPTIONS # */ + /* ########### */ +options { + STATIC = false; + IGNORE_CASE = true; + DEBUG_PARSER = true; +} + + /* ########## */ + /* # PARSER # */ + /* ########## */ +PARSER_BEGIN(ADQLParser) + +package adql.parser; + +import java.util.Stack; +import java.util.Vector; +import java.util.ArrayList; +import java.util.Collection; + +import java.io.FileReader; +import java.io.IOException; + +import adql.db.exception.UnresolvedIdentifiersException; + +import adql.parser.IdentifierItems.IdentifierItem; + +import adql.parser.ADQLQueryFactory.JoinType; + +import adql.query.*; +import adql.query.from.*; +import adql.query.constraint.*; + +import adql.query.operand.*; + +import adql.query.operand.function.*; + +import adql.query.operand.function.geometry.*; +import adql.query.operand.function.geometry.GeometryFunction.GeometryValue; + +import adql.translator.PostgreSQLTranslator; +import adql.translator.TranslationException; + +/** +*

Parses an ADQL query thanks to the {@link ADQLParser#Query()} function.

+* +*

This parser is able, thanks to a {@link QueryChecker} object, to check each ADQLQuery just after its generation. +* It could be used to check the consistency between the ADQL query to parse and the "database" on which the query must be executed. +* By default, there is no {@link QueryChecker}. Thus you must extend {@link QueryChecker} to check semantically all generated ADQLQuery objects.

+* +*

To create an object representation of the given ADQL query, this parser uses a {@link ADQLQueryFactory} object. So if you want customize some object (ie. CONTAINS) of this representation +* you just have to extend the corresponding default object (ie. ContainsFunction) and to extend the corresponding function of {@link ADQLQueryFactory} (ie. createContains(...)).

+* +*

WARNING: To modify this class it's strongly encouraged to modify the .jj file in the section between PARSER_BEGIN and PARSER_END and to re-compile it with JavaCC.

+* +* @see QueryChecker +* @see ADQLQueryFactory +* +* @author Grégory Mantelet (CDS;ARI) - gmantele@ari.uni-heidelberg.de +* @version 1.4 (03/2017) +*/ +public class ADQLParser { + + /** Tools to build the object representation of the ADQL query. */ + private ADQLQueryFactory queryFactory = new ADQLQueryFactory(); + + /** The stack of queries (because there may be some sub-queries). */ + private Stack stackQuery = new Stack(); + + /** The object representation of the ADQL query to parse. (ONLY USED DURING THE PARSING, else it is always null). */ + private ADQLQuery query = null; + + /** Checks each ADQLQuery (sub-query or not) just after their generation. */ + private QueryChecker queryChecker = null; + + /** The first token of a table/column name. This token is extracted by {@link #Identifier()}. */ + private Token currentIdentifierToken = null; + + /** + * Builds an ADQL parser without a query to parse. + */ + public ADQLParser(){ + this(new java.io.ByteArrayInputStream("".getBytes())); + setDebug(false); + } + + /** + * Builds an ADQL parser without a query to parse but with a QueryChecker and a ADQLQueryFactory. + * + * @param checker The object to use to check each ADQLQuery. + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(QueryChecker checker, ADQLQueryFactory factory) { + this(); + + queryChecker = checker; + + if (factory != null) + queryFactory = factory; + } + + /** + * Builds an ADQL parser without a query to parse but with a QueryChecker. + * + * @param checker The object to use to check each ADQLQuery. + */ + public ADQLParser(QueryChecker checker) { + this(checker, null); + } + + /** + * Builds an ADQL parser without a query to parse but with a ADQLQueryFactory. + * + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(ADQLQueryFactory factory) { + this((QueryChecker)null, factory); + } + + /** + * Builds a parser with a stream containing the query to parse. + * + * @param stream The stream in which the ADQL query to parse is given. + * @param checker The object to use to check each ADQLQuery. + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(java.io.InputStream stream, QueryChecker checker, ADQLQueryFactory factory) { + this(stream); + setDebug(false); + + setDebug(false); + + queryChecker = checker; + + if (factory != null) + queryFactory = factory; + } + + /** + * Builds a parser with a stream containing the query to parse. + * + * @param stream The stream in which the ADQL query to parse is given. + * @param checker The object to use to check each ADQLQuery. + */ + public ADQLParser(java.io.InputStream stream, QueryChecker checker) { + this(stream, checker, null); + } + + /** + * Builds a parser with a stream containing the query to parse. + * + * @param stream The stream in which the ADQL query to parse is given. + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(java.io.InputStream stream, ADQLQueryFactory factory) { + this(stream, (QueryChecker)null, factory); + } + + /** + * Builds a parser with a stream containing the query to parse. + * + * @param stream The stream in which the ADQL query to parse is given. + * @param encoding The supplied encoding. + * @param checker The object to use to check each ADQLQuery. + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(java.io.InputStream stream, String encoding, QueryChecker checker, ADQLQueryFactory factory) { + this(stream, encoding); + setDebug(false); + + queryChecker = checker; + + if (factory != null) + queryFactory = factory; + } + + /** + * Builds a parser with a stream containing the query to parse. + * + * @param stream The stream in which the ADQL query to parse is given. + * @param encoding The supplied encoding. + * @param checker The object to use to check each ADQLQuery. + */ + public ADQLParser(java.io.InputStream stream, String encoding, QueryChecker checker) { + this(stream, encoding, checker, null); + } + + /** + * Builds a parser with a stream containing the query to parse. + * + * @param stream The stream in which the ADQL query to parse is given. + * @param encoding The supplied encoding. + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(java.io.InputStream stream, String encoding, ADQLQueryFactory factory) { + this(stream, encoding, null, factory); + } + + /** + * Builds a parser with a reader containing the query to parse. + * + * @param reader The reader in which the ADQL query to parse is given. + * @param checker The object to use to check each ADQLQuery. + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(java.io.Reader reader, QueryChecker checker, ADQLQueryFactory factory) { + this(reader); + setDebug(false); + + setDebug(false); + + queryChecker = checker; + + if (factory != null) + queryFactory = factory; + } + + /** + * Builds a parser with a reader containing the query to parse. + * + * @param reader The reader in which the ADQL query to parse is given. + * @param checker The object to use to check each ADQLQuery. + */ + public ADQLParser(java.io.Reader reader, QueryChecker checker) { + this(reader, checker, null); + } + + /** + * Builds a parser with a reader containing the query to parse. + * + * @param reader The reader in which the ADQL query to parse is given. + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(java.io.Reader reader, ADQLQueryFactory factory) { + this(reader, null, factory); + } + + /** + * Builds a parser with another token manager. + * + * @param tm The manager which associates a token to a numeric code. + * @param checker The object to use to check each ADQLQuery. + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(ADQLParserTokenManager tm, QueryChecker checker, ADQLQueryFactory factory) { + this(tm); + setDebug(false); + + setDebug(false); + + queryChecker = checker; + + if (factory != null) + queryFactory = factory; + } + + /** + * Builds a parser with another token manager. + * + * @param tm The manager which associates a token to a numeric code. + * @param checker The object to use to check each ADQLQuery. + */ + public ADQLParser(ADQLParserTokenManager tm, QueryChecker checker) { + this(tm, checker, null); + } + + /** + * Builds a parser with another token manager. + * + * @param tm The manager which associates a token to a numeric code. + * @param factory The object to use to build an object representation of the given ADQL query. + */ + public ADQLParser(ADQLParserTokenManager tm, ADQLQueryFactory factory) { + this(tm, null, factory); + } + + /** + * Parses the query given at the creation of this parser or in the ReInit functions. + * + * @return The object representation of the given ADQL query. + * @throws ParseException If there is at least one syntactic error. + * + * @see ADQLParser#Query() + */ + public final ADQLQuery parseQuery() throws ParseException { + stackQuery.clear(); + query = null; + return Query(); + } + + /** + * Parses the query given in parameter. + * + * @param q The ADQL query to parse. + * @return The object representation of the given ADQL query. + * @throws ParseException If there is at least one syntactic error. + * + * @see ADQLParser#ReInit(java.io.InputStream) + * @see ADQLParser#setDebug(boolean) + * @see ADQLParser#Query() + */ + public final ADQLQuery parseQuery(String q) throws ParseException { + stackQuery.clear(); + query = null; + ReInit(new java.io.ByteArrayInputStream(q.getBytes())); + return Query(); + } + + /** + * Parses the query contained in the stream given in parameter. + * + * @param stream The stream which contains the ADQL query to parse. + * @return The object representation of the given ADQL query. + * @throws ParseException If there is at least one syntactic error. + * + * @see ADQLParser#ReInit(java.io.InputStream) + * @see ADQLParser#setDebug(boolean) + * @see ADQLParser#Query() + */ + public final ADQLQuery parseQuery(java.io.InputStream stream) throws ParseException { + stackQuery.clear(); + query = null; + ReInit(stream); + return Query(); + } + + public final void setDebug(boolean debug){ + if (debug) enable_tracing(); + else disable_tracing(); + } + + public final QueryChecker getQueryChecker(){ + return queryChecker; + } + + public final void setQueryChecker(QueryChecker checker){ + queryChecker = checker; + } + + public final ADQLQueryFactory getQueryFactory(){ + return queryFactory; + } + + public final void setQueryFactory(ADQLQueryFactory factory){ + queryFactory = (factory!=null)?factory:(new ADQLQueryFactory()); + } + + private final ParseException generateParseException(Exception ex){ + if (!(ex instanceof ParseException)){ + ParseException pex = new ParseException("["+ex.getClass().getName()+"] "+ex.getMessage()); + pex.setStackTrace(ex.getStackTrace()); + return pex; + }else + return (ParseException)ex; + } + + /** + *

Gets the specified ADQL query and parses the given ADQL query. The SQL translation is then printed if the syntax is correct.

+ *

ONLY the syntax is checked: the query is NOT EXECUTED !

+ *

Supplied parameters are:

  • [-debug] -url http://...
  • [-debug] -file ...
  • [-debug] -query SELECT...

+ * + * @param args + * @throws Exception + */ + public static final void main(String[] args) throws Exception { + final String USAGE = "Usage:\n\tadqlParser.jar [-d] [-v] [-e] [-a|-s] [|]\n\nNOTE: If no file or URL is given, the ADQL query is expected in the standard input. This query must end with a ';' !\n\nParameters:\n\t-v or --verbose : Print the main steps of the parsing\n\t-d or --debug : Print stack traces when a grave error occurs\n\t-e or --explain : Explain the ADQL parsing (or Expand the parsing tree)\n\t-a or --adql : Display the understood ADQL query\n\t-s or --sql : Ask the SQL translation of the given ADQL query (SQL compatible with PostgreSQL)\n\nReturn:\n\tBy default: nothing if the query is correct. Otherwise a message explaining why the query is not correct is displayed.\n\tWith the -s option, the SQL translation of the given ADQL query will be returned.\n\tWith the -a option, the ADQL query is returned as it has been understood.\n\nExit status:\n\t0\tOK !\n\t1\tParameter error (missing or incorrect parameter)\n\t2\tFile error (incorrect file/url, reading error, ...)\n\t3\tParsing error (syntactic or semantic error)\n\t4\tTranslation error (a problem has occurred during the translation of the given ADQL query in SQL)."; + + ADQLParser parser; + + final String urlRegex = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"; + + String file = null, metaFile = null; + short mode = -1; + boolean verbose=false, debug=false, explain=false; + + // Parameters reading: + for(int i=0; i } + +/* *********** */ +/* Punctuation */ +/* *********** */ +TOKEN : { + < LEFT_PAR: "(" > +| < RIGHT_PAR: ")" > +| < DOT: "." > +| < COMMA: "," > +| < EOQ: ";"> +| < CONCAT: "||" > +} + +/* ******************** */ +/* Arithmetic operators */ +/* ******************** */ +TOKEN : { + < PLUS: "+" > +| < MINUS: "-" > +| < ASTERISK: "*" > +| < DIVIDE: "/" > +} + +/* ******************** */ +/* Comparison operators */ +/* ******************** */ +TOKEN : { + < EQUAL: "=" > +| < NOT_EQUAL: "<>" | "!=" > +| < LESS_THAN: "<" > +| < LESS_EQUAL_THAN: "<=" > +| < GREATER_THAN: ">" > +| < GREATER_EQUAL_THAN: ">=" > +} + +/* *************** */ +/* SELECT's tokens */ +/* *************** */ +TOKEN : { + < SELECT: "SELECT" > +| < QUANTIFIER: "DISTINCT" | "ALL" > +| < TOP: "TOP" > +} + +/* ************* */ +/* FROM's tokens */ +/* ************* */ +TOKEN : { + < FROM: "FROM" > +| < AS: "AS" > +| < NATURAL: "NATURAL" > +| < INNER: "INNER" > +| < OUTER: "OUTER" > +| < RIGHT: "RIGHT" > +| < LEFT: "LEFT" > +| < FULL: "FULL" > +| < JOIN: "JOIN" > +| < ON: "ON" > +| < USING: "USING" > +} + +/* ************** */ +/* WHERE's tokens */ +/* ************** */ +TOKEN : { + < WHERE: "WHERE" > +| < AND: "AND" > +| < OR: "OR" > +| < NOT: "NOT" > +| < IS: "IS" > +| < NULL: "NULL" > +| < BETWEEN: "BETWEEN" > +| < LIKE: "LIKE" > +| < IN: "IN" > +| < EXISTS: "EXISTS" > +} + +/* ********************* */ +/* Other clauses' tokens */ +/* ********************* */ +TOKEN : { + < GROUP_BY: "GROUP BY" > +| < HAVING: "HAVING" > +| < ORDER_BY: "ORDER BY" > +| < ASC: "ASC" > +| < DESC: "DESC" > +} + +/* ************* */ +/* SQL functions */ +/* ************* */ +TOKEN : { + < AVG: "AVG" > +| < MAX: "MAX" > +| < MIN: "MIN" > +| < SUM: "SUM" > +| < COUNT: "COUNT" > +} + +/* ************** */ +/* ADQL functions */ +/* ************** */ +TOKEN : { + < BOX: "BOX" > +| < CENTROID: "CENTROID" > +| < CIRCLE: "CIRCLE" > +| < POINT: "POINT" > +| < POLYGON: "POLYGON" > +| < REGION: "REGION" > + +| < CONTAINS: "CONTAINS" > +| < INTERSECTS: "INTERSECTS" > +| < AREA: "AREA" > +| < COORD1: "COORD1" > +| < COORD2: "COORD2" > +| < COORDSYS: "COORDSYS" > +| < DISTANCE: "DISTANCE" > +} + +/* ********************** */ +/* Mathematical functions */ +/* ********************** */ +TOKEN : { + < ABS: "ABS" > +| < CEILING: "CEILING" > +| < DEGREES: "DEGREES" > +| < EXP: "EXP" > +| < FLOOR: "FLOOR" > +| < LOG: "LOG" > +| < LOG10: "LOG10" > +| < MOD: "MOD" > +| < PI: "PI" > +| < POWER: "POWER" > +| < RADIANS: "RADIANS" > +| < RAND: "RAND" > +| < ROUND: "ROUND" > +| < SQRT: "SQRT" > +| < TRUNCATE: "TRUNCATE" > +} + +/* ************************* */ +/* Trigonometrical functions */ +/* ************************* */ +TOKEN : { + < ACOS: "ACOS" > +| < ASIN: "ASIN" > +| < ATAN: "ATAN" > +| < ATAN2: "ATAN2" > +| < COS: "COS" > +| < COT: "COT" > +| < SIN: "SIN" > +| < TAN: "TAN" > +} + +/* ******* */ +/* Comment */ +/* ******* */ +SKIP : { < (~["\n","\r"])* ("\n"|"\r"|"\r\n")? > } + +/* ****** */ +/* String */ +/* ****** */ + MORE : { "'" : WithinString } + MORE : { < ~["'"] | ("''") > } + TOKEN : { < STRING_LITERAL: "'" >: DEFAULT } + +/* ************************************************* */ +/* Identifier (column, tables, ...) */ +/* ************************************************* */ + MORE : { "\"" : WithinDelimitedId } + MORE : { < ~["\""] | ("\"\"") > } + TOKEN : { < DELIMITED_IDENTIFIER: "\"" >: DEFAULT } + +TOKEN : { + < REGULAR_IDENTIFIER: ()+ ( | | "_")* > +| < #Letter: ["a"-"z","A"-"Z"] > +} + +/* *************** */ +/* Primary numbers */ +/* *************** */ +TOKEN : { + < SCIENTIFIC_NUMBER: (|) "E" (|)? > +| < UNSIGNED_FLOAT: ( ()?) | ( ) > +| < UNSIGNED_INTEGER: ()+ > +| < #DIGIT: ["0"-"9"] > +} + + /* ########## */ + /* # SYNTAX # */ + /* ########## */ + +/* ******************* */ +/* GENERAL ADQL SYNTAX */ +/* ******************* */ +/** +* Parses the ADQL query given at the parser creation or in the {@link ADQLParser#ReInit(java.io.InputStream)} +* or in the parseQuery functions. +* +* @return The object representation of the query. +* @throws ParseException If the query syntax is incorrect. +*/ +ADQLQuery Query(): {ADQLQuery q = null;}{ + q=QueryExpression() ( | ) + { + // check the query: + if (queryChecker != null) + queryChecker.check(q); + + return q; + } +} + +ADQLQuery QueryExpression(): {TextPosition endPos = null;} { + { + try{ + // create the query: + query = queryFactory.createQuery(); + stackQuery.push(query); + }catch(Exception ex){ + throw generateParseException(ex); + } + } + Select() + From() {endPos = query.getFrom().getPosition();} + [Where() {endPos = query.getWhere().getPosition();}] + [GroupBy() {endPos = query.getGroupBy().getPosition();}] + [Having() {endPos = query.getHaving().getPosition();}] + [OrderBy() {endPos = query.getOrderBy().getPosition();}] + { + // set the position of the query: + query.setPosition(new TextPosition(query.getSelect().getPosition(), endPos)); + + // get the previous query (!= null if the current query is a sub-query): + ADQLQuery previousQuery = stackQuery.pop(); + if (stackQuery.isEmpty()) + query = null; + else + query = stackQuery.peek(); + + return previousQuery; + } +} + +ADQLQuery SubQueryExpression(): {ADQLQuery q = null; Token start, end;} { + start= q=QueryExpression() end= + { + q.setPosition(new TextPosition(start, end)); + return q; + } +} + +void Select(): {ClauseSelect select = query.getSelect(); SelectItem item=null; Token start,t = null;} { + start=