GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pt-pr-code.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include <cctype>
28 
29 #include <iostream>
30 
31 #include "comment-list.h"
32 #include "error.h"
33 #include "ov-usr-fcn.h"
34 #include "pr-output.h"
35 #include "pt-all.h"
36 
37 void
39 {
40  indent ();
41 
42  print_parens (afh, "(");
43 
44  os << "@(";
45 
46  tree_parameter_list *param_list = afh.parameter_list ();
47 
48  if (param_list)
49  param_list->accept (*this);
50 
51  os << ") ";
52 
53  print_fcn_handle_body (afh.body ());
54 
55  print_parens (afh, ")");
56 }
57 
58 void
60 {
62 
63  while (p != lst.end ())
64  {
65  tree_expression *elt = *p++;
66 
67  if (elt)
68  {
69  elt->accept (*this);
70 
71  if (p != lst.end ())
72  os << ", ";
73  }
74  }
75 }
76 
77 void
79 {
80  indent ();
81 
82  print_parens (expr, "(");
83 
84  tree_expression *op1 = expr.lhs ();
85 
86  if (op1)
87  op1->accept (*this);
88 
89  os << " " << expr.oper () << " ";
90 
91  tree_expression *op2 = expr.rhs ();
92 
93  if (op2)
94  op2->accept (*this);
95 
96  print_parens (expr, ")");
97 }
98 
99 void
101 {
102  indent ();
103 
104  os << "break";
105 }
106 
107 void
109 {
110  indent ();
111 
112  print_parens (expr, "(");
113 
114  tree_expression *op1 = expr.base ();
115 
116  if (op1)
117  op1->accept (*this);
118 
119  // Stupid syntax.
120 
121  tree_expression *op3 = expr.increment ();
122 
123  if (op3)
124  {
125  os << ":";
126  op3->accept (*this);
127  }
128 
129  tree_expression *op2 = expr.limit ();
130 
131  if (op2)
132  {
133  os << ":";
134  op2->accept (*this);
135  }
136 
137  print_parens (expr, ")");
138 }
139 
140 void
142 {
143  indent ();
144 
145  os << "continue";
146 }
147 
148 void
150 {
151  indent ();
152 
153  os << cmd.name () << " ";
154 
155  tree_decl_init_list *init_list = cmd.initializer_list ();
156 
157  if (init_list)
158  init_list->accept (*this);
159 }
160 
161 void
163 {
164  do_decl_command (cmd);
165 }
166 
167 void
169 {
170  do_decl_command (cmd);
171 }
172 
173 void
175 {
176  tree_identifier *id = cmd.ident ();
177 
178  if (id)
179  id->accept (*this);
180 
181  tree_expression *expr = cmd.expression ();
182 
183  if (expr)
184  {
185  os << " = ";
186 
187  expr->accept (*this);
188  }
189 }
190 
191 void
193 {
195 
196  while (p != lst.end ())
197  {
198  tree_decl_elt *elt = *p++;
199 
200  if (elt)
201  {
202  elt->accept (*this);
203 
204  if (p != lst.end ())
205  os << ", ";
206  }
207  }
208 }
209 
210 void
212 {
214 
215  indent ();
216 
217  os << (cmd.in_parallel () ? "parfor " : "for ");
218 
219  tree_expression *lhs = cmd.left_hand_side ();
220 
221  tree_expression *maxproc = cmd.maxproc_expr ();
222 
223  if (maxproc)
224  os << "(";
225 
226  if (lhs)
227  lhs->accept (*this);
228 
229  os << " = ";
230 
231  tree_expression *expr = cmd.control_expr ();
232 
233  if (expr)
234  expr->accept (*this);
235 
236  if (maxproc)
237  {
238  os << ", ";
239  maxproc->accept (*this);
240  os << ")";
241  }
242 
243  newline ();
244 
245  tree_statement_list *list = cmd.body ();
246 
247  if (list)
248  {
250 
251  list->accept (*this);
252 
254  }
255 
257 
258  indent ();
259 
260  os << (cmd.in_parallel () ? "endparfor" : "endfor");
261 }
262 
263 void
265 {
267 
268  indent ();
269 
270  os << "for [";
271  nesting.push ('[');
272 
273  tree_argument_list *lhs = cmd.left_hand_side ();
274 
275  if (lhs)
276  lhs->accept (*this);
277 
278  nesting.pop ();
279  os << "] = ";
280 
281  tree_expression *expr = cmd.control_expr ();
282 
283  if (expr)
284  expr->accept (*this);
285 
286  newline ();
287 
288  tree_statement_list *list = cmd.body ();
289 
290  if (list)
291  {
293 
294  list->accept (*this);
295 
297  }
298 
300 
301  indent ();
302 
303  os << "endfor";
304 }
305 
306 void
308 {
309  reset ();
310 
311  tree_statement_list *cmd_list = fcn.body ();
312 
313  if (cmd_list)
314  cmd_list->accept (*this);
315 }
316 
317 void
319 {
320  reset ();
321 
323 
324  tree_statement_list *cmd_list = fcn.body ();
325 
326  if (cmd_list)
327  {
329 
330  cmd_list->accept (*this);
331 
332  // endfunction will decrement the indent level.
333  }
334 
336 }
337 
338 void
340 {
341  octave_comment_list *leading_comment = fcn.leading_comment ();
342 
343  if (leading_comment)
344  {
345  print_comment_list (leading_comment);
346  newline ();
347  }
348 
349  indent ();
350 
351  os << "function ";
352 
353  tree_parameter_list *ret_list = fcn.return_list ();
354 
355  if (ret_list)
356  {
357  bool takes_var_return = fcn.takes_var_return ();
358 
359  int len = ret_list->length ();
360 
361  if (len > 1 || takes_var_return)
362  {
363  os << "[";
364  nesting.push ('[');
365  }
366 
367  ret_list->accept (*this);
368 
369  if (takes_var_return)
370  {
371  if (len > 0)
372  os << ", ";
373 
374  os << "varargout";
375  }
376 
377  if (len > 1 || takes_var_return)
378  {
379  nesting.pop ();
380  os << "]";
381  }
382 
383  os << " = ";
384  }
385 
386  std::string fcn_name = fcn.name ();
387 
388  os << (fcn_name.empty () ? std::string ("(empty)") : fcn_name) << " ";
389 
390  tree_parameter_list *param_list = fcn.parameter_list ();
391 
392  if (param_list)
393  {
394  bool takes_varargs = fcn.takes_varargs ();
395 
396  int len = param_list->length ();
397 
398  if (len > 0 || takes_varargs)
399  {
400  os << "(";
401  nesting.push ('(');
402  }
403 
404  param_list->accept (*this);
405 
406  if (takes_varargs)
407  {
408  if (len > 0)
409  os << ", ";
410 
411  os << "varargin";
412  }
413 
414  if (len > 0 || takes_varargs)
415  {
416  nesting.pop ();
417  os << ")";
418  newline ();
419  }
420  }
421  else
422  {
423  os << "()";
424  newline ();
425  }
426 }
427 
428 void
430 {
432 
433  newline ();
434 }
435 
436 void
438 {
439  indent ();
440 
441  octave_value fcn = fdef.function ();
442 
443  octave_function *f = fcn.function_value ();
444 
445  if (f)
446  f->accept (*this);
447 }
448 
449 void
451 {
452  indent ();
453 
454  print_parens (id, "(");
455 
456  std::string nm = id.name ();
457  os << (nm.empty () ? std::string ("(empty)") : nm);
458 
459  print_parens (id, ")");
460 }
461 
462 void
464 {
465  tree_expression *expr = cmd.condition ();
466 
467  if (expr)
468  expr->accept (*this);
469 
470  newline ();
471 
473 
474  if (list)
475  {
477 
478  list->accept (*this);
479 
481  }
482 }
483 
484 void
486 {
488 
489  indent ();
490 
491  os << "if ";
492 
494 
495  if (list)
496  list->accept (*this);
497 
499 
500  indent ();
501 
502  os << "endif";
503 }
504 
505 void
507 {
509 
510  bool first_elt = true;
511 
512  while (p != lst.end ())
513  {
514  tree_if_clause *elt = *p++;
515 
516  if (elt)
517  {
518  if (! first_elt)
519  {
521 
522  indent ();
523 
524  if (elt->is_else_clause ())
525  os << "else";
526  else
527  os << "elseif ";
528  }
529 
530  elt->accept (*this);
531  }
532 
533  first_elt = false;
534  }
535 }
536 
537 void
539 {
540  indent ();
541 
542  print_parens (expr, "(");
543 
544  tree_expression *e = expr.expression ();
545 
546  if (e)
547  e->accept (*this);
548 
549  std::list<tree_argument_list *> arg_lists = expr.arg_lists ();
550  std::string type_tags = expr.type_tags ();
551  std::list<string_vector> arg_names = expr.arg_names ();
552 
553  int n = type_tags.length ();
554 
555  std::list<tree_argument_list *>::iterator p_arg_lists = arg_lists.begin ();
556  std::list<string_vector>::iterator p_arg_names = arg_names.begin ();
557 
558  for (int i = 0; i < n; i++)
559  {
560  switch (type_tags[i])
561  {
562  case '(':
563  {
564  char nc = nesting.top ();
565  if ((nc == '[' || nc == '{') && expr.paren_count () == 0)
566  os << "(";
567  else
568  os << " (";
569  nesting.push ('(');
570 
571  tree_argument_list *l = *p_arg_lists;
572  if (l)
573  l->accept (*this);
574 
575  nesting.pop ();
576  os << ")";
577  }
578  break;
579 
580  case '{':
581  {
582  char nc = nesting.top ();
583  if ((nc == '[' || nc == '{') && expr.paren_count () == 0)
584  os << "{";
585  else
586  os << " {";
587  // We only care about whitespace inside [] and {} when we
588  // are defining matrix and cell objects, not when indexing.
589  nesting.push ('(');
590 
591  tree_argument_list *l = *p_arg_lists;
592  if (l)
593  l->accept (*this);
594 
595  nesting.pop ();
596  os << "}";
597  }
598  break;
599 
600  case '.':
601  {
602  string_vector nm = *p_arg_names;
603  assert (nm.numel () == 1);
604  os << "." << nm(0);
605  }
606  break;
607 
608  default:
609  panic_impossible ();
610  }
611 
612  p_arg_lists++;
613  p_arg_names++;
614  }
615 
616  print_parens (expr, ")");
617 }
618 
619 void
621 {
622  indent ();
623 
624  print_parens (lst, "(");
625 
626  os << "[";
627  nesting.push ('[');
628 
629  tree_matrix::iterator p = lst.begin ();
630 
631  while (p != lst.end ())
632  {
633  tree_argument_list *elt = *p++;
634 
635  if (elt)
636  {
637  elt->accept (*this);
638 
639  if (p != lst.end ())
640  os << "; ";
641  }
642  }
643 
644  nesting.pop ();
645  os << "]";
646 
647  print_parens (lst, ")");
648 }
649 
650 void
652 {
653  indent ();
654 
655  print_parens (lst, "(");
656 
657  os << "{";
658  nesting.push ('{');
659 
660  tree_cell::iterator p = lst.begin ();
661 
662  while (p != lst.end ())
663  {
664  tree_argument_list *elt = *p++;
665 
666  if (elt)
667  {
668  elt->accept (*this);
669 
670  if (p != lst.end ())
671  os << "; ";
672  }
673  }
674 
675  nesting.pop ();
676  os << "}";
677 
678  print_parens (lst, ")");
679 }
680 
681 void
683 {
684  indent ();
685 
686  print_parens (expr, "(");
687 
688  tree_argument_list *lhs = expr.left_hand_side ();
689 
690  if (lhs)
691  {
692  int len = lhs->length ();
693 
694  if (len > 1)
695  {
696  os << "[";
697  nesting.push ('[');
698  }
699 
700  lhs->accept (*this);
701 
702  if (len > 1)
703  {
704  nesting.pop ();
705  os << "]";
706  }
707  }
708 
709  os << " " << expr.oper () << " ";
710 
711  tree_expression *rhs = expr.right_hand_side ();
712 
713  if (rhs)
714  rhs->accept (*this);
715 
716  print_parens (expr, ")");
717 }
718 
719 void
721 {
724 
725  indent ();
726 
727  os << cmd.original_command ();
728 }
729 
730 void
732 {
733  indent ();
734 
735  print_parens (val, "(");
736 
737  val.print_raw (os, true, print_original_text);
738 
739  print_parens (val, ")");
740 }
741 
742 void
744 {
745  indent ();
746 
747  print_parens (fh, "(");
748 
749  fh.print_raw (os, true, print_original_text);
750 
751  print_parens (fh, ")");
752 }
753 
754 void
756 {
757  indent ();
758 
759  print_parens (fc, "(");
760 
761  fc.print_raw (os, true, print_original_text);
762 
763  print_parens (fc, ")");
764 }
765 
766 void
768 {
770 
771  while (p != lst.end ())
772  {
773  tree_decl_elt *elt = *p++;
774 
775  if (elt)
776  {
777  elt->accept (*this);
778 
779  if (p != lst.end ())
780  os << ", ";
781  }
782  }
783 }
784 
785 void
787 {
788  indent ();
789 
790  print_parens (expr, "(");
791 
792  tree_expression *e = expr.operand ();
793 
794  if (e)
795  e->accept (*this);
796 
797  os << expr.oper ();
798 
799  print_parens (expr, ")");
800 }
801 
802 void
804 {
805  indent ();
806 
807  print_parens (expr, "(");
808 
809  os << expr.oper ();
810 
811  tree_expression *e = expr.operand ();
812 
813  if (e)
814  e->accept (*this);
815 
816  print_parens (expr, ")");
817 }
818 
819 void
821 {
822  indent ();
823 
824  os << "return";
825 }
826 
827 void
829 {
831 
832  while (p != lst.end ())
833  {
834  tree_index_expression *elt = *p++;
835 
836  if (elt)
837  {
838  elt->accept (*this);
839 
840  if (p != lst.end ())
841  os << ", ";
842  }
843  }
844 }
845 
846 void
848 {
849  indent ();
850 
851  print_parens (expr, "(");
852 
853  tree_expression *lhs = expr.left_hand_side ();
854 
855  if (lhs)
856  lhs->accept (*this);
857 
858  os << " " << expr.oper () << " ";
859 
860  tree_expression *rhs = expr.right_hand_side ();
861 
862  if (rhs)
863  rhs->accept (*this);
864 
865  print_parens (expr, ")");
866 }
867 
868 void
870 {
872 
873  tree_command *cmd = stmt.command ();
874 
875  if (cmd)
876  {
877  cmd->accept (*this);
878 
879  newline ();
880  }
881  else
882  {
883  tree_expression *expr = stmt.expression ();
884 
885  if (expr)
886  {
887  expr->accept (*this);
888 
889  if (! stmt.print_result ())
890  {
891  os << ";";
892  newline (" ");
893  }
894  else
895  newline ();
896  }
897  }
898 }
899 
900 void
902 {
903  for (tree_statement_list::iterator p = lst.begin (); p != lst.end (); p++)
904  {
905  tree_statement *elt = *p;
906 
907  if (elt)
908  elt->accept (*this);
909  }
910 }
911 
912 void
914 {
916 
917  indent ();
918 
919  if (cs.is_default_case ())
920  os << "otherwise";
921  else
922  os << "case ";
923 
924  tree_expression *label = cs.case_label ();
925 
926  if (label)
927  label->accept (*this);
928 
929  newline ();
930 
932 
933  if (list)
934  {
936 
937  list->accept (*this);
938 
939  newline ();
940 
942  }
943 }
944 
945 void
947 {
949 
950  while (p != lst.end ())
951  {
952  tree_switch_case *elt = *p++;
953 
954  if (elt)
955  elt->accept (*this);
956  }
957 }
958 
959 void
961 {
963 
964  indent ();
965 
966  os << "switch ";
967 
968  tree_expression *expr = cmd.switch_value ();
969 
970  if (expr)
971  expr->accept (*this);
972 
973  newline ();
974 
976 
977  if (list)
978  {
980 
981  list->accept (*this);
982 
984  }
985 
987 
988  indent ();
989 
990  os << "endswitch";
991 }
992 
993 void
995 {
997 
998  indent ();
999 
1000  os << "try";
1001 
1002  newline ();
1003 
1004  tree_statement_list *try_code = cmd.body ();
1005  tree_identifier *expr_id = cmd.identifier ();
1006 
1007  if (try_code)
1008  {
1010 
1011  try_code->accept (*this);
1012 
1014  }
1015 
1017 
1018  indent ();
1019 
1020  os << "catch";
1021 
1022  if (expr_id)
1023  {
1024  os << " ";
1025  expr_id->accept (*this);
1026  }
1027 
1028  newline ();
1029 
1030  tree_statement_list *catch_code = cmd.cleanup ();
1031 
1032  if (catch_code)
1033  {
1035 
1036  catch_code->accept (*this);
1037 
1039  }
1040 
1042 
1043  indent ();
1044 
1045  os << "end_try_catch";
1046 }
1047 
1048 void
1050 {
1052 
1053  indent ();
1054 
1055  os << "unwind_protect";
1056 
1057  newline ();
1058 
1059  tree_statement_list *unwind_protect_code = cmd.body ();
1060 
1061  if (unwind_protect_code)
1062  {
1064 
1065  unwind_protect_code->accept (*this);
1066 
1068  }
1069 
1071 
1072  indent ();
1073 
1074  os << "unwind_protect_cleanup";
1075 
1076  newline ();
1077 
1078  tree_statement_list *cleanup_code = cmd.cleanup ();
1079 
1080  if (cleanup_code)
1081  {
1083 
1084  cleanup_code->accept (*this);
1085 
1087  }
1088 
1090 
1091  indent ();
1092 
1093  os << "end_unwind_protect";
1094 }
1095 
1096 void
1098 {
1100 
1101  indent ();
1102 
1103  os << "while ";
1104 
1105  tree_expression *expr = cmd.condition ();
1106 
1107  if (expr)
1108  expr->accept (*this);
1109 
1110  newline ();
1111 
1112  tree_statement_list *list = cmd.body ();
1113 
1114  if (list)
1115  {
1117 
1118  list->accept (*this);
1119 
1121  }
1122 
1124 
1125  indent ();
1126 
1127  os << "endwhile";
1128 }
1129 
1130 void
1132 {
1134 
1135  indent ();
1136 
1137  os << "do";
1138 
1139  newline ();
1140 
1141  tree_statement_list *list = cmd.body ();
1142 
1143  if (list)
1144  {
1146 
1147  list->accept (*this);
1148 
1150  }
1151 
1153 
1154  indent ();
1155 
1156  os << "until ";
1157 
1158  tree_expression *expr = cmd.condition ();
1159 
1160  if (expr)
1161  expr->accept (*this);
1162 
1163  newline ();
1164 }
1165 
1166 void
1168 {
1169  if (b)
1170  {
1171  assert (b->length () == 1);
1172 
1173  tree_statement *s = b->front ();
1174 
1175  if (s)
1176  {
1177  if (s->is_expression ())
1178  {
1179  tree_expression *e = s->expression ();
1180 
1181  if (e)
1182  {
1184  e->accept (*this);
1186  }
1187  }
1188  else
1189  {
1190  tree_command *c = s->command ();
1191 
1193  c->accept (*this);
1195  }
1196  }
1197  }
1198 }
1199 
1200 // Each print_code() function should call this before printing anything.
1201 
1202 void
1204 {
1205  assert (curr_print_indent_level >= 0);
1206 
1207  if (beginning_of_line)
1208  {
1209  os << prefix;
1210 
1212 
1213  beginning_of_line = false;
1214  }
1215 }
1216 
1217 // All print_code() functions should use this to print new lines.
1218 
1219 void
1220 tree_print_code::newline (const char *alt_txt)
1221 {
1222  if (suppress_newlines)
1223  os << alt_txt;
1224  else
1225  {
1226  // Print prefix for blank lines.
1227  indent ();
1228 
1229  os << "\n";
1230 
1231  beginning_of_line = true;
1232  }
1233 }
1234 
1235 // For ressetting print_code state.
1236 
1237 void
1239 {
1240  beginning_of_line = true;
1242  while (nesting.top () != 'n')
1243  nesting.pop ();
1244 }
1245 
1246 void
1247 tree_print_code::print_parens (const tree_expression& expr, const char *txt)
1248 {
1249  int n = expr.paren_count ();
1250 
1251  for (int i = 0; i < n; i++)
1252  os << txt;
1253 }
1254 
1255 void
1257 {
1258  bool printed_something = false;
1259 
1260  bool prev_char_was_newline = false;
1261 
1262  std::string comment = elt.text ();
1263 
1264  size_t len = comment.length ();
1265 
1266  size_t i = 0;
1267 
1268  while (i < len && comment[i++] == '\n')
1269  ; // Skip leading new lines.
1270  i--;
1271 
1272  while (i < len)
1273  {
1274  char c = comment[i++];
1275 
1276  if (c == '\n')
1277  {
1278  if (prev_char_was_newline)
1279  {
1280  printed_something = true;
1281 
1282  indent ();
1283 
1284  os << "##";
1285  }
1286 
1287  newline ();
1288 
1289  prev_char_was_newline = true;
1290  }
1291  else
1292  {
1293  if (beginning_of_line)
1294  {
1295  printed_something = true;
1296 
1297  indent ();
1298 
1299  os << "##";
1300 
1301  if (! (isspace (c) || c == '!'))
1302  os << " ";
1303  }
1304 
1305  os << static_cast<char> (c);
1306 
1307  prev_char_was_newline = false;
1308  }
1309  }
1310 
1311  if (printed_something && ! beginning_of_line)
1312  newline ();
1313 }
1314 
1315 void
1317 {
1318  if (comment_list)
1319  {
1320  octave_comment_list::iterator p = comment_list->begin ();
1321 
1322  while (p != comment_list->end ())
1323  {
1324  octave_comment_elt elt = *p++;
1325 
1326  print_comment_elt (elt);
1327 
1328  if (p != comment_list->end ())
1329  newline ();
1330  }
1331  }
1332 }
1333 
1334 void
1336 {
1338 
1339  print_comment_list (comment_list);
1340 
1342 }
tree_expression * operand(void)
Definition: pt-unop.h:62
void visit_unwind_protect_command(tree_unwind_protect_command &)
Definition: pt-pr-code.cc:1049
void visit_statement(tree_statement &)
Definition: pt-pr-code.cc:869
octave_comment_list * leading_comment(void)
Definition: pt-select.h:139
octave_comment_list * trailing_comment(void)
Definition: pt-loop.h:299
tree_identifier * identifier(void)
Definition: pt-except.h:59
void visit_if_command_list(tree_if_command_list &)
Definition: pt-pr-code.cc:506
octave_comment_list * leading_comment(void)
Definition: pt-except.h:129
octave_comment_list * comment_text(void)
Definition: pt-stmt.h:88
bool print_result(void)
Definition: pt-stmt.cc:70
bool takes_var_return(void) const
Definition: ov-usr-fcn.cc:359
void accept(tree_walker &tw)
Definition: pt-select.cc:159
void visit_parameter_list(tree_parameter_list &)
Definition: pt-pr-code.cc:767
tree_statement_list * cleanup(void)
Definition: pt-except.h:127
void visit_funcall(tree_funcall &)
Definition: pt-pr-code.cc:755
int paren_count(void) const
Definition: pt-exp.h:90
The value of lines which begin with a space character are not saved in the history list A value of all commands are saved on the history list
Definition: oct-hist.cc:728
void decrement_indent_level(void)
Definition: pt-pr-code.h:173
tree_expression * left_hand_side(void)
Definition: pt-assign.h:72
void visit_return_command(tree_return_command &)
Definition: pt-pr-code.cc:820
tree_expression * switch_value(void)
Definition: pt-select.h:270
octave_comment_list * middle_comment(void)
Definition: pt-except.h:67
tree_parameter_list * parameter_list(void)
Definition: ov-usr-fcn.h:377
void visit_octave_user_function_header(octave_user_function &)
Definition: pt-pr-code.cc:339
tree_expression * control_expr(void)
Definition: pt-loop.h:293
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:363
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
tree_argument_list * left_hand_side(void)
Definition: pt-assign.h:139
void accept(tree_walker &tw)
Definition: pt-stmt.cc:324
std::string original_command(void)
Definition: pt-cmd.h:86
void print_raw(std::ostream &os, bool pr_as_read_syntax=false, bool pr_orig_txt=true)
Definition: pt-funcall.cc:41
void visit_identifier(tree_identifier &)
Definition: pt-pr-code.cc:450
void visit_statement_list(tree_statement_list &)
Definition: pt-pr-code.cc:901
bool is_default_case(void)
Definition: pt-select.h:187
tree_command * command(void)
Definition: pt-stmt.h:84
void print_comment_list(octave_comment_list *comment_list)
Definition: pt-pr-code.cc:1316
void visit_multi_assignment(tree_multi_assignment &)
Definition: pt-pr-code.cc:682
bool is_end_of_fcn_or_script(void) const
Definition: pt-cmd.h:79
std::string name(void) const
Definition: ov-fcn.h:163
tree_switch_case_list * case_list(void)
Definition: pt-select.h:272
octave_comment_list * trailing_comment(void)
Definition: pt-loop.h:218
void visit_if_clause(tree_if_clause &)
Definition: pt-pr-code.cc:463
bool print_original_text
Definition: pt-pr-code.h:156
bool beginning_of_line
Definition: pt-pr-code.h:162
void visit_try_catch_command(tree_try_catch_command &)
Definition: pt-pr-code.cc:994
octave_comment_list * trailing_comment(void)
Definition: ov-usr-fcn.h:385
std::list< tree_expression * >::iterator iterator
Definition: base-list.h:40
octave_comment_list * leading_comment(void)
Definition: pt-loop.h:216
void visit_binary_expression(tree_binary_expression &)
Definition: pt-pr-code.cc:78
tree_statement_list * commands(void)
Definition: pt-select.h:63
octave_comment_list * trailing_comment(void)
Definition: pt-except.h:133
octave_comment_list * leading_comment(void)
Definition: ov-usr-fcn.h:383
tree_expression * expression(void)
Definition: pt-idx.h:74
tree_expression * case_label(void)
Definition: pt-select.h:191
octave_comment_list * leading_comment(void)
Definition: pt-select.h:274
s
Definition: file-io.cc:2682
void increment_indent_level(void)
Definition: pt-pr-code.h:171
void visit_decl_elt(tree_decl_elt &)
Definition: pt-pr-code.cc:174
void visit_decl_init_list(tree_decl_init_list &)
Definition: pt-pr-code.cc:192
i e
Definition: data.cc:2724
void visit_while_command(tree_while_command &)
Definition: pt-pr-code.cc:1097
std::string type_tags(void)
Definition: pt-idx.h:78
std::list< string_vector > arg_names(void)
Definition: pt-idx.h:80
tree_argument_list * left_hand_side(void)
Definition: pt-loop.h:291
octave_function * fcn
Definition: ov-class.cc:1743
bool takes_varargs(void) const
Definition: ov-usr-fcn.cc:353
void visit_octave_user_function(octave_user_function &)
Definition: pt-pr-code.cc:318
tree_identifier * ident(void)
Definition: pt-decl.h:87
tree_decl_init_list * initializer_list(void)
Definition: pt-decl.h:162
octave_comment_list * leading_comment(void)
Definition: pt-loop.h:297
void visit_complex_for_command(tree_complex_for_command &)
Definition: pt-pr-code.cc:264
void visit_cell(tree_cell &)
Definition: pt-pr-code.cc:651
tree_statement_list * body(void)
Definition: pt-loop.h:295
tree_expression * increment(void)
Definition: pt-colon.h:91
tree_if_command_list * cmd_list(void)
Definition: pt-select.h:137
tree_statement_list * body(void)
Definition: pt-loop.h:214
octave_comment_list * leading_comment(void)
Definition: pt-loop.h:86
std::string oper(void) const
Definition: pt-binop.cc:143
std::ostream & os
Definition: pt-pr-code.h:150
tree_expression * maxproc_expr(void)
Definition: pt-loop.h:212
void visit_no_op_command(tree_no_op_command &)
Definition: pt-pr-code.cc:720
void visit_prefix_expression(tree_prefix_expression &)
Definition: pt-pr-code.cc:803
void accept(tree_walker &tw)
Definition: pt-id.cc:153
iterator end(void)
Definition: base-list.h:86
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:941
void visit_octave_user_script(octave_user_script &)
Definition: pt-pr-code.cc:307
tree_expression * right_hand_side(void)
Definition: pt-assign.h:74
std::list< tree_argument_list * > arg_lists(void)
Definition: pt-idx.h:76
void visit_persistent_command(tree_persistent_command &)
Definition: pt-pr-code.cc:168
tree_expression * condition(void)
Definition: pt-select.h:61
void visit_argument_list(tree_argument_list &)
Definition: pt-pr-code.cc:59
void visit_fcn_handle(tree_fcn_handle &)
Definition: pt-pr-code.cc:743
tree_expression * control_expr(void)
Definition: pt-loop.h:210
std::string oper(void) const
Definition: pt-assign.cc:136
tree_parameter_list * return_list(void)
Definition: ov-usr-fcn.h:379
void accept(tree_walker &tw)
Definition: pt-stmt.cc:185
void visit_switch_command(tree_switch_command &)
Definition: pt-pr-code.cc:960
void visit_index_expression(tree_index_expression &)
Definition: pt-pr-code.cc:538
void visit_function_def(tree_function_def &)
Definition: pt-pr-code.cc:437
void visit_anon_fcn_handle(tree_anon_fcn_handle &)
Definition: pt-pr-code.cc:38
void visit_postfix_expression(tree_postfix_expression &)
Definition: pt-pr-code.cc:786
tree_expression * limit(void)
Definition: pt-colon.h:89
octave_value function(void)
Definition: pt-cmd.h:118
std::string oper(void) const
Definition: pt-unop.cc:39
tree_statement_list * body(void)
Definition: pt-except.h:125
#define panic_impossible()
Definition: error.h:40
void reset(void)
Definition: pt-pr-code.cc:1238
tree_expression * lhs(void)
Definition: pt-binop.h:97
tree_expression * left_hand_side(void)
Definition: pt-loop.h:208
tree_statement_list * body(void)
Definition: pt-except.h:61
void accept(tree_walker &tw)
Definition: pt-decl.cc:100
void visit_switch_case(tree_switch_case &)
Definition: pt-pr-code.cc:913
void accept(tree_walker &tw)
Definition: pt-select.cc:183
octave_comment_list * middle_comment(void)
Definition: pt-except.h:131
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
tree_statement_list * commands(void)
Definition: pt-select.h:193
tree_statement_list * cleanup(void)
Definition: pt-except.h:63
octave::base_list< tree_argument_list * >::iterator iterator
Definition: pt-array-list.h:41
void print_parens(const tree_expression &expr, const char *txt)
Definition: pt-pr-code.cc:1247
void visit_colon_expression(tree_colon_expression &)
Definition: pt-pr-code.cc:108
octave_function * function_value(bool silent=false) const
Definition: ov.cc:1705
void print_raw(std::ostream &os, bool pr_as_read_syntax=false, bool pr_orig_txt=true)
std::string oper(void) const
Definition: pt-assign.cc:358
octave_comment_list * trailing_comment(void)
Definition: pt-select.h:141
octave_comment_list * trailing_comment(void)
Definition: pt-except.h:69
void accept(tree_walker &tw)
std::string text(void) const
Definition: comment-list.h:71
void visit_octave_user_function_trailer(octave_user_function &)
Definition: pt-pr-code.cc:429
tree_statement_list * body(void)
Definition: ov-usr-fcn.h:142
void visit_switch_case_list(tree_switch_case_list &)
Definition: pt-pr-code.cc:946
tree_expression * rhs(void)
Definition: pt-binop.h:98
bool is_else_clause(void)
Definition: pt-select.h:59
octave_comment_list * trailing_comment(void)
Definition: pt-loop.h:88
void visit_return_list(tree_return_list &)
Definition: pt-pr-code.cc:828
void print_comment_elt(const octave_comment_elt &comment_elt)
Definition: pt-pr-code.cc:1256
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
void visit_global_command(tree_global_command &)
Definition: pt-pr-code.cc:162
p
Definition: lu.cc:138
tree_expression * expression(void)
Definition: pt-stmt.h:86
std::string name(void)
Definition: pt-decl.h:164
void accept(tree_walker &tw)
Definition: pt-idx.cc:703
tree_statement_list * body(void) const
void visit_continue_command(tree_continue_command &)
Definition: pt-pr-code.cc:141
size_t length(void) const
Definition: base-list.h:50
void accept(tree_walker &tw)
Definition: pt-decl.cc:76
octave_comment_list * leading_comment(void)
Definition: pt-select.h:195
tree_expression * expression(void)
Definition: pt-decl.h:91
void visit_constant(tree_constant &)
Definition: pt-pr-code.cc:731
void accept(tree_walker &tw)
Definition: pt-select.cc:81
void visit_do_until_command(tree_do_until_command &)
Definition: pt-pr-code.cc:1131
elt_type & front(void)
Definition: base-list.h:97
b
Definition: cellfun.cc:398
void visit_simple_assignment(tree_simple_assignment &)
Definition: pt-pr-code.cc:847
octave_comment_list * leading_comment(void)
Definition: pt-select.h:65
void do_decl_command(tree_decl_command &cmd)
Definition: pt-pr-code.cc:149
void newline(const char *alt_txt=", ")
Definition: pt-pr-code.cc:1220
void indent(void)
Definition: pt-pr-code.cc:1203
void accept(tree_walker &tw)
Definition: pt-select.cc:57
virtual void accept(tree_walker &)
Definition: ov-fcn.h:179
void visit_break_command(tree_break_command &)
Definition: pt-pr-code.cc:100
std::stack< char > nesting
Definition: pt-pr-code.h:154
tree_parameter_list * parameter_list(void) const
tree_expression * base(void)
Definition: pt-colon.h:87
tree_statement_list * body(void)
Definition: pt-loop.h:84
void print_raw(std::ostream &os, bool pr_as_read_syntax=false, bool pr_orig_txt=true)
Definition: pt-const.cc:49
octave_comment_list * leading_comment(void)
Definition: pt-except.h:65
void visit_if_command(tree_if_command &)
Definition: pt-pr-code.cc:485
void print_fcn_handle_body(tree_statement_list *)
Definition: pt-pr-code.cc:1167
void visit_simple_for_command(tree_simple_for_command &)
Definition: pt-pr-code.cc:211
std::string prefix
Definition: pt-pr-code.h:152
tree_statement_list * body(void)
Definition: ov-usr-fcn.h:381
bool in_parallel(void)
Definition: pt-loop.h:206
int curr_print_indent_level
Definition: pt-pr-code.h:159
tree_expression * right_hand_side(void)
Definition: pt-assign.h:141
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
virtual void accept(tree_walker &tw)=0
void print_indented_comment(octave_comment_list *comment_list)
Definition: pt-pr-code.cc:1335
void accept(tree_walker &tw)
Definition: pt-misc.cc:320
void visit_matrix(tree_matrix &)
Definition: pt-pr-code.cc:620
iterator begin(void)
Definition: base-list.h:83
tree_expression * condition(void)
Definition: pt-loop.h:82