Replace ! with a function call writei
This commit is contained in:
@ -108,20 +108,18 @@ namespace elna::source
|
||||
}
|
||||
|
||||
token::token(const token& that)
|
||||
: m_type(that.of()), m_position(that.position())
|
||||
{
|
||||
*this = that;
|
||||
}
|
||||
|
||||
token::token(token&& that)
|
||||
: m_type(that.of()), m_position(that.position())
|
||||
{
|
||||
*this = std::move(that);
|
||||
}
|
||||
|
||||
token::~token()
|
||||
{
|
||||
if (m_type == type::identifier || m_type == type::term_operator || m_type == type::factor_operator)
|
||||
if (has_identifier())
|
||||
{
|
||||
m_value.identifier.~basic_string();
|
||||
}
|
||||
@ -129,11 +127,15 @@ namespace elna::source
|
||||
|
||||
token& token::operator=(const token& that)
|
||||
{
|
||||
if (has_identifier())
|
||||
{
|
||||
m_value.identifier.~basic_string();
|
||||
}
|
||||
m_type = that.of();
|
||||
m_position = that.position();
|
||||
if (that.has_identifier())
|
||||
{
|
||||
m_value.identifier = that.identifier();
|
||||
new((void *) &m_value.identifier) std::string(that.identifier());
|
||||
}
|
||||
else if (that.is_numeric())
|
||||
{
|
||||
@ -148,11 +150,15 @@ namespace elna::source
|
||||
|
||||
token& token::operator=(token&& that)
|
||||
{
|
||||
if (has_identifier())
|
||||
{
|
||||
m_value.identifier.~basic_string();
|
||||
}
|
||||
m_type = that.of();
|
||||
m_position = that.position();
|
||||
if (that.has_identifier())
|
||||
{
|
||||
m_value.identifier = std::move(that.identifier());
|
||||
new((void *) &m_value.identifier) std::string(std::move(that.identifier()));
|
||||
}
|
||||
else if (that.is_numeric())
|
||||
{
|
||||
@ -344,10 +350,6 @@ namespace elna::source
|
||||
{
|
||||
tokens.emplace_back(token::type::comma, iterator.position());
|
||||
}
|
||||
else if (*iterator == '!')
|
||||
{
|
||||
tokens.emplace_back(token::type::bang, iterator.position());
|
||||
}
|
||||
else if (*iterator == '?')
|
||||
{
|
||||
tokens.emplace_back(token::type::question_mark, iterator.position());
|
||||
|
Reference in New Issue
Block a user