Mercurial > octave
diff src/pt-pr-code.cc @ 2846:52e7c4509983
[project @ 1997-03-26 23:27:35 by jwe]
author | jwe |
---|---|
date | Wed, 26 Mar 1997 23:29:12 +0000 |
parents | 2c0f259cf83d |
children | 8b262e771614 |
line wrap: on
line diff
--- a/src/pt-pr-code.cc Wed Mar 26 23:05:15 1997 +0000 +++ b/src/pt-pr-code.cc Wed Mar 26 23:29:12 1997 +0000 @@ -142,6 +142,54 @@ } void +tree_print_code::visit_decl_command (tree_decl_command& cmd) +{ + indent (); + + os << cmd.name () << " "; + + tree_decl_init_list *init_list = cmd.initializer_list (); + + if (init_list) + init_list->accept (*this); +} + +void +tree_print_code::visit_decl_elt (tree_decl_elt& cmd) +{ + tree_identifier *id = cmd.ident (); + + if (id) + id->accept (*this); + + tree_simple_assignment_expression *ass_expr = cmd.assign_expr (); + + if (ass_expr) + ass_expr->accept (*this); +} + +void +tree_print_code::visit_decl_init_list (tree_decl_init_list& lst) +{ + Pix p = lst.first (); + + while (p) + { + tree_decl_elt *elt = lst (p); + + lst.next (p); + + if (elt) + { + elt->accept (*this); + + if (p) + os << ", "; + } + } +} + +void tree_print_code::visit_for_command (tree_for_command& cmd) { indent (); @@ -278,54 +326,6 @@ } void -tree_print_code::visit_global (tree_global& cmd) -{ - tree_identifier *id = cmd.ident (); - - if (id) - id->accept (*this); - - tree_simple_assignment_expression *ass_expr = cmd.assign_expr (); - - if (ass_expr) - ass_expr->accept (*this); -} - -void -tree_print_code::visit_global_command (tree_global_command& cmd) -{ - indent (); - - os << "global "; - - tree_global_init_list *init_list = cmd.initializer_list (); - - if (init_list) - init_list->accept (*this); -} - -void -tree_print_code::visit_global_init_list (tree_global_init_list& lst) -{ - Pix p = lst.first (); - - while (p) - { - tree_global *elt = lst (p); - - lst.next (p); - - if (elt) - { - elt->accept (*this); - - if (p) - os << ", "; - } - } -} - -void tree_print_code::visit_identifier (tree_identifier& id) { indent (); @@ -413,77 +413,6 @@ } void -tree_print_code::visit_switch_case (tree_switch_case& cs) -{ - indent (); - - if (cs.is_default_case ()) - os << "otherwise"; - else - os << "case "; - - tree_expression *label = cs.case_label (); - - if (label) - label->accept (*this); - - newline (); - - increment_indent_level (); - - tree_statement_list *list = cs.commands (); - - if (list) - { - list->accept (*this); - - decrement_indent_level (); - } -} - -void -tree_print_code::visit_switch_case_list (tree_switch_case_list& lst) -{ - Pix p = lst.first (); - - while (p) - { - tree_switch_case *elt = lst (p); - - if (elt) - elt->accept (*this); - - lst.next (p); - } -} - -void -tree_print_code::visit_switch_command (tree_switch_command& cmd) -{ - indent (); - - os << "switch "; - - tree_expression *expr = cmd.switch_value (); - - if (expr) - expr->accept (*this); - - newline (); - - increment_indent_level (); - - tree_switch_case_list *list = cmd.case_list (); - - if (list) - list->accept (*this); - - indent (); - - os << "endswitch"; -} - -void tree_print_code::visit_index_expression (tree_index_expression& expr) { indent (); @@ -1005,6 +934,77 @@ } void +tree_print_code::visit_switch_case (tree_switch_case& cs) +{ + indent (); + + if (cs.is_default_case ()) + os << "otherwise"; + else + os << "case "; + + tree_expression *label = cs.case_label (); + + if (label) + label->accept (*this); + + newline (); + + increment_indent_level (); + + tree_statement_list *list = cs.commands (); + + if (list) + { + list->accept (*this); + + decrement_indent_level (); + } +} + +void +tree_print_code::visit_switch_case_list (tree_switch_case_list& lst) +{ + Pix p = lst.first (); + + while (p) + { + tree_switch_case *elt = lst (p); + + if (elt) + elt->accept (*this); + + lst.next (p); + } +} + +void +tree_print_code::visit_switch_command (tree_switch_command& cmd) +{ + indent (); + + os << "switch "; + + tree_expression *expr = cmd.switch_value (); + + if (expr) + expr->accept (*this); + + newline (); + + increment_indent_level (); + + tree_switch_case_list *list = cmd.case_list (); + + if (list) + list->accept (*this); + + indent (); + + os << "endswitch"; +} + +void tree_print_code::visit_try_catch_command (tree_try_catch_command& cmd) { indent ();