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

📄 assigntokentypeswalker.java

📁 antlr最新版本V3源代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
			_t = _t.getFirstChild();			{			int _cnt65=0;			_loop65:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==BLOCK||_t.getType()==OPTIONAL||_t.getType()==CLOSURE||_t.getType()==POSITIVE_CLOSURE||_t.getType()==SYNPRED||_t.getType()==RANGE||_t.getType()==CHAR_RANGE||_t.getType()==EPSILON||_t.getType()==GATED_SEMPRED||_t.getType()==SYN_SEMPRED||_t.getType()==BACKTRACK_SEMPRED||_t.getType()==ACTION||_t.getType()==ASSIGN||_t.getType()==STRING_LITERAL||_t.getType()==CHAR_LITERAL||_t.getType()==TOKEN_REF||_t.getType()==BANG||_t.getType()==PLUS_ASSIGN||_t.getType()==SEMPRED||_t.getType()==ROOT||_t.getType()==RULE_REF||_t.getType()==NOT||_t.getType()==TREE_BEGIN||_t.getType()==WILDCARD)) {					element(_t);					_t = _retTree;				}				else {					if ( _cnt65>=1 ) { break _loop65; } else {throw new NoViableAltException(_t);}				}								_cnt65++;			} while (true);			}			GrammarAST tmp33_AST_in = (GrammarAST)_t;			match(_t,EOA);			_t = _t.getNextSibling();			_t = __t63;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void rewrite(AST _t) throws RecognitionException {				GrammarAST rewrite_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			{			_loop79:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==REWRITE)) {					AST __t76 = _t;					GrammarAST tmp34_AST_in = (GrammarAST)_t;					match(_t,REWRITE);					_t = _t.getFirstChild();					{					if (_t==null) _t=ASTNULL;					switch ( _t.getType()) {					case SEMPRED:					{						GrammarAST tmp35_AST_in = (GrammarAST)_t;						match(_t,SEMPRED);						_t = _t.getNextSibling();						break;					}					case ALT:					case TEMPLATE:					case ACTION:					{						break;					}					default:					{						throw new NoViableAltException(_t);					}					}					}					{					if (_t==null) _t=ASTNULL;					switch ( _t.getType()) {					case ALT:					{						GrammarAST tmp36_AST_in = (GrammarAST)_t;						match(_t,ALT);						_t = _t.getNextSibling();						break;					}					case TEMPLATE:					{						GrammarAST tmp37_AST_in = (GrammarAST)_t;						match(_t,TEMPLATE);						_t = _t.getNextSibling();						break;					}					case ACTION:					{						GrammarAST tmp38_AST_in = (GrammarAST)_t;						match(_t,ACTION);						_t = _t.getNextSibling();						break;					}					default:					{						throw new NoViableAltException(_t);					}					}					}					_t = __t76;					_t = _t.getNextSibling();				}				else {					break _loop79;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void element(AST _t) throws RecognitionException {				GrammarAST element_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case ROOT:			{				AST __t81 = _t;				GrammarAST tmp39_AST_in = (GrammarAST)_t;				match(_t,ROOT);				_t = _t.getFirstChild();				element(_t);				_t = _retTree;				_t = __t81;				_t = _t.getNextSibling();				break;			}			case BANG:			{				AST __t82 = _t;				GrammarAST tmp40_AST_in = (GrammarAST)_t;				match(_t,BANG);				_t = _t.getFirstChild();				element(_t);				_t = _retTree;				_t = __t82;				_t = _t.getNextSibling();				break;			}			case STRING_LITERAL:			case CHAR_LITERAL:			case TOKEN_REF:			case RULE_REF:			case WILDCARD:			{				atom(_t);				_t = _retTree;				break;			}			case NOT:			{				AST __t83 = _t;				GrammarAST tmp41_AST_in = (GrammarAST)_t;				match(_t,NOT);				_t = _t.getFirstChild();				element(_t);				_t = _retTree;				_t = __t83;				_t = _t.getNextSibling();				break;			}			case RANGE:			{				AST __t84 = _t;				GrammarAST tmp42_AST_in = (GrammarAST)_t;				match(_t,RANGE);				_t = _t.getFirstChild();				atom(_t);				_t = _retTree;				atom(_t);				_t = _retTree;				_t = __t84;				_t = _t.getNextSibling();				break;			}			case CHAR_RANGE:			{				AST __t85 = _t;				GrammarAST tmp43_AST_in = (GrammarAST)_t;				match(_t,CHAR_RANGE);				_t = _t.getFirstChild();				atom(_t);				_t = _retTree;				atom(_t);				_t = _retTree;				_t = __t85;				_t = _t.getNextSibling();				break;			}			case ASSIGN:			{				AST __t86 = _t;				GrammarAST tmp44_AST_in = (GrammarAST)_t;				match(_t,ASSIGN);				_t = _t.getFirstChild();				GrammarAST tmp45_AST_in = (GrammarAST)_t;				match(_t,ID);				_t = _t.getNextSibling();				element(_t);				_t = _retTree;				_t = __t86;				_t = _t.getNextSibling();				break;			}			case PLUS_ASSIGN:			{				AST __t87 = _t;				GrammarAST tmp46_AST_in = (GrammarAST)_t;				match(_t,PLUS_ASSIGN);				_t = _t.getFirstChild();				GrammarAST tmp47_AST_in = (GrammarAST)_t;				match(_t,ID);				_t = _t.getNextSibling();				element(_t);				_t = _retTree;				_t = __t87;				_t = _t.getNextSibling();				break;			}			case BLOCK:			case OPTIONAL:			case CLOSURE:			case POSITIVE_CLOSURE:			{				ebnf(_t);				_t = _retTree;				break;			}			case TREE_BEGIN:			{				tree(_t);				_t = _retTree;				break;			}			case SYNPRED:			{				AST __t88 = _t;				GrammarAST tmp48_AST_in = (GrammarAST)_t;				match(_t,SYNPRED);				_t = _t.getFirstChild();				block(_t);				_t = _retTree;				_t = __t88;				_t = _t.getNextSibling();				break;			}			case ACTION:			{				GrammarAST tmp49_AST_in = (GrammarAST)_t;				match(_t,ACTION);				_t = _t.getNextSibling();				break;			}			case SEMPRED:			{				GrammarAST tmp50_AST_in = (GrammarAST)_t;				match(_t,SEMPRED);				_t = _t.getNextSibling();				break;			}			case SYN_SEMPRED:			{				GrammarAST tmp51_AST_in = (GrammarAST)_t;				match(_t,SYN_SEMPRED);				_t = _t.getNextSibling();				break;			}			case BACKTRACK_SEMPRED:			{				GrammarAST tmp52_AST_in = (GrammarAST)_t;				match(_t,BACKTRACK_SEMPRED);				_t = _t.getNextSibling();				break;			}			case GATED_SEMPRED:			{				GrammarAST tmp53_AST_in = (GrammarAST)_t;				match(_t,GATED_SEMPRED);				_t = _t.getNextSibling();				break;			}			case EPSILON:			{				GrammarAST tmp54_AST_in = (GrammarAST)_t;				match(_t,EPSILON);				_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 exceptionHandler(AST _t) throws RecognitionException {				GrammarAST exceptionHandler_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t71 = _t;			GrammarAST tmp55_AST_in = (GrammarAST)_t;			match(_t,LITERAL_catch);			_t = _t.getFirstChild();			GrammarAST tmp56_AST_in = (GrammarAST)_t;			match(_t,ARG_ACTION);			_t = _t.getNextSibling();			GrammarAST tmp57_AST_in = (GrammarAST)_t;			match(_t,ACTION);			_t = _t.getNextSibling();			_t = __t71;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void finallyClause(AST _t) throws RecognitionException {				GrammarAST finallyClause_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t73 = _t;			GrammarAST tmp58_AST_in = (GrammarAST)_t;			match(_t,LITERAL_finally);			_t = _t.getFirstChild();			GrammarAST tmp59_AST_in = (GrammarAST)_t;			match(_t,ACTION);			_t = _t.getNextSibling();			_t = __t73;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void atom(AST _t) throws RecognitionException {				GrammarAST atom_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;		GrammarAST t = null;		GrammarAST c = null;		GrammarAST s = null;				try {      // for error handling			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case RULE_REF:			{				GrammarAST tmp60_AST_in = (GrammarAST)_t;				match(_t,RULE_REF);				_t = _t.getNextSibling();				break;			}			case TOKEN_REF:			{				t = (GrammarAST)_t;				match(_t,TOKEN_REF);				_t = _t.getNextSibling();				trackToken(t);				break;			}			case CHAR_LITERAL:			{				c = (GrammarAST)_t;				match(_t,CHAR_LITERAL);				_t = _t.getNextSibling();				trackString(c);				break;			}			case STRING_LITERAL:			{				s = (GrammarAST)_t;				match(_t,STRING_LITERAL);				_t = _t.getNextSibling();				trackString(s);				break;			}			case WILDCARD:			{				GrammarAST tmp61_AST_in = (GrammarAST)_t;				match(_t,WILDCARD);				_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 ebnf(AST _t) throws RecognitionException {				GrammarAST ebnf_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case BLOCK:			{				block(_t);				_t = _retTree;				break;			}			case OPTIONAL:			{				AST __t90 = _t;				GrammarAST tmp62_AST_in = (GrammarAST)_t;				match(_t,OPTIONAL);				_t = _t.getFirstChild();				block(_t);				_t = _retTree;				_t = __t90;				_t = _t.getNextSibling();				break;			}			case CLOSURE:			{				AST __t91 = _t;				GrammarAST tmp63_AST_in = (GrammarAST)_t;				match(_t,CLOSURE);				_t = _t.getFirstChild();				block(_t);				_t = _retTree;				_t = __t91;				_t = _t.getNextSibling();				break;			}			case POSITIVE_CLOSURE:			{				AST __t92 = _t;				GrammarAST tmp64_AST_in = (GrammarAST)_t;				match(_t,POSITIVE_CLOSURE);				_t = _t.getFirstChild();				block(_t);				_t = _retTree;				_t = __t92;				_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 tree(AST _t) throws RecognitionException {				GrammarAST tree_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t94 = _t;			GrammarAST tmp65_AST_in = (GrammarAST)_t;			match(_t,TREE_BEGIN);			_t = _t.getFirstChild();			element(_t);			_t = _retTree;			{			_loop96:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==BLOCK||_t.getType()==OPTIONAL||_t.getType()==CLOSURE||_t.getType()==POSITIVE_CLOSURE||_t.getType()==SYNPRED||_t.getType()==RANGE||_t.getType()==CHAR_RANGE||_t.getType()==EPSILON||_t.getType()==GATED_SEMPRED||_t.getType()==SYN_SEMPRED||_t.getType()==BACKTRACK_SEMPRED||_t.getType()==ACTION||_t.getType()==ASSIGN||_t.getType()==STRING_LITERAL||_t.getType()==CHAR_LITERAL||_t.getType()==TOKEN_REF||_t.getType()==BANG||_t.getType()==PLUS_ASSIGN||_t.getType()==SEMPRED||_t.getType()==ROOT||_t.getType()==RULE_REF||_t.getType()==NOT||_t.getType()==TREE_BEGIN||_t.getType()==WILDCARD)) {					element(_t);					_t = _retTree;				}				else {					break _loop96;				}							} while (true);			}			_t = __t94;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void ast_suffix(AST _t) throws RecognitionException {				GrammarAST ast_suffix_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case ROOT:			{				GrammarAST tmp66_AST_in = (GrammarAST)_t;				match(_t,ROOT);				_t = _t.getNextSibling();				break;			}			case BANG:			{				GrammarAST tmp67_AST_in = (GrammarAST)_t;				match(_t,BANG);				_t = _t.getNextSibling();				break;			}			default:			{				throw new NoViableAltException(_t);			}			}		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}			public static final String[] _tokenNames = {		"<0>",		"EOF",		"<2>",		"NULL_TREE_LOOKAHEAD",		"\"options\"",		"\"tokens\"",		"\"parser\"",		"LEXER",		"RULE",		"BLOCK",		"OPTIONAL",		"CLOSURE",		"POSITIVE_CLOSURE",		"SYNPRED",		"RANGE",		"CHAR_RANGE",		"EPSILON",		"ALT",		"EOR",		"EOB",		"EOA",		"ID",		"ARG",		"ARGLIST",		"RET",		"LEXER_GRAMMAR",		"PARSER_GRAMMAR",		"TREE_GRAMMAR",		"COMBINED_GRAMMAR",		"INITACTION",		"LABEL",		"TEMPLATE",		"\"scope\"",		"GATED_SEMPRED",		"SYN_SEMPRED",		"BACKTRACK_SEMPRED",		"\"fragment\"",		"ACTION",		"DOC_COMMENT",		"SEMI",		"\"lexer\"",		"\"tree\"",		"\"grammar\"",		"AMPERSAND",		"COLON",		"RCURLY",		"ASSIGN",		"STRING_LITERAL",		"CHAR_LITERAL",		"INT",		"STAR",		"TOKEN_REF",		"\"protected\"",		"\"public\"",		"\"private\"",		"BANG",		"ARG_ACTION",		"\"returns\"",		"\"throws\"",		"COMMA",		"LPAREN",		"OR",		"RPAREN",		"\"catch\"",		"\"finally\"",		"PLUS_ASSIGN",		"SEMPRED",		"IMPLIES",		"ROOT",		"RULE_REF",		"NOT",		"TREE_BEGIN",		"QUESTION",		"PLUS",		"WILDCARD",		"REWRITE",		"DOLLAR",		"DOUBLE_QUOTE_STRING_LITERAL",		"DOUBLE_ANGLE_STRING_LITERAL",		"WS",		"COMMENT",		"SL_COMMENT",		"ML_COMMENT",		"OPEN_ELEMENT_OPTION",		"CLOSE_ELEMENT_OPTION",		"ESC",		"DIGIT",		"XDIGIT",		"NESTED_ARG_ACTION",		"NESTED_ACTION",		"ACTION_CHAR_LITERAL",		"ACTION_STRING_LITERAL",		"ACTION_ESC",		"WS_LOOP",		"INTERNAL_RULE_REF",		"WS_OPT",		"SRC",		"CHARSET"	};		}	

⌨️ 快捷键说明

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