Changeset a5f9444


Ignore:
Timestamp:
Jan 30, 2023, 8:43:16 PM (22 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
0f15e3b
Parents:
79a6b17
Message:

change 0 to nullptr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r79a6b17 ra5f9444  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 30 18:59:23 2023
    13 // Update Count     : 5856
     12// Last Modified On : Mon Jan 30 19:19:22 2023
     13// Update Count     : 5858
    1414//
    1515
     
    16451645exception_statement:
    16461646        TRY compound_statement handler_clause                                   %prec THEN
    1647                 { $$ = new StatementNode( build_try( $2, $3, 0 ) ); }
     1647                { $$ = new StatementNode( build_try( $2, $3, nullptr ) ); }
    16481648        | TRY compound_statement finally_clause
    1649                 { $$ = new StatementNode( build_try( $2, 0, $3 ) ); }
     1649                { $$ = new StatementNode( build_try( $2, nullptr, $3 ) ); }
    16501650        | TRY compound_statement handler_clause finally_clause
    16511651                { $$ = new StatementNode( build_try( $2, $3, $4 ) ); }
     
    16991699asm_statement:
    17001700        ASM asm_volatile_opt '(' string_literal ')' ';'
    1701                 { $$ = new StatementNode( build_asm( $2, $4, 0 ) ); }
     1701                { $$ = new StatementNode( build_asm( $2, $4, nullptr ) ); }
    17021702        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ')' ';' // remaining GCC
    17031703                { $$ = new StatementNode( build_asm( $2, $4, $6 ) ); }
     
    17071707                { $$ = new StatementNode( build_asm( $2, $4, $6, $8, $10 ) ); }
    17081708        | ASM asm_volatile_opt GOTO '(' string_literal ':' ':' asm_operands_opt ':' asm_clobbers_list_opt ':' label_list ')' ';'
    1709                 { $$ = new StatementNode( build_asm( $2, $5, 0, $8, $10, $12 ) ); }
     1709                { $$ = new StatementNode( build_asm( $2, $5, nullptr, $8, $10, $12 ) ); }
    17101710        ;
    17111711
     
    18801880//      '[' ']' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' // S/R conflict
    18811881//              {
    1882 //                      $$ = DeclarationNode::newFunction( $3, DeclarationNode::newTuple( 0 ), $6, 0, true );
     1882//                      $$ = DeclarationNode::newFunction( $3, DeclarationNode::newTuple( 0 ), $6, nullptr, true );
    18831883//              }
    18841884//      '[' ']' identifier '(' push cfa_parameter_ellipsis_list_opt pop ')'
    18851885//              {
    18861886//                      typedefTable.setNextIdentifier( *$5 );
    1887 //                      $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, 0, true );
     1887//                      $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, nullptr, true );
    18881888//              }
    18891889//      | '[' ']' TYPEDEFname '(' push cfa_parameter_ellipsis_list_opt pop ')'
    18901890//              {
    18911891//                      typedefTable.setNextIdentifier( *$5 );
    1892 //                      $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, 0, true );
     1892//                      $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, nullptr, true );
    18931893//              }
    18941894//      | '[' ']' typegen_name
     
    19021902        cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' attribute_list_opt
    19031903                // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator).
    1904                 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 )->addQualifiers( $8 ); }
     1904                { $$ = DeclarationNode::newFunction( $2, $1, $5, nullptr )->addQualifiers( $8 ); }
    19051905        | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' attribute_list_opt
    1906                 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 )->addQualifiers( $8 ); }
     1906                { $$ = DeclarationNode::newFunction( $2, $1, $5, nullptr )->addQualifiers( $8 ); }
    19071907        ;
    19081908
     
    26262626enum_type_nobody:                                                                               // enum - {...}
    26272627        ENUM attribute_list_opt identifier
    2628                 { typedefTable.makeTypedef( *$3 ); $$ = DeclarationNode::newEnum( $3, 0, false, false )->addQualifiers( $2 ); }
     2628                { typedefTable.makeTypedef( *$3 ); $$ = DeclarationNode::newEnum( $3, nullptr, false, false )->addQualifiers( $2 ); }
    26292629        | ENUM attribute_list_opt type_name
    2630                 { typedefTable.makeTypedef( *$3->type->symbolic.name ); $$ = DeclarationNode::newEnum( $3->type->symbolic.name, 0, false, false )->addQualifiers( $2 ); }
     2630                { typedefTable.makeTypedef( *$3->type->symbolic.name ); $$ = DeclarationNode::newEnum( $3->type->symbolic.name, nullptr, false, false )->addQualifiers( $2 ); }
    26312631        ;
    26322632
     
    29672967                {
    29682968                        typedefTable.addToEnclosingScope( *$1, TYPEDEFname, "10" );
    2969                         $$ = DeclarationNode::newTypeDecl( $1, 0 );
     2969                        $$ = DeclarationNode::newTypeDecl( $1, nullptr );
    29702970                }
    29712971        | identifier_or_type_name '(' type_parameter_list ')'
     
    29782978trait_specifier:                                                                                // CFA
    29792979        TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' '}'
    2980                 { $$ = DeclarationNode::newTrait( $2, $4, 0 ); }
     2980                { $$ = DeclarationNode::newTrait( $2, $4, nullptr ); }
    29812981        | TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' push trait_declaration_list pop '}'
    29822982                { $$ = DeclarationNode::newTrait( $2, $4, $8 ); }
     
    30603060                }
    30613061        | ASM '(' string_literal ')' ';'                                        // GCC, global assembler statement
    3062                 { $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asm( false, $3, 0 ) ) ); }
     3062                { $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asm( false, $3, nullptr ) ) ); }
    30633063        | EXTERN STRINGliteral
    30643064                {
     
    33043304variable_ptr:
    33053305        ptrref_operator variable_declarator
    3306                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3306                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    33073307        | ptrref_operator type_qualifier_list variable_declarator
    33083308                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     
    33683368function_ptr:
    33693369        ptrref_operator function_declarator
    3370                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3370                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    33713371        | ptrref_operator type_qualifier_list function_declarator
    33723372                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     
    34203420KR_function_ptr:
    34213421        ptrref_operator KR_function_declarator
    3422                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3422                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    34233423        | ptrref_operator type_qualifier_list KR_function_declarator
    34243424                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     
    34763476type_ptr:
    34773477        ptrref_operator variable_type_redeclarator
    3478                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3478                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    34793479        | ptrref_operator type_qualifier_list variable_type_redeclarator
    34803480                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     
    35343534identifier_parameter_ptr:
    35353535        ptrref_operator identifier_parameter_declarator
    3536                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3536                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    35373537        | ptrref_operator type_qualifier_list identifier_parameter_declarator
    35383538                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     
    35913591type_parameter_ptr:
    35923592        ptrref_operator type_parameter_redeclarator
    3593                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3593                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    35943594        | ptrref_operator type_qualifier_list type_parameter_redeclarator
    35953595                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     
    36343634abstract_ptr:
    36353635        ptrref_operator
    3636                 { $$ = DeclarationNode::newPointer( 0, $1 ); }
     3636                { $$ = DeclarationNode::newPointer( nullptr, $1 ); }
    36373637        | ptrref_operator type_qualifier_list
    36383638                { $$ = DeclarationNode::newPointer( $2, $1 ); }
    36393639        | ptrref_operator abstract_declarator
    3640                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3640                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    36413641        | ptrref_operator type_qualifier_list abstract_declarator
    36423642                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     
    36673667                // Only the first dimension can be empty.
    36683668        '[' ']'
    3669                 { $$ = DeclarationNode::newArray( 0, 0, false ); }
     3669                { $$ = DeclarationNode::newArray( nullptr, nullptr, false ); }
    36703670        | '[' ']' multi_array_dimension
    3671                 { $$ = DeclarationNode::newArray( 0, 0, false )->addArray( $3 ); }
     3671                { $$ = DeclarationNode::newArray( nullptr, nullptr, false )->addArray( $3 ); }
    36723672                // Cannot use constant_expression because of tuples => semantic check
    36733673        | '[' push assignment_expression pop ',' comma_expression ']' // CFA
    3674                 { $$ = DeclarationNode::newArray( $3, 0, false )->addArray( DeclarationNode::newArray( $6, 0, false ) ); }
     3674                { $$ = DeclarationNode::newArray( $3, nullptr, false )->addArray( DeclarationNode::newArray( $6, nullptr, false ) ); }
    36753675                // { SemanticError( yylloc, "New array dimension is currently unimplemented." ); $$ = nullptr; }
    36763676        | '[' push array_type_list pop ']'                                      // CFA
     
    37013701multi_array_dimension:
    37023702        '[' push assignment_expression pop ']'
    3703                 { $$ = DeclarationNode::newArray( $3, 0, false ); }
     3703                { $$ = DeclarationNode::newArray( $3, nullptr, false ); }
    37043704        | '[' push '*' pop ']'                                                          // C99
    37053705                { $$ = DeclarationNode::newVarArray( 0 ); }
    37063706        | multi_array_dimension '[' push assignment_expression pop ']'
    3707                 { $$ = $1->addArray( DeclarationNode::newArray( $4, 0, false ) ); }
     3707                { $$ = $1->addArray( DeclarationNode::newArray( $4, nullptr, false ) ); }
    37083708        | multi_array_dimension '[' push '*' pop ']'            // C99
    37093709                { $$ = $1->addArray( DeclarationNode::newVarArray( 0 ) ); }
     
    38023802array_parameter_1st_dimension:
    38033803        '[' ']'
    3804                 { $$ = DeclarationNode::newArray( 0, 0, false ); }
     3804                { $$ = DeclarationNode::newArray( nullptr, nullptr, false ); }
    38053805                // multi_array_dimension handles the '[' '*' ']' case
    38063806        | '[' push type_qualifier_list '*' pop ']'                      // remaining C99
    38073807                { $$ = DeclarationNode::newVarArray( $3 ); }
    38083808        | '[' push type_qualifier_list pop ']'
    3809                 { $$ = DeclarationNode::newArray( 0, $3, false ); }
     3809                { $$ = DeclarationNode::newArray( nullptr, $3, false ); }
    38103810                // multi_array_dimension handles the '[' assignment_expression ']' case
    38113811        | '[' push type_qualifier_list assignment_expression pop ']'
     
    38363836variable_abstract_ptr:
    38373837        ptrref_operator
    3838                 { $$ = DeclarationNode::newPointer( 0, $1 ); }
     3838                { $$ = DeclarationNode::newPointer( nullptr, $1 ); }
    38393839        | ptrref_operator type_qualifier_list
    38403840                { $$ = DeclarationNode::newPointer( $2, $1 ); }
    38413841        | ptrref_operator variable_abstract_declarator
    3842                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3842                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    38433843        | ptrref_operator type_qualifier_list variable_abstract_declarator
    38443844                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     
    38823882                // No SUE declaration in parameter list.
    38833883        ptrref_operator type_specifier_nobody
    3884                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3884                { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    38853885        | type_qualifier_list ptrref_operator type_specifier_nobody
    38863886                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    38873887        | ptrref_operator cfa_abstract_function
    3888                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3888                { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    38893889        | type_qualifier_list ptrref_operator cfa_abstract_function
    38903890                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    38913891        | ptrref_operator cfa_identifier_parameter_declarator_tuple
    3892                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3892                { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    38933893        | type_qualifier_list ptrref_operator cfa_identifier_parameter_declarator_tuple
    38943894                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
     
    38993899                // shift/reduce conflict with new-style empty (void) function return type.
    39003900        '[' ']' type_specifier_nobody
    3901                 { $$ = $3->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     3901                { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    39023902        | cfa_array_parameter_1st_dimension type_specifier_nobody
    39033903                { $$ = $2->addNewArray( $1 ); }
    39043904        | '[' ']' multi_array_dimension type_specifier_nobody
    3905                 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     3905                { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    39063906        | cfa_array_parameter_1st_dimension multi_array_dimension type_specifier_nobody
    39073907                { $$ = $3->addNewArray( $2 )->addNewArray( $1 ); }
     
    39103910
    39113911        | '[' ']' cfa_identifier_parameter_ptr
    3912                 { $$ = $3->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     3912                { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    39133913        | cfa_array_parameter_1st_dimension cfa_identifier_parameter_ptr
    39143914                { $$ = $2->addNewArray( $1 ); }
    39153915        | '[' ']' multi_array_dimension cfa_identifier_parameter_ptr
    3916                 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     3916                { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    39173917        | cfa_array_parameter_1st_dimension multi_array_dimension cfa_identifier_parameter_ptr
    39183918                { $$ = $3->addNewArray( $2 )->addNewArray( $1 ); }
     
    39703970cfa_abstract_ptr:                                                                               // CFA
    39713971        ptrref_operator type_specifier
    3972                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3972                { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    39733973        | type_qualifier_list ptrref_operator type_specifier
    39743974                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    39753975        | ptrref_operator cfa_abstract_function
    3976                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3976                { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    39773977        | type_qualifier_list ptrref_operator cfa_abstract_function
    39783978                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    39793979        | ptrref_operator cfa_abstract_declarator_tuple
    3980                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     3980                { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    39813981        | type_qualifier_list ptrref_operator cfa_abstract_declarator_tuple
    39823982                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
Note: See TracChangeset for help on using the changeset viewer.