📄 javalexer.java
字号:
// $ANTLR 2.7.4: "java-expression.g" -> "JavaLexer.java"$ package gnu.classpath.tools.gjdoc.expr; import java.io.InputStream;import antlr.TokenStreamException;import antlr.TokenStreamIOException;import antlr.TokenStreamRecognitionException;import antlr.CharStreamException;import antlr.CharStreamIOException;import antlr.ANTLRException;import java.io.Reader;import java.util.Hashtable;import antlr.CharScanner;import antlr.InputBuffer;import antlr.ByteBuffer;import antlr.CharBuffer;import antlr.Token;import antlr.CommonToken;import antlr.RecognitionException;import antlr.NoViableAltForCharException;import antlr.MismatchedCharException;import antlr.TokenStream;import antlr.ANTLRHashString;import antlr.LexerSharedInputState;import antlr.collections.impl.BitSet;import antlr.SemanticException;public class JavaLexer extends antlr.CharScanner implements JavaTokenTypes, TokenStream {public JavaLexer(InputStream in) { this(new ByteBuffer(in));}public JavaLexer(Reader in) { this(new CharBuffer(in));}public JavaLexer(InputBuffer ib) { this(new LexerSharedInputState(ib));}public JavaLexer(LexerSharedInputState state) { super(state); caseSensitiveLiterals = true; setCaseSensitive(true); literals = new Hashtable(); literals.put(new ANTLRHashString("String", this), new Integer(55)); literals.put(new ANTLRHashString("true", this), new Integer(83)); literals.put(new ANTLRHashString("void", this), new Integer(46)); literals.put(new ANTLRHashString("boolean", this), new Integer(47)); literals.put(new ANTLRHashString("abstract", this), new Integer(40)); literals.put(new ANTLRHashString("short", this), new Integer(50)); literals.put(new ANTLRHashString("long", this), new Integer(53)); literals.put(new ANTLRHashString("null", this), new Integer(85)); literals.put(new ANTLRHashString("char", this), new Integer(49)); literals.put(new ANTLRHashString("float", this), new Integer(52)); literals.put(new ANTLRHashString("byte", this), new Integer(48)); literals.put(new ANTLRHashString("double", this), new Integer(54)); literals.put(new ANTLRHashString("int", this), new Integer(51)); literals.put(new ANTLRHashString("strictfp", this), new Integer(41)); literals.put(new ANTLRHashString("false", this), new Integer(84)); literals.put(new ANTLRHashString("final", this), new Integer(39));}public Token nextToken() throws TokenStreamException { Token theRetToken=null;tryAgain: for (;;) { Token _token = null; int _ttype = Token.INVALID_TYPE; resetText(); try { // for char stream error handling try { // for lexical error handling switch ( LA(1)) { case '?': { mQUESTION(true); theRetToken=_returnToken; break; } case '(': { mLPAREN(true); theRetToken=_returnToken; break; } case ')': { mRPAREN(true); theRetToken=_returnToken; break; } case '[': { mLBRACK(true); theRetToken=_returnToken; break; } case ']': { mRBRACK(true); theRetToken=_returnToken; break; } case '{': { mLCURLY(true); theRetToken=_returnToken; break; } case '}': { mRCURLY(true); theRetToken=_returnToken; break; } case ':': { mCOLON(true); theRetToken=_returnToken; break; } case ',': { mCOMMA(true); theRetToken=_returnToken; break; } case '~': { mBNOT(true); theRetToken=_returnToken; break; } case ';': { mSEMI(true); theRetToken=_returnToken; break; } case '\t': case '\n': case '\u000c': case '\r': case ' ': { mWS(true); theRetToken=_returnToken; break; } case '\'': { mCHAR_LITERAL(true); theRetToken=_returnToken; break; } case '"': { mSTRING_LITERAL(true); theRetToken=_returnToken; break; } case '$': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': { mIDENT(true); theRetToken=_returnToken; break; } case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { mNUM_INT(true); theRetToken=_returnToken; break; } default: if ((LA(1)=='>') && (LA(2)=='>') && (LA(3)=='>') && (LA(4)=='=')) { mBSR_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='>') && (LA(2)=='>') && (LA(3)=='=')) { mSR_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='>') && (LA(2)=='>') && (LA(3)=='>') && (true)) { mBSR(true); theRetToken=_returnToken; } else if ((LA(1)=='<') && (LA(2)=='<') && (LA(3)=='=')) { mSL_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='=') && (LA(2)=='=')) { mEQUAL(true); theRetToken=_returnToken; } else if ((LA(1)=='!') && (LA(2)=='=')) { mNOT_EQUAL(true); theRetToken=_returnToken; } else if ((LA(1)=='/') && (LA(2)=='=')) { mDIV_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='+') && (LA(2)=='=')) { mPLUS_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='+') && (LA(2)=='+')) { mINC(true); theRetToken=_returnToken; } else if ((LA(1)=='-') && (LA(2)=='=')) { mMINUS_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='-') && (LA(2)=='-')) { mDEC(true); theRetToken=_returnToken; } else if ((LA(1)=='*') && (LA(2)=='=')) { mSTAR_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='%') && (LA(2)=='=')) { mMOD_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='>') && (LA(2)=='>') && (true)) { mSR(true); theRetToken=_returnToken; } else if ((LA(1)=='>') && (LA(2)=='=')) { mGE(true); theRetToken=_returnToken; } else if ((LA(1)=='<') && (LA(2)=='<') && (true)) { mSL(true); theRetToken=_returnToken; } else if ((LA(1)=='<') && (LA(2)=='=')) { mLE(true); theRetToken=_returnToken; } else if ((LA(1)=='^') && (LA(2)=='=')) { mBXOR_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='|') && (LA(2)=='=')) { mBOR_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='|') && (LA(2)=='|')) { mLOR(true); theRetToken=_returnToken; } else if ((LA(1)=='&') && (LA(2)=='=')) { mBAND_ASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='&') && (LA(2)=='&')) { mLAND(true); theRetToken=_returnToken; } else if ((LA(1)=='/') && (LA(2)=='/')) { mSL_COMMIT(true); theRetToken=_returnToken; } else if ((LA(1)=='/') && (LA(2)=='*')) { mML_COMMENT(true); theRetToken=_returnToken; } else if ((LA(1)=='=') && (true)) { mASSIGN(true); theRetToken=_returnToken; } else if ((LA(1)=='!') && (true)) { mLNOT(true); theRetToken=_returnToken; } else if ((LA(1)=='/') && (true)) { mDIV(true); theRetToken=_returnToken; } else if ((LA(1)=='+') && (true)) { mPLUS(true); theRetToken=_returnToken; } else if ((LA(1)=='-') && (true)) { mMINUS(true); theRetToken=_returnToken; } else if ((LA(1)=='*') && (true)) { mSTAR(true); theRetToken=_returnToken; } else if ((LA(1)=='%') && (true)) { mMOD(true); theRetToken=_returnToken; } else if ((LA(1)=='>') && (true)) { mGT(true); theRetToken=_returnToken; } else if ((LA(1)=='<') && (true)) { mLT(true); theRetToken=_returnToken; } else if ((LA(1)=='^') && (true)) { mBXOR(true); theRetToken=_returnToken; } else if ((LA(1)=='|') && (true)) { mBOR(true); theRetToken=_returnToken; } else if ((LA(1)=='&') && (true)) { mBAND(true); theRetToken=_returnToken; } else { if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} } } if ( _returnToken==null ) continue tryAgain; // found SKIP token _ttype = _returnToken.getType(); _returnToken.setType(_ttype); return _returnToken; } catch (RecognitionException e) { throw new TokenStreamRecognitionException(e); } } catch (CharStreamException cse) { if ( cse instanceof CharStreamIOException ) { throw new TokenStreamIOException(((CharStreamIOException)cse).io); } else { throw new TokenStreamException(cse.getMessage()); } } }} public final void mQUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = QUESTION; int _saveIndex; match('?'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = LPAREN; int _saveIndex; match('('); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = RPAREN; int _saveIndex; match(')'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mLBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = LBRACK; int _saveIndex; match('['); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mRBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = RBRACK; int _saveIndex; match(']'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mLCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = LCURLY; int _saveIndex; match('{'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = RCURLY; int _saveIndex; match('}'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = COLON; int _saveIndex; match(':'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = COMMA; int _saveIndex; match(','); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = ASSIGN; int _saveIndex; match('='); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mEQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = EQUAL; int _saveIndex; match("=="); if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -