annotate libinterp/parse-tree/pt-idx.cc @ 31605:e88a07dec498 stable

maint: Use macros to begin/end C++ namespaces. * oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE, OCTAVE_END_NAMESPACE) that can be used to start/end a namespace. * mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc, __dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc, auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h, besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc, display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h, mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc, pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, __delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc, ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h, anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author Rik <rik@octave.org>
date Thu, 01 Dec 2022 14:23:45 -0800
parents 396f60e0b984
children aac27ad79be6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30144
diff changeset
3 // Copyright (C) 1996-2022 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
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
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
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
28 #endif
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
29
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3930
diff changeset
30 #include "Cell.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
31 #include "error.h"
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23576
diff changeset
32 #include "interpreter-private.h"
3930
61d4427c016e [project @ 2002-05-07 00:47:31 by jwe]
jwe
parents: 3929
diff changeset
33 #include "oct-map.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20700
diff changeset
34 #include "ovl.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
35 #include "oct-lvalue.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
36 #include "ov.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents: 2980
diff changeset
37 #include "pt-arg-list.h"
23435
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
38 #include "pt-eval.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7200
diff changeset
39 #include "pt-id.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
40 #include "pt-idx.h"
3930
61d4427c016e [project @ 2002-05-07 00:47:31 by jwe]
jwe
parents: 3929
diff changeset
41 #include "utils.h"
61d4427c016e [project @ 2002-05-07 00:47:31 by jwe]
jwe
parents: 3929
diff changeset
42 #include "variables.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 20977
diff changeset
43 #include "errwarn.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
44
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31073
diff changeset
45 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31073
diff changeset
46
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
47 // Index expressions.
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
48
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
49 tree_index_expression::tree_index_expression (int l, int c)
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
50 : tree_expression (l, c), m_expr (nullptr), m_args (0), m_type (),
26662
05fc703b419a update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents: 26660
diff changeset
51 m_arg_nm (), m_dyn_field (), m_word_list_cmd (false) { }
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
52
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
53 tree_index_expression::tree_index_expression (tree_expression *e,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
54 tree_argument_list *lst,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
55 int l, int c, char t)
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
56 : tree_expression (l, c), m_expr (e), m_args (0), m_type (),
26662
05fc703b419a update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents: 26660
diff changeset
57 m_arg_nm (), m_dyn_field (), m_word_list_cmd (false)
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
58 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
59 append (lst, t);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
60 }
4131
597fbc55ea40 [project @ 2002-10-29 17:12:53 by jwe]
jwe
parents: 4066
diff changeset
61
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
62 tree_index_expression::tree_index_expression (tree_expression *e,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
63 const std::string& n,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
64 int l, int c)
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
65 : tree_expression (l, c), m_expr (e), m_args (0), m_type (),
26662
05fc703b419a update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents: 26660
diff changeset
66 m_arg_nm (), m_dyn_field (), m_word_list_cmd (false)
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
67 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
68 append (n);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
69 }
3930
61d4427c016e [project @ 2002-05-07 00:47:31 by jwe]
jwe
parents: 3929
diff changeset
70
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
71 tree_index_expression::tree_index_expression (tree_expression *e,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
72 tree_expression *df,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
73 int l, int c)
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
74 : tree_expression (l, c), m_expr (e), m_args (0), m_type (),
26662
05fc703b419a update handling of command-style function call syntax in eval
John W. Eaton <jwe@octave.org>
parents: 26660
diff changeset
75 m_arg_nm (), m_dyn_field (), m_word_list_cmd (false)
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
76 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
77 append (df);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
78 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3930
diff changeset
79
30144
3c2dee80b542 attempt more uniform handling of list concatenation in the parser
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
80 tree_index_expression *
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
81 tree_index_expression::append (tree_argument_list *lst, char t)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
82 {
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
83 m_args.push_back (lst);
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
84 m_type.append (1, t);
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
85 m_arg_nm.push_back (lst ? lst->get_arg_names () : string_vector ());
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
86 m_dyn_field.push_back (static_cast<tree_expression *> (nullptr));
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
87
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
88 if (lst && lst->has_magic_tilde ())
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
89 error ("invalid use of empty argument (~) in index expression");
30144
3c2dee80b542 attempt more uniform handling of list concatenation in the parser
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
90
3c2dee80b542 attempt more uniform handling of list concatenation in the parser
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
91 return this;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
92 }
13970
c93b953f7d54 plug some memory leaks
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
93
30144
3c2dee80b542 attempt more uniform handling of list concatenation in the parser
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
94 tree_index_expression *
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
95 tree_index_expression::append (const std::string& n)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
96 {
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
97 m_args.push_back (static_cast<tree_argument_list *> (nullptr));
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
98 m_type += '.';
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
99 m_arg_nm.push_back (n);
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
100 m_dyn_field.push_back (static_cast<tree_expression *> (nullptr));
30144
3c2dee80b542 attempt more uniform handling of list concatenation in the parser
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
101
3c2dee80b542 attempt more uniform handling of list concatenation in the parser
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
102 return this;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
103 }
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
104
30144
3c2dee80b542 attempt more uniform handling of list concatenation in the parser
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
105 tree_index_expression *
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
106 tree_index_expression::append (tree_expression *df)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
107 {
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
108 m_args.push_back (static_cast<tree_argument_list *> (nullptr));
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
109 m_type += '.';
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
110 m_arg_nm.push_back ("");
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
111 m_dyn_field.push_back (df);
30144
3c2dee80b542 attempt more uniform handling of list concatenation in the parser
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
112
3c2dee80b542 attempt more uniform handling of list concatenation in the parser
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
113 return this;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
114 }
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
115
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
116 tree_index_expression::~tree_index_expression (void)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
117 {
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
118 delete m_expr;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
119
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
120 while (! m_args.empty ())
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
121 {
25337
3ff9192b676e use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents: 25336
diff changeset
122 auto p = m_args.begin ();
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
123 delete *p;
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
124 m_args.erase (p);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
125 }
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
126
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
127 while (! m_dyn_field.empty ())
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
128 {
25337
3ff9192b676e use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents: 25336
diff changeset
129 auto p = m_dyn_field.begin ();
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
130 delete *p;
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
131 m_dyn_field.erase (p);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
132 }
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
133 }
5099
f7e39f977fe8 [project @ 2004-12-24 19:06:01 by jwe]
jwe
parents: 4675
diff changeset
134
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
135 // This is useful for printing the name of the variable in an indexed
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
136 // assignment.
2991
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents: 2984
diff changeset
137
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
138 std::string
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
139 tree_index_expression::name (void) const
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
140 {
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
141 return m_expr->name ();
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
142 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3930
diff changeset
143
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
144 std::string
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
145 tree_index_expression::get_struct_index
25383
d3a035528c9a use reference to tree_evaluator instead of pointer
John W. Eaton <jwe@octave.org>
parents: 25382
diff changeset
146 (tree_evaluator& tw,
23435
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
147 std::list<string_vector>::const_iterator p_arg_nm,
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
148 std::list<tree_expression *>::const_iterator p_dyn_field) const
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
149 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
150 std::string fn = (*p_arg_nm)(0);
4131
597fbc55ea40 [project @ 2002-10-29 17:12:53 by jwe]
jwe
parents: 4066
diff changeset
151
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
152 if (fn.empty ())
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
153 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
154 tree_expression *df = *p_dyn_field;
4131
597fbc55ea40 [project @ 2002-10-29 17:12:53 by jwe]
jwe
parents: 4066
diff changeset
155
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
156 if (df)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
157 {
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
158 octave_value t = df->evaluate (tw);
4131
597fbc55ea40 [project @ 2002-10-29 17:12:53 by jwe]
jwe
parents: 4066
diff changeset
159
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
160 fn = t.xstring_value ("dynamic structure field names must be strings");
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
161 }
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
162 else
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
163 panic_impossible ();
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
164 }
4131
597fbc55ea40 [project @ 2002-10-29 17:12:53 by jwe]
jwe
parents: 4066
diff changeset
165
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
166 return fn;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
167 }
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10659
diff changeset
168
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
169 octave_lvalue
25383
d3a035528c9a use reference to tree_evaluator instead of pointer
John W. Eaton <jwe@octave.org>
parents: 25382
diff changeset
170 tree_index_expression::lvalue (tree_evaluator& tw)
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
171 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
172 std::list<octave_value_list> idx;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
173
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
174 int n = m_args.size ();
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
175
25337
3ff9192b676e use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents: 25336
diff changeset
176 auto p_args = m_args.begin ();
3ff9192b676e use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents: 25336
diff changeset
177 auto p_arg_nm = m_arg_nm.begin ();
3ff9192b676e use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents: 25336
diff changeset
178 auto p_dyn_field = m_dyn_field.begin ();
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
179
26660
e4909f142491 * pt-idx.cc (tree_index_expression::lvalue): Style fix.
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
180 octave_lvalue retval = m_expr->lvalue (tw);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
181
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
182 unwind_action
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
183 act ([&tw] (const octave_value& val,
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
184 const std::string& index_type,
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
185 const std::list<octave_value_list>& index_list)
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
186 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
187 tw.set_indexed_object (val);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
188 tw.set_index_list (index_type, index_list);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
189 }, tw.indexed_object (), tw.index_type (), tw.index_list ());
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
190
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
191 tw.set_indexed_object (retval.value ());
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
192 tw.clear_index_list ();
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
193
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
194 for (int i = 0; i < n; i++)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
195 {
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
196 switch (m_type[i])
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
197 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
198 case '(':
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
199 {
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
200 octave_value_list tidx = tw.make_value_list (*p_args, *p_arg_nm);
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
201
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
202 tw.append_index_list ('(', tidx);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
203 idx.push_back (tidx);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
204 }
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
205 break;
3930
61d4427c016e [project @ 2002-05-07 00:47:31 by jwe]
jwe
parents: 3929
diff changeset
206
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
207 case '{':
20558
1a0a433c8263 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
208 {
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
209 octave_value_list tidx = tw.make_value_list (*p_args, *p_arg_nm);
20558
1a0a433c8263 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
210
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
211 tw.append_index_list ('{', tidx);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
212 idx.push_back (tidx);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
213 }
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
214 break;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
215
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
216 case '.':
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
217 {
23435
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
218 octave_value tidx = get_struct_index (tw, p_arg_nm, p_dyn_field);
20558
1a0a433c8263 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
219
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
220 tw.append_index_list ('.', tidx);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
221 idx.push_back (tidx);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
222 }
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
223 break;
20558
1a0a433c8263 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
224
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
225 default:
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
226 panic_impossible ();
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
227 }
20558
1a0a433c8263 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
228
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
229 if (idx.back ().empty ())
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
230 error ("invalid empty index list");
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
231
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
232 p_args++;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
233 p_arg_nm++;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
234 p_dyn_field++;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
235 }
20558
1a0a433c8263 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
236
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
237 retval.set_index (m_type, idx);
8546
3d8a914c580e improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
238
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
239 return retval;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
240 }
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4233
diff changeset
241
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
242 tree_index_expression *
24270
bc3819b7cca1 don't use symbol_table:: nesting for symbol_record, symbol_scope, or fcn_info
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
243 tree_index_expression::dup (symbol_scope& scope) const
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
244 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
245 tree_index_expression *new_idx_expr
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
246 = new tree_index_expression (line (), column ());
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
247
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
248 new_idx_expr->m_expr = (m_expr ? m_expr->dup (scope) : nullptr);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
249
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
250 std::list<tree_argument_list *> new_args;
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
251
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
252 for (const tree_argument_list *elt : m_args)
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23696
diff changeset
253 new_args.push_back (elt ? elt->dup (scope) : nullptr);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
254
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
255 new_idx_expr->m_args = new_args;
3930
61d4427c016e [project @ 2002-05-07 00:47:31 by jwe]
jwe
parents: 3929
diff changeset
256
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
257 new_idx_expr->m_type = m_type;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
258
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
259 new_idx_expr->m_arg_nm = m_arg_nm;
7099
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
260
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
261 std::list<tree_expression *> new_dyn_field;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
262
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
263 for (const tree_expression *elt : m_dyn_field)
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23696
diff changeset
264 new_dyn_field.push_back (elt ? elt->dup (scope) : nullptr);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
265
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24722
diff changeset
266 new_idx_expr->m_dyn_field = new_dyn_field;
8546
3d8a914c580e improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
267
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
268 new_idx_expr->copy_base (*this);
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4233
diff changeset
269
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
270 return new_idx_expr;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23071
diff changeset
271 }
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
272
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
273 // Unlike Matlab, which does not allow the result of a function call
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
274 // or array indexing expression to be further indexed, Octave attempts
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
275 // to handle arbitrary index expressions. For example, Octave allows
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
276 // expressions like
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
277 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
278 // svd (rand (10))(1:5)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
279 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
280 // Although octave_value objects may contain function objects, no
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
281 // indexing operation or function call is supposed to return them
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
282 // directly. Instead, the language is supposed to only allow function
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
283 // objects to be stored as function handles (named or anonymous) or as
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
284 // inline functions. The only place a function object should appear
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
285 // directly is if the symbol stored in a tree_identifier object
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
286 // resolves to a function. This means that the only place we need to
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
287 // look for functions is in the first element of the index
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
288 // expression.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
289 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
290 // Steps:
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
291 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
292 // * Obtain the initial value from the expression component of the
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
293 // tree_index_expression object. If it is a tree_identifier object
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
294 // indexed by '(args)' and the identifier is not a variable, then
27971
ec769a7ab9fb fix more spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
295 // perform a function call. Use the (optional) arguments to perform
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
296 // the function lookup so we choose the correct function or class
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
297 // method to call. Otherwise, evaluate the first expression
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
298 // without any additional arguments.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
299 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
300 // * Iterate over the remaining elements of the index expression and
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
301 // call the octave_value::subsref method. If indexing a class or
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
302 // classdef object, build up a list of indices for a call to the
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
303 // subsref method for the object. Otherwise, use the result of
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
304 // each temporary evaluation for the next index element.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
305 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
306 // * If not indexing a class or classdef object and any partial
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
307 // expression evaluation produces a class or classdef object, then
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
308 // build up a complete argument list from that point on for a final
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
309 // subsref call for that object.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
310 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
311 // Multiple partial evaluations may be required. For example,
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
312 // given a class or classdef object X, then for the expression
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
313 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
314 // x.a{end}(2:end).b
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
315 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
316 // we must evaluate x.a to obtain the size for the first {end}
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
317 // expression, then we must evaluate x.a{end} to obtain the size
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
318 // for the second (2:end) expression. Finally, the complete
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
319 // expression may be evaluated.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
320 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
321 // If X is a cell array in the above expression, and none of the
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
322 // intermediate evaluations produces a class or classdef object,
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
323 // then the evaluation is performed as the following series of
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
324 // steps
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
325 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
326 // tmp = x.a
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
327 // tmp = tmp{end}
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
328 // tmp = tmp(2:end)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
329 // result = tmp.b
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
330 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
331 // If any of the partial evaluations produces a class or classdef
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
332 // object, then the subsref method for that object is called as
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
333 // described above. For example, suppose x.a produces a classdef
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
334 // object. Then the evaluation is performed as the following
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
335 // series of steps
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
336 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
337 // base_expr = tmp = x.a
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
338 // tmp = base_expr{end}
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
339 // base_expr{end}(2:end).b
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
340 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
341 // In the last two steps, the partial value computed in the
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
342 // previous step is used to determine the value of END.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
343
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
344 octave_value_list
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
345 tree_index_expression::evaluate_n (tree_evaluator& tw, int nargout)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
346 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
347 octave_value_list retval;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
348
30723
08b08b7f05b2 Replace direct calls to C library assert() with Octave specialty functions in libinterp/ (bug #61753)
Arun Giridhar <arungiridhar@gmail.com> and Rik <rik@octave.org>
parents: 30564
diff changeset
349 panic_if (m_args.empty ());
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
350
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
351 auto p_args = m_args.begin ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
352 auto p_arg_nm = m_arg_nm.begin ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
353 auto p_dyn_field = m_dyn_field.begin ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
354
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
355 int n = m_args.size ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
356 int beg = 0;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
357
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
358 octave_value base_expr_val;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
359
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
360 if (m_expr->is_identifier () && m_type[beg] == '(')
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
361 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
362 tree_identifier *id = dynamic_cast<tree_identifier *> (m_expr);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
363
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
364 bool is_var = tw.is_variable (m_expr);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
365
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
366 std::string nm = id->name ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
367
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
368 if (is_var && is_word_list_cmd ())
31072
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
369 {
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
370 bool maybe_binary_op = false;
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
371 if ((*p_args) && (*p_args)->length () > 0)
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
372 {
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
373 // check if first character of first argument might be (the
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
374 // start of) a binary operator
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
375 std::string ops = "+-*/\\.^|&";
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
376 string_vector arg_list = (*p_args)->get_arg_names ();
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
377 if (! arg_list.isempty ()
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
378 && (ops.find (arg_list(0)[1]) != std::string::npos))
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
379 maybe_binary_op = true;
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
380 }
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
381
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
382 std::string advice;
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
383 if (maybe_binary_op)
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
384 advice = "\nCheck whitespace around potential binary operator.";
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
385
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
386 error ("variable \"%s\" used as function in command style expression%s",
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
387 nm.c_str (), advice.c_str ());
277e31f0bb60 Change wording of error message when using a variable as function (bug #62552).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
388 }
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
389
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
390 if (! is_var)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
391 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
392 octave_value_list first_args;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
393
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
394 tree_argument_list *al = *p_args;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
395
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
396 if (al && al->length () > 0)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
397 {
27373
25627c524ad8 where possible, use new unwind-protect classes in evaluator
John W. Eaton <jwe@octave.org>
parents: 27371
diff changeset
398 unwind_action act ([&tw] (const std::list<octave_lvalue> *lvl)
25627c524ad8 where possible, use new unwind-protect classes in evaluator
John W. Eaton <jwe@octave.org>
parents: 27371
diff changeset
399 {
25627c524ad8 where possible, use new unwind-protect classes in evaluator
John W. Eaton <jwe@octave.org>
parents: 27371
diff changeset
400 tw.set_lvalue_list (lvl);
25627c524ad8 where possible, use new unwind-protect classes in evaluator
John W. Eaton <jwe@octave.org>
parents: 27371
diff changeset
401 }, tw.lvalue_list ());
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
402
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
403 tw.set_lvalue_list (nullptr);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
404
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
405 string_vector anm = *p_arg_nm;
28618
af302efce502 avoid some unnecessary work when evaluating index expressions
John W. Eaton <jwe@octave.org>
parents: 28552
diff changeset
406
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
407 first_args = tw.convert_to_const_vector (al);
28618
af302efce502 avoid some unnecessary work when evaluating index expressions
John W. Eaton <jwe@octave.org>
parents: 28552
diff changeset
408
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
409 first_args.stash_name_tags (anm);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
410 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
411
28618
af302efce502 avoid some unnecessary work when evaluating index expressions
John W. Eaton <jwe@octave.org>
parents: 28552
diff changeset
412 interpreter& interp = tw.get_interpreter ();
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
413
28618
af302efce502 avoid some unnecessary work when evaluating index expressions
John W. Eaton <jwe@octave.org>
parents: 28552
diff changeset
414 symbol_table& symtab = interp.get_symbol_table ();
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
415
28618
af302efce502 avoid some unnecessary work when evaluating index expressions
John W. Eaton <jwe@octave.org>
parents: 28552
diff changeset
416 octave_value val = symtab.find_function (nm, first_args);
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
417
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
418 octave_function *fcn = nullptr;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
419
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
420 if (val.is_function ())
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
421 fcn = val.function_value (true);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
422
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
423 if (fcn)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
424 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
425 try
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
426 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
427 retval = fcn->call (tw, nargout, first_args);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
428 }
29163
8f67ad8b3103 maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents: 28805
diff changeset
429 catch (index_exception& ie)
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
430 {
29163
8f67ad8b3103 maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents: 28805
diff changeset
431 tw.final_index_error (ie, m_expr);
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
432 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
433
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
434 beg++;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
435 p_args++;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
436 p_arg_nm++;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
437 p_dyn_field++;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
438
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
439 if (n > beg)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
440 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
441 // More indices to follow. Silently ignore
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
442 // extra output values.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
443
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
444 if (retval.length () == 0)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
445 error ("indexing undefined value");
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
446 else
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
447 base_expr_val = retval(0);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
448 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
449 else
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
450 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
451 // No more indices, so we are done.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
452
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
453 // See note at end of function about deleting
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
454 // temporaries prior to pushing result.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
455
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
456 base_expr_val = octave_value ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
457 first_args = octave_value_list ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
458
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
459 return retval;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
460 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
461 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
462 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
463 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
464
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
465 if (base_expr_val.is_undefined ())
27374
d171d356767b don't apply std::move to temporary values
John W. Eaton <jwe@octave.org>
parents: 27373
diff changeset
466 base_expr_val = m_expr->evaluate (tw);
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
467
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
468 // If we are indexing an object or looking at something like
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
469 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
470 // classname.static_function (args, ...);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
471 //
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
472 // then we'll just build a complete index list for one big subsref
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
473 // call. If the expression we are indexing is a classname then
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
474 // base_expr_val will be an octave_classdef_meta object. If we have
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
475 // files in a +packagename folder, they will also be an
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
476 // octave_classdef_meta object, but we don't want to index them.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
477
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
478 std::list<octave_value_list> idx_list;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
479
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
480 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
481 // Note: need new scope so that the following unwind action will
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
482 // happen before we perform the final indexing for objects (for
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
483 // example).
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
484
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
485 unwind_action
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
486 act ([&tw] (const octave_value& val,
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
487 const std::string& index_type,
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
488 const std::list<octave_value_list>& index_list)
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
489 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
490 tw.set_indexed_object (val);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
491 tw.set_index_list (index_type, index_list);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
492 },
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
493 tw.indexed_object (),
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
494 tw.index_type (), tw.index_list ());
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
495
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
496 tw.set_indexed_object ();
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
497 tw.clear_index_list ();
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
498
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
499 bool indexing_object = (base_expr_val.isobject ()
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
500 || base_expr_val.isjava ()
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
501 || (base_expr_val.is_classdef_meta ()
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
502 && ! base_expr_val.is_package ()));
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
503
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
504 octave_value partial_expr_val = base_expr_val;
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
505
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
506 for (int i = beg; i < n; i++)
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
507 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
508 if (i > beg)
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
509 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
510 if (! indexing_object)
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
511 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
512 // Evaluate what we have so far.
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
513
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
514 try
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
515 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
516 // Silently ignore extra output values.
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
517
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
518 octave_value_list tmp_list
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
519 = base_expr_val.subsref (m_type.substr (beg, i-beg),
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
520 idx_list, nargout);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
521
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
522 partial_expr_val
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
523 = tmp_list.length () ? tmp_list(0) : octave_value ();
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
524
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
525 base_expr_val = partial_expr_val;
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
526
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
527 if (partial_expr_val.is_cs_list ())
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
528 err_indexed_cs_list ();
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
529
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
530 retval = partial_expr_val;
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
531
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
532 beg = i;
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
533 idx_list.clear ();
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
534 tw.clear_index_list ();
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
535
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
536 if (partial_expr_val.isobject ()
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
537 || partial_expr_val.isjava ()
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
538 || (partial_expr_val.is_classdef_meta ()
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
539 && ! partial_expr_val.is_package ()))
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
540 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
541 // Found an object, so now we'll build up
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
542 // complete index list for one big subsref
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
543 // call from this point on.
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
544
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
545 // FIXME: is is also possible to have a
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
546 // static method call buried somewhere in
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
547 // the depths of a complex indexing
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
548 // expression so that we would also need to
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
549 // check for an octave_classdef_meta object
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
550 // here?
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
551
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
552 indexing_object = true;
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
553 }
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
554 }
29163
8f67ad8b3103 maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents: 28805
diff changeset
555 catch (index_exception& ie)
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
556 {
29163
8f67ad8b3103 maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents: 28805
diff changeset
557 tw.final_index_error (ie, m_expr);
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
558 }
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
559 }
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
560 }
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
561
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
562 tw.set_indexed_object (partial_expr_val);
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
563
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
564 switch (m_type[i])
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
565 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
566 case '(':
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
567 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
568 octave_value_list tmp = tw.make_value_list (*p_args, *p_arg_nm);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
569 tw.append_index_list ('(', tmp);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
570 idx_list.push_back (tmp);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
571 }
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
572 break;
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
573
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
574 case '{':
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
575 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
576 octave_value_list tmp = tw.make_value_list (*p_args, *p_arg_nm);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
577 tw.append_index_list ('{', tmp);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
578 idx_list.push_back (tmp);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
579 }
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
580 break;
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
581
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
582 case '.':
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
583 {
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
584 octave_value tmp = get_struct_index (tw, p_arg_nm, p_dyn_field);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
585 tw.append_index_list ('.', tmp);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
586 idx_list.push_back (tmp);
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
587 }
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
588 break;
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
589
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
590 default:
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
591 panic_impossible ();
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
592 }
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
593
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
594 p_args++;
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
595 p_arg_nm++;
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
596 p_dyn_field++;
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
597 }
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
598 }
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
599
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
600 // If ! idx_list.empty () that means we still have stuff to index
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
601 // otherwise they would have been dealt with and idx_list would have
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
602 // been emptied.
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
603 if (! idx_list.empty ())
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
604 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
605 // This is for +package and other classdef_meta objects
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
606 if (! base_expr_val.is_function ()
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
607 || base_expr_val.is_classdef_meta ())
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
608 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
609 try
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
610 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
611 retval = base_expr_val.subsref (m_type.substr (beg, n-beg),
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
612 idx_list, nargout);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
613 beg = n;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
614 idx_list.clear ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
615 }
29163
8f67ad8b3103 maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents: 28805
diff changeset
616 catch (index_exception& ie)
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
617 {
29163
8f67ad8b3103 maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents: 28805
diff changeset
618 tw.final_index_error (ie, m_expr);
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
619 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
620 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
621 else
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
622 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
623 // FIXME: we want this to only be a superclass constructor
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
624 // call Should we actually make a check for this or are all
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
625 // other types of calls already dealt with?
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
626
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
627 octave_function *fcn = base_expr_val.function_value ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
628
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
629 if (fcn)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
630 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
631 try
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
632 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
633 // FIXME: is it possible for the IDX_LIST to have
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
634 // more than one element here? Do we need to check?
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
635
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
636 octave_value_list final_args;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
637
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
638 if (idx_list.size () != 1)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
639 error ("unexpected extra index at end of expression");
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
640
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
641 if (m_type[beg] != '(')
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
642 error ("invalid index type '%c' for function call",
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
643 m_type[beg]);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
644
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
645 final_args = idx_list.front ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
646
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
647 // FIXME: Do we ever need the names of the arguments
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
648 // passed to FCN here?
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
649
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
650 retval = fcn->call (tw, nargout, final_args);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
651 }
29163
8f67ad8b3103 maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents: 28805
diff changeset
652 catch (index_exception& ie)
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
653 {
29163
8f67ad8b3103 maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents: 28805
diff changeset
654 tw.final_index_error (ie, m_expr);
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
655 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
656 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
657 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
658 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
659
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
660 // FIXME: when can the following happen? In what case does indexing
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
661 // result in a value that is a function? Classdef method calls?
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
662 // Something else?
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
663
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
664 octave_value val = (retval.length () ? retval(0) : octave_value ());
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
665
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
666 if (val.is_function ())
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
667 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
668 octave_function *fcn = val.function_value (true);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
669
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
670 if (fcn)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
671 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
672 octave_value_list final_args;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
673
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
674 if (! idx_list.empty ())
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
675 {
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
676 if (n - beg != 1)
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
677 error ("unexpected extra index at end of expression");
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
678
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
679 if (m_type[beg] != '(')
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
680 error ("invalid index type '%c' for function call",
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
681 m_type[beg]);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
682
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
683 final_args = idx_list.front ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
684 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
685
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
686 retval = fcn->call (tw, nargout, final_args);
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
687 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
688 }
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
689
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
690 // Delete any temporary values prior to returning so that
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
691 // destructors for any temporary classdef handle objects will be
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents: 28726
diff changeset
692 // called before we return.
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
693
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
694 idx_list.clear ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
695 base_expr_val = octave_value ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
696 val = octave_value ();
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
697
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
698 return retval;
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 26922
diff changeset
699 }
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31073
diff changeset
700
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31073
diff changeset
701 OCTAVE_END_NAMESPACE(octave)
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
702
7099
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
703 /*
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
704 %!test
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14343
diff changeset
705 %! clear x;
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14343
diff changeset
706 %! clear y;
14343
acc26b860afa fix indexed assignment bug (bug #35482)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
707 %! y = 3;
acc26b860afa fix indexed assignment bug (bug #35482)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
708 %! x(y(end)) = 1;
acc26b860afa fix indexed assignment bug (bug #35482)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
709 %! assert (x, [0, 0, 1]);
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14343
diff changeset
710 %! clear x;
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14343
diff changeset
711 %! clear y;
14343
acc26b860afa fix indexed assignment bug (bug #35482)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
712 %! y = {3};
acc26b860afa fix indexed assignment bug (bug #35482)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
713 %! x(y{end}) = 1;
acc26b860afa fix indexed assignment bug (bug #35482)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
714 %! assert (x, [0, 0, 1]);
acc26b860afa fix indexed assignment bug (bug #35482)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
715
acc26b860afa fix indexed assignment bug (bug #35482)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
716 %!test
7099
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
717 %! x = {1, 2, 3};
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
718 %! [x{:}] = deal (4, 5, 6);
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
719 %! assert (x, {4, 5, 6});
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
720
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
721 %!test
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
722 %! [x.a, x.b.c] = deal (1, 2);
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
723 %! assert (x.a == 1 && x.b.c == 2);
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
724
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
725 %!test
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
726 %! [x.a, x(2).b] = deal (1, 2);
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
727 %! assert (x(1).a == 1 && isempty (x(2).a) && isempty (x(1).b) && x(2).b == 2);
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
728
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
729 %!test
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
730 %! x = struct (zeros (0, 1), {"a", "b"});
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
731 %! x(2).b = 1;
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
732 %! assert (x(2).b == 1);
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
733
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
734 %!test
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
735 %! x = struct (zeros (0, 1), {"a", "b"});
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
736 %! x(2).b = 1;
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
737 %! assert (x(2).b == 1);
70f30a92b725 [project @ 2007-11-05 21:51:24 by jwe]
jwe
parents: 7057
diff changeset
738 */