Allow empty var sections

This commit is contained in:
2025-03-29 10:53:13 +01:00
parent 413f23af4d
commit 0658d07e97
3 changed files with 29 additions and 30 deletions

View File

@ -530,7 +530,7 @@ variable_declarations:
$$.reserve($$.size() + $3.size());
$$.insert(std::end($$), std::begin($3), std::end($3));
}
| variable_declaration { std::swap($$, $1); }
| /* no variable declarations */ {}
variable_part:
/* no variable declarations */ {}
| "var" variable_declarations { std::swap($$, $2); }
@ -553,9 +553,9 @@ type_definition: identifier_definition "=" type_expression
$$ = new boot::type_definition(boot::make_position(@1), $1.first, $1.second, $3);
}
type_definitions:
type_definition type_definitions
type_definition ";" type_definitions
{
std::swap($$, $2);
std::swap($$, $3);
$$.insert($$.cbegin(), $1);
}
| /* no type definitions */ {}