7#include "formula_post_process_context.hpp"
8#include "formula_evaluation_context.hpp"
9#include "../utility/module.hpp"
10#include "../parse_location.hpp"
11#include "../datum.hpp"
16namespace hi::inline
v1 {
20template<
typename CharT>
21struct std::formatter<
hi::formula_node, CharT> : std::formatter<string_view, CharT> {
22 auto format(hi::formula_node
const& t,
auto& fc)
const
23 ->
decltype(std::formatter<string_view, CharT>{}.format(
std::string{}, fc));
26namespace hi::inline
v1 {
58 context.disable_output();
59 auto r = evaluate(context);
60 context.enable_output();
68 throw operation_error(std::format(
"{}: Expression is not a modifiable value.", location));
71 virtual bool has_evaluate_xvalue()
const
80 throw operation_error(std::format(
"{}: Expression is not a xvalue.", location));
87 return evaluate_lvalue(context) = rhs;
92 context.disable_output();
93 auto& r = assign(context, rhs);
94 context.enable_output();
102 throw operation_error(std::format(
"{}: Expression is not callable.", location));
109 throw parse_error(std::format(
"{}: Expect a name got {})", location, *
this));
117 throw parse_error(std::format(
"{}: Expect a function definition got {})", location, *
this));
129 return lhs << to_string(rhs);
135template<
typename CharT>
136auto std::formatter<hi::formula_node, CharT>::format(hi::formula_node
const& t,
auto& fc)
const
137 ->
decltype(std::formatter<string_view, CharT>{}.format(
std::string{}, fc))
139 return std::formatter<string_view, CharT>{}.format(
to_string(t), fc);
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
A dynamic data type.
Definition datum.hpp:219
Definition formula_evaluation_context.hpp:15
Definition formula_node.hpp:28
virtual std::string get_name() const
Get the name of a formula_name_node.
Definition formula_node.hpp:107
virtual void post_process(formula_post_process_context &context)
Resolve function and method pointers.
Definition formula_node.hpp:45
virtual datum call(formula_evaluation_context &context, datum::vector_type const &arguments) const
Call a function with a datum::vector as arguments.
Definition formula_node.hpp:100
virtual datum evaluate(formula_evaluation_context &context) const =0
Evaluate an rvalue.
virtual datum & assign(formula_evaluation_context &context, datum const &rhs) const
Assign to a non-existing or existing lvalue.
Definition formula_node.hpp:85
virtual std::vector< std::string > get_name_and_argument_names() const
Get name and argument names from a function declaration.
Definition formula_node.hpp:115
virtual datum const & evaluate_xvalue(formula_evaluation_context const &context) const
Evaluate an existing xvalue.
Definition formula_node.hpp:78
virtual void resolve_function_pointer(formula_post_process_context &context)
Resolve function and method pointers.
Definition formula_node.hpp:50
virtual datum & evaluate_lvalue(formula_evaluation_context &context) const
Evaluate an existing lvalue.
Definition formula_node.hpp:66
Definition formula_post_process_context.hpp:19
Definition parse_location.hpp:18