Mercurial > octave
comparison src/pt-unop.h @ 2980:cd5ad3fd8049
[project @ 1997-05-16 01:12:13 by jwe]
author | jwe |
---|---|
date | Fri, 16 May 1997 01:13:19 +0000 |
parents | |
children | daa1ed1f5462 |
comparison
equal
deleted
inserted
replaced
2979:a3556d2adec9 | 2980:cd5ad3fd8049 |
---|---|
1 /* | |
2 | |
3 Copyright (C) 1996, 1997 John W. Eaton | |
4 | |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 2, or (at your option) any | |
10 later version. | |
11 | |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with Octave; see the file COPYING. If not, write to the Free | |
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
20 | |
21 */ | |
22 | |
23 #if !defined (octave_tree_unop_h) | |
24 #define octave_tree_unop_h 1 | |
25 | |
26 #if defined (__GNUG__) | |
27 #pragma interface | |
28 #endif | |
29 | |
30 #include <string> | |
31 | |
32 class tree_walker; | |
33 | |
34 class octave_value; | |
35 class octave_value_list; | |
36 class octave_lvalue; | |
37 | |
38 #include "pt-exp.h" | |
39 | |
40 // Unary expressions. | |
41 | |
42 class | |
43 tree_unary_expression : public tree_expression | |
44 { | |
45 public: | |
46 | |
47 tree_unary_expression (int l = -1, int c = -1) | |
48 : tree_expression (l, c), op (0) { } | |
49 | |
50 tree_unary_expression (tree_expression *e, int l = -1, int c = -1) | |
51 : tree_expression (l, c), op (e) { } | |
52 | |
53 ~tree_unary_expression (void) { delete op; } | |
54 | |
55 tree_expression *operand (void) { return op; } | |
56 | |
57 protected: | |
58 | |
59 // The operand for the expression. | |
60 tree_expression *op; | |
61 }; | |
62 | |
63 // Prefix expressions. | |
64 | |
65 class | |
66 tree_prefix_expression : public tree_unary_expression | |
67 { | |
68 public: | |
69 | |
70 enum type | |
71 { | |
72 unknown, | |
73 unot, | |
74 uminus, | |
75 increment, | |
76 decrement | |
77 }; | |
78 | |
79 tree_prefix_expression (int l = -1, int c = -1) | |
80 : tree_unary_expression (l, c), etype (unknown) { } | |
81 | |
82 tree_prefix_expression (type t = unknown, tree_expression *e, | |
83 int l = -1, int c = -1) | |
84 : tree_unary_expression (e, l, c), etype (t) { } | |
85 | |
86 ~tree_prefix_expression (void) { } | |
87 | |
88 bool rvalue_ok (void) const | |
89 { return true; } | |
90 | |
91 octave_value rvalue (void); | |
92 | |
93 octave_value_list rvalue (int nargou); | |
94 | |
95 void eval_error (void); | |
96 | |
97 string oper (void) const; | |
98 | |
99 void accept (tree_walker& tw); | |
100 | |
101 private: | |
102 | |
103 // The type of the expression. | |
104 type etype; | |
105 }; | |
106 | |
107 // Postfix expressions. | |
108 | |
109 class | |
110 tree_postfix_expression : public tree_unary_expression | |
111 { | |
112 public: | |
113 | |
114 enum type | |
115 { | |
116 unknown, | |
117 hermitian, | |
118 transpose, | |
119 increment, | |
120 decrement | |
121 }; | |
122 | |
123 tree_postfix_expression (int l = -1, int c = -1) | |
124 : tree_unary_expression (l, c), etype (unknown) { } | |
125 | |
126 tree_postfix_expression (type t = unknown, tree_expression *e, | |
127 int l = -1, int c = -1) | |
128 : tree_unary_expression (e, l, c), etype (t) { } | |
129 | |
130 ~tree_postfix_expression (void) { } | |
131 | |
132 bool rvalue_ok (void) const | |
133 { return true; } | |
134 | |
135 octave_value rvalue (void); | |
136 | |
137 octave_value_list rvalue (int nargout); | |
138 | |
139 void eval_error (void); | |
140 | |
141 string oper (void) const; | |
142 | |
143 void accept (tree_walker& tw); | |
144 | |
145 private: | |
146 | |
147 // The type of the expression. | |
148 type etype; | |
149 }; | |
150 | |
151 #endif | |
152 | |
153 /* | |
154 ;;; Local Variables: *** | |
155 ;;; mode: C++ *** | |
156 ;;; End: *** | |
157 */ |