コード例 #1
0
ファイル: SQLParser.cs プロジェクト: apakian/fluorinefx
	public IExpression  term() //throws RecognitionException, TokenStreamException
{
		IExpression expression = null;
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST term_AST = null;
		
			IExpression expressionRhs = null;
		
		
		expression=factor();
		if (0 == inputState.guessing)
		{
			astFactory.addASTChild(ref currentAST, returnAST);
		}
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==ASTERISK||LA(1)==SOLIDUS) && (tokenSet_9_.member(LA(2))))
				{
					factor_op();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					expressionRhs=factor();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					if (0==inputState.guessing)
					{
						
									ITwoPartExpression twoPartExpression = new TwoPartExpression();
									twoPartExpression.Lhs = expression;
									twoPartExpression.Rhs = expressionRhs;
									expression = twoPartExpression;
								
					}
				}
				else
				{
					goto _loop376_breakloop;
				}
				
			}
_loop376_breakloop:			;
		}    // ( ... )*
		term_AST = currentAST.root;
		returnAST = term_AST;
		return expression;
	}
コード例 #2
0
ファイル: SQLParser.cs プロジェクト: apakian/fluorinefx
	public ITwoPartExpression  comp_predicate() //throws RecognitionException, TokenStreamException
{
		ITwoPartExpression twoPartExpression = null;
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST comp_predicate_AST = null;
		
			IExpression expressionRhs = null;
			SqlOperator op;
		
		
		op=comp_op();
		if (0 == inputState.guessing)
		{
			astFactory.addASTChild(ref currentAST, returnAST);
		}
		expressionRhs=row_value_constructor();
		if (0 == inputState.guessing)
		{
			astFactory.addASTChild(ref currentAST, returnAST);
		}
		if (0==inputState.guessing)
		{
			
					twoPartExpression = new TwoPartExpression();
					twoPartExpression.Rhs = expressionRhs;
					twoPartExpression.Operator = op;
				
		}
		comp_predicate_AST = currentAST.root;
		returnAST = comp_predicate_AST;
		return twoPartExpression;
	}
コード例 #3
0
ファイル: SQLParser.cs プロジェクト: apakian/fluorinefx
	public IExpression  boolean_term() //throws RecognitionException, TokenStreamException
{
		IExpression expression = null;
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST boolean_term_AST = null;
		
			IExpression expressionRhs = null;
		
		
		expression=boolean_factor();
		if (0 == inputState.guessing)
		{
			astFactory.addASTChild(ref currentAST, returnAST);
		}
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==SQL2RW_and))
				{
					boolean_factor_op();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					expressionRhs=boolean_factor();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					if (0==inputState.guessing)
					{
						
									ITwoPartExpression twoPartExpression = new TwoPartExpression();
									twoPartExpression.Lhs = expression;
									twoPartExpression.Rhs = expressionRhs;
									twoPartExpression.Operator = SqlOperator.BooleanFactorOperator;
									expression = twoPartExpression;
								
					}
				}
				else
				{
					goto _loop200_breakloop;
				}
				
			}
_loop200_breakloop:			;
		}    // ( ... )*
		boolean_term_AST = currentAST.root;
		returnAST = boolean_term_AST;
		return expression;
	}
コード例 #4
0
ファイル: SQLParser.cs プロジェクト: apakian/fluorinefx
	public IExpression  predicate() //throws RecognitionException, TokenStreamException
{
		IExpression expression = null;
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST predicate_AST = null;
		
			ITwoPartExpression twoPartExpression = null;
			ILikeExpression likeExpression = null;
			INullExpression nullExpression = null;
			bool bNot = false;
		
		
		if ((tokenSet_25_.member(LA(1))))
		{
			expression=row_value_constructor();
			if (0 == inputState.guessing)
			{
				astFactory.addASTChild(ref currentAST, returnAST);
			}
			{
				switch ( LA(1) )
				{
				case SQL2RW_between:
				case SQL2RW_in:
				case SQL2RW_like:
				case SQL2RW_not:
				{
					{
						if ((LA(1)==SQL2RW_not))
						{
							AST tmp111_AST = null;
							tmp111_AST = astFactory.create(LT(1));
							astFactory.addASTChild(ref currentAST, tmp111_AST);
							match(SQL2RW_not);
							if (0==inputState.guessing)
							{
								bNot = true;
							}
						}
						else if ((LA(1)==SQL2RW_between||LA(1)==SQL2RW_in||LA(1)==SQL2RW_like)) {
						}
						else
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						
					}
					{
						if ((LA(1)==SQL2RW_between))
						{
							between_predicate();
							if (0 == inputState.guessing)
							{
								astFactory.addASTChild(ref currentAST, returnAST);
							}
						}
						else if ((LA(1)==SQL2RW_in)) {
							in_predicate();
							if (0 == inputState.guessing)
							{
								astFactory.addASTChild(ref currentAST, returnAST);
							}
						}
						else if ((LA(1)==SQL2RW_like)) {
							likeExpression=like_predicate();
							if (0 == inputState.guessing)
							{
								astFactory.addASTChild(ref currentAST, returnAST);
							}
							if (0==inputState.guessing)
							{
								
															twoPartExpression = new TwoPartExpression();
															twoPartExpression.Lhs = expression;
															twoPartExpression.Rhs = likeExpression;
															twoPartExpression.Not = bNot;
															expression = twoPartExpression;
														
							}
						}
						else
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						
					}
					break;
				}
				case SQL2RW_is:
				{
					nullExpression=null_predicate();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					if (0==inputState.guessing)
					{
						
										twoPartExpression = new TwoPartExpression();
										twoPartExpression.Lhs = expression;
										twoPartExpression.Rhs = nullExpression;
										expression = twoPartExpression;
									
					}
					break;
				}
				case SQL2RW_match:
				{
					match_predicate();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					break;
				}
				case SQL2RW_overlaps:
				{
					overlaps_predicate();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					break;
				}
				default:
					if ((LA(1)==NOT_EQUALS_OP||LA(1)==LESS_THAN_OR_EQUALS_OP||LA(1)==GREATER_THAN_OR_EQUALS_OP||LA(1)==LESS_THAN_OP||LA(1)==EQUALS_OP||LA(1)==GREATER_THAN_OP) && (tokenSet_25_.member(LA(2))))
					{
						twoPartExpression=comp_predicate();
						if (0 == inputState.guessing)
						{
							astFactory.addASTChild(ref currentAST, returnAST);
						}
						if (0==inputState.guessing)
						{
							
											twoPartExpression.Lhs = expression;
											expression = twoPartExpression;
										
						}
					}
					else if ((LA(1)==NOT_EQUALS_OP||LA(1)==LESS_THAN_OR_EQUALS_OP||LA(1)==GREATER_THAN_OR_EQUALS_OP||LA(1)==LESS_THAN_OP||LA(1)==EQUALS_OP||LA(1)==GREATER_THAN_OP) && (LA(2)==SQL2RW_all||LA(2)==SQL2RW_any||LA(2)==SQL2RW_some)) {
						quantified_comp_predicate();
						if (0 == inputState.guessing)
						{
							astFactory.addASTChild(ref currentAST, returnAST);
						}
					}
				else
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				break; }
			}
			predicate_AST = currentAST.root;
		}
		else if ((LA(1)==SQL2RW_exists)) {
			exists_predicate();
			if (0 == inputState.guessing)
			{
				astFactory.addASTChild(ref currentAST, returnAST);
			}
			predicate_AST = currentAST.root;
		}
		else if ((LA(1)==SQL2RW_unique)) {
			unique_predicate();
			if (0 == inputState.guessing)
			{
				astFactory.addASTChild(ref currentAST, returnAST);
			}
			predicate_AST = currentAST.root;
		}
		else
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		
		returnAST = predicate_AST;
		return expression;
	}
コード例 #5
0
ファイル: SQLParser.cs プロジェクト: apakian/fluorinefx
	public IExpression  value_exp() //throws RecognitionException, TokenStreamException
{
		IExpression expression = null;
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST value_exp_AST = null;
		
			IExpression expressionRhs = null;
		
		
		expression=term();
		if (0 == inputState.guessing)
		{
			astFactory.addASTChild(ref currentAST, returnAST);
		}
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==MINUS_SIGN||LA(1)==CONCATENATION_OP||LA(1)==PLUS_SIGN) && (tokenSet_9_.member(LA(2))))
				{
					{
						if ((LA(1)==MINUS_SIGN||LA(1)==PLUS_SIGN))
						{
							term_op();
							if (0 == inputState.guessing)
							{
								astFactory.addASTChild(ref currentAST, returnAST);
							}
						}
						else if ((LA(1)==CONCATENATION_OP)) {
							AST tmp52_AST = null;
							tmp52_AST = astFactory.create(LT(1));
							astFactory.addASTChild(ref currentAST, tmp52_AST);
							match(CONCATENATION_OP);
						}
						else
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						
					}
					expressionRhs=term();
					if (0 == inputState.guessing)
					{
						astFactory.addASTChild(ref currentAST, returnAST);
					}
					if (0==inputState.guessing)
					{
						
									ITwoPartExpression twoPartExpression = new TwoPartExpression();
									twoPartExpression.Lhs = expression;
									twoPartExpression.Rhs = expressionRhs;
									expression = twoPartExpression;
								
					}
				}
				else
				{
					goto _loop360_breakloop;
				}
				
			}
_loop360_breakloop:			;
		}    // ( ... )*
		value_exp_AST = currentAST.root;
		returnAST = value_exp_AST;
		return expression;
	}