Support compound statements

This commit is contained in:
2024-03-11 10:43:26 +01:00
parent 2c396ece17
commit 25657ac36d
12 changed files with 242 additions and 86 deletions

View File

@ -58,6 +58,12 @@ namespace elna::source
return *this;
}
text_iterator text_iterator::operator+(std::size_t step)
{
auto result = *this;
return ++result;
}
bool text_iterator::operator==(const text_iterator& that) const noexcept
{
return this->m_buffer == that.m_buffer;
@ -309,6 +315,11 @@ namespace elna::source
tokens.emplace_back(token::type::factor_operator, _operator.c_str(), iterator.position());
}
else if (*iterator == ':' && iterator + 1 != text_end && *(iterator + 1) == '=')
{
tokens.emplace_back(token::type::assignment, iterator.position());
++iterator;
}
else
{
return source_result(unexpected_character{ std::string{ *iterator }, iterator.position() });