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-colon.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_colon_h)
24 #define octave_pt_colon_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 // Colon expressions.
40 
41 class
43 {
44 public:
45 
46  tree_colon_expression (int l = -1, int c = -1)
47  : tree_expression (l, c), op_base (0), op_limit (0),
48  op_increment (0), save_base (false) { }
49 
50  tree_colon_expression (tree_expression *e, int l = -1, int c = -1)
51  : tree_expression (l, c), op_base (e), op_limit (0),
52  op_increment (0), save_base (false) { }
53 
55  tree_expression *inc, int l = -1, int c = -1)
56  : tree_expression (l, c), op_base (bas), op_limit (lim),
57  op_increment (inc), save_base (false) { }
58 
60  {
61  if (! save_base)
62  delete op_base;
63 
64  delete op_limit;
65  delete op_increment;
66  }
67 
68  bool has_magic_end (void) const
69  {
70  return ((op_base && op_base->has_magic_end ())
71  || (op_limit && op_limit->has_magic_end ())
72  || (op_increment && op_increment->has_magic_end ()));
73  }
74 
75  void preserve_base (void) { save_base = true; }
76 
78 
79  bool rvalue_ok (void) const { return true; }
80 
81  octave_value rvalue1 (int nargout = 1);
82 
83  octave_value_list rvalue (int nargout);
84 
85  void eval_error (const std::string& s) const;
86 
87  tree_expression *base (void) { return op_base; }
88 
89  tree_expression *limit (void) { return op_limit; }
90 
91  tree_expression *increment (void) { return op_increment; }
92 
93  int line (void) const;
94  int column (void) const;
95 
98 
99  void accept (tree_walker& tw);
100 
101 private:
102 
103  // The components of the expression.
107 
108  bool save_base;
109 
110  // No copying!
111 
113 
115 };
116 
117 #endif
OCTAVE_EXPORT octave_value_list column
Definition: sparse.cc:123
void preserve_base(void)
Definition: pt-colon.h:75
bool has_magic_end(void) const
Definition: pt-colon.h:68
tree_expression * op_increment
Definition: pt-colon.h:106
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
s
Definition: file-io.cc:2682
i e
Definition: data.cc:2724
tree_expression * increment(void)
Definition: pt-colon.h:91
tree_colon_expression(tree_expression *bas, tree_expression *lim, tree_expression *inc, int l=-1, int c=-1)
Definition: pt-colon.h:54
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_colon_expression(int l=-1, int c=-1)
Definition: pt-colon.h:46
static OCTAVE_NORETURN void eval_error(const char *msg, const dim_vector &x, const dim_vector &y)
Definition: pt-mat.cc:279
tree_expression * limit(void)
Definition: pt-colon.h:89
is false
Definition: cellfun.cc:398
bool append
Definition: load-save.cc:1582
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_expression * op_limit
Definition: pt-colon.h:105
tree_colon_expression(tree_expression *e, int l=-1, int c=-1)
Definition: pt-colon.h:50
bool rvalue_ok(void) const
Definition: pt-colon.h:79
tree_expression * base(void)
Definition: pt-colon.h:87
~tree_colon_expression(void)
Definition: pt-colon.h:59
tree_expression * op_base
Definition: pt-colon.h:104
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