Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_tree_const_h)
00024 #define octave_tree_const_h 1
00025
00026 #include <iosfwd>
00027 #include <string>
00028
00029 #include "oct-alloc.h"
00030
00031 class octave_value_list;
00032 class tree_walker;
00033
00034 #include "ov.h"
00035 #include "pt-bp.h"
00036 #include "pt-exp.h"
00037 #include "symtab.h"
00038
00039 class
00040 tree_constant : public tree_expression
00041 {
00042 public:
00043
00044 tree_constant (int l = -1, int c = -1)
00045 : tree_expression (l, c), val (), orig_text () { }
00046
00047 tree_constant (const octave_value& v, int l = -1, int c = -1)
00048 : tree_expression (l, c), val (v), orig_text () { }
00049
00050 tree_constant (const octave_value& v, const std::string& ot,
00051 int l = -1, int c = -1)
00052 : tree_expression (l, c), val (v), orig_text (ot) { }
00053
00054 ~tree_constant (void) { }
00055
00056 bool has_magic_end (void) const { return false; }
00057
00058
00059
00060 bool is_constant (void) const { return true; }
00061
00062 void maybe_mutate (void) { val.maybe_mutate (); }
00063
00064 void print (std::ostream& os, bool pr_as_read_syntax = false,
00065 bool pr_orig_txt = true);
00066
00067 void print_raw (std::ostream& os, bool pr_as_read_syntax = false,
00068 bool pr_orig_txt = true);
00069
00070 bool rvalue_ok (void) const { return true; }
00071
00072 octave_value rvalue1 (int = 1) { return val; }
00073
00074 octave_value_list rvalue (int nargout);
00075
00076 tree_expression *dup (symbol_table::scope_id scope,
00077 symbol_table::context_id context) const;
00078
00079 void accept (tree_walker& tw);
00080
00081
00082
00083
00084 void stash_original_text (const std::string& s) { orig_text = s; }
00085
00086 std::string original_text (void) const { return orig_text; }
00087
00088 private:
00089
00090
00091 octave_value val;
00092
00093
00094 std::string orig_text;
00095
00096
00097
00098 tree_constant (const tree_constant&);
00099
00100 tree_constant& operator = (const tree_constant&);
00101
00102 DECLARE_OCTAVE_ALLOCATOR
00103 };
00104
00105 #endif