Changes in src/Parser/parser.yy [5c216b4:3b0bc16]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r5c216b4 r3b0bc16 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Feb 19 09:47:20202213 // Update Count : 5 21812 // Last Modified On : Tue Feb 1 11:06:13 2022 13 // Update Count : 5167 14 14 // 15 15 … … 1052 1052 identifier_or_type_name ':' attribute_list_opt statement 1053 1053 { $$ = $4->add_label( $1, $3 ); } 1054 | identifier_or_type_name ':' attribute_list_opt error1055 { SemanticError( yylloc, "previous label must be associated with a statement (where a declaration is not a statement). Move the label or terminate with a semi-colon." ); $$ = nullptr; }1056 1054 ; 1057 1055 … … 1088 1086 | statement_list_nodecl statement 1089 1087 { assert( $1 ); $1->set_last( $2 ); $$ = $1; } 1090 | statement_list_nodecl error1091 { SemanticError( yylloc, "declarations only allowed at the start of the switch body, i.e., after the '{'." ); $$ = nullptr; }1092 1088 ; 1093 1089 … … 1097 1093 | MUTEX '(' ')' comma_expression ';' 1098 1094 { $$ = new StatementNode( build_mutex( nullptr, new StatementNode( build_expr( $4 ) ) ) ); } 1095 // { SemanticError( yylloc, "Mutex expression is currently unimplemented." ); $$ = nullptr; } 1099 1096 ; 1100 1097 … … 1116 1113 $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw; 1117 1114 } 1118 | SWITCH '(' comma_expression ')' '{' error '}' // CFA1119 { SemanticError( yylloc, "only declarations can appear before the list of case clauses." ); $$ = nullptr; }1120 1115 | CHOOSE '(' comma_expression ')' case_clause // CFA 1121 1116 { $$ = new StatementNode( build_switch( false, $3, $5 ) ); } … … 1125 1120 $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw; 1126 1121 } 1127 | CHOOSE '(' comma_expression ')' '{' error '}' // CFA1128 { SemanticError( yylloc, "only declarations can appear before the list of case clauses." ); $$ = nullptr; }1129 1122 ; 1130 1123 … … 1165 1158 1166 1159 case_label: // CFA 1167 CASE error 1168 { SemanticError( yylloc, "missing case list after case." ); $$ = nullptr; } 1169 | CASE case_value_list ':' { $$ = $2; } 1170 | CASE case_value_list error 1171 { SemanticError( yylloc, "missing colon after case list." ); $$ = nullptr; } 1160 CASE case_value_list ':' { $$ = $2; } 1172 1161 | DEFAULT ':' { $$ = new StatementNode( build_default() ); } 1173 1162 // A semantic check is required to ensure only one default clause per switch/choose statement. 1174 | DEFAULT error 1175 { SemanticError( yylloc, "missing colon after default." ); $$ = nullptr; } 1176 ; 1163 ; 1164 1165 //label_list_opt: 1166 // // empty 1167 // | identifier_or_type_name ':' 1168 // | label_list_opt identifier_or_type_name ':' 1169 // ; 1177 1170 1178 1171 case_label_list: // CFA … … 1204 1197 { $$ = new StatementNode( build_while( $3, maybe_build_compound( $5 ) ) ); } 1205 1198 | WHILE '(' conditional_declaration ')' statement ELSE statement // CFA 1199 // { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; } 1206 1200 { $$ = new StatementNode( build_while( $3, maybe_build_compound( $5 ), $7 ) ); } 1207 1201 | DO statement WHILE '(' ')' ';' // CFA => do while( 1 ) … … 1210 1204 { $$ = new StatementNode( build_do_while( $5, maybe_build_compound( $2 ) ) ); } 1211 1205 | DO statement WHILE '(' comma_expression ')' ELSE statement // CFA 1206 // { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; } 1212 1207 { $$ = new StatementNode( build_do_while( $5, maybe_build_compound( $2 ), $8 ) ); } 1213 1208 | FOR '(' ')' statement // CFA => for ( ;; ) … … 1216 1211 { $$ = new StatementNode( build_for( $3, maybe_build_compound( $5 ) ) ); } 1217 1212 | FOR '(' for_control_expression_list ')' statement ELSE statement // CFA 1213 // { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; } 1218 1214 { $$ = new StatementNode( build_for( $3, maybe_build_compound( $5 ), $7 ) ); } 1219 1215 ; … … 2733 2729 | ASM '(' string_literal ')' ';' // GCC, global assembler statement 2734 2730 { $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asm( false, $3, 0 ) ) ); } 2735 | EXTERN STRINGliteral2736 {2737 linkageStack.push( linkage ); // handle nested extern "C"/"Cforall"2738 linkage = LinkageSpec::update( yylloc, linkage, $2 );2739 }2740 up external_definition down2741 {2742 linkage = linkageStack.top();2743 linkageStack.pop();2744 $$ = $5;2745 }2746 2731 | EXTERN STRINGliteral // C++-style linkage specifier 2747 2732 {
Note:
See TracChangeset
for help on using the changeset viewer.