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-unop.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_unop_h)
24 #define octave_pt_unop_h 1
25 
26 #include "octave-config.h"
27 
28 #include <string>
29 
30 class tree_walker;
31 
32 class octave_value;
33 class octave_value_list;
34 class octave_lvalue;
35 
36 #include "pt-exp.h"
37 #include "symtab.h"
38 
39 // Unary expressions.
40 
41 class
43 {
44 public:
45 
46  tree_unary_expression (int l = -1, int c = -1,
49  : tree_expression (l, c), op (0), etype (t) { }
50 
51  tree_unary_expression (tree_expression *e, int l = -1, int c = -1,
54  : tree_expression (l, c), op (e), etype (t) { }
55 
56  ~tree_unary_expression (void) { delete op; }
57 
58  bool is_unary_expression (void) const { return true; }
59 
60  bool has_magic_end (void) const { return (op && op->has_magic_end ()); }
61 
62  tree_expression *operand (void) { return op; }
63 
64  std::string oper (void) const;
65 
66  octave_value::unary_op op_type (void) const { return etype; }
67 
68 protected:
69 
70  // The operand for the expression.
72 
73  // The type of the expression.
75 
76 private:
77 
78  // No copying!
79 
81 
83 };
84 
85 // Prefix expressions.
86 
87 class
89 {
90 public:
91 
92  tree_prefix_expression (int l = -1, int c = -1)
93  : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
94 
95  tree_prefix_expression (tree_expression *e, int l = -1, int c = -1,
98  : tree_unary_expression (e, l, c, t) { }
99 
101 
102  bool rvalue_ok (void) const { return true; }
103 
104  octave_value rvalue1 (int nargout = 1);
105 
106  octave_value_list rvalue (int nargout);
107 
110 
111  void accept (tree_walker& tw);
112 
113  std::string profiler_name (void) const { return "prefix " + oper (); }
114 
115 private:
116 
117  // No copying!
118 
120 
122 };
123 
124 // Postfix expressions.
125 
126 class
128 {
129 public:
130 
131  tree_postfix_expression (int l = -1, int c = -1)
132  : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
133 
134  tree_postfix_expression (tree_expression *e, int l = -1, int c = -1,
137  : tree_unary_expression (e, l, c, t) { }
138 
140 
141  bool rvalue_ok (void) const { return true; }
142 
143  octave_value rvalue1 (int nargout = 1);
144 
145  octave_value_list rvalue (int nargout);
146 
149 
150  void accept (tree_walker& tw);
151 
152  std::string profiler_name (void) const { return "postfix " + oper (); }
153 
154 private:
155 
156  // No copying!
157 
159 
161 };
162 
163 #endif
tree_expression * operand(void)
Definition: pt-unop.h:62
octave_value::unary_op op_type(void) const
Definition: pt-unop.h:66
bool rvalue_ok(void) const
Definition: pt-unop.h:102
~tree_postfix_expression(void)
Definition: pt-unop.h:139
tree_unary_expression(int l=-1, int c=-1, octave_value::unary_op t=octave_value::unknown_unary_op)
Definition: pt-unop.h:46
tree_postfix_expression(int l=-1, int c=-1)
Definition: pt-unop.h:131
bool has_magic_end(void) const
Definition: pt-unop.h:60
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
i e
Definition: data.cc:2724
std::string profiler_name(void) const
Definition: pt-unop.h:113
tree_prefix_expression(int l=-1, int c=-1)
Definition: pt-unop.h:92
octave_value::unary_op etype
Definition: pt-unop.h:74
tree_expression * op
Definition: pt-unop.h:71
bool is_unary_expression(void) const
Definition: pt-unop.h:58
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
static llvm::LLVMContext & context
Definition: jit-typeinfo.cc:76
tree_postfix_expression(tree_expression *e, int l=-1, int c=-1, octave_value::unary_op t=octave_value::unknown_unary_op)
Definition: pt-unop.h:134
~tree_prefix_expression(void)
Definition: pt-unop.h:100
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
tree_unary_expression(tree_expression *e, int l=-1, int c=-1, octave_value::unary_op t=octave_value::unknown_unary_op)
Definition: pt-unop.h:51
std::string profiler_name(void) const
Definition: pt-unop.h:152
tree_prefix_expression(tree_expression *e, int l=-1, int c=-1, octave_value::unary_op t=octave_value::unknown_unary_op)
Definition: pt-unop.h:95
unary_op
Definition: ov.h:76
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
bool rvalue_ok(void) const
Definition: pt-unop.h:141
~tree_unary_expression(void)
Definition: pt-unop.h:56
octave_lvalue & operator=(const octave_lvalue &vr)
Definition: oct-lvalue.h:51