• 大小: 62KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-12
  • 语言: Java
  • 标签: javacc  编译原理  

资源简介

通过javacc来设计一个小型编译器,思路清晰,功能完善

资源截图

代码片段和文件信息

/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 4.1 */
/* JavaCCOptions:KEEP_LINE_COL=null */
package hao.pakg;

/**
 * This exception is thrown when parse errors are encountered.
 * You can explicitly create objects of this exception type by
 * calling the method generateParseException in the generated
 * parser.
 *
 * You can modify this class to customize your error reporting
 * mechanisms so long as you retain the public fields.
 */
public class ParseException extends Exception {

  /**
   * This constructor is used by the method “generateParseException“
   * in the generated parser.  Calling this constructor generates
   * a new object of this type with the fields “currentToken“
   * “expectedTokenSequences“ and “tokenImage“ set.  The boolean
   * flag “specialConstructor“ is also set to true to indicate that
   * this constructor was used to create this object.
   * This constructor calls its super class with the empty string
   * to force the “toString“ method of parent class “Throwable“ to
   * print the error message in the form:
   *     ParseException: 
   */
  public ParseException(Token currentTokenVal
                        int[][] expectedTokenSequencesVal
                        String[] tokenImageVal
                       )
  {
    super(““);
    specialConstructor = true;
    currentToken = currentTokenVal;
    expectedTokenSequences = expectedTokenSequencesVal;
    tokenImage = tokenImageVal;
  }

  /**
   * The following constructors are for use by you for whatever
   * purpose you can think of.  Constructing the exception in this
   * manner makes the exception behave in the normal way - i.e. as
   * documented in the class “Throwable“.  The fields “errorToken“
   * “expectedTokenSequences“ and “tokenImage“ do not contain
   * relevant information.  The JavaCC generated code does not use
   * these constructors.
   */

  public ParseException() {
    super();
    specialConstructor = false;
  }

  /** Constructor with message. */
  public ParseException(String message) {
    super(message);
    specialConstructor = false;
  }

  /**
   * This variable determines which constructor was used to create
   * this object and thereby affects the semantics of the
   * “getMessage“ method (see below).
   */
  protected boolean specialConstructor;

  /**
   * This is the last token that has been consumed successfully.  If
   * this object has been created due to a parse error the token
   * followng this token will (therefore) be the first error token.
   */
  public Token currentToken;

  /**
   * Each entry in this array is an array of integers.  Each array
   * of integers represents a sequence of tokens (by their ordinal
   * values) that is expected at this point of the parse.
   */
  public int[][] expectedTokenSequences;

  /**
   * This is a reference to the “tokenImage“ array of the gener

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-01-20 21:47  代码\
     目录           0  2013-01-20 21:47  代码\complier\
     文件        1969  2013-01-18 14:18  代码\complier\.classpath
     文件         567  2013-01-18 08:35  代码\complier\.project
     目录           0  2013-01-20 21:47  代码\complier\.settings\
     文件         629  2013-01-18 08:35  代码\complier\.settings\org.eclipse.jdt.core.prefs
     文件         220  2013-01-18 08:35  代码\complier\.settings\sf.eclipse.javacc.prefs
     目录           0  2013-01-20 21:47  代码\complier\bin\
     目录           0  2013-01-20 21:47  代码\complier\bin\hao\
     目录           0  2013-01-20 21:47  代码\complier\bin\hao\pakg\
     文件       11192  2013-01-18 08:35  代码\complier\bin\hao\pakg\new_file.jj
     文件        3572  2013-01-18 14:27  代码\complier\bin\hao\pakg\ParseException.class
     文件       15457  2013-01-18 14:28  代码\complier\bin\hao\pakg\Parser.class
     文件        3762  2013-01-18 14:27  代码\complier\bin\hao\pakg\ParserConstants.class
     文件       15476  2013-01-18 14:27  代码\complier\bin\hao\pakg\ParserTokenManager.class
     文件        8107  2013-01-18 14:27  代码\complier\bin\hao\pakg\SimpleCharStream.class
     文件        1097  2013-01-18 14:27  代码\complier\bin\hao\pakg\Token.class
     文件        2775  2013-01-18 14:27  代码\complier\bin\hao\pakg\TokenMgrError.class
     文件         901  2013-01-18 14:27  代码\complier\bin\hao\pakg\Windows$1.class
     文件        1651  2013-01-18 14:27  代码\complier\bin\hao\pakg\Windows$2.class
     文件        3598  2013-01-18 14:27  代码\complier\bin\hao\pakg\Windows.class
     文件         740  2013-01-18 09:53  代码\complier\for_test(郝宁).txt
     目录           0  2013-01-20 21:47  代码\complier\src\
     目录           0  2013-01-20 21:47  代码\complier\src\hao\
     目录           0  2013-01-20 21:47  代码\complier\src\hao\pakg\
     文件       11192  2013-01-18 08:35  代码\complier\src\hao\pakg\new_file.jj
     文件        6864  2013-01-18 14:27  代码\complier\src\hao\pakg\ParseException.java
     文件       24486  2013-01-18 14:28  代码\complier\src\hao\pakg\Parser.java
     文件        4716  2013-01-18 14:27  代码\complier\src\hao\pakg\ParserConstants.java
     文件       33219  2013-01-18 14:27  代码\complier\src\hao\pakg\ParserTokenManager.java
     文件       13057  2013-01-18 14:27  代码\complier\src\hao\pakg\SimpleCharStream.java
............此处省略4个文件信息

评论

共有 条评论