Changeset 9997fee


Ignore:
Timestamp:
Apr 28, 2018, 10:34:40 AM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
534d84e
Parents:
6926a6d
Message:

start anonymous type-variables and qualifier-distribution block

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r6926a6d r9997fee  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 17 17:10:30 2018
    13 // Update Count     : 3144
     12// Last Modified On : Sat Apr 28 09:37:03 2018
     13// Update Count     : 3201
    1414//
    1515
     
    133133} // build_postfix_name
    134134
    135 bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
     135bool forall = false, xxx = false;                                               // aggregate have one or more forall qualifiers ?
    136136
    137137// https://www.gnu.org/software/bison/manual/bison.html#Location-Type
     
    282282%type<decl> aggregate_type aggregate_type_nobody
    283283
    284 %type<decl> assertion assertion_list_opt
     284%type<decl> assertion assertion_list assertion_list_opt
    285285
    286286%type<en>   bit_subrange_size_opt bit_subrange_size
     
    18661866                {
    18671867                        typedefTable.makeTypedef( *$3 );
     1868                        if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update
     1869                        forall = false;                                                         // reset
    18681870                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    18691871                }
     
    22352237                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    22362238        | type_specifier identifier_parameter_declarator
     2239        | assertion_list
     2240                { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
    22372241        ;
    22382242
     
    22512255        // empty
    22522256                { $$ = nullptr; }
    2253         | assertion_list_opt assertion
     2257        | assertion_list
     2258        ;
     2259
     2260assertion_list:                                                                                 // CFA
     2261        assertion
     2262        | assertion_list assertion
    22542263                { $$ = $1 ? $1->appendList( $2 ) : $2; }
    22552264        ;
     
    23782387external_definition_list:
    23792388        external_definition
    2380         | external_definition_list push external_definition
    2381                 { $$ = $1 ? $1->appendList( $3 ) : $3; }
     2389        | external_definition_list { forall = xxx; } push external_definition
     2390                { $$ = $1 ? $1->appendList( $4 ) : $4; }
    23822391        ;
    23832392
     
    24112420                        $$ = $2;
    24122421                }
    2413         | type_qualifier_list '{' external_definition_list '}'                  // CFA, namespace
     2422        | type_qualifier_list
     2423                {
     2424                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2425                }
     2426          push '{' external_definition_list '}'                         // CFA, namespace
     2427                {
     2428                        for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     2429                                iter->addQualifiers( $1->clone() );
     2430                        } // for
     2431                        xxx = false;
     2432                        delete $1;
     2433                        $$ = $5;
     2434                }
     2435        | declaration_qualifier_list
     2436                {
     2437                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2438                }
     2439          push '{' external_definition_list '}'                         // CFA, namespace
     2440                {
     2441                        for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     2442                                iter->addQualifiers( $1->clone() );
     2443                        } // for
     2444                        xxx = false;
     2445                        delete $1;
     2446                        $$ = $5;
     2447                }
     2448        | declaration_qualifier_list type_qualifier_list
     2449                {
     2450                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2451                }
     2452          push '{' external_definition_list '}'                         // CFA, namespace
     2453                {
     2454                        for ( DeclarationNode * iter = $6; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     2455                                iter->addQualifiers( $1->clone() );
     2456                                iter->addQualifiers( $2->clone() );
     2457                        } // for
     2458                        xxx = false;
     2459                        delete $1;
     2460                        delete $2;
     2461                        $$ = $6;
     2462                }
    24142463        ;
    24152464
     
    24372486with_clause_opt:
    24382487        // empty
    2439                 { $$ = nullptr; }
     2488                { $$ = nullptr; forall = false; }
    24402489        | WITH '(' tuple_expression_list ')'
    2441                 { $$ = $3; }
     2490                { $$ = $3; forall = false; }
    24422491        ;
    24432492
Note: See TracChangeset for help on using the changeset viewer.