annotate libinterp/parse-tree/pt-stmt.h @ 25337:3ff9192b676e

use auto keyword to declare iterator variables where possible * dialog.cc, files-dock-widget.cc, history-dock-widget.cc, file-editor.cc, octave-qt-link.cc, call-stack.cc, debug.cc, dynamic-ld.cc, fcn-info.cc, fcn-info.h, genprops.awk, graphics.cc, gtk-manager.cc, gtk-manager.h, hook-fcn.h, load-path.cc, load-save.cc, ls-mat5.cc, mex.cc, oct-map.cc, oct-stream.cc, octave-link.cc, regexp.cc, symscope.h, symtab.h, txt-eng.h, url-handle-manager.cc, variables.cc, ov-base.cc, ov-class.cc, ov-classdef.cc, ov-fcn-handle.cc, ov-java.cc, ov-struct.cc, bp-table.cc, jit-ir.cc, jit-typeinfo.cc, pt-arg-list.cc, pt-arg-list.h, pt-array-list.cc, pt-check.cc, pt-classdef.cc, pt-decl.h, pt-eval.cc, pt-idx.cc, pt-jit.cc, pt-misc.cc, pt-pr-code.cc, pt-select.h, pt-stmt.h, caseless-str.h, lo-regexp.cc: Use auto keyword to declare iterator variables where possible. Style fixes.
author John W. Eaton <jwe@octave.org>
date Wed, 02 May 2018 01:36:20 -0400
parents 6652d3823428
children 8a15f3bace49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
1 /*
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
2
25054
6652d3823428 maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 24846
diff changeset
3 Copyright (C) 1996-2018 John W. Eaton
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
4
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
6
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24362
diff changeset
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
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24362
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
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.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
16
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
18 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24362
diff changeset
19 <https://www.gnu.org/licenses/>.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
20
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
21 */
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
23 #if ! defined (octave_pt_stmt_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
24 #define octave_pt_stmt_h 1
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21157
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21157
diff changeset
27
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
28 class octave_value_list;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
29
7552
6070c3bd69c4 Arbitrary call stack access for external debuggers changeset
ryanru@PrinceHumperdinck
parents: 7336
diff changeset
30 #include <deque>
6070c3bd69c4 Arbitrary call stack access for external debuggers changeset
ryanru@PrinceHumperdinck
parents: 7336
diff changeset
31
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
32 #include "base-list.h"
23137
334119c390b3 move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
33 #include "bp-table.h"
23435
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
34 #include "pt.h"
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
35 #include "pt-walk.h"
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
36
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
37 namespace octave
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
38 {
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
39 class comment_list;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
40 class tree_command;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
41 class tree_expression;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
42
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
43 // A statement is either a command to execute or an expression to
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
44 // evaluate.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
45
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
46 class tree_statement : public tree
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
47 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
48 public:
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
49
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
50 tree_statement (void)
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
51 : m_command (nullptr), m_expression (nullptr),
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
52 m_comment_list (nullptr) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
53
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
54 tree_statement (tree_command *c, comment_list *cl)
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
55 : m_command (c), m_expression (nullptr), m_comment_list (cl) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
56
23750
ea879bc55272 move comment_list and comment_elt classes to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
57 tree_statement (tree_expression *e, comment_list *cl)
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
58 : m_command (nullptr), m_expression (e), m_comment_list (cl) { }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
59
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
60 // No copying!
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8471
diff changeset
61
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
62 tree_statement (const tree_statement&) = delete;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
63
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
64 tree_statement& operator = (const tree_statement&) = delete;
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8471
diff changeset
65
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
66 ~tree_statement (void);
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
67
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
68 void set_print_flag (bool print_flag);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
69
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
70 bool print_result (void);
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8471
diff changeset
71
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
72 bool is_command (void) const { return m_command != nullptr; }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
73
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
74 bool is_expression (void) const { return m_expression != nullptr; }
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8471
diff changeset
75
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
76 void set_breakpoint (const std::string& condition);
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16530
diff changeset
77
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
78 void delete_breakpoint (void);
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
79
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
80 bool is_breakpoint (bool check_valid = false) const;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
81 std::string bp_cond () const;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
82
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
83 int line (void) const;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
84 int column (void) const;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
85
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
86 void set_location (int l, int c);
8471
02de6775f1fe parse.y: always append statements to list, but remove null statements after seeing separator
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
87
23723
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23696
diff changeset
88 void echo_code (const std::string& prefix);
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8471
diff changeset
89
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
90 tree_command * command (void) { return m_command; }
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
91
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
92 tree_expression * expression (void) { return m_expression; }
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16530
diff changeset
93
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
94 comment_list * comment_text (void) { return m_comment_list; }
4935
4fc993a4e072 [project @ 2004-08-06 03:17:12 by jwe]
jwe
parents: 4219
diff changeset
95
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
96 bool is_null_statement (void) const
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
97 {
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
98 return ! (m_command || m_expression || m_comment_list);
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
99 }
8471
02de6775f1fe parse.y: always append statements to list, but remove null statements after seeing separator
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
100
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
101 bool is_end_of_fcn_or_script (void) const;
4935
4fc993a4e072 [project @ 2004-08-06 03:17:12 by jwe]
jwe
parents: 4219
diff changeset
102
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
103 bool is_end_of_file (void) const;
4935
4fc993a4e072 [project @ 2004-08-06 03:17:12 by jwe]
jwe
parents: 4219
diff changeset
104
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
105 // Allow modification of this statement. Note that there is no
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
106 // checking. If you use these, are you sure you knwo what you are
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
107 // doing?
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
108
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
109 void set_command (tree_command *c) { m_command = c; }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
110
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
111 void set_expression (tree_expression *e) { m_expression = e; }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
112
23435
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
113 void accept (tree_walker& tw)
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
114 {
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
115 tw.visit_statement (*this);
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
116 }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
117
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
118 private:
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
119
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
120 // Only one of cmd or expr can be valid at once.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
121
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
122 // Command to execute.
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
123 tree_command *m_command;
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 2988
diff changeset
124
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
125 // Expression to evaluate.
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
126 tree_expression *m_expression;
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
127
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
128 // Comment associated with this statement.
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
129 comment_list *m_comment_list;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
130 };
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
131
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
132 // A list of statements to evaluate.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
133
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23615
diff changeset
134 class tree_statement_list : public base_list<tree_statement *>
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
135 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
136 public:
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
137
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
138 tree_statement_list (void)
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
139 : m_function_body (false), m_anon_function_body (false),
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
140 m_script_body (false) { }
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
141
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
142 tree_statement_list (tree_statement *s)
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
143 : m_function_body (false), m_anon_function_body (false),
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
144 m_script_body (false) { append (s); }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
145
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
146 // No copying!
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
147
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
148 tree_statement_list (const tree_statement_list&) = delete;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
149
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
150 tree_statement_list& operator = (const tree_statement_list&) = delete;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
151
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
152 ~tree_statement_list (void)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
153 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
154 while (! empty ())
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
155 {
25337
3ff9192b676e use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
156 auto p = begin ();
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
157 delete *p;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
158 erase (p);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
159 }
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
160 }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
161
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
162 void mark_as_function_body (void) { m_function_body = true; }
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8471
diff changeset
163
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
164 void mark_as_anon_function_body (void) { m_anon_function_body = true; }
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7734
diff changeset
165
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
166 void mark_as_script_body (void) { m_script_body = true; }
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8471
diff changeset
167
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
168 bool is_function_body (void) const { return m_function_body; }
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8471
diff changeset
169
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
170 bool is_anon_function_body (void) const { return m_anon_function_body; }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
171
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
172 bool is_script_body (void) const { return m_script_body; }
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3707
diff changeset
173
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
174 int set_breakpoint (int line, const std::string& condition);
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
175
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
176 void delete_breakpoint (int line);
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3707
diff changeset
177
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
178 octave_value_list list_breakpoints (void);
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3707
diff changeset
179
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
180 std::list<bp_type> breakpoints_and_conds (void);
21157
94fc5f13d51b dbstop: conditional breakpoint, dbstop if caught error etc. (bug #46795)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20791
diff changeset
181
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
182 bp_table::intmap add_breakpoint (const std::string& file,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
183 const bp_table::intmap& line,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
184 const std::string& condition);
16530
7ca7e7d5eb91 remove breakpoints when clearing function
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
185
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
186 bp_table::intmap remove_all_breakpoints (const std::string& file);
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3707
diff changeset
187
23435
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
188 void accept (tree_walker& tw)
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
189 {
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
190 tw.visit_statement_list (*this);
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
191 }
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
192
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
193 private:
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
194
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
195 // Does this list of statements make up the body of a function?
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
196 bool m_function_body;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
197
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
198 // Does this list of statements make up the body of a function?
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
199 bool m_anon_function_body;
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
200
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
201 // Does this list of statements make up the body of a script?
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
202 bool m_script_body;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
203 };
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
204 }
7736
a059b5679fbb implement dbstack
John W. Eaton <jwe@octave.org>
parents: 7734
diff changeset
205
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
206 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
207
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23601
diff changeset
208 OCTAVE_DEPRECATED (4.4, "use 'octave::tree_statement' instead")
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
209 typedef octave::tree_statement tree_statement;
2988
daa1ed1f5462 [project @ 1997-05-16 07:23:15 by jwe]
jwe
parents: 2982
diff changeset
210
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23601
diff changeset
211 OCTAVE_DEPRECATED (4.4, "use 'octave::tree_statement_list' instead")
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
212 typedef octave::tree_statement_list tree_statement_list;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
213
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
214 #endif
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22333
diff changeset
215
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
216 #endif