Changeset 6c2ba38 for src/Parser/parser.yy
- Timestamp:
- Nov 28, 2017, 3:52:06 PM (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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 383e159, 8d5b9cf
- Parents:
- cf966b5 (diff), 8a0a64d9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
rcf966b5 r6c2ba38 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Nov 2 0 09:45:36201713 // Update Count : 29 4512 // Last Modified On : Mon Nov 27 17:23:35 2017 13 // Update Count : 2992 14 14 // 15 15 … … 345 345 %type<en> type_list 346 346 347 %type<decl> type_qualifier type_qualifier_name type_qualifier_list_opt type_qualifier_list347 %type<decl> type_qualifier type_qualifier_name forall type_qualifier_list_opt type_qualifier_list 348 348 %type<decl> type_specifier type_specifier_nobody 349 349 … … 379 379 // `---' matches start of TYPEGENname '(' 380 380 // Must be: 381 // Foo( int ) ( *fp )( int );381 // Foo( int ) ( *fp )( int ); 382 382 383 383 // Order of these lines matters (low-to-high precedence). … … 1058 1058 with_statement: 1059 1059 WITH '(' tuple_expression_list ')' statement 1060 { $$ = nullptr; }// FIX ME1060 { throw SemanticError("With clause is currently unimplemented."); $$ = nullptr; } // FIX ME 1061 1061 ; 1062 1062 … … 1064 1064 mutex_statement: 1065 1065 MUTEX '(' argument_expression_list ')' statement 1066 { $$ = nullptr; }// FIX ME1066 { throw SemanticError("Mutex statement is currently unimplemented."); $$ = nullptr; } // FIX ME 1067 1067 ; 1068 1068 … … 1280 1280 c_declaration pop ';' 1281 1281 | cfa_declaration pop ';' // CFA 1282 | STATICASSERT '(' constant_expression ',' string_literal ')' ';' // C11 1283 { throw SemanticError("Static assert is currently unimplemented."); $$ = nullptr; } // FIX ME 1282 1284 ; 1283 1285 … … 1362 1364 $$ = $3->addQualifiers( $1 )->addQualifiers( $2 ); 1363 1365 } 1364 | cfa_function_declaration pop ',' push identifier_or_type_name 1365 { 1366 typedefTable.addToEnclosingScope( *$5, TypedefTable::ID ); 1367 $$ = $1->appendList( $1->cloneType( $5 ) ); 1366 | cfa_function_declaration pop ',' push identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')' 1367 { 1368 // Append the return type at the start (left-hand-side) to each identifier in the list. 1369 DeclarationNode * ret = new DeclarationNode; 1370 ret->type = maybeClone( $1->type->base ); 1371 $$ = $1->appendList( DeclarationNode::newFunction( $5, ret, $8, nullptr, true ) ); 1368 1372 } 1369 1373 ; … … 1587 1591 | ATOMIC 1588 1592 { $$ = DeclarationNode::newTypeQualifier( Type::Atomic ); } 1589 | FORALL '(' 1593 | forall 1594 ; 1595 1596 forall: 1597 FORALL '(' 1590 1598 { 1591 1599 typedefTable.enterScope(); … … 2374 2382 $$ = $2; 2375 2383 } 2384 | forall '{' external_definition_list '}' // CFA, namespace 2376 2385 ; 2377 2386 … … 2399 2408 with_clause_opt: 2400 2409 // empty 2401 { $$ = nullptr; } // FIX ME2410 { $$ = nullptr; } 2402 2411 | WITH '(' tuple_expression_list ')' 2403 { $$ = nullptr; }// FIX ME2412 { throw SemanticError("With clause is currently unimplemented."); $$ = nullptr; } // FIX ME 2404 2413 ; 2405 2414 … … 2409 2418 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2410 2419 typedefTable.leaveScope(); 2411 $$ = $1->addFunctionBody( $3 ); 2420 // Add the function body to the last identifier in the function definition list, i.e., foo3: 2421 // [const double] foo1(), foo2( int ), foo3( double ) { return 3.0; } 2422 $1->get_last()->addFunctionBody( $3 ); 2423 $$ = $1; 2412 2424 } 2413 2425 | declaration_specifier function_declarator with_clause_opt compound_statement … … 2418 2430 $$ = $2->addFunctionBody( $4 )->addType( $1 ); 2419 2431 } 2432 // handles default int return type, OBSOLESCENT (see 1) 2420 2433 | type_qualifier_list function_declarator with_clause_opt compound_statement 2421 2434 { … … 2424 2437 $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 ); 2425 2438 } 2439 // handles default int return type, OBSOLESCENT (see 1) 2426 2440 | declaration_qualifier_list function_declarator with_clause_opt compound_statement 2427 2441 { … … 2430 2444 $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 ); 2431 2445 } 2446 // handles default int return type, OBSOLESCENT (see 1) 2432 2447 | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement 2433 2448 { … … 2445 2460 $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addType( $1 ); 2446 2461 } 2462 // handles default int return type, OBSOLESCENT (see 1) 2447 2463 | type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement 2448 2464 { … … 2451 2467 $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addQualifiers( $1 ); 2452 2468 } 2453 2454 // Old-style K&R function definition with "implicit int" type_specifier, OBSOLESCENT (see 4) 2469 // handles default int return type, OBSOLESCENT (see 1) 2455 2470 | declaration_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement 2456 2471 { … … 2459 2474 $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addQualifiers( $1 ); 2460 2475 } 2476 // handles default int return type, OBSOLESCENT (see 1) 2461 2477 | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement 2462 2478 {
Note: See TracChangeset
for help on using the changeset viewer.