Esempio n. 1
0
        /// <summary>
        /// Parses a print term node.
        /// Expects that there is an expression node and possibly next print term node.
        /// Together it creates a chain of print expressions.
        /// </summary>
        public void Visit(SelectPrintTermNode 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);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Parses a select print term node.
        /// Expecting: expression, expression
        /// </summary>
        /// <returns> A chain of variable nodes. </returns>
        static private Node ParseSelectPrintTerm(ref int position, List <Token> tokens)
        {
            SelectPrintTermNode selectPrintTermNode = new SelectPrintTermNode();

            var expression = ParseExpressionNode(ref position, tokens);

            if (expression == null)
            {
                ThrowError("Select parser", "Expected expression.", position, tokens);
            }
            else
            {
                selectPrintTermNode.AddExpression(expression);
            }

            // Comma signals there is another expression node, next expression must follow.
            if (CheckToken(position, Token.TokenType.Comma, tokens))
            {
                position++;
                selectPrintTermNode.AddNext(ParseNextSelectPrintNode(ref position, tokens));
            }
            return(selectPrintTermNode);
        }
Esempio n. 3
0
 public void Visit(SelectPrintTermNode node)
 {
     throw new NotImplementedException();
 }