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