Changeset d7874052 for src/Parser


Ignore:
Timestamp:
Jun 30, 2023, 4:22:16 PM (13 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
6c7fe7b
Parents:
bdf4cd9
Message:

print proper error for hiding enumerator names of an anonymous enumeration, which means the names are inaccessible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rbdf4cd9 rd7874052  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun 20 22:10:31 2023
    13 // Update Count     : 6348
     12// Last Modified On : Fri Jun 30 12:32:36 2023
     13// Update Count     : 6364
    1414//
    1515
     
    26802680        ENUM attribute_list_opt '{' enumerator_list comma_opt '}'
    26812681                { $$ = DeclarationNode::newEnum( nullptr, $4, true, false )->addQualifiers( $2 ); }
     2682        | ENUM attribute_list_opt '!' '{' enumerator_list comma_opt '}' // invalid syntax rule
     2683                { SemanticError( yylloc, "syntax error, hiding '!' the enumerator names of an anonymous enumeration means the names are inaccessible." ); $$ = nullptr; }
    26822684        | ENUM attribute_list_opt identifier
    26832685                { typedefTable.makeTypedef( *$3 ); }
    26842686          hide_opt '{' enumerator_list comma_opt '}'
    26852687                { $$ = DeclarationNode::newEnum( $3, $7, true, false, nullptr, $5 )->addQualifiers( $2 ); }
    2686         | ENUM attribute_list_opt typedef_name                          // unqualified type name
    2687           hide_opt '{' enumerator_list comma_opt '}'
     2688        | ENUM attribute_list_opt typedef_name hide_opt '{' enumerator_list comma_opt '}' // unqualified type name
    26882689                { $$ = DeclarationNode::newEnum( $3->name, $6, true, false, nullptr, $4 )->addQualifiers( $2 ); }
    26892690        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}'
     
    26942695                        $$ = DeclarationNode::newEnum( nullptr, $7, true, true, $3 )->addQualifiers( $5 );
    26952696                }
     2697        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '!' '{' enumerator_list comma_opt '}' // unqualified type name
     2698                { SemanticError( yylloc, "syntax error, hiding '!' the enumerator names of an anonymous enumeration means the names are inaccessible." ); $$ = nullptr; }
    26962699        | ENUM '(' ')' attribute_list_opt '{' enumerator_list comma_opt '}'
    26972700                {
    26982701                        $$ = DeclarationNode::newEnum( nullptr, $6, true, true )->addQualifiers( $4 );
    26992702                }
     2703        | ENUM '(' ')' attribute_list_opt '!' '{' enumerator_list comma_opt '}' // invalid syntax rule
     2704                { SemanticError( yylloc, "syntax error, hiding '!' the enumerator names of an anonymous enumeration means the names are inaccessible." ); $$ = nullptr; }
    27002705        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt identifier attribute_list_opt
    27012706                {
     
    27092714                        $$ = DeclarationNode::newEnum( $6, $11, true, true, $3, $9 )->addQualifiers( $5 )->addQualifiers( $7 );
    27102715                }
    2711         | ENUM '(' ')' attribute_list_opt identifier attribute_list_opt
    2712           hide_opt '{' enumerator_list comma_opt '}'
     2716        | ENUM '(' ')' attribute_list_opt identifier attribute_list_opt hide_opt '{' enumerator_list comma_opt '}'
    27132717                {
    27142718                        $$ = DeclarationNode::newEnum( $5, $9, true, true, nullptr, $7 )->addQualifiers( $4 )->addQualifiers( $6 );
    27152719                }
    2716         | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt
    2717           hide_opt '{' enumerator_list comma_opt '}'
     2720        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt hide_opt '{' enumerator_list comma_opt '}'
    27182721                {
    27192722                        $$ = DeclarationNode::newEnum( $6->name, $10, true, true, $3, $8 )->addQualifiers( $5 )->addQualifiers( $7 );
    27202723                }
    2721         | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt
    2722           hide_opt '{' enumerator_list comma_opt '}'
     2724        | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt hide_opt '{' enumerator_list comma_opt '}'
    27232725                {
    27242726                        $$ = DeclarationNode::newEnum( $5->name, $9, true, true, nullptr, $7 )->addQualifiers( $4 )->addQualifiers( $6 );
Note: See TracChangeset for help on using the changeset viewer.