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

📄 assigntokentypeswalker.java

📁 ANTLR(ANother Tool for Language Recognition)它是这样的一种工具
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void exceptionSpec(AST _t) throws RecognitionException {				GrammarAST exceptionSpec_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t70 = _t;			GrammarAST tmp53_AST_in = (GrammarAST)_t;			match(_t,LITERAL_exception);			_t = _t.getFirstChild();			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case ARG_ACTION:			{				GrammarAST tmp54_AST_in = (GrammarAST)_t;				match(_t,ARG_ACTION);				_t = _t.getNextSibling();				break;			}			case 3:			case LITERAL_catch:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			{			_loop73:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==LITERAL_catch)) {					exceptionHandler(_t);					_t = _retTree;				}				else {					break _loop73;				}							} while (true);			}			_t = __t70;			_t = _t.getNextSibling();		}		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 __t75 = _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 = __t75;			_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 tmp58_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 tmp59_AST_in = (GrammarAST)_t;				match(_t,WILDCARD);				_t = _t.getNextSibling();				break;			}			case SET:			{				set(_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 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 __t92 = _t;				GrammarAST tmp60_AST_in = (GrammarAST)_t;				match(_t,OPTIONAL);				_t = _t.getFirstChild();				block(_t);				_t = _retTree;				_t = __t92;				_t = _t.getNextSibling();				break;			}			case CLOSURE:			{				AST __t93 = _t;				GrammarAST tmp61_AST_in = (GrammarAST)_t;				match(_t,CLOSURE);				_t = _t.getFirstChild();				block(_t);				_t = _retTree;				_t = __t93;				_t = _t.getNextSibling();				break;			}			case POSITIVE_CLOSURE:			{				AST __t94 = _t;				GrammarAST tmp62_AST_in = (GrammarAST)_t;				match(_t,POSITIVE_CLOSURE);				_t = _t.getFirstChild();				block(_t);				_t = _retTree;				_t = __t94;				_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 __t96 = _t;			GrammarAST tmp63_AST_in = (GrammarAST)_t;			match(_t,TREE_BEGIN);			_t = _t.getFirstChild();			element(_t);			_t = _retTree;			{			_loop98:			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()==SET||_t.getType()==GATED_SEMPRED||_t.getType()==SYN_SEMPRED||_t.getType()==ACTION||_t.getType()==ASSIGN||_t.getType()==STRING_LITERAL||_t.getType()==CHAR_LITERAL||_t.getType()==TOKEN_REF||_t.getType()==PLUS_ASSIGN||_t.getType()==SEMPRED||_t.getType()==NOT||_t.getType()==TREE_BEGIN||_t.getType()==RULE_REF||_t.getType()==WILDCARD)) {					element(_t);					_t = _retTree;				}				else {					break _loop98;				}							} while (true);			}			_t = __t96;			_t = _t.getNextSibling();		}		catch (RecognitionException ex) {			reportError(ex);			if (_t!=null) {_t = _t.getNextSibling();}		}		_retTree = _t;	}		public final void set(AST _t) throws RecognitionException {				GrammarAST set_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;				try {      // for error handling			AST __t102 = _t;			GrammarAST tmp64_AST_in = (GrammarAST)_t;			match(_t,SET);			_t = _t.getFirstChild();			{			int _cnt104=0;			_loop104:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==CHAR_RANGE||_t.getType()==STRING_LITERAL||_t.getType()==CHAR_LITERAL||_t.getType()==TOKEN_REF)) {					setElement(_t);					_t = _retTree;				}				else {					if ( _cnt104>=1 ) { break _loop104; } else {throw new NoViableAltException(_t);}				}								_cnt104++;			} while (true);			}			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case BANG:			case ROOT:			case RULEROOT:			{				ast_suffix(_t);				_t = _retTree;				break;			}			case 3:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			_t = __t102;			_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 tmp65_AST_in = (GrammarAST)_t;				match(_t,ROOT);				_t = _t.getNextSibling();				break;			}			case RULEROOT:			{				GrammarAST tmp66_AST_in = (GrammarAST)_t;				match(_t,RULEROOT);				_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 final void setElement(AST _t) throws RecognitionException {				GrammarAST setElement_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;		GrammarAST c = null;		GrammarAST t = null;		GrammarAST s = null;		GrammarAST c1 = null;		GrammarAST c2 = 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();				trackString(c);				break;			}			case TOKEN_REF:			{				t = (GrammarAST)_t;				match(_t,TOKEN_REF);				_t = _t.getNextSibling();				trackToken(t);				break;			}			case STRING_LITERAL:			{				s = (GrammarAST)_t;				match(_t,STRING_LITERAL);				_t = _t.getNextSibling();				trackString(s);				break;			}			case CHAR_RANGE:			{				AST __t107 = _t;				GrammarAST tmp68_AST_in = (GrammarAST)_t;				match(_t,CHAR_RANGE);				_t = _t.getFirstChild();				c1 = (GrammarAST)_t;				match(_t,CHAR_LITERAL);				_t = _t.getNextSibling();				c2 = (GrammarAST)_t;				match(_t,CHAR_LITERAL);				_t = _t.getNextSibling();				_t = __t107;				_t = _t.getNextSibling();									trackString(c1);					trackString(c2);									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",		"CHARSET",		"SET",		"ID",		"ARG",		"ARGLIST",		"RET",		"LEXER_GRAMMAR",		"PARSER_GRAMMAR",		"TREE_GRAMMAR",		"COMBINED_GRAMMAR",		"INITACTION",		"LABEL",		"TEMPLATE",		"\"scope\"",		"GATED_SEMPRED",		"SYN_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",		"\"exception\"",		"\"catch\"",		"OPEN_ELEMENT_OPTION",		"CLOSE_ELEMENT_OPTION",		"PLUS_ASSIGN",		"SEMPRED",		"IMPLIES",		"NOT",		"TREE_BEGIN",		"QUESTION",		"PLUS",		"RULE_REF",		"WILDCARD",		"ROOT",		"RULEROOT",		"REWRITE",		"DOLLAR",		"DOUBLE_QUOTE_STRING_LITERAL",		"DOUBLE_ANGLE_STRING_LITERAL",		"WS",		"COMMENT",		"SL_COMMENT",		"ML_COMMENT",		"ESC",		"DIGIT",		"XDIGIT",		"NESTED_ARG_ACTION",		"NESTED_ACTION",		"ACTION_CHAR_LITERAL",		"ACTION_STRING_LITERAL",		"ACTION_ESC",		"WS_LOOP",		"INTERNAL_RULE_REF",		"WS_OPT",		"SRC"	};		}	

⌨️ 快捷键说明

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