void WhereClause(SingleNodeTree tree) { var conditions = new ConditionGroup(); tree.SetChild(conditions); Expect(16); Unary(conditions, false); while (StartOf(4)) { Unary(conditions, false); } }
void ComplexCondition(SingleNodeTree parent, SelectorExpression selector, bool? isAsOptional) { ConditionGroup group = new ConditionGroup(); parent.SetChild(group); ExpressionTreeBase addTo = group; SingleNodeTree condition = null; ConditionalExpression lastOperation = null; Expect(7); while (StartOf(4)) { lastOperation = lastOperation ?? new AndCondition(); MultiAdd(addTo, lastOperation); addTo = lastOperation; var nestedselector = new SelectorExpression(selector.NodeType, selector.Modifier, selector.Left); if (la.kind == 6 || la.kind == 36) { if (la.kind == 6) { Get(); } else { Get(); } if (la.kind == 17) { Get(); } NotCondition not = new NotCondition(); lastOperation.SetChild(not); lastOperation = not; } if (la.kind == 7) { ComplexCondition(lastOperation, nestedselector, isAsOptional); } else if (StartOf(6)) { Condition(lastOperation, nestedselector, isAsOptional); } else SynErr(56); if (la.kind == 13 || la.kind == 14) { Operation(out lastOperation); } else { lastOperation = null; } } Expect(8); }
void OptionalWhereClause(SingleNodeTree tree) { var conditions = new ConditionGroup(); tree.SetChild(conditions); if (la.kind == 16) { Get(); } Unary(conditions, false); while (StartOf(4)) { Unary(conditions, false); } }
void ConditionGroup(SingleNodeTree parent, bool? isAsOptional) { ConditionGroup group = new ConditionGroup(); parent.SetChild(group); ExpressionTreeBase addTo = group; SingleNodeTree condition = null; ConditionalExpression lastOperation = null; Expect(7); while (StartOf(4)) { lastOperation = lastOperation ?? new AndCondition(); MultiAdd(addTo, lastOperation); addTo = lastOperation; if (la.kind == 6 || la.kind == 36) { if (la.kind == 6) { Get(); } else { Get(); } if (la.kind == 17) { Get(); } NotCondition not = new NotCondition(); lastOperation.SetChild(not); lastOperation = not; } if (StartOf(6)) { Condition(lastOperation, null, isAsOptional); } else if (la.kind == 7) { ConditionGroup(lastOperation, isAsOptional); } else SynErr(54); if (la.kind == 13 || la.kind == 14) { Operation(out lastOperation); } else { lastOperation = null; } } if (lastOperation != null && lastOperation.Child == null) SemErr("Invalid Condition"); Expect(8); }