Changes in src/Parser/parser.yy [9bd6105:1efa1e1]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r9bd6105 r1efa1e1 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 26 17:50:19201713 // Update Count : 27 1212 // Last Modified On : Wed Aug 23 21:08:08 2017 13 // Update Count : 2704 14 14 // 15 15 … … 97 97 DeclarationNode::TypeClass tclass; 98 98 StatementNode * sn; 99 WaitForStmt * wfs;100 99 ConstantExpr * constant; 101 100 IfCtl * ifctl; … … 120 119 %token RESTRICT // C99 121 120 %token ATOMIC // C11 122 %token FORALL MUTEX VIRTUAL // CFA121 %token FORALL MUTEX VIRTUAL // CFA 123 122 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED 124 123 %token BOOL COMPLEX IMAGINARY // C99 … … 190 189 191 190 // statements 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 191 %type<sn> labeled_statement compound_statement expression_statement selection_statement 192 %type<sn> iteration_statement jump_statement 193 %type<sn> with_statement exception_statement asm_statement 194 %type<sn> when_clause_opt waitfor_statement waitfor_clause waitfor timeout 195 %type<sn> fall_through_opt fall_through 196 %type<sn> statement statement_list 197 %type<sn> block_item_list block_item 198 %type<sn> with_clause_opt 196 199 %type<en> case_value 197 200 %type<sn> case_clause case_value_list case_label case_label_list 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 201 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list 202 %type<sn> handler_clause finally_clause 203 203 %type<catch_kind> handler_key 204 %type<en> when_clause when_clause_opt waitfor timeout205 %type<sn> waitfor_statement206 %type<wfs> waitfor_clause207 204 208 205 // declarations … … 776 773 push push 777 774 local_label_declaration_opt // GCC, local labels 778 statement_decl_list// C99, intermix declarations and statements775 block_item_list // C99, intermix declarations and statements 779 776 pop '}' 780 777 { $$ = new StatementNode( build_compound( $5 ) ); } 781 778 ; 782 779 783 statement_decl_list:// C99784 statement_decl785 | statement_decl_list push statement_decl780 block_item_list: // C99 781 block_item 782 | block_item_list push block_item 786 783 { if ( $1 != 0 ) { $1->set_last( $3 ); $$ = $1; } } 787 784 ; 788 785 789 statement_decl:786 block_item: 790 787 declaration // CFA, new & old style declarations 791 788 { $$ = new StatementNode( $1 ); } … … 805 802 ; 806 803 807 statement_list _nodecl:804 statement_list: 808 805 statement 809 | statement_list _nodeclstatement806 | statement_list statement 810 807 { if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } } 811 808 ; … … 817 814 818 815 selection_statement: 819 IF '(' push if_control_expression ')' statement %prec THEN816 IF '(' push if_control_expression ')' statement %prec THEN 820 817 // explicitly deal with the shift/reduce conflict on if/else 821 818 { $$ = new StatementNode( build_if( $4, $6, nullptr ) ); } … … 892 889 893 890 switch_clause_list: // CFA 894 case_label_list statement_list _nodecl891 case_label_list statement_list 895 892 { $$ = $1->append_last_case( new StatementNode( build_compound( $2 ) ) ); } 896 | switch_clause_list case_label_list statement_list _nodecl893 | switch_clause_list case_label_list statement_list 897 894 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( $3 ) ) ) ) ); } 898 895 ; … … 907 904 case_label_list fall_through 908 905 { $$ = $1->append_last_case( $2 ); } 909 | case_label_list statement_list _nodeclfall_through_opt906 | case_label_list statement_list fall_through_opt 910 907 { $$ = $1->append_last_case( new StatementNode( build_compound( (StatementNode *)$2->set_last( $3 ) ) ) ); } 911 908 | choose_clause_list case_label_list fall_through 912 909 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( $3 ))); } 913 | choose_clause_list case_label_list statement_list _nodeclfall_through_opt910 | choose_clause_list case_label_list statement_list fall_through_opt 914 911 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( (StatementNode *)$3->set_last( $4 ) ) ) ) ) ); } 915 912 ; … … 980 977 ; 981 978 982 when_clause:983 WHEN '(' comma_expression ')'984 { $$ = $3; }985 ;986 987 979 when_clause_opt: 988 980 // empty 989 { $$ = nullptr; } 990 | when_clause 981 { $$ = nullptr; } // FIX ME 982 | WHEN '(' comma_expression ')' 983 { $$ = nullptr; } // FIX ME 991 984 ; 992 985 993 986 waitfor: 994 987 WAITFOR '(' identifier ')' 995 { 996 $$ = new ExpressionNode( new NameExpr( *$3 ) ); 997 delete $3; 998 } 988 { $$ = nullptr; } // FIX ME 999 989 | WAITFOR '(' identifier ',' argument_expression_list ')' 1000 { 1001 $$ = new ExpressionNode( new NameExpr( *$3 ) ); 1002 $$->set_last( $5 ); 1003 delete $3; 1004 } 990 { $$ = nullptr; } // FIX ME 1005 991 ; 1006 992 1007 993 timeout: 1008 994 TIMEOUT '(' comma_expression ')' 1009 { $$ = $3; }995 { $$ = nullptr; } // FIX ME 1010 996 ; 1011 997 1012 998 waitfor_clause: 1013 when_clause_opt waitfor statement %prec THEN1014 { $$ = build_waitfor( $2, $3, $1 ); }999 when_clause_opt waitfor statement %prec THEN 1000 { $$ = nullptr; } // FIX ME 1015 1001 | when_clause_opt waitfor statement WOR waitfor_clause 1016 { $$ = build_waitfor( $2, $3, $1, $5 ); }1017 | when_clause_opt timeout statement %prec THEN1018 { $$ = build_waitfor_timeout( $2, $3, $1 ); }1002 { $$ = nullptr; } // FIX ME 1003 | when_clause_opt timeout statement %prec THEN 1004 { $$ = nullptr; } // FIX ME 1019 1005 | when_clause_opt ELSE statement 1020 { $$ = build_waitfor_timeout( nullptr, $3, $1 ); } 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 1023 { $$ = build_waitfor_timeout( $2, $3, $1, $7, $5 ); } 1006 { $$ = nullptr; } // FIX ME 1007 | when_clause_opt timeout statement WOR when_clause_opt ELSE statement 1008 { $$ = nullptr; } // FIX ME 1024 1009 ; 1025 1010 1026 1011 waitfor_statement: 1027 when_clause_opt waitfor statement %prec THEN1028 { $$ = n ew StatementNode( build_waitfor( $2, $3, $1 ) ); }1012 when_clause_opt waitfor statement %prec THEN 1013 { $$ = nullptr; } // FIX ME 1029 1014 | when_clause_opt waitfor statement WOR waitfor_clause 1030 { $$ = n ew StatementNode( build_waitfor( $2, $3, $1, $5 ) ); }1015 { $$ = nullptr; } // FIX ME 1031 1016 ; 1032 1017
Note:
See TracChangeset
for help on using the changeset viewer.