#ifndef _CLI_STATEMENT_LIST_H_ #define _CLI_STATEMENT_LIST_H_ #include <ast/Statement.h> namespace cli { class StatementList final : public Statement { std::shared_ptr < Statement > m_statement; std::shared_ptr < StatementList > m_next; public: StatementList ( std::shared_ptr < Statement > statement, std::shared_ptr < StatementList > next ) : m_statement ( statement ), m_next ( next ) { } virtual std::shared_ptr < abstraction::OperationAbstraction > translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > & prev, Environment & environment ) const override { std::shared_ptr < abstraction::OperationAbstraction > next = m_statement->translateAndEval ( prev, environment ); if ( m_next != nullptr ) return m_next->translateAndEval ( next, environment ); else return next; } void append ( std::shared_ptr < Statement > statement ) { if ( m_next == nullptr ) { m_next = std::make_shared < StatementList > ( std::move ( statement ), nullptr ); } else { m_next->append ( std::move ( statement ) ); } } }; } /* namespace cli */ #endif /* _CLI_STATEMENT_LIST_H_ */