Ignore:
Timestamp:
Nov 14, 2022, 11:52:44 AM (3 years ago)
Author:
caparson <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
7d9598d8
Parents:
b77f0e1 (diff), 19a8c40 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rb77f0e1 r63be3387  
    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 : Wed Nov  2 21:31:21 2022
     13// Update Count     : 5810
    1414//
    1515
     
    278278
    279279// Types declaration for productions
     280
    280281%union {
    281282        Token tok;
     
    290291        CondCtl * ifctl;
    291292        ForCtrl * fctl;
    292         enum OperKinds compop;
     293        OperKinds compop;
    293294        LabelNode * label;
    294295        InitializerNode * in;
     
    296297        std::string * str;
    297298        bool flag;
     299        EnumHiding hide;
    298300        CatchStmt::Kind catch_kind;
    299301        GenericExpr * genexpr;
     
    364366%type<constant> string_literal
    365367%type<str> string_literal_list
     368
     369%type<hide> hide_opt                                    visible_hide_opt
    366370
    367371// expressions
     
    25532557        | ENUM attribute_list_opt identifier
    25542558                { typedefTable.makeTypedef( *$3 ); }
    2555           '{' enumerator_list comma_opt '}'
    2556                 { $$ = DeclarationNode::newEnum( $3, $6, true, false )->addQualifiers( $2 ); }
     2559          hide_opt '{' enumerator_list comma_opt '}'
     2560          { $$ = DeclarationNode::newEnum( $3, $7, true, false )->addQualifiers( $2 ); }
    25572561        | ENUM attribute_list_opt typedef_name                          // unqualified type name
    2558           '{' enumerator_list comma_opt '}'
    2559                 { $$ = DeclarationNode::newEnum( $3->name, $5, true, false )->addQualifiers( $2 ); }
     2562          hide_opt '{' enumerator_list comma_opt '}'
     2563                { $$ = DeclarationNode::newEnum( $3->name, $6, true, false )->addQualifiers( $2 ); }
    25602564        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}'
    25612565                {
     
    25742578                        typedefTable.makeTypedef( *$6 );
    25752579                }
    2576           '{' enumerator_list comma_opt '}'
    2577                 {
    2578                         $$ = DeclarationNode::newEnum( $6, $10, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
     2580          hide_opt '{' enumerator_list comma_opt '}'
     2581                {
     2582                        $$ = DeclarationNode::newEnum( $6, $11, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
    25792583                }
    25802584        | 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 );
     2585          hide_opt '{' enumerator_list comma_opt '}'
     2586                {
     2587                        $$ = DeclarationNode::newEnum( $5, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
     2588                }
     2589        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt
     2590          hide_opt '{' enumerator_list comma_opt '}'
     2591                {
     2592                        $$ = DeclarationNode::newEnum( $6->name, $10, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
     2593                }
     2594        | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt
     2595          hide_opt '{' enumerator_list comma_opt '}'
     2596                {
     2597                        $$ = DeclarationNode::newEnum( $5->name, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
    25922598                }
    25932599        | enum_type_nobody
     2600        ;
     2601
     2602hide_opt:
     2603        // empty
     2604                { $$ = EnumHiding::Visible; }
     2605        | '!'
     2606                { $$ = EnumHiding::Hide; }
    25942607        ;
    25952608
     
    26022615
    26032616enumerator_list:
    2604         identifier_or_type_name enumerator_value_opt
    2605                 { $$ = DeclarationNode::newEnumValueGeneric( $1, $2 ); }
     2617        visible_hide_opt identifier_or_type_name enumerator_value_opt
     2618                { $$ = DeclarationNode::newEnumValueGeneric( $2, $3 ); }
    26062619        | INLINE type_name
    26072620                { $$ = DeclarationNode::newEnumInLine( *$2->type->symbolic.name ); }
    2608         | enumerator_list ',' identifier_or_type_name enumerator_value_opt
    2609                 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $3, $4 ) ); }
     2621        | enumerator_list ',' visible_hide_opt identifier_or_type_name enumerator_value_opt
     2622                { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $4, $5 ) ); }
    26102623        | enumerator_list ',' INLINE type_name enumerator_value_opt
    26112624                { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( new string("inline"), nullptr ) ); }
     2625        ;
     2626
     2627visible_hide_opt:
     2628        hide_opt
     2629        | '^'
     2630                { $$ = EnumHiding::Visible; }
    26122631        ;
    26132632
Note: See TracChangeset for help on using the changeset viewer.