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

📄 scanner.java

📁 SkipOOMiniJOOL教学语言的编译器前端
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* The following code was generated by JFlex 1.4.1 on 07-6-4 下午4:31 */package edu.ustc.cs.minijool.lab3parser;

import java_cup.runtime.*;

/** * This class is a scanner generated by  * <a href="http://www.jflex.de/">JFlex</a> 1.4.1 * on 07-6-4 下午4:31 from the specification file * <tt>/home/taotao/workspace/Lab3/JFlex/dpar-spec.flex</tt> */public class Scanner implements java_cup.runtime.Scanner {  /** This character denotes the end of file */  public static final int YYEOF = -1;  /** initial size of the lookahead buffer */  private static final int ZZ_BUFFERSIZE = 16384;  /** lexical states */  public static final int YYINITIAL = 0;  /**    * Translates characters to character classes   */  private static final String ZZ_CMAP_PACKED =     "\11\11\1\3\1\2\1\0\1\3\1\1\16\11\4\0\1\3\3\0"+    "\1\10\10\0\1\37\1\0\1\7\12\11\1\23\1\40\1\12\1\0"+    "\1\13\2\0\4\10\1\27\1\10\1\25\1\10\1\14\2\10\1\24"+    "\1\15\1\10\1\17\1\16\1\10\1\20\1\22\1\21\1\26\5\10"+    "\1\4\1\0\1\6\1\0\1\10\1\0\4\10\1\30\3\10\1\33"+    "\2\10\1\34\1\10\1\36\1\35\1\31\2\10\1\32\7\10\1\0"+    "\1\5\2\0\41\11\2\0\4\10\4\0\1\10\2\0\1\11\7\0"+    "\1\10\4\0\1\10\5\0\27\10\1\0\37\10\1\0\u013f\10\31\0"+    "\162\10\4\0\14\10\16\0\5\10\11\0\1\10\21\0\130\11\5\0"+    "\23\11\12\0\1\10\13\0\1\10\1\0\3\10\1\0\1\10\1\0"+    "\24\10\1\0\54\10\1\0\46\10\1\0\5\10\4\0\202\10\1\0"+    "\4\11\3\0\105\10\1\0\46\10\2\0\2\10\6\0\20\10\41\0"+    "\46\10\2\0\1\10\7\0\47\10\11\0\21\11\1\0\27\11\1\0"+    "\3\11\1\0\1\11\1\0\2\11\1\0\1\11\13\0\33\10\5\0"+    "\3\10\15\0\4\11\14\0\6\11\13\0\32\10\5\0\13\10\16\11"+    "\7\0\12\11\4\0\2\10\1\11\143\10\1\0\1\10\10\11\1\0"+    "\6\11\2\10\2\11\1\0\4\11\2\10\12\11\3\10\2\0\1\10"+    "\17\0\1\11\1\10\1\11\36\10\33\11\2\0\3\10\60\0\46\10"+    "\13\11\1\10\u014f\0\3\11\66\10\2\0\1\11\1\10\20\11\2\0"+    "\1\10\4\11\3\0\12\10\2\11\2\0\12\11\21\0\3\11\1\0"+    "\10\10\2\0\2\10\2\0\26\10\1\0\7\10\1\0\1\10\3\0"+    "\4\10\2\0\1\11\1\10\7\11\2\0\2\11\2\0\3\11\11\0"+    "\1\11\4\0\2\10\1\0\3\10\2\11\2\0\12\11\4\10\15\0"+    "\3\11\1\0\6\10\4\0\2\10\2\0\26\10\1\0\7\10\1\0"+    "\2\10\1\0\2\10\1\0\2\10\2\0\1\11\1\0\5\11\4\0"+    "\2\11\2\0\3\11\13\0\4\10\1\0\1\10\7\0\14\11\3\10"+    "\14\0\3\11\1\0\11\10\1\0\3\10\1\0\26\10\1\0\7\10"+    "\1\0\2\10\1\0\5\10\2\0\1\11\1\10\10\11\1\0\3\11"+    "\1\0\3\11\2\0\1\10\17\0\2\10\2\11\2\0\12\11\1\0"+    "\1\10\17\0\3\11\1\0\10\10\2\0\2\10\2\0\26\10\1\0"+    "\7\10\1\0\2\10\1\0\5\10\2\0\1\11\1\10\6\11\3\0"+    "\2\11\2\0\3\11\10\0\2\11\4\0\2\10\1\0\3\10\4\0"+    "\12\11\1\0\1\10\20\0\1\11\1\10\1\0\6\10\3\0\3\10"+    "\1\0\4\10\3\0\2\10\1\0\1\10\1\0\2\10\3\0\2\10"+    "\3\0\3\10\3\0\10\10\1\0\3\10\4\0\5\11\3\0\3\11"+    "\1\0\4\11\11\0\1\11\17\0\11\11\11\0\1\10\7\0\3\11"+    "\1\0\10\10\1\0\3\10\1\0\27\10\1\0\12\10\1\0\5\10"+    "\4\0\7\11\1\0\3\11\1\0\4\11\7\0\2\11\11\0\2\10"+    "\4\0\12\11\22\0\2\11\1\0\10\10\1\0\3\10\1\0\27\10"+    "\1\0\12\10\1\0\5\10\2\0\1\11\1\10\7\11\1\0\3\11"+    "\1\0\4\11\7\0\2\11\7\0\1\10\1\0\2\10\4\0\12\11"+    "\22\0\2\11\1\0\10\10\1\0\3\10\1\0\27\10\1\0\20\10"+    "\4\0\6\11\2\0\3\11\1\0\4\11\11\0\1\11\10\0\2\10"+    "\4\0\12\11\22\0\2\11\1\0\22\10\3\0\30\10\1\0\11\10"+    "\1\0\1\10\2\0\7\10\3\0\1\11\4\0\6\11\1\0\1\11"+    "\1\0\10\11\22\0\2\11\15\0\60\10\1\11\2\10\7\11\4\0"+    "\10\10\10\11\1\0\12\11\47\0\2\10\1\0\1\10\2\0\2\10"+    "\1\0\1\10\2\0\1\10\6\0\4\10\1\0\7\10\1\0\3\10"+    "\1\0\1\10\1\0\1\10\2\0\2\10\1\0\4\10\1\11\2\10"+    "\6\11\1\0\2\11\1\10\2\0\5\10\1\0\1\10\1\0\6\11"+    "\2\0\12\11\2\0\2\10\42\0\1\10\27\0\2\11\6\0\12\11"+    "\13\0\1\11\1\0\1\11\1\0\1\11\4\0\2\11\10\10\1\0"+    "\42\10\6\0\24\11\1\0\2\11\4\10\4\0\10\11\1\0\44\11"+    "\11\0\1\11\71\0\42\10\1\0\5\10\1\0\2\10\1\0\7\11"+    "\3\0\4\11\6\0\12\11\6\0\6\10\4\11\106\0\46\10\12\0"+    "\51\10\7\0\132\10\5\0\104\10\5\0\122\10\6\0\7\10\1\0"+    "\77\10\1\0\1\10\1\0\4\10\2\0\7\10\1\0\1\10\1\0"+    "\4\10\2\0\47\10\1\0\1\10\1\0\4\10\2\0\37\10\1\0"+    "\1\10\1\0\4\10\2\0\7\10\1\0\1\10\1\0\4\10\2\0"+    "\7\10\1\0\7\10\1\0\27\10\1\0\37\10\1\0\1\10\1\0"+    "\4\10\2\0\7\10\1\0\47\10\1\0\23\10\16\0\11\11\56\0"+    "\125\10\14\0\u026c\10\2\0\10\10\12\0\32\10\5\0\113\10\3\0"+    "\3\10\17\0\15\10\1\0\4\10\3\11\13\0\22\10\3\11\13\0"+    "\22\10\2\11\14\0\15\10\1\0\3\10\1\0\2\11\14\0\64\10"+    "\40\11\3\0\1\10\3\0\2\10\1\11\2\0\12\11\41\0\3\11"+    "\2\0\12\11\6\0\130\10\10\0\51\10\1\11\126\0\35\10\3\0"+    "\14\11\4\0\14\11\12\0\12\11\36\10\2\0\5\10\u038b\0\154\10"+    "\224\0\234\10\4\0\132\10\6\0\26\10\2\0\6\10\2\0\46\10"+    "\2\0\6\10\2\0\10\10\1\0\1\10\1\0\1\10\1\0\1\10"+    "\1\0\37\10\2\0\65\10\1\0\7\10\1\0\1\10\3\0\3\10"+    "\1\0\7\10\3\0\4\10\2\0\6\10\4\0\15\10\5\0\3\10"+    "\1\0\7\10\17\0\4\11\32\0\5\11\20\0\2\10\23\0\1\10"+    "\13\0\4\11\6\0\6\11\1\0\1\10\15\0\1\10\40\0\22\10"+    "\36\0\15\11\4\0\1\11\3\0\6\11\27\0\1\10\4\0\1\10"+    "\2\0\12\10\1\0\1\10\3\0\5\10\6\0\1\10\1\0\1\10"+    "\1\0\1\10\1\0\4\10\1\0\3\10\1\0\7\10\3\0\3\10"+    "\5\0\5\10\26\0\44\10\u0e81\0\3\10\31\0\11\10\6\11\1\0"+    "\5\10\2\0\5\10\4\0\126\10\2\0\2\11\2\0\3\10\1\0"+    "\137\10\5\0\50\10\4\0\136\10\21\0\30\10\70\0\20\10\u0200\0"+    "\u19b6\10\112\0\u51a6\10\132\0\u048d\10\u0773\0\u2ba4\10\u215c\0\u012e\10\2\0"+    "\73\10\225\0\7\10\14\0\5\10\5\0\1\10\1\11\12\10\1\0"+    "\15\10\1\0\5\10\1\0\1\10\1\0\2\10\1\0\2\10\1\0"+    "\154\10\41\0\u016b\10\22\0\100\10\2\0\66\10\50\0\15\10\3\0"+    "\20\11\20\0\4\11\17\0\2\10\30\0\3\10\31\0\1\10\6\0"+    "\5\10\1\0\207\10\2\0\1\11\4\0\1\10\13\0\12\11\7\0"+    "\32\10\4\0\1\10\1\0\32\10\12\0\132\10\3\0\6\10\2\0"+    "\6\10\2\0\6\10\2\0\3\10\3\0\2\10\3\0\2\10\22\0"+    "\3\11\4\0";  /**    * Translates characters to character classes   */  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);  /**    * Translates DFA states to action switch labels.   */  private static final int [] ZZ_ACTION = zzUnpackAction();  private static final String ZZ_ACTION_PACKED_0 =    "\1\0\1\1\2\2\1\1\1\3\1\1\1\4\1\1"+    "\3\4\1\1\1\5\1\0\1\2\1\0\3\4\1\6"+    "\1\0\1\7\3\4\1\10\13\4\1\11\1\12\1\4"+    "\1\13";  private static int [] zzUnpackAction() {    int [] result = new int[42];    int offset = 0;    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);    return result;  }  private static int zzUnpackAction(String packed, int offset, int [] result) {    int i = 0;       /* index in packed string  */    int j = offset;  /* index in unpacked array */    int l = packed.length();    while (i < l) {      int count = packed.charAt(i++);      int value = packed.charAt(i++);      do result[j++] = value; while (--count > 0);    }    return j;  }  /**    * Translates a state to a row index in the transition table   */  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();  private static final String ZZ_ROWMAP_PACKED_0 =    "\0\0\0\41\0\102\0\41\0\143\0\41\0\204\0\245"+    "\0\306\0\347\0\u0108\0\u0129\0\u014a\0\41\0\u016b\0\u018c"+    "\0\u01ad\0\u01ce\0\u01ef\0\u0210\0\41\0\u0231\0\41\0\u0252"+    "\0\u0273\0\u0294\0\41\0\u02b5\0\u02d6\0\u02f7\0\u0318\0\u0339"+    "\0\u035a\0\u037b\0\u039c\0\u03bd\0\u03de\0\u03ff\0\245\0\41"+    "\0\u0420\0\41";  private static int [] zzUnpackRowMap() {    int [] result = new int[42];    int offset = 0;    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);    return result;  }  private static int zzUnpackRowMap(String packed, int offset, int [] result) {    int i = 0;  /* index in packed string  */    int j = offset;  /* index in unpacked array */    int l = packed.length();    while (i < l) {      int high = packed.charAt(i++) << 16;      result[j++] = high | packed.charAt(i++);    }    return j;  }  /**    * The transition table of the DFA   */  private static final int [] ZZ_TRANS = zzUnpackTrans();  private static final String ZZ_TRANS_PACKED_0 =    "\1\2\1\3\2\4\1\5\1\6\1\2\1\7\1\10"+    "\1\2\1\11\1\2\1\12\1\10\1\13\4\10\1\2"+    "\4\10\1\14\6\10\1\15\1\16\43\0\1\4\43\0"+    "\1\17\42\0\1\20\41\0\2\10\2\0\7\10\1\0"+    "\13\10\12\0\1\21\3\0\7\21\1\0\13\21\12\0"+    "\2\10\2\0\1\10\1\22\5\10\1\0\13\10\12\0"+    "\2\10\2\0\4\10\1\23\2\10\1\0\13\10\12\0"+    "\2\10\2\0\7\10\1\0\5\10\1\24\5\10\15\0"+    "\1\25\25\0\5\17\1\26\33\17\1\20\1\3\1\4"+    "\36\20\10\0\2\21\1\0\1\27\7\21\1\0\13\21"+    "\12\0\2\10\2\0\2\10\1\30\4\10\1\0\13\10"+    "\12\0\2\10\2\0\3\10\1\31\3\10\1\0\13\10"+    "\12\0\2\10\2\0\7\10\1\0\6\10\1\32\4\10"+    "\2\0\5\17\1\26\1\33\32\17\10\0\2\10\2\0"+    "\3\10\1\34\3\10\1\0\13\10\12\0\2\10\2\0"+    "\7\10\1\0\1\35\12\10\12\0\2\10\2\0\7\10"+    "\1\0\7\10\1\36\3\10\12\0\2\10\2\0\4\10"+    "\1\37\2\10\1\0\13\10\12\0\2\10\2\0\3\10"+    "\1\40\3\10\1\0\13\10\12\0\2\10\2\0\7\10"+    "\1\0\10\10\1\41\2\10\12\0\2\10\2\0\5\10"+    "\1\42\1\10\1\0\13\10\12\0\2\10\2\0\7\10"+    "\1\0\1\10\1\43\11\10\12\0\2\10\2\0\7\10"+    "\1\0\11\10\1\44\1\10\12\0\2\10\2\0\6\10"+    "\1\45\1\0\13\10\12\0\2\10\2\0\7\10\1\0"+    "\2\10\1\46\10\10\12\0\2\10\2\0\7\10\1\0"+    "\12\10\1\47\12\0\2\10\2\0\7\10\1\50\13\10"+    "\12\0\2\10\2\0\7\10\1\0\3\10\1\51\7\10"+    "\12\0\2\10\2\0\7\10\1\52\13\10\2\0";  private static int [] zzUnpackTrans() {    int [] result = new int[1089];    int offset = 0;    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);    return result;  }  private static int zzUnpackTrans(String packed, int offset, int [] result) {    int i = 0;       /* index in packed string  */    int j = offset;  /* index in unpacked array */    int l = packed.length();    while (i < l) {      int count = packed.charAt(i++);      int value = packed.charAt(i++);      value--;      do result[j++] = value; while (--count > 0);    }    return j;  }  /* error codes */  private static final int ZZ_UNKNOWN_ERROR = 0;  private static final int ZZ_NO_MATCH = 1;  private static final int ZZ_PUSHBACK_2BIG = 2;  /* error messages for the codes above */  private static final String ZZ_ERROR_MSG[] = {    "Unkown internal scanner error",    "Error: could not match input",    "Error: pushback value was too large"  };  /**   * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>   */  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();  private static final String ZZ_ATTRIBUTE_PACKED_0 =    "\1\0\1\11\1\1\1\11\1\1\1\11\7\1\1\11"+    "\1\0\1\1\1\0\3\1\1\11\1\0\1\11\3\1"+    "\1\11\14\1\1\11\1\1\1\11";  private static int [] zzUnpackAttribute() {    int [] result = new int[42];    int offset = 0;    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);    return result;  }  private static int zzUnpackAttribute(String packed, int offset, int [] result) {    int i = 0;       /* index in packed string  */    int j = offset;  /* index in unpacked array */    int l = packed.length();    while (i < l) {      int count = packed.charAt(i++);      int value = packed.charAt(i++);      do result[j++] = value; while (--count > 0);    }    return j;  }  /** the input device */  private java.io.Reader zzReader;  /** the current state of the DFA */  private int zzState;  /** the current lexical state */  private int zzLexicalState = YYINITIAL;  /** this buffer contains the current text to be matched and is      the source of the yytext() string */  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];  /** the textposition at the last accepting state */  private int zzMarkedPos;  /** the textposition at the last state to be included in yytext */  private int zzPushbackPos;  /** the current text position in the buffer */  private int zzCurrentPos;  /** startRead marks the beginning of the yytext() string in the buffer */  private int zzStartRead;  /** endRead marks the last character in the buffer, that has been read      from input */  private int zzEndRead;  /** number of newlines encountered up to the start of the matched text */  private int yyline;  /** the number of characters up to the start of the matched text */  private int yychar;  /**   * the number of characters from the last newline up to the start of the    * matched text   */  private int yycolumn;  /**    * zzAtBOL == true <=> the scanner is currently at the beginning of a line   */  private boolean zzAtBOL = true;  /** zzAtEOF == true <=> the scanner is at the EOF */  private boolean zzAtEOF;  /** denotes if the user-EOF-code has already been executed */  private boolean zzEOFDone;  /* user code: */  StringBuffer string = new StringBuffer();
  
  private Symbol symbol(int type) {
    return new Symbol(type, yyline+1, yycolumn+1);
  }

  private Symbol symbol(int type, Object value) {
    return new Symbol(type, yyline+1, yycolumn+1, value);
  }
  /**   * Creates a new scanner   * There is also a java.io.InputStream version of this constructor.   *   * @param   in  the java.io.Reader to read input from.   */  public Scanner(java.io.Reader in) {    this.zzReader = in;  }  /**   * Creates a new scanner.   * There is also java.io.Reader version of this constructor.   *   * @param   in  the java.io.Inputstream to read input from.   */  public Scanner(java.io.InputStream in) {    this(new java.io.InputStreamReader(in));  }  /**    * Unpacks the compressed character translation table.   *   * @param packed   the packed character translation table   * @return         the unpacked character translation table   */  private static char [] zzUnpackCMap(String packed) {    char [] map = new char[0x10000];    int i = 0;  /* index in packed string  */    int j = 0;  /* index in unpacked array */    while (i < 1744) {      int  count = packed.charAt(i++);      char value = packed.charAt(i++);      do map[j++] = value; while (--count > 0);    }    return map;  }  /**   * Refills the input buffer.   *   * @return      <code>false</code>, iff there was new input.   *    * @exception   java.io.IOException  if any I/O-Error occurs   */  private boolean zzRefill() throws java.io.IOException {    /* first: make room (if you can) */    if (zzStartRead > 0) {      System.arraycopy(zzBuffer, zzStartRead,                       zzBuffer, 0,                       zzEndRead-zzStartRead);      /* translate stored positions */      zzEndRead-= zzStartRead;      zzCurrentPos-= zzStartRead;      zzMarkedPos-= zzStartRead;      zzPushbackPos-= zzStartRead;      zzStartRead = 0;    }    /* is the buffer big enough? */    if (zzCurrentPos >= zzBuffer.length) {      /* if not: blow it up */      char newBuffer[] = new char[zzCurrentPos*2];      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);      zzBuffer = newBuffer;    }

⌨️ 快捷键说明

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