Changes in src/Parser/parser.yy [6a276a0:a16764a6]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r6a276a0 ra16764a6 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 9 11:37:35201813 // Update Count : 30 7512 // Last Modified On : Thu Feb 22 17:48:54 2018 13 // Update Count : 3028 14 14 // 15 15 … … 254 254 %type<sn> statement_decl statement_decl_list statement_list_nodecl 255 255 %type<sn> selection_statement 256 %type<sn> switch_clause_list_opt switch_clause_list 256 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list 257 257 %type<en> case_value 258 258 %type<sn> case_clause case_value_list case_label case_label_list 259 %type<sn> fall_through fall_through_opt 259 260 %type<sn> iteration_statement jump_statement 260 261 %type<sn> expression_statement asm_statement … … 916 917 { $$ = new StatementNode( build_if( $4, $6, $8 ) ); } 917 918 | SWITCH '(' comma_expression ')' case_clause 918 { $$ = new StatementNode( build_switch( true,$3, $5 ) ); }919 { $$ = new StatementNode( build_switch( $3, $5 ) ); } 919 920 | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA 920 921 { 921 StatementNode *sw = new StatementNode( build_switch( true,$3, $8 ) );922 StatementNode *sw = new StatementNode( build_switch( $3, $8 ) ); 922 923 // The semantics of the declaration list is changed to include associated initialization, which is performed 923 924 // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound … … 928 929 } 929 930 | CHOOSE '(' comma_expression ')' case_clause // CFA 930 { $$ = new StatementNode( build_switch( false,$3, $5 ) ); }931 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA932 { 933 StatementNode *sw = new StatementNode( build_switch( false,$3, $8 ) );931 { $$ = new StatementNode( build_switch( $3, $5 ) ); } 932 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA 933 { 934 StatementNode *sw = new StatementNode( build_switch( $3, $8 ) ); 934 935 $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw; 935 936 } … … 969 970 ; 970 971 971 //label_list_opt:972 // // empty973 // | identifier_or_type_name ':'974 // | label_list_opt identifier_or_type_name ':'975 // ;976 977 972 case_label_list: // CFA 978 973 case_label … … 995 990 | switch_clause_list case_label_list statement_list_nodecl 996 991 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( $3 ) ) ) ) ); } 992 ; 993 994 choose_clause_list_opt: // CFA 995 // empty 996 { $$ = nullptr; } 997 | choose_clause_list 998 ; 999 1000 choose_clause_list: // CFA 1001 case_label_list fall_through 1002 { $$ = $1->append_last_case( $2 ); } 1003 | case_label_list statement_list_nodecl fall_through_opt 1004 { $$ = $1->append_last_case( new StatementNode( build_compound( (StatementNode *)$2->set_last( $3 ) ) ) ); } 1005 | choose_clause_list case_label_list fall_through 1006 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( $3 ))); } 1007 | choose_clause_list case_label_list statement_list_nodecl fall_through_opt 1008 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( (StatementNode *)$3->set_last( $4 ) ) ) ) ) ); } 1009 ; 1010 1011 fall_through_opt: // CFA 1012 // empty 1013 { $$ = new StatementNode( build_branch( BranchStmt::Break ) ); } // insert implicit break 1014 | fall_through 1015 ; 1016 1017 fall_through_name: // CFA 1018 FALLTHRU 1019 | FALLTHROUGH 1020 ; 1021 1022 fall_through: // CFA 1023 fall_through_name 1024 { $$ = nullptr; } 1025 | fall_through_name ';' 1026 { $$ = nullptr; } 997 1027 ; 998 1028 … … 1020 1050 // whereas normal operator precedence yields goto (*i)+3; 1021 1051 { $$ = new StatementNode( build_computedgoto( $3 ) ); } 1022 // A semantic check is required to ensure fallthru appears only in the body of a choose statement.1023 | fall_through_name ';' // CFA1024 { $$ = new StatementNode( build_branch( BranchStmt::FallThrough ) ); }1025 | fall_through_name identifier_or_type_name ';' // CFA1026 { $$ = new StatementNode( build_branch( $2, BranchStmt::FallThrough ) ); }1027 | fall_through_name DEFAULT ';' // CFA1028 { $$ = new StatementNode( build_branch( BranchStmt::FallThroughDefault ) ); }1029 1052 | CONTINUE ';' 1030 1053 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. … … 1053 1076 ; 1054 1077 1055 fall_through_name: // CFA1056 FALLTHRU1057 | FALLTHROUGH1058 ;1059 1060 1078 with_statement: 1061 1079 WITH '(' tuple_expression_list ')' statement … … 1072 1090 1073 1091 when_clause: 1074 WHEN '(' comma_expression ')' { $$ = $3; } 1092 WHEN '(' comma_expression ')' 1093 { $$ = $3; } 1075 1094 ; 1076 1095 … … 1096 1115 1097 1116 timeout: 1098 TIMEOUT '(' comma_expression ')' { $$ = $3; } 1117 TIMEOUT '(' comma_expression ')' 1118 { $$ = $3; } 1099 1119 ; 1100 1120 … … 1139 1159 //empty 1140 1160 { $$ = nullptr; } 1141 | ';' conditional_expression { $$ = $2; } 1161 | ';' conditional_expression 1162 { $$ = $2; } 1142 1163 ; 1143 1164 1144 1165 handler_key: 1145 CATCH { $$ = CatchStmt::Terminate; } 1146 | CATCHRESUME { $$ = CatchStmt::Resume; } 1166 CATCH 1167 { $$ = CatchStmt::Terminate; } 1168 | CATCHRESUME 1169 { $$ = CatchStmt::Resume; } 1147 1170 ; 1148 1171 1149 1172 finally_clause: 1150 FINALLY compound_statement { $$ = new StatementNode( build_finally( $2 ) ); } 1173 FINALLY compound_statement 1174 { 1175 $$ = new StatementNode( build_finally( $2 ) ); 1176 } 1151 1177 ; 1152 1178 … … 2387 2413 $$ = $2; 2388 2414 } 2389 | type_qualifier_list'{' external_definition_list '}' // CFA, namespace2415 | forall '{' external_definition_list '}' // CFA, namespace 2390 2416 ; 2391 2417
Note: See TracChangeset
for help on using the changeset viewer.