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