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 tt {
13
15 using const_iterator = typename std::vector<token_t>::const_iterator;
16
17 std::string_view::const_iterator first;
18 std::string_view::const_iterator last;
19
21 const_iterator token_it;
22
23 formula_parse_context(std::string_view::const_iterator first, std::string_view::const_iterator last) :
24 first(first), last(last), tokens(parseTokens(first, last)), token_it(tokens.begin()) {}
25
26 [[nodiscard]] token_t const& operator*() const noexcept {
27 return *token_it;
28 }
29
30 [[nodiscard]] token_t const *operator->() const noexcept {
31 return &(*token_it);
32 }
33
34 formula_parse_context& operator++() noexcept {
35 tt_axiom(token_it != tokens.end());
36 tt_axiom(*token_it != tokenizer_name_t::End);
37 ++token_it;
38 return *this;
39 }
40
41 formula_parse_context operator++(int) noexcept {
42 auto tmp = *this;
43 ++(*this);
44 return tmp;
45 }
46};
47
48}
Definition formula_parse_context.hpp:14
Definition tokenizer.hpp:74
T begin(T... args)
T end(T... args)