From 7d07bef760a8807fe49fbe5c90799a1822f95973 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 8 Oct 2026 19:45:19 +0200 Subject: Make modules re-exportable --- boot/parser.yy | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'boot/parser.yy') diff --git a/boot/parser.yy b/boot/parser.yy index cfa63d5..65d3dba 100644 --- a/boot/parser.yy +++ b/boot/parser.yy @@ -160,7 +160,8 @@ along with GCC; see the file COPYING3. If not see %type > identifier_definitions; %type > attribute; %type > attributes; -%type > import_declaration; +%type , bool>> import_declaration; +%type > import_path; %type > required_identifiers optional_identifiers generic_parameters; %type > enumeration_member; %type > enumeration_members; @@ -736,22 +737,31 @@ variable_declarations: $$ = $2; $$.insert(std::cbegin($$), $1); } -import_declaration: - IDENTIFIER "." import_declaration +import_path: + IDENTIFIER "." import_path { $$ = $3; $$.emplace($$.cbegin(), $1); } | IDENTIFIER { $$.emplace_back($1); } +import_declaration: + import_path "*" { $$ = { $1, true }; } + | import_path { $$ = { $1, false }; } import_declarations: import_declaration "," import_declarations { + auto [segments, exported] = $1; + $$ = $3; - $$.emplace($$.cbegin(), new boot::import_declaration(boot::make_position(@$), $1)); + $$.emplace($$.cbegin(), + new boot::import_declaration(boot::make_position(@$), std::move(segments), exported)); } | import_declaration { - $$.emplace_back(new boot::import_declaration(boot::make_position(@$), $1)); + auto [segments, exported] = $1; + + $$.emplace_back( + new boot::import_declaration(boot::make_position(@$), std::move(segments), exported)); } type_declaration: identifier_definition generic_parameters "=" type_expression -- cgit v1.2.3