Changes in src/Parser/parser.yy [e1d66c84:7cf8006]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
re1d66c84 r7cf8006 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Nov 21 22:34:30202213 // Update Count : 58 4812 // Last Modified On : Wed Nov 2 21:31:21 2022 13 // Update Count : 5810 14 14 // 15 15 … … 383 383 %type<ifctl> conditional_declaration 384 384 %type<fctl> for_control_expression for_control_expression_list 385 %type<compop> up upeq updown updowneq downupdowneq385 %type<compop> updown updowneq downupdowneq 386 386 %type<en> subrange 387 387 %type<decl> asm_name_opt … … 489 489 %type<decl> type_parameter type_parameter_list type_initializer_opt 490 490 491 %type<en> type_parameters_opt type_list array_type_list491 %type<en> type_parameters_opt type_list 492 492 493 493 %type<decl> type_qualifier type_qualifier_name forall type_qualifier_list_opt type_qualifier_list … … 551 551 552 552 %% 553 // ************************ Namespace Management ********************************553 //************************* Namespace Management ******************************** 554 554 555 555 // The C grammar is not context free because it relies on the distinct terminal symbols "identifier" and "TYPEDEFname", … … 588 588 ; 589 589 590 // ************************ CONSTANTS ********************************590 //************************* CONSTANTS ******************************** 591 591 592 592 constant: … … 634 634 ; 635 635 636 // ************************ EXPRESSIONS ********************************636 //************************* EXPRESSIONS ******************************** 637 637 638 638 primary_expression: … … 1101 1101 ; 1102 1102 1103 // ************************** STATEMENTS *******************************1103 //*************************** STATEMENTS ******************************* 1104 1104 1105 1105 statement: … … 1758 1758 ; 1759 1759 1760 // ****************************** DECLARATIONS *********************************1760 //******************************* DECLARATIONS ********************************* 1761 1761 1762 1762 declaration_list_opt: // used at beginning of switch statement … … 2558 2558 { typedefTable.makeTypedef( *$3 ); } 2559 2559 hide_opt '{' enumerator_list comma_opt '}' 2560 { $$ = DeclarationNode::newEnum( $3, $7, true, false, nullptr, $5)->addQualifiers( $2 ); }2560 { $$ = DeclarationNode::newEnum( $3, $7, true, false )->addQualifiers( $2 ); } 2561 2561 | ENUM attribute_list_opt typedef_name // unqualified type name 2562 2562 hide_opt '{' enumerator_list comma_opt '}' 2563 { $$ = DeclarationNode::newEnum( $3->name, $6, true, false , nullptr, $4)->addQualifiers( $2 ); }2563 { $$ = DeclarationNode::newEnum( $3->name, $6, true, false )->addQualifiers( $2 ); } 2564 2564 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}' 2565 2565 { … … 2580 2580 hide_opt '{' enumerator_list comma_opt '}' 2581 2581 { 2582 $$ = DeclarationNode::newEnum( $6, $11, true, true, $3 , $9)->addQualifiers( $5 )->addQualifiers( $7 );2582 $$ = DeclarationNode::newEnum( $6, $11, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 ); 2583 2583 } 2584 2584 | ENUM '(' ')' attribute_list_opt identifier attribute_list_opt 2585 2585 hide_opt '{' enumerator_list comma_opt '}' 2586 2586 { 2587 $$ = DeclarationNode::newEnum( $5, $9, true, true, nullptr , $7)->addQualifiers( $4 )->addQualifiers( $6 );2587 $$ = DeclarationNode::newEnum( $5, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 ); 2588 2588 } 2589 2589 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt 2590 2590 hide_opt '{' enumerator_list comma_opt '}' 2591 2591 { 2592 $$ = DeclarationNode::newEnum( $6->name, $10, true, true, $3 , $8)->addQualifiers( $5 )->addQualifiers( $7 );2592 $$ = DeclarationNode::newEnum( $6->name, $10, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 ); 2593 2593 } 2594 2594 | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt 2595 2595 hide_opt '{' enumerator_list comma_opt '}' 2596 2596 { 2597 $$ = DeclarationNode::newEnum( $5->name, $9, true, true, nullptr , $7)->addQualifiers( $4 )->addQualifiers( $6 );2597 $$ = DeclarationNode::newEnum( $5->name, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 ); 2598 2598 } 2599 2599 | enum_type_nobody … … 2991 2991 ; 2992 2992 2993 // **************************** EXTERNAL DEFINITIONS *****************************2993 //***************************** EXTERNAL DEFINITIONS ***************************** 2994 2994 2995 2995 translation_unit: … … 3653 3653 | '[' ']' multi_array_dimension 3654 3654 { $$ = DeclarationNode::newArray( 0, 0, false )->addArray( $3 ); } 3655 // Cannot use constant_expression because of tuples => semantic check 3656 | '[' push assignment_expression pop ',' comma_expression ']' // CFA 3655 | '[' push assignment_expression pop ',' comma_expression ']' 3657 3656 { $$ = DeclarationNode::newArray( $3, 0, false )->addArray( DeclarationNode::newArray( $6, 0, false ) ); } 3658 3657 // { SemanticError( yylloc, "New array dimension is currently unimplemented." ); $$ = nullptr; } 3659 | '[' push array_type_list pop ']' // CFA3660 { SemanticError( yylloc, "Type array dimension is currently unimplemented." ); $$ = nullptr; }3661 3658 | multi_array_dimension 3662 3659 ; 3663 3664 array_type_list:3665 basic_type_name3666 { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( $1 ) ) ); }3667 | type_name3668 { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( $1 ) ) ); }3669 | assignment_expression upupeq assignment_expression3670 | array_type_list ',' basic_type_name3671 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }3672 | array_type_list ',' type_name3673 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }3674 | array_type_list ',' assignment_expression upupeq assignment_expression3675 ;3676 3677 upupeq:3678 '~'3679 { $$ = OperKinds::LThan; }3680 | ErangeUpEq3681 { $$ = OperKinds::LEThan; }3682 ;3683 3660 3684 3661 multi_array_dimension: … … 4013 3990 // declaration lists (not prototype-format parameter type and identifier declarators) is an obsolescent feature. 4014 3991 4015 // ************************ MISCELLANEOUS ********************************3992 //************************* MISCELLANEOUS ******************************** 4016 3993 4017 3994 comma_opt: // redundant comma
Note:
See TracChangeset
for help on using the changeset viewer.