Changeset 26238c1 for src/Parser
- Timestamp:
- Aug 28, 2017, 2:59:36 PM (7 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, resolv-new, with_gc
- Children:
- 234223f, afce1cf
- Parents:
- 2065609 (diff), 1cb758f2 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r2065609 r26238c1 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 23 21:08:08201713 // Update Count : 27 0412 // Last Modified On : Sat Aug 26 17:50:19 2017 13 // Update Count : 2712 14 14 // 15 15 … … 120 120 %token RESTRICT // C99 121 121 %token ATOMIC // C11 122 %token FORALL MUTEX VIRTUAL // CFA122 %token FORALL MUTEX VIRTUAL // CFA 123 123 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED 124 124 %token BOOL COMPLEX IMAGINARY // C99 … … 188 188 %type<flag> asm_volatile_opt 189 189 %type<en> handler_predicate_opt 190 %type<en> when_clause_opt timeout191 190 192 191 // statements 193 %type<sn> labeled_statement compound_statement expression_statement selection_statement 194 %type<sn> iteration_statement jump_statement 195 %type<sn> with_statement exception_statement asm_statement 196 %type<sn> waitfor_statement 197 %type<sn> fall_through_opt fall_through 198 %type<sn> statement statement_list 199 %type<sn> block_item_list block_item 200 %type<sn> with_clause_opt 192 %type<sn> statement labeled_statement compound_statement 193 %type<sn> statement_decl statement_decl_list statement_list_nodecl 194 %type<sn> selection_statement 195 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list 201 196 %type<en> case_value 202 197 %type<sn> case_clause case_value_list case_label case_label_list 203 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list 204 %type<sn> handler_clause finally_clause 198 %type<sn> fall_through fall_through_opt 199 %type<sn> iteration_statement jump_statement 200 %type<sn> expression_statement asm_statement 201 %type<sn> with_statement with_clause_opt 202 %type<sn> exception_statement handler_clause finally_clause 205 203 %type<catch_kind> handler_key 204 %type<en> when_clause when_clause_opt waitfor timeout 205 %type<sn> waitfor_statement 206 206 %type<wfs> waitfor_clause 207 %type<en> waitfor208 207 209 208 // declarations … … 777 776 push push 778 777 local_label_declaration_opt // GCC, local labels 779 block_item_list// C99, intermix declarations and statements778 statement_decl_list // C99, intermix declarations and statements 780 779 pop '}' 781 780 { $$ = new StatementNode( build_compound( $5 ) ); } 782 781 ; 783 782 784 block_item_list:// C99785 block_item786 | block_item_list push block_item783 statement_decl_list: // C99 784 statement_decl 785 | statement_decl_list push statement_decl 787 786 { if ( $1 != 0 ) { $1->set_last( $3 ); $$ = $1; } } 788 787 ; 789 788 790 block_item:789 statement_decl: 791 790 declaration // CFA, new & old style declarations 792 791 { $$ = new StatementNode( $1 ); } … … 806 805 ; 807 806 808 statement_list :807 statement_list_nodecl: 809 808 statement 810 | statement_list statement809 | statement_list_nodecl statement 811 810 { if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } } 812 811 ; … … 818 817 819 818 selection_statement: 820 IF '(' push if_control_expression ')' statement 819 IF '(' push if_control_expression ')' statement %prec THEN 821 820 // explicitly deal with the shift/reduce conflict on if/else 822 821 { $$ = new StatementNode( build_if( $4, $6, nullptr ) ); } … … 893 892 894 893 switch_clause_list: // CFA 895 case_label_list statement_list 894 case_label_list statement_list_nodecl 896 895 { $$ = $1->append_last_case( new StatementNode( build_compound( $2 ) ) ); } 897 | switch_clause_list case_label_list statement_list 896 | switch_clause_list case_label_list statement_list_nodecl 898 897 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( $3 ) ) ) ) ); } 899 898 ; … … 908 907 case_label_list fall_through 909 908 { $$ = $1->append_last_case( $2 ); } 910 | case_label_list statement_list fall_through_opt909 | case_label_list statement_list_nodecl fall_through_opt 911 910 { $$ = $1->append_last_case( new StatementNode( build_compound( (StatementNode *)$2->set_last( $3 ) ) ) ); } 912 911 | choose_clause_list case_label_list fall_through 913 912 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( $3 ))); } 914 | choose_clause_list case_label_list statement_list fall_through_opt913 | choose_clause_list case_label_list statement_list_nodecl fall_through_opt 915 914 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( (StatementNode *)$3->set_last( $4 ) ) ) ) ) ); } 916 915 ; … … 981 980 ; 982 981 982 when_clause: 983 WHEN '(' comma_expression ')' 984 { $$ = $3; } 985 ; 986 983 987 when_clause_opt: 984 988 // empty 985 989 { $$ = nullptr; } 986 | WHEN '(' comma_expression ')' 987 { $$ = $3; } 990 | when_clause 988 991 ; 989 992 … … 1008 1011 1009 1012 waitfor_clause: 1010 when_clause_opt waitfor statement 1013 when_clause_opt waitfor statement %prec THEN 1011 1014 { $$ = build_waitfor( $2, $3, $1 ); } 1012 1015 | when_clause_opt waitfor statement WOR waitfor_clause 1013 1016 { $$ = build_waitfor( $2, $3, $1, $5 ); } 1014 | when_clause_opt timeout statement 1017 | when_clause_opt timeout statement %prec THEN 1015 1018 { $$ = build_waitfor_timeout( $2, $3, $1 ); } 1016 1019 | when_clause_opt ELSE statement 1017 1020 { $$ = build_waitfor_timeout( nullptr, $3, $1 ); } 1018 | when_clause_opt timeout statement WOR when_clause_opt ELSE statement 1021 // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless) 1022 | when_clause_opt timeout statement WOR when_clause ELSE statement 1019 1023 { $$ = build_waitfor_timeout( $2, $3, $1, $7, $5 ); } 1020 1024 ; 1021 1025 1022 1026 waitfor_statement: 1023 when_clause_opt waitfor statement 1027 when_clause_opt waitfor statement %prec THEN 1024 1028 { $$ = new StatementNode( build_waitfor( $2, $3, $1 ) ); } 1025 1029 | when_clause_opt waitfor statement WOR waitfor_clause
Note: See TracChangeset
for help on using the changeset viewer.