HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
hikogui
formula
formula_parse_context.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 "../utility/module.hpp"
8
#include "../tokenizer.hpp"
9
#include <vector>
10
#include <string_view>
11
12
namespace
hi::inline
v1
{
13
14
struct
formula_parse_context
{
15
using
const_iterator =
typename
std::vector<token_t>::const_iterator;
16
17
std::vector<token_t>
tokens;
18
const_iterator token_it;
19
20
formula_parse_context
(std::string_view::const_iterator first, std::string_view::const_iterator last) :
21
tokens(
parseTokens
(first, last)), token_it(tokens.
begin
())
22
{
23
}
24
25
[[nodiscard]]
token_t
const
&operator*()
const
noexcept
26
{
27
return
*token_it;
28
}
29
30
[[nodiscard]]
token_t
const
*operator->()
const
noexcept
31
{
32
return
&(*token_it);
33
}
34
35
formula_parse_context
&operator++()
noexcept
36
{
37
hi_assert
(token_it != tokens.
end
());
38
hi_assert
(*token_it != tokenizer_name_t::End);
39
++token_it;
40
return
*
this
;
41
}
42
43
formula_parse_context
operator++(
int
)
noexcept
44
{
45
auto
tmp = *
this
;
46
++(*this);
47
return
tmp;
48
}
49
};
50
51
}
// namespace hi::inline v1
hi_assert
#define hi_assert(expression,...)
Assert if expression is true.
Definition
assert.hpp:184
v1
DOXYGEN BUG.
Definition
algorithm.hpp:13
v1::parseTokens
std::vector< token_t > parseTokens(std::string_view text) noexcept
v1::formula_parse_context
Definition
formula_parse_context.hpp:14
v1::token_t
Definition
tokenizer.hpp:95
std::vector::begin
T begin(T... args)
std::vector::end
T end(T... args)
std::vector
Generated on Mon Apr 22 2024 12:52:45 for HikoGUI by
1.10.0