/// <summary> /// Parses a group by term. /// Expression (, Expression)* /// </summary> /// <returns> A group by term node. </returns> private static Node ParseGroupByTerm(ref int position, List <Token> tokens) { GroupByTermNode groupByTermNode = new GroupByTermNode(); // Expression var expression = ParseExpressionNode(ref position, tokens); if (expression == null) { ThrowError("Group by parser", "Expected expression.", position, tokens); } else { groupByTermNode.AddExpression(expression); } // Comma signals another group term. if (CheckToken(position, Token.TokenType.Comma, tokens)) { position++; groupByTermNode.AddNext(ParseGroupByTerm(ref position, tokens)); } return(groupByTermNode); }
/// <summary> /// Expects an expression and possibly the next group by term. /// </summary> public void Visit(GroupByTermNode node) { if (node.exp == null) { throw new ArgumentNullException($"{this.GetType()}, failed to access expression."); } else { node.exp.Accept(this); } if (node.next != null) { node.next.Accept(this); } }
public void Visit(GroupByTermNode node) { throw new NotImplementedException(); }