GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
pt-cbinop.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2008-2021 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 
33 class octave_value;
34 class octave_value_list;
35 
36 #include "ov.h"
37 #include "pt-binop.h"
38 #include "pt-walk.h"
39 
40 namespace octave
41 {
42  // Binary expressions that can be reduced to compound operations
43 
45  {
46  public:
47 
49  int l, int c,
53  : tree_binary_expression (a, b, l, c, t), m_lhs (ca), m_rhs (cb),
54  m_etype (ct)
55  { }
56 
58 
59  bool rvalue_ok (void) const { return true; }
60 
61  tree_expression * clhs (void) { return m_lhs; }
62  tree_expression * crhs (void) { return m_rhs; }
63 
64  octave_value evaluate (tree_evaluator&, int nargout = 1);
65 
67  {
68  return ovl (evaluate (tw, nargout));
69  }
70 
71  void accept (tree_walker& tw)
72  {
74  }
75 
76  private:
77 
80 
82 
83  // No copying!
84 
86 
89  };
90 
91  // a "virtual constructor"
92 
95  int l = -1, int c = -1,
98 }
99 
100 #endif
tree_expression * crhs(void)
Definition: pt-cbinop.h:62
octave_value evaluate(tree_evaluator &, int nargout=1)
Definition: pt-cbinop.cc:39
tree_compound_binary_expression(const tree_compound_binary_expression &)=delete
octave_value::compound_binary_op m_etype
Definition: pt-cbinop.h:81
tree_expression * clhs(void)
Definition: pt-cbinop.h:61
octave_value_list evaluate_n(tree_evaluator &tw, int nargout=1)
Definition: pt-cbinop.h:66
tree_compound_binary_expression & operator=(const tree_compound_binary_expression &)=delete
tree_compound_binary_expression(tree_expression *a, tree_expression *b, int l, int c, octave_value::binary_op t, tree_expression *ca, tree_expression *cb, octave_value::compound_binary_op ct)
Definition: pt-cbinop.h:48
octave_value::compound_binary_op cop_type(void) const
Definition: pt-cbinop.h:57
virtual void visit_compound_binary_expression(tree_compound_binary_expression &)
Definition: pt-walk.cc:70
compound_binary_op
Definition: ov.h:121
binary_op
Definition: ov.h:96
@ unknown_binary_op
Definition: ov.h:117
tree_binary_expression * maybe_compound_binary_expression(tree_expression *a, tree_expression *b, int l, int c, octave_value::binary_op t)
Definition: pt-cbinop.cc:203
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:211