@@ -721,7 +721,7 @@ struct postfix_expression_node
721721 if (ops.empty ()) {
722722 return false ;
723723 } else {
724- return (ops.front ().op ->type () == lexeme::Ampersand
724+ return (ops.front ().op ->type () == lexeme::Ampersand
725725 || ops.front ().op ->type () == lexeme::Tilde);
726726 }
727727 }
@@ -2225,7 +2225,7 @@ struct alias_node
22252225};
22262226
22272227
2228- enum class accessibility { default_ = 0 , public_, protected_, private_ };
2228+ enum class accessibility { default_ = 0 , public_, protected_, private_, export_ };
22292229
22302230auto to_string (accessibility a)
22312231 -> std::string
@@ -2234,6 +2234,7 @@ auto to_string(accessibility a)
22342234 break ;case accessibility::public_ : return " public" ;
22352235 break ;case accessibility::protected_: return " protected" ;
22362236 break ;case accessibility::private_ : return " private" ;
2237+ break ;case accessibility::export_ : return " export" ;
22372238 break ;default : assert (a == accessibility::default_);
22382239 }
22392240 return " default" ;
@@ -2358,6 +2359,12 @@ struct declaration_node
23582359 return access == accessibility::private_;
23592360 }
23602361
2362+ auto is_export () const
2363+ -> bool
2364+ {
2365+ return access == accessibility::export_;
2366+ }
2367+
23612368 auto is_default_access () const
23622369 -> bool
23632370 {
@@ -3993,7 +4000,7 @@ class parser
39934000 // || curr().type() == lexeme::LeftBrace
39944001 )
39954002 {
3996- bool inside_initializer = (
4003+ bool inside_initializer = (
39974004 peek (-1 ) && peek (-1 )->type () == lexeme::Assignment
39984005 );
39994006 auto open_paren = &curr ();
@@ -4015,12 +4022,12 @@ class parser
40154022 next ();
40164023 if (
40174024 curr ().type () != lexeme::Semicolon
4018- && curr ().type () != lexeme::RightParen
4019- && curr ().type () != lexeme::RightBracket
4025+ && curr ().type () != lexeme::RightParen
4026+ && curr ().type () != lexeme::RightBracket
40204027 && curr ().type () != lexeme::Comma
40214028 ) {
40224029 expr_list->inside_initializer = false ;
4023- }
4030+ }
40244031 n->expr = std::move (expr_list);
40254032 return n;
40264033 }
@@ -4374,7 +4381,7 @@ class parser
43744381 // G shift-expression '<<' additive-expression
43754382 // G shift-expression '>>' additive-expression
43764383 // G
4377- auto shift_expression (bool allow_angle_operators = true )
4384+ auto shift_expression (bool allow_angle_operators = true )
43784385 -> auto
43794386 {
43804387 if (allow_angle_operators) {
@@ -4409,7 +4416,7 @@ class parser
44094416 // G shift-expression
44104417 // G compare-expression '<=>' shift-expression
44114418 // G
4412- auto compare_expression (bool allow_angle_operators = true )
4419+ auto compare_expression (bool allow_angle_operators = true )
44134420 -> auto
44144421 {
44154422 return binary_expression<compare_expression_node> (
@@ -4425,7 +4432,7 @@ class parser
44254432 // G relational-expression '<=' compare-expression
44264433 // G relational-expression '>=' compare-expression
44274434 // G
4428- auto relational_expression (bool allow_angle_operators = true )
4435+ auto relational_expression (bool allow_angle_operators = true )
44294436 -> auto
44304437 {
44314438 if (allow_angle_operators) {
@@ -4457,7 +4464,7 @@ class parser
44574464 // G equality-expression '==' relational-expression
44584465 // G equality-expression '!=' relational-expression
44594466 // G
4460- auto equality_expression (bool allow_angle_operators = true )
4467+ auto equality_expression (bool allow_angle_operators = true )
44614468 -> auto
44624469 {
44634470 return binary_expression<equality_expression_node> (
@@ -4470,7 +4477,7 @@ class parser
44704477 // G equality-expression
44714478 // G bit-and-expression '&' equality-expression
44724479 // G
4473- auto bit_and_expression (bool allow_angle_operators = true )
4480+ auto bit_and_expression (bool allow_angle_operators = true )
44744481 -> auto
44754482 {
44764483 return binary_expression<bit_and_expression_node> (
@@ -4483,7 +4490,7 @@ class parser
44834490 // G bit-and-expression
44844491 // G bit-xor-expression '^' bit-and-expression
44854492 // G
4486- auto bit_xor_expression (bool allow_angle_operators = true )
4493+ auto bit_xor_expression (bool allow_angle_operators = true )
44874494 -> auto
44884495 {
44894496 return binary_expression<bit_xor_expression_node> (
@@ -4496,7 +4503,7 @@ class parser
44964503 // G bit-xor-expression
44974504 // G bit-or-expression '|' bit-xor-expression
44984505 // G
4499- auto bit_or_expression (bool allow_angle_operators = true )
4506+ auto bit_or_expression (bool allow_angle_operators = true )
45004507 -> auto
45014508 {
45024509 return binary_expression<bit_or_expression_node> (
@@ -4509,7 +4516,7 @@ class parser
45094516 // G bit-or-expression
45104517 // G logical-and-expression '&&' bit-or-expression
45114518 // G
4512- auto logical_and_expression (bool allow_angle_operators = true )
4519+ auto logical_and_expression (bool allow_angle_operators = true )
45134520 -> auto
45144521 {
45154522 return binary_expression<logical_and_expression_node> (
@@ -4524,7 +4531,7 @@ class parser
45244531 // G logical-and-expression
45254532 // G logical-or-expression '||' logical-and-expression
45264533 // G
4527- auto logical_or_expression (bool allow_angle_operators = true )
4534+ auto logical_or_expression (bool allow_angle_operators = true )
45284535 -> auto
45294536 {
45304537 return binary_expression<logical_or_expression_node> (
@@ -4842,7 +4849,7 @@ class parser
48424849
48434850 n->open_angle = curr ().position ();
48444851 next ();
4845-
4852+
48464853 auto term = unqualified_id_node::term{};
48474854
48484855 do {
@@ -6413,7 +6420,7 @@ class parser
64136420 }
64146421 assert (n->is_type ());
64156422 }
6416-
6423+
64176424 // Or a function type, declaring a function - and tell the function whether it's in a user-defined type
64186425 else if (auto t = function_type (n.get (), named))
64196426 {
@@ -6561,11 +6568,11 @@ class parser
65616568 )
65626569 {
65636570 auto & type = std::get<declaration_node::an_object>(n->type );
6564- // object initialized by the address of the curr() object
6571+ // object initialized by the address of the curr() object
65656572 if (peek (1 )->type () == lexeme::Ampersand) {
65666573 type->address_of = &curr ();
65676574 }
6568- // object initialized by (potentially multiple) dereference of the curr() object
6575+ // object initialized by (potentially multiple) dereference of the curr() object
65696576 else if (peek (1 )->type () == lexeme::Multiply) {
65706577 type->dereference_of = &curr ();
65716578 for (int i = 1 ; peek (i)->type () == lexeme::Multiply; ++i)
@@ -6770,7 +6777,7 @@ class parser
67706777 return {};
67716778 }
67726779 if (
6773- t->is_wildcard ()
6780+ t->is_wildcard ()
67746781 || ( t->get_token () && t->get_token ()->to_string (true ) == " auto" )
67756782 ) {
67766783 errors.emplace_back (
@@ -6878,6 +6885,10 @@ class parser
68786885 access = accessibility::private_;
68796886 next ();
68806887 }
6888+ else if (curr () == " export" ) {
6889+ access = accessibility::export_;
6890+ next ();
6891+ }
68816892
68826893 // If they wrote an access-specifier, see if they put a ':'
68836894 // after it out of Cpp1 habit (there's no colon in Cpp2)
0 commit comments