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

📄 assigntokentypeswalker.java

📁 ANTLR(ANother Tool for Language Recognition)它是这样的一种工具
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
					option(_t,opts);					_t = _retTree;				}				else {					if ( _cnt20>=1 ) { break _loop20; } else {throw new NoViableAltException(_t);}				}								_cnt20++;			} while (true);			}			_t = __t18;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;		return opts;	}		public final void tokensSpec(AST _t) throws RecognitionException {				GrammarAST tokensSpec_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t30 = _t;			GrammarAST tmp7_AST_in = (GrammarAST)_t;			match(_t,TOKENS);			_t = _t.getFirstChild();			{			int _cnt32=0;			_loop32:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==ASSIGN||_t.getType()==TOKEN_REF)) {					tokenSpec(_t);					_t = _retTree;				}				else {					if ( _cnt32>=1 ) { break _loop32; } else {throw new NoViableAltException(_t);}				}								_cnt32++;			} while (true);			}			_t = __t30;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void attrScope(AST _t) throws RecognitionException {				GrammarAST attrScope_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t16 = _t;			GrammarAST tmp8_AST_in = (GrammarAST)_t;			match(_t,SCOPE);			_t = _t.getFirstChild();			GrammarAST tmp9_AST_in = (GrammarAST)_t;			match(_t,ID);			_t = _t.getNextSibling();			GrammarAST tmp10_AST_in = (GrammarAST)_t;			match(_t,ACTION);			_t = _t.getNextSibling();			_t = __t16;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void rules(AST _t) throws RecognitionException {				GrammarAST rules_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			{			int _cnt38=0;			_loop38:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==RULE)) {					rule(_t);					_t = _retTree;				}				else {					if ( _cnt38>=1 ) { break _loop38; } else {throw new NoViableAltException(_t);}				}								_cnt38++;			} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void option(AST _t,		Map opts	) throws RecognitionException {				GrammarAST option_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;		GrammarAST id = null;				String key=null;		Object value=null;						try {      // for error handling			AST __t22 = _t;			GrammarAST tmp11_AST_in = (GrammarAST)_t;			match(_t,ASSIGN);			_t = _t.getFirstChild();			id = (GrammarAST)_t;			match(_t,ID);			_t = _t.getNextSibling();			key=id.getText();			value=optionValue(_t);			_t = _retTree;			_t = __t22;			_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_exception:			{				exceptionGroup(_t);				_t = _retTree;				break;			}

⌨️ 快捷键说明

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