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

📄 csharplexer.cs

📁 C#编写的c#编译器
💻 CS
📖 第 1 页 / 共 5 页
字号:
						inputState.guessing++;
						try {
							{
								{ // ( ... )+
								int _cnt573=0;
								for (;;)
								{
									if (((LA(1) >= '0' && LA(1) <= '9')))
									{
										mDECIMAL_DIGIT(false);
									}
									else
									{
										if (_cnt573 >= 1) { goto _loop573_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
									}
									
									_cnt573++;
								}
_loop573_breakloop:								;
								}    // ( ... )+
								{
									mREAL_TYPE_SUFFIX(false);
								}
							}
						}
						catch (RecognitionException)
						{
							synPredMatched575 = false;
						}
						rewind(_m575);
						inputState.guessing--;
					}
					if ( synPredMatched575 )
					{
						{ // ( ... )+
						int _cnt577=0;
						for (;;)
						{
							if (((LA(1) >= '0' && LA(1) <= '9')))
							{
								mDECIMAL_DIGIT(false);
							}
							else
							{
								if (_cnt577 >= 1) { goto _loop577_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
							}
							
							_cnt577++;
						}
_loop577_breakloop:						;
						}    // ( ... )+
						{
							mREAL_TYPE_SUFFIX(false);
						}
						if (0==inputState.guessing)
						{
							_ttype = REAL_LITERAL;
						}
					}
					else if (((LA(1) >= '0' && LA(1) <= '9')) && (true) && (true) && (true)) {
						{ // ( ... )+
						int _cnt580=0;
						for (;;)
						{
							if (((LA(1) >= '0' && LA(1) <= '9')))
							{
								mDECIMAL_DIGIT(false);
							}
							else
							{
								if (_cnt580 >= 1) { goto _loop580_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
							}
							
							_cnt580++;
						}
_loop580_breakloop:						;
						}    // ( ... )+
						{
							if ((tokenSet_10_.member(LA(1))))
							{
								mINTEGER_TYPE_SUFFIX(false);
							}
							else {
							}
							
						}
						if (0==inputState.guessing)
						{
							_ttype = INTEGER_LITERAL;
						}
					}
					else if ((LA(1)=='.') && (true)) {
						match('.');
						if (0==inputState.guessing)
						{
							_ttype = DOT;
						}
					}
					else
					{
						throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
					}
					}}}
					if (_createToken && (null == _token) && (_ttype != Token.SKIP))
					{
						_token = makeToken(_ttype);
						_token.setText(text.ToString(_begin, text.Length-_begin));
					}
					returnToken_ = _token;
				}
				
	protected void mDECIMAL_DIGIT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = DECIMAL_DIGIT;
		
		switch ( LA(1) )
		{
		case '0':
		{
			match('0');
			break;
		}
		case '1':
		{
			match('1');
			break;
		}
		case '2':
		{
			match('2');
			break;
		}
		case '3':
		{
			match('3');
			break;
		}
		case '4':
		{
			match('4');
			break;
		}
		case '5':
		{
			match('5');
			break;
		}
		case '6':
		{
			match('6');
			break;
		}
		case '7':
		{
			match('7');
			break;
		}
		case '8':
		{
			match('8');
			break;
		}
		case '9':
		{
			match('9');
			break;
		}
		default:
		{
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		 }
		if (_createToken && (null == _token) && (_ttype != Token.SKIP))
		{
			_token = makeToken(_ttype);
			_token.setText(text.ToString(_begin, text.Length-_begin));
		}
		returnToken_ = _token;
	}
	
	protected void mEXPONENT_PART(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = EXPONENT_PART;
		
		switch ( LA(1) )
		{
		case 'e':
		{
			match("e");
			{    // ( ... )*
				for (;;)
				{
					if ((LA(1)=='+'||LA(1)=='-'))
					{
						mSIGN(false);
					}
					else
					{
						goto _loop597_breakloop;
					}
					
				}
_loop597_breakloop:				;
			}    // ( ... )*
			{ // ( ... )+
			int _cnt599=0;
			for (;;)
			{
				if (((LA(1) >= '0' && LA(1) <= '9')))
				{
					mDECIMAL_DIGIT(false);
				}
				else
				{
					if (_cnt599 >= 1) { goto _loop599_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
				}
				
				_cnt599++;
			}
_loop599_breakloop:			;
			}    // ( ... )+
			break;
		}
		case 'E':
		{
			match("E");
			{    // ( ... )*
				for (;;)
				{
					if ((LA(1)=='+'||LA(1)=='-'))
					{
						mSIGN(false);
					}
					else
					{
						goto _loop601_breakloop;
					}
					
				}
_loop601_breakloop:				;
			}    // ( ... )*
			{ // ( ... )+
			int _cnt603=0;
			for (;;)
			{
				if (((LA(1) >= '0' && LA(1) <= '9')))
				{
					mDECIMAL_DIGIT(false);
				}
				else
				{
					if (_cnt603 >= 1) { goto _loop603_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
				}
				
				_cnt603++;
			}
_loop603_breakloop:			;
			}    // ( ... )+
			break;
		}
		default:
		{
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		 }
		if (_createToken && (null == _token) && (_ttype != Token.SKIP))
		{
			_token = makeToken(_ttype);
			_token.setText(text.ToString(_begin, text.Length-_begin));
		}
		returnToken_ = _token;
	}
	
	protected void mREAL_TYPE_SUFFIX(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = REAL_TYPE_SUFFIX;
		
		switch ( LA(1) )
		{
		case 'F':
		{
			match('F');
			break;
		}
		case 'f':
		{
			match('f');
			break;
		}
		case 'D':
		{
			match('D');
			break;
		}
		case 'd':
		{
			match('d');
			break;
		}
		case 'M':
		{
			match('M');
			break;
		}
		case 'm':
		{
			match('m');
			break;
		}
		default:
		{
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		 }
		if (_createToken && (null == _token) && (_ttype != Token.SKIP))
		{
			_token = makeToken(_ttype);
			_token.setText(text.ToString(_begin, text.Length-_begin));
		}
		returnToken_ = _token;
	}
	
	protected void mINTEGER_TYPE_SUFFIX(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = INTEGER_TYPE_SUFFIX;
		
		{
			if ((LA(1)=='U') && (LA(2)=='L') && (true) && (true))
			{
				match("UL");
			}
			else if ((LA(1)=='L') && (LA(2)=='U') && (true) && (true)) {
				match("LU");
			}
			else if ((LA(1)=='u') && (LA(2)=='l')) {
				match("ul");
			}
			else if ((LA(1)=='l') && (LA(2)=='u')) {
				match("lu");
			}
			else if ((LA(1)=='U') && (LA(2)=='L') && (true) && (true)) {
				match("UL");
			}
			else if ((LA(1)=='L') && (LA(2)=='U') && (true) && (true)) {
				match("LU");
			}
			else if ((LA(1)=='u') && (LA(2)=='L')) {
				match("uL");
			}
			else if ((LA(1)=='l') && (LA(2)=='U')) {
				match("lU");
			}
			else if ((LA(1)=='U') && (true)) {
				match("U");
			}
			else if ((LA(1)=='L') && (true)) {
				match("L");
			}
			else if ((LA(1)=='u') && (true)) {
				match("u");
			}
			else if ((LA(1)=='l') && (true)) {
				match("l");
			}
			else
			{
				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
			}
			
		}
		if (_createToken && (null == _token) && (_ttype != Token.SKIP))
		{
			_token = makeToken(_ttype);
			_token.setText(text.ToString(_begin, text.Length-_begin));
		}
		returnToken_ = _token;
	}
	
	public void mHEXADECIMAL_INTEGER_LITERAL(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = HEXADECIMAL_INTEGER_LITERAL;
		
		if ((LA(1)=='0') && (LA(2)=='x'))
		{
			match("0x");
			{ // ( ... )+
			int _cnt584=0;
			for (;;)
			{
				if ((tokenSet_11_.member(LA(1))))
				{
					mHEX_DIGIT(false);
				}
				else
				{
					if (_cnt584 >= 1) { goto _loop584_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
				}
				
				_cnt584++;
			}
_loop584_breakloop:			;
			}    // ( ... )+
			{
				if ((tokenSet_10_.member(LA(1))))
				{
					mINTEGER_TYPE_SUFFIX(false);
				}
				else {
				}
				
			}
		}
		else if ((LA(1)=='0') && (LA(2)=='X')) {
			match("0X");
			{ // ( ... )+
			int _cnt587=0;
			for (;;)
			{
				if ((tokenSet_11_.member(LA(1))))
				{
					mHEX_DIGIT(false);
				}
				else
				{
					if (_cnt587 >= 1) { goto _loop587_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
				}
				
				_cnt587++;
			}
_loop587_breakloop:			;
			}    // ( ... )+
			{
				if ((tokenSet_10_.member(LA(1))))
				{
					mINTEGER_TYPE_SUFFIX(false);
				}
				else {
				}
				
			}
		}
		else
		{
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		
		if (_createToken && (null == _token) && (_ttype != Token.SKIP))
		{
			_token = makeToken(_ttype);
			_token.setText(text.ToString(_begin, text.Length-_begin));
		}
		returnToken_ = _token;
	}
	
	public void mCHARACTER_LITERAL(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = CHARACTER_LITERAL;
		
		int _saveIndex = 0;
		_saveIndex = text.Length;
		match("'");
		text.Length = _saveIndex;
		mCHARACTER(false);
		_saveIndex = text.Length;
		match("'");
		text.Length = _saveIndex;
		if (_createToken && (null == _token) && (_ttype != Token.SKIP))
		{
			_token = makeToken(_ttype);
			_token.setText(text.ToString(_begin, text.Length-_begin));
		}
		returnToken_ = _token;
	}
	
	protected void mCHARACTER(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = CHARACTER;
		
		if ((LA(1)=='\\') && (tokenSet_12_.member(LA(2))))
		{
			mSIMPLE_ESCAPE_SEQUENCE(false);
		}
		else if ((LA(1)=='\\') && (LA(2)=='x')) {
			mHEXADECIMAL_ESCAPE_SEQUENCE(false);
		}
		else if ((LA(1)=='\\') && (LA(2)=='U'||LA(2)=='u')) {
			mUNICODE_ESCAPE_SEQUENCE(false);
		}
		else if ((tokenSet_13_.member(LA(1)))) {
			mSINGLE_CHARACTER(false);
		}
		else
		{
			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
		}
		
		if (_createToken && (null == _token) && (_ttype != Token.SKIP))
		{
			_token = makeToken(_ttype);
			_token.setText(text.ToString(_begin, text.Length-_begin));
		}
		returnToken_ = _token;
	}
	

⌨️ 快捷键说明

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