2887
|
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_indirect_ref_h) |
|
24 #define octave_tree_indirect_ref_h 1 |
|
25 |
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 class ostream; |
|
31 |
|
32 #include <string> |
|
33 |
2942
|
34 class octave_value; |
|
35 class octave_value_list; |
2887
|
36 class tree_walker; |
|
37 |
2980
|
38 #include "pt-exp.h" |
2887
|
39 |
|
40 // Indirect references to values (structure references). |
|
41 |
|
42 class |
2971
|
43 tree_indirect_ref : public tree_expression |
2887
|
44 { |
|
45 public: |
|
46 |
|
47 tree_indirect_ref (int l = -1, int c = -1) |
2971
|
48 : tree_expression (l, c), expr (0), nm () { } |
2887
|
49 |
2971
|
50 tree_indirect_ref (tree_expression *e, const string& n, |
2887
|
51 int l = -1, int c = -1) |
2971
|
52 : tree_expression (l, c), expr (e), nm (n) { } |
2887
|
53 |
|
54 ~tree_indirect_ref (void); |
|
55 |
|
56 bool is_indirect_ref (void) const |
|
57 { return true; } |
|
58 |
|
59 string name (void) const; |
|
60 |
3010
|
61 bool lvalue_ok (void) const |
2971
|
62 { return true; } |
|
63 |
|
64 octave_value rvalue (void); |
2887
|
65 |
2971
|
66 octave_value_list rvalue (int nargout); |
2887
|
67 |
2979
|
68 octave_lvalue lvalue (void); |
2971
|
69 |
|
70 tree_expression *expression (void) |
|
71 { return expr; } |
2887
|
72 |
|
73 string elt_name (void) |
|
74 { return nm; } |
|
75 |
|
76 void accept (tree_walker& tw); |
|
77 |
|
78 private: |
|
79 |
2971
|
80 // The LHS of this structure reference. |
|
81 tree_expression *expr; |
2887
|
82 |
|
83 // The sub-element name. |
|
84 string nm; |
2972
|
85 |
|
86 void eval_error (void) const; |
2988
|
87 |
|
88 // No copying! |
|
89 |
|
90 tree_indirect_ref (const tree_indirect_ref&); |
|
91 |
|
92 tree_indirect_ref& operator = (const tree_indirect_ref&); |
2887
|
93 }; |
|
94 |
|
95 #endif |
|
96 |
|
97 /* |
|
98 ;;; Local Variables: *** |
|
99 ;;; mode: C++ *** |
|
100 ;;; End: *** |
|
101 */ |