Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r61fc4f6 r9a705dc8  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 29 14:20:17 2018
    13 // Update Count     : 3206
     12// Last Modified On : Tue Apr 17 17:10:30 2018
     13// Update Count     : 3144
    1414//
    1515
     
    133133} // build_postfix_name
    134134
    135 bool forall = false, xxx = false;                                               // aggregate have one or more forall qualifiers ?
     135bool forall = 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
    211210// Floating point constant is broken into three kinds of tokens because of the ambiguity with tuple indexing and
    212211// overloading constants 0/1, e.g., x.1 is lexed as (x)(.1), where (.1) is a factional constant, but is semantically
     
    283282%type<decl> aggregate_type aggregate_type_nobody
    284283
    285 %type<decl> assertion assertion_list assertion_list_opt
     284%type<decl> assertion assertion_list_opt
    286285
    287286%type<en>   bit_subrange_size_opt bit_subrange_size
     
    876875                { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; }
    877876        | asm_statement
    878         | DIRECTIVE
    879                 { $$ = new StatementNode( build_dirstmt( $1 ) ); }
    880877        ;
    881878
     
    18691866                {
    18701867                        typedefTable.makeTypedef( *$3 );
    1871                         if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update
    1872                         forall = false;                                                         // reset
    18731868                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    18741869                }
     
    22402235                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    22412236        | type_specifier identifier_parameter_declarator
    2242         | assertion_list
    2243                 { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
    22442237        ;
    22452238
     
    22582251        // empty
    22592252                { $$ = nullptr; }
    2260         | assertion_list
    2261         ;
    2262 
    2263 assertion_list:                                                                                 // CFA
    2264         assertion
    2265         | assertion_list assertion
     2253        | assertion_list_opt assertion
    22662254                { $$ = $1 ? $1->appendList( $2 ) : $2; }
    22672255        ;
     
    23902378external_definition_list:
    23912379        external_definition
    2392         | external_definition_list { forall = xxx; } push external_definition
    2393                 { $$ = $1 ? $1->appendList( $4 ) : $4; }
     2380        | external_definition_list push external_definition
     2381                { $$ = $1 ? $1->appendList( $3 ) : $3; }
    23942382        ;
    23952383
     
    24232411                        $$ = $2;
    24242412                }
    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                 }
     2413        | type_qualifier_list '{' external_definition_list '}'                  // CFA, namespace
    24662414        ;
    24672415
     
    24892437with_clause_opt:
    24902438        // empty
    2491                 { $$ = nullptr; forall = false; }
     2439                { $$ = nullptr; }
    24922440        | WITH '(' tuple_expression_list ')'
    2493                 { $$ = $3; forall = false; }
     2441                { $$ = $3; }
    24942442        ;
    24952443
Note: See TracChangeset for help on using the changeset viewer.