11#include " noad/noad.hpp"
22
3- #include " node/hlist.hpp"
43#include " mlist_with_kind.hpp"
54#include " noad/accent.hpp"
65#include " noad/big_op.hpp"
1211#include " noad/script.hpp"
1312#include " noad/underline.hpp"
1413#include " node/box.hpp"
14+ #include " node/hlist.hpp"
1515#include " settings.hpp"
1616
1717#include < algorithm>
@@ -39,22 +39,20 @@ namespace mfl
3939
4040 hlist noad_to_hlist (const settings s, const cramping cramp, const noad& n)
4141 {
42- return std::visit (
43- overload{[&](const math_char& c) { return math_char_to_hlist (s, c); },
44- [&](const radical& r) { return radical_to_hlist (s, cramp, r); },
45- [&](const accent& a) { return accent_to_hlist (s, cramp, a); },
46- [](const vcenter&) { return hlist{}; },
47- [&](const overline& o) { return overline_to_hlist (s, cramp, o); },
48- [&](const underline& u) { return underline_to_hlist (s, cramp, u); },
49- [&](const fraction& f) { return fraction_to_hlist (s, cramp, f); },
50- [&](const left_right& l) { return left_right_to_hlist (s, cramp, l); },
51- [&](const script& sc) { return script_to_hlist (s, cramp, sc); },
52- [&](const big_op& b) { return big_op_to_hlist (s, cramp, b); },
53- [](const math_space&) { return hlist{}; },
54- [&](const mlist& m) { return to_hlist (s, cramp, false , m.noads ); },
55- [&](const mlist_with_kind& m) { return to_hlist (s, cramp, false , m.noads ); }
56- },
57- n);
42+ return std::visit (overload{[&](const math_char& c) { return math_char_to_hlist (s, c); },
43+ [&](const radical& r) { return radical_to_hlist (s, cramp, r); },
44+ [&](const accent& a) { return accent_to_hlist (s, cramp, a); },
45+ [](const vcenter&) { return hlist{}; },
46+ [&](const overline& o) { return overline_to_hlist (s, cramp, o); },
47+ [&](const underline& u) { return underline_to_hlist (s, cramp, u); },
48+ [&](const fraction& f) { return fraction_to_hlist (s, cramp, f); },
49+ [&](const left_right& l) { return left_right_to_hlist (s, cramp, l); },
50+ [&](const script& sc) { return script_to_hlist (s, cramp, sc); },
51+ [&](const big_op& b) { return big_op_to_hlist (s, cramp, b); },
52+ [](const math_space&) { return hlist{}; },
53+ [&](const mlist& m) { return to_hlist (s, cramp, false , m.noads ); },
54+ [&](const mlist_with_kind& m) { return to_hlist (s, cramp, false , m.noads ); }},
55+ n);
5856 }
5957
6058 ilist noads_to_intermediate_terms (const settings s, const cramping cramp, const std::vector<noad>& noads)
@@ -65,8 +63,7 @@ namespace mfl
6563 if (std::holds_alternative<math_space>(n)) { result.terms .emplace_back (std::get<math_space>(n)); }
6664 else
6765 {
68- result.terms .emplace_back (
69- inoad{.translated_noad = noad_to_hlist (s, cramp, n), .kind = kind (n)});
66+ result.terms .emplace_back (inoad{.translated_noad = noad_to_hlist (s, cramp, n), .kind = kind (n)});
7067 }
7168 }
7269
@@ -112,12 +109,11 @@ namespace mfl
112109 {.left = item_kind::op, .right = item_kind::ord, .space = thin_skip_always}};
113110
114111 const auto is_entry_for_items = [&](const table_entry& e) {
115- return (((e.left == left) or (e.left == item_kind::any)) and
116- ((e.right == right) or (e.right == item_kind::any)));
112+ return (((e.left == left) or (e.left == item_kind::any))
113+ and ((e.right == right) or (e.right == item_kind::any)));
117114 };
118115
119- if (const auto it = std::ranges::find_if (table, is_entry_for_items); it != table.end ())
120- return it->space ;
116+ if (const auto it = std::ranges::find_if (table, is_entry_for_items); it != table.end ()) return it->space ;
121117
122118 return std::nullopt ;
123119 }
@@ -151,8 +147,8 @@ namespace mfl
151147
152148 item_kind kind_of_next_inoad (const std::span<const intermediate_term> iterms)
153149 {
154- const auto it =
155- std::ranges::find_if ( iterms, [](const intermediate_term& t) { return std::holds_alternative<inoad>(t); });
150+ const auto it = std::ranges::find_if (
151+ iterms, [](const intermediate_term& t) { return std::holds_alternative<inoad>(t); });
156152
157153 return it == iterms.end () ? item_kind::none : std::get<inoad>(*it).kind ;
158154 }
@@ -171,7 +167,8 @@ namespace mfl
171167 return std::ranges::find (kinds, kind) != kinds.end ();
172168 }
173169
174- item_kind change_kind (const item_kind prev_kind, const item_kind kind, const std::span<const intermediate_term> iterms)
170+ item_kind change_kind (const item_kind prev_kind, const item_kind kind,
171+ const std::span<const intermediate_term> iterms)
175172 {
176173 if (kind != item_kind::bin) return kind;
177174
@@ -194,7 +191,8 @@ namespace mfl
194191 kind = change_kind (prev_kind, n.kind , tail);
195192 const auto space = make_space (s, math_spacing (prev_kind, n.kind ));
196193 result.nodes .insert (result.nodes .end (), space.nodes .begin (), space.nodes .end ());
197- result.nodes .insert (result.nodes .end (), n.translated_noad .nodes .begin (), n.translated_noad .nodes .end ());
194+ result.nodes .insert (result.nodes .end (), n.translated_noad .nodes .begin (),
195+ n.translated_noad .nodes .end ());
198196 }
199197 else if (std::holds_alternative<ispace>(term))
200198 {
@@ -216,7 +214,9 @@ namespace mfl
216214 item_kind nucleus_kind (const script& s)
217215 {
218216 if ((s.nucleus .size () == 1 ) && (std::holds_alternative<math_char>(s.nucleus .front ())))
219- { return std::get<math_char>(s.nucleus .front ()).kind ; }
217+ {
218+ return std::get<math_char>(s.nucleus .front ()).kind ;
219+ }
220220
221221 return item_kind::ord;
222222 }
0 commit comments