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

📄 gcmdparser.java

📁 UML设计测试工具
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_14);		}		return idList;	}		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_15);		}		return n;	}		public final ASTExpression  expression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  name = null;		ASTLetExpression prevLet = null, firstLet = null; ASTType t = null; 		ASTExpression e1, e2; n = null; 						try {      // for error handling			MyToken tok = (MyToken) LT(1); /* remember start of expression */			{			_loop40:			do {				if ((LA(1)==LITERAL_let)) {					match(LITERAL_let);					name = LT(1);					match(IDENT);					{					switch ( LA(1)) {					case COLON:					{						match(COLON);						t=type();						break;					}					case EQUAL:					{						break;					}					default:					{						throw new NoViableAltException(LT(1), getFilename());					}					}					}					match(EQUAL);					e1=expression();					match(LITERAL_in);					ASTLetExpression nextLet = new ASTLetExpression((MyToken) name, t, e1);					if ( firstLet == null ) 					firstLet = nextLet;					if ( prevLet != null ) 					prevLet.setInExpr(nextLet);					prevLet = nextLet;									}				else {					break _loop40;				}							} while (true);			}			n=conditionalImpliesExpression();			if ( n != null ) 			n.setStartToken(tok);			if ( prevLet != null ) { 			prevLet.setInExpr(n);			n = firstLet;			n.setStartToken(tok);			}					}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_16);		}		return n;	}		public final ASTType  type() throws RecognitionException, TokenStreamException {		ASTType n;				n = null;				try {      // for error handling			MyToken tok = (MyToken) LT(1); /* remember start of type */			{			switch ( LA(1)) {			case IDENT:			{				n=simpleType();				break;			}			case LITERAL_Set:			case LITERAL_Sequence:			case LITERAL_Bag:			case LITERAL_Collection:			{				n=collectionType();				break;			}			case LITERAL_Tuple:			{				n=tupleType();				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			n.setStartToken(tok);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_17);		}		return n;	}		public final List  paramList() throws RecognitionException, TokenStreamException {		List paramList;				ASTVariableDeclaration v; paramList = new ArrayList();				try {      // for error handling			match(LPAREN);			{			switch ( LA(1)) {			case IDENT:			{				v=variableDeclaration();				paramList.add(v);				{				_loop31:				do {					if ((LA(1)==COMMA)) {						match(COMMA);						v=variableDeclaration();						paramList.add(v);					}					else {						break _loop31;					}									} while (true);				}				break;			}			case RPAREN:			{				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			match(RPAREN);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_1);		}		return paramList;	}		public final ASTVariableDeclaration  variableDeclaration() throws RecognitionException, TokenStreamException {		ASTVariableDeclaration n;				Token  name = null;		ASTType t; n = null;				try {      // for error handling			name = LT(1);			match(IDENT);			match(COLON);			t=type();			n = new ASTVariableDeclaration((MyToken) name, t);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_18);		}		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_1);		}		return n;	}		public final ASTExpression  conditionalImpliesExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=conditionalOrExpression();			{			_loop43:			do {				if ((LA(1)==LITERAL_implies)) {					op = LT(1);					match(LITERAL_implies);					n1=conditionalOrExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop43;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_16);		}		return n;	}		public final ASTExpression  conditionalOrExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=conditionalXOrExpression();			{			_loop46:			do {				if ((LA(1)==LITERAL_or)) {					op = LT(1);					match(LITERAL_or);					n1=conditionalXOrExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop46;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_19);		}		return n;	}		public final ASTExpression  conditionalXOrExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=conditionalAndExpression();			{			_loop49:			do {				if ((LA(1)==LITERAL_xor)) {					op = LT(1);					match(LITERAL_xor);					n1=conditionalAndExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop49;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_20);		}		return n;	}		public final ASTExpression  conditionalAndExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=equalityExpression();			{			_loop52:			do {				if ((LA(1)==LITERAL_and)) {					op = LT(1);					match(LITERAL_and);					n1=equalityExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop52;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_21);		}		return n;	}		public final ASTExpression  equalityExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=relationalExpression();			{			_loop56:			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 _loop56;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_22);		}		return n;	}		public final ASTExpression  relationalExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=additiveExpression();			{			_loop60:			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 _loop60;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_23);		}		return n;	}		public final ASTExpression  additiveExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=multiplicativeExpression();			{			_loop64:			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 _loop64;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_24);		}		return n;	}		public final ASTExpression  multiplicativeExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=unaryExpression();			{			_loop68:			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 _loop68;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_25);		}		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();

⌨️ 快捷键说明

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