26 #if defined (HAVE_CONFIG_H)
45 print_parens (afh,
"(");
52 param_list->
accept (*
this);
56 print_parens (afh,
")");
62 auto p = lst.
begin ();
64 while (p != lst.
end ())
84 m_os <<
"arguments ... endarguments";
122 print_parens (expr,
"(");
129 m_os <<
' ' << expr.
oper () <<
' ';
136 print_parens (expr,
")");
152 print_parens (expr,
"(");
177 print_parens (expr,
")");
193 m_os << cmd.
name () <<
' ';
198 init_list->
accept (*
this);
204 auto p = lst.
begin ();
206 while (p != lst.
end ())
277 increment_indent_level ();
281 decrement_indent_level ();
288 m_os << (cmd.
in_parallel () ?
"endparfor" :
"endfor");
299 m_nesting.push (
'[');
320 increment_indent_level ();
324 decrement_indent_level ();
349 increment_indent_level ();
353 decrement_indent_level ();
385 increment_indent_level ();
402 print_comment_list (leading_comment);
418 std::string fcn_name = fcn.
name ();
420 m_os << (fcn_name.empty () ?
"(empty)" : fcn_name) <<
' ';
425 param_list->accept (*
this);
456 print_parens (
id,
"(");
458 std::string nm =
id.name ();
459 m_os << (nm.empty () ?
"(empty)" : nm);
461 print_parens (
id,
")");
478 increment_indent_level ();
482 decrement_indent_level ();
510 auto p = lst.
begin ();
512 bool first_elt =
true;
514 while (p != lst.
end ())
544 print_parens (expr,
"(");
551 std::list<tree_argument_list *> arg_lists = expr.
arg_lists ();
552 std::string type_tags = expr.
type_tags ();
553 std::list<string_vector> arg_names = expr.
arg_names ();
554 std::list<tree_expression *> dyn_fields = expr.
dyn_fields ();
556 int n = type_tags.length ();
558 auto p_arg_lists = arg_lists.begin ();
559 auto p_arg_names = arg_names.begin ();
560 auto p_dyn_fields = dyn_fields.begin ();
562 for (
int i = 0; i <
n; i++)
564 switch (type_tags[i])
568 char nc = m_nesting.top ();
569 if ((nc ==
'[' || nc ==
'{') && expr.
paren_count () == 0)
573 m_nesting.push (
'(');
586 char nc = m_nesting.top ();
587 if ((nc ==
'[' || nc ==
'{') && expr.
paren_count () == 0)
593 m_nesting.push (
'(');
606 std::string fn = (*p_arg_names)(0);
613 m_nesting.push (
'(');
634 print_parens (expr,
")");
642 print_parens (lst,
"(");
645 m_nesting.push (
'[');
647 auto p = lst.
begin ();
649 while (p != lst.
end ())
665 print_parens (lst,
")");
673 print_parens (lst,
"(");
676 m_nesting.push (
'{');
678 auto p = lst.
begin ();
680 while (p != lst.
end ())
696 print_parens (lst,
")");
704 print_parens (expr,
"(");
715 m_nesting.push (
'[');
727 m_os <<
' ' << expr.
oper () <<
' ';
734 print_parens (expr,
")");
741 decrement_indent_level ();
753 print_parens (val,
"(");
755 val.
print_raw (m_os,
true, m_print_original_text);
757 print_parens (val,
")");
765 print_parens (fh,
"(");
767 fh.
print_raw (m_os,
true, m_print_original_text);
769 print_parens (fh,
")");
780 m_nesting.push (
'(');
791 m_nesting.push (
'[');
795 auto p = lst.
begin ();
797 while (p != lst.
end ())
837 print_parens (expr,
"(");
844 m_os << expr.
oper ();
846 print_parens (expr,
")");
854 print_parens (expr,
"(");
856 m_os << expr.
oper ();
863 print_parens (expr,
")");
879 print_parens (expr,
"(");
886 m_os <<
' ' << expr.
oper () <<
' ';
893 print_parens (expr,
")");
961 increment_indent_level ();
967 decrement_indent_level ();
991 increment_indent_level ();
995 decrement_indent_level ();
1002 m_os <<
"endswitch";
1021 increment_indent_level ();
1023 try_code->
accept (*
this);
1025 decrement_indent_level ();
1046 increment_indent_level ();
1048 catch_code->
accept (*
this);
1050 decrement_indent_level ();
1057 m_os <<
"end_try_catch";
1067 m_os <<
"unwind_protect";
1073 if (unwind_protect_code)
1075 increment_indent_level ();
1077 unwind_protect_code->
accept (*
this);
1079 decrement_indent_level ();
1086 m_os <<
"unwind_protect_cleanup";
1094 increment_indent_level ();
1096 cleanup_code->
accept (*
this);
1098 decrement_indent_level ();
1105 m_os <<
"end_unwind_protect";
1128 increment_indent_level ();
1132 decrement_indent_level ();
1157 increment_indent_level ();
1161 decrement_indent_level ();
1195 m_suppress_newlines++;
1197 m_suppress_newlines--;
1204 tree_print_code::indent ()
1208 if (m_beginning_of_line)
1212 m_os << std::string (m_curr_print_indent_level,
' ');
1214 m_beginning_of_line =
false;
1221 tree_print_code::newline (
const char *alt_txt)
1223 if (m_suppress_newlines)
1232 m_beginning_of_line =
true;
1239 tree_print_code::reset ()
1241 m_beginning_of_line =
true;
1242 m_curr_print_indent_level = 0;
1243 while (m_nesting.top () !=
'n')
1248 tree_print_code::print_parens (
const tree_expression& expr,
const char *txt)
1252 for (
int i = 0; i <
n; i++)
1257 tree_print_code::print_comment_elt (
const comment_elt& elt)
1259 bool printed_something =
false;
1261 bool prev_char_was_newline =
false;
1263 std::string comment = elt.
text ();
1265 std::size_t
len = comment.length ();
1269 while (i <
len && comment[i++] ==
'\n')
1275 char c = comment[i++];
1279 if (prev_char_was_newline)
1281 printed_something =
true;
1290 prev_char_was_newline =
true;
1294 if (m_beginning_of_line)
1296 printed_something =
true;
1302 if (! (isspace (c) || c ==
'!'))
1306 m_os << static_cast<char> (c);
1308 prev_char_was_newline =
false;
1312 if (printed_something && ! m_beginning_of_line)
1327 print_comment_elt (elt);
1338 increment_indent_level ();
1342 decrement_indent_level ();
1345 OCTAVE_END_NAMESPACE(
octave)
std::size_t length() const
octave::tree_statement_list * body()
octave::comment_list * trailing_comment()
octave::comment_list * leading_comment()
octave::tree_parameter_list * parameter_list()
octave::tree_parameter_list * return_list()
octave_function * function_value(bool silent=false) const
tree_parameter_list * parameter_list() const
tree_expression * expression() const
void accept(tree_walker &tw)
tree_expression * limit()
tree_expression * increment()
comment_list * trailing_comment()
tree_statement_list * body()
tree_argument_list * left_hand_side()
tree_expression * control_expr()
comment_list * leading_comment()
void print_raw(std::ostream &os, bool pr_as_read_syntax=false, bool pr_orig_txt=true)
tree_decl_init_list * initializer_list()
void accept(tree_walker &tw)
tree_identifier * ident()
tree_expression * expression()
void accept(tree_walker &tw)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false, bool pr_orig_txt=true)
void accept(tree_walker &tw)
void accept(tree_walker &tw)
tree_expression * condition()
tree_statement_list * commands()
comment_list * leading_comment()
void accept(tree_walker &tw)
comment_list * trailing_comment()
tree_if_command_list * cmd_list()
comment_list * leading_comment()
tree_expression * expression()
std::list< tree_argument_list * > arg_lists()
std::list< string_vector > arg_names()
std::list< tree_expression * > dyn_fields()
tree_argument_list * left_hand_side()
tree_expression * right_hand_side()
std::string original_command()
bool is_end_of_fcn_or_script() const
void accept(tree_walker &tw)
bool takes_varargs() const
bool is_input_list() const
std::string varargs_symbol_name() const
void visit_binary_expression(tree_binary_expression &)
void visit_continue_command(tree_continue_command &)
void visit_switch_case(tree_switch_case &)
void visit_decl_init_list(tree_decl_init_list &)
void visit_constant(tree_constant &)
void visit_postfix_expression(tree_postfix_expression &)
void visit_superclass_ref(tree_superclass_ref &)
void visit_no_op_command(tree_no_op_command &)
void visit_args_block_attribute_list(tree_args_block_attribute_list &)
void visit_while_command(tree_while_command &)
void visit_fcn_handle(tree_fcn_handle &)
void visit_arguments_block(tree_arguments_block &)
void visit_switch_command(tree_switch_command &)
void visit_prefix_expression(tree_prefix_expression &)
void visit_octave_user_function_header(octave_user_function &)
void visit_simple_assignment(tree_simple_assignment &)
void visit_decl_command(tree_decl_command &)
void visit_if_clause(tree_if_clause &)
void visit_index_expression(tree_index_expression &)
void print_fcn_handle_body(tree_expression *)
void visit_statement(tree_statement &)
void visit_break_command(tree_break_command &)
void visit_return_command(tree_return_command &)
void visit_if_command(tree_if_command &)
void visit_unwind_protect_command(tree_unwind_protect_command &)
void visit_identifier(tree_identifier &)
void visit_complex_for_command(tree_complex_for_command &)
void visit_multi_assignment(tree_multi_assignment &)
void visit_matrix(tree_matrix &)
void visit_if_command_list(tree_if_command_list &)
void visit_try_catch_command(tree_try_catch_command &)
void visit_do_until_command(tree_do_until_command &)
void visit_arg_validation(tree_arg_validation &)
void visit_octave_user_function(octave_user_function &)
void visit_parameter_list(tree_parameter_list &)
void visit_statement_list(tree_statement_list &)
void visit_spmd_command(tree_spmd_command &)
void visit_decl_elt(tree_decl_elt &)
void visit_args_block_validation_list(tree_args_block_validation_list &)
void visit_arg_size_spec(tree_arg_size_spec &)
void visit_simple_for_command(tree_simple_for_command &)
void visit_anon_fcn_handle(tree_anon_fcn_handle &)
void visit_argument_list(tree_argument_list &)
void visit_colon_expression(tree_colon_expression &)
void visit_octave_user_script(octave_user_script &)
void visit_arg_validation_fcns(tree_arg_validation_fcns &)
void visit_cell(tree_cell &)
void visit_octave_user_function_trailer(octave_user_function &)
void visit_metaclass_query(tree_metaclass_query &)
void visit_function_def(tree_function_def &)
tree_expression * left_hand_side()
tree_expression * right_hand_side()
comment_list * leading_comment()
comment_list * trailing_comment()
tree_expression * left_hand_side()
tree_expression * control_expr()
tree_expression * maxproc_expr()
tree_statement_list * body()
comment_list * trailing_comment()
comment_list * leading_comment()
tree_statement_list * body()
void accept(tree_walker &tw)
comment_list * comment_text()
tree_expression * expression()
std::string method_name() const
std::string class_name() const
void accept(tree_walker &tw)
comment_list * leading_comment()
tree_statement_list * commands()
tree_expression * case_label()
tree_switch_case_list * case_list()
comment_list * leading_comment()
tree_expression * switch_value()
tree_statement_list * cleanup()
tree_identifier * identifier()
tree_statement_list * body()
comment_list * trailing_comment()
comment_list * middle_comment()
comment_list * leading_comment()
tree_expression * operand()
comment_list * middle_comment()
comment_list * trailing_comment()
comment_list * leading_comment()
tree_statement_list * cleanup()
tree_statement_list * body()
tree_statement_list * body()
tree_expression * condition()
comment_list * trailing_comment()
comment_list * leading_comment()
virtual void accept(tree_walker &tw)=0
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define panic_impossible()
#define panic_unless(cond)
F77_RET_T const F77_DBLE const F77_DBLE * f