HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
skeleton_top_node.hpp
1// Copyright Take Vos 2020.
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
9namespace tt {
10
12 statement_vector children;
13
15 skeleton_node(std::move(location)), children() {}
16
19 bool append(std::unique_ptr<skeleton_node> x) noexcept override {
20 append_child(children, std::move(x));
21 return true;
22 }
23
24 void post_process(formula_post_process_context &context) override {
25 if (std::ssize(children) > 0) {
26 children.back()->left_align();
27 }
28
29 for (ttlet &child: children) {
30 child->post_process(context);
31 }
32 }
33
35 try {
36 return evaluate_children(context, children);
37
38 } catch (...) {
39 auto error_location = location;
40 if (auto formula_location = error_info::peek<parse_location, "parse_location">()) {
41 error_location += *formula_location;
42 }
43 error_info(true).set<"parse_location">(error_location);
44 throw;
45 }
46 }
47
48 std::string string() const noexcept override {
49 ttlet children_str = transform<std::vector<std::string>>(children, [](ttlet &x) { return x->string(); });
50 return fmt::format("<top {}>", join(children_str));
51 }
52};
53
54}
Error information passed alongside an error code or exception.
Definition error_info.hpp:81
error_info & set(Arg &&value) noexcept
Set an information for a given tag.
Definition error_info.hpp:144
Definition formula_evaluation_context.hpp:16
Definition formula_post_process_context.hpp:18
Definition parse_location.hpp:16
Definition skeleton_node.hpp:16
Definition skeleton_top_node.hpp:11
datum evaluate(formula_evaluation_context &context) override
Evaluate the template.
Definition skeleton_top_node.hpp:34
bool append(std::unique_ptr< skeleton_node > x) noexcept override
Append a template-piece to the current template.
Definition skeleton_top_node.hpp:19
T move(T... args)