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_assign_h)
00025 #define octave_tree_assign_h 1
00026
00027 #include <iosfwd>
00028 #include <string>
00029
00030 class tree_argument_list;
00031 class tree_walker;
00032
00033 class octave_value;
00034 class octave_value_list;
00035 class octave_lvalue;
00036
00037 #include "ov.h"
00038 #include "pt-exp.h"
00039 #include "symtab.h"
00040
00041
00042
00043 class
00044 tree_simple_assignment : public tree_expression
00045 {
00046 public:
00047
00048 tree_simple_assignment (bool plhs = false, int l = -1, int c = -1,
00049 octave_value::assign_op t = octave_value::op_asn_eq)
00050 : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), etype (t),
00051 first_execution (true) { }
00052
00053 tree_simple_assignment (tree_expression *le, tree_expression *re,
00054 bool plhs = false, int l = -1, int c = -1,
00055 octave_value::assign_op t = octave_value::op_asn_eq);
00056
00057 ~tree_simple_assignment (void);
00058
00059 bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
00060
00061 bool rvalue_ok (void) const { return true; }
00062
00063 octave_value rvalue1 (int nargout = 1);
00064
00065 octave_value_list rvalue (int nargout);
00066
00067 bool is_assignment_expression (void) const { return true; }
00068
00069 std::string oper (void) const;
00070
00071 tree_expression *left_hand_side (void) { return lhs; }
00072
00073 tree_expression *right_hand_side (void) { return rhs; }
00074
00075 tree_expression *dup (symbol_table::scope_id scope,
00076 symbol_table::context_id context) const;
00077
00078 void accept (tree_walker& tw);
00079
00080 octave_value::assign_op op_type (void) const { return etype; }
00081
00082 private:
00083
00084 void do_assign (octave_lvalue& ult, const octave_value_list& args,
00085 const octave_value& rhs_val);
00086
00087 void do_assign (octave_lvalue& ult, const octave_value& rhs_val);
00088
00089
00090 tree_expression *lhs;
00091
00092
00093 tree_expression *rhs;
00094
00095
00096 bool preserve;
00097
00098
00099 bool ans_ass;
00100
00101
00102 octave_value::assign_op etype;
00103
00104
00105 bool first_execution;
00106
00107
00108
00109 tree_simple_assignment (const tree_simple_assignment&);
00110
00111 tree_simple_assignment& operator = (const tree_simple_assignment&);
00112 };
00113
00114
00115
00116 class
00117 tree_multi_assignment : public tree_expression
00118 {
00119 public:
00120
00121 tree_multi_assignment (bool plhs = false, int l = -1, int c = -1,
00122 octave_value::assign_op t = octave_value::op_asn_eq)
00123 : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), etype(t),
00124 first_execution (true) { }
00125
00126 tree_multi_assignment (tree_argument_list *lst, tree_expression *r,
00127 bool plhs = false, int l = -1, int c = -1,
00128 octave_value::assign_op t = octave_value::op_asn_eq);
00129
00130 ~tree_multi_assignment (void);
00131
00132 bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
00133
00134 bool is_assignment_expression (void) const { return true; }
00135
00136 bool rvalue_ok (void) const { return true; }
00137
00138 octave_value rvalue1 (int nargout = 1);
00139
00140 octave_value_list rvalue (int nargout);
00141
00142 std::string oper (void) const;
00143
00144 tree_argument_list *left_hand_side (void) { return lhs; }
00145
00146 tree_expression *right_hand_side (void) { return rhs; }
00147
00148 tree_expression *dup (symbol_table::scope_id scope,
00149 symbol_table::context_id context) const;
00150
00151 void accept (tree_walker& tw);
00152
00153 octave_value::assign_op op_type (void) const { return etype; }
00154
00155 private:
00156
00157
00158 tree_argument_list *lhs;
00159
00160
00161 tree_expression *rhs;
00162
00163
00164 bool preserve;
00165
00166
00167 octave_value::assign_op etype;
00168
00169
00170 bool first_execution;
00171
00172
00173
00174 tree_multi_assignment (const tree_multi_assignment&);
00175
00176 tree_multi_assignment& operator = (const tree_multi_assignment&);
00177 };
00178
00179 #endif
00180
00181
00182
00183
00184
00185