Mercurial > hg > octave-jordi
annotate src/pt-unop.h @ 8874:bd1b1fe9c6e9 ss-3-1-53
bump version info for snapshot
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 25 Feb 2009 18:35:47 -0500 |
parents | 73c4516fae10 |
children | 35cd375d4bb3 |
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 | |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7767
diff
changeset
|
57 bool is_unary_expression (void) const { return true; } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7767
diff
changeset
|
58 |
4267 | 59 bool has_magic_end (void) const { return (op && op->has_magic_end ()); } |
60 | |
2980 | 61 tree_expression *operand (void) { return op; } |
62 | |
3523 | 63 std::string oper (void) const; |
7087 | 64 |
65 octave_value::unary_op op_type (void) const { return etype; } | |
3203 | 66 |
2980 | 67 protected: |
68 | |
69 // The operand for the expression. | |
70 tree_expression *op; | |
2988 | 71 |
3203 | 72 // The type of the expression. |
73 octave_value::unary_op etype; | |
74 | |
75 private: | |
76 | |
2988 | 77 // No copying! |
78 | |
79 tree_unary_expression (const tree_unary_expression&); | |
80 | |
81 tree_unary_expression& operator = (const tree_unary_expression&); | |
2980 | 82 }; |
83 | |
84 // Prefix expressions. | |
85 | |
86 class | |
87 tree_prefix_expression : public tree_unary_expression | |
88 { | |
89 public: | |
90 | |
91 tree_prefix_expression (int l = -1, int c = -1) | |
3203 | 92 : tree_unary_expression (l, c, octave_value::unknown_unary_op) { } |
2980 | 93 |
3195 | 94 tree_prefix_expression (tree_expression *e, int l = -1, int c = -1, |
3203 | 95 octave_value::unary_op t |
96 = octave_value::unknown_unary_op) | |
97 : tree_unary_expression (e, l, c, t) { } | |
2980 | 98 |
99 ~tree_prefix_expression (void) { } | |
100 | |
3933 | 101 bool rvalue_ok (void) const { return true; } |
2980 | 102 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
103 octave_value rvalue1 (int nargout = 1); |
2980 | 104 |
3010 | 105 octave_value_list rvalue (int nargout); |
2980 | 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 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
140 octave_value rvalue1 (int nargout = 1); |
2980 | 141 |
142 octave_value_list rvalue (int nargout); | |
143 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
144 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
|
145 symbol_table::context_id context); |
5861 | 146 |
2980 | 147 void accept (tree_walker& tw); |
148 | |
149 private: | |
150 | |
2988 | 151 // No copying! |
152 | |
153 tree_postfix_expression (const tree_postfix_expression&); | |
154 | |
155 tree_postfix_expression& operator = (const tree_postfix_expression&); | |
2980 | 156 }; |
157 | |
158 #endif | |
159 | |
160 /* | |
161 ;;; Local Variables: *** | |
162 ;;; mode: C++ *** | |
163 ;;; End: *** | |
164 */ |