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

📄 javaccglobals.java

📁 java 编译器java复杂编译器,可以编译java文件的类库
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Copyright © 2002 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * California 95054, U.S.A. All rights reserved.  Sun Microsystems, Inc. has * intellectual property rights relating to technology embodied in the product * that is described in this document. In particular, and without limitation, * these intellectual property rights may include one or more of the U.S. * patents listed at http://www.sun.com/patents and one or more additional * patents or pending patent applications in the U.S. and in other countries. * U.S. Government Rights - Commercial software. Government users are subject * to the Sun Microsystems, Inc. standard license agreement and applicable * provisions of the FAR and its supplements.  Use is subject to license terms. * Sun,  Sun Microsystems,  the Sun logo and  Java are trademarks or registered * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  This * product is covered and controlled by U.S. Export Control laws and may be * subject to the export or import laws in other countries.  Nuclear, missile, * chemical biological weapons or nuclear maritime end uses or end users, * whether direct or indirect, are strictly prohibited.  Export or reexport * to countries subject to U.S. embargo or to entities identified on U.S. * export exclusion lists, including, but not limited to, the denied persons * and specially designated nationals lists is strictly prohibited. */package org.javacc.parser;import java.util.Vector;import java.io.*;import org.javacc.Version;/** * This package contains data created as a result of parsing and semanticizing * a JavaCC input file.  This data is what is used by the back-ends of JavaCC as * well as any other back-end of JavaCC related tools such as JJTree. */public class JavaCCGlobals {  /**   * String that identifies the JavaCC generated files.   */  protected static final String toolName = "JavaCC";  /**   * The name of the grammar file being processed.   */  static public String fileName;  /**   * The name of the original file (before processing by JJTree and JJCov).   * Currently this is the same as fileName.   */  static public String origFileName;  /**   * The File object for the output directory where all the generated files will   * be placed. It defaults to the current directory, but may be set by the   * user using the OUTPUT_DIRECTORY option.   */  static public File outputDir = new File(System.getProperty("user.dir"));  static private String outputDirName = null;  static private Object outputDirNameLoc = null;  /**   * Set to true if this file has been processed by JJTree.   */  static public boolean jjtreeGenerated;  /**   * Set to true if this file has been processed by JJCov.   */  static public boolean jjcovGenerated;  /**   * The list of tools that have participated in generating the   * input grammar file.   */  static public Vector toolNames;  /**   * This prints the banner line when the various tools are invoked.  This   * takes as argument the tool's full name and its version.   */  static public void bannerLine(String fullName, String ver) {    System.out.print("Java Compiler Compiler Version " + Version.version + " (" + fullName);    if (!ver.equals("")) {      System.out.print(" Version " + ver);    }    System.out.println(")");    //System.out.println("Copyright © 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.");  }  /**   * The name of the parser class (what appears in PARSER_BEGIN and PARSER_END).   */  static public String cu_name;  /**   * This is a list of tokens that appear after "PARSER_BEGIN(name)" all the   * way until (but not including) the opening brace "{" of the class "name".   */  static public java.util.Vector cu_to_insertion_point_1 = new java.util.Vector();  /**   * This is the list of all tokens that appear after the tokens in   * "cu_to_insertion_point_1" and until (but not including) the closing brace "}"   * of the class "name".   */  static public java.util.Vector cu_to_insertion_point_2 = new java.util.Vector();  /**   * This is the list of all tokens that appear after the tokens in   * "cu_to_insertion_point_2" and until "PARSER_END(name)".   */  static public java.util.Vector cu_from_insertion_point_2 = new java.util.Vector();  /**   * A list of all grammar productions - normal and JAVACODE - in the order   * they appear in the input file.  Each entry here will be a subclass of   * "NormalProduction".   */  static public java.util.Vector bnfproductions = new java.util.Vector();  /**   * A symbol table of all grammar productions - normal and JAVACODE.  The   * symbol table is indexed by the name of the left hand side non-terminal.   * Its contents are of type "NormalProduction".   */  static public java.util.Hashtable production_table = new java.util.Hashtable();  /**   * A mapping of lexical state strings to their integer internal representation.   * Integers are stored as java.lang.Integer's.   */  static public java.util.Hashtable lexstate_S2I = new java.util.Hashtable();  /**   * A mapping of the internal integer representations of lexical states to   * their strings.  Integers are stored as java.lang.Integer's.   */  static public java.util.Hashtable lexstate_I2S = new java.util.Hashtable();  /**   * The declarations to be inserted into the TokenManager class.   */  static public java.util.Vector token_mgr_decls;  /**   * The list of all TokenProductions from the input file.  This list includes   * implicit TokenProductions that are created for uses of regular expressions   * within BNF productions.   */  static public java.util.Vector rexprlist = new java.util.Vector();  /**   * The total number of distinct tokens.  This is therefore one more than the   * largest assigned token ordinal.   */  static public int tokenCount;  /**   * This is a symbol table that contains all named tokens (those that are   * defined with a label).  The index to the table is the image of the label   * and the contents of the table are of type "RegularExpression".   */  static public java.util.Hashtable named_tokens_table = new java.util.Hashtable();  /**   * Contains the same entries as "named_tokens_table", but this is an ordered   * list which is ordered by the order of appearance in the input file.   */  static public java.util.Vector ordered_named_tokens = new java.util.Vector();  /**   * A mapping of ordinal values (represented as objects of type "Integer") to   * the corresponding labels (of type "String").  An entry exists for an ordinal   * value only if there is a labeled token corresponding to this entry.   * If there are multiple labels representing the same ordinal value, then   * only one label is stored.   */  static public java.util.Hashtable names_of_tokens = new java.util.Hashtable();  /**   * A mapping of ordinal values (represented as objects of type "Integer") to   * the corresponding RegularExpression's.   */  static public java.util.Hashtable rexps_of_tokens = new java.util.Hashtable();  /**   * This is a three-level symbol table that contains all simple tokens (those   * that are defined using a single string (with or without a label).  The index   * to the first level table is a lexical state which maps to a second level   * hashtable.  The index to the second level hashtable is the string of the   * simple token converted to upper case, and this maps to a third level hashtable.   * This third level hashtable contains the actual string of the simple token   * and maps it to its RegularExpression.   */  static public java.util.Hashtable simple_tokens_table = new java.util.Hashtable();  /**   * maskindex, jj2index, maskVals are variables that are shared between   * ParseEngine and ParseGen.   */  static protected int maskindex = 0;  static protected int jj2index = 0;  static protected Vector maskVals = new Vector();  static Action actForEof;  static String nextStateForEof;  // Some general purpose utilities follow.  /**   * Returns the identifying string for the file name, given a toolname   * used to generate it.   */  public static String getIdString(String toolName, String fileName) {     Vector toolNames = new Vector();     toolNames.addElement(toolName);     return getIdString(toolNames, fileName);  }  /**   * Returns the identifying string for the file name, given a set of tool   * names that are used to generate it.   */  public static String getIdString(Vector toolNames, String fileName) {     int i;     String toolNamePrefix = "Generated By:";     for (i = 0; i < toolNames.size() - 1; i++)        toolNamePrefix += (String)toolNames.elementAt(i) + "&";     toolNamePrefix += (String)toolNames.elementAt(i) + ":";     if (toolNamePrefix.length() > 200)     {        System.out.println("Tool names too long.");        throw new Error();     }     return toolNamePrefix + " Do not edit this line. " + fileName;  }  /**   * Returns true if tool name passed is one of the tool names returned   * by getToolNames(fileName).   */  public static boolean isGeneratedBy(String toolName, String fileName) {     Vector v = getToolNames(fileName);     for (int i = 0; i < v.size(); i++)        if (toolName.equals((String)v.elementAt(i)))           return true;     return false;  }  private static Vector makeToolNameVector(String str) {     Vector retVal = new Vector();     int limit1 = str.indexOf('\n');     if (limit1 == -1) limit1 = 1000;     int limit2 = str.indexOf('\r');     if (limit2 == -1) limit2 = 1000;     int limit = (limit1 < limit2) ? limit1 : limit2;     String tmp;     if (limit == 1000) {       tmp = str;     } else {       tmp = str.substring(0, limit);     }     if (tmp.indexOf(':') == -1)        return retVal;     tmp = tmp.substring(tmp.indexOf(':') + 1);     if (tmp.indexOf(':') == -1)        return retVal;     tmp = tmp.substring(0, tmp.indexOf(':'));     int i = 0, j = 0;     while (j < tmp.length() && (i = tmp.indexOf('&', j)) != -1)     {        retVal.addElement(tmp.substring(j, i));        j = i + 1;     }     if (j < tmp.length())        retVal.addElement(tmp.substring(j));     return retVal;

⌨️ 快捷键说明

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