comparison src/pt-pr-code.cc @ 4980:003bbf6c13d8

[project @ 2004-09-09 15:47:17 by jwe]
author jwe
date Thu, 09 Sep 2004 15:47:17 +0000
parents 7b145222fea3
children b04b30d30c66
comparison
equal deleted inserted replaced
4979:ce4e3d39d05b 4980:003bbf6c13d8
881 if (cmd) 881 if (cmd)
882 { 882 {
883 cmd->accept (*this); 883 cmd->accept (*this);
884 884
885 if (! stmt.print_result ()) 885 if (! stmt.print_result ())
886 os << ";"; 886 {
887 887 os << ";";
888 newline (); 888 newline (" ");
889 }
890 else
891 newline ();
889 } 892 }
890 else 893 else
891 { 894 {
892 tree_expression *expr = stmt.expression (); 895 tree_expression *expr = stmt.expression ();
893 896
894 if (expr) 897 if (expr)
895 { 898 {
896 expr->accept (*this); 899 expr->accept (*this);
897 900
898 if (! stmt.print_result ()) 901 if (! stmt.print_result ())
899 os << ";"; 902 {
900 903 os << ";";
901 newline (); 904 newline (" ");
905 }
906 else
907 newline ();
902 } 908 }
903 } 909 }
904 } 910 }
905 911
906 void 912 void
1281 1287
1282 void 1288 void
1283 tree_print_code::indent (void) 1289 tree_print_code::indent (void)
1284 { 1290 {
1285 assert (curr_print_indent_level >= 0); 1291 assert (curr_print_indent_level >= 0);
1286 1292
1287 if (beginning_of_line) 1293 if (printing_newlines)
1288 { 1294 {
1289 os << prefix; 1295 if (beginning_of_line)
1290 1296 {
1291 for (int i = 0; i < curr_print_indent_level; i++) 1297 os << prefix;
1292 os << " "; 1298
1293 1299 for (int i = 0; i < curr_print_indent_level; i++)
1294 beginning_of_line = false; 1300 os << " ";
1301
1302 beginning_of_line = false;
1303 }
1295 } 1304 }
1296 } 1305 }
1297 1306
1298 // All print_code() functions should use this to print new lines. 1307 // All print_code() functions should use this to print new lines.
1299 1308
1300 void 1309 void
1301 tree_print_code::newline (void) 1310 tree_print_code::newline (const char *alt_txt)
1302 { 1311 {
1303 os << "\n"; 1312 os << (printing_newlines ? "\n" : alt_txt);
1304 1313
1305 beginning_of_line = true; 1314 beginning_of_line = true;
1306 } 1315 }
1307 1316
1308 // For ressetting print_code state. 1317 // For ressetting print_code state.