Label loops

This commit is contained in:
2025-04-12 12:05:32 +02:00
parent 6fd1bda112
commit 8ec407515a
9 changed files with 134 additions and 103 deletions

View File

@ -33,36 +33,6 @@ namespace elna::boot
return this->source_position;
}
assign_statement *statement::is_assign()
{
return nullptr;
}
if_statement *statement::is_if()
{
return nullptr;
}
while_statement *statement::is_while()
{
return nullptr;
}
return_statement *statement::is_return()
{
return nullptr;
}
defer_statement *statement::is_defer()
{
return nullptr;
}
procedure_call *statement::is_call_statement()
{
return nullptr;
}
cast_expression *expression::is_cast()
{
return nullptr;
@ -447,11 +417,6 @@ namespace elna::boot
visitor->visit(this);
}
defer_statement *defer_statement::is_defer()
{
return this;
}
defer_statement::~defer_statement()
{
for (statement *body_statement : statements)
@ -676,11 +641,6 @@ namespace elna::boot
visitor->visit(this);
}
procedure_call *procedure_call::is_call_statement()
{
return this;
}
procedure_call *procedure_call::is_call_expression()
{
return this;
@ -754,8 +714,8 @@ namespace elna::boot
return this;
}
conditional_statements::conditional_statements(expression *prerequisite)
: m_prerequisite(prerequisite)
conditional_statements::conditional_statements(expression *prerequisite, std::vector<statement *>&& statements)
: m_prerequisite(prerequisite), statements(std::move(statements))
{
}
@ -783,11 +743,6 @@ namespace elna::boot
visitor->visit(this);
}
return_statement *return_statement::is_return()
{
return this;
}
return_statement::~return_statement()
{
delete this->return_expression;
@ -820,11 +775,6 @@ namespace elna::boot
visitor->visit(this);
}
assign_statement *assign_statement::is_assign()
{
return this;
}
variable_expression *designator_expression::is_variable()
{
return nullptr;
@ -871,11 +821,6 @@ namespace elna::boot
visitor->visit(this);
}
if_statement *if_statement::is_if()
{
return this;
}
conditional_statements& if_statement::body()
{
return *m_body;
@ -891,8 +836,26 @@ namespace elna::boot
delete this->alternative;
}
while_statement::while_statement(const struct position position, conditional_statements *body)
: node(position), m_body(body)
escape_statement::escape_statement(const struct position position,
escape_direction direction, const std::string& label)
: node(position), direction(direction), label(label)
{
}
void escape_statement::accept(parser_visitor *visitor)
{
visitor->visit(this);
}
while_statement::while_statement(const struct position position, conditional_statements *body,
std::vector<conditional_statements *>&& branches)
: node(position), m_body(body), branches(std::move(branches))
{
}
while_statement::while_statement(const struct position position, conditional_statements *body,
std::vector<conditional_statements *>&& branches, const std::string& label)
: node(position), m_body(body), branches(std::move(branches)), label(label)
{
}
@ -901,11 +864,6 @@ namespace elna::boot
visitor->visit(this);
}
while_statement *while_statement::is_while()
{
return this;
}
conditional_statements& while_statement::body()
{
return *m_body;