Allow comparing all pointer types to nil

This commit is contained in:
2025-02-03 23:04:00 +01:00
parent 607bf09434
commit aab16e4941
7 changed files with 187 additions and 98 deletions

View File

@ -111,23 +111,14 @@
%type <elna::boot::cast_expression *> cast_expression;
%%
program:
type_part constant_part variable_part procedure_part BEGIN_BLOCK optional_statements END_BLOCK DOT
constant_part type_part variable_part procedure_part BEGIN_BLOCK optional_statements END_BLOCK DOT
{
std::vector<elna::boot::definition *> definitions($1.size() + $4.size());
std::vector<elna::boot::definition *>::iterator definition = definitions.begin();
auto tree = new elna::boot::program(elna::boot::make_position(@5));
for (auto type : $1)
{
*definition++ = type;
}
for (auto procedure : $4)
{
*definition++ = procedure;
}
auto tree = new elna::boot::program(elna::boot::make_position(@5), std::move(definitions));
std::swap(tree->constants, $2);
std::swap(tree->constants, $1);
std::swap(tree->types , $2);
std::swap(tree->variables, $3);
std::swap(tree->procedures, $4);
std::swap(tree->body, $6);
driver.tree.reset(tree);