GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
libinterp
parse-tree
pt-unop.h
Go to the documentation of this file.
1
/*
2
3
Copyright (C) 1996-2013 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
40
tree_unary_expression
:
public
tree_expression
41
{
42
public
:
43
44
tree_unary_expression
(
int
l = -1,
int
c = -1,
45
octave_value::unary_op
t
46
=
octave_value::unknown_unary_op
)
47
:
tree_expression
(l, c), op (0), etype (t) { }
48
49
tree_unary_expression
(
tree_expression
*e,
int
l = -1,
int
c = -1,
50
octave_value::unary_op
t
51
=
octave_value::unknown_unary_op
)
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.
69
tree_expression
*
op
;
70
71
// The type of the expression.
72
octave_value::unary_op
etype
;
73
74
private
:
75
76
// No copying!
77
78
tree_unary_expression
(
const
tree_unary_expression
&);
79
80
tree_unary_expression
&
operator =
(
const
tree_unary_expression
&);
81
};
82
83
// Prefix expressions.
84
85
class
86
tree_prefix_expression
:
public
tree_unary_expression
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,
94
octave_value::unary_op
t
95
=
octave_value::unknown_unary_op
)
96
:
tree_unary_expression
(e, l, c, t) { }
97
98
~tree_prefix_expression
(
void
) { }
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
106
tree_expression
*dup (
symbol_table::scope_id
scope,
107
symbol_table::context_id
context
)
const
;
108
109
void
accept (
tree_walker
& tw);
110
111
private
:
112
113
// No copying!
114
115
tree_prefix_expression
(
const
tree_prefix_expression
&);
116
117
tree_prefix_expression
&
operator =
(
const
tree_prefix_expression
&);
118
};
119
120
// Postfix expressions.
121
122
class
123
tree_postfix_expression
:
public
tree_unary_expression
124
{
125
public
:
126
127
tree_postfix_expression
(
int
l = -1,
int
c = -1)
128
:
tree_unary_expression
(l, c,
octave_value
::unknown_unary_op) { }
129
130
tree_postfix_expression
(
tree_expression
*e,
int
l = -1,
int
c = -1,
131
octave_value::unary_op
t
132
=
octave_value::unknown_unary_op
)
133
:
tree_unary_expression
(e, l, c, t) { }
134
135
~tree_postfix_expression
(
void
) { }
136
137
bool
rvalue_ok
(
void
)
const
{
return
true
; }
138
139
octave_value
rvalue1 (
int
nargout = 1);
140
141
octave_value_list
rvalue (
int
nargout);
142
143
tree_expression
*dup (
symbol_table::scope_id
scope,
144
symbol_table::context_id
context
)
const
;
145
146
void
accept (
tree_walker
& tw);
147
148
private
:
149
150
// No copying!
151
152
tree_postfix_expression
(
const
tree_postfix_expression
&);
153
154
tree_postfix_expression
&
operator =
(
const
tree_postfix_expression
&);
155
};
156
157
#endif
Generated on Mon Dec 30 2013 03:04:38 for GNU Octave by
1.8.1.2