Changeset 73f04fd for src


Ignore:
Timestamp:
Jan 26, 2021, 11:55:56 AM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
352cbc2
Parents:
667b3c7
Message:

remove temporary token "fred" from grammar, add comments for enumeration rules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r667b3c7 r73f04fd  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 25 21:41:56 2021
    13 // Update Count     : 4670
     12// Last Modified On : Tue Jan 26 11:18:19 2021
     13// Update Count     : 4674
    1414//
    1515
     
    20142014        ;
    20152015
    2016 fred:
    2017         // empty
    2018                 { yyy = false; }
    2019         ;
    2020 
    20212016aggregate_type:                                                                                 // struct, union
    20222017        aggregate_key attribute_list_opt
     
    20242019          '{' field_declaration_list_opt '}' type_parameters_opt
    20252020                { $$ = DeclarationNode::newAggregate( $1, nullptr, $7, $5, true )->addQualifiers( $2 ); }
    2026         | aggregate_key attribute_list_opt identifier fred
     2021        | aggregate_key attribute_list_opt identifier
    20272022                {
    20282023                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef
     
    20302025                }
    20312026          '{' field_declaration_list_opt '}' type_parameters_opt
    2032                 { $$ = DeclarationNode::newAggregate( $1, $3, $9, $7, true )->addQualifiers( $2 ); }
    2033         | aggregate_key attribute_list_opt type_name fred
     2027                { $$ = DeclarationNode::newAggregate( $1, $3, $8, $6, true )->addQualifiers( $2 ); }
     2028        | aggregate_key attribute_list_opt type_name
    20342029                {
    20352030                        // for type_name can be a qualified type name S.T, in which case only the last name in the chain needs a typedef (other names in the chain should already have one)
     
    20382033                }
    20392034          '{' field_declaration_list_opt '}' type_parameters_opt
    2040                 { $$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, $9, $7, true )->addQualifiers( $2 ); }
     2035                { $$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, $8, $6, true )->addQualifiers( $2 ); }
    20412036        | aggregate_type_nobody
    20422037        ;
     
    20502045
    20512046aggregate_type_nobody:                                                                  // struct, union - {...}
    2052         aggregate_key attribute_list_opt identifier fred
     2047        aggregate_key attribute_list_opt identifier
    20532048                {
    20542049                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname );
     
    20562051                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    20572052                }
    2058         | aggregate_key attribute_list_opt type_name fred
     2053        | aggregate_key attribute_list_opt type_name
    20592054                {
    20602055                        forall = false;                                                         // reset
     
    21942189        ;
    21952190
    2196 // Cannot use attribute_list_opt because of ambiguity with enum_specifier_nobody, which already parses attributes.
     2191// Cannot use attribute_list_opt because of ambiguity with enum_specifier_nobody, which already parses attribute.
     2192// Hence, only a single attribute is allowed after the "ENUM".
    21972193enum_type:                                                                                              // enum
    21982194        ENUM attribute_opt '{' enumerator_list comma_opt '}'
     
    22022198          '{' enumerator_list comma_opt '}'
    22032199                { $$ = DeclarationNode::newEnum( $3, $6, true )->addQualifiers( $2 ); }
    2204         | ENUM attribute_opt typedef
     2200        | ENUM attribute_opt typedef                                            // enum cannot be generic
    22052201          '{' enumerator_list comma_opt '}'
    22062202                { $$ = DeclarationNode::newEnum( $3->name, $5, true )->addQualifiers( $2 ); }
     
    22232219                        $$ = DeclarationNode::newEnum( $3, 0, false )->addQualifiers( $2 );
    22242220                }
    2225         | ENUM attribute_opt type_name
     2221        | ENUM attribute_opt type_name                                          // enum cannot be generic
    22262222                {
    22272223                        typedefTable.makeTypedef( *$3->type->symbolic.name );
Note: See TracChangeset for help on using the changeset viewer.