Changeset ff29f08 for src/Parser


Ignore:
Timestamp:
May 18, 2018, 2:09:21 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
2472a19
Parents:
f6f0cca3 (diff), c7d8100c (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 remote-tracking branch 'origin/master' into with_gc

Location:
src/Parser
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rf6f0cca3 rff29f08  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Apr 20 22:37:20 2018
    13 // Update Count     : 1063
     12// Last Modified On : Wed May 16 09:37:17 2018
     13// Update Count     : 1070
    1414//
    1515
     
    526526
    527527DeclarationNode * DeclarationNode::addQualifiers( DeclarationNode * q ) {
    528         if ( ! q ) { delete q; return this; }                           // empty qualifier
     528        if ( ! q ) { return this; }                                                     // empty qualifier
    529529
    530530        checkSpecifiers( q );
     
    560560
    561561        checkQualifiers( type, q->type );
    562         if ( (builtin == Zero || builtin == One) && error.length() == 0 ) {
     562        if ( (builtin == Zero || builtin == One) && q->type->qualifiers.val != 0 && error.length() == 0 ) {
    563563                SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, Type::QualifiersNames[ilog2( q->type->qualifiers.val )], builtinTypeNames[builtin] );
    564 //              appendError( error, string( "questionable qualifiers" ) );
    565564        } // if
    566565        addQualifiersToType( q->type, type );
     
    782781DeclarationNode * DeclarationNode::addPointer( DeclarationNode * p ) {
    783782        if ( p ) {
    784                 assert( p->type->kind == TypeData::Pointer || TypeData::Reference );
     783                assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference );
    785784                setBase( p->type );
    786785                p->type = nullptr;
  • src/Parser/ParseNode.h

    rf6f0cca3 rff29f08  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 22 17:49:31 2018
    13 // Update Count     : 827
     12// Last Modified On : Mon Apr 30 09:19:17 2018
     13// Update Count     : 831
    1414//
    1515
     
    332332        bool hasEllipsis;
    333333        LinkageSpec::Spec linkage;
    334         Expression *asmName;
     334        Expression * asmName;
    335335        std::list< Attribute * > attributes;
    336336        InitializerNode * initializer;
     
    416416Statement * build_finally( StatementNode * stmt );
    417417Statement * build_compound( StatementNode * first );
    418 Statement * build_asmstmt( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
     418Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
     419Statement * build_directive( std::string * directive );
    419420WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when );
    420421WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when, WaitForStmt * existing );
  • src/Parser/StatementNode.cc

    rf6f0cca3 rff29f08  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 14:31:32 2018
    13 // Update Count     : 348
     12// Last Modified On : Mon Apr 30 09:21:16 2018
     13// Update Count     : 354
    1414//
    1515
    1616#include <cassert>                 // for assert, strict_dynamic_cast, assertf
    1717#include <list>                    // for list
     18#include <memory>                  // for unique_ptr
    1819#include <string>                  // for string
    1920
     
    3233
    3334
    34 StatementNode::StatementNode( DeclarationNode *decl ) {
     35StatementNode::StatementNode( DeclarationNode * decl ) {
    3536        assert( decl );
    36         DeclarationNode *agg = decl->extractAggregate();
     37        DeclarationNode * agg = decl->extractAggregate();
    3738        if ( agg ) {
    38                 StatementNode *nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) );
     39                StatementNode * nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) );
    3940                set_next( nextStmt );
    4041                if ( decl->get_next() ) {
     
    5253} // StatementNode::StatementNode
    5354
    54 StatementNode *StatementNode::append_last_case( StatementNode *stmt ) {
    55         StatementNode *prev = this;
     55StatementNode * StatementNode::append_last_case( StatementNode * stmt ) {
     56        StatementNode * prev = this;
    5657        // find end of list and maintain previous pointer
    5758        for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) {
    58                 StatementNode *node = strict_dynamic_cast< StatementNode * >(curr);
     59                StatementNode * node = strict_dynamic_cast< StatementNode * >(curr);
    5960                assert( dynamic_cast< CaseStmt * >(node->stmt) );
    6061                prev = curr;
    6162        } // for
    6263        // convert from StatementNode list to Statement list
    63         StatementNode *node = dynamic_cast< StatementNode * >(prev);
     64        StatementNode * node = dynamic_cast< StatementNode * >(prev);
    6465        std::list< Statement * > stmts;
    6566        buildMoveList( stmt, stmts );
     
    7071}
    7172
    72 Statement *build_expr( ExpressionNode *ctl ) {
    73         Expression *e = maybeMoveBuild< Expression >( ctl );
     73Statement * build_expr( ExpressionNode * ctl ) {
     74        Expression * e = maybeMoveBuild< Expression >( ctl );
    7475
    7576        if ( e )
     
    7980}
    8081
    81 Statement *build_if( IfCtl * ctl, StatementNode *then_stmt, StatementNode *else_stmt ) {
    82         Statement *thenb, *elseb = 0;
     82Statement * build_if( IfCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt ) {
     83        Statement * thenb, * elseb = 0;
    8384        std::list< Statement * > branches;
    8485        buildMoveList< Statement, StatementNode >( then_stmt, branches );
     
    115116}
    116117
    117 Statement *build_switch( bool isSwitch, ExpressionNode *ctl, StatementNode *stmt ) {
     118Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt ) {
    118119        std::list< Statement * > branches;
    119120        buildMoveList< Statement, StatementNode >( stmt, branches );
     
    130131        return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches );
    131132}
    132 Statement *build_case( ExpressionNode *ctl ) {
     133Statement * build_case( ExpressionNode * ctl ) {
    133134        std::list< Statement * > branches;
    134135        return new CaseStmt( maybeMoveBuild< Expression >(ctl), branches );
    135136}
    136 Statement *build_default() {
     137Statement * build_default() {
    137138        std::list< Statement * > branches;
    138139        return new CaseStmt( nullptr, branches, true );
    139140}
    140141
    141 Statement *build_while( ExpressionNode *ctl, StatementNode *stmt, bool kind ) {
     142Statement * build_while( ExpressionNode * ctl, StatementNode * stmt, bool kind ) {
    142143        std::list< Statement * > branches;
    143144        buildMoveList< Statement, StatementNode >( stmt, branches );
     
    146147}
    147148
    148 Statement *build_for( ForCtl *forctl, StatementNode *stmt ) {
     149Statement * build_for( ForCtl * forctl, StatementNode * stmt ) {
    149150        std::list< Statement * > branches;
    150151        buildMoveList< Statement, StatementNode >( stmt, branches );
     
    156157        } // if
    157158
    158         Expression *cond = 0;
     159        Expression * cond = 0;
    159160        if ( forctl->condition != 0 )
    160161                cond = notZeroExpr( maybeMoveBuild< Expression >(forctl->condition) );
    161162
    162         Expression *incr = 0;
     163        Expression * incr = 0;
    163164        if ( forctl->change != 0 )
    164165                incr = maybeMoveBuild< Expression >(forctl->change);
     
    168169}
    169170
    170 Statement *build_branch( BranchStmt::Type kind ) {
     171Statement * build_branch( BranchStmt::Type kind ) {
    171172        Statement * ret = new BranchStmt( "", kind );
    172173        return ret;
    173174}
    174 Statement *build_branch( std::string *identifier, BranchStmt::Type kind ) {
    175         Statement * ret = new BranchStmt( *identifier, kind );
     175Statement * build_branch( std::string * identifier, BranchStmt::Type kind ) {
     176        Statement * ret = new BranchStmt( * identifier, kind );
    176177        delete identifier;                                                                      // allocated by lexer
    177178        return ret;
    178179}
    179 Statement *build_computedgoto( ExpressionNode *ctl ) {
     180Statement * build_computedgoto( ExpressionNode * ctl ) {
    180181        return new BranchStmt( maybeMoveBuild< Expression >(ctl), BranchStmt::Goto );
    181182}
    182183
    183 Statement *build_return( ExpressionNode *ctl ) {
     184Statement * build_return( ExpressionNode * ctl ) {
    184185        std::list< Expression * > exps;
    185186        buildMoveList( ctl, exps );
     
    187188}
    188189
    189 Statement *build_throw( ExpressionNode *ctl ) {
     190Statement * build_throw( ExpressionNode * ctl ) {
    190191        std::list< Expression * > exps;
    191192        buildMoveList( ctl, exps );
     
    194195}
    195196
    196 Statement *build_resume( ExpressionNode *ctl ) {
     197Statement * build_resume( ExpressionNode * ctl ) {
    197198        std::list< Expression * > exps;
    198199        buildMoveList( ctl, exps );
     
    201202}
    202203
    203 Statement *build_resume_at( ExpressionNode *ctl, ExpressionNode *target ) {
     204Statement * build_resume_at( ExpressionNode * ctl, ExpressionNode * target ) {
    204205        (void)ctl;
    205206        (void)target;
     
    207208}
    208209
    209 Statement *build_try( StatementNode *try_stmt, StatementNode *catch_stmt, StatementNode *finally_stmt ) {
     210Statement * build_try( StatementNode * try_stmt, StatementNode * catch_stmt, StatementNode * finally_stmt ) {
    210211        std::list< CatchStmt * > branches;
    211212        buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches );
    212         CompoundStmt *tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    213         FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
     213        CompoundStmt * tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
     214        FinallyStmt * finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    214215        return new TryStmt( tryBlock, branches, finallyBlock );
    215216}
    216 Statement *build_catch( CatchStmt::Kind kind, DeclarationNode *decl, ExpressionNode *cond, StatementNode *body ) {
     217Statement * build_catch( CatchStmt::Kind kind, DeclarationNode * decl, ExpressionNode * cond, StatementNode * body ) {
    217218        std::list< Statement * > branches;
    218219        buildMoveList< Statement, StatementNode >( body, branches );
     
    220221        return new CatchStmt( kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() );
    221222}
    222 Statement *build_finally( StatementNode *stmt ) {
     223Statement * build_finally( StatementNode * stmt ) {
    223224        std::list< Statement * > branches;
    224225        buildMoveList< Statement, StatementNode >( stmt, branches );
     
    303304}
    304305
    305 Statement *build_compound( StatementNode *first ) {
    306         CompoundStmt *cs = new CompoundStmt();
     306Statement * build_compound( StatementNode * first ) {
     307        CompoundStmt * cs = new CompoundStmt();
    307308        buildMoveList( first, cs->get_kids() );
    308309        return cs;
    309310}
    310311
    311 Statement *build_asmstmt( bool voltile, Expression *instruction, ExpressionNode *output, ExpressionNode *input, ExpressionNode *clobber, LabelNode *gotolabels ) {
     312Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output, ExpressionNode * input, ExpressionNode * clobber, LabelNode * gotolabels ) {
    312313        std::list< Expression * > out, in;
    313314        std::list< ConstantExpr * > clob;
     
    317318        buildMoveList( clobber, clob );
    318319        return new AsmStmt( voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels );
     320}
     321
     322Statement * build_directive( string * directive ) {
     323        return new DirectiveStmt( *directive );
    319324}
    320325
  • src/Parser/TypeData.cc

    rf6f0cca3 rff29f08  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 17 23:00:52 2018
    13 // Update Count     : 602
     12// Last Modified On : Thu Apr 26 13:46:07 2018
     13// Update Count     : 603
    1414//
    1515
     
    6262                enumeration.constants = nullptr;
    6363                enumeration.body = false;
     64                break;
    6465          case Aggregate:
    6566                // aggregate = new Aggregate_t;
  • src/Parser/lex.ll

    rf6f0cca3 rff29f08  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Fri Apr  6 15:16:15 2018
    13  * Update Count     : 670
     12 * Last Modified On : Thu May  3 13:42:40 2018
     13 * Update Count     : 676
    1414 */
    1515
     
    174174}
    175175
    176                                 /* ignore preprocessor directives (for now) */
    177 ^{h_white}*"#"[^\n]*"\n" ;
     176                                /* preprocessor-style directives */
     177^{h_white}*"#"[^\n]*"\n" { RETURN_VAL( DIRECTIVE ); }
    178178
    179179                                /* ignore C style comments (ALSO HANDLED BY CPP) */
  • src/Parser/parser.yy

    rf6f0cca3 rff29f08  
    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 : Fri May 11 17:51:38 2018
     13// Update Count     : 3261
    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
     
    301302
    302303%type<decl> field_declaration field_declaration_list field_declarator field_declaring_list
    303 %type<en> field field_list field_name fraction_constants
     304%type<en> field field_list field_name fraction_constants_opt
    304305
    305306%type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr
     
    498499        | type_name '.' no_attr_identifier                                      // CFA, nested type
    499500                { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; }
     501//              { $$ = nullptr; }
    500502        | type_name '.' '[' push field_list pop ']'                     // CFA, nested type / tuple field selector
    501503                { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; }
     504//              { $$ = nullptr; }
    502505        | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11
    503506                { SemanticError( yylloc, "_Generic is currently unimplemented." ); $$ = nullptr; }
     
    532535        | postfix_expression '.' no_attr_identifier
    533536                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
     537        | postfix_expression '.' INTEGERconstant                        // CFA, tuple index
     538                { $$ = new ExpressionNode( build_fieldSel( $1, build_constantInteger( *$3 ) ) ); }
     539        | postfix_expression FLOATING_FRACTIONconstant          // CFA, tuple index
     540                { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_FLOATING_FRACTIONconstant( *$2 ) ) ); }
    534541        | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
    535542                { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
    536         | postfix_expression FLOATING_FRACTIONconstant          // CFA, tuple index
    537                 { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_FLOATING_FRACTIONconstant( *$2 ) ) ); }
    538543        | postfix_expression ARROW no_attr_identifier
    539544                {
    540545                        $$ = new ExpressionNode( build_pfieldSel( $1, *$3 == "0" || *$3 == "1" ? build_constantInteger( *$3 ) : build_varref( $3 ) ) );
    541546                }
    542         | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
    543                         { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
    544547        | postfix_expression ARROW INTEGERconstant                      // CFA, tuple index
    545548                { $$ = new ExpressionNode( build_pfieldSel( $1, build_constantInteger( *$3 ) ) ); }
     549        | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
     550                { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
    546551        | postfix_expression ICR
    547552                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); }
     
    596601
    597602field_name:
    598         INTEGERconstant fraction_constants
     603        INTEGERconstant fraction_constants_opt
    599604                { $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantInteger( *$1 ), $2 ) ); }
    600         | FLOATINGconstant fraction_constants
     605        | FLOATINGconstant fraction_constants_opt
    601606                { $$ = new ExpressionNode( build_field_name_fraction_constants( build_field_name_FLOATINGconstant( *$1 ), $2 ) ); }
    602         | no_attr_identifier fraction_constants
     607        | no_attr_identifier fraction_constants_opt
    603608                {
    604609                        $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) );
     
    606611        ;
    607612
    608 fraction_constants:
     613fraction_constants_opt:
    609614        // empty
    610615                { $$ = nullptr; }
    611         | fraction_constants FLOATING_FRACTIONconstant
     616        | fraction_constants_opt FLOATING_FRACTIONconstant
    612617                {
    613618                        Expression * constant = build_field_name_FLOATING_FRACTIONconstant( *$2 );
     
    875880                { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; }
    876881        | asm_statement
     882        | DIRECTIVE
     883                { $$ = new StatementNode( build_directive( $1 ) ); }
    877884        ;
    878885
     
    12041211asm_statement:
    12051212        ASM asm_volatile_opt '(' string_literal ')' ';'
    1206                 { $$ = new StatementNode( build_asmstmt( $2, $4, 0 ) ); }
     1213                { $$ = new StatementNode( build_asm( $2, $4, 0 ) ); }
    12071214        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ')' ';' // remaining GCC
    1208                 { $$ = new StatementNode( build_asmstmt( $2, $4, $6 ) ); }
     1215                { $$ = new StatementNode( build_asm( $2, $4, $6 ) ); }
    12091216        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ')' ';'
    1210                 { $$ = new StatementNode( build_asmstmt( $2, $4, $6, $8 ) ); }
     1217                { $$ = new StatementNode( build_asm( $2, $4, $6, $8 ) ); }
    12111218        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ':' asm_clobbers_list_opt ')' ';'
    1212                 { $$ = new StatementNode( build_asmstmt( $2, $4, $6, $8, $10 ) ); }
     1219                { $$ = new StatementNode( build_asm( $2, $4, $6, $8, $10 ) ); }
    12131220        | ASM asm_volatile_opt GOTO '(' string_literal ':' ':' asm_operands_opt ':' asm_clobbers_list_opt ':' label_list ')' ';'
    1214                 { $$ = new StatementNode( build_asmstmt( $2, $5, 0, $8, $10, $12 ) ); }
     1221                { $$ = new StatementNode( build_asm( $2, $5, 0, $8, $10, $12 ) ); }
    12151222        ;
    12161223
     
    18661873                {
    18671874                        typedefTable.makeTypedef( *$3 );
     1875                        if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update
     1876                        forall = false;                                                         // reset
    18681877                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    18691878                }
     
    22352244                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    22362245        | type_specifier identifier_parameter_declarator
     2246        | assertion_list
     2247                { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
    22372248        ;
    22382249
     
    22512262        // empty
    22522263                { $$ = nullptr; }
    2253         | assertion_list_opt assertion
     2264        | assertion_list
     2265        ;
     2266
     2267assertion_list:                                                                                 // CFA
     2268        assertion
     2269        | assertion_list assertion
    22542270                { $$ = $1 ? $1->appendList( $2 ) : $2; }
    22552271        ;
     
    23782394external_definition_list:
    23792395        external_definition
    2380         | external_definition_list push external_definition
    2381                 { $$ = $1 ? $1->appendList( $3 ) : $3; }
     2396        | external_definition_list
     2397                { forall = xxx; }
     2398          push external_definition
     2399                { $$ = $1 ? $1->appendList( $4 ) : $4; }
    23822400        ;
    23832401
     
    23932411        | ASM '(' string_literal ')' ';'                                        // GCC, global assembler statement
    23942412                {
    2395                         $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asmstmt( false, $3, 0 ) ) );
     2413                        $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asm( false, $3, 0 ) ) );
    23962414                }
    23972415        | EXTERN STRINGliteral                                                          // C++-style linkage specifier
     
    24112429                        $$ = $2;
    24122430                }
    2413         | type_qualifier_list '{' external_definition_list '}'                  // CFA, namespace
     2431        | type_qualifier_list
     2432                {
     2433                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2434                }
     2435          push '{' external_definition_list '}'                         // CFA, namespace
     2436                {
     2437                        for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     2438                                if ( isMangled( iter->linkage ) ) {             // ignore extern "C"
     2439                                        iter->addQualifiers( $1->clone() );
     2440                                } // if
     2441                        } // for
     2442                        xxx = false;
     2443                        delete $1;
     2444                        $$ = $5;
     2445                }
     2446        | declaration_qualifier_list
     2447                {
     2448                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2449                }
     2450          push '{' external_definition_list '}'                         // CFA, namespace
     2451                {
     2452                        for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     2453                                if ( isMangled( iter->linkage ) ) {             // ignore extern "C"
     2454                                        iter->addQualifiers( $1->clone() );
     2455                                } // if
     2456                        } // for
     2457                        xxx = false;
     2458                        delete $1;
     2459                        $$ = $5;
     2460                }
     2461        | declaration_qualifier_list type_qualifier_list
     2462                {
     2463                        // forall must be in the type_qualifier_list
     2464                        if ( $2->type->forall ) xxx = forall = true; // remember generic type
     2465                }
     2466          push '{' external_definition_list '}'                         // CFA, namespace
     2467                {
     2468                        for ( DeclarationNode * iter = $6; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     2469                                if ( isMangled( iter->linkage ) && isMangled( $2->linkage ) ) { // ignore extern "C"
     2470                                        iter->addQualifiers( $1->clone() );
     2471                                        iter->addQualifiers( $2->clone() );
     2472                                } // if
     2473                        } // for
     2474                        xxx = false;
     2475                        delete $1;
     2476                        delete $2;
     2477                        $$ = $6;
     2478                }
    24142479        ;
    24152480
     
    24372502with_clause_opt:
    24382503        // empty
    2439                 { $$ = nullptr; }
     2504                { $$ = nullptr; forall = false; }
    24402505        | WITH '(' tuple_expression_list ')'
    2441                 { $$ = $3; }
     2506                { $$ = $3; forall = false; }
    24422507        ;
    24432508
Note: See TracChangeset for help on using the changeset viewer.