Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r9a705dc8 r61fc4f6  
    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 : Sun Apr 29 14:20:17 2018
     13// Update Count     : 3206
    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
     
    208208%token<tok> ATTR_IDENTIFIER             ATTR_TYPEDEFname                ATTR_TYPEGENname
    209209%token<tok> INTEGERconstant             CHARACTERconstant               STRINGliteral
     210%token<tok> DIRECTIVE
    210211// Floating point constant is broken into three kinds of tokens because of the ambiguity with tuple indexing and
    211212// overloading constants 0/1, e.g., x.1 is lexed as (x)(.1), where (.1) is a factional constant, but is semantically
     
    282283%type<decl> aggregate_type aggregate_type_nobody
    283284
    284 %type<decl> assertion assertion_list_opt
     285%type<decl> assertion assertion_list assertion_list_opt
    285286
    286287%type<en>   bit_subrange_size_opt bit_subrange_size
     
    875876                { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; }
    876877        | asm_statement
     878        | DIRECTIVE
     879                { $$ = new StatementNode( build_dirstmt( $1 ) ); }
    877880        ;
    878881
     
    18661869                {
    18671870                        typedefTable.makeTypedef( *$3 );
     1871                        if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update
     1872                        forall = false;                                                         // reset
    18681873                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    18691874                }
     
    22352240                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    22362241        | type_specifier identifier_parameter_declarator
     2242        | assertion_list
     2243                { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
    22372244        ;
    22382245
     
    22512258        // empty
    22522259                { $$ = nullptr; }
    2253         | assertion_list_opt assertion
     2260        | assertion_list
     2261        ;
     2262
     2263assertion_list:                                                                                 // CFA
     2264        assertion
     2265        | assertion_list assertion
    22542266                { $$ = $1 ? $1->appendList( $2 ) : $2; }
    22552267        ;
     
    23782390external_definition_list:
    23792391        external_definition
    2380         | external_definition_list push external_definition
    2381                 { $$ = $1 ? $1->appendList( $3 ) : $3; }
     2392        | external_definition_list { forall = xxx; } push external_definition
     2393                { $$ = $1 ? $1->appendList( $4 ) : $4; }
    23822394        ;
    23832395
     
    24112423                        $$ = $2;
    24122424                }
    2413         | type_qualifier_list '{' external_definition_list '}'                  // CFA, namespace
     2425        | type_qualifier_list
     2426                {
     2427                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2428                }
     2429          push '{' external_definition_list '}'                         // CFA, namespace
     2430                {
     2431                        for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     2432                                iter->addQualifiers( $1->clone() );
     2433                        } // for
     2434                        xxx = false;
     2435                        delete $1;
     2436                        $$ = $5;
     2437                }
     2438        | declaration_qualifier_list
     2439                {
     2440                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2441                }
     2442          push '{' external_definition_list '}'                         // CFA, namespace
     2443                {
     2444                        for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     2445                                iter->addQualifiers( $1->clone() );
     2446                        } // for
     2447                        xxx = false;
     2448                        delete $1;
     2449                        $$ = $5;
     2450                }
     2451        | declaration_qualifier_list type_qualifier_list
     2452                {
     2453                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2454                }
     2455          push '{' external_definition_list '}'                         // CFA, namespace
     2456                {
     2457                        for ( DeclarationNode * iter = $6; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     2458                                iter->addQualifiers( $1->clone() );
     2459                                iter->addQualifiers( $2->clone() );
     2460                        } // for
     2461                        xxx = false;
     2462                        delete $1;
     2463                        delete $2;
     2464                        $$ = $6;
     2465                }
    24142466        ;
    24152467
     
    24372489with_clause_opt:
    24382490        // empty
    2439                 { $$ = nullptr; }
     2491                { $$ = nullptr; forall = false; }
    24402492        | WITH '(' tuple_expression_list ')'
    2441                 { $$ = $3; }
     2493                { $$ = $3; forall = false; }
    24422494        ;
    24432495
Note: See TracChangeset for help on using the changeset viewer.