Mercurial > hg > octave-nkf
annotate src/pt-colon.h @ 10824:1e6664326d32
rsf2csf: Change first documentation line to active voice.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 27 Jul 2010 10:46:11 -0700 |
parents | f3b65e1ae355 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
2980 | 1 /* |
2 | |
8920 | 3 Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004, 2005, 2006, 2007, |
4 2008, 2009 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_colon_h) | |
25 #define octave_tree_colon 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 // Colon expressions. | |
39 | |
40 class | |
41 tree_colon_expression : public tree_expression | |
42 { | |
43 public: | |
44 | |
45 tree_colon_expression (int l = -1, int c = -1) | |
2990 | 46 : tree_expression (l, c), op_base (0), op_limit (0), |
47 op_increment (0), save_base (false) { } | |
2980 | 48 |
49 tree_colon_expression (tree_expression *e, int l = -1, int c = -1) | |
2990 | 50 : tree_expression (l, c), op_base (e), op_limit (0), |
51 op_increment (0), save_base (false) { } | |
2980 | 52 |
5861 | 53 tree_colon_expression (tree_expression *bas, tree_expression *lim, |
10313 | 54 tree_expression *inc, int l = -1, int c = -1) |
5861 | 55 : tree_expression (l, c), op_base (bas), op_limit (lim), |
56 op_increment (inc), save_base (false) { } | |
57 | |
2980 | 58 ~tree_colon_expression (void) |
59 { | |
2990 | 60 if (! save_base) |
10313 | 61 delete op_base; |
2990 | 62 |
2980 | 63 delete op_limit; |
64 delete op_increment; | |
65 } | |
66 | |
4267 | 67 bool has_magic_end (void) const |
68 { | |
69 return ((op_base && op_base->has_magic_end ()) | |
10313 | 70 || (op_limit && op_limit->has_magic_end ()) |
71 || (op_increment && op_increment->has_magic_end ())); | |
4267 | 72 } |
73 | |
2990 | 74 void preserve_base (void) { save_base = true; } |
75 | |
2980 | 76 tree_colon_expression *append (tree_expression *t); |
77 | |
3933 | 78 bool rvalue_ok (void) const { return true; } |
2980 | 79 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
80 octave_value rvalue1 (int nargout = 1); |
2980 | 81 |
82 octave_value_list rvalue (int nargout); | |
83 | |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7767
diff
changeset
|
84 void eval_error (const std::string& s) const; |
2980 | 85 |
86 tree_expression *base (void) { return op_base; } | |
87 | |
88 tree_expression *limit (void) { return op_limit; } | |
89 | |
90 tree_expression *increment (void) { return op_increment; } | |
91 | |
5066 | 92 int line (void) const; |
93 int column (void) const; | |
94 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
95 tree_expression *dup (symbol_table::scope_id scope, |
10313 | 96 symbol_table::context_id context) const; |
5861 | 97 |
2980 | 98 void accept (tree_walker& tw); |
99 | |
100 private: | |
101 | |
102 // The components of the expression. | |
103 tree_expression *op_base; | |
104 tree_expression *op_limit; | |
105 tree_expression *op_increment; | |
2988 | 106 |
2990 | 107 bool save_base; |
108 | |
5347 | 109 octave_value |
110 make_range (const Matrix& m_base, const Matrix& m_limit, | |
10313 | 111 const Matrix& m_increment, bool result_is_str, |
112 bool dq_str) const; | |
5347 | 113 |
114 octave_value | |
115 make_range (const octave_value& ov_base, const octave_value& ov_limit, | |
10313 | 116 const octave_value& ov_increment) const; |
5347 | 117 |
2988 | 118 // No copying! |
119 | |
120 tree_colon_expression (const tree_colon_expression&); | |
121 | |
122 tree_colon_expression& operator = (const tree_colon_expression&); | |
2980 | 123 }; |
124 | |
125 #endif |