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

📄 antlrlexer.java

📁 ANTLR(ANother Tool for Language Recognition)它是这样的一种工具
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
			_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 mDOLLAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = DOLLAR;		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 mCHAR_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = CHAR_LITERAL;		int _saveIndex;				match('\'');		{		_loop204:		do {			switch ( LA(1)) {			case '\\':			{				mESC(false);				break;			}			case '\n':			{				match('\n');				if ( inputState.guessing==0 ) {					newline();				}				break;			}			default:				if ((_tokenSet_1.member(LA(1)))) {					matchNot('\'');				}			else {				break _loop204;			}			}		} while (true);		}		match('\'');		if ( inputState.guessing==0 ) {								StringBuffer s = Grammar.getUnescapedStringFromGrammarStringLiteral(new String(text.getBuffer(),_begin,text.length()-_begin));					if ( s.length()>1 ) {						_ttype = STRING_LITERAL;					}							}		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('\\');		{		if ((LA(1)=='n') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			match('n');		}		else if ((LA(1)=='r') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			match('r');		}		else if ((LA(1)=='t') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			match('t');		}		else if ((LA(1)=='b') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			match('b');		}		else if ((LA(1)=='f') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			match('f');		}		else if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			match('"');		}		else if ((LA(1)=='\'') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			match('\'');		}		else if ((LA(1)=='\\') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			match('\\');		}		else if ((LA(1)=='>') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			match('>');		}		else if (((LA(1) >= '0' && LA(1) <= '3')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			{			matchRange('0','3');			}			{			if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				{				matchRange('0','9');				}				{				if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {					matchRange('0','9');				}				else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true)) {				}				else {					throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());				}								}			}			else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true)) {			}			else {				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());			}						}		}		else if (((LA(1) >= '4' && LA(1) <= '7')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			{			matchRange('4','7');			}			{			if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				{				matchRange('0','9');				}			}			else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true)) {			}			else {				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());			}						}		}		else if ((LA(1)=='u') && (_tokenSet_2.member(LA(2)))) {			match('u');			mXDIGIT(false);			mXDIGIT(false);			mXDIGIT(false);			mXDIGIT(false);		}		else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {			matchNot(EOF_CHAR);		}		else {			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;	}		public final void mDOUBLE_QUOTE_STRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = DOUBLE_QUOTE_STRING_LITERAL;		int _saveIndex;				match('"');		{		_loop207:		do {			switch ( LA(1)) {			case '\\':			{				mESC(false);				break;			}			case '\n':			{				match('\n');				if ( inputState.guessing==0 ) {					newline();				}				break;			}			default:				if ((_tokenSet_3.member(LA(1)))) {					matchNot('"');				}			else {				break _loop207;			}			}		} while (true);		}		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 mDOUBLE_ANGLE_STRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = DOUBLE_ANGLE_STRING_LITERAL;		int _saveIndex;				match("<<");		{		_loop210:		do {			// nongreedy exit test			if ((LA(1)=='>') && (LA(2)=='>')) break _loop210;			if ((LA(1)=='\\') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				mESC(false);			}			else if ((LA(1)=='\n') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				match('\n');				if ( inputState.guessing==0 ) {					newline();				}			}			else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				matchNot(EOF_CHAR);			}			else {				break _loop210;			}					} while (true);		}		match(">>");		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 mXDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = XDIGIT;		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 mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = DIGIT;		int _saveIndex;				matchRange('0','9');		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 mINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = INT;		int _saveIndex;				{		int _cnt224=0;		_loop224:		do {			if (((LA(1) >= '0' && LA(1) <= '9'))) {				matchRange('0','9');			}			else {				if ( _cnt224>=1 ) { break _loop224; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}			}						_cnt224++;		} while (true);		}		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 mARG_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = ARG_ACTION;		int _saveIndex;				mNESTED_ARG_ACTION(false);		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 mNESTED_ARG_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = NESTED_ARG_ACTION;		int _saveIndex;				_saveIndex=text.length();		match('[');		text.setLength(_saveIndex);		{		_loop228:		do {			switch ( LA(1)) {			case '[':			{				mNESTED_ARG_ACTION(false);				break;			}			case '\r':			{				match('\r');				match('\n');				if ( inputState.guessing==0 ) {					newline();				}				break;			}			case '\n':			{				match('\n');				if ( inputState.guessing==0 ) {					newline();				}				break;			}			case '"':			{				mACTION_STRING_LITERAL(false);				break;			}			default:				if ((_tokenSet_4.member(LA(1)))) {					matchNot(']');				}			else {				break _loop228;			}			}		} while (true);		}		_saveIndex=text.length();		match(']');		text.setLength(_saveIndex);		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 mACTION_STRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = ACTION_STRING_LITERAL;		int _saveIndex;				match('"');		{		_loop240:		do {			switch ( LA(1)) {			case '\\':			{				mACTION_ESC(false);				break;			}			case '\n':			{				match('\n');				if ( inputState.guessing==0 ) {					newline();				}				break;			}			default:				if ((_tokenSet_3.member(LA(1)))) {					matchNot('"');				}			else {				break _loop240;			}			}		} while (true);		}		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 mACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = ACTION;

⌨️ 快捷键说明

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