Ignore:
Timestamp:
May 27, 2018, 10:19:55 PM (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:
1213f21
Parents:
91cfa34
Message:

fix and formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r91cfa34 r40de461  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu May 24 18:11:59 2018
    13 // Update Count     : 3369
     12// Last Modified On : Sun May 27 12:01:51 2018
     13// Update Count     : 3373
    1414//
    1515
     
    324324%type<decl> cfa_identifier_parameter_declarator_tuple cfa_identifier_parameter_ptr
    325325
    326 %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
    327327
    328328%type<decl> cfa_typedef_declaration cfa_variable_declaration cfa_variable_specifier
     
    13641364        | declaration_qualifier_list type_qualifier_list cfa_function_specifier
    13651365                { $$ = $3->addQualifiers( $1 )->addQualifiers( $2 ); }
    1366         | 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 ')'
    13671367                {
    13681368                        // Append the return type at the start (left-hand-side) to each identifier in the list.
    13691369                        DeclarationNode * ret = new DeclarationNode;
    13701370                        ret->type = maybeClone( $1->type->base );
    1371                         $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $5, nullptr ) );
     1371                        $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $6, nullptr ) );
    13721372                }
    13731373        ;
    13741374
    13751375cfa_function_specifier:                                                                 // CFA
    1376 //      '[' ']' 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
    13771377//              {
    13781378//                      $$ = DeclarationNode::newFunction( $3, DeclarationNode::newTuple( 0 ), $6, 0, true );
    13791379//              }
    1380 //      '[' ']' identifier '(' push cfa_parameter_type_list_opt pop ')'
     1380//      '[' ']' identifier '(' push cfa_parameter_ellipsis_list_opt pop ')'
    13811381//              {
    13821382//                      typedefTable.setNextIdentifier( *$5 );
    13831383//                      $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, 0, true );
    13841384//              }
    1385 //      | '[' ']' TYPEDEFname '(' push cfa_parameter_type_list_opt pop ')'
     1385//      | '[' ']' TYPEDEFname '(' push cfa_parameter_ellipsis_list_opt pop ')'
    13861386//              {
    13871387//                      typedefTable.setNextIdentifier( *$5 );
     
    13911391                // identifier_or_type_name must be broken apart because of the sequence:
    13921392                //
    1393                 //   '[' ']' identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     1393                //   '[' ']' identifier_or_type_name '(' cfa_parameter_ellipsis_list_opt ')'
    13941394                //   '[' ']' type_specifier
    13951395                //
    13961396                // type_specifier can resolve to just TYPEDEFname (e.g., typedef int T; int f( T );). Therefore this must be
    13971397                // flattened to allow lookahead to the '(' without having to reduce identifier_or_type_name.
    1398         cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
     1398        cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
    13991399                // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator).
    14001400                { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
    1401         | cfa_function_return identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
     1401        | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
    14021402                { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
    14031403        ;
     
    19511951        ;
    19521952
    1953 cfa_parameter_type_list_opt:                                                    // CFA, abstract + real
     1953cfa_parameter_ellipsis_list_opt:                                                        // CFA, abstract + real
    19541954        // empty
    19551955                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     
    31153115//
    31163116//              cfa_abstract_tuple identifier_or_type_name
    3117 //              '[' 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 ')'
    31183118//
    31193119// since a function return type can be syntactically identical to a tuple type:
     
    31773177
    31783178cfa_abstract_function:                                                                  // CFA
    3179 //      '[' ']' '(' cfa_parameter_type_list_opt ')'
     3179//      '[' ']' '(' cfa_parameter_ellipsis_list_opt ')'
    31803180//              { $$ = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), $4, nullptr ); }
    3181         cfa_abstract_tuple '(' push cfa_parameter_type_list_opt pop ')'
     3181        cfa_abstract_tuple '(' push cfa_parameter_ellipsis_list_opt pop ')'
    31823182                { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
    3183         | cfa_function_return '(' push cfa_parameter_type_list_opt pop ')'
     3183        | cfa_function_return '(' push cfa_parameter_ellipsis_list_opt pop ')'
    31843184                { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
    31853185        ;
Note: See TracChangeset for help on using the changeset viewer.