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_colon_h) |
|
24 #define octave_tree_colon 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 // Colon expressions. |
|
41 |
|
42 class |
|
43 tree_colon_expression : public tree_expression |
|
44 { |
|
45 public: |
|
46 |
|
47 tree_colon_expression (int l = -1, int c = -1) |
2990
|
48 : tree_expression (l, c), op_base (0), op_limit (0), |
|
49 op_increment (0), save_base (false) { } |
2980
|
50 |
|
51 tree_colon_expression (tree_expression *e, int l = -1, int c = -1) |
2990
|
52 : tree_expression (l, c), op_base (e), op_limit (0), |
|
53 op_increment (0), save_base (false) { } |
2980
|
54 |
|
55 ~tree_colon_expression (void) |
|
56 { |
2990
|
57 if (! save_base) |
|
58 delete op_base; |
|
59 |
2980
|
60 delete op_limit; |
|
61 delete op_increment; |
|
62 } |
|
63 |
2990
|
64 void preserve_base (void) { save_base = true; } |
|
65 |
2980
|
66 tree_colon_expression *append (tree_expression *t); |
|
67 |
3933
|
68 bool rvalue_ok (void) const { return true; } |
2980
|
69 |
|
70 octave_value rvalue (void); |
|
71 |
|
72 octave_value_list rvalue (int nargout); |
|
73 |
3523
|
74 void eval_error (const std::string& s = std::string ()); |
2980
|
75 |
|
76 tree_expression *base (void) { return op_base; } |
|
77 |
|
78 tree_expression *limit (void) { return op_limit; } |
|
79 |
|
80 tree_expression *increment (void) { return op_increment; } |
|
81 |
|
82 void accept (tree_walker& tw); |
|
83 |
|
84 private: |
|
85 |
|
86 // The components of the expression. |
|
87 tree_expression *op_base; |
|
88 tree_expression *op_limit; |
|
89 tree_expression *op_increment; |
2988
|
90 |
2990
|
91 bool save_base; |
|
92 |
2988
|
93 // No copying! |
|
94 |
|
95 tree_colon_expression (const tree_colon_expression&); |
|
96 |
|
97 tree_colon_expression& operator = (const tree_colon_expression&); |
2980
|
98 }; |
|
99 |
|
100 #endif |
|
101 |
|
102 /* |
|
103 ;;; Local Variables: *** |
|
104 ;;; mode: C++ *** |
|
105 ;;; End: *** |
|
106 */ |