GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
anon-fcn-validator.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2019-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <string>
31 
32 #include "anon-fcn-validator.h"
33 #include "ov.h"
34 #include "pt-all.h"
35 
37 
39  tree_expression *expr)
40  : m_ok (true), m_line (-1), m_column (-1), m_message ()
41 {
42  expr->accept (*this);
43 }
44 
45 void
47 {
48  octave_value::unary_op op = expr.op_type ();
49 
51  error (expr);
52  else
54 }
55 
56 void
58 {
59  octave_value::unary_op op = expr.op_type ();
60 
62  error (expr);
63  else
65 }
66 
67 void
69 {
70  error (expr);
71 }
72 
73 void
75 {
76  error (expr);
77 }
78 
79 void
80 anon_fcn_validator::error (tree_expression& expr)
81 {
82  m_ok = false;
83  m_line = expr.line ();
84  m_column = expr.column ();
85  m_message
86  = "invalid use of operator " + expr.oper () + " in anonymous function";
87 }
88 
89 OCTAVE_END_NAMESPACE(octave)
void visit_prefix_expression(tree_prefix_expression &)
void visit_multi_assignment(tree_multi_assignment &)
void visit_simple_assignment(tree_simple_assignment &)
void visit_postfix_expression(tree_postfix_expression &)
unary_op
Definition: ov.h:79
@ op_incr
Definition: ov.h:85
@ op_decr
Definition: ov.h:86
virtual std::string oper() const
Definition: pt-exp.h:100
octave_value::unary_op op_type() const
Definition: pt-unop.h:72
virtual void visit_postfix_expression(tree_postfix_expression &)
Definition: pt-walk.cc:529
virtual void visit_prefix_expression(tree_prefix_expression &)
Definition: pt-walk.cc:538
virtual int line() const
Definition: pt.h:56
virtual int column() const
Definition: pt.h:58
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn