Mercurial > hg > octave-lyh
annotate src/pt-stmt.h @ 13714:a2f8ca655ca3
Make uicontextmenu::visible property off by default.
* graphics.h.in (uicontextmenu::properties::init): Set visible to false.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 17 Oct 2011 21:46:08 +0100 |
parents | fd0a3ac60b0e |
children | 72c96de7a403 |
rev | line source |
---|---|
2982 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1996-2011 John W. Eaton |
2982 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2982 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2982 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_tree_stmt_h) | |
24 #define octave_tree_stmt_h 1 | |
25 | |
26 class octave_value_list; | |
27 | |
28 class tree_command; | |
29 class tree_expression; | |
30 | |
31 class tree_walker; | |
32 | |
7552
6070c3bd69c4
Arbitrary call stack access for external debuggers changeset
ryanru@PrinceHumperdinck
parents:
7336
diff
changeset
|
33 #include <deque> |
6070c3bd69c4
Arbitrary call stack access for external debuggers changeset
ryanru@PrinceHumperdinck
parents:
7336
diff
changeset
|
34 |
4219 | 35 #include "base-list.h" |
3665 | 36 #include "comment-list.h" |
7336 | 37 #include "symtab.h" |
3665 | 38 |
2982 | 39 // A statement is either a command to execute or an expression to |
40 // evaluate. | |
41 | |
42 class | |
43 tree_statement | |
44 { | |
45 public: | |
46 | |
47 tree_statement (void) | |
8843
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
48 : cmd (0), expr (0), comm (0) { } |
2982 | 49 |
3665 | 50 tree_statement (tree_command *c, octave_comment_list *cl) |
8843
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
51 : cmd (c), expr (0), comm (cl) { } |
2982 | 52 |
3665 | 53 tree_statement (tree_expression *e, octave_comment_list *cl) |
8843
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
54 : cmd (0), expr (e), comm (cl) { } |
2982 | 55 |
56 ~tree_statement (void); | |
57 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
58 void set_print_flag (bool print_flag); |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
59 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
60 bool print_result (void); |
2982 | 61 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
62 bool is_command (void) const { return cmd != 0; } |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
63 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
64 bool is_expression (void) const { return expr != 0; } |
2982 | 65 |
8843
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
66 void set_breakpoint (void); |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
67 |
8843
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
68 void delete_breakpoint (void); |
2982 | 69 |
8843
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8669
diff
changeset
|
70 bool is_breakpoint (void) const; |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
71 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
72 int line (void) const; |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
73 int column (void) const; |
2982 | 74 |
8669
33783e94fb16
line number fixes and other evaluator tweaks
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
75 void echo_code (void); |
2982 | 76 |
77 tree_command *command (void) { return cmd; } | |
78 | |
79 tree_expression *expression (void) { return expr; } | |
80 | |
3665 | 81 octave_comment_list *comment_text (void) { return comm; } |
82 | |
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
|
83 bool is_null_statement (void) const { return ! (cmd || expr || comm); } |
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
|
84 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
85 bool is_end_of_fcn_or_script (void) const; |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
86 |
4935 | 87 // Allow modification of this statement. Note that there is no |
88 // checking. If you use these, are you sure you knwo what you are | |
89 // doing? | |
90 | |
91 void set_command (tree_command *c) { cmd = c; } | |
92 | |
93 void set_expression (tree_expression *e) { expr = e; } | |
94 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7736
diff
changeset
|
95 tree_statement *dup (symbol_table::scope_id scope, |
10313 | 96 symbol_table::context_id context) const; |
5861 | 97 |
2982 | 98 void accept (tree_walker& tw); |
99 | |
100 private: | |
101 | |
102 // Only one of cmd or expr can be valid at once. | |
103 | |
104 // Command to execute. | |
105 tree_command *cmd; | |
106 | |
107 // Expression to evaluate. | |
108 tree_expression *expr; | |
109 | |
3665 | 110 // Comment associated with this statement. |
111 octave_comment_list *comm; | |
112 | |
2988 | 113 // No copying! |
114 tree_statement (const tree_statement&); | |
115 | |
116 tree_statement& operator = (const tree_statement&); | |
2982 | 117 }; |
118 | |
119 // A list of statements to evaluate. | |
120 | |
121 class | |
4219 | 122 tree_statement_list : public octave_base_list<tree_statement *> |
2982 | 123 { |
124 public: | |
125 | |
126 tree_statement_list (void) | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
127 : function_body (false), anon_function_body (false), |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
128 script_body (false) { } |
2982 | 129 |
130 tree_statement_list (tree_statement *s) | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
131 : function_body (false), anon_function_body (false), |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
132 script_body (false) { append (s); } |
2982 | 133 |
134 ~tree_statement_list (void) | |
135 { | |
4219 | 136 while (! empty ()) |
10313 | 137 { |
138 iterator p = begin (); | |
139 delete *p; | |
140 erase (p); | |
141 } | |
2982 | 142 } |
143 | |
144 void mark_as_function_body (void) { function_body = true; } | |
145 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
146 void mark_as_anon_function_body (void) { anon_function_body = true; } |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
147 |
7736 | 148 void mark_as_script_body (void) { script_body = true; } |
149 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
150 bool is_function_body (void) const { return function_body; } |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
151 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
152 bool is_anon_function_body (void) const { return anon_function_body; } |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
153 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
154 bool is_script_body (void) const { return script_body; } |
2982 | 155 |
3770 | 156 int set_breakpoint (int line); |
157 | |
158 void delete_breakpoint (int line); | |
159 | |
160 octave_value_list list_breakpoints (void); | |
161 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7736
diff
changeset
|
162 tree_statement_list *dup (symbol_table::scope_id scope, |
10313 | 163 symbol_table::context_id context) const; |
5861 | 164 |
2982 | 165 void accept (tree_walker& tw); |
166 | |
167 private: | |
168 | |
169 // Does this list of statements make up the body of a function? | |
170 bool function_body; | |
2988 | 171 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
172 // Does this list of statements make up the body of a function? |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
173 bool anon_function_body; |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8471
diff
changeset
|
174 |
7736 | 175 // Does this list of statements make up the body of a script? |
176 bool script_body; | |
177 | |
2988 | 178 // No copying! |
179 | |
180 tree_statement_list (const tree_statement_list&); | |
181 | |
182 tree_statement_list& operator = (const tree_statement_list&); | |
2982 | 183 }; |
184 | |
185 #endif |