HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
formula_parse_context.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 "../required.hpp"
8#include "../tokenizer.hpp"
9#include <vector>
10#include <string_view>
11
12namespace hi::inline v1 {
13
15 using const_iterator = typename std::vector<token_t>::const_iterator;
16
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_axiom(token_it != tokens.end());
38 hi_axiom(*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
This file includes required definitions.
Definition formula_parse_context.hpp:14
Definition tokenizer.hpp:74
T begin(T... args)
T end(T... args)