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

📄 guseparser.java

📁 UML设计测试工具
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				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 _loop93;				}							} 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_13);		}		return n;	}		public final ASTPrePostClause  prePostClause() throws RecognitionException, TokenStreamException {		ASTPrePostClause n;				Token  name = null;		ASTExpression e; n = null;				try {      // for error handling			MyToken t = (MyToken) LT(1);			{			switch ( LA(1)) {			case LITERAL_pre:			{				match(LITERAL_pre);				break;			}			case LITERAL_post:			{				match(LITERAL_post);				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			{			switch ( LA(1)) {			case IDENT:			{				name = LT(1);				match(IDENT);				break;			}			case COLON:			{				break;			}			default:			{				throw new NoViableAltException(LT(1), getFilename());			}			}			}			match(COLON);			e=expression();			n = new ASTPrePostClause(t, (MyToken) name, e);		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_14);		}		return n;	}		public final ASTMultiplicity  multiplicity() throws RecognitionException, TokenStreamException {		ASTMultiplicity n;				ASTMultiplicityRange mr; n = null;				try {      // for error handling							MyToken t = (MyToken) LT(1); // remember start position of expression				n = new ASTMultiplicity(t); 						mr=multiplicityRange();			n.addRange(mr);			{			_loop64:			do {				if ((LA(1)==COMMA)) {					match(COMMA);					mr=multiplicityRange();					n.addRange(mr);				}				else {					break _loop64;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_15);		}		return n;	}		public final ASTMultiplicityRange  multiplicityRange() throws RecognitionException, TokenStreamException {		ASTMultiplicityRange n;				int ms1, ms2; n = null;				try {      // for error handling			ms1=multiplicitySpec();			n = new ASTMultiplicityRange(ms1);			{			switch ( LA(1)) {			case DOTDOT:			{				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_16);		}		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_17);		}		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_18);		}		return n;	}		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_19);		}		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();			{			_loop96:			do {				if ((LA(1)==LITERAL_implies)) {					op = LT(1);					match(LITERAL_implies);					n1=conditionalOrExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop96;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_13);		}		return n;	}		public final ASTExpression  conditionalOrExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=conditionalXOrExpression();			{			_loop99:			do {				if ((LA(1)==LITERAL_or)) {					op = LT(1);					match(LITERAL_or);					n1=conditionalXOrExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop99;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_20);		}		return n;	}		public final ASTExpression  conditionalXOrExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=conditionalAndExpression();			{			_loop102:			do {				if ((LA(1)==LITERAL_xor)) {					op = LT(1);					match(LITERAL_xor);					n1=conditionalAndExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop102;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_21);		}		return n;	}		public final ASTExpression  conditionalAndExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				Token  op = null;		ASTExpression n1; n = null;				try {      // for error handling			n=equalityExpression();			{			_loop105:			do {				if ((LA(1)==LITERAL_and)) {					op = LT(1);					match(LITERAL_and);					n1=equalityExpression();					n = new ASTBinaryExpression((MyToken) op, n, n1);				}				else {					break _loop105;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_22);		}		return n;	}		public final ASTExpression  equalityExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=relationalExpression();			{			_loop109:			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 _loop109;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_23);		}		return n;	}		public final ASTExpression  relationalExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=additiveExpression();			{			_loop113:			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 _loop113;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_24);		}		return n;	}		public final ASTExpression  additiveExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=multiplicativeExpression();			{			_loop117:			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 _loop117;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_25);		}		return n;	}		public final ASTExpression  multiplicativeExpression() throws RecognitionException, TokenStreamException {		ASTExpression n;				ASTExpression n1; n = null;				try {      // for error handling			n=unaryExpression();			{			_loop121:			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 _loop121;				}							} while (true);			}		}		catch (RecognitionException ex) {			reportError(ex);			consume();			consumeUntil(_tokenSet_26);		}		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;

⌨️ 快捷键说明

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