示例#1
0
	public IExpression  row_value_constructor_elem() //throws RecognitionException, TokenStreamException
{
		IExpression expression = null;
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST row_value_constructor_elem_AST = null;
		
		if ((tokenSet_9_.member(LA(1))))
		{
			expression=value_exp();
			if (0 == inputState.guessing)
			{
				astFactory.addASTChild(ref currentAST, returnAST);
			}
			row_value_constructor_elem_AST = currentAST.root;
		}
		else if ((LA(1)==SQL2RW_null)) {
			AST tmp249_AST = null;
			tmp249_AST = astFactory.create(LT(1));
			astFactory.addASTChild(ref currentAST, tmp249_AST);
			match(SQL2RW_null);
			if (0==inputState.guessing)
			{
				
							ITerminalExpression terminalExpression = new TerminalExpression();
							terminalExpression.Value = "null";
							expression = terminalExpression;
						
			}
			row_value_constructor_elem_AST = currentAST.root;
		}
		else if ((LA(1)==SQL2RW_default)) {
			AST tmp250_AST = null;
			tmp250_AST = astFactory.create(LT(1));
			astFactory.addASTChild(ref currentAST, tmp250_AST);
			match(SQL2RW_default);
			row_value_constructor_elem_AST = currentAST.root;
		}
		else
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		
		returnAST = row_value_constructor_elem_AST;
		return expression;
	}
示例#2
0
	public IExpression  value_exp_primary() //throws RecognitionException, TokenStreamException
{
		IExpression expression = null;
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST value_exp_primary_AST = null;
		
			string tmp;
		
		
		if ((LA(1)==SQL2RW_avg||LA(1)==SQL2RW_count||LA(1)==SQL2RW_max||LA(1)==SQL2RW_min||LA(1)==SQL2RW_sum))
		{
			set_fct_spec();
			if (0 == inputState.guessing)
			{
				astFactory.addASTChild(ref currentAST, returnAST);
			}
			value_exp_primary_AST = currentAST.root;
		}
		else if ((LA(1)==SQL2RW_case||LA(1)==SQL2RW_coalesce||LA(1)==SQL2RW_nullif)) {
			case_exp();
			if (0 == inputState.guessing)
			{
				astFactory.addASTChild(ref currentAST, returnAST);
			}
			value_exp_primary_AST = currentAST.root;
		}
		else if ((LA(1)==SQL2RW_cast)) {
			cast_spec();
			if (0 == inputState.guessing)
			{
				astFactory.addASTChild(ref currentAST, returnAST);
			}
			value_exp_primary_AST = currentAST.root;
		}
		else if (((tokenSet_14_.member(LA(1))) && (tokenSet_15_.member(LA(2))))&&(LA(1) == INTRODUCER)) {
			{
				bool synPredMatched168 = false;
				if (((LA(1)==SQL2NRW_ada||LA(1)==REGULAR_ID||LA(1)==DELIMITED_ID||LA(1)==INTRODUCER) && (tokenSet_16_.member(LA(2)))))
				{
					int _m168 = mark();
					synPredMatched168 = true;
					inputState.guessing++;
					try {
						{
							column_ref();
						}
					}
					catch (RecognitionException)
					{
						synPredMatched168 = false;
					}
					rewind(_m168);
					inputState.guessing--;
				}
				if ( synPredMatched168 )
				{
					tmp=column_ref();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					if (0==inputState.guessing)
					{
						
										ITerminalExpression terminalExpression = new TerminalExpression();
										string column = "_" + tmp;
										terminalExpression.Value = column;
										expression = terminalExpression;
									
					}
				}
				else if ((tokenSet_17_.member(LA(1))) && (tokenSet_18_.member(LA(2)))) {
					tmp=unsigned_value_spec();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					if (0==inputState.guessing)
					{
						
										ITerminalExpression terminalExpression = new TerminalExpression();
										terminalExpression.Value = tmp;
										expression = terminalExpression;
									
					}
				}
				else
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				
			}
			value_exp_primary_AST = currentAST.root;
		}
		else if (((LA(1)==SQL2NRW_ada||LA(1)==REGULAR_ID||LA(1)==DELIMITED_ID||LA(1)==INTRODUCER) && (tokenSet_16_.member(LA(2))))&&(LA(1) != INTRODUCER)) {
			tmp=column_ref();
			if (0 == inputState.guessing)
			{
				astFactory.addASTChild(ref currentAST, returnAST);
			}
			if (0==inputState.guessing)
			{
				
								ITerminalExpression terminalExpression = new TerminalExpression();
								terminalExpression.Value = tmp;
								expression = terminalExpression;
						
			}
			value_exp_primary_AST = currentAST.root;
		}
		else if ((tokenSet_17_.member(LA(1))) && (tokenSet_18_.member(LA(2)))) {
			tmp=unsigned_value_spec();
			if (0 == inputState.guessing)
			{
				astFactory.addASTChild(ref currentAST, returnAST);
			}
			if (0==inputState.guessing)
			{
				
								ITerminalExpression terminalExpression = new TerminalExpression();
								terminalExpression.Value = tmp;
								expression = terminalExpression;
						
			}
			value_exp_primary_AST = currentAST.root;
		}
		else {
			bool synPredMatched170 = false;
			if (((LA(1)==LEFT_PAREN) && (tokenSet_9_.member(LA(2)))))
			{
				int _m170 = mark();
				synPredMatched170 = true;
				inputState.guessing++;
				try {
					{
						match(LEFT_PAREN);
						value_exp();
						match(RIGHT_PAREN);
					}
				}
				catch (RecognitionException)
				{
					synPredMatched170 = false;
				}
				rewind(_m170);
				inputState.guessing--;
			}
			if ( synPredMatched170 )
			{
				AST tmp65_AST = null;
				tmp65_AST = astFactory.create(LT(1));
				astFactory.addASTChild(ref currentAST, tmp65_AST);
				match(LEFT_PAREN);
				expression=value_exp();
				if (0 == inputState.guessing)
				{
					astFactory.addASTChild(ref currentAST, returnAST);
				}
				AST tmp66_AST = null;
				tmp66_AST = astFactory.create(LT(1));
				astFactory.addASTChild(ref currentAST, tmp66_AST);
				match(RIGHT_PAREN);
				value_exp_primary_AST = currentAST.root;
			}
			else if ((LA(1)==LEFT_PAREN) && (tokenSet_3_.member(LA(2)))) {
				scalar_subquery();
				if (0 == inputState.guessing)
				{
					astFactory.addASTChild(ref currentAST, returnAST);
				}
				value_exp_primary_AST = currentAST.root;
			}
			else
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			returnAST = value_exp_primary_AST;
			return expression;
		}