Changes in src/Parser/parser.yy [a16764a6:6a276a0]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
ra16764a6 r6a276a0 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:54201813 // Update Count : 30 2812 // Last Modified On : Fri Mar 9 11:37:35 2018 13 // Update Count : 3075 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 choose_clause_list_opt choose_clause_list256 %type<sn> switch_clause_list_opt switch_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_opt260 259 %type<sn> iteration_statement jump_statement 261 260 %type<sn> expression_statement asm_statement … … 917 916 { $$ = new StatementNode( build_if( $4, $6, $8 ) ); } 918 917 | SWITCH '(' comma_expression ')' case_clause 919 { $$ = new StatementNode( build_switch( $3, $5 ) ); }918 { $$ = new StatementNode( build_switch( true, $3, $5 ) ); } 920 919 | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA 921 920 { 922 StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );921 StatementNode *sw = new StatementNode( build_switch( true, $3, $8 ) ); 923 922 // The semantics of the declaration list is changed to include associated initialization, which is performed 924 923 // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound … … 929 928 } 930 929 | 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 ) );930 { $$ = new StatementNode( build_switch( false, $3, $5 ) ); } 931 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA 932 { 933 StatementNode *sw = new StatementNode( build_switch( false, $3, $8 ) ); 935 934 $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw; 936 935 } … … 970 969 ; 971 970 971 //label_list_opt: 972 // // empty 973 // | identifier_or_type_name ':' 974 // | label_list_opt identifier_or_type_name ':' 975 // ; 976 972 977 case_label_list: // CFA 973 978 case_label … … 990 995 | switch_clause_list case_label_list statement_list_nodecl 991 996 { $$ = (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 997 ; 1028 998 … … 1050 1020 // whereas normal operator precedence yields goto (*i)+3; 1051 1021 { $$ = 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 ';' // CFA 1024 { $$ = new StatementNode( build_branch( BranchStmt::FallThrough ) ); } 1025 | fall_through_name identifier_or_type_name ';' // CFA 1026 { $$ = new StatementNode( build_branch( $2, BranchStmt::FallThrough ) ); } 1027 | fall_through_name DEFAULT ';' // CFA 1028 { $$ = new StatementNode( build_branch( BranchStmt::FallThroughDefault ) ); } 1052 1029 | CONTINUE ';' 1053 1030 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. … … 1076 1053 ; 1077 1054 1055 fall_through_name: // CFA 1056 FALLTHRU 1057 | FALLTHROUGH 1058 ; 1059 1078 1060 with_statement: 1079 1061 WITH '(' tuple_expression_list ')' statement … … 1090 1072 1091 1073 when_clause: 1092 WHEN '(' comma_expression ')' 1093 { $$ = $3; } 1074 WHEN '(' comma_expression ')' { $$ = $3; } 1094 1075 ; 1095 1076 … … 1115 1096 1116 1097 timeout: 1117 TIMEOUT '(' comma_expression ')' 1118 { $$ = $3; } 1098 TIMEOUT '(' comma_expression ')' { $$ = $3; } 1119 1099 ; 1120 1100 … … 1159 1139 //empty 1160 1140 { $$ = nullptr; } 1161 | ';' conditional_expression 1162 { $$ = $2; } 1141 | ';' conditional_expression { $$ = $2; } 1163 1142 ; 1164 1143 1165 1144 handler_key: 1166 CATCH 1167 { $$ = CatchStmt::Terminate; } 1168 | CATCHRESUME 1169 { $$ = CatchStmt::Resume; } 1145 CATCH { $$ = CatchStmt::Terminate; } 1146 | CATCHRESUME { $$ = CatchStmt::Resume; } 1170 1147 ; 1171 1148 1172 1149 finally_clause: 1173 FINALLY compound_statement 1174 { 1175 $$ = new StatementNode( build_finally( $2 ) ); 1176 } 1150 FINALLY compound_statement { $$ = new StatementNode( build_finally( $2 ) ); } 1177 1151 ; 1178 1152 … … 2413 2387 $$ = $2; 2414 2388 } 2415 | forall'{' external_definition_list '}' // CFA, namespace2389 | type_qualifier_list '{' external_definition_list '}' // CFA, namespace 2416 2390 ; 2417 2391
Note: See TracChangeset
for help on using the changeset viewer.