Mercurial > octave
annotate libinterp/parse-tree/pt-pr-code.h @ 22869:f75d289645ec
make deleted functions public
* octave-gui.h, resource-manager.h, shortcut-manager.h,
base-text-renderer.h, c-file-ptr-stream.h, dynamic-ld.cc,
dynamic-ld.h, event-queue.h, ft-text-renderer.cc, gl-render.cc,
gl-render.h, graphics.cc, graphics.in.h, interpreter.h, mex.cc,
mxarray.in.h, oct-fstrm.h, oct-iostrm.h, oct-prcstrm.h,
oct-procbuf.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h,
oct-strstrm.h, octave-link.h, pager.h, profiler.h, sighandlers.cc,
symtab.h, text-renderer.h, zfstream.h, __init_fltk__.cc,
ov-builtin.h, ov-dld-fcn.h, ov-fcn.h, ov-mex-fcn.h, ov-typeinfo.h,
ov-usr-fcn.h, octave.h, lex.h, parse.h, pt-arg-list.h,
pt-array-list.h, pt-assign.h, pt-binop.h, pt-bp.h, pt-cell.h,
pt-check.h, pt-classdef.h, pt-cmd.h, pt-colon.h, pt-const.h,
pt-decl.h, pt-eval.h, pt-except.h, pt-exp.h, pt-fcn-handle.h,
pt-funcall.h, pt-id.h, pt-idx.h, pt-jump.h, pt-loop.h, pt-mat.h,
pt-misc.h, pt-pr-code.h, pt-select.h, pt-stmt.h, pt-unop.h,
pt-walk.h, pt.h, token.h, Array.cc, idx-vector.h, oct-fftw.h,
sparse-chol.cc, sparse-qr.cc, file-ops.h, mach-info.h, oct-env.h,
action-container.h, cmd-edit.cc, cmd-edit.h, cmd-hist.h,
oct-locbuf.h, oct-mutex.h, oct-shlib.cc, oct-sort.h, pathsearch.h,
singleton-cleanup.h, unwind-prot.h, url-transfer.cc, url-transfer.h:
Declare deleted copy constructors and assignment operators public.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 06 Dec 2016 12:40:45 -0500 |
parents | 87e3163f6c87 |
children | 4e3d47dc7e25 |
rev | line source |
---|---|
2123 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
3 Copyright (C) 1996-2016 John W. Eaton |
2123 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 (at your option) any later version. |
2123 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 GNU General Public License for more details. |
2123 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2123 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
23 #if ! defined (octave_pt_pr_code_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
24 #define octave_pt_pr_code_h 1 |
2123 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
27 |
4676 | 28 #include <stack> |
2530 | 29 #include <string> |
30 | |
3665 | 31 #include "comment-list.h" |
2123 | 32 #include "pt-walk.h" |
33 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
34 class tree_decl_command; |
2961 | 35 class tree_expression; |
36 | |
2123 | 37 // How to print the code that the parse trees represent. |
38 | |
39 class | |
40 tree_print_code : public tree_walker | |
41 { | |
42 public: | |
43 | |
3708 | 44 tree_print_code (std::ostream& os_arg, |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
45 const std::string& pfx = "", |
10313 | 46 bool pr_orig_txt = true) |
4676 | 47 : os (os_arg), prefix (pfx), nesting (), |
48 print_original_text (pr_orig_txt), | |
4980 | 49 curr_print_indent_level (0), beginning_of_line (true), |
11223
64e7538db12a
fix printing of newlines for anonymous function handle bodies
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
50 suppress_newlines (0) |
4676 | 51 { |
52 // For "none". | |
53 nesting.push ('n'); | |
54 } | |
2123 | 55 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
56 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
57 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
58 tree_print_code (const tree_print_code&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
59 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
60 tree_print_code& operator = (const tree_print_code&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
61 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
62 ~tree_print_code (void) = default; |
2123 | 63 |
5861 | 64 void visit_anon_fcn_handle (tree_anon_fcn_handle&); |
65 | |
2123 | 66 void visit_argument_list (tree_argument_list&); |
67 | |
68 void visit_binary_expression (tree_binary_expression&); | |
69 | |
4207 | 70 void visit_break_command (tree_break_command&); |
2123 | 71 |
72 void visit_colon_expression (tree_colon_expression&); | |
73 | |
4207 | 74 void visit_continue_command (tree_continue_command&); |
2123 | 75 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
76 void visit_global_command (tree_global_command&); |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
77 |
14294
9e3983c8963c
deprecate the static keyword
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
78 void visit_persistent_command (tree_persistent_command&); |
2846 | 79 |
80 void visit_decl_elt (tree_decl_elt&); | |
81 | |
82 void visit_decl_init_list (tree_decl_init_list&); | |
83 | |
2969 | 84 void visit_simple_for_command (tree_simple_for_command&); |
85 | |
86 void visit_complex_for_command (tree_complex_for_command&); | |
2123 | 87 |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
88 void visit_octave_user_script (octave_user_script&); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
89 |
2891 | 90 void visit_octave_user_function (octave_user_function&); |
2123 | 91 |
2891 | 92 void visit_octave_user_function_header (octave_user_function&); |
2123 | 93 |
2891 | 94 void visit_octave_user_function_trailer (octave_user_function&); |
2123 | 95 |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
96 void visit_function_def (tree_function_def&); |
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
97 |
2123 | 98 void visit_identifier (tree_identifier&); |
99 | |
100 void visit_if_clause (tree_if_clause&); | |
101 | |
102 void visit_if_command (tree_if_command&); | |
103 | |
104 void visit_if_command_list (tree_if_command_list&); | |
105 | |
106 void visit_index_expression (tree_index_expression&); | |
107 | |
108 void visit_matrix (tree_matrix&); | |
109 | |
3351 | 110 void visit_cell (tree_cell&); |
111 | |
2969 | 112 void visit_multi_assignment (tree_multi_assignment&); |
2123 | 113 |
2620 | 114 void visit_no_op_command (tree_no_op_command&); |
115 | |
2372 | 116 void visit_constant (tree_constant&); |
2123 | 117 |
4342 | 118 void visit_fcn_handle (tree_fcn_handle&); |
119 | |
15035 | 120 void visit_funcall (tree_funcall&); |
121 | |
2123 | 122 void visit_parameter_list (tree_parameter_list&); |
123 | |
124 void visit_postfix_expression (tree_postfix_expression&); | |
125 | |
126 void visit_prefix_expression (tree_prefix_expression&); | |
127 | |
4207 | 128 void visit_return_command (tree_return_command&); |
2123 | 129 |
130 void visit_return_list (tree_return_list&); | |
131 | |
2969 | 132 void visit_simple_assignment (tree_simple_assignment&); |
2123 | 133 |
134 void visit_statement (tree_statement&); | |
135 | |
136 void visit_statement_list (tree_statement_list&); | |
137 | |
2846 | 138 void visit_switch_case (tree_switch_case&); |
139 | |
140 void visit_switch_case_list (tree_switch_case_list&); | |
141 | |
142 void visit_switch_command (tree_switch_command&); | |
143 | |
2123 | 144 void visit_try_catch_command (tree_try_catch_command&); |
145 | |
146 void visit_unwind_protect_command (tree_unwind_protect_command&); | |
147 | |
148 void visit_while_command (tree_while_command&); | |
149 | |
3484 | 150 void visit_do_until_command (tree_do_until_command&); |
151 | |
11223
64e7538db12a
fix printing of newlines for anonymous function handle bodies
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
152 void print_fcn_handle_body (tree_statement_list *); |
4980 | 153 |
2123 | 154 private: |
155 | |
3523 | 156 std::ostream& os; |
2123 | 157 |
3523 | 158 std::string prefix; |
2530 | 159 |
4676 | 160 std::stack<char> nesting; |
161 | |
2530 | 162 bool print_original_text; |
163 | |
3708 | 164 // Current indentation. |
165 int curr_print_indent_level; | |
166 | |
167 // TRUE means we are at the beginning of a line. | |
168 bool beginning_of_line; | |
2123 | 169 |
11223
64e7538db12a
fix printing of newlines for anonymous function handle bodies
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
170 // Nonzero means we are not printing newlines and indenting. |
64e7538db12a
fix printing of newlines for anonymous function handle bodies
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
171 int suppress_newlines; |
4980 | 172 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
173 void do_decl_command (tree_decl_command& cmd); |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
174 |
3933 | 175 void reset_indent_level (void) { curr_print_indent_level = 0; } |
2123 | 176 |
3933 | 177 void increment_indent_level (void) { curr_print_indent_level += 2; } |
2123 | 178 |
3933 | 179 void decrement_indent_level (void) { curr_print_indent_level -= 2; } |
2123 | 180 |
4980 | 181 void newline (const char *alt_txt = ", "); |
2123 | 182 |
183 void indent (void); | |
184 | |
185 void reset (void); | |
186 | |
2961 | 187 void print_parens (const tree_expression& expr, const char *txt); |
188 | |
3665 | 189 void print_comment_list (octave_comment_list *comment_list); |
190 | |
191 void print_comment_elt (const octave_comment_elt& comment_elt); | |
192 | |
193 void print_indented_comment (octave_comment_list *comment_list); | |
194 | |
2123 | 195 // Must create with an output stream! |
196 | |
197 tree_print_code (void); | |
198 }; | |
199 | |
200 #endif | |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
201 |