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

📄 ggeneratorparser.java

📁 UML设计测试工具
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				match(DOTDOT);				ms2=multiplicitySpec();				n.setHigh(ms2);				break;			}			case COMMA:			case RBRACK:			{				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_24);		}		return n;	}		public final int  multiplicitySpec() throws RecognitionException, TokenStreamException {		int m;				Token  i = null;		m = -1;				try {      // for error handling			switch ( LA(1)) {			case INT:			{				i = LT(1);				match(INT);				m = Integer.parseInt(i.getText());				break;			}			case STAR:			{				match(STAR);				m = -1;				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_25);		}		return m;	}		public final ASTSimpleType  simpleType() throws RecognitionException, TokenStreamException {		ASTSimpleType n;				Token  name = null;		n = null;				try {      // for error handling			name = LT(1);			match(IDENT);			n = new ASTSimpleType((MyToken) name);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_26);		}		return n;	}		public final ASTExpression  expressionOnly() throws RecognitionException, TokenStreamException {		ASTExpression n;				n = null;				try {      // for error handling			n=expression();			match(Token.EOF_TYPE);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_0);		}		return n;	}		public final ASTExpression  conditionalImpliesExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=conditionalOrExpression();			{			_loop129:			do {				if ((LA(1)==LITERAL_implies)) {					op = LT(1);					match(LITERAL_implies);					n1=conditionalOrExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop129;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_11);		}		return n;	}		public final ASTExpression  conditionalOrExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=conditionalXOrExpression();			{			_loop132:			do {				if ((LA(1)==LITERAL_or)) {					op = LT(1);					match(LITERAL_or);					n1=conditionalXOrExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop132;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_27);		}		return n;	}		public final ASTExpression  conditionalXOrExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=conditionalAndExpression();			{			_loop135:			do {				if ((LA(1)==LITERAL_xor)) {					op = LT(1);					match(LITERAL_xor);					n1=conditionalAndExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop135;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_28);		}		return n;	}		public final ASTExpression  conditionalAndExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=equalityExpression();			{			_loop138:			do {				if ((LA(1)==LITERAL_and)) {					op = LT(1);					match(LITERAL_and);					n1=equalityExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop138;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_29);		}		return n;	}		public final ASTExpression  equalityExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=relationalExpression();			{			_loop142:			do {				if ((LA(1)==EQUAL||LA(1)==NOT_EQUAL)) {					MyToken op = (MyToken) LT(1);					{					switch ( LA(1)) {					case EQUAL:					{						match(EQUAL);						break;					}					case NOT_EQUAL:					{						match(NOT_EQUAL);						break;					}					default:					{						throw new NoViableAltException(LT(1), getFilename());					}					}					}					n1=relationalExpression();					n = new ASTBinaryExpression(op, n, n1);				}				else {					break _loop142;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_30);		}		return n;	}		public final ASTExpression  relationalExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=additiveExpression();			{			_loop146:			do {				if (((LA(1) >= LESS && LA(1) <= GREATER_EQUAL))) {					MyToken op = (MyToken) LT(1);					{					switch ( LA(1)) {					case LESS:					{						match(LESS);						break;					}					case GREATER:					{						match(GREATER);						break;					}					case LESS_EQUAL:					{						match(LESS_EQUAL);						break;					}					case GREATER_EQUAL:					{						match(GREATER_EQUAL);						break;					}					default:					{						throw new NoViableAltException(LT(1), getFilename());					}					}					}					n1=additiveExpression();					n = new ASTBinaryExpression(op, n, n1);				}				else {					break _loop146;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_31);		}		return n;	}		public final ASTExpression  additiveExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=multiplicativeExpression();			{			_loop150:			do {				if ((LA(1)==PLUS||LA(1)==MINUS)) {					MyToken op = (MyToken) LT(1);					{					switch ( LA(1)) {					case PLUS:					{						match(PLUS);						break;					}					case MINUS:					{						match(MINUS);						break;					}					default:					{						throw new NoViableAltException(LT(1), getFilename());					}					}					}					n1=multiplicativeExpression();					n = new ASTBinaryExpression(op, n, n1);				}				else {					break _loop150;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_32);		}		return n;	}		public final ASTExpression  multiplicativeExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=unaryExpression();			{			_loop154:			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 _loop154;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_33);		}		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_34);		}		return n;	}		public final ASTExpression  postfixExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				boolean arrow; n = null;				try {      // for error handling			n=primaryExpression();			{			_loop161:			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 _loop161;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_34);		}		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_35.member(LA(1))) && (_tokenSet_36.member(LA(2))) && (_tokenSet_37.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_38);		}		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_39.member(LA(3))) && (_tokenSet_40.member(LA(4))) && (_tokenSet_41.member(LA(5))))&&( isQueryIdent(LT(1)) )) {					n=queryExpression(source);				}				else if ((LA(1)==IDENT) && (_tokenSet_36.member(LA(2))) && (_tokenSet_42.member(LA(3))) && (_tokenSet_43.member(LA(4))) && (_tokenSet_44.member(LA(5)))) {					n=operationExpression(source, followsArrow);				}			else {				throw new NoViableAltException(LT(1), getFilename());			}			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_38);		}		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:			{

⌨️ 快捷键说明

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