Changeset a5f9444
- Timestamp:
- Jan 30, 2023, 8:43:16 PM (22 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 0f15e3b
- Parents:
- 79a6b17
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r79a6b17 ra5f9444 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 30 1 8:59:23202313 // Update Count : 585 612 // Last Modified On : Mon Jan 30 19:19:22 2023 13 // Update Count : 5858 14 14 // 15 15 … … 1645 1645 exception_statement: 1646 1646 TRY compound_statement handler_clause %prec THEN 1647 { $$ = new StatementNode( build_try( $2, $3, 0) ); }1647 { $$ = new StatementNode( build_try( $2, $3, nullptr ) ); } 1648 1648 | TRY compound_statement finally_clause 1649 { $$ = new StatementNode( build_try( $2, 0, $3 ) ); }1649 { $$ = new StatementNode( build_try( $2, nullptr, $3 ) ); } 1650 1650 | TRY compound_statement handler_clause finally_clause 1651 1651 { $$ = new StatementNode( build_try( $2, $3, $4 ) ); } … … 1699 1699 asm_statement: 1700 1700 ASM asm_volatile_opt '(' string_literal ')' ';' 1701 { $$ = new StatementNode( build_asm( $2, $4, 0) ); }1701 { $$ = new StatementNode( build_asm( $2, $4, nullptr ) ); } 1702 1702 | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ')' ';' // remaining GCC 1703 1703 { $$ = new StatementNode( build_asm( $2, $4, $6 ) ); } … … 1707 1707 { $$ = new StatementNode( build_asm( $2, $4, $6, $8, $10 ) ); } 1708 1708 | 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 ) ); } 1710 1710 ; 1711 1711 … … 1880 1880 // '[' ']' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' // S/R conflict 1881 1881 // { 1882 // $$ = DeclarationNode::newFunction( $3, DeclarationNode::newTuple( 0 ), $6, 0, true );1882 // $$ = DeclarationNode::newFunction( $3, DeclarationNode::newTuple( 0 ), $6, nullptr, true ); 1883 1883 // } 1884 1884 // '[' ']' identifier '(' push cfa_parameter_ellipsis_list_opt pop ')' 1885 1885 // { 1886 1886 // typedefTable.setNextIdentifier( *$5 ); 1887 // $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, 0, true );1887 // $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, nullptr, true ); 1888 1888 // } 1889 1889 // | '[' ']' TYPEDEFname '(' push cfa_parameter_ellipsis_list_opt pop ')' 1890 1890 // { 1891 1891 // typedefTable.setNextIdentifier( *$5 ); 1892 // $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, 0, true );1892 // $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, nullptr, true ); 1893 1893 // } 1894 1894 // | '[' ']' typegen_name … … 1902 1902 cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' attribute_list_opt 1903 1903 // 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 ); } 1905 1905 | 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 ); } 1907 1907 ; 1908 1908 … … 2626 2626 enum_type_nobody: // enum - {...} 2627 2627 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 ); } 2629 2629 | 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 ); } 2631 2631 ; 2632 2632 … … 2967 2967 { 2968 2968 typedefTable.addToEnclosingScope( *$1, TYPEDEFname, "10" ); 2969 $$ = DeclarationNode::newTypeDecl( $1, 0);2969 $$ = DeclarationNode::newTypeDecl( $1, nullptr ); 2970 2970 } 2971 2971 | identifier_or_type_name '(' type_parameter_list ')' … … 2978 2978 trait_specifier: // CFA 2979 2979 TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' '}' 2980 { $$ = DeclarationNode::newTrait( $2, $4, 0); }2980 { $$ = DeclarationNode::newTrait( $2, $4, nullptr ); } 2981 2981 | TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' push trait_declaration_list pop '}' 2982 2982 { $$ = DeclarationNode::newTrait( $2, $4, $8 ); } … … 3060 3060 } 3061 3061 | 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 ) ) ); } 3063 3063 | EXTERN STRINGliteral 3064 3064 { … … 3304 3304 variable_ptr: 3305 3305 ptrref_operator variable_declarator 3306 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }3306 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3307 3307 | ptrref_operator type_qualifier_list variable_declarator 3308 3308 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } … … 3368 3368 function_ptr: 3369 3369 ptrref_operator function_declarator 3370 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }3370 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3371 3371 | ptrref_operator type_qualifier_list function_declarator 3372 3372 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } … … 3420 3420 KR_function_ptr: 3421 3421 ptrref_operator KR_function_declarator 3422 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }3422 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3423 3423 | ptrref_operator type_qualifier_list KR_function_declarator 3424 3424 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } … … 3476 3476 type_ptr: 3477 3477 ptrref_operator variable_type_redeclarator 3478 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }3478 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3479 3479 | ptrref_operator type_qualifier_list variable_type_redeclarator 3480 3480 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } … … 3534 3534 identifier_parameter_ptr: 3535 3535 ptrref_operator identifier_parameter_declarator 3536 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }3536 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3537 3537 | ptrref_operator type_qualifier_list identifier_parameter_declarator 3538 3538 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } … … 3591 3591 type_parameter_ptr: 3592 3592 ptrref_operator type_parameter_redeclarator 3593 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }3593 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3594 3594 | ptrref_operator type_qualifier_list type_parameter_redeclarator 3595 3595 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } … … 3634 3634 abstract_ptr: 3635 3635 ptrref_operator 3636 { $$ = DeclarationNode::newPointer( 0, $1 ); }3636 { $$ = DeclarationNode::newPointer( nullptr, $1 ); } 3637 3637 | ptrref_operator type_qualifier_list 3638 3638 { $$ = DeclarationNode::newPointer( $2, $1 ); } 3639 3639 | ptrref_operator abstract_declarator 3640 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }3640 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3641 3641 | ptrref_operator type_qualifier_list abstract_declarator 3642 3642 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } … … 3667 3667 // Only the first dimension can be empty. 3668 3668 '[' ']' 3669 { $$ = DeclarationNode::newArray( 0, 0, false ); }3669 { $$ = DeclarationNode::newArray( nullptr, nullptr, false ); } 3670 3670 | '[' ']' multi_array_dimension 3671 { $$ = DeclarationNode::newArray( 0, 0, false )->addArray( $3 ); }3671 { $$ = DeclarationNode::newArray( nullptr, nullptr, false )->addArray( $3 ); } 3672 3672 // Cannot use constant_expression because of tuples => semantic check 3673 3673 | '[' 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 ) ); } 3675 3675 // { SemanticError( yylloc, "New array dimension is currently unimplemented." ); $$ = nullptr; } 3676 3676 | '[' push array_type_list pop ']' // CFA … … 3701 3701 multi_array_dimension: 3702 3702 '[' push assignment_expression pop ']' 3703 { $$ = DeclarationNode::newArray( $3, 0, false ); }3703 { $$ = DeclarationNode::newArray( $3, nullptr, false ); } 3704 3704 | '[' push '*' pop ']' // C99 3705 3705 { $$ = DeclarationNode::newVarArray( 0 ); } 3706 3706 | multi_array_dimension '[' push assignment_expression pop ']' 3707 { $$ = $1->addArray( DeclarationNode::newArray( $4, 0, false ) ); }3707 { $$ = $1->addArray( DeclarationNode::newArray( $4, nullptr, false ) ); } 3708 3708 | multi_array_dimension '[' push '*' pop ']' // C99 3709 3709 { $$ = $1->addArray( DeclarationNode::newVarArray( 0 ) ); } … … 3802 3802 array_parameter_1st_dimension: 3803 3803 '[' ']' 3804 { $$ = DeclarationNode::newArray( 0, 0, false ); }3804 { $$ = DeclarationNode::newArray( nullptr, nullptr, false ); } 3805 3805 // multi_array_dimension handles the '[' '*' ']' case 3806 3806 | '[' push type_qualifier_list '*' pop ']' // remaining C99 3807 3807 { $$ = DeclarationNode::newVarArray( $3 ); } 3808 3808 | '[' push type_qualifier_list pop ']' 3809 { $$ = DeclarationNode::newArray( 0, $3, false ); }3809 { $$ = DeclarationNode::newArray( nullptr, $3, false ); } 3810 3810 // multi_array_dimension handles the '[' assignment_expression ']' case 3811 3811 | '[' push type_qualifier_list assignment_expression pop ']' … … 3836 3836 variable_abstract_ptr: 3837 3837 ptrref_operator 3838 { $$ = DeclarationNode::newPointer( 0, $1 ); }3838 { $$ = DeclarationNode::newPointer( nullptr, $1 ); } 3839 3839 | ptrref_operator type_qualifier_list 3840 3840 { $$ = DeclarationNode::newPointer( $2, $1 ); } 3841 3841 | ptrref_operator variable_abstract_declarator 3842 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }3842 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3843 3843 | ptrref_operator type_qualifier_list variable_abstract_declarator 3844 3844 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } … … 3882 3882 // No SUE declaration in parameter list. 3883 3883 ptrref_operator type_specifier_nobody 3884 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }3884 { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3885 3885 | type_qualifier_list ptrref_operator type_specifier_nobody 3886 3886 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 3887 3887 | ptrref_operator cfa_abstract_function 3888 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }3888 { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3889 3889 | type_qualifier_list ptrref_operator cfa_abstract_function 3890 3890 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 3891 3891 | ptrref_operator cfa_identifier_parameter_declarator_tuple 3892 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }3892 { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3893 3893 | type_qualifier_list ptrref_operator cfa_identifier_parameter_declarator_tuple 3894 3894 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } … … 3899 3899 // shift/reduce conflict with new-style empty (void) function return type. 3900 3900 '[' ']' type_specifier_nobody 3901 { $$ = $3->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }3901 { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 3902 3902 | cfa_array_parameter_1st_dimension type_specifier_nobody 3903 3903 { $$ = $2->addNewArray( $1 ); } 3904 3904 | '[' ']' 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 ) ); } 3906 3906 | cfa_array_parameter_1st_dimension multi_array_dimension type_specifier_nobody 3907 3907 { $$ = $3->addNewArray( $2 )->addNewArray( $1 ); } … … 3910 3910 3911 3911 | '[' ']' cfa_identifier_parameter_ptr 3912 { $$ = $3->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }3912 { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 3913 3913 | cfa_array_parameter_1st_dimension cfa_identifier_parameter_ptr 3914 3914 { $$ = $2->addNewArray( $1 ); } 3915 3915 | '[' ']' 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 ) ); } 3917 3917 | cfa_array_parameter_1st_dimension multi_array_dimension cfa_identifier_parameter_ptr 3918 3918 { $$ = $3->addNewArray( $2 )->addNewArray( $1 ); } … … 3970 3970 cfa_abstract_ptr: // CFA 3971 3971 ptrref_operator type_specifier 3972 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }3972 { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3973 3973 | type_qualifier_list ptrref_operator type_specifier 3974 3974 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 3975 3975 | ptrref_operator cfa_abstract_function 3976 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }3976 { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3977 3977 | type_qualifier_list ptrref_operator cfa_abstract_function 3978 3978 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 3979 3979 | ptrref_operator cfa_abstract_declarator_tuple 3980 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }3980 { $$ = $2->addNewPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 3981 3981 | type_qualifier_list ptrref_operator cfa_abstract_declarator_tuple 3982 3982 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
Note: See TracChangeset
for help on using the changeset viewer.