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

📄 assigntokentypeswalker.java

📁 antlr最新版本V3源代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
			_t = _t.getNextSibling();						opts.put(key,value);			// check for grammar-level option to import vocabulary			if ( currentRuleName==null && key.equals("tokenVocab") ) {			grammar.importTokenVocabulary((String)value);			}					}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final Object  optionValue(AST _t) throws RecognitionException {		Object value=null;				GrammarAST optionValue_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;		GrammarAST id = null;		GrammarAST s = null;		GrammarAST c = null;		GrammarAST i = null;				try {      // for error handling			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case ID:			{				id = (GrammarAST)_t;				match(_t,ID);				_t = _t.getNextSibling();				value = id.getText();				break;			}			case STRING_LITERAL:			{				s = (GrammarAST)_t;				match(_t,STRING_LITERAL);				_t = _t.getNextSibling();				value = s.getText();				break;			}			case CHAR_LITERAL:			{				c = (GrammarAST)_t;				match(_t,CHAR_LITERAL);				_t = _t.getNextSibling();				value = c.getText();				break;			}			case INT:			{				i = (GrammarAST)_t;				match(_t,INT);				_t = _t.getNextSibling();				value = new Integer(i.getText());				break;			}			default:			{				throw new NoViableAltException(_t);			}			}		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;		return value;	}		public final void charSet(AST _t) throws RecognitionException {				GrammarAST charSet_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t25 = _t;			GrammarAST tmp12_AST_in = (GrammarAST)_t;			match(_t,CHARSET);			_t = _t.getFirstChild();			charSetElement(_t);			_t = _retTree;			_t = __t25;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void charSetElement(AST _t) throws RecognitionException {				GrammarAST charSetElement_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;		GrammarAST c = null;		GrammarAST c1 = null;		GrammarAST c2 = null;		GrammarAST c3 = null;		GrammarAST c4 = null;				try {      // for error handling			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case CHAR_LITERAL:			{				c = (GrammarAST)_t;				match(_t,CHAR_LITERAL);				_t = _t.getNextSibling();				break;			}			case OR:			{				AST __t27 = _t;				GrammarAST tmp13_AST_in = (GrammarAST)_t;				match(_t,OR);				_t = _t.getFirstChild();				c1 = (GrammarAST)_t;				match(_t,CHAR_LITERAL);				_t = _t.getNextSibling();				c2 = (GrammarAST)_t;				match(_t,CHAR_LITERAL);				_t = _t.getNextSibling();				_t = __t27;				_t = _t.getNextSibling();				break;			}			case RANGE:			{				AST __t28 = _t;				GrammarAST tmp14_AST_in = (GrammarAST)_t;				match(_t,RANGE);				_t = _t.getFirstChild();				c3 = (GrammarAST)_t;				match(_t,CHAR_LITERAL);				_t = _t.getNextSibling();				c4 = (GrammarAST)_t;				match(_t,CHAR_LITERAL);				_t = _t.getNextSibling();				_t = __t28;				_t = _t.getNextSibling();				break;			}			default:			{				throw new NoViableAltException(_t);			}			}		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void tokenSpec(AST _t) throws RecognitionException {				GrammarAST tokenSpec_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;		GrammarAST t = null;		GrammarAST t2 = null;		GrammarAST s = null;		GrammarAST c = null;				try {      // for error handling			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case TOKEN_REF:			{				t = (GrammarAST)_t;				match(_t,TOKEN_REF);				_t = _t.getNextSibling();				trackToken(t);				break;			}			case ASSIGN:			{				AST __t34 = _t;				GrammarAST tmp15_AST_in = (GrammarAST)_t;				match(_t,ASSIGN);				_t = _t.getFirstChild();				t2 = (GrammarAST)_t;				match(_t,TOKEN_REF);				_t = _t.getNextSibling();				trackToken(t2);				{				if (_t==null) _t=ASTNULL;				switch ( _t.getType()) {				case STRING_LITERAL:				{					s = (GrammarAST)_t;					match(_t,STRING_LITERAL);					_t = _t.getNextSibling();					trackString(s); alias(t2,s);					break;				}				case CHAR_LITERAL:				{					c = (GrammarAST)_t;					match(_t,CHAR_LITERAL);					_t = _t.getNextSibling();					trackString(c); alias(t2,c);					break;				}				default:				{					throw new NoViableAltException(_t);				}				}				}				_t = __t34;				_t = _t.getNextSibling();				break;			}			default:			{				throw new NoViableAltException(_t);			}			}		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void rule(AST _t) throws RecognitionException {				GrammarAST rule_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;		GrammarAST id = null;		GrammarAST m = null;		GrammarAST b = null;				try {      // for error handling			AST __t40 = _t;			GrammarAST tmp16_AST_in = (GrammarAST)_t;			match(_t,RULE);			_t = _t.getFirstChild();			id = (GrammarAST)_t;			match(_t,ID);			_t = _t.getNextSibling();			currentRuleName=id.getText();			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case FRAGMENT:			case LITERAL_protected:			case LITERAL_public:			case LITERAL_private:			{				m = _t==ASTNULL ? null : (GrammarAST)_t;				modifier(_t);				_t = _retTree;				break;			}			case ARG:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			{			GrammarAST tmp17_AST_in = (GrammarAST)_t;			match(_t,ARG);			_t = _t.getNextSibling();			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case ARG_ACTION:			{				GrammarAST tmp18_AST_in = (GrammarAST)_t;				match(_t,ARG_ACTION);				_t = _t.getNextSibling();				break;			}			case RET:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			}			{			GrammarAST tmp19_AST_in = (GrammarAST)_t;			match(_t,RET);			_t = _t.getNextSibling();			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case ARG_ACTION:			{				GrammarAST tmp20_AST_in = (GrammarAST)_t;				match(_t,ARG_ACTION);				_t = _t.getNextSibling();				break;			}			case OPTIONS:			case BLOCK:			case SCOPE:			case AMPERSAND:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			}			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case OPTIONS:			{				optionsSpec(_t);				_t = _retTree;				break;			}			case BLOCK:			case SCOPE:			case AMPERSAND:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case SCOPE:			{				ruleScopeSpec(_t);				_t = _retTree;				break;			}			case BLOCK:			case AMPERSAND:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			{			_loop49:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==AMPERSAND)) {					GrammarAST tmp21_AST_in = (GrammarAST)_t;					match(_t,AMPERSAND);					_t = _t.getNextSibling();				}				else {					break _loop49;				}							} while (true);			}			b = _t==ASTNULL ? null : (GrammarAST)_t;			block(_t);			_t = _retTree;			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case LITERAL_catch:			case LITERAL_finally:			{				exceptionGroup(_t);				_t = _retTree;				break;			}			case EOR:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			GrammarAST tmp22_AST_in = (GrammarAST)_t;			match(_t,EOR);			_t = _t.getNextSibling();			trackTokenRule(id,m,b);			_t = __t40;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void modifier(AST _t) throws RecognitionException {				GrammarAST modifier_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case LITERAL_protected:			{				GrammarAST tmp23_AST_in = (GrammarAST)_t;				match(_t,LITERAL_protected);				_t = _t.getNextSibling();				break;			}			case LITERAL_public:			{				GrammarAST tmp24_AST_in = (GrammarAST)_t;				match(_t,LITERAL_public);				_t = _t.getNextSibling();				break;			}			case LITERAL_private:			{				GrammarAST tmp25_AST_in = (GrammarAST)_t;				match(_t,LITERAL_private);				_t = _t.getNextSibling();				break;			}			case FRAGMENT:			{				GrammarAST tmp26_AST_in = (GrammarAST)_t;				match(_t,FRAGMENT);				_t = _t.getNextSibling();				break;			}			default:			{				throw new NoViableAltException(_t);			}			}		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void ruleScopeSpec(AST _t) throws RecognitionException {				GrammarAST ruleScopeSpec_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t53 = _t;			GrammarAST tmp27_AST_in = (GrammarAST)_t;			match(_t,SCOPE);			_t = _t.getFirstChild();			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case ACTION:			{				GrammarAST tmp28_AST_in = (GrammarAST)_t;				match(_t,ACTION);				_t = _t.getNextSibling();				break;			}			case 3:			case ID:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			{			_loop56:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==ID)) {					GrammarAST tmp29_AST_in = (GrammarAST)_t;					match(_t,ID);					_t = _t.getNextSibling();				}				else {					break _loop56;				}							} while (true);			}			_t = __t53;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void block(AST _t) throws RecognitionException {				GrammarAST block_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t58 = _t;			GrammarAST tmp30_AST_in = (GrammarAST)_t;			match(_t,BLOCK);			_t = _t.getFirstChild();			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case OPTIONS:			{				optionsSpec(_t);				_t = _retTree;				break;			}			case ALT:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			{			int _cnt61=0;			_loop61:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==ALT)) {					alternative(_t);					_t = _retTree;					rewrite(_t);					_t = _retTree;				}				else {					if ( _cnt61>=1 ) { break _loop61; } else {throw new NoViableAltException(_t);}				}								_cnt61++;			} while (true);			}			GrammarAST tmp31_AST_in = (GrammarAST)_t;			match(_t,EOB);			_t = _t.getNextSibling();			_t = __t58;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void exceptionGroup(AST _t) throws RecognitionException {				GrammarAST exceptionGroup_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case LITERAL_catch:			{				{				int _cnt68=0;				_loop68:				do {					if (_t==null) _t=ASTNULL;					if ((_t.getType()==LITERAL_catch)) {						exceptionHandler(_t);						_t = _retTree;					}					else {						if ( _cnt68>=1 ) { break _loop68; } else {throw new NoViableAltException(_t);}					}										_cnt68++;				} while (true);				}				{				if (_t==null) _t=ASTNULL;				switch ( _t.getType()) {				case LITERAL_finally:				{					finallyClause(_t);					_t = _retTree;					break;				}				case EOR:				{					break;				}				default:				{					throw new NoViableAltException(_t);				}				}				}				break;			}			case LITERAL_finally:			{				finallyClause(_t);				_t = _retTree;				break;			}			default:			{				throw new NoViableAltException(_t);			}			}		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void alternative(AST _t) throws RecognitionException {				GrammarAST alternative_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t63 = _t;			GrammarAST tmp32_AST_in = (GrammarAST)_t;			match(_t,ALT);

⌨️ 快捷键说明

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