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

📄 antlrlexer.java

📁 antlr最新版本V3源代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
		if ((LA(1)=='?')) {			_saveIndex=text.length();			match('?');			text.setLength(_saveIndex);			if ( inputState.guessing==0 ) {				_ttype = SEMPRED;			}		}		else {		}				}		if ( inputState.guessing==0 ) {									Token t = makeToken(_ttype);						String action = new String(text.getBuffer(),_begin,text.length()-_begin);						action = action.substring(1,action.length()-1);						t.setText(action);						t.setLine(actionLine);			// set action line to start						t.setColumn(actionColumn);						_token = t;							}		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_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = NESTED_ACTION;		int _saveIndex;				match('{');		{		_loop205:		do {			// nongreedy exit test			if ((LA(1)=='}') && (true)) break _loop205;			if ((LA(1)=='\n'||LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				{				switch ( LA(1)) {				case '\r':				{					match('\r');					match('\n');					if ( inputState.guessing==0 ) {						newline();					}					break;				}				case '\n':				{					match('\n');					if ( inputState.guessing==0 ) {						newline();					}					break;				}				default:				{					throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());				}				}				}			}			else if ((LA(1)=='{') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				mNESTED_ACTION(false);			}			else if ((LA(1)=='\'') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				mACTION_CHAR_LITERAL(false);			}			else if ((LA(1)=='/') && (LA(2)=='*'||LA(2)=='/')) {				mCOMMENT(false);			}			else if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				mACTION_STRING_LITERAL(false);			}			else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {				matchNot(EOF_CHAR);			}			else {				break _loop205;			}					} 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 mACTION_CHAR_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = ACTION_CHAR_LITERAL;		int _saveIndex;				match('\'');		{		_loop208:		do {			switch ( LA(1)) {			case '\\':			{				mACTION_ESC(false);				break;			}			case '\n':			{				match('\n');				if ( inputState.guessing==0 ) {					newline();				}				break;			}			default:				if ((_tokenSet_1.member(LA(1)))) {					matchNot('\'');				}			else {				break _loop208;			}			}		} 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 mACTION_ESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = ACTION_ESC;		int _saveIndex;				if ((LA(1)=='\\') && (LA(2)=='\'')) {			match("\\'");		}		else if ((LA(1)=='\\') && (LA(2)=='"')) {			match("\\\"");		}		else if ((LA(1)=='\\') && (_tokenSet_5.member(LA(2)))) {			match('\\');			{			match(_tokenSet_5);			}		}		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 mTOKEN_REF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = TOKEN_REF;		int _saveIndex;				matchRange('A','Z');		{		_loop216:		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;			}			default:			{				break _loop216;			}			}		} while (true);		}		_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 mRULE_REF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = RULE_REF;		int _saveIndex;					int t=0;						t=mINTERNAL_RULE_REF(false);		if ( inputState.guessing==0 ) {			_ttype=t;		}		{		if (( true )&&(t==OPTIONS)) {			mWS_LOOP(false);			{			if ((LA(1)=='{')) {				match('{');				if ( inputState.guessing==0 ) {					_ttype = OPTIONS;				}			}			else {			}						}		}		else if (( true )&&(t==TOKENS)) {			mWS_LOOP(false);			{			if ((LA(1)=='{')) {				match('{');				if ( inputState.guessing==0 ) {					_ttype = TOKENS;				}			}			else {			}						}		}		else {		}				}		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {			_token = makeToken(_ttype);			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));		}		_returnToken = _token;	}		protected final int  mINTERNAL_RULE_REF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int t;		int _ttype; Token _token=null; int _begin=text.length();		_ttype = INTERNAL_RULE_REF;		int _saveIndex;					t = RULE_REF;						matchRange('a','z');		{		_loop226:		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;			}			default:			{				break _loop226;			}			}		} while (true);		}		if ( inputState.guessing==0 ) {			t = testLiteralsTable(t);		}		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {			_token = makeToken(_ttype);			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));		}		_returnToken = _token;		return t;	}		protected final void mWS_LOOP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = WS_LOOP;		int _saveIndex;				{		_loop223:		do {			switch ( LA(1)) {			case '\t':  case '\n':  case '\r':  case ' ':			{				mWS(false);				break;			}			case '/':			{				mCOMMENT(false);				break;			}			default:			{				break _loop223;			}			}		} while (true);		}		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 mWS_OPT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {		int _ttype; Token _token=null; int _begin=text.length();		_ttype = WS_OPT;		int _saveIndex;				{		if ((_tokenSet_6.member(LA(1)))) {			mWS(false);		}		else {		}				}		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {			_token = makeToken(_ttype);			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));		}		_returnToken = _token;	}			private static final long[] mk_tokenSet_0() {		long[] data = new long[8];		data[0]=-9224L;		for (int i = 1; i<=3; i++) { data[i]=-1L; }		return data;	}	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());	private static final long[] mk_tokenSet_1() {		long[] data = new long[8];		data[0]=-549755814920L;		data[1]=-268435457L;		for (int i = 2; i<=3; i++) { data[i]=-1L; }		return data;	}	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());	private static final long[] mk_tokenSet_2() {		long[] data = { 287948901175001088L, 541165879422L, 0L, 0L, 0L};		return data;	}	public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());	private static final long[] mk_tokenSet_3() {		long[] data = new long[8];		data[0]=-17179870216L;		data[1]=-268435457L;		for (int i = 2; i<=3; i++) { data[i]=-1L; }		return data;	}	public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());	private static final long[] mk_tokenSet_4() {		long[] data = new long[8];		data[0]=-17179878408L;		data[1]=-671088641L;		for (int i = 2; i<=3; i++) { data[i]=-1L; }		return data;	}	public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());	private static final long[] mk_tokenSet_5() {		long[] data = new long[8];		data[0]=-566935683080L;		for (int i = 1; i<=3; i++) { data[i]=-1L; }		return data;	}	public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());	private static final long[] mk_tokenSet_6() {		long[] data = { 4294977024L, 0L, 0L, 0L, 0L};		return data;	}	public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());		}

⌨️ 快捷键说明

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