annotate libinterp/parse-tree/pt-id.h @ 20574:dd6345fd8a97

use exceptions for better invalid index error reporting (bug #45957) * lo-array-gripes.h, lo-array-gripes.cc (index_exception): New base class for indexing errors. (invalid_index, out_of_range): New classes. (gripe_index_out_of_range): New overloaded function. (gripe_invalid_index): New overloaded functions. Delete version with no arguments. (gripe_invalid_assignment_size, gripe_assignment_dimension_mismatch): Delete. Change uses of gripe functions as needed. * Cell.cc (Cell::index, Cell::assign, Cell::delete_elements): Use exceptions to collect error info about and handle indexing errors. * data.cc (Fnth_element, do_accumarray_sum, F__accumarray_sum__, do_accumarray_minmax, do_accumarray_minmax_fun, F__accumdim_sum__): Likewise. * oct-map.cc (octave_map::index, octave_map::assign, octave_map::delete_elements): Likewise. * sparse.cc (Fsparse): Likewise. * sub2ind.cc (Fsub2ind, Find2sub): Likewise. New tests. * utils.cc (dims_to_numel): Likewise. * ov-base-diag.cc (octave_base_diag<DMT, MT>::do_index_op, octave_base_diag<DMT, MT>::subsasgn): Likewise. * ov-base-mat.cc (octave_base_matrix<MT>::subsref, octave_base_matrix<MT>::assign): Likewise. * ov-base-sparse.cc (octave_base_sparse<T>::do_index_op, octave_base_sparse<T>::assign, octave_base_sparse<MT>::delete_elements): Likewise. * ov-classdef.cc (cdef_object_array::subsref, cdef_object_array::subsasgn): Likewise. * ov-java.cc (make_java_index): Likewise. * ov-perm.cc (octave_perm_matrix::do_index_op): Likewise. * ov-range.cc (octave_range::do_index_op): Likewise. * ov-re-diag.cc (octave_diag_matrix::do_index_op): Likewise. * ov-str-mat.cc (octave_char_matrix_str::do_index_op_internal): Likewise. * pt-assign.cc (tree_simple_assignment::rvalue1): Likewise. * pt-idx.cc (tree_index_expression::rvalue, tree_index_expression::lvalue): Likewise. * Array-util.cc (sub2ind): Likewise. * toplev.cc (main_loop): Also catch unhandled index_exception exceptions. * ov-base.cc (octave_base_value::index_vector): Improve error message. * ov-re-sparse.cc (octave_sparse_matrix::index_vector): Likewise. * ov-complex.cc (complex_index): New class. (gripe_complex_index): New function. (octave_complex::index_vector): Use it. * pt-id.h, pt-id.cc (tree_identifier::is_variable, tree_black_hole::is_variable): Now const. * pt-idx.cc (final_index_error): New static function. (tree_index_expression::rvalue, tree_index_expression::lvalue): Use it. * index.tst: New tests.
author Lachlan Andrew <lachlanbis@gmail.com>
date Fri, 02 Oct 2015 15:07:37 -0400
parents 7ac907da9fba
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
1 /*
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
2
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17856
diff changeset
3 Copyright (C) 1996-2015 John W. Eaton
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
4
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
6
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
10 option) any later version.
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
11
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
15 for more details.
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
16
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
19 <http://www.gnu.org/licenses/>.
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
20
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
21 */
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
22
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
23 #if !defined (octave_pt_id_h)
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
24 #define octave_pt_id_h 1
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
25
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
26 #include <iosfwd>
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
27 #include <string>
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
28
2943
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2887
diff changeset
29 class octave_value;
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2887
diff changeset
30 class octave_value_list;
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
31 class octave_function;
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
32
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
33 class tree_walker;
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
34
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents: 14982
diff changeset
35 #include "oct-lvalue.h"
7677
db02cc0ba8f2 handle breakpoints in tree_identifier::do_lookup
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
36 #include "pt-bp.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents: 2979
diff changeset
37 #include "pt-exp.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
38 #include "symtab.h"
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
39
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
40 // Symbols from the symbol table.
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
41
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
42 class
2971
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
43 tree_identifier : public tree_expression
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
44 {
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
45 friend class tree_index_expression;
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
46
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
47 public:
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
48
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
49 tree_identifier (int l = -1, int c = -1)
14912
3d3c002ccc60 Add symbol_table::symbol_record_ref
Max Brister <max@2bass.com>
parents: 14544
diff changeset
50 : tree_expression (l, c) { }
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
51
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7677
diff changeset
52 tree_identifier (const symbol_table::symbol_record& s,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
53 int l = -1, int c = -1,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
54 symbol_table::scope_id sc = symbol_table::current_scope ())
14912
3d3c002ccc60 Add symbol_table::symbol_record_ref
Max Brister <max@2bass.com>
parents: 14544
diff changeset
55 : tree_expression (l, c), sym (s, sc) { }
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
56
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
57 ~tree_identifier (void) { }
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
58
17355
f0edd6c752e9 don't convert "end" token to "__end__" for indexing
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
59 bool has_magic_end (void) const { return (name () == "end"); }
4267
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4192
diff changeset
60
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3523
diff changeset
61 bool is_identifier (void) const { return true; }
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
62
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7677
diff changeset
63 // The name doesn't change with scope, so use sym instead of
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7677
diff changeset
64 // accessing it through sym so that this function may remain const.
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
65 std::string name (void) const { return sym.name (); }
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
66
14912
3d3c002ccc60 Add symbol_table::symbol_record_ref
Max Brister <max@2bass.com>
parents: 14544
diff changeset
67 bool is_defined (void) { return sym->is_defined (); }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
68
20574
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20463
diff changeset
69 virtual bool is_variable (void) const { return sym->is_variable (); }
10206
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
70
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
71 virtual bool is_black_hole (void) { return false; }
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
72
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
73 // Try to find a definition for an identifier. Here's how:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
74 //
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
75 // * If the identifier is already defined and is a function defined
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
76 // in an function file that has been modified since the last time
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
77 // we parsed it, parse it again.
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
78 //
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
79 // * If the identifier is not defined, try to find a builtin
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
80 // variable or an already compiled function with the same name.
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
81 //
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
82 // * If the identifier is still undefined, try looking for an
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
83 // function file to parse.
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
84 //
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
85 // * On systems that support dynamic linking, we prefer .oct files,
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
86 // then .mex files, then .m files.
2971
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
87
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
88 octave_value
9445
c5f03874ea2a simplify symbol_table::find and associated functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
89 do_lookup (const octave_value_list& args = octave_value_list ())
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
90 {
14912
3d3c002ccc60 Add symbol_table::symbol_record_ref
Max Brister <max@2bass.com>
parents: 14544
diff changeset
91 return sym->find (args);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
92 }
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
93
14912
3d3c002ccc60 Add symbol_table::symbol_record_ref
Max Brister <max@2bass.com>
parents: 14544
diff changeset
94 void mark_global (void) { sym->mark_global (); }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
95
14912
3d3c002ccc60 Add symbol_table::symbol_record_ref
Max Brister <max@2bass.com>
parents: 14544
diff changeset
96 void mark_as_static (void) { sym->init_persistent (); }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
97
14912
3d3c002ccc60 Add symbol_table::symbol_record_ref
Max Brister <max@2bass.com>
parents: 14544
diff changeset
98 void mark_as_formal_parameter (void) { sym->mark_formal (); }
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
99
3010
1aeb8869e464 [project @ 1997-06-01 19:24:02 by jwe]
jwe
parents: 2988
diff changeset
100 // We really need to know whether this symbol referst to a variable
1aeb8869e464 [project @ 1997-06-01 19:24:02 by jwe]
jwe
parents: 2988
diff changeset
101 // or a function, but we may not know that yet.
1aeb8869e464 [project @ 1997-06-01 19:24:02 by jwe]
jwe
parents: 2988
diff changeset
102
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3523
diff changeset
103 bool lvalue_ok (void) const { return true; }
3010
1aeb8869e464 [project @ 1997-06-01 19:24:02 by jwe]
jwe
parents: 2988
diff changeset
104
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
105 octave_value rvalue1 (int nargout = 1);
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
106
16091
1785493171ac pass lvalue_list to more subsref calls (bug #38374)
John W. Eaton <jwe@octave.org>
parents: 15236
diff changeset
107 octave_value_list rvalue (int nargout)
1785493171ac pass lvalue_list to more subsref calls (bug #38374)
John W. Eaton <jwe@octave.org>
parents: 15236
diff changeset
108 {
1785493171ac pass lvalue_list to more subsref calls (bug #38374)
John W. Eaton <jwe@octave.org>
parents: 15236
diff changeset
109 return rvalue (nargout, 0);
1785493171ac pass lvalue_list to more subsref calls (bug #38374)
John W. Eaton <jwe@octave.org>
parents: 15236
diff changeset
110 }
1785493171ac pass lvalue_list to more subsref calls (bug #38374)
John W. Eaton <jwe@octave.org>
parents: 15236
diff changeset
111
1785493171ac pass lvalue_list to more subsref calls (bug #38374)
John W. Eaton <jwe@octave.org>
parents: 15236
diff changeset
112 octave_value_list rvalue (int nargout,
1785493171ac pass lvalue_list to more subsref calls (bug #38374)
John W. Eaton <jwe@octave.org>
parents: 15236
diff changeset
113 const std::list<octave_lvalue> *lvalue_list);
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
114
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents: 2971
diff changeset
115 octave_lvalue lvalue (void);
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
116
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
117 void eval_undefined_error (void);
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
118
15236
44d6ffdf9479 Disallow new variables in nested functions (bug #36271)
Max Brister <max@2bass.com>
parents: 15195
diff changeset
119 void static_workspace_error (void)
44d6ffdf9479 Disallow new variables in nested functions (bug #36271)
Max Brister <max@2bass.com>
parents: 15195
diff changeset
120 {
20463
7ac907da9fba Use error() rather than ::error() unless explicitly required.
Rik <rik@octave.org>
parents: 19731
diff changeset
121 error ("can not add variable \"%s\" to a static workspace",
7ac907da9fba Use error() rather than ::error() unless explicitly required.
Rik <rik@octave.org>
parents: 19731
diff changeset
122 name ().c_str ());
15236
44d6ffdf9479 Disallow new variables in nested functions (bug #36271)
Max Brister <max@2bass.com>
parents: 15195
diff changeset
123 }
44d6ffdf9479 Disallow new variables in nested functions (bug #36271)
Max Brister <max@2bass.com>
parents: 15195
diff changeset
124
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7753
diff changeset
125 tree_identifier *dup (symbol_table::scope_id scope,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
126 symbol_table::context_id context) const;
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
127
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
128 void accept (tree_walker& tw);
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
129
14930
7d44ed216b98 Rename symbol_table::symbol_record_ref to symbol_table::symbol_reference
Max Brister <max@2bass.com>
parents: 14913
diff changeset
130 symbol_table::symbol_reference symbol (void) const
14913
c7071907a641 Use symbol_record_ref instead of names in JIT
Max Brister <max@2bass.com>
parents: 14912
diff changeset
131 {
c7071907a641 Use symbol_record_ref instead of names in JIT
Max Brister <max@2bass.com>
parents: 14912
diff changeset
132 return sym;
c7071907a641 Use symbol_record_ref instead of names in JIT
Max Brister <max@2bass.com>
parents: 14912
diff changeset
133 }
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
134 private:
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
135
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
136 // The symbol record that this identifier references.
14930
7d44ed216b98 Rename symbol_table::symbol_record_ref to symbol_table::symbol_reference
Max Brister <max@2bass.com>
parents: 14913
diff changeset
137 symbol_table::symbol_reference sym;
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7677
diff changeset
138
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
139 // No copying!
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
140
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
141 tree_identifier (const tree_identifier&);
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
142
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2980
diff changeset
143 tree_identifier& operator = (const tree_identifier&);
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
144 };
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
145
10206
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
146 class tree_black_hole : public tree_identifier
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
147 {
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
148 public:
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
149
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
150 tree_black_hole (int l = -1, int c = -1)
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
151 : tree_identifier (l, c) { }
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
152
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
153 std::string name (void) const { return "~"; }
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
154
20574
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20463
diff changeset
155 bool is_variable (void) const { return false; }
10206
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
156
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
157 bool is_black_hole (void) { return true; }
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
158
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
159 tree_black_hole *dup (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
160 { return new tree_black_hole; }
10206
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
161
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
162 octave_lvalue lvalue (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
163 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
164 return octave_lvalue (); // black hole lvalue
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
165 }
10206
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
166 };
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
167
2887
4b71bb90c388 [project @ 1997-04-28 01:20:55 by jwe]
jwe
parents:
diff changeset
168 #endif