2980
|
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_index_h) |
|
24 #define octave_tree_index_h 1 |
|
25 |
4066
|
26 #if defined (__GNUG__) && ! defined (NO_PRAGMA_INTERFACE_IMPLEMENTATION) |
2980
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 class tree_argument_list; |
|
31 |
|
32 class tree_walker; |
|
33 |
3933
|
34 class Octave_map; |
2980
|
35 class octave_value; |
|
36 class octave_value_list; |
|
37 class octave_lvalue; |
|
38 |
3933
|
39 #include "SLList.h" |
2980
|
40 #include "str-vec.h" |
|
41 |
|
42 #include "pt-exp.h" |
|
43 |
|
44 // Index expressions. |
|
45 |
|
46 class |
|
47 tree_index_expression : public tree_expression |
|
48 { |
|
49 public: |
|
50 |
|
51 tree_index_expression (tree_expression *e = 0, tree_argument_list *lst = 0, |
3933
|
52 int l = -1, int c = -1, char t = '('); |
2980
|
53 |
3930
|
54 tree_index_expression (tree_expression *e, const std::string& n, |
|
55 int l = -1, int c = -1); |
|
56 |
2980
|
57 ~tree_index_expression (void); |
|
58 |
3933
|
59 void append (tree_argument_list *lst = 0, char t = '('); |
3930
|
60 |
3933
|
61 void append (const std::string& n); |
|
62 |
|
63 bool is_index_expression (void) const { return true; } |
2980
|
64 |
3523
|
65 std::string name (void) const; |
2991
|
66 |
3933
|
67 tree_expression *expression (void) { return expr; } |
3930
|
68 |
3933
|
69 SLList<tree_argument_list *> arg_lists (void) { return args; } |
3930
|
70 |
3933
|
71 std::string type_tags (void) { return type; } |
2980
|
72 |
3933
|
73 SLList<string_vector> arg_names (void) { return arg_nm; } |
2980
|
74 |
3933
|
75 bool lvalue_ok (void) const { return expr->lvalue_ok (); } |
3010
|
76 |
3933
|
77 bool rvalue_ok (void) const { return true; } |
2980
|
78 |
|
79 octave_value rvalue (void); |
|
80 |
|
81 octave_value_list rvalue (int nargout); |
|
82 |
|
83 octave_lvalue lvalue (void); |
|
84 |
|
85 void eval_error (void); |
|
86 |
|
87 void accept (tree_walker& tw); |
|
88 |
|
89 private: |
|
90 |
3930
|
91 // The LHS of this index expression. |
2980
|
92 tree_expression *expr; |
|
93 |
3933
|
94 // The indices (only valid if type == paren || type == brace). |
|
95 SLList<tree_argument_list *> args; |
2980
|
96 |
3930
|
97 // The type of this index expression. |
3933
|
98 std::string type; |
3929
|
99 |
3930
|
100 // The names of the arguments. |
3933
|
101 SLList<string_vector> arg_nm; |
|
102 |
|
103 Octave_map tree_index_expression::make_arg_struct (void) const; |
2988
|
104 |
|
105 // No copying! |
|
106 |
|
107 tree_index_expression (const tree_index_expression&); |
|
108 |
|
109 tree_index_expression& operator = (const tree_index_expression&); |
2980
|
110 }; |
|
111 |
|
112 #endif |
|
113 |
|
114 /* |
|
115 ;;; Local Variables: *** |
|
116 ;;; mode: C++ *** |
|
117 ;;; End: *** |
|
118 */ |