lexer.java

来自「一个类似于openJMS分布在ObjectWeb之下的JMS消息中间件。」· Java 代码 · 共 968 行 · 第 1/3 页

JAVA
968
字号
     9,  0,  1,  1,  1,  9,  9,  1,  0,  1,  1,  1,  1,  1,  1,  0,      0,  9,  9,  9,  1,  1,  1,  1,  1,  9,  1,  1,  1,  1,  1,  0,      1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  9,  1,  1,  1,  1,  1,      1,  1,  0,  0,  1,  0,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,      1,  0,  1,  1,  1,  1,  0,  1,  1,  1,  0,  1,  1,  1,  0,  1,      1,  1,  0,  0,  1,  1,  9,  0,  1,  1,  0,  1,  1,  0,  1,  1,      0,  1,  1,  0,  1,  1,  0,  1,  1,  0,  1,  1,  1,  1,  1  };  /** the input device */  private java.io.Reader yy_reader;  /** the current state of the DFA */  private int yy_state;  /** the current lexical state */  private int yy_lexical_state = YYINITIAL;  /** this buffer contains the current text to be matched and is      the source of the yytext() string */  private char yy_buffer[] = new char[YY_BUFFERSIZE];  /** the textposition at the last accepting state */  private int yy_markedPos;  /** the textposition at the last state to be included in yytext */  private int yy_pushbackPos;  /** the current text position in the buffer */  private int yy_currentPos;  /** startRead marks the beginning of the yytext() string in the buffer */  private int yy_startRead;  /** endRead marks the last character in the buffer, that has been read      from input */  private int yy_endRead;  /** 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;   /**    * yy_atBOL == true <=> the scanner is currently at the beginning of a line   */  private boolean yy_atBOL = true;  /** yy_atEOF == true <=> the scanner is at the EOF */  private boolean yy_atEOF;  /** denotes if the user-EOF-code has already been executed */  private boolean yy_eof_done;  /* user code: */    /* To create a new java_cup.runtime.Symbol with information about       the current token, the token will have no value in this       case. */    private Symbol symbol(int type) {      return new Symbol(type, yyline, yycolumn);    }        /* Also creates a new java_cup.runtime.Symbol with information       about the current token, but this object has a value. */    private Symbol symbol(int type, Object value) {      return new Symbol(type, yyline, yycolumn, value);    }  /* assumes correct representation of a long value for      specified radix in String s */  private long parseLong(String s, int radix) {    return Long.valueOf(s,radix).longValue();  }  /** Constructor called by the <code>Selector</code> class. */  Lexer(String in) {    this(new java.io.StringReader(in));  }  /**   * 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.   */  Lexer(java.io.Reader in) {    this.yy_reader = 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.   */  Lexer(java.io.InputStream in) {    this(new java.io.InputStreamReader(in));  }  /**    * Unpacks the split, compressed DFA transition table.   *   * @return the unpacked transition table   */  private static int [] yy_unpack() {    int [] trans = new int[4816];    int offset = 0;    offset = yy_unpack(yy_packed0, offset, trans);    return trans;  }  /**    * Unpacks the compressed DFA transition table.   *   * @param packed   the packed transition table   * @return         the index of the last entry   */  private static int yy_unpack(String packed, int offset, int [] trans) {    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 trans[j++] = value; while (--count > 0);    }    return j;  }  /**    * Unpacks the compressed character translation table.   *   * @param packed   the packed character translation table   * @return         the unpacked character translation table   */  private static char [] yy_unpack_cmap(String packed) {    char [] map = new char[0x10000];    int i = 0;  /* index in packed string  */    int j = 0;  /* index in unpacked array */    while (i < 1668) {      int  count = packed.charAt(i++);      char value = packed.charAt(i++);      do map[j++] = value; while (--count > 0);    }    return map;  }  /**   * Gets the next input character.   *   * @return      the next character of the input stream, EOF if the   *              end of the stream is reached.   * @exception   IOException  if any I/O-Error occurs   */  private int yy_advance() throws java.io.IOException {    /* standard case */    if (yy_currentPos < yy_endRead) return yy_buffer[yy_currentPos++];    /* if the eof is reached, we don't need to work hard */     if (yy_atEOF) return YYEOF;    /* otherwise: need to refill the buffer */    /* first: make room (if you can) */    if (yy_startRead > 0) {      System.arraycopy(yy_buffer, yy_startRead,                        yy_buffer, 0,                        yy_endRead-yy_startRead);      /* translate stored positions */      yy_endRead-= yy_startRead;      yy_currentPos-= yy_startRead;      yy_markedPos-= yy_startRead;      yy_pushbackPos-= yy_startRead;      yy_startRead = 0;    }    /* is the buffer big enough? */    if (yy_currentPos >= yy_buffer.length) {      /* if not: blow it up */      char newBuffer[] = new char[yy_currentPos*2];      System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);      yy_buffer = newBuffer;    }    /* finally: fill the buffer with new input */    int numRead = yy_reader.read(yy_buffer, yy_endRead,                                             yy_buffer.length-yy_endRead);    if ( numRead == -1 ) return YYEOF;    yy_endRead+= numRead;    return yy_buffer[yy_currentPos++];  }  /**   * Closes the input stream.   */  final public void yyclose() throws java.io.IOException {    yy_atEOF = true;            /* indicate end of file */    yy_endRead = yy_startRead;  /* invalidate buffer    */    if (yy_reader != null)      yy_reader.close();  }  /**   * Closes the current stream, and resets the   * scanner to read from a new input stream.   *   * All internal variables are reset, the old input stream    * <b>cannot</b> be reused (internal buffer is discarded and lost).   * Lexical state is set to <tt>YY_INITIAL</tt>.   *   * @param reader   the new input stream    */  final public void yyreset(java.io.Reader reader) throws java.io.IOException {    yyclose();    yy_reader = reader;    yy_atBOL  = true;    yy_atEOF  = false;    yy_endRead = yy_startRead = 0;    yy_currentPos = yy_markedPos = yy_pushbackPos = 0;    yyline = yychar = yycolumn = 0;    yy_lexical_state = YYINITIAL;  }  /**   * Returns the current lexical state.   */  final public int yystate() {    return yy_lexical_state;  }  /**   * Enters a new lexical state   *   * @param newState the new lexical state   */  final public void yybegin(int newState) {    yy_lexical_state = newState;  }  /**   * Returns the text matched by the current regular expression.   */  final public String yytext() {    return new String( yy_buffer, yy_startRead, yy_markedPos-yy_startRead );  }  /**   * Returns the character at position <tt>pos</tt> from the    * matched text.    *    * It is equivalent to yytext().charAt(pos), but faster   *   * @param pos the position of the character to fetch.    *            A value from 0 to yylength()-1.   *   * @return the character at position pos   */  final public char yycharat(int pos) {    return yy_buffer[yy_startRead+pos];  }  /**   * Returns the length of the matched text region.   */  final public int yylength() {    return yy_markedPos-yy_startRead;  }  /**   * Reports an error that occured while scanning.   *   * In a wellformed scanner (no or only correct usage of    * yypushback(int) and a match-all fallback rule) this method    * will only be called with things that "Can't Possibly Happen".   * If this method is called, something is seriously wrong   * (e.g. a JFlex bug producing a faulty scanner etc.).   *   * Usual syntax/scanner level error handling should be done   * in error fallback rules.   *   * @param   errorCode  the code of the errormessage to display   */  private void yy_ScanError(int errorCode) {    String message;    try {      message = YY_ERROR_MSG[errorCode];    }    catch (ArrayIndexOutOfBoundsException e) {      message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];    }    throw new Error(message);  }   /**   * Pushes the specified amount of characters back into the input stream.   *   * They will be read again by then next call of the scanning method

⌨️ 快捷键说明

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