Split code generation from the ui
This commit is contained in:
@ -1,9 +1,7 @@
|
||||
#include "elna/source/parser.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace elna
|
||||
{
|
||||
namespace source
|
||||
namespace elna::source
|
||||
{
|
||||
/**
|
||||
* AST node.
|
||||
@ -67,17 +65,17 @@ namespace source
|
||||
return m_number;
|
||||
}
|
||||
|
||||
variable::variable(const std::string& name)
|
||||
variable_expression::variable_expression(const std::string& name)
|
||||
: m_name(name)
|
||||
{
|
||||
}
|
||||
|
||||
void variable::accept(ParserVisitor *visitor)
|
||||
void variable_expression::accept(ParserVisitor *visitor)
|
||||
{
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
const std::string& variable::name() const noexcept
|
||||
const std::string& variable_expression::name() const noexcept
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
@ -154,7 +152,7 @@ namespace source
|
||||
{
|
||||
if (tokens->of() == source::token::type::identifier)
|
||||
{
|
||||
auto result = std::make_unique<variable>(tokens->identifier());
|
||||
auto result = std::make_unique<variable_expression>(tokens->identifier());
|
||||
++tokens;
|
||||
return result;
|
||||
}
|
||||
@ -291,4 +289,3 @@ namespace source
|
||||
return std::make_unique<block>(std::move(definitions), std::move(parsed_statement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user