Changeset 6ea87486 for src/Parser
- Timestamp:
- Jul 14, 2017, 5:25:25 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- bac5158
- Parents:
- 4b234f0
- Location:
- src/Parser
- Files:
-
- 5 edited
-
DeclarationNode.cc (modified) (3 diffs)
-
ParseNode.h (modified) (3 diffs)
-
TypeData.cc (modified) (5 diffs)
-
TypeData.h (modified) (2 diffs)
-
parser.yy (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r4b234f0 r6ea87486 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:27:00 201713 // Update Count : 10 1912 // Last Modified On : Fri Jul 14 16:55:00 2017 13 // Update Count : 1020 14 14 // 15 15 … … 253 253 newnode->type->aggregate.fields = fields; 254 254 newnode->type->aggregate.body = body; 255 newnode->type->aggregate.tagged = false; 256 newnode->type->aggregate.parent = nullptr; 255 257 return newnode; 256 258 } // DeclarationNode::newAggregate … … 273 275 return newnode; 274 276 } // DeclarationNode::newEnumConstant 277 278 DeclarationNode * DeclarationNode::newTreeStruct( Aggregate kind, const string * name, const string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ) { 279 assert( name ); 280 DeclarationNode * newnode = new DeclarationNode; 281 newnode->type = new TypeData( TypeData::Aggregate ); 282 newnode->type->aggregate.kind = kind; 283 newnode->type->aggregate.name = name; 284 newnode->type->aggregate.actuals = actuals; 285 newnode->type->aggregate.fields = fields; 286 newnode->type->aggregate.body = body; 287 newnode->type->aggregate.tagged = true; 288 newnode->type->aggregate.parent = parent; 289 return newnode; 290 } // DeclarationNode::newTreeStruct 275 291 276 292 DeclarationNode * DeclarationNode::newName( string * name ) { -
src/Parser/ParseNode.h
r4b234f0 r6ea87486 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 12 13:00:00 201713 // Update Count : 7 7912 // Last Modified On : Fri Jul 14 16:56:00 2017 13 // Update Count : 780 14 14 // 15 15 … … 248 248 static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement 249 249 250 // Perhaps this would best fold into newAggragate. 251 static DeclarationNode * newTreeStruct( Aggregate kind, const std::string * name, const std::string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ); 252 250 253 DeclarationNode(); 251 254 ~DeclarationNode(); … … 332 335 333 336 static UniqueName anonymous; 337 338 // Temp to test TreeStruct 339 const std::string * parent_name; 334 340 }; // DeclarationNode 335 341 -
src/Parser/TypeData.cc
r4b234f0 r6ea87486 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:28:00 201713 // Update Count : 56 412 // Last Modified On : Fri Jul 14 16:58:00 2017 13 // Update Count : 565 14 14 // 15 15 … … 63 63 aggregate.fields = nullptr; 64 64 aggregate.body = false; 65 aggregate.tagged = false; 66 aggregate.parent = nullptr; 65 67 break; 66 68 case AggregateInst: … … 121 123 delete aggregate.actuals; 122 124 delete aggregate.fields; 125 delete aggregate.parent; 123 126 // delete aggregate; 124 127 break; … … 192 195 newtype->aggregate.kind = aggregate.kind; 193 196 newtype->aggregate.body = aggregate.body; 197 newtype->aggregate.tagged = aggregate.tagged; 198 newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr; 194 199 break; 195 200 case AggregateInst: … … 619 624 switch ( td->aggregate.kind ) { 620 625 case DeclarationNode::Struct: 626 if ( td->aggregate.tagged ) { 627 at = new StructDecl( *td->aggregate.name, td->aggregate.parent, attributes, linkage ); 628 buildForall( td->aggregate.params, at->get_parameters() ); 629 break; 630 } 621 631 case DeclarationNode::Coroutine: 622 632 case DeclarationNode::Monitor: -
src/Parser/TypeData.h
r4b234f0 r6ea87486 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:29:00 201713 // Update Count : 18 612 // Last Modified On : Fri Jul 14 16:57:00 2017 13 // Update Count : 187 14 14 // 15 15 … … 31 31 DeclarationNode * fields; 32 32 bool body; 33 34 bool tagged; 35 const std::string * parent; 33 36 }; 34 37 -
src/Parser/parser.yy
r4b234f0 r6ea87486 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jul 13 14:38:54201713 // Update Count : 243 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jul 14 16:58:00 2017 13 // Update Count : 2432 14 14 // 15 15 … … 1667 1667 | aggregate_key attribute_list_opt typegen_name // CFA 1668 1668 { $$ = $3->addQualifiers( $2 ); } 1669 1670 // Temp, testing TreeStruct 1671 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name 1672 { 1673 typedefTable.makeTypedef( *$4 ); // create typedef 1674 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $ 1675 forall = false; // reset 1676 } 1677 '{' field_declaration_list '}' 1678 { 1679 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct, 1680 $4, nullptr, nullptr, $7, true )->addQualifiers( $3 ); 1681 } 1682 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname 1683 { 1684 typedefTable.makeTypedef( *$4 ); // create typedef 1685 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $ 1686 forall = false; // reset 1687 } 1688 '{' field_declaration_list '}' 1689 { 1690 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct, 1691 $4, $5, nullptr, $8, true )->addQualifiers( $3 ); 1692 } 1669 1693 ; 1670 1694
Note:
See TracChangeset
for help on using the changeset viewer.