⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 types.java

📁 大名鼎鼎的java动态脚本语言。已经通过了sun的认证
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/* $Id: Types.java,v 1.11 2005/04/12 15:04:59 jstrachan Exp $ Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved. Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain copyright    statements and notices.  Redistributions must also contain a    copy of this document. 2. Redistributions in binary form must reproduce the    above copyright notice, this list of conditions and the    following disclaimer in the documentation and/or other    materials provided with the distribution. 3. The name "groovy" must not be used to endorse or promote    products derived from this Software without prior written    permission of The Codehaus.  For written permission,    please contact info@codehaus.org. 4. Products derived from this Software may not be called "groovy"    nor may "groovy" appear in their names without prior written    permission of The Codehaus. "groovy" is a registered    trademark of The Codehaus. 5. Due credit should be given to The Codehaus -    http://groovy.codehaus.org/ THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */package org.codehaus.groovy.syntax;import java.util.HashMap;import java.util.Iterator;import java.util.Map;import org.codehaus.groovy.GroovyBugError;/** *  Typing information for the CST system.  The types here are those *  used by CSTNode, Token, and Reduction. * *  @author <a href="mailto:bob@werken.com">bob mcwhirter</a> *  @author <a href="mailto:cpoirier@dreaming.org">Chris Poirier</a> * *  @version $Id: Types.java,v 1.11 2005/04/12 15:04:59 jstrachan Exp $ */public class Types{  //---------------------------------------------------------------------------  // TYPES: NOTE THAT ORDERING AND VALUES ARE IMPORTANT TO LOCAL ROUTINES!    //    // SPECIAL TOKENS    public static final int EOF                         = -1;    // end of file    public static final int UNKNOWN                     = 0;     // the unknown token    //    // RELEVANT WHITESPACE    public static final int NEWLINE                     = 5;     // \n    //    // OPERATORS AND OTHER MARKERS    public static final int LEFT_CURLY_BRACE            = 10;    // {    public static final int RIGHT_CURLY_BRACE           = 20;    // }    public static final int LEFT_SQUARE_BRACKET         = 30;    // [    public static final int RIGHT_SQUARE_BRACKET        = 40;    // ]    public static final int LEFT_PARENTHESIS            = 50;    // (    public static final int RIGHT_PARENTHESIS           = 60;    // )    public static final int DOT                         = 70;    // .    public static final int DOT_DOT                     = 75;    // ..    public static final int DOT_DOT_DOT                 = 77;    // ...    public static final int NAVIGATE                    = 80;    // ->    public static final int FIND_REGEX                  = 90;    // =~    public static final int MATCH_REGEX                 = 94;    // ==~    public static final int REGEX_PATTERN               = 97;    // ~    public static final int EQUAL                       = 100;   // =    public static final int EQUALS                      = EQUAL;    public static final int ASSIGN                      = EQUAL;    public static final int COMPARE_NOT_EQUAL           = 120;   // !=    public static final int COMPARE_IDENTICAL           = 121;   // ===    public static final int COMPARE_NOT_IDENTICAL       = 122;   // !==    public static final int COMPARE_EQUAL               = 123;   // ==    public static final int COMPARE_LESS_THAN           = 124;   // <    public static final int COMPARE_LESS_THAN_EQUAL     = 125;   // <=    public static final int COMPARE_GREATER_THAN        = 126;   // >    public static final int COMPARE_GREATER_THAN_EQUAL  = 127;   // >=    public static final int COMPARE_TO                  = 128;   // <=>    public static final int NOT                         = 160;   // !    public static final int LOGICAL_OR                  = 162;   // ||    public static final int LOGICAL_AND                 = 164;   // &&    public static final int LOGICAL_OR_EQUAL            = 166;   // ||=    public static final int LOGICAL_AND_EQUAL           = 168;   // &&=    public static final int PLUS                        = 200;   // +    public static final int MINUS                       = 201;   // -    public static final int MULTIPLY                    = 202;   // *    public static final int DIVIDE                      = 203;   // /    public static final int INTDIV                      = 204;   // \    public static final int MOD                         = 205;   // %    public static final int STAR_STAR                   = 206;   // **    public static final int POWER                       = STAR_STAR;   // **    public static final int PLUS_EQUAL                  = 210;   // +=    public static final int MINUS_EQUAL                 = 211;   // -=    public static final int MULTIPLY_EQUAL              = 212;   // *=    public static final int DIVIDE_EQUAL                = 213;   // /=    public static final int INTDIV_EQUAL                = 214;   // \=    public static final int MOD_EQUAL                   = 215;   // %=    public static final int POWER_EQUAL                 = 216;   // **=    public static final int PLUS_PLUS                   = 250;   // ++    public static final int PREFIX_PLUS_PLUS            = 251;   // ++    public static final int POSTFIX_PLUS_PLUS           = 252;   // ++    public static final int PREFIX_PLUS                 = 253;   // +    public static final int MINUS_MINUS                 = 260;   // --    public static final int PREFIX_MINUS_MINUS          = 261;   // --    public static final int POSTFIX_MINUS_MINUS         = 262;   // --    public static final int PREFIX_MINUS                = 263;   // - (negation)    public static final int LEFT_SHIFT                  = 280;   // <<    public static final int RIGHT_SHIFT                 = 281;   // >>    public static final int RIGHT_SHIFT_UNSIGNED        = 282;   // >>>    public static final int LEFT_SHIFT_EQUAL            = 285;   // <<=    public static final int RIGHT_SHIFT_EQUAL           = 286;   // >>=    public static final int RIGHT_SHIFT_UNSIGNED_EQUAL  = 287;   // >>>=    public static final int STAR                        = MULTIPLY;    public static final int COMMA                       = 300;   // -    public static final int COLON                       = 310;   // :    public static final int SEMICOLON                   = 320;   // ;    public static final int QUESTION                    = 330;   // ?    // TODO refactor PIPE to be BITWISE_OR    public static final int PIPE                        = 340;   // |    public static final int DOUBLE_PIPE                 = LOGICAL_OR;   // ||    public static final int BITWISE_OR                  = PIPE;  // |    public static final int BITWISE_AND                 = 341;   // &    public static final int BITWISE_XOR                 = 342;   // ^    public static final int BITWISE_OR_EQUAL            = 350;   // |=    public static final int BITWISE_AND_EQUAL           = 351;   // &=    public static final int BITWISE_XOR_EQUAL           = 352;   // ^=    public static final int BITWISE_NEGATION            = REGEX_PATTERN;    // ~    //    // LITERALS    public static final int STRING                      = 400;   // any bare string data    public static final int IDENTIFIER                  = 440;   // anything text and not a keyword    public static final int INTEGER_NUMBER              = 450;   // integer    public static final int DECIMAL_NUMBER              = 451;   // decimal    //    // KEYWORDS: (PRIMARILY) CLASS/METHOD DECLARATION MODIFIERS    public static final int KEYWORD_PRIVATE             = 500;   // declaration visibility    public static final int KEYWORD_PROTECTED           = 501;   // declaration visibility    public static final int KEYWORD_PUBLIC              = 502;   // declaration visibility    public static final int KEYWORD_ABSTRACT            = 510;   // method body missing    public static final int KEYWORD_FINAL               = 511;   // declaration cannot be overridden    public static final int KEYWORD_NATIVE              = 512;   // a native code entry point    public static final int KEYWORD_TRANSIENT           = 513;   // property should not be persisted    public static final int KEYWORD_VOLATILE            = 514;   // compiler should never cache property    public static final int KEYWORD_SYNCHRONIZED        = 520;   // modifier and block type    public static final int KEYWORD_STATIC              = 521;   // modifier and block type    //    // KEYWORDS: TYPE SYSTEM    public static final int KEYWORD_DEF                 = 530;   // identifies a function declaration    public static final int KEYWORD_DEFMACRO            = 539;   // XXX br identifies a macro declaration    public static final int KEYWORD_CLASS               = 531;   // identifies a class declaration    public static final int KEYWORD_INTERFACE           = 532;   // identifies an interface declaration    public static final int KEYWORD_MIXIN               = 533;   // identifies a mixin declaration    public static final int KEYWORD_IMPLEMENTS          = 540;   // specifies the interfaces implemented by a class    public static final int KEYWORD_EXTENDS             = 541;   // specifies the base class/interface for a new one    public static final int KEYWORD_THIS                = 542;   // method variable points to the current instance    public static final int KEYWORD_SUPER               = 543;   // method variable points to the base instance    public static final int KEYWORD_INSTANCEOF          = 544;   // type comparator    public static final int KEYWORD_PROPERTY            = 545;   // deprecated; identifies a property    public static final int KEYWORD_NEW                 = 546;   // used to create a new instance of a class    public static final int KEYWORD_PACKAGE             = 550;   // declares the package scope    public static final int KEYWORD_IMPORT              = 551;   // declares an external class    public static final int KEYWORD_AS                  = 552;   // used in import statements to create an alias    //    // KEYWORDS: CONTROL STRUCTURES    public static final int KEYWORD_RETURN              = 560;   // returns from a closure or method    public static final int KEYWORD_IF                  = 561;   // if    public static final int KEYWORD_ELSE                = 562;   // else    public static final int KEYWORD_DO                  = 570;   // do loop    public static final int KEYWORD_WHILE               = 571;   // while loop    public static final int KEYWORD_FOR                 = 572;   // for loop    public static final int KEYWORD_IN                  = 573;   // for (each) loop separator    public static final int KEYWORD_BREAK               = 574;   // exits a loop or block    public static final int KEYWORD_CONTINUE            = 575;   // restarts a loop on the next iteration    public static final int KEYWORD_SWITCH              = 576;   // switch block    public static final int KEYWORD_CASE                = 577;   // item in a switch block    public static final int KEYWORD_DEFAULT             = 578;   // catch-all item in a switch block    public static final int KEYWORD_TRY                 = 580;   // block to monitor for exceptions    public static final int KEYWORD_CATCH               = 581;   // catch block for a particular exception    public static final int KEYWORD_FINALLY             = 582;   // block to always execute on exit of the try    public static final int KEYWORD_THROW               = 583;   // statement to throw an exception    public static final int KEYWORD_THROWS              = 584;   // method modifier to declare thrown transactions    public static final int KEYWORD_ASSERT              = 585;   // alternate throw for code invariants    //    // KEYWORDS: PRIMITIVE TYPES    public static final int KEYWORD_VOID                = 600;   // void    public static final int KEYWORD_BOOLEAN             = 601;   // boolean    public static final int KEYWORD_BYTE                = 602;   // 1 byte integer    public static final int KEYWORD_SHORT               = 603;   // 2 byte integer    public static final int KEYWORD_INT                 = 604;   // 4 byte integer    public static final int KEYWORD_LONG                = 605;   // 8 byte integer    public static final int KEYWORD_FLOAT               = 606;   // 32 bit floating point number    public static final int KEYWORD_DOUBLE              = 607;   // 64 bit floating point number    public static final int KEYWORD_CHAR                = 608;   // unicode character code    //    // KEYWORDS: SPECIAL VALUES    public static final int KEYWORD_TRUE                = 610;   // boolean truth    public static final int KEYWORD_FALSE               = 611;   // boolean false    public static final int KEYWORD_NULL                = 612;   // missing instance    //    // KEYWORDS: RESERVED    public static final int KEYWORD_CONST               = 700;   // reserved in java and groovy    public static final int KEYWORD_GOTO                = 701;   // reserved in java and groovy    //    // SPECIAL (CALCULATED) MEANINGS    public static final int SYNTH_COMPILATION_UNIT      = 800;   // reserved: a synthetic root for a CST    public static final int SYNTH_CLASS                 = 801;   // applied to class names    public static final int SYNTH_INTERFACE             = 802;   // applied to interface names    public static final int SYNTH_MIXIN                 = 803;   // applied to mixin names    public static final int SYNTH_METHOD                = 804;   // applied to method names    public static final int SYNTH_PROPERTY              = 805;   // applied to property names    public static final int SYNTH_PARAMETER_DECLARATION = 806;   // applied to method/closure parameter names    public static final int SYNTH_LIST                  = 810;   // applied to "[" that marks a list    public static final int SYNTH_MAP                   = 811;   // applied to "[" that marks a map    public static final int SYNTH_GSTRING               = 812;   // a complete GString    public static final int SYNTH_METHOD_CALL           = 814;   // applied to the optional "(" that marks a call to a method    public static final int SYNTH_CAST                  = 815;   // applied to "(" that marks a type cast    public static final int SYNTH_BLOCK                 = 816;   // applied to "{" that marks a block    public static final int SYNTH_CLOSURE               = 817;   // applied to "{" that marks a closure    public static final int SYNTH_LABEL                 = 818;   // applied to a statement label    public static final int SYNTH_TERNARY               = 819;   // applied to "?" that marks a ternary expression    public static final int SYNTH_TUPLE                 = 820;   // applied to "{" that marks an array initializer    public static final int SYNTH_VARIABLE_DECLARATION  = 830;   // applied to an identifier that specifies                                                                 // the type of a variable declaration    //    // GSTRING TOKENS    public static final int GSTRING_START               = 901;   // any marker tha begins a GString    public static final int GSTRING_END                 = 902;   // any matching marker that ends a GString    public static final int GSTRING_EXPRESSION_START    = 903;   // the ${ marker that starts a GString expression    public static final int GSTRING_EXPRESSION_END      = 904;   // the } marker that ends a GString expresssion    //    // TYPE CLASSES    public static final int ANY                         = 1000;  // anything    public static final int NOT_EOF                     = 1001;  // anything but EOF    public static final int GENERAL_END_OF_STATEMENT    = 1002;  // ";", "\n", EOF    public static final int ANY_END_OF_STATEMENT        = 1003;  // ";", "\n", EOF, "}"    public static final int ASSIGNMENT_OPERATOR         = 1100;  // =, +=, etc.    public static final int COMPARISON_OPERATOR         = 1101;  // ==, ===, >, <, etc.    public static final int MATH_OPERATOR               = 1102;  // +, -, / *, %, plus the LOGICAL_OPERATORS    public static final int LOGICAL_OPERATOR            = 1103;  // ||, &&, !    public static final int RANGE_OPERATOR              = 1104;  // .., ...    public static final int REGEX_COMPARISON_OPERATOR   = 1105;  // =~, etc.    public static final int DEREFERENCE_OPERATOR        = 1106;  // ., ->    public static final int BITWISE_OPERATOR            = 1107;  // |, &, <<, >>, >>>, ^, ~    public static final int PREFIX_OPERATOR             = 1200;  // ++, !, etc.    public static final int POSTFIX_OPERATOR            = 1210;  // ++, etc.    public static final int INFIX_OPERATOR              = 1220;  // +, -, =, etc.    public static final int PREFIX_OR_INFIX_OPERATOR    = 1230;  // +, -    public static final int PURE_PREFIX_OPERATOR        = 1235;  // prefix +, prefix -    public static final int KEYWORD                     = 1300;  // any keyword    public static final int SYMBOL                      = 1301;  // any symbol    public static final int LITERAL                     = 1310;  // strings, numbers, identifiers    public static final int NUMBER                      = 1320;  // integers and decimals    public static final int SIGN                        = 1325;  // "+", "-"    public static final int NAMED_VALUE                 = 1330;  // true, false, null    public static final int TRUTH_VALUE                 = 1331;  // true, false    public static final int PRIMITIVE_TYPE              = 1340;  // void, byte, short, int, etc.    public static final int CREATABLE_PRIMITIVE_TYPE    = 1341;  // any PRIMITIVE_TYPE except void    public static final int LOOP                        = 1350;  // do, while, etc.    public static final int RESERVED_KEYWORD            = 1360;  // const, goto, etc.    public static final int KEYWORD_IDENTIFIER          = 1361;  // keywords that can appear as identifiers    public static final int SYNTHETIC                   = 1370;  // any of the SYNTH types    public static final int TYPE_DECLARATION            = 1400;  // class, interface, mixin    public static final int DECLARATION_MODIFIER        = 1410;  // public, private, abstract, etc.    public static final int TYPE_NAME                   = 1420;  // identifiers, primitive types    public static final int CREATABLE_TYPE_NAME         = 1430;  // identifiers, primitive types except void    public static final int MATCHED_CONTAINER           = 1500;  // (, ), [, ], {, }    public static final int LEFT_OF_MATCHED_CONTAINER   = 1501;  // (, [, {    public static final int RIGHT_OF_MATCHED_CONTAINER  = 1502;  // ), ], }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -