Mercurial > octave
annotate libinterp/parse-tree/pt-colon.cc @ 30346:91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
* __isprimelarge__.cc, bsxfun.cc, cellfun.cc, chol.cc, data.cc, error.h,
event-manager.h, filter.cc, find.cc, gcd.cc, gl-render.h, gl2ps-print.cc,
graphics.cc, graphics.in.h, hash.cc, help.cc, hex2num.cc, input.cc, inv.cc,
load-path.cc, load-save.cc, ls-hdf5.cc, ls-hdf5.h, ls-mat5.cc, lu.cc,
mappers.cc, matrix_type.cc, max.cc, mex.cc, mxarray.h, oct-errno.in.cc,
oct-map.cc, oct-stream.cc, oct-stream.h, pr-output.cc, psi.cc, qr.cc, rand.cc,
regexp.cc, sparse-xdiv.h, stack-frame.cc, strfind.cc, strfns.cc, sylvester.cc,
symbfact.cc, symrec.h, symscope.cc, typecast.cc, utils.cc, variables.h, xdiv.h,
xpow.h, __init_fltk__.cc, __ode15__.cc, audiodevinfo.cc, audioread.cc,
convhulln.cc, cdef-class.cc, cdef-class.h, cdef-manager.cc, cdef-method.cc,
cdef-object.cc, cdef-object.h, cdef-package.h, cdef-utils.cc, ov-base-diag.cc,
ov-base-int.cc, ov-base.h, ov-bool-mat.cc, ov-bool.cc, ov-cell.cc,
ov-ch-mat.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-colon.h,
ov-complex.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.h, ov-fcn-handle.cc,
ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc,
ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-java.cc, ov-lazy-idx.cc, ov-lazy-idx.h,
ov-range.cc, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-scalar.cc,
ov-str-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov.cc, ov.h, octave.h,
bp-table.cc, bp-table.h, lex.h, oct-lvalue.h, profiler.cc, profiler.h,
pt-binop.h, pt-colon.cc, pt-eval.cc, pt-exp.h, pt-select.h:
Shorten some long lines in libinterp to <= 80 characters.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Nov 2021 09:38:51 -0800 |
parents | 7854d5752dd2 |
children | 83f9f8bda883 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
3 // Copyright (C) 1996-2021 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
2980 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
27 # include "config.h" |
2980 | 28 #endif |
29 | |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
30 #include "interpreter.h" |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
31 #include "parse.h" |
2980 | 32 #include "pt-colon.h" |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
33 #include "pt-eval.h" |
2980 | 34 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
35 namespace octave |
2980 | 36 { |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
37 // Colon expressions. |
2980 | 38 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
39 tree_expression * |
24270
bc3819b7cca1
don't use symbol_table:: nesting for symbol_record, symbol_scope, or fcn_info
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
40 tree_colon_expression::dup (symbol_scope& scope) const |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
41 { |
23655
bbcc1e08aaed
improve colon expression construction and avoid possible memory leak
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
42 tree_colon_expression *new_ce |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
43 = new tree_colon_expression (m_base ? m_base->dup (scope) : nullptr, |
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
44 m_limit ? m_limit->dup (scope) : nullptr, |
30346
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
45 m_increment ? m_increment->dup (scope) |
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
46 : nullptr, |
23655
bbcc1e08aaed
improve colon expression construction and avoid possible memory leak
John W. Eaton <jwe@octave.org>
parents:
23602
diff
changeset
|
47 line (), column ()); |
5861 | 48 |
25814
a8a72d1c21dd
correctly copy base class for colon and funcall parse tree objects (bug #47091)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
49 new_ce->copy_base (*this); |
5861 | 50 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
51 return new_ce; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
52 } |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
53 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
54 octave_value tree_colon_expression::evaluate (tree_evaluator& tw, int) |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
55 { |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
56 octave_value val; |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
57 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
58 if (! m_base || ! m_limit) |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
59 return val; |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
60 |
28519
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
61 octave_value ov_base; |
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
62 octave_value ov_increment; |
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
63 octave_value ov_limit; |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
64 |
28519
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
65 if (m_increment) |
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
66 { |
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
67 ov_base = m_base->evaluate (tw); |
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
68 ov_increment = m_increment->evaluate (tw); |
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
69 ov_limit = m_limit->evaluate (tw); |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
70 } |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
71 else |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
72 { |
28519
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
73 ov_base = m_base->evaluate (tw); |
d4563c5d4060
handle all dispatching for colon operator in do_colon_op function
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
74 ov_limit = m_limit->evaluate (tw); |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
75 } |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
76 |
28631
70cdf8de553d
move non-member octave_value operator functions to octave namespace
John W. Eaton <jwe@octave.org>
parents:
28519
diff
changeset
|
77 return colon_op (ov_base, ov_increment, ov_limit, is_for_cmd_expr ()); |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
78 } |
2980 | 79 } |