- Timestamp:
- Dec 15, 2024, 10:11:40 PM (2 days ago)
- Branches:
- master
- Children:
- 0497b6ba
- Parents:
- 5786403
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r5786403 ra16f2b6 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Nov 15 15:01:33202413 // Update Count : 69 1512 // Last Modified On : Sun Dec 15 21:30:38 2024 13 // Update Count : 6933 14 14 // 15 15 … … 199 199 200 200 DeclarationNode * fieldDecl( DeclarationNode * typeSpec, DeclarationNode * fieldList ) { 201 if ( nullptr == fieldList ) { 202 if ( !( typeSpec->type && typeSpec->type->kind == TypeData::Aggregate ) ) { 203 stringstream ss; 201 if ( fieldList == nullptr ) { 202 if ( !( typeSpec->type && typeSpec->type->kind == TypeData::Aggregate ) ) { // int; no fieldList 204 203 // printf( "fieldDecl1 typeSpec %p\n", typeSpec ); typeSpec->type->print( std::cout ); 205 SemanticWarning( yylloc, Warning::SuperfluousDecl , ss.str().c_str());204 SemanticWarning( yylloc, Warning::SuperfluousDecl ); 206 205 return nullptr; 207 206 } // if 208 207 // printf( "fieldDecl2 typeSpec %p\n", typeSpec ); typeSpec->type->print( std::cout ); 209 fieldList = DeclarationNode::newName( nullptr ); 208 fieldList = DeclarationNode::newName( nullptr ); // struct S { ... } no fieldList 210 209 } // if 211 210 … … 464 463 // declarations 465 464 %type<decl> abstract_declarator abstract_ptr abstract_array abstract_function array_dimension multi_array_dimension 466 %type<decl> abstract_parameter_declarator_opt abstract_parameter_declarator abstract_parameter_ptr abstract_parameter_array abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension467 %type<decl>abstract_parameter_declaration465 %type<decl> abstract_parameter_declarator_opt abstract_parameter_declarator abstract_parameter_ptr abstract_parameter_array 466 abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension abstract_parameter_declaration 468 467 469 468 %type<aggKey> aggregate_key aggregate_data aggregate_control … … 492 491 %type<decl> exception_declaration 493 492 494 %type<decl> field_declaration_list_opt field_declaration field_declaring_list _opt field_declarator field_abstract_list_opt field_abstract493 %type<decl> field_declaration_list_opt field_declaration field_declaring_list field_declaring_list_opt field_declarator field_abstract_list_opt field_abstract 495 494 %type<expr> field field_name_list field_name fraction_constants_opt 496 495 … … 978 977 | '(' VIRTUAL type_no_function ')' cast_expression // CFA 979 978 { $$ = new ExpressionNode( new ast::VirtualCastExpr( yylloc, maybeMoveBuild( $5 ), maybeMoveBuildType( $3 ) ) ); } 980 | '(' RETURN type_no_function ')' cast_expression // CFA 979 | '(' RETURN type_no_function ')' cast_expression // CFA (ASCRIPTION) 981 980 { $$ = new ExpressionNode( build_cast( yylloc, $3, $5, ast::ReturnCast ) ); } 982 | '(' COERCE type_no_function ')' cast_expression // CFA 981 | '(' COERCE type_no_function ')' cast_expression // CFA (COERCION) 983 982 { SemanticError( yylloc, "Coerce cast is currently unimplemented." ); $$ = nullptr; } 984 | '(' qualifier_cast_list ')' cast_expression // CFA 983 | '(' qualifier_cast_list ')' cast_expression // CFA, (modify CVs of cast_expression) 985 984 { SemanticError( yylloc, "Qualifier cast is currently unimplemented." ); $$ = nullptr; } 986 985 // | '(' type_no_function ')' tuple … … 2701 2700 type_specifier field_declaring_list_opt ';' 2702 2701 { 2703 // printf( "type_specifier1 %p %s\n", $$, $$->type->aggregate.name ? $$->type->aggregate.name->c_str() : "(nil)" );2704 2702 $$ = fieldDecl( $1, $2 ); 2705 // printf( "type_specifier2 %p %s\n", $$, $$->type->aggregate.name ? $$->type->aggregate.name->c_str() : "(nil)" );2706 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) {2707 // printf( "\tattr %s\n", attr->name.c_str() );2708 // } // for2709 2703 } 2710 2704 | type_specifier field_declaring_list_opt '}' // invalid syntax rule … … 2741 2735 // empty 2742 2736 { $$ = nullptr; } 2743 | field_declarator 2737 | field_declaring_list 2738 ; 2739 2740 field_declaring_list: 2741 field_declarator 2744 2742 | field_declaring_list_opt ',' attribute_list_opt field_declarator 2745 2743 { $$ = $1->set_last( $4->addQualifiers( $3 ) ); } … … 3512 3510 | ATTRIBUTE '(' attribute_name_list ')' // CFA 3513 3511 { $$ = $3; } 3514 | ATTR '(' attribute_name_list ')' // CFA3515 { $$ = $ 3; }3516 | C23_ATTRIBUTE 3512 | ATTR attribute_name_list ']' // CFA, @[...] 3513 { $$ = $2; } 3514 | C23_ATTRIBUTE // C23, [[...]], see lexer 3517 3515 { $$ = DeclarationNode::newAttribute( $1 ); } 3518 3516 ;
Note: See TracChangeset
for help on using the changeset viewer.