Changeset 65d6de4
- Timestamp:
- Nov 17, 2017, 2:41:46 PM (7 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:
- 9e1eabc
- Parents:
- 34c6c767
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r34c6c767 r65d6de4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Oct 25 12:28:54201713 // Update Count : 2 89312 // Last Modified On : Fri Nov 17 11:38:57 2017 13 // Update Count : 2914 14 14 // 15 15 … … 348 348 349 349 350 // Handle single shift/reduce conflict for dangling else by shifting the ELSE token. For example, this string 351 // is ambiguous: 352 // .---------. matches IF '(' comma_expression ')' statement . (reduce) 353 // if ( C ) S1 else S2 354 // `-----------------' matches IF '(' comma_expression ')' statement . (shift) ELSE statement */ 350 // Handle shift/reduce conflict for dangling else by shifting the ELSE token. For example, this string is ambiguous: 351 // .---------. matches IF '(' comma_expression ')' statement . (reduce) 352 // if ( C ) S1 else S2 353 // `-----------------' matches IF '(' comma_expression ')' statement . (shift) ELSE statement */ 355 354 // Similar issues exit with the waitfor statement. 356 355 … … 361 360 %precedence TIMEOUT // token precedence for start of TIMEOUT in WAITFOR statement 362 361 %precedence ELSE // token precedence for start of else clause in IF/WAITFOR statement 362 363 // Handle shift/reduce conflict for generic type by shifting the '(' token. For example, this string is ambiguous: 364 // forall( otype T ) struct Foo { T v; }; 365 // .-----. matches pointer to function returning a generic (which is impossible without a type) 366 // Foo ( *fp )( int ); 367 // `---' matches start of TYPEGENname '(' 368 // Must be: 369 // Foo( int ) ( *fp )( int ); 370 371 // Order of these lines matters (low-to-high precedence). 372 %precedence TYPEGENname 373 %precedence '(' 363 374 364 375 %locations // support location tracking for error messages … … 1765 1776 1766 1777 typegen_name: // CFA 1767 TYPEGENname '(' ')' 1778 TYPEGENname 1779 { $$ = DeclarationNode::newFromTypeGen( $1, nullptr ); } 1780 | TYPEGENname '(' ')' 1768 1781 { $$ = DeclarationNode::newFromTypeGen( $1, nullptr ); } 1769 1782 | TYPEGENname '(' type_list ')' … … 1809 1822 } 1810 1823 | aggregate_key attribute_list_opt typegen_name // CFA 1811 { $$ = $3->addQualifiers( $2 ); } 1824 { 1825 // Create new generic declaration with same name as previous forward declaration, where the IDENTIFIER is 1826 // switched to a TYPEGENname. Link any generic arguments from typegen_name to new generic declaration and 1827 // delete newFromTypeGen. 1828 $$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, $3->type->symbolic.actuals, nullptr, false )->addQualifiers( $2 ); 1829 $3->type->symbolic.name = nullptr; 1830 $3->type->symbolic.actuals = nullptr; 1831 delete $3; 1832 } 1812 1833 ; 1813 1834
Note: See TracChangeset
for help on using the changeset viewer.