7#include "formula_post_process_context.hpp"
8#include "formula_evaluation_context.hpp"
9#include "../utility/utility.hpp"
10#include "../parser/parser.hpp"
11#include "../codec/codec.hpp"
12#include "../macros.hpp"
17hi_export_module(hikogui.formula.formula_node);
19namespace hi {
inline namespace v1 {
34 formula_node(
size_t line_nr,
size_t column_nr) : line_nr(line_nr), column_nr(column_nr) {}
62 throw operation_error(std::format(
"{}:{}: Expression is not a modifiable value.", line_nr, column_nr));
65 virtual bool has_evaluate_xvalue()
const
74 throw operation_error(std::format(
"{}:{}: Expression is not a xvalue.", line_nr, column_nr));
96 throw operation_error(std::format(
"{}:{}: Expression is not callable.", line_nr, column_nr));
103 throw parse_error(std::format(
"{}:{}: Expect a name, got {})", line_nr, column_nr, *
this));
111 throw parse_error(std::format(
"{}:{}: Expect a function definition, got {})", line_nr, column_nr, *
this));
125struct std::formatter<
hi::formula_node, CharT> : std::formatter<std::string_view, CharT> {
128 return std::formatter<std::string_view, CharT>::format(
to_string(t), fc);
132namespace hi {
inline namespace v1 {
136 return lhs << std::format(
"{}", rhs);
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
A dynamic data type.
Definition datum.hpp:212
Definition formula_evaluation_context.hpp:18
Definition formula_node.hpp:21
virtual datum & assign(formula_evaluation_context &context, datum const &rhs) const
Assign to a non-existing or existing lvalue.
Definition formula_node.hpp:79
virtual std::string get_name() const
Get the name of a formula_name_node.
Definition formula_node.hpp:101
virtual void post_process(formula_post_process_context &context)
Resolve function and method pointers.
Definition formula_node.hpp:39
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:94
virtual datum const & evaluate_xvalue(formula_evaluation_context const &context) const
Evaluate an existing xvalue.
Definition formula_node.hpp:72
virtual datum & evaluate_lvalue(formula_evaluation_context &context) const
Evaluate an existing lvalue.
Definition formula_node.hpp:60
virtual std::vector< std::string > get_name_and_argument_names() const
Get name and argument names from a function declaration.
Definition formula_node.hpp:109
virtual void resolve_function_pointer(formula_post_process_context &context)
Resolve function and method pointers.
Definition formula_node.hpp:44
virtual datum evaluate(formula_evaluation_context &context) const =0
Evaluate an rvalue.
Definition formula_post_process_context.hpp:237
Exception thrown during parsing on an error.
Definition exception_intf.hpp:47
Exception thrown during execution of a dynamic operation.
Definition exception_intf.hpp:160