Changeset c7f12a4


Ignore:
Timestamp:
Oct 30, 2022, 3:59:54 PM (18 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
0bdfcc3, 637c139
Parents:
7a2057a
Message:

parse enum hiding

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r7a2057a rc7f12a4  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Oct 14 14:04:43 2022
    13 // Update Count     : 5751
     12// Last Modified On : Fri Oct 28 15:27:08 2022
     13// Update Count     : 5764
    1414//
    1515
     
    25532553        | ENUM attribute_list_opt identifier
    25542554                { typedefTable.makeTypedef( *$3 ); }
    2555           '{' enumerator_list comma_opt '}'
    2556                 { $$ = DeclarationNode::newEnum( $3, $6, true, false )->addQualifiers( $2 ); }
     2555          hide_opt '{' enumerator_list comma_opt '}'
     2556                { $$ = DeclarationNode::newEnum( $3, $7, true, false )->addQualifiers( $2 ); }
    25572557        | ENUM attribute_list_opt typedef_name                          // unqualified type name
    2558           '{' enumerator_list comma_opt '}'
    2559                 { $$ = DeclarationNode::newEnum( $3->name, $5, true, false )->addQualifiers( $2 ); }
     2558          hide_opt '{' enumerator_list comma_opt '}'
     2559                { $$ = DeclarationNode::newEnum( $3->name, $6, true, false )->addQualifiers( $2 ); }
    25602560        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}'
    25612561                {
     
    25742574                        typedefTable.makeTypedef( *$6 );
    25752575                }
    2576           '{' enumerator_list comma_opt '}'
    2577                 {
    2578                         $$ = DeclarationNode::newEnum( $6, $10, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
     2576          hide_opt '{' enumerator_list comma_opt '}'
     2577                {
     2578                        $$ = DeclarationNode::newEnum( $6, $11, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
    25792579                }
    25802580        | ENUM '(' ')' attribute_list_opt identifier attribute_list_opt
    2581           '{' enumerator_list comma_opt '}'
    2582                 {
    2583                         $$ = DeclarationNode::newEnum( $5, $8, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
    2584                 }
    2585         | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt '{' enumerator_list comma_opt '}'
    2586                 {
    2587                         $$ = DeclarationNode::newEnum( $6->name, $9, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
    2588                 }
    2589         | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt '{' enumerator_list comma_opt '}'
    2590                 {
    2591                         $$ = DeclarationNode::newEnum( $5->name, $8, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
     2581          hide_opt '{' enumerator_list comma_opt '}'
     2582                {
     2583                        $$ = DeclarationNode::newEnum( $5, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
     2584                }
     2585        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt
     2586          hide_opt '{' enumerator_list comma_opt '}'
     2587                {
     2588                        $$ = DeclarationNode::newEnum( $6->name, $10, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
     2589                }
     2590        | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt
     2591          hide_opt '{' enumerator_list comma_opt '}'
     2592                {
     2593                        $$ = DeclarationNode::newEnum( $5->name, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
    25922594                }
    25932595        | enum_type_nobody
     2596        ;
     2597
     2598hide_opt:
     2599        // empty
     2600        | '!'
    25942601        ;
    25952602
     
    26022609
    26032610enumerator_list:
    2604         identifier_or_type_name enumerator_value_opt
    2605                 { $$ = DeclarationNode::newEnumValueGeneric( $1, $2 ); }
     2611        hide_visible_opt identifier_or_type_name enumerator_value_opt
     2612                { $$ = DeclarationNode::newEnumValueGeneric( $2, $3 ); }
    26062613        | INLINE type_name
    26072614                { $$ = DeclarationNode::newEnumInLine( *$2->type->symbolic.name ); }
    2608         | enumerator_list ',' identifier_or_type_name enumerator_value_opt
    2609                 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $3, $4 ) ); }
     2615        | enumerator_list ',' hide_visible_opt identifier_or_type_name enumerator_value_opt
     2616                { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $4, $5 ) ); }
    26102617        | enumerator_list ',' INLINE type_name enumerator_value_opt
    26112618                { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( new string("inline"), nullptr ) ); }
     2619        ;
     2620
     2621hide_visible_opt:
     2622        hide_opt
     2623        | '^'
    26122624        ;
    26132625
Note: See TracChangeset for help on using the changeset viewer.