diff --git a/COPYING b/COPYING new file mode 100644 index 00000000000..5b6e7c66c27 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) 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 +this service 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 make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. 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. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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 +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE 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. + + 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 +convey 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision 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, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This 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 Library General +Public License instead of this License. diff --git a/README b/README new file mode 100644 index 00000000000..488f7df031f --- /dev/null +++ b/README @@ -0,0 +1,13 @@ +JRuby - Ruby interpreter for Java +================================== + +Authors: Stefan Matthias Aust , + Jan Arne Petersen + +JRuby is the effort to recreate the Ruby (http://www.ruby-lang.org) interpreter +in Java. Currently, the interpreter is written in portable C. + +The Java version will be tightly integrated with Java to allow both to script +any Java class and to embed the interpreter into any Java application. + +Visit http://jruby.sourceforge.net for more information. diff --git a/build.xml b/build.xml new file mode 100644 index 00000000000..7460c829257 --- /dev/null +++ b/build.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jruby.mf b/jruby.mf new file mode 100644 index 00000000000..3312f8e11a9 --- /dev/null +++ b/jruby.mf @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +Main-Class: org.jruby.parser.parse diff --git a/org/jruby/.nbattrs b/org/jruby/.nbattrs new file mode 100644 index 00000000000..de057476834 --- /dev/null +++ b/org/jruby/.nbattrs @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org/jruby/Ruby.java b/org/jruby/Ruby.java new file mode 100644 index 00000000000..2f5cc3ac690 --- /dev/null +++ b/org/jruby/Ruby.java @@ -0,0 +1,439 @@ +/* + * Ruby.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +import java.util.*; + +import org.jruby.core.*; +import org.jruby.original.*; +import org.jruby.interpreter.*; + +/** + * The jruby runtime. + * + * @author jpetersen + */ +public final class Ruby implements token { + /** rb_class_tbl + * + */ + private Map classMap; + + /** rb_global_tbl + * + */ + private Map globalMap; + + private int securityLevel = 0; + + private RubyInterpreter rubyInterpreter = null; + + // Default objects and classes. + + private RubyNil nilObject; + private RubyBoolean trueObject; + private RubyBoolean falseObject; + + private RubyClass classClass; + private RubyClass moduleClass; + private RubyClass objectClass; + private RubyClass fixnumClass; + private RubyClass nilClass; + private RubyClass trueClass; + private RubyClass falseClass; + private RubyClass symbolClass; + + private RubyClass stringClass; + private RubyModule kernelModule; + + private RubyOriginalMethods originalMethods; + + /** + * + */ + // public SCOPE ruby_scope = new SCOPE(); + public RubyScope rubyScope = new RubyScope(); + + public op_tbl[] op_tbl; + + /** Create and initialize a new jruby Runtime. + */ + public Ruby() { + initOperatorTable(); + + originalMethods = new RubyOriginalMethods(this); + + globalMap = new HashMap(); + classMap = new HashMap(); + + nilObject = new RubyNil(this); + trueObject = new RubyBoolean(this, true); + falseObject = new RubyBoolean(this, false); + + initializeCoreClasses(); + } + + /** Returns an in + /** Returns the "true" instance from the instance pool. + * @return The "true" instance. + */ + public RubyBoolean getTrue() { + return trueObject; + } + + /** Returns the "false" instance from the instance pool. + * @return The "false" instance. + */ + public RubyBoolean getFalse() { + return falseObject; + } + + public RubyNil getNil() { + return nilObject; + } + + public RubyClass getTrueClass() { + return trueClass; + } + + public RubyClass getFalseClass() { + return falseClass; + } + + public RubyClass getNilClass() { + return nilClass; + } + + public RubyClass getSymbolClass() { + return symbolClass; + } + + /** Returns a class from the instance pool. + * @param name The name of the class. + * @return The class. + */ + public RubyClass getRubyClass(String name) { + return (RubyClass)classMap.get(intern(name)); + } + + /** rb_define_boot? + * + */ + private RubyClass defineBootClass(String name, RubyClass superClass) { + RubyClass bootClass = RubyClass.m_newClass(this, superClass); + bootClass.setName(intern(name)); + classMap.put(intern(name), bootClass); + + return bootClass; + } + + private void initializeCoreClasses() { + RubyClass metaClass; + + objectClass = defineBootClass("Object", null); + moduleClass = defineBootClass("Module", objectClass); + classClass = defineBootClass("Class", moduleClass); + + metaClass = classClass.newSingletonClass(); + objectClass.setRubyClass(metaClass); + metaClass.attachSingletonClass(objectClass); + + metaClass = metaClass.newSingletonClass(); + moduleClass.setRubyClass(metaClass); + metaClass.attachSingletonClass(moduleClass); + + metaClass = metaClass.newSingletonClass(); + classClass.setRubyClass(metaClass); + metaClass.attachSingletonClass(classClass); + + RubyModule kernelModule = RBKernel.createKernelModule(this); + objectClass.includeModule(kernelModule); + + objectClass.definePrivateMethod("initialize", DefaultCallbackMethods.getMethodNil()); + classClass.definePrivateMethod("inherited", DefaultCallbackMethods.getMethodNil()); + + /* + * + * Ruby's Class Hierarchy Chart + * + * +------------------+ + * | | + * Object---->(Object) | + * ^ ^ ^ ^ | + * | | | | | + * | | +-----+ +---------+ | + * | | | | | + * | +-----------+ | | + * | | | | | + * +------+ | Module--->(Module) | + * | | ^ ^ | + * OtherClass-->(OtherClass) | | | + * | | | + * Class---->(Class) | + * ^ | + * | | + * +----------------+ + * + * + All metaclasses are instances of the class `Class'. + */ + + RbObject.initObjectClass(objectClass); + RbClass.initClassClass(classClass); + + nilClass = RbNilClass.createNilClass(this); + + falseClass = RbFalseClass.createFalseClass(this); + + RbNumeric.createNumericClass(this); + fixnumClass = RbFixnum.createFixnum(this); + stringClass = RbString.createStringClass(this); + } + + /** rb_define_class + * + */ + public RubyClass defineClass(String name, RubyClass superClass) { + RubyClass newClass = defineClassId(intern(name), superClass); + + classMap.put(intern(name), newClass); + + return newClass; + } + + /** rb_define_class_id + * + */ + public RubyClass defineClassId(RubyId id, RubyClass superClass) { + if (superClass == null) { + superClass = getObjectClass(); + } + + RubyClass newClass = RubyClass.m_newClass(this, superClass); + newClass.setName(id); + + newClass.setRubyClass(((RubyClass)superClass.getRubyClass()).newSingletonClass()); + ((RubyClass)newClass.getRubyClass()).attachSingletonClass(newClass); + + superClass.funcall(intern("inherited"), newClass); + + return newClass; + } + + /** rb_define_module + * + */ + public RubyModule defineModule(String name) { + RubyModule newModule = defineModuleId(intern(name)); + + classMap.put(name, newModule); + + return newModule; + } + + /** rb_define_module_id + * + */ + public RubyModule defineModuleId(RubyId id) { + RubyModule newModule = RubyModule.m_newModule(this); + newModule.setName(id); + + return newModule; + } + + /** rb_define_global_function + * + */ + public void defineGlobalFunction(String name, RubyCallbackMethod method) { + getKernelModule().defineModuleFunction(name, method); + } + + public RubyModule getKernelModule() { + return kernelModule; + } + + /** Getter for property securityLevel. + * @return Value of property securityLevel. + */ + public int getSecurityLevel() { + return this.securityLevel; + } + + /** Setter for property securityLevel. + * @param securityLevel New value of property securityLevel. + */ + public void setSecurityLevel(int securityLevel) { + this.securityLevel = securityLevel; + } + + public RubyClass getClassClass() { + return classClass; + } + + public RubyClass getObjectClass() { + return objectClass; + } + + public RubyClass getModuleClass() { + return moduleClass; + } + + public RubyClass getFixnumClass() { + return fixnumClass; + } + + public RubyClass getStringClass() { + return stringClass; + } + + public void secure(int security) { + } + + /*public void defineGlobalConst(String name, RubyObject obj) { + }*/ + + public RubyFixnum getFixnumInstance(long value) { + return new RubyFixnum(this, value); + } + + /** rb_define_global_const + * + */ + public void defineGlobalConstant(String name, RubyObject value) { + getObjectClass().defineConstant(name, value); + } + + /** top_const_get + * + */ + public RubyObject getTopConstant(RubyId id) { + if (classMap.get(id) != null) { + return (RubyObject)classMap.get(id); + } + + /* autoload */ + // if (autoload_tbl && st_lookup(autoload_tbl, id, 0)) { + // rb_autoload_load(id); + // *klassp = rb_const_get(rb_cObject, id); + // return Qtrue; + //} + + return null; + } + + /** + * + */ + public boolean isAutoloadDefined(ID id) { + return false; + } + + public RubyOriginalMethods getOriginalMethods() { + return this.originalMethods; + } + + public RubyId intern(String name) { + return (RubyId)ID.rb_intern(name, this); + } + + public boolean isClassDefined(RubyId id) { + return false; + } + + public RubyId toId(RubyObject name) { + return null; + } + + // Compatibility + + public ID createId(int value) { + return new RubyId(this, value); + } + + public RubyInterpreter getInterpreter() { + if (rubyInterpreter == null) { + rubyInterpreter = new RubyInterpreter(this); + } + return rubyInterpreter; + } + + // -- + + public static class op_tbl { + public RubyId token; + public String name; + + private op_tbl(Ruby ruby, int token, String name) { + this.token = new RubyId(ruby, token); + this.name = name; + } + } + + private void initOperatorTable() { + op_tbl = new op_tbl[] { + new op_tbl(this, tDOT2, ".."), + new op_tbl(this, tDOT3, "..."), + new op_tbl(this, '+', "+"), + new op_tbl(this, '-', "-"), + new op_tbl(this, '+', "+(binary)"), + new op_tbl(this, '-', "-(binary)"), + new op_tbl(this, '*', "*"), + new op_tbl(this, '/', "/"), + new op_tbl(this, '%', "%"), + new op_tbl(this, tPOW, "**"), + new op_tbl(this, tUPLUS, "+@"), + new op_tbl(this, tUMINUS, "-@"), + new op_tbl(this, tUPLUS, "+(unary)"), + new op_tbl(this, tUMINUS, "-(unary)"), + new op_tbl(this, '|', "|"), + new op_tbl(this, '^', "^"), + new op_tbl(this, '&', "&"), + new op_tbl(this, tCMP, "<=>"), + new op_tbl(this, '>', ">"), + new op_tbl(this, tGEQ, ">="), + new op_tbl(this, '<', "<"), + new op_tbl(this, tLEQ, "<="), + new op_tbl(this, tEQ, "=="), + new op_tbl(this, tEQQ, "==="), + new op_tbl(this, tNEQ, "!="), + new op_tbl(this, tMATCH, "=~"), + new op_tbl(this, tNMATCH, "!~"), + new op_tbl(this, '!', "!"), + new op_tbl(this, '~', "~"), + new op_tbl(this, '!', "!(unary)"), + new op_tbl(this, '~', "~(unary)"), + new op_tbl(this, '!', "!@"), + new op_tbl(this, '~', "~@"), + new op_tbl(this, tAREF, "[]"), + new op_tbl(this, tASET, "[]="), + new op_tbl(this, tLSHFT, "<<"), + new op_tbl(this, tRSHFT, ">>"), + new op_tbl(this, tCOLON2, "::"), + new op_tbl(this, '`', "`"), + new op_tbl(this, 0, null), + }; + } +} \ No newline at end of file diff --git a/org/jruby/RubyArray.java b/org/jruby/RubyArray.java new file mode 100644 index 00000000000..09c43d3ec6c --- /dev/null +++ b/org/jruby/RubyArray.java @@ -0,0 +1,348 @@ +/* + * RubyArray.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +import java.util.*; + +import org.jruby.exceptions.*; + +/** + * + * @author jpetersen + */ +public class RubyArray extends RubyObject { + private ArrayList array; + private boolean tmpLock; + + public RubyArray(Ruby ruby) { + this(ruby, null); + } + + public RubyArray(Ruby ruby, List array) { + super(ruby); + this.array = new ArrayList(array); + } + + public ArrayList getArray() { + return array; + } + + public void setArray(ArrayList array) { + this.array = array; + } + + + /** Getter for property tmpLock. + * @return Value of property tmpLock. + */ + public boolean isTmpLock() { + return tmpLock; + } + + /** Setter for property tmpLock. + * @param tmpLock New value of property tmpLock. + */ + public void setTmpLock(boolean tmpLock) { + this.tmpLock = tmpLock; + } + + public long length() { + return array.size(); + } + + /** rb_ary_modify + * + */ + public void modify() { + if (isFrozen()) { + throw new RubyFrozenException("Array"); + } + if (isTmpLock()) { + throw new RubyTypeException("can't modify array during sort"); + } + if (isTaint() && getRuby().getSecurityLevel() >= 4 ) { + throw new RubySecurityException("Insecure: can't modify array"); + } + } + + /** rb_ary_store + * + */ + public void store(long idx, RubyObject value) { + modify(); + if (idx < 0) { + idx += array.size(); + if (idx < 0) { + throw new RubyIndexException("index " + (idx - array.size()) + " out of array"); + } + } + if (idx > array.size()) { + array.ensureCapacity((int)idx + 1); + for (int i = array.size(); i < idx; i++) { + array.add(getRuby().getNil()); + } + } + if (idx == array.size()) { + array.add(value); + } + array.set((int)idx, value); + } + + + /** rb_ary_entry + * + */ + public RubyObject entry(long offset) { + if (array.size() == 0) { + return getRuby().getNil(); + } + + if (offset < 0) { + offset += array.size(); + } + + if (offset < 0 || array.size() <= offset) { + return getRuby().getNil(); + } + return (RubyObject)array.get((int)offset); + } + + + /** rb_ary_push + * + */ + public RubyArray push(RubyObject item) { + array.add(item); + return this; + } + + /** rb_ary_unshift + * + */ + public RubyArray unshift(RubyObject item) { + modify(); + array.add(0, item); + + return this; + } + + /** rb_ary_subseq + * + */ + public RubyArray subseq(long beg, long len) { + /*if (beg > array.size()) { + return getRuby().getNil(); + }*/ + /* if (beg < 0 || len < 0) { + return getRuby().getNil(); + }*/ + + if (beg + len > array.size()) { + len = array.size() - beg; + } + if (len < 0) { + len = 0; + } + if (len == 0) { + return m_newArray(getRuby()); + } + + RubyArray ary2 = m_newArray(getRuby(), (int)len); + ary2.array.addAll(array.subList((int)beg, (int)(len + beg))); + + return ary2; + } + + /** + * + + public int length() { + return array.size(); + } + + // + // Methods of the Array Class (rb_ary_*): + // + + /** rb_ary_new2 + * + */ + public static RubyArray m_newArray(Ruby ruby, long len) { + return new RubyArray(ruby, new ArrayList((int)len)); + } + + /** rb_ary_new + * + */ + public static RubyArray m_newArray(Ruby ruby) { + return new RubyArray(ruby, new ArrayList(0)); + } + + /** + * + */ + public static RubyArray m_newArray(Ruby ruby, RubyObject obj) { + return new RubyArray(ruby, Collections.singletonList(obj)); + } + + /** rb_assoc_new + * + */ + public static RubyArray m_newArray(Ruby ruby, RubyObject car, RubyObject cdr) { + return new RubyArray(ruby, Arrays.asList(new RubyObject[] {car, cdr})); + } + + /** rb_ary_push_m + * + */ + public RubyArray m_push(RubyObject[] items) { + if (items.length == 0) { + throw new RubyArgumentException("wrong # of arguments(at least 1)"); + } + + for (int i = 0; i < items.length; i++) { + array.add(items[i]); + } + return this; + } + + /** rb_ary_pop + * + */ + public RubyObject m_pop() { + modify(); + if (array.size() == 0) { + return getRuby().getNil(); + } + return (RubyObject)array.remove(array.size() - 1); + } + + /** rb_ary_shift + * + */ + public RubyObject m_shift() { + modify(); + if (array.size() == 0) { + return getRuby().getNil(); + } + + return (RubyObject)array.remove(0); + } + + /** rb_ary_unshift_m + * + */ + public RubyArray m_unshift(RubyObject[] items) { + if (items.length == 0) { + throw new RubyArgumentException("wrong # of arguments(at least 1)"); + } + modify(); + array.addAll(0, Arrays.asList(items)); + + return this; + } + + /** rb_ary_includes + * + */ + public RubyBoolean m_includes(RubyObject item) { + if (array.contains(item)) { + return getRuby().getTrue(); + } else { + return getRuby().getFalse(); + } + } + + /** rb_ary_frozen_p + * + */ + public RubyBoolean m_frozen() { + return super.m_frozen().op_or(new RubyBoolean(getRuby(), isTmpLock())); + } + + /** rb_ary_initialize + * + */ + public RubyObject m_initialize(RubyFixnum size, RubyObject value) { + modify(); + + long len = size.getValue(); + if (len < 0) { + throw new RubyArgumentException("negative array size"); + } + if (len > Integer.MAX_VALUE) { + throw new RubyArgumentException("array size too big"); + } + Collections.fill(array, value); + for (int i = array.size(); i < len; i++) { + array.add(value); + } + return this; + } + + /** rb_ary_aref + * + */ + public RubyObject m_slice(RubyObject[] args) { + if (args.length == 2) { + long beg = ((RubyFixnum)args[0]).getValue(); + long len = ((RubyFixnum)args[1]).getValue(); + if (beg < 0) { + beg += array.size(); + } + return subseq(beg, len); + } + if (args.length == 1) { + if (args[0] instanceof RubyFixnum) { + return entry(((RubyFixnum)args[0]).getValue()); + } +/* if (args[0] instanceof RubyBignum) { + throw new RubyIndexException("index too big"); + } + if (args[0] instanceof RubyRange) { + + }*/ + } + return getRuby().getNil(); + } + + /** rb_ary_at + * + */ + public RubyObject m_at(RubyFixnum pos) { + return entry(pos.getValue()); + } + + /** rb_ary_concat + * + */ + public RubyArray m_concat(RubyObject obj) { + // obj.toArray(); + + return this; + } +} \ No newline at end of file diff --git a/org/jruby/RubyBlock.java b/org/jruby/RubyBlock.java new file mode 100644 index 00000000000..c94f81bf96e --- /dev/null +++ b/org/jruby/RubyBlock.java @@ -0,0 +1,39 @@ +/* + * RubyBlock.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + */ +public class RubyBlock { + + /** Creates new RubyBlock */ + public RubyBlock() { + } + +} diff --git a/org/jruby/RubyBoolean.java b/org/jruby/RubyBoolean.java new file mode 100644 index 00000000000..a41511f91c5 --- /dev/null +++ b/org/jruby/RubyBoolean.java @@ -0,0 +1,124 @@ +/* + * RubyBoolean.java - No description + * Created on 09. Juli 2001, 21:38 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + */ +public class RubyBoolean extends RubyObject { + private boolean value; + + public RubyBoolean(Ruby ruby, boolean value) { + super(ruby); + this.value = value; + } + + public RubyModule getRubyClass() { + if (value) { + return getRuby().getTrueClass(); + } else { + return getRuby().getFalseClass(); + } + } + + public boolean isTrue() { + return value; + } + + public boolean isFalse() { + return !value; + } + + public static RubyBoolean m_newBoolean(Ruby ruby, boolean value) { + if (value) { + return ruby.getTrue(); + } else { + return ruby.getFalse(); + } + } + + // Methods of the False class (false_*) + + + /** false_to_s + * true_to_s + * + */ + public RubyString m_to_s() { + if (isFalse()) { + return RubyString.m_newString(getRuby(), "false"); + } else { + return RubyString.m_newString(getRuby(), "true"); + } + } + + /** false_type + * true_type + * + */ + public RubyModule m_type() { + return (RubyClass)getRubyClass(); + } + + /** false_and + * true_and + * + */ + public RubyBoolean op_and(RubyBoolean obj) { + if (isTrue() && obj.isTrue()) { + return getRuby().getTrue(); + } else { + return getRuby().getFalse(); + } + } + + /** false_or + * true_or + * + */ + public RubyBoolean op_or(RubyBoolean obj) { + if (isFalse() && obj.isFalse()) { + return getRuby().getFalse(); + } else { + return getRuby().getTrue(); + } + } + + /** false_xor + * true_xor + * + */ + public RubyBoolean op_xor(RubyBoolean obj) { + if ((isTrue() && obj.isFalse()) || (isFalse() && obj.isTrue())) { + return getRuby().getTrue(); + } else { + return getRuby().getFalse(); + } + } + +} \ No newline at end of file diff --git a/org/jruby/RubyClass.java b/org/jruby/RubyClass.java new file mode 100644 index 00000000000..330294d6e2a --- /dev/null +++ b/org/jruby/RubyClass.java @@ -0,0 +1,84 @@ +/* + * RubyClass.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +import java.util.*; + +import org.jruby.exceptions.*; +import org.jruby.util.*; + +/** + * + * @author jpetersen + */ +public class RubyClass extends RubyModule { + public RubyClass(Ruby ruby) { + this(ruby, null); + } + + public RubyClass(Ruby ruby, RubyModule rubyClass) { + this(ruby, rubyClass, null); + } + + public RubyClass(Ruby ruby, RubyModule rubyClass, RubyModule superClass) { + super(ruby, rubyClass, superClass); + } + + public boolean isModule() { + return false; + } + + public boolean isClass() { + return !isIncluded(); + } + + // Methods of the Class class (rb_class_*): + + /** rb_class_s_new + * + */ + public static RubyClass m_newClass(Ruby ruby, RubyClass superClass) { + return new RubyClass(ruby, ruby.getClassClass(), superClass); + } + + /** rb_class_new_instance + * + */ + public RubyObject m_new(RubyObject[] args) { + if (isSingleton()) { + throw new RubyTypeException("can't create instance of virtual class"); + } + + RubyObject obj = new RubyObject(getRuby(), this); + + // PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT); + obj.funcall(getRuby().intern("initialize"), args); + // POP_ITER(); + + return obj; + } +} \ No newline at end of file diff --git a/org/jruby/RubyFixnum.java b/org/jruby/RubyFixnum.java new file mode 100644 index 00000000000..a083f5b85a1 --- /dev/null +++ b/org/jruby/RubyFixnum.java @@ -0,0 +1,124 @@ +/* + * RubyFixnum.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + */ +public class RubyFixnum extends RubyInteger { + private long value; + + public RubyFixnum(Ruby ruby) { + this(ruby, 0); + } + + public RubyFixnum(Ruby ruby, long value) { + super(ruby, ruby.getFixnumClass()); + this.value = value; + } + + /** Getter for property value. + * @return Value of property value. + */ + public long getValue() { + return this.value; + } + + /** Setter for property value. + * @param value New value of property value. + */ + public void setValue(long value) { + this.value = value; + } + + // Methods of the Fixnum Class (fix_*): + + public static RubyFixnum m_newFixnum(Ruby ruby, long value) { + // Cache for Fixnums (Performance) + + return new RubyFixnum(ruby, value); + } + + public RubyFixnum op_plus(RubyFixnum other) { + return m_newFixnum(getRuby(), getValue() + other.getValue()); + } + + public RubyFixnum op_minus(RubyFixnum other) { + return m_newFixnum(getRuby(), getValue() - other.getValue()); + } + + public RubyFixnum op_mul(RubyFixnum other) { + return m_newFixnum(getRuby(), getValue() * other.getValue()); + } + + public RubyFixnum op_div(RubyFixnum other) { + return m_newFixnum(getRuby(), getValue() / other.getValue()); + } + + public RubyFixnum op_mod(RubyFixnum other) { + return m_newFixnum(getRuby(), getValue() % other.getValue()); + } + + public RubyFixnum op_exp(RubyFixnum other) { + return m_newFixnum(getRuby(), (long)Math.pow(getValue(), other.getValue())); + } + + public RubyBoolean op_equal(RubyFixnum other) { + return getValue() == other.getValue() ? getRuby().getTrue() : getRuby().getFalse(); + } + + public RubyFixnum op_cmp(RubyFixnum other) { + if (getValue() == other.getValue()) { + return m_newFixnum(getRuby(), 0); + } else if (getValue() > other.getValue()) { + return m_newFixnum(getRuby(), 1); + } else { + return m_newFixnum(getRuby(), -1); + } + } + + public RubyBoolean op_gt(RubyFixnum other) { + return getValue() > other.getValue() ? getRuby().getTrue() : getRuby().getFalse(); + } + + public RubyBoolean op_ge(RubyFixnum other) { + return getValue() >= other.getValue() ? getRuby().getTrue() : getRuby().getFalse(); + } + + public RubyBoolean op_lt(RubyFixnum other) { + return getValue() < other.getValue() ? getRuby().getTrue() : getRuby().getFalse(); + } + + public RubyBoolean op_le(RubyFixnum other) { + return getValue() <= other.getValue() ? getRuby().getTrue() : getRuby().getFalse(); + } + + public RubyString m_to_s() { + return RubyString.m_newString(getRuby(), String.valueOf(getValue())); + } +} \ No newline at end of file diff --git a/org/jruby/RubyFloat.java b/org/jruby/RubyFloat.java new file mode 100644 index 00000000000..b73cb6b37e7 --- /dev/null +++ b/org/jruby/RubyFloat.java @@ -0,0 +1,59 @@ +/* + * RubyFloat.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + */ +public class RubyFloat extends RubyObject { + private double value; + + public RubyFloat(Ruby ruby) { + this(ruby, 0.0); + } + + public RubyFloat(Ruby ruby, double value) { + super(ruby); + this.value = value; + } + + /** Getter for property value. + * @return Value of property value. + */ + public double getValue() { + return this.value; + } + + /** Setter for property value. + * @param value New value of property value. + */ + public void setValue(double value) { + this.value = value; + } + +} diff --git a/org/jruby/RubyHash.java b/org/jruby/RubyHash.java new file mode 100644 index 00000000000..fecc70cdff6 --- /dev/null +++ b/org/jruby/RubyHash.java @@ -0,0 +1,70 @@ +/* + * RubyHash.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +import java.util.*; + +import org.jruby.util.*; + +/** + * + * @author jpetersen + */ +public class RubyHash extends RubyObject { + private RubyMap valueMap; + private RubyObject defautValue; + + public RubyHash(Ruby ruby) { + this(ruby, new RubyHashMap()); + } + + public RubyHash(Ruby ruby, Map valueMap) { + this(ruby, new RubyHashMap(), null); + } + + public RubyHash(Ruby ruby, RubyMap valueMap, RubyObject defaultValue) { + super(ruby); + this.valueMap = valueMap; + this.defautValue = defautValue; + } + + public RubyObject getDefautValue() { + return this.defautValue; + } + + public void setDefautValue(RubyObject defautValue) { + this.defautValue = defautValue; + } + + public RubyMap getValueMap() { + return this.valueMap; + } + + public void setValueMap(RubyMap valueMap) { + this.valueMap = valueMap; + } +} \ No newline at end of file diff --git a/org/jruby/RubyId.java b/org/jruby/RubyId.java new file mode 100644 index 00000000000..8eef5820330 --- /dev/null +++ b/org/jruby/RubyId.java @@ -0,0 +1,92 @@ +/* + * RubyId.java - No description + * Created on 09. Juli 2001, 21:38 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +import org.jruby.original.*; +import org.jruby.parser.*; + +/** + * + * @author jpetersen + */ +public class RubyId extends ID { + private Ruby ruby; + + public RubyId(Ruby ruby) { + this(ruby, 0); + } + + public RubyId(Ruby ruby, int value) { + super(); + this.ruby = ruby; + this.value = value; + } + + public RubySymbol toSymbol() { + return null; + } + + public String toName() { + return ID.rb_id2name(getRuby(), this); + } + + public boolean isConstId() { + return is_const_id(); + } + + public boolean isClassId() { + return is_class_id(); + } + + public boolean isGlobalId() { + return is_global_id(); + } + + public boolean equals(Object object) { + return (object instanceof RubyId) && + ((RubyId)object).value == value; + } + + public int hashCode() { + return value; + } + + /** Getter for property ruby. + * @return Value of property ruby. + */ + public org.jruby.Ruby getRuby() { + return ruby; + } + + /** Setter for property ruby. + * @param ruby New value of property ruby. + */ + public void setRuby(org.jruby.Ruby ruby) { + this.ruby = ruby; + } + +} diff --git a/org/jruby/RubyInteger.java b/org/jruby/RubyInteger.java new file mode 100644 index 00000000000..dc7c8b1b0c9 --- /dev/null +++ b/org/jruby/RubyInteger.java @@ -0,0 +1,39 @@ +/* + * RubyInteger.java - No description + * Created on 10. September 2001, 17:49 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + * @version + */ +public class RubyInteger extends RubyNumeric { + + public RubyInteger(Ruby ruby, RubyClass rubyClass) { + super(ruby, rubyClass); + } +} \ No newline at end of file diff --git a/org/jruby/RubyMethod.java b/org/jruby/RubyMethod.java new file mode 100644 index 00000000000..6cebb957fb1 --- /dev/null +++ b/org/jruby/RubyMethod.java @@ -0,0 +1,35 @@ +/* + * RubyMethod.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + + +/** + * @deprecated + * @author jpetersen + */ +public abstract class RubyMethod { +} \ No newline at end of file diff --git a/org/jruby/RubyModule.java b/org/jruby/RubyModule.java new file mode 100644 index 00000000000..29e26221899 --- /dev/null +++ b/org/jruby/RubyModule.java @@ -0,0 +1,1200 @@ +/* + * RubyModule.java - No description + * Created on 09. Juli 2001, 21:38 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +import java.util.*; + +import org.jruby.core.*; +import org.jruby.exceptions.*; +import org.jruby.interpreter.*; +import org.jruby.original.*; +import org.jruby.util.*; + +/** + * + * @author jpetersen + */ +public class RubyModule extends RubyObject implements Scope, node_type { + private RubyModule superClass; + private RubyMap methods = new RubyHashMap(); + + // Flags + private boolean singleton = false; + + /** Holds value of property included. */ + private boolean included; + + public RubyModule(Ruby ruby) { + this(ruby, null); + } + + public RubyModule(Ruby ruby, RubyModule rubyClass) { + this(ruby, rubyClass, null); + } + + public RubyModule(Ruby ruby, RubyModule rubyClass, RubyModule superClass) { + super(ruby, rubyClass); + + this.superClass = superClass; + } + + /** Getter for property superClass. + * @return Value of property superClass. + */ + public RubyModule getSuperClass() { + return this.superClass; + } + + /** Setter for property superClass. + * @param superClass New value of property superClass. + */ + public void setSuperClass(RubyModule superClass) { + this.superClass = superClass; + } + + public boolean isSingleton() { + return this.singleton; + } + + public void setSingleton(boolean singleton) { + this.singleton = singleton; + } + + + public RubyMap getMethods() { + return this.methods; + } + + public void setMethods(RubyMap methods) { + this.methods = methods; + } + + public boolean isModule() { + return !isIncluded(); + } + + public boolean isClass() { + return false; + } + + /** classname + * + */ + public RubyString getClassname() { + RubyString path = null; + + RubyModule rbModule = this; + while (rbModule.isIncluded() || rbModule.isSingleton()) { + rbModule = ((RubyClass)rbModule).getSuperClass(); + } + + if (rbModule == null) { + rbModule = getRuby().getObjectClass(); + } + + path = (RubyString)getInstanceVariables().get("__classpath__"); + if (path != null) { + if (getInstanceVariables().get("__classid__") != null) { + path = RubyString.m_newString(getRuby(), ((RubyId)getInstanceVariables().get("__classid__")).toName()); // todo: convert from symbol to string + + getInstanceVariables().put("__classpath__", path); + getInstanceVariables().remove("__classid__"); + } + } + + if (path == null) { + path = rbModule.findClassPath(); + + /* if (path.isNil()) { + return null; + }*/ + + return path; + } + + /*if (!(path instanceof RubyString)) { + throw new RubyBugException("class path is not set properly"); + }*/ + + return path; + } + + /** + * + */ + public RubyString findClassPath() { + return null; + } + + /** include_class_new + * + */ + public RubyClass newIncludeClass(RubyModule superClass) { + RubyClass newClass = new RubyClass(getRuby(), getRuby().getClassClass(), superClass); + newClass.setIncluded(true); + + newClass.setInstanceVariables(getInstanceVariables()); + newClass.setMethods(getMethods()); + + if (isIncluded()) { + newClass.setRubyClass(getRubyClass()); + } else { + newClass.setRubyClass(this); + } + + return newClass; + } + + public void setName(RubyId id) { + getInstanceVariables().put("__classid__", id); + } + + /** rb_set_class_path + * + */ + public void setClassPath(RubyModule under, String name) { + RubyString value = null; + + if (under == getRuby().getObjectClass()) { + value = RubyString.m_newString(getRuby(), name); + } else { + value = (RubyString)under.getClassPath().m_dup(); + value.m_cat("::"); + value.m_cat(name); + } + + getInstanceVariables().put("__classpath__", value); + } + + /** rb_class_path + * + */ + public RubyString getClassPath() { + RubyString path = getClassname(); + + if (path != null) { + return path; + } + + String s = "Module"; + if (isClass()) { + s = "Class"; + } + + return RubyString.m_newString(getRuby(), "<" + s + " 01x" + Integer.toHexString(hashCode()) + ">"); // 0 = pointer + } + + public void setCvar(RubyId id, RubyObject value) { + } + + public void declareCvar(RubyId id, RubyObject value) { + } + + public RubyObject getCvar(RubyId id) { + return null; + } + + public boolean isCvarDefined(RubyId id) { + return false; + } + + /** + * + */ + public void setConstant(RubyId id, RubyObject value) { + setAv(id, value, true); + } + + /** rb_const_get + * + */ + public RubyObject getConstant(RubyId id) { + boolean mod_retry = false; + RubyModule tmp = this; + + while (true) { + while (tmp != null) { + if (tmp.getInstanceVariables().get(id) != null) { + return (RubyObject)tmp.getInstanceVariables().get(id); + } + if (tmp == getRuby().getObjectClass() && getRuby().getTopConstant(id) != null) { + return getRuby().getTopConstant(id); + } + tmp = tmp.getSuperClass(); + } + if (!mod_retry && isModule()) { + mod_retry = true; + tmp = getRuby().getObjectClass(); + continue; + } + break; + } + + /* Uninitialized constant */ + if (this != getRuby().getObjectClass()) { + throw new RubyNameException("uninitialized constant " + id.toName() + " at " + getClassPath().getString()); + } else { + throw new RubyNameException("uninitialized constant " + id.toName()); + } + + // return getRuby().getNil(); + } + + /** rb_include_module + * + */ + public void includeModule(RubyModule rubyModule) { + if (rubyModule == null || rubyModule == this) { + return; + } + + RubyModule actClass = this; + while (rubyModule != null) { + for (RubyModule rbClass = actClass.getSuperClass(); rbClass != null; rbClass = rbClass.getSuperClass()) { + if (rbClass.isIncluded() && rbClass.getMethods() == rubyModule.getMethods()) { + if (rubyModule.getSuperClass() != null) { + rbClass.includeModule(rubyModule.getSuperClass()); + } + return; + } + } + actClass.setSuperClass(rubyModule.newIncludeClass(actClass.getSuperClass())); + actClass = actClass.getSuperClass(); + rubyModule = rubyModule.getSuperClass(); + } + } + + /** mod_av_set + * + */ + protected void setAv(RubyId id, RubyObject value, boolean constant) { + String dest = constant ? "constant" : "class variable"; + + if (!isTaint() && getRuby().getSecurityLevel() >= 4) { + throw new RubySecurityException("Insecure: can't set " + dest); + } + if (isFrozen()) { + throw new RubyFrozenException("class/module"); + } + if (constant && (getInstanceVariables().get(id) != null)) { + //getRuby().warn("already initialized " + dest + " " + name); + } + + if (getInstanceVariables() == null) { + setInstanceVariables(new RubyHashMap()); + } + + getInstanceVariables().put(id, value); + } + + /** rb_add_method + * + */ + public void addMethod(RubyId id, NODE node, int noex) { + if (this == getRuby().getObjectClass()) { + getRuby().secure(4); + } + + if (getRuby().getSecurityLevel() >= 4 && !isTaint()) { + throw new RubySecurityException("Insecure: can't define method"); + } + if (isFrozen()) { + throw new RubyFrozenException("class/module"); + } + NODE body = NODE.newMethod(node, noex); + getMethods().put(id, body); + } + + public void defineMethod(String name, RubyCallbackMethod method) { + RubyId id = getRuby().intern(name); + + int noex = (name.charAt(0) == 'i' && id == getRuby().intern("initialize")) ? NOEX_PRIVATE : NOEX_PUBLIC; + + addMethod(id, NODE.newCallbackMethod(method), noex | NOEX_CFUNC); + } + + public void defineMethodId(RubyId id, RubyCallbackMethod method) { + addMethod(id, NODE.newCallbackMethod(method), NOEX_PUBLIC | NOEX_CFUNC); + } + + public void defineProtectedMethod(String name, RubyCallbackMethod method) { + addMethod(getRuby().intern(name), NODE.newCallbackMethod(method), NOEX_PROTECTED | NOEX_CFUNC); + } + + public void definePrivateMethod(String name, RubyCallbackMethod method) { + addMethod(getRuby().intern(name), NODE.newCallbackMethod(method), NOEX_PRIVATE | NOEX_CFUNC); + } + + /*public void undefMethod(RubyId id) { + if (isFrozen()) { + throw new RubyFrozenException(); + } + + getMethods().remove(id); + }*/ + + public void undefMethod(String name) { + addMethod(getRuby().intern(name), null, NOEX_UNDEF); + } + + /** rb_frozen_class_p + * + */ + protected void testFrozen() { + String desc = "something(?!)"; + if (isFrozen()) { + if (isSingleton()) { + desc = "object"; + } else { + if (isIncluded() || isModule()) { + desc = "module"; + } else if (isClass()) { + desc = "class"; + } + } + throw new RubyFrozenException(desc); + } + } + + /** rb_undef + * + */ + public void undef(RubyId id) { + if (this == getRuby().getObjectClass()) { + getRuby().secure(4); + } + if (getRuby().getSecurityLevel() >= 4 && !isTaint()) { + throw new SecurityException("Insecure: can't undef"); + } + testFrozen(); + if (id == getRuby().intern("__id__") || id == getRuby().intern("__send__")) { + /*rb_warn("undefining `%s' may cause serious problem", + rb_id2name( id ) );*/ + } + NODE body = searchMethod(id); + if (body == null || body.nd_body() == null) { + String s0 = " class"; + RubyModule c = this; + + if (c.isSingleton()) { + RubyObject obj = getIv("__attached__"); + + if (obj instanceof RubyModule) { + c = (RubyModule)obj; + s0 = ""; + } + } else if (c.isModule()) { + s0 = " module"; + } + throw new RubyNameException("undefined method " + id.toName() + + " for" + s0 + " '" + c.toName() + "'"); + } + addMethod(id, null, NOEX_PUBLIC); + } + + /** rb_define_module_function + * + */ + public void defineModuleFunction(String name, RubyCallbackMethod method) { + definePrivateMethod(name, method); + defineSingletonMethod(name, method); + } + + /** rb_define_alias + * + */ + public void defineAlias(String oldName, String newName) { + + } + + /** rb_define_attr + * + */ + public void defineAttribute(String name, boolean read, boolean write) { + + } + + /** rb_const_defined + * + */ + public boolean isConstantDefined(RubyId id) { + for (RubyModule tmp = this; tmp != null; tmp = tmp.getSuperClass()) { + if (tmp.getInstanceVariables() != null && tmp.getInstanceVariables().get(id) != null) { + return true; + } + } + + if (isModule()) { + return getRuby().getObjectClass().isConstantDefined(id); + } + + if (getRuby().isClassDefined(id)) { + return true; + } + + return getRuby().isAutoloadDefined(id); + } + + /** search_method + * + */ + public NODE searchMethod(RubyId id) { + RubyModule rubyModule = getMethodOrigin(id); + + if (rubyModule != null) { + return (NODE)rubyModule.getMethods().get(id); + } + return null; + } + + /** search_method + * + */ + public RubyModule getMethodOrigin(RubyId id) { + NODE body = (NODE)getMethods().get(id); + if (body == null) { + if (getSuperClass() != null) { + return getSuperClass().getMethodOrigin(id); + } else { + return null; + } + } + return this; + } + + /** rb_get_method_body + * + */ + public NODE getMethodBody(RubyId id, int scope) { + NODE body = searchMethod(id); + + // ?? + if (body == null) { + System.out.println("Cant find method: " + id.toName()); + + return null; + } + + // ?? + + // ... cache + + body = body.nd_body(); + + if (body.nd_type() == NODE_FBODY) { + body = body.nd_head(); + } + + return body; + } + + /** rb_call + * + */ + public RubyObject call(RubyObject recv, RubyId id, RubyObject[] args, int scope) { + + // ... + + NODE body = getMethodBody(id, scope); + + return call0(recv, id, args, body, false); + } + + /** rb_call0 + * + */ + public RubyObject call0(RubyObject recv, RubyId id, RubyObject[] args, NODE body, boolean noSuper) { + + // ... + RubyInterpreter interpreter = getRuby().getInterpreter(); + + interpreter.getRubyFrame().push(); + interpreter.PUSH_ITER(0); + + interpreter.getRubyFrame().setLastFunc(id); + interpreter.getRubyFrame().setLastClass(noSuper ? null : this); + interpreter.getRubyFrame().setSelf(recv); + interpreter.getRubyFrame().setArgs(args); + + RubyObject result = null; + + switch (body.nd_type()) { + case NODE_CFUNC: { + result = ((RubyCallbackMethod)body.nd_cfnc()).execute(recv, args, getRuby()); + break; + } + case NODE_IVAR: { + result = interpreter.eval(recv, body); + break; + } + case NODE_SCOPE: { + NODE savedCref = null; + VALUE[] localVars = null; + + getRuby().rubyScope.push(); + + if (body.nd_rval() != null) { + savedCref = interpreter.ruby_cref; + interpreter.ruby_cref = (NODE)body.nd_rval(); + interpreter.getRubyFrame().setCbase(body.nd_rval()); + } + if (body.nd_tbl() != null) { + localVars = new VALUE[body.nd_tbl().length]; + // System.arraycopy(body.nd_tbl(), 0, local_vars, 0, body.nd_tbl().length); + + RubyId[] tmp = new RubyId[body.nd_tbl().length]; + System.arraycopy(body.nd_tbl(), 0, tmp, 0, body.nd_tbl().length); + + getRuby().rubyScope.setLocalTbl(tmp); + getRuby().rubyScope.setLocalVars(localVars); + } else { + localVars = getRuby().rubyScope.getLocalVars(); + + getRuby().rubyScope.setLocalVars(null); + getRuby().rubyScope.setLocalTbl(null); + } + + body = body.nd_next(); + + // PUSH_VARS(); + // PUSH_TAG(PROT_FUNC); + + // try { + NODE node = null; + int i; + + if (body.nd_type() == NODE_ARGS) { + node = body; + body = null; + } else if (body.nd_type() == NODE_BLOCK) { + node = body.nd_head(); + body = body.nd_next(); + } + + if (node != null) { + if (node.nd_type() != NODE_ARGS) { + // rb_bug("no argument-node"); + } + + i = node.nd_cnt(); + if (i > (args != null ? args.length : 0)) { + throw new RubyArgumentException("wrong # of arguments(" + args.length + " for " + i + ")"); + } + if (node.nd_rest() == -1) { + int opt = i; + NODE optnode = node.nd_opt(); + + while (optnode != null) { + opt++; + optnode = optnode.nd_next(); + } + if (opt < (args != null ? args.length : 0)) { + throw new RubyArgumentException("wrong # of arguments(" + args.length + " for " + opt + ")"); + } + RubyObject[] tmp = new RubyObject[opt]; + // System.arraycopy(localVars, 2, tmp, 0, opt); + interpreter.getRubyFrame().setArgs(tmp); + } + + if (localVars != null) { +/* if (i > 0) { + MEMCPY(local_vars+2, argv, VALUE, i); + } + + argv += i; argc -= i; + + if (node.nd_opt() != null) { + NODE opt = node.nd_opt(); + + while (opt != null && args.length != 0) { + assign(recv, opt->nd_head, *argv, 1); + argv++; argc--; + opt = opt->nd_next; + } + rb_eval(recv, opt); + } + if (node->nd_rest >= 0) { + VALUE v; + + if (argc > 0) + v = rb_ary_new4(argc,argv); + else + v = rb_ary_new2(0); + local_vars[node->nd_rest] = v; + }*/ + } + } + + result = interpreter.eval(recv, body); + // } catch (ReturnException rExcptn) { + // } + + getRuby().rubyScope.pop(); + interpreter.ruby_cref = savedCref; + + break; + } + default: { + System.out.println("Not implemented yet (method call): " + id.toName() + ", node_type:" + body.nd_type()); + } + } + + interpreter.getRubyFrame().pop(); + interpreter.POP_ITER(); + + return result ; + } + + + /** rb_singleton_class_new + * + */ + public RubyClass newSingletonClass() { + RubyClass newClass = RubyClass.m_newClass(getRuby(), (RubyClass)this); + newClass.setSingleton(true); + + return newClass; + } + + /** rb_alias + * + */ + public void aliasMethod(RubyId newId, RubyId oldId) { + testFrozen(); + + if (oldId == newId) { + return; + } + + if (this == getRuby().getObjectClass()) { + getRuby().secure(4); + } + + NODE orig = searchMethod(oldId); + RubyModule origin = getMethodOrigin(oldId); + + if (orig == null || orig.nd_body() == null) { + if (isModule()) { + orig = getRuby().getObjectClass().searchMethod(oldId); + origin = getRuby().getObjectClass().getMethodOrigin(oldId); + } + } + if (orig == null || orig.nd_body() == null) { + // print_undef( klass, def ); + } + + NODE body = orig.nd_body(); + orig.nd_cnt(orig.nd_cnt() + 1); + if (body.nd_type() == NODE_FBODY) { /* was alias */ + oldId = (RubyId)body.nd_mid(); + origin = (RubyModule)body.nd_orig(); + body = body.nd_head(); + } + + getMethods().put(newId, NODE.newMethod(NODE.newFBody(body, oldId, origin), orig.nd_noex())); + } + + /** rb_singleton_class_clone + * + */ + public RubyModule getSingletonClassClone() { + if (!isSingleton()) { + return this; + } + + RubyModule clone = new RubyClass(getRuby(), null, getSuperClass()); + clone.setupClone(this); + clone.setInstanceVariables(getInstanceVariables().cloneRubyMap()); + + //clone.setMethods(); + + // st_foreach(RCLASS(klass)->m_tbl, clone_method, clone->m_tbl); + + clone.setSingleton(true); + + return clone; + } + + /** rb_singleton_class_attached + * + */ + public void attachSingletonClass(RubyObject rbObject) { + if (isSingleton()) { + if (getInstanceVariables() == null) { + setInstanceVariables(new RubyHashMap()); + } + + getInstanceVariables().put(getRuby().intern("__atached__"), rbObject); + } + } + + /** rb_define_class_under + * + */ + public RubyClass defineClassUnder(String name, RubyClass superClass) { + RubyClass newClass = getRuby().defineClassId(getRuby().intern(name), superClass); + + setConstant(getRuby().intern(name), newClass); + newClass.setClassPath(this, name); + + return newClass; + } + + /** rb_define_module_under + * + */ + public RubyModule defineModuleUnder(String name) { + RubyModule newModule = getRuby().defineModuleId(getRuby().intern(name)); + + setConstant(getRuby().intern(name), newModule); + newModule.setClassPath(this, name); + + return newModule; + } + + /** rb_class2name + * + */ + public String toName() { + if (this == getRuby().getNilClass()) { + return "nil"; + } + if (this == getRuby().getTrueClass()) { + return "true"; + } + if (this == getRuby().getFalseClass()) { + return "false"; + } + + return ((RubyString)getClassPath()).toString(); + } + + + /** rb_define_const + * + */ + public void defineConstant(String name, RubyObject value) { + RubyId id = getRuby().intern(name); + + if (this == getRuby().getClassClass()) { + getRuby().secure(4); + } + + if (!id.isConstId()) { + throw new RubyNameException("wrong constnt name " + name); + } + + setConstant(id, value); + } + + /** rb_mod_remove_cvar + * + */ + public RubyObject removeCvar(RubyObject name) { // Wrong Parameter ? + RubyId id = getRuby().toId(name); + + if (!id.isClassId()) { + throw new RubyNameException("wrong class variable name " + name); + } + + if (!isTaint() && getRuby().getSecurityLevel() >= 4) { + throw new RubySecurityException("Insecure: can't remove class variable"); + } + + if (isFrozen()) { + throw new RubyFrozenException("class/module"); + } + + RubyObject value = (RubyObject)getInstanceVariables().remove(id); + + if (value != null) { + return value; + } + + if (isCvarDefined(id)) { + throw new RubyNameException("cannot remove " + id.toName() + " for " + toName()); + } + + throw new RubyNameException("class variable " + id.toName() + " not defined for " + toName()); + } + + /** rb_define_class_variable + * + */ + public void defineClassVariable(String name, RubyObject value) { + RubyId id = getRuby().intern(name); + + if (!id.isClassId()) { + throw new RubyNameException("wrong class variable name " + name); + } + + declareCvar(id, value); + } + + /** rb_attr + * + */ + public void addAttribute(RubyId id, boolean read, boolean write, int noex) { + String name = id.toName(); + + RubyId attr_iv = getRuby().intern("@" + name); + + if (read) { +/* RubyMethod rubyMethod = new AttrReadMethod(attr_iv); + rubyMethod.setVisibility(visibility); + addMethod(id, rubyMethod); + id.clearCache(); + invokeMethod("method_added", new RubyBasic[] { id.toSym() }, null); +*/ } + + if (write) { +/* RubyMethod rubyMethod = new AttrWriteMethod(attr_iv); + rubyMethod.setVisibility(visibility); + addMethod(id, rubyMethod); + id.clearCache(); + invokeMethod("method_added", new RubyBasic[] { id.toSym() }, null); +*/ } + } + + // Methods of the Module Class (rb_mod_*): + + /** rb_mod_new + * + */ + public static RubyModule m_newModule(Ruby ruby) { + RubyModule newModule = new RubyModule(ruby, ruby.getModuleClass()); + + return newModule; + } + + /** rb_mod_name + * + */ + public RubyString m_name() { + RubyString path = getClassname(); + if (path != null) { + return (RubyString)path.m_dup(); + } + return RubyString.m_newString(getRuby(), ""); + } + + /** rb_mod_class_variables + * + */ + public RubyArray m_class_variables() { + RubyArray ary = RubyArray.m_newArray(getRuby()); + + RubyModule rbModule = this; + + if (isSingleton()) { + rbModule = ((RubyObject)rbModule.getIv("__atached__")).getCvarSingleton(); + } + + while (rbModule != null) { + if (rbModule.getInstanceVariables() != null) { + Iterator iter = rbModule.getInstanceVariables().keySet().iterator(); + while (iter.hasNext()) { + RubyId id = (RubyId)iter.next(); + if (id.isClassId()) { + RubyString kval = RubyString.m_newString(getRuby(), id.toName()); + if (ary.m_includes(kval).isFalse()) { + ary.push(kval); + } + } + } + } + rbModule = rbModule.getSuperClass(); + } + + return ary; + } + + /** rb_mod_clone + * + */ + public RubyObject m_clone() { + RubyModule clone = new RubyModule(getRuby(), getRubyClass(), getSuperClass()); + clone.setupClone(this); + + if (getInstanceVariables() != null) { + clone.setInstanceVariables(getInstanceVariables().cloneRubyMap()); + } + + // clone methods. + + return clone; + } + + /** rb_mod_dup + * + */ + public RubyObject m_dup() { + RubyModule dup = (RubyModule)m_clone(); + dup.setupObject(getRubyClass()); + + dup.setSingleton(isSingleton()); + + return dup; + } + + /** rb_mod_included_modules + * + */ + public RubyArray m_included_modules() { + RubyArray ary = RubyArray.m_newArray(getRuby()); + + for (RubyModule p = getSuperClass(); p != null; p = p.getSuperClass()) { + if (p.isIncluded()) { + ary.push(p.getRubyClass()); + } + } + + return ary; + } + + /** rb_mod_ancestors + * + */ + public RubyArray m_ancestors() { + RubyArray ary = RubyArray.m_newArray(getRuby()); + + for (RubyModule p = this; p != null; p = p.getSuperClass()) { + if (p.isSingleton()) { + continue; + } + + if (p.isIncluded()) { + ary.push(p.getRubyClass()); + } else { + ary.push(p); + } + } + + return ary; + } + + /** rb_mod_to_s + * + */ + public RubyString m_to_s() { + return (RubyString)getClassPath().m_dup(); + } + + /** rb_mod_eqq + * + */ + public RubyBoolean op_eqq(RubyObject obj) { + //return obj.isKindOf(this); + return getRuby().getFalse(); + } + + /** rb_mod_le + * + */ + public RubyBoolean op_le(RubyObject obj) { + if (!(obj instanceof RubyModule)) { + throw new RubyTypeException("compared with non class/module"); + } + + RubyModule mod = this; + while (mod != null) { + if (mod.getMethods() == ((RubyModule)obj).getMethods()) { + return getRuby().getTrue(); + } + mod = mod.getSuperClass(); + } + + return getRuby().getFalse(); + } + + /** rb_mod_lt + * + */ + public RubyBoolean op_lt(RubyObject obj) { + if (obj == this) { + return getRuby().getFalse(); + } + return op_le(obj); + } + + /** rb_mod_ge + * + */ + public RubyBoolean op_ge(RubyObject obj) { + if (!(obj instanceof RubyModule)) { + throw new RubyTypeException("compared with non class/module"); + } + + return ((RubyModule)obj).op_le(this); + } + + /** rb_mod_gt + * + */ + public RubyBoolean op_gt(RubyObject obj) { + if (this == obj) { + return getRuby().getFalse(); + } + return op_ge(obj); + } + + /** rb_mod_cmp + * + */ + public RubyFixnum op_cmp(RubyObject obj) { + if (this == obj) { + return RubyFixnum.m_newFixnum(getRuby(), 0); + } + + if (!(obj instanceof RubyModule)) { + throw new RubyTypeException("<=> requires Class or Module (" + getRubyClass().toName() + " given)"); + } + + if (op_le(obj).isTrue()) { + return RubyFixnum.m_newFixnum(getRuby(), -1); + } + + return RubyFixnum.m_newFixnum(getRuby(), 1); + } + + /** rb_mod_initialize + * + */ + public RubyObject m_initialize() { + return getRuby().getNil(); + } + + /** rb_module_s_new + * + */ + public static RubyModule m_newModule(Ruby ruby, RubyClass rubyClass) { + RubyModule mod = RubyModule.m_newModule(ruby); + + mod.setRubyClass(rubyClass); + //rubyClass.callInit(); + + return mod; + } + + /** rb_mod_attr + * + */ + public RubyObject m_attr(RubySymbol symbol, RubyBoolean writeable) { + addAttribute(symbol.toId(), true, writeable.isTrue(), 0 /*act_scope*/); + + return getRuby().getNil(); + } + + /** rb_mod_attr_reader + * + */ + public RubyObject m_attr_reader(RubyObject[] args) { + for (int i = 0; i < args.length; i++) { + addAttribute(((RubySymbol)args[i]).toId(), true, false, 0 /*act_scope*/); + } + + return getRuby().getNil(); + } + + /** rb_mod_attr_writer + * + */ + public RubyObject m_attr_writer(RubyObject[] args) { + for (int i = 0; i < args.length; i++) { + addAttribute(((RubySymbol)args[i]).toId(), false, true, 0 /*act_scope*/); + } + + return getRuby().getNil(); + } + + /** rb_mod_attr_accessor + * + */ + public RubyObject m_attr_accessor(RubyObject[] args) { + for (int i = 0; i < args.length; i++) { + addAttribute(((RubySymbol)args[i]).toId(), true, true, 0 /*act_scope*/); + } + + return getRuby().getNil(); + } + + /** rb_mod_const_get + * + */ + public RubyObject m_const_get(RubySymbol symbol) { + RubyId id = symbol.toId(); + + if (!id.isConstId()) { + throw new RubyNameException("wrong constant name " + symbol.getName()); + } + + return getConstant(id); + } + + /** rb_mod_const_set + * + */ + public RubyObject m_const_set(RubySymbol symbol, RubyObject value) { + RubyId id = symbol.toId(); + + if (!id.isConstId()) { + throw new RubyNameException("wrong constant name " + symbol.getName()); + } + + setConstant(id, value); + + return value; + } + + /** rb_mod_const_defined + * + */ + public RubyBoolean m_const_defined(RubySymbol symbol) { + RubyId id = symbol.toId(); + + if (!id.isConstId()) { + throw new RubyNameException("wrong constant name " + symbol.getName()); + } + + return RubyBoolean.m_newBoolean(getRuby(), isConstantDefined(id)); + } + + /** Getter for property included. + * @return Value of property included. + */ + public boolean isIncluded() { + return this.included; + } + + /** Setter for property included. + * @param included New value of property included. + */ + public void setIncluded(boolean included) { + this.included = included; + } + +} \ No newline at end of file diff --git a/org/jruby/RubyNil.java b/org/jruby/RubyNil.java new file mode 100644 index 00000000000..a8fba946df1 --- /dev/null +++ b/org/jruby/RubyNil.java @@ -0,0 +1,83 @@ +/* + * RubyNil.java - No description + * Created on 09. Juli 2001, 21:38 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + */ +public class RubyNil extends RubyObject { + + public RubyNil(Ruby ruby) { + super(ruby); + } + + public RubyModule getRubyClass() { + return getRuby().getNilClass(); + } + + public boolean isNil() { + return true; + } + + // Methods of the Nil Class (nil_*): + + /** nil_to_i + * + */ + public RubyFixnum m_to_i() { + return RubyFixnum.m_newFixnum(getRuby(), 0); + } + + /** nil_to_s + * + */ + public RubyString m_to_s() { + return RubyString.m_newString(getRuby(), ""); + } + + /** nil_to_a + * + */ + public RubyArray m_to_a() { + return RubyArray.m_newArray(getRuby(), 0); + } + + /** nil_inspect + * + */ + public RubyString m_inspect() { + return RubyString.m_newString(getRuby(), "nil"); + } + + /** nil_type + * + */ + public RubyModule m_type() { + return (RubyClass)getRubyClass(); + } +} \ No newline at end of file diff --git a/org/jruby/RubyNumeric.java b/org/jruby/RubyNumeric.java new file mode 100644 index 00000000000..70485453a70 --- /dev/null +++ b/org/jruby/RubyNumeric.java @@ -0,0 +1,148 @@ +/* + * RubyNumeric.java - No description + * Created on 10. September 2001, 17:49 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + * @version + */ +public abstract class RubyNumeric extends RubyObject { + + public RubyNumeric(Ruby ruby, RubyClass rubyClass) { + super(ruby, rubyClass); + } + + public RubyNumeric[] getCoerce(RubyNumeric other) { + if (getRubyClass() == other.getRubyClass()) { + return new RubyNumeric[] {this, other}; + } else { + // HACK +++ + // todo: convert both to float. + return new RubyNumeric[] {this, other}; + // HACK --- + } + } + + /* Numeric methods. (num_*) + * + */ + + /** num_coerce + * + */ + public RubyArray m_coerce(RubyNumeric other) { + if (getRubyClass() == other.getRubyClass()) { + return RubyArray.m_newArray(getRuby(), this, other); + } else { + return null; // Convert both to float. + } + } + + /** num_clone + * + */ + public RubyObject m_clone() { + return this; + } + + /** num_uplus + * + */ + public RubyNumeric op_uplus() { + return this; + } + + /** num_uminus + * + */ + public RubyNumeric op_uminus() { + RubyNumeric[] coerce = getCoerce(RubyFixnum.m_newFixnum(getRuby(), 0)); + + return (RubyNumeric)coerce[1].funcall(getRuby().intern("-"), coerce[0]); + } + + /** num_divmod + * + */ + public RubyArray m_divmod(RubyNumeric other) { + RubyNumeric div = (RubyNumeric)funcall(getRuby().intern("/"), other); + /*if (div instanceof RubyFloat) { + double d = Math.floor(((RubyFloat)div).getValue()); + if (((RubyFloat)div).getValue() > d) { + div = RubyFloat.m_newFloat(getRuby(), d); + } + }*/ + RubyNumeric mod = (RubyNumeric)funcall(getRuby().intern("%"), other); + + return RubyArray.m_newArray(getRuby(), div, mod); + } + + /** num_modulo + * + */ + public RubyNumeric m_modulo(RubyNumeric other) { + return (RubyNumeric)funcall(getRuby().intern("%"), other); + } + + /** num_remainder + * + */ + public RubyNumeric m_remainder(RubyNumeric other) { + RubyNumeric mod = (RubyNumeric)funcall(getRuby().intern("%"), other); + + final RubyNumeric zero = RubyFixnum.m_newFixnum(getRuby(), 0); + + if (funcall(getRuby().intern("<"), zero).isTrue() && + other.funcall(getRuby().intern(">"), zero).isTrue() || + funcall(getRuby().intern(">"), zero).isTrue() && + other.funcall(getRuby().intern("<"), zero).isTrue()) { + + return (RubyNumeric)mod.funcall(getRuby().intern("-"), other); + } + + return mod; + } + + /** num_equal + * + */ + public RubyBoolean m_equal(RubyObject other) { + return other.m_equal(this); + } + + /** num_eql + * + */ + public RubyBoolean m_eql(RubyObject other) { + if (getRubyClass() != other.getRubyClass()) { + return getRuby().getFalse(); + } else { + return super.m_equal(other); + } + } +} \ No newline at end of file diff --git a/org/jruby/RubyObject.java b/org/jruby/RubyObject.java new file mode 100644 index 00000000000..c27382a00f0 --- /dev/null +++ b/org/jruby/RubyObject.java @@ -0,0 +1,560 @@ +/* + * RubyObject.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +import java.util.*; + +import org.jruby.core.*; +import org.jruby.exceptions.*; +import org.jruby.interpreter.nodes.*; +import org.jruby.original.*; +import org.jruby.util.*; + +/** + * + * @author jpetersen + */ +public class RubyObject implements VALUE { + private Ruby ruby; + + private RubyModule rubyClass; + private RubyMap instanceVariables; + + private boolean frozen = false; + private boolean taint = false; + + // deprecated ??? + private boolean immediate = false; + + public RubyObject(Ruby ruby) { + this(ruby, null); + } + + public RubyObject(Ruby ruby, RubyModule rubyClass) { + this.ruby = ruby; + this.rubyClass = rubyClass; + } + + + /** Getter for property frozen. + * @return Value of property frozen. + */ + public boolean isFrozen() { + return this.frozen; + } + + /** Setter for property frozen. + * @param frozen New value of property frozen. + */ + public void setFrozen(boolean frozen) { + this.frozen = frozen; + } + + /** Getter for property immediate. + * @return Value of property immediate. + */ + public boolean isImmediate() { + return this.immediate; + } + + /** Setter for property immediate. + * @param immediate New value of property immediate. + */ + public void setImmediate(boolean immediate) { + this.immediate = immediate; + } + + /** Getter for property ruby. + * @return Value of property ruby. + */ + public org.jruby.Ruby getRuby() { + return this.ruby; + } + + /** Setter for property ruby. + * @param ruby New value of property ruby. + */ + public void setRuby(org.jruby.Ruby ruby) { + this.ruby = ruby; + } + + /** Getter for property rubyClass. + * @return Value of property rubyClass. + */ + public RubyModule getRubyClass() { + return this.rubyClass; + } + + /** Setter for property rubyClass. + * @param rubyClass New value of property rubyClass. + */ + public void setRubyClass(RubyModule rubyClass) { + this.rubyClass = rubyClass; + } + + /** Getter for property taint. + * @return Value of property taint. + */ + public boolean isTaint() { + return this.taint; + } + + + /** Setter for property taint. + * @param taint New value of property taint. + */ + public void setTaint(boolean taint) { + this.taint = taint; + } + + public RubyMap getInstanceVariables() { + if (instanceVariables == null) { + instanceVariables = new RubyHashMap(); + } + return instanceVariables; + } + + public void setInstanceVariables(RubyMap instanceVariables) { + this.instanceVariables = instanceVariables; + } + + // methods + + public boolean isNil() { + return false; + } + + public boolean isTrue() { + return false; + } + + public boolean isFalse() { + return false; + } + + /** rb_special_const_p + * + */ + public boolean isSpecialConst() { + return (isImmediate() || isNil()); + } + + /** SPECIAL_SINGLETON(x,c) + * + */ + private RubyClass getSpecialSingleton() { + RubyClass rubyClass = (RubyClass)getRubyClass(); + if (!rubyClass.isSingleton()) { + rubyClass = rubyClass.newSingletonClass(); + rubyClass.attachSingletonClass(this); + } + return rubyClass; + } + + /** rb_singleton_class + * + */ + public RubyClass getSingletonClass() { + // if (getType() == Type.FIXNUM || isSymbol()) { + // throw new RubyTypeException("can't define singleton"); + // } + + if (isSpecialConst()) { + if (isNil() || isTrue() || isFalse()) { + return getSpecialSingleton(); + } + throw new RubyBugException("unknown immediate " + toString()); + } + + //synchronize(this) { + RubyClass rbClass = null; + + if (getRubyClass().isSingleton()) { + rbClass = (RubyClass)getRubyClass(); + } else { + rbClass = ((RubyClass)getRubyClass()).newSingletonClass(); + setRubyClass(rbClass); + rbClass.attachSingletonClass(this); + } + + rbClass.setTaint(isTaint()); + + if (isFrozen()) { + rbClass.setFrozen(true); + } + //} + return rbClass; + } + + /** rb_define_singleton_method + * + */ + public void defineSingletonMethod(String name, RubyCallbackMethod method) { + getSingletonClass().defineMethod(name, method); + } + + + /** OBJSETUP + * + */ + protected void setupObject(RubyModule rubyClass) { + setRubyClass(rubyClass); + } + + /** CLONESETUP + * + */ + protected void setupClone(RubyObject obj) { + setupObject(obj.getRubyClass().getSingletonClassClone()); + + getRubyClass().attachSingletonClass(this); + } + + /** OBJ_INFECT + * + */ + protected void infectObject(RubyObject obj) { + if (obj.isTaint()) { + setTaint(true); + } + } + + /** rb_funcall2 + * + */ + public RubyObject funcall(RubyId mid, RubyObject[] args) { + return getRubyClass().call(this, mid, args, 1); + } + + public RubyObject funcall(RubyId mid) { + return funcall(mid, (RubyObject[])null); + } + + /** rb_funcall3 + * + */ + public RubyObject funcall3(RubyId mid, RubyObject[] args) { + return getRubyClass().call(this, mid, args, 0); + } + + /** rb_funcall + * + */ + public RubyObject funcall(RubyId mid, RubyObject arg) { + return funcall(mid, new RubyObject[] {arg}); + } + + /** rb_iv_get + * + */ + public RubyObject getIv(String name) { + return getIvar(getRuby().intern(name)); + } + + /** rb_iv_set + * + */ + public void setIv(String name, RubyObject value) { + setIvar(getRuby().intern(name), value); + } + + public RubyObject getIvar(RubyId id) { + return null; + } + + public boolean isIvarDefined(RubyId id) { + return false; + } + + public void setIvar(RubyId id, RubyObject value) { + //return null; + } + + public RubyModule getCvarSingleton() { + return null; + } + + /** rb_eval + * + * future version + */ + public RubyObject eval(NODE n) { + NODE node = n; + + while (true) { + if (node == null) { + return getRuby().getNil(); + } + + if (node instanceof ExpandNode) { + node = ((ExpandNode)node).expand(this); + } else if (node instanceof ResultNode) { + return ((ResultNode)node).interpret(this); + } + } + } + + // Methods of the Object class (rb_obj_*): + + /** rb_obj_equal + * + */ + public RubyBoolean m_equal(RubyObject obj) { + if (this == obj) { + return getRuby().getTrue(); + } + return getRuby().getFalse(); + } + + /** rb_obj_id + * + */ + public RubyObject m_id() { + //obj.hashCode(); + + return null; + } + + /** rb_obj_type + * + */ + public RubyModule m_type() { + RubyModule rbClass = getRubyClass(); + + while (rbClass.isSingleton() || rbClass.isIncluded()) { + rbClass = rbClass.getSuperClass(); + } + + return rbClass; + } + + /** rb_obj_clone + * + */ + public RubyObject m_clone() { + RubyObject clone = new RubyObject(getRuby(), (RubyClass)getRubyClass()); + clone.setupClone(this); + + clone.setInstanceVariables(getInstanceVariables().cloneRubyMap()); + + return clone; + } + + /** rb_obj_dup + * + */ + public RubyObject m_dup() { + RubyObject dup = funcall(getRuby().intern("clone")); + + if (!dup.getClass().equals(getClass())) { + throw new RubyTypeException("duplicated object must be same type"); + } + + if (!dup.isSpecialConst()) { + dup.setupObject(m_type()); + dup.infectObject(this); + } + + return dup; + } + + /** rb_obj_tainted + * + */ + public RubyBoolean m_tainted() { + if (isTaint()) { + return getRuby().getTrue(); + } else { + return getRuby().getFalse(); + } + } + + /** rb_obj_taint + * + */ + public RubyObject m_taint() { + getRuby().secure(4); + + if (!isTaint()) { + if (isFrozen()) { + throw new RubyFrozenException("object"); + } + setTaint(true); + } + + return this; + } + + /** rb_obj_untaint + * + */ + public RubyObject m_untaint() { + getRuby().secure(3); + + if (isTaint()) { + if (isFrozen()) { + throw new RubyFrozenException("object"); + } + setTaint(false); + } + + return this; + } + + /** rb_obj_freeze + * + */ + public RubyObject m_freeze() { + if (getRuby().getSecurityLevel() >= 4 && + isTaint()) { + throw new RubySecurityException("Insecure: can't freeze object"); + } + + // ?????????????? + + return this; + } + + /** rb_obj_frozen_p + * + */ + public RubyBoolean m_frozen() { + if (isFrozen()) { + return getRuby().getTrue(); + } else { + return getRuby().getFalse(); + } + } + + /** rb_obj_inspect + * + */ + public RubyString m_inspect() { + // if (TYPE(obj) == T_OBJECT + // && ROBJECT(obj)->iv_tbl + // && ROBJECT(obj)->iv_tbl->num_entries > 0) { + // VALUE str; + // char *c; + // + // c = rb_class2name(CLASS_OF(obj)); + // if (rb_inspecting_p(obj)) { + // str = rb_str_new(0, strlen(c)+10+16+1); /* 10:tags 16:addr 1:eos */ + // sprintf(RSTRING(str)->ptr, "#<%s:0x%lx ...>", c, obj); + // RSTRING(str)->len = strlen(RSTRING(str)->ptr); + // return str; + // } + // str = rb_str_new(0, strlen(c)+6+16+1); /* 6:tags 16:addr 1:eos */ + // sprintf(RSTRING(str)->ptr, "-<%s:0x%lx ", c, obj); + // RSTRING(str)->len = strlen(RSTRING(str)->ptr); + // return rb_protect_inspect(inspect_obj, obj, str); + // } + // return rb_funcall(obj, rb_intern("to_s"), 0, 0); + // } + //return (RubyString)invokeMethod(getRuby().intern("to_s"), null, null); + return null; + } + + /** rb_obj_is_instance_of + * + */ + public RubyBoolean m_instance_of(RubyModule rbModule) { + return RubyBoolean.m_newBoolean(getRuby(), m_type() == rbModule); + } + + /** rb_obj_is_kind_of + * + */ + public RubyBoolean m_kind_of(RubyModule rbModule) { + RubyModule rbClass = getRubyClass(); + + while (rbClass != null) { + if (rbClass == rbModule || rbClass.getMethods() == rbModule.getMethods()) { + return getRuby().getTrue(); + } + rbClass = rbClass.getSuperClass(); + } + + return getRuby().getFalse(); + } + + /** rb_obj_methods + * + */ + public RubyArray m_methods() { + // return getRubyClass().m_instance_methods(getRuby().getTrue()); + return null; + } + + /** rb_obj_protected_methods + * + */ + public RubyArray m_protected_methods() { + // return getRubyClass().m_protected_instance_methods(getRuby().getTrue()); + return null; + } + + /** rb_obj_private_methods + * + */ + public RubyArray m_private_methods() { + // return getRubyClass().m_private_instance_methods(getRuby().getTrue()); + + return null; + } + + /** rb_obj_singleton_methods + * + */ + public RubyArray m_singleton_methods() { + RubyArray ary = RubyArray.m_newArray(getRuby()); + RubyModule rbClass = getRubyClass(); + + while (rbClass != null && rbClass.isSingleton()) { + rbClass.getMethods().foreach(new RubyMapMethod() { + public int execute(Object key, Object value, Object arg) { + return CONTINUE; + } + }, ary); + rbClass = rbClass.getSuperClass(); + } + //ary.removeNil(); + return ary; + } + + + public RubyString m_to_s() { + String cname = getRubyClass().toName(); + + RubyString str = RubyString.m_newString(getRuby(), ""); /* 6:tags 16:addr 1:eos */ + str.setString("#<" + cname + ":0x" + this + "x>"); + if (isTaint()) { + str.setTaint(true); + } + + return str; + } +} \ No newline at end of file diff --git a/org/jruby/RubyRange.java b/org/jruby/RubyRange.java new file mode 100644 index 00000000000..11b61f37dae --- /dev/null +++ b/org/jruby/RubyRange.java @@ -0,0 +1,44 @@ +/* + * RubyRange.java - No description + * Created on 26. Juli 2001, 00:01 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + * @version + */ +public class RubyRange extends RubyObject { + + /** Creates new RubyRange */ + public RubyRange(Ruby ruby) { + super(ruby); + } + + public static RubyRange m_newRange(Ruby ruby, RubyObject start, RubyObject end, boolean exclude_last) { + return new RubyRange(ruby); + } +} \ No newline at end of file diff --git a/org/jruby/RubyRegex.java b/org/jruby/RubyRegex.java new file mode 100644 index 00000000000..c28020338fe --- /dev/null +++ b/org/jruby/RubyRegex.java @@ -0,0 +1,40 @@ +/* + * RubyRegex.java - No description + * Created on 26. Juli 2001, 00:01 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + * @version + */ +public class RubyRegex extends RubyObject { + + public RubyRegex(Ruby ruby, RubyString str, int options) { + super(ruby); + } + +} diff --git a/org/jruby/RubyString.java b/org/jruby/RubyString.java new file mode 100644 index 00000000000..83fe59c24dc --- /dev/null +++ b/org/jruby/RubyString.java @@ -0,0 +1,159 @@ +/* + * RubyString.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + */ +public class RubyString extends RubyObject { + private String string; + + public RubyString(Ruby ruby) { + this(ruby, null); + } + + public RubyString(Ruby ruby, String string) { + super(ruby, ruby.getStringClass()); + this.string = string; + } + + public String getString() { + return this.string; + } + + public void setString(String string) { + this.string = string; + } + + public String toString() { + return "\"" + getString() + "\""; + } + + /** + * + */ + public RubyObject slice(int beg, int len) { + // ... + + return m_newString(getRuby(), getString().substring(beg, beg + len)); + } + + // Methods of the String class (rb_str_*): + + /** rb_str_new2 + * + */ + public static RubyString m_newString(Ruby ruby, String str) { + return new RubyString(ruby, str); + } + + /** rb_str_new + * + */ + public static RubyString m_newString(Ruby ruby, String str, int len) { + return new RubyString(ruby, str.substring(0, len)); + } + + /** rb_str_dup + * + */ + public RubyObject m_dup() { + // HACK +++ + return m_newString(getRuby(), getString()); + // HACK --- + } + + /** rb_str_cat + * + */ + public RubyString m_cat(String value) { + string = string + value; + return this; + } + + /** rb_str_to_s + * + */ + public RubyString m_to_s() { + return this; + } + + /** rb_str_replace_m + * + */ + public RubyString m_replace(RubyString other) { + if (this == other || getString() == other.getString()) { + return this; + } + + setString(other.getString()); + + // The other stuff isn't needed? + + return this; + } + + /** rb_str_reverse + * + */ + public RubyString m_reverse() { + StringBuffer sb = new StringBuffer(getString().length()); + for (int i = getString().length() - 1; i >= 0; i--) { + sb.append(getString().charAt(i)); + } + + return m_newString(getRuby(), sb.toString()); + } + + /** + * + */ + public RubyObject m_slice(RubyObject args[]) { + if (args.length > 1) { + RubyFixnum beg = (RubyFixnum)args[0]; + RubyFixnum len = (RubyFixnum)args[1]; + + return slice((int)beg.getValue(), (int)len.getValue()); + } else { + // ... + } + + return getRuby().getNil(); + } + + /** rb_str_s_new + * + */ + public static RubyString sm_new(Ruby ruby, RubyObject[] args) { + RubyString newString = m_newString(ruby, ""); + + ruby.getInterpreter().callInit(newString, args); + + return newString; + } +} \ No newline at end of file diff --git a/org/jruby/RubySymbol.java b/org/jruby/RubySymbol.java new file mode 100644 index 00000000000..a2c5190ff45 --- /dev/null +++ b/org/jruby/RubySymbol.java @@ -0,0 +1,45 @@ +/* + * RubySymbol.java - No description + * Created on 26. Juli 2001, 00:01 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby; + +/** + * + * @author jpetersen + */ +public class RubySymbol extends RubyObject { + public RubySymbol(Ruby ruby) { + super(ruby, ruby.getSymbolClass()); + } + + public RubyId toId() { + return null; + } + + public String getName() { + return null; + } +} \ No newline at end of file diff --git a/org/jruby/exceptions/.nbattrs b/org/jruby/exceptions/.nbattrs new file mode 100644 index 00000000000..82545d7fe52 --- /dev/null +++ b/org/jruby/exceptions/.nbattrs @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org/jruby/exceptions/RubyArgumentException.java b/org/jruby/exceptions/RubyArgumentException.java new file mode 100644 index 00000000000..26733747cfd --- /dev/null +++ b/org/jruby/exceptions/RubyArgumentException.java @@ -0,0 +1,46 @@ +/* + * RubyArgumentException.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.exceptions; + +/** + * + * @author jpetersen + */ +public class RubyArgumentException extends java.lang.RuntimeException { + + public RubyArgumentException() { + } + + + /** + * Constructs an RubyTypeException with the specified detail message. + * @param msg the detail message. + */ + public RubyArgumentException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/org/jruby/exceptions/RubyBugException.java b/org/jruby/exceptions/RubyBugException.java new file mode 100644 index 00000000000..4a7a9fe3f27 --- /dev/null +++ b/org/jruby/exceptions/RubyBugException.java @@ -0,0 +1,46 @@ +/* + * RubyBugException.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.exceptions; + +/** + * + * @author jpetersen + */ +public class RubyBugException extends java.lang.RuntimeException { + + public RubyBugException() { + } + + + /** + * Constructs an RubyTypeException with the specified detail message. + * @param msg the detail message. + */ + public RubyBugException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/org/jruby/exceptions/RubyFrozenException.java b/org/jruby/exceptions/RubyFrozenException.java new file mode 100644 index 00000000000..c9af01d797c --- /dev/null +++ b/org/jruby/exceptions/RubyFrozenException.java @@ -0,0 +1,46 @@ +/* + * RubyFrozenException.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.exceptions; + +/** + * + * @author jpetersen + */ +public class RubyFrozenException extends java.lang.RuntimeException { + + public RubyFrozenException() { + } + + + /** + * Constructs an RubyTypeException with the specified detail message. + * @param msg the detail message. + */ + public RubyFrozenException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/org/jruby/exceptions/RubyIndexException.java b/org/jruby/exceptions/RubyIndexException.java new file mode 100644 index 00000000000..a8a50bb076e --- /dev/null +++ b/org/jruby/exceptions/RubyIndexException.java @@ -0,0 +1,52 @@ +/* + * RubyIndexException.java - No description + * Created on 10. September 2001, 17:55 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.exceptions; + +/** + * + * @author jpetersen + * @version + */ +public class RubyIndexException extends java.lang.RuntimeException { + + /** + * Creates new RubyIndexException without detail message. + */ + public RubyIndexException() { + } + + + /** + * Constructs an RubyIndexException with the specified detail message. + * @param msg the detail message. + */ + public RubyIndexException(String msg) { + super(msg); + } +} + + diff --git a/org/jruby/exceptions/RubyNameException.java b/org/jruby/exceptions/RubyNameException.java new file mode 100644 index 00000000000..c35d3429c54 --- /dev/null +++ b/org/jruby/exceptions/RubyNameException.java @@ -0,0 +1,46 @@ +/* + * RubyNameException.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.exceptions; + +/** + * + * @author jpetersen + */ +public class RubyNameException extends java.lang.RuntimeException { + + public RubyNameException() { + } + + + /** + * Constructs an RubyTypeException with the specified detail message. + * @param msg the detail message. + */ + public RubyNameException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/org/jruby/exceptions/RubySecurityException.java b/org/jruby/exceptions/RubySecurityException.java new file mode 100644 index 00000000000..840b48e857a --- /dev/null +++ b/org/jruby/exceptions/RubySecurityException.java @@ -0,0 +1,46 @@ +/* + * RubySecurityException.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.exceptions; + +/** + * + * @author jpetersen + */ +public class RubySecurityException extends java.lang.RuntimeException { + + public RubySecurityException() { + } + + + /** + * Constructs an RubyTypeException with the specified detail message. + * @param msg the detail message. + */ + public RubySecurityException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/org/jruby/exceptions/RubyTypeException.java b/org/jruby/exceptions/RubyTypeException.java new file mode 100644 index 00000000000..8ed9d614de4 --- /dev/null +++ b/org/jruby/exceptions/RubyTypeException.java @@ -0,0 +1,51 @@ +/* + * RubyTypeException.java - No description + * Created on 04. Juli 2001, 22:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.exceptions; + +/** + * + * @author jpetersen + */ +public class RubyTypeException extends java.lang.RuntimeException { + + /** + * Creates new RubyTypeException without detail message. + */ + public RubyTypeException() { + } + + + /** + * Constructs an RubyTypeException with the specified detail message. + * @param msg the detail message. + */ + public RubyTypeException(String msg) { + super(msg); + } +} + + diff --git a/org/jruby/interpreter/.nbattrs b/org/jruby/interpreter/.nbattrs new file mode 100644 index 00000000000..672cba6cd61 --- /dev/null +++ b/org/jruby/interpreter/.nbattrs @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org/jruby/interpreter/BreakException.java b/org/jruby/interpreter/BreakException.java new file mode 100644 index 00000000000..eaf9f82a994 --- /dev/null +++ b/org/jruby/interpreter/BreakException.java @@ -0,0 +1,40 @@ +/* + * BreakException.java - No description + * Created on 10. September 2001, 17:54 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter; + +/** + * + * @author jpetersen + * @version + */ +public class BreakException extends RuntimeException { + + /** Creates new LoopRedoException */ + public BreakException() { + } + +} diff --git a/org/jruby/interpreter/Frame.java b/org/jruby/interpreter/Frame.java new file mode 100644 index 00000000000..9b093f45636 --- /dev/null +++ b/org/jruby/interpreter/Frame.java @@ -0,0 +1,280 @@ +/* + * Frame.java - No description + * Created on 10. September 2001, 17:54 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter; + +import org.jruby.*; +import org.jruby.original.*; + +/** + * + * @author jpetersen + * @version + */ +public class Frame { + public static final int FRAME_ALLOCA = 0; + public static final int FRAME_MALLOC = 1; + + private RubyObject self = null; + private RubyObject[] args = null; + private RubyId lastFunc = null; + private RubyModule lastClass = null; + private VALUE cbase = null; + private Frame prev = null; + private Frame tmp = null; + private String file = null; + private int line = 0; + private int iter = 0; + private int flags = 0; + + public Frame() { + } + + public Frame(RubyObject self, RubyObject[] args, RubyId lastFunc, RubyModule lastClass, + VALUE cbase, Frame prev, Frame tmp, String file, int line, int iter, int flags) { + this(); + + this.self = self; + this.args = args; + this.lastFunc = lastFunc; + this.lastClass = lastClass; + this.cbase = cbase; + this.prev = prev; + this.tmp = tmp; + this.file = file; + this.line = line; + this.iter = iter; + this.flags = flags; + } + + /** Indexed getter for property args. + * @param index Index of the property. + * @return Value of the property at index. + */ + public RubyObject getArgs(int index) { + return args[index]; + } + + /** Getter for property args. + * @return Value of property args. + */ + public RubyObject[] getArgs() { + return args; + } + + /** Indexed setter for property args. + * @param index Index of the property. + * @param args New value of the property at index. + */ + public void setArgs(int index, RubyObject args) { + this.args[index] = args; + } + + /** Setter for property args. + * @param args New value of property args. + */ + public void setArgs(RubyObject[] args) { + this.args = args; + } + + /** Getter for property cbase. + * @return Value of property cbase. + */ + public VALUE getCbase() { + return cbase; + } + + /** Setter for property cbase. + * @param cbase New value of property cbase. + */ + public void setCbase(VALUE cbase) { + this.cbase = cbase; + } + + /** Getter for property file. + * @return Value of property file. + */ + public java.lang.String getFile() { + return file; + } + + /** Setter for property file. + * @param file New value of property file. + */ + public void setFile(java.lang.String file) { + this.file = file; + } + + /** Getter for property flags. + * @return Value of property flags. + */ + public int getFlags() { + return flags; + } + + /** Setter for property flags. + * @param flags New value of property flags. + */ + public void setFlags(int flags) { + this.flags = flags; + } + + /** Getter for property iter. + * @return Value of property iter. + */ + public int getIter() { + return iter; + } + + /** Setter for property iter. + * @param iter New value of property iter. + */ + public void setIter(int iter) { + this.iter = iter; + } + + /** Getter for property lastClass. + * @return Value of property lastClass. + */ + public RubyModule getLastClass() { + return lastClass; + } + + /** Setter for property lastClass. + * @param lastClass New value of property lastClass. + */ + public void setLastClass(RubyModule lastClass) { + this.lastClass = lastClass; + } + + /** Getter for property lastFunc. + * @return Value of property lastFunc. + */ + public RubyId getLastFunc() { + return lastFunc; + } + + /** Setter for property lastFunc. + * @param lastFunc New value of property lastFunc. + */ + public void setLastFunc(RubyId lastFunc) { + this.lastFunc = lastFunc; + } + + /** Getter for property line. + * @return Value of property line. + */ + public int getLine() { + return line; + } + + /** Setter for property line. + * @param line New value of property line. + */ + public void setLine(int line) { + this.line = line; + } + + /** Getter for property prev. + * @return Value of property prev. + */ + public org.jruby.interpreter.Frame getPrev() { + return prev; + } + + /** Setter for property prev. + * @param prev New value of property prev. + */ + public void setPrev(org.jruby.interpreter.Frame prev) { + this.prev = prev; + } + + /** Getter for property self. + * @return Value of property self. + */ + public RubyObject getSelf() { + return self; + } + + /** Setter for property self. + * @param self New value of property self. + */ + public void setSelf(RubyObject self) { + this.self = self; + } + + /** Getter for property tmp. + * @return Value of property tmp. + */ + public org.jruby.interpreter.Frame getTmp() { + return tmp; + } + + /** Setter for property tmp. + * @param tmp New value of property tmp. + */ + public void setTmp(org.jruby.interpreter.Frame tmp) { + this.tmp = tmp; + } + + /** Push a new empty frame to the frame stack. + * + */ + public void push() { + Frame oldFrame = new Frame(self, args, lastFunc, lastClass, cbase, prev, + tmp, file, line, iter, flags); + + prev = oldFrame; + tmp = null; + // file = null + // line = + // iter = + // cbase = cbase; + args = null; + flags = FRAME_ALLOCA; + } + + /** Pop the frame. + * + */ + public void pop() { + self = prev.self; + args = prev.args; + lastFunc = prev.lastFunc; + lastClass = prev.lastClass; + cbase = prev.cbase; + tmp = prev.tmp; + file = prev.file; + line = prev.line; + iter = prev.iter; + flags = prev.flags; + + prev = prev.prev; + + // ruby_file = file; + // ruby_line = line; + } +} \ No newline at end of file diff --git a/org/jruby/interpreter/NextException.java b/org/jruby/interpreter/NextException.java new file mode 100644 index 00000000000..165c91638d4 --- /dev/null +++ b/org/jruby/interpreter/NextException.java @@ -0,0 +1,40 @@ +/* + * NextException.java - No description + * Created on 10. September 2001, 17:54 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter; + +/** + * + * @author jpetersen + * @version + */ +public class NextException extends RuntimeException { + + /** Creates new LoopRedoException */ + public NextException() { + } + +} diff --git a/org/jruby/interpreter/RedoException.java b/org/jruby/interpreter/RedoException.java new file mode 100644 index 00000000000..1a03473caa8 --- /dev/null +++ b/org/jruby/interpreter/RedoException.java @@ -0,0 +1,40 @@ +/* + * RedoException.java - No description + * Created on 10. September 2001, 17:54 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter; + +/** + * + * @author jpetersen + * @version + */ +public class RedoException extends RuntimeException { + + /** Creates new LoopRedoException */ + public RedoException() { + } + +} diff --git a/org/jruby/interpreter/RetryException.java b/org/jruby/interpreter/RetryException.java new file mode 100644 index 00000000000..b477a9e9b62 --- /dev/null +++ b/org/jruby/interpreter/RetryException.java @@ -0,0 +1,40 @@ +/* + * RetryException.java - No description + * Created on 10. September 2001, 17:54 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter; + +/** + * + * @author jpetersen + * @version + */ +public class RetryException extends RuntimeException { + + /** Creates new LoopRedoException */ + public RetryException() { + } + +} diff --git a/org/jruby/interpreter/RubyInterpreter.java b/org/jruby/interpreter/RubyInterpreter.java new file mode 100644 index 00000000000..6b6c61e7f6b --- /dev/null +++ b/org/jruby/interpreter/RubyInterpreter.java @@ -0,0 +1,1688 @@ +/* + * RubyInterpreter.java - No description + * Created on 23. Juli 2001, 19:27 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter; + +import java.util.*; + +import org.jruby.*; +import org.jruby.exceptions.*; +import org.jruby.original.*; + +/** + * + * @author jpetersen + * @version + */ +public class RubyInterpreter implements node_type, Scope { + private Ruby ruby; + + private Frame rubyFrame; + private Frame topFrame; + + public RubyVarmap ruby_dyna_vars = new RubyVarmap(); + + // C + + private RubyModule ruby_class; + private RubyModule ruby_cbase; + private RubyModule ruby_wrapper; + + private int scope_vmode; + + public RubyInterpreter(Ruby ruby) { + this.ruby = ruby; + + ruby_class = ruby.getObjectClass(); + ruby_cbase = null; + } + + public Frame getRubyFrame() { + if (rubyFrame == null) { + rubyFrame = new Frame(); + } + return rubyFrame; + } + + /** Getter for property ruby. + * @return Value of property ruby. + */ + public org.jruby.Ruby getRuby() { + return ruby; + } + + /** Setter for property ruby. + * @param ruby New value of property ruby. + */ + public void setRuby(org.jruby.Ruby ruby) { + this.ruby = ruby; + } + + private boolean initialized = false; + + /** ruby_init + * + */ + public void init() { + // FRAME frame = new FRAME(); + iter iter = new iter(); + int state; + + if (initialized) { + return; + } + initialized = true; + + topFrame = getRubyFrame(); + ruby_iter = iter; + + // rb_origenviron = environ; + + // Init_stack(0); + // Init_heap(); + + // PUSH_SCOPE(); + getRuby().rubyScope.setLocalVars(null); + getRuby().rubyScope.setLocalVars(null); + // top_scope = getRuby().ruby_scope; + + /* default visibility is private at toplevel */ + // SET_SCOPE(SCOPE_PRIVATE); + + // PUSH_TAG( PROT_NONE ); + // if ((state = EXEC_TAG()) == 0) { + // rb_call_inits(); + ruby_class = getRuby().getObjectClass(); + // ruby_frame.self = ruby_top_self; + // top_cref = new NODE(NODE_CREF, getRuby().getObjectClass(), null, null); + // ruby_cref = top_cref; + rubyFrame.setCbase((VALUE)ruby_cref); + // rb_define_global_const( "TOPLEVEL_BINDING", rb_f_binding( ruby_top_self ) ); + // ruby_prog_init(); + // } + // POP_TAG(); + // if (state != 0) { + // error_print(); + // } + // POP_SCOPE(); + // ruby_scope = top_scope; + } + + + /** rb_eval + * + */ + public RubyObject eval(RubyObject self, NODE n) { + NODE node = n; + + RubyBoolean cond = null; + RubyObject[] args = null; + RubyObject result = null; + // int state; + + // RubyOriginalMethods rom = getRuby().getOriginalMethods(); + + while (true) { + + if (node == null) { + return getRuby().getNil(); + } + + switch (node.nd_type()) { + case NODE_BLOCK: + while (node.nd_next() != null) { + eval(self, node.nd_head()); + node = node.nd_next(); + } + node = node.nd_head(); + break; + + case NODE_POSTEXE: + // rb_f_END(); + node.nd_set_type(NODE_NIL); /* exec just once */ + return getRuby().getNil(); + + /* begin .. end without clauses */ + case NODE_BEGIN: + node = node.nd_body(); + break; + + /* nodes for speed-up(default match) */ + case NODE_MATCH: + //return rom.rb_reg_match2(node.nd_head().nd_lit()); + return getRuby().getNil(); + + /* nodes for speed-up(literal match) */ + case NODE_MATCH2: + //return rom.rb_reg_match(eval(node.nd_recv()), eval(node.nd_value())); + return getRuby().getNil(); + + /* nodes for speed-up(literal match) */ + case NODE_MATCH3: + //VALUE r = eval(node.nd_recv()); + //VALUE l = eval(node.nd_value()); + //if (r instanceof RubyString) { + // return rom.rb_reg_match(l, r); + //} else { + // return rom.rb_funcall(r, match, 1, l); + //} + return getRuby().getNil(); + + /* node for speed-up(top-level loop for -n/-p) */ + case NODE_OPT_N: +/* PUSH_TAG(PROT_NONE); + switch (state = EXEC_TAG()) { + case 0: + opt_n_next: + while (!NIL_P(rb_gets())) { + opt_n_redo: + rb_eval(self, node->nd_body); + } + break; + + case TAG_REDO: + state = 0; + goto opt_n_redo; + case TAG_NEXT: + state = 0; + goto opt_n_next; + case TAG_BREAK: + state = 0; + default: + break; + } + POP_TAG(); + if (state) JUMP_TAG(state); + RETURN(Qnil);*/ + + return getRuby().getNil(); + + case NODE_SELF: + return self; + + case NODE_NIL: + return getRuby().getNil(); + + case NODE_TRUE: + return getRuby().getTrue(); + + case NODE_FALSE: + return getRuby().getFalse(); + + case NODE_IF: + // ruby_sourceline = node.nd_line(); + cond = (RubyBoolean)eval(self, node.nd_cond()); + if (cond.isTrue()) { + node = node.nd_body(); + } else { + node = node.nd_else(); + } + break; + + case NODE_WHEN: + while (node != null) { + NODE tag; + + if (node.nd_type() != NODE_WHEN) { + break; + } + + tag = node.nd_head(); + while (tag != null) { +/* if (trace_func) { + call_trace_func("line", tag->nd_file, nd_line(tag), self, + ruby_frame->last_func, + ruby_frame->last_class); + }*/ + // ruby_sourcefile = tag.nd_file; + // ruby_sourceline = tag.nd_line(); + + if (tag.nd_head().nd_type() == NODE_WHEN) { + RubyObject obj = eval(self, tag.nd_head().nd_head()); + + if (!(obj instanceof RubyArray)) { + obj = RubyArray.m_newArray(getRuby(), obj); + } + + for (int i = 0; i < ((RubyArray)obj).length(); i++) { + if (((RubyBoolean)((RubyArray)obj).entry(i)).isTrue()) { + node = node.nd_body(); + break; + } + } + tag = tag.nd_next(); + continue; + } + if (((RubyBoolean)eval(self, tag.nd_head())).isTrue()) { + node = node.nd_body(); + break; + } + tag = tag.nd_next(); + } + node = node.nd_next(); + } + return getRuby().getNil(); + + case NODE_CASE: + + RubyObject obj = eval(self, node.nd_head()); + node = node.nd_body(); + while (node != null) { + NODE tag; + + if (node.nd_type() != NODE_WHEN) { + break; + } + tag = node.nd_head(); + while (tag != null) { +/* if (trace_func) { + call_trace_func("line", tag->nd_file, nd_line(tag), self, + ruby_frame->last_func, + ruby_frame->last_class); + } + ruby_sourcefile = tag->nd_file; + ruby_sourceline = nd_line(tag);*/ + + if (tag.nd_head().nd_type() == NODE_WHEN) { + RubyObject obj2 = eval(self, tag.nd_head().nd_head()); + + if (!(obj2 instanceof RubyArray)) { + obj2 = RubyArray.m_newArray(getRuby(), obj2); + } + for (int i = 0; i < ((RubyArray)obj).length(); i++) { + RubyBoolean eqq = (RubyBoolean)((RubyArray)obj2).entry(i).funcall(getRuby().intern("==="), obj); + if (eqq.isTrue()) { + node = node.nd_body(); + break; + } + } + tag = tag.nd_next(); + continue; + } + if (((RubyBoolean)eval(self, tag.nd_head()).funcall(getRuby().intern("==="), obj)).isTrue()) { + node = node.nd_body(); + break; + } + tag = tag.nd_next(); + } + node = node.nd_next(); + } + return getRuby().getNil(); + + case NODE_WHILE: + while (eval(self, node.nd_cond()).isTrue()) { + while (true) { + try { + eval(self, node.nd_body()); + break; + } catch (RedoException rExcptn) { + } catch (NextException nExcptn) { + break; + } catch (BreakException bExcptn) { + return getRuby().getNil(); + } + } + } + + return getRuby().getNil(); + + case NODE_UNTIL: + while (eval(self, node.nd_cond()).isFalse()) { + while (true) { + try { + eval(self, node.nd_body()); + break; + } catch (RedoException rExcptn) { + } catch (NextException nExcptn) { + break; + } catch (BreakException bExcptn) { + return getRuby().getNil(); + } + } + } + + return getRuby().getNil(); + + case NODE_BLOCK_PASS: + //return block_pass(node); + return null; + + case NODE_ITER: + case NODE_FOR: +/* { + iter_retry: + PUSH_TAG(PROT_FUNC); + PUSH_BLOCK(node->nd_var, node->nd_body); + + state = EXEC_TAG(); + if (state == 0) { + PUSH_ITER(ITER_PRE); + if (nd_type(node) == NODE_ITER) { + result = rb_eval(self, node->nd_iter); + } + else { + VALUE recv; + char *file = ruby_sourcefile; + int line = ruby_sourceline; + + _block.flags &= ~BLOCK_D_SCOPE; + BEGIN_CALLARGS; + recv = rb_eval(self, node->nd_iter); + END_CALLARGS; + ruby_sourcefile = file; + ruby_sourceline = line; + result = rb_call(CLASS_OF(recv),recv,each,0,0,0); + } + POP_ITER(); + } + else if (_block.tag->dst == state) { + state &= TAG_MASK; + if (state == TAG_RETURN) { + result = prot_tag->retval; + } + } + POP_BLOCK(); + POP_TAG(); + switch (state) { + case 0: + break; + + case TAG_RETRY: + goto iter_retry; + + case TAG_BREAK: + result = Qnil; + break; + case TAG_RETURN: + return_value(result); + */ /* fall through */ +/* default: + JUMP_TAG(state); + } + }*/ + break; + + case NODE_BREAK: + throw new BreakException(); + + case NODE_NEXT: + throw new NextException(); + + case NODE_REDO: + throw new RedoException(); + + case NODE_RETRY: + throw new RetryException(); + + case NODE_RESTARGS: + result = eval(self, node.nd_head()); + if (!(result instanceof RubyArray)) { + result = obj = RubyArray.m_newArray(getRuby(), result); + } + return result; + + case NODE_YIELD: +/* if (node.nd_stts) { + result = rb_eval(self, node->nd_stts); + if (nd_type(node->nd_stts) == NODE_RESTARGS && + RARRAY(result)->len == 1) + { + result = RARRAY(result)->ptr[0]; + } + } + else { + result = Qnil; + } + result = rb_yield_0(result, 0, 0, 0); + break;*/ + + case NODE_RESCUE: +/* retry_entry: + { + volatile VALUE e_info = ruby_errinfo; + + PUSH_TAG(PROT_NONE); + if ((state = EXEC_TAG()) == 0) { + result = rb_eval(self, node->nd_head); + } + POP_TAG(); + if (state == TAG_RAISE) { + NODE * volatile resq = node->nd_resq; + + ruby_sourceline = nd_line(node); + while (resq) { + if (handle_rescue(self, resq)) { + state = 0; + PUSH_TAG(PROT_NONE); + if ((state = EXEC_TAG()) == 0) { + result = rb_eval(self, resq->nd_body); + } + POP_TAG(); + if (state == TAG_RETRY) { + state = 0; + ruby_errinfo = Qnil; + goto retry_entry; + } + if (state != TAG_RAISE) { + ruby_errinfo = e_info; + } + break; + } + resq = resq->nd_head; /* next rescue */ + /** } + * } + * else if (node->nd_else) { /* else clause given */ +/* if (!state) { /* no exception raised */ +/* result = rb_eval(self, node->nd_else); + } + } + if (state) JUMP_TAG(state); + } + break;*/ + + case NODE_ENSURE: +/* PUSH_TAG(PROT_NONE); + if ((state = EXEC_TAG()) == 0) { + result = eval(node.nd_head()); + } + POP_TAG(); + if (node.nd_ensr()) { + VALUE retval = prot_tag->retval; /* save retval */ +/* VALUE errinfo = ruby_errinfo; + + rb_eval(self, node->nd_ensr); + return_value(retval); + ruby_errinfo = errinfo; + } + if (state) JUMP_TAG(state); + break;*/ + + case NODE_AND: + cond = (RubyBoolean)eval(self, node.nd_1st()); + if (cond.isFalse()) { + return cond; + } + node = node.nd_2nd(); + break; + + case NODE_OR: + cond = (RubyBoolean)eval(self, node.nd_1st()); + if (cond.isTrue()) { + return cond; + } + node = node.nd_2nd(); + break; + + case NODE_NOT: + return RubyBoolean.m_newBoolean(getRuby(), eval(self, node.nd_1st()).isFalse()); + + case NODE_DOT2: + case NODE_DOT3: + result = RubyRange.m_newRange(getRuby(), eval(self, node.nd_beg()), + eval(self, node.nd_end()), + node.nd_type() == NODE_DOT3); + if (node.nd_state() != 0) { + return result; + } + + if (node.nd_beg().nd_type() == NODE_LIT && (node.nd_beg().nd_lit() instanceof RubyFixnum) && + node.nd_end().nd_type() == NODE_LIT && (node.nd_end().nd_lit() instanceof RubyFixnum)) { + + node.nd_set_type(NODE_LIT); + node.nd_lit(result); + } else { + node.nd_state(1L); + } + return result; + + case NODE_FLIP2: /* like AWK */ + //RubyBoolean result; +/* if (ruby_scope->local_vars == 0) { + rb_bug("unexpected local variable"); + } + if (!RTEST(ruby_scope->local_vars[node->nd_cnt])) { + if (RTEST(rb_eval(self, node->nd_beg))) { + ruby_scope->local_vars[node->nd_cnt] = + RTEST(rb_eval(self, node->nd_end))?Qfalse:Qtrue; + result = Qtrue; + } else { + result = Qfalse; + } + } else { + if (RTEST(rb_eval(self, node->nd_end))) { + ruby_scope->local_vars[node->nd_cnt] = Qfalse; + } + result = Qtrue; + }*/ + return result; + + case NODE_FLIP3: /* like SED */ + //RubyBoolean result; +/* if (ruby_scope->local_vars == 0) { + rb_bug("unexpected local variable"); + } + if (!RTEST(ruby_scope->local_vars[node->nd_cnt])) { + result = RTEST(rb_eval(self, node->nd_beg)) ? Qtrue : Qfalse; + ruby_scope->local_vars[node->nd_cnt] = result; + } else { + if (RTEST(rb_eval(self, node->nd_end))) { + ruby_scope->local_vars[node->nd_cnt] = Qfalse; + } + result = Qtrue; + }*/ + return result; + + case NODE_RETURN: + // if (node.s) +/* if (node->nd_stts) { + return_value(rb_eval(self, node->nd_stts)); + } else { + return_value(Qnil); + } + return_check(); + JUMP_TAG(TAG_RETURN); + break; + */ + case NODE_ARGSCAT: + return ((RubyArray)eval(self, node.nd_head())).m_concat(eval(self, node.nd_body())); + + case NODE_ARGSPUSH: + return ((RubyArray)eval(self, node.nd_head()).m_dup()).push(eval(self, node.nd_body())); + + case NODE_CALL: + // TMP_PROTECT; + + BLOCK tmpBlock = BEGIN_CALLARGS(); + + RubyObject recv = eval(self, node.nd_recv()); + args = setupArgs(self, node.nd_args()); + + END_CALLARGS(tmpBlock); + + return recv.getRubyClass().call(recv, (RubyId)node.nd_mid(), args, 0); + + case NODE_FCALL: + // TMP_PROTECT; + + tmpBlock = BEGIN_CALLARGS(); + + args = setupArgs(self, node.nd_args()); + + END_CALLARGS(tmpBlock); + + return self.getRubyClass().call(self, (RubyId)node.nd_mid(), args, 1); + + case NODE_VCALL: + return self.getRubyClass().call(self, (RubyId)node.nd_mid(), null, 2); + + case NODE_SUPER: + case NODE_ZSUPER: + // TMP_PROTECT; + + if (rubyFrame.getLastClass() == null) { + throw new RubyNameException("superclass method '" + rubyFrame.getLastFunc().toName() + "' disabled"); + } + if (node.nd_type() == NODE_ZSUPER) { + args = rubyFrame.getArgs(); + } else { + tmpBlock = BEGIN_CALLARGS(); + args = setupArgs(self, node.nd_args()); + END_CALLARGS(tmpBlock); + } + + PUSH_ITER(ruby_iter.iter != 0 ? ITER_PRE : ITER_NOT); + result = rubyFrame.getLastClass().getSuperClass().call(rubyFrame.getSelf(), rubyFrame.getLastFunc(), args, 3); + POP_ITER(); + return result; + + case NODE_SCOPE: + /*NODE saved_cref = null; + + FRAME frame = ruby_frame; + frame.tmp = ruby_frame; + ruby_frame = frame; + + PUSH_SCOPE(); + PUSH_TAG(PROT_NONE); + if (node->nd_rval) { + saved_cref = ruby_cref; + ruby_cref = (NODE*)node->nd_rval; + ruby_frame->cbase = node->nd_rval; + }*/ + + if (node.nd_tbl() != null) { + RubyObject[] vars = new RubyObject[node.nd_tbl()[0].intValue() + 1]; + // *vars++ = (VALUE)node; + getRuby().rubyScope.setLocalVars(vars); + // rb_mem_clear(ruby_scope->local_vars, node->nd_tbl[0]); + getRuby().rubyScope.setLocalTbl(node.nd_tbl()); + } else { + getRuby().rubyScope.setLocalVars(null); + getRuby().rubyScope.setLocalTbl(null); + } +/* if ((state = EXEC_TAG()) == 0) { + result = rb_eval(self, node->nd_next); + } + POP_TAG(); + POP_SCOPE(); + ruby_frame = frame.tmp; + if (saved_cref) + ruby_cref = saved_cref; + if (state) JUMP_TAG(state); + } + break; + */ + case NODE_OP_ASGN1: + // TMP_PROTECT; + + recv = eval(self, node.nd_recv()); + NODE rval = node.nd_args().nd_head(); + + args = setupArgs(self, node.nd_args().nd_next()); + + ArrayList argsList = new ArrayList(Arrays.asList(args)); + argsList.remove(args.length - 1); + RubyBoolean val = (RubyBoolean)recv.funcall(getRuby().intern("[]"), (RubyObject[])argsList.toArray(new RubyObject[argsList.size()])); + + switch (node.nd_mid().intValue()) { + case 0: /* OR */ + if (val.isTrue()) { + return val; + } + val = (RubyBoolean)eval(self, rval); + break; + case 1: /* AND */ + if (val.isFalse()) { + return val; + } + val = (RubyBoolean)eval(self, rval); + break; + default: + val = (RubyBoolean)val.funcall((RubyId)node.nd_mid(), eval(self, rval)); + } + args[args.length - 1] = val; + return recv.funcall(getRuby().intern("[]="), args); + + case NODE_OP_ASGN2: + ID id = node.nd_next().nd_vid(); + + recv = eval(self, node.nd_recv()); + val = (RubyBoolean)recv.funcall((RubyId)id, (RubyObject[])null); + + switch (node.nd_next().nd_mid().intValue()) { + case 0: /* OR */ + if (val.isTrue()) { + return val; + } + val = (RubyBoolean)eval(self, node.nd_value()); + break; + case 1: /* AND */ + if (val.isFalse()) { + return val; + } + val = (RubyBoolean)eval(self, node.nd_value()); + break; + default: + val = (RubyBoolean)val.funcall((RubyId)node.nd_mid(), eval(self, node.nd_value())); + } + + // rom.rb_funcall2(recv, node.nd_next().nd_aid(), 1, &val); + return val; + + case NODE_OP_ASGN_AND: + cond = (RubyBoolean)eval(self, node.nd_head()); + + if (cond.isFalse()) { + return cond; + } + node = node.nd_value(); + + break; + + case NODE_OP_ASGN_OR: + cond = (RubyBoolean)eval(self, node.nd_head()); + + if ((node.nd_aid() != null && !self.isIvarDefined((RubyId)node.nd_aid())) || cond.isFalse()) { + node = node.nd_value(); + break; + } + return cond; + + case NODE_MASGN: + return massign(self, node, eval(self, node.nd_value()), false); + + case NODE_LASGN: + // if (ruby.ruby_scope.local_vars == null) { + // rb_bug("unexpected local variable assignment"); + // } + result = eval(self, node.nd_value()); + getRuby().rubyScope.setLocalVars(node.nd_cnt(), result); + return result; + + case NODE_DASGN: + result = eval(self, node.nd_value()); + /// dvar_asgn(node.nd_vid(), result); + return result; + + case NODE_DASGN_CURR: + result = eval(self, node.nd_value()); + // dvar_asgn_curr(node.nd_vid(), result); + return result; + + case NODE_GASGN: + // result = eval(self, node.nd_value()); + // rom.rb_gvar_set(node.nd_entry(), result); + // return result; + return null; + + case NODE_IASGN: + result = eval(self, node.nd_value()); + self.setIvar((RubyId)node.nd_vid(), result); + return result; + + case NODE_CDECL: + if (ruby_class == null) { + throw new RubyTypeException("no class/module to define constant"); + } + result = eval(self, node.nd_value()); + ruby_class.setConstant((RubyId)node.nd_vid(), result); + return result; + + case NODE_CVDECL: + if (ruby_cbase == null) { + throw new RubyTypeException("no class/module to define class variable"); + } + result = eval(self, node.nd_value()); + if (ruby_cbase.isSingleton()) { + ruby_cbase.getIv("__attached__").getCvarSingleton().declareCvar((RubyId)node.nd_vid(), result); + return result; + } + ruby_cbase.declareCvar((RubyId)node.nd_vid(), result); + return result; + + case NODE_CVASGN: + result = eval(self, node.nd_value()); + self.getCvarSingleton().setCvar((RubyId)node.nd_vid(), result); + return result; + + case NODE_LVAR: + //if (getRuby().ruby_scope.local_vars == null) { + // rb_bug("unexpected local variable"); + // } + return (RubyObject)getRuby().rubyScope.getLocalVars(node.nd_cnt()); + + case NODE_DVAR: + // return rom.rb_dvar_ref(node.nd_vid()); + return null; + + case NODE_GVAR: + // return rom.rb_gvar_get(node.nd_entry()); + return null; + + case NODE_IVAR: + return self.getIvar((RubyId)node.nd_vid()); + + case NODE_CONST: + return getConstant((NODE)rubyFrame.getCbase(), (RubyId)node.nd_vid(), self); + + case NODE_CVAR: /* normal method */ + if (ruby_cbase == null) { + return self.getRubyClass().getCvar((RubyId)node.nd_vid()); + } + if (!ruby_cbase.isSingleton()) { + return ruby_cbase.getCvar((RubyId)node.nd_vid()); + } + + return ruby_cbase.getIv("__attached__").getCvarSingleton().getCvar((RubyId)node.nd_vid()); + + case NODE_CVAR2: /* singleton method */ + return self.getCvarSingleton().getCvar((RubyId)node.nd_vid()); + + case NODE_BLOCK_ARG: + // if (ruby_scope.local_vars() == null) { + // rom.rb_bug("unexpected block argument"); + // } + // if (rom.rb_block_given_p()) { + // result = rom.rb_f_lambda(); + // ruby_scope.local_vars()[node.nd_cnt()] = result; + // } else { + return getRuby().getNil(); + // } + + case NODE_COLON2: + RubyModule rubyClass = (RubyModule)eval(self, node.nd_head()); +/* switch (TYPE(klass)) { + case T_CLASS: + case T_MODULE: + break; + default: + return rom.rb_funcall(klass, node.nd_mid(), 0, 0); + }*/ + return rubyClass.getConstant((RubyId)node.nd_mid()); + + case NODE_COLON3: + return getRuby().getObjectClass().getConstant((RubyId)node.nd_mid()); + + case NODE_NTH_REF: + // return rom.rb_reg_nth_match(node.nd_nth(), MATCH_DATA); + return null; + + case NODE_BACK_REF: + /*switch ((char)node.nd_nth()) { + case '&': + return rom.rb_reg_last_match(MATCH_DATA); + + case '`': + return rom.rb_reg_match_pre(MATCH_DATA); + + case '\'': + return rom.rb_reg_match_post(MATCH_DATA); + + case '+': + return rom.rb_reg_match_last(MATCH_DATA); + + default: + rom.rb_bug("unexpected back-ref"); + }*/ + + case NODE_HASH: +/* RubyHash hash = RubyHash.m_newHash(); + RubyObject key, val; + + NODE list = node.nd_head(); + while (list != null) { + key = eval(self, list.nd_head()); + list = list.nd_next(); + if (list == null) { + rom.rb_bug("odd number list for Hash"); + } + val = eval(self, list.nd_head()); + list = list.nd_next(); + hash.aset(key, val); + } + return hash;*/ + + case NODE_ZARRAY: /* zero length list */ + return RubyArray.m_newArray(getRuby()); + + case NODE_ARRAY: + RubyArray ary = (RubyArray)RubyArray.m_newArray(getRuby(), node.nd_alen()); + for (int i = 0; node != null ; node = node.nd_next()) { + ary.getArray().set(i++, eval(self, node.nd_head())); + } + return ary; + + case NODE_STR: + return ((RubyObject)node.nd_lit()).m_to_s(); + + case NODE_DSTR: + case NODE_DXSTR: + case NODE_DREGX: + case NODE_DREGX_ONCE: +/* NODE list = node.nd_next(); + + RubyString str = RubyString.m_newString(getRuby(), (RubyObject)node.nd_lit()); + RubyString str2; + + while (list != null) { + if (list.nd_head() != null) { + switch (list.nd_head().nd_type()) { + case NODE_STR: + str2 = (RubyString)list.nd_head().nd_lit(); + break; + + case NODE_EVSTR: + result = ruby_errinfo; + ruby_errinfo = Qnil; + ruby_sourceline = nd_line(node); + ruby_in_eval++; + list.nd_head(compile(list.nd_head().nd_lit(), ruby_sourcefile,ruby_sourceline)); + ruby_eval_tree = 0; + ruby_in_eval--; + if (ruby_nerrs > 0) { + compile_error("string expansion"); + } + if (!NIL_P(result)) ruby_errinfo = result; + /* fall through */ +/* default: + str2 = (RubyString)rom.rb_obj_as_string(eval(list.nd_head())); + break; + } + + str.append(str2); + str.infectObject(str2); + } + list = list.nd_next(); + } + switch (node.nd_type()) { + case NODE_DREGX: + return rom.rb_reg_new(str.getString(), str.getString().length(), node.nd_cflag()); + + case NODE_DREGX_ONCE: /* regexp expand once */ +/* VALUE result = rom.rb_reg_new(str.getString(), str.getString().length(), node.nd_cflag()); + node.nd_set_type(NODE_LIT); + node.nd_lit(result); + return result; + + case NODE_DXSTR: + return rom.rb_funcall(this, '`', 1, str); + + default: + return str; + }*/ + return null; + + case NODE_XSTR: + return self.funcall(getRuby().intern("`"), (RubyObject)node.nd_lit()); + + case NODE_LIT: + return (RubyObject)node.nd_lit(); + + case NODE_ATTRSET: +/* if (ruby_frame.argc() != 1) { + throw new RubyArgumentException("wrong # of arguments(" + ruby_frame.argc() + "for 1)"); + } + return self.setIvar((RubyId)node.nd_vid(), ruby_frame.argv()[0]); + */ + return null; + + case NODE_DEFN: + if (node.nd_defn() != null) { + int noex; + if (ruby_class == null) { + throw new RubyTypeException("no class to add method"); + } + + //if (ruby_class == getRuby().getObjectClass() && node.nd_mid() == init) { + // rom.rb_warn("redefining Object#initialize may cause infinite loop"); + //} + //if (node.nd_mid() == __id__ || node.nd_mid() == __send__) { + // rom.rb_warn("redefining `%s' may cause serious problem", ((RubyId)node.nd_mid()).toName()); + //} + // ruby_class.setFrozen(true); + + NODE body = ruby_class.searchMethod((RubyId)node.nd_mid()); + RubyObject origin = ruby_class.getMethodOrigin((RubyId)node.nd_mid()); + + if (body != null){ + // if (ruby_verbose.isTrue() && ruby_class == origin && body.nd_cnt() == 0) { + // rom.rb_warning("discarding old %s", ((RubyId)node.nd_mid()).toName()); + // } + // if (node.nd_noex() != 0) { /* toplevel */ + /* should upgrade to rb_warn() if no super was called inside? */ + // rom.rb_warning("overriding global function `%s'", ((RubyId)node.nd_mid()).toName()); + // } + } + if (isScope(SCOPE_PRIVATE) || node.nd_mid().equals(ruby.intern("initialize"))) { + noex = NOEX_PRIVATE; + } else if (isScope(SCOPE_PROTECTED)) { + noex = NOEX_PROTECTED; + } else if (ruby_class == getRuby().getObjectClass()) { + noex = node.nd_noex(); + } else { + noex = NOEX_PUBLIC; + } + if (body != null && origin == ruby_class && (body.nd_noex() & NOEX_UNDEF) != 0) { + noex |= NOEX_UNDEF; + } + + NODE defn = node.nd_defn().copyNodeScope(ruby_cref); + ruby_class.addMethod((RubyId)node.nd_mid(), defn, noex); + // rb_clear_cache_by_id(node.nd_mid()); + if (scope_vmode == SCOPE_MODFUNC) { + ruby_class.getSingletonClass().addMethod((RubyId)node.nd_mid(), defn, NOEX_PUBLIC); + ruby_class.funcall(getRuby().intern("singleton_method_added"), ((RubyId)node.nd_mid()).toSymbol()); + } + if (ruby_class.isSingleton()) { + ruby_class.getIv("__attached__").funcall(getRuby().intern("singleton_method_added"), ((RubyId)node.nd_mid()).toSymbol()); + } else { + // ruby_class.funcall(getRuby().intern("method_added"), ((RubyId)node.nd_mid()).toSymbol()); + } + } + return getRuby().getNil(); + + case NODE_DEFS: + if (node.nd_defn() != null) { + recv = eval(self, node.nd_recv()); + + if (getRuby().getSecurityLevel() >= 4 && !recv.isTaint()) { + throw new RubySecurityException("Insecure; can't define singleton method"); + } + /*if (FIXNUM_P(recv) || SYMBOL_P(recv)) { + rb_raise(rb_eTypeError, "can't define singleton method \"%s\" for %s", + rb_id2name(node.nd_mid()), rb_class2name(CLASS_OF(recv))); + }*/ // not needed in jruby + + if (recv.isFrozen()) { + throw new RubyFrozenException("object"); + } + rubyClass = recv.getSingletonClass(); + + NODE body = (NODE)rubyClass.getMethods().get((RubyId)node.nd_mid()); + if (body != null) { + if (getRuby().getSecurityLevel() >= 4) { + throw new RubySecurityException("redefining method prohibited"); + } + /*if (RTEST(ruby_verbose)) { + rb_warning("redefine %s", rb_id2name(node.nd_mid())); + }*/ + } + NODE defn = node.nd_defn().copyNodeScope(ruby_cref); + defn.nd_rval(ruby_cref); + rubyClass.addMethod((RubyId)node.nd_mid(), defn, NOEX_PUBLIC | (body != null ? body.nd_noex() & NOEX_UNDEF : 0)); + // rb_clear_cache_by_id(node.nd_mid()); + recv.funcall(getRuby().intern("singleton_method_added"), ((RubyId)node.nd_mid()).toSymbol()); + } + return getRuby().getNil(); + + case NODE_UNDEF: + if (ruby_class == null) { + throw new RubyTypeException("no class to undef method"); + } + ruby_class.undef((RubyId)node.nd_mid()); + + return getRuby().getNil(); + + case NODE_ALIAS: + if (ruby_class == null) { + throw new RubyTypeException("no class to make alias"); + } + ruby_class.aliasMethod((RubyId)node.nd_new(), (RubyId)node.nd_old()); + ruby_class.funcall(getRuby().intern("method_added"), ((RubyId)node.nd_mid()).toSymbol()); + + return getRuby().getNil(); + + case NODE_VALIAS: + //rb_alias_variable(node.nd_new(), node.nd_old()); + + return getRuby().getNil(); + + case NODE_CLASS: + RubyModule superClass; + + if (ruby_class == null) { + throw new RubyTypeException("no outer class/module"); + } + if (node.nd_super() != null) { + superClass = getSuperClass(self, node.nd_super()); + } else { + superClass = null; + } + + rubyClass = null; + // if ((ruby_class == getRuby().getObjectClass()) && rb_autoload_defined(node.nd_cname())) { + // rb_autoload_load(node.nd_cname()); + // } + if (ruby_class.isConstantDefined((RubyId)node.nd_cname())) { + rubyClass = (RubyClass)ruby_class.getConstant((RubyId)node.nd_cname()); + } + if (rubyClass != null) { + if (!rubyClass.isClass()) { + throw new RubyTypeException(((RubyId)node.nd_cname()).toName() + " is not a class"); + } + if (superClass != null) { + RubyModule tmp = rubyClass.getSuperClass(); + if (tmp.isSingleton()) { + tmp = tmp.getSuperClass(); + } + while (tmp.isIncluded()) { + tmp = tmp.getSuperClass(); + } + if (tmp != superClass) { + superClass = tmp; + //goto override_class; + } + } + if (getRuby().getSecurityLevel() >= 4) { + throw new RubySecurityException("extending class prohibited"); + } + // rb_clear_cache(); + } else { + //override_class: + if (superClass == null) { + superClass = getRuby().getObjectClass(); + } + rubyClass = getRuby().defineClassId((RubyId)node.nd_cname(), (RubyClass)superClass); + ruby_class.setConstant((RubyId)node.nd_cname(), rubyClass); + rubyClass.setClassPath((RubyClass)ruby_class, ((RubyId)node.nd_cname()).toName()); + } + if (ruby_wrapper != null) { + rubyClass.getSingletonClass().includeModule(ruby_wrapper); + rubyClass.includeModule(ruby_wrapper); + } + + return setupModule(rubyClass, node.nd_body()); + + case NODE_MODULE: + if (ruby_class == null) { + throw new RubyTypeException("no outer class/module"); + } + + RubyModule module = null; + + if ((ruby_class == getRuby().getObjectClass()) && getRuby().isAutoloadDefined((RubyId)node.nd_cname())) { + // getRuby().rb_autoload_load(node.nd_cname()); + } + if (ruby_class.isConstantDefined((RubyId)node.nd_cname())) { + module = (RubyModule)ruby_class.getConstant((RubyId)node.nd_cname()); + } + if (module != null) { + if (!(module instanceof RubyModule)) { + throw new RubyTypeException(((RubyId)node.nd_cname()).toName() + " is not a module"); + + } + if (getRuby().getSecurityLevel() >= 4) { + throw new RubySecurityException("extending module prohibited"); + } + } else { + module = getRuby().defineModuleId((RubyId)node.nd_cname()); + ruby_class.setConstant((RubyId)node.nd_cname(), module); + module.setClassPath(ruby_class, ((RubyId)node.nd_cname()).toName()); + } + if (ruby_wrapper != null) { + module.getSingletonClass().includeModule(ruby_wrapper); + module.includeModule(ruby_wrapper); + } + + return setupModule(module, node.nd_body()); + + case NODE_SCLASS: + rubyClass = (RubyClass)eval(self, node.nd_recv()); + if (rubyClass.isSpecialConst()) { + throw new RubyTypeException("no virtual class for " + rubyClass.getRubyClass().toName()); + } + if (getRuby().getSecurityLevel() >= 4 && !rubyClass.isTaint()) { + throw new RubySecurityException("Insecure: can't extend object"); + } + if (rubyClass.getRubyClass().isSingleton()) { + // rb_clear_cache(); + } + rubyClass = rubyClass.getSingletonClass(); + + if (ruby_wrapper != null) { + rubyClass.getSingletonClass().includeModule(ruby_wrapper); + rubyClass.includeModule(ruby_wrapper); + } + + return setupModule(rubyClass, node.nd_body()); + + case NODE_DEFINED: + // String buf; + // String desc = is_defined(self, node.nd_head(), buf); + // + // if (desc) { + // result = rb_str_new2(desc); + // } else { + // result = Qnil; + // } + + case NODE_NEWLINE: + // ruby_sourcefile = node.nd_file; + // ruby_sourceline = node.nd_nth(); + // if (trace_func) { + // call_trace_func("line", ruby_sourcefile, ruby_sourceline, self, + // ruby_frame.last_func(), + // ruby_frame.last_class()); + // } + node = node.nd_next(); + break; + + default: + // rom.rb_bug("unknown node type %d", nd_type(node)); + } + } + } + + private RubyModule PUSH_CLASS() { + return ruby_class; + } + + private void POP_CLASS(RubyModule _class) { + ruby_class = _class; + } + + public NODE ruby_cref = null; + private NODE top_cref; + + private void PUSH_CREF(Object c) { + ruby_cref = new NODE(NODE_CREF, c, null, ruby_cref); + } + + private void POP_CREF() { + ruby_cref = ruby_cref.nd_next(); + } + + + /** ev_const_get + * + */ + protected RubyObject getConstant(NODE cref, RubyId id, RubyObject self) { + NODE cbase = cref; + +// while (cbase != null && cbase.nd_next() != null) { +// RubyObject rubyClass = (RubyObject)cbase.nd_clss(); +// if (rubyClass.isNil()) { + return self.getRubyClass().getConstant(id); +// } else if (rubyClass.getInstanceVariables().get(id) != null) { +// return (RubyObject)rubyClass.getInstanceVariables().get(id); +// } +// cbase = cbase.nd_next(); +// } +// return ((RubyModule)cref.nd_clss()).getConstant(id); + } + + /** rb_obj_call_init + * + */ + public void callInit(RubyObject obj, RubyObject[] args) { + // PUSH_ITER( rb_block_given_p() ? ITER_PRE : ITER_NOT ); + obj.funcall(ruby.intern("initialize"), args); + // POP_ITER(); + } + + public RubyObject setupModule(RubyModule module, NODE n) { + NODE node = n; + + // String file = ruby_sourcefile; + // int line = ruby_sourceline; + + // TMP_PROTECT; + + // frame = ruby_frame; + // frame.tmp(ruby_frame); + // ruby_frame = frame; + + // PUSH_CLASS(); + ruby_class = module; + // PUSH_SCOPE(); + ruby_dyna_vars.push(); + + if (node.nd_tbl() != null) { + VALUE[] vars = new VALUE[node.nd_tbl()[0].intValue() + 1]; + // vars[0] = (VALUE) node; + getRuby().rubyScope.setLocalVars(vars); + // rb_mem_clear( ruby_scope->local_vars, node->nd_tbl[ 0 ] ); + getRuby().rubyScope.setLocalTbl(node.nd_tbl()); + } else { + getRuby().rubyScope.setLocalVars(null); + getRuby().rubyScope.setLocalTbl(null); + } + + // PUSH_CREF(module); + rubyFrame.setCbase((VALUE)ruby_cref); + // PUSH_TAG(PROT_NONE); + + RubyObject result = null; + + // if (( state = EXEC_TAG()) == 0 ) { + // if (trace_func) { + // call_trace_func("class", file, line, ruby_class, + // ruby_frame->last_func, ruby_frame->last_class ); + // } + result = eval(ruby_class, node.nd_next()); + // } + + // POP_TAG(); + // POP_CREF(); + ruby_dyna_vars.pop(); + // POP_SCOPE(); + // POP_CLASS(); + + // ruby_frame = frame.tmp; +// if (trace_func) { +// call_trace_func("end", file, line, 0, ruby_frame->last_func, ruby_frame->last_class ); +// } + // if (state != 0) { + // JUMP_TAG(state); + // } + + return result; + } + + + // C constants and variables + + /** massign + * + */ + public RubyObject massign(RubyObject self, NODE node, RubyObject val, boolean check) { + if (val == null) { + val = RubyArray.m_newArray(getRuby()); + } else if (!(val instanceof RubyArray)) { + // if ( rb_respond_to( val, to_ary ) ) { + // val.funcall(getRuby().intern("to_a")); + // } else { + val = RubyArray.m_newArray(getRuby(), val); + // } + } + + int len = (int)((RubyArray)val).length(); + NODE list = node.nd_head(); + + int i = 0; + for (; list != null && i < len; i++) { + assign(self, list.nd_head(), ((RubyArray)val).entry(i), check); + list = list.nd_next(); + } + + if (check && list != null) { + // error + } + + if (node.nd_args() != null) { + if (node.nd_args() == NODE.MINUS_ONE) { + } else if (list == null && i < len) { + assign(self, node.nd_args(), ((RubyArray)val).subseq(len - i, i), check); + } else { + assign(self, node.nd_args(), RubyArray.m_newArray(getRuby()), check); + } + } else if (check && i < len) { + // error + } + + while (list != null) { + i++; + assign(self, list.nd_head(), getRuby().getNil(), check); + list = list.nd_next(); + } + return val; + } + + /** assign + * + */ + public void assign(RubyObject self, NODE lhs, RubyObject val, boolean check) { + if (val == null) { + val = getRuby().getNil(); + } + switch (lhs.nd_type()) { + case NODE_GASGN: + // lhs.nd_entry().setGvar(val); + break; + + case NODE_IASGN: + self.setIvar((RubyId)lhs.nd_vid(), val); + break; + + case NODE_LASGN: + // if (getRuby().ruby_scope.local_vars == null) { + // rb_bug( "unexpected local variable assignment" ); + // } + getRuby().rubyScope.setLocalVars(lhs.nd_cnt(), val); + break; + + case NODE_DASGN: + // dvar_asgn(lhs.nd_vid(), val); + break; + + case NODE_DASGN_CURR: + // dvar_asgn_curr(lhs.nd_vid(), val); + break; + + case NODE_CDECL: + ruby_class.setConstant((RubyId)lhs.nd_vid(), val); + break; + + case NODE_CVDECL: + if (!ruby_cbase.isSingleton()) { + ruby_cbase.declareCvar((RubyId)lhs.nd_vid(), val); + break; + } + self = ruby_cbase.getIv("__attached__"); + /* fall through */ + case NODE_CVASGN: + self.getCvarSingleton().setCvar((RubyId)lhs.nd_vid(), val); + break; + + case NODE_MASGN: + massign(self, lhs, val, check); + break; + + case NODE_CALL: + RubyObject recv = eval(self, lhs.nd_recv()); + if (lhs.nd_args() == null) { + /* attr set */ + recv.getRubyClass().call(recv, (RubyId)lhs.nd_mid(), new RubyObject[] { val }, 0); + } else { + RubyArray args = (RubyArray)eval(self, lhs.nd_args()); + args.push(val); + recv.getRubyClass().call(recv, (RubyId)lhs.nd_mid(), (RubyObject[])args.getArray().toArray(new RubyObject[0]), 0); + } + break; + + default: + // rb_bug( "bug in variable assignment" ); + break; + } + } + + + /** SCOPE_TEST + * + */ + private boolean isScope(int scope) { + return (scope_vmode & scope) != 0; + } + + /** SETUP_ARGS + * + */ + private RubyObject[] setupArgs(RubyObject self, NODE anode) { + NODE n = anode; + if (n == null) { + return new RubyObject[0]; + } else if (n.nd_type() == NODE_ARRAY) { + int len = n.nd_alen(); + if (len > 0) { + // String file = ruby_sourcefile; + // int line = ruby_sourceline; + n = anode; + RubyObject[] args = new RubyObject[len]; + for (int i = 0; i < len; i++) { + args[i] = eval(self, n.nd_head()); + n = n.nd_next(); + } + // ruby_sourcefile = file; + // ruby_sourceline = line; + return args; + } else { + return new RubyObject[0]; + } + } else { + RubyObject args = eval(self, n); + // String file = ruby_sourcefile; + // int line = ruby_sourceline; + if (!(args instanceof RubyArray)) { + args = RubyArray.m_newArray(getRuby(), args); + } + + List argsList = ((RubyArray)args).getArray(); + // ruby_sourcefile = file; + // ruby_sourceline = line; + return (RubyObject[])argsList.toArray(new RubyObject[argsList.size()]); + } + } + + private RubyClass getSuperClass(RubyObject self, NODE node) { + RubyObject obj; + int state = 1; // unreachable + + // PUSH_TAG(PROT_NONE); + // if ((state = EXEC_TAG()) == 0 ) { + obj = eval(self, node); + // } + // POP_TAG(); + + if (state != 0) { + switch (node.nd_type()) { + case NODE_COLON2: + throw new RubyTypeException("undefined superclass `" + ((RubyId)node.nd_mid()).toName() + "'"); + case NODE_CONST: + throw new RubyTypeException("undefined superclass `" + ((RubyId)node.nd_vid()).toName() + "'"); + default: + throw new RubyTypeException("undefined superclass"); + } + // JUMP_TAG(state); + } + if (!(obj instanceof RubyClass)) { + throw new RuntimeException(); + // goto superclass_error; + } + if (((RubyClass)obj).isSingleton()) { + throw new RubyTypeException("can't make subclass of virtual class"); + } + return (RubyClass)obj; + } + + private BLOCK BEGIN_CALLARGS() { + BLOCK tmp_block = ruby_block; + if (ruby_iter.iter == ITER_PRE) { + ruby_block = ruby_block.prev; + } + PUSH_ITER(ITER_NOT); + return tmp_block; + } + + private void END_CALLARGS(BLOCK tmp_block) { + ruby_block = tmp_block; + POP_ITER(); + } + + // static final int CACHE_SIZE = 0x800; + // static final int CACHE_MASK = 0x7ff; + + // static long expr1(long c, long m) { + // return ((c>>3) ^ m) & CACHE_MASK; + // } + + // cache_entry[CACHE_SIZE] cache; + + // int ruby_in_compile; + + // VALUE ruby_errinfo = ruby.getNil(); + // NODE ruby_eval_tree_begin; + // NODE ruby_eval_tree; + // int ruby_nerrs; + + // VALUE rb_eLocalJumpError; + // VALUE rb_eSysStackError; + + // VALUE ruby_top_self; + + private static final int BLOCK_D_SCOPE = 1; + private static final int BLOCK_DYNAMIC = 2; + private static final int BLOCK_ORPHAN = 4; + + BLOCK ruby_block = new BLOCK(); + + private BLOCK PUSH_BLOCK(NODE v, NODE b, VALUE self) { + BLOCK _block = new BLOCK(); + // _block.tag = new_blktag(); + _block.var = v; + _block.body = b; + _block.self = self; + _block.frame = rubyFrame; + _block.klass = ruby_class; + // _block.frame.file = ruby_sourcefile; + // _block.frame.line = ruby_sourceline; + _block.scope = getRuby().rubyScope; + _block.prev = ruby_block; + _block.iter = ruby_iter.iter; + _block.vmode = scope_vmode; + _block.flags = BLOCK_D_SCOPE; + _block.dyna_vars = ruby_dyna_vars; + ruby_block = _block; + return _block; + } + + private void POP_BLOCK_TAG(BLOCKTAG tag) { + if ((tag.flags & BLOCK_DYNAMIC) != 0) { + tag.flags |= BLOCK_ORPHAN; + } else { + // rb_gc_force_recycle((VALUE)tag); + } + } + + private void POP_BLOCK(BLOCK _block) { + POP_BLOCK_TAG(_block.tag); + ruby_block = _block.prev; + } + + iter ruby_iter = new iter(); + + private static final int ITER_NOT = 0; + private static final int ITER_PRE = 1; + private static final int ITER_CUR = 2; + + public void PUSH_ITER(int i) { + iter _iter = new iter(); + _iter.prev = ruby_iter; + _iter.iter = i; + ruby_iter = _iter; + } + + public void POP_ITER() { + ruby_iter = ruby_iter.prev; + } +} + +// C structs + +// class cache_entry { /* method hash table. */ +// ID mid; /* method's id */ +// ID mid0; /* method's original id */ +// VALUE klass; /* receiver's class */ +// VALUE origin; /* where method defined */ +// NODE method; +// int noex; +// } + +class BLOCKTAG { + RubyObject _super; + long dst; + long flags; +} + +class BLOCK { + NODE var; + NODE body; + VALUE self; + Frame frame; + RubyScope scope; + BLOCKTAG tag; + VALUE klass; + int iter; + int vmode; + int flags; + RubyVarmap dyna_vars; + VALUE orig_thread; + BLOCK prev; +} + +class iter { + int iter; + iter prev; +} \ No newline at end of file diff --git a/org/jruby/interpreter/RubyScope.java b/org/jruby/interpreter/RubyScope.java new file mode 100644 index 00000000000..9a51887bd4a --- /dev/null +++ b/org/jruby/interpreter/RubyScope.java @@ -0,0 +1,170 @@ +/* + * RubyScope.java - No description + * Created on 10. September 2001, 17:54 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter; + +import org.jruby.*; +import org.jruby.original.*; + +/** + * + * @author jpetersen + * @version + */ +public class RubyScope { + private RubyObject superObject = null; + private RubyId[] localTbl = null; + private VALUE[] localVars = null; + private int flags = 0; + + private RubyScope old = null; + + public RubyScope() { + } + + public RubyScope(RubyScope scope) { + this.superObject = scope.superObject; + this.localTbl = scope.localTbl; + this.localVars = scope.localVars; + this.flags = scope.flags; + this.old = scope.old; + } + + public void push() { + old = new RubyScope(this); + + localTbl = null; + localVars = null; + flags = 0; + } + + public void pop() { + this.superObject = old.superObject; + this.localTbl = old.localTbl; + this.localVars = old.localVars; + this.flags = old.flags; + this.old = old.old; + } + + /** Getter for property flags. + * @return Value of property flags. + */ + public int getFlags() { + return flags; + } + + /** Setter for property flags. + * @param flags New value of property flags. + */ + public void setFlags(int flags) { + this.flags = flags; + } + + /** Indexed getter for property localTbl. + * @param index Index of the property. + * @return Value of the property at index. + */ + public RubyId getLocalTbl(int index) { + return localTbl[index]; + } + + /** Getter for property localTbl. + * @return Value of property localTbl. + */ + public RubyId[] getLocalTbl() { + return localTbl; + } + + /** Indexed setter for property localTbl. + * @param index Index of the property. + * @param localTbl New value of the property at index. + */ + public void setLocalTbl(int index, RubyId localTbl) { + this.localTbl[index] = localTbl; + } + + /** Setter for property localTbl. + * @param localTbl New value of property localTbl. + */ + public void setLocalTbl(RubyId[] localTbl) { + this.localTbl = localTbl; + } + + public void setLocalTbl(ID[] localTbl) { + this.localTbl = new RubyId[localTbl.length]; + System.arraycopy(localTbl, 0, this.localTbl, 0, localTbl.length); + } + + /** Indexed getter for property localVars. + * @param index Index of the property. + * @return Value of the property at index. + */ + public VALUE getLocalVars(int index) { + return localVars[index]; + } + + /** Getter for property localVars. + * @return Value of property localVars. + */ + public VALUE[] getLocalVars() { + return localVars; + } + + /** Indexed setter for property localVars. + * @param index Index of the property. + * @param localVars New value of the property at index. + */ + public void setLocalVars(int index, VALUE newValue) { + // HACK +++ + if (localVars == null) { + localVars = new VALUE[index + 1]; + } + // HACK --- + localVars[index] = newValue; + } + + /** Setter for property localVars. + * @param localVars New value of property localVars. + */ + public void setLocalVars(VALUE[] localVars) { + this.localVars = localVars; + } + + /** Getter for property superObject. + * @return Value of property superObject. + */ + public RubyObject getSuperObject() { + return superObject; + } + + /** Setter for property superObject. + * @param superObject New value of property superObject. + */ + public void setSuperObject(RubyObject superObject) { + this.superObject = superObject; + } + +} \ No newline at end of file diff --git a/org/jruby/interpreter/RubyVarmap.java b/org/jruby/interpreter/RubyVarmap.java new file mode 100644 index 00000000000..d8419da9795 --- /dev/null +++ b/org/jruby/interpreter/RubyVarmap.java @@ -0,0 +1,124 @@ +/* + * RubyVarmap.java - No description + * Created on 10. September 2001, 17:54 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter; + +import org.jruby.*; +import org.jruby.original.*; + +/** + * + * @author jpetersen + * @version + */ +public class RubyVarmap { + private RubyObject superObject = null; + private RubyId id = null; + private VALUE val = null; + private RubyVarmap next = null; + + /** Creates new RubyVarmap */ + public RubyVarmap(RubyObject superObject, RubyId id, VALUE val, RubyVarmap next) { + this.superObject = superObject; + this.id = id; + this.val = val; + this.next = next; + } + + public RubyVarmap() { + } + + public void push() { + RubyVarmap varMap = new RubyVarmap(superObject, id, val, next); + next = varMap; + } + + public void pop() { + if (next != null) { + superObject = next.superObject; + id = next.id; + val = next.val; + next = next.next; + } + } + + /** Getter for property id. + * @return Value of property id. + */ + public RubyId getId() { + return id; + } + + /** Setter for property id. + * @param id New value of property id. + */ + public void setId(RubyId id) { + this.id = id; + } + + /** Getter for property next. + * @return Value of property next. + */ + public org.jruby.interpreter.RubyVarmap getNext() { + return next; + } + + /** Setter for property next. + * @param next New value of property next. + */ + public void setNext(org.jruby.interpreter.RubyVarmap next) { + this.next = next; + } + + /** Getter for property superObject. + * @return Value of property superObject. + */ + public RubyObject getSuperObject() { + return superObject; + } + + /** Setter for property superObject. + * @param superObject New value of property superObject. + */ + public void setSuperObject(RubyObject superObject) { + this.superObject = superObject; + } + + /** Getter for property val. + * @return Value of property val. + */ + public VALUE getVal() { + return val; + } + + /** Setter for property val. + * @param val New value of property val. + */ + public void setVal(VALUE val) { + this.val = val; + } + +} \ No newline at end of file diff --git a/org/jruby/interpreter/nodes/.nbattrs b/org/jruby/interpreter/nodes/.nbattrs new file mode 100644 index 00000000000..2ec9754ea5a --- /dev/null +++ b/org/jruby/interpreter/nodes/.nbattrs @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org/jruby/interpreter/nodes/BlockNode.java b/org/jruby/interpreter/nodes/BlockNode.java new file mode 100644 index 00000000000..fc473581e72 --- /dev/null +++ b/org/jruby/interpreter/nodes/BlockNode.java @@ -0,0 +1,52 @@ +/* + * BlockNode.java - No description + * Created on 10. September 2001, 17:46 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter.nodes; + +import org.jruby.*; +import org.jruby.original.*; + +/** + * + * @author jpetersen + * @version + */ +public class BlockNode extends NODE implements ExpandNode, node_type { + + public BlockNode(NODE arg1) { + super(NODE_BLOCK, arg1, null, null); + } + + public NODE expand(RubyObject self) { + NODE node = this; + + while (node.nd_next() != null) { + self.eval(node.nd_head()); + node = node.nd_next(); + } + return node.nd_head(); + } +} \ No newline at end of file diff --git a/org/jruby/interpreter/nodes/ExpandNode.java b/org/jruby/interpreter/nodes/ExpandNode.java new file mode 100644 index 00000000000..d04125853e6 --- /dev/null +++ b/org/jruby/interpreter/nodes/ExpandNode.java @@ -0,0 +1,39 @@ +/* + * ExpandNode.java - No description + * Created on 10. September 2001, 17:54 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter.nodes; + +import org.jruby.*; +import org.jruby.original.*; + +/** + * + * @author jpetersen + * @version + */ +public interface ExpandNode { + public NODE expand(RubyObject self); +} \ No newline at end of file diff --git a/org/jruby/interpreter/nodes/ResultNode.java b/org/jruby/interpreter/nodes/ResultNode.java new file mode 100644 index 00000000000..327ad293430 --- /dev/null +++ b/org/jruby/interpreter/nodes/ResultNode.java @@ -0,0 +1,38 @@ +/* + * ResultNode.java - No description + * Created on 10. September 2001, 17:54 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.interpreter.nodes; + +import org.jruby.*; + +/** + * + * @author jpetersen + * @version + */ +public interface ResultNode { + public RubyObject interpret(RubyObject self); +} \ No newline at end of file diff --git a/org/jruby/original/.nbattrs b/org/jruby/original/.nbattrs new file mode 100644 index 00000000000..ff76f3415cd --- /dev/null +++ b/org/jruby/original/.nbattrs @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org/jruby/original/ID.java b/org/jruby/original/ID.java new file mode 100644 index 00000000000..22d93d4321c --- /dev/null +++ b/org/jruby/original/ID.java @@ -0,0 +1,212 @@ +/* + * ID.java - No description + * Created on 10. September 2001, 17:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.original; + +import java.util.*; + +import org.jruby.*; + +public class ID implements VALUE, token { + protected int value; + + /*public ID(int value) { + this.value = value; + }*/ + + public int intValue() { + return value; + } + + public final boolean is_notop_id() { + return value > LAST_TOKEN; + } + + public final boolean is_local_id() { + return is_notop_id() && (value & ID_SCOPE_MASK) == ID_LOCAL; + } + + public final boolean is_instance_id() { + return is_notop_id() && (value & ID_SCOPE_MASK) == ID_INSTANCE; + } + + public final boolean is_global_id() { + return is_notop_id() && (value & ID_SCOPE_MASK) == ID_GLOBAL; + } + + public final boolean is_attrset_id() { + return is_notop_id() && (value & ID_SCOPE_MASK) == ID_ATTRSET; + } + + public final ID rb_id_attrset(Ruby ruby) { + return new RubyId(ruby, (value & ~ID_SCOPE_MASK) | ID_ATTRSET); + } + + public final boolean is_const_id() { + return is_notop_id() && (value & ID_SCOPE_MASK) == ID_CONST; + } + + public final boolean is_class_id() { + return is_notop_id() && (value & ID_SCOPE_MASK) == ID_CLASS; + } + + // ------------------------------------------------------------------------ + // Symbol table + // ------------------------------------------------------------------------ + + private static final int ID_SCOPE_SHIFT = 3; + private static final int ID_SCOPE_MASK = 7; + private static final int ID_LOCAL = 0x01; + private static final int ID_INSTANCE = 0x02; + private static final int ID_GLOBAL = 0x03; + private static final int ID_ATTRSET = 0x04; + private static final int ID_CONST = 0x05; + private static final int ID_CLASS = 0x06; + private static final int ID_JUNK = 0x07; + + private static Map sym_tbl = new HashMap(200); + private static Map sym_rev_tbl = new HashMap(200); + + private static ID last_id = null; + + private static ID last_id(Ruby ruby) { + return last_id == null ? new RubyId(ruby, LAST_TOKEN) : last_id; + } + + /** Create a new ID (aka symbol) for the given string. */ + public static ID rb_intern(String name, Ruby ruby) { + int last; + + ID _id = (ID)sym_tbl.get(name); + if (_id != null) + return _id; + + int id = 0; + int m = 0; + id_regist:for(;;) { + switch (name.charAt(m)) { + case '$': + id |= ID_GLOBAL; + m++; + if (!is_identchar(name.charAt(m))) + m++; + break; + case '@': + if (name.charAt(m + 1) == '@') { + m++; + id |= ID_CLASS; + } + else { + id |= ID_INSTANCE; + } + m++; + break; + default: + if (name.charAt(m) != '_' && !Character.isLetter(name.charAt(m))) { + if (m != 0) throw new Error("m="+m); + /* operators */ + for (int i=0; ruby.op_tbl[i].token != null; i++) { + if (ruby.op_tbl[i].name.equals(name)) { + id = ruby.op_tbl[i].token.intValue(); + break id_regist; + } + } + } + + last = name.length() - 1; + if (name.charAt(last) == '=') { + /* attribute assignment */ + String buf = name.substring(m, last); + _id = rb_intern(buf, ruby); id = _id.intValue(); + if (id > LAST_TOKEN && !_id.is_attrset_id()) { + _id = _id.rb_id_attrset(ruby); + id = _id.intValue(); + break id_regist; + } + id = ID_ATTRSET; + } + else if (Character.isUpperCase(name.charAt(m))) { + id = ID_CONST; + } + else { + id = ID_LOCAL; + } + break; + } //switch + while (m < name.length() && is_identchar(name.charAt(m))) { + m++; + } + if (m < name.length()) id = ID_JUNK; + last_id = new RubyId(ruby, last_id(ruby).intValue() + 1); + id |= last_id(ruby).intValue() << ID_SCOPE_SHIFT; + break id_regist; + } + //id_regist: + _id = new RubyId(ruby, id); + sym_tbl.put(name, _id); + sym_rev_tbl.put(_id, name); + return _id; + } + + public static final boolean is_identchar(char ch) { + return Character.isLetterOrDigit(ch) || ch == '_'; + } + + /** Returns the ID's print string */ + public static String rb_id2name(Ruby ruby, ID id) { + if (id.intValue() < LAST_TOKEN) { + for (int i = 0; ruby.op_tbl[i].token != null; i++) { + if (ruby.op_tbl[i].token.equals(id)) + return ruby.op_tbl[i].name; + } + } + + String name = (String)sym_rev_tbl.get(id); + if (name != null) + return name; + + if (id.is_attrset_id()) { + ID id2 = new RubyId(ruby, (id.intValue() & ~ID_SCOPE_MASK) | ID_LOCAL); + + again: for(;;) { + name = rb_id2name(ruby, id2); + if (name != null) { + ID.rb_intern(name + "=", ((RubyId)id).getRuby()); + return rb_id2name(ruby, id); + } + if (id2.is_local_id()) { + id2 = new RubyId(ruby, (id.intValue() & ~ID_SCOPE_MASK) | ID_CONST); + continue again; + } + break again; + } + } + return null; + } + + public static String rb_id2name_last_id(Ruby ruby) { + return rb_id2name(ruby, last_id(ruby)); + } +} diff --git a/org/jruby/original/IdentitySet.java b/org/jruby/original/IdentitySet.java new file mode 100644 index 00000000000..5d261a2e001 --- /dev/null +++ b/org/jruby/original/IdentitySet.java @@ -0,0 +1,33 @@ +/* + * IdentitySet.java - No description + * Created on 10. September 2001, 17:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.original; + +import java.util.*; + +public class IdentitySet extends HashSet { + +} + diff --git a/org/jruby/original/NODE.java b/org/jruby/original/NODE.java new file mode 100644 index 00000000000..a2b4df6c756 --- /dev/null +++ b/org/jruby/original/NODE.java @@ -0,0 +1,236 @@ +/* + * NODE.java - No description + * Created on 23. Juli 2001, 19:25 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.original; + +import java.util.*; + +import org.jruby.*; +import org.jruby.core.*; + +public class NODE implements node_type, VALUE, Scope { + + private NODE() {} + + public static NODE MINUS_ONE = new NODE(); + public static NODE undefined = new NODE(); //XXX + + private Object u1; + private Object u2; + private Object u3; + + public NODE nd_head() { return (NODE)u1; } + public void nd_head(NODE n) { u1 = n; } + + public int nd_alen() { return u2 == null ? 0 : ((Integer)u2).intValue(); } + public void nd_alen(int i) { u2 = new Integer(i); } + + public NODE nd_next() { return (NODE)u3; } + public void nd_next(NODE n) { u3 = n; } + + public NODE nd_cond() { return (NODE)u1; } + public NODE nd_body() { return (NODE)u2; } + public NODE nd_else() { return (NODE)u3; } + + public VALUE nd_orig() { return (VALUE)u3; } + + //NODE nd_resq() { return (NODE)u2; } + public NODE nd_ensr() { return (NODE)u3; } + + public NODE nd_1st() { return (NODE)u1; } + public NODE nd_2nd() { return (NODE)u2; } + + NODE nd_stts() { return (NODE)u1; } + + public global_entry nd_entry() { return (global_entry)u3; } + public ID nd_vid() { return (ID)u1; } + public ID nd_cflag() { return (ID)u2; } + public void nd_cflag(ID id) { u2 = id; } + //VALUE nd_cval() { return (VALUE)u3; } + + public int nd_cnt() { return u3 == null ? 0 : ((Integer)u3).intValue(); } + public void nd_cnt(int i) { u3 = new Integer(i); } + public ID[] nd_tbl() { return (ID[])u1; } + public void nd_tbl(ID[] idTable) { u1 = idTable; } + + //NODE nd_var() { return (NODE)u1; } + //NODE nd_ibdy() { return (NODE)u2; } + //NODE nd_iter() { return (NODE)u3; } + public void nd_iter(NODE n) { u3 = n; } + + public NODE nd_value() { return (NODE)u2; } + public void nd_value(NODE n) { u2 = n; } + public ID nd_aid() { return (ID)u3; } + public void nd_aid(ID id) { u3 = id; } + + public VALUE nd_lit() { return (VALUE)u1; } + public void nd_lit(VALUE v) { u1 = v; } + + //NODE nd_frml() { return (NODE)u1; } + public int nd_rest() { return u2 == null ? 0 : ((Integer)u2).intValue(); } + public NODE nd_opt() { return (NODE)u1; } + + public NODE nd_recv() { return (NODE)u1; } + public ID nd_mid() { return (ID)u2; } + public void nd_mid(ID id) { u2 = id; } + public NODE nd_args() { return (NODE)u3; } + public void nd_args(NODE n) { u3 = n; } + + public int nd_noex() { return u1 == null ? 0 : ((Integer)u1).intValue(); } + public void nd_noex(int i) { u1 = new Integer(i); } + public NODE nd_defn() { return (NODE)u3; } + + public ID nd_old() { return (ID)u1; } + public ID nd_new() { return (ID)u2; } + + public Object nd_cfnc() { return u1; } + //int nd_argc() { return u2 == null ? 0 : ((Integer)u2).intValue(); } + + public ID nd_cname() { return (ID)u1; } + public NODE nd_super() { return (NODE)u3; } + + //ID nd_modl() { return (ID)u1; } + public VALUE nd_clss() { return (VALUE)u1; } + + public NODE nd_beg() { return (NODE)u1; } + public void nd_beg(NODE n) { u1 = n; } + public NODE nd_end() { return (NODE)u2; } + public void nd_end(NODE n) { u2 = n; } + public long nd_state() { return u3 == null ? 0L : ((Long)u3).longValue(); } + public void nd_state(long l) { u3 = new Long(l); } + public VALUE nd_rval() { return (VALUE)u2; } + public void nd_rval(VALUE val) { u2 = val; } + + public int nd_nth() { return u2 == null ? 0 : ((Integer)u2).intValue(); } + public void nd_nth(int i) { u2 = new Integer(i); } + + //ID nd_tag() { return (ID)u1; } + //VALUE nd_tval() { return (VALUE)u2; } + + private short type; + public int nd_type() { return type; } + public void nd_set_type(int type) { this.type = (short)type; } + + private short line; + public int nd_line() { return line; } + public void nd_set_line(int line) { this.line = (short)line; } + + public String nd_file; + + public NODE(int type, Object u1, Object u2, Object u3) { + nd_set_type(type); + this.u1 = u1; + this.u2 = u2; + this.u3 = u3; + } + + public static NODE newNode(int type, Object u1, Object u2, Object u3) { + return new NODE(type, u1, u2, u3); + } + + /** copy_node_scope + * + */ + public NODE copyNodeScope(VALUE rval) { + NODE copy = new NODE(NODE_SCOPE, null, rval, nd_next()); + + if (nd_tbl() != null) { + // ??? + // copy->nd_tbl = ALLOC_N( ID, node->nd_tbl[ 0 ] + 1 ); + // MEMCPY( copy->nd_tbl, node->nd_tbl, ID, node->nd_tbl[ 0 ] + 1 ); + + ID[] idTable = new ID[nd_tbl()[0].intValue() + 1]; + System.arraycopy(nd_tbl(), 0, idTable, 0, nd_tbl().length); + + copy.nd_tbl(idTable); + // ??? + } else { + copy.nd_tbl(null); + } + + return copy; + } + + /** NEW_METHOD + * + */ + public static NODE newMethod(NODE n, int noex) { + return new NODE(NODE_METHOD, new Integer(noex), n, null); + } + + /** NEW_CFUNC + * + */ + public static NODE newCallbackMethod(RubyCallbackMethod method) { + return new NODE(NODE_CFUNC, method, null, null); + } + + /** NEW_FBODY + * + */ + public static NODE newFBody(NODE n, RubyId i, RubyModule o) { + return new NODE(NODE_FBODY, n, i, o); + } + + public String toString() { + return super.toString() + "("+type_name(type)+")"; + } + + /** Uses the magic of reflections to determine the node type string. */ + private static String type_name(int t) { + java.lang.reflect.Field[] f = node_type.class.getDeclaredFields(); + try { + for (int i = 0; i < f.length; i++) + if (f[i].getInt(null) == t) + return f[i].getName(); + } catch (IllegalAccessException e) {} + return String.valueOf(t); + } + + /** Prints this node and all subnodes with indentation. */ + public void print(int indent, Set visited) { + visited.add(this); + indent(indent); System.out.println(this); + print(indent + 1, u1, visited); + print(indent + 1, u2, visited); + print(indent + 1, u3, visited); + } + public static void print(int indent, Object o, Set visited) { + if (o == null) return; + if (visited.contains(o)) { + indent(indent); + System.out.println("(...@" + Integer.toHexString(o.hashCode()) + "...)"); + } + else if (o instanceof NODE) + ((NODE)o).print(indent, visited); + else { + indent(indent); System.out.println(o); + } + } + static void indent(int indent) { + for (int i = 0; i < indent; i++) System.out.print(" | "); + } +} + diff --git a/org/jruby/original/RVarmap.java b/org/jruby/original/RVarmap.java new file mode 100644 index 00000000000..9c22f24cb6f --- /dev/null +++ b/org/jruby/original/RVarmap.java @@ -0,0 +1,35 @@ +/* + * RVarmap.java - No description + * Created on 10. September 2001, 17:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.original; + +import org.jruby.*; + +public class RVarmap { + public RubyObject super_; + public ID id; + public VALUE val; + public RVarmap next; +} \ No newline at end of file diff --git a/org/jruby/original/RubyOriginalMethods.java b/org/jruby/original/RubyOriginalMethods.java new file mode 100644 index 00000000000..022a7cd9b92 --- /dev/null +++ b/org/jruby/original/RubyOriginalMethods.java @@ -0,0 +1,839 @@ +/* + * RubyOriginalMethods.java - No description + * Created on 09. Juli 2001, 21:38 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.original; + +import org.jruby.*; +import org.jruby.core.*; + +/** + * + * @author jpetersen + */ +public final class RubyOriginalMethods { + private Ruby ruby; + + public RubyOriginalMethods(Ruby ruby) { + this.ruby = ruby; + } + + // + // class.c + // + + public st_table rb_class_tbl() { + return null; + } + + public VALUE rb_class_new(VALUE superClass) { + return RubyClass.m_newClass(ruby, (RubyClass)superClass); + } + + public VALUE rb_mod_clone(VALUE mod) { + return ((RubyModule)mod).m_clone(); + } + + public VALUE rb_mod_dup(VALUE mod) { + return ((RubyModule)mod).m_dup(); + } + + public VALUE rb_singleton_class_new(VALUE superClass) { + return ((RubyClass)superClass).newSingletonClass(); + } + + public VALUE rb_singleton_class_clone(VALUE klass) { + return ((RubyClass)klass).getSingletonClassClone(); + } + + public void rb_singleton_class_attached(VALUE klass, VALUE obj) { + ((RubyClass)klass).attachSingletonClass((RubyObject)obj); + } + + public VALUE rb_define_class_id(ID id, VALUE superClass) { + return ruby.defineClassId((RubyId)id, (RubyClass)superClass); + } + + public VALUE rb_define_class(String name, VALUE superClass) { + return ruby.defineClass(name, (RubyClass)superClass); + } + + public VALUE rb_define_class_under(VALUE outer, String name, VALUE superClass) { + return ((RubyClass)outer).defineClassUnder(name, (RubyClass)superClass); + } + + public VALUE rb_module_new() { + return RubyModule.m_newModule(ruby); + } + + public VALUE rb_define_module_id(ID id) { + return ruby.defineModuleId((RubyId)id); + } + + public VALUE rb_define_module(String name) { + return ruby.defineModule(name); + } + + public VALUE rb_define_module_under(VALUE outer, String name) { + return ((RubyClass)outer).defineModuleUnder(name); + } + + public VALUE include_class_new(VALUE module, VALUE superClass) { + return null; + } + + public void rb_include_module(VALUE klass, VALUE module) { + ((RubyClass)klass).includeModule((RubyModule)module); + } + + public VALUE rb_mod_included_modules(VALUE mod) { + return ((RubyModule)mod).m_included_modules(); + } + + public VALUE rb_mod_ancestors(VALUE mod) { + return ((RubyModule)mod).m_ancestors(); + } + + public VALUE rb_class_instance_methods(int argc, VALUE[] argv, VALUE mod) { + return null; + } + + public VALUE rb_class_protected_instance_methods(int argc, VALUE[] argv, VALUE mod) { + return null; + } + + public VALUE rb_class_private_instance_methods(int argc, VALUE[] argv, VALUE mod) { + return null; + } + + public VALUE rb_obj_singleton_methods(VALUE obj) { + return null; + } + + public void rb_define_method_id(VALUE klass, ID name, VALUE func) { + ((RubyModule)klass).defineMethodId((RubyId)name, (RubyCallbackMethod)func); + } + + public void rb_define_method(VALUE klass, String name, VALUE func) { + ((RubyModule)klass).defineMethod(name, (RubyCallbackMethod)func); + } + + public void rb_define_protected_method(VALUE klass, String name, VALUE func) { + ((RubyModule)klass).defineProtectedMethod(name, (RubyCallbackMethod)func); + } + + public void rb_define_private_method(VALUE klass, String name, VALUE func) { + ((RubyModule)klass).definePrivateMethod(name, (RubyCallbackMethod)func); + } + + public void rb_undef_method(VALUE klass, String name) { + ((RubyClass)klass).undefMethod(name); + } + + public VALUE rb_singleton_class(VALUE obj) { + return ((RubyObject)obj).getSingletonClass(); + } + + public void rb_define_singleton_method(VALUE obj, String name, VALUE func, int argc) { + } + + public void rb_define_module_function(VALUE module, String name, VALUE func, int argc) { + } + + public void rb_define_global_function(String name, VALUE func, int argc) { + } + + public void rb_define_alias(VALUE klass, String name1, String name2) { + ((RubyClass)klass).defineAlias(name1, name2); + } + + public void rb_define_attr(VALUE klass, String name, int read, int write) { + ((RubyClass)klass).defineAttribute(name, read != 0, write != 0); + } + + // + // object.c + // + + public VALUE rb_mKernel() { + return ruby.getKernelModule(); + } + + public VALUE rb_cObject() { + return ruby.getObjectClass(); + } + + public VALUE rb_cModule() { + return ruby.getModuleClass(); + } + + public VALUE rb_cClass() { + return ruby.getClassClass(); + } + + public VALUE rb_cData() { + return null; + } + + public VALUE rb_cNilClass() { + return ruby.getNilClass(); + } + + public VALUE rb_cTrueClass() { + return ruby.getTrueClass(); + } + + public VALUE rb_cFalseClass() { + return ruby.getFalseClass(); + } + + public VALUE rb_cSymbol() { + return ruby.getSymbolClass(); + } + + public ID eq() { + return ruby.intern("=="); + } + + public ID eql() { + return ruby.intern("eql?"); + } + + public ID inspect() { + return ruby.intern("inspect"); + } + + /** Change clone to _clone + * + */ + public ID _clone() { + return ruby.intern("clone"); + } + + public VALUE rb_equal(VALUE obj1, VALUE obj2) { + return null; + } + + public int rb_eql(VALUE obj1, VALUE obj2) { + return 0; + } + + public VALUE rb_obj_equal(VALUE obj1, VALUE obj2) { + return ((RubyObject)obj2).m_equal((RubyObject)obj2); + } + + public VALUE rb_obj_id(VALUE obj) { + return ((RubyObject)obj).m_id(); + } + + public VALUE rb_obj_type(VALUE obj) { + return ((RubyObject)obj).m_type(); + } + + public VALUE rb_obj_clone(VALUE obj) { + return ((RubyObject)obj).m_clone(); + } + + public VALUE rb_obj_dup(VALUE obj) { + return ((RubyObject)obj).m_dup(); + } + + public VALUE rb_any_to_a(VALUE obj) { + return null; + } + + public VALUE rb_any_to_s(VALUE obj) { + return null; + } + + public VALUE rb_inspect(VALUE obj) { + return null; + } + + public VALUE rb_obj_inspect(VALUE obj) { + return ((RubyObject)obj).m_inspect(); + } + + public VALUE rb_obj_is_instance_of(VALUE obj, VALUE c) { + return ((RubyObject)obj).m_instance_of((RubyModule)c); + } + + public VALUE rb_obj_is_kind_of(VALUE obj, VALUE c) { + return ((RubyObject)obj).m_kind_of((RubyModule)c); + } + + public VALUE rb_obj_dummy() { + return ruby.getNil(); + } + + public VALUE rb_obj_tainted(VALUE obj) { + return ((RubyObject)obj).m_tainted(); + } + + public VALUE rb_obj_taint(VALUE obj) { + return ((RubyObject)obj).m_taint(); + } + + public VALUE rb_obj_untaint(VALUE obj) { + return ((RubyObject)obj).m_untaint(); + } + + public VALUE rb_obj_freeze(VALUE obj) { + return ((RubyObject)obj).m_freeze(); + } + + public VALUE rb_obj_frozen_p(VALUE obj) { + return ((RubyObject)obj).m_frozen(); + } + + public VALUE rb_true(VALUE obj) { + return ruby.getTrue(); + } + + public VALUE rb_false(VALUE obj) { + return ruby.getFalse(); + } + + public VALUE rb_obj_alloc(VALUE klass) { + return null; + } + + public VALUE rb_mod_to_s(VALUE klass) { + return ((RubyModule)klass).m_to_s(); + } + + public VALUE rb_mod_eqq(VALUE mod, VALUE arg) { + return ((RubyModule)mod).op_eqq((RubyObject)arg); + } + + public VALUE rb_mod_le(VALUE mod, VALUE arg) { + return ((RubyModule)mod).op_le((RubyObject)arg); + } + + public VALUE rb_mod_lt(VALUE mod, VALUE arg) { + return ((RubyModule)mod).op_lt((RubyObject)arg); + } + + public VALUE rb_mod_ge(VALUE mod, VALUE arg) { + return ((RubyModule)mod).op_ge((RubyObject)arg); + } + + public VALUE rb_mod_gt(VALUE mod, VALUE arg) { + return ((RubyModule)mod).op_gt((RubyObject)arg); + } + + public VALUE rb_mod_cmp(VALUE mod, VALUE arg) { + return ((RubyModule)mod).op_cmp((RubyObject)arg); + } + + public VALUE rb_mod_initialize(VALUE[] argv) { + return ruby.getNil(); + } + + public VALUE rb_module_s_new(VALUE klass) { + return RubyModule.m_newModule(ruby, (RubyClass)klass); + } + + public VALUE rb_class_s_new(VALUE[] argv) { + return null; + } + + public VALUE rb_class_s_inherited() { + return null; + } + + public VALUE rb_class_superclass(VALUE klass) { + return null; + } + + public ID rb_to_id(VALUE name) { + return null; + } + + public VALUE rb_mod_attr(VALUE[] argv, VALUE klass) { + return ((RubyModule)klass).m_attr((RubySymbol)argv[0], argv.length > 1 ? (RubyBoolean)argv[1] : ruby.getFalse()); + } + + public VALUE rb_mod_attr_reader(VALUE[] argv, VALUE klass) { + return ((RubyModule)klass).m_attr_reader((RubyObject[])argv); + } + + public VALUE rb_mod_attr_writer(VALUE[] argv, VALUE klass) { + return ((RubyModule)klass).m_attr_writer((RubyObject[])argv); + } + + public VALUE rb_mod_attr_accessor(VALUE[] argv, VALUE klass) { + return ((RubyModule)klass).m_attr_accessor((RubyObject[])argv); + } + + public VALUE rb_mod_const_get(VALUE mod, VALUE name) { + return ((RubyModule)mod).m_const_get((RubySymbol)name); + } + + public VALUE rb_mod_const_set(VALUE mod, VALUE name, VALUE value) { + return ((RubyModule)mod).m_const_set((RubySymbol)name, (RubyObject)value); + } + + public VALUE rb_mod_const_defined(VALUE mod, VALUE name) { + return ((RubyModule)mod).m_const_defined((RubySymbol)name); + } + + public VALUE rb_obj_methods(VALUE obj) { + return ((RubyObject)obj).m_methods(); + } + + public VALUE rb_obj_protected_methods(VALUE obj) { + return ((RubyObject)obj).m_protected_methods(); + } + + public VALUE rb_obj_private_methods(VALUE obj) { + return ((RubyObject)obj).m_private_methods(); + } + + public VALUE rb_convert_type(VALUE val, int type, String tname, String method) { + return null; + } + + public VALUE rb_to_integer(VALUE val, String method) { + return null; + } + + public VALUE rb_to_int(VALUE val) { + return null; + } + + public VALUE rb_Integer(VALUE val) { + return null; + } + + public VALUE rb_f_integer(VALUE obj, VALUE arg) { + return null; + } + + public VALUE rb_Float(VALUE val) { + return null; + } + + public VALUE rb_f_float(VALUE obj, VALUE arg) { + return null; + } + + public double rb_num2dbl(VALUE val) { + return 0; + }; + + public String rb_str2cstr(VALUE str, int len) { + return null; + } + + public VALUE rb_String(VALUE val) { + return null; + } + + public VALUE rb_f_string(VALUE obj, VALUE arg) { + return null; + } + + public VALUE rb_Array(VALUE val) { + return null; + } + + public VALUE rb_f_array(VALUE obj, VALUE arg) { + return null; + } + + // + // array.c + // + + public VALUE rb_cArray() { + //return ruby.getArrayClass(); + return null; + } + + /** + * @deprecated throw UnsupportedOperationException. + */ + public void rb_mem_clear(VALUE mem, long size) { + throw new UnsupportedOperationException(); + } + + /** + * @deprecated throw UnsupportedOperationException. + */ + public void memfill(VALUE mem, long size, VALUE val) { + throw new UnsupportedOperationException(); + } + + public void rb_ary_modify(VALUE ary) { + ((RubyArray)ary).modify(); + } + + public VALUE rb_ary_freeze(VALUE ary) { + return rb_obj_freeze(ary); + } + + public VALUE rb_ary_frozen_p(VALUE ary) { + return ((RubyArray)ary).m_frozen(); + } + + public VALUE rb_ary_new2(long len) { + return RubyArray.m_newArray(ruby, len); + } + + public VALUE rb_ary_new() { + return RubyArray.m_newArray(ruby); + } + + public VALUE rb_ary_new3(long n, VALUE[] args) { + return null; + } + + public VALUE rb_ary_new4(long n, VALUE elts) { + return null; + } + + public VALUE rb_assoc_new(VALUE car, VALUE cdr) { + return null; + } + + public VALUE rb_ary_s_new(VALUE[] argv, VALUE klass) { + return null; + }; + + public VALUE rb_ary_initialize(VALUE[] argv, VALUE ary) { + return ((RubyArray)ary).m_initialize(argv.length > 0 ? (RubyFixnum)argv[0] : null, + argv.length > 1 ? (RubyObject)argv[1] : null); + } + + public VALUE rb_ary_s_create(VALUE[] argv, VALUE klass) { + return null; + } + + public void rb_ary_store(VALUE ary, long idx, VALUE val) { + ((RubyArray)ary).store(idx, (RubyObject)val); + } + + public VALUE rb_ary_push(VALUE ary, VALUE item) { + return ((RubyArray)ary).push((RubyObject)item); + } + + public VALUE rb_ary_push_m(VALUE[] argv, VALUE ary) { + return ((RubyArray)ary).m_push((RubyObject[])argv); + } + + public VALUE rb_ary_pop(VALUE ary) { + return ((RubyArray)ary).m_pop(); + } + + public VALUE rb_ary_shift(VALUE ary) { + return ((RubyArray)ary).m_shift(); + } + + public VALUE rb_ary_unshift(VALUE ary, VALUE item) { + return ((RubyArray)ary).unshift((RubyObject)item); + } + + public VALUE rb_ary_unshift_m(VALUE[] argv, VALUE ary) { + return ((RubyArray)ary).m_unshift((RubyObject[])argv); + } + + public VALUE rb_ary_entry(VALUE ary, long offset) { + return ((RubyArray)ary).entry(offset); + } + + public VALUE rb_ary_subseq(VALUE ary, long beg, long len) { + return ((RubyArray)ary).subseq(beg, len); + } + + public VALUE rb_ary_aref(VALUE[] argv, VALUE ary) { + return ((RubyArray)ary).m_slice((RubyObject[])argv); + } + + public VALUE rb_ary_at(VALUE ary, VALUE pos) { + return null; + } + + public VALUE rb_ary_first(VALUE ary) { + return null; + } + + public VALUE rb_ary_last(VALUE ary) { + return null; + } + + public VALUE rb_ary_index(VALUE ary, VALUE val) { + return null; + } + + public VALUE rb_ary_rindex(VALUE ary, VALUE val) { + return null; + } + + static VALUE rb_ary_indexes(VALUE[] argv, VALUE ary) { + return null; + } + + public void rb_ary_replace(VALUE ary, long beg, long len, VALUE rpl) { + } + + public VALUE rb_ary_aset(VALUE[] argv, VALUE ary) { + return null; + } + + public VALUE rb_ary_each(VALUE ary) { + return null; + } + + public VALUE rb_ary_each_index(VALUE ary) { + return null; + } + + public VALUE rb_ary_reverse_each(VALUE ary) { + return null; + } + + public VALUE rb_ary_length(VALUE ary) { + return null; + } + + public VALUE rb_ary_empty_p(VALUE ary) { + return null; + } + + public VALUE rb_ary_clone(VALUE ary) { + return null; + } + + public VALUE to_ary(VALUE ary) { + return null; + } + + public VALUE rb_output_fs() { + return null; + } + + public VALUE inspect_join(VALUE ary, VALUE[] arg) { + return null; + } + + public VALUE rb_ary_join(VALUE ary, VALUE sep) { + return null; + } + + public VALUE rb_ary_join_m(VALUE[] argv, VALUE ary) { + return null; + } + + public VALUE rb_ary_to_s(VALUE ary) { + return null; + } + + public VALUE inspect_ensure(VALUE obj) { + return null; + } + + public VALUE rb_protect_inspect(VALUE func, VALUE obj, VALUE arg) { + return null; + } + + public VALUE rb_inspecting_p(VALUE obj) { + return null; + } + + public VALUE inspect_ary(VALUE ary) { + return null; + } + + public VALUE rb_ary_inspect(VALUE ary) { + return null; + } + + public VALUE rb_ary_to_a(VALUE ary) { + return null; + } + + public VALUE rb_ary_reverse(VALUE ary) { + return null; + } + + public VALUE rb_ary_reverse_bang(VALUE ary) { + return null; + } + + public VALUE rb_ary_reverse_m(VALUE ary) { + return null; + } + + public VALUE rb_ary_sort_bang(VALUE ary) { + return null; + } + + public VALUE rb_ary_sort(VALUE ary) { + return null; + } + + public VALUE rb_ary_collect(VALUE ary) { + return null; + } + + public VALUE rb_ary_collect_bang(VALUE ary) { + return null; + } + + public VALUE rb_ary_filter(VALUE ary) { + return null; + } + + public VALUE rb_ary_delete(VALUE ary, VALUE item) { + return null; + } + + public VALUE rb_ary_delete_at(VALUE ary, long pos) { + return null; + } + + public VALUE rb_ary_delete_at_m(VALUE ary, VALUE pos) { + return null; + } + + public VALUE rb_ary_slice_bang(VALUE[] argv, VALUE ary) { + return null; + } + + public VALUE rb_ary_reject_bang(VALUE ary) { + return null; + } + + public VALUE rb_ary_delete_if(VALUE ary) { + return null; + } + + public VALUE rb_ary_replace_m(VALUE ary, VALUE ary2) { + return null; + } + + public VALUE rb_ary_clear(VALUE ary) { + return null; + } + + public VALUE rb_ary_fill(VALUE[] argv, VALUE ary) { + return null; + } + + public VALUE rb_ary_plus(VALUE x, VALUE y) { + return null; + } + + public VALUE rb_ary_concat(VALUE x, VALUE y) { + return null; + } + + public VALUE rb_ary_times(VALUE ary, VALUE times) { + return null; + } + + public VALUE rb_ary_assoc(VALUE ary, VALUE key) { + return null; + } + + public VALUE rb_ary_rassoc(VALUE ary, VALUE value) { + return null; + } + + public VALUE rb_ary_equal(VALUE ary1, VALUE ary2) { + return null; + } + + public VALUE rb_ary_eql(VALUE ary1, VALUE ary2) { + return null; + } + + public VALUE rb_ary_hash(VALUE ary) { + return null; + } + + public VALUE rb_ary_includes(VALUE ary, VALUE item) { + return ((RubyArray)ary).m_includes((RubyObject)item); + } + + public VALUE rb_ary_cmp(VALUE ary, VALUE ary2) { + return null; + } + + public VALUE rb_ary_diff(VALUE ary1, VALUE ary2) { + return null; + } + + public VALUE ary_make_hash(VALUE ary1, VALUE ary2) { + return null; + } + + public VALUE rb_ary_and(VALUE ary1, VALUE ary2) { + return null; + } + + public VALUE rb_ary_or(VALUE ary1, VALUE ary2) { + return null; + } + + public VALUE rb_ary_uniq_bang(VALUE ary) { + return null; + } + + public VALUE rb_ary_uniq(VALUE ary) { + return null; + } + + public VALUE rb_ary_compact_bang(VALUE ary) { + return null; + } + + public VALUE rb_ary_compact(VALUE ary) { + return null; + } + + public VALUE rb_ary_nitems(VALUE ary) { + return null; + } + + public VALUE rb_ary_flatten_bang(VALUE ary) { + return null; + } + + public VALUE rb_ary_flatten(VALUE ary) { + return null; + } + + // variable.c + + public VALUE rb_const_get(VALUE clazz, ID id) { + return ((RubyModule)clazz).getConstant((RubyId)id); + } + + public boolean rb_const_defined(VALUE clazz, ID id) { + return ((RubyModule)clazz).isConstantDefined((RubyId)id); + } +} \ No newline at end of file diff --git a/org/jruby/original/SCOPE.java b/org/jruby/original/SCOPE.java new file mode 100644 index 00000000000..087d4bae265 --- /dev/null +++ b/org/jruby/original/SCOPE.java @@ -0,0 +1,35 @@ +/* + * SCOPE.java - No description + * Created on 28. Juli 2001, 14:56 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.original; + +import org.jruby.*; + +public class SCOPE { + public RubyObject super_; + public ID[] local_tbl; + public VALUE[] local_vars; + public int flags; +} \ No newline at end of file diff --git a/org/jruby/original/Scope.java b/org/jruby/original/Scope.java new file mode 100644 index 00000000000..782f26a9edd --- /dev/null +++ b/org/jruby/original/Scope.java @@ -0,0 +1,46 @@ +/* + * Scope.java - No description + * Created on 10. September 2001, 17:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.original; + +/** + * + * @author jpetersen + * @version + */ +public interface Scope { + public static final int SCOPE_PUBLIC = 0; + public static final int SCOPE_PRIVATE = 1; + public static final int SCOPE_PROTECTED = 2; + public static final int SCOPE_MODFUNC = 5; + public static final int SCOPE_MASK = 7; + + public static final int NOEX_PUBLIC = 0; + public static final int NOEX_UNDEF = 1; + public static final int NOEX_CFUNC = 1; + public static final int NOEX_PRIVATE = 2; + public static final int NOEX_PROTECTED = 4; +} \ No newline at end of file diff --git a/org/jruby/original/VALUE.java b/org/jruby/original/VALUE.java new file mode 100644 index 00000000000..f8b3368fc1a --- /dev/null +++ b/org/jruby/original/VALUE.java @@ -0,0 +1,36 @@ +/* + * VALUE.java - No description + * Created on 09. Juli 2001, 21:38 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.original; + +/** + * + * @author jpetersen + */ +public interface VALUE { + +} + diff --git a/org/jruby/original/global_entry.java b/org/jruby/original/global_entry.java new file mode 100644 index 00000000000..5457d61c8dd --- /dev/null +++ b/org/jruby/original/global_entry.java @@ -0,0 +1,35 @@ +/* + * global_entry.java - No description + * Created on 10. September 2001, 17:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.original; + +/** + * + * @author jpetersen + * @version + */ +public interface global_entry extends VALUE{ +} \ No newline at end of file diff --git a/org/jruby/original/node_type.java b/org/jruby/original/node_type.java new file mode 100644 index 00000000000..482d0d17ebd --- /dev/null +++ b/org/jruby/original/node_type.java @@ -0,0 +1,134 @@ +/* + * node_type.java - No description + * Created on 10. September 2001, 17:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.original; + +public interface node_type { + final int NODE_METHOD =0; + final int NODE_FBODY =1; + final int NODE_CFUNC =2; + final int NODE_SCOPE =3; + final int NODE_BLOCK =4; + final int NODE_IF =5; + final int NODE_CASE =6; + final int NODE_WHEN =7; + final int NODE_OPT_N =8; + final int NODE_WHILE =9; + final int NODE_UNTIL =10; + final int NODE_ITER =11; + final int NODE_FOR =12; + final int NODE_BREAK =13; + final int NODE_NEXT =14; + final int NODE_REDO =15; + final int NODE_RETRY =16; + final int NODE_BEGIN =17; + final int NODE_RESCUE =18; + final int NODE_RESBODY =19; + final int NODE_ENSURE =20; + final int NODE_AND =21; + final int NODE_OR =22; + final int NODE_NOT =23; + final int NODE_MASGN =24; + final int NODE_LASGN =25; + final int NODE_DASGN =26; + final int NODE_DASGN_CURR =27; + final int NODE_GASGN =28; + final int NODE_IASGN =29; + final int NODE_CDECL =30; + final int NODE_CVASGN =31; + final int NODE_CVDECL =32; + final int NODE_OP_ASGN1 =33; + final int NODE_OP_ASGN2 =34; + final int NODE_OP_ASGN_AND =35; + final int NODE_OP_ASGN_OR =36; + final int NODE_CALL =37; + final int NODE_FCALL =38; + final int NODE_VCALL =39; + final int NODE_SUPER =40; + final int NODE_ZSUPER =41; + final int NODE_ARRAY =42; + final int NODE_ZARRAY =43; + final int NODE_HASH =44; + final int NODE_RETURN =45; + final int NODE_YIELD =46; + final int NODE_LVAR =47; + final int NODE_DVAR =48; + final int NODE_GVAR =49; + final int NODE_IVAR =50; + final int NODE_CONST =51; + final int NODE_CVAR =52; + final int NODE_CVAR2 =53; + final int NODE_NTH_REF =54; + final int NODE_BACK_REF =55; + final int NODE_MATCH =56; + final int NODE_MATCH2 =57; + final int NODE_MATCH3 =58; + final int NODE_LIT =59; + final int NODE_STR =60; + final int NODE_DSTR =61; + final int NODE_XSTR =62; + final int NODE_DXSTR =63; + final int NODE_EVSTR =64; + final int NODE_DREGX =65; + final int NODE_DREGX_ONCE =66; + final int NODE_ARGS =67; + final int NODE_ARGSCAT =68; + final int NODE_ARGSPUSH =69; + final int NODE_RESTARGS =70; + final int NODE_RESTARY =71; + final int NODE_REXPAND =72; + final int NODE_BLOCK_ARG =73; + final int NODE_BLOCK_PASS =74; + final int NODE_DEFN =75; + final int NODE_DEFS =76; + final int NODE_ALIAS =77; + final int NODE_VALIAS =78; + final int NODE_UNDEF =79; + final int NODE_CLASS =80; + final int NODE_MODULE =81; + final int NODE_SCLASS =82; + final int NODE_COLON2 =83; + final int NODE_COLON3 =84; + final int NODE_CREF =85; + final int NODE_DOT2 =86; + final int NODE_DOT3 =87; + final int NODE_FLIP2 =88; + final int NODE_FLIP3 =89; + final int NODE_ATTRSET =90; + final int NODE_SELF =91; + final int NODE_NIL =92; + final int NODE_TRUE =93; + final int NODE_FALSE =94; + final int NODE_DEFINED =95; + final int NODE_NEWLINE =96; + final int NODE_POSTEXE =97; + final int NODE_ALLOCA =98; + final int NODE_DMETHOD =99; + final int NODE_BMETHOD =100; + final int NODE_MEMO =101; + final int NODE_IFUNC =102; + final int NODE_LAST =103; +} \ No newline at end of file diff --git a/org/jruby/original/st_table.java b/org/jruby/original/st_table.java new file mode 100644 index 00000000000..168d1f869d4 --- /dev/null +++ b/org/jruby/original/st_table.java @@ -0,0 +1,36 @@ +/* + * st_table.java - No description + * Created on 09. Juli 2001, 21:38 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.original; + +/** + * + * @author jpetersen + */ +public interface st_table { + +} + diff --git a/org/jruby/original/token.java b/org/jruby/original/token.java new file mode 100644 index 00000000000..934f5a5dc96 --- /dev/null +++ b/org/jruby/original/token.java @@ -0,0 +1,225 @@ +/* + * token.java - No description + * Created on 10. September 2001, 17:53 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.original; + +public interface token { + + public static final int kCLASS =257; + + public static final int kMODULE =258; + + public static final int kDEF =259; + + public static final int kUNDEF =260; + + public static final int kBEGIN =261; + + public static final int kRESCUE =262; + + public static final int kENSURE =263; + + public static final int kEND =264; + + public static final int kIF =265; + + public static final int kUNLESS =266; + + public static final int kTHEN =267; + + public static final int kELSIF =268; + + public static final int kELSE =269; + + public static final int kCASE =270; + + public static final int kWHEN =271; + + public static final int kWHILE =272; + + public static final int kUNTIL =273; + + public static final int kFOR =274; + + public static final int kBREAK =275; + + public static final int kNEXT =276; + + public static final int kREDO =277; + + public static final int kRETRY =278; + + public static final int kIN =279; + + public static final int kDO =280; + + public static final int kDO_COND =281; + + public static final int kDO_BLOCK =282; + + public static final int kRETURN =283; + + public static final int kYIELD =284; + + public static final int kSUPER =285; + + public static final int kSELF =286; + + public static final int kNIL =287; + + public static final int kTRUE =288; + + public static final int kFALSE =289; + + public static final int kAND =290; + + public static final int kOR =291; + + public static final int kNOT =292; + + public static final int kIF_MOD =293; + + public static final int kUNLESS_MOD =294; + + public static final int kWHILE_MOD =295; + + public static final int kUNTIL_MOD =296; + + public static final int kRESCUE_MOD =297; + + public static final int kALIAS =298; + + public static final int kDEFINED =299; + + public static final int klBEGIN =300; + + public static final int klEND =301; + + public static final int k__LINE__ =302; + + public static final int k__FILE__ =303; + + public static final int tIDENTIFIER =304; + + public static final int tFID =305; + + public static final int tGVAR =306; + + public static final int tIVAR =307; + + public static final int tCONSTANT =308; + + public static final int tCVAR =309; + + public static final int tINTEGER =310; + + public static final int tFLOAT =311; + + public static final int tSTRING =312; + + public static final int tXSTRING =313; + + public static final int tREGEXP =314; + + public static final int tDSTRING =315; + + public static final int tDXSTRING =316; + + public static final int tDREGEXP =317; + + public static final int tNTH_REF =318; + + public static final int tBACK_REF =319; + + public static final int tUPLUS =320; + + public static final int tUMINUS =321; + + public static final int tPOW =322; + + public static final int tCMP =323; + + public static final int tEQ =324; + + public static final int tEQQ =325; + + public static final int tNEQ =326; + + public static final int tGEQ =327; + + public static final int tLEQ =328; + + public static final int tANDOP =329; + + public static final int tOROP =330; + + public static final int tMATCH =331; + + public static final int tNMATCH =332; + + public static final int tDOT2 =333; + + public static final int tDOT3 =334; + + public static final int tAREF =335; + + public static final int tASET =336; + + public static final int tLSHFT =337; + + public static final int tRSHFT =338; + + public static final int tCOLON2 =339; + + public static final int tCOLON3 =340; + + public static final int tOP_ASGN =341; + + public static final int tASSOC =342; + + public static final int tLPAREN =343; + + public static final int tLPAREN_ARG =344; + + public static final int tRPAREN =345; + + public static final int tLBRACK =346; + + public static final int tLBRACE =347; + + public static final int tLBRACE_ARG =348; + + public static final int tSTAR =349; + + public static final int tAMPER =350; + + public static final int tSYMBEG =351; + + public static final int LAST_TOKEN =352; + + public static final int yyErrorCode =256; + +} + diff --git a/org/jruby/parser/.nbattrs b/org/jruby/parser/.nbattrs new file mode 100644 index 00000000000..bf6587d8100 --- /dev/null +++ b/org/jruby/parser/.nbattrs @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org/jruby/parser/kwtable.java b/org/jruby/parser/kwtable.java new file mode 100644 index 00000000000..73105e466c0 --- /dev/null +++ b/org/jruby/parser/kwtable.java @@ -0,0 +1,165 @@ +/* + * kwtable.java - No description + * Created on 10. September 2001, 17:51 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.parser; + +import org.jruby.original.*; + +public class kwtable implements lex_state, token { + + String name; + int id0, id1; + /*enum lex_state*/int state; + + private kwtable() { + this("", 0, 0, 0); + } + + private kwtable(String name, int id0, int id1, int state) { + this.name = name; + this.id0 = id0; + this.id1 = id1; + this.state = state; + } + + private static final int TOTAL_KEYWORDS = 40; + private static final int MIN_WORD_LENGTH = 2; + private static final int MAX_WORD_LENGTH = 8; + private static final int MIN_HASH_VALUE = 6; + private static final int MAX_HASH_VALUE = 55; + + private static final byte asso_values[] = { + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 11, 56, 56, 36, 56, 1, 37, + 31, 1, 56, 56, 56, 56, 29, 56, 1, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 1, 56, 32, 1, 2, + 1, 1, 4, 23, 56, 17, 56, 20, 9, 2, + 9, 26, 14, 56, 5, 1, 1, 16, 56, 21, + 20, 9, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56 + }; + + private static int hash(String str, int len) { + int hval = len; + switch (hval) { + default: + case 3: + hval += asso_values[str.charAt(2) & 255]; + case 2: + case 1: + hval += asso_values[str.charAt(0) & 255]; + break; + } + return hval + asso_values[str.charAt(len - 1) & 255]; + } + + private static final kwtable[] wordlist = { + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable("end", kEND, kEND, EXPR_END), + new kwtable("else", kELSE, kELSE, EXPR_BEG), + new kwtable("case", kCASE, kCASE, EXPR_BEG), + new kwtable("ensure", kENSURE, kENSURE, EXPR_BEG), + new kwtable("module", kMODULE, kMODULE, EXPR_BEG), + new kwtable("elsif", kELSIF, kELSIF, EXPR_BEG), + new kwtable("def", kDEF, kDEF, EXPR_FNAME), + new kwtable("rescue", kRESCUE, kRESCUE_MOD, EXPR_END), + new kwtable("not", kNOT, kNOT, EXPR_BEG), + new kwtable("then", kTHEN, kTHEN, EXPR_BEG), + new kwtable("yield", kYIELD, kYIELD, EXPR_ARG), + new kwtable("for", kFOR, kFOR, EXPR_BEG), + new kwtable("self", kSELF, kSELF, EXPR_END), + new kwtable("false", kFALSE, kFALSE, EXPR_END), + new kwtable("retry", kRETRY, kRETRY, EXPR_END), + new kwtable("return", kRETURN, kRETURN, EXPR_MID), + new kwtable("true", kTRUE, kTRUE, EXPR_END), + new kwtable("if", kIF, kIF_MOD, EXPR_BEG), + new kwtable("defined?", kDEFINED, kDEFINED, EXPR_ARG), + new kwtable("super", kSUPER, kSUPER, EXPR_ARG), + new kwtable("undef", kUNDEF, kUNDEF, EXPR_FNAME), + new kwtable("break", kBREAK, kBREAK, EXPR_END), + new kwtable("in", kIN, kIN, EXPR_BEG), + new kwtable("do", kDO, kDO, EXPR_BEG), + new kwtable("nil", kNIL, kNIL, EXPR_END), + new kwtable("until", kUNTIL, kUNTIL_MOD, EXPR_BEG), + new kwtable("unless", kUNLESS, kUNLESS_MOD, EXPR_BEG), + new kwtable("or", kOR, kOR, EXPR_BEG), + new kwtable("next", kNEXT, kNEXT, EXPR_END), + new kwtable("when", kWHEN, kWHEN, EXPR_BEG), + new kwtable("redo", kREDO, kREDO, EXPR_END), + new kwtable("and", kAND, kAND, EXPR_BEG), + new kwtable("begin", kBEGIN, kBEGIN, EXPR_BEG), + new kwtable("__LINE__", k__LINE__, k__LINE__, EXPR_END), + new kwtable("class", kCLASS, kCLASS, EXPR_CLASS), + new kwtable("__FILE__", k__FILE__, k__FILE__, EXPR_END), + new kwtable("END", klEND, klEND, EXPR_END), + new kwtable("BEGIN", klBEGIN, klBEGIN, EXPR_END), + new kwtable("while", kWHILE, kWHILE_MOD, EXPR_BEG), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable(), + new kwtable("alias", kALIAS, kALIAS, EXPR_FNAME) + }; + + public static kwtable rb_reserved_word(String str, int len) { + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { + int key = hash(str, len); + if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) { + if (str.equals(wordlist[key].name)) + return wordlist[key]; + } + } + return null; + } +} \ No newline at end of file diff --git a/org/jruby/parser/lex_state.java b/org/jruby/parser/lex_state.java new file mode 100644 index 00000000000..a9da69fc5c6 --- /dev/null +++ b/org/jruby/parser/lex_state.java @@ -0,0 +1,49 @@ +/* + * lex_state.java - No description + * Created on 10. September 2001, 17:51 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.parser; + +public interface lex_state { + + final int EXPR_BEG =0; + + final int EXPR_END =1; + + final int EXPR_ARG =2; + + final int EXPR_CMDARG =3; + + final int EXPR_ENDARG =4; + + final int EXPR_MID =5; + + final int EXPR_FNAME =6; + + final int EXPR_DOT =7; + + final int EXPR_CLASS =8; + +} + diff --git a/org/jruby/parser/parse.java b/org/jruby/parser/parse.java new file mode 100644 index 00000000000..70e78958b7e --- /dev/null +++ b/org/jruby/parser/parse.java @@ -0,0 +1,6565 @@ +/* + * parse.java - No description + * Created on 10. September 2001, 17:51 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.parser; + +// created by jay 0.7 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de + + // line 5 "parse.y" +import java.util.*; +import java.io.*; + +import org.jruby.*; +import org.jruby.original.*; + +public class parse /*extends Ruby*/ implements lex_state, node_type, re_options { + private NODE ruby_eval_tree_begin; + private NODE ruby_eval_tree; + + private String ruby_sourcefile; // current source file + private int ruby_sourceline; // current line no. + + private /*lex_state*/int lex_state; + + private int class_nest; + private int in_single; + private int in_def; + private boolean compile_for_eval; + private ID cur_mid; + + private boolean in_defined; + + //XXX global variables + private RVarmap ruby_dyna_vars; + private VALUE ruby_class; + private Hashtable rb_global_tbl = new Hashtable(); + + // jruby + private Ruby ruby; // Runtime + private RubyOriginalMethods rom; // C rb_* methods + + private VALUE rb_cObject; + + public parse(Ruby ruby) { + this.ruby = ruby; + this.rom = ruby.getOriginalMethods(); + + rb_cObject = ruby.getObjectClass(); + } + + private long cond_stack; + + private void COND_PUSH(int i) { + cond_stack <<= 1; + cond_stack |= i & 1; + } + + private void COND_POP() { + cond_stack >>>= 1; + } + + private void COND_LEXPOP() { + boolean last = COND_P(); + cond_stack >>= 1; + if (last) cond_stack |= 1; + } + + private boolean COND_P() { + return (cond_stack & 1) == 1; + } + + private long cmdarg_stack; + + void CMDARG_PUSH(int i) { + cmdarg_stack <<= 1; + cmdarg_stack |= i & 1; + } + + private void CMDARG_POP() { + cmdarg_stack >>= 1; + } + + private void CMDARG_LEXPOP() { + boolean last = CMDARG_P(); + cmdarg_stack >>= 1; + if (last) cmdarg_stack |= 1; + } + + private boolean CMDARG_P() { + return (cmdarg_stack & 1) == 1; + } +/* +%union { + NODE *node; + VALUE val; + ID id; + int num; + struct RVarmap *vars; +} +*/ + // line 124 "-" +// %token constants + + public static final int kCLASS = 257; + public static final int kMODULE = 258; + public static final int kDEF = 259; + public static final int kUNDEF = 260; + public static final int kBEGIN = 261; + public static final int kRESCUE = 262; + public static final int kENSURE = 263; + public static final int kEND = 264; + public static final int kIF = 265; + public static final int kUNLESS = 266; + public static final int kTHEN = 267; + public static final int kELSIF = 268; + public static final int kELSE = 269; + public static final int kCASE = 270; + public static final int kWHEN = 271; + public static final int kWHILE = 272; + public static final int kUNTIL = 273; + public static final int kFOR = 274; + public static final int kBREAK = 275; + public static final int kNEXT = 276; + public static final int kREDO = 277; + public static final int kRETRY = 278; + public static final int kIN = 279; + public static final int kDO = 280; + public static final int kDO_COND = 281; + public static final int kDO_BLOCK = 282; + public static final int kRETURN = 283; + public static final int kYIELD = 284; + public static final int kSUPER = 285; + public static final int kSELF = 286; + public static final int kNIL = 287; + public static final int kTRUE = 288; + public static final int kFALSE = 289; + public static final int kAND = 290; + public static final int kOR = 291; + public static final int kNOT = 292; + public static final int kIF_MOD = 293; + public static final int kUNLESS_MOD = 294; + public static final int kWHILE_MOD = 295; + public static final int kUNTIL_MOD = 296; + public static final int kRESCUE_MOD = 297; + public static final int kALIAS = 298; + public static final int kDEFINED = 299; + public static final int klBEGIN = 300; + public static final int klEND = 301; + public static final int k__LINE__ = 302; + public static final int k__FILE__ = 303; + public static final int tIDENTIFIER = 304; + public static final int tFID = 305; + public static final int tGVAR = 306; + public static final int tIVAR = 307; + public static final int tCONSTANT = 308; + public static final int tCVAR = 309; + public static final int tINTEGER = 310; + public static final int tFLOAT = 311; + public static final int tSTRING = 312; + public static final int tXSTRING = 313; + public static final int tREGEXP = 314; + public static final int tDSTRING = 315; + public static final int tDXSTRING = 316; + public static final int tDREGEXP = 317; + public static final int tNTH_REF = 318; + public static final int tBACK_REF = 319; + public static final int tUPLUS = 320; + public static final int tUMINUS = 321; + public static final int tPOW = 322; + public static final int tCMP = 323; + public static final int tEQ = 324; + public static final int tEQQ = 325; + public static final int tNEQ = 326; + public static final int tGEQ = 327; + public static final int tLEQ = 328; + public static final int tANDOP = 329; + public static final int tOROP = 330; + public static final int tMATCH = 331; + public static final int tNMATCH = 332; + public static final int tDOT2 = 333; + public static final int tDOT3 = 334; + public static final int tAREF = 335; + public static final int tASET = 336; + public static final int tLSHFT = 337; + public static final int tRSHFT = 338; + public static final int tCOLON2 = 339; + public static final int tCOLON3 = 340; + public static final int tOP_ASGN = 341; + public static final int tASSOC = 342; + public static final int tLPAREN = 343; + public static final int tLPAREN_ARG = 344; + public static final int tRPAREN = 345; + public static final int tLBRACK = 346; + public static final int tLBRACE = 347; + public static final int tLBRACE_ARG = 348; + public static final int tSTAR = 349; + public static final int tAMPER = 350; + public static final int tSYMBEG = 351; + public static final int LAST_TOKEN = 352; + public static final int yyErrorCode = 256; + + /** thrown for irrecoverable syntax errors and stack overflow. + */ + public static class yyException extends java.lang.Exception { + public yyException (String message) { + super(message); + } + } + + /** must be implemented by a scanner object to supply input to the parser. + */ + public interface yyInput { + /** move on to next token. + @return false if positioned beyond tokens. + @throws IOException on input error. + */ + boolean advance () throws java.io.IOException; + /** classifies current token. + Should not be called if advance() returned false. + @return current %token or single character. + */ + int token (); + /** associated with current token. + Should not be called if advance() returned false. + @return value for token(). + */ + Object value (); + } + + /** simplified error message. + @see yyerror + */ + public void yyerror (String message) { + yyerror(message, null); + } + + /** (syntax) error message. + Can be overwritten to control message format. + @param message text to be displayed. + @param expected vector of acceptable tokens, if available. + */ + public void yyerror (String message, String[] expected) { + if (expected != null && expected.length > 0) { + System.err.print(message+", expecting"); + for (int n = 0; n < expected.length; ++ n) + System.err.print(" "+expected[n]); + System.err.println(); + } else + System.err.println(message); + } + + /** debugging support, requires the package jay.yydebug. + Set to null to suppress debugging messages. + */ + + protected static final int yyFinal = 1; + protected static final String yyName [] = { + "end-of-file",null,null,null,null,null,null,null,null,null,"'\\n'", + 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, + 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,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,"kCLASS","kMODULE","kDEF","kUNDEF","kBEGIN","kRESCUE","kENSURE", + "kEND","kIF","kUNLESS","kTHEN","kELSIF","kELSE","kCASE","kWHEN", + "kWHILE","kUNTIL","kFOR","kBREAK","kNEXT","kREDO","kRETRY","kIN", + "kDO","kDO_COND","kDO_BLOCK","kRETURN","kYIELD","kSUPER","kSELF", + "kNIL","kTRUE","kFALSE","kAND","kOR","kNOT","kIF_MOD","kUNLESS_MOD", + "kWHILE_MOD","kUNTIL_MOD","kRESCUE_MOD","kALIAS","kDEFINED","klBEGIN", + "klEND","k__LINE__","k__FILE__","tIDENTIFIER","tFID","tGVAR","tIVAR", + "tCONSTANT","tCVAR","tINTEGER","tFLOAT","tSTRING","tXSTRING", + "tREGEXP","tDSTRING","tDXSTRING","tDREGEXP","tNTH_REF","tBACK_REF", + "tUPLUS","tUMINUS","tPOW","tCMP","tEQ","tEQQ","tNEQ","tGEQ","tLEQ", + "tANDOP","tOROP","tMATCH","tNMATCH","tDOT2","tDOT3","tAREF","tASET", + "tLSHFT","tRSHFT","tCOLON2","tCOLON3","tOP_ASGN","tASSOC","tLPAREN", + "tLPAREN_ARG","tRPAREN","tLBRACK","tLBRACE","tLBRACE_ARG","tSTAR", + "tAMPER","tSYMBEG","LAST_TOKEN", + }; + + /** index-checked interface to yyName[]. + @param token single character or %token value. + @return token name or [illegal] or [unknown]. + */ + + /** computes list of expected tokens on error by tracing the tables. + @param state for which to compute the list. + @return list of token names. + */ + protected String[] yyExpecting (int state) { + int token, n, len = 0; + boolean[] ok = new boolean[yyName.length]; + + if ((n = yySindex[state]) != 0) + for (token = n < 0 ? -n : 0; + token < yyName.length && n+token < yyTable.length; ++ token) + if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) { + ++ len; + ok[token] = true; + } + if ((n = yyRindex[state]) != 0) + for (token = n < 0 ? -n : 0; + token < yyName.length && n+token < yyTable.length; ++ token) + if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) { + ++ len; + ok[token] = true; + } + + String result[] = new String[len]; + for (n = token = 0; n < len; ++ token) + if (ok[token]) result[n++] = yyName[token]; + return result; + } + + /** the generated parser, with debugging messages. + Maintains a state and a value stack, currently with fixed maximum size. + @param yyLex scanner. + @param yydebug debug message writer implementing yyDebug, or null. + @return result of the last reduction, if any. + @throws yyException on irrecoverable parse error. + */ + public Object yyparse (yyInput yyLex, Object yydebug) + throws java.io.IOException, yyException { + return yyparse(yyLex); + } + + /** initial size and increment of the state/value stack [default 256]. + This is not final so that it can be overwritten outside of invocations + of yyparse(). + */ + protected int yyMax; + + /** executed at the beginning of a reduce action. + Used as $$ = yyDefault($1), prior to the user-specified action, if any. + Can be overwritten to provide deep copy, etc. + @param first value for $1, or null. + @return first. + */ + protected Object yyDefault (Object first) { + return first; + } + + /** the generated parser. + Maintains a state and a value stack, currently with fixed maximum size. + @param yyLex scanner. + @return result of the last reduction, if any. + @throws yyException on irrecoverable parse error. + */ + public Object yyparse (yyInput yyLex) + throws java.io.IOException, yyException { + if (yyMax <= 0) yyMax = 256; // initial size + int yyState = 0, yyStates[] = new int[yyMax]; // state stack + Object yyVal = null, yyVals[] = new Object[yyMax]; // value stack + int yyToken = -1; // current input + int yyErrorFlag = 0; // #tks to shift + + yyLoop: for (int yyTop = 0;; ++ yyTop) { + if (yyTop >= yyStates.length) { // dynamically increase + int[] i = new int[yyStates.length+yyMax]; + System.arraycopy(yyStates, 0, i, 0, yyStates.length); + yyStates = i; + Object[] o = new Object[yyVals.length+yyMax]; + System.arraycopy(yyVals, 0, o, 0, yyVals.length); + yyVals = o; + } + yyStates[yyTop] = yyState; + yyVals[yyTop] = yyVal; + + yyDiscarded: for (;;) { // discarding a token does not change stack + int yyN; + if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN) + if (yyToken < 0) { + yyToken = yyLex.advance() ? yyLex.token() : 0; + } + if ((yyN = yySindex[yyState]) != 0 && (yyN += yyToken) >= 0 + && yyN < yyTable.length && yyCheck[yyN] == yyToken) { + yyState = yyTable[yyN]; // shift to yyN + yyVal = yyLex.value(); + yyToken = -1; + if (yyErrorFlag > 0) -- yyErrorFlag; + continue yyLoop; + } + if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0 + && yyN < yyTable.length && yyCheck[yyN] == yyToken) + yyN = yyTable[yyN]; // reduce (yyN) + else + switch (yyErrorFlag) { + + case 0: + yyerror("syntax error", yyExpecting(yyState)); + + case 1: case 2: + yyErrorFlag = 3; + do { + if ((yyN = yySindex[yyStates[yyTop]]) != 0 + && (yyN += yyErrorCode) >= 0 && yyN < yyTable.length + && yyCheck[yyN] == yyErrorCode) { + yyState = yyTable[yyN]; + yyVal = yyLex.value(); + continue yyLoop; + } + } while (-- yyTop >= 0); + throw new yyException("irrecoverable syntax error"); + + case 3: + if (yyToken == 0) { + throw new yyException("irrecoverable syntax error at end-of-file"); + } + yyToken = -1; + continue yyDiscarded; // leave stack alone + } + } + int yyV = yyTop + 1-yyLen[yyN]; + yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]); + switch (yyN) { +case 1: + // line 246 "parse.y" + { + yyVal = ruby_dyna_vars; + lex_state = EXPR_BEG; + top_local_init(); + if ((VALUE)ruby_class == rb_cObject) class_nest = 0; + else class_nest = 1; + } + break; +case 2: + // line 254 "parse.y" + { + if (((NODE)yyVals[0+yyTop]) != null && !compile_for_eval) { + /* last expression should not be void */ + if (nd_type(((NODE)yyVals[0+yyTop])) != NODE.NODE_BLOCK) void_expr(((NODE)yyVals[0+yyTop])); + else { + NODE node = ((NODE)yyVals[0+yyTop]); + while (node.nd_next() != null) { + node = node.nd_next(); + } + void_expr(node.nd_head()); + } + } + ruby_eval_tree = block_append(ruby_eval_tree, ((NODE)yyVals[0+yyTop])); + top_local_setup(); + class_nest = 0; + ruby_dyna_vars = ((RVarmap)yyVals[-1+yyTop]); + } + break; +case 3: + // line 273 "parse.y" + { + void_stmts(((NODE)yyVals[-1+yyTop])); + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 5: + // line 280 "parse.y" + { + yyVal = newline_node(((NODE)yyVals[0+yyTop])); + } + break; +case 6: + // line 284 "parse.y" + { + yyVal = block_append(((NODE)yyVals[-2+yyTop]), newline_node(((NODE)yyVals[0+yyTop]))); + } + break; +case 7: + // line 288 "parse.y" + { + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 8: + // line 292 "parse.y" + {lex_state = EXPR_FNAME;} + break; +case 9: + // line 293 "parse.y" + { + if (in_def!=0 || in_single!=0) + yyerror("alias within method"); + yyVal = NEW_ALIAS(((ID)yyVals[-2+yyTop]), ((ID)yyVals[0+yyTop])); + } + break; +case 10: + // line 299 "parse.y" + { + if (in_def!=0 || in_single!=0) + yyerror("alias within method"); + yyVal = NEW_VALIAS(((ID)yyVals[-1+yyTop]), ((ID)yyVals[0+yyTop])); + } + break; +case 11: + // line 305 "parse.y" + { + if (in_def!=0 || in_single!=0) + yyerror("alias within method"); + String buf = "$" + (char)((NODE)yyVals[0+yyTop]).nd_nth(); + yyVal = NEW_VALIAS(((ID)yyVals[-1+yyTop]), ID.rb_intern(buf, ruby)); + } + break; +case 12: + // line 312 "parse.y" + { + yyerror("can't make alias for the number variables"); + yyVal = null; /*XXX 0*/ + } + break; +case 13: + // line 317 "parse.y" + { + if (in_def!=0 || in_single!=0) + yyerror("undef within method"); + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 14: + // line 323 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = NEW_IF(cond(((NODE)yyVals[0+yyTop])), ((NODE)yyVals[-2+yyTop]), null); + fixpos(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 15: + // line 329 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = NEW_UNLESS(cond(((NODE)yyVals[0+yyTop])), ((NODE)yyVals[-2+yyTop]), null); + fixpos(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 16: + // line 335 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + if (((NODE)yyVals[-2+yyTop]) != null && nd_type(((NODE)yyVals[-2+yyTop])) == NODE.NODE_BEGIN) { + yyVal = NEW_WHILE(cond(((NODE)yyVals[0+yyTop])), ((NODE)yyVals[-2+yyTop]).nd_body(), 0); + } + else { + yyVal = NEW_WHILE(cond(((NODE)yyVals[0+yyTop])), ((NODE)yyVals[-2+yyTop]), 1); + } + } + break; +case 17: + // line 345 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + if (((NODE)yyVals[-2+yyTop]) != null && nd_type(((NODE)yyVals[-2+yyTop])) == NODE.NODE_BEGIN) { + yyVal = NEW_UNTIL(cond(((NODE)yyVals[0+yyTop])), ((NODE)yyVals[-2+yyTop]).nd_body(), 0); + } + else { + yyVal = NEW_UNTIL(cond(((NODE)yyVals[0+yyTop])), ((NODE)yyVals[-2+yyTop]), 1); + } + } + break; +case 18: + // line 355 "parse.y" + { + yyVal = NEW_RESCUE(((NODE)yyVals[-2+yyTop]), NEW_RESBODY(null,((NODE)yyVals[0+yyTop]),null), null); + } + break; +case 19: + // line 359 "parse.y" + { + if (in_def!=0 || in_single!=0) { + yyerror("BEGIN in method"); + } + local_push(); + } + break; +case 20: + // line 366 "parse.y" + { + ruby_eval_tree_begin = block_append(ruby_eval_tree_begin, + NEW_PREEXE(((NODE)yyVals[-1+yyTop]))); + local_pop(); + yyVal = null; /*XXX 0;*/ + } + break; +case 21: + // line 373 "parse.y" + { + if (compile_for_eval && (in_def!=0 || in_single!=0)) { + yyerror("END in method; use at_exit"); + } + + yyVal = NEW_ITER(null, NEW_POSTEXE(), ((NODE)yyVals[-1+yyTop])); + } + break; +case 22: + // line 381 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = node_assign(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 23: + // line 386 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + ((NODE)yyVals[-2+yyTop]).nd_value((NODE)yyVals[0+yyTop]); + yyVal = ((NODE)yyVals[-2+yyTop]); + } + break; +case 24: + // line 392 "parse.y" + { + yyVal = node_assign(((NODE)yyVals[-2+yyTop]), NEW_REXPAND(((NODE)yyVals[0+yyTop]))); + } + break; +case 25: + // line 396 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + ((NODE)yyVals[-2+yyTop]).nd_value((NODE)yyVals[0+yyTop]); + yyVal = ((NODE)yyVals[-2+yyTop]); + } + break; +case 27: + // line 404 "parse.y" + { + if (!compile_for_eval && in_def==0 && in_single==0) + yyerror("return appeared outside of method"); + yyVal = NEW_RETURN(ret_args(((NODE)yyVals[0+yyTop]))); + } + break; +case 28: + // line 410 "parse.y" + { + yyVal = NEW_BREAK(ret_args(((NODE)yyVals[0+yyTop]))); + } + break; +case 29: + // line 414 "parse.y" + { + yyVal = NEW_NEXT(ret_args(((NODE)yyVals[0+yyTop]))); + } + break; +case 31: + // line 419 "parse.y" + { + yyVal = logop(NODE.NODE_AND, ((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 32: + // line 423 "parse.y" + { + yyVal = logop(NODE.NODE_OR, ((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 33: + // line 427 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = NEW_NOT(cond(((NODE)yyVals[0+yyTop]))); + } + break; +case 34: + // line 432 "parse.y" + { + yyVal = NEW_NOT(cond(((NODE)yyVals[0+yyTop]))); + } + break; +case 39: + // line 442 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = new_call(((NODE)yyVals[-3+yyTop]), ((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 40: + // line 447 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = new_call(((NODE)yyVals[-3+yyTop]), ((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 41: + // line 453 "parse.y" + { + yyVal = new_fcall(((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 42: + // line 458 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = new_call(((NODE)yyVals[-3+yyTop]), ((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-3+yyTop])); + } + break; +case 43: + // line 464 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = new_call(((NODE)yyVals[-3+yyTop]), ((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-3+yyTop])); + } + break; +case 44: + // line 470 "parse.y" + { + if (!compile_for_eval && in_def==0 && in_single==0) + yyerror("super called outside of method"); + yyVal = new_super(((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 45: + // line 477 "parse.y" + { + yyVal = NEW_YIELD(ret_args(((NODE)yyVals[0+yyTop]))); + fixpos(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 47: + // line 484 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 49: + // line 490 "parse.y" + { + yyVal = NEW_MASGN(NEW_LIST(((NODE)yyVals[-1+yyTop])), null); + } + break; +case 50: + // line 495 "parse.y" + { + yyVal = NEW_MASGN(((NODE)yyVals[0+yyTop]), null); + } + break; +case 51: + // line 499 "parse.y" + { + yyVal = NEW_MASGN(list_append(((NODE)yyVals[-1+yyTop]),((NODE)yyVals[0+yyTop])), null); + } + break; +case 52: + // line 503 "parse.y" + { + yyVal = NEW_MASGN(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 53: + // line 507 "parse.y" + { + yyVal = NEW_MASGN(((NODE)yyVals[-1+yyTop]), NODE.MINUS_ONE); + } + break; +case 54: + // line 511 "parse.y" + { + yyVal = NEW_MASGN(null, ((NODE)yyVals[0+yyTop])); + } + break; +case 55: + // line 515 "parse.y" + { + yyVal = NEW_MASGN(null, NODE.MINUS_ONE); + } + break; +case 57: + // line 521 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 58: + // line 526 "parse.y" + { + yyVal = NEW_LIST(((NODE)yyVals[-1+yyTop])); + } + break; +case 59: + // line 530 "parse.y" + { + yyVal = list_append(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[-1+yyTop])); + } + break; +case 60: + // line 535 "parse.y" + { + yyVal = assignable(((ID)yyVals[0+yyTop]), null); + } + break; +case 61: + // line 539 "parse.y" + { + yyVal = aryset(((NODE)yyVals[-3+yyTop]), ((NODE)yyVals[-1+yyTop])); + } + break; +case 62: + // line 543 "parse.y" + { + yyVal = attrset(((NODE)yyVals[-2+yyTop]), ((ID)yyVals[0+yyTop])); + } + break; +case 63: + // line 547 "parse.y" + { + yyVal = attrset(((NODE)yyVals[-2+yyTop]), ((ID)yyVals[0+yyTop])); + } + break; +case 64: + // line 551 "parse.y" + { + yyVal = attrset(((NODE)yyVals[-2+yyTop]), ((ID)yyVals[0+yyTop])); + } + break; +case 65: + // line 555 "parse.y" + { + rb_backref_error(((NODE)yyVals[0+yyTop])); + yyVal = null; /*XXX 0;*/ + } + break; +case 66: + // line 561 "parse.y" + { + yyVal = assignable(((ID)yyVals[0+yyTop]), null); + } + break; +case 67: + // line 565 "parse.y" + { + yyVal = aryset(((NODE)yyVals[-3+yyTop]), ((NODE)yyVals[-1+yyTop])); + } + break; +case 68: + // line 569 "parse.y" + { + yyVal = attrset(((NODE)yyVals[-2+yyTop]), ((ID)yyVals[0+yyTop])); + } + break; +case 69: + // line 573 "parse.y" + { + yyVal = attrset(((NODE)yyVals[-2+yyTop]), ((ID)yyVals[0+yyTop])); + } + break; +case 70: + // line 577 "parse.y" + { + yyVal = attrset(((NODE)yyVals[-2+yyTop]), ((ID)yyVals[0+yyTop])); + } + break; +case 71: + // line 581 "parse.y" + { + rb_backref_error(((NODE)yyVals[0+yyTop])); + yyVal = null; /*XXX 0;*/ + } + break; +case 72: + // line 587 "parse.y" + { + yyerror("class/module name must be CONSTANT"); + } + break; +case 77: + // line 596 "parse.y" + { + lex_state = EXPR_END; + //XXX Integer->ID + yyVal = new RubyId(ruby, ((Integer)yyVals[0+yyTop]).intValue()); + } + break; +case 78: + // line 601 "parse.y" + { + lex_state = EXPR_END; + yyVal = ((ID)yyVals[0+yyTop]); + } + break; +case 81: + // line 610 "parse.y" + { + yyVal = NEW_UNDEF(((ID)yyVals[0+yyTop])); + } + break; +case 82: + // line 613 "parse.y" + {lex_state = EXPR_FNAME;} + break; +case 83: + // line 614 "parse.y" + { + yyVal = block_append(((NODE)yyVals[-3+yyTop]), NEW_UNDEF(((ID)yyVals[0+yyTop]))); + } + break; +case 84: + // line 618 "parse.y" + { yyVal = new Integer('|'); } + break; +case 85: + // line 619 "parse.y" + { yyVal = new Integer('^'); } + break; +case 86: + // line 620 "parse.y" + { yyVal = new Integer('&'); } + break; +case 87: + // line 621 "parse.y" + { yyVal = new Integer(tCMP); } + break; +case 88: + // line 622 "parse.y" + { yyVal = new Integer(tEQ); } + break; +case 89: + // line 623 "parse.y" + { yyVal = new Integer(tEQQ); } + break; +case 90: + // line 624 "parse.y" + { yyVal = new Integer(tMATCH); } + break; +case 91: + // line 625 "parse.y" + { yyVal = new Integer('>'); } + break; +case 92: + // line 626 "parse.y" + { yyVal = new Integer(tGEQ); } + break; +case 93: + // line 627 "parse.y" + { yyVal = new Integer('<'); } + break; +case 94: + // line 628 "parse.y" + { yyVal = new Integer(tLEQ); } + break; +case 95: + // line 629 "parse.y" + { yyVal = new Integer(tLSHFT); } + break; +case 96: + // line 630 "parse.y" + { yyVal = new Integer(tRSHFT); } + break; +case 97: + // line 631 "parse.y" + { yyVal = new Integer('+'); } + break; +case 98: + // line 632 "parse.y" + { yyVal = new Integer('-'); } + break; +case 99: + // line 633 "parse.y" + { yyVal = new Integer('*'); } + break; +case 100: + // line 634 "parse.y" + { yyVal = new Integer('*'); } + break; +case 101: + // line 635 "parse.y" + { yyVal = new Integer('/'); } + break; +case 102: + // line 636 "parse.y" + { yyVal = new Integer('%'); } + break; +case 103: + // line 637 "parse.y" + { yyVal = new Integer(tPOW); } + break; +case 104: + // line 638 "parse.y" + { yyVal = new Integer('~'); } + break; +case 105: + // line 639 "parse.y" + { yyVal = new Integer(tUPLUS); } + break; +case 106: + // line 640 "parse.y" + { yyVal = new Integer(tUMINUS); } + break; +case 107: + // line 641 "parse.y" + { yyVal = new Integer(tAREF); } + break; +case 108: + // line 642 "parse.y" + { yyVal = new Integer(tASET); } + break; +case 109: + // line 643 "parse.y" + { yyVal = new Integer('`'); } + break; +case 151: + // line 654 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = node_assign(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 152: + // line 658 "parse.y" + {yyVal = assignable(((ID)yyVals[-1+yyTop]), null);} + break; +case 153: + // line 659 "parse.y" + { + if (((ID)yyVals[-2+yyTop]).intValue() == tOROP) { + ((NODE)yyVals[-1+yyTop]).nd_value((NODE)yyVals[0+yyTop]); + yyVal = NEW_OP_ASGN_OR(gettable(((ID)yyVals[-3+yyTop])), ((NODE)yyVals[-1+yyTop])); + if (((ID)yyVals[-3+yyTop]).is_instance_id()) { + ((NODE)yyVal).nd_aid((ID)yyVals[-3+yyTop]); + } + } + else if (((ID)yyVals[-2+yyTop]).intValue() == tANDOP) { + ((NODE)yyVals[-1+yyTop]).nd_value((NODE)yyVals[0+yyTop]); + yyVal = NEW_OP_ASGN_AND(gettable(((ID)yyVals[-3+yyTop])), ((NODE)yyVals[-1+yyTop])); + } + else { + yyVal = ((NODE)yyVals[-1+yyTop]); + if (yyVal != null) { + ((NODE)yyVal).nd_value(call_op(gettable(((ID)yyVals[-3+yyTop])),((ID)yyVals[-2+yyTop]).intValue(),1,((NODE)yyVals[0+yyTop]))); + } + } + fixpos(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 154: + // line 680 "parse.y" + { + NODE args = NEW_LIST(((NODE)yyVals[0+yyTop])); + + list_append(((NODE)yyVals[-3+yyTop]), NEW_NIL()); + list_concat(args, ((NODE)yyVals[-3+yyTop])); + yyVal = NEW_OP_ASGN1(((NODE)yyVals[-5+yyTop]), fixop(((ID)yyVals[-1+yyTop])), args); + fixpos(yyVal, ((NODE)yyVals[-5+yyTop])); + } + break; +case 155: + // line 689 "parse.y" + { + yyVal = NEW_OP_ASGN2(((NODE)yyVals[-4+yyTop]), ((ID)yyVals[-2+yyTop]), fixop(((ID)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])); + } + break; +case 156: + // line 694 "parse.y" + { + yyVal = NEW_OP_ASGN2(((NODE)yyVals[-4+yyTop]), ((ID)yyVals[-2+yyTop]), fixop(((ID)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])); + } + break; +case 157: + // line 699 "parse.y" + { + yyVal = NEW_OP_ASGN2(((NODE)yyVals[-4+yyTop]), ((ID)yyVals[-2+yyTop]), fixop(((ID)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])); + } + break; +case 158: + // line 704 "parse.y" + { + rb_backref_error(((NODE)yyVals[-2+yyTop])); + yyVal = null; /*XXX 0*/ + } + break; +case 159: + // line 709 "parse.y" + { + yyVal = NEW_DOT2(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 160: + // line 713 "parse.y" + { + yyVal = NEW_DOT3(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 161: + // line 717 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '+', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 162: + // line 721 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '-', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 163: + // line 725 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '*', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 164: + // line 729 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '/', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 165: + // line 733 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '%', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 166: + // line 737 "parse.y" + { + boolean need_negate = false; + + if (nd_type(((NODE)yyVals[-2+yyTop])) == NODE.NODE_LIT) { + + switch (TYPE(((NODE)yyVals[-2+yyTop]).nd_lit())) { + case T_FIXNUM: + case T_FLOAT: + case T_BIGNUM: + if (RTEST(rb_funcall(((NODE)yyVals[-2+yyTop]).nd_lit(),'<',1,INT2FIX(0)))) { + ((NODE)yyVals[-2+yyTop]).nd_lit(rb_funcall(((NODE)yyVals[-2+yyTop]).nd_lit(),ID.rb_intern("-@", ruby),0,null)); + need_negate = true; + } + default: + break; + } + } + yyVal = call_op(((NODE)yyVals[-2+yyTop]), tPOW, 1, ((NODE)yyVals[0+yyTop])); + if (need_negate) { + yyVal = call_op(((NODE)yyVal), tUMINUS, 0, null); + } + } + break; +case 167: + // line 760 "parse.y" + { + if (((NODE)yyVals[0+yyTop]) != null && nd_type(((NODE)yyVals[0+yyTop])) == NODE.NODE_LIT) { + yyVal = ((NODE)yyVals[0+yyTop]); + } + else { + yyVal = call_op(((NODE)yyVals[0+yyTop]), tUPLUS, 0, null); + } + } + break; +case 168: + // line 769 "parse.y" + { + if (((NODE)yyVals[0+yyTop]) != null && nd_type(((NODE)yyVals[0+yyTop])) == NODE.NODE_LIT && FIXNUM_P(((NODE)yyVals[0+yyTop]).nd_lit())) { + long i = FIX2LONG(((NODE)yyVals[0+yyTop]).nd_lit()); + + ((NODE)yyVals[0+yyTop]).nd_lit(INT2FIX(-i)); + yyVal = ((NODE)yyVals[0+yyTop]); + } + else { + yyVal = call_op(((NODE)yyVals[0+yyTop]), tUMINUS, 0, null); + } + } + break; +case 169: + // line 781 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '|', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 170: + // line 785 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '^', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 171: + // line 789 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '&', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 172: + // line 793 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), tCMP, 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 173: + // line 797 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '>', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 174: + // line 801 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), tGEQ, 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 175: + // line 805 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), '<', 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 176: + // line 809 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), tLEQ, 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 177: + // line 813 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), tEQ, 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 178: + // line 817 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), tEQQ, 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 179: + // line 821 "parse.y" + { + yyVal = NEW_NOT(call_op(((NODE)yyVals[-2+yyTop]), tEQ, 1, ((NODE)yyVals[0+yyTop]))); + } + break; +case 180: + // line 825 "parse.y" + { + yyVal = match_gen(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 181: + // line 829 "parse.y" + { + yyVal = NEW_NOT(match_gen(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop]))); + } + break; +case 182: + // line 833 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = NEW_NOT(cond(((NODE)yyVals[0+yyTop]))); + } + break; +case 183: + // line 838 "parse.y" + { + yyVal = call_op(((NODE)yyVals[0+yyTop]), '~', 0, null); + } + break; +case 184: + // line 842 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), tLSHFT, 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 185: + // line 846 "parse.y" + { + yyVal = call_op(((NODE)yyVals[-2+yyTop]), tRSHFT, 1, ((NODE)yyVals[0+yyTop])); + } + break; +case 186: + // line 850 "parse.y" + { + yyVal = logop(NODE.NODE_AND, ((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 187: + // line 854 "parse.y" + { + yyVal = logop(NODE.NODE_OR, ((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 188: + // line 857 "parse.y" + {in_defined = true;} + break; +case 189: + // line 858 "parse.y" + { + in_defined = false; + yyVal = NEW_DEFINED(((NODE)yyVals[0+yyTop])); + } + break; +case 190: + // line 863 "parse.y" + { + value_expr(((NODE)yyVals[-4+yyTop])); + yyVal = NEW_IF(cond(((NODE)yyVals[-4+yyTop])), ((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])); + } + break; +case 191: + // line 869 "parse.y" + { + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 193: + // line 875 "parse.y" + { + yyVal = NEW_LIST(((NODE)yyVals[-1+yyTop])); + } + break; +case 194: + // line 879 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 195: + // line 883 "parse.y" + { + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_concat(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-1+yyTop])); + } + break; +case 196: + // line 888 "parse.y" + { + yyVal = NEW_LIST(NEW_HASH(((NODE)yyVals[-1+yyTop]))); + } + break; +case 197: + // line 892 "parse.y" + { + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = NEW_RESTARY(((NODE)yyVals[-1+yyTop])); + } + break; +case 198: + // line 898 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 199: + // line 902 "parse.y" + { + yyVal = ((NODE)yyVals[-2+yyTop]); + } + break; +case 200: + // line 906 "parse.y" + { + yyVal = NEW_LIST(((NODE)yyVals[-2+yyTop])); + } + break; +case 201: + // line 910 "parse.y" + { + yyVal = list_append(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-2+yyTop])); + } + break; +case 204: + // line 918 "parse.y" + { + yyVal = NEW_LIST(((NODE)yyVals[0+yyTop])); + } + break; +case 205: + // line 922 "parse.y" + { + yyVal = arg_blk_pass(((NODE)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 206: + // line 926 "parse.y" + { + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_concat(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(((NODE)yyVal), ((NODE)yyVals[0+yyTop])); + } + break; +case 207: + // line 932 "parse.y" + { + yyVal = NEW_LIST(NEW_HASH(((NODE)yyVals[-1+yyTop]))); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 208: + // line 937 "parse.y" + { + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_concat(NEW_LIST(NEW_HASH(((NODE)yyVals[-4+yyTop]))), ((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(((NODE)yyVal), ((NODE)yyVals[0+yyTop])); + } + break; +case 209: + // line 943 "parse.y" + { + yyVal = list_append(((NODE)yyVals[-3+yyTop]), NEW_HASH(((NODE)yyVals[-1+yyTop]))); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 210: + // line 948 "parse.y" + { + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_concat(list_append(((NODE)yyVals[-6+yyTop]), NEW_HASH(((NODE)yyVals[-4+yyTop]))), ((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 211: + // line 954 "parse.y" + { + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(NEW_RESTARGS(((NODE)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + } + break; +case 213: + // line 961 "parse.y" + { + yyVal = arg_blk_pass(list_concat(NEW_LIST(((NODE)yyVals[-3+yyTop])),((NODE)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + } + break; +case 214: + // line 965 "parse.y" + { + value_expr(((NODE)yyVals[-4+yyTop])); + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_concat(NEW_LIST(((NODE)yyVals[-4+yyTop])), ((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 215: + // line 972 "parse.y" + { + value_expr(((NODE)yyVals[-6+yyTop])); + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_concat(list_concat(((NODE)yyVals[-6+yyTop]),((NODE)yyVals[-4+yyTop])), ((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 216: + // line 979 "parse.y" + { + yyVal = NEW_LIST(NEW_HASH(((NODE)yyVals[-1+yyTop]))); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 217: + // line 984 "parse.y" + { + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_concat(NEW_LIST(NEW_HASH(((NODE)yyVals[-4+yyTop]))), ((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 218: + // line 990 "parse.y" + { + yyVal = list_append(NEW_LIST(((NODE)yyVals[-3+yyTop])), NEW_HASH(((NODE)yyVals[-1+yyTop]))); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 219: + // line 995 "parse.y" + { + value_expr(((NODE)yyVals[-5+yyTop])); + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = list_append(list_concat(((NODE)yyVals[-5+yyTop]),((NODE)yyVals[-3+yyTop])), NEW_HASH(((NODE)yyVals[-1+yyTop]))); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 220: + // line 1002 "parse.y" + { + value_expr(((NODE)yyVals[-6+yyTop])); + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_concat(list_append(NEW_LIST(((NODE)yyVals[-6+yyTop])), NEW_HASH(((NODE)yyVals[-4+yyTop]))), ((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 221: + // line 1009 "parse.y" + { + value_expr(((NODE)yyVals[-8+yyTop])); + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_concat(list_append(list_concat(NEW_LIST(((NODE)yyVals[-8+yyTop])), ((NODE)yyVals[-6+yyTop])), NEW_HASH(((NODE)yyVals[-4+yyTop]))), ((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 222: + // line 1016 "parse.y" + { + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = arg_blk_pass(NEW_RESTARGS(((NODE)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + } + break; +case 224: + // line 1022 "parse.y" + { + yyVal = new Long(cmdarg_stack); + CMDARG_PUSH(1); + } + break; +case 225: + // line 1027 "parse.y" + { + /* CMDARG_POP() */ + cmdarg_stack = ((Long)yyVals[-1+yyTop]).longValue(); + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 227: + // line 1034 "parse.y" + {lex_state = EXPR_ENDARG;} + break; +case 228: + // line 1035 "parse.y" + { + rb_warning("%s (...) interpreted as method call", + ID.rb_id2name_last_id(ruby)); + yyVal = null; + } + break; +case 229: + // line 1040 "parse.y" + {lex_state = EXPR_ENDARG;} + break; +case 230: + // line 1041 "parse.y" + { + rb_warning("%s (...) interpreted as method call", + ID.rb_id2name_last_id(ruby)); + yyVal = ((NODE)yyVals[-2+yyTop]); + } + break; +case 231: + // line 1048 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = NEW_BLOCK_PASS(((NODE)yyVals[0+yyTop])); + } + break; +case 232: + // line 1054 "parse.y" + { + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 234: + // line 1060 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = NEW_LIST(((NODE)yyVals[0+yyTop])); + } + break; +case 235: + // line 1065 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = list_append(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 236: + // line 1071 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 237: + // line 1076 "parse.y" + { + yyVal = NEW_REXPAND(((NODE)yyVals[0+yyTop])); + } + break; +case 238: + // line 1081 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = list_append(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 239: + // line 1086 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = arg_concat(((NODE)yyVals[-3+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 240: + // line 1091 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 241: + // line 1097 "parse.y" + { + yyVal = NEW_LIT(((VALUE)yyVals[0+yyTop])); + } + break; +case 243: + // line 1102 "parse.y" + { + yyVal = NEW_XSTR(((VALUE)yyVals[0+yyTop])); + } + break; +case 248: + // line 1110 "parse.y" + { + yyVal = NEW_VCALL(((ID)yyVals[0+yyTop])); + } + break; +case 249: + // line 1119 "parse.y" + { + if (((NODE)yyVals[-3+yyTop]) == null && ((NODE)yyVals[-2+yyTop]) == null && ((NODE)yyVals[-1+yyTop]) == null) + yyVal = NEW_BEGIN(((NODE)yyVals[-4+yyTop])); + else { + if (((NODE)yyVals[-3+yyTop]) != null) yyVals[-4+yyTop] = NEW_RESCUE(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-3+yyTop]), ((NODE)yyVals[-2+yyTop])); + else if (((NODE)yyVals[-2+yyTop]) != null) { + rb_warn("else without rescue is useless"); + yyVals[-4+yyTop] = block_append(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-2+yyTop])); + } + if (((NODE)yyVals[-1+yyTop]) != null) yyVals[-4+yyTop] = NEW_ENSURE(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-1+yyTop])); + yyVal = ((NODE)yyVals[-4+yyTop]); + } + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])); + } + break; +case 250: + // line 1133 "parse.y" + {lex_state = EXPR_ENDARG;} + break; +case 251: + // line 1134 "parse.y" + { + rb_warning("%s (...) interpreted as command call", ID.rb_id2name_last_id(ruby)); + yyVal = ((NODE)yyVals[-2+yyTop]); + } + break; +case 252: + // line 1139 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 253: + // line 1143 "parse.y" + { + value_expr(((NODE)yyVals[-2+yyTop])); + yyVal = NEW_COLON2(((NODE)yyVals[-2+yyTop]), ((ID)yyVals[0+yyTop])); + } + break; +case 254: + // line 1148 "parse.y" + { + yyVal = NEW_COLON3(((ID)yyVals[0+yyTop])); + } + break; +case 255: + // line 1152 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = NEW_CALL(((NODE)yyVals[-3+yyTop]), new RubyId(ruby, tAREF), ((NODE)yyVals[-1+yyTop])); + } + break; +case 256: + // line 1157 "parse.y" + { + if (((NODE)yyVals[-1+yyTop]) == null) { + yyVal = NEW_ZARRAY(); /* zero length array*/ + } + else { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + } + break; +case 257: + // line 1166 "parse.y" + { + yyVal = NEW_HASH(((NODE)yyVals[-1+yyTop])); + } + break; +case 258: + // line 1170 "parse.y" + { + if (!compile_for_eval && in_def==0 && in_single==0) + yyerror("return appeared outside of method"); + yyVal = NEW_RETURN(null); + } + break; +case 259: + // line 1176 "parse.y" + { + value_expr(((NODE)yyVals[-1+yyTop])); + yyVal = NEW_YIELD(ret_args(((NODE)yyVals[-1+yyTop]))); + } + break; +case 260: + // line 1181 "parse.y" + { + yyVal = NEW_YIELD(null); + } + break; +case 261: + // line 1185 "parse.y" + { + yyVal = NEW_YIELD(null); + } + break; +case 262: + // line 1188 "parse.y" + {in_defined = true;} + break; +case 263: + // line 1189 "parse.y" + { + in_defined = false; + yyVal = NEW_DEFINED(((NODE)yyVals[-1+yyTop])); + } + break; +case 264: + // line 1194 "parse.y" + { + ((NODE)yyVals[0+yyTop]).nd_iter(NEW_FCALL(((ID)yyVals[-1+yyTop]), null)); + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 266: + // line 1200 "parse.y" + { + if (((NODE)yyVals[-1+yyTop]) != null && nd_type(((NODE)yyVals[-1+yyTop])) == NODE.NODE_BLOCK_PASS) { + rb_compile_error("both block arg and actual block given"); + } + ((NODE)yyVals[0+yyTop]).nd_iter(((NODE)yyVals[-1+yyTop])); + yyVal = ((NODE)yyVals[0+yyTop]); + fixpos(yyVal, ((NODE)yyVals[-1+yyTop])); + } + break; +case 267: + // line 1212 "parse.y" + { + value_expr(((NODE)yyVals[-4+yyTop])); + yyVal = NEW_IF(cond(((NODE)yyVals[-4+yyTop])), ((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[-1+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])); + } + break; +case 268: + // line 1221 "parse.y" + { + value_expr(((NODE)yyVals[-4+yyTop])); + yyVal = NEW_UNLESS(cond(((NODE)yyVals[-4+yyTop])), ((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[-1+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])); + } + break; +case 269: + // line 1226 "parse.y" + {COND_PUSH(1);} + break; +case 270: + // line 1226 "parse.y" + {COND_POP();} + break; +case 271: + // line 1229 "parse.y" + { + value_expr(((NODE)yyVals[-4+yyTop])); + yyVal = NEW_WHILE(cond(((NODE)yyVals[-4+yyTop])), ((NODE)yyVals[-1+yyTop]), 1); + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])); + } + break; +case 272: + // line 1234 "parse.y" + {COND_PUSH(1);} + break; +case 273: + // line 1234 "parse.y" + {COND_POP();} + break; +case 274: + // line 1237 "parse.y" + { + value_expr(((NODE)yyVals[-4+yyTop])); + yyVal = NEW_UNTIL(cond(((NODE)yyVals[-4+yyTop])), ((NODE)yyVals[-1+yyTop]), 1); + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])); + } + break; +case 275: + // line 1245 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = NEW_CASE(((NODE)yyVals[-3+yyTop]), ((NODE)yyVals[-1+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-3+yyTop])); + } + break; +case 276: + // line 1251 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 277: + // line 1254 "parse.y" + {COND_PUSH(1);} + break; +case 278: + // line 1254 "parse.y" + {COND_POP();} + break; +case 279: + // line 1257 "parse.y" + { + value_expr(((NODE)yyVals[-4+yyTop])); + yyVal = NEW_FOR(((NODE)yyVals[-7+yyTop]), ((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-1+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-7+yyTop])); + } + break; +case 280: + // line 1263 "parse.y" + { + if (in_def!=0 || in_single!=0) + yyerror("class definition in method body"); + class_nest++; + local_push(); + yyVal = new Integer(ruby_sourceline); + } + break; +case 281: + // line 1272 "parse.y" + { + yyVal = NEW_CLASS(((ID)yyVals[-4+yyTop]), ((NODE)yyVals[-1+yyTop]), ((NODE)yyVals[-3+yyTop])); + nd_set_line(((NODE)yyVal), ((Integer)yyVals[-2+yyTop]).intValue()); + local_pop(); + class_nest--; + } + break; +case 282: + // line 1279 "parse.y" + { + yyVal = new Integer(in_def); + in_def = 0; + } + break; +case 283: + // line 1284 "parse.y" + { + yyVal = new Integer(in_single); + in_single = 0; + class_nest++; + local_push(); + } + break; +case 284: + // line 1292 "parse.y" + { + yyVal = NEW_SCLASS(((NODE)yyVals[-5+yyTop]), ((NODE)yyVals[-1+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-5+yyTop])); + local_pop(); + class_nest--; + in_def = ((Integer)yyVals[-4+yyTop]).intValue(); + in_single = ((Integer)yyVals[-2+yyTop]).intValue(); + } + break; +case 285: + // line 1301 "parse.y" + { + if (in_def!=0 || in_single!=0) + yyerror("module definition in method body"); + class_nest++; + local_push(); + yyVal = new Integer(ruby_sourceline); + } + break; +case 286: + // line 1310 "parse.y" + { + yyVal = NEW_MODULE(((ID)yyVals[-3+yyTop]), ((NODE)yyVals[-1+yyTop])); + nd_set_line(((NODE)yyVal), ((Integer)yyVals[-2+yyTop]).intValue()); + local_pop(); + class_nest--; + } + break; +case 287: + // line 1317 "parse.y" + { + if (in_def!=0 || in_single!=0) + yyerror("nested method definition"); + yyVal = cur_mid; + cur_mid = ((ID)yyVals[0+yyTop]); + in_def++; + local_push(); + } + break; +case 288: + // line 1331 "parse.y" + { + if (((NODE)yyVals[-3+yyTop]) != null) yyVals[-4+yyTop] = NEW_RESCUE(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-3+yyTop]), ((NODE)yyVals[-2+yyTop])); + else if (((NODE)yyVals[-2+yyTop]) != null) { + rb_warn("else without rescue is useless"); + yyVals[-4+yyTop] = block_append(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-2+yyTop])); + } + if (((NODE)yyVals[-1+yyTop]) != null) yyVals[-4+yyTop] = NEW_ENSURE(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-1+yyTop])); + + /* NOEX_PRIVATE for toplevel */ + yyVal = NEW_DEFN(((ID)yyVals[-7+yyTop]), ((NODE)yyVals[-5+yyTop]), ((NODE)yyVals[-4+yyTop]), class_nest!=0?NODE.NOEX_PUBLIC:NODE.NOEX_PRIVATE); + if (((ID)yyVals[-7+yyTop]).is_attrset_id()) ((NODE)yyVal).nd_noex(NODE.NOEX_PUBLIC); + fixpos(yyVal, ((NODE)yyVals[-5+yyTop])); + local_pop(); + in_def--; + cur_mid = ((ID)yyVals[-6+yyTop]); + } + break; +case 289: + // line 1347 "parse.y" + {lex_state = EXPR_FNAME;} + break; +case 290: + // line 1348 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + in_single++; + local_push(); + lex_state = EXPR_END; /* force for args */ + } + break; +case 291: + // line 1360 "parse.y" + { + if (((NODE)yyVals[-3+yyTop]) != null) yyVals[-4+yyTop] = NEW_RESCUE(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-3+yyTop]), ((NODE)yyVals[-2+yyTop])); + else if (((NODE)yyVals[-2+yyTop]) != null) { + rb_warn("else without rescue is useless"); + yyVals[-4+yyTop] = block_append(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-2+yyTop])); + } + if (((NODE)yyVals[-1+yyTop]) != null) yyVals[-4+yyTop] = NEW_ENSURE(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-1+yyTop])); + + yyVal = NEW_DEFS(((NODE)yyVals[-10+yyTop]), ((ID)yyVals[-7+yyTop]), ((NODE)yyVals[-5+yyTop]), ((NODE)yyVals[-4+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-10+yyTop])); + local_pop(); + in_single--; + } + break; +case 292: + // line 1374 "parse.y" + { + yyVal = NEW_BREAK(null); + } + break; +case 293: + // line 1378 "parse.y" + { + yyVal = NEW_NEXT(null); + } + break; +case 294: + // line 1382 "parse.y" + { + yyVal = NEW_REDO(); + } + break; +case 295: + // line 1386 "parse.y" + { + yyVal = NEW_RETRY(); + } + break; +case 302: + // line 1401 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = NEW_IF(cond(((NODE)yyVals[-3+yyTop])), ((NODE)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-3+yyTop])); + } + break; +case 304: + // line 1409 "parse.y" + { + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 308: + // line 1418 "parse.y" + { + yyVal = new Integer(1); /*XXX (NODE*)1;*/ + } + break; +case 309: + // line 1422 "parse.y" + { + yyVal = new Integer(1); /*XXX (NODE*)1;*/ + } + break; +case 310: + // line 1426 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 311: + // line 1431 "parse.y" + { + yyVal = dyna_push(); + } + break; +case 312: + // line 1437 "parse.y" + { + yyVal = NEW_ITER(((NODE)yyVals[-2+yyTop]), null, ((NODE)yyVals[-1+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-2+yyTop])!=null?((NODE)yyVals[-2+yyTop]):((NODE)yyVals[-1+yyTop])); + dyna_pop(((RVarmap)yyVals[-3+yyTop])); + } + break; +case 313: + // line 1442 "parse.y" + {yyVal = dyna_push();} + break; +case 314: + // line 1446 "parse.y" + { + yyVal = NEW_ITER(((NODE)yyVals[-2+yyTop]), null, ((NODE)yyVals[-1+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-2+yyTop])!=null?((NODE)yyVals[-2+yyTop]):((NODE)yyVals[-1+yyTop])); + dyna_pop(((RVarmap)yyVals[-3+yyTop])); + } + break; +case 315: + // line 1454 "parse.y" + { + if (((NODE)yyVals[-1+yyTop]) != null && nd_type(((NODE)yyVals[-1+yyTop])) == NODE.NODE_BLOCK_PASS) { + rb_compile_error("both block arg and actual block given"); + } + ((NODE)yyVals[0+yyTop]).nd_iter((NODE)yyVals[-1+yyTop]); + yyVal = ((NODE)yyVals[0+yyTop]); + fixpos(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 316: + // line 1463 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = new_call(((NODE)yyVals[-3+yyTop]), ((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 317: + // line 1468 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = new_call(((NODE)yyVals[-3+yyTop]), ((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 318: + // line 1474 "parse.y" + { + yyVal = new_fcall(((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[0+yyTop])); + } + break; +case 319: + // line 1479 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = new_call(((NODE)yyVals[-3+yyTop]), ((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-3+yyTop])); + } + break; +case 320: + // line 1485 "parse.y" + { + value_expr(((NODE)yyVals[-3+yyTop])); + yyVal = new_call(((NODE)yyVals[-3+yyTop]), ((ID)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-3+yyTop])); + } + break; +case 321: + // line 1491 "parse.y" + { + value_expr(((NODE)yyVals[-2+yyTop])); + yyVal = new_call(((NODE)yyVals[-2+yyTop]), ((ID)yyVals[0+yyTop]), null); + } + break; +case 322: + // line 1496 "parse.y" + { + if (!compile_for_eval && in_def==0 && + in_single==0 && !in_defined) + yyerror("super called outside of method"); + yyVal = new_super(((NODE)yyVals[0+yyTop])); + } + break; +case 323: + // line 1503 "parse.y" + { + if (!compile_for_eval && in_def==0 && + in_single==0 && !in_defined) + yyerror("super called outside of method"); + yyVal = NEW_ZSUPER(); + } + break; +case 324: + // line 1511 "parse.y" + { + yyVal = dyna_push(); + } + break; +case 325: + // line 1516 "parse.y" + { + yyVal = NEW_ITER(((NODE)yyVals[-2+yyTop]), null, ((NODE)yyVals[-1+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-1+yyTop])); + dyna_pop(((RVarmap)yyVals[-3+yyTop])); + } + break; +case 326: + // line 1522 "parse.y" + { + yyVal = dyna_push(); + } + break; +case 327: + // line 1527 "parse.y" + { + yyVal = NEW_ITER(((NODE)yyVals[-2+yyTop]), null, ((NODE)yyVals[-1+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-1+yyTop])); + dyna_pop(((RVarmap)yyVals[-3+yyTop])); + } + break; +case 328: + // line 1536 "parse.y" + { + yyVal = NEW_WHEN(((NODE)yyVals[-3+yyTop]), ((NODE)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 330: + // line 1542 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = list_append(((NODE)yyVals[-3+yyTop]), NEW_WHEN(((NODE)yyVals[0+yyTop]), null, null)); + } + break; +case 331: + // line 1547 "parse.y" + { + value_expr(((NODE)yyVals[0+yyTop])); + yyVal = NEW_LIST(NEW_WHEN(((NODE)yyVals[0+yyTop]), null, null)); + } + break; +case 336: + // line 1559 "parse.y" + { + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 338: + // line 1567 "parse.y" + { + if (((NODE)yyVals[-3+yyTop]) != null) { + yyVals[-3+yyTop] = node_assign(((NODE)yyVals[-3+yyTop]), NEW_GVAR(ID.rb_intern("$!", ruby))); + yyVals[-1+yyTop] = block_append(((NODE)yyVals[-3+yyTop]), ((NODE)yyVals[-1+yyTop])); + } + yyVal = NEW_RESBODY(((NODE)yyVals[-4+yyTop]), ((NODE)yyVals[-1+yyTop]), ((NODE)yyVals[0+yyTop])); + fixpos(yyVal, ((NODE)yyVals[-4+yyTop])!=null?((NODE)yyVals[-4+yyTop]):((NODE)yyVals[-1+yyTop])); + } + break; +case 341: + // line 1579 "parse.y" + { + if (((NODE)yyVals[0+yyTop]) != null) + yyVal = ((NODE)yyVals[0+yyTop]); + else + /* place holder */ + yyVal = NEW_NIL(); + } + break; +case 343: + // line 1589 "parse.y" + { + yyVal = ID2SYM(((ID)yyVals[0+yyTop])); + } + break; +case 345: + // line 1595 "parse.y" + { + yyVal = NEW_STR(((VALUE)yyVals[0+yyTop])); + } + break; +case 347: + // line 1600 "parse.y" + { + if (nd_type(((NODE)yyVals[-1+yyTop])) == NODE.NODE_DSTR) { + list_append(((NODE)yyVals[-1+yyTop]), NEW_STR(((VALUE)yyVals[0+yyTop]))); + } + else { + rb_str_concat(((NODE)yyVals[-1+yyTop]).nd_lit(), ((VALUE)yyVals[0+yyTop])); + } + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 348: + // line 1610 "parse.y" + { + if (nd_type(((NODE)yyVals[-1+yyTop])) == NODE.NODE_STR) { + yyVal = NEW_DSTR(((NODE)yyVals[-1+yyTop]).nd_lit()); + } + else { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + ((NODE)yyVals[0+yyTop]).nd_head(NEW_STR(((NODE)yyVals[0+yyTop]).nd_lit())); + nd_set_type(((NODE)yyVals[0+yyTop]), NODE.NODE_ARRAY); + list_concat(((NODE)yyVal), ((NODE)yyVals[0+yyTop])); + } + break; +case 349: + // line 1623 "parse.y" + { + lex_state = EXPR_END; + yyVal = ((ID)yyVals[0+yyTop]); + } + break; +case 361: + // line 1641 "parse.y" + {yyVal = new RubyId(ruby, kNIL);} + break; +case 362: + // line 1642 "parse.y" + {yyVal = new RubyId(ruby, kSELF);} + break; +case 363: + // line 1643 "parse.y" + {yyVal = new RubyId(ruby, kTRUE);} + break; +case 364: + // line 1644 "parse.y" + {yyVal = new RubyId(ruby, kFALSE);} + break; +case 365: + // line 1645 "parse.y" + {yyVal = new RubyId(ruby, k__FILE__);} + break; +case 366: + // line 1646 "parse.y" + {yyVal = new RubyId(ruby, k__LINE__);} + break; +case 367: + // line 1649 "parse.y" + { + yyVal = gettable(((ID)yyVals[0+yyTop])); + } + break; +case 370: + // line 1657 "parse.y" + { + yyVal = null; + } + break; +case 371: + // line 1661 "parse.y" + { + lex_state = EXPR_BEG; + } + break; +case 372: + // line 1665 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 373: + // line 1668 "parse.y" + {yyerrok(); yyVal = null;} + break; +case 374: + // line 1671 "parse.y" + { + yyVal = ((NODE)yyVals[-2+yyTop]); + lex_state = EXPR_BEG; + } + break; +case 375: + // line 1676 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 376: + // line 1681 "parse.y" + { + yyVal = block_append(NEW_ARGS(((Integer)yyVals[-5+yyTop]), ((NODE)yyVals[-3+yyTop]), ((Integer)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + } + break; +case 377: + // line 1685 "parse.y" + { + yyVal = block_append(NEW_ARGS(((Integer)yyVals[-3+yyTop]), ((NODE)yyVals[-1+yyTop]), new Integer(-1)), ((NODE)yyVals[0+yyTop])); + } + break; +case 378: + // line 1689 "parse.y" + { + yyVal = block_append(NEW_ARGS(((Integer)yyVals[-3+yyTop]), null, ((Integer)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + } + break; +case 379: + // line 1693 "parse.y" + { + yyVal = block_append(NEW_ARGS(((Integer)yyVals[-1+yyTop]), null, new Integer(-1)), ((NODE)yyVals[0+yyTop])); + } + break; +case 380: + // line 1697 "parse.y" + { + yyVal = block_append(NEW_ARGS(null, ((NODE)yyVals[-3+yyTop]), ((Integer)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + } + break; +case 381: + // line 1701 "parse.y" + { + yyVal = block_append(NEW_ARGS(null, ((NODE)yyVals[-1+yyTop]), new Integer(-1)), ((NODE)yyVals[0+yyTop])); + } + break; +case 382: + // line 1705 "parse.y" + { + yyVal = block_append(NEW_ARGS(null, null, ((Integer)yyVals[-1+yyTop])), ((NODE)yyVals[0+yyTop])); + } + break; +case 383: + // line 1709 "parse.y" + { + yyVal = block_append(NEW_ARGS(null, null, new Integer(-1)), ((NODE)yyVals[0+yyTop])); + } + break; +case 384: + // line 1713 "parse.y" + { + yyVal = NEW_ARGS(null, null, new Integer(-1)); + } + break; +case 385: + // line 1718 "parse.y" + { + yyerror("formal argument cannot be a constant"); + } + break; +case 386: + // line 1722 "parse.y" + { + yyerror("formal argument cannot be an instance variable"); + } + break; +case 387: + // line 1726 "parse.y" + { + yyerror("formal argument cannot be a global variable"); + } + break; +case 388: + // line 1730 "parse.y" + { + yyerror("formal argument cannot be a class variable"); + } + break; +case 389: + // line 1734 "parse.y" + { + if (!((ID)yyVals[0+yyTop]).is_local_id()) + yyerror("formal argument must be local variable"); + else if (local_id(((ID)yyVals[0+yyTop]))) + yyerror("duplicate argument name"); + local_cnt(((ID)yyVals[0+yyTop])); + yyVal = new Integer(1); + } + break; +case 391: + // line 1745 "parse.y" + { + yyVal = new Integer(((Integer)yyVal).intValue() + 1); + } + break; +case 392: + // line 1750 "parse.y" + { + if (!((ID)yyVals[-2+yyTop]).is_local_id()) + yyerror("formal argument must be local variable"); + else if (local_id(((ID)yyVals[-2+yyTop]))) + yyerror("duplicate optional argument name"); + yyVal = assignable(((ID)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 393: + // line 1759 "parse.y" + { + yyVal = NEW_BLOCK(((NODE)yyVals[0+yyTop])); + ((NODE)yyVal).nd_end(((NODE)yyVal)); + } + break; +case 394: + // line 1764 "parse.y" + { + yyVal = block_append(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 395: + // line 1769 "parse.y" + { + if (!((ID)yyVals[0+yyTop]).is_local_id()) + yyerror("rest argument must be local variable"); + else if (local_id(((ID)yyVals[0+yyTop]))) + yyerror("duplicate rest argument name"); + yyVal = new Integer(local_cnt(((ID)yyVals[0+yyTop]))); + } + break; +case 396: + // line 1777 "parse.y" + { + yyVal = new Integer(-2); + } + break; +case 397: + // line 1782 "parse.y" + { + if (!((ID)yyVals[0+yyTop]).is_local_id()) + yyerror("block argument must be local variable"); + else if (local_id(((ID)yyVals[0+yyTop]))) + yyerror("duplicate block argument name"); + yyVal = NEW_BLOCK_ARG(((ID)yyVals[0+yyTop])); + } + break; +case 398: + // line 1791 "parse.y" + { + yyVal = ((NODE)yyVals[0+yyTop]); + } + break; +case 400: + // line 1797 "parse.y" + { + if (nd_type(((NODE)yyVals[0+yyTop])) == NODE.NODE_SELF) { + yyVal = NEW_SELF(); + } + else { + yyVal = ((NODE)yyVals[0+yyTop]); + } + } + break; +case 401: + // line 1805 "parse.y" + {lex_state = EXPR_BEG;} + break; +case 402: + // line 1806 "parse.y" + { + switch ((int)nd_type(((NODE)yyVals[-2+yyTop]))) { + case NODE.NODE_STR: + case NODE.NODE_DSTR: + case NODE.NODE_XSTR: + case NODE.NODE_DXSTR: + case NODE.NODE_DREGX: + case NODE.NODE_LIT: + case NODE.NODE_ARRAY: + case NODE.NODE_ZARRAY: + yyerror("can't define single method for literals."); + default: + break; + } + yyVal = ((NODE)yyVals[-2+yyTop]); + } + break; +case 404: + // line 1825 "parse.y" + { + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 405: + // line 1829 "parse.y" + { + if (((NODE)yyVals[-1+yyTop]).nd_alen()%2 != 0) { + yyerror("odd number list for Hash"); + } + yyVal = ((NODE)yyVals[-1+yyTop]); + } + break; +case 407: + // line 1838 "parse.y" + { + yyVal = list_concat(((NODE)yyVals[-2+yyTop]), ((NODE)yyVals[0+yyTop])); + } + break; +case 408: + // line 1843 "parse.y" + { + yyVal = list_append(NEW_LIST(((NODE)yyVals[-2+yyTop])), ((NODE)yyVals[0+yyTop])); + } + break; +case 428: + // line 1873 "parse.y" + {yyerrok();} + break; +case 431: + // line 1877 "parse.y" + {yyerrok();} + break; +case 432: + // line 1880 "parse.y" + { + yyVal = null; /*XXX 0;*/ + } + break; + // line 3000 "-" + } + yyTop -= yyLen[yyN]; + yyState = yyStates[yyTop]; + int yyM = yyLhs[yyN]; + if (yyState == 0 && yyM == 0) { + yyState = yyFinal; + if (yyToken < 0) { + yyToken = yyLex.advance() ? yyLex.token() : 0; + } + if (yyToken == 0) { + return yyVal; + } + continue yyLoop; + } + if ((yyN = yyGindex[yyM]) != 0 && (yyN += yyState) >= 0 + && yyN < yyTable.length && yyCheck[yyN] == yyState) + yyState = yyTable[yyN]; + else + yyState = yyDgoto[yyM]; + continue yyLoop; + } + } + } + + protected static final short yyLhs [] = { -1, + 75, 0, 5, 6, 6, 6, 6, 78, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 79, 7, + 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 12, 12, 38, 38, 38, + 11, 11, 11, 11, 11, 56, 56, 59, 59, 58, + 58, 58, 58, 58, 58, 60, 60, 57, 57, 61, + 61, 61, 61, 61, 61, 54, 54, 54, 54, 54, + 54, 69, 69, 70, 70, 70, 70, 70, 62, 62, + 48, 81, 48, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 9, 82, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 84, 9, 9, + 9, 30, 30, 30, 30, 30, 30, 27, 27, 27, + 27, 28, 28, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 86, 29, 26, 87, 26, 88, 26, + 32, 31, 31, 22, 22, 34, 34, 35, 35, 35, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 89, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 90, 10, 10, 10, 10, 10, 10, 92, 94, + 10, 95, 96, 10, 10, 10, 97, 98, 10, 99, + 10, 101, 102, 10, 103, 10, 104, 10, 106, 107, + 10, 10, 10, 10, 10, 91, 91, 91, 93, 93, + 14, 14, 15, 15, 50, 50, 51, 51, 51, 51, + 108, 53, 109, 53, 37, 37, 37, 13, 13, 13, + 13, 13, 13, 110, 52, 111, 52, 16, 23, 23, + 23, 17, 17, 19, 19, 20, 20, 18, 18, 21, + 21, 3, 3, 3, 2, 2, 2, 2, 65, 64, + 64, 64, 64, 4, 4, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 33, 49, 49, 36, + 112, 36, 36, 39, 39, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 73, 73, 73, 73, 73, 74, + 74, 42, 41, 41, 72, 72, 43, 44, 44, 1, + 113, 1, 45, 45, 45, 46, 46, 47, 66, 66, + 66, 67, 67, 67, 67, 68, 68, 68, 105, 105, + 76, 76, 83, 83, 85, 85, 85, 100, 100, 77, + 77, 55, + }; + protected static final short yyLen [] = { 2, + 0, 2, 2, 1, 1, 3, 2, 0, 4, 3, + 3, 3, 2, 3, 3, 3, 3, 3, 0, 5, + 4, 3, 3, 3, 3, 1, 2, 2, 2, 1, + 3, 3, 2, 2, 1, 1, 1, 1, 4, 4, + 2, 4, 4, 2, 2, 1, 3, 1, 3, 1, + 2, 3, 2, 2, 1, 1, 3, 2, 3, 1, + 4, 3, 3, 3, 1, 1, 4, 3, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 0, 4, 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, + 3, 0, 4, 6, 5, 5, 5, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 2, 2, 3, 3, 3, 3, 0, 4, 5, + 1, 1, 2, 2, 5, 2, 3, 3, 4, 4, + 6, 1, 1, 1, 2, 5, 2, 5, 4, 7, + 3, 1, 4, 5, 7, 2, 5, 4, 6, 7, + 9, 3, 1, 0, 2, 1, 0, 3, 0, 4, + 2, 2, 1, 1, 3, 1, 1, 3, 4, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 6, 0, + 4, 3, 3, 2, 4, 3, 3, 1, 4, 3, + 1, 0, 6, 2, 1, 2, 6, 6, 0, 0, + 7, 0, 0, 7, 5, 4, 0, 0, 9, 0, + 6, 0, 0, 8, 0, 5, 0, 9, 0, 0, + 12, 1, 1, 1, 1, 1, 1, 2, 1, 1, + 1, 5, 1, 2, 1, 1, 1, 2, 1, 3, + 0, 5, 0, 5, 2, 4, 4, 2, 4, 4, + 3, 2, 1, 0, 5, 0, 5, 5, 1, 4, + 2, 1, 1, 1, 1, 2, 1, 6, 1, 1, + 2, 1, 1, 1, 1, 1, 2, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 4, 2, 4, 2, 6, 4, 4, 2, 4, + 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, + 3, 3, 1, 3, 2, 1, 2, 2, 1, 1, + 0, 5, 1, 2, 2, 1, 3, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, + 2, 0, + }; + protected static final short yyDefRed [] = { 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 269, 272, 0, 0, 0, 294, 295, 0, 0, + 0, 362, 361, 363, 364, 0, 0, 0, 19, 0, + 366, 365, 0, 0, 358, 357, 0, 360, 354, 355, + 345, 243, 344, 346, 244, 245, 368, 369, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 241, 342, 2, 0, 0, 0, 0, 0, 0, 30, + 0, 246, 0, 37, 0, 0, 4, 0, 0, 46, + 0, 56, 0, 343, 0, 0, 72, 73, 0, 0, + 285, 119, 131, 120, 144, 116, 137, 126, 125, 142, + 124, 123, 118, 147, 128, 117, 132, 136, 138, 130, + 122, 139, 149, 141, 0, 0, 0, 0, 115, 135, + 134, 129, 145, 148, 146, 150, 114, 121, 112, 113, + 0, 0, 0, 76, 0, 105, 106, 103, 87, 88, + 89, 92, 94, 90, 107, 108, 95, 96, 100, 91, + 93, 84, 85, 86, 97, 98, 99, 101, 102, 104, + 109, 401, 0, 400, 367, 287, 77, 78, 140, 133, + 143, 127, 110, 111, 74, 75, 0, 81, 80, 79, + 0, 0, 0, 0, 0, 0, 0, 0, 429, 428, + 0, 0, 0, 430, 0, 0, 292, 293, 258, 0, + 0, 0, 0, 0, 0, 305, 306, 0, 0, 0, + 0, 0, 0, 204, 0, 28, 212, 0, 406, 29, + 27, 0, 45, 0, 322, 44, 0, 33, 0, 8, + 424, 0, 0, 0, 0, 0, 0, 254, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, + 0, 0, 403, 0, 0, 54, 0, 352, 351, 353, + 349, 350, 0, 34, 0, 347, 348, 3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 311, 313, 315, 326, 324, + 266, 0, 0, 0, 0, 0, 0, 0, 0, 58, + 152, 318, 41, 264, 0, 0, 371, 280, 370, 0, + 0, 420, 419, 289, 0, 82, 0, 0, 339, 297, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 431, 0, 0, 0, 0, 0, 0, 277, 0, 0, + 0, 0, 205, 233, 0, 207, 260, 0, 0, 0, + 0, 0, 0, 0, 226, 225, 10, 12, 11, 0, + 262, 0, 0, 0, 0, 0, 0, 252, 0, 0, + 0, 193, 0, 426, 194, 256, 0, 196, 0, 405, + 257, 404, 0, 0, 0, 0, 0, 0, 0, 0, + 18, 31, 32, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 321, 0, 0, 414, 0, 0, 415, + 0, 0, 0, 0, 0, 412, 413, 0, 0, 0, + 0, 0, 22, 0, 24, 0, 23, 25, 237, 0, + 52, 59, 0, 0, 373, 0, 0, 0, 0, 0, + 0, 387, 386, 385, 388, 0, 0, 0, 0, 0, + 0, 393, 383, 0, 390, 0, 0, 0, 0, 0, + 334, 0, 0, 303, 0, 298, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 276, 300, 270, 299, + 273, 0, 0, 0, 0, 0, 0, 0, 0, 211, + 0, 0, 0, 232, 0, 0, 0, 407, 259, 0, + 0, 0, 0, 0, 198, 0, 0, 229, 223, 0, + 0, 9, 0, 0, 0, 21, 0, 251, 197, 0, + 0, 0, 0, 0, 0, 0, 0, 320, 43, 0, + 0, 203, 319, 42, 202, 0, 309, 0, 0, 307, + 0, 0, 0, 317, 40, 316, 39, 0, 0, 57, + 0, 283, 0, 0, 286, 0, 290, 0, 395, 397, + 0, 0, 375, 0, 381, 399, 0, 382, 0, 379, + 83, 0, 0, 337, 0, 304, 0, 0, 340, 0, + 0, 301, 0, 0, 275, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 209, 0, 0, 0, 199, 0, + 0, 200, 0, 0, 0, 0, 216, 228, 0, 20, + 0, 0, 0, 0, 0, 0, 0, 308, 0, 0, + 0, 0, 0, 0, 0, 0, 372, 281, 402, 0, + 0, 0, 0, 0, 394, 398, 0, 0, 0, 391, + 0, 0, 336, 0, 0, 341, 249, 0, 267, 268, + 0, 0, 0, 0, 278, 206, 0, 208, 0, 222, + 0, 0, 0, 230, 0, 263, 195, 0, 310, 312, + 314, 327, 325, 0, 0, 0, 374, 0, 380, 0, + 377, 378, 0, 0, 0, 0, 0, 0, 332, 333, + 328, 271, 274, 0, 0, 201, 0, 0, 213, 0, + 218, 0, 284, 0, 0, 0, 0, 0, 0, 0, + 338, 0, 0, 210, 214, 0, 0, 0, 217, 0, + 288, 376, 0, 302, 279, 0, 0, 219, 0, 0, + 215, 0, 220, 0, 0, 291, 221, + }; + protected static final short yyDgoto [] = { 1, + 163, 60, 61, 62, 240, 64, 65, 66, 67, 236, + 69, 70, 71, 621, 622, 350, 731, 338, 499, 613, + 618, 215, 516, 216, 548, 376, 572, 573, 226, 247, + 363, 534, 72, 468, 465, 328, 73, 74, 489, 490, + 491, 492, 676, 605, 251, 218, 219, 177, 185, 205, + 579, 324, 308, 186, 77, 78, 79, 80, 242, 81, + 82, 178, 187, 261, 84, 209, 523, 444, 90, 180, + 450, 494, 495, 496, 2, 192, 193, 380, 233, 168, + 497, 473, 232, 382, 395, 227, 551, 645, 390, 553, + 341, 195, 519, 629, 196, 630, 528, 734, 477, 342, + 474, 666, 330, 335, 334, 480, 670, 452, 453, 455, + 454, 476, 331, + }; + protected static final short yySindex [] = { 0, + 0, 4393,12265, 212, -155,15494,15222, 4393,13761,13761, +11356, 0, 0,15020,12683,12683, 0, 0,12683,12389, + 34, 0, 0, 0, 0,13761,15127, 41, 0, -92, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,14643,14643, + -155,12005,13761,13859,14643,16962,15587,14741,14643, -177, + 0, 0, 0, 68, 331, 214,16880, -28, -235, 0, + -82, 0, -27, 0, -280, 89, 0, 128,15385, 0, + 130, 0, -123, 0, 17, 331, 0, 0,13761, 83, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -16, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 187, 0, 0, 0, + -40, 4393, 180, -4, -280, 165, -123, 180, 0, 0, + 66, -35, 185, 0,13761,13761, 0, 0, 0, 209, + 34, 41, 31, 0, -18, 0, 0, 0, 17,14643, +14643,14643,16825, 0, 244, 0, 0, 272, 0, 0, + 0,12487, 0,12683, 0, 0,12781, 0, 173, 0, + 0, 280, 202, 4393, 16, 37, 16, 0,12005, 303, + 0, 371, 214,14643, 41, 72, 279, 82, 0, 207, + 301, 82, 0, 56, 0, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 16, 0, 0, 0,12100,13761, +13761,13761,13761,12265,13761,13761,14643,14643,14643,14643, +14643,14643,14643,14643,14643,14643,14643,14643,14643,14643, +14643,14643,14643,14643,14643,14643,14643,14643,14643,14643, +14643,14643,15925,15960,13859, 0, 0, 0, 0, 0, + 0,15995,15995,14643,13957,13957,12005,16962, 400, 0, + 0, 0, 0, 0, 214, 68, 0, 0, 0, 4393, +13761, 0, 0, 0, 111, 0,14643, 219, 0, 0, + 4393, 211,16298,16333,13859,14643, 4393, -35,14055, 188, + 0, 178, 178, 280,16368,16403,13859, 0, 4199,16880, +14643,12879, 0, 0,12977, 0, 0, 435, -235, 450, + 41, 4, 461,12585, 0, 0, 0, 0, 0,15222, + 0,14643, 4393, 382,16298,16333, 474, 0, 0, 478, + 6222, 0,14153, 0, 0, 0,14643, 0,14643, 0, + 0, 0,16438,16473,13859, 331, 214, 214, 214, 214, + 0, 0, 0, 16, 1315, 1315, 1315, 1315, 1414, 1414, + 7190, 6709, 1315, 1315,11920,11920, 94, 94,16853, 1414, + 1414, 205, 205, 61, 87, 87, 16, 16, 16, 191, + 0, 0, 34, 0, 0, 203, 0, 222, 34, 0, + 430, -102, -102, -102, -102, 0, 0, 34, 34,16880, +14643,16880, 0, 521, 0,16880, 0, 0, 0, 527, + 0, 0,14643, 68, 0,13761, 4393, 312, 134,15890, + 519, 0, 0, 0, 0, 288, 291, 530, 4393, 68, + 543, 0, 0, 554, 0, 563,15222,16880, 266, 569, + 0, 4393, 351, 0, 261, 0, 191, 203, 222, 525, +16880, 219, 357,14643, 588, 74, 0, 0, 0, 0, + 0, 0, 34, 0, 0, 34, 546,13761, 296, 0, +16880,14643,16825, 0, 613,14643,16825, 0, 0,13075, + 611,15995,15995, 621, 0,14643,10601, 0, 0, 619, + 625, 0,13761,16880, 542, 0, 0, 0, 0,14643, +16880, 0, 0, 0, 581,14643,14643, 0, 0,14643, +14643, 0, 0, 0, 0, 336, 0,16710, 4393, 0, + 4393, 4393, 4393, 0, 0, 0, 0,16880,14251, 0, +16880, 0, 66, 415, 0, 639, 0,14643, 0, 0, + 41, -40, 0, 161, 0, 0, 333, 0, 530, 0, + 0,16962, 74, 0,14643, 0, 4393, 425, 0,13761, + 428, 0, 336, 429, 0,16880,14349, 4393, 4393, 4393, + 0, 178, 4199,13173, 0, 4199, -235, 4, 0, 34, + 34, 0, 4199,14447, 655,13271, 0, 0, 138, 0, + 6222, 0,16880,16880,16880,16880,14643, 0, 574, 436, + 576, 441, 579,14643,16880, 4393, 0, 0, 0, 111, +16880, 658, 219, 519, 0, 0, 554, 662, 554, 0, + 64, 0, 0, 0, 4393, 0, 0, 180, 0, 0, +14643, -112, 448, 451, 0, 0,14643, 0, 667, 0, +14643, 673, 683, 0,14643, 0, 0,16880, 0, 0, + 0, 0, 0,16880, 464, 4393, 0, 351, 0, 161, + 0, 0,16516,16788,13859, -40, 4393,16880, 0, 0, + 0, 0, 0, 4393, 4199, 0, 4199,13369, 0,13467, + 0, 4199, 0, -40, 466, 554, 0, 0, 0, 636, + 0, 261, 467, 0, 0,14643, 691,14643, 0, 219, + 0, 0, 0, 0, 0, 4199,13565, 0, 4199, 351, + 0,14643, 0, 475, 4199, 0, 0, + }; + protected static final short yyRindex [] = { 0, + 0, 200, 0, 0, 0, 0, 0, 561, 0, 0, + 469, 0, 0, 0,10761,10846, 0, 0,10942, 6071, + 3306, 0, 0, 0, 0, 0, 0,14545, 0, 0, + 0, 0, 1586, 2781, 0, 0, 1921, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 250, 0, 654, 638, 465, 0, 0, 0, 5584, + 0, 0, 0, 997, 1341, 5022, 1707,12162, 5312, 0, + 5892, 0, 5799, 0,11678, 0, 0, 0, 477, 0, + 0, 0,11763, 0,13663, 1428, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 364, 692, 782, 808, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 868, 999, 1084, 0, 1272, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5113, 0, 0, 0, + 306, 250, 0, 6468, 5097, 0, 5405, 0, 0, 0, + 469, 0, 503, 0, 0, 0, 0, 0, 0, 5981, + 4918, 735, 0, 114, 0, 0, 0, 443, 0, 0, + 0, 0, 6679, 0,10453, 0, 0,10453, 0, 0, + 0, 0, 0, 739, 0, 0, 0, 0, 0, 0, + 0,14839, 0, 46, 6558, 6379, 6860, 0, 250, 0, + 440, 0, 740, 0, 693, 695, 0, 695, 0, 664, + 0, 664, 0, 0, 830, 0, 891, 0, 0, 0, + 0, 0, 6949, 0, 7039, 0, 0, 0, 1678, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 654, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 250, 499, 541, 0, + 0, 0, 0, 0, 107, 0, 0, 0, 0, 97, + 0, 0, 0, 0, 182, 0, 26, 283, 0, 0, + 390,11037, 0, 0, 654, 0, 198, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 654, 0,10453,10495, + 0, 0, 0, 0, 0, 0, 0, 0, 80, 120, + 752, 752, 0, 753, 0, 0, 0, 0, 0, 0, + 0, 0, 46, 0, 0, 0, 0, 0, 493, 0, + 693, 0, 706, 0, 0, 0, 21, 0, 677, 0, + 0, 0, 0, 0, 654, 1530, 5510, 5600, 6087, 7681, + 0, 0, 0, 7341, 9072, 9164, 9251, 9345, 8518, 8795, + 9437, 9710, 9524, 9618, 1491, 9797, 8216, 8304, 0, 8887, + 8974, 8609, 8697, 8395, 7910, 8001, 7430, 7520, 7822, 4071, + 2876, 3641,13663, 0, 3211, 4166, 0, 4501, 3736, 0, + 0,11134,11245,11134,11245, 0, 0, 4596, 4596, 9833, + 0, 5218, 0, 0, 0, 5705, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 97, 0, 752, 0, + 589, 0, 0, 0, 0, 596, 0, 204, 561, 0, + 250, 0, 0, 250, 0, 250, 0, 22, 113, 50, + 0, 421, 544, 0, 544, 0, 2016, 2351, 2446, 0, + 9895, 544, 0, 0, 144, 0, 0, 0, 0, 0, + 0, 865, 0, 2407, 2837, 5007, 0, 0, 0, 0, + 7160, 0, 8121, 0,10453, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 183, 0, 0, 739, + 0, 0, 0, 9983, 0, 0, 492, 0, 0, 0, + 108, 1203, 1386, 1977, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,11859, 0, 0, 97, 0, + 46, 97, 46, 0, 0, 0, 0, 7925, 0, 0, +10026, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 752, 306, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 97, 0, 0, 0, + 0, 0, 5494, 0, 0, 154, 0, 322, 97, 97, + 937, 0,10453, 0, 0,10453, 0, 752, 0, 27, + 27, 0, 739, 0, 0, 0, 0, 0, 0, 0, + 693, 916,10138,10174,10271,10334, 0, 0, 0, 0, + 0, 0, 0, 0, 6192, 97, 0, 0, 0, 182, + 732, 0, 283, 0, 0, 0, 250, 250, 250, 0, + 0, 314, 0, 444, 561, 0, 0, 0, 0, 0, + 0, 544, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 739, 739, 0, 0, 0, 0,10403, 0, 0, + 0, 0, 0, 9147, 0, 561, 0, 544, 0, 0, + 0, 0, 0, 0, 654, 306, 390, 196, 0, 0, + 0, 0, 0, 97,10453, 0, 739, 0, 0, 0, + 0, 739, 0, 306, 0, 250, 518, 635, 678, 0, + 0, 544, 0, 0, 0, 0, 739, 0, 0, 283, + 0, 0, 709, 0, 0, 739, 0, 0, 739, 544, + 0, 0, 0, 0, 739, 0, 0, + }; + protected static final short yyGindex [] = { 0, + 0, 0, 0, 0, 232, 0, 52, 878, -15, 167, + 8, 36, 0, 54, -285, -338, 0, -581, 0, 0, + -659, -9, 0, 631, 0, 0, -10, -387, -72, -293, + 277, 81, 801, 0, 494, 0, -207, 0, 147, 338, + 210, -509, -315, 609, 0, -47, -332, 0, 608, 251, + 150, 760, 0, 867, 1065, -12, 0, -23, -169, 756, + 11, -11, 582, 0, -1, 751, -224, 0, 397, -3, + 42, -518, 223, 0, 0, -26, 779, 0, 0, 0, + 0, 0, -187, 0, 309, 0, 0, 0, 0, 0, + -179, 0, -328, 0, 0, 0, 0, 0, 0, 104, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, + }; + protected static final short yyTable [] = tab.yyTable(); + protected static final short yyCheck [] = tab.yyCheck(); + + // line 1884 "parse.y" + //XXX helpers + void yyerrok() {} + + private int fixop(ID op) { + if (op.intValue() == tOROP) + return 0; + if (op.intValue() == tANDOP) + return 1; + return op.intValue(); + } + +// --------------------------------------------------------------------------- +// here the parser methods start.... +// --------------------------------------------------------------------------- + + /** Returns the node's type (added to reduce the need for casts). */ + private int nd_type(Object node) { + return ((NODE)node).nd_type(); + } + + /** Sets the node's type. */ + private void nd_set_type(NODE node, int type) { + node.nd_set_type(type); + } + + /* Returns the node's type (same as nd_type()) */ + private /*enum node_type*/int nodetype(NODE node) { + return nd_type(node); + } + + /** Returns the node's source code line number (same as nd_line()) */ + private int nodeline(NODE node) { + return nd_line(node); + } + + /** Returns the node's source code line number. */ + private int nd_line(NODE node) { + return node.nd_line(); + } + + /** Sets the node's source code line number. */ + private void nd_set_line(NODE node, int line) { + node.nd_set_line(line); + } + + /** Copies position info (added to reduce the need for casts). */ + private void fixpos(Object node, NODE orig) { + fixpos((NODE)node, orig); + } + + /** Copies filename and line number from "orig" to "node". */ + private void fixpos(NODE node, NODE orig) { + if (node == null) return; + if (orig == null) return; + node.nd_file = orig.nd_file; + nd_set_line(node, nd_line(orig)); + } + + /** Wraps node with NEWLINE node. */ + private NODE newline_node(NODE node) { + NODE nl = null; + if (node != null) { + nl = NEW_NEWLINE(node); + fixpos(nl, node); + nl.nd_nth(nd_line(node)); + } + return nl; + } + + private NODE block_append(NODE head, NODE tail) { + if (tail == null) return head; + if (head == null) return tail; + + NODE end; + if (nd_type(head) != NODE.NODE_BLOCK) { + end = NEW_BLOCK(head); + end.nd_end(end); + fixpos(end, head); + head = end; + } + else { + end = head.nd_end(); + } + + if (RTEST(ruby_verbose)) { + NODE nd = end.nd_head(); + newline:for(;;) { + switch (nd_type(nd)) { + case NODE.NODE_RETURN: + case NODE.NODE_BREAK: + case NODE.NODE_NEXT: + case NODE.NODE_REDO: + case NODE.NODE_RETRY: + rb_warning("statement not reached"); + break; + + case NODE.NODE_NEWLINE: + nd = nd.nd_next(); + continue newline; + + default: + break; + } + break; + } + } + + if (nd_type(tail) != NODE.NODE_BLOCK) { + tail = NEW_BLOCK(tail); + tail.nd_end(tail); + } + end.nd_next(tail); + head.nd_end(tail.nd_end()); + return head; + } + + private NODE list_append(NODE head, NODE tail) { + if (head == null) return NEW_LIST(tail); + + NODE last = head; + while (last.nd_next() != null) { + last = last.nd_next(); + } + + last.nd_next(NEW_LIST(tail)); + head.nd_alen(head.nd_alen() + 1); + return head; + } + + private NODE list_concat(NODE head, NODE tail) { + NODE last = head; + + while (last.nd_next() != null) { + last = last.nd_next(); + } + + last.nd_next(tail); + head.nd_alen(head.nd_alen() + tail.nd_alen()); + + return head; + } + + /** Creates a new CALL node (added to reduce the need for casts). */ + NODE call_op(NODE recv, int op, int narg, NODE arg1) { + return call_op(recv, new RubyId(ruby, op), narg, arg1); + } + + /** Creates a new CALL node. */ + private NODE call_op(NODE recv, ID id, int narg, NODE arg1) { + value_expr(recv); + if (narg == 1) { + value_expr(arg1); + } + return NEW_CALL(recv, id, narg == 1 ? NEW_LIST(arg1) : null); + } + + private NODE match_gen(NODE node1, NODE node2) { + local_cnt('~'); + + switch (nd_type(node1)) { + case NODE.NODE_DREGX: + case NODE.NODE_DREGX_ONCE: + return NEW_MATCH2(node1, node2); + + case NODE.NODE_LIT: + if (TYPE(node1.nd_lit()) == T_REGEXP) { + return NEW_MATCH2(node1, node2); + } + } + + switch (nd_type(node2)) { + case NODE.NODE_DREGX: + case NODE.NODE_DREGX_ONCE: + return NEW_MATCH3(node2, node1); + + case NODE.NODE_LIT: + if (TYPE(node2.nd_lit()) == T_REGEXP) { + return NEW_MATCH3(node2, node1); + } + } + + return NEW_CALL(node1, new RubyId(ruby, tMATCH), NEW_LIST(node2)); + } + + private NODE gettable(ID id) { + if (id.intValue() == kSELF) { + return NEW_SELF(); + } + else if (id.intValue() == kNIL) { + return NEW_NIL(); + } + else if (id.intValue() == kTRUE) { + return NEW_TRUE(); + } + else if (id.intValue() == kFALSE) { + return NEW_FALSE(); + } + else if (id.intValue() == k__FILE__) { + return NEW_STR(rb_str_new2(ruby_sourcefile)); + } + else if (id.intValue() == k__LINE__) { + return NEW_LIT(INT2FIX(ruby_sourceline)); + } + else if (id.is_local_id()) { + if (dyna_in_block() && rb_dvar_defined(id)) return NEW_DVAR(id); + if (local_id(id)) return NEW_LVAR(id); + /* method call without arguments */ + return NEW_VCALL(id); + } + else if (id.is_global_id()) { + return NEW_GVAR(id); + } + else if (id.is_instance_id()) { + return NEW_IVAR(id); + } + else if (id.is_const_id()) { + return NEW_CONST(id); + } + else if (id.is_class_id()) { + if (in_single!=0) + return NEW_CVAR2(id); + return NEW_CVAR(id); + } + rb_bug("invalid id for gettable"); + return null; + } + + private NODE assignable(ID id, NODE val) { + value_expr(val); + if (id.intValue() == kSELF) { + yyerror("Can't change the value of self"); + } + else if (id.intValue() == kNIL) { + yyerror("Can't assign to nil"); + } + else if (id.intValue() == kTRUE) { + yyerror("Can't assign to true"); + } + else if (id.intValue() == kFALSE) { + yyerror("Can't assign to false"); + } + else if (id.intValue() == k__FILE__) { + yyerror("Can't assign to __FILE__"); + } + else if (id.intValue() == k__LINE__) { + yyerror("Can't assign to __LINE__"); + } + else if (id.is_local_id()) { + if (rb_dvar_curr(id) != false) { + return NEW_DASGN_CURR(id, val); + } + else if (rb_dvar_defined(id)) { + return NEW_DASGN(id, val); + } + else if (local_id(id) || !dyna_in_block()) { + return NEW_LASGN(id, val); + } + else{ + rb_dvar_push(id, Qnil); + return NEW_DASGN_CURR(id, val); + } + } + else if (id.is_global_id()) { + return NEW_GASGN(id, val); + } + else if (id.is_instance_id()) { + return NEW_IASGN(id, val); + } + else if (id.is_const_id()) { + if (in_def!=0 || in_single!=0) + yyerror("dynamic constant assignment"); + return NEW_CDECL(id, val); + } + else if (id.is_class_id()) { + if (in_single!=0) return NEW_CVASGN(id, val); + return NEW_CVDECL(id, val); + } + else { + rb_bug("bad id for variable"); + } + return null; + } + + private NODE aryset(NODE recv, NODE idx) { + value_expr(recv); + return NEW_CALL(recv, new RubyId(ruby, tASET), idx); + } + + private NODE attrset(NODE recv, ID id) { + value_expr(recv); + + return NEW_CALL(recv, id.rb_id_attrset(ruby), null); + } + + private void rb_backref_error(NODE node) { + switch (nd_type(node)) { + case NODE.NODE_NTH_REF: + rb_compile_error("Can't set variable $%d", new Long(node.nd_nth())); + break; + case NODE.NODE_BACK_REF: + rb_compile_error("Can't set variable $%c", new Long(node.nd_nth())); + break; + } + } + + private NODE arg_concat(NODE node1, NODE node2) + { + if (node2 == null) return node1; + return NEW_ARGSCAT(node1, node2); + } + + private NODE arg_add(NODE node1, NODE node2) + { + if (node1 == null) return NEW_LIST(node2); + if (nd_type(node1) == NODE.NODE_ARRAY) { + return list_append(node1, node2); + } + else { + return NEW_ARGSPUSH(node1, node2); + } + } + + private NODE node_assign(NODE lhs, NODE rhs) + { + if (lhs == null) return null; + + value_expr(rhs); + switch (nd_type(lhs)) { + case NODE.NODE_GASGN: + case NODE.NODE_IASGN: + case NODE.NODE_LASGN: + case NODE.NODE_DASGN: + case NODE.NODE_DASGN_CURR: + case NODE.NODE_MASGN: + case NODE.NODE_CDECL: + case NODE.NODE_CVDECL: + case NODE.NODE_CVASGN: + lhs.nd_value(rhs); + break; + + case NODE.NODE_CALL: + lhs.nd_args(arg_add(lhs.nd_args(), rhs)); + break; + + default: + /* should not happen */ + break; + } + + if (rhs != null) fixpos(lhs, rhs); + return lhs; + } + + private boolean value_expr(NODE node) + { + if (node == null) return true; + + switch (nd_type(node)) { + case NODE.NODE_RETURN: + case NODE.NODE_BREAK: + case NODE.NODE_NEXT: + case NODE.NODE_REDO: + case NODE.NODE_RETRY: + case NODE.NODE_WHILE: + case NODE.NODE_UNTIL: + case NODE.NODE_CLASS: + case NODE.NODE_MODULE: + case NODE.NODE_DEFN: + case NODE.NODE_DEFS: + yyerror("void value expression"); + return false; + + case NODE.NODE_BLOCK: + while (node.nd_next() != null) { + node = node.nd_next(); + } + return value_expr(node.nd_head()); + + case NODE.NODE_BEGIN: + return value_expr(node.nd_body()); + + case NODE.NODE_IF: + return value_expr(node.nd_body()) && value_expr(node.nd_else()); + + case NODE.NODE_NEWLINE: + return value_expr(node.nd_next()); + + default: + return true; + } + } + + private void void_expr(NODE node) + { + String useless = null; + + if (!RTEST(ruby_verbose)) return; + if (node == null) return; + + again:for(;;) { + switch (nd_type(node)) { + case NODE.NODE_NEWLINE: + node = node.nd_next(); + continue again; + + case NODE.NODE_CALL: + switch (node.nd_mid().intValue()) { + case '+': + case '-': + case '*': + case '/': + case '%': + case tPOW: + case tUPLUS: + case tUMINUS: + case '|': + case '^': + case '&': + case tCMP: + case '>': + case tGEQ: + case '<': + case tLEQ: + case tEQ: + case tNEQ: + case tAREF: + case tRSHFT: + case tCOLON2: + case tCOLON3: + useless = ID.rb_id2name(ruby, node.nd_mid()); + break; + } + break; + + case NODE.NODE_LVAR: + case NODE.NODE_DVAR: + case NODE.NODE_GVAR: + case NODE.NODE_IVAR: + case NODE.NODE_CVAR: + case NODE.NODE_NTH_REF: + case NODE.NODE_BACK_REF: + useless = "a variable"; + break; + case NODE.NODE_CONST: + case NODE.NODE_CREF: + useless = "a constant"; + break; + case NODE.NODE_LIT: + case NODE.NODE_STR: + case NODE.NODE_DSTR: + case NODE.NODE_DREGX: + case NODE.NODE_DREGX_ONCE: + useless = "a literal"; + break; + case NODE.NODE_COLON2: + case NODE.NODE_COLON3: + useless = "::"; + break; + case NODE.NODE_DOT2: + useless = ".."; + break; + case NODE.NODE_DOT3: + useless = "..."; + break; + case NODE.NODE_SELF: + useless = "self"; + break; + case NODE.NODE_NIL: + useless = "nil"; + break; + case NODE.NODE_TRUE: + useless = "true"; + break; + case NODE.NODE_FALSE: + useless = "false"; + break; + case NODE.NODE_DEFINED: + useless = "defined?"; + break; + } + break again; + } + + if (useless != null) { + int line = ruby_sourceline; + + ruby_sourceline = nd_line(node); + rb_warn("useless use of %s in void context", useless); + ruby_sourceline = line; + } + } + + private void void_stmts(NODE node) { + if (!RTEST(ruby_verbose)) return; + if (node == null) return; + if (nd_type(node) != NODE.NODE_BLOCK) return; + + for (;;) { + if (node.nd_next() == null) return; + void_expr(node.nd_head()); + node = node.nd_next(); + } + } + + private boolean assign_in_cond(NODE node) { + switch (nd_type(node)) { + case NODE.NODE_MASGN: + yyerror("multiple assignment in conditional"); + return true; + + case NODE.NODE_LASGN: + case NODE.NODE_DASGN: + case NODE.NODE_GASGN: + case NODE.NODE_IASGN: + break; + + case NODE.NODE_NEWLINE: + default: + return false; + } + + switch (nd_type(node.nd_value())) { + case NODE.NODE_LIT: + case NODE.NODE_STR: + case NODE.NODE_NIL: + case NODE.NODE_TRUE: + case NODE.NODE_FALSE: + /* reports always */ + rb_warn("found = in conditional, should be =="); + return true; + + case NODE.NODE_DSTR: + case NODE.NODE_XSTR: + case NODE.NODE_DXSTR: + case NODE.NODE_EVSTR: + case NODE.NODE_DREGX: + default: + break; + } + return true; + } + + private boolean e_option_supplied() { + return ruby_sourcefile.equals("-e"); + } + + private void warn_unless_e_option(String str) { + if (!e_option_supplied()) rb_warn(str); + } + + private void warning_unless_e_option(String str) { + if (!e_option_supplied()) rb_warning(str); + } + + private NODE range_op(NODE node, int logop) { + /*enum node_type*/int type; + + if (logop!=0) return node; + if (!e_option_supplied()) return node; + + warn_unless_e_option("integer literal in condition"); + node = cond0(node, 0); //XXX second argument was missing + type = nd_type(node); + if (type == NODE.NODE_NEWLINE) node = node.nd_next(); + if (type == NODE.NODE_LIT && FIXNUM_P(node.nd_lit())) { + return call_op(node,tEQ,1,NEW_GVAR(ID.rb_intern("$.", ruby))); + } + return node; + } + + private NODE cond0(NODE node, int logop) { + /*enum node_type*/int type = nd_type(node); + + assign_in_cond(node); + switch (type) { + case NODE.NODE_DSTR: + case NODE.NODE_STR: + if (logop!=0) break; + rb_warn("string literal in condition"); + break; + + case NODE.NODE_DREGX: + case NODE.NODE_DREGX_ONCE: + warning_unless_e_option("regex literal in condition"); + local_cnt('_'); + local_cnt('~'); + return NEW_MATCH2(node, NEW_GVAR(ID.rb_intern("$_", ruby))); + + case NODE.NODE_DOT2: + case NODE.NODE_DOT3: + node.nd_beg(range_op(node.nd_beg(), logop)); + node.nd_end(range_op(node.nd_end(), logop)); + if (type == NODE.NODE_DOT2) nd_set_type(node,NODE.NODE_FLIP2); + else if (type == NODE.NODE_DOT3) nd_set_type(node, NODE.NODE_FLIP3); + node.nd_cnt(local_append(new RubyId(ruby, 0))); + warning_unless_e_option("range literal in condition"); + break; + + case NODE.NODE_LIT: + if (TYPE(node.nd_lit()) == T_REGEXP) { + warning_unless_e_option("regex literal in condition"); + nd_set_type(node, NODE.NODE_MATCH); + local_cnt('_'); + local_cnt('~'); + } + } + return node; + } + + private NODE cond1(NODE node, int logop) { + if (node == null) return null; + if (nd_type(node) == NODE.NODE_NEWLINE){ + node.nd_next(cond0(node.nd_next(), logop)); + return node; + } + return cond0(node, logop); + } + + private NODE cond(NODE node) { + return cond1(node, 0); + } + + private NODE logop(/*node_type*/int type, NODE left, NODE right) { + value_expr(left); + return rb_node_newnode(type, cond1(left, 1), cond1(right, 1), null); + } + + private NODE ret_args(NODE node) { + if (node != null) { + if (nd_type(node) == NODE.NODE_BLOCK_PASS) { + rb_compile_error("block argument should not be given"); + } + } + return node; + } + + /** (added to reduce the need to cast) */ + NODE arg_blk_pass(Object n1, NODE n2) { + return arg_blk_pass((NODE)n1, n2); + } + + NODE arg_blk_pass(NODE node1, NODE node2) { + if (node2 != null) { + node2.nd_head(node1); + return node2; + } + return node1; + } + + /* + private NODE arg_prepend(NODE node1, NODE node2) { + switch (nodetype(node2)) { + case NODE.NODE_ARRAY: + return list_concat(NEW_LIST(node1), node2); + + case NODE.NODE_RESTARGS: + return arg_concat(node1, node2.nd_head()); + + case NODE.NODE_BLOCK_PASS: + node2.nd_body = arg_prepend(node1, node2.nd_body); + return node2; + + default: + rb_bug("unknown nodetype(%d) for arg_prepend"); + } + return null; // not reached + } + */ + + private NODE new_call(NODE r, ID m, NODE a) { + if (a != null && nd_type(a) == NODE.NODE_BLOCK_PASS) { + a.nd_iter(NEW_CALL(r,m,a.nd_head())); + return a; + } + return NEW_CALL(r,m,a); + } + + private NODE new_fcall(ID m, NODE a) { + if (a != null && nd_type(a) == NODE.NODE_BLOCK_PASS) { + a.nd_iter(NEW_FCALL(m,a.nd_head())); + return a; + } + return NEW_FCALL(m,a); + } + + private NODE new_super(NODE a) { + if (a != null && nd_type(a) == NODE.NODE_BLOCK_PASS) { + a.nd_iter(NEW_SUPER(a.nd_head())); + return a; + } + return NEW_SUPER(a); + } + + private class local_vars { + ID[] tbl; + int nofree; + int cnt; + int dlev; + local_vars prev; + }; + + private local_vars lvtbl = new local_vars(); + + private void local_push() { + local_vars local = new local_vars(); + local.prev = lvtbl; + local.nofree = 0; + local.cnt = 0; + local.tbl = null; + local.dlev = 0; + lvtbl = local; + } + + private void local_pop() { + local_vars local = lvtbl.prev; + + if (lvtbl.tbl != null) { + if (lvtbl.nofree == 0) /*free(lvtbl.tbl)*/; + else lvtbl.tbl[0] = new RubyId(ruby, lvtbl.cnt); + } + /*free(lvtbl);*/ + lvtbl = local; + } + + private ID[] local_tbl() { + lvtbl.nofree = 1; + return lvtbl.tbl; + } + + private int local_append(ID id) { + if (lvtbl.tbl == null) { + lvtbl.tbl = new ID[4]; + lvtbl.tbl[0] = new RubyId(ruby, 0); + lvtbl.tbl[1] = new RubyId(ruby, '_'); + lvtbl.tbl[2] = new RubyId(ruby, '~'); + lvtbl.cnt = 2; + if (id.intValue() == '_') return 0; + if (id.intValue() == '~') return 1; + } + else { + ID[] ntbl = new ID[lvtbl.cnt + 2]; + System.arraycopy(lvtbl.tbl, 0, ntbl, 0, lvtbl.tbl.length); + lvtbl.tbl = ntbl; + } + + lvtbl.tbl[lvtbl.cnt + 1] = id; + return lvtbl.cnt++; + } + + private int local_cnt(int id) { + return local_cnt(new RubyId(ruby, id)); + } + private int local_cnt(ID id) { + if (id == null) return lvtbl.cnt; + + for (int cnt = 1, max = lvtbl.cnt + 1; cnt < max; cnt++) { + if (lvtbl.tbl[cnt] == id) return cnt - 1; + } + return local_append(id); + } + + private boolean local_id(ID id) + { + int i, max; + + if (lvtbl == null) return false; + for (i=3, max=lvtbl.cnt+1; i 0) { + lvtbl.tbl = new ID[lvtbl.cnt+3]; + System.arraycopy(lvtbl.tbl, 0, ruby.rubyScope.getLocalTbl(), 0, lvtbl.cnt+1); + } + else { + lvtbl.tbl = null; + } + if (ruby_dyna_vars != null) + lvtbl.dlev = 1; + else + lvtbl.dlev = 0; + } + + private void + top_local_setup() + { + int len = lvtbl.cnt; + int i; + + if (len > 0) { + i = ruby.rubyScope.getLocalTbl() != null ? ruby.rubyScope.getLocalTbl(0).intValue() : 0; + + if (i < len) { + if (i == 0 || (ruby.rubyScope.getFlags() & 1 /*SCOPE_MALLOC*/) == 0) { + VALUE[] vars = new VALUE[len + 1]; + int vi = 0; + if (ruby.rubyScope.getLocalVars() != null) { + vars[vi++] = ruby.rubyScope.getLocalVars(-1); + + System.arraycopy(vars, 0, ruby.rubyScope.getLocalVars(), 0, i); + // rb_mem_clear(vars+i, len-i); + } else { + vars[vi++] = null; + // rb_mem_clear(vars, len); + } + ruby.rubyScope.setLocalVars(vars); + ruby.rubyScope.setFlags(ruby.rubyScope.getFlags() | 1); // SCOPE_MALLOC; + } else { + // VALUE[] vars = ruby.ruby_scope.local_vars-1; + // REALLOC_N(vars, VALUE, len+1); + // ruby_scope.local_vars = vars+1; + // rb_mem_clear(ruby_scope.local_vars+i, len-i); + } + // if (ruby.ruby_scope.local_tbl != null && ruby_scope.local_vars[-1] == 0) { + // free(ruby_scope.local_tbl); + // } + // ruby_scope.local_vars[-1] = 0; + ruby.rubyScope.setLocalTbl(local_tbl()); + } + } + local_pop(); + // */ + } + + private RVarmap dyna_push() { + RVarmap vars = ruby_dyna_vars; + + rb_dvar_push(null, null); + lvtbl.dlev++; + return vars; + } + + private void dyna_pop(RVarmap vars) { + lvtbl.dlev--; + ruby_dyna_vars = vars; + } + + private boolean dyna_in_block() { + return lvtbl.dlev > 0; + } + + void rb_parser_append_print() { + ruby_eval_tree = + block_append(ruby_eval_tree, + NEW_FCALL(ID.rb_intern("print", ruby), + NEW_ARRAY(NEW_GVAR(ID.rb_intern("$_", ruby))))); + } + + void rb_parser_while_loop(int chop, int split) { + if (split != 0) { + ruby_eval_tree = + block_append(NEW_GASGN(ID.rb_intern("$F", ruby), + NEW_CALL(NEW_GVAR(ID.rb_intern("$_", ruby)), + ID.rb_intern("split", ruby), null)), + ruby_eval_tree); + } + if (chop != 0) { + ruby_eval_tree = + block_append(NEW_CALL(NEW_GVAR(ID.rb_intern("$_", ruby)), + ID.rb_intern("chop!", ruby), null), ruby_eval_tree); + } + ruby_eval_tree = NEW_OPT_N(ruby_eval_tree); + } + + + + + + VALUE rb_sym_all_symbols() { + throw missing(); + /* + VALUE ary = rb_ary_new2(sym_tbl.size()); + + for (Iterator i = sym_tbl.entrySet().iterator(); i.hasNext();) { + Map.Entry e = (Map.Entry)i.next(); + rb_ary_push(ary, ID2SYM((ID)e.getValue())); + } + return ary; + */ + } + + boolean rb_is_const_id(ID id) { + return id.is_const_id(); + } + + boolean rb_is_class_id(ID id) { + return id.is_class_id(); + } + + boolean rb_is_instance_id(ID id) { + return id.is_instance_id(); + } + + private void special_local_set(char c, VALUE val) { + top_local_init(); + int cnt = local_cnt(c); + top_local_setup(); + ruby.rubyScope.setLocalVars(cnt, val); + } + + VALUE rb_backref_get() { + if (ruby.rubyScope.getLocalVars() != null) { + return ruby.rubyScope.getLocalVars(1); + } + return Qnil; + } + + void rb_backref_set(VALUE val) { + if (ruby.rubyScope.getLocalVars() != null) { + ruby.rubyScope.setLocalVars(1, val); + } + else { + special_local_set('~', val); + } + } + + VALUE rb_lastline_get() { + if (ruby.rubyScope.getLocalVars() != null) { + return ruby.rubyScope.getLocalVars(0); + } + return Qnil; + } + + void rb_lastline_set(VALUE val) { + if (ruby.rubyScope.getLocalVars() != null) { + ruby.rubyScope.setLocalVars(0, val); + } + else { + special_local_set('_', val); + } + } + + // ----------------------------------------------------------------------- + // macros from node.h + // ----------------------------------------------------------------------- + + NODE NEW_METHOD(NODE n, int x) { + return rb_node_newnode(NODE_METHOD, new Integer(x), n, null); + } + NODE NEW_FBODY(NODE n, ID i, VALUE o) { + return rb_node_newnode(NODE_FBODY, n, i, o); + } + NODE NEW_DEFN(ID i, NODE a, NODE d, int p) { + return rb_node_newnode(NODE_DEFN, new Integer(p), i, NEW_RFUNC(a, d)); + } + NODE NEW_DEFS(NODE r, ID i, NODE a, NODE d) { + return rb_node_newnode(NODE_DEFS, r, i, NEW_RFUNC(a, d)); + } + NODE NEW_CFUNC(Object f, int c) { + return rb_node_newnode(NODE_CFUNC, f, new Integer(c), null); + } + NODE NEW_IFUNC(Object f, int c) { + return rb_node_newnode(NODE_IFUNC, f, new Integer(c), null); + } + NODE NEW_RFUNC(NODE b1, NODE b2) { + return NEW_SCOPE(block_append(b1,b2)); + } + NODE NEW_SCOPE(NODE b) { + return rb_node_newnode(NODE_SCOPE, local_tbl(), null, b); + } + NODE NEW_BLOCK(NODE a) { + return rb_node_newnode(NODE_BLOCK, a, null, null); + } + NODE NEW_IF(NODE c, NODE t, NODE e) { + return rb_node_newnode(NODE_IF, c, t, e); + } + NODE NEW_UNLESS(NODE c, NODE t, NODE e) { + return NEW_IF(c, e, t); + } + NODE NEW_CASE(NODE h, NODE b) { + return rb_node_newnode(NODE_CASE, h, b, null); + } + NODE NEW_WHEN(NODE c, NODE t, NODE e) { + return rb_node_newnode(NODE_WHEN, c, t, e); + } + NODE NEW_OPT_N(NODE b) { + return rb_node_newnode(NODE_OPT_N,null,b,null); + } + NODE NEW_WHILE(NODE c, NODE b, int n) { + return rb_node_newnode(NODE_WHILE, c, b, new Integer(n)); + } + NODE NEW_UNTIL(NODE c, NODE b, int n) { + return rb_node_newnode(NODE_UNTIL, c, b, new Integer(n)); + } + NODE NEW_FOR(NODE v, NODE i, NODE b) { + return rb_node_newnode(NODE_FOR, v, b, i); + } + NODE NEW_ITER(NODE v, NODE i, NODE b) { + return rb_node_newnode(NODE_ITER, v, b, i); + } + NODE NEW_BREAK(NODE s) { + return rb_node_newnode(NODE_BREAK, s, null, null); + } + NODE NEW_NEXT(NODE s) { + return rb_node_newnode(NODE_NEXT,s,null,null); + } + NODE NEW_REDO() { + return rb_node_newnode(NODE_REDO,null,null,null); + } + NODE NEW_RETRY() { + return rb_node_newnode(NODE_RETRY,null,null,null); + } + NODE NEW_BEGIN(NODE b) { + return rb_node_newnode(NODE_BEGIN,null,b,null); + } + NODE NEW_RESCUE(NODE b, NODE res, NODE e) { + return rb_node_newnode(NODE_RESCUE, b, res, e); + } + NODE NEW_RESBODY(NODE a, NODE ex, NODE n) { + return rb_node_newnode(NODE_RESBODY, n, ex, a); + } + NODE NEW_ENSURE(NODE b, NODE en) { + return rb_node_newnode(NODE_ENSURE,b,null,en); + } + NODE NEW_RETURN(NODE s) { + return rb_node_newnode(NODE_RETURN,s,null,null); + } + NODE NEW_YIELD(NODE a) { + return rb_node_newnode(NODE_YIELD,a,null,null); + } + NODE NEW_LIST(NODE a) { + return NEW_ARRAY(a); + } + NODE NEW_ARRAY(NODE a) { + return rb_node_newnode(NODE_ARRAY,a,new Integer(1),null); + } + NODE NEW_ZARRAY() { + return rb_node_newnode(NODE_ZARRAY,null,null,null); + } + NODE NEW_HASH(NODE a) { + return rb_node_newnode(NODE_HASH,a,null,null); + } + NODE NEW_NOT(NODE a) { + return rb_node_newnode(NODE_NOT,null,a,null); + } + NODE NEW_MASGN(NODE l, NODE r) { + return rb_node_newnode(NODE_MASGN,l,null,r); + } + NODE NEW_GASGN(ID v, NODE val) { + return rb_node_newnode(NODE_GASGN,v,val,rb_global_entry(v)); + } + NODE NEW_LASGN(ID v, NODE val) { + return rb_node_newnode(NODE_LASGN,v,val,new Integer(local_cnt(v))); + } + NODE NEW_DASGN(ID v, NODE val) { + return rb_node_newnode(NODE_DASGN,v,val,null); + } + NODE NEW_DASGN_CURR(ID v, NODE val) { + return rb_node_newnode(NODE_DASGN_CURR,v,val,null); + } + NODE NEW_IASGN(ID v, NODE val) { + return rb_node_newnode(NODE_IASGN,v,val,null); + } + NODE NEW_CDECL(ID v, NODE val) { + return rb_node_newnode(NODE_CDECL,v,val,null); + } + NODE NEW_CVASGN(ID v, NODE val) { + return rb_node_newnode(NODE_CVASGN,v,val,null); + } + NODE NEW_CVDECL(ID v, NODE val) { + return rb_node_newnode(NODE_CVDECL,v,val,null); + } + NODE NEW_OP_ASGN1(NODE p, int id, NODE a) { + return rb_node_newnode(NODE_OP_ASGN1,p,new Integer(id),a); + } + NODE NEW_OP_ASGN2(NODE r, ID i, int o, NODE val) { + return rb_node_newnode(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o)); + } + NODE NEW_OP_ASGN22(ID i, int o) { + return rb_node_newnode(NODE_OP_ASGN2,i,new Integer(o),i.rb_id_attrset(ruby)); + } + NODE NEW_OP_ASGN_OR(NODE i,NODE val) { + return rb_node_newnode(NODE_OP_ASGN_OR,i,val,null); + } + NODE NEW_OP_ASGN_AND(NODE i, NODE val) { + return rb_node_newnode(NODE_OP_ASGN_AND,i,val,null); + } + NODE NEW_GVAR(ID v) { + return rb_node_newnode(NODE_GVAR,v,null,rb_global_entry(v)); + } + NODE NEW_LVAR(ID v) { + return rb_node_newnode(NODE_LVAR,v,null,new Integer(local_cnt(v))); + } + NODE NEW_DVAR(ID v) { + return rb_node_newnode(NODE_DVAR,v,null,null); + } + NODE NEW_IVAR(ID v) { + return rb_node_newnode(NODE_IVAR,v,null,null); + } + NODE NEW_CONST(ID v) { + return rb_node_newnode(NODE_CONST,v,null,null); + } + NODE NEW_CVAR(ID v) { + return rb_node_newnode(NODE_CVAR,v,null,null); + } + NODE NEW_CVAR2(ID v) { + return rb_node_newnode(NODE_CVAR2,v,null,null); + } + NODE NEW_NTH_REF(int n) { + return rb_node_newnode(NODE_NTH_REF,null,new Integer(n),new Integer(local_cnt('~'))); + } + NODE NEW_BACK_REF(int n) { + return rb_node_newnode(NODE_BACK_REF,null,new Integer(n),new Integer(local_cnt('~'))); + } + NODE NEW_MATCH(NODE c) { + return rb_node_newnode(NODE_MATCH,c,null,null); + } + NODE NEW_MATCH2(NODE n1, NODE n2) { + return rb_node_newnode(NODE_MATCH2,n1,n2,null); + } + NODE NEW_MATCH3(NODE r, NODE n2) { + return rb_node_newnode(NODE_MATCH3,r,n2,null); + } + NODE NEW_LIT(VALUE l) { + return rb_node_newnode(NODE_LIT,l,null,null); + } + NODE NEW_STR(VALUE s) { + return rb_node_newnode(NODE_STR,s,null,null); + } + NODE NEW_DSTR(VALUE s) { + return rb_node_newnode(NODE_DSTR,s,null,null); + } + NODE NEW_XSTR(VALUE s) { + return rb_node_newnode(NODE_XSTR,s,null,null); + } + NODE NEW_DXSTR(VALUE s) { + return rb_node_newnode(NODE_DXSTR,s,null,null); + } + NODE NEW_EVSTR(String s, int l) { + return rb_node_newnode(NODE_EVSTR,rb_str_new(s,l),null,null); + } + NODE NEW_CALL(NODE r, ID m, NODE a) { + return rb_node_newnode(NODE_CALL, r, m, a); + } + NODE NEW_FCALL(ID m, NODE a) { + return rb_node_newnode(NODE_FCALL,null,m, a); + } + NODE NEW_VCALL(ID m) { + return rb_node_newnode(NODE_VCALL,null,m,null); + } + NODE NEW_SUPER(NODE a) { + return rb_node_newnode(NODE_SUPER,null,null,a); + } + NODE NEW_ZSUPER() { + return rb_node_newnode(NODE_ZSUPER,null,null,null); + } + NODE NEW_ARGS(Integer f, Object o, Integer r) { + return rb_node_newnode(NODE_ARGS,o,r,f); + } + NODE NEW_ARGSCAT(NODE a, NODE b) { + return rb_node_newnode(NODE_ARGSCAT,a,b,null); + } + NODE NEW_ARGSPUSH(NODE a, NODE b) { + return rb_node_newnode(NODE_ARGSPUSH,a,b,null); + } + NODE NEW_RESTARGS(NODE a) { + return rb_node_newnode(NODE_RESTARGS,a,null,null); + } + NODE NEW_RESTARY(NODE a) { + return rb_node_newnode(NODE_RESTARY,a,null,null); + } + NODE NEW_REXPAND(NODE a) { + return rb_node_newnode(NODE_REXPAND,a,null,null); + } + NODE NEW_BLOCK_ARG(ID v) { + return rb_node_newnode(NODE_BLOCK_ARG,v,null,new Integer(local_cnt(v))); + } + NODE NEW_BLOCK_PASS(NODE b) { + return rb_node_newnode(NODE_BLOCK_PASS,null,b,null); + } + NODE NEW_ALIAS(ID n, ID o) { + return rb_node_newnode(NODE_ALIAS,o,n,null); + } + NODE NEW_VALIAS(ID n, ID o) { + return rb_node_newnode(NODE_VALIAS,o,n,null); + } + NODE NEW_UNDEF(ID i) { + return rb_node_newnode(NODE_UNDEF,null,i,null); + } + NODE NEW_CLASS(ID n, NODE b, NODE s) { + return rb_node_newnode(NODE_CLASS,n,NEW_SCOPE(b),(s)); + } + NODE NEW_SCLASS(NODE r, NODE b) { + return rb_node_newnode(NODE_SCLASS,r,NEW_SCOPE(b),null); + } + NODE NEW_MODULE(ID n, NODE b) { + return rb_node_newnode(NODE_MODULE,n,NEW_SCOPE(b),null); + } + NODE NEW_COLON2(NODE c, ID i) { + return rb_node_newnode(NODE_COLON2,c,i,null); + } + NODE NEW_COLON3(ID i) { + return rb_node_newnode(NODE_COLON3,null,i,null); + } + /*NODE NEW_CREF(c) { + return rb_node_newnode(NODE_CREF,null,null,c); + }*/ + NODE NEW_DOT2(NODE b, NODE e) { + return rb_node_newnode(NODE_DOT2,b,e,null); + } + NODE NEW_DOT3(NODE b, NODE e) { + return rb_node_newnode(NODE_DOT3,b,e,null); + } + NODE NEW_ATTRSET(NODE a) { + return rb_node_newnode(NODE_ATTRSET,a,null,null); + } + NODE NEW_SELF() { + return rb_node_newnode(NODE_SELF,null,null,null); + } + NODE NEW_NIL() { + return rb_node_newnode(NODE_NIL,null,null,null); + } + NODE NEW_TRUE() { + return rb_node_newnode(NODE_TRUE,null,null,null); + } + NODE NEW_FALSE() { + return rb_node_newnode(NODE_FALSE,null,null,null); + } + NODE NEW_DEFINED(NODE e) { + return rb_node_newnode(NODE_DEFINED,e,null,null); + } + NODE NEW_NEWLINE(NODE n) { + return rb_node_newnode(NODE_NEWLINE,null,null,n); + } + NODE NEW_PREEXE(NODE b) { + return NEW_SCOPE(b); + } + NODE NEW_POSTEXE() { + return rb_node_newnode(NODE_POSTEXE,null,null,null); + } + NODE NEW_DMETHOD(NODE b) { + return rb_node_newnode(NODE_DMETHOD,null,null,b); + } + NODE NEW_BMETHOD(NODE b) { + return rb_node_newnode(NODE_BMETHOD,null,null,b); + } + + private static NODE rb_node_newnode(int type, Object o1, Object o2, Object o3) { + return NODE.newNode(type, o1, o2, o3); + } + + // ----------------------------------------------------------------------- + // scanner stuff + // ----------------------------------------------------------------------- + + //XXX yyInput implementation + private int token = 0; + + public boolean advance () throws java.io.IOException { + return (token = yylex()) != 0; + } + + public int token () { + return token; + } + + public Object value () { + return yyVal; + } + //XXX yyInput END + + private String lex_curline; // current line + //private int lex_pbeg; //XXX not needed + private int lex_p; // pointer in current line + private int lex_pend; // pointer to end of line +/* + int yyerror(String msg) { + char *p, *pe, *buf; + int len, i; + + rb_compile_error("%s", msg); + p = lex_p; + while (lex_pbeg <= p) { + if (*p == '\n') break; + p--; + } + p++; + + pe = lex_p; + while (pe < lex_pend) { + if (*pe == '\n') break; + pe++; + } + + len = pe - p; + if (len > 4) { + buf = ALLOCA_N(char, len+2); + MEMCPY(buf, p, char, len); + buf[len] = '\0'; + rb_compile_error_append("%s", buf); + + i = lex_p - p; + p = buf; pe = p + len; + + while (p < pe) { + if (*p != '\t') *p = ' '; + p++; + } + buf[i] = '^'; + buf[i+1] = '\0'; + rb_compile_error_append("%s", buf); + } + + return 0; + } +*/ + private int heredoc_end; + private boolean command_start = true; + + int ruby_in_compile = 0; + boolean ruby__end__seen; // XXX is this really needed? + + private VALUE ruby_debug_lines; + + NODE yycompile(String f, int line) { + ID sl_id = ID.rb_intern("SCRIPT_LINES__", ruby); + if (!compile_for_eval && rb_safe_level() == 0 && + rb_const_defined(rb_cObject, sl_id)) { + + VALUE hash = rb_const_get(rb_cObject, sl_id); + if (TYPE(hash) == T_HASH) { + VALUE fname = rb_str_new2(f); + ruby_debug_lines = rb_hash_aref(hash, fname); + if (NIL_P(ruby_debug_lines)) { + ruby_debug_lines = rb_ary_new(); + rb_hash_aset(hash, fname, ruby_debug_lines); + } + } + if (line > 1) { + VALUE str = rb_str_new(null,0); + while (line > 1) { + rb_ary_push(ruby_debug_lines, str); + line--; + } + } + } + + ruby__end__seen = false; // is there an __end__{} statement? + ruby_eval_tree = null; // parser stores NODEs here + heredoc_end = 0; + ruby_sourcefile = f; // source file name + ruby_in_compile = 1; + + try { + yyparse(new yyInput() { + public boolean advance() throws java.io.IOException { + return parse.this.advance(); + } + public int token() { return parse.this.token(); } + public Object value() { return parse.this.value(); } + }, null); + } catch (Exception e) { + e.printStackTrace(); + } + + ruby_debug_lines = null; // remove debug info + compile_for_eval = false; + ruby_in_compile = 0; + cond_stack = 0; // reset stuff for next compile + cmdarg_stack = 0; // reset stuff for next compile + command_start = true; // reset stuff for next compile + class_nest = 0; + in_single = 0; + in_def = 0; + cur_mid = null; + + return ruby_eval_tree; + } + + // separate a Ruby string into lines... + + /** beginning of the next line */ + private int lex_gets_ptr; + private VALUE lex_input; /* non-nil if File */ + private VALUE lex_lastline; /* gc protect */ + + private VALUE lex_gets_str(VALUE _s) { + String s = ((RubyString)_s).getString(); + if (lex_gets_ptr != 0) { + if (s.length() == lex_gets_ptr) + return Qnil; + s = s.substring(lex_gets_ptr); + } + int end = 0; + while (end < s.length()) { + if (s.charAt(end++) == '\n') break; + } + lex_gets_ptr += end; + return rb_str_new(s, end); + } + + /** true, if scanner source is a file + and false, if lex_get_str() shall be used. */ + private boolean lex_file_io; + + /** Returns in next line either from file or from a string. */ + private VALUE lex_getline() { + VALUE line; + if (lex_file_io) + // uses rb_io_gets(lex_input) + throw new Error(); + else + line = lex_gets_str(lex_input); + + if (ruby_debug_lines != null && !NIL_P(line)) { + rb_ary_push(ruby_debug_lines, line); + } + return line; + } + + private void init_for_scanner(String s) { + lex_file_io = false; + lex_gets_ptr = 0; + lex_input = new RubyString(ruby, s); + lex_p = lex_pend = 0; + ruby_sourceline = 0; + compile_for_eval = ruby_in_eval; + ruby__end__seen = false;// is there an __end__{} statement? + heredoc_end = 0; + ruby_in_compile = 1; + } + + /** Compiles the given RString "s" */ + NODE rb_compile_string(String f, VALUE s, int line) { + lex_file_io = false; + lex_gets_ptr = 0; + lex_input = s; + lex_p = lex_pend = 0; + ruby_sourceline = line - 1; + + compile_for_eval = ruby_in_eval; + + return yycompile(f, line); + } + + /** Compiles the given Java String "s" */ + NODE rb_compile_cstr(String f, String s, int len, int line) { + return rb_compile_string(f, rb_str_new(s, len), line); + } + + /** Compiles the given file "file" */ + NODE rb_compile_file(String f, VALUE file, int start) { + lex_file_io = true; + lex_input = file; + lex_p = lex_pend = 0; + ruby_sourceline = start - 1; + + return yycompile(f, start); + } + + /** Returns the next character from input */ + private int nextc() { + int c; + + if (lex_p == lex_pend) { + if (lex_input != null) { + VALUE v = lex_getline(); + + if (NIL_P(v)) return -1; + if (heredoc_end > 0) { + ruby_sourceline = heredoc_end; + heredoc_end = 0; + } + ruby_sourceline++; + lex_curline = ((RubyString)v).getString(); + lex_p = 0; + lex_pend = lex_curline.length(); + if (lex_curline.startsWith("__END__") && (lex_pend == 7 || lex_curline.charAt(7) == '\n' || lex_curline.charAt(7) == '\r')) { + ruby__end__seen = true; + lex_lastline = null; + return -1; + } + lex_lastline = v; + } + else { + lex_lastline = null; + return -1; + } + } + c = lex_curline.charAt(lex_p++); + if (c == '\r' && lex_p <= lex_pend && lex_curline.charAt(lex_p) == '\n') { + lex_p++; + c = '\n'; + } + + return c; + } + + /** Puts back the given character so that nextc() will answer it next time + * it'll be called. */ + private void pushback(int c) { + if (c == -1) return; + lex_p--; + } + + /** Returns true if the given character is the current one in the input stream */ + private boolean peek(int c) { + return lex_p != lex_pend && c == lex_curline.charAt(lex_p); + } + + // deal with tokens.................. + + private StringBuffer tokenbuf; + + private String tok() { return tokenbuf.toString(); } + private int toklen() { return tokenbuf.length(); } + private void tokfix() { /*nothing to do*/ } + private char toklast() { return tokenbuf.charAt(toklen() - 1); } + + private void newtok() { + tokenbuf = new StringBuffer(60); + } + + private void tokadd(int c) { + tokenbuf.append((char)c); + } + + // yylex helpers................... + + private int read_escape() { + int c; + + switch (c = nextc()) { + case '\\': /* Backslash */ + return c; + + case 'n': /* newline */ + return '\n'; + + case 't': /* horizontal tab */ + return '\t'; + + case 'r': /* carriage-return */ + return '\r'; + + case 'f': /* form-feed */ + return '\f'; + + case 'v': /* vertical tab */ + return '\013'; + + case 'a': /* alarm(bell) */ + return '\007'; + + case 'e': /* escape */ + return '\033'; + + case '0': case '1': case '2': case '3': /* octal constant */ + case '4': case '5': case '6': case '7': + { + int cc = 0; + + pushback(c); + for (int i=0; i<3; i++) { + c = nextc(); + if (c == -1) { + // goto eof + yyerror("Invalid escape character syntax"); + return '\0'; + } + if (c < '0' || '7' < c) { + pushback(c); + break; + } + cc = cc * 8 + c - '0'; + } + c = cc; + } + return c; + + case 'x': /* hex constant */ + { + int[] numlen = new int[1]; + c = (int)scan_hex(lex_curline, lex_p, 2, numlen); + lex_p += numlen[0]; + } + return c; + + case 'b': /* backspace */ + return '\010'; + + case 's': /* space */ + return ' '; + + case 'M': + if ((c = nextc()) != '-') { + yyerror("Invalid escape character syntax"); + pushback(c); + return '\0'; + } + if ((c = nextc()) == '\\') { + return read_escape() | 0x80; + } + else if (c == -1) { + // goto eof + yyerror("Invalid escape character syntax"); + return '\0'; + } + else { + return ((c & 0xff) | 0x80); + } + + case 'C': + if ((c = nextc()) != '-') { + yyerror("Invalid escape character syntax"); + pushback(c); + return '\0'; + } + case 'c': + if ((c = nextc())== '\\') { + c = read_escape(); + } + else if (c == '?') + return 0177; + else if (c == -1) { + // goto eof + yyerror("Invalid escape character syntax"); + return '\0'; + } + return c & 0x9f; + + case -1: + // eof: + yyerror("Invalid escape character syntax"); + return '\0'; + + default: + return c; + } + } + + private int tokadd_escape() { + int c; + + switch (c = nextc()) { + case '\n': + return 0; /* just ignore */ + + case '0': case '1': case '2': case '3': /* octal constant */ + case '4': case '5': case '6': case '7': + { + int i; + + tokadd('\\'); + tokadd(c); + for (i=0; i<2; i++) { + c = nextc(); + if (c == -1) { + //goto eof; + yyerror("Invalid escape character syntax"); + return -1; + } + if (c < '0' || '7' < c) { + pushback(c); + break; + } + tokadd(c); + } + } + return 0; + + case 'x': /* hex constant */ + { + tokadd('\\'); + tokadd(c); + + int[] numlen = new int[1]; + scan_hex(lex_curline, lex_p, 2, numlen); + while (numlen[0]-- != 0) + tokadd(nextc()); + } + return 0; + + case 'M': + if ((c = nextc()) != '-') { + yyerror("Invalid escape character syntax"); + pushback(c); + return 0; + } + tokadd('\\'); tokadd('M'); tokadd('-'); + //goto escaped; + if ((c = nextc()) == '\\') { + return tokadd_escape(); + } + else if (c == -1) { + // goto eof; + yyerror("Invalid escape character syntax"); + return -1; + } + tokadd(c); + return 0; + + case 'C': + if ((c = nextc()) != '-') { + yyerror("Invalid escape character syntax"); + pushback(c); + return 0; + } + tokadd('\\'); tokadd('C'); tokadd('-'); + //goto escaped; + if ((c = nextc()) == '\\') { + return tokadd_escape(); + } + else if (c == -1) { + // goto eof; + yyerror("Invalid escape character syntax"); + return -1; + } + tokadd(c); + return 0; + + case 'c': + tokadd('\\'); tokadd('c'); + //escaped: + if ((c = nextc()) == '\\') { + return tokadd_escape(); + } + else if (c == -1) { + // goto eof; + yyerror("Invalid escape character syntax"); + return -1; + } + tokadd(c); + return 0; + + case -1: + // eof: + yyerror("Invalid escape character syntax"); + return -1; + + default: + tokadd('\\'); + tokadd(c); + } + return 0; + } + + private int parse_regx(int term, int paren) { + int c; + char kcode = 0; + boolean once = false; + int nest = 0; + int options = 0; + int re_start = ruby_sourceline; + NODE list = null; + + newtok(); + regx_end: + while ((c = nextc()) != -1) { + if (c == term && nest == 0) { + break regx_end; + } + + switch (c) { + case '#': + list = str_extend(list, term); + if (list == NODE.MINUS_ONE) return 0; + continue; + + case '\\': + if (tokadd_escape() < 0) + return 0; + continue; + + case -1: + //goto unterminated; + ruby_sourceline = re_start; + rb_compile_error("unterminated regexp meets end of file"); + return 0; + + default: + if (paren != 0) { + if (c == paren) nest++; + if (c == term) nest--; + } + /* + if (ismbchar(c)) { + int i, len = mbclen(c)-1; + + for (i = 0; i < len; i++) { + tokadd(c); + c = nextc(); + } + } + */ + break; + } + tokadd(c); + } + + end_options: + for (;;) { + switch (c = nextc()) { + case 'i': + options |= RE_OPTION_IGNORECASE; + break; + case 'x': + options |= RE_OPTION_EXTENDED; + break; + case 'p': /* /p is obsolete */ + rb_warn("/p option is obsolete; use /m\n\tnote: /m does not change ^, $ behavior"); + options |= RE_OPTION_POSIXLINE; + break; + case 'm': + options |= RE_OPTION_MULTILINE; + break; + case 'o': + once = true; + break; + case 'n': + kcode = 16; + break; + case 'e': + kcode = 32; + break; + case 's': + kcode = 48; + break; + case 'u': + kcode = 64; + break; + default: + pushback(c); + break end_options; + } + } + + tokfix(); + lex_state = EXPR_END; + if (list != null) { + nd_set_line(list, re_start); + if (toklen() > 0) { + VALUE ss = rb_str_new(tok(), toklen()); + list_append(list, NEW_STR(ss)); + } + nd_set_type(list, once?NODE_DREGX_ONCE:NODE_DREGX); + list.nd_cflag(new RubyId(ruby, options | kcode)); + yyVal = (NODE)list; + return tDREGEXP; + } + else { + yyVal = (VALUE)rb_reg_new(tok(), toklen(), options | kcode); + return tREGEXP; + } + //unterminated: + //ruby_sourceline = re_start; + //rb_compile_error("unterminated regexp meets end of file"); + //return 0; + } + + private int parse_string(int func, int term, int paren) { + int c; + NODE list = null; + int strstart; + int nest = 0; + + if (func == '\'') { + return parse_qstring(term, paren); + } + if (func == 0) { + /* read 1 line for heredoc */ + /* -1 for chomp */ + yyVal = (VALUE)rb_str_new(lex_curline, lex_pend - 1); + lex_p = lex_pend; + return tSTRING; + } + strstart = ruby_sourceline; + newtok(); + while ((c = nextc()) != term || nest > 0) { + if (c == -1) { + //unterm_str: + ruby_sourceline = strstart; + rb_compile_error("unterminated string meets end of file"); + return 0; + } + /* + if (ismbchar(c)) { + int i, len = mbclen(c)-1; + + for (i = 0; i < len; i++) { + tokadd(c); + c = nextc(); + } + } + else*/ if (c == '#') { + list = str_extend(list, term); + if (list == NODE.MINUS_ONE) { + //goto unterm_str; + ruby_sourceline = strstart; + rb_compile_error("unterminated string meets end of file"); + return 0; + } + continue; + } + else if (c == '\\') { + c = nextc(); + if (c == '\n') + continue; + if (c == term) { + tokadd(c); + } + else { + pushback(c); + if (func != '"') tokadd('\\'); + tokadd(read_escape()); + } + continue; + } + if (paren != 0) { + if (c == paren) nest++; + if (c == term && nest-- == 0) break; + } + tokadd(c); + } + + tokfix(); + lex_state = EXPR_END; + + if (list != null) { + nd_set_line(list, strstart); + if (toklen() > 0) { + VALUE ss = rb_str_new(tok(), toklen()); + list_append(list, NEW_STR(ss)); + } + yyVal = (NODE)list; + if (func == '`') { + nd_set_type(list, NODE.NODE_DXSTR); + return tDXSTRING; + } + else { + return tDSTRING; + } + } + else { + yyVal = (VALUE)rb_str_new(tok(), toklen()); + return (func == '`') ? tXSTRING : tSTRING; + } + } + + private int parse_qstring(int term, int paren) { + int strstart; + int c; + int nest = 0; + + strstart = ruby_sourceline; + newtok(); + while ((c = nextc()) != term || nest > 0) { + if (c == -1) { + ruby_sourceline = strstart; + rb_compile_error("unterminated string meets end of file"); + return 0; + } + /*if (ismbchar(c)) { + int i, len = mbclen(c)-1; + + for (i = 0; i < len; i++) { + tokadd(c); + c = nextc(); + } + } + else*/ if (c == '\\') { + c = nextc(); + switch (c) { + case '\n': + continue; + + case '\\': + c = '\\'; + break; + + default: + /* fall through */ + if (c == term || (paren!=0 && c == paren)) { + tokadd(c); + continue; + } + tokadd('\\'); + } + } + if (paren!=0) { + if (c == paren) nest++; + if (c == term && nest-- == 0) break; + } + tokadd(c); + } + + tokfix(); + yyVal = (VALUE)rb_str_new(tok(), toklen()); + lex_state = EXPR_END; + return tSTRING; + } + + private int parse_quotedwords(int term, int paren) { + NODE qwords = null; + int strstart; + int c; + int nest = 0; + + strstart = ruby_sourceline; + newtok(); + + c = nextc(); + while (ISSPACE(c)) + c = nextc(); /* skip preceding spaces */ + pushback(c); + while ((c = nextc()) != term || nest > 0) { + if (c == -1) { + ruby_sourceline = strstart; + rb_compile_error("unterminated string meets end of file"); + return 0; + } + /*if (ismbchar(c)) { + int i, len = mbclen(c)-1; + + for (i = 0; i < len; i++) { + tokadd(c); + c = nextc(); + } + } + else*/ if (c == '\\') { + c = nextc(); + switch (c) { + case '\n': + continue; + case '\\': + c = '\\'; + break; + default: + if (c == term || (paren!=0 && c == paren)) { + tokadd(c); + continue; + } + if (!ISSPACE(c)) + tokadd('\\'); + break; + } + } + else if (ISSPACE(c)) { + NODE str; + + tokfix(); + str = NEW_STR(rb_str_new(tok(), toklen())); + newtok(); + if (qwords == null) qwords = NEW_LIST(str); + else list_append(qwords, str); + c = nextc(); + while (ISSPACE(c)) + c = nextc(); /* skip continuous spaces */ + pushback(c); + continue; + } + if (paren != 0) { + if (c == paren) nest++; + if (c == term && nest-- == 0) break; + } + tokadd(c); + } + + tokfix(); + if (toklen() > 0) { + NODE str = NEW_STR(rb_str_new(tok(), toklen())); + if (qwords == null) qwords = NEW_LIST(str); + else list_append(qwords, str); + } + if (qwords == null) qwords = NEW_ZARRAY(); + yyVal = (NODE)qwords; + lex_state = EXPR_END; + return tDSTRING; + } + + private int here_document(int term, int indent) { + throw new Error("not supported yet"); + } +/* + private int here_document(int term, int indent) { + int c; + //char *eos, *p; + int len; + VALUE str; + VALUE line = 0; + VALUE lastline_save; + int offset_save; + NODE *list = 0; + int linesave = ruby_sourceline; + + newtok(); + switch (term) { + case '\'': + case '"': + case '`': + while ((c = nextc()) != term) { + tokadd(c); + } + if (term == '\'') term = 0; + break; + + default: + c = term; + term = '"'; + if (!is_identchar(c)) { + rb_warn("use of bare << to mean <<\"\" is deprecated"); + break; + } + while (is_identchar(c)) { + tokadd(c); + c = nextc(); + } + pushback(c); + break; + } + tokfix(); + lastline_save = lex_lastline; + offset_save = lex_p - lex_pbeg; + eos = strdup(tok()); + len = strlen(eos); + + str = rb_str_new(0,0); + for (;;) { + lex_lastline = line = lex_getline(); + if (NIL_P(line)) { + //error: + ruby_sourceline = linesave; + rb_compile_error("can't find string \"%s\" anywhere before EOF", eos); + free(eos); + return 0; + } + ruby_sourceline++; + p = RSTRING(line).ptr; + if (indent) { + while (*p && (*p == ' ' || *p == '\t')) { + p++; + } + } + if (strncmp(eos, p, len) == 0) { + if (p[len] == '\n' || p[len] == '\r') + break; + if (len == RSTRING(line).len) + break; + } + + lex_pbeg = lex_p = RSTRING(line).ptr; + lex_pend = lex_p + RSTRING(line).len; + retry:for(;;) { + switch (parse_string(term, '\n', '\n')) { + case tSTRING: + case tXSTRING: + rb_str_cat2((VALUE)yyVal, "\n"); + if (!list) { + rb_str_append(str, (VALUE)yyVal); + } + else { + list_append(list, NEW_STR((VALUE)yyVal)); + } + break; + case tDSTRING: + if (!list) list = NEW_DSTR(str); + // fall through + case tDXSTRING: + if (!list) list = NEW_DXSTR(str); + + list_append((NODE)yyVal, NEW_STR(rb_str_new2("\n"))); + nd_set_type((NODE)yyVal, NODE_STR); + yyVal = (NODE)NEW_LIST((NODE)yyVal); + ((NODE)yyVal).nd_next() = ((NODE)yyVal).nd_head().nd_next(); + list_concat(list, (NODE)yyVal); + break; + + case 0: + ruby_sourceline = linesave; + rb_compile_error("can't find string \"%s\" anywhere before EOF", eos); + free(eos); + return 0; + } + if (lex_p != lex_pend) { + continue retry; + } + break retry;} + } + free(eos); + lex_lastline = lastline_save; + lex_pbeg = RSTRING(lex_lastline).ptr; + lex_pend = lex_pbeg + RSTRING(lex_lastline).len; + lex_p = lex_pbeg + offset_save; + + lex_state = EXPR_END; + heredoc_end = ruby_sourceline; + ruby_sourceline = linesave; + + if (list) { + nd_set_line(list, linesave+1); + yyVal = (NODE)list; + } + switch (term) { + case '\0': + case '\'': + case '"': + if (list) return tDSTRING; + yyVal = (VALUE)str; + return tSTRING; + case '`': + if (list) return tDXSTRING; + yyVal = (VALUE)str; + return tXSTRING; + } + return 0; + } +*/ + + private void arg_ambiguous() { + rb_warning("ambiguous first argument; make sure"); + } + + private boolean IS_ARG() { + return lex_state == EXPR_ARG || lex_state == EXPR_CMDARG; + } + + /** Returns the next token. Also sets yyVal is needed. */ + private int yylex() { + int c; + boolean space_seen = false; + boolean cmd_state; + kwtable kw; + + cmd_state = command_start; + command_start = false; + retry:for(;;) { + switch (c = nextc()) { + case '\0': /* NUL */ + case '\004': /* ^D */ + case '\032': /* ^Z */ + case -1: /* end of script. */ + return 0; + + /* white spaces */ + case ' ': case '\t': case '\f': case '\r': + case '\013': /* '\v' */ + space_seen = true; + continue retry; + + case '#': /* it's a comment */ + while ((c = nextc()) != '\n') { + if (c == -1) + return 0; + } + /* fall through */ + case '\n': + switch (lex_state) { + case EXPR_BEG: + case EXPR_FNAME: + case EXPR_DOT: + continue retry; + default: + break; + } + command_start = true; + lex_state = EXPR_BEG; + return '\n'; + + case '*': + if ((c = nextc()) == '*') { + lex_state = EXPR_BEG; + if (nextc() == '=') { + yyVal = new RubyId(ruby, tPOW); + return tOP_ASGN; + } + pushback(c); + return tPOW; + } + if (c == '=') { + yyVal = new RubyId(ruby, '*'); + lex_state = EXPR_BEG; + return tOP_ASGN; + } + pushback(c); + if (IS_ARG() && space_seen && !ISSPACE(c)){ + rb_warning("`*' interpreted as argument prefix"); + c = tSTAR; + } + else if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + c = tSTAR; + } + else { + c = '*'; + } + lex_state = EXPR_BEG; + return c; + + case '!': + lex_state = EXPR_BEG; + if ((c = nextc()) == '=') { + return tNEQ; + } + if (c == '~') { + return tNMATCH; + } + pushback(c); + return '!'; + + case '=': + if (lex_p == 1) { + /* skip embedded rd document */ + if (lex_curline.startsWith("=begin") && (lex_pend == 6 || ISSPACE(lex_curline.charAt(6)))) { + for (;;) { + lex_p = lex_pend; + c = nextc(); + if (c == -1) { + rb_compile_error("embedded document meets end of file"); + return 0; + } + if (c != '=') continue; + if (lex_curline.substring(lex_p, lex_p + 3).equals("end") && + (lex_p + 3 == lex_pend || ISSPACE(lex_curline.charAt(lex_p + 3)))) { + break; + } + } + lex_p = lex_pend; + continue retry; + } + } + + lex_state = EXPR_BEG; + if ((c = nextc()) == '=') { + if ((c = nextc()) == '=') { + return tEQQ; + } + pushback(c); + return tEQ; + } + if (c == '~') { + return tMATCH; + } + else if (c == '>') { + return tASSOC; + } + pushback(c); + return '='; + + case '<': + c = nextc(); + if (c == '<' && + lex_state != EXPR_END && + lex_state != EXPR_ENDARG + && lex_state != EXPR_CLASS && + (!IS_ARG() || space_seen)) { + int c2 = nextc(); + int indent = 0; + if (c2 == '-') { + indent = 1; + c2 = nextc(); + } + if (!ISSPACE(c2) && ("\"'`".indexOf(c2) != -1 || is_identchar(c2))) { + return here_document(c2, indent); + } + pushback(c2); + } + lex_state = EXPR_BEG; + if (c == '=') { + if ((c = nextc()) == '>') { + return tCMP; + } + pushback(c); + return tLEQ; + } + if (c == '<') { + if (nextc() == '=') { + yyVal = new RubyId(ruby, tLSHFT); + return tOP_ASGN; + } + pushback(c); + return tLSHFT; + } + pushback(c); + return '<'; + + case '>': + lex_state = EXPR_BEG; + if ((c = nextc()) == '=') { + return tGEQ; + } + if (c == '>') { + if ((c = nextc()) == '=') { + yyVal = new RubyId(ruby, tRSHFT); + return tOP_ASGN; + } + pushback(c); + return tRSHFT; + } + pushback(c); + return '>'; + + case '"': + return parse_string(c,c,c); + case '`': + if (lex_state == EXPR_FNAME) return c; + if (lex_state == EXPR_DOT) return c; + return parse_string(c,c,c); + + case '\'': + return parse_qstring(c,0); + + case '?': + if (lex_state == EXPR_END || lex_state == EXPR_ENDARG) { + lex_state = EXPR_BEG; + return '?'; + } + c = nextc(); + if (c == -1 || c == 10) { + rb_compile_error("incomplete character syntax"); + return 0; + } + if (IS_ARG() && ISSPACE(c)){ + pushback(c); + lex_state = EXPR_BEG; + return '?'; + } + if (c == '\\') { + c = read_escape(); + } + c &= 0xff; + yyVal = (VALUE)INT2FIX(c); + lex_state = EXPR_END; + return tINTEGER; + + case '&': + if ((c = nextc()) == '&') { + lex_state = EXPR_BEG; + if ((c = nextc()) == '=') { + yyVal = new RubyId(ruby, tANDOP); + return tOP_ASGN; + } + pushback(c); + return tANDOP; + } + else if (c == '=') { + yyVal = new RubyId(ruby, '&'); + lex_state = EXPR_BEG; + return tOP_ASGN; + } + pushback(c); + if (IS_ARG() && space_seen && !ISSPACE(c)){ + rb_warning("`&' interpeted as argument prefix"); + c = tAMPER; + } + else if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + c = tAMPER; + } + else { + c = '&'; + } + lex_state = EXPR_BEG; + return c; + + case '|': + lex_state = EXPR_BEG; + if ((c = nextc()) == '|') { + if ((c = nextc()) == '=') { + yyVal = new RubyId(ruby, tOROP); + return tOP_ASGN; + } + pushback(c); + return tOROP; + } + else if (c == '=') { + yyVal = new RubyId(ruby, '|'); + return tOP_ASGN; + } + pushback(c); + return '|'; + + case '+': + c = nextc(); + if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) { + if (c == '@') { + return tUPLUS; + } + pushback(c); + return '+'; + } + if (c == '=') { + lex_state = EXPR_BEG; + yyVal = new RubyId(ruby, '+'); + return tOP_ASGN; + } + if (lex_state == EXPR_BEG || lex_state == EXPR_MID || + (IS_ARG() && space_seen && !ISSPACE(c))) { + if (IS_ARG()) arg_ambiguous(); + lex_state = EXPR_BEG; + pushback(c); + if (Character.isDigit((char)c)) { + c = '+'; + return start_num(c); + } + return tUPLUS; + } + lex_state = EXPR_BEG; + pushback(c); + return '+'; + + case '-': + c = nextc(); + if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) { + if (c == '@') { + return tUMINUS; + } + pushback(c); + return '-'; + } + if (c == '=') { + lex_state = EXPR_BEG; + yyVal = new RubyId(ruby, '-'); + return tOP_ASGN; + } + if (lex_state == EXPR_BEG || lex_state == EXPR_MID || + (IS_ARG() && space_seen && !ISSPACE(c))) { + if (IS_ARG()) arg_ambiguous(); + lex_state = EXPR_BEG; + pushback(c); + if (Character.isDigit((char)c)) { + c = '-'; + return start_num(c); + } + return tUMINUS; + } + lex_state = EXPR_BEG; + pushback(c); + return '-'; + + case '.': + lex_state = EXPR_BEG; + if ((c = nextc()) == '.') { + if ((c = nextc()) == '.') { + return tDOT3; + } + pushback(c); + return tDOT2; + } + pushback(c); + if (!Character.isDigit((char)c)) { + lex_state = EXPR_DOT; + return '.'; + } + c = '.'; + /* fall through */ + + //start_num: + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + return start_num(c); + + case ']': + case '}': + case ')': + COND_LEXPOP(); + CMDARG_LEXPOP(); + lex_state = EXPR_END; + return c; + + case ':': + c = nextc(); + if (c == ':') { + if (lex_state == EXPR_BEG || lex_state == EXPR_MID || + (IS_ARG() && space_seen)) { + lex_state = EXPR_BEG; + return tCOLON3; + } + lex_state = EXPR_DOT; + return tCOLON2; + } + pushback(c); + if (lex_state == EXPR_END || lex_state == EXPR_ENDARG || ISSPACE(c)) { + lex_state = EXPR_BEG; + return ':'; + } + lex_state = EXPR_FNAME; + return tSYMBEG; + + case '/': + if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + return parse_regx('/', '/'); + } + if ((c = nextc()) == '=') { + lex_state = EXPR_BEG; + yyVal = new RubyId(ruby, '/'); + return tOP_ASGN; + } + pushback(c); + if (IS_ARG() && space_seen) { + if (!ISSPACE(c)) { + arg_ambiguous(); + return parse_regx('/', '/'); + } + } + lex_state = EXPR_BEG; + return '/'; + + case '^': + lex_state = EXPR_BEG; + if ((c = nextc()) == '=') { + yyVal = new RubyId(ruby, '^'); + return tOP_ASGN; + } + pushback(c); + return '^'; + + case ';': + command_start = true; + case ',': + lex_state = EXPR_BEG; + return c; + + case '~': + if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) { + if ((c = nextc()) != '@') { + pushback(c); + } + } + lex_state = EXPR_BEG; + return '~'; + + case '(': + command_start = true; + if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + c = tLPAREN; + } + else if (space_seen) { + if (lex_state == EXPR_CMDARG) { + c = tLPAREN_ARG; + } + else if (lex_state == EXPR_ARG) { + rb_warning("%s (...) interpreted as method call", tok()); + c = tLPAREN_ARG; + } + } + COND_PUSH(0); + CMDARG_PUSH(0); + lex_state = EXPR_BEG; + return c; + + case '[': + if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) { + if ((c = nextc()) == ']') { + if ((c = nextc()) == '=') { + return tASET; + } + pushback(c); + return tAREF; + } + pushback(c); + return '['; + } + else if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + c = tLBRACK; + } + else if (IS_ARG() && space_seen) { + c = tLBRACK; + } + lex_state = EXPR_BEG; + COND_PUSH(0); + CMDARG_PUSH(0); + return c; + + case '{': + if (!IS_ARG()) { + if (space_seen && lex_state == EXPR_ENDARG) + c = tLBRACE_ARG; + if (lex_state != EXPR_END && lex_state != EXPR_ENDARG) + c = tLBRACE; + } + COND_PUSH(0); + CMDARG_PUSH(0); + lex_state = EXPR_BEG; + return c; + + case '\\': + c = nextc(); + if (c == '\n') { + space_seen = true; + continue retry; /* skip \\n */ + } + pushback(c); + return '\\'; + + case '%': + quotation:for(;;) { + if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + int term; + int paren; + + c = nextc(); + if (!Character.isLetterOrDigit((char)c)) { + term = c; + c = 'Q'; + } + else { + term = nextc(); + } + if (c == -1 || term == -1) { + rb_compile_error("unterminated quoted string meets end of file"); + return 0; + } + paren = term; + if (term == '(') term = ')'; + else if (term == '[') term = ']'; + else if (term == '{') term = '}'; + else if (term == '<') term = '>'; + else paren = 0; + + switch (c) { + case 'Q': + return parse_string('"', term, paren); + + case 'q': + return parse_qstring(term, paren); + + case 'w': + return parse_quotedwords(term, paren); + + case 'x': + return parse_string('`', term, paren); + + case 'r': + return parse_regx(term, paren); + + default: + yyerror("unknown type of %string"); + return 0; + } + } + if ((c = nextc()) == '=') { + yyVal = new RubyId(ruby, '%'); + return tOP_ASGN; + } + if (IS_ARG() && space_seen && !ISSPACE(c)) { + pushback(c); + continue quotation; + } + break quotation; + } + lex_state = EXPR_BEG; + pushback(c); + return '%'; + + case '$': + lex_state = EXPR_END; + newtok(); + c = nextc(); + switch (c) { + case '_': /* $_: last read line string */ + c = nextc(); + if (is_identchar(c)) { + tokadd('$'); + tokadd('_'); + break; + } + pushback(c); + c = '_'; + /* fall through */ + case '~': /* $~: match-data */ + local_cnt(c); + /* fall through */ + case '*': /* $*: argv */ + case '$': /* $$: pid */ + case '?': /* $?: last status */ + case '!': /* $!: error string */ + case '@': /* $@: error position */ + case '/': /* $/: input record separator */ + case '\\': /* $\: output record separator */ + case ';': /* $;: field separator */ + case ',': /* $,: output field separator */ + case '.': /* $.: last read line number */ + case '=': /* $=: ignorecase */ + case ':': /* $:: load path */ + case '<': /* $<: reading filename */ + case '>': /* $>: default output handle */ + case '\"': /* $": already loaded files */ + tokadd('$'); + tokadd(c); + tokfix(); + yyVal = ID.rb_intern(tok(), ruby); + return tGVAR; + + case '-': + tokadd('$'); + tokadd(c); + c = nextc(); + tokadd(c); + tokfix(); + yyVal = ID.rb_intern(tok(), ruby); + /* xxx shouldn't check if valid option variable */ + return tGVAR; + + case '&': /* $&: last match */ + case '`': /* $`: string before last match */ + case '\'': /* $': string after last match */ + case '+': /* $+: string matches last paren. */ + yyVal = NEW_BACK_REF(c); + return tBACK_REF; + + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + tokadd('$'); + while (Character.isDigit((char)c)) { + tokadd(c); + c = nextc(); + } + if (is_identchar(c)) + break; + pushback(c); + tokfix(); + yyVal = NEW_NTH_REF(Integer.parseInt(tok().substring(1))); + return tNTH_REF; + + default: + if (!is_identchar(c)) { + pushback(c); + return '$'; + } + case '0': + tokadd('$'); + } + break; + + case '@': + c = nextc(); + newtok(); + tokadd('@'); + if (c == '@') { + tokadd('@'); + c = nextc(); + } + if (Character.isDigit((char)c)) { + rb_compile_error("`@%c' is not a valid instance variable name", new Integer(c)); + } + if (!is_identchar(c)) { + pushback(c); + return '@'; + } + break; + + default: + if (!is_identchar(c) || Character.isDigit((char)c)) { + rb_compile_error("Invalid char `\\%03o' in expression", new Integer(c)); + continue retry; + } + + newtok(); + break; + } + break retry; + } + + while (is_identchar(c)) { + tokadd(c); + /*if (ismbchar(c)) { + int i, len = mbclen(c)-1; + + for (i = 0; i < len; i++) { + c = nextc(); + tokadd(c); + } + }*/ + c = nextc(); + } + if ((c == '!' || c == '?') && is_identchar(tok().charAt(0)) && !peek('=')) { + tokadd(c); + } + else { + pushback(c); + } + tokfix(); + + { + int result = 0; + + switch (tok().charAt(0)) { + case '$': + lex_state = EXPR_END; + result = tGVAR; + break; + case '@': + lex_state = EXPR_END; + if (tok().charAt(1) == '@') + result = tCVAR; + else + result = tIVAR; + break; + default: + if (lex_state != EXPR_DOT) { + /* See if it is a reserved word. */ + kw = rb_reserved_word(tok(), toklen()); + if (kw != null) { + /*enum lex_state*/int state = lex_state; + lex_state = kw.state; + if (state == EXPR_FNAME) { + yyVal = ID.rb_intern(kw.name, ruby); + } + if (kw.id0 == kDO) { + if (COND_P()) return kDO_COND; + if (CMDARG_P() && state != EXPR_CMDARG) + return kDO_BLOCK; + return kDO; + } + if (state == EXPR_BEG) + return kw.id0; + else { + if (kw.id0 != kw.id1) + lex_state = EXPR_BEG; + return kw.id1; + } + } + } + + if (toklast() == '!' || toklast() == '?') { + result = tFID; + } + else { + if (lex_state == EXPR_FNAME) { + if ((c = nextc()) == '=' && !peek('~') && !peek('>') && + (!peek('=') || lex_p + 1 < lex_pend && lex_curline.charAt(lex_p + 1) == '>')) { + result = tIDENTIFIER; + tokadd(c); + } + else { + pushback(c); + } + } + if (result == 0 && Character.isUpperCase(tok().charAt(0))) { + result = tCONSTANT; + } + else { + result = tIDENTIFIER; + } + } + if (lex_state == EXPR_BEG || + lex_state == EXPR_DOT || + lex_state == EXPR_ARG || + lex_state == EXPR_CMDARG) { + if (cmd_state) + lex_state = EXPR_CMDARG; + else + lex_state = EXPR_ARG; + } + else { + lex_state = EXPR_END; + } + } + tokfix(); + yyVal = /*last_id =*/ ID.rb_intern(tok(), ruby); //XXX really overwrite last_id? + return result; + } + } + + private int start_num(int c) { + boolean is_float, seen_point, seen_e, seen_uc; + + is_float = seen_point = seen_e = seen_uc = false; + lex_state = EXPR_END; + newtok(); + if (c == '-' || c == '+') { + tokadd(c); + c = nextc(); + } + if (c == '0') { + c = nextc(); + if (c == 'x' || c == 'X') { + /* hexadecimal */ + c = nextc(); + do { + if (c == '_') { + seen_uc = true; + continue; + } + if (!ISXDIGIT(c)) break; + seen_uc = false; + tokadd(c); + } while ((c = nextc()) != 0); + pushback(c); + tokfix(); + if (toklen() == 0) { + yyerror("hexadecimal number without hex-digits"); + } + else if (seen_uc) return decode_num(c, is_float, seen_uc, true); + yyVal = rb_cstr2inum(tok(), 16); + return tINTEGER; + } + if (c == 'b' || c == 'B') { + /* binary */ + c = nextc(); + do { + if (c == '_') { + seen_uc = true; + continue; + } + if (c != '0'&& c != '1') break; + seen_uc = false; + tokadd(c); + } while ((c = nextc()) != 0); + pushback(c); + tokfix(); + if (toklen() == 0) { + yyerror("numeric literal without digits"); + } + else if (seen_uc) return decode_num(c, is_float, seen_uc, true); + yyVal = (VALUE)rb_cstr2inum(tok(), 2); + return tINTEGER; + } + if (c >= '0' && c <= '7' || c == '_') { + /* octal */ + do { + if (c == '_') { + seen_uc = true; + continue; + } + if (c < '0' || c > '7') break; + seen_uc = false; + tokadd(c); + } while ((c = nextc()) != 0); + pushback(c); + tokfix(); + if (seen_uc) return decode_num(c, is_float, seen_uc, true); + yyVal = (VALUE)rb_cstr2inum(tok(), 8); + return tINTEGER; + } + if (c > '7' && c <= '9') { + yyerror("Illegal octal digit"); + } + else if (c == '.') { + tokadd('0'); + } + else { + pushback(c); + yyVal = (VALUE)INT2FIX(0); + return tINTEGER; + } + } + + for (;;) { + switch (c) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + seen_uc = false; + tokadd(c); + break; + + case '.': + if (seen_point || seen_e) { + return decode_num(c, is_float, seen_uc); + } + else { + int c0 = nextc(); + if (!Character.isDigit((char)c0)) { + pushback(c0); + return decode_num(c, is_float, seen_uc); + } + c = c0; + } + tokadd('.'); + tokadd(c); + is_float = true; + seen_point = true; + seen_uc = false; + break; + + case 'e': + case 'E': + if (seen_e) { + return decode_num(c, is_float, seen_uc); + } + tokadd(c); + seen_e = true; + is_float = true; + while ((c = nextc()) == '_') + seen_uc = true; + if (c == '-' || c == '+') + tokadd(c); + else + continue; + break; + + case '_': /* `_' in number just ignored */ + seen_uc = true; + break; + + default: + return decode_num(c, is_float, seen_uc); + } + c = nextc(); + } + } + + private int decode_num(int c, boolean is_float, boolean seen_uc) { + return decode_num(c, is_float, seen_uc, false); + } + + private int decode_num(int c, boolean is_float, boolean seen_uc, boolean trailing_uc) { + if (!trailing_uc) { + pushback(c); + tokfix(); + } + if (seen_uc || trailing_uc) { + //trailing_uc: + yyerror("trailing `_' in number"); + } + if (is_float) { + double d = 0.0; + try { + d = Double.parseDouble(tok()); + } catch (NumberFormatException e) { + rb_warn("Float %s out of range", tok()); + } + yyVal = (VALUE)rb_float_new(d); + return tFLOAT; + } + yyVal = (VALUE)rb_cstr2inum(tok(), 10); + return tINTEGER; + } + + private NODE str_extend(NODE list, int term) + { + int c; + int brace = -1; + VALUE ss; + NODE node; + int nest; + + c = nextc(); + switch (c) { + case '$': + case '@': + case '{': + break; + default: + tokadd('#'); + pushback(c); + return list; + } + + ss = rb_str_new(tok(), toklen()); + if (list == null) { + list = NEW_DSTR(ss); + } + else if (toklen() > 0) { + list_append(list, NEW_STR(ss)); + } + newtok(); + + fetch_id:for(;;) { + switch (c) { + case '$': + tokadd('$'); + c = nextc(); + if (c == -1) return NODE.MINUS_ONE; + switch (c) { + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + while (Character.isDigit((char)c)) { + tokadd(c); + c = nextc(); + } + pushback(c); + break fetch_id; + + case '&': case '+': + case '_': case '~': + case '*': case '$': case '?': + case '!': case '@': case ',': + case '.': case '=': case ':': + case '<': case '>': case '\\': + //refetch: + tokadd(c); + break fetch_id; + + default: + if (c == term) { + list_append(list, NEW_STR(rb_str_new2("#$"))); + pushback(c); + newtok(); + return list; + } + switch (c) { + case '\"': + case '/': + case '\'': + case '`': + //goto refetch; + tokadd(c); + break fetch_id; + } + if (!is_identchar(c)) { + yyerror("bad global variable in string"); + newtok(); + return list; + } + } + + while (is_identchar(c)) { + tokadd(c); + /*if (ismbchar(c)) { + int i, len = mbclen(c)-1; + + for (i = 0; i < len; i++) { + c = nextc(); + tokadd(c); + } + }*/ + c = nextc(); + } + pushback(c); + break; + + case '@': + tokadd(c); + c = nextc(); + if (c == '@') { + tokadd(c); + c = nextc(); + } + while (is_identchar(c)) { + tokadd(c); + /*if (ismbchar(c)) { + int i, len = mbclen(c)-1; + + for (i = 0; i < len; i++) { + c = nextc(); + tokadd(c); + } + }*/ + c = nextc(); + } + pushback(c); + break; + + case '{': + if (c == '{') brace = '}'; + nest = 0; + do { + loop_again:for(;;) { + c = nextc(); + switch (c) { + case -1: + if (nest > 0) { + yyerror("bad substitution in string"); + newtok(); + return list; + } + return NODE.MINUS_ONE; + case '}': + if (c == brace) { + if (nest == 0) break; + nest--; + } + tokadd(c); + continue loop_again; + case '\\': + c = nextc(); + if (c == -1) return NODE.MINUS_ONE; + if (c == term) { + tokadd(c); + } + else { + tokadd('\\'); + tokadd(c); + } + break; + case '{': + if (brace != -1) nest++; + case '\"': + case '/': + case '`': + if (c == term) { + pushback(c); + list_append(list, NEW_STR(rb_str_new2("#"))); + rb_warning("bad substitution in string"); + tokfix(); + list_append(list, NEW_STR(rb_str_new(tok(), toklen()))); + newtok(); + return list; + } + default: + tokadd(c); + break; + } + break loop_again; + } + } while (c != brace); + } + break; + } + + //fetch_id: + tokfix(); + node = NEW_EVSTR(tok(),toklen()); + list_append(list, node); + newtok(); + + return list; + } // yylex + + + // Helper functions (could be inlined).................... + + /** Returns true if "c" is a white space character. */ + private boolean ISSPACE(int c) { + return Character.isWhitespace((char)c); + } + + /** Returns true if "c" is a hex-digit. */ + boolean ISXDIGIT(int c) { + return c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F'; + } + + /** Returns true if "c" is a valid identifier character (letter, digit + * or underscore) */ + boolean is_identchar(int ch) { + return Character.isLetterOrDigit((char)ch) || ch == '_'; + } + + /** + * Returns the value of a hex number with max "len" characters. + * Also returns the number of characters read. Please note the + * "x"-hack. + */ + private long scan_hex(String s, int start, int len, int[] retlen) { + String hexdigit = "0123456789abcdef0123456789ABCDEFx"; + long retval = 0; + int tmp, st = start; + + while (len-- != 0 && st < s.length() && (tmp = hexdigit.indexOf(s.charAt(st))) != -1) { + retval <<= 4; + retval |= tmp & 15; + st++; + } + retlen[0] = st - start; + return retval; + } + + // yyVal is local to parse, so we need this ivar for the scanner + private Object yyVal; + + //XXX globals + boolean ruby_in_eval; + VALUE ruby_verbose; + VALUE Qnil; + + // SCOPE ruby_scope; replaced by ruby.ruby_scope + + //------------------------------------------------------------------------ + // global helper functions, locally defined for now... + //------------------------------------------------------------------------ + + private Error missing() { return new Error("missing function"); } + + /** Returns a kwtable entry if "w" is a keyword or null otherwise */ + kwtable rb_reserved_word(String w, int len) { + return kwtable.rb_reserved_word(w, len); + } + + /** Creates a new regular expression from "s" */ + VALUE rb_reg_new(String s, int len, int options) { + //XXX well... + return new RubyRegex(ruby, (RubyString)rb_str_new(s, len), options); + } + + /** Creates a new integer object (Fixnum or Bignum) from "s" */ + VALUE rb_cstr2inum(String s, int radix) { + //XXX no support for _ or leading and trailing spaces + return new RubyFixnum(ruby, Integer.parseInt(s, radix)); + } + + /** (Added to reduce the need for casts) */ + VALUE rb_funcall(VALUE v1, char c, int j, VALUE v) { + return rb_funcall(v1, ruby.intern(String.valueOf(c)), j, v); + } + VALUE rb_funcall(VALUE v1, ID i, int j, VALUE v) { + return ((RubyObject)v1).funcall((RubyId)i, (RubyObject)v); + } + + // warnings and errors + // ------------------- + void rb_warn(String s) { rb_warn(s, null); } + void rb_warn(String s, Object arg) { System.err.println(s + arg); } + void rb_warning(String s) { rb_warning(s, null); } + void rb_warning(String s, Object arg) { System.err.println(s + arg); } + void rb_compile_error(String s) { rb_compile_error(s, null); } + void rb_compile_error(String s, Object arg) { System.err.println(s + arg); } + void rb_bug(String s) { System.err.println(s); } + + // String stuff + // ------------ + + /** Adds second value (a string or char) to first value */ + VALUE rb_str_concat(VALUE v, VALUE w) { + //XXX need to keep identity and tainting + RubyString vs = (RubyString)v; + if (FIXNUM_P(w)) + vs.setString(vs.getString() + (char)FIX2INT(w)); + else + vs.setString(vs.getString() + ((RubyString)w).getString()); + return vs; + } + + /** Creates a new string object. */ + VALUE rb_str_new(String s, int len) { + return new RubyString(ruby, s.substring(0, len)); + } + + /** Creates a new string object. */ + VALUE rb_str_new2(String s) { + return rb_str_new(s, s.length()); + } + + // Number stuff + // ------------ + /** Creates a new float object */ + VALUE rb_float_new(double d) {throw missing();} + VALUE INT2FIX(int i) { return new RubyFixnum(ruby, i); } + VALUE INT2FIX(long i) { return new RubyFixnum(ruby, i); } + boolean FIXNUM_P(VALUE v) {return v instanceof RubyFixnum;} + long FIX2LONG(VALUE v) {return FIX2INT(v);} + int FIX2INT(VALUE v) { return (int)((RubyFixnum)v).getValue(); } + + // Symbol stuff + // ------------ + static final int SYMBOL_FLAG = 14; + boolean SYMBOL_P(ID id) { + return (id.intValue() & 255) == SYMBOL_FLAG; + } + ID ID2SYM(ID id) { + return new RubyId(ruby, id.intValue() << 8 | SYMBOL_FLAG); + } + ID SYM2ID(ID id) { + return new RubyId(ruby, id.intValue() >> 8); + } + + int TYPE(VALUE v) { + if (v instanceof RubyFixnum) return T_FIXNUM; + if (v instanceof RubyRegex) return T_REGEXP; + throw missing(); + } + static final int T_FIXNUM = 0; + static final int T_FLOAT = 1; + static final int T_BIGNUM = 2; + static final int T_NODE = 3; + static final int T_REGEXP = 4; + static final int T_HASH = 5; + + /** Returns true if "value" isn't the nil object */ + boolean RTEST(VALUE value) { return value != Qnil; } + + /** Returns true if "value" is the nil object */ + boolean NIL_P(VALUE value) { return value == Qnil; } + + // Environment stuff + // ----------------- + + boolean rb_dvar_defined(ID id) { + RVarmap vars = ruby_dyna_vars; + + while (vars != null) { + if (vars.id == null) break; + if (vars.id.equals(id)) return true; + vars = vars.next; + } + return false; + } + + boolean rb_dvar_curr(ID id) { + RVarmap vars = ruby_dyna_vars; + + while (vars != null) { + if (vars.id == null) break; + if (vars.id.equals(id)) return true; + vars = vars.next; + } + return false; + } + + void rb_dvar_push(ID id, VALUE value) { + ruby_dyna_vars = new_dvar(id, value, ruby_dyna_vars); + } + + private RVarmap new_dvar(ID id, VALUE value, RVarmap prev) { + RVarmap map = new RVarmap(); + map.id = id; + map.val = value; + map.next = prev; + return map; + } + + // array stuff + // ----------- + + void rb_ary_push(VALUE array, NODE n) { + rom.rb_ary_push(array, n); + } + void rb_ary_push(VALUE array, VALUE value) { + rom.rb_ary_push(array, value); + } + + /** Creates an array object with default size */ + VALUE rb_ary_new() { + return rb_ary_new2(16); + } + + /** Creates an array object with the given size */ + VALUE rb_ary_new2(int size) { + return rom.rb_ary_new2(size); + } + + // Hash stuff + // ---------- + + VALUE rb_hash_aref(VALUE hash, VALUE key) {throw missing();} + void rb_hash_aset(VALUE hash, VALUE key, VALUE value) {throw missing();} + + int rb_safe_level() { return 0; } + boolean rb_const_defined(VALUE clazz, ID name) { + return rom.rb_const_defined(clazz, name); + } + VALUE rb_const_get(VALUE clazz, ID name) { + return rom.rb_const_get(clazz, name); + } + + global_entry rb_global_entry(ID v) { + global_entry entry = (global_entry)rb_global_tbl.get(v); + if (entry == null) { + entry = new global_entry(); + entry.id = v; + rb_global_tbl.put(v, entry); + } + return entry; + } + + // Test methods + // ------------ + private static String readFile(String name) { + try { + BufferedReader in = new BufferedReader(new FileReader(name)); + StringBuffer sb = new StringBuffer(1024); + String line; + while ((line = in.readLine()) != null) + sb.append(line).append('\n'); + in.close(); + return sb.toString(); + } catch (IOException e) { + System.out.println(new File(name).getAbsolutePath()); + e.printStackTrace(); + } + return null; + } + public static void scanner_test(String f) { + Ruby ruby = new Ruby(); + parse p = new parse(ruby); + p.init_for_scanner(f); + + int t; + while ((t = p.yylex()) != 0) { + if (t < 256) + if (t == 10) + System.out.println("'\\n'"); + else + System.out.println("'" + (char)t + "'"); + else { + System.out.print(token_name(t)); + System.out.print(" - "); + if (p.yyVal instanceof ID) + System.out.println(ID.rb_id2name(ruby, (ID)p.yyVal)); + else + System.out.println(p.yyVal); + } + } + } + private static String token_name(int t) { + java.lang.reflect.Field[] f = token.class.getDeclaredFields(); + try { + for (int i = 0; i < f.length; i++) + if (f[i].getInt(null) == t) + return f[i].getName(); + } catch (IllegalAccessException e) {} + return String.valueOf(t); + } + public static void parser_test(String f) { + Ruby ruby = new Ruby(); + parse p = new parse(ruby); + print_nodes(p.rb_compile_string("stdin", new RubyString(ruby, f), 0)); + } + + public static void interpreter_test(String f) { + Ruby ruby = new Ruby(); + parse p = new parse(ruby); + ruby.getInterpreter().eval(ruby.getObjectClass(), p.rb_compile_string("stdin", new RubyString(ruby, f), 0)); + } + + private static void print_nodes(NODE n) { + if (n != null) + ((NODE)n).print(0, n, new IdentitySet()); + else + System.out.println(""); + } + + public static void main(String[] args) { + // String f = "a, b = 'Hallo', :Welt"; + String f ="puts \"Hello World\""; + if (args.length > 1) f = readFile(args[1]); + if (args.length > 0 && args[0].equals("-p")) + parser_test(f); + else if (args.length > 0 && args[0].equals("-s")) + scanner_test(f); + else + interpreter_test(f); + } +} + +//XXX strange classes needed to compile the stuff +class RBasic {} + +class global_entry implements VALUE { + ID id; + /*void *data; + VALUE (*getter)(); + void (*setter)(); + void (*marker)(); + int block_trace; + struct trace_var *trace;*/ +}; + + + // line 10414 "-" diff --git a/org/jruby/parser/re_options.java b/org/jruby/parser/re_options.java new file mode 100644 index 00000000000..f50adc90162 --- /dev/null +++ b/org/jruby/parser/re_options.java @@ -0,0 +1,44 @@ +/* + * re_options.java - No description + * Created on 10. September 2001, 17:51 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.parser; + +public interface re_options { + + final long RE_OPTION_IGNORECASE =1L; + + final long RE_OPTION_EXTENDED =(RE_OPTION_IGNORECASE<<1); + + final long RE_OPTION_MULTILINE =(RE_OPTION_EXTENDED<<1); + + final long RE_OPTION_SINGLELINE =(RE_OPTION_MULTILINE<<1); + + final long RE_OPTION_POSIXLINE =(RE_OPTION_MULTILINE|RE_OPTION_SINGLELINE); + + final long RE_OPTION_LONGEST =(RE_OPTION_SINGLELINE<<1); + + final long RE_MAY_IGNORECASE =(RE_OPTION_LONGEST<<1); + +} \ No newline at end of file diff --git a/org/jruby/parser/tab.java b/org/jruby/parser/tab.java new file mode 100644 index 00000000000..bc004d2d15d --- /dev/null +++ b/org/jruby/parser/tab.java @@ -0,0 +1,3528 @@ +/* + * tab.java - No description + * Created on 10. September 2001, 17:51 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +package org.jruby.parser; + +/** + * This class contains some parser tables, broken apart + * which were too large for the JVM. DO NOT regenerate + * parse.java from parse.y without adapting this class. + */ +class tab { + + protected static short[] yyTable() { + return combine(yyTable1(), yyTable2()); + } + protected static short[] yyCheck() { + return combine(yyCheck1(), yyCheck2()); + } + private static short[] combine(short[] t1, short[] t2) { + short[] t = new short[t1.length + t2.length]; + System.arraycopy(t1, 0, t, 0, t1.length); + System.arraycopy(t2, 0, t, t1.length, t2.length); + return t; + } + + protected static final short[] yyTable1() { + return new short[] { 213, + 213, 207, 166, 213, 213, 179, 248, 252, 347, 513, + 225, 451, 323, 231, 354, 230, 372, 304, 313, 493, + 673, 578, 214, 214, 521, 179, 214, 214, 241, 333, + 234, 234, 538, 235, 237, 432, 432, 268, 213, 213, + 310, 344, 263, 265, 246, 250, 306, 167, 167, 543, + 231, 510, 503, 262, 86, 432, 224, 392, 745, 335, + 314, 245, 305, 527, 538, 234, 256, 432, 167, 387, + 584, 586, 432, 224, 322, 189, 356, 189, 443, 449, + 234, 394, 386, 189, 432, 677, 345, 458, 459, 204, + 679, 394, 189, 264, 675, 217, 217, 302, 167, 217, + 217, 404, 300, 298, 432, 299, 432, 301, 335, 724, + 774, 565, 307, 427, 194, 393, 282, 235, 443, 449, + 204, 357, 432, 302, 190, 397, 190, 345, 300, 432, + 302, 526, 190, 301, 266, 300, 298, 267, 299, 310, + 301, 190, 327, 231, 751, 427, 405, 470, 87, 315, + 488, 235, 88, 329, 725, 432, 502, 65, 349, 247, + 432, 526, 760, 331, 348, 282, 235, 194, 68, 68, + 432, 432, 493, 320, 68, 184, 184, 184, 706, 526, + 203, 184, 184, 541, 544, 184, 184, 189, 316, 189, + 225, 384, 184, 329, 359, 360, 263, 309, 322, 432, + 235, 746, 329, 559, 247, 330, 213, 432, 213, 432, + 675, 213, 331, 384, 370, 241, 394, 321, 68, 184, + 184, 337, 254, 35, 184, 346, 624, 577, 391, 214, + 336, 369, 235, 63, 214, 349, 190, 71, 190, 181, + 384, 302, 297, 351, 384, 254, 300, 298, 222, 299, + 399, 301, 584, 586, 330, 184, 432, 248, 432, 432, + 358, 414, 415, 416, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, + 433, 434, 435, 436, 437, 438, 439, 362, 234, 213, + 432, 596, 432, 241, 194, 246, 309, 248, 460, 462, + 466, 538, 217, 695, 217, 464, 464, 217, 432, 248, + 303, 312, 245, 538, 535, 365, 335, 640, 641, 381, + 406, 498, 332, 71, 383, 411, 550, 500, 471, 213, + 511, 432, 638, 498, 343, 246, 628, 277, 326, 515, + 340, 213, 542, 388, 445, 531, 533, 246, 68, 537, + 463, 467, 245, 730, 493, 275, 276, 248, 547, 247, + 432, 184, 184, 234, 245, 432, 554, 432, 552, 355, + 569, 396, 71, 140, 235, 385, 574, 561, 179, 432, + 432, 537, 277, 561, 445, 585, 587, 718, 184, 213, + 184, 335, 71, 184, 403, 246, 445, 290, 291, 432, + 68, 91, 723, 140, 247, 68, 729, 538, 277, 362, + 329, 389, 245, 672, 481, 277, 482, 483, 484, 485, + 331, 167, 140, 275, 276, 401, 445, 275, 276, 475, + 432, 750, 568, 685, 538, 68, 184, 184, 184, 184, + 68, 184, 184, 472, 445, 588, 340, 238, 432, 235, + 699, 517, 247, 66, 549, 520, 520, 591, 518, 486, + 487, 432, 330, 707, 674, 384, 432, 275, 276, 275, + 276, 184, 35, 35, 770, 539, 597, 506, 377, 432, + 48, 184, 184, 68, 254, 611, 60, 502, 367, 367, + 378, 379, 535, 540, 366, 179, 68, 184, 626, 526, + 46, 545, 66, 275, 276, 55, 556, 68, 727, 486, + 487, 184, 568, 68, 557, 87, 633, 50, 558, 88, + 636, 167, 576, 184, 533, 55, 277, 69, 620, 502, + 643, 567, 49, 367, 367, 57, 57, 50, 167, 53, + 184, 290, 291, 570, 651, 432, 432, 637, 89, 68, + 653, 654, 47, 47, 655, 656, 398, 412, 400, 53, + 402, 478, 571, 416, 589, 207, 66, 590, 432, 432, + 432, 184, 505, 665, 432, 595, 69, 592, 512, 598, + 71, 51, 671, 83, 83, 432, 604, 165, 55, 83, + 432, 599, 432, 603, 600, 208, 703, 607, 389, 561, + 50, 51, 581, 582, 583, 396, 609, 612, 416, 75, + 75, 561, 615, 617, 555, 75, 47, 623, 537, 432, + 625, 204, 53, 270, 271, 272, 273, 274, 213, 389, + 537, 627, 389, 83, 702, 530, 396, 257, 631, 396, + 416, 708, 184, 68, 68, 211, 220, 389, 714, 221, + 223, 639, 247, 432, 396, 68, 634, 432, 432, 75, + 257, 642, 646, 255, 51, 648, 650, 140, 68, 140, + 140, 140, 140, 652, 412, 728, 657, 248, 668, 669, + 412, 735, 487, 432, 432, 737, 255, 70, 687, 742, + 757, 689, 690, 68, 184, 704, 667, 709, 717, 710, + 711, 133, 362, 713, 712, 720, 184, 736, 594, 213, + 66, 732, 140, 140, 733, 246, 738, 413, 67, 184, + 602, 66, 533, 413, 537, 412, 740, 743, 763, 761, + 765, 133, 245, 616, 767, 520, 70, 361, 776, 421, + 766, 392, 769, 55, 203, 68, 432, 68, 68, 68, + 133, 537, 85, 85, 255, 50, 775, 412, 85, 85, + 85, 85, 432, 83, 445, 85, 85, 67, 413, 85, + 85, 47, 392, 422, 423, 392, 85, 53, 681, 432, + 250, 367, 367, 68, 69, 423, 184, 425, 425, 75, + 392, 143, 423, 227, 68, 68, 68, 416, 427, 255, + 413, 427, 85, 85, 85, 764, 164, 432, 85, 469, + 660, 635, 661, 662, 663, 83, 716, 127, 678, 51, + 83, 143, 432, 432, 432, 601, 647, 363, 659, 432, + 311, 680, 68, 481, 319, 482, 483, 484, 485, 85, + 143, 75, 269, 0, 0, 0, 75, 127, 686, 0, + 83, 68, 368, 364, 371, 83, 416, 375, 0, 692, + 693, 694, 0, 0, 0, 0, 127, 0, 76, 76, + 65, 0, 0, 65, 76, 247, 75, 110, 486, 487, + 206, 75, 68, 0, 0, 0, 183, 188, 191, 0, + 65, 184, 0, 68, 0, 0, 0, 715, 83, 257, + 68, 68, 0, 228, 412, 0, 0, 110, 63, 696, + 416, 83, 698, 366, 412, 0, 726, 0, 76, 700, + 247, 0, 83, 0, 75, 255, 110, 0, 83, 0, + 243, 60, 85, 0, 60, 0, 367, 75, 0, 0, + 0, 0, 0, 0, 70, 85, 85, 744, 75, 0, + 0, 60, 0, 65, 75, 416, 61, 413, 752, 61, + 0, 255, 0, 0, 83, 753, 325, 0, 0, 0, + 0, 0, 85, 412, 85, 67, 61, 85, 739, 741, + 61, 367, 255, 0, 85, 0, 0, 416, 69, 85, + 75, 0, 0, 0, 0, 133, 421, 133, 133, 133, + 133, 0, 0, 0, 0, 0, 255, 0, 111, 0, + 0, 754, 0, 755, 60, 0, 413, 0, 759, 85, + 85, 85, 85, 85, 85, 85, 85, 255, 0, 0, + 361, 0, 0, 768, 0, 0, 0, 421, 111, 61, + 133, 133, 771, 0, 365, 773, 0, 255, 76, 0, + 0, 777, 0, 0, 0, 85, 0, 111, 83, 0, + 67, 0, 0, 0, 0, 85, 85, 85, 0, 0, + 83, 0, 352, 353, 0, 0, 0, 0, 0, 0, + 85, 85, 0, 83, 75, 143, 0, 143, 143, 143, + 143, 85, 0, 74, 0, 85, 75, 85, 0, 0, + 76, 0, 608, 0, 610, 76, 0, 85, 65, 75, + 0, 127, 0, 127, 127, 127, 127, 0, 249, 253, + 363, 421, 0, 74, 85, 0, 0, 0, 0, 356, + 143, 143, 0, 85, 0, 76, 0, 0, 0, 0, + 76, 0, 74, 69, 416, 0, 364, 407, 408, 409, + 410, 0, 412, 413, 0, 85, 127, 127, 0, 208, + 83, 0, 83, 83, 83, 0, 0, 0, 247, 60, + 0, 110, 0, 110, 110, 110, 110, 0, 0, 0, + 0, 0, 0, 76, 0, 204, 75, 0, 75, 75, + 75, 0, 0, 684, 61, 0, 76, 0, 83, 0, + 0, 0, 0, 416, 0, 0, 366, 76, 479, 83, + 83, 83, 0, 76, 0, 67, 110, 110, 0, 682, + 0, 0, 0, 0, 75, 0, 85, 85, 0, 367, + 0, 0, 0, 0, 0, 75, 75, 75, 0, 85, + 0, 0, 412, 63, 0, 339, 63, 83, 416, 76, + 0, 243, 85, 0, 255, 0, 0, 0, 421, 421, + 421, 0, 0, 63, 421, 421, 83, 421, 0, 0, + 0, 0, 0, 75, 0, 255, 0, 0, 85, 364, + 0, 75, 364, 0, 0, 719, 721, 722, 373, 0, + 85, 0, 75, 416, 0, 0, 0, 83, 0, 0, + 0, 0, 111, 85, 111, 111, 111, 111, 83, 0, + 0, 75, 0, 0, 0, 83, 0, 359, 0, 0, + 0, 0, 0, 75, 0, 416, 63, 0, 0, 85, + 75, 85, 85, 85, 75, 0, 0, 365, 0, 0, + 5, 75, 0, 76, 0, 0, 0, 111, 111, 0, + 5, 302, 297, 593, 762, 76, 300, 298, 0, 299, + 0, 301, 0, 0, 0, 0, 0, 85, 76, 249, + 85, 0, 0, 0, 294, 0, 293, 0, 85, 85, + 85, 5, 0, 0, 0, 0, 0, 74, 0, 74, + 74, 74, 74, 0, 0, 0, 0, 0, 0, 5, + 0, 501, 504, 0, 0, 632, 0, 0, 296, 249, + 0, 0, 0, 0, 0, 0, 85, 0, 0, 0, + 0, 249, 356, 364, 0, 412, 62, 7, 0, 62, + 649, 412, 74, 74, 364, 85, 0, 7, 295, 0, + 0, 0, 0, 0, 206, 76, 62, 76, 76, 76, + 302, 297, 0, 0, 0, 300, 298, 0, 299, 0, + 301, 0, 0, 0, 0, 5, 85, 0, 7, 249, + 0, 0, 0, 0, 0, 85, 412, 85, 683, 0, + 0, 63, 416, 76, 85, 0, 7, 0, 0, 0, + 159, 0, 0, 0, 76, 76, 76, 688, 0, 0, + 159, 0, 0, 0, 0, 0, 0, 296, 412, 62, + 0, 0, 0, 575, 0, 0, 580, 580, 580, 580, + 0, 0, 575, 575, 0, 0, 0, 0, 0, 6, + 0, 159, 76, 0, 159, 0, 0, 295, 0, 6, + 0, 416, 0, 0, 0, 0, 0, 0, 159, 159, + 0, 76, 7, 159, 0, 606, 0, 0, 606, 0, + 606, 0, 0, 614, 0, 0, 0, 619, 0, 504, + 6, 0, 0, 0, 0, 75, 504, 75, 75, 75, + 75, 0, 76, 159, 0, 356, 0, 0, 6, 0, + 575, 0, 0, 76, 0, 356, 0, 0, 0, 364, + 76, 0, 5, 5, 5, 0, 0, 0, 5, 5, + 359, 5, 0, 0, 364, 159, 0, 0, 409, 0, + 75, 75, 356, 356, 0, 409, 356, 356, 356, 356, + 356, 356, 356, 0, 0, 0, 277, 0, 0, 0, + 0, 282, 283, 356, 356, 356, 356, 356, 356, 0, + 0, 290, 291, 0, 6, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 62, 412, 339, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 356, 422, 356, 356, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, + 7, 7, 0, 0, 0, 7, 7, 364, 7, 0, + 364, 0, 0, 0, 575, 575, 35, 364, 409, 356, + 356, 409, 0, 0, 0, 0, 35, 0, 422, 0, + 0, 0, 0, 0, 412, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 277, 0, 504, 0, 0, + 0, 606, 606, 606, 0, 0, 0, 35, 0, 0, + 290, 291, 159, 159, 159, 0, 504, 159, 159, 159, + 0, 159, 0, 0, 0, 35, 364, 364, 0, 0, + 0, 159, 159, 0, 0, 0, 0, 0, 0, 0, + 159, 159, 619, 159, 159, 159, 159, 159, 0, 249, + 339, 6, 6, 6, 0, 0, 0, 6, 6, 364, + 6, 364, 422, 0, 0, 0, 364, 0, 339, 0, + 606, 0, 0, 0, 0, 0, 504, 0, 0, 0, + 0, 364, 0, 0, 504, 0, 0, 0, 0, 0, + 364, 35, 159, 364, 619, 0, 0, 0, 159, 364, + 0, 0, 409, 409, 409, 0, 409, 356, 356, 356, + 409, 409, 356, 356, 356, 409, 356, 409, 409, 409, + 409, 409, 409, 409, 356, 409, 356, 356, 409, 409, + 409, 409, 409, 409, 409, 356, 356, 0, 356, 356, + 356, 356, 356, 0, 409, 0, 0, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 356, 356, 356, + 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, + 359, 0, 356, 356, 356, 409, 356, 356, 409, 409, + 359, 409, 409, 356, 409, 409, 409, 0, 0, 422, + 422, 422, 0, 0, 0, 422, 422, 0, 422, 0, + 0, 0, 0, 410, 0, 0, 0, 359, 359, 0, + 410, 359, 359, 359, 359, 359, 359, 359, 35, 35, + 35, 0, 0, 35, 35, 35, 0, 35, 359, 359, + 359, 359, 359, 359, 0, 0, 0, 35, 0, 0, + 0, 0, 0, 0, 0, 0, 35, 35, 0, 35, + 35, 35, 35, 35, 0, 0, 0, 0, 0, 0, + 0, 359, 0, 359, 359, 416, 413, 64, 0, 0, + 64, 0, 413, 0, 0, 416, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, + 0, 0, 0, 410, 359, 359, 410, 0, 412, 0, + 0, 0, 416, 416, 0, 412, 416, 416, 416, 416, + 416, 416, 416, 0, 0, 0, 0, 413, 0, 0, + 0, 0, 0, 416, 416, 416, 69, 416, 416, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 413, + 64, 0, 0, 0, 0, 0, 416, 0, 416, 416, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 416, 416, + 416, 412, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 410, 410, 410, + 0, 410, 359, 359, 359, 410, 410, 359, 359, 359, + 410, 359, 410, 410, 410, 410, 410, 410, 410, 359, + 410, 359, 359, 410, 410, 410, 410, 410, 410, 410, + 359, 359, 0, 359, 359, 359, 359, 359, 0, 410, + 0, 0, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 359, 359, 359, 359, 359, 359, 359, 359, + 359, 359, 359, 359, 359, 64, 413, 359, 359, 359, + 410, 359, 359, 410, 410, 0, 410, 410, 359, 410, + 410, 410, 412, 412, 412, 0, 412, 416, 416, 416, + 412, 412, 416, 416, 416, 412, 416, 412, 412, 412, + 412, 412, 412, 412, 0, 416, 416, 416, 412, 412, + 412, 412, 412, 412, 412, 416, 416, 0, 416, 416, + 416, 416, 416, 0, 412, 413, 0, 412, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 416, 416, 416, + 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, + 412, 0, 416, 416, 416, 412, 0, 416, 412, 412, + 412, 412, 412, 416, 412, 412, 412, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 412, 0, 0, 0, 412, 412, 0, + 412, 412, 412, 412, 412, 412, 412, 412, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 412, 412, + 412, 68, 412, 412, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 412, 0, 412, 412, 413, 412, 0, 0, 0, + 62, 0, 412, 0, 0, 413, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 412, 412, 412, 412, 0, 413, 0, + 0, 0, 413, 413, 0, 413, 413, 413, 413, 413, + 413, 413, 413, 0, 0, 0, 0, 412, 0, 0, + 0, 0, 0, 413, 413, 413, 70, 413, 413, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 412, + 68, 0, 0, 0, 0, 0, 413, 0, 413, 413, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 413, 413, + 413, 413, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 412, 412, 412, + 0, 412, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 412, 412, 0, + 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 0, 412, 412, 412, 412, 412, 0, 412, + 0, 0, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 412, 412, 412, 68, 412, 412, 412, 412, + 412, 0, 412, 412, 412, 0, 412, 412, 412, 412, + 412, 412, 413, 413, 413, 0, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 0, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 0, 413, 413, + 413, 413, 413, 0, 413, 412, 0, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, + 248, 0, 413, 413, 413, 413, 0, 413, 413, 413, + 248, 413, 413, 413, 413, 413, 413, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 411, 0, 0, 0, 248, 248, 0, + 411, 248, 248, 248, 248, 248, 248, 248, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, + 248, 0, 248, 248, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 248, 0, 248, 248, 417, 413, 0, 0, 0, + 64, 0, 413, 0, 0, 417, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 411, 248, 248, 411, 0, 414, 0, + 0, 0, 417, 417, 0, 414, 417, 417, 417, 417, + 417, 417, 417, 0, 0, 0, 0, 413, 0, 0, + 0, 0, 0, 417, 417, 417, 0, 417, 417, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 413, + 70, 0, 0, 0, 0, 0, 417, 0, 417, 417, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 417, 417, + 417, 414, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 411, 411, 411, + 0, 411, 248, 248, 248, 411, 411, 248, 248, 248, + 411, 248, 411, 411, 411, 411, 411, 411, 411, 0, + 411, 248, 248, 411, 411, 411, 411, 411, 411, 411, + 248, 248, 0, 248, 248, 248, 248, 248, 0, 411, + 0, 0, 411, 411, 411, 411, 411, 411, 411, 411, + 411, 411, 411, 411, 411, 411, 411, 411, 411, 411, + 411, 411, 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 70, 413, 248, 248, 248, + 411, 0, 248, 411, 411, 0, 411, 411, 248, 411, + 411, 411, 414, 414, 414, 0, 414, 417, 417, 417, + 414, 414, 417, 417, 417, 414, 417, 414, 414, 414, + 414, 414, 414, 414, 0, 417, 417, 417, 414, 414, + 414, 414, 414, 414, 414, 417, 417, 0, 417, 417, + 417, 417, 417, 0, 414, 413, 0, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 417, 417, 417, + 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, + 418, 0, 417, 417, 417, 414, 0, 417, 414, 414, + 418, 414, 414, 417, 414, 414, 414, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 415, 0, 0, 0, 418, 418, 0, + 415, 418, 418, 418, 418, 418, 418, 418, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 418, 418, + 418, 0, 418, 418, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 418, 0, 418, 418, 323, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 323, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 418, 418, 418, 415, 0, 224, 0, + 0, 0, 323, 323, 0, 0, 323, 323, 323, 323, + 323, 323, 323, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 323, 323, 0, 323, 323, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 323, 0, 323, 323, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 323, 323, + 323, 224, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 415, 415, 415, + 0, 415, 418, 418, 418, 415, 415, 418, 418, 418, + 415, 418, 415, 415, 415, 415, 415, 415, 415, 0, + 418, 418, 418, 415, 415, 415, 415, 415, 415, 415, + 418, 418, 0, 418, 418, 418, 418, 418, 0, 415, + 0, 0, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 415, 415, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 0, 0, 418, 418, 418, + 415, 0, 418, 415, 415, 0, 415, 415, 418, 415, + 415, 415, 224, 224, 224, 0, 224, 323, 323, 323, + 224, 224, 323, 323, 323, 224, 323, 224, 224, 224, + 224, 224, 224, 224, 0, 323, 323, 323, 224, 224, + 224, 224, 224, 224, 224, 323, 323, 0, 323, 323, + 323, 323, 323, 0, 224, 0, 0, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, + 253, 0, 323, 323, 323, 224, 0, 323, 224, 224, + 253, 224, 224, 323, 224, 224, 224, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 413, 0, 0, 0, 253, 253, 0, + 413, 253, 253, 253, 253, 253, 253, 253, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 253, 253, + 253, 0, 253, 253, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 253, 0, 253, 253, 432, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 432, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 253, 253, 413, 0, 224, 0, + 0, 0, 432, 432, 0, 0, 432, 432, 432, 432, + 432, 432, 432, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 432, 432, 0, 432, 432, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 432, 0, 432, 432, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 432, 432, + 432, 224, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 413, 413, 413, + 0, 413, 253, 253, 253, 413, 413, 253, 253, 253, + 413, 253, 413, 413, 413, 413, 413, 413, 413, 0, + 0, 253, 253, 413, 413, 413, 413, 413, 413, 413, + 253, 253, 0, 253, 253, 253, 253, 253, 0, 413, + 0, 0, 413, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 253, 253, 253, 253, 253, 253, 253, 253, + 253, 253, 253, 253, 253, 0, 0, 253, 253, 253, + 413, 0, 253, 413, 413, 0, 413, 413, 253, 413, + 413, 413, 224, 224, 224, 0, 224, 432, 432, 432, + 224, 224, 432, 432, 432, 224, 432, 224, 224, 224, + 224, 224, 224, 224, 0, 432, 432, 432, 224, 224, + 224, 224, 224, 224, 224, 432, 432, 0, 432, 432, + 432, 432, 432, 0, 224, 0, 0, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 432, 432, 432, + 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, + 416, 0, 432, 432, 432, 224, 0, 432, 224, 224, + 416, 224, 224, 432, 224, 224, 224, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 412, 0, 0, 0, 416, 416, 0, + 412, 416, 416, 416, 63, 416, 416, 416, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 416, + 416, 69, 416, 416, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 416, 0, 0, 416, 412, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 412, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 416, 416, 416, 412, 0, 412, 0, + 0, 0, 412, 412, 0, 412, 412, 412, 412, 62, + 412, 412, 412, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 412, 412, 68, 412, 412, 0, + 0, 0, 0, 0, 0, 302, 297, 0, 0, 0, + 300, 298, 529, 299, 0, 301, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 412, 0, 294, 412, + 293, 292, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 412, 412, + 412, 412, 296, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 295, 0, 0, 0, 0, 412, 412, 412, + 0, 412, 416, 416, 416, 412, 412, 0, 416, 416, + 412, 416, 412, 412, 412, 412, 412, 412, 412, 0, + 416, 0, 0, 412, 412, 412, 412, 412, 412, 412, + 416, 416, 0, 416, 416, 416, 416, 416, 0, 412, + 0, 0, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 416, 416, 416, 416, 416, 416, 416, 416, + 416, 416, 416, 416, 416, 0, 0, 416, 416, 416, + 412, 0, 0, 412, 412, 0, 412, 412, 0, 412, + 412, 412, 412, 412, 412, 58, 412, 412, 412, 412, + 412, 412, 0, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 412, 412, 0, 412, 0, 0, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 0, 412, 412, + 412, 412, 412, 0, 412, 0, 0, 412, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, + 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, + 413, 0, 412, 412, 412, 412, 0, 0, 412, 412, + 413, 412, 412, 0, 412, 412, 412, 0, 59, 0, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 413, 0, 290, 291, 413, 413, 0, + 413, 413, 413, 413, 64, 413, 413, 413, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 413, + 413, 70, 413, 413, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 413, 0, 0, 413, 432, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 432, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 413, 413, 413, 413, 0, 224, 0, + 0, 0, 0, 0, 0, 0, 432, 0, 0, 0, + 0, 432, 0, 0, 0, 0, 0, 0, 3, 4, + 5, 6, 7, 8, 432, 0, 0, 9, 10, 0, + 0, 0, 11, 0, 12, 13, 14, 15, 16, 17, + 18, 0, 0, 0, 0, 19, 20, 21, 22, 23, + 24, 25, 0, 0, 26, 0, 0, 0, 0, 0, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 0, 0, 0, 0, 0, 0, + 432, 224, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 0, 0, 52, 53, 0, 54, 55, + 0, 56, 0, 57, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 413, 413, 413, + 0, 413, 413, 413, 413, 413, 413, 0, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 0, + 413, 0, 0, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 0, 413, 413, 413, 413, 413, 0, 413, + 0, 0, 413, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 0, 0, 413, 413, 413, + 413, 0, 0, 413, 413, 0, 413, 413, 0, 413, + 413, 413, 224, 224, 224, 0, 224, 432, 432, 432, + 224, 224, 432, 432, 432, 224, 432, 224, 224, 224, + 224, 224, 224, 224, 0, 0, 432, 0, 224, 224, + 224, 224, 224, 224, 224, 432, 432, 0, 432, 432, + 432, 432, 432, 0, 224, 0, 0, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 323, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 323, 0, 0, + 0, 0, 0, 0, 432, 224, 0, 0, 224, 224, + 0, 224, 224, 0, 224, 224, 224, 0, 0, 0, + 0, 0, 0, 0, 323, 323, 0, 0, 323, 323, + 323, 323, 323, 323, 323, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 323, 323, 323, 0, 323, + 323, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 432, 0, 323, 0, + 323, 323, 0, 0, 0, 0, 432, 0, 0, 0, + 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, + 323, 323, 323, 432, 432, 0, 0, 432, 432, 432, + 432, 432, 432, 432, 0, 0, 0, 0, 0, 0, + 0, 0, 26, 0, 432, 432, 432, 0, 432, 432, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 247, 432, 0, 432, + 432, 0, 0, 0, 0, 0, 247, 0, 0, 0, + 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 13, 0, 0, 0, 0, 0, 0, 432, + 432, 432, 0, 247, 247, 0, 0, 247, 247, 247, + 247, 247, 247, 247, 0, 0, 26, 0, 0, 0, + 0, 0, 0, 13, 247, 247, 247, 71, 247, 247, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 13, 0, 0, 0, 0, 0, 0, 0, 323, + 323, 323, 0, 0, 323, 323, 323, 247, 323, 247, + 247, 0, 0, 0, 0, 0, 0, 323, 323, 323, + 0, 0, 0, 0, 0, 0, 0, 323, 323, 0, + 323, 323, 323, 323, 323, 0, 0, 151, 0, 0, + 247, 247, 0, 0, 0, 0, 0, 151, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 13, 0, 323, + 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 0, 0, 323, 323, 323, 0, 151, 323, + 0, 234, 0, 0, 0, 323, 0, 0, 432, 432, + 432, 0, 0, 432, 432, 432, 151, 432, 0, 0, + 0, 0, 0, 26, 26, 26, 432, 432, 432, 26, + 26, 0, 26, 0, 0, 0, 432, 432, 0, 432, + 432, 432, 432, 432, 0, 0, 0, 0, 0, 0, + 0, 36, 0, 0, 26, 26, 26, 26, 26, 0, + 0, 36, 0, 0, 0, 0, 0, 0, 432, 432, + 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, + 432, 0, 151, 432, 432, 432, 0, 0, 432, 0, + 0, 0, 36, 0, 432, 0, 0, 0, 247, 247, + 247, 0, 0, 247, 247, 247, 0, 247, 0, 0, + 36, 0, 0, 0, 13, 13, 13, 247, 247, 0, + 13, 13, 0, 13, 0, 0, 247, 247, 0, 247, + 247, 247, 247, 247, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 367, 13, 13, 13, 13, 13, + 0, 0, 0, 0, 367, 0, 0, 0, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 0, 0, 247, 247, 247, 36, 0, 247, 0, + 0, 367, 367, 0, 247, 367, 367, 367, 367, 367, + 367, 367, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 367, 367, 367, 66, 367, 367, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, + 151, 151, 0, 0, 0, 151, 151, 0, 151, 0, + 0, 0, 0, 255, 0, 367, 0, 367, 367, 0, + 0, 0, 0, 255, 0, 0, 0, 151, 151, 14, + 151, 151, 151, 151, 151, 0, 0, 0, 0, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 367, 367, + 255, 255, 0, 0, 255, 255, 255, 255, 255, 255, + 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 255, 255, 255, 67, 255, 255, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, + 0, 0, 0, 36, 36, 36, 0, 0, 36, 36, + 36, 0, 36, 242, 255, 0, 255, 255, 0, 0, + 0, 0, 36, 242, 0, 0, 0, 0, 0, 15, + 0, 36, 36, 0, 36, 36, 36, 36, 36, 15, + 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, + 242, 242, 0, 0, 242, 242, 242, 242, 242, 242, + 242, 0, 0, 0, 14, 0, 0, 0, 0, 0, + 15, 242, 242, 242, 0, 242, 242, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, + 0, 0, 0, 0, 0, 0, 367, 367, 367, 0, + 0, 367, 367, 367, 242, 367, 242, 242, 0, 0, + 0, 0, 0, 0, 0, 367, 367, 0, 0, 0, + 0, 0, 0, 0, 367, 367, 0, 367, 367, 367, + 367, 367, 0, 0, 236, 0, 0, 242, 242, 0, + 0, 0, 0, 0, 236, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 0, 367, 367, 367, 367, + 367, 367, 367, 367, 367, 367, 367, 367, 367, 0, + 0, 367, 367, 367, 0, 236, 367, 0, 234, 0, + 0, 0, 367, 0, 0, 255, 255, 255, 0, 0, + 255, 255, 255, 236, 255, 0, 0, 0, 0, 0, + 0, 14, 14, 14, 255, 255, 0, 14, 14, 0, + 14, 0, 0, 255, 255, 0, 255, 255, 255, 255, + 255, 0, 0, 0, 0, 0, 0, 0, 38, 0, + 0, 0, 14, 14, 14, 14, 14, 0, 38, 0, + 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 0, 236, + 255, 255, 255, 0, 0, 255, 0, 0, 0, 38, + 0, 255, 0, 0, 0, 242, 242, 242, 0, 0, + 242, 242, 242, 0, 242, 0, 0, 38, 0, 0, + 0, 15, 15, 15, 242, 242, 0, 15, 15, 0, + 15, 0, 0, 242, 242, 0, 242, 242, 242, 242, + 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 265, 15, 15, 15, 15, 15, 0, 0, 0, + 0, 265, 0, 0, 0, 242, 242, 242, 242, 242, + 242, 242, 242, 242, 242, 242, 242, 242, 0, 0, + 242, 242, 242, 38, 0, 242, 0, 0, 265, 265, + 0, 242, 265, 265, 265, 265, 265, 265, 265, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 265, + 265, 265, 0, 265, 265, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 236, 236, 236, 0, + 0, 0, 236, 236, 0, 236, 0, 0, 0, 0, + 261, 0, 265, 0, 265, 265, 0, 0, 0, 0, + 261, 0, 0, 0, 0, 0, 0, 236, 236, 236, + 236, 236, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 265, 265, 261, 261, 0, + 0, 261, 261, 261, 261, 261, 261, 261, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 261, 261, + 261, 0, 261, 261, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 38, 38, 38, 0, 0, 38, 38, 38, 0, 38, + 261, 261, 0, 261, 261, 0, 0, 0, 0, 38, + 261, 0, 0, 0, 0, 0, 16, 0, 38, 38, + 0, 38, 38, 38, 38, 38, 16, 0, 0, 0, + 0, 0, 0, 0, 261, 261, 0, 261, 261, 0, + 0, 261, 261, 261, 261, 261, 261, 261, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 261, + 261, 0, 261, 261, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, + 0, 0, 0, 265, 265, 265, 0, 0, 265, 265, + 265, 261, 265, 261, 261, 0, 0, 0, 0, 0, + 0, 0, 265, 265, 0, 0, 0, 0, 0, 0, + 0, 265, 265, 0, 265, 265, 265, 265, 265, 0, + 0, 238, 0, 0, 261, 261, 0, 0, 0, 0, + 0, 238, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 16, 0, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 0, 0, 265, 265, + 265, 231, 238, 265, 0, 235, 0, 0, 0, 265, + 0, 0, 261, 261, 261, 0, 0, 261, 261, 261, + 238, 261, 0, 0, 0, 0, 0, 0, 302, 297, + 0, 261, 261, 300, 298, 0, 299, 0, 301, 0, + 261, 261, 0, 261, 261, 261, 261, 261, 0, 0, + 0, 294, 0, 293, 292, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 296, 238, 261, 261, 261, + 0, 0, 261, 0, 0, 0, 0, 0, 261, 0, + 0, 0, 261, 261, 261, 0, 0, 261, 261, 261, + 0, 261, 0, 0, 0, 295, 0, 0, 16, 16, + 16, 261, 261, 0, 16, 16, 0, 16, 0, 0, + 261, 261, 0, 261, 261, 261, 261, 261, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 191, 16, + 16, 16, 16, 16, 0, 0, 0, 0, 191, 0, + 0, 0, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 0, 0, 261, 261, 261, + 0, 0, 261, 0, 0, 191, 191, 0, 261, 191, + 191, 191, 191, 191, 0, 191, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, + 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 238, 238, 238, 0, 0, 0, 238, + 238, 0, 238, 0, 0, 0, 0, 191, 0, 0, + 0, 191, 191, 0, 0, 0, 0, 191, 0, 0, + 0, 0, 0, 0, 238, 238, 238, 238, 238, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 191, 191, 191, 191, 0, 0, 191, 191, + 191, 191, 191, 0, 191, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 191, 191, 0, 191, + 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 0, 167, 290, 291, + 191, 191, 0, 0, 0, 0, 0, 167, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 191, 191, 0, 167, 167, 0, 0, 167, 167, + 167, 167, 167, 0, 167, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 167, 167, 167, 0, 167, + 167, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 191, 191, 191, 0, 0, 191, 191, 191, 0, 191, + 167, 167, 0, 0, 0, 0, 0, 0, 0, 191, + 191, 0, 0, 0, 0, 0, 0, 0, 191, 191, + 0, 191, 191, 191, 191, 191, 0, 0, 234, 0, + 0, 167, 167, 0, 0, 0, 0, 0, 234, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 0, 0, 191, 191, 0, 0, 234, + 191, 0, 234, 0, 0, 0, 191, 0, 0, 191, + 191, 191, 0, 0, 191, 191, 191, 234, 191, 0, + 0, 0, 0, 0, 0, 302, 297, 0, 191, 191, + 300, 298, 0, 299, 0, 301, 0, 191, 191, 0, + 191, 191, 191, 191, 191, 0, 0, 0, 294, 0, + 293, 234, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 296, 234, 191, 191, 0, 0, 0, 191, + 0, 0, 0, 0, 0, 191, 0, 0, 0, 167, + 167, 167, 0, 0, 167, 167, 167, 0, 167, 0, + 0, 0, 295, 0, 0, 0, 0, 0, 167, 167, + 0, 0, 0, 0, 0, 0, 0, 167, 167, 0, + 167, 167, 167, 167, 167, 0, 0, 0, 0, 168, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 0, 0, 167, 167, 168, 168, 0, 167, + 168, 168, 168, 168, 168, 167, 168, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 168, 168, 168, + 0, 168, 168, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 234, 234, 234, 0, 0, 234, 234, 234, 182, 234, + 0, 0, 168, 168, 0, 0, 0, 0, 182, 234, + 234, 0, 0, 0, 0, 0, 0, 0, 234, 234, + 0, 234, 234, 234, 234, 234, 0, 0, 0, 0, + 0, 0, 0, 168, 168, 182, 182, 0, 0, 182, + 182, 182, 182, 182, 0, 182, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 182, 182, 182, 0, + 182, 182, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 234, 0, 0, 0, + 277, 278, 279, 280, 281, 282, 283, 284, 183, 286, + 287, 182, 182, 0, 0, 290, 291, 0, 183, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 182, 182, 0, 183, 183, 0, 0, 183, + 183, 183, 183, 183, 0, 183, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 183, 183, 183, 0, + 183, 183, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 168, 168, 168, 0, 0, 168, 168, 168, 0, + 168, 183, 183, 0, 0, 0, 0, 0, 0, 0, + 168, 168, 0, 0, 0, 0, 0, 0, 0, 168, + 168, 0, 168, 168, 168, 168, 168, 0, 0, 408, + 0, 0, 183, 183, 0, 0, 0, 0, 0, 408, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 0, 0, 168, 168, 0, 0, + 408, 168, 0, 408, 0, 0, 0, 168, 0, 0, + 182, 182, 182, 0, 0, 182, 182, 182, 408, 182, + 0, 0, 0, 0, 0, 0, 302, 297, 0, 182, + 182, 300, 298, 0, 299, 0, 301, 0, 182, 182, + 0, 182, 182, 182, 182, 182, 0, 0, 0, 294, + 0, 293, 408, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 182, 182, 182, 182, 182, 182, 182, 182, 182, + 182, 182, 182, 296, 408, 182, 182, 0, 0, 0, + 182, 0, 0, 0, 0, 0, 182, 0, 0, 0, + 183, 183, 183, 0, 0, 183, 183, 183, 0, 183, + 0, 0, 0, 295, 0, 0, 0, 0, 0, 183, + 183, 0, 0, 0, 0, 0, 0, 0, 183, 183, + 0, 183, 183, 183, 183, 183, 0, 0, 0, 0, + 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 183, 183, 183, 183, 183, 183, 183, 183, 183, + 183, 183, 183, 0, 0, 183, 183, 166, 166, 0, + 183, 166, 166, 166, 166, 166, 183, 166, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 166, 166, + 166, 0, 166, 166, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 408, 408, 408, 0, 0, 408, 408, 408, 163, + 408, 0, 0, 166, 166, 0, 0, 0, 0, 163, + 408, 408, 0, 0, 0, 0, 0, 0, 0, 408, + 408, 0, 408, 408, 408, 408, 408, 0, 0, 0, + 0, 0, 0, 0, 166, 166, 163, 163, 0, 0, + 163, 163, 163, 163, 163, 0, 163, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 163, 163, 163, + 0, 163, 163, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 408, 0, 0, + 0, 277, 278, 279, 280, 281, 282, 283, 0, 164, + 286, 287, 163, 163, 0, 0, 290, 291, 0, 164, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 163, 163, 0, 164, 164, 0, 0, + 164, 164, 164, 164, 164, 0, 164, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 164, 164, 164, + 0, 164, 164, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 166, 166, 166, 0, 0, 166, 166, 166, + 0, 166, 164, 164, 0, 0, 0, 0, 0, 0, + 0, 166, 166, 0, 0, 0, 0, 0, 0, 0, + 166, 166, 0, 166, 166, 166, 166, 166, 0, 0, + 0, 0, 0, 164, 164, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 0, 0, 166, 166, 0, + 17, 0, 166, 0, 0, 0, 0, 0, 166, 0, + 17, 163, 163, 163, 0, 0, 163, 163, 163, 0, + 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 163, 163, 0, 0, 0, 0, 0, 0, 0, 163, + 163, 17, 163, 163, 163, 163, 163, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 163, 163, 163, 163, 163, 163, 163, 163, + 163, 163, 163, 163, 0, 0, 163, 163, 0, 0, + 0, 163, 0, 0, 0, 0, 0, 163, 0, 0, + 0, 164, 164, 164, 0, 0, 164, 164, 164, 0, + 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 164, 164, 0, 0, 0, 17, 0, 0, 0, 164, + 164, 0, 164, 164, 164, 164, 164, 0, 0, 0, + 0, 165, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 165, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 0, 0, 164, 164, 165, 165, + 0, 164, 165, 165, 165, 165, 165, 164, 165, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, + 165, 165, 0, 165, 165, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 161, + 0, 0, 0, 0, 165, 165, 0, 0, 0, 161, + 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, + 0, 0, 17, 17, 17, 165, 165, 161, 17, 17, + 161, 17, 161, 161, 161, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 240, 0, 161, 161, 161, + 0, 161, 161, 17, 17, 17, 17, 17, 0, 0, + 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 162, 0, 161, 161, 0, 0, 0, 0, 0, 0, + 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 161, 161, 0, 0, 0, 162, 0, + 0, 162, 0, 162, 162, 162, 0, 0, 0, 240, + 0, 0, 0, 0, 0, 0, 0, 0, 162, 162, + 162, 0, 162, 162, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 165, 165, 165, 0, 0, 165, 165, + 165, 0, 165, 162, 162, 0, 0, 0, 0, 0, + 0, 0, 165, 165, 0, 0, 0, 0, 0, 0, + 0, 165, 165, 0, 165, 165, 165, 165, 165, 0, + 235, 0, 0, 0, 162, 162, 0, 0, 0, 0, + 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 165, 165, 165, 165, 165, 165, + 165, 165, 165, 165, 165, 165, 0, 0, 165, 165, + 0, 235, 0, 165, 235, 0, 0, 0, 0, 165, + 0, 161, 161, 161, 0, 0, 161, 161, 161, 235, + 161, 0, 0, 0, 0, 0, 240, 240, 240, 0, + 161, 161, 240, 240, 0, 240, 0, 0, 0, 161, + 161, 0, 161, 161, 161, 161, 161, 0, 0, 0, + 0, 0, 0, 235, 0, 184, 0, 240, 240, 240, + 240, 240, 0, 0, 0, 184, 0, 0, 0, 0, + 0, 0, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 0, 235, 161, 161, 0, 0, + 0, 161, 0, 184, 0, 0, 184, 161, 0, 184, + 0, 0, 162, 162, 162, 0, 0, 162, 162, 162, + 0, 162, 0, 184, 184, 184, 0, 184, 184, 0, + 0, 162, 162, 0, 0, 0, 0, 0, 0, 0, + 162, 162, 0, 162, 162, 162, 162, 162, 0, 0, + 0, 0, 0, 185, 0, 0, 0, 0, 184, 184, + 0, 0, 0, 185, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 0, 0, 162, 162, 184, + 184, 185, 162, 0, 185, 0, 0, 185, 162, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 185, 185, 185, 0, 185, 185, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 235, 235, 235, 0, 0, 235, 235, 235, + 0, 235, 0, 0, 171, 0, 185, 185, 0, 0, + 0, 235, 235, 0, 171, 0, 0, 0, 0, 0, + 235, 235, 0, 235, 235, 235, 235, 235, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 185, 185, 0, + 0, 0, 171, 0, 0, 171, 0, 0, 171, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 171, 171, 171, 0, 171, 171, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 235, 0, + 0, 0, 0, 0, 0, 0, 0, 184, 184, 184, + 0, 0, 184, 184, 184, 0, 184, 171, 171, 0, + 0, 0, 0, 0, 0, 0, 184, 184, 0, 0, + 0, 0, 0, 0, 0, 184, 184, 0, 184, 184, + 184, 184, 184, 0, 0, 0, 0, 174, 171, 171, + 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 184, 184, + 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, + 0, 0, 184, 184, 0, 0, 0, 184, 174, 0, + 0, 174, 0, 184, 0, 185, 185, 185, 0, 0, + 185, 185, 185, 0, 185, 174, 174, 174, 0, 174, + 174, 0, 0, 0, 185, 185, 0, 0, 0, 0, + 0, 0, 0, 185, 185, 0, 185, 185, 185, 185, + 185, 0, 0, 0, 0, 0, 0, 0, 169, 0, + 174, 0, 0, 0, 0, 0, 0, 0, 169, 0, + 0, 0, 0, 0, 0, 0, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 0, 0, + 185, 185, 174, 0, 0, 185, 0, 0, 0, 169, + }; + } + protected static final short[] yyTable2() { + return new short[] { + 0, 185, 169, 0, 0, 0, 171, 171, 171, 0, + 0, 171, 171, 171, 0, 171, 169, 169, 169, 0, + 169, 169, 0, 0, 0, 171, 171, 0, 0, 0, + 0, 0, 0, 0, 171, 171, 0, 171, 171, 171, + 171, 171, 0, 0, 0, 0, 170, 0, 0, 0, + 0, 169, 169, 0, 0, 0, 170, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 0, + 0, 0, 169, 169, 0, 0, 171, 170, 0, 0, + 170, 0, 171, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 170, 170, 170, 0, 170, 170, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, + 174, 174, 0, 0, 174, 174, 174, 0, 174, 170, + 170, 0, 0, 0, 176, 0, 0, 0, 174, 174, + 0, 0, 0, 0, 176, 0, 0, 174, 174, 0, + 174, 174, 174, 174, 174, 0, 0, 0, 0, 0, + 170, 170, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 176, 0, 0, 176, 0, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 176, 176, 176, 0, 176, 176, 0, 174, + 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, + 169, 169, 169, 0, 0, 169, 169, 169, 0, 169, + 0, 0, 0, 0, 0, 0, 173, 176, 0, 169, + 169, 0, 0, 0, 0, 0, 173, 0, 169, 169, + 0, 169, 169, 169, 169, 169, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, + 0, 0, 0, 0, 0, 0, 0, 173, 0, 0, + 173, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 169, 169, 0, 173, 173, 173, 0, 173, 173, + 169, 0, 0, 0, 0, 0, 169, 0, 170, 170, + 170, 0, 0, 170, 170, 170, 0, 170, 0, 0, + 0, 0, 0, 175, 0, 0, 0, 170, 170, 173, + 0, 0, 0, 175, 0, 0, 170, 170, 0, 170, + 170, 170, 170, 170, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 173, 0, 0, 175, 0, 0, 175, 0, 170, + 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, + 170, 175, 175, 175, 0, 175, 175, 0, 170, 0, + 0, 0, 0, 0, 170, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 176, 176, 176, 0, + 0, 176, 176, 176, 0, 176, 175, 0, 0, 0, + 0, 172, 0, 0, 0, 176, 176, 0, 0, 0, + 0, 172, 0, 0, 176, 176, 0, 176, 176, 176, + 176, 176, 0, 0, 0, 0, 0, 0, 175, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 172, 0, 0, 172, 0, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 172, + 172, 0, 0, 0, 172, 0, 176, 0, 0, 0, + 0, 0, 176, 0, 0, 0, 239, 0, 173, 173, + 173, 0, 0, 173, 173, 173, 239, 173, 0, 0, + 0, 0, 0, 177, 172, 0, 0, 173, 173, 0, + 0, 0, 0, 177, 0, 0, 173, 173, 0, 173, + 173, 173, 173, 173, 0, 0, 0, 239, 0, 0, + 0, 0, 0, 0, 0, 0, 172, 0, 0, 0, + 0, 0, 0, 0, 177, 239, 0, 177, 0, 173, + 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, + 173, 177, 177, 0, 0, 0, 177, 0, 173, 0, + 0, 0, 0, 0, 173, 175, 175, 175, 0, 0, + 175, 175, 175, 0, 175, 0, 0, 0, 0, 0, + 178, 0, 0, 0, 175, 175, 177, 0, 0, 0, + 178, 0, 0, 175, 175, 0, 175, 175, 175, 175, + 175, 239, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 177, 0, + 0, 178, 0, 0, 178, 0, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 178, 178, + 0, 0, 0, 178, 0, 175, 0, 0, 0, 0, + 0, 175, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 172, 172, 172, 0, 0, 172, 172, + 172, 0, 172, 178, 179, 0, 0, 0, 0, 0, + 0, 0, 172, 172, 179, 0, 0, 0, 0, 0, + 0, 172, 172, 0, 172, 172, 172, 172, 172, 0, + 0, 0, 0, 0, 0, 178, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 179, 0, 0, 179, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 172, 172, 179, 179, 172, 172, 0, 179, 239, 239, + 239, 0, 0, 172, 239, 239, 0, 239, 0, 172, + 0, 0, 0, 0, 0, 177, 177, 177, 0, 0, + 177, 177, 177, 0, 177, 0, 186, 179, 0, 239, + 239, 239, 239, 239, 177, 177, 186, 0, 0, 0, + 0, 0, 0, 177, 177, 0, 177, 177, 177, 177, + 177, 0, 0, 0, 0, 0, 0, 0, 0, 179, + 0, 0, 0, 0, 0, 0, 0, 186, 0, 0, + 186, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 177, 177, 186, 186, 177, 177, 0, 186, + 0, 0, 0, 0, 0, 177, 0, 0, 0, 0, + 0, 177, 178, 178, 178, 0, 0, 178, 178, 178, + 0, 178, 0, 180, 0, 0, 0, 0, 0, 186, + 0, 178, 178, 180, 0, 0, 0, 0, 0, 0, + 178, 178, 0, 178, 178, 178, 178, 178, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 186, 0, 0, 180, 0, 0, 180, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, + 178, 180, 180, 178, 178, 0, 180, 0, 0, 0, + 0, 0, 178, 0, 0, 0, 0, 0, 178, 0, + 0, 0, 0, 0, 0, 0, 179, 179, 179, 0, + 0, 179, 179, 179, 0, 179, 180, 181, 0, 0, + 0, 0, 0, 0, 0, 179, 179, 181, 0, 0, + 0, 0, 0, 0, 179, 179, 0, 179, 179, 179, + 179, 179, 0, 0, 0, 0, 0, 0, 180, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 181, 0, + 0, 181, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 179, 179, 181, 181, 179, 179, 0, + 181, 0, 0, 0, 0, 0, 179, 0, 0, 0, + 0, 0, 179, 0, 0, 0, 0, 0, 186, 186, + 186, 0, 0, 186, 186, 186, 0, 186, 0, 187, + 181, 0, 0, 0, 0, 0, 0, 186, 186, 187, + 0, 0, 0, 0, 0, 0, 186, 186, 0, 186, + 186, 186, 186, 186, 0, 0, 0, 0, 0, 0, + 0, 0, 181, 0, 0, 0, 0, 0, 0, 0, + 187, 0, 0, 187, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 186, 186, 187, 187, 186, + 186, 0, 187, 0, 0, 0, 0, 0, 186, 0, + 0, 0, 0, 0, 186, 180, 180, 180, 0, 0, + 180, 180, 180, 0, 180, 0, 160, 0, 0, 0, + 0, 0, 187, 0, 180, 180, 160, 0, 0, 0, + 0, 0, 0, 180, 180, 0, 180, 180, 180, 180, + 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 158, 0, 187, 0, 0, 160, 0, 0, + 160, 0, 158, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 180, 180, 160, 160, 180, 180, 0, 160, + 0, 0, 0, 0, 0, 180, 0, 0, 0, 0, + 0, 180, 0, 158, 0, 0, 158, 0, 0, 181, + 181, 181, 0, 0, 181, 181, 181, 0, 181, 160, + 158, 158, 0, 0, 151, 0, 0, 0, 181, 181, + 0, 0, 0, 0, 151, 0, 0, 181, 181, 0, + 181, 181, 181, 181, 181, 0, 0, 0, 0, 0, + 0, 160, 0, 0, 0, 158, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 151, 0, 0, 151, 0, + 0, 0, 0, 0, 0, 0, 181, 181, 0, 0, + 181, 181, 151, 151, 0, 0, 0, 158, 0, 181, + 0, 0, 0, 0, 0, 181, 0, 0, 0, 0, + 0, 187, 187, 187, 0, 0, 187, 187, 187, 0, + 187, 0, 189, 0, 0, 0, 0, 151, 0, 0, + 187, 187, 189, 0, 0, 0, 0, 0, 0, 187, + 187, 0, 187, 187, 187, 187, 187, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, + 0, 0, 0, 189, 0, 153, 189, 0, 0, 0, + 0, 0, 0, 0, 0, 153, 0, 0, 0, 187, + 189, 189, 187, 187, 0, 0, 0, 0, 0, 0, + 0, 187, 0, 0, 0, 0, 0, 187, 160, 160, + 160, 0, 0, 160, 160, 160, 153, 160, 0, 153, + 0, 0, 0, 0, 0, 189, 0, 160, 160, 0, + 0, 0, 0, 153, 153, 0, 160, 160, 0, 160, + 160, 160, 160, 160, 158, 158, 158, 0, 0, 158, + 158, 158, 0, 158, 0, 0, 0, 189, 0, 0, + 0, 0, 0, 158, 158, 0, 0, 0, 153, 0, + 0, 0, 158, 158, 0, 158, 158, 158, 158, 158, + 0, 0, 0, 0, 0, 0, 0, 190, 160, 0, + 0, 0, 0, 0, 160, 0, 0, 190, 0, 0, + 153, 0, 0, 0, 0, 0, 151, 151, 151, 0, + 0, 151, 151, 151, 0, 151, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 151, 151, 0, 190, 0, + 158, 190, 0, 157, 151, 151, 0, 151, 151, 151, + 151, 151, 0, 0, 0, 190, 190, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 157, 0, 0, 157, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 190, 157, 157, 0, 0, 0, 151, 0, 0, 0, + 0, 0, 151, 0, 189, 189, 189, 0, 0, 189, + 189, 189, 0, 189, 0, 0, 0, 0, 0, 0, + 0, 0, 190, 189, 189, 0, 157, 0, 0, 0, + 155, 0, 189, 189, 0, 189, 189, 189, 189, 189, + 155, 0, 0, 0, 0, 0, 0, 153, 153, 153, + 0, 0, 153, 153, 153, 0, 153, 0, 157, 0, + 0, 0, 0, 0, 0, 0, 153, 153, 0, 0, + 0, 155, 0, 0, 155, 153, 153, 0, 153, 153, + 153, 153, 153, 0, 189, 0, 0, 0, 155, 155, + 189, 0, 0, 156, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 156, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 155, 0, 0, 0, 153, 0, 0, + 0, 0, 0, 153, 156, 0, 0, 156, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 156, 156, 0, 0, 155, 0, 0, 0, 190, + 190, 190, 154, 0, 190, 190, 190, 0, 190, 0, + 0, 0, 154, 0, 0, 0, 0, 0, 190, 190, + 0, 0, 0, 0, 0, 0, 156, 190, 190, 0, + 190, 190, 190, 190, 190, 157, 157, 157, 0, 0, + 157, 157, 157, 154, 157, 0, 154, 0, 0, 0, + 0, 0, 432, 0, 157, 157, 0, 0, 156, 0, + 154, 154, 432, 157, 157, 0, 157, 157, 157, 157, + 157, 0, 0, 0, 0, 0, 0, 0, 0, 190, + 0, 0, 0, 0, 0, 190, 0, 0, 0, 0, + 0, 0, 0, 432, 231, 154, 0, 0, 0, 0, + 0, 0, 0, 0, 231, 0, 0, 0, 0, 0, + 0, 432, 0, 0, 0, 157, 0, 0, 0, 0, + 0, 157, 0, 0, 0, 0, 0, 154, 0, 0, + 0, 0, 155, 155, 155, 231, 0, 155, 155, 155, + 0, 155, 0, 0, 0, 432, 0, 0, 0, 0, + 0, 155, 155, 231, 0, 0, 0, 0, 0, 0, + 155, 155, 0, 155, 155, 155, 155, 155, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 432, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 231, 0, 0, + 0, 0, 0, 0, 0, 156, 156, 156, 0, 0, + 156, 156, 156, 0, 156, 0, 0, 0, 0, 0, + 0, 0, 155, 0, 156, 156, 0, 0, 155, 231, + 0, 0, 0, 156, 156, 0, 156, 156, 156, 156, + 156, 0, 0, 0, 0, 0, 0, 302, 297, 0, + 0, 0, 300, 298, 644, 299, 0, 301, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 294, 0, 293, 292, 154, 154, 154, 0, 0, 154, + 154, 154, 0, 154, 0, 156, 0, 0, 0, 0, + 0, 156, 0, 154, 154, 0, 0, 0, 0, 0, + 0, 0, 154, 154, 296, 154, 154, 154, 154, 154, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 432, 432, 432, 0, 0, 432, + 432, 432, 0, 432, 295, 0, 0, 0, 0, 0, + 0, 0, 0, 432, 432, 0, 0, 0, 0, 0, + 0, 0, 432, 432, 154, 432, 432, 432, 432, 432, + 154, 0, 0, 0, 0, 0, 231, 231, 231, 0, + 292, 231, 231, 231, 0, 231, 0, 0, 0, 0, + 292, 0, 0, 0, 0, 231, 231, 0, 0, 0, + 0, 0, 0, 0, 231, 231, 0, 231, 231, 231, + 231, 231, 0, 0, 0, 0, 0, 292, 292, 0, + 432, 292, 292, 292, 292, 292, 292, 292, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 292, + 292, 0, 292, 292, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 231, 0, 0, 293, 0, 0, 0, 0, + 0, 292, 0, 0, 292, 293, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 293, 293, 292, 292, 293, 293, 293, 293, + 293, 293, 293, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 293, 293, 0, 293, 293, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 0, 293, 290, 291, 293, + 0, 258, 361, 0, 0, 0, 0, 0, 0, 0, + 0, 258, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 293, + 293, 0, 0, 0, 0, 0, 0, 0, 258, 258, + 0, 0, 258, 258, 258, 258, 258, 258, 258, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 258, 258, 0, 258, 258, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 292, 292, 292, 0, 0, 292, 292, 292, + 0, 292, 258, 0, 0, 258, 0, 0, 0, 0, + 0, 292, 0, 0, 0, 0, 296, 0, 0, 0, + 292, 292, 0, 292, 292, 292, 292, 292, 0, 0, + 0, 0, 0, 0, 0, 258, 258, 0, 0, 296, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 292, 292, 292, 292, 292, 292, 292, 292, + 292, 292, 292, 292, 292, 296, 0, 292, 292, 292, + 0, 0, 292, 0, 0, 0, 0, 293, 293, 293, + 0, 0, 293, 293, 293, 0, 293, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 293, 0, 0, 0, + 0, 0, 0, 0, 0, 293, 293, 0, 293, 293, + 293, 293, 293, 432, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 296, 0, 0, 0, 432, 293, 293, 293, + 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, + 0, 0, 293, 293, 293, 0, 0, 293, 0, 0, + 0, 0, 432, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 258, 258, 258, 0, 0, 258, 258, + 258, 0, 258, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 258, 0, 0, 0, 0, 0, 0, 0, + 0, 258, 258, 0, 258, 258, 258, 258, 258, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 432, 0, 0, 0, 0, 432, + 0, 0, 0, 258, 258, 258, 258, 258, 258, 258, + 258, 258, 258, 258, 258, 258, 0, 432, 258, 258, + 258, 0, 0, 258, 0, 0, 0, 0, 0, 0, + 0, 0, 296, 296, 296, 296, 296, 296, 296, 296, + 296, 296, 296, 432, 296, 296, 296, 296, 296, 296, + 296, 296, 296, 296, 296, 0, 0, 0, 0, 296, + 296, 296, 296, 296, 296, 296, 0, 0, 296, 0, + 0, 0, 0, 0, 296, 296, 296, 296, 296, 296, + 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, + 296, 296, 296, 296, 296, 296, 296, 296, 0, 0, + 0, 0, 0, 0, 0, 189, 0, 0, 0, 432, + 432, 0, 0, 0, 0, 0, 296, 0, 0, 296, + 296, 0, 296, 296, 0, 296, 0, 296, 58, 432, + 432, 432, 432, 432, 432, 0, 0, 432, 432, 432, + 0, 0, 0, 432, 0, 432, 432, 432, 432, 432, + 432, 432, 0, 0, 190, 0, 432, 432, 432, 432, + 432, 432, 432, 0, 0, 432, 0, 0, 0, 0, + 0, 432, 432, 432, 432, 432, 432, 432, 432, 432, + 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, + 432, 432, 432, 432, 432, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 432, 0, 0, 432, 432, 0, 432, + 432, 59, 432, 0, 432, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 432, 432, 432, 432, 432, 432, 0, 0, 0, 432, + 432, 0, 0, 0, 432, 0, 432, 432, 432, 432, + 432, 432, 432, 0, 0, 0, 0, 432, 432, 432, + 432, 432, 432, 432, 0, 0, 432, 0, 0, 0, + 0, 0, 432, 432, 432, 432, 432, 432, 432, 432, + 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, + 432, 432, 432, 432, 432, 432, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 432, 0, 0, 432, 432, 0, + 432, 432, 0, 432, 0, 432, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 5, 6, 0, 8, 0, 0, 0, + 9, 10, 0, 0, 0, 11, 0, 12, 13, 14, + 15, 16, 17, 18, 0, 0, 0, 0, 19, 20, + 21, 22, 23, 24, 25, 0, 0, 26, 0, 0, + 0, 0, 0, 0, 28, 0, 0, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 247, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 247, 0, 0, + 0, 0, 0, 0, 0, 51, 0, 0, 182, 53, + 0, 54, 55, 0, 0, 0, 57, 0, 0, 0, + 0, 0, 0, 0, 247, 247, 0, 0, 247, 247, + 247, 65, 247, 247, 247, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 247, 247, 71, 247, + 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 367, 0, 0, 0, 0, 0, 247, 0, + 0, 247, 367, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 367, + 367, 247, 247, 367, 367, 367, 60, 367, 367, 367, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 367, 367, 66, 367, 367, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 367, 0, 0, 367, 0, 255, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 367, 367, 0, 0, + 0, 0, 0, 0, 0, 255, 255, 0, 0, 255, + 255, 255, 61, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 255, 255, 67, + 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, + 247, 247, 0, 0, 0, 247, 247, 0, 247, 255, + 0, 0, 255, 0, 0, 0, 302, 297, 0, 0, + 0, 300, 298, 0, 299, 0, 301, 247, 247, 0, + 247, 247, 247, 247, 247, 0, 0, 0, 0, 294, + 0, 293, 255, 255, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 0, 296, 247, 247, 247, 0, 0, 0, + 0, 0, 0, 0, 367, 367, 367, 0, 0, 0, + 367, 367, 0, 367, 0, 0, 0, 58, 0, 0, + 0, 0, 0, 295, 0, 0, 0, 0, 0, 0, + 0, 0, 367, 367, 0, 367, 367, 367, 367, 367, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 367, 367, 367, 367, 367, 367, + 367, 367, 367, 367, 367, 367, 367, 0, 0, 367, + 367, 367, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 255, 255, 255, 0, 0, 0, 255, 255, 0, 255, + 59, 0, 58, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, + 0, 255, 255, 255, 255, 255, 0, 0, 351, 0, + 0, 191, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 191, 0, 0, 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 0, 0, 255, 255, 255, 191, 191, + 0, 0, 191, 191, 191, 0, 191, 0, 191, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 191, 191, 0, 191, 191, 59, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 0, 0, 0, 191, 290, 291, 0, 0, + 3, 4, 5, 6, 7, 8, 0, 0, 0, 9, + 10, 0, 0, 0, 11, 0, 12, 13, 14, 15, + 16, 17, 18, 0, 0, 191, 191, 19, 20, 21, + 22, 23, 24, 25, 0, 0, 26, 58, 0, 0, + 0, 0, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 0, 0, 239, 53, 0, + 54, 55, 0, 56, 0, 57, 4, 5, 6, 7, + 8, 0, 0, 0, 9, 10, 0, 0, 0, 11, + 0, 12, 13, 14, 15, 16, 17, 18, 0, 0, + 0, 0, 19, 20, 21, 22, 23, 24, 25, 0, + 59, 26, 0, 0, 0, 0, 0, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 212, 0, 191, 191, 191, 0, 0, 222, 191, + 191, 0, 191, 0, 0, 0, 0, 0, 0, 51, + 0, 0, 52, 53, 0, 54, 55, 0, 56, 0, + 57, 191, 191, 0, 191, 191, 191, 191, 191, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 0, 0, 191, 191, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 59, 0, 0, 0, 0, 212, + 0, 4, 5, 6, 7, 8, 0, 367, 0, 9, + 10, 0, 0, 0, 11, 0, 12, 13, 14, 15, + 16, 17, 18, 0, 0, 0, 0, 19, 20, 21, + 22, 23, 24, 25, 0, 0, 26, 0, 0, 0, + 0, 0, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 0, 0, 52, 53, 0, + 54, 55, 59, 56, 0, 57, 0, 58, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 4, 5, 6, 0, 8, + 0, 0, 0, 9, 10, 0, 0, 0, 11, 0, + 12, 13, 14, 197, 198, 17, 18, 0, 0, 0, + 0, 199, 20, 21, 22, 23, 24, 25, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 59, 0, 0, 0, 0, 212, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, + 0, 182, 53, 0, 54, 55, 0, 210, 211, 57, + 0, 0, 0, 4, 5, 6, 0, 8, 0, 0, + 0, 9, 10, 0, 0, 0, 11, 0, 12, 13, + 14, 197, 198, 17, 18, 0, 0, 0, 0, 199, + 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 28, 0, 0, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 59, 0, + 0, 0, 0, 212, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 51, 0, 0, 182, + 53, 0, 54, 55, 0, 210, 211, 57, 0, 0, + 0, 4, 5, 6, 0, 8, 0, 0, 0, 9, + 10, 0, 0, 0, 11, 0, 12, 13, 14, 15, + 16, 17, 18, 0, 0, 0, 0, 19, 20, 21, + 22, 23, 24, 25, 0, 0, 26, 0, 0, 0, + 0, 0, 0, 28, 0, 0, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 59, 0, 0, 0, + 0, 212, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 0, 0, 182, 53, 0, + 54, 55, 0, 546, 211, 57, 0, 0, 0, 4, + 5, 6, 0, 8, 0, 0, 0, 9, 10, 0, + 0, 0, 11, 0, 12, 13, 14, 197, 198, 17, + 18, 0, 0, 0, 0, 199, 20, 21, 22, 23, + 24, 25, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 28, 0, 0, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 59, 0, 0, 0, 0, 212, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 0, 0, 182, 53, 0, 54, 55, + 0, 210, 211, 57, 0, 0, 0, 4, 5, 6, + 0, 8, 0, 0, 0, 9, 10, 0, 0, 0, + 11, 0, 12, 13, 14, 197, 198, 17, 18, 0, + 0, 0, 0, 199, 20, 21, 22, 23, 24, 25, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, + 0, 0, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 59, 0, 0, 0, 0, 212, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 51, 0, 0, 182, 374, 0, 54, 55, 0, 210, + 211, 57, 0, 0, 0, 4, 5, 6, 0, 8, + 0, 0, 0, 9, 10, 0, 0, 0, 11, 0, + 12, 13, 14, 197, 198, 17, 18, 0, 0, 0, + 0, 199, 200, 201, 22, 23, 24, 25, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 59, 0, 0, 0, 0, 212, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, + 0, 182, 53, 0, 54, 55, 0, 532, 211, 57, + 0, 0, 0, 4, 5, 6, 0, 8, 0, 0, + 0, 9, 10, 0, 0, 0, 11, 0, 12, 13, + 14, 197, 198, 17, 18, 0, 0, 0, 0, 199, + 200, 201, 22, 23, 24, 25, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 28, 0, 0, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 59, 0, + 0, 0, 0, 212, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 51, 0, 0, 182, + 53, 0, 54, 55, 0, 536, 211, 57, 0, 0, + 0, 4, 5, 6, 0, 8, 0, 0, 0, 9, + 10, 0, 0, 0, 11, 0, 12, 13, 14, 197, + 198, 17, 18, 0, 0, 0, 0, 199, 20, 21, + 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 28, 0, 0, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 59, 0, 0, 0, + 0, 212, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 0, 0, 182, 53, 0, + 54, 55, 0, 532, 211, 57, 0, 0, 0, 4, + 5, 6, 0, 8, 0, 0, 0, 9, 10, 0, + 0, 0, 11, 0, 12, 13, 14, 197, 198, 17, + 18, 0, 0, 0, 0, 199, 200, 201, 22, 23, + 24, 25, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 28, 0, 0, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 59, 0, 0, 0, 0, 212, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 0, 0, 182, 53, 0, 54, 55, + 0, 697, 211, 57, 0, 0, 0, 4, 5, 6, + 0, 8, 0, 0, 0, 9, 10, 0, 0, 0, + 11, 0, 12, 13, 14, 197, 198, 17, 18, 0, + 0, 0, 0, 199, 200, 201, 22, 23, 24, 25, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, + 0, 0, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 59, 0, 0, 0, 0, 212, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 51, 0, 0, 182, 53, 0, 54, 55, 0, 705, + 211, 57, 0, 0, 0, 4, 5, 6, 0, 8, + 0, 0, 0, 9, 10, 0, 0, 0, 11, 0, + 12, 13, 14, 197, 198, 17, 18, 0, 0, 0, + 0, 199, 200, 201, 22, 23, 24, 25, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 59, 0, 0, 0, 0, 224, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, + 0, 182, 53, 0, 54, 55, 0, 756, 211, 57, + 0, 0, 0, 4, 5, 6, 0, 8, 0, 0, + 0, 9, 10, 0, 0, 0, 11, 0, 12, 13, + 14, 197, 198, 17, 18, 0, 0, 0, 0, 199, + 200, 201, 22, 23, 24, 25, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 28, 0, 0, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 224, 0, + 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 51, 0, 0, 182, + 53, 0, 54, 55, 0, 758, 211, 57, 0, 0, + 0, 4, 5, 6, 0, 8, 0, 0, 0, 9, + 10, 0, 0, 0, 11, 0, 12, 13, 14, 197, + 198, 17, 18, 0, 0, 0, 0, 199, 200, 201, + 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 28, 0, 0, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 59, 0, 0, 0, + 0, 212, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 0, 0, 182, 53, 0, + 54, 55, 0, 772, 211, 57, 0, 0, 0, 224, + 224, 224, 0, 224, 0, 0, 0, 224, 224, 0, + 0, 0, 224, 0, 224, 224, 224, 224, 224, 224, + 224, 0, 0, 0, 0, 224, 224, 224, 224, 224, + 224, 224, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 224, 0, 0, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 59, 0, 0, 0, 0, 212, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 224, 0, 0, 224, 224, 0, 224, 224, + 0, 224, 224, 224, 0, 0, 0, 4, 5, 6, + 0, 8, 0, 0, 0, 9, 10, 0, 0, 0, + 11, 0, 12, 13, 14, 15, 16, 17, 18, 0, + 0, 0, 0, 19, 20, 21, 22, 23, 24, 25, + 0, 0, 26, 0, 0, 0, 0, 0, 0, 28, + 0, 0, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 59, 0, 0, 0, 0, 212, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 51, 0, 0, 182, 53, 0, 54, 55, 0, 0, + 0, 57, 0, 0, 0, 4, 5, 6, 0, 8, + 0, 0, 0, 9, 10, 0, 0, 0, 11, 0, + 12, 13, 14, 197, 198, 17, 18, 0, 0, 0, + 0, 199, 20, 21, 22, 23, 24, 25, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 59, 0, 0, 0, 0, 212, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, + 0, 182, 53, 0, 54, 55, 0, 244, 0, 57, + 0, 0, 0, 4, 5, 6, 0, 8, 0, 0, + 0, 9, 10, 0, 0, 0, 11, 0, 12, 13, + 14, 197, 198, 17, 18, 0, 0, 0, 0, 199, + 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 28, 0, 0, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 59, 0, + 0, 0, 0, 212, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 51, 0, 0, 182, + 53, 0, 54, 55, 0, 461, 0, 57, 0, 0, + 0, 4, 5, 6, 0, 8, 0, 0, 0, 9, + 10, 0, 0, 0, 11, 0, 12, 13, 14, 197, + 198, 17, 18, 0, 0, 0, 0, 199, 200, 201, + 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 28, 0, 0, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 59, 0, 0, 0, + 0, 212, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 0, 0, 182, 53, 0, + 54, 55, 0, 514, 0, 57, 0, 0, 0, 4, + 5, 6, 0, 8, 0, 0, 0, 9, 10, 0, + 0, 0, 11, 0, 12, 13, 14, 197, 198, 17, + 18, 0, 0, 0, 0, 199, 200, 201, 22, 23, + 24, 25, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 28, 0, 0, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 59, 0, 0, 0, 0, 212, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 0, 0, 182, 53, 0, 54, 55, + 0, 560, 0, 57, 0, 0, 0, 4, 5, 6, + 0, 8, 0, 0, 0, 9, 10, 0, 0, 0, + 11, 0, 12, 13, 14, 197, 198, 17, 18, 0, + 0, 0, 0, 199, 200, 201, 22, 23, 24, 25, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, + 0, 0, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 59, 0, 0, 0, 0, 423, 0, 0, + 0, 0, 0, 0, 423, 0, 0, 0, 0, 0, + 51, 0, 0, 182, 53, 0, 54, 55, 0, 664, + 0, 57, 0, 0, 0, 4, 5, 6, 0, 8, + 0, 0, 0, 9, 10, 0, 0, 0, 11, 0, + 12, 13, 14, 197, 198, 17, 18, 0, 0, 0, + 0, 199, 200, 201, 22, 23, 24, 25, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 423, 0, 0, 0, 0, 212, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, + 0, 182, 53, 0, 54, 55, 0, 691, 0, 57, + 0, 0, 0, 4, 5, 6, 0, 8, 0, 0, + 0, 9, 10, 0, 0, 0, 11, 0, 12, 13, + 14, 197, 198, 17, 18, 0, 0, 0, 0, 199, + 200, 201, 22, 23, 24, 25, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 28, 0, 0, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 59, 0, + 0, 0, 0, 212, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 51, 0, 0, 182, + 53, 0, 54, 55, 0, 701, 0, 57, 0, 0, + 0, 423, 423, 423, 0, 423, 0, 0, 0, 423, + 423, 0, 0, 0, 423, 0, 423, 423, 423, 423, + 423, 423, 423, 0, 0, 0, 0, 423, 423, 423, + 423, 423, 423, 423, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 423, 0, 0, 423, 423, 423, 423, + 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, + 423, 423, 423, 423, 423, 423, 59, 0, 0, 0, + 0, 188, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 423, 0, 0, 423, 423, 0, + 423, 423, 0, 0, 0, 423, 0, 0, 0, 4, + 5, 6, 0, 8, 0, 0, 0, 9, 10, 0, + 0, 0, 11, 0, 12, 13, 14, 197, 198, 17, + 18, 0, 0, 0, 0, 199, 200, 201, 22, 23, + 24, 25, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 28, 0, 0, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 188, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 0, 0, 182, 53, 0, 54, 55, + 0, 0, 0, 57, 0, 0, 0, 4, 5, 6, + 0, 8, 0, 0, 0, 9, 10, 0, 0, 0, + 11, 0, 12, 13, 14, 197, 198, 17, 18, 0, + 0, 0, 0, 199, 20, 21, 22, 23, 24, 25, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, + 0, 0, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 51, 0, 0, 182, 53, 0, 54, 55, 0, 0, + 0, 57, 0, 0, 0, 188, 188, 188, 0, 188, + 0, 0, 0, 188, 188, 0, 0, 0, 188, 0, + 188, 188, 188, 188, 188, 188, 188, 0, 0, 0, + 0, 188, 188, 188, 188, 188, 188, 188, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 188, 0, 0, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 0, 0, 0, 159, 154, 0, 0, 0, 157, 155, + 0, 156, 0, 158, 0, 0, 0, 0, 188, 0, + 0, 188, 188, 0, 188, 188, 151, 0, 150, 188, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 153, 0, 161, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 152, 0, 160, 0, 0, 0, 0, 0, 159, 154, + 0, 0, 0, 157, 155, 0, 156, 0, 158, 0, + 0, 0, 0, 0, 0, 0, 4, 5, 6, 0, + 8, 151, 0, 150, 9, 10, 0, 0, 0, 11, + 0, 12, 13, 14, 197, 198, 17, 18, 0, 0, + 0, 0, 199, 200, 201, 22, 23, 24, 25, 0, + 0, 0, 0, 0, 0, 153, 0, 161, 202, 0, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, + 0, 0, 0, 0, 0, 152, 0, 160, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 0, 0, 52, 53, 0, 54, 55, 0, 56, 0, + 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 92, 93, 94, 95, 96, 97, 98, + 99, 0, 0, 100, 101, 102, 103, 104, 0, 0, + 105, 106, 107, 108, 109, 110, 111, 0, 0, 112, + 113, 114, 169, 170, 171, 172, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 173, 174, + 175, 134, 229, 0, 176, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 142, 143, 0, 0, 144, 0, 0, + 0, 145, 146, 147, 148, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 149, 0, 57, 92, 93, + 94, 95, 96, 97, 98, 99, 0, 0, 100, 101, + 102, 103, 104, 0, 0, 105, 106, 107, 108, 109, + 110, 111, 0, 0, 112, 113, 114, 169, 170, 171, + 172, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 173, 174, 175, 134, 0, 0, 176, + 159, 154, 0, 162, 0, 157, 155, 0, 156, 0, + 158, 136, 137, 138, 139, 140, 141, 0, 142, 143, + 0, 0, 144, 151, 0, 150, 145, 146, 147, 148, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 149, 0, 57, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 153, 0, 161, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 152, 0, 160, + 0, 0, 0, 159, 154, 0, 0, 0, 157, 155, + 0, 156, 0, 158, 0, 0, 0, 0, 0, 0, + 0, 4, 5, 6, 0, 8, 151, 0, 150, 9, + 10, 0, 0, 0, 11, 0, 12, 13, 14, 197, + 198, 17, 18, 0, 0, 0, 0, 199, 200, 201, + 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, + 153, 0, 161, 202, 0, 0, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 0, 0, 0, 0, 0, 0, + 152, 0, 160, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 0, 0, 317, 53, 0, + 54, 55, 0, 318, 0, 57, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 92, 93, 94, 95, 96, 97, 98, 99, 0, 0, + 100, 101, 102, 103, 104, 0, 0, 105, 106, 107, + 108, 109, 110, 111, 0, 0, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 35, + 36, 135, 38, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 136, 137, 138, 139, 140, 141, 0, + 142, 143, 0, 0, 144, 0, 0, 0, 145, 146, + 147, 148, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 149, 92, 93, 94, 95, 96, 97, 98, + 99, 0, 0, 100, 101, 102, 103, 104, 0, 0, + 105, 106, 107, 108, 109, 110, 111, 0, 0, 112, + 113, 114, 169, 170, 171, 172, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 173, 174, + 175, 134, 258, 259, 176, 260, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 142, 143, 0, 0, 144, 0, 0, + 0, 145, 146, 147, 148, 0, 159, 154, 0, 0, + 0, 157, 155, 0, 156, 149, 158, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, + 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 159, 154, 0, 0, 0, 157, 155, 0, 156, + 0, 158, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 153, 151, 161, 150, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 159, 154, 0, 0, + 0, 157, 155, 0, 156, 0, 158, 0, 0, 0, + 0, 0, 0, 152, 0, 160, 0, 0, 153, 151, + 161, 150, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 159, 154, 0, 0, 0, 157, 155, 0, 156, + 0, 158, 0, 0, 0, 0, 0, 0, 152, 0, + 160, 0, 0, 153, 151, 161, 150, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 152, 0, 160, 0, 0, 153, 0, + 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 152, 0, + 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 92, 93, 94, 95, + 96, 97, 98, 99, 0, 0, 100, 101, 102, 103, + 104, 0, 0, 105, 106, 107, 108, 109, 110, 111, + 0, 0, 112, 113, 114, 169, 170, 171, 172, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 173, 174, 175, 134, 0, 0, 176, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 136, + 137, 138, 139, 140, 141, 0, 142, 143, 0, 0, + 144, 0, 0, 0, 145, 146, 147, 148, 440, 441, + 0, 0, 442, 0, 0, 0, 0, 0, 149, 0, + 0, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 142, 143, 0, 0, 144, 0, 0, 0, 145, + 146, 147, 148, 446, 447, 0, 0, 448, 0, 0, + 0, 0, 0, 149, 0, 0, 0, 0, 0, 136, + 137, 138, 139, 140, 141, 0, 142, 143, 0, 0, + 144, 0, 0, 0, 145, 146, 147, 148, 456, 447, + 0, 0, 457, 0, 0, 0, 0, 0, 149, 0, + 0, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 142, 143, 0, 0, 144, 0, 0, 0, 145, + 146, 147, 148, 0, 159, 154, 0, 0, 0, 157, + 155, 0, 156, 149, 158, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 151, 0, 150, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, + 154, 0, 0, 0, 157, 155, 0, 156, 0, 158, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 153, 151, 161, 150, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 159, 154, 0, 0, 0, 157, + 155, 0, 156, 0, 158, 0, 0, 0, 0, 0, + 0, 152, 0, 160, 0, 0, 153, 151, 161, 150, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, + 154, 0, 0, 0, 157, 155, 0, 156, 0, 158, + 0, 0, 0, 0, 0, 0, 152, 0, 160, 0, + 0, 153, 151, 161, 150, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 159, 154, 0, 0, 0, 157, + 155, 0, 156, 0, 158, 0, 0, 0, 0, 0, + 0, 152, 0, 160, 0, 0, 153, 151, 161, 150, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, + 154, 0, 0, 0, 157, 155, 0, 156, 0, 158, + 0, 0, 0, 0, 0, 0, 152, 0, 160, 0, + 0, 153, 151, 161, 150, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 159, 154, 0, 0, 0, 157, 155, 0, + 156, 152, 158, 160, 0, 0, 153, 0, 161, 0, + 0, 0, 0, 0, 0, 151, 0, 150, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 152, 0, 160, 0, + 0, 507, 441, 0, 0, 442, 0, 0, 0, 153, + 0, 161, 0, 0, 0, 0, 0, 136, 137, 138, + 139, 140, 141, 0, 142, 143, 0, 0, 144, 0, + 0, 0, 145, 146, 147, 148, 508, 447, 0, 152, + 509, 160, 0, 0, 0, 0, 149, 0, 0, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 142, + 143, 0, 0, 144, 0, 0, 0, 145, 146, 147, + 148, 522, 441, 0, 0, 442, 0, 0, 0, 0, + 0, 149, 0, 0, 0, 0, 0, 136, 137, 138, + 139, 140, 141, 0, 142, 143, 0, 0, 144, 0, + 0, 0, 145, 146, 147, 148, 524, 447, 0, 0, + 525, 0, 0, 0, 0, 0, 149, 0, 0, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 142, + 143, 0, 0, 144, 0, 0, 0, 145, 146, 147, + 148, 562, 441, 0, 0, 442, 0, 0, 0, 0, + 0, 149, 0, 0, 0, 0, 0, 136, 137, 138, + 139, 140, 141, 0, 142, 143, 0, 0, 144, 0, + 0, 0, 145, 146, 147, 148, 563, 447, 0, 0, + 564, 0, 0, 0, 0, 0, 149, 0, 0, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 142, + 143, 0, 0, 144, 0, 0, 0, 145, 146, 147, + 148, 0, 0, 0, 0, 0, 0, 0, 0, 747, + 441, 149, 0, 442, 159, 154, 0, 0, 0, 157, + 155, 0, 156, 658, 158, 136, 137, 138, 139, 140, + 141, 0, 142, 143, 0, 0, 144, 151, 0, 150, + 145, 146, 147, 148, 0, 0, 0, 0, 0, 0, + 0, 302, 297, 0, 149, 0, 300, 298, 0, 299, + 0, 301, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 153, 0, 161, 294, 0, 293, 292, 0, 302, + 297, 0, 0, 0, 300, 298, 0, 299, 0, 301, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 566, 152, 294, 160, 293, 292, 302, 297, 296, 0, + 0, 300, 298, 0, 299, 0, 301, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 294, + 0, 293, 292, 0, 0, 0, 296, 0, 295, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4, 5, 6, 0, + 8, 0, 0, 296, 9, 10, 295, 0, 0, 11, + 0, 12, 13, 14, 197, 198, 17, 18, 0, 0, + 0, 0, 199, 200, 201, 22, 23, 24, 25, 0, + 0, 0, 0, 295, 0, 0, 0, 0, 202, 0, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 0, 0, 52, 53, 0, 54, 55, 0, 56, 0, + 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 748, 447, 0, 0, 749, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 136, 137, 138, + 139, 140, 141, 0, 142, 143, 0, 0, 144, 0, + 0, 0, 145, 146, 147, 148, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 0, + 0, 290, 291, 0, 0, 0, 361, 0, 0, 0, + 0, 0, 0, 0, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 0, 0, 290, + 291, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 0, 0, 290, 291, 4, 5, + 6, 0, 8, 0, 0, 0, 9, 10, 0, 0, + 0, 11, 0, 12, 13, 14, 197, 198, 17, 18, + 0, 0, 0, 0, 199, 200, 201, 22, 23, 24, + 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 202, 0, 0, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 51, 0, 0, 182, 53, 0, 54, 55, 0, + 0, 0, 57, + }; + } + protected static final short[] yyCheck1() { + return new short[] { 15, + 16, 14, 6, 19, 20, 7, 54, 55, 188, 348, + 21, 305, 85, 10, 202, 27, 224, 46, 46, 335, + 602, 124, 15, 16, 353, 27, 19, 20, 52, 46, + 123, 10, 365, 49, 50, 10, 10, 64, 54, 55, + 123, 46, 58, 59, 54, 55, 282, 6, 7, 46, + 10, 345, 338, 57, 3, 10, 40, 245, 718, 10, + 341, 54, 91, 357, 397, 44, 56, 41, 27, 239, + 458, 459, 46, 40, 85, 10, 46, 10, 303, 304, + 59, 10, 46, 10, 59, 604, 91, 312, 313, 10, + 609, 10, 10, 58, 604, 15, 16, 37, 57, 19, + 20, 46, 42, 43, 59, 45, 10, 47, 59, 46, + 770, 405, 348, 93, 11, 44, 10, 10, 343, 344, + 41, 91, 10, 37, 59, 44, 59, 91, 42, 10, + 37, 356, 59, 47, 312, 42, 43, 315, 45, 123, + 47, 59, 60, 10, 726, 125, 91, 317, 304, 61, + 40, 44, 308, 10, 91, 59, 269, 44, 271, 46, + 41, 386, 744, 10, 191, 59, 59, 64, 2, 3, + 125, 59, 488, 44, 8, 9, 10, 11, 41, 404, + 14, 15, 16, 371, 372, 19, 20, 10, 61, 10, + 201, 10, 26, 90, 210, 211, 212, 280, 209, 0, + 93, 720, 59, 391, 91, 10, 222, 10, 224, 10, + 720, 227, 59, 10, 224, 239, 10, 341, 52, 53, + 54, 262, 56, 41, 58, 61, 512, 330, 244, 222, + 44, 224, 125, 2, 227, 271, 59, 124, 59, 8, + 59, 37, 38, 59, 41, 79, 42, 43, 40, 45, + 44, 47, 640, 641, 59, 89, 59, 305, 59, 10, + 279, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 44, 267, 305, + 41, 479, 267, 317, 191, 305, 280, 345, 314, 315, + 316, 634, 222, 632, 224, 315, 316, 227, 59, 357, + 339, 339, 305, 646, 362, 44, 267, 542, 543, 40, + 269, 337, 339, 10, 123, 274, 374, 337, 318, 345, + 346, 10, 540, 349, 339, 345, 516, 322, 256, 349, + 267, 357, 339, 41, 303, 361, 362, 357, 182, 365, + 315, 316, 345, 692, 670, 290, 291, 405, 374, 46, + 264, 195, 196, 342, 357, 339, 382, 342, 380, 339, + 443, 93, 59, 10, 267, 339, 449, 393, 380, 267, + 59, 397, 322, 399, 343, 458, 459, 673, 222, 405, + 224, 342, 279, 227, 339, 405, 355, 337, 338, 10, + 234, 5, 339, 40, 91, 239, 692, 740, 322, 46, + 267, 41, 405, 601, 304, 322, 306, 307, 308, 309, + 267, 380, 59, 290, 291, 125, 385, 290, 291, 326, + 10, 725, 443, 613, 767, 269, 270, 271, 272, 273, + 274, 275, 276, 44, 403, 461, 267, 51, 59, 342, + 638, 264, 339, 10, 374, 352, 353, 473, 281, 349, + 350, 264, 267, 651, 304, 234, 269, 290, 291, 290, + 291, 305, 290, 291, 760, 41, 480, 267, 306, 59, + 41, 315, 316, 317, 318, 497, 44, 269, 46, 46, + 318, 319, 540, 44, 218, 497, 330, 331, 514, 724, + 61, 41, 59, 290, 291, 41, 125, 341, 688, 349, + 350, 345, 523, 347, 41, 304, 532, 41, 41, 308, + 536, 480, 93, 357, 540, 61, 322, 10, 268, 269, + 546, 341, 41, 91, 91, 44, 44, 61, 497, 41, + 374, 337, 338, 341, 560, 263, 264, 540, 337, 383, + 566, 567, 61, 61, 570, 571, 248, 40, 250, 61, + 252, 330, 341, 46, 44, 578, 124, 41, 263, 264, + 10, 405, 341, 589, 269, 264, 59, 474, 347, 61, + 267, 41, 598, 2, 3, 264, 44, 6, 124, 8, + 269, 304, 271, 490, 304, 14, 644, 44, 10, 615, + 124, 61, 453, 454, 455, 10, 44, 342, 91, 2, + 3, 627, 44, 263, 383, 8, 124, 93, 634, 59, + 264, 14, 124, 293, 294, 295, 296, 297, 644, 41, + 646, 44, 44, 52, 644, 359, 41, 56, 93, 44, + 123, 657, 476, 477, 10, 350, 16, 59, 664, 19, + 20, 41, 339, 264, 59, 489, 44, 268, 269, 52, + 79, 41, 44, 56, 124, 41, 125, 304, 502, 306, + 307, 308, 309, 93, 40, 691, 341, 725, 264, 41, + 46, 697, 350, 263, 264, 701, 79, 10, 264, 705, + 738, 264, 264, 59, 528, 41, 593, 124, 41, 264, + 125, 10, 339, 125, 264, 44, 540, 41, 477, 725, + 267, 264, 349, 350, 264, 725, 44, 40, 10, 553, + 489, 279, 738, 46, 740, 91, 44, 264, 93, 264, + 264, 40, 725, 502, 44, 632, 59, 46, 264, 271, + 756, 10, 758, 279, 578, 579, 93, 581, 582, 583, + 59, 767, 2, 3, 46, 279, 772, 123, 8, 9, + 10, 11, 125, 182, 723, 15, 16, 59, 91, 19, + 20, 279, 41, 271, 40, 44, 26, 279, 612, 41, + 41, 339, 339, 617, 267, 93, 620, 93, 125, 182, + 59, 10, 41, 41, 628, 629, 630, 280, 93, 91, + 123, 125, 52, 53, 54, 752, 6, 264, 58, 316, + 579, 535, 581, 582, 583, 234, 670, 10, 609, 279, + 239, 40, 262, 263, 264, 488, 550, 46, 578, 269, + 71, 609, 666, 304, 79, 306, 307, 308, 309, 89, + 59, 234, 64, -1, -1, -1, 239, 40, 617, -1, + 269, 685, 222, 46, 224, 274, 339, 227, -1, 628, + 629, 630, -1, -1, -1, -1, 59, -1, 2, 3, + 41, -1, -1, 44, 8, 46, 269, 10, 349, 350, + 14, 274, 716, -1, -1, -1, 9, 10, 11, -1, + 61, 725, -1, 727, -1, -1, -1, 666, 317, 318, + 734, 267, -1, 26, 40, -1, -1, 40, 44, 633, + 46, 330, 636, 46, 280, -1, 685, -1, 52, 643, + 91, -1, 341, -1, 317, 318, 59, -1, 347, -1, + 53, 41, 182, -1, 44, -1, 46, 330, -1, -1, + -1, -1, -1, -1, 267, 195, 196, 716, 341, -1, + -1, 61, -1, 124, 347, 91, 41, 280, 727, 44, + -1, 46, -1, -1, 383, 734, 89, -1, -1, -1, + -1, -1, 222, 339, 224, 267, 61, 227, 702, 703, + 44, 91, 46, -1, 234, -1, -1, 123, 124, 239, + 383, -1, -1, -1, -1, 304, 0, 306, 307, 308, + 309, -1, -1, -1, -1, -1, 91, -1, 10, -1, + -1, 735, -1, 737, 124, -1, 339, -1, 742, 269, + 270, 271, 272, 273, 274, 275, 276, 91, -1, -1, + 339, -1, -1, 757, -1, -1, -1, 41, 40, 124, + 349, 350, 766, -1, 46, 769, -1, 339, 182, -1, + -1, 775, -1, -1, -1, 305, -1, 59, 477, -1, + 124, -1, -1, -1, -1, 315, 316, 317, -1, -1, + 489, -1, 195, 196, -1, -1, -1, -1, -1, -1, + 330, 331, -1, 502, 477, 304, -1, 306, 307, 308, + 309, 341, -1, 10, -1, 345, 489, 347, -1, -1, + 234, -1, 494, -1, 496, 239, -1, 357, 279, 502, + -1, 304, -1, 306, 307, 308, 309, -1, 54, 55, + 339, 125, -1, 40, 374, -1, -1, -1, -1, 46, + 349, 350, -1, 383, -1, 269, -1, -1, -1, -1, + 274, -1, 59, 279, 280, -1, 339, 270, 271, 272, + 273, -1, 275, 276, -1, 405, 349, 350, -1, 578, + 579, -1, 581, 582, 583, -1, -1, -1, 339, 279, + -1, 304, -1, 306, 307, 308, 309, -1, -1, -1, + -1, -1, -1, 317, -1, 578, 579, -1, 581, 582, + 583, -1, -1, 612, 279, -1, 330, -1, 617, -1, + -1, -1, -1, 339, -1, -1, 339, 341, 331, 628, + 629, 630, -1, 347, -1, 279, 349, 350, -1, 612, + -1, -1, -1, -1, 617, -1, 476, 477, -1, 339, + -1, -1, -1, -1, -1, 628, 629, 630, -1, 489, + -1, -1, 40, 41, -1, 181, 44, 666, 46, 383, + -1, 374, 502, -1, 339, -1, -1, -1, 262, 263, + 264, -1, -1, 61, 268, 269, 685, 271, -1, -1, + -1, -1, -1, 666, -1, 339, -1, -1, 528, 215, + -1, 10, 218, -1, -1, 677, 678, 679, 224, -1, + 540, -1, 685, 91, -1, -1, -1, 716, -1, -1, + -1, -1, 304, 553, 306, 307, 308, 309, 727, -1, + -1, 40, -1, -1, -1, 734, -1, 46, -1, -1, + -1, -1, -1, 716, -1, 123, 124, -1, -1, 579, + 59, 581, 582, 583, 727, -1, -1, 339, -1, -1, + 0, 734, -1, 477, -1, -1, -1, 349, 350, -1, + 10, 37, 38, 476, 746, 489, 42, 43, -1, 45, + -1, 47, -1, -1, -1, -1, -1, 617, 502, 305, + 620, -1, -1, -1, 60, -1, 62, -1, 628, 629, + 630, 41, -1, -1, -1, -1, -1, 304, -1, 306, + 307, 308, 309, -1, -1, -1, -1, -1, -1, 59, + -1, 337, 338, -1, -1, 528, -1, -1, 94, 345, + -1, -1, -1, -1, -1, -1, 666, -1, -1, -1, + -1, 357, 339, 359, -1, 40, 41, 0, -1, 44, + 553, 46, 349, 350, 370, 685, -1, 10, 124, -1, + -1, -1, -1, -1, 578, 579, 61, 581, 582, 583, + 37, 38, -1, -1, -1, 42, 43, -1, 45, -1, + 47, -1, -1, -1, -1, 125, 716, -1, 41, 405, + -1, -1, -1, -1, -1, 725, 91, 727, 612, -1, + -1, 279, 280, 617, 734, -1, 59, -1, -1, -1, + 0, -1, -1, -1, 628, 629, 630, 620, -1, -1, + 10, -1, -1, -1, -1, -1, -1, 94, 123, 124, + -1, -1, -1, 449, -1, -1, 452, 453, 454, 455, + -1, -1, 458, 459, -1, -1, -1, -1, -1, 0, + -1, 41, 666, -1, 44, -1, -1, 124, -1, 10, + -1, 339, -1, -1, -1, -1, -1, -1, 58, 59, + -1, 685, 125, 63, -1, 491, -1, -1, 494, -1, + 496, -1, -1, 499, -1, -1, -1, 503, -1, 505, + 41, -1, -1, -1, -1, 304, 512, 306, 307, 308, + 309, -1, 716, 93, -1, 0, -1, -1, 59, -1, + 526, -1, -1, 727, -1, 10, -1, -1, -1, 535, + 734, -1, 262, 263, 264, -1, -1, -1, 268, 269, + 339, 271, -1, -1, 550, 125, -1, -1, 33, -1, + 349, 350, 37, 38, -1, 40, 41, 42, 43, 44, + 45, 46, 47, -1, -1, -1, 322, -1, -1, -1, + -1, 327, 328, 58, 59, 60, 61, 62, 63, -1, + -1, 337, 338, -1, 125, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 279, 280, 602, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 91, 0, 93, 94, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 262, + 263, 264, -1, -1, -1, 268, 269, 633, 271, -1, + 636, -1, -1, -1, 640, 641, 0, 643, 123, 124, + 125, 126, -1, -1, -1, -1, 10, -1, 41, -1, + -1, -1, -1, -1, 339, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 322, -1, 673, -1, -1, + -1, 677, 678, 679, -1, -1, -1, 41, -1, -1, + 337, 338, 262, 263, 264, -1, 692, 267, 268, 269, + -1, 271, -1, -1, -1, 59, 702, 703, -1, -1, + -1, 281, 282, -1, -1, -1, -1, -1, -1, -1, + 290, 291, 718, 293, 294, 295, 296, 297, -1, 725, + 726, 262, 263, 264, -1, -1, -1, 268, 269, 735, + 271, 737, 125, -1, -1, -1, 742, -1, 744, -1, + 746, -1, -1, -1, -1, -1, 752, -1, -1, -1, + -1, 757, -1, -1, 760, -1, -1, -1, -1, -1, + 766, 125, 342, 769, 770, -1, -1, -1, 348, 775, + -1, -1, 257, 258, 259, -1, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, + 295, 296, 297, -1, 299, -1, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 0, -1, 337, 338, 339, 340, 341, 342, 343, 344, + 10, 346, 347, 348, 349, 350, 351, -1, -1, 262, + 263, 264, -1, -1, -1, 268, 269, -1, 271, -1, + -1, -1, -1, 33, -1, -1, -1, 37, 38, -1, + 40, 41, 42, 43, 44, 45, 46, 47, 262, 263, + 264, -1, -1, 267, 268, 269, -1, 271, 58, 59, + 60, 61, 62, 63, -1, -1, -1, 281, -1, -1, + -1, -1, -1, -1, -1, -1, 290, 291, -1, 293, + 294, 295, 296, 297, -1, -1, -1, -1, -1, -1, + -1, 91, -1, 93, 94, 0, 40, 41, -1, -1, + 44, -1, 46, -1, -1, 10, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, + -1, -1, -1, 123, 124, 125, 126, -1, 33, -1, + -1, -1, 37, 38, -1, 40, 41, 42, 43, 44, + 45, 46, 47, -1, -1, -1, -1, 91, -1, -1, + -1, -1, -1, 58, 59, 60, 61, 62, 63, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, + 124, -1, -1, -1, -1, -1, 91, -1, 93, 94, + -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, 123, 124, + 125, 126, -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, 257, 258, 259, + -1, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, -1, 293, 294, 295, 296, 297, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 279, 280, 337, 338, 339, + 340, 341, 342, 343, 344, -1, 346, 347, 348, 349, + 350, 351, 257, 258, 259, -1, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, -1, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, + 295, 296, 297, -1, 299, 339, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 0, -1, 337, 338, 339, 340, -1, 342, 343, 344, + 10, 346, 347, 348, 349, 350, 351, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 33, -1, -1, -1, 37, 38, -1, + 40, 41, 42, 43, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, + 60, 61, 62, 63, -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, 91, -1, 93, 94, 0, 40, -1, -1, -1, + 44, -1, 46, -1, -1, 10, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 123, 124, 125, 126, -1, 33, -1, + -1, -1, 37, 38, -1, 40, 41, 42, 43, 44, + 45, 46, 47, -1, -1, -1, -1, 91, -1, -1, + -1, -1, -1, 58, 59, 60, 61, 62, 63, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, + 124, -1, -1, -1, -1, -1, 91, -1, 93, 94, + -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, 123, 124, + 125, 126, -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, 257, 258, 259, + -1, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, -1, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, -1, 293, 294, 295, 296, 297, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 279, 280, 337, 338, 339, + 340, -1, 342, 343, 344, -1, 346, 347, 348, 349, + 350, 351, 257, 258, 259, -1, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, -1, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, + 295, 296, 297, -1, 299, 339, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 0, -1, 337, 338, 339, 340, -1, 342, 343, 344, + 10, 346, 347, 348, 349, 350, 351, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 33, -1, -1, -1, 37, 38, -1, + 40, 41, 42, 43, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, + 60, -1, 62, 63, -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, 91, -1, 93, 94, 0, 40, -1, -1, -1, + 44, -1, 46, -1, -1, 10, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 123, 124, 125, 126, -1, 33, -1, + -1, -1, 37, 38, -1, 40, 41, 42, 43, 44, + 45, 46, 47, -1, -1, -1, -1, 91, -1, -1, + -1, -1, -1, 58, 59, 60, -1, 62, 63, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, + 124, -1, -1, -1, -1, -1, 91, -1, 93, 94, + -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, 123, 124, + 125, 126, -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, 257, 258, 259, + -1, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, -1, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, -1, 293, 294, 295, 296, 297, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 279, 280, 337, 338, 339, + 340, -1, 342, 343, 344, -1, 346, 347, 348, 349, + 350, 351, 257, 258, 259, -1, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, -1, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, + 295, 296, 297, -1, 299, 339, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 0, -1, 337, 338, 339, 340, -1, 342, 343, 344, + 10, 346, 347, 348, 349, 350, 351, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 33, -1, -1, -1, 37, 38, -1, + 40, 41, 42, 43, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, + 60, -1, 62, 63, -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, 91, -1, 93, 94, 0, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 123, 124, 125, 126, -1, 33, -1, + -1, -1, 37, 38, -1, -1, 41, 42, 43, 44, + 45, 46, 47, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 59, 60, -1, 62, 63, -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, 91, -1, 93, 94, + -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, 123, 124, + 125, 126, -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, 257, 258, 259, + -1, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, -1, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, -1, 293, 294, 295, 296, 297, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, -1, -1, 337, 338, 339, + 340, -1, 342, 343, 344, -1, 346, 347, 348, 349, + 350, 351, 257, 258, 259, -1, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, -1, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, + 295, 296, 297, -1, 299, -1, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 0, -1, 337, 338, 339, 340, -1, 342, 343, 344, + 10, 346, 347, 348, 349, 350, 351, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 33, -1, -1, -1, 37, 38, -1, + 40, 41, 42, 43, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, + 60, -1, 62, 63, -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, 91, -1, 93, 94, 0, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 124, 125, 126, -1, 33, -1, + -1, -1, 37, 38, -1, -1, 41, 42, 43, 44, + 45, 46, 47, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 59, 60, -1, 62, 63, -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, 91, -1, 93, 94, + -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, 123, 124, + 125, 126, -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, 257, 258, 259, + -1, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, -1, + -1, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, -1, 293, 294, 295, 296, 297, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, -1, -1, 337, 338, 339, + 340, -1, 342, 343, 344, -1, 346, 347, 348, 349, + 350, 351, 257, 258, 259, -1, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, -1, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, + 295, 296, 297, -1, 299, -1, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 0, -1, 337, 338, 339, 340, -1, 342, 343, 344, + 10, 346, 347, 348, 349, 350, 351, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 33, -1, -1, -1, 37, 38, -1, + 40, 41, 42, 43, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, + 60, 61, 62, 63, -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, 91, -1, -1, 94, 0, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 123, 124, 125, 126, -1, 33, -1, + -1, -1, 37, 38, -1, 40, 41, 42, 43, 44, + 45, 46, 47, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 59, 60, 61, 62, 63, -1, + -1, -1, -1, -1, -1, 37, 38, -1, -1, -1, + 42, 43, 44, 45, -1, 47, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 91, -1, 60, 94, + 62, 63, -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, 123, 124, + 125, 126, 94, -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, 124, -1, -1, -1, -1, 257, 258, 259, + -1, 261, 262, 263, 264, 265, 266, -1, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, -1, + 280, -1, -1, 283, 284, 285, 286, 287, 288, 289, + 290, 291, -1, 293, 294, 295, 296, 297, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, -1, -1, 337, 338, 339, + 340, -1, -1, 343, 344, -1, 346, 347, -1, 349, + 350, 351, 257, 258, 259, 33, 261, 262, 263, 264, + 265, 266, -1, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, -1, 280, -1, -1, 283, 284, + 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, + 295, 296, 297, -1, 299, -1, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 0, -1, 337, 338, 339, 340, -1, -1, 343, 344, + 10, 346, 347, -1, 349, 350, 351, -1, 126, -1, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 33, -1, 337, 338, 37, 38, -1, + 40, 41, 42, 43, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, + 60, 61, 62, 63, -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, 91, -1, -1, 94, 0, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 123, 124, 125, 126, -1, 33, -1, + -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, + -1, 46, -1, -1, -1, -1, -1, -1, 256, 257, + 258, 259, 260, 261, 59, -1, -1, 265, 266, -1, + -1, -1, 270, -1, 272, 273, 274, 275, 276, 277, + 278, -1, -1, -1, -1, 283, 284, 285, 286, 287, + 288, 289, -1, -1, 292, -1, -1, -1, -1, -1, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, -1, -1, -1, -1, -1, -1, + 125, 126, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 340, -1, -1, 343, 344, -1, 346, 347, + -1, 349, -1, 351, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 257, 258, 259, + -1, 261, 262, 263, 264, 265, 266, -1, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, -1, + 280, -1, -1, 283, 284, 285, 286, 287, 288, 289, + 290, 291, -1, 293, 294, 295, 296, 297, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, -1, -1, 337, 338, 339, + 340, -1, -1, 343, 344, -1, 346, 347, -1, 349, + 350, 351, 257, 258, 259, -1, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, -1, -1, 281, -1, 283, 284, + 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, + 295, 296, 297, -1, 299, -1, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 0, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, + -1, -1, -1, -1, 339, 340, -1, -1, 343, 344, + -1, 346, 347, -1, 349, 350, 351, -1, -1, -1, + -1, -1, -1, -1, 37, 38, -1, -1, 41, 42, + 43, 44, 45, 46, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 58, 59, 60, -1, 62, + 63, -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, 91, -1, + 93, 94, -1, -1, -1, -1, 10, -1, -1, -1, + -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, + 123, 124, 125, 37, 38, -1, -1, 41, 42, 43, + 44, 45, 46, 47, -1, -1, -1, -1, -1, -1, + -1, -1, 41, -1, 58, 59, 60, -1, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 0, 91, -1, 93, + 94, -1, -1, -1, -1, -1, 10, -1, -1, -1, + -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 10, -1, -1, -1, -1, -1, -1, 123, + 124, 125, -1, 37, 38, -1, -1, 41, 42, 43, + 44, 45, 46, 47, -1, -1, 125, -1, -1, -1, + -1, -1, -1, 41, 58, 59, 60, 61, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 59, -1, -1, -1, -1, -1, -1, -1, 262, + 263, 264, -1, -1, 267, 268, 269, 91, 271, 93, + 94, -1, -1, -1, -1, -1, -1, 280, 281, 282, + -1, -1, -1, -1, -1, -1, -1, 290, 291, -1, + 293, 294, 295, 296, 297, -1, -1, 0, -1, -1, + 124, 125, -1, -1, -1, -1, -1, 10, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 125, -1, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, -1, -1, 337, 338, 339, -1, 41, 342, + -1, 44, -1, -1, -1, 348, -1, -1, 262, 263, + 264, -1, -1, 267, 268, 269, 59, 271, -1, -1, + -1, -1, -1, 262, 263, 264, 280, 281, 282, 268, + 269, -1, 271, -1, -1, -1, 290, 291, -1, 293, + 294, 295, 296, 297, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, 293, 294, 295, 296, 297, -1, + -1, 10, -1, -1, -1, -1, -1, -1, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, -1, 125, 337, 338, 339, -1, -1, 342, -1, + -1, -1, 41, -1, 348, -1, -1, -1, 262, 263, + 264, -1, -1, 267, 268, 269, -1, 271, -1, -1, + 59, -1, -1, -1, 262, 263, 264, 281, 282, -1, + 268, 269, -1, 271, -1, -1, 290, 291, -1, 293, + 294, 295, 296, 297, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 0, 293, 294, 295, 296, 297, + -1, -1, -1, -1, 10, -1, -1, -1, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, -1, -1, 337, 338, 339, 125, -1, 342, -1, + -1, 37, 38, -1, 348, 41, 42, 43, 44, 45, + 46, 47, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 58, 59, 60, 61, 62, 63, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 262, + 263, 264, -1, -1, -1, 268, 269, -1, 271, -1, + -1, -1, -1, 0, -1, 91, -1, 93, 94, -1, + -1, -1, -1, 10, -1, -1, -1, 290, 291, 0, + 293, 294, 295, 296, 297, -1, -1, -1, -1, 10, + -1, -1, -1, -1, -1, -1, -1, -1, 124, 125, + 37, 38, -1, -1, 41, 42, 43, 44, 45, 46, + 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 41, 58, 59, 60, 61, 62, 63, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, + -1, -1, -1, 262, 263, 264, -1, -1, 267, 268, + 269, -1, 271, 0, 91, -1, 93, 94, -1, -1, + -1, -1, 281, 10, -1, -1, -1, -1, -1, 0, + -1, 290, 291, -1, 293, 294, 295, 296, 297, 10, + -1, -1, -1, -1, -1, -1, -1, 124, 125, -1, + 37, 38, -1, -1, 41, 42, 43, 44, 45, 46, + 47, -1, -1, -1, 125, -1, -1, -1, -1, -1, + 41, 58, 59, 60, -1, 62, 63, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, + -1, -1, -1, -1, -1, -1, 262, 263, 264, -1, + -1, 267, 268, 269, 91, 271, 93, 94, -1, -1, + -1, -1, -1, -1, -1, 281, 282, -1, -1, -1, + -1, -1, -1, -1, 290, 291, -1, 293, 294, 295, + 296, 297, -1, -1, 0, -1, -1, 124, 125, -1, + -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 125, -1, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, 333, 334, -1, + -1, 337, 338, 339, -1, 41, 342, -1, 44, -1, + -1, -1, 348, -1, -1, 262, 263, 264, -1, -1, + 267, 268, 269, 59, 271, -1, -1, -1, -1, -1, + -1, 262, 263, 264, 281, 282, -1, 268, 269, -1, + 271, -1, -1, 290, 291, -1, 293, 294, 295, 296, + 297, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, -1, 293, 294, 295, 296, 297, -1, 10, -1, + -1, -1, -1, -1, -1, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, -1, 125, + 337, 338, 339, -1, -1, 342, -1, -1, -1, 41, + -1, 348, -1, -1, -1, 262, 263, 264, -1, -1, + 267, 268, 269, -1, 271, -1, -1, 59, -1, -1, + -1, 262, 263, 264, 281, 282, -1, 268, 269, -1, + 271, -1, -1, 290, 291, -1, 293, 294, 295, 296, + 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, 293, 294, 295, 296, 297, -1, -1, -1, + -1, 10, -1, -1, -1, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, -1, -1, + 337, 338, 339, 125, -1, 342, -1, -1, 37, 38, + -1, 348, 41, 42, 43, 44, 45, 46, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, + 59, 60, -1, 62, 63, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 262, 263, 264, -1, + -1, -1, 268, 269, -1, 271, -1, -1, -1, -1, + 0, -1, 91, -1, 93, 94, -1, -1, -1, -1, + 10, -1, -1, -1, -1, -1, -1, 293, 294, 295, + 296, 297, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 124, 125, 37, 38, -1, + -1, 41, 42, 43, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, + 60, -1, 62, 63, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 262, 263, 264, -1, -1, 267, 268, 269, -1, 271, + 0, 91, -1, 93, 94, -1, -1, -1, -1, 281, + 10, -1, -1, -1, -1, -1, 0, -1, 290, 291, + -1, 293, 294, 295, 296, 297, 10, -1, -1, -1, + -1, -1, -1, -1, 124, 125, -1, 37, 38, -1, + -1, 41, 42, 43, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 41, -1, 59, + 60, -1, 62, 63, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, + -1, -1, -1, 262, 263, 264, -1, -1, 267, 268, + 269, 91, 271, 93, 94, -1, -1, -1, -1, -1, + -1, -1, 281, 282, -1, -1, -1, -1, -1, -1, + -1, 290, 291, -1, 293, 294, 295, 296, 297, -1, + -1, 0, -1, -1, 124, 125, -1, -1, -1, -1, + -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 125, -1, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, -1, -1, 337, 338, + 339, 10, 41, 342, -1, 44, -1, -1, -1, 348, + -1, -1, 262, 263, 264, -1, -1, 267, 268, 269, + 59, 271, -1, -1, -1, -1, -1, -1, 37, 38, + -1, 281, 282, 42, 43, -1, 45, -1, 47, -1, + 290, 291, -1, 293, 294, 295, 296, 297, -1, -1, + -1, 60, -1, 62, 63, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 94, 125, 337, 338, 339, + -1, -1, 342, -1, -1, -1, -1, -1, 348, -1, + -1, -1, 262, 263, 264, -1, -1, 267, 268, 269, + -1, 271, -1, -1, -1, 124, -1, -1, 262, 263, + 264, 281, 282, -1, 268, 269, -1, 271, -1, -1, + 290, 291, -1, 293, 294, 295, 296, 297, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 0, 293, + 294, 295, 296, 297, -1, -1, -1, -1, 10, -1, + -1, -1, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, -1, -1, 337, 338, 339, + -1, -1, 342, -1, -1, 37, 38, -1, 348, 41, + 42, 43, 44, 45, -1, 47, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 58, 59, 60, -1, + 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 262, 263, 264, -1, -1, -1, 268, + 269, -1, 271, -1, -1, -1, -1, 0, -1, -1, + -1, 93, 94, -1, -1, -1, -1, 10, -1, -1, + -1, -1, -1, -1, 293, 294, 295, 296, 297, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 124, 125, 37, 38, -1, -1, 41, 42, + 43, 44, 45, -1, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 59, 60, -1, 62, + 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, -1, 0, 337, 338, + 93, 94, -1, -1, -1, -1, -1, 10, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, 125, -1, 37, 38, -1, -1, 41, 42, + 43, 44, 45, -1, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 58, 59, 60, -1, 62, + 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 262, 263, 264, -1, -1, 267, 268, 269, -1, 271, + 93, 94, -1, -1, -1, -1, -1, -1, -1, 281, + 282, -1, -1, -1, -1, -1, -1, -1, 290, 291, + -1, 293, 294, 295, 296, 297, -1, -1, 0, -1, + -1, 124, 125, -1, -1, -1, -1, -1, 10, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, -1, -1, 337, 338, -1, -1, 41, + 342, -1, 44, -1, -1, -1, 348, -1, -1, 262, + 263, 264, -1, -1, 267, 268, 269, 59, 271, -1, + -1, -1, -1, -1, -1, 37, 38, -1, 281, 282, + 42, 43, -1, 45, -1, 47, -1, 290, 291, -1, + 293, 294, 295, 296, 297, -1, -1, -1, 60, -1, + 62, 93, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, 94, 125, 337, 338, -1, -1, -1, 342, + -1, -1, -1, -1, -1, 348, -1, -1, -1, 262, + 263, 264, -1, -1, 267, 268, 269, -1, 271, -1, + -1, -1, 124, -1, -1, -1, -1, -1, 281, 282, + -1, -1, -1, -1, -1, -1, -1, 290, 291, -1, + 293, 294, 295, 296, 297, -1, -1, -1, -1, 0, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, -1, -1, 337, 338, 37, 38, -1, 342, + 41, 42, 43, 44, 45, 348, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 58, 59, 60, + -1, 62, 63, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 262, 263, 264, -1, -1, 267, 268, 269, 0, 271, + -1, -1, 93, 94, -1, -1, -1, -1, 10, 281, + 282, -1, -1, -1, -1, -1, -1, -1, 290, 291, + -1, 293, 294, 295, 296, 297, -1, -1, -1, -1, + -1, -1, -1, 124, 125, 37, 38, -1, -1, 41, + 42, 43, 44, 45, -1, 47, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 58, 59, 60, -1, + 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 348, -1, -1, -1, + 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, + 332, 93, 94, -1, -1, 337, 338, -1, 10, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 124, 125, -1, 37, 38, -1, -1, 41, + 42, 43, 44, 45, -1, 47, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 58, 59, 60, -1, + 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 262, 263, 264, -1, -1, 267, 268, 269, -1, + 271, 93, 94, -1, -1, -1, -1, -1, -1, -1, + 281, 282, -1, -1, -1, -1, -1, -1, -1, 290, + 291, -1, 293, 294, 295, 296, 297, -1, -1, 0, + -1, -1, 124, 125, -1, -1, -1, -1, -1, 10, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, -1, -1, 337, 338, -1, -1, + 41, 342, -1, 44, -1, -1, -1, 348, -1, -1, + 262, 263, 264, -1, -1, 267, 268, 269, 59, 271, + -1, -1, -1, -1, -1, -1, 37, 38, -1, 281, + 282, 42, 43, -1, 45, -1, 47, -1, 290, 291, + -1, 293, 294, 295, 296, 297, -1, -1, -1, 60, + -1, 62, 93, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 94, 125, 337, 338, -1, -1, -1, + 342, -1, -1, -1, -1, -1, 348, -1, -1, -1, + 262, 263, 264, -1, -1, 267, 268, 269, -1, 271, + -1, -1, -1, 124, -1, -1, -1, -1, -1, 281, + 282, -1, -1, -1, -1, -1, -1, -1, 290, 291, + -1, 293, 294, 295, 296, 297, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, -1, -1, 337, 338, 37, 38, -1, + 342, 41, 42, 43, 44, 45, 348, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, + 60, -1, 62, 63, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 262, 263, 264, -1, -1, 267, 268, 269, 0, + 271, -1, -1, 93, 94, -1, -1, -1, -1, 10, + 281, 282, -1, -1, -1, -1, -1, -1, -1, 290, + 291, -1, 293, 294, 295, 296, 297, -1, -1, -1, + -1, -1, -1, -1, 124, 125, 37, 38, -1, -1, + 41, 42, 43, 44, 45, -1, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 58, 59, 60, + -1, 62, 63, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 348, -1, -1, + -1, 322, 323, 324, 325, 326, 327, 328, -1, 0, + 331, 332, 93, 94, -1, -1, 337, 338, -1, 10, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 124, 125, -1, 37, 38, -1, -1, + 41, 42, 43, 44, 45, -1, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 58, 59, 60, + -1, 62, 63, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 262, 263, 264, -1, -1, 267, 268, 269, + -1, 271, 93, 94, -1, -1, -1, -1, -1, -1, + -1, 281, 282, -1, -1, -1, -1, -1, -1, -1, + 290, 291, -1, 293, 294, 295, 296, 297, -1, -1, + -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, -1, -1, 337, 338, -1, + 0, -1, 342, -1, -1, -1, -1, -1, 348, -1, + 10, 262, 263, 264, -1, -1, 267, 268, 269, -1, + 271, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 281, 282, -1, -1, -1, -1, -1, -1, -1, 290, + 291, 41, 293, 294, 295, 296, 297, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, -1, -1, 337, 338, -1, -1, + -1, 342, -1, -1, -1, -1, -1, 348, -1, -1, + -1, 262, 263, 264, -1, -1, 267, 268, 269, -1, + 271, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 281, 282, -1, -1, -1, 125, -1, -1, -1, 290, + 291, -1, 293, 294, 295, 296, 297, -1, -1, -1, + -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, -1, -1, 337, 338, 37, 38, + -1, 342, 41, 42, 43, 44, 45, 348, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, + 59, 60, -1, 62, 63, -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, 93, 94, -1, -1, -1, 10, + -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, + -1, -1, 262, 263, 264, 124, 125, 38, 268, 269, + 41, 271, 43, 44, 45, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 41, -1, 58, 59, 60, + -1, 62, 63, 293, 294, 295, 296, 297, -1, -1, + -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, 93, 94, -1, -1, -1, -1, -1, -1, + 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 124, 125, -1, -1, -1, 38, -1, + -1, 41, -1, 43, 44, 45, -1, -1, -1, 125, + -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, + 60, -1, 62, 63, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 262, 263, 264, -1, -1, 267, 268, + 269, -1, 271, 93, 94, -1, -1, -1, -1, -1, + -1, -1, 281, 282, -1, -1, -1, -1, -1, -1, + -1, 290, 291, -1, 293, 294, 295, 296, 297, -1, + 0, -1, -1, -1, 124, 125, -1, -1, -1, -1, + 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, -1, -1, 337, 338, + -1, 41, -1, 342, 44, -1, -1, -1, -1, 348, + -1, 262, 263, 264, -1, -1, 267, 268, 269, 59, + 271, -1, -1, -1, -1, -1, 262, 263, 264, -1, + 281, 282, 268, 269, -1, 271, -1, -1, -1, 290, + 291, -1, 293, 294, 295, 296, 297, -1, -1, -1, + -1, -1, -1, 93, -1, 0, -1, 293, 294, 295, + 296, 297, -1, -1, -1, 10, -1, -1, -1, -1, + -1, -1, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, -1, 125, 337, 338, -1, -1, + -1, 342, -1, 38, -1, -1, 41, 348, -1, 44, + -1, -1, 262, 263, 264, -1, -1, 267, 268, 269, + -1, 271, -1, 58, 59, 60, -1, 62, 63, -1, + -1, 281, 282, -1, -1, -1, -1, -1, -1, -1, + 290, 291, -1, 293, 294, 295, 296, 297, -1, -1, + -1, -1, -1, 0, -1, -1, -1, -1, 93, 94, + -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, -1, -1, 337, 338, 124, + 125, 38, 342, -1, 41, -1, -1, 44, 348, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 58, 59, 60, -1, 62, 63, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 262, 263, 264, -1, -1, 267, 268, 269, + -1, 271, -1, -1, 0, -1, 93, 94, -1, -1, + -1, 281, 282, -1, 10, -1, -1, -1, -1, -1, + 290, 291, -1, 293, 294, 295, 296, 297, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, 125, -1, + -1, -1, 38, -1, -1, 41, -1, -1, 44, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }; + } + protected static final short[] yyCheck2() { + return new short[] { + -1, -1, 58, 59, 60, -1, 62, 63, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 348, -1, + -1, -1, -1, -1, -1, -1, -1, 262, 263, 264, + -1, -1, 267, 268, 269, -1, 271, 93, 94, -1, + -1, -1, -1, -1, -1, -1, 281, 282, -1, -1, + -1, -1, -1, -1, -1, 290, 291, -1, 293, 294, + 295, 296, 297, -1, -1, -1, -1, 0, 124, 125, + -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + -1, -1, 337, 338, -1, -1, -1, 342, 41, -1, + -1, 44, -1, 348, -1, 262, 263, 264, -1, -1, + 267, 268, 269, -1, 271, 58, 59, 60, -1, 62, + 63, -1, -1, -1, 281, 282, -1, -1, -1, -1, + -1, -1, -1, 290, 291, -1, 293, 294, 295, 296, + 297, -1, -1, -1, -1, -1, -1, -1, 0, -1, + 93, -1, -1, -1, -1, -1, -1, -1, 10, -1, + -1, -1, -1, -1, -1, -1, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, -1, -1, + 337, 338, 125, -1, -1, 342, -1, -1, -1, 41, + -1, 348, 44, -1, -1, -1, 262, 263, 264, -1, + -1, 267, 268, 269, -1, 271, 58, 59, 60, -1, + 62, 63, -1, -1, -1, 281, 282, -1, -1, -1, + -1, -1, -1, -1, 290, 291, -1, 293, 294, 295, + 296, 297, -1, -1, -1, -1, 0, -1, -1, -1, + -1, 93, 94, -1, -1, -1, 10, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, 333, 334, -1, + -1, -1, 124, 125, -1, -1, 342, 41, -1, -1, + 44, -1, 348, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 58, 59, 60, -1, 62, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 262, + 263, 264, -1, -1, 267, 268, 269, -1, 271, 93, + 94, -1, -1, -1, 0, -1, -1, -1, 281, 282, + -1, -1, -1, -1, 10, -1, -1, 290, 291, -1, + 293, 294, 295, 296, 297, -1, -1, -1, -1, -1, + 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 41, -1, -1, 44, -1, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, 58, 59, 60, -1, 62, 63, -1, 342, + -1, -1, -1, -1, -1, 348, -1, -1, -1, -1, + 262, 263, 264, -1, -1, 267, 268, 269, -1, 271, + -1, -1, -1, -1, -1, -1, 0, 93, -1, 281, + 282, -1, -1, -1, -1, -1, 10, -1, 290, 291, + -1, 293, 294, 295, 296, 297, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, + -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, + 44, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, -1, 58, 59, 60, -1, 62, 63, + 342, -1, -1, -1, -1, -1, 348, -1, 262, 263, + 264, -1, -1, 267, 268, 269, -1, 271, -1, -1, + -1, -1, -1, 0, -1, -1, -1, 281, 282, 93, + -1, -1, -1, 10, -1, -1, 290, 291, -1, 293, + 294, 295, 296, 297, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 125, -1, -1, 41, -1, -1, 44, -1, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 58, 59, 60, -1, 62, 63, -1, 342, -1, + -1, -1, -1, -1, 348, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 262, 263, 264, -1, + -1, 267, 268, 269, -1, 271, 93, -1, -1, -1, + -1, 0, -1, -1, -1, 281, 282, -1, -1, -1, + -1, 10, -1, -1, 290, 291, -1, 293, 294, 295, + 296, 297, -1, -1, -1, -1, -1, -1, 125, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 41, -1, -1, 44, -1, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, 333, 334, 58, + 59, -1, -1, -1, 63, -1, 342, -1, -1, -1, + -1, -1, 348, -1, -1, -1, 0, -1, 262, 263, + 264, -1, -1, 267, 268, 269, 10, 271, -1, -1, + -1, -1, -1, 0, 93, -1, -1, 281, 282, -1, + -1, -1, -1, 10, -1, -1, 290, 291, -1, 293, + 294, 295, 296, 297, -1, -1, -1, 41, -1, -1, + -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, + -1, -1, -1, -1, 41, 59, -1, 44, -1, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 58, 59, -1, -1, -1, 63, -1, 342, -1, + -1, -1, -1, -1, 348, 262, 263, 264, -1, -1, + 267, 268, 269, -1, 271, -1, -1, -1, -1, -1, + 0, -1, -1, -1, 281, 282, 93, -1, -1, -1, + 10, -1, -1, 290, 291, -1, 293, 294, 295, 296, + 297, 125, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, + -1, 41, -1, -1, 44, -1, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 58, 59, + -1, -1, -1, 63, -1, 342, -1, -1, -1, -1, + -1, 348, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 262, 263, 264, -1, -1, 267, 268, + 269, -1, 271, 93, 0, -1, -1, -1, -1, -1, + -1, -1, 281, 282, 10, -1, -1, -1, -1, -1, + -1, 290, 291, -1, 293, 294, 295, 296, 297, -1, + -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 41, -1, -1, 44, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 329, 330, 58, 59, 333, 334, -1, 63, 262, 263, + 264, -1, -1, 342, 268, 269, -1, 271, -1, 348, + -1, -1, -1, -1, -1, 262, 263, 264, -1, -1, + 267, 268, 269, -1, 271, -1, 0, 93, -1, 293, + 294, 295, 296, 297, 281, 282, 10, -1, -1, -1, + -1, -1, -1, 290, 291, -1, 293, 294, 295, 296, + 297, -1, -1, -1, -1, -1, -1, -1, -1, 125, + -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, + 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 329, 330, 58, 59, 333, 334, -1, 63, + -1, -1, -1, -1, -1, 342, -1, -1, -1, -1, + -1, 348, 262, 263, 264, -1, -1, 267, 268, 269, + -1, 271, -1, 0, -1, -1, -1, -1, -1, 93, + -1, 281, 282, 10, -1, -1, -1, -1, -1, -1, + 290, 291, -1, 293, 294, 295, 296, 297, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 125, -1, -1, 41, -1, -1, 44, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 329, + 330, 58, 59, 333, 334, -1, 63, -1, -1, -1, + -1, -1, 342, -1, -1, -1, -1, -1, 348, -1, + -1, -1, -1, -1, -1, -1, 262, 263, 264, -1, + -1, 267, 268, 269, -1, 271, 93, 0, -1, -1, + -1, -1, -1, -1, -1, 281, 282, 10, -1, -1, + -1, -1, -1, -1, 290, 291, -1, 293, 294, 295, + 296, 297, -1, -1, -1, -1, -1, -1, 125, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, + -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 329, 330, 58, 59, 333, 334, -1, + 63, -1, -1, -1, -1, -1, 342, -1, -1, -1, + -1, -1, 348, -1, -1, -1, -1, -1, 262, 263, + 264, -1, -1, 267, 268, 269, -1, 271, -1, 0, + 93, -1, -1, -1, -1, -1, -1, 281, 282, 10, + -1, -1, -1, -1, -1, -1, 290, 291, -1, 293, + 294, 295, 296, 297, -1, -1, -1, -1, -1, -1, + -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, + 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 329, 330, 58, 59, 333, + 334, -1, 63, -1, -1, -1, -1, -1, 342, -1, + -1, -1, -1, -1, 348, 262, 263, 264, -1, -1, + 267, 268, 269, -1, 271, -1, 0, -1, -1, -1, + -1, -1, 93, -1, 281, 282, 10, -1, -1, -1, + -1, -1, -1, 290, 291, -1, 293, 294, 295, 296, + 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 0, -1, 125, -1, -1, 41, -1, -1, + 44, -1, 10, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 329, 330, 58, 59, 333, 334, -1, 63, + -1, -1, -1, -1, -1, 342, -1, -1, -1, -1, + -1, 348, -1, 41, -1, -1, 44, -1, -1, 262, + 263, 264, -1, -1, 267, 268, 269, -1, 271, 93, + 58, 59, -1, -1, 0, -1, -1, -1, 281, 282, + -1, -1, -1, -1, 10, -1, -1, 290, 291, -1, + 293, 294, 295, 296, 297, -1, -1, -1, -1, -1, + -1, 125, -1, -1, -1, 93, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 41, -1, -1, 44, -1, + -1, -1, -1, -1, -1, -1, 329, 330, -1, -1, + 333, 334, 58, 59, -1, -1, -1, 125, -1, 342, + -1, -1, -1, -1, -1, 348, -1, -1, -1, -1, + -1, 262, 263, 264, -1, -1, 267, 268, 269, -1, + 271, -1, 0, -1, -1, -1, -1, 93, -1, -1, + 281, 282, 10, -1, -1, -1, -1, -1, -1, 290, + 291, -1, 293, 294, 295, 296, 297, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, + -1, -1, -1, 41, -1, 0, 44, -1, -1, -1, + -1, -1, -1, -1, -1, 10, -1, -1, -1, 330, + 58, 59, 333, 334, -1, -1, -1, -1, -1, -1, + -1, 342, -1, -1, -1, -1, -1, 348, 262, 263, + 264, -1, -1, 267, 268, 269, 41, 271, -1, 44, + -1, -1, -1, -1, -1, 93, -1, 281, 282, -1, + -1, -1, -1, 58, 59, -1, 290, 291, -1, 293, + 294, 295, 296, 297, 262, 263, 264, -1, -1, 267, + 268, 269, -1, 271, -1, -1, -1, 125, -1, -1, + -1, -1, -1, 281, 282, -1, -1, -1, 93, -1, + -1, -1, 290, 291, -1, 293, 294, 295, 296, 297, + -1, -1, -1, -1, -1, -1, -1, 0, 342, -1, + -1, -1, -1, -1, 348, -1, -1, 10, -1, -1, + 125, -1, -1, -1, -1, -1, 262, 263, 264, -1, + -1, 267, 268, 269, -1, 271, -1, -1, -1, -1, + -1, -1, -1, 0, 342, 281, 282, -1, 41, -1, + 348, 44, -1, 10, 290, 291, -1, 293, 294, 295, + 296, 297, -1, -1, -1, 58, 59, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 41, -1, -1, 44, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 93, 58, 59, -1, -1, -1, 342, -1, -1, -1, + -1, -1, 348, -1, 262, 263, 264, -1, -1, 267, + 268, 269, -1, 271, -1, -1, -1, -1, -1, -1, + -1, -1, 125, 281, 282, -1, 93, -1, -1, -1, + 0, -1, 290, 291, -1, 293, 294, 295, 296, 297, + 10, -1, -1, -1, -1, -1, -1, 262, 263, 264, + -1, -1, 267, 268, 269, -1, 271, -1, 125, -1, + -1, -1, -1, -1, -1, -1, 281, 282, -1, -1, + -1, 41, -1, -1, 44, 290, 291, -1, 293, 294, + 295, 296, 297, -1, 342, -1, -1, -1, 58, 59, + 348, -1, -1, 0, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 93, -1, -1, -1, 342, -1, -1, + -1, -1, -1, 348, 41, -1, -1, 44, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 58, 59, -1, -1, 125, -1, -1, -1, 262, + 263, 264, 0, -1, 267, 268, 269, -1, 271, -1, + -1, -1, 10, -1, -1, -1, -1, -1, 281, 282, + -1, -1, -1, -1, -1, -1, 93, 290, 291, -1, + 293, 294, 295, 296, 297, 262, 263, 264, -1, -1, + 267, 268, 269, 41, 271, -1, 44, -1, -1, -1, + -1, -1, 0, -1, 281, 282, -1, -1, 125, -1, + 58, 59, 10, 290, 291, -1, 293, 294, 295, 296, + 297, -1, -1, -1, -1, -1, -1, -1, -1, 342, + -1, -1, -1, -1, -1, 348, -1, -1, -1, -1, + -1, -1, -1, 41, 0, 93, -1, -1, -1, -1, + -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, + -1, 59, -1, -1, -1, 342, -1, -1, -1, -1, + -1, 348, -1, -1, -1, -1, -1, 125, -1, -1, + -1, -1, 262, 263, 264, 41, -1, 267, 268, 269, + -1, 271, -1, -1, -1, 93, -1, -1, -1, -1, + -1, 281, 282, 59, -1, -1, -1, -1, -1, -1, + 290, 291, -1, 293, 294, 295, 296, 297, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, + -1, -1, -1, -1, -1, 262, 263, 264, -1, -1, + 267, 268, 269, -1, 271, -1, -1, -1, -1, -1, + -1, -1, 342, -1, 281, 282, -1, -1, 348, 125, + -1, -1, -1, 290, 291, -1, 293, 294, 295, 296, + 297, -1, -1, -1, -1, -1, -1, 37, 38, -1, + -1, -1, 42, 43, 44, 45, -1, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 60, -1, 62, 63, 262, 263, 264, -1, -1, 267, + 268, 269, -1, 271, -1, 342, -1, -1, -1, -1, + -1, 348, -1, 281, 282, -1, -1, -1, -1, -1, + -1, -1, 290, 291, 94, 293, 294, 295, 296, 297, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 262, 263, 264, -1, -1, 267, + 268, 269, -1, 271, 124, -1, -1, -1, -1, -1, + -1, -1, -1, 281, 282, -1, -1, -1, -1, -1, + -1, -1, 290, 291, 342, 293, 294, 295, 296, 297, + 348, -1, -1, -1, -1, -1, 262, 263, 264, -1, + 0, 267, 268, 269, -1, 271, -1, -1, -1, -1, + 10, -1, -1, -1, -1, 281, 282, -1, -1, -1, + -1, -1, -1, -1, 290, 291, -1, 293, 294, 295, + 296, 297, -1, -1, -1, -1, -1, 37, 38, -1, + 348, 41, 42, 43, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, + 60, -1, 62, 63, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 348, -1, -1, 0, -1, -1, -1, -1, + -1, 91, -1, -1, 94, 10, -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, 37, 38, 124, 125, 41, 42, 43, 44, + 45, 46, 47, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 59, 60, -1, 62, 63, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, -1, 91, 337, 338, 94, + -1, 0, 342, -1, -1, -1, -1, -1, -1, -1, + -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + 125, -1, -1, -1, -1, -1, -1, -1, 37, 38, + -1, -1, 41, 42, 43, 44, 45, 46, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 59, 60, -1, 62, 63, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 262, 263, 264, -1, -1, 267, 268, 269, + -1, 271, 91, -1, -1, 94, -1, -1, -1, -1, + -1, 281, -1, -1, -1, -1, 10, -1, -1, -1, + 290, 291, -1, 293, 294, 295, 296, 297, -1, -1, + -1, -1, -1, -1, -1, 124, 125, -1, -1, 33, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 59, -1, 337, 338, 339, + -1, -1, 342, -1, -1, -1, -1, 262, 263, 264, + -1, -1, 267, 268, 269, -1, 271, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 281, -1, -1, -1, + -1, -1, -1, -1, -1, 290, 291, -1, 293, 294, + 295, 296, 297, 10, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 126, -1, -1, -1, 33, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + -1, -1, 337, 338, 339, -1, -1, 342, -1, -1, + -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 262, 263, 264, -1, -1, 267, 268, + 269, -1, 271, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 281, -1, -1, -1, -1, -1, -1, -1, + -1, 290, 291, -1, 293, 294, 295, 296, 297, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 10, -1, -1, -1, -1, 126, + -1, -1, -1, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, -1, 33, 337, 338, + 339, -1, -1, 342, -1, -1, -1, -1, -1, -1, + -1, -1, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 59, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, -1, -1, -1, -1, 283, + 284, 285, 286, 287, 288, 289, -1, -1, 292, -1, + -1, -1, -1, -1, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, -1, -1, + -1, -1, -1, -1, -1, 10, -1, -1, -1, 125, + 126, -1, -1, -1, -1, -1, 340, -1, -1, 343, + 344, -1, 346, 347, -1, 349, -1, 351, 33, 256, + 257, 258, 259, 260, 261, -1, -1, 264, 265, 266, + -1, -1, -1, 270, -1, 272, 273, 274, 275, 276, + 277, 278, -1, -1, 59, -1, 283, 284, 285, 286, + 287, 288, 289, -1, -1, 292, -1, -1, -1, -1, + -1, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 340, -1, -1, 343, 344, -1, 346, + 347, 126, 349, -1, 351, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 256, 257, 258, 259, 260, 261, -1, -1, -1, 265, + 266, -1, -1, -1, 270, -1, 272, 273, 274, 275, + 276, 277, 278, -1, -1, -1, -1, 283, 284, 285, + 286, 287, 288, 289, -1, -1, 292, -1, -1, -1, + -1, -1, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 340, -1, -1, 343, 344, -1, + 346, 347, -1, 349, -1, 351, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 257, 258, 259, -1, 261, -1, -1, -1, + 265, 266, -1, -1, -1, 270, -1, 272, 273, 274, + 275, 276, 277, 278, -1, -1, -1, -1, 283, 284, + 285, 286, 287, 288, 289, -1, -1, 292, -1, -1, + -1, -1, -1, -1, 299, -1, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 0, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, + -1, -1, -1, -1, -1, 340, -1, -1, 343, 344, + -1, 346, 347, -1, -1, -1, 351, -1, -1, -1, + -1, -1, -1, -1, 37, 38, -1, -1, 41, 42, + 43, 44, 45, 46, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 59, 60, 61, 62, + 63, -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, -1, 91, -1, + -1, 94, 10, -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, 37, + 38, 124, 125, 41, 42, 43, 44, 45, 46, 47, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 59, 60, 61, 62, 63, -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, 91, -1, -1, 94, -1, 0, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 124, 125, -1, -1, + -1, -1, -1, -1, -1, 37, 38, -1, -1, 41, + 42, 43, 44, 45, 46, 47, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 59, 60, 61, + 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 262, + 263, 264, -1, -1, -1, 268, 269, -1, 271, 91, + -1, -1, 94, -1, -1, -1, 37, 38, -1, -1, + -1, 42, 43, -1, 45, -1, 47, 290, 291, -1, + 293, 294, 295, 296, 297, -1, -1, -1, -1, 60, + -1, 62, 124, 125, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, -1, 94, 337, 338, 339, -1, -1, -1, + -1, -1, -1, -1, 262, 263, 264, -1, -1, -1, + 268, 269, -1, 271, -1, -1, -1, 33, -1, -1, + -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, + -1, -1, 290, 291, -1, 293, 294, 295, 296, 297, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, -1, -1, 337, + 338, 339, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 262, 263, 264, -1, -1, -1, 268, 269, -1, 271, + 126, -1, 33, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 290, 291, + -1, 293, 294, 295, 296, 297, -1, -1, 59, -1, + -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, -1, -1, 337, 338, 339, 37, 38, + -1, -1, 41, 42, 43, -1, 45, -1, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 59, 60, -1, 62, 63, 126, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, -1, -1, -1, 94, 337, 338, -1, -1, + 256, 257, 258, 259, 260, 261, -1, -1, -1, 265, + 266, -1, -1, -1, 270, -1, 272, 273, 274, 275, + 276, 277, 278, -1, -1, 124, 125, 283, 284, 285, + 286, 287, 288, 289, -1, -1, 292, 33, -1, -1, + -1, -1, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 340, -1, -1, 343, 344, -1, + 346, 347, -1, 349, -1, 351, 257, 258, 259, 260, + 261, -1, -1, -1, 265, 266, -1, -1, -1, 270, + -1, 272, 273, 274, 275, 276, 277, 278, -1, -1, + -1, -1, 283, 284, 285, 286, 287, 288, 289, -1, + 126, 292, -1, -1, -1, -1, -1, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 33, -1, 262, 263, 264, -1, -1, 40, 268, + 269, -1, 271, -1, -1, -1, -1, -1, -1, 340, + -1, -1, 343, 344, -1, 346, 347, -1, 349, -1, + 351, 290, 291, -1, 293, 294, 295, 296, 297, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, -1, -1, 337, 338, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 126, -1, -1, -1, -1, 33, + -1, 257, 258, 259, 260, 261, -1, 41, -1, 265, + 266, -1, -1, -1, 270, -1, 272, 273, 274, 275, + 276, 277, 278, -1, -1, -1, -1, 283, 284, 285, + 286, 287, 288, 289, -1, -1, 292, -1, -1, -1, + -1, -1, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 340, -1, -1, 343, 344, -1, + 346, 347, 126, 349, -1, 351, -1, 33, -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, 257, 258, 259, -1, 261, + -1, -1, -1, 265, 266, -1, -1, -1, 270, -1, + 272, 273, 274, 275, 276, 277, 278, -1, -1, -1, + -1, 283, 284, 285, 286, 287, 288, 289, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 299, -1, -1, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 126, -1, -1, -1, -1, 33, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 340, -1, + -1, 343, 344, -1, 346, 347, -1, 349, 350, 351, + -1, -1, -1, 257, 258, 259, -1, 261, -1, -1, + -1, 265, 266, -1, -1, -1, 270, -1, 272, 273, + 274, 275, 276, 277, 278, -1, -1, -1, -1, 283, + 284, 285, 286, 287, 288, 289, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 299, -1, -1, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 126, -1, + -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 340, -1, -1, 343, + 344, -1, 346, 347, -1, 349, 350, 351, -1, -1, + -1, 257, 258, 259, -1, 261, -1, -1, -1, 265, + 266, -1, -1, -1, 270, -1, 272, 273, 274, 275, + 276, 277, 278, -1, -1, -1, -1, 283, 284, 285, + 286, 287, 288, 289, -1, -1, 292, -1, -1, -1, + -1, -1, -1, 299, -1, -1, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 126, -1, -1, -1, + -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 340, -1, -1, 343, 344, -1, + 346, 347, -1, 349, 350, 351, -1, -1, -1, 257, + 258, 259, -1, 261, -1, -1, -1, 265, 266, -1, + -1, -1, 270, -1, 272, 273, 274, 275, 276, 277, + 278, -1, -1, -1, -1, 283, 284, 285, 286, 287, + 288, 289, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 299, -1, -1, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 126, -1, -1, -1, -1, 33, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 340, -1, -1, 343, 344, -1, 346, 347, + -1, 349, 350, 351, -1, -1, -1, 257, 258, 259, + -1, 261, -1, -1, -1, 265, 266, -1, -1, -1, + 270, -1, 272, 273, 274, 275, 276, 277, 278, -1, + -1, -1, -1, 283, 284, 285, 286, 287, 288, 289, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 126, -1, -1, -1, -1, 33, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 340, -1, -1, 343, 344, -1, 346, 347, -1, 349, + 350, 351, -1, -1, -1, 257, 258, 259, -1, 261, + -1, -1, -1, 265, 266, -1, -1, -1, 270, -1, + 272, 273, 274, 275, 276, 277, 278, -1, -1, -1, + -1, 283, 284, 285, 286, 287, 288, 289, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 299, -1, -1, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 126, -1, -1, -1, -1, 33, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 340, -1, + -1, 343, 344, -1, 346, 347, -1, 349, 350, 351, + -1, -1, -1, 257, 258, 259, -1, 261, -1, -1, + -1, 265, 266, -1, -1, -1, 270, -1, 272, 273, + 274, 275, 276, 277, 278, -1, -1, -1, -1, 283, + 284, 285, 286, 287, 288, 289, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 299, -1, -1, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 126, -1, + -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 340, -1, -1, 343, + 344, -1, 346, 347, -1, 349, 350, 351, -1, -1, + -1, 257, 258, 259, -1, 261, -1, -1, -1, 265, + 266, -1, -1, -1, 270, -1, 272, 273, 274, 275, + 276, 277, 278, -1, -1, -1, -1, 283, 284, 285, + 286, 287, 288, 289, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 299, -1, -1, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 126, -1, -1, -1, + -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 340, -1, -1, 343, 344, -1, + 346, 347, -1, 349, 350, 351, -1, -1, -1, 257, + 258, 259, -1, 261, -1, -1, -1, 265, 266, -1, + -1, -1, 270, -1, 272, 273, 274, 275, 276, 277, + 278, -1, -1, -1, -1, 283, 284, 285, 286, 287, + 288, 289, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 299, -1, -1, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 126, -1, -1, -1, -1, 33, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 340, -1, -1, 343, 344, -1, 346, 347, + -1, 349, 350, 351, -1, -1, -1, 257, 258, 259, + -1, 261, -1, -1, -1, 265, 266, -1, -1, -1, + 270, -1, 272, 273, 274, 275, 276, 277, 278, -1, + -1, -1, -1, 283, 284, 285, 286, 287, 288, 289, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 126, -1, -1, -1, -1, 33, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 340, -1, -1, 343, 344, -1, 346, 347, -1, 349, + 350, 351, -1, -1, -1, 257, 258, 259, -1, 261, + -1, -1, -1, 265, 266, -1, -1, -1, 270, -1, + 272, 273, 274, 275, 276, 277, 278, -1, -1, -1, + -1, 283, 284, 285, 286, 287, 288, 289, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 299, -1, -1, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 126, -1, -1, -1, -1, 33, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 340, -1, + -1, 343, 344, -1, 346, 347, -1, 349, 350, 351, + -1, -1, -1, 257, 258, 259, -1, 261, -1, -1, + -1, 265, 266, -1, -1, -1, 270, -1, 272, 273, + 274, 275, 276, 277, 278, -1, -1, -1, -1, 283, + 284, 285, 286, 287, 288, 289, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 299, -1, -1, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 126, -1, + -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 340, -1, -1, 343, + 344, -1, 346, 347, -1, 349, 350, 351, -1, -1, + -1, 257, 258, 259, -1, 261, -1, -1, -1, 265, + 266, -1, -1, -1, 270, -1, 272, 273, 274, 275, + 276, 277, 278, -1, -1, -1, -1, 283, 284, 285, + 286, 287, 288, 289, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 299, -1, -1, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 126, -1, -1, -1, + -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 340, -1, -1, 343, 344, -1, + 346, 347, -1, 349, 350, 351, -1, -1, -1, 257, + 258, 259, -1, 261, -1, -1, -1, 265, 266, -1, + -1, -1, 270, -1, 272, 273, 274, 275, 276, 277, + 278, -1, -1, -1, -1, 283, 284, 285, 286, 287, + 288, 289, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 299, -1, -1, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 126, -1, -1, -1, -1, 33, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 340, -1, -1, 343, 344, -1, 346, 347, + -1, 349, 350, 351, -1, -1, -1, 257, 258, 259, + -1, 261, -1, -1, -1, 265, 266, -1, -1, -1, + 270, -1, 272, 273, 274, 275, 276, 277, 278, -1, + -1, -1, -1, 283, 284, 285, 286, 287, 288, 289, + -1, -1, 292, -1, -1, -1, -1, -1, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 126, -1, -1, -1, -1, 33, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 340, -1, -1, 343, 344, -1, 346, 347, -1, -1, + -1, 351, -1, -1, -1, 257, 258, 259, -1, 261, + -1, -1, -1, 265, 266, -1, -1, -1, 270, -1, + 272, 273, 274, 275, 276, 277, 278, -1, -1, -1, + -1, 283, 284, 285, 286, 287, 288, 289, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 299, -1, -1, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 126, -1, -1, -1, -1, 33, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 340, -1, + -1, 343, 344, -1, 346, 347, -1, 349, -1, 351, + -1, -1, -1, 257, 258, 259, -1, 261, -1, -1, + -1, 265, 266, -1, -1, -1, 270, -1, 272, 273, + 274, 275, 276, 277, 278, -1, -1, -1, -1, 283, + 284, 285, 286, 287, 288, 289, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 299, -1, -1, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 126, -1, + -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 340, -1, -1, 343, + 344, -1, 346, 347, -1, 349, -1, 351, -1, -1, + -1, 257, 258, 259, -1, 261, -1, -1, -1, 265, + 266, -1, -1, -1, 270, -1, 272, 273, 274, 275, + 276, 277, 278, -1, -1, -1, -1, 283, 284, 285, + 286, 287, 288, 289, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 299, -1, -1, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 126, -1, -1, -1, + -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 340, -1, -1, 343, 344, -1, + 346, 347, -1, 349, -1, 351, -1, -1, -1, 257, + 258, 259, -1, 261, -1, -1, -1, 265, 266, -1, + -1, -1, 270, -1, 272, 273, 274, 275, 276, 277, + 278, -1, -1, -1, -1, 283, 284, 285, 286, 287, + 288, 289, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 299, -1, -1, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 126, -1, -1, -1, -1, 33, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 340, -1, -1, 343, 344, -1, 346, 347, + -1, 349, -1, 351, -1, -1, -1, 257, 258, 259, + -1, 261, -1, -1, -1, 265, 266, -1, -1, -1, + 270, -1, 272, 273, 274, 275, 276, 277, 278, -1, + -1, -1, -1, 283, 284, 285, 286, 287, 288, 289, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 126, -1, -1, -1, -1, 33, -1, -1, + -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, + 340, -1, -1, 343, 344, -1, 346, 347, -1, 349, + -1, 351, -1, -1, -1, 257, 258, 259, -1, 261, + -1, -1, -1, 265, 266, -1, -1, -1, 270, -1, + 272, 273, 274, 275, 276, 277, 278, -1, -1, -1, + -1, 283, 284, 285, 286, 287, 288, 289, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 299, -1, -1, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 126, -1, -1, -1, -1, 33, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 340, -1, + -1, 343, 344, -1, 346, 347, -1, 349, -1, 351, + -1, -1, -1, 257, 258, 259, -1, 261, -1, -1, + -1, 265, 266, -1, -1, -1, 270, -1, 272, 273, + 274, 275, 276, 277, 278, -1, -1, -1, -1, 283, + 284, 285, 286, 287, 288, 289, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 299, -1, -1, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 126, -1, + -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 340, -1, -1, 343, + 344, -1, 346, 347, -1, 349, -1, 351, -1, -1, + -1, 257, 258, 259, -1, 261, -1, -1, -1, 265, + 266, -1, -1, -1, 270, -1, 272, 273, 274, 275, + 276, 277, 278, -1, -1, -1, -1, 283, 284, 285, + 286, 287, 288, 289, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 299, -1, -1, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 126, -1, -1, -1, + -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 340, -1, -1, 343, 344, -1, + 346, 347, -1, -1, -1, 351, -1, -1, -1, 257, + 258, 259, -1, 261, -1, -1, -1, 265, 266, -1, + -1, -1, 270, -1, 272, 273, 274, 275, 276, 277, + 278, -1, -1, -1, -1, 283, 284, 285, 286, 287, + 288, 289, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 299, -1, -1, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 126, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 340, -1, -1, 343, 344, -1, 346, 347, + -1, -1, -1, 351, -1, -1, -1, 257, 258, 259, + -1, 261, -1, -1, -1, 265, 266, -1, -1, -1, + 270, -1, 272, 273, 274, 275, 276, 277, 278, -1, + -1, -1, -1, 283, 284, 285, 286, 287, 288, 289, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 299, + -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 340, -1, -1, 343, 344, -1, 346, 347, -1, -1, + -1, 351, -1, -1, -1, 257, 258, 259, -1, 261, + -1, -1, -1, 265, 266, -1, -1, -1, 270, -1, + 272, 273, 274, 275, 276, 277, 278, -1, -1, -1, + -1, 283, 284, 285, 286, 287, 288, 289, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 299, -1, -1, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + -1, -1, -1, 37, 38, -1, -1, -1, 42, 43, + -1, 45, -1, 47, -1, -1, -1, -1, 340, -1, + -1, 343, 344, -1, 346, 347, 60, -1, 62, 351, + -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, + 94, -1, 96, -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, + 124, -1, 126, -1, -1, -1, -1, -1, 37, 38, + -1, -1, -1, 42, 43, -1, 45, -1, 47, -1, + -1, -1, -1, -1, -1, -1, 257, 258, 259, -1, + 261, 60, -1, 62, 265, 266, -1, -1, -1, 270, + -1, 272, 273, 274, 275, 276, 277, 278, -1, -1, + -1, -1, 283, 284, 285, 286, 287, 288, 289, -1, + -1, -1, -1, -1, -1, 94, -1, 96, 299, -1, + -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, -1, + -1, -1, -1, -1, -1, 124, -1, 126, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 340, + -1, -1, 343, 344, -1, 346, 347, -1, 349, -1, + 351, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 257, 258, 259, 260, 261, 262, 263, + 264, -1, -1, 267, 268, 269, 270, 271, -1, -1, + 274, 275, 276, 277, 278, 279, 280, -1, -1, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, -1, 308, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 320, 321, 322, 323, + 324, 325, -1, 327, 328, -1, -1, 331, -1, -1, + -1, 335, 336, 337, 338, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 349, -1, 351, 257, 258, + 259, 260, 261, 262, 263, 264, -1, -1, 267, 268, + 269, 270, 271, -1, -1, 274, 275, 276, 277, 278, + 279, 280, -1, -1, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, -1, -1, 308, + 37, 38, -1, 40, -1, 42, 43, -1, 45, -1, + 47, 320, 321, 322, 323, 324, 325, -1, 327, 328, + -1, -1, 331, 60, -1, 62, 335, 336, 337, 338, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 349, -1, 351, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 94, -1, 96, + -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, 124, -1, 126, + -1, -1, -1, 37, 38, -1, -1, -1, 42, 43, + -1, 45, -1, 47, -1, -1, -1, -1, -1, -1, + -1, 257, 258, 259, -1, 261, 60, -1, 62, 265, + 266, -1, -1, -1, 270, -1, 272, 273, 274, 275, + 276, 277, 278, -1, -1, -1, -1, 283, 284, 285, + 286, 287, 288, 289, -1, -1, -1, -1, -1, -1, + 94, -1, 96, 299, -1, -1, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, -1, -1, -1, -1, -1, -1, + 124, -1, 126, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 340, -1, -1, 343, 344, -1, + 346, 347, -1, 349, -1, 351, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 257, 258, 259, 260, 261, 262, 263, 264, -1, -1, + 267, 268, 269, 270, 271, -1, -1, 274, 275, 276, + 277, 278, 279, 280, -1, -1, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 320, 321, 322, 323, 324, 325, -1, + 327, 328, -1, -1, 331, -1, -1, -1, 335, 336, + 337, 338, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 349, 257, 258, 259, 260, 261, 262, 263, + 264, -1, -1, 267, 268, 269, 270, 271, -1, -1, + 274, 275, 276, 277, 278, 279, 280, -1, -1, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 320, 321, 322, 323, + 324, 325, -1, 327, 328, -1, -1, 331, -1, -1, + -1, 335, 336, 337, 338, -1, 37, 38, -1, -1, + -1, 42, 43, -1, 45, 349, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, + -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 37, 38, -1, -1, -1, 42, 43, -1, 45, + -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 94, 60, 96, 62, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 37, 38, -1, -1, + -1, 42, 43, -1, 45, -1, 47, -1, -1, -1, + -1, -1, -1, 124, -1, 126, -1, -1, 94, 60, + 96, 62, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 37, 38, -1, -1, -1, 42, 43, -1, 45, + -1, 47, -1, -1, -1, -1, -1, -1, 124, -1, + 126, -1, -1, 94, 60, 96, 62, -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, 124, -1, 126, -1, -1, 94, -1, + 96, -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, 124, -1, + 126, -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, 257, 258, 259, 260, + 261, 262, 263, 264, -1, -1, 267, 268, 269, 270, + 271, -1, -1, 274, 275, 276, 277, 278, 279, 280, + -1, -1, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, -1, -1, 308, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 320, + 321, 322, 323, 324, 325, -1, 327, 328, -1, -1, + 331, -1, -1, -1, 335, 336, 337, 338, 304, 305, + -1, -1, 308, -1, -1, -1, -1, -1, 349, -1, + -1, -1, -1, -1, 320, 321, 322, 323, 324, 325, + -1, 327, 328, -1, -1, 331, -1, -1, -1, 335, + 336, 337, 338, 304, 305, -1, -1, 308, -1, -1, + -1, -1, -1, 349, -1, -1, -1, -1, -1, 320, + 321, 322, 323, 324, 325, -1, 327, 328, -1, -1, + 331, -1, -1, -1, 335, 336, 337, 338, 304, 305, + -1, -1, 308, -1, -1, -1, -1, -1, 349, -1, + -1, -1, -1, -1, 320, 321, 322, 323, 324, 325, + -1, 327, 328, -1, -1, 331, -1, -1, -1, 335, + 336, 337, 338, -1, 37, 38, -1, -1, -1, 42, + 43, -1, 45, 349, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, + 38, -1, -1, -1, 42, 43, -1, 45, -1, 47, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 94, 60, 96, 62, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 37, 38, -1, -1, -1, 42, + 43, -1, 45, -1, 47, -1, -1, -1, -1, -1, + -1, 124, -1, 126, -1, -1, 94, 60, 96, 62, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, + 38, -1, -1, -1, 42, 43, -1, 45, -1, 47, + -1, -1, -1, -1, -1, -1, 124, -1, 126, -1, + -1, 94, 60, 96, 62, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 37, 38, -1, -1, -1, 42, + 43, -1, 45, -1, 47, -1, -1, -1, -1, -1, + -1, 124, -1, 126, -1, -1, 94, 60, 96, 62, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, + 38, -1, -1, -1, 42, 43, -1, 45, -1, 47, + -1, -1, -1, -1, -1, -1, 124, -1, 126, -1, + -1, 94, 60, 96, 62, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 37, 38, -1, -1, -1, 42, 43, -1, + 45, 124, 47, 126, -1, -1, 94, -1, 96, -1, + -1, -1, -1, -1, -1, 60, -1, 62, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 124, -1, 126, -1, + -1, 304, 305, -1, -1, 308, -1, -1, -1, 94, + -1, 96, -1, -1, -1, -1, -1, 320, 321, 322, + 323, 324, 325, -1, 327, 328, -1, -1, 331, -1, + -1, -1, 335, 336, 337, 338, 304, 305, -1, 124, + 308, 126, -1, -1, -1, -1, 349, -1, -1, -1, + -1, -1, 320, 321, 322, 323, 324, 325, -1, 327, + 328, -1, -1, 331, -1, -1, -1, 335, 336, 337, + 338, 304, 305, -1, -1, 308, -1, -1, -1, -1, + -1, 349, -1, -1, -1, -1, -1, 320, 321, 322, + 323, 324, 325, -1, 327, 328, -1, -1, 331, -1, + -1, -1, 335, 336, 337, 338, 304, 305, -1, -1, + 308, -1, -1, -1, -1, -1, 349, -1, -1, -1, + -1, -1, 320, 321, 322, 323, 324, 325, -1, 327, + 328, -1, -1, 331, -1, -1, -1, 335, 336, 337, + 338, 304, 305, -1, -1, 308, -1, -1, -1, -1, + -1, 349, -1, -1, -1, -1, -1, 320, 321, 322, + 323, 324, 325, -1, 327, 328, -1, -1, 331, -1, + -1, -1, 335, 336, 337, 338, 304, 305, -1, -1, + 308, -1, -1, -1, -1, -1, 349, -1, -1, -1, + -1, -1, 320, 321, 322, 323, 324, 325, -1, 327, + 328, -1, -1, 331, -1, -1, -1, 335, 336, 337, + 338, -1, -1, -1, -1, -1, -1, -1, -1, 304, + 305, 349, -1, 308, 37, 38, -1, -1, -1, 42, + 43, -1, 45, 124, 47, 320, 321, 322, 323, 324, + 325, -1, 327, 328, -1, -1, 331, 60, -1, 62, + 335, 336, 337, 338, -1, -1, -1, -1, -1, -1, + -1, 37, 38, -1, 349, -1, 42, 43, -1, 45, + -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 94, -1, 96, 60, -1, 62, 63, -1, 37, + 38, -1, -1, -1, 42, 43, -1, 45, -1, 47, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 58, 124, 60, 126, 62, 63, 37, 38, 94, -1, + -1, 42, 43, -1, 45, -1, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, + -1, 62, 63, -1, -1, -1, 94, -1, 124, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 257, 258, 259, -1, + 261, -1, -1, 94, 265, 266, 124, -1, -1, 270, + -1, 272, 273, 274, 275, 276, 277, 278, -1, -1, + -1, -1, 283, 284, 285, 286, 287, 288, 289, -1, + -1, -1, -1, 124, -1, -1, -1, -1, 299, -1, + -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 340, + -1, -1, 343, 344, -1, 346, 347, -1, 349, -1, + 351, -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, 304, 305, -1, -1, 308, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 320, 321, 322, + 323, 324, 325, -1, 327, 328, -1, -1, 331, -1, + -1, -1, 335, 336, 337, 338, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 349, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, 333, 334, -1, + -1, 337, 338, -1, -1, -1, 342, -1, -1, -1, + -1, -1, -1, -1, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, -1, -1, 337, + 338, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, -1, -1, 337, 338, 257, 258, + 259, -1, 261, -1, -1, -1, 265, 266, -1, -1, + -1, 270, -1, 272, 273, 274, 275, 276, 277, 278, + -1, -1, -1, -1, 283, 284, 285, 286, 287, 288, + 289, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 340, -1, -1, 343, 344, -1, 346, 347, -1, + -1, -1, 351, + }; + } +} diff --git a/org/jruby/util/.nbattrs b/org/jruby/util/.nbattrs new file mode 100644 index 00000000000..e68532fb4df --- /dev/null +++ b/org/jruby/util/.nbattrs @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org/jruby/util/RubyHashMap.java b/org/jruby/util/RubyHashMap.java new file mode 100644 index 00000000000..aeff0f266bb --- /dev/null +++ b/org/jruby/util/RubyHashMap.java @@ -0,0 +1,74 @@ +/* + * RubyHashMap.java - No description + * Created on 10. September 2001, 17:51 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.util; + +import java.util.*; + +import org.jruby.original.*; + +/** + * + * @author jpetersen + */ +public class RubyHashMap extends HashMap implements RubyMap, st_table { + public RubyHashMap() { + super(); + } + + public RubyHashMap(int initialCapacity) { + super(initialCapacity); + } + + public RubyHashMap(int initialCapacity, float loadFactor) { + super(initialCapacity, loadFactor); + } + + public RubyHashMap(Map t) { + super(t); + } + + public void foreach(RubyMapMethod method, Object arg) { + Iterator iter = entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry)iter.next(); + int ret = method.execute(entry.getKey(), entry.getValue(), arg); + switch (ret) { + case RubyMapMethod.CONTINUE: + continue; + case RubyMapMethod.STOP: + return; + case RubyMapMethod.DELETE: + iter.remove(); + } + } + } + + public RubyMap cloneRubyMap() { + return (RubyMap)clone(); + } + +} \ No newline at end of file diff --git a/org/jruby/util/RubyMap.java b/org/jruby/util/RubyMap.java new file mode 100644 index 00000000000..b9ac126fb80 --- /dev/null +++ b/org/jruby/util/RubyMap.java @@ -0,0 +1,39 @@ +/* + * RubyMap.java - No description + * Created on 10. September 2001, 17:51 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.util; + +import java.util.*; + +/** + * + * @author jpetersen + */ +public interface RubyMap extends Map { + public void foreach(RubyMapMethod method, Object arg); + + public RubyMap cloneRubyMap(); +} \ No newline at end of file diff --git a/org/jruby/util/RubyMapMethod.java b/org/jruby/util/RubyMapMethod.java new file mode 100644 index 00000000000..42cc2342eec --- /dev/null +++ b/org/jruby/util/RubyMapMethod.java @@ -0,0 +1,39 @@ +/* + * RubyMapMethod.java - No description + * Created on 10. September 2001, 17:51 + * + * Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust + * Jan Arne Petersen + * Stefan Matthias Aust + * + * JRuby - http://jruby.sourceforge.net + * + * 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 2 + * of the License, or 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package org.jruby.util; + +/** + * + * @author jpetersen + */ +public interface RubyMapMethod { + public static final int CONTINUE = 0; + public static final int STOP = 1; + public static final int DELETE = 2; + + public int execute(Object key, Object value, Object arg); +} \ No newline at end of file diff --git a/test.rb b/test.rb new file mode 100644 index 00000000000..8b93e271561 --- /dev/null +++ b/test.rb @@ -0,0 +1,92 @@ +# +# Ruby.java - No description +# Created on 04. Juli 2001, 22:53 +# +# Copyright (C) 2001 Jan Arne Petersen, Stefan Matthias Aust +# Jan Arne Petersen +# Stefan Matthias Aust +# +# JRuby - http://jruby.sourceforge.net +# +# 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 2 +# of the License, or 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +# test variables and method calls + +a = String.new("Hello World") +b = a.reverse +c = " " +d = "Hello".reverse +e = a[6, 5].reverse + +f = 100 + 35 +g = 2 * 10 +h = 13 % 5 + +puts(a) +puts b +puts d.reverse, c, e.reverse + +puts f, " ", g, " ", h + +# test ifs + +if (true) + puts "True" +end + +if (FALSE | true) + puts "False" +end + +# test loops + +i = 0 +j = 0 +while (i < 10) + break if (i == 6) + + j = j + 1 + puts i + + redo if (j < 2) + + j = 0 + i = i + 1 +end + +# test methods + +def testMethod + puts "method tested." +end + +testMethod + +# test classes + +class Hello + def sayHelloWorld + puts "Hello World." + end +end + +hello = Hello.new +hello.sayHelloWorld + +# number test + +# puts 25.eql? 25 +# puts 20 === 20 \ No newline at end of file