~ubuntu-branches/debian/sid/octave3.0/sid

« back to all changes in this revision

Viewing changes to src/pt-unop.h

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2007-12-23 16:04:15 UTC
  • Revision ID: james.westby@ubuntu.com-20071223160415-n4gk468dihy22e9v
Tags: upstream-3.0.0
ImportĀ upstreamĀ versionĀ 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006,
 
4
              2007 John W. Eaton
 
5
 
 
6
This file is part of Octave.
 
7
 
 
8
Octave is free software; you can redistribute it and/or modify it
 
9
under the terms of the GNU General Public License as published by the
 
10
Free Software Foundation; either version 3 of the License, or (at your
 
11
option) any later version.
 
12
 
 
13
Octave is distributed in the hope that it will be useful, but WITHOUT
 
14
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
15
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
16
for more details.
 
17
 
 
18
You should have received a copy of the GNU General Public License
 
19
along with Octave; see the file COPYING.  If not, see
 
20
<http://www.gnu.org/licenses/>.
 
21
 
 
22
*/
 
23
 
 
24
#if !defined (octave_tree_unop_h)
 
25
#define octave_tree_unop_h 1
 
26
 
 
27
#include <string>
 
28
 
 
29
class tree_walker;
 
30
 
 
31
class octave_value;
 
32
class octave_value_list;
 
33
class octave_lvalue;
 
34
 
 
35
#include "pt-exp.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 has_magic_end (void) const { return (op && op->has_magic_end ()); }
 
57
 
 
58
  tree_expression *operand (void) { return op; }
 
59
 
 
60
  std::string oper (void) const;
 
61
  
 
62
  octave_value::unary_op op_type (void) const { return etype; }
 
63
 
 
64
protected:
 
65
 
 
66
  // The operand for the expression.
 
67
  tree_expression *op;
 
68
 
 
69
  // The type of the expression.
 
70
  octave_value::unary_op etype;
 
71
 
 
72
private:
 
73
 
 
74
  // No copying!
 
75
 
 
76
  tree_unary_expression (const tree_unary_expression&);
 
77
 
 
78
  tree_unary_expression& operator = (const tree_unary_expression&);
 
79
};
 
80
 
 
81
// Prefix expressions.
 
82
 
 
83
class
 
84
tree_prefix_expression : public tree_unary_expression
 
85
{
 
86
public:
 
87
 
 
88
  tree_prefix_expression (int l = -1, int c = -1)
 
89
    : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
 
90
 
 
91
  tree_prefix_expression (tree_expression *e, int l = -1, int c = -1,
 
92
                          octave_value::unary_op t
 
93
                            = octave_value::unknown_unary_op)
 
94
    : tree_unary_expression (e, l, c, t) { }
 
95
 
 
96
  ~tree_prefix_expression (void) { }
 
97
 
 
98
  bool rvalue_ok (void) const { return true; }
 
99
 
 
100
  octave_value rvalue (void);
 
101
 
 
102
  octave_value_list rvalue (int nargout);
 
103
 
 
104
  void eval_error (void);
 
105
 
 
106
  tree_expression *dup (symbol_table *sym_tab);
 
107
 
 
108
  void accept (tree_walker& tw);
 
109
 
 
110
private:
 
111
 
 
112
  // No copying!
 
113
 
 
114
  tree_prefix_expression (const tree_prefix_expression&);
 
115
 
 
116
  tree_prefix_expression& operator = (const tree_prefix_expression&);
 
117
};
 
118
 
 
119
// Postfix expressions.
 
120
 
 
121
class
 
122
tree_postfix_expression : public tree_unary_expression
 
123
{
 
124
public:
 
125
 
 
126
  tree_postfix_expression (int l = -1, int c = -1)
 
127
    : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
 
128
 
 
129
  tree_postfix_expression (tree_expression *e, int l = -1, int c = -1,
 
130
                           octave_value::unary_op t
 
131
                             = octave_value::unknown_unary_op)
 
132
    : tree_unary_expression (e, l, c, t) { }
 
133
 
 
134
  ~tree_postfix_expression (void) { }
 
135
 
 
136
  bool rvalue_ok (void) const { return true; }
 
137
 
 
138
  octave_value rvalue (void);
 
139
 
 
140
  octave_value_list rvalue (int nargout);
 
141
 
 
142
  void eval_error (void);
 
143
 
 
144
  tree_expression *dup (symbol_table *sym_tab);
 
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
 
158
 
 
159
/*
 
160
;;; Local Variables: ***
 
161
;;; mode: C++ ***
 
162
;;; End: ***
 
163
*/