private bool ContextHasPredicate(TSqlParser.Search_conditionContext context) { var predicate = context.predicate(); if (predicate != null) { return(true); } return(false); }
private d.Predicate GetDrumPredicate(TSqlParser.Search_conditionContext context) { var predicate = context.predicate(); if (predicate is not null) { var predicateInterval = predicate.SourceInterval; var bucketInterval = new Interval { A = predicateInterval.a, B = predicateInterval.b }; var newPredicate = new d.Predicate(GetNextPredicateId()); newPredicate.SetInterval(bucketInterval); newPredicate.Text = GetWhiteSpaceFromCurrentContext(predicate); return(newPredicate); } return(null); }
public override void EnterSearch_condition([NotNull] TSqlParser.Search_conditionContext context) { string debug = context.GetText(); var interval = context.SourceInterval; Console.WriteLine("EnterSearch_condition:"); Console.WriteLine($"Text: {debug}"); Console.WriteLine($"Interval: {interval.ToString()}"); var predicate = context.predicate(); if (predicate != null) { string predicateText = predicate.GetText(); var predicateInterval = predicate.SourceInterval; var bucketInterval = new Interval { A = predicateInterval.a, B = predicateInterval.b }; d.Predicate newPredicate = null; if (!HasPredicate(bucketInterval)) { if (PredicateHasBool(context)) { // we need to determine if we need to add a boolean predicate // or regular predicate WalkTree(context); } else { // just add the predicate newPredicate = new d.Predicate(GetNextPredicateId()); newPredicate.SetInterval(bucketInterval); AddPredicate(newPredicate); } } } }