Changeset 1e30df7 for src/Parser
- Timestamp:
- Oct 18, 2022, 5:48:13 PM (21 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 5408b59
- Parents:
- a55472cc
- Location:
- src/Parser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
ra55472cc r1e30df7 297 297 } // if 298 298 } // DeclarationNode::newEnumValueGeneric 299 300 DeclarationNode * DeclarationNode::newEnumInLine( const string name ) { 301 DeclarationNode * newnode = newName( new std::string(name) ); 302 newnode->enumInLine = true; 303 return newnode; 304 } 299 305 300 306 DeclarationNode * DeclarationNode::newFromTypedef( const string * name ) { -
src/Parser/ParseNode.h
ra55472cc r1e30df7 240 240 static DeclarationNode * newEnumConstant( const std::string * name, ExpressionNode * constant ); 241 241 static DeclarationNode * newEnumValueGeneric( const std::string * name, InitializerNode * init ); 242 static DeclarationNode * newEnumInLine( const std::string name ); 242 243 static DeclarationNode * newName( const std::string * ); 243 244 static DeclarationNode * newFromTypeGen( const std::string *, ExpressionNode * params ); … … 339 340 340 341 bool inLine = false; 342 bool enumInLine = false; 341 343 Type::FuncSpecifiers funcSpecs; 342 344 Type::StorageClasses storageClasses; -
src/Parser/TypeData.cc
ra55472cc r1e30df7 924 924 list< Declaration * >::iterator members = ret->get_members().begin(); 925 925 for ( const DeclarationNode * cur = td->enumeration.constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) { 926 if ( cur->enumInLine ) { 927 // Tell the compiler this is a inline value placeholder 928 ObjectDecl * member = dynamic_cast< ObjectDecl* >(* members); 929 member->enumInLine = true; 930 } 926 931 if ( ret->isTyped && !ret->base && cur->has_enumeratorValue() ) { 927 932 SemanticError( td->location, "Enumerator of enum(void) cannot have an explicit initializer value." ); -
src/Parser/parser.yy
ra55472cc r1e30df7 2601 2601 { $$ = DeclarationNode::newEnumValueGeneric( $1, $2 ); } 2602 2602 | INLINE type_name 2603 { $$ = DeclarationNode::newEnum ValueGeneric( new string("inline"), nullptr); }2603 { $$ = DeclarationNode::newEnumInLine( *$2->type->symbolic.name ); } 2604 2604 | enumerator_list ',' identifier_or_type_name enumerator_value_opt 2605 2605 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $3, $4 ) ); }
Note: See TracChangeset
for help on using the changeset viewer.