Changeset fc20514 for src/Parser/parser.yy
- Timestamp:
- Jul 11, 2018, 11:53:09 AM (6 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, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 777ed2b
- Parents:
- 132d276
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r132d276 rfc20514 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 6 08:02:38201813 // Update Count : 37 1612 // Last Modified On : Wed Jul 11 11:20:51 2018 13 // Update Count : 3738 14 14 // 15 15 … … 166 166 } // build_postfix_name 167 167 168 bool forall = false, xxx = false, yyy = false;// aggregate have one or more forall qualifiers ?168 bool forall = false, yyy = false; // aggregate have one or more forall qualifiers ? 169 169 170 170 // https://www.gnu.org/software/bison/manual/bison.html#Location-Type … … 422 422 // Foo ( *fp )( int ); 423 423 // `---' matches start of TYPEGENname '(' 424 // Must be:424 // must be: 425 425 // Foo( int ) ( *fp )( int ); 426 // The same problem occurs here: 427 // forall( otype T ) struct Foo { T v; } ( *fp )( int ); 428 // must be: 429 // forall( otype T ) struct Foo { T v; } ( int ) ( *fp )( int ); 426 430 427 431 // Order of these lines matters (low-to-high precedence). … … 1856 1860 1857 1861 aggregate_type: // struct, union 1858 aggregate_key attribute_list_opt '{' field_declaration_list_opt '}' type_parameters_opt 1859 { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), $6, $4, true )->addQualifiers( $2 ); } 1862 aggregate_key attribute_list_opt 1863 { forall = false; } // reset 1864 '{' field_declaration_list_opt '}' type_parameters_opt 1865 { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), $7, $5, true )->addQualifiers( $2 ); } 1860 1866 | aggregate_key attribute_list_opt no_attr_identifier fred 1861 1867 { 1862 typedefTable.makeTypedef( *$3, forall ? TYPEGENname : TYPEDEFname ); // create typedef1868 typedefTable.makeTypedef( *$3, forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef 1863 1869 forall = false; // reset 1864 1870 } … … 1867 1873 | aggregate_key attribute_list_opt type_name fred 1868 1874 { 1869 typedefTable.makeTypedef( *$3->type->symbolic.name, forall ? TYPEGENname : TYPEDEFname ); // create typedef1875 typedefTable.makeTypedef( *$3->type->symbolic.name, forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef 1870 1876 forall = false; // reset 1871 1877 } … … 1885 1891 aggregate_key attribute_list_opt no_attr_identifier fred 1886 1892 { 1887 typedefTable.makeTypedef( *$3, forall ? TYPEGENname : TYPEDEFname );1893 typedefTable.makeTypedef( *$3, forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); 1888 1894 forall = false; // reset 1889 1895 $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 ); … … 1891 1897 | aggregate_key attribute_list_opt type_name fred 1892 1898 { 1899 forall = false; // reset 1893 1900 // Create new generic declaration with same name as previous forward declaration, where the IDENTIFIER is 1894 1901 // switched to a TYPEGENname. Link any generic arguments from typegen_name to new generic declaration and … … 2366 2373 push external_definition pop 2367 2374 { $$ = $2; } 2368 | external_definition_list 2369 { forall = xxx; } 2370 push external_definition pop 2371 { $$ = $1 ? $1->appendList( $4 ) : $4; } 2375 | external_definition_list push external_definition pop 2376 { $$ = $1 ? $1->appendList( $3 ) : $3; } 2372 2377 ; 2373 2378 … … 2379 2384 2380 2385 up: 2381 { typedefTable.up( ); }2386 { typedefTable.up( forall ); forall = false; } 2382 2387 ; 2383 2388 … … 2412 2417 { 2413 2418 if ( $1->type->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); } 2414 if ( $1->type->forall ) xxx = forall = true;// remember generic type2419 if ( $1->type->forall ) forall = true; // remember generic type 2415 2420 } 2416 2421 '{' up external_definition_list_opt down '}' // CFA, namespace 2417 2422 { 2418 2423 distQual( $5, $1 ); 2419 xxx= false;2424 forall = false; 2420 2425 $$ = $5; 2421 2426 } … … 2423 2428 { 2424 2429 if ( $1->type && $1->type->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); } 2425 if ( $1->type && $1->type->forall ) xxx =forall = true; // remember generic type2430 if ( $1->type && $1->type->forall ) forall = true; // remember generic type 2426 2431 } 2427 2432 '{' up external_definition_list_opt down '}' // CFA, namespace 2428 2433 { 2429 2434 distQual( $5, $1 ); 2430 xxx= false;2435 forall = false; 2431 2436 $$ = $5; 2432 2437 } … … 2434 2439 { 2435 2440 if ( ($1->type && $1->type->qualifiers.val) || $2->type->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); } 2436 if ( ($1->type && $1->type->forall) || $2->type->forall ) xxx =forall = true; // remember generic type2441 if ( ($1->type && $1->type->forall) || $2->type->forall ) forall = true; // remember generic type 2437 2442 } 2438 2443 '{' up external_definition_list_opt down '}' // CFA, namespace 2439 2444 { 2440 2445 distQual( $6, $1->addQualifiers( $2 ) ); 2441 xxx= false;2446 forall = false; 2442 2447 $$ = $6; 2443 2448 }
Note: See TracChangeset
for help on using the changeset viewer.