GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pt-assign.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_pt_assign_h)
24 #define octave_pt_assign_h 1
25 
26 #include "octave-config.h"
27 
28 #include <iosfwd>
29 #include <string>
30 
31 class tree_argument_list;
32 class tree_walker;
33 
34 class octave_value;
35 class octave_value_list;
36 class octave_lvalue;
37 
38 #include "ov.h"
39 #include "pt-exp.h"
40 #include "symtab.h"
41 
42 // Simple assignment expressions.
43 
44 class
46 {
47 public:
48 
49  tree_simple_assignment (bool plhs = false, int l = -1, int c = -1,
51  : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), ans_ass (),
52  etype (t) { }
53 
55  bool plhs = false, int l = -1, int c = -1,
57 
58  ~tree_simple_assignment (void);
59 
60  bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
61 
62  bool rvalue_ok (void) const { return true; }
63 
64  octave_value rvalue1 (int nargout = 1);
65 
66  octave_value_list rvalue (int nargout);
67 
68  bool is_assignment_expression (void) const { return true; }
69 
70  std::string oper (void) const;
71 
72  tree_expression *left_hand_side (void) { return lhs; }
73 
74  tree_expression *right_hand_side (void) { return rhs; }
75 
78 
79  void accept (tree_walker& tw);
80 
81  octave_value::assign_op op_type (void) const { return etype; }
82 
83 private:
84 
85  void do_assign (octave_lvalue& ult, const octave_value_list& args,
86  const octave_value& rhs_val);
87 
88  void do_assign (octave_lvalue& ult, const octave_value& rhs_val);
89 
90  // The left hand side of the assignment.
92 
93  // The right hand side of the assignment.
95 
96  // True if we should not delete the lhs.
97  bool preserve;
98 
99  // True if this is an assignment to the automatic variable ans.
100  bool ans_ass;
101 
102  // The type of the expression.
104 
105  // No copying!
106 
108 
110 };
111 
112 // Multi-valued assignment expressions.
113 
114 class
116 {
117 public:
118 
119  tree_multi_assignment (bool plhs = false, int l = -1, int c = -1)
120  : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs) { }
121 
123  bool plhs = false, int l = -1, int c = -1);
124 
125  ~tree_multi_assignment (void);
126 
127  bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
128 
129  bool is_assignment_expression (void) const { return true; }
130 
131  bool rvalue_ok (void) const { return true; }
132 
133  octave_value rvalue1 (int nargout = 1);
134 
135  octave_value_list rvalue (int nargout);
136 
137  std::string oper (void) const;
138 
139  tree_argument_list *left_hand_side (void) { return lhs; }
140 
141  tree_expression *right_hand_side (void) { return rhs; }
142 
145 
146  void accept (tree_walker& tw);
147 
149  { return octave_value::op_asn_eq; }
150 
151 private:
152 
153  // The left hand side of the assignment.
155 
156  // The right hand side of the assignment.
158 
159  // True if we should not delete the lhs.
160  bool preserve;
161 
162  // No copying!
163 
165 
167 };
168 
169 #endif
octave_value::assign_op op_type(void) const
Definition: pt-assign.h:81
tree_multi_assignment(bool plhs=false, int l=-1, int c=-1)
Definition: pt-assign.h:119
tree_simple_assignment(bool plhs=false, int l=-1, int c=-1, octave_value::assign_op t=octave_value::op_asn_eq)
Definition: pt-assign.h:49
assign_op
Definition: ov.h:131
tree_expression * left_hand_side(void)
Definition: pt-assign.h:72
octave_value::assign_op etype
Definition: pt-assign.h:103
tree_argument_list * left_hand_side(void)
Definition: pt-assign.h:139
bool rvalue_ok(void) const
Definition: pt-assign.h:131
bool has_magic_end(void) const
Definition: pt-assign.h:60
tree_expression * rhs
Definition: pt-assign.h:94
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:935
JNIEnv void * args
Definition: ov-java.cc:67
tree_expression * right_hand_side(void)
Definition: pt-assign.h:74
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:935
bool rvalue_ok(void) const
Definition: pt-assign.h:62
static llvm::LLVMContext & context
Definition: jit-typeinfo.cc:76
tree_expression * lhs
Definition: pt-assign.h:91
octave_value::assign_op op_type(void) const
Definition: pt-assign.h:148
bool has_magic_end(void) const
Definition: pt-assign.h:127
tree_argument_list * lhs
Definition: pt-assign.h:154
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
bool is_assignment_expression(void) const
Definition: pt-assign.h:68
bool is_assignment_expression(void) const
Definition: pt-assign.h:129
tree_expression * right_hand_side(void)
Definition: pt-assign.h:141
tree_expression * rhs
Definition: pt-assign.h:157
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
octave_lvalue & operator=(const octave_lvalue &vr)
Definition: oct-lvalue.h:51