Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r3ed994e r13e8427  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 22 08:41:57 2018
    13 // Update Count     : 3353
     12// Last Modified On : Mon May 28 17:01:36 2018
     13// Update Count     : 3383
    1414//
    1515
     
    175175        bool flag;
    176176        CatchStmt::Kind catch_kind;
    177         GenericExpr * genexpr;
    178177}
    179178
     
    260259%type<flag> asm_volatile_opt
    261260%type<en> handler_predicate_opt
    262 %type<genexpr> generic_association generic_assoc_list
    263261
    264262// statements
     
    326324%type<decl> cfa_identifier_parameter_declarator_tuple cfa_identifier_parameter_ptr
    327325
    328 %type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_type_list_opt
     326%type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_ellipsis_list_opt
    329327
    330328%type<decl> cfa_typedef_declaration cfa_variable_declaration cfa_variable_specifier
     
    503501                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    504502        | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11
    505                 {
    506                         // add the missing control expression to the GenericExpr and return it
    507                         $5->control = maybeMoveBuild<Expression>( $3 );
    508                         $$ = new ExpressionNode( $5 );
    509                 }
     503                { SemanticError( yylloc, "_Generic is currently unimplemented." ); $$ = nullptr; }
    510504        ;
    511505
    512506generic_assoc_list:                                                                             // C11
    513         generic_association
     507        | generic_association
    514508        | generic_assoc_list ',' generic_association
    515                 {
    516                         // steal the association node from the singleton and delete the wrapper
    517                         $1->associations.splice($1->associations.end(), $3->associations);
    518                         delete $3;
    519                         $$ = $1;
    520                 }
    521509        ;
    522510
    523511generic_association:                                                                    // C11
    524512        type_no_function ':' assignment_expression
    525                 {
    526                         // create a GenericExpr wrapper with one association pair
    527                         $$ = new GenericExpr( nullptr, { { maybeMoveBuildType($1), maybeMoveBuild<Expression>($3) } } );
    528                 }
    529513        | DEFAULT ':' assignment_expression
    530                 { $$ = new GenericExpr( nullptr, { { maybeMoveBuild<Expression>($3) } } ); }
    531514        ;
    532515
     
    852835//      '[' ']'
    853836//              { $$ = new ExpressionNode( build_tuple() ); }
    854 //      '[' push assignment_expression pop ']'
     837//      | '[' push assignment_expression pop ']'
    855838//              { $$ = new ExpressionNode( build_tuple( $3 ) ); }
    856         '[' ',' tuple_expression_list ']'
    857                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); }
    858         | '[' assignment_expression ',' tuple_expression_list ']'
    859                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$2->set_last( $4 ) ) ); }
     839        '[' push ',' tuple_expression_list pop ']'
     840                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $4 ) ) ); }
     841        | '[' push assignment_expression ',' tuple_expression_list pop ']'
     842                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$3->set_last( $5 ) ) ); }
    860843        ;
    861844
     
    883866        labeled_statement
    884867        | compound_statement
    885         | expression_statement                                          { $$ = $1; }
     868        | expression_statement
    886869        | selection_statement
    887870        | iteration_statement
     
    12001183        type_specifier_nobody
    12011184        | type_specifier_nobody declarator
    1202                 {
    1203                         $$ = $2->addType( $1 );
    1204                 }
     1185                { $$ = $2->addType( $1 ); }
    12051186        | type_specifier_nobody variable_abstract_declarator
    12061187                { $$ = $2->addType( $1 ); }
    12071188        | cfa_abstract_declarator_tuple no_attr_identifier      // CFA
    1208                 {
    1209                         $$ = $1->addName( $2 );
    1210                 }
     1189                { $$ = $1->addName( $2 ); }
    12111190        | cfa_abstract_declarator_tuple                                         // CFA
    12121191        ;
     
    12861265
    12871266declaration_list_opt:                                                                   // used at beginning of switch statement
    1288         pop
     1267        pop     // empty
    12891268                { $$ = nullptr; }
    12901269        | declaration_list
     
    13211300
    13221301local_label_list:                                                                               // GCC, local label
    1323         no_attr_identifier_or_type_name                         {}
    1324         | local_label_list ',' no_attr_identifier_or_type_name {}
     1302        no_attr_identifier_or_type_name
     1303        | local_label_list ',' no_attr_identifier_or_type_name
    13251304        ;
    13261305
     
    13851364        | declaration_qualifier_list type_qualifier_list cfa_function_specifier
    13861365                { $$ = $3->addQualifiers( $1 )->addQualifiers( $2 ); }
    1387         | cfa_function_declaration ',' identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     1366        | cfa_function_declaration ',' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
    13881367                {
    13891368                        // Append the return type at the start (left-hand-side) to each identifier in the list.
    13901369                        DeclarationNode * ret = new DeclarationNode;
    13911370                        ret->type = maybeClone( $1->type->base );
    1392                         $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $5, nullptr ) );
     1371                        $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $6, nullptr ) );
    13931372                }
    13941373        ;
    13951374
    13961375cfa_function_specifier:                                                                 // CFA
    1397 //      '[' ']' identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')' // S/R conflict
     1376//      '[' ']' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' // S/R conflict
    13981377//              {
    13991378//                      $$ = DeclarationNode::newFunction( $3, DeclarationNode::newTuple( 0 ), $6, 0, true );
    14001379//              }
    1401 //      '[' ']' identifier '(' push cfa_parameter_type_list_opt pop ')'
     1380//      '[' ']' identifier '(' push cfa_parameter_ellipsis_list_opt pop ')'
    14021381//              {
    14031382//                      typedefTable.setNextIdentifier( *$5 );
    14041383//                      $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, 0, true );
    14051384//              }
    1406 //      | '[' ']' TYPEDEFname '(' push cfa_parameter_type_list_opt pop ')'
     1385//      | '[' ']' TYPEDEFname '(' push cfa_parameter_ellipsis_list_opt pop ')'
    14071386//              {
    14081387//                      typedefTable.setNextIdentifier( *$5 );
     
    14121391                // identifier_or_type_name must be broken apart because of the sequence:
    14131392                //
    1414                 //   '[' ']' identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     1393                //   '[' ']' identifier_or_type_name '(' cfa_parameter_ellipsis_list_opt ')'
    14151394                //   '[' ']' type_specifier
    14161395                //
    14171396                // type_specifier can resolve to just TYPEDEFname (e.g., typedef int T; int f( T );). Therefore this must be
    14181397                // flattened to allow lookahead to the '(' without having to reduce identifier_or_type_name.
    1419         cfa_abstract_tuple identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     1398        cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
    14201399                // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator).
    1421                 { $$ = DeclarationNode::newFunction( $2, $1, $4, 0 ); }
    1422         | cfa_function_return identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
    1423                 { $$ = DeclarationNode::newFunction( $2, $1, $4, 0 ); }
     1400                { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
     1401        | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
     1402                { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
    14241403        ;
    14251404
    14261405cfa_function_return:                                                                    // CFA
    1427         '[' cfa_parameter_list ']'
    1428                 { $$ = DeclarationNode::newTuple( $2 ); }
    1429         | '[' cfa_parameter_list ',' cfa_abstract_parameter_list ']'
    1430                 // To obtain LR(1 ), the last cfa_abstract_parameter_list is added into this flattened rule to lookahead to the
    1431                 // ']'.
    1432                 { $$ = DeclarationNode::newTuple( $2->appendList( $4 ) ); }
     1406        '[' push cfa_parameter_list pop ']'
     1407                { $$ = DeclarationNode::newTuple( $3 ); }
     1408        | '[' push cfa_parameter_list pop ',' push cfa_abstract_parameter_list pop ']'
     1409                // To obtain LR(1 ), the last cfa_abstract_parameter_list is added into this flattened rule to lookahead to the ']'.
     1410                { $$ = DeclarationNode::newTuple( $3->appendList( $7 ) ); }
    14331411        ;
    14341412
     
    16041582
    16051583forall:
    1606         FORALL '('
    1607                 {
    1608                         typedefTable.enterScope();
    1609                 }
    1610           type_parameter_list ')'                                                       // CFA
    1611                 {
    1612                         typedefTable.leaveScope();
    1613                         $$ = DeclarationNode::newForall( $4 );
    1614                 }
     1584        FORALL '(' push type_parameter_list pop ')'                                     // CFA
     1585                { $$ = DeclarationNode::newForall( $4 ); }
    16151586        ;
    16161587
     
    19801951        ;
    19811952
    1982 cfa_parameter_type_list_opt:                                                    // CFA, abstract + real
     1953cfa_parameter_ellipsis_list_opt:                                                        // CFA, abstract + real
    19831954        // empty
    19841955                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     
    19871958        | cfa_abstract_parameter_list
    19881959        | cfa_parameter_list
    1989         | cfa_parameter_list ',' cfa_abstract_parameter_list
    1990                 { $$ = $1->appendList( $3 ); }
    1991         | cfa_abstract_parameter_list ',' ELLIPSIS
     1960        | cfa_parameter_list pop ',' push cfa_abstract_parameter_list
     1961                { $$ = $1->appendList( $5 ); }
     1962        | cfa_abstract_parameter_list pop ',' push ELLIPSIS
    19921963                { $$ = $1->addVarArgs(); }
    1993         | cfa_parameter_list ',' ELLIPSIS
     1964        | cfa_parameter_list pop ',' push ELLIPSIS
    19941965                { $$ = $1->addVarArgs(); }
    19951966        ;
     
    19991970                // factored out from cfa_parameter_list, flattening the rules to get lookahead to the ']'.
    20001971        cfa_parameter_declaration
    2001         | cfa_abstract_parameter_list ',' cfa_parameter_declaration
    2002                 { $$ = $1->appendList( $3 ); }
    2003         | cfa_parameter_list ',' cfa_parameter_declaration
    2004                 { $$ = $1->appendList( $3 ); }
    2005         | cfa_parameter_list ',' cfa_abstract_parameter_list ',' cfa_parameter_declaration
    2006                 { $$ = $1->appendList( $3 )->appendList( $5 ); }
     1972        | cfa_abstract_parameter_list pop ',' push cfa_parameter_declaration
     1973                { $$ = $1->appendList( $5 ); }
     1974        | cfa_parameter_list pop ',' push cfa_parameter_declaration
     1975                { $$ = $1->appendList( $5 ); }
     1976        | cfa_parameter_list pop ',' push cfa_abstract_parameter_list pop ',' push cfa_parameter_declaration
     1977                { $$ = $1->appendList( $5 )->appendList( $9 ); }
    20071978        ;
    20081979
    20091980cfa_abstract_parameter_list:                                                    // CFA, new & old style abstract
    20101981        cfa_abstract_parameter_declaration
    2011         | cfa_abstract_parameter_list ',' cfa_abstract_parameter_declaration
    2012                 { $$ = $1->appendList( $3 ); }
     1982        | cfa_abstract_parameter_list pop ',' push cfa_abstract_parameter_declaration
     1983                { $$ = $1->appendList( $5 ); }
    20131984        ;
    20141985
     
    21132084                { $$ = $2; }
    21142085        | '=' VOID
    2115                 { $$ = new InitializerNode( true ); }
     2086                { $$ = nullptr; }
    21162087        | ATassign initializer
    21172088                { $$ = $2->set_maybeConstructed( false ); }
     
    21592130        '.' no_attr_identifier                                                          // C99, field name
    21602131                { $$ = new ExpressionNode( build_varref( $2 ) ); }
    2161         | '[' assignment_expression ']'                                         // C99, single array element
     2132        | '[' push assignment_expression pop ']'                        // C99, single array element
    21622133                // assignment_expression used instead of constant_expression because of shift/reduce conflicts with tuple.
    2163                 { $$ = $2; }
    2164         | '[' subrange ']'                                                                      // CFA, multiple array elements
    2165                 { $$ = $2; }
    2166         | '[' constant_expression ELLIPSIS constant_expression ']' // GCC, multiple array elements
    2167                 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $2 ), maybeMoveBuild< Expression >( $4 ) ) ); }
    2168         | '.' '[' field_list ']'                                                        // CFA, tuple field selector
    21692134                { $$ = $3; }
     2135        | '[' push subrange pop ']'                                                     // CFA, multiple array elements
     2136                { $$ = $3; }
     2137        | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements
     2138                { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $3 ), maybeMoveBuild< Expression >( $5 ) ) ); }
     2139        | '.' '[' push field_list pop ']'                                       // CFA, tuple field selector
     2140                { $$ = $4; }
    21702141        ;
    21712142
     
    22382209        '|' no_attr_identifier_or_type_name '(' type_list ')'
    22392210                { $$ = DeclarationNode::newTraitUse( $2, $4 ); }
    2240         | '|' '{' push trait_declaration_list '}'
     2211        | '|' '{' push trait_declaration_list pop '}'
    22412212                { $$ = $4; }
    2242         | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_list ')'
     2213        | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list pop '}' '(' type_list ')'
    22432214                { SemanticError( yylloc, "Generic data-type assertion is currently unimplemented." ); $$ = nullptr; }
    22442215        ;
     
    22862257        TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'
    22872258                { $$ = DeclarationNode::newTrait( $2, $5, 0 ); }
    2288         | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{'
    2289                 { typedefTable.enterScope(); }
    2290           trait_declaration_list '}'
     2259        | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' push trait_declaration_list pop '}'
    22912260                { $$ = DeclarationNode::newTrait( $2, $5, $10 ); }
    22922261        ;
     
    22942263trait_declaration_list:                                                                 // CFA
    22952264        trait_declaration
    2296         | trait_declaration_list push trait_declaration
    2297                 { $$ = $1->appendList( $3 ); }
     2265        | trait_declaration_list pop push trait_declaration
     2266                { $$ = $1->appendList( $4 ); }
    22982267        ;
    22992268
    23002269trait_declaration:                                                                              // CFA
    2301         cfa_trait_declaring_list pop ';'
    2302         | trait_declaring_list pop ';'
     2270        cfa_trait_declaring_list ';'
     2271        | trait_declaring_list ';'
    23032272        ;
    23042273
    23052274cfa_trait_declaring_list:                                                               // CFA
    23062275        cfa_variable_specifier
    2307                 { $$ = $1; }
    23082276        | cfa_function_specifier
    2309                 { $$ = $1; }
    23102277        | cfa_trait_declaring_list pop ',' push identifier_or_type_name
    23112278                { $$ = $1->appendList( $1->cloneType( $5 ) ); }
     
    23662333                }
    23672334        | type_qualifier_list
    2368                 {
    2369                         if ( $1->type->forall ) xxx = forall = true; // remember generic type
    2370                 }
     2335                { if ( $1->type->forall ) xxx = forall = true; } // remember generic type
    23712336          push '{' external_definition_list '}'                         // CFA, namespace
    23722337                {
     
    23812346                }
    23822347        | declaration_qualifier_list
    2383                 {
    2384                         if ( $1->type->forall ) xxx = forall = true; // remember generic type
    2385                 }
     2348                { if ( $1->type->forall ) xxx = forall = true; } // remember generic type
    23862349          push '{' external_definition_list '}'                         // CFA, namespace
    23872350                {
     
    24232386                // declaration must still have a type_specifier.  OBSOLESCENT (see 1)
    24242387        | function_declarator compound_statement
    2425                 {
    2426                         typedefTable.leaveScope();
    2427                         $$ = $1->addFunctionBody( $2 );
    2428                 }
     2388                { $$ = $1->addFunctionBody( $2 ); }
    24292389        | KR_function_declarator KR_declaration_list_opt compound_statement
    2430                 {
    2431                         typedefTable.leaveScope();
    2432                         $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 );
    2433                 }
     2390                { $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 ); }
    24342391        ;
    24352392
     
    24442401        cfa_function_declaration with_clause_opt compound_statement     // CFA
    24452402                {
    2446                         typedefTable.leaveScope();
    24472403                        // Add the function body to the last identifier in the function definition list, i.e., foo3:
    24482404                        //   [const double] foo1(), foo2( int ), foo3( double ) { return 3.0; }
     
    24532409                {
    24542410                        rebindForall( $1, $2 );
    2455                         typedefTable.leaveScope();
    24562411                        $$ = $2->addFunctionBody( $4, $3 )->addType( $1 );
    24572412                }
     
    24592414                {
    24602415                        rebindForall( $1, $2 );
    2461                         typedefTable.leaveScope();
    24622416                        $$ = $2->addFunctionBody( $4, $3 )->addType( $1 );
    24632417                }
    24642418                // handles default int return type, OBSOLESCENT (see 1)
    24652419        | type_qualifier_list function_declarator with_clause_opt compound_statement
    2466                 {
    2467                         typedefTable.leaveScope();
    2468                         $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 );
    2469                 }
     2420                { $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); }
    24702421                // handles default int return type, OBSOLESCENT (see 1)
    24712422        | declaration_qualifier_list function_declarator with_clause_opt compound_statement
    2472                 {
    2473                         typedefTable.leaveScope();
    2474                         $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 );
    2475                 }
     2423                { $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); }
    24762424                // handles default int return type, OBSOLESCENT (see 1)
    24772425        | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement
    2478                 {
    2479                         typedefTable.leaveScope();
    2480                         $$ = $3->addFunctionBody( $5, $4 )->addQualifiers( $2 )->addQualifiers( $1 );
    2481                 }
     2426                { $$ = $3->addFunctionBody( $5, $4 )->addQualifiers( $2 )->addQualifiers( $1 ); }
    24822427
    24832428                // Old-style K&R function definition, OBSOLESCENT (see 4)
     
    24852430                {
    24862431                        rebindForall( $1, $2 );
    2487                         typedefTable.leaveScope();
    24882432                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addType( $1 );
    24892433                }
    24902434                // handles default int return type, OBSOLESCENT (see 1)
    24912435        | type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    2492                 {
    2493                         typedefTable.leaveScope();
    2494                         $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 );
    2495                 }
     2436                { $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); }
    24962437                // handles default int return type, OBSOLESCENT (see 1)
    24972438        | declaration_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    2498                 {
    2499                         typedefTable.leaveScope();
    2500                         $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 );
    2501                 }
     2439                { $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); }
    25022440                // handles default int return type, OBSOLESCENT (see 1)
    25032441        | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    2504                 {
    2505                         typedefTable.leaveScope();
    2506                         $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6, $5 )->addQualifiers( $2 )->addQualifiers( $1 );
    2507                 }
     2442                { $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6, $5 )->addQualifiers( $2 )->addQualifiers( $1 ); }
    25082443        ;
    25092444
     
    27022637        paren_identifier '(' identifier_list ')'                        // function_declarator handles empty parameter
    27032638                { $$ = $1->addIdList( $3 ); }
    2704         | '(' KR_function_ptr ')' '(' parameter_type_list_opt ')'
    2705                 { $$ = $2->addParamList( $5 ); }
     2639        | '(' KR_function_ptr ')' '(' push parameter_type_list_opt pop ')'
     2640                { $$ = $2->addParamList( $6 ); }
    27062641        | '(' KR_function_no_ptr ')'                                            // redundant parenthesis
    27072642                { $$ = $2; }
     
    28212756
    28222757identifier_parameter_function:
    2823         paren_identifier '(' parameter_type_list_opt ')'        // empty parameter list OBSOLESCENT (see 3)
    2824                 { $$ = $1->addParamList( $3 ); }
    2825         | '(' identifier_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    2826                 { $$ = $2->addParamList( $5 ); }
     2758        paren_identifier '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     2759                { $$ = $1->addParamList( $4 ); }
     2760        | '(' identifier_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     2761                { $$ = $2->addParamList( $6 ); }
    28272762        | '(' identifier_parameter_function ')'                         // redundant parenthesis
    28282763                { $$ = $2; }
     
    28742809
    28752810type_parameter_function:
    2876         typedef '(' parameter_type_list_opt ')'                         // empty parameter list OBSOLESCENT (see 3)
    2877                 { $$ = $1->addParamList( $3 ); }
    2878         | '(' type_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    2879                 { $$ = $2->addParamList( $5 ); }
     2811        typedef '(' push parameter_type_list_opt pop ')'        // empty parameter list OBSOLESCENT (see 3)
     2812                { $$ = $1->addParamList( $4 ); }
     2813        | '(' type_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     2814                { $$ = $2->addParamList( $6 ); }
    28802815        ;
    28812816
     
    29242859
    29252860abstract_function:
    2926         '(' parameter_type_list_opt ')'                                         // empty parameter list OBSOLESCENT (see 3)
    2927                 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
    2928         | '(' abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    2929                 { $$ = $2->addParamList( $5 ); }
     2861        '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
     2862                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); }
     2863        | '(' abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     2864                { $$ = $2->addParamList( $6 ); }
    29302865        | '(' abstract_function ')'                                                     // redundant parenthesis
    29312866                { $$ = $2; }
     
    29422877
    29432878multi_array_dimension:
    2944         '[' assignment_expression ']'
    2945                 { $$ = DeclarationNode::newArray( $2, 0, false ); }
    2946         | '[' '*' ']'                                                                           // C99
     2879        '[' push assignment_expression pop ']'
     2880                { $$ = DeclarationNode::newArray( $3, 0, false ); }
     2881        | '[' push '*' pop ']'                                                          // C99
    29472882                { $$ = DeclarationNode::newVarArray( 0 ); }
    2948         | multi_array_dimension '[' assignment_expression ']'
    2949                 { $$ = $1->addArray( DeclarationNode::newArray( $3, 0, false ) ); }
    2950         | multi_array_dimension '[' '*' ']'                                     // C99
     2883        | multi_array_dimension '[' push assignment_expression pop ']'
     2884                { $$ = $1->addArray( DeclarationNode::newArray( $4, 0, false ) ); }
     2885        | multi_array_dimension '[' push '*' pop ']'            // C99
    29512886                { $$ = $1->addArray( DeclarationNode::newVarArray( 0 ) ); }
    29522887        ;
     
    30152950
    30162951abstract_parameter_function:
    3017         '(' parameter_type_list_opt ')'                                         // empty parameter list OBSOLESCENT (see 3)
    3018                 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
    3019         | '(' abstract_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3020                 { $$ = $2->addParamList( $5 ); }
     2952        '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
     2953                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); }
     2954        | '(' abstract_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     2955                { $$ = $2->addParamList( $6 ); }
    30212956        | '(' abstract_parameter_function ')'                           // redundant parenthesis
    30222957                { $$ = $2; }
     
    30392974        '[' ']'
    30402975                { $$ = DeclarationNode::newArray( 0, 0, false ); }
    3041         // multi_array_dimension handles the '[' '*' ']' case
    3042         | '[' type_qualifier_list '*' ']'                                       // remaining C99
    3043                 { $$ = DeclarationNode::newVarArray( $2 ); }
    3044         | '[' type_qualifier_list ']'
    3045                 { $$ = DeclarationNode::newArray( 0, $2, false ); }
    3046         // multi_array_dimension handles the '[' assignment_expression ']' case
    3047         | '[' type_qualifier_list assignment_expression ']'
    3048                 { $$ = DeclarationNode::newArray( $3, $2, false ); }
    3049         | '[' STATIC type_qualifier_list_opt assignment_expression ']'
    3050                 { $$ = DeclarationNode::newArray( $4, $3, true ); }
    3051         | '[' type_qualifier_list STATIC assignment_expression ']'
    3052                 { $$ = DeclarationNode::newArray( $4, $2, true ); }
     2976                // multi_array_dimension handles the '[' '*' ']' case
     2977        | '[' push type_qualifier_list '*' pop ']'                      // remaining C99
     2978                { $$ = DeclarationNode::newVarArray( $3 ); }
     2979        | '[' push type_qualifier_list pop ']'
     2980                { $$ = DeclarationNode::newArray( 0, $3, false ); }
     2981                // multi_array_dimension handles the '[' assignment_expression ']' case
     2982        | '[' push type_qualifier_list assignment_expression pop ']'
     2983                { $$ = DeclarationNode::newArray( $4, $3, false ); }
     2984        | '[' push STATIC type_qualifier_list_opt assignment_expression pop ']'
     2985                { $$ = DeclarationNode::newArray( $5, $4, true ); }
     2986        | '[' push type_qualifier_list STATIC assignment_expression pop ']'
     2987                { $$ = DeclarationNode::newArray( $5, $3, true ); }
    30532988        ;
    30542989
     
    30943029
    30953030variable_abstract_function:
    3096         '(' variable_abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3097                 { $$ = $2->addParamList( $5 ); }
     3031        '(' variable_abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3032                { $$ = $2->addParamList( $6 ); }
    30983033        | '(' variable_abstract_function ')'                            // redundant parenthesis
    30993034                { $$ = $2; }
     
    31583093
    31593094cfa_array_parameter_1st_dimension:
    3160         '[' type_qualifier_list '*' ']'                                         // remaining C99
    3161                 { $$ = DeclarationNode::newVarArray( $2 ); }
    3162         | '[' type_qualifier_list assignment_expression ']'
    3163                 { $$ = DeclarationNode::newArray( $3, $2, false ); }
    3164         | '[' declaration_qualifier_list assignment_expression ']'
     3095        '[' push type_qualifier_list '*' pop ']'                        // remaining C99
     3096                { $$ = DeclarationNode::newVarArray( $3 ); }
     3097        | '[' push type_qualifier_list assignment_expression pop ']'
     3098                { $$ = DeclarationNode::newArray( $4, $3, false ); }
     3099        | '[' push declaration_qualifier_list assignment_expression pop ']'
    31653100                // declaration_qualifier_list must be used because of shift/reduce conflict with
    31663101                // assignment_expression, so a semantic check is necessary to preclude them as a type_qualifier cannot
    31673102                // appear in this context.
    3168                 { $$ = DeclarationNode::newArray( $3, $2, true ); }
    3169         | '[' declaration_qualifier_list type_qualifier_list assignment_expression ']'
    3170                 { $$ = DeclarationNode::newArray( $4, $3->addQualifiers( $3 ), true ); }
     3103                { $$ = DeclarationNode::newArray( $4, $3, true ); }
     3104        | '[' push declaration_qualifier_list type_qualifier_list assignment_expression pop ']'
     3105                { $$ = DeclarationNode::newArray( $5, $4->addQualifiers( $3 ), true ); }
    31713106        ;
    31723107
     
    31803115//
    31813116//              cfa_abstract_tuple identifier_or_type_name
    3182 //              '[' cfa_parameter_list ']' identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     3117//              '[' cfa_parameter_list ']' identifier_or_type_name '(' cfa_parameter_ellipsis_list_opt ')'
    31833118//
    31843119// since a function return type can be syntactically identical to a tuple type:
     
    32373172
    32383173cfa_abstract_tuple:                                                                             // CFA
    3239         '[' cfa_abstract_parameter_list ']'
    3240                 { $$ = DeclarationNode::newTuple( $2 ); }
     3174        '[' push cfa_abstract_parameter_list pop ']'
     3175                { $$ = DeclarationNode::newTuple( $3 ); }
     3176        | '[' push type_specifier_nobody ELLIPSIS ']'
     3177                { SemanticError( yylloc, "Tuple array currently unimplemented." ); $$ = nullptr; }
     3178        | '[' push type_specifier_nobody ELLIPSIS constant_expression ']'
     3179                { SemanticError( yylloc, "Tuple array currently unimplemented." ); $$ = nullptr; }
    32413180        ;
    32423181
    32433182cfa_abstract_function:                                                                  // CFA
    3244 //      '[' ']' '(' cfa_parameter_type_list_opt ')'
     3183//      '[' ']' '(' cfa_parameter_ellipsis_list_opt ')'
    32453184//              { $$ = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), $4, nullptr ); }
    3246         cfa_abstract_tuple '(' cfa_parameter_type_list_opt ')'
    3247                 { $$ = DeclarationNode::newFunction( nullptr, $1, $3, nullptr ); }
    3248         | cfa_function_return '(' cfa_parameter_type_list_opt ')'
    3249                 { $$ = DeclarationNode::newFunction( nullptr, $1, $3, nullptr ); }
     3185        cfa_abstract_tuple '(' push cfa_parameter_ellipsis_list_opt pop ')'
     3186                { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
     3187        | cfa_function_return '(' push cfa_parameter_ellipsis_list_opt pop ')'
     3188                { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
    32503189        ;
    32513190
Note: See TracChangeset for help on using the changeset viewer.