Changeset e4d7c1c for src/Parser
- Timestamp:
- Nov 14, 2022, 3:07:34 PM (19 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- db6cdc0
- Parents:
- 71806e0
- Location:
- src/Parser
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r71806e0 re4d7c1c 254 254 } // DeclarationNode::newAggregate 255 255 256 DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body, bool typed, DeclarationNode * base ) {256 DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body, bool typed, DeclarationNode * base, EnumHiding hiding ) { 257 257 DeclarationNode * newnode = new DeclarationNode; 258 258 newnode->type = new TypeData( TypeData::Enum ); … … 262 262 newnode->type->enumeration.anon = name == nullptr; 263 263 newnode->type->enumeration.typed = typed; 264 newnode->type->enumeration.hiding = hiding; 264 265 if ( base && base->type) { 265 266 newnode->type->base = base->type; -
src/Parser/ParseNode.h
r71806e0 re4d7c1c 239 239 static DeclarationNode * newFunction( const std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ); 240 240 static DeclarationNode * newAggregate( AggregateDecl::Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ); 241 static DeclarationNode * newEnum( const std::string * name, DeclarationNode * constants, bool body, bool typed, DeclarationNode * base = nullptr );241 static DeclarationNode * newEnum( const std::string * name, DeclarationNode * constants, bool body, bool typed, DeclarationNode * base = nullptr, EnumHiding hiding = EnumHiding::Visible ); 242 242 static DeclarationNode * newEnumConstant( const std::string * name, ExpressionNode * constant ); 243 243 static DeclarationNode * newEnumValueGeneric( const std::string * name, InitializerNode * init ); -
src/Parser/TypeData.cc
r71806e0 re4d7c1c 923 923 buildList( td->enumeration.constants, ret->get_members() ); 924 924 list< Declaration * >::iterator members = ret->get_members().begin(); 925 ret->hide = td->enumeration.hiding == EnumHiding::Hide ? EnumDecl::EnumHiding::Hide : EnumDecl::EnumHiding::Visible; 925 926 for ( const DeclarationNode * cur = td->enumeration.constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) { 926 927 if ( cur->enumInLine ) { -
src/Parser/TypeData.h
r71806e0 re4d7c1c 60 60 bool anon; 61 61 bool typed; 62 EnumHiding hiding; 62 63 }; 63 64 -
src/Parser/parser.yy
r71806e0 re4d7c1c 2558 2558 { typedefTable.makeTypedef( *$3 ); } 2559 2559 hide_opt '{' enumerator_list comma_opt '}' 2560 { $$ = DeclarationNode::newEnum( $3, $7, true, false )->addQualifiers( $2 ); }2560 { $$ = DeclarationNode::newEnum( $3, $7, true, false, nullptr, $5 )->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 )->addQualifiers( $2 ); }2563 { $$ = DeclarationNode::newEnum( $3->name, $6, true, false, nullptr, $4 )->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 )->addQualifiers( $5 )->addQualifiers( $7 );2582 $$ = DeclarationNode::newEnum( $6, $11, true, true, $3, $9 )->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 )->addQualifiers( $4 )->addQualifiers( $6 );2587 $$ = DeclarationNode::newEnum( $5, $9, true, true, nullptr, $7 )->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 )->addQualifiers( $5 )->addQualifiers( $7 );2592 $$ = DeclarationNode::newEnum( $6->name, $10, true, true, $3, $8 )->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 )->addQualifiers( $4 )->addQualifiers( $6 );2597 $$ = DeclarationNode::newEnum( $5->name, $9, true, true, nullptr, $7 )->addQualifiers( $4 )->addQualifiers( $6 ); 2598 2598 } 2599 2599 | enum_type_nobody
Note: See TracChangeset
for help on using the changeset viewer.