Skip to content

File eval_log.hpp

File List > backends > cxx > include > zmbt > expr > eval_log.hpp

Go to the documentation of this file

#ifndef ZMBT_EXPR_EVAL_LOG_HPP_
#define ZMBT_EXPR_EVAL_LOG_HPP_

#include <memory>
#include <ostream>
#include <boost/json.hpp>

namespace zmbt {
namespace lang {

class Expression;

struct EvalLog
{
    mutable std::shared_ptr<boost::json::array> stack;

    EvalLog() = default;

    boost::json::string str(int const indent = 0) const;

    void push(Expression const& expr, Expression const& x, Expression const& result, std::uint64_t const depth) const;


    static void format(std::ostream& os, boost::json::array const& log, int const indent = 0);

    friend std::ostream& operator<<(std::ostream& os, EvalLog const& log);

    static EvalLog make();
};

}  // namespace lang
}  // namespace zmbt

#endif