Exemple #1
0
	void Primary(DimensionExpression sel, bool? isAsOptional) {
		if (la.kind == 3 || la.kind == 4 || la.kind == 31) {
			var identifier = new IdentifierExpression(); 
			Identifier(identifier);
			sel.Source = identifier.LastPart; sel.SourceType = typeof(string); 
            sel.IsQuoted = identifier.IsQuoted; 
			if (la.kind == 7) {
				sel.Function = sel.Source; sel.Source = null; 
				Get();
				if (StartOf(4)) {
					var argList = new ArgumentListExpression(); argList.SetParent(sel); sel.IsFunctionCall = true; 
					SelectField(argList);
					while (la.kind == 18) {
						Get();
						SelectField(argList);
					}
					sel.AddArguments(argList.GetChildren()); 
				}
				Expect(8);
			}
		} else if (la.kind == 9) {
			Get();
			Expect(11);
			Primary(sel, null);
			Expect(10);
		} else if (la.kind == 1) {
			Get();
			sel.Source = t.val; sel.SourceType = typeof(long); 
		} else if (la.kind == 2) {
			Get();
			sel.Source = t.val; sel.SourceType = typeof(double); 
		} else if (la.kind == 4) {
			Get();
			sel.Source = t.val.Substring(1, t.val.Length - 2); sel.SourceType = typeof(string); sel.IsQuoted = true; 
		} else SynErr(47);
	}
Exemple #2
0
	void SelectField(ArgumentListExpression expression, DimensionExpression dimensionToUse = null) {
		var selLol = dimensionToUse ?? new DimensionExpression(); 
		  if(expression != null) 
		{
		selLol.SetParent(expression);  
		expression.AddArgument(selLol); 
		}
		
		if (la.kind == 6 || la.kind == 36) {
			if (la.kind == 6) {
				Get();
				selLol.IsNotted = true; 
			} else {
				Get();
				selLol.IsNegated = true; 
			}
			if (la.kind == 17) {
				Get();
			}
		}
		Condition(selLol, null, true);
		var selectorChild = selLol.Child as SelectorExpression;
		  if (expression != null && selectorChild != null)
		  {
		      var selectorChildRightDimension = selectorChild.Right as DimensionExpression;
		      if (selectorChildRightDimension != null && selectorChild.Left == null)
		      {
		          selectorChildRightDimension.Target = selectorChild.Target;
			selectorChildRightDimension.IsNegated = selLol.IsNegated;
		          selectorChildRightDimension.IsNotted = selLol.IsNotted;
		          expression.AddArgument(selectorChildRightDimension);
		          expression.RemoveArgument(selLol);
		      }
		  }
		
	}
Exemple #3
0
	void SelectClause(GetExpression expression) {
		Expect(29);
		if (la.kind == 24) {
			Get();
			Expect(1);
			expression.Take = Int32.Parse(t.val); 
		}
		if (StartOf(7)) {
			if (StartOf(4)) {
				var argList = new ArgumentListExpression(); argList.SetParent(expression); 
				SelectField(argList);
				while (la.kind == 18) {
					Get();
					SelectField(argList);
				}
				expression.AddSelects(argList.GetChildren()); 
			}
			if (la.kind == 32) {
				FromClause(expression);
			}
			if (la.kind == 30) {
				GroupByClause(expression);
			}
		}
	}