2982
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
4192
|
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
2982
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
|
31 #include "error.h" |
3770
|
32 #include "oct-obj.h" |
|
33 #include "pt-bp.h" |
2982
|
34 #include "pt-jump.h" |
|
35 #include "pt-walk.h" |
|
36 |
3770
|
37 class octave_value_list; |
|
38 |
2982
|
39 // Break. |
|
40 |
2985
|
41 // Nonzero means we're breaking out of a loop or function body. |
4173
|
42 int tree_break_expression::breaking = 0; |
2985
|
43 |
4173
|
44 octave_value |
|
45 tree_break_expression::rvalue (void) |
2982
|
46 { |
3770
|
47 // Even if we have an error we should still enter debug mode. |
|
48 MAYBE_DO_BREAKPOINT; |
|
49 |
2982
|
50 if (! error_state) |
|
51 breaking = 1; |
4173
|
52 |
|
53 return true; |
2982
|
54 } |
|
55 |
|
56 void |
4173
|
57 tree_break_expression::accept (tree_walker& tw) |
2982
|
58 { |
4173
|
59 tw.visit_break_expression (*this); |
2982
|
60 } |
|
61 |
|
62 // Continue. |
|
63 |
2985
|
64 // Nonzero means we're jumping to the end of a loop. |
4173
|
65 int tree_continue_expression::continuing = 0; |
2985
|
66 |
4173
|
67 octave_value |
|
68 tree_continue_expression::rvalue (void) |
2982
|
69 { |
3770
|
70 MAYBE_DO_BREAKPOINT; |
|
71 |
2982
|
72 if (! error_state) |
|
73 continuing = 1; |
4173
|
74 |
|
75 return true; |
2982
|
76 } |
|
77 |
|
78 void |
4173
|
79 tree_continue_expression::accept (tree_walker& tw) |
2982
|
80 { |
4173
|
81 tw.visit_continue_expression (*this); |
2982
|
82 } |
|
83 |
|
84 // Return. |
|
85 |
2985
|
86 // Nonzero means we're returning from a function. Global because it |
|
87 // is also needed in tree-expr.cc. |
4173
|
88 int tree_return_expression::returning = 0; |
2985
|
89 |
4173
|
90 octave_value |
|
91 tree_return_expression::rvalue (void) |
2982
|
92 { |
3770
|
93 MAYBE_DO_BREAKPOINT; |
|
94 |
2982
|
95 if (! error_state) |
|
96 returning = 1; |
4173
|
97 |
|
98 return true; |
2982
|
99 } |
|
100 |
|
101 void |
4173
|
102 tree_return_expression::accept (tree_walker& tw) |
2982
|
103 { |
4173
|
104 tw.visit_return_expression (*this); |
2982
|
105 } |
|
106 |
|
107 /* |
|
108 ;;; Local Variables: *** |
|
109 ;;; mode: C++ *** |
|
110 ;;; End: *** |
|
111 */ |