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-const.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-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_const_h)
24 #define octave_pt_const_h 1
25 
26 #include "octave-config.h"
27 
28 #include <iosfwd>
29 #include <string>
30 
31 
32 class octave_value_list;
33 class tree_walker;
34 
35 #include "ov.h"
36 #include "pt-bp.h"
37 #include "pt-exp.h"
38 #include "symtab.h"
39 
40 class
42 {
43 public:
44 
45  tree_constant (int l = -1, int c = -1)
46  : tree_expression (l, c), val (), orig_text () { }
47 
48  tree_constant (const octave_value& v, int l = -1, int c = -1)
49  : tree_expression (l, c), val (v), orig_text () { }
50 
51  tree_constant (const octave_value& v, const std::string& ot,
52  int l = -1, int c = -1)
53  : tree_expression (l, c), val (v), orig_text (ot) { }
54 
55  ~tree_constant (void) { }
56 
57  bool has_magic_end (void) const { return false; }
58 
59  // Type. It would be nice to eliminate the need for this.
60 
61  bool is_constant (void) const { return true; }
62 
63  void maybe_mutate (void) { val.maybe_mutate (); }
64 
65  void print (std::ostream& os, bool pr_as_read_syntax = false,
66  bool pr_orig_txt = true);
67 
68  void print_raw (std::ostream& os, bool pr_as_read_syntax = false,
69  bool pr_orig_txt = true);
70 
71  bool rvalue_ok (void) const { return true; }
72 
73  octave_value rvalue1 (int = 1) { return val; }
74 
75  octave_value_list rvalue (int nargout);
76 
79 
80  void accept (tree_walker& tw);
81 
82  // Store the original text corresponding to this constant for later
83  // pretty printing.
84 
85  void stash_original_text (const std::string& s) { orig_text = s; }
86 
87  std::string original_text (void) const { return orig_text; }
88 
89 private:
90 
91  // The actual value that this constant refers to.
93 
94  // The original text form of this constant.
96 
97  // No copying!
98 
100 
102 
103 };
104 
105 #endif
tree_constant(const octave_value &v, int l=-1, int c=-1)
Definition: pt-const.h:48
void maybe_mutate(void)
Definition: pt-const.h:63
octave_value rvalue1(int=1)
Definition: pt-const.h:73
octave_value val
Definition: pt-const.h:92
tree_constant(int l=-1, int c=-1)
Definition: pt-const.h:45
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
~tree_constant(void)
Definition: pt-const.h:55
bool rvalue_ok(void) const
Definition: pt-const.h:71
s
Definition: file-io.cc:2682
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
std::string orig_text
Definition: pt-const.h:95
void stash_original_text(const std::string &s)
Definition: pt-const.h:85
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
bool is_constant(void) const
Definition: pt-const.h:61
tree_constant(const octave_value &v, const std::string &ot, int l=-1, int c=-1)
Definition: pt-const.h:51
bool has_magic_end(void) const
Definition: pt-const.h:57
std::string original_text(void) const
Definition: pt-const.h:87
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
tree_walker & operator=(const tree_walker &)