javalexer.java
来自「Groovy动态语言 运行在JVM中的动态语言 可以方便的处理业务逻辑变化大的业」· Java 代码 · 共 2,127 行 · 第 1/4 页
JAVA
2,127 行
int _cnt363=0; _loop363: do { switch ( LA(1)) { case ' ': { match(' '); break; } case '\t': { match('\t'); break; } case '\u000c': { match('\f'); break; } case '\n': case '\r': { { if ((LA(1)=='\r') && (LA(2)=='\n') && (true) && (true)) { match("\r\n"); } else if ((LA(1)=='\r') && (true) && (true) && (true)) { match('\r'); } else if ((LA(1)=='\n')) { match('\n'); } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } if ( inputState.guessing==0 ) { newline(); } break; } default: { if ( _cnt363>=1 ) { break _loop363; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} } } _cnt363++; } while (true); } if ( inputState.guessing==0 ) { _ttype = Token.SKIP; } 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 mSL_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = SL_COMMENT; int _saveIndex; match("//"); { _loop367: do { if ((_tokenSet_0.member(LA(1)))) { { match(_tokenSet_0); } } else { break _loop367; } } while (true); } { switch ( LA(1)) { case '\n': { match('\n'); break; } case '\r': { match('\r'); { if ((LA(1)=='\n')) { match('\n'); } else { } } break; } default: { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } } if ( inputState.guessing==0 ) { _ttype = Token.SKIP; newline(); } 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 mML_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = ML_COMMENT; int _saveIndex; match("/*"); { _loop373: do { if ((LA(1)=='\r') && (LA(2)=='\n') && ((LA(3) >= '\u0003' && LA(3) <= '\uffff')) && ((LA(4) >= '\u0003' && LA(4) <= '\uffff'))) { match('\r'); match('\n'); if ( inputState.guessing==0 ) { newline(); } } else if (((LA(1)=='*') && ((LA(2) >= '\u0003' && LA(2) <= '\uffff')) && ((LA(3) >= '\u0003' && LA(3) <= '\uffff')))&&( LA(2)!='/' )) { match('*'); } else if ((LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '\uffff')) && ((LA(3) >= '\u0003' && LA(3) <= '\uffff')) && (true)) { match('\r'); if ( inputState.guessing==0 ) { newline(); } } else if ((LA(1)=='\n')) { match('\n'); if ( inputState.guessing==0 ) { newline(); } } else if ((_tokenSet_1.member(LA(1)))) { { match(_tokenSet_1); } } else { break _loop373; } } while (true); } match("*/"); if ( inputState.guessing==0 ) { _ttype = Token.SKIP; } 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 mSTRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = STRING_LITERAL; int _saveIndex; switch ( LA(1)) { case '"': { match('"'); { _loop377: do { if ((LA(1)=='\\')) { mESC(false); } else if ((_tokenSet_2.member(LA(1)))) { { match(_tokenSet_2); } } else { break _loop377; } } while (true); } match('"'); break; } case '\'': { match('\''); { if ((LA(1)=='\\')) { mESC(false); } else if ((_tokenSet_3.member(LA(1)))) { { match(_tokenSet_3); } } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } match('\''); break; } default: { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = ESC; int _saveIndex; match('\\'); { switch ( LA(1)) { case 'n': { match('n'); break; } case 'r': { match('r'); break; } case 't': { match('t'); break; } case 'b': { match('b'); break; } case 'f': { match('f'); break; } case '"': { match('"'); break; } case '\'': { match('\''); break; } case '\\': { match('\\'); break; } case 'u': { { int _cnt383=0; _loop383: do { if ((LA(1)=='u')) { match('u'); } else { if ( _cnt383>=1 ) { break _loop383; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} } _cnt383++; } while (true); } mHEX_DIGIT(false); mHEX_DIGIT(false); mHEX_DIGIT(false); mHEX_DIGIT(false); break; } case '0': case '1': case '2': case '3': { matchRange('0','3'); { if (((LA(1) >= '0' && LA(1) <= '7')) && (_tokenSet_0.member(LA(2))) && (true) && (true)) { matchRange('0','7'); { if (((LA(1) >= '0' && LA(1) <= '7')) && (_tokenSet_0.member(LA(2))) && (true) && (true)) { matchRange('0','7'); } else if ((_tokenSet_0.member(LA(1))) && (true) && (true) && (true)) { } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } } else if ((_tokenSet_0.member(LA(1))) && (true) && (true) && (true)) { } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } break; } case '4': case '5': case '6': case '7': { matchRange('4','7'); { if (((LA(1) >= '0' && LA(1) <= '7')) && (_tokenSet_0.member(LA(2))) && (true) && (true)) { matchRange('0','7'); } else if ((_tokenSet_0.member(LA(1))) && (true) && (true) && (true)) { } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } break; } default: { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } protected final void mHEX_DIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = HEX_DIGIT; int _saveIndex; { switch ( LA(1)) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { matchRange('0','9'); break; } case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': { matchRange('A','F'); break; } case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': { matchRange('a','f'); break; } default: { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } protected final void mVOCAB(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = VOCAB; int _saveIndex; matchRange('\3','\377'); 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 mIDENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = IDENT; int _saveIndex; { switch ( LA(1)) { 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': { matchRange('a','z'); break; } 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': { matchRange('A','Z'); break; } case '_': { match('_'); break; } case '$': { match('$'); break; } default: { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } } { _loop393: do { switch ( LA(1)) { 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': { matchRange('a','z'); break; } 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': { matchRange('A','Z'); break; } case '_': { match('_'); break; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { matchRange('0','9'); break; } case '$': { match('$'); break; } default: { break _loop393; } } } while (true); } if ( inputState.guessing==0 ) { // check if "assert" keyword is enabled if (assertEnabled && "assert".equals(new String(text.getBuffer(),_begin,text.length()-_begin))) { _ttype = LITERAL_assert; // set token type for the rule in the parser } // check if "enum" keyword is enabled if (enumEnabled && "enum".equals(new String(text.getBuffer(),_begin,text.length()-_begin))) { _ttype = LITERAL_enum; // set token type for the rule in the parser } } _ttype = testLiteralsTable(_ttype); 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 mNUM_INT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = NUM_INT; int _saveIndex; Token f1=null; Token f2=null; Token f3=null; Token f4=null; boolean isDecimal=false; Token t=null;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?