7#include "formula_node.hpp"
8#include "../macros.hpp"
10hi_export_module(hikogui.formula.formula_name_node);
12namespace hi {
inline namespace v1 {
16 mutable formula_post_process_context::function_type function;
18 formula_name_node(
size_t line_nr,
size_t column_nr, std::string_view name) : formula_node(line_nr, column_nr), name(name) {}
22 function = context.get_function(name);
24 throw parse_error(std::format(
"{}:{}: Could not find function {}().", line_nr, column_nr, name));
30 hilet &const_context = context;
33 return const_context.get(name);
35 throw operation_error(std::format(
"{}:{}: Can not evaluate function.\n{}", line_nr, column_nr, e.
what()));
42 return context.get(name);
44 throw operation_error(std::format(
"{}:{}: Can not evaluate function.\n{}", line_nr, column_nr, e.
what()));
48 bool has_evaluate_xvalue()
const override
58 return context.get(name);
60 throw operation_error(std::format(
"{}:{}: Can not evaluate function.\n{}", line_nr, column_nr, e.
what()));
67 return context.set(name, rhs);
69 throw operation_error(std::format(
"{}:{}: Can not evaluate function.\n{}", line_nr, column_nr, e.
what()));
75 return function(context, arguments);
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
The HikoGUI API version 1.
Definition lookahead_iterator.hpp:6
A dynamic data type.
Definition datum.hpp:212
Definition formula_evaluation_context.hpp:18
Definition formula_name_node.hpp:14
datum evaluate(formula_evaluation_context &context) const override
Evaluate an rvalue.
Definition formula_name_node.hpp:28
datum & assign(formula_evaluation_context &context, datum const &rhs) const override
Assign to a non-existing or existing lvalue.
Definition formula_name_node.hpp:64
datum & evaluate_lvalue(formula_evaluation_context &context) const override
Evaluate an existing lvalue.
Definition formula_name_node.hpp:39
datum const & evaluate_xvalue(formula_evaluation_context const &context) const override
Evaluate an existing xvalue.
Definition formula_name_node.hpp:55
datum call(formula_evaluation_context &context, datum::vector_type const &arguments) const override
Call a function with a datum::vector as arguments.
Definition formula_name_node.hpp:73
void resolve_function_pointer(formula_post_process_context &context) override
Resolve function and method pointers.
Definition formula_name_node.hpp:20
std::string get_name() const noexcept override
Get the name of a formula_name_node.
Definition formula_name_node.hpp:78
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