GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
pt-cbinop.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2008-2025 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 (octave_pt_cbinop_h)
27#define octave_pt_cbinop_h 1
28
29#include "octave-config.h"
30
31#include <string>
32
33class octave_value;
35
36#include "ov.h"
37#include "pt-binop.h"
38#include "pt-walk.h"
39
41
42// Binary expressions that can be reduced to compound operations
43
45{
46public:
47
50 : tree_binary_expression (a, op_tok, b, t), m_lhs (ca), m_rhs (cb), m_etype (ct)
51 { }
52
53 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_compound_binary_expression)
54
55 // FIXME: who is responsibile for deleting M_LHS and M_RHS?
57
58 octave_value::compound_binary_op cop_type () const { return m_etype; }
59
60 bool rvalue_ok () const { return true; }
61
62 tree_expression * clhs () { return m_lhs; }
63 tree_expression * crhs () { return m_rhs; }
64
65 octave_value evaluate (tree_evaluator&, int nargout = 1);
66
68 {
69 return ovl (evaluate (tw, nargout));
70 }
71
73 {
75 }
76
77private:
78
79 tree_expression *m_lhs;
80 tree_expression *m_rhs;
81
83};
84
85// a "virtual constructor"
86
89
90OCTAVE_END_NAMESPACE(octave)
91
92#endif
compound_binary_op
Definition ov.h:117
binary_op
Definition ov.h:92
@ unknown_binary_op
Definition ov.h:113
Definition token.h:42
octave_value::compound_binary_op cop_type() const
Definition pt-cbinop.h:58
tree_expression * clhs()
Definition pt-cbinop.h:62
tree_compound_binary_expression(tree_expression *a, const token &op_tok, tree_expression *b, octave_value::binary_op t, tree_expression *ca, tree_expression *cb, octave_value::compound_binary_op ct)
Definition pt-cbinop.h:48
octave_value_list evaluate_n(tree_evaluator &tw, int nargout=1)
Definition pt-cbinop.h:67
void accept(tree_walker &tw)
Definition pt-cbinop.h:72
tree_expression * crhs()
Definition pt-cbinop.h:63
virtual void visit_compound_binary_expression(tree_compound_binary_expression &)
Definition pt-walk.cc:162
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition ovl.h:217
tree_binary_expression * maybe_compound_binary_expression(tree_expression *a, const token &op_tok, tree_expression *b, octave_value::binary_op t=octave_value::unknown_binary_op)
Definition pt-cbinop.cc:143