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

📄 goclparser.java

📁 UML设计测试工具
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	}		public final ASTExpression  multiplicativeExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=unaryExpression();			{			_loop41:			do {				if (((LA(1) >= STAR && LA(1) <= LITERAL_div))) {					MyToken op = (MyToken) LT(1);					{					switch ( LA(1)) {					case STAR:					{						match(STAR);						break;					}					case SLASH:					{						match(SLASH);						break;					}					case LITERAL_div:					{						match(LITERAL_div);						break;					}					default:					{						throw new NoViableAltException(LT(1), getFilename());					}					}					}					n1=unaryExpression();					n = new ASTBinaryExpression(op, n, n1);				}				else {					break _loop41;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_11);		}		return n;	}		public final ASTExpression  unaryExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				n = null;				try {      // for error handling			switch ( LA(1)) {			case PLUS:			case MINUS:			case LITERAL_not:			{				{				MyToken op = (MyToken) LT(1);				{				switch ( LA(1)) {				case LITERAL_not:				{					match(LITERAL_not);					break;				}				case MINUS:				{					match(MINUS);					break;				}				case PLUS:				{					match(PLUS);					break;				}				default:				{					throw new NoViableAltException(LT(1), getFilename());				}				}				}				n=unaryExpression();				n = new ASTUnaryExpression((MyToken) op, n);				}				break;			}			case LPAREN:			case IDENT:			case LITERAL_iterate:			case LITERAL_oclAsType:			case LITERAL_oclIsKindOf:			case LITERAL_oclIsTypeOf:			case LITERAL_if:			case LITERAL_true:			case LITERAL_false:			case INT:			case REAL:			case STRING:			case HASH:			case LITERAL_Set:			case LITERAL_Sequence:			case LITERAL_Bag:			case LITERAL_oclEmpty:			case LITERAL_oclUndefined:			case LITERAL_Tuple:			{				n=postfixExpression();				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_12);		}		return n;	}		public final ASTExpression  postfixExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				boolean arrow; n = null;				try {      // for error handling			n=primaryExpression();			{			_loop48:			do {				if ((LA(1)==ARROW||LA(1)==DOT)) {					{					switch ( LA(1)) {					case ARROW:					{						match(ARROW);						arrow = true;						break;					}					case DOT:					{						match(DOT);						arrow = false;						break;					}					default:					{						throw new NoViableAltException(LT(1), getFilename());					}					}					}					n=propertyCall(n, arrow);				}				else {					break _loop48;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_12);		}		return n;	}		public final ASTExpression  primaryExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  id1 = null;		n = null;				try {      // for error handling			switch ( LA(1)) {			case LITERAL_true:			case LITERAL_false:			case INT:			case REAL:			case STRING:			case HASH:			case LITERAL_Set:			case LITERAL_Sequence:			case LITERAL_Bag:			case LITERAL_oclEmpty:			case LITERAL_oclUndefined:			case LITERAL_Tuple:			{				n=literal();				break;			}			case LPAREN:			{				match(LPAREN);				n=expression();				match(RPAREN);				break;			}			case LITERAL_if:			{				n=ifExpression();				break;			}			default:				if ((_tokenSet_13.member(LA(1))) && (_tokenSet_14.member(LA(2))) && (_tokenSet_15.member(LA(3)))) {					n=propertyCall(null, false);				}				else if ((LA(1)==IDENT) && (LA(2)==DOT) && (LA(3)==LITERAL_allInstances)) {					id1 = LT(1);					match(IDENT);					match(DOT);					match(LITERAL_allInstances);					n = new ASTAllInstancesExpression((MyToken) id1);				}			else {				throw new NoViableAltException(LT(1), getFilename());			}			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_16);		}		return n;	}		public final ASTExpression  propertyCall(		ASTExpression source, boolean followsArrow	) throws RecognitionException, TokenStreamException {		ASTExpression n;				n = null;				try {      // for error handling			switch ( LA(1)) {			case LITERAL_iterate:			{				n=iterateExpression(source);				break;			}			case LITERAL_oclAsType:			case LITERAL_oclIsKindOf:			case LITERAL_oclIsTypeOf:			{				n=typeExpression(source, followsArrow);				break;			}			default:				if (((LA(1)==IDENT) && (LA(2)==LPAREN) && (_tokenSet_17.member(LA(3))) && (_tokenSet_18.member(LA(4))) && (_tokenSet_19.member(LA(5))))&&( isQueryIdent(LT(1)) )) {					n=queryExpression(source);				}				else if ((LA(1)==IDENT) && (_tokenSet_14.member(LA(2))) && (_tokenSet_20.member(LA(3))) && (_tokenSet_21.member(LA(4))) && (_tokenSet_19.member(LA(5)))) {					n=operationExpression(source, followsArrow);				}			else {				throw new NoViableAltException(LT(1), getFilename());			}			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_16);		}		return n;	}		public final ASTExpression  literal() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  t = null;		Token  f = null;		Token  i = null;		Token  r = null;		Token  s = null;		Token  enumLit = null;		n = null;				try {      // for error handling			switch ( LA(1)) {			case LITERAL_true:			{				t = LT(1);				match(LITERAL_true);				n = new ASTBooleanLiteral(true);				break;			}			case LITERAL_false:			{				f = LT(1);				match(LITERAL_false);				n = new ASTBooleanLiteral(false);				break;			}			case INT:			{				i = LT(1);				match(INT);				n = new ASTIntegerLiteral((MyToken) i);				break;			}			case REAL:			{				r = LT(1);				match(REAL);				n = new ASTRealLiteral((MyToken) r);				break;			}			case STRING:			{				s = LT(1);				match(STRING);				n = new ASTStringLiteral((MyToken) s);				break;			}			case HASH:			{				match(HASH);				enumLit = LT(1);				match(IDENT);				n = new ASTEnumLiteral((MyToken) enumLit);				break;			}			case LITERAL_Set:			case LITERAL_Sequence:			case LITERAL_Bag:			{				n=collectionLiteral();				break;			}			case LITERAL_oclEmpty:			{				n=emptyCollectionLiteral();				break;			}			case LITERAL_oclUndefined:			{				n=undefinedLiteral();				break;			}			case LITERAL_Tuple:			{				n=tupleLiteral();				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_16);		}		return n;	}		public final ASTExpression  ifExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  i = null;		ASTExpression cond, t, e; n = null;				try {      // for error handling			i = LT(1);			match(LITERAL_if);			cond=expression();			match(LITERAL_then);			t=expression();			match(LITERAL_else);			e=expression();			match(LITERAL_endif);			n = new ASTIfExpression((MyToken) i, cond, t, e);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_16);		}		return n;	}		public final ASTExpression  queryExpression(		ASTExpression range	) throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;				ASTElemVarsDeclaration decls = new ASTElemVarsDeclaration(); 		n = null; 						try {      // for error handling			op = LT(1);			match(IDENT);			match(LPAREN);			{			if ((LA(1)==IDENT) && (LA(2)==COMMA||LA(2)==COLON||LA(2)==BAR)) {				decls=elemVarsDeclaration();				match(BAR);			}			else if ((_tokenSet_17.member(LA(1))) && (_tokenSet_22.member(LA(2)))) {			}			else {				throw new NoViableAltException(LT(1), getFilename());			}						}			n=expression();			match(RPAREN);			n = new ASTQueryExpression((MyToken) op, range, decls, n);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_16);		}		return n;	}		public final ASTExpression  iterateExpression(		ASTExpression range	) throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  i = null;				ASTElemVarsDeclaration decls = null; 		ASTVariableInitialization init = null; 		n = null;						try {      // for error handling			i = LT(1);			match(LITERAL_iterate);			match(LPAREN);			decls=elemVarsDeclaration();			match(SEMI);			init=variableInitialization();			match(BAR);			n=expression();			match(RPAREN);			n = new ASTIterateExpression((MyToken) i, range, decls, init, n);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_16);		}		return n;	}		public final ASTOperationExpression  operationExpression(		ASTExpression source, boolean followsArrow	) throws RecognitionException, TokenStreamException {		ASTOperationExpression n;				Token  name = null;		Token  rolename = null;		ASTExpression e; n = null;				try {      // for error handling			name = LT(1);			match(IDENT);			n = new ASTOperationExpression((MyToken) name, source, followsArrow);			{			switch ( LA(1)) {			case LBRACK:			{				match(LBRACK);				rolename = LT(1);				match(IDENT);				match(RBRACK);				n.setExplicitRolename((MyToken) rolename);				break;			}			case EOF:			case LPAREN:			case COMMA:			case RPAREN:			case EQUAL:			case LITERAL_in:			case LITERAL_implies:			case LITERAL_or:			case LITERAL_xor:			case LITERAL_and:			case NOT_EQUAL:			case LESS:			case GREATER:			case LESS_EQUAL:			case GREATER_EQUAL:			case PLUS:			case MINUS:			case STAR:			case SLASH:			case LITERAL_div:			case ARROW:			case DOT:			case BAR:			case AT:			case LITERAL_then:			case LITERAL_else:			case LITERAL_endif:			case RBRACE:			case DOTDOT:			{				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			{			switch ( LA(1)) {			case AT:			{				match(AT);				match(LITERAL_pre);				n.setIsPre();				break;			}			case EOF:			case LPAREN:			case COMMA:			case RPAREN:			case EQUAL:			case LITERAL_in:			case LITERAL_implies:			case LITERAL_or:			case LITERAL_xor:			case LITERAL_and:			case NOT_EQUAL:			case LESS:			case GREATER:			case LESS_EQUAL:			case GREATER_EQUAL:			case PLUS:			case MINUS:			case STAR:			case SLASH:			case LITERAL_div:			case ARROW:			case DOT:			case BAR:			case LITERAL_then:			case LITERAL_else:			case LITERAL_endif:			case RBRACE:			case DOTDOT:			{				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			{			switch ( LA(1)) {			case LPAREN:			{				match(LPAREN);				n.hasParentheses();				{				switch ( LA(1)) {				case LPAREN:				case IDENT:				case LITERAL_let:				case PLUS:				case MINUS:				case LITERAL_not:				case LITERAL_iterate:				case LITERAL_oclAsType:				case LITERAL_oclIsKindOf:				case LITERAL_oclIsTypeOf:				case LITERAL_if:				case LITERAL_true:				case LITERAL_false:				case INT:				case REAL:				case STRING:				case HASH:				case LITERAL_Set:				case LITERAL_Sequence:				case LITERAL_Bag:				case LITERAL_oclEmpty:				case LITERAL_oclUndefined:				case LITERAL_Tuple:				{					e=expression();					n.addArg(e);					{					_loop60:					do {						if ((LA(1)==COMMA)) {							match(COMMA);							e=expression();							n.addArg(e);						}						else {							break _loop60;						}											} while (true);					}					break;				}				case RPAREN:				{					break;				}				default:				{					throw new NoViableAltException(LT(1), getFilename());				}				}				}				match(RPAREN);				break;			}			case EOF:			case COMMA:			case RPAREN:			case EQUAL:			case LITERAL_in:			case LITERAL_implies:			case LITERAL_or:			case LITERAL_xor:			case LITERAL_and:			case NOT_EQUAL:

⌨️ 快捷键说明

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