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_select_h)
00025 #define octave_tree_select_h 1
00026
00027 class expression;
00028 class tree_statement_list;
00029
00030 class tree_walker;
00031
00032 #include "base-list.h"
00033 #include "comment-list.h"
00034 #include "pt-cmd.h"
00035 #include "symtab.h"
00036
00037
00038
00039 class
00040 tree_if_clause : public tree
00041 {
00042 public:
00043
00044 tree_if_clause (int l = -1, int c = -1)
00045 : tree (l, c), expr (0), list (0), lead_comm (0) { }
00046
00047 tree_if_clause (tree_statement_list *sl, octave_comment_list *lc = 0,
00048 int l = -1, int c = -1)
00049 : tree (l, c), expr (0), list (sl), lead_comm (lc) { }
00050
00051 tree_if_clause (tree_expression *e, tree_statement_list *sl,
00052 octave_comment_list *lc = 0,
00053 int l = -1, int c = -1)
00054 : tree (l, c), expr (e), list (sl), lead_comm (lc) { }
00055
00056 ~tree_if_clause (void);
00057
00058 bool is_else_clause (void) { return ! expr; }
00059
00060 tree_expression *condition (void) { return expr; }
00061
00062 tree_statement_list *commands (void) { return list; }
00063
00064 octave_comment_list *leading_comment (void) { return lead_comm; }
00065
00066 tree_if_clause *dup (symbol_table::scope_id scope,
00067 symbol_table::context_id context) const;
00068
00069 void accept (tree_walker& tw);
00070
00071 private:
00072
00073
00074 tree_expression *expr;
00075
00076
00077 tree_statement_list *list;
00078
00079
00080 octave_comment_list *lead_comm;
00081
00082
00083
00084 tree_if_clause (const tree_if_clause&);
00085
00086 tree_if_clause& operator = (const tree_if_clause&);
00087 };
00088
00089 class
00090 tree_if_command_list : public octave_base_list<tree_if_clause *>
00091 {
00092 public:
00093
00094 tree_if_command_list (void) { }
00095
00096 tree_if_command_list (tree_if_clause *t) { append (t); }
00097
00098 ~tree_if_command_list (void)
00099 {
00100 while (! empty ())
00101 {
00102 iterator p = begin ();
00103 delete *p;
00104 erase (p);
00105 }
00106 }
00107
00108 tree_if_command_list *dup (symbol_table::scope_id scope,
00109 symbol_table::context_id context) const;
00110
00111 void accept (tree_walker& tw);
00112
00113 private:
00114
00115
00116
00117 tree_if_command_list (const tree_if_command_list&);
00118
00119 tree_if_command_list& operator = (const tree_if_command_list&);
00120 };
00121
00122 class
00123 tree_if_command : public tree_command
00124 {
00125 public:
00126
00127 tree_if_command (int l = -1, int c = -1)
00128 : tree_command (l, c), list (0), lead_comm (0), trail_comm (0) { }
00129
00130 tree_if_command (tree_if_command_list *lst, octave_comment_list *lc,
00131 octave_comment_list *tc, int l = -1, int c = -1)
00132 : tree_command (l, c), list (lst), lead_comm (lc), trail_comm (tc) { }
00133
00134 ~tree_if_command (void);
00135
00136 void set_breakpoint (void);
00137
00138 void delete_breakpoint (void);
00139
00140 tree_if_command_list *cmd_list (void) { return list; }
00141
00142 octave_comment_list *leading_comment (void) { return lead_comm; }
00143
00144 octave_comment_list *trailing_comment (void) { return trail_comm; }
00145
00146 tree_command *dup (symbol_table::scope_id scope,
00147 symbol_table::context_id context) const;
00148
00149 void accept (tree_walker& tw);
00150
00151 private:
00152
00153
00154 tree_if_command_list *list;
00155
00156
00157 octave_comment_list *lead_comm;
00158
00159
00160 octave_comment_list *trail_comm;
00161
00162
00163
00164 tree_if_command (const tree_if_command&);
00165
00166 tree_if_command& operator = (const tree_if_command&);
00167 };
00168
00169
00170
00171 class
00172 tree_switch_case : public tree
00173 {
00174 public:
00175
00176 tree_switch_case (int l = -1, int c = -1)
00177 : tree (l, c), label (0), list (0), lead_comm (0) { }
00178
00179 tree_switch_case (tree_statement_list *sl, octave_comment_list *lc = 0,
00180 int l = -1, int c = -1)
00181 : tree (l, c), label (0), list (sl), lead_comm (lc) { }
00182
00183 tree_switch_case (tree_expression *e, tree_statement_list *sl,
00184 octave_comment_list *lc = 0,
00185 int l = -1, int c = -1)
00186 : tree (l, c), label (e), list (sl), lead_comm (lc) { }
00187
00188 ~tree_switch_case (void);
00189
00190 bool is_default_case (void) { return ! label; }
00191
00192 bool label_matches (const octave_value& val);
00193
00194 tree_expression *case_label (void) { return label; }
00195
00196 tree_statement_list *commands (void) { return list; }
00197
00198 octave_comment_list *leading_comment (void) { return lead_comm; }
00199
00200 tree_switch_case *dup (symbol_table::scope_id scope,
00201 symbol_table::context_id context) const;
00202
00203 void accept (tree_walker& tw);
00204
00205 private:
00206
00207
00208 tree_expression *label;
00209
00210
00211 tree_statement_list *list;
00212
00213
00214 octave_comment_list *lead_comm;
00215
00216
00217
00218 tree_switch_case (const tree_switch_case&);
00219
00220 tree_switch_case& operator = (const tree_switch_case&);
00221 };
00222
00223 class
00224 tree_switch_case_list : public octave_base_list<tree_switch_case *>
00225 {
00226 public:
00227
00228 tree_switch_case_list (void) { }
00229
00230 tree_switch_case_list (tree_switch_case *t) { append (t); }
00231
00232 ~tree_switch_case_list (void)
00233 {
00234 while (! empty ())
00235 {
00236 iterator p = begin ();
00237 delete *p;
00238 erase (p);
00239 }
00240 }
00241
00242 tree_switch_case_list *dup (symbol_table::scope_id scope,
00243 symbol_table::context_id context) const;
00244
00245 void accept (tree_walker& tw);
00246
00247 private:
00248
00249
00250
00251 tree_switch_case_list (const tree_switch_case_list&);
00252
00253 tree_switch_case_list& operator = (const tree_switch_case_list&);
00254 };
00255
00256 class
00257 tree_switch_command : public tree_command
00258 {
00259 public:
00260
00261 tree_switch_command (int l = -1, int c = -1)
00262 : tree_command (l, c), expr (0), list (0), lead_comm (0),
00263 trail_comm (0) { }
00264
00265 tree_switch_command (tree_expression *e, tree_switch_case_list *lst,
00266 octave_comment_list *lc, octave_comment_list *tc,
00267 int l = -1, int c = -1)
00268 : tree_command (l, c), expr (e), list (lst), lead_comm (lc),
00269 trail_comm (tc) { }
00270
00271 ~tree_switch_command (void);
00272
00273 void set_breakpoint (void);
00274
00275 void delete_breakpoint (void);
00276
00277 tree_expression *switch_value (void) { return expr; }
00278
00279 tree_switch_case_list *case_list (void) { return list; }
00280
00281 octave_comment_list *leading_comment (void) { return lead_comm; }
00282
00283 octave_comment_list *trailing_comment (void) { return trail_comm; }
00284
00285 tree_command *dup (symbol_table::scope_id scope,
00286 symbol_table::context_id context) const;
00287
00288 void accept (tree_walker& tw);
00289
00290 private:
00291
00292
00293 tree_expression *expr;
00294
00295
00296 tree_switch_case_list *list;
00297
00298
00299 octave_comment_list *lead_comm;
00300
00301
00302 octave_comment_list *trail_comm;
00303
00304
00305
00306 tree_switch_command (const tree_switch_command&);
00307
00308 tree_switch_command& operator = (const tree_switch_command&);
00309 };
00310
00311 #endif
00312
00313
00314
00315
00316
00317