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

📄 ggeneratorparser.java

📁 UML设计测试工具
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				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_38);		}		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_38);		}		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_39.member(LA(1))) && (_tokenSet_45.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_38);		}		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_38);		}		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 IDENT:			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 SEMI:			case RBRACK:			case AT:			case LITERAL_pre:			case LITERAL_then:			case LITERAL_else:			case LITERAL_endif:			case RBRACE:			case DOTDOT:			case LITERAL_constraints:			case LITERAL_abstract:			case LITERAL_class:			case LITERAL_end:			case LITERAL_associationClass:			case LITERAL_associationclass:			case LITERAL_aggregation:			case LITERAL_composition:			case LITERAL_association:			case LITERAL_context:			case LITERAL_inv:			case LITERAL_post:			{				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 IDENT:			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 SEMI:			case RBRACK:			case LITERAL_pre:			case LITERAL_then:			case LITERAL_else:			case LITERAL_endif:			case RBRACE:			case DOTDOT:			case LITERAL_constraints:			case LITERAL_abstract:			case LITERAL_class:			case LITERAL_end:			case LITERAL_associationClass:			case LITERAL_associationclass:			case LITERAL_aggregation:			case LITERAL_composition:			case LITERAL_association:			case LITERAL_context:			case LITERAL_inv:			case LITERAL_post:			{				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);					{					_loop173:					do {						if ((LA(1)==COMMA)) {							match(COMMA);							e=expression();							n.addArg(e);						}						else {							break _loop173;						}											} while (true);					}					break;				}				case RPAREN:				{					break;				}				default:				{					throw new NoViableAltException(LT(1), getFilename());				}				}				}				match(RPAREN);				break;			}			case EOF:			case COMMA:			case RPAREN:			case IDENT:			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 SEMI:			case RBRACK:			case LITERAL_pre:			case LITERAL_then:			case LITERAL_else:			case LITERAL_endif:			case RBRACE:			case DOTDOT:			case LITERAL_constraints:			case LITERAL_abstract:			case LITERAL_class:			case LITERAL_end:			case LITERAL_associationClass:			case LITERAL_associationclass:			case LITERAL_aggregation:			case LITERAL_composition:			case LITERAL_association:			case LITERAL_context:			case LITERAL_inv:			case LITERAL_post:			{				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_38);		}		return n;	}		public final ASTTypeArgExpression  typeExpression(		ASTExpression source, boolean followsArrow	) throws RecognitionException, TokenStreamException {		ASTTypeArgExpression n;				ASTType t = null; n = null;				try {      // for error handling			MyToken opToken = (MyToken) LT(1);			{			switch ( LA(1)) {			case LITERAL_oclAsType:			{				match(LITERAL_oclAsType);				break;			}			case LITERAL_oclIsKindOf:			{				match(LITERAL_oclIsKindOf);				break;			}			case LITERAL_oclIsTypeOf:			{				match(LITERAL_oclIsTypeOf);				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			match(LPAREN);			t=type();			match(RPAREN);			n = new ASTTypeArgExpression(opToken, source, t, followsArrow);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_38);		}		return n;	}		public final ASTElemVarsDeclaration  elemVarsDeclaration() throws RecognitionException, TokenStreamException {		ASTElemVarsDeclaration n;				List idList; ASTType t = null; n = null;				try {      // for error handling			idList=idList();			{			switch ( LA(1)) {			case COLON:			{				match(COLON);				t=type();				break;			}			case BAR:			case SEMI:			{				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			n = new ASTElemVarsDeclaration(idList, t);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_46);		}		return n;	}		public final ASTVariableInitialization  variableInitialization() throws RecognitionException, TokenStreamException {		ASTVariableInitialization n;				Token  name = null;		ASTType t; ASTExpression e; n = null;				try {      // for error handling			name = LT(1);			match(IDENT);			match(COLON);			t=type();			match(EQUAL);			e=expression();			n = new ASTVariableInitialization((MyToken) name, t, e);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_47);		}		return n;	}		public final ASTCollectionLiteral  collectionLiteral() throws RecognitionException, TokenStreamException {		ASTCollectionLiteral n;				ASTCollectionItem ci; n = null;				try {      // for error handling			MyToken op = (MyToken) LT(1);			{			switch ( LA(1)) {			case LITERAL_Set:			{				match(LITERAL_Set);				break;			}			case LITERAL_Sequence:			{				match(LITERAL_Sequence);				break;			}			case LITERAL_Bag:			{				match(LITERAL_Bag);				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			n = new ASTCollectionLiteral(op);			match(LBRACE);			ci=collectionItem();			n.addItem(ci);			{			_loop184:			do {				if ((LA(1)==COMMA)) {					match(COMMA);					ci=collectionItem();					n.addItem(ci);				}				else {					break _loop184;				}							} while (true);			}			match(RBRACE);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_38);		}		return n;	}		public final ASTEmptyCollectionLiteral  emptyCollectionLiteral() throws RecognitionException, TokenStreamException {		ASTEmptyCollectionLiteral n;				ASTType t = null; n = null;				try {      // for error handling			match(LITERAL_oclEmpty);			match(LPAREN);			t=collectionType();			match(RPAREN);			n = new ASTEmptyCollectionLiteral(t);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_38);		}		return n;	}		public final ASTUndefinedLiteral  undefinedLiteral() throws RecognitionException, TokenStreamException {		ASTUndefinedLiteral n;				ASTType t = null; n = null;				try {      // for error handling			match(LITERAL_oclUndefined);			match(LPAREN);			t=type();			match(RPAREN);			n = new ASTUndefinedLiteral(t);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_38);		}		return n;	}		public final ASTTupleLiteral  tupleLiteral() throws RecognitionException, TokenStreamException {		ASTTupleLiteral n;				ASTTupleItem ti; n = null; List tiList = new ArrayList();				try {      // for error handling			match(LITERAL_Tuple);			match(LBRACE);			ti=tupleItem();			tiList.add(ti);			{			_loop191:			do {				if ((LA(1)==COMMA)) {					match(COMMA);					ti=tupleItem();					tiList.add(ti);				}				else {					break _loop191;				}							} while (true);			}			match(RBRACE);			n = new ASTTupleLiteral(tiList);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_38);		}		return n;	}		public final ASTCollectionItem  collectionItem() throws RecognitionException, TokenStreamException {		ASTCollectionItem n;				ASTExpression e; n = new ASTCollectionItem();				try {      // for error handling			e=expression();			n.setFirst(e);			{			switch ( LA(1)) {

⌨️ 快捷键说明

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