Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    re307e12 rf1da02c  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Dec  7 10:43:44 2019
    13 // Update Count     : 4394
     12// Last Modified On : Sun Aug  4 21:48:23 2019
     13// Update Count     : 4364
    1414//
    1515
     
    211211} // forCtrl
    212212
    213 KeywordCastExpr::Target Aggregate2Target( DeclarationNode::Aggregate aggr ) {
    214         KeywordCastExpr::Target target;
    215         switch ( aggr ) {
    216           case DeclarationNode::Coroutine: target = KeywordCastExpr::Coroutine; break;
    217           case DeclarationNode::Monitor: target = KeywordCastExpr::Monitor; break;
    218           case DeclarationNode::Thread: target = KeywordCastExpr::Thread; break;
    219           default: abort();
    220         } // switch
    221         return target;
    222 } // Aggregate2Target
    223 
    224213
    225214bool forall = false, yyy = false;                                               // aggregate have one or more forall qualifiers ?
     
    376365%type<decl> abstract_parameter_declaration
    377366
    378 %type<aggKey> aggregate_key aggregate_data aggregate_control
     367%type<aggKey> aggregate_key
    379368%type<decl> aggregate_type aggregate_type_nobody
    380369
     
    661650        | postfix_expression '.' '[' field_name_list ']'        // CFA, tuple field selector
    662651                { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); }
    663         | postfix_expression '.' aggregate_control
    664                 { $$ = new ExpressionNode( build_keyword_cast( Aggregate2Target( $3 ), $1 ) ); }
    665652        | postfix_expression ARROW identifier
    666653                { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); }
     
    806793        | '(' type_no_function ')' cast_expression
    807794                { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
    808         | '(' aggregate_control '&' ')' cast_expression         // CFA
    809                 { $$ = new ExpressionNode( build_keyword_cast( Aggregate2Target( $2 ), $5 ) ); }
     795                // keyword cast cannot be grouped because of reduction in aggregate_key
     796        | '(' GENERATOR '&' ')' cast_expression                         // CFA
     797                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Coroutine, $5 ) ); }
     798        | '(' COROUTINE '&' ')' cast_expression                         // CFA
     799                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Coroutine, $5 ) ); }
     800        | '(' THREAD '&' ')' cast_expression                            // CFA
     801                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Thread, $5 ) ); }
     802        | '(' MONITOR '&' ')' cast_expression                           // CFA
     803                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Monitor, $5 ) ); }
    810804                // VIRTUAL cannot be opt because of look ahead issues
    811805        | '(' VIRTUAL ')' cast_expression                                       // CFA
     
    14291423asm_operand:                                                                                    // GCC
    14301424        string_literal '(' constant_expression ')'
    1431                 { $$ = new ExpressionNode( new AsmExpr( nullptr, $1, maybeMoveBuild< Expression >( $3 ) ) ); }
    1432         | '[' IDENTIFIER ']' string_literal '(' constant_expression ')'
    1433                 { $$ = new ExpressionNode( new AsmExpr( $2, $4, maybeMoveBuild< Expression >( $6 ) ) ); }
     1425                { $$ = new ExpressionNode( new AsmExpr( maybeMoveBuild< Expression >( (ExpressionNode *)nullptr ), $1, maybeMoveBuild< Expression >( $3 ) ) ); }
     1426        | '[' constant_expression ']' string_literal '(' constant_expression ')'
     1427                { $$ = new ExpressionNode( new AsmExpr( maybeMoveBuild< Expression >( $2 ), $4, maybeMoveBuild< Expression >( $6 ) ) ); }
    14341428        ;
    14351429
     
    20652059
    20662060aggregate_key:
    2067         aggregate_data
    2068         | aggregate_control
    2069         ;
    2070 
    2071 aggregate_data:
    20722061        STRUCT
    20732062                { yyy = true; $$ = DeclarationNode::Struct; }
    20742063        | UNION
    20752064                { yyy = true; $$ = DeclarationNode::Union; }
    2076         | EXCEPTION                                                                                     // CFA
     2065        | EXCEPTION
    20772066                { yyy = true; $$ = DeclarationNode::Exception; }
    2078         ;
    2079 
    2080 aggregate_control:                                                                              // CFA
    2081         GENERATOR
     2067        | GENERATOR
    20822068                { yyy = true; $$ = DeclarationNode::Coroutine; }
    20832069        | COROUTINE
     
    21102096                        distInl( $3 );
    21112097                }
    2112         | INLINE aggregate_control ';'                                          // CFA
    2113                 { SemanticError( yylloc, "INLINE aggregate control currently unimplemented." ); $$ = nullptr; }
    21142098        | typedef_declaration ';'                                                       // CFA
    21152099        | cfa_field_declaring_list ';'                                          // CFA, new style field declaration
Note: See TracChangeset for help on using the changeset viewer.