Mercurial > hg > octave-jordi
annotate src/pt-unop.h @ 7767:71f068b22fcc
scope and context fixes for function handles
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 07 May 2008 13:45:30 -0400 |
parents | 745a8299c2b5 |
children | 5861b95e9879 |
rev | line source |
---|---|
2980 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, |
4 2007 John W. Eaton | |
2980 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2980 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2980 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_tree_unop_h) | |
25 #define octave_tree_unop_h 1 | |
26 | |
27 #include <string> | |
28 | |
29 class tree_walker; | |
30 | |
31 class octave_value; | |
32 class octave_value_list; | |
33 class octave_lvalue; | |
34 | |
35 #include "pt-exp.h" | |
7336 | 36 #include "symtab.h" |
2980 | 37 |
38 // Unary expressions. | |
39 | |
40 class | |
41 tree_unary_expression : public tree_expression | |
42 { | |
43 public: | |
44 | |
3203 | 45 tree_unary_expression (int l = -1, int c = -1, |
46 octave_value::unary_op t | |
47 = octave_value::unknown_unary_op) | |
48 : tree_expression (l, c), op (0), etype (t) { } | |
2980 | 49 |
3203 | 50 tree_unary_expression (tree_expression *e, int l = -1, int c = -1, |
51 octave_value::unary_op t | |
52 = octave_value::unknown_unary_op) | |
53 : tree_expression (l, c), op (e), etype (t) { } | |
2980 | 54 |
55 ~tree_unary_expression (void) { delete op; } | |
56 | |
4267 | 57 bool has_magic_end (void) const { return (op && op->has_magic_end ()); } |
58 | |
2980 | 59 tree_expression *operand (void) { return op; } |
60 | |
3523 | 61 std::string oper (void) const; |
7087 | 62 |
63 octave_value::unary_op op_type (void) const { return etype; } | |
3203 | 64 |
2980 | 65 protected: |
66 | |
67 // The operand for the expression. | |
68 tree_expression *op; | |
2988 | 69 |
3203 | 70 // The type of the expression. |
71 octave_value::unary_op etype; | |
72 | |
73 private: | |
74 | |
2988 | 75 // No copying! |
76 | |
77 tree_unary_expression (const tree_unary_expression&); | |
78 | |
79 tree_unary_expression& operator = (const tree_unary_expression&); | |
2980 | 80 }; |
81 | |
82 // Prefix expressions. | |
83 | |
84 class | |
85 tree_prefix_expression : public tree_unary_expression | |
86 { | |
87 public: | |
88 | |
89 tree_prefix_expression (int l = -1, int c = -1) | |
3203 | 90 : tree_unary_expression (l, c, octave_value::unknown_unary_op) { } |
2980 | 91 |
3195 | 92 tree_prefix_expression (tree_expression *e, int l = -1, int c = -1, |
3203 | 93 octave_value::unary_op t |
94 = octave_value::unknown_unary_op) | |
95 : tree_unary_expression (e, l, c, t) { } | |
2980 | 96 |
97 ~tree_prefix_expression (void) { } | |
98 | |
3933 | 99 bool rvalue_ok (void) const { return true; } |
2980 | 100 |
101 octave_value rvalue (void); | |
102 | |
3010 | 103 octave_value_list rvalue (int nargout); |
2980 | 104 |
105 void eval_error (void); | |
106 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
107 tree_expression *dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
108 symbol_table::context_id context); |
5861 | 109 |
2980 | 110 void accept (tree_walker& tw); |
111 | |
112 private: | |
113 | |
2988 | 114 // No copying! |
115 | |
116 tree_prefix_expression (const tree_prefix_expression&); | |
117 | |
118 tree_prefix_expression& operator = (const tree_prefix_expression&); | |
2980 | 119 }; |
120 | |
121 // Postfix expressions. | |
122 | |
123 class | |
124 tree_postfix_expression : public tree_unary_expression | |
125 { | |
126 public: | |
127 | |
128 tree_postfix_expression (int l = -1, int c = -1) | |
3203 | 129 : tree_unary_expression (l, c, octave_value::unknown_unary_op) { } |
2980 | 130 |
3195 | 131 tree_postfix_expression (tree_expression *e, int l = -1, int c = -1, |
3203 | 132 octave_value::unary_op t |
133 = octave_value::unknown_unary_op) | |
134 : tree_unary_expression (e, l, c, t) { } | |
2980 | 135 |
136 ~tree_postfix_expression (void) { } | |
137 | |
3933 | 138 bool rvalue_ok (void) const { return true; } |
2980 | 139 |
140 octave_value rvalue (void); | |
141 | |
142 octave_value_list rvalue (int nargout); | |
143 | |
144 void eval_error (void); | |
145 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
146 tree_expression *dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
147 symbol_table::context_id context); |
5861 | 148 |
2980 | 149 void accept (tree_walker& tw); |
150 | |
151 private: | |
152 | |
2988 | 153 // No copying! |
154 | |
155 tree_postfix_expression (const tree_postfix_expression&); | |
156 | |
157 tree_postfix_expression& operator = (const tree_postfix_expression&); | |
2980 | 158 }; |
159 | |
160 #endif | |
161 | |
162 /* | |
163 ;;; Local Variables: *** | |
164 ;;; mode: C++ *** | |
165 ;;; End: *** | |
166 */ |