00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined (octave_tree_loop_h)
00025 #define octave_tree_loop_h 1
00026
00027 class octave_value;
00028 class octave_lvalue;
00029
00030 class tree_argument_list;
00031 class tree_expression;
00032 class tree_statement_list;
00033
00034 class tree_walker;
00035
00036 #include "comment-list.h"
00037 #include "pt-cmd.h"
00038 #include "symtab.h"
00039
00040
00041
00042 class
00043 tree_while_command : public tree_command
00044 {
00045 public:
00046
00047 tree_while_command (int l = -1, int c = -1)
00048 : tree_command (l, c), expr (0), list (0), lead_comm (0),
00049 trail_comm (0) { }
00050
00051 tree_while_command (tree_expression *e,
00052 octave_comment_list *lc = 0,
00053 octave_comment_list *tc = 0,
00054 int l = -1, int c = -1)
00055 : tree_command (l, c), expr (e), list (0), lead_comm (lc),
00056 trail_comm (tc) { }
00057
00058 tree_while_command (tree_expression *e, tree_statement_list *lst,
00059 octave_comment_list *lc = 0,
00060 octave_comment_list *tc = 0,
00061 int l = -1, int c = -1)
00062 : tree_command (l, c), expr (e), list (lst), lead_comm (lc),
00063 trail_comm (tc) { }
00064
00065 ~tree_while_command (void);
00066
00067 tree_expression *condition (void) { return expr; }
00068
00069 tree_statement_list *body (void) { return list; }
00070
00071 octave_comment_list *leading_comment (void) { return lead_comm; }
00072
00073 octave_comment_list *trailing_comment (void) { return trail_comm; }
00074
00075 tree_command *dup (symbol_table::scope_id scope,
00076 symbol_table::context_id context) const;
00077
00078 void accept (tree_walker& tw);
00079
00080 protected:
00081
00082
00083 tree_expression *expr;
00084
00085
00086 tree_statement_list *list;
00087
00088
00089 octave_comment_list *lead_comm;
00090
00091
00092 octave_comment_list *trail_comm;
00093
00094 private:
00095
00096
00097
00098 tree_while_command (const tree_while_command&);
00099
00100 tree_while_command& operator = (const tree_while_command&);
00101 };
00102
00103
00104
00105 class
00106 tree_do_until_command : public tree_while_command
00107 {
00108 public:
00109
00110 tree_do_until_command (int l = -1, int c = -1)
00111 : tree_while_command (l, c) { }
00112
00113 tree_do_until_command (tree_expression *e,
00114 octave_comment_list *lc = 0,
00115 octave_comment_list *tc = 0,
00116 int l = -1, int c = -1)
00117 : tree_while_command (e, lc, tc, l, c) { }
00118
00119 tree_do_until_command (tree_expression *e, tree_statement_list *lst,
00120 octave_comment_list *lc = 0,
00121 octave_comment_list *tc = 0,
00122 int l = -1, int c = -1)
00123 : tree_while_command (e, lst, lc, tc, l, c) { }
00124
00125 ~tree_do_until_command (void) { }
00126
00127 tree_command *dup (symbol_table::scope_id scope,
00128 symbol_table::context_id context) const;
00129
00130 void accept (tree_walker& tw);
00131
00132 private:
00133
00134
00135
00136 tree_do_until_command (const tree_do_until_command&);
00137
00138 tree_do_until_command& operator = (const tree_do_until_command&);
00139 };
00140
00141
00142
00143 class
00144 tree_simple_for_command : public tree_command
00145 {
00146 public:
00147
00148 tree_simple_for_command (int l = -1, int c = -1)
00149 : tree_command (l, c), lhs (0), expr (0), list (0), lead_comm (0),
00150 trail_comm (0) { }
00151
00152 tree_simple_for_command (tree_expression *le, tree_expression *re,
00153 tree_statement_list *lst,
00154 octave_comment_list *lc = 0,
00155 octave_comment_list *tc = 0,
00156 int l = -1, int c = -1)
00157 : tree_command (l, c), lhs (le), expr (re), list (lst),
00158 lead_comm (lc), trail_comm (tc) { }
00159
00160 ~tree_simple_for_command (void);
00161
00162 tree_expression *left_hand_side (void) { return lhs; }
00163
00164 tree_expression *control_expr (void) { return expr; }
00165
00166 tree_statement_list *body (void) { return list; }
00167
00168 octave_comment_list *leading_comment (void) { return lead_comm; }
00169
00170 octave_comment_list *trailing_comment (void) { return trail_comm; }
00171
00172 tree_command *dup (symbol_table::scope_id scope,
00173 symbol_table::context_id context) const;
00174
00175 void accept (tree_walker& tw);
00176
00177 private:
00178
00179
00180 tree_expression *lhs;
00181
00182
00183 tree_expression *expr;
00184
00185
00186 tree_statement_list *list;
00187
00188
00189 octave_comment_list *lead_comm;
00190
00191
00192 octave_comment_list *trail_comm;
00193
00194
00195
00196 tree_simple_for_command (const tree_simple_for_command&);
00197
00198 tree_simple_for_command& operator = (const tree_simple_for_command&);
00199 };
00200
00201 class
00202 tree_complex_for_command : public tree_command
00203 {
00204 public:
00205
00206 tree_complex_for_command (int l = -1, int c = -1)
00207 : tree_command (l, c), lhs (0), expr (0), list (0), lead_comm (0),
00208 trail_comm (0) { }
00209
00210 tree_complex_for_command (tree_argument_list *le, tree_expression *re,
00211 tree_statement_list *lst,
00212 octave_comment_list *lc = 0,
00213 octave_comment_list *tc = 0,
00214 int l = -1, int c = -1)
00215 : tree_command (l, c), lhs (le), expr (re), list (lst),
00216 lead_comm (lc), trail_comm (tc) { }
00217
00218 ~tree_complex_for_command (void);
00219
00220 tree_argument_list *left_hand_side (void) { return lhs; }
00221
00222 tree_expression *control_expr (void) { return expr; }
00223
00224 tree_statement_list *body (void) { return list; }
00225
00226 octave_comment_list *leading_comment (void) { return lead_comm; }
00227
00228 octave_comment_list *trailing_comment (void) { return trail_comm; }
00229
00230 tree_command *dup (symbol_table::scope_id scope,
00231 symbol_table::context_id context) const;
00232
00233 void accept (tree_walker& tw);
00234
00235 private:
00236
00237
00238 tree_argument_list *lhs;
00239
00240
00241 tree_expression *expr;
00242
00243
00244 tree_statement_list *list;
00245
00246
00247 octave_comment_list *lead_comm;
00248
00249
00250 octave_comment_list *trail_comm;
00251
00252
00253
00254 tree_complex_for_command (const tree_complex_for_command&);
00255
00256 tree_complex_for_command& operator = (const tree_complex_for_command&);
00257 };
00258
00259 #endif
00260
00261
00262
00263
00264
00265