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 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include <iostream>
00028
00029 #include "error.h"
00030 #include "oct-obj.h"
00031 #include "pager.h"
00032 #include "pt-const.h"
00033 #include "pt-walk.h"
00034
00035
00036
00037 DEFINE_OCTAVE_ALLOCATOR2 (tree_constant, 1024);
00038
00039 void
00040 tree_constant::print (std::ostream& os, bool pr_as_read_syntax, bool pr_orig_text)
00041 {
00042 if (pr_orig_text && ! orig_text.empty ())
00043 os << orig_text;
00044 else
00045 val.print (os, pr_as_read_syntax);
00046 }
00047
00048 void
00049 tree_constant::print_raw (std::ostream& os, bool pr_as_read_syntax,
00050 bool pr_orig_text)
00051 {
00052 if (pr_orig_text && ! orig_text.empty ())
00053 os << orig_text;
00054 else
00055 val.print_raw (os, pr_as_read_syntax);
00056 }
00057
00058 octave_value_list
00059 tree_constant::rvalue (int nargout)
00060 {
00061 octave_value_list retval;
00062
00063 if (nargout > 1)
00064 error ("invalid number of output arguments for constant expression");
00065 else
00066 retval = rvalue1 (nargout);
00067
00068 return retval;
00069 }
00070
00071 tree_expression *
00072 tree_constant::dup (symbol_table::scope_id,
00073 symbol_table::context_id) const
00074 {
00075 tree_constant *new_tc
00076 = new tree_constant (val, orig_text, line (), column ());
00077
00078 new_tc->copy_base (*this);
00079
00080 return new_tc;
00081 }
00082
00083 void
00084 tree_constant::accept (tree_walker& tw)
00085 {
00086 tw.visit_constant (*this);
00087 }