Changeset 9082d7e8 for src/Parser
- Timestamp:
- Mar 30, 2023, 4:05:59 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- bd72c284
- Parents:
- d24b1985 (diff), ff443e5 (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. - Location:
- src/Parser
- Files:
-
- 4 edited
-
ParseNode.h (modified) (2 diffs)
-
StatementNode.cc (modified) (4 diffs)
-
lex.ll (modified) (2 diffs)
-
parser.yy (modified) (35 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
rd24b1985 r9082d7e8 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Feb 19 09:02:37 202313 // Update Count : 94 012 // Last Modified On : Wed Mar 29 08:40:27 2023 13 // Update Count : 948 14 14 // 15 15 … … 425 425 Statement * build_directive( std::string * directive ); 426 426 SuspendStmt * build_suspend( StatementNode *, SuspendStmt::Type = SuspendStmt::None); 427 WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when ); 428 WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when, WaitForStmt * existing ); 429 WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when ); 430 WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when, StatementNode * else_stmt, ExpressionNode * else_when ); 427 WaitForStmt * build_waitfor( WaitForStmt * existing, ExpressionNode * when, ExpressionNode * targetExpr, StatementNode * stmt ); 428 WaitForStmt * build_waitfor_else( WaitForStmt * existing, ExpressionNode * when, StatementNode * stmt ); 429 WaitForStmt * build_waitfor_timeout( WaitForStmt * existing, ExpressionNode * when, ExpressionNode * timeout, StatementNode * stmt ); 431 430 Statement * build_with( ExpressionNode * exprs, StatementNode * stmt ); 432 431 Statement * build_mutex( ExpressionNode * exprs, StatementNode * stmt ); -
src/Parser/StatementNode.cc
rd24b1985 r9082d7e8 11 11 // Created On : Sat May 16 14:59:41 2015 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Wed Feb 2 20:29:30 202214 // Update Count : 4 2513 // Last Modified On : Wed Mar 29 08:51:23 2023 14 // Update Count : 454 15 15 // 16 16 … … 268 268 269 269 return node; 270 } 271 272 WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when ) { 273 auto node = new WaitForStmt(); 274 270 } // build_suspend 271 272 WaitForStmt * build_waitfor( WaitForStmt * existing, ExpressionNode * when, ExpressionNode * targetExpr, StatementNode * stmt ) { 275 273 WaitForStmt::Target target; 276 274 target.function = maybeBuild( targetExpr ); … … 282 280 delete targetExpr; 283 281 284 node->clauses.push_back( WaitForStmt::Clause{ 285 target, 286 maybeMoveBuild( stmt ), 287 notZeroExpr( maybeMoveBuild( when ) ) 288 }); 289 290 return node; 291 } // build_waitfor 292 293 WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when, WaitForStmt * node ) { 294 WaitForStmt::Target target; 295 target.function = maybeBuild( targetExpr ); 296 297 ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() ); 298 targetExpr->set_next( nullptr ); 299 buildMoveList< Expression >( next, target.arguments ); 300 301 delete targetExpr; 302 303 node->clauses.insert( node->clauses.begin(), WaitForStmt::Clause{ 282 existing->clauses.insert( existing->clauses.begin(), WaitForStmt::Clause{ 304 283 std::move( target ), 305 284 maybeMoveBuild( stmt ), … … 307 286 }); 308 287 309 return node;288 return existing; 310 289 } // build_waitfor 311 290 312 WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when ) { 313 auto node = new WaitForStmt(); 314 315 if( timeout ) { 316 node->timeout.time = maybeMoveBuild( timeout ); 317 node->timeout.statement = maybeMoveBuild( stmt ); 318 node->timeout.condition = notZeroExpr( maybeMoveBuild( when ) ); 319 } else { 320 node->orelse.statement = maybeMoveBuild( stmt ); 321 node->orelse.condition = notZeroExpr( maybeMoveBuild( when ) ); 322 } // if 323 324 return node; 325 } // build_waitfor_timeout 326 327 WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when, StatementNode * else_, ExpressionNode * else_when ) { 328 auto node = new WaitForStmt(); 329 330 node->timeout.time = maybeMoveBuild( timeout ); 331 node->timeout.statement = maybeMoveBuild( stmt ); 332 node->timeout.condition = notZeroExpr( maybeMoveBuild( when ) ); 333 334 node->orelse.statement = maybeMoveBuild( else_ ); 335 node->orelse.condition = notZeroExpr( maybeMoveBuild( else_when ) ); 336 337 return node; 291 WaitForStmt * build_waitfor_else( WaitForStmt * existing, ExpressionNode * when, StatementNode * stmt ) { 292 existing->orelse.statement = maybeMoveBuild( stmt ); 293 existing->orelse.condition = notZeroExpr( maybeMoveBuild( when ) ); 294 295 return existing; 296 } // build_waitfor_else 297 298 WaitForStmt * build_waitfor_timeout( WaitForStmt * existing, ExpressionNode * when, ExpressionNode * timeout, StatementNode * stmt ) { 299 existing->timeout.time = maybeMoveBuild( timeout ); 300 existing->timeout.statement = maybeMoveBuild( stmt ); 301 existing->timeout.condition = notZeroExpr( maybeMoveBuild( when ) ); 302 303 return existing; 338 304 } // build_waitfor_timeout 339 305 -
src/Parser/lex.ll
rd24b1985 r9082d7e8 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Mon Jan 30 19:03:34202313 * Update Count : 76 712 * Last Modified On : Sat Mar 25 08:09:03 2023 13 * Update Count : 768 14 14 */ 15 15 … … 214 214 __alignof { KEYWORD_RETURN(ALIGNOF); } // GCC 215 215 __alignof__ { KEYWORD_RETURN(ALIGNOF); } // GCC 216 and { QKEYWORD_RETURN(WAND); } // CFA 216 217 asm { KEYWORD_RETURN(ASM); } 217 218 __asm { KEYWORD_RETURN(ASM); } // GCC -
src/Parser/parser.yy
rd24b1985 r9082d7e8 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 2 21:26:01202313 // Update Count : 6 00212 // Last Modified On : Wed Mar 29 17:56:42 2023 13 // Update Count : 6325 14 14 // 15 15 … … 44 44 45 45 #include <cstdio> 46 #include <sstream> 46 47 #include <stack> 47 48 using namespace std; … … 270 271 SemanticError( yylloc, ::toString( "Identifier \"", identifier, "\" cannot appear before a ", kind, ".\n" 271 272 "Possible cause is misspelled storage/CV qualifier, misspelled typename, or missing generic parameter." ) ); 272 } // IdentifierBeforeType273 274 static bool TypedefForall( DeclarationNode * decl ) {275 if ( decl->type->forall || (decl->type->kind == TypeData::Aggregate && decl->type->aggregate.params) ) {276 SemanticError( yylloc, "forall qualifier in typedef is currently unimplemented." );277 return true;278 } // if279 return false;280 273 } // IdentifierBeforeType 281 274 … … 359 352 360 353 // names and constants: lexer differentiates between identifier and typedef names 361 %token<tok> IDENTIFIER QUOTED_IDENTIFIERTYPEDIMname TYPEDEFname TYPEGENname362 %token<tok> TIMEOUT W ORCATCH RECOVER CATCHRESUME FIXUP FINALLY // CFA354 %token<tok> IDENTIFIER TYPEDIMname TYPEDEFname TYPEGENname 355 %token<tok> TIMEOUT WAND WOR CATCH RECOVER CATCHRESUME FIXUP FINALLY // CFA 363 356 %token<tok> INTEGERconstant CHARACTERconstant STRINGliteral 364 357 %token<tok> DIRECTIVE … … 429 422 %type<catch_kind> handler_key 430 423 %type<sn> mutex_statement 431 %type<en> when_clause when_clause_opt waitfor timeout432 %type<sn> waitfor_statement 433 %type<wfs> w aitfor_clause424 %type<en> when_clause when_clause_opt waitfor waituntil timeout 425 %type<sn> waitfor_statement waituntil_statement 426 %type<wfs> wor_waitfor_clause waituntil_clause wand_waituntil_clause wor_waituntil_clause 434 427 435 428 // declarations … … 535 528 // Similar issues exit with the waitfor statement. 536 529 537 // Order of these lines matters (low-to-high precedence). THEN is left associative over W OR/TIMEOUT/ELSE, WOR is left538 // associative over TIMEOUT/ELSE, and TIMEOUT is left associative over ELSE.530 // Order of these lines matters (low-to-high precedence). THEN is left associative over WAND/WOR/TIMEOUT/ELSE, WAND/WOR 531 // is left associative over TIMEOUT/ELSE, and TIMEOUT is left associative over ELSE. 539 532 %precedence THEN // rule precedence for IF/WAITFOR statement 533 %precedence ANDAND // token precedence for start of WAND in WAITFOR statement 534 %precedence WAND // token precedence for start of WAND in WAITFOR statement 535 %precedence OROR // token precedence for start of WOR in WAITFOR statement 540 536 %precedence WOR // token precedence for start of WOR in WAITFOR statement 541 537 %precedence TIMEOUT // token precedence for start of TIMEOUT in WAITFOR statement … … 624 620 quasi_keyword: // CFA 625 621 TIMEOUT 622 | WAND 626 623 | WOR 627 624 | CATCH … … 774 771 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $4 ) ) ); } 775 772 | postfix_expression ICR 776 { $$ = new ExpressionNode( build_unary_val( OperKinds::IncrPost, $1 ) ); }773 { $$ = new ExpressionNode( build_unary_val( OperKinds::IncrPost, $1 ) ); } 777 774 | postfix_expression DECR 778 { $$ = new ExpressionNode( build_unary_val( OperKinds::DecrPost, $1 ) ); }775 { $$ = new ExpressionNode( build_unary_val( OperKinds::DecrPost, $1 ) ); } 779 776 | '(' type_no_function ')' '{' initializer_list_opt comma_opt '}' // C99, compound-literal 780 777 { $$ = new ExpressionNode( build_compoundLiteral( $2, new InitializerNode( $5, true ) ) ); } … … 804 801 '@' // CFA, default parameter 805 802 { SemanticError( yylloc, "Default parameter for argument is currently unimplemented." ); $$ = nullptr; } 806 // { $$ = new ExpressionNode( build_constantInteger( *new string( "2" ) ) ); }803 // { $$ = new ExpressionNode( build_constantInteger( *new string( "2" ) ) ); } 807 804 | assignment_expression 808 805 ; … … 879 876 } 880 877 | unary_operator cast_expression 881 { $$ = new ExpressionNode( build_unary_val( $1, $2 ) ); }878 { $$ = new ExpressionNode( build_unary_val( $1, $2 ) ); } 882 879 | ICR unary_expression 883 { $$ = new ExpressionNode( build_unary_val( OperKinds::Incr, $2 ) ); }880 { $$ = new ExpressionNode( build_unary_val( OperKinds::Incr, $2 ) ); } 884 881 | DECR unary_expression 885 { $$ = new ExpressionNode( build_unary_val( OperKinds::Decr, $2 ) ); }882 { $$ = new ExpressionNode( build_unary_val( OperKinds::Decr, $2 ) ); } 886 883 | SIZEOF unary_expression 887 884 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuild( $2 ) ) ); } … … 1136 1133 | mutex_statement 1137 1134 | waitfor_statement 1135 | waituntil_statement 1138 1136 | exception_statement 1139 1137 | enable_disable_statement … … 1245 1243 | declaration comma_expression // semi-colon separated 1246 1244 { $$ = new CondCtl( $1, $2 ); } 1247 ;1245 ; 1248 1246 1249 1247 // CASE and DEFAULT clauses are only allowed in the SWITCH statement, precluding Duff's device. In addition, a case … … 1328 1326 } 1329 1327 | FOR '(' for_control_expression_list ')' statement %prec THEN 1330 { $$ = new StatementNode( build_for( $3, maybe_build_compound( $5 ) ) ); }1328 { $$ = new StatementNode( build_for( $3, maybe_build_compound( $5 ) ) ); } 1331 1329 | FOR '(' for_control_expression_list ')' statement ELSE statement // CFA 1332 1330 { $$ = new StatementNode( build_for( $3, maybe_build_compound( $5 ), $7 ) ); } … … 1520 1518 SemanticError( yylloc, "Type iterator is currently unimplemented." ); $$ = nullptr; 1521 1519 } 1522 ;1520 ; 1523 1521 1524 1522 downupdowneq: … … 1529 1527 | ErangeDownEq 1530 1528 { $$ = OperKinds::GEThan; } 1531 ;1529 ; 1532 1530 1533 1531 updown: … … 1536 1534 | ErangeDown 1537 1535 { $$ = OperKinds::GThan; } 1538 ;1536 ; 1539 1537 1540 1538 updowneq: … … 1544 1542 | ErangeDownEq 1545 1543 { $$ = OperKinds::GEThan; } 1546 ;1544 ; 1547 1545 1548 1546 jump_statement: … … 1627 1625 ; 1628 1626 1629 waitfor:1630 WAITFOR '(' cast_expression ')'1631 { $$ = $3; }1632 // | WAITFOR '(' cast_expression ',' argument_expression_list_opt ')'1633 // { $$ = (ExpressionNode *)$3->set_last( $5 ); }1634 | WAITFOR '(' cast_expression_list ':' argument_expression_list_opt ')'1635 { $$ = (ExpressionNode *)($3->set_last( $5 )); }1636 ;1637 1638 1627 cast_expression_list: 1639 1628 cast_expression … … 1644 1633 1645 1634 timeout: 1646 TIMEOUT '(' comma_expression ')' { $$ = $3; } 1647 ; 1648 1649 waitfor_clause: 1635 TIMEOUT '(' comma_expression ')' { $$ = $3; } 1636 ; 1637 1638 wor: 1639 OROR 1640 | WOR 1641 1642 waitfor: 1643 WAITFOR '(' cast_expression ')' 1644 { $$ = $3; } 1645 | WAITFOR '(' cast_expression_list ':' argument_expression_list_opt ')' 1646 { $$ = (ExpressionNode *)($3->set_last( $5 )); } 1647 ; 1648 1649 wor_waitfor_clause: 1650 1650 when_clause_opt waitfor statement %prec THEN 1651 { $$ = build_waitfor( $2, maybe_build_compound( $3 ), $1 ); } 1652 | when_clause_opt waitfor statement WOR waitfor_clause 1653 { $$ = build_waitfor( $2, maybe_build_compound( $3 ), $1, $5 ); } 1654 | when_clause_opt timeout statement %prec THEN 1655 { $$ = build_waitfor_timeout( $2, maybe_build_compound( $3 ), $1 ); } 1656 | when_clause_opt ELSE statement 1657 { $$ = build_waitfor_timeout( nullptr, maybe_build_compound( $3 ), $1 ); } 1651 // Called first: create header for WaitForStmt. 1652 { $$ = build_waitfor( new WaitForStmt(), $1, $2, maybe_build_compound( $3 ) ); } 1653 | wor_waitfor_clause wor when_clause_opt waitfor statement %prec THEN 1654 { $$ = build_waitfor( $1, $3, $4, maybe_build_compound( $5 ) ); } 1655 | wor_waitfor_clause wor when_clause_opt ELSE statement 1656 { $$ = build_waitfor_else( $1, $3, maybe_build_compound( $5 ) ); } 1657 | wor_waitfor_clause wor when_clause_opt timeout statement %prec THEN 1658 { $$ = build_waitfor_timeout( $1, $3, $4, maybe_build_compound( $5 ) ); } 1658 1659 // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless) 1659 | w hen_clause_opt timeout statement WORELSE statement // syntax error1660 | wor_waitfor_clause wor when_clause_opt timeout statement wor ELSE statement // syntax error 1660 1661 { SemanticError( yylloc, "else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; } 1661 | when_clause_opt timeout statement WOR when_clause ELSE statement 1662 { $$ = build_waitfor_timeout( $2, maybe_build_compound( $3 ), $1, maybe_build_compound( $7 ), $5 ); } 1663 ; 1662 | wor_waitfor_clause wor when_clause_opt timeout statement wor when_clause ELSE statement 1663 { $$ = build_waitfor_else( build_waitfor_timeout( $1, $3, $4, maybe_build_compound( $5 ) ), $7, maybe_build_compound( $9 ) ); } 1664 1664 1665 1665 waitfor_statement: 1666 when_clause_opt waitfor statement %prec THEN 1667 { $$ = new StatementNode( build_waitfor( $2, $3, $1 ) ); } 1668 | when_clause_opt waitfor statement WOR waitfor_clause 1669 { $$ = new StatementNode( build_waitfor( $2, $3, $1, $5 ) ); } 1666 wor_waitfor_clause %prec THEN 1667 { $$ = new StatementNode( $1 ); } 1668 ; 1669 1670 wand: 1671 ANDAND 1672 | WAND 1673 ; 1674 1675 waituntil: 1676 WAITUNTIL '(' cast_expression ')' 1677 { $$ = $3; } 1678 ; 1679 1680 waituntil_clause: 1681 when_clause_opt waituntil statement 1682 { printf( "waituntil_clause 1\n" ); $$ = nullptr; } 1683 | '(' wor_waituntil_clause ')' 1684 { printf( "waituntil_clause 2\n" ); $$ = nullptr; } 1685 ; 1686 1687 wand_waituntil_clause: 1688 waituntil_clause %prec THEN 1689 { printf( "wand_waituntil_clause 1\n" ); $$ = nullptr; } 1690 | waituntil_clause wand wand_waituntil_clause 1691 { printf( "wand_waituntil_clause 2\n" ); $$ = nullptr; } 1692 ; 1693 1694 wor_waituntil_clause: 1695 wand_waituntil_clause 1696 { printf( "wor_waituntil_clause 1\n" ); $$ = nullptr; } 1697 | wor_waituntil_clause wor wor_waituntil_clause %prec THEN 1698 { printf( "wor_waituntil_clause 2\n" ); $$ = nullptr; } 1699 | wor_waituntil_clause wor when_clause_opt ELSE statement 1700 { printf( "wor_waituntil_clause 3\n" ); $$ = nullptr; } 1701 | wor_waituntil_clause wor when_clause_opt timeout statement %prec THEN 1702 { printf( "wor_waituntil_clause 4\n" ); $$ = nullptr; } 1703 // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless) 1704 | wor_waituntil_clause wor when_clause_opt timeout statement wor ELSE statement // syntax error 1705 { SemanticError( yylloc, "else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; } 1706 | wor_waituntil_clause wor when_clause_opt timeout statement wor when_clause ELSE statement 1707 { printf( "wor_waituntil_clause 6\n" ); $$ = nullptr; } 1708 ; 1709 1710 waituntil_statement: 1711 wor_waituntil_clause %prec THEN 1712 // SKULLDUGGERY: create an empty compound statement to test parsing of waituntil statement. 1713 { $$ = new StatementNode( build_compound( (StatementNode *)0 ) ); } 1670 1714 ; 1671 1715 1672 1716 exception_statement: 1673 TRY compound_statement handler_clause %prec THEN1717 TRY compound_statement handler_clause %prec THEN 1674 1718 { $$ = new StatementNode( build_try( $2, $3, nullptr ) ); } 1675 1719 | TRY compound_statement finally_clause … … 1831 1875 { 1832 1876 // printf( "C_DECLARATION1 %p %s\n", $$, $$->name ? $$->name->c_str() : "(nil)" ); 1833 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) {1877 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) { 1834 1878 // printf( "\tattr %s\n", attr->name.c_str() ); 1835 1879 // } // for … … 1967 2011 { 1968 2012 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "4" ); 1969 if ( TypedefForall( $2 ) ) $$ = nullptr; 1970 else $$ = $3->addType( $2 )->addTypedef(); // watchout frees $2 and $3 2013 if ( $2->type->forall || ($2->type->kind == TypeData::Aggregate && $2->type->aggregate.params) ) { 2014 SemanticError( yylloc, "forall qualifier in typedef is currently unimplemented." ); $$ = nullptr; 2015 } else $$ = $3->addType( $2 )->addTypedef(); // watchout frees $2 and $3 1971 2016 } 1972 2017 | typedef_declaration pop ',' push declarator … … 1976 2021 } 1977 2022 | type_qualifier_list TYPEDEF type_specifier declarator // remaining OBSOLESCENT (see 2 ) 1978 { 1979 typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname, "6" ); 1980 if ( TypedefForall( $1 ) ) $$ = nullptr; 1981 else $$ = $4->addQualifiers( $1 )->addType( $3 )->addTypedef(); 1982 } 2023 { SemanticError( yylloc, "Type qualifiers/specifiers before TYPEDEF is deprecated, move after TYPEDEF." ); $$ = nullptr; } 1983 2024 | type_specifier TYPEDEF declarator 1984 { 1985 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "7" ); 1986 if ( TypedefForall( $1 ) ) $$ = nullptr; 1987 else $$ = $3->addType( $1 )->addTypedef(); 1988 } 2025 { SemanticError( yylloc, "Type qualifiers/specifiers before TYPEDEF is deprecated, move after TYPEDEF." ); $$ = nullptr; } 1989 2026 | type_specifier TYPEDEF type_qualifier_list declarator 1990 { 1991 typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname, "8" ); 1992 if ( TypedefForall( $3 ) ) $$ = nullptr; 1993 else $$ = $4->addQualifiers( $1 )->addType( $1 )->addTypedef(); 1994 } 2027 { SemanticError( yylloc, "Type qualifiers/specifiers before TYPEDEF is deprecated, move after TYPEDEF." ); $$ = nullptr; } 1995 2028 ; 1996 2029 … … 1999 2032 TYPEDEF identifier '=' assignment_expression 2000 2033 { 2001 SemanticError( yylloc, "T ypedefexpression is deprecated, use typeof(...) instead." ); $$ = nullptr;2034 SemanticError( yylloc, "TYPEDEF expression is deprecated, use typeof(...) instead." ); $$ = nullptr; 2002 2035 } 2003 2036 | typedef_expression pop ',' push identifier '=' assignment_expression 2004 2037 { 2005 SemanticError( yylloc, "T ypedefexpression is deprecated, use typeof(...) instead." ); $$ = nullptr;2038 SemanticError( yylloc, "TYPEDEF expression is deprecated, use typeof(...) instead." ); $$ = nullptr; 2006 2039 } 2007 2040 ; … … 2301 2334 { 2302 2335 // printf( "sue_declaration_specifier %p %s\n", $$, $$->type->aggregate.name ? $$->type->aggregate.name->c_str() : "(nil)" ); 2303 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) {2336 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) { 2304 2337 // printf( "\tattr %s\n", attr->name.c_str() ); 2305 2338 // } // for … … 2317 2350 { 2318 2351 // printf( "sue_type_specifier %p %s\n", $$, $$->type->aggregate.name ? $$->type->aggregate.name->c_str() : "(nil)" ); 2319 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) {2352 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) { 2320 2353 // printf( "\tattr %s\n", attr->name.c_str() ); 2321 2354 // } // for … … 2395 2428 { 2396 2429 // printf( "elaborated_type %p %s\n", $$, $$->type->aggregate.name ? $$->type->aggregate.name->c_str() : "(nil)" ); 2397 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) {2430 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) { 2398 2431 // printf( "\tattr %s\n", attr->name.c_str() ); 2399 2432 // } // for … … 2522 2555 $$ = fieldDecl( $1, $2 ); 2523 2556 // printf( "type_specifier2 %p %s\n", $$, $$->type->aggregate.name ? $$->type->aggregate.name->c_str() : "(nil)" ); 2524 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) {2557 // for ( Attribute * attr: reverseIterate( $$->attributes ) ) { 2525 2558 // printf( "\tattr %s\n", attr->name.c_str() ); 2526 2559 // } // for … … 2529 2562 { $$ = fieldDecl( $2, $3 ); distExt( $$ ); } 2530 2563 | STATIC type_specifier field_declaring_list_opt ';' // CFA 2531 { SemanticError( yylloc, "STATIC aggregate field qualifier currently unimplemented." ); $$ = nullptr; }2564 { SemanticError( yylloc, "STATIC aggregate field qualifier currently unimplemented." ); $$ = nullptr; } 2532 2565 | INLINE type_specifier field_abstract_list_opt ';' // CFA 2533 2566 { … … 2540 2573 } 2541 2574 | INLINE aggregate_control ';' // CFA 2542 { SemanticError( yylloc, "INLINE aggregate control currently unimplemented." ); $$ = nullptr; }2575 { SemanticError( yylloc, "INLINE aggregate control currently unimplemented." ); $$ = nullptr; } 2543 2576 | typedef_declaration ';' // CFA 2544 2577 | cfa_field_declaring_list ';' // CFA, new style field declaration … … 2623 2656 { $$ = DeclarationNode::newEnum( $3->name, $6, true, false, nullptr, $4 )->addQualifiers( $2 ); } 2624 2657 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}' 2625 {2658 { 2626 2659 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.any() ) 2627 2660 { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } … … 3157 3190 { 3158 3191 distQual( $5, $1 ); 3159 forall = false;3192 forall = false; 3160 3193 $$ = $5; 3161 3194 } … … 3168 3201 { 3169 3202 distQual( $5, $1 ); 3170 forall = false;3203 forall = false; 3171 3204 $$ = $5; 3172 3205 } … … 3179 3212 { 3180 3213 distQual( $6, $1->addQualifiers( $2 ) ); 3181 forall = false;3214 forall = false; 3182 3215 $$ = $6; 3183 3216 } … … 3386 3419 | '(' attribute_list variable_ptr ')' array_dimension 3387 3420 { $$ = $3->addQualifiers( $2 )->addArray( $5 ); } 3388 | '(' variable_array ')' multi_array_dimension // redundant parenthesis3421 | '(' variable_array ')' multi_array_dimension // redundant parenthesis 3389 3422 { $$ = $2->addArray( $4 ); } 3390 3423 | '(' attribute_list variable_array ')' multi_array_dimension // redundant parenthesis … … 3809 3842 | ErangeUpEq 3810 3843 { $$ = OperKinds::LEThan; } 3811 ;3844 ; 3812 3845 3813 3846 multi_array_dimension:
Note:
See TracChangeset
for help on using the changeset viewer.