aboutsummaryrefslogtreecommitdiff
path: root/boot/parser.yy
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-10-08 19:45:19 +0200
committerEugen Wissner <belka@caraus.de>2026-10-08 19:45:19 +0200
commit7d07bef760a8807fe49fbe5c90799a1822f95973 (patch)
tree8b8d8ed0003dc61c4bd7313df86f6cbaea3d4b82 /boot/parser.yy
parentd392f0c54a7748b816ab327758ae835f73cd1c0a (diff)
downloadelna-7d07bef760a8807fe49fbe5c90799a1822f95973.tar.gz
Make modules re-exportable
Diffstat (limited to 'boot/parser.yy')
-rw-r--r--boot/parser.yy20
1 files changed, 15 insertions, 5 deletions
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 <std::vector<elna::boot::identifier_definition>> identifier_definitions;
%type <std::unique_ptr<elna::boot::attribute>> attribute;
%type <std::vector<elna::boot::attribute>> attributes;
-%type <std::vector<std::string>> import_declaration;
+%type <std::pair<std::vector<std::string>, bool>> import_declaration;
+%type <std::vector<std::string>> import_path;
%type <std::vector<elna::boot::identifier>> required_identifiers optional_identifiers generic_parameters;
%type <std::unique_ptr<elna::boot::enumeration_type_expression::member_declaration>> enumeration_member;
%type <std::vector<elna::boot::enumeration_type_expression::member_declaration>> 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