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