GNU Octave  4.0.0
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-2015 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 <string>
27 
28 class tree_walker;
29 
30 class octave_value;
31 class octave_value_list;
32 class octave_lvalue;
33 
34 #include "pt-exp.h"
35 #include "symtab.h"
36 
37 // Unary expressions.
38 
39 class
41 {
42 public:
43 
44  tree_unary_expression (int l = -1, int c = -1,
47  : tree_expression (l, c), op (0), etype (t) { }
48 
49  tree_unary_expression (tree_expression *e, int l = -1, int c = -1,
52  : tree_expression (l, c), op (e), etype (t) { }
53 
54  ~tree_unary_expression (void) { delete op; }
55 
56  bool is_unary_expression (void) const { return true; }
57 
58  bool has_magic_end (void) const { return (op && op->has_magic_end ()); }
59 
60  tree_expression *operand (void) { return op; }
61 
62  std::string oper (void) const;
63 
64  octave_value::unary_op op_type (void) const { return etype; }
65 
66 protected:
67 
68  // The operand for the expression.
70 
71  // The type of the expression.
73 
74 private:
75 
76  // No copying!
77 
79 
81 };
82 
83 // Prefix expressions.
84 
85 class
87 {
88 public:
89 
90  tree_prefix_expression (int l = -1, int c = -1)
91  : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
92 
93  tree_prefix_expression (tree_expression *e, int l = -1, int c = -1,
96  : tree_unary_expression (e, l, c, t) { }
97 
99 
100  bool rvalue_ok (void) const { return true; }
101 
102  octave_value rvalue1 (int nargout = 1);
103 
104  octave_value_list rvalue (int nargout);
105 
108 
109  void accept (tree_walker& tw);
110 
111  std::string profiler_name (void) const { return "prefix " + oper (); }
112 
113 
114 private:
115 
116  // No copying!
117 
119 
121 };
122 
123 // Postfix expressions.
124 
125 class
127 {
128 public:
129 
130  tree_postfix_expression (int l = -1, int c = -1)
131  : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
132 
133  tree_postfix_expression (tree_expression *e, int l = -1, int c = -1,
136  : tree_unary_expression (e, l, c, t) { }
137 
139 
140  bool rvalue_ok (void) const { return true; }
141 
142  octave_value rvalue1 (int nargout = 1);
143 
144  octave_value_list rvalue (int nargout);
145 
148 
149  void accept (tree_walker& tw);
150 
151  std::string profiler_name (void) const { return "postfix " + oper (); }
152 
153 private:
154 
155  // No copying!
156 
158 
160 };
161 
162 #endif
tree_expression * operand(void)
Definition: pt-unop.h:60
octave_value::unary_op op_type(void) const
Definition: pt-unop.h:64
bool rvalue_ok(void) const
Definition: pt-unop.h:100
~tree_postfix_expression(void)
Definition: pt-unop.h:138
tree_unary_expression(int l=-1, int c=-1, octave_value::unary_op t=octave_value::unknown_unary_op)
Definition: pt-unop.h:44
tree_postfix_expression(int l=-1, int c=-1)
Definition: pt-unop.h:130
bool has_magic_end(void) const
Definition: pt-unop.h:58
std::string profiler_name(void) const
Definition: pt-unop.h:111
tree_prefix_expression(int l=-1, int c=-1)
Definition: pt-unop.h:90
octave_value::unary_op etype
Definition: pt-unop.h:72
tree_expression * op
Definition: pt-unop.h:69
bool is_unary_expression(void) const
Definition: pt-unop.h:56
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:133
~tree_prefix_expression(void)
Definition: pt-unop.h:98
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:49
std::string profiler_name(void) const
Definition: pt-unop.h:151
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:93
size_t context_id
Definition: symtab.h:51
unary_op
Definition: ov.h:74
bool rvalue_ok(void) const
Definition: pt-unop.h:140
~tree_unary_expression(void)
Definition: pt-unop.h:54
octave_lvalue & operator=(const octave_lvalue &vr)
Definition: oct-lvalue.h:49