Rune Caster 1.0.0
Modern C++ Text Processing Framework
Loading...
Searching...
No Matches
whitespace_tokenizer.cpp
Go to the documentation of this file.
2
3namespace rune_caster {
4namespace spell {
5namespace core {
6
8 output_type tokens;
9 if (input.empty()) return tokens;
10
11 RuneSequence current;
12 for (const auto& rune : input) {
13 if (unicode::is_whitespace(rune.codepoint())) {
14 if (!current.empty()) {
15 tokens.push_back(current);
16 current.clear();
17 }
18 } else {
19 current.push_back(rune);
20 }
21 }
22 if (!current.empty()) tokens.push_back(current);
23 return tokens;
24}
25
26} // namespace core
27} // namespace spell
28} // namespace rune_caster
bool empty() const noexcept
void push_back(const Rune &rune)
output_type operator()(const input_type &input) const override
Apply the spell transformation.
constexpr bool is_whitespace(char32_t cp) noexcept
Definition unicode.hpp:72
RuneString RuneSequence
Backward compatibility alias for RuneString.