Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
            }
        }
Example #3
0
 public void Visit(GroupByTermNode node)
 {
     throw new NotImplementedException();
 }