GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
#include "pt-pr-code.h"
Private Member Functions | |
tree_print_code (void) | |
tree_print_code (const tree_print_code &) | |
void | decrement_indent_level (void) |
void | do_decl_command (tree_decl_command &cmd) |
void | increment_indent_level (void) |
void | indent (void) |
void | newline (const char *alt_txt=", ") |
tree_print_code & | operator= (const tree_print_code &) |
void | print_comment_elt (const octave_comment_elt &comment_elt) |
void | print_comment_list (octave_comment_list *comment_list) |
void | print_indented_comment (octave_comment_list *comment_list) |
void | print_parens (const tree_expression &expr, const char *txt) |
void | reset (void) |
void | reset_indent_level (void) |
Private Attributes | |
bool | beginning_of_line |
int | curr_print_indent_level |
std::stack< char > | nesting |
std::ostream & | os |
std::string | prefix |
bool | print_original_text |
int | suppress_newlines |
Definition at line 37 of file pt-pr-code.h.
|
inline |
Definition at line 42 of file pt-pr-code.h.
|
inline |
Definition at line 54 of file pt-pr-code.h.
|
private |
|
private |
Definition at line 169 of file pt-pr-code.h.
Referenced by print_indented_comment(), visit_complex_for_command(), visit_do_until_command(), visit_if_clause(), visit_octave_user_function(), visit_simple_for_command(), visit_switch_case(), visit_switch_command(), visit_try_catch_command(), visit_unwind_protect_command(), and visit_while_command().
|
private |
Definition at line 149 of file pt-pr-code.cc.
References tree_decl_init_list::accept(), indent(), tree_decl_command::initializer_list(), tree_decl_command::name(), and os.
Referenced by visit_global_command(), and visit_persistent_command().
Definition at line 167 of file pt-pr-code.h.
Referenced by print_indented_comment(), visit_complex_for_command(), visit_do_until_command(), visit_if_clause(), visit_octave_user_function(), visit_simple_for_command(), visit_switch_case(), visit_switch_command(), visit_try_catch_command(), visit_unwind_protect_command(), and visit_while_command().
Definition at line 1197 of file pt-pr-code.cc.
References beginning_of_line, curr_print_indent_level, os, and prefix.
Referenced by do_decl_command(), print_comment_elt(), visit_anon_fcn_handle(), visit_binary_expression(), visit_break_command(), visit_cell(), visit_colon_expression(), visit_complex_for_command(), visit_constant(), visit_continue_command(), visit_do_until_command(), visit_fcn_handle(), visit_function_def(), visit_identifier(), visit_if_command(), visit_if_command_list(), visit_index_expression(), visit_matrix(), visit_multi_assignment(), visit_no_op_command(), visit_octave_user_function_header(), visit_postfix_expression(), visit_prefix_expression(), visit_return_command(), visit_simple_assignment(), visit_simple_for_command(), visit_switch_case(), visit_switch_command(), visit_try_catch_command(), visit_unwind_protect_command(), and visit_while_command().
Definition at line 1215 of file pt-pr-code.cc.
References beginning_of_line, os, and suppress_newlines.
Referenced by print_comment_elt(), print_comment_list(), visit_complex_for_command(), visit_do_until_command(), visit_if_clause(), visit_octave_user_function_header(), visit_octave_user_function_trailer(), visit_simple_for_command(), visit_statement(), visit_switch_case(), visit_switch_command(), visit_try_catch_command(), visit_unwind_protect_command(), and visit_while_command().
|
private |
|
private |
Definition at line 1248 of file pt-pr-code.cc.
References beginning_of_line, indent(), newline(), os, and octave_comment_elt::text().
Referenced by print_comment_list().
|
private |
Definition at line 1302 of file pt-pr-code.cc.
References octave_base_list< elt_type >::begin(), octave_base_list< elt_type >::end(), newline(), and print_comment_elt().
Referenced by print_indented_comment(), visit_complex_for_command(), visit_do_until_command(), visit_if_command(), visit_octave_user_function_header(), visit_simple_for_command(), visit_statement(), visit_switch_case(), visit_switch_command(), visit_try_catch_command(), visit_unwind_protect_command(), and visit_while_command().
void tree_print_code::print_fcn_handle_body | ( | tree_statement_list * | b | ) |
Definition at line 1158 of file pt-pr-code.cc.
References tree::accept(), octave_base_list< elt_type >::front(), octave_base_list< elt_type >::length(), and suppress_newlines.
Referenced by octave_fcn_handle::print_raw(), and visit_anon_fcn_handle().
|
private |
Definition at line 1321 of file pt-pr-code.cc.
References decrement_indent_level(), increment_indent_level(), and print_comment_list().
Referenced by visit_complex_for_command(), visit_do_until_command(), visit_if_command(), visit_if_command_list(), visit_octave_user_function_trailer(), visit_simple_for_command(), visit_switch_command(), visit_try_catch_command(), visit_unwind_protect_command(), and visit_while_command().
|
private |
Definition at line 1239 of file pt-pr-code.cc.
References os, and tree_expression::paren_count().
Referenced by visit_anon_fcn_handle(), visit_binary_expression(), visit_cell(), visit_colon_expression(), visit_constant(), visit_fcn_handle(), visit_identifier(), visit_index_expression(), visit_matrix(), visit_multi_assignment(), visit_postfix_expression(), visit_prefix_expression(), and visit_simple_assignment().
Definition at line 1230 of file pt-pr-code.cc.
References beginning_of_line, curr_print_indent_level, and nesting.
Referenced by visit_octave_user_function(), and visit_octave_user_script().
Definition at line 165 of file pt-pr-code.h.
|
virtual |
Implements tree_walker.
Definition at line 38 of file pt-pr-code.cc.
References tree_parameter_list::accept(), tree_anon_fcn_handle::body(), indent(), os, tree_anon_fcn_handle::parameter_list(), print_fcn_handle_body(), and print_parens().
|
virtual |
Implements tree_walker.
Definition at line 59 of file pt-pr-code.cc.
References tree::accept(), octave_base_list< elt_type >::begin(), octave_base_list< elt_type >::end(), and os.
|
virtual |
Implements tree_walker.
Definition at line 78 of file pt-pr-code.cc.
References tree::accept(), indent(), tree_binary_expression::lhs(), tree_binary_expression::oper(), os, print_parens(), and tree_binary_expression::rhs().
|
virtual |
Implements tree_walker.
Definition at line 651 of file pt-pr-code.cc.
References tree_argument_list::accept(), octave_base_list< elt_type >::begin(), octave_base_list< elt_type >::end(), indent(), nesting, os, and print_parens().
|
virtual |
Implements tree_walker.
Definition at line 108 of file pt-pr-code.cc.
References tree::accept(), tree_colon_expression::base(), tree_colon_expression::increment(), indent(), tree_colon_expression::limit(), os, and print_parens().
|
virtual |
Implements tree_walker.
Definition at line 264 of file pt-pr-code.cc.
References tree::accept(), tree_argument_list::accept(), tree_statement_list::accept(), tree_complex_for_command::body(), tree_complex_for_command::control_expr(), decrement_indent_level(), increment_indent_level(), indent(), tree_complex_for_command::leading_comment(), tree_complex_for_command::left_hand_side(), nesting, newline(), os, print_comment_list(), print_indented_comment(), and tree_complex_for_command::trailing_comment().
|
virtual |
Implements tree_walker.
Definition at line 728 of file pt-pr-code.cc.
References indent(), os, print_original_text, print_parens(), and tree_constant::print_raw().
|
virtual |
|
virtual |
Implements tree_walker.
Definition at line 174 of file pt-pr-code.cc.
References tree::accept(), tree_identifier::accept(), tree_decl_elt::expression(), tree_decl_elt::ident(), and os.
|
virtual |
Implements tree_walker.
Definition at line 192 of file pt-pr-code.cc.
References tree_decl_elt::accept(), octave_base_list< elt_type >::begin(), octave_base_list< elt_type >::end(), and os.
|
virtual |
Implements tree_walker.
Definition at line 1122 of file pt-pr-code.cc.
References tree::accept(), tree_statement_list::accept(), tree_while_command::body(), tree_while_command::condition(), decrement_indent_level(), increment_indent_level(), indent(), tree_while_command::leading_comment(), newline(), os, print_comment_list(), print_indented_comment(), and tree_while_command::trailing_comment().
|
virtual |
Implements tree_walker.
Definition at line 740 of file pt-pr-code.cc.
References indent(), os, print_original_text, print_parens(), and tree_fcn_handle::print_raw().
|
virtual |
Implements tree_walker.
Definition at line 437 of file pt-pr-code.cc.
References octave_function::accept(), f, tree_function_def::function(), octave_value::function_value(), and indent().
|
virtual |
|
virtual |
Implements tree_walker.
Definition at line 450 of file pt-pr-code.cc.
References indent(), os, and print_parens().
|
virtual |
Implements tree_walker.
Definition at line 463 of file pt-pr-code.cc.
References tree::accept(), tree_statement_list::accept(), tree_if_clause::commands(), tree_if_clause::condition(), decrement_indent_level(), increment_indent_level(), and newline().
|
virtual |
Implements tree_walker.
Definition at line 485 of file pt-pr-code.cc.
References tree_if_command_list::accept(), tree_if_command::cmd_list(), indent(), tree_if_command::leading_comment(), os, print_comment_list(), print_indented_comment(), and tree_if_command::trailing_comment().
|
virtual |
Implements tree_walker.
Definition at line 506 of file pt-pr-code.cc.
References tree_if_clause::accept(), octave_base_list< elt_type >::begin(), octave_base_list< elt_type >::end(), indent(), tree_if_clause::is_else_clause(), tree_if_clause::leading_comment(), os, and print_indented_comment().
|
virtual |
Implements tree_walker.
Definition at line 538 of file pt-pr-code.cc.
References tree::accept(), tree_argument_list::accept(), tree_index_expression::arg_lists(), tree_index_expression::arg_names(), tree_index_expression::expression(), indent(), Array< T >::length(), nesting, os, panic_impossible, tree_expression::paren_count(), print_parens(), and tree_index_expression::type_tags().
|
virtual |
Implements tree_walker.
Definition at line 620 of file pt-pr-code.cc.
References tree_argument_list::accept(), octave_base_list< elt_type >::begin(), octave_base_list< elt_type >::end(), indent(), nesting, os, and print_parens().
|
virtual |
Implements tree_walker.
Definition at line 682 of file pt-pr-code.cc.
References tree::accept(), tree_argument_list::accept(), indent(), tree_multi_assignment::left_hand_side(), octave_base_list< elt_type >::length(), nesting, tree_multi_assignment::oper(), os, print_parens(), and tree_multi_assignment::right_hand_side().
|
virtual |
Implements tree_walker.
Definition at line 720 of file pt-pr-code.cc.
References indent(), tree_no_op_command::original_command(), and os.
|
virtual |
Implements tree_walker.
Definition at line 318 of file pt-pr-code.cc.
References tree_statement_list::accept(), octave_user_function::body(), decrement_indent_level(), increment_indent_level(), reset(), visit_octave_user_function_header(), and visit_octave_user_function_trailer().
void tree_print_code::visit_octave_user_function_header | ( | octave_user_function & | fcn | ) |
Definition at line 339 of file pt-pr-code.cc.
References tree_parameter_list::accept(), indent(), octave_user_function::leading_comment(), octave_base_list< elt_type >::length(), octave_function::name(), nesting, newline(), os, octave_user_function::parameter_list(), print_comment_list(), octave_user_function::return_list(), octave_user_function::takes_var_return(), and octave_user_function::takes_varargs().
Referenced by jit_function_info::jit_function_info(), octave_user_function::print_code_function_header(), and visit_octave_user_function().
void tree_print_code::visit_octave_user_function_trailer | ( | octave_user_function & | fcn | ) |
Definition at line 429 of file pt-pr-code.cc.
References newline(), print_indented_comment(), and octave_user_function::trailing_comment().
Referenced by jit_function_info::jit_function_info(), octave_user_function::print_code_function_trailer(), and visit_octave_user_function().
|
virtual |
Implements tree_walker.
Definition at line 307 of file pt-pr-code.cc.
References tree_statement_list::accept(), octave_user_script::body(), and reset().
|
virtual |
Implements tree_walker.
Definition at line 752 of file pt-pr-code.cc.
References tree_decl_elt::accept(), octave_base_list< elt_type >::begin(), octave_base_list< elt_type >::end(), and os.
|
virtual |
|
virtual |
Implements tree_walker.
Definition at line 771 of file pt-pr-code.cc.
References tree::accept(), indent(), tree_unary_expression::oper(), tree_unary_expression::operand(), os, and print_parens().
|
virtual |
Implements tree_walker.
Definition at line 788 of file pt-pr-code.cc.
References tree::accept(), indent(), tree_unary_expression::oper(), tree_unary_expression::operand(), os, and print_parens().
|
virtual |
|
virtual |
Implements tree_walker.
Definition at line 813 of file pt-pr-code.cc.
References tree_index_expression::accept(), octave_base_list< elt_type >::begin(), octave_base_list< elt_type >::end(), and os.
|
virtual |
Implements tree_walker.
Definition at line 832 of file pt-pr-code.cc.
References tree::accept(), indent(), tree_simple_assignment::left_hand_side(), tree_simple_assignment::oper(), os, print_parens(), and tree_simple_assignment::right_hand_side().
|
virtual |
Implements tree_walker.
Definition at line 211 of file pt-pr-code.cc.
References tree::accept(), tree_statement_list::accept(), tree_simple_for_command::body(), tree_simple_for_command::control_expr(), decrement_indent_level(), tree_simple_for_command::in_parallel(), increment_indent_level(), indent(), tree_simple_for_command::leading_comment(), tree_simple_for_command::left_hand_side(), tree_simple_for_command::maxproc_expr(), newline(), os, print_comment_list(), print_indented_comment(), and tree_simple_for_command::trailing_comment().
|
virtual |
Implements tree_walker.
Definition at line 854 of file pt-pr-code.cc.
References tree::accept(), tree_statement::command(), tree_statement::comment_text(), tree_statement::expression(), newline(), os, print_comment_list(), and tree_statement::print_result().
|
virtual |
Implements tree_walker.
Definition at line 892 of file pt-pr-code.cc.
References tree_statement::accept(), octave_base_list< elt_type >::begin(), and octave_base_list< elt_type >::end().
Referenced by jit_function_info::jit_function_info().
|
virtual |
Implements tree_walker.
Definition at line 904 of file pt-pr-code.cc.
References tree::accept(), tree_statement_list::accept(), tree_switch_case::case_label(), tree_switch_case::commands(), decrement_indent_level(), increment_indent_level(), indent(), tree_switch_case::is_default_case(), tree_switch_case::leading_comment(), newline(), os, and print_comment_list().
|
virtual |
Implements tree_walker.
Definition at line 937 of file pt-pr-code.cc.
References tree_switch_case::accept(), octave_base_list< elt_type >::begin(), and octave_base_list< elt_type >::end().
|
virtual |
Implements tree_walker.
Definition at line 951 of file pt-pr-code.cc.
References tree::accept(), tree_switch_case_list::accept(), tree_switch_command::case_list(), decrement_indent_level(), increment_indent_level(), indent(), tree_switch_command::leading_comment(), newline(), os, print_comment_list(), print_indented_comment(), and tree_switch_command::switch_value().
|
virtual |
Implements tree_walker.
Definition at line 985 of file pt-pr-code.cc.
References tree_identifier::accept(), tree_statement_list::accept(), tree_try_catch_command::body(), tree_try_catch_command::cleanup(), decrement_indent_level(), tree_try_catch_command::identifier(), increment_indent_level(), indent(), tree_try_catch_command::leading_comment(), tree_try_catch_command::middle_comment(), newline(), os, print_comment_list(), print_indented_comment(), and tree_try_catch_command::trailing_comment().
|
virtual |
Implements tree_walker.
Definition at line 1040 of file pt-pr-code.cc.
References tree_statement_list::accept(), tree_unwind_protect_command::body(), tree_unwind_protect_command::cleanup(), decrement_indent_level(), increment_indent_level(), indent(), tree_unwind_protect_command::leading_comment(), tree_unwind_protect_command::middle_comment(), newline(), os, print_comment_list(), print_indented_comment(), and tree_unwind_protect_command::trailing_comment().
|
virtual |
Implements tree_walker.
Definition at line 1088 of file pt-pr-code.cc.
References tree::accept(), tree_statement_list::accept(), tree_while_command::body(), tree_while_command::condition(), decrement_indent_level(), increment_indent_level(), indent(), tree_while_command::leading_comment(), newline(), os, print_comment_list(), print_indented_comment(), and tree_while_command::trailing_comment().
|
private |
Definition at line 158 of file pt-pr-code.h.
Referenced by indent(), newline(), print_comment_elt(), and reset().
|
private |
Definition at line 155 of file pt-pr-code.h.
|
private |
Definition at line 150 of file pt-pr-code.h.
Referenced by reset(), visit_cell(), visit_complex_for_command(), visit_index_expression(), visit_matrix(), visit_multi_assignment(), and visit_octave_user_function_header().
|
private |
Definition at line 146 of file pt-pr-code.h.
Referenced by do_decl_command(), indent(), newline(), print_comment_elt(), print_parens(), visit_anon_fcn_handle(), visit_argument_list(), visit_binary_expression(), visit_break_command(), visit_cell(), visit_colon_expression(), visit_complex_for_command(), visit_constant(), visit_continue_command(), visit_decl_elt(), visit_decl_init_list(), visit_do_until_command(), visit_fcn_handle(), visit_identifier(), visit_if_command(), visit_if_command_list(), visit_index_expression(), visit_matrix(), visit_multi_assignment(), visit_no_op_command(), visit_octave_user_function_header(), visit_parameter_list(), visit_postfix_expression(), visit_prefix_expression(), visit_return_command(), visit_return_list(), visit_simple_assignment(), visit_simple_for_command(), visit_statement(), visit_switch_case(), visit_switch_command(), visit_try_catch_command(), visit_unwind_protect_command(), and visit_while_command().
|
private |
Definition at line 148 of file pt-pr-code.h.
Referenced by indent().
|
private |
Definition at line 152 of file pt-pr-code.h.
Referenced by visit_constant(), and visit_fcn_handle().
|
private |
Definition at line 161 of file pt-pr-code.h.
Referenced by newline(), and print_fcn_handle_body().