Changeset 32cab5b for src/Parser
- Timestamp:
- Apr 17, 2018, 12:01:09 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, with_gc
- Children:
- 3265399
- Parents:
- b2fe1c9 (diff), 81bb114 (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:
-
- 6 edited
-
DeclarationNode.cc (modified) (5 diffs)
-
ExpressionNode.cc (modified) (6 diffs)
-
ParseNode.h (modified) (3 diffs)
-
StatementNode.cc (modified) (2 diffs)
-
lex.ll (modified) (15 diffs)
-
parser.yy (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
rb2fe1c9 r32cab5b 71 71 attr.expr = nullptr; 72 72 attr.type = nullptr; 73 74 assert.condition = nullptr; 75 assert.message = nullptr; 73 76 } 74 77 … … 88 91 // asmName, no delete, passed to next stage 89 92 delete initializer; 93 94 delete assert.condition; 95 delete assert.message; 90 96 } 91 97 … … 117 123 newnode->attr.expr = maybeClone( attr.expr ); 118 124 newnode->attr.type = maybeClone( attr.type ); 125 126 newnode->assert.condition = maybeClone( assert.condition ); 127 newnode->assert.message = maybeClone( assert.message ); 119 128 return newnode; 120 129 } // DeclarationNode::clone … … 434 443 return newnode; 435 444 } 445 446 DeclarationNode * DeclarationNode::newStaticAssert( ExpressionNode * condition, Expression * message ) { 447 DeclarationNode * newnode = new DeclarationNode; 448 newnode->assert.condition = condition; 449 newnode->assert.message = message; 450 return newnode; 451 } 452 436 453 437 454 void appendError( string & dst, const string & src ) { … … 1052 1069 } // if 1053 1070 1071 if ( assert.condition ) { 1072 return new StaticAssertDecl( maybeBuild< Expression >( assert.condition ), strict_dynamic_cast< ConstantExpr * >( maybeClone( assert.message ) ) ); 1073 } 1074 1054 1075 // SUE's cannot have function specifiers, either 1055 1076 // -
src/Parser/ExpressionNode.cc
rb2fe1c9 r32cab5b 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Mar 3 18:22:33201813 // Update Count : 79612 // Last Modified On : Thu Mar 22 11:57:39 2018 13 // Update Count : 801 14 14 // 15 15 … … 94 94 } // checkLNInt 95 95 96 static void sepNumeric( string & str, string & units ) {97 string::size_type posn = str.find_first_of( "`" );98 if ( posn != string::npos ) {99 units = "?" + str.substr( posn ); // extract units100 str.erase( posn ); // remove units101 } // if102 } // sepNumeric103 104 96 Expression * build_constantInteger( string & str ) { 105 97 static const BasicType::Kind kind[2][6] = { … … 108 100 { BasicType::ShortUnsignedInt, BasicType::UnsignedChar, BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::UnsignedInt128, }, 109 101 }; 110 111 string units;112 sepNumeric( str, units ); // separate constant from units113 102 114 103 bool dec = true, Unsigned = false; // decimal, unsigned constant … … 232 221 } // if 233 222 CLEANUP: 234 if ( units.length() != 0 ) {235 ret = new UntypedExpr( new NameExpr( units ), { ret } );236 } // if237 223 238 224 delete &str; // created by lex … … 268 254 }; 269 255 270 string units;271 sepNumeric( str, units ); // separate constant from units272 273 256 bool complx = false; // real, complex 274 257 int size = 1; // 0 => float, 1 => double, 2 => long double … … 303 286 if ( lnth != -1 ) { // explicit length ? 304 287 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ) ); 305 } // if306 if ( units.length() != 0 ) {307 ret = new UntypedExpr( new NameExpr( units ), { ret } );308 288 } // if 309 289 -
src/Parser/ParseNode.h
rb2fe1c9 r32cab5b 246 246 static DeclarationNode * newAttribute( std::string *, ExpressionNode * expr = nullptr ); // gcc attributes 247 247 static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement 248 static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message ); 248 249 249 250 DeclarationNode(); … … 313 314 Attr_t attr; 314 315 316 struct StaticAssert_t { 317 ExpressionNode * condition; 318 Expression * message; 319 }; 320 StaticAssert_t assert; 321 315 322 BuiltinType builtin; 316 323 … … 392 399 393 400 Statement * build_if( IfCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt ); 394 Statement * build_switch( ExpressionNode * ctl, StatementNode * stmt );401 Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt ); 395 402 Statement * build_case( ExpressionNode * ctl ); 396 403 Statement * build_default(); -
src/Parser/StatementNode.cc
rb2fe1c9 r32cab5b 10 10 // Created On : Sat May 16 14:59:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 1 23:25:23 201713 // Update Count : 34 612 // Last Modified On : Thu Mar 8 14:31:32 2018 13 // Update Count : 348 14 14 // 15 15 … … 116 116 } 117 117 118 Statement *build_switch( ExpressionNode *ctl, StatementNode *stmt ) {118 Statement *build_switch( bool isSwitch, ExpressionNode *ctl, StatementNode *stmt ) { 119 119 std::list< Statement * > branches; 120 120 buildMoveList< Statement, StatementNode >( stmt, branches ); 121 if ( ! isSwitch ) { // choose statement 122 for ( Statement * stmt : branches ) { 123 CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt ); 124 if ( ! caseStmt->stmts.empty() ) { // code after "case" => end of case list 125 CompoundStmt * block = strict_dynamic_cast< CompoundStmt * >( caseStmt->stmts.front() ); 126 block->kids.push_back( new BranchStmt( "", BranchStmt::Break ) ); 127 } // if 128 } // for 129 } // if 121 130 // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements 122 131 return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches ); -
src/Parser/lex.ll
rb2fe1c9 r32cab5b 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Sat Mar 3 18:38:16201813 * Update Count : 6 4012 * Last Modified On : Fri Apr 6 15:16:15 2018 13 * Update Count : 670 14 14 */ 15 15 … … 54 54 55 55 void rm_underscore() { 56 // Remove underscores in numeric constant by copying the non-underscore characters to the front of the string.56 // SKULLDUGGERY: remove underscores (ok to shorten?) 57 57 yyleng = 0; 58 for ( int i = 0; yytext[i] != '\0'; i += 1 ) { 59 if ( yytext[i] == '`' ) { 60 // copy user suffix 61 for ( ; yytext[i] != '\0'; i += 1 ) { 62 yytext[yyleng] = yytext[i]; 63 yyleng += 1; 64 } // for 65 break; 66 } // if 58 for ( int i = 0; yytext[i] != '\0'; i += 1 ) { // copying non-underscore characters to front of string 67 59 if ( yytext[i] != '_' ) { 68 60 yytext[yyleng] = yytext[i]; … … 71 63 } // for 72 64 yytext[yyleng] = '\0'; 73 } 65 } // rm_underscore 74 66 75 67 // Stop warning due to incorrectly generated flex code. … … 90 82 attr_identifier "@"{identifier} 91 83 92 user_suffix_opt ("`"{identifier})?93 94 84 // numeric constants, CFA: '_' in constant 95 85 hex_quad {hex}("_"?{hex}){3} 96 86 size_opt (8|16|32|64|128)? 97 87 length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hH]) 98 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))? {user_suffix_opt}88 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))? 99 89 100 90 octal_digits ({octal})|({octal}({octal}|"_")*{octal}) … … 118 108 floating_length ([fFdDlL]|[lL]{floating_size}) 119 109 floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length}) 120 floating_suffix_opt ("_"?({floating_suffix}|"DL"))? {user_suffix_opt}110 floating_suffix_opt ("_"?({floating_suffix}|"DL"))? 121 111 decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal}) 122 112 floating_decimal {decimal_digits}"."{exponent}?{floating_suffix_opt} … … 125 115 126 116 binary_exponent "_"?[pP]"_"?[+-]?{decimal_digits} 127 hex_floating_suffix_opt ("_"?({floating_suffix}))? {user_suffix_opt}117 hex_floating_suffix_opt ("_"?({floating_suffix}))? 128 118 hex_floating_fraction ({hex_digits}?"."{hex_digits})|({hex_digits}".") 129 119 hex_floating_constant {hex_prefix}(({hex_floating_fraction}{binary_exponent})|({hex_digits}{binary_exponent})){hex_floating_suffix_opt} … … 208 198 __asm { KEYWORD_RETURN(ASM); } // GCC 209 199 __asm__ { KEYWORD_RETURN(ASM); } // GCC 210 _At { KEYWORD_RETURN(AT); } // CFA211 200 _Atomic { KEYWORD_RETURN(ATOMIC); } // C11 212 201 __attribute { KEYWORD_RETURN(ATTRIBUTE); } // GCC … … 239 228 exception { KEYWORD_RETURN(EXCEPTION); } // CFA 240 229 extern { KEYWORD_RETURN(EXTERN); } 230 fallthrough { KEYWORD_RETURN(FALLTHROUGH); } // CFA 241 231 fallthru { KEYWORD_RETURN(FALLTHRU); } // CFA 242 fallthrough { KEYWORD_RETURN(FALLTHROUGH); } // CFA243 232 finally { KEYWORD_RETURN(FINALLY); } // CFA 244 233 float { KEYWORD_RETURN(FLOAT); } … … 270 259 __builtin_offsetof { KEYWORD_RETURN(OFFSETOF); } // GCC 271 260 one_t { NUMERIC_RETURN(ONE_T); } // CFA 261 or { QKEYWORD_RETURN(WOR); } // CFA 272 262 otype { KEYWORD_RETURN(OTYPE); } // CFA 273 263 register { KEYWORD_RETURN(REGISTER); } … … 306 296 __volatile__ { KEYWORD_RETURN(VOLATILE); } // GCC 307 297 waitfor { KEYWORD_RETURN(WAITFOR); } 308 or { QKEYWORD_RETURN(WOR); } // CFA309 298 when { KEYWORD_RETURN(WHEN); } 310 299 while { KEYWORD_RETURN(WHILE); } … … 314 303 /* identifier */ 315 304 {identifier} { IDENTIFIER_RETURN(); } 305 "`"{identifier}"`" { // CFA 306 yytext[yyleng - 1] = '\0'; yytext += 1; // SKULLDUGGERY: remove backquotes (ok to shorten?) 307 IDENTIFIER_RETURN(); 308 } 316 309 {attr_identifier} { ATTRIBUTE_RETURN(); } 317 "`" { BEGIN BKQUOTE; }318 <BKQUOTE>{identifier} { IDENTIFIER_RETURN(); }319 <BKQUOTE>"`" { BEGIN 0; }320 310 321 311 /* numeric constants */ … … 332 322 ({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new string( yytext, yyleng ); } 333 323 <QUOTE>[^'\\\n]* { strtext->append( yytext, yyleng ); } 334 <QUOTE>['\n] {user_suffix_opt}{ BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }324 <QUOTE>['\n] { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); } 335 325 /* ' stop editor highlighting */ 336 326 … … 338 328 ({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new string( yytext, yyleng ); } 339 329 <STRING>[^"\\\n]* { strtext->append( yytext, yyleng ); } 340 <STRING>["\n] {user_suffix_opt}{ BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }330 <STRING>["\n] { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); } 341 331 /* " stop editor highlighting */ 342 332 … … 348 338 /* punctuation */ 349 339 "@" { ASCIIOP_RETURN(); } 340 "`" { ASCIIOP_RETURN(); } 350 341 "[" { ASCIIOP_RETURN(); } 351 342 "]" { ASCIIOP_RETURN(); } … … 412 403 "?"({op_unary_pre_post}|"()"|"[?]"|"{}") { IDENTIFIER_RETURN(); } 413 404 "^?{}" { IDENTIFIER_RETURN(); } 414 "?`"{identifier} { IDENTIFIER_RETURN(); } // unitoperator405 "?`"{identifier} { IDENTIFIER_RETURN(); } // postfix operator 415 406 "?"{op_binary_over}"?" { IDENTIFIER_RETURN(); } // binary 416 407 /* -
src/Parser/parser.yy
rb2fe1c9 r32cab5b 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 22 17:48:54 201813 // Update Count : 3 02812 // Last Modified On : Wed Mar 28 17:52:24 2018 13 // Update Count : 3130 14 14 // 15 15 … … 126 126 } // if 127 127 } // rebindForall 128 129 NameExpr * build_postfix_name( const string * name ) { 130 NameExpr * new_name = build_varref( new string( "?`" + *name ) ); 131 delete name; 132 return new_name; 133 } // build_postfix_name 128 134 129 135 bool forall = false; // aggregate have one or more forall qualifiers ? … … 254 260 %type<sn> statement_decl statement_decl_list statement_list_nodecl 255 261 %type<sn> selection_statement 256 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list262 %type<sn> switch_clause_list_opt switch_clause_list 257 263 %type<en> case_value 258 264 %type<sn> case_clause case_value_list case_label case_label_list 259 %type<sn> fall_through fall_through_opt260 265 %type<sn> iteration_statement jump_statement 261 266 %type<sn> expression_statement asm_statement … … 481 486 | '(' compound_statement ')' // GCC, lambda expression 482 487 { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); } 488 | constant '`' IDENTIFIER // CFA, postfix call 489 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); } 490 | string_literal '`' IDENTIFIER // CFA, postfix call 491 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); } 492 | IDENTIFIER '`' IDENTIFIER // CFA, postfix call 493 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( build_varref( $1 ) ) ) ); } 494 | tuple '`' IDENTIFIER // CFA, postfix call 495 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); } 496 | '(' comma_expression ')' '`' IDENTIFIER // CFA, postfix call 497 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); } 483 498 | type_name '.' no_attr_identifier // CFA, nested type 484 { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; } // FIX ME499 { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; } 485 500 | type_name '.' '[' push field_list pop ']' // CFA, nested type / tuple field selector 486 { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; } // FIX ME501 { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; } 487 502 | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11 488 { SemanticError( yylloc, "_Generic is currently unimplemented." ); $$ = nullptr; } // FIX ME503 { SemanticError( yylloc, "_Generic is currently unimplemented." ); $$ = nullptr; } 489 504 ; 490 505 … … 535 550 | '(' type_no_function ')' '{' initializer_list comma_opt '}' // C99, compound-literal 536 551 { $$ = new ExpressionNode( build_compoundLiteral( $2, new InitializerNode( $5, true ) ) ); } 552 | '(' type_no_function ')' '@' '{' initializer_list comma_opt '}' // CFA, explicit C compound-literal 553 { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); } 537 554 | '^' primary_expression '{' argument_expression_list '}' // CFA 538 555 { … … 670 687 | '(' type_no_function ')' cast_expression 671 688 { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } 689 | '(' COROUTINE '&' ')' cast_expression // CFA 690 { SemanticError( yylloc, "coroutine cast is currently unimplemented." ); $$ = nullptr; } 691 | '(' THREAD '&' ')' cast_expression // CFA 692 { SemanticError( yylloc, "monitor cast is currently unimplemented." ); $$ = nullptr; } 693 | '(' MONITOR '&' ')' cast_expression // CFA 694 { SemanticError( yylloc, "thread cast is currently unimplemented." ); $$ = nullptr; } 672 695 // VIRTUAL cannot be opt because of look ahead issues 673 | '(' VIRTUAL ')' cast_expression 696 | '(' VIRTUAL ')' cast_expression // CFA 674 697 { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $4 ), maybeMoveBuildType( nullptr ) ) ); } 675 | '(' VIRTUAL type_no_function ')' cast_expression 698 | '(' VIRTUAL type_no_function ')' cast_expression // CFA 676 699 { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $5 ), maybeMoveBuildType( $3 ) ) ); } 677 700 // | '(' type_no_function ')' tuple … … 765 788 | logical_OR_expression '?' comma_expression ':' conditional_expression 766 789 { $$ = new ExpressionNode( build_cond( $1, $3, $5 ) ); } 767 // FIX ME: this hackcomputes $1 twice790 // FIX ME: computes $1 twice 768 791 | logical_OR_expression '?' /* empty */ ':' conditional_expression // GCC, omitted first operand 769 792 { $$ = new ExpressionNode( build_cond( $1, $1, $4 ) ); } … … 780 803 { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); } 781 804 | unary_expression '=' '{' initializer_list comma_opt '}' 782 { SemanticError( yylloc, "Initializer assignment is currently unimplemented." ); $$ = nullptr; } // FIX ME805 { SemanticError( yylloc, "Initializer assignment is currently unimplemented." ); $$ = nullptr; } 783 806 ; 784 807 … … 850 873 | exception_statement 851 874 | enable_disable_statement 852 { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; } // FIX ME875 { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; } 853 876 | asm_statement 854 877 ; … … 917 940 { $$ = new StatementNode( build_if( $4, $6, $8 ) ); } 918 941 | SWITCH '(' comma_expression ')' case_clause 919 { $$ = new StatementNode( build_switch( $3, $5 ) ); }942 { $$ = new StatementNode( build_switch( true, $3, $5 ) ); } 920 943 | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA 921 944 { 922 StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );945 StatementNode *sw = new StatementNode( build_switch( true, $3, $8 ) ); 923 946 // The semantics of the declaration list is changed to include associated initialization, which is performed 924 947 // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound … … 929 952 } 930 953 | CHOOSE '(' comma_expression ')' case_clause // CFA 931 { $$ = new StatementNode( build_switch( $3, $5 ) ); }932 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA933 { 934 StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );954 { $$ = new StatementNode( build_switch( false, $3, $5 ) ); } 955 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA 956 { 957 StatementNode *sw = new StatementNode( build_switch( false, $3, $8 ) ); 935 958 $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw; 936 959 } … … 970 993 ; 971 994 995 //label_list_opt: 996 // // empty 997 // | identifier_or_type_name ':' 998 // | label_list_opt identifier_or_type_name ':' 999 // ; 1000 972 1001 case_label_list: // CFA 973 1002 case_label … … 990 1019 | switch_clause_list case_label_list statement_list_nodecl 991 1020 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( $3 ) ) ) ) ); } 992 ;993 994 choose_clause_list_opt: // CFA995 // empty996 { $$ = nullptr; }997 | choose_clause_list998 ;999 1000 choose_clause_list: // CFA1001 case_label_list fall_through1002 { $$ = $1->append_last_case( $2 ); }1003 | case_label_list statement_list_nodecl fall_through_opt1004 { $$ = $1->append_last_case( new StatementNode( build_compound( (StatementNode *)$2->set_last( $3 ) ) ) ); }1005 | choose_clause_list case_label_list fall_through1006 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( $3 ))); }1007 | choose_clause_list case_label_list statement_list_nodecl fall_through_opt1008 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( (StatementNode *)$3->set_last( $4 ) ) ) ) ) ); }1009 ;1010 1011 fall_through_opt: // CFA1012 // empty1013 { $$ = new StatementNode( build_branch( BranchStmt::Break ) ); } // insert implicit break1014 | fall_through1015 ;1016 1017 fall_through_name: // CFA1018 FALLTHRU1019 | FALLTHROUGH1020 ;1021 1022 fall_through: // CFA1023 fall_through_name1024 { $$ = nullptr; }1025 | fall_through_name ';'1026 { $$ = nullptr; }1027 1021 ; 1028 1022 … … 1050 1044 // whereas normal operator precedence yields goto (*i)+3; 1051 1045 { $$ = new StatementNode( build_computedgoto( $3 ) ); } 1046 // A semantic check is required to ensure fallthru appears only in the body of a choose statement. 1047 | fall_through_name ';' // CFA 1048 { $$ = new StatementNode( build_branch( BranchStmt::FallThrough ) ); } 1049 | fall_through_name identifier_or_type_name ';' // CFA 1050 { $$ = new StatementNode( build_branch( $2, BranchStmt::FallThrough ) ); } 1051 | fall_through_name DEFAULT ';' // CFA 1052 { $$ = new StatementNode( build_branch( BranchStmt::FallThroughDefault ) ); } 1052 1053 | CONTINUE ';' 1053 1054 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. … … 1067 1068 { $$ = new StatementNode( build_return( $2 ) ); } 1068 1069 | RETURN '{' initializer_list comma_opt '}' 1069 { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; } // FIX ME1070 { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; } 1070 1071 | THROW assignment_expression_opt ';' // handles rethrow 1071 1072 { $$ = new StatementNode( build_throw( $2 ) ); } … … 1076 1077 ; 1077 1078 1079 fall_through_name: // CFA 1080 FALLTHRU 1081 | FALLTHROUGH 1082 ; 1083 1078 1084 with_statement: 1079 1085 WITH '(' tuple_expression_list ')' statement … … 1086 1092 mutex_statement: 1087 1093 MUTEX '(' argument_expression_list ')' statement 1088 { SemanticError( yylloc, "Mutex statement is currently unimplemented." ); $$ = nullptr; } // FIX ME1094 { SemanticError( yylloc, "Mutex statement is currently unimplemented." ); $$ = nullptr; } 1089 1095 ; 1090 1096 1091 1097 when_clause: 1092 WHEN '(' comma_expression ')' 1093 { $$ = $3; } 1098 WHEN '(' comma_expression ')' { $$ = $3; } 1094 1099 ; 1095 1100 … … 1115 1120 1116 1121 timeout: 1117 TIMEOUT '(' comma_expression ')' 1118 { $$ = $3; } 1122 TIMEOUT '(' comma_expression ')' { $$ = $3; } 1119 1123 ; 1120 1124 … … 1159 1163 //empty 1160 1164 { $$ = nullptr; } 1161 | ';' conditional_expression 1162 { $$ = $2; } 1165 | ';' conditional_expression { $$ = $2; } 1163 1166 ; 1164 1167 1165 1168 handler_key: 1166 CATCH 1167 { $$ = CatchStmt::Terminate; } 1168 | CATCHRESUME 1169 { $$ = CatchStmt::Resume; } 1169 CATCH { $$ = CatchStmt::Terminate; } 1170 | CATCHRESUME { $$ = CatchStmt::Resume; } 1170 1171 ; 1171 1172 1172 1173 finally_clause: 1173 FINALLY compound_statement 1174 { 1175 $$ = new StatementNode( build_finally( $2 ) ); 1176 } 1174 FINALLY compound_statement { $$ = new StatementNode( build_finally( $2 ) ); } 1177 1175 ; 1178 1176 … … 1316 1314 static_assert: 1317 1315 STATICASSERT '(' constant_expression ',' string_literal ')' ';' // C11 1318 { SemanticError( yylloc, "Static assert is currently unimplemented." ); $$ = nullptr; } // FIX ME1316 { $$ = DeclarationNode::newStaticAssert( $3, $5 ); } 1319 1317 1320 1318 // C declaration syntax is notoriously confusing and error prone. Cforall provides its own type, variable and function … … 2413 2411 $$ = $2; 2414 2412 } 2415 | forall'{' external_definition_list '}' // CFA, namespace2413 | type_qualifier_list '{' external_definition_list '}' // CFA, namespace 2416 2414 ; 2417 2415
Note:
See TracChangeset
for help on using the changeset viewer.