Mercurial > hg > octave-nkf
annotate src/pt-loop.h @ 12432:455f2db40a8f release-3-4-x
update NEWS
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 09 Feb 2011 16:29:14 -0500 |
parents | fd0a3ac60b0e |
children | 027a2186cd90 |
rev | line source |
---|---|
2982 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1996-2011 John W. Eaton |
2982 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2982 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2982 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_tree_loop_h) | |
24 #define octave_tree_loop_h 1 | |
25 | |
26 class octave_value; | |
27 class octave_lvalue; | |
28 | |
29 class tree_argument_list; | |
30 class tree_expression; | |
31 class tree_statement_list; | |
32 | |
33 class tree_walker; | |
34 | |
3665 | 35 #include "comment-list.h" |
2982 | 36 #include "pt-cmd.h" |
7336 | 37 #include "symtab.h" |
2982 | 38 |
39 // While. | |
40 | |
41 class | |
42 tree_while_command : public tree_command | |
43 { | |
44 public: | |
45 | |
46 tree_while_command (int l = -1, int c = -1) | |
3665 | 47 : tree_command (l, c), expr (0), list (0), lead_comm (0), |
48 trail_comm (0) { } | |
2982 | 49 |
3665 | 50 tree_while_command (tree_expression *e, |
10313 | 51 octave_comment_list *lc = 0, |
52 octave_comment_list *tc = 0, | |
53 int l = -1, int c = -1) | |
3665 | 54 : tree_command (l, c), expr (e), list (0), lead_comm (lc), |
55 trail_comm (tc) { } | |
2982 | 56 |
57 tree_while_command (tree_expression *e, tree_statement_list *lst, | |
10313 | 58 octave_comment_list *lc = 0, |
59 octave_comment_list *tc = 0, | |
60 int l = -1, int c = -1) | |
3665 | 61 : tree_command (l, c), expr (e), list (lst), lead_comm (lc), |
62 trail_comm (tc) { } | |
2982 | 63 |
64 ~tree_while_command (void); | |
65 | |
66 tree_expression *condition (void) { return expr; } | |
67 | |
68 tree_statement_list *body (void) { return list; } | |
69 | |
3665 | 70 octave_comment_list *leading_comment (void) { return lead_comm; } |
71 | |
72 octave_comment_list *trailing_comment (void) { return trail_comm; } | |
73 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
74 tree_command *dup (symbol_table::scope_id scope, |
10313 | 75 symbol_table::context_id context) const; |
5861 | 76 |
2982 | 77 void accept (tree_walker& tw); |
78 | |
3484 | 79 protected: |
2982 | 80 |
81 // Expression to test. | |
82 tree_expression *expr; | |
83 | |
84 // List of commands to execute. | |
85 tree_statement_list *list; | |
2988 | 86 |
3665 | 87 // Comment preceding WHILE token. |
88 octave_comment_list *lead_comm; | |
89 | |
90 // Comment preceding ENDWHILE token. | |
91 octave_comment_list *trail_comm; | |
92 | |
3484 | 93 private: |
94 | |
2988 | 95 // No copying! |
96 | |
97 tree_while_command (const tree_while_command&); | |
98 | |
99 tree_while_command& operator = (const tree_while_command&); | |
2982 | 100 }; |
101 | |
3484 | 102 // Do-Until. |
103 | |
104 class | |
105 tree_do_until_command : public tree_while_command | |
106 { | |
107 public: | |
108 | |
109 tree_do_until_command (int l = -1, int c = -1) | |
110 : tree_while_command (l, c) { } | |
111 | |
3665 | 112 tree_do_until_command (tree_expression *e, |
10313 | 113 octave_comment_list *lc = 0, |
114 octave_comment_list *tc = 0, | |
115 int l = -1, int c = -1) | |
3665 | 116 : tree_while_command (e, lc, tc, l, c) { } |
3484 | 117 |
118 tree_do_until_command (tree_expression *e, tree_statement_list *lst, | |
10313 | 119 octave_comment_list *lc = 0, |
120 octave_comment_list *tc = 0, | |
121 int l = -1, int c = -1) | |
3665 | 122 : tree_while_command (e, lst, lc, tc, l, c) { } |
3484 | 123 |
124 ~tree_do_until_command (void) { } | |
125 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
126 tree_command *dup (symbol_table::scope_id scope, |
10313 | 127 symbol_table::context_id context) const; |
5861 | 128 |
3484 | 129 void accept (tree_walker& tw); |
130 | |
131 private: | |
132 | |
133 // No copying! | |
134 | |
135 tree_do_until_command (const tree_do_until_command&); | |
136 | |
137 tree_do_until_command& operator = (const tree_do_until_command&); | |
138 }; | |
139 | |
2982 | 140 // For. |
141 | |
142 class | |
143 tree_simple_for_command : public tree_command | |
144 { | |
145 public: | |
146 | |
147 tree_simple_for_command (int l = -1, int c = -1) | |
3665 | 148 : tree_command (l, c), lhs (0), expr (0), list (0), lead_comm (0), |
149 trail_comm (0) { } | |
2982 | 150 |
151 tree_simple_for_command (tree_expression *le, tree_expression *re, | |
10313 | 152 tree_statement_list *lst, |
153 octave_comment_list *lc = 0, | |
154 octave_comment_list *tc = 0, | |
155 int l = -1, int c = -1) | |
3665 | 156 : tree_command (l, c), lhs (le), expr (re), list (lst), |
157 lead_comm (lc), trail_comm (tc) { } | |
2982 | 158 |
159 ~tree_simple_for_command (void); | |
160 | |
161 tree_expression *left_hand_side (void) { return lhs; } | |
162 | |
163 tree_expression *control_expr (void) { return expr; } | |
164 | |
165 tree_statement_list *body (void) { return list; } | |
166 | |
3665 | 167 octave_comment_list *leading_comment (void) { return lead_comm; } |
168 | |
169 octave_comment_list *trailing_comment (void) { return trail_comm; } | |
170 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
171 tree_command *dup (symbol_table::scope_id scope, |
10313 | 172 symbol_table::context_id context) const; |
5861 | 173 |
2982 | 174 void accept (tree_walker& tw); |
175 | |
176 private: | |
177 | |
178 // Expression to modify. | |
179 tree_expression *lhs; | |
180 | |
181 // Expression to evaluate. | |
182 tree_expression *expr; | |
183 | |
184 // List of commands to execute. | |
185 tree_statement_list *list; | |
186 | |
3665 | 187 // Comment preceding FOR token. |
188 octave_comment_list *lead_comm; | |
189 | |
190 // Comment preceding ENDFOR token. | |
191 octave_comment_list *trail_comm; | |
192 | |
2988 | 193 // No copying! |
194 | |
195 tree_simple_for_command (const tree_simple_for_command&); | |
196 | |
197 tree_simple_for_command& operator = (const tree_simple_for_command&); | |
2982 | 198 }; |
199 | |
200 class | |
201 tree_complex_for_command : public tree_command | |
202 { | |
203 public: | |
204 | |
205 tree_complex_for_command (int l = -1, int c = -1) | |
3665 | 206 : tree_command (l, c), lhs (0), expr (0), list (0), lead_comm (0), |
207 trail_comm (0) { } | |
2982 | 208 |
209 tree_complex_for_command (tree_argument_list *le, tree_expression *re, | |
10313 | 210 tree_statement_list *lst, |
211 octave_comment_list *lc = 0, | |
212 octave_comment_list *tc = 0, | |
213 int l = -1, int c = -1) | |
3665 | 214 : tree_command (l, c), lhs (le), expr (re), list (lst), |
215 lead_comm (lc), trail_comm (tc) { } | |
2982 | 216 |
217 ~tree_complex_for_command (void); | |
218 | |
219 tree_argument_list *left_hand_side (void) { return lhs; } | |
220 | |
221 tree_expression *control_expr (void) { return expr; } | |
222 | |
223 tree_statement_list *body (void) { return list; } | |
224 | |
3665 | 225 octave_comment_list *leading_comment (void) { return lead_comm; } |
226 | |
227 octave_comment_list *trailing_comment (void) { return trail_comm; } | |
228 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
229 tree_command *dup (symbol_table::scope_id scope, |
10313 | 230 symbol_table::context_id context) const; |
5861 | 231 |
2982 | 232 void accept (tree_walker& tw); |
233 | |
234 private: | |
235 | |
236 // Expression to modify. | |
237 tree_argument_list *lhs; | |
238 | |
239 // Expression to evaluate. | |
240 tree_expression *expr; | |
241 | |
242 // List of commands to execute. | |
243 tree_statement_list *list; | |
244 | |
3665 | 245 // Comment preceding FOR token. |
246 octave_comment_list *lead_comm; | |
247 | |
248 // Comment preceding ENDFOR token. | |
249 octave_comment_list *trail_comm; | |
250 | |
2988 | 251 // No copying! |
252 | |
253 tree_complex_for_command (const tree_complex_for_command&); | |
254 | |
255 tree_complex_for_command& operator = (const tree_complex_for_command&); | |
2982 | 256 }; |
257 | |
258 #endif |