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_unop_h)
00025 #define octave_tree_unop_h 1
00026
00027 #include <string>
00028
00029 class tree_walker;
00030
00031 class octave_value;
00032 class octave_value_list;
00033 class octave_lvalue;
00034
00035 #include "pt-exp.h"
00036 #include "symtab.h"
00037
00038
00039
00040 class
00041 tree_unary_expression : public tree_expression
00042 {
00043 public:
00044
00045 tree_unary_expression (int l = -1, int c = -1,
00046 octave_value::unary_op t
00047 = octave_value::unknown_unary_op)
00048 : tree_expression (l, c), op (0), etype (t) { }
00049
00050 tree_unary_expression (tree_expression *e, int l = -1, int c = -1,
00051 octave_value::unary_op t
00052 = octave_value::unknown_unary_op)
00053 : tree_expression (l, c), op (e), etype (t) { }
00054
00055 ~tree_unary_expression (void) { delete op; }
00056
00057 bool is_unary_expression (void) const { return true; }
00058
00059 bool has_magic_end (void) const { return (op && op->has_magic_end ()); }
00060
00061 tree_expression *operand (void) { return op; }
00062
00063 std::string oper (void) const;
00064
00065 octave_value::unary_op op_type (void) const { return etype; }
00066
00067 protected:
00068
00069
00070 tree_expression *op;
00071
00072
00073 octave_value::unary_op etype;
00074
00075 private:
00076
00077
00078
00079 tree_unary_expression (const tree_unary_expression&);
00080
00081 tree_unary_expression& operator = (const tree_unary_expression&);
00082 };
00083
00084
00085
00086 class
00087 tree_prefix_expression : public tree_unary_expression
00088 {
00089 public:
00090
00091 tree_prefix_expression (int l = -1, int c = -1)
00092 : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
00093
00094 tree_prefix_expression (tree_expression *e, int l = -1, int c = -1,
00095 octave_value::unary_op t
00096 = octave_value::unknown_unary_op)
00097 : tree_unary_expression (e, l, c, t) { }
00098
00099 ~tree_prefix_expression (void) { }
00100
00101 bool rvalue_ok (void) const { return true; }
00102
00103 octave_value rvalue1 (int nargout = 1);
00104
00105 octave_value_list rvalue (int nargout);
00106
00107 tree_expression *dup (symbol_table::scope_id scope,
00108 symbol_table::context_id context) const;
00109
00110 void accept (tree_walker& tw);
00111
00112 private:
00113
00114
00115
00116 tree_prefix_expression (const tree_prefix_expression&);
00117
00118 tree_prefix_expression& operator = (const tree_prefix_expression&);
00119 };
00120
00121
00122
00123 class
00124 tree_postfix_expression : public tree_unary_expression
00125 {
00126 public:
00127
00128 tree_postfix_expression (int l = -1, int c = -1)
00129 : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
00130
00131 tree_postfix_expression (tree_expression *e, int l = -1, int c = -1,
00132 octave_value::unary_op t
00133 = octave_value::unknown_unary_op)
00134 : tree_unary_expression (e, l, c, t) { }
00135
00136 ~tree_postfix_expression (void) { }
00137
00138 bool rvalue_ok (void) const { return true; }
00139
00140 octave_value rvalue1 (int nargout = 1);
00141
00142 octave_value_list rvalue (int nargout);
00143
00144 tree_expression *dup (symbol_table::scope_id scope,
00145 symbol_table::context_id context) const;
00146
00147 void accept (tree_walker& tw);
00148
00149 private:
00150
00151
00152
00153 tree_postfix_expression (const tree_postfix_expression&);
00154
00155 tree_postfix_expression& operator = (const tree_postfix_expression&);
00156 };
00157
00158 #endif
00159
00160
00161
00162
00163
00164