예제 #1
0
 public virtual void Visit(EchoExpressionStatement statement)
 {
     VisitSubNodes(statement);
 }
예제 #2
0
        /// <summary>
        /// Parser for EchoStatement
        /// </summary>
        /// <returns>Parsed EchoStatement</returns>
        public EchoStatement ParseEchoStatement()
        {
            //Skip echo
            NextToken("echo", "echo Expression/Embedding ;", "echo");

            //Determine echo type
            if (TokenStream.HasNext() && TokenStream.Peek(1).GetType() == TokenType.EMBEDDING)
            {   //EchoEmbeddingStatement
                EchoEmbeddingStatement echoEmbedding = new EchoEmbeddingStatement();

                //Parse embedding
                echoEmbedding.SetEmbedding(embeddingParser.ParseEmbedding());

                //Skip ; token
                NextToken(";", "echo Expression/Embedding ;", ';');

                return echoEmbedding;
            }
            else
            {   //EchoExpressionStatement
                EchoExpressionStatement echoExpression = new EchoExpressionStatement();

                //Parse expression
                echoExpression.SetExpression(expressionParser.ParseExpression());

                //Skip ; token
                NextToken(";", "echo Expression/Embedding ;", ';');

                return echoExpression;
            }
        }