Mercurial > octave-nkf
diff src/pt-const.cc @ 2124:97a566037a75
[project @ 1996-05-12 07:16:36 by jwe]
author | jwe |
---|---|
date | Sun, 12 May 1996 07:16:36 +0000 |
parents | d750e30a03e4 |
children | 138b3c98dc85 |
line wrap: on
line diff
--- a/src/pt-const.cc Sun May 12 07:16:36 1996 +0000 +++ b/src/pt-const.cc Sun May 12 07:16:36 1996 +0000 @@ -53,6 +53,7 @@ #include "pr-output.h" #include "sysdep.h" #include "pt-const.h" +#include "pt-walk.h" #include "unwind-prot.h" #include "user-prefs.h" #include "utils.h" @@ -407,18 +408,9 @@ } void -octave_value::print_code (ostream& os) +octave_value::accept (tree_walker& tw) { - print_code_indent (os); - - if (in_parens) - os << "("; - - if (rep) - rep->print_code (os); - - if (in_parens) - os << ")"; + tw.visit_octave_value (*this); } // The real representation of constants. @@ -2320,69 +2312,6 @@ } void -OCT_VAL_REP::print_code (ostream& os) -{ - switch (type_tag) - { - case scalar_constant: - if (orig_text.empty ()) - octave_print_internal (os, scalar, 1); - else - os << orig_text; - break; - - case matrix_constant: - octave_print_internal (os, *matrix, 1); - break; - - case complex_scalar_constant: - { - double re = complex_scalar->real (); - double im = complex_scalar->imag (); - - // If we have the original text and a pure imaginary, just - // print the original text, because this must be a constant - // that was parsed as part of a function. - - if (! orig_text.empty () && re == 0.0 && im > 0.0) - os << orig_text; - else - octave_print_internal (os, *complex_scalar, 1); - } - break; - - case complex_matrix_constant: - octave_print_internal (os, *complex_matrix, 1); - break; - - case char_matrix_constant: - octave_print_internal (os, *char_matrix, 1); - break; - - case char_matrix_constant_str: - octave_print_internal (os, *char_matrix, 1, 1); - break; - - case range_constant: - octave_print_internal (os, *range, 1); - break; - - case magic_colon: - os << ":"; - break; - - case all_va_args: - os << "all_va_args"; - break; - - case map_constant: - case unknown_constant: - panic_impossible (); - break; - } -} - -void OCT_VAL_REP::gripe_wrong_type_arg (const char *name, const octave_value_rep& tcr) const {