HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
skeleton_expression_node.hpp
1// Copyright Take Vos 2020-2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "skeleton_node.hpp"
8#include "../macros.hpp"
9
10namespace hi::inline v1 {
11
14
16 skeleton_node(std::move(location)), expression(std::move(expression))
17 {
18 }
19
20 void post_process(formula_post_process_context &context) override
21 {
22 post_process_expression(context, *expression, location);
23 }
24
25 std::string string() const noexcept override
26 {
27 return std::format("<expression {}>", *expression);
28 }
29
30 datum evaluate(formula_evaluation_context &context) override
31 {
32 hilet tmp = evaluate_formula_without_output(context, *expression, location);
33 if (tmp.is_break()) {
34 throw operation_error(std::format("{}: Found #break not inside a loop statement.", location));
35
36 } else if (tmp.is_continue()) {
37 throw operation_error(std::format("{}: Found #continue not inside a loop statement.", location));
38
39 } else {
40 return {};
41 }
42 }
43};
44
45} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:16
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
Definition parse_location.hpp:18
Definition skeleton_expression_node.hpp:12
datum evaluate(formula_evaluation_context &context) override
Evaluate the template.
Definition skeleton_expression_node.hpp:30
Definition skeleton_node.hpp:16
T move(T... args)