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

📄 csharplexer.cs

📁 C#编写的c#编译器
💻 CS
📖 第 1 页 / 共 5 页
字号:
		{
			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;
		}
		case 'A':
		{
			match('A');
			break;
		}
		case 'B':
		{
			match('B');
			break;
		}
		case 'C':
		{
			match('C');
			break;
		}
		case 'D':
		{
			match('D');
			break;
		}
		case 'E':
		{
			match('E');
			break;
		}
		case 'F':
		{
			match('F');
			break;
		}
		case 'a':
		{
			match('a');
			break;
		}
		case 'b':
		{
			match('b');
			break;
		}
		case 'c':
		{
			match('c');
			break;
		}
		case 'd':
		{
			match('d');
			break;
		}
		case 'e':
		{
			match('e');
			break;
		}
		case 'f':
		{
			match('f');
			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;
	}
	
	public void mIDENTIFIER(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = IDENTIFIER;
		
		mIDENTIFIER_START_CHARACTER(false);
		{    // ( ... )*
			for (;;)
			{
				if ((tokenSet_5_.member(LA(1))))
				{
					mIDENTIFIER_PART_CHARACTER(false);
				}
				else
				{
					goto _loop540_breakloop;
				}
				
			}
_loop540_breakloop:			;
		}    // ( ... )*
		_ttype = testLiteralsTable(_ttype);
		if (_createToken && (null == _token) && (_ttype != Token.SKIP))
		{
			_token = makeToken(_ttype);
			_token.setText(text.ToString(_begin, text.Length-_begin));
		}
		returnToken_ = _token;
	}
	
	protected void mIDENTIFIER_START_CHARACTER(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = IDENTIFIER_START_CHARACTER;
		
		{
			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());
			}
			 }
		}
		if (_createToken && (null == _token) && (_ttype != Token.SKIP))
		{
			_token = makeToken(_ttype);
			_token.setText(text.ToString(_begin, text.Length-_begin));
		}
		returnToken_ = _token;
	}
	
	protected void mIDENTIFIER_PART_CHARACTER(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = IDENTIFIER_PART_CHARACTER;
		
		{
			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:
			{
				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 mNUMERIC_LITERAL(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
{
		int _ttype; Token _token=null; int _begin=text.Length;
		_ttype = NUMERIC_LITERAL;
		
		bool synPredMatched555 = false;
		if ((((LA(1) >= '0' && LA(1) <= '9')) && (tokenSet_2_.member(LA(2))) && (tokenSet_2_.member(LA(3))) && (true)))
		{
			int _m555 = mark();
			synPredMatched555 = true;
			inputState.guessing++;
			try {
				{
					{ // ( ... )+
					int _cnt554=0;
					for (;;)
					{
						if (((LA(1) >= '0' && LA(1) <= '9')))
						{
							mDECIMAL_DIGIT(false);
						}
						else
						{
							if (_cnt554 >= 1) { goto _loop554_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
						}
						
						_cnt554++;
					}
_loop554_breakloop:					;
					}    // ( ... )+
					match('.');
					mDECIMAL_DIGIT(false);
				}
			}
			catch (RecognitionException)
			{
				synPredMatched555 = false;
			}
			rewind(_m555);
			inputState.guessing--;
		}
		if ( synPredMatched555 )
		{
			{ // ( ... )+
			int _cnt557=0;
			for (;;)
			{
				if (((LA(1) >= '0' && LA(1) <= '9')))
				{
					mDECIMAL_DIGIT(false);
				}
				else
				{
					if (_cnt557 >= 1) { goto _loop557_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
				}
				
				_cnt557++;
			}
_loop557_breakloop:			;
			}    // ( ... )+
			match('.');
			{ // ( ... )+
			int _cnt559=0;
			for (;;)
			{
				if (((LA(1) >= '0' && LA(1) <= '9')))
				{
					mDECIMAL_DIGIT(false);
				}
				else
				{
					if (_cnt559 >= 1) { goto _loop559_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
				}
				
				_cnt559++;
			}
_loop559_breakloop:			;
			}    // ( ... )+
			{
				if ((LA(1)=='E'||LA(1)=='e'))
				{
					mEXPONENT_PART(false);
				}
				else {
				}
				
			}
			{
				if ((tokenSet_6_.member(LA(1))))
				{
					mREAL_TYPE_SUFFIX(false);
				}
				else {
				}
				
			}
			if (0==inputState.guessing)
			{
				_ttype = REAL_LITERAL;
			}
		}
		else {
			bool synPredMatched566 = false;
			if ((((LA(1) >= '0' && LA(1) <= '9')) && (tokenSet_7_.member(LA(2))) && (tokenSet_8_.member(LA(3))) && (true)))
			{
				int _m566 = mark();
				synPredMatched566 = true;
				inputState.guessing++;
				try {
					{
						{ // ( ... )+
						int _cnt564=0;
						for (;;)
						{
							if (((LA(1) >= '0' && LA(1) <= '9')))
							{
								mDECIMAL_DIGIT(false);
							}
							else
							{
								if (_cnt564 >= 1) { goto _loop564_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
							}
							
							_cnt564++;
						}
_loop564_breakloop:						;
						}    // ( ... )+
						{
							mEXPONENT_PART(false);
						}
					}
				}
				catch (RecognitionException)
				{
					synPredMatched566 = false;
				}
				rewind(_m566);
				inputState.guessing--;
			}
			if ( synPredMatched566 )
			{
				{ // ( ... )+
				int _cnt568=0;
				for (;;)
				{
					if (((LA(1) >= '0' && LA(1) <= '9')))
					{
						mDECIMAL_DIGIT(false);
					}
					else
					{
						if (_cnt568 >= 1) { goto _loop568_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
					}
					
					_cnt568++;
				}
_loop568_breakloop:				;
				}    // ( ... )+
				{
					mEXPONENT_PART(false);
				}
				{
					if ((tokenSet_6_.member(LA(1))))
					{
						mREAL_TYPE_SUFFIX(false);
					}
					else {
					}
					
				}
				if (0==inputState.guessing)
				{
					_ttype = REAL_LITERAL;
				}
			}
			else {
				bool synPredMatched547 = false;
				if (((LA(1)=='.') && ((LA(2) >= '0' && LA(2) <= '9'))))
				{
					int _m547 = mark();
					synPredMatched547 = true;
					inputState.guessing++;
					try {
						{
							match('.');
							mDECIMAL_DIGIT(false);
						}
					}
					catch (RecognitionException)
					{
						synPredMatched547 = false;
					}
					rewind(_m547);
					inputState.guessing--;
				}
				if ( synPredMatched547 )
				{
					match('.');
					{ // ( ... )+
					int _cnt549=0;
					for (;;)
					{
						if (((LA(1) >= '0' && LA(1) <= '9')))
						{
							mDECIMAL_DIGIT(false);
						}
						else
						{
							if (_cnt549 >= 1) { goto _loop549_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
						}
						
						_cnt549++;
					}
_loop549_breakloop:					;
					}    // ( ... )+
					{
						if ((LA(1)=='E'||LA(1)=='e'))
						{
							mEXPONENT_PART(false);
						}
						else {
						}
						
					}
					{
						if ((tokenSet_6_.member(LA(1))))
						{
							mREAL_TYPE_SUFFIX(false);
						}
						else {
						}
						
					}
					if (0==inputState.guessing)
					{
						_ttype = REAL_LITERAL;
					}
				}
				else {
					bool synPredMatched575 = false;
					if ((((LA(1) >= '0' && LA(1) <= '9')) && (tokenSet_9_.member(LA(2))) && (true) && (true)))
					{
						int _m575 = mark();
						synPredMatched575 = true;

⌨️ 快捷键说明

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