Mercurial > hg > octave-nkf
annotate src/pt-except.h @ 14200:64d9f33313cc stable rc-3-6-0-1
3.6.0-rc1 release candidate
* configure.ac (AC_INIT): Version is now 3.6.0-rc1.
(OCTAVE_RELEASE_DATE): Now 2012-01-12.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 12 Jan 2012 14:31:50 -0500 |
parents | 72c96de7a403 |
children | 955a9f63a35e |
rev | line source |
---|---|
2982 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3 Copyright (C) 1996-2012 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_except_h) | |
24 #define octave_tree_except_h 1 | |
25 | |
26 class tree_statement_list; | |
27 | |
28 class tree_walker; | |
29 | |
3665 | 30 #include "comment-list.h" |
2982 | 31 #include "pt-cmd.h" |
7336 | 32 #include "symtab.h" |
2982 | 33 |
34 // Simple exception handling. | |
35 | |
36 class | |
37 tree_try_catch_command : public tree_command | |
38 { | |
39 public: | |
40 | |
41 tree_try_catch_command (int l = -1, int c = -1) | |
3665 | 42 : tree_command (l, c), try_code (0), catch_code (0), lead_comm (0), |
43 mid_comm (0), trail_comm (0) { } | |
2982 | 44 |
45 tree_try_catch_command (tree_statement_list *tc, tree_statement_list *cc, | |
10313 | 46 octave_comment_list *cl = 0, |
47 octave_comment_list *cm = 0, | |
48 octave_comment_list *ct = 0, | |
49 int l = -1, int c = -1) | |
3665 | 50 : tree_command (l, c), try_code (tc), catch_code (cc), |
51 lead_comm (cl), mid_comm (cm), trail_comm (ct) { } | |
2982 | 52 |
53 ~tree_try_catch_command (void); | |
54 | |
55 tree_statement_list *body (void) { return try_code; } | |
56 | |
57 tree_statement_list *cleanup (void) { return catch_code; } | |
58 | |
3665 | 59 octave_comment_list *leading_comment (void) { return lead_comm; } |
60 | |
61 octave_comment_list *middle_comment (void) { return mid_comm; } | |
62 | |
63 octave_comment_list *trailing_comment (void) { return trail_comm; } | |
64 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
65 tree_command *dup (symbol_table::scope_id scope, |
10313 | 66 symbol_table::context_id context) const; |
5861 | 67 |
2982 | 68 void accept (tree_walker& tw); |
69 | |
70 private: | |
71 | |
72 // The first block of code to attempt to execute. | |
73 tree_statement_list *try_code; | |
74 | |
75 // The code to execute if an error occurs in the first block. | |
76 tree_statement_list *catch_code; | |
2988 | 77 |
3665 | 78 // Comment preceding TRY token. |
79 octave_comment_list *lead_comm; | |
80 | |
81 // Comment preceding CATCH token. | |
82 octave_comment_list *mid_comm; | |
83 | |
84 // Comment preceding END_TRY_CATCH token. | |
85 octave_comment_list *trail_comm; | |
86 | |
2988 | 87 // No copying! |
88 | |
89 tree_try_catch_command (const tree_try_catch_command&); | |
90 | |
91 tree_try_catch_command& operator = (const tree_try_catch_command&); | |
2982 | 92 }; |
93 | |
94 // Simple exception handling. | |
95 | |
96 class | |
97 tree_unwind_protect_command : public tree_command | |
98 { | |
99 public: | |
100 | |
101 tree_unwind_protect_command (int l = -1, int c = -1) | |
3665 | 102 : tree_command (l, c), unwind_protect_code (0), cleanup_code (0), |
103 lead_comm (0), mid_comm (0), trail_comm (0) { } | |
2982 | 104 |
105 tree_unwind_protect_command (tree_statement_list *tc, | |
10313 | 106 tree_statement_list *cc, |
107 octave_comment_list *cl = 0, | |
108 octave_comment_list *cm = 0, | |
109 octave_comment_list *ct = 0, | |
110 int l = -1, int c = -1) | |
3665 | 111 : tree_command (l, c), unwind_protect_code (tc), cleanup_code (cc), |
112 lead_comm (cl), mid_comm (cm), trail_comm (ct) { } | |
2982 | 113 |
114 ~tree_unwind_protect_command (void); | |
115 | |
116 tree_statement_list *body (void) { return unwind_protect_code; } | |
117 | |
118 tree_statement_list *cleanup (void) { return cleanup_code; } | |
119 | |
3665 | 120 octave_comment_list *leading_comment (void) { return lead_comm; } |
121 | |
122 octave_comment_list *middle_comment (void) { return mid_comm; } | |
123 | |
124 octave_comment_list *trailing_comment (void) { return trail_comm; } | |
125 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
126 tree_command *dup (symbol_table::scope_id scope, |
10313 | 127 symbol_table::context_id context) const; |
5861 | 128 |
2982 | 129 void accept (tree_walker& tw); |
130 | |
131 private: | |
132 | |
133 // The first body of code to attempt to execute. | |
134 tree_statement_list *unwind_protect_code; | |
135 | |
136 // The body of code to execute no matter what happens in the first | |
137 // body of code. | |
138 tree_statement_list *cleanup_code; | |
2988 | 139 |
3665 | 140 // Comment preceding TRY token. |
141 octave_comment_list *lead_comm; | |
142 | |
143 // Comment preceding CATCH token. | |
144 octave_comment_list *mid_comm; | |
145 | |
146 // Comment preceding END_TRY_CATCH token. | |
147 octave_comment_list *trail_comm; | |
148 | |
2988 | 149 // No copying! |
150 | |
151 tree_unwind_protect_command (const tree_unwind_protect_command&); | |
152 | |
153 tree_unwind_protect_command& operator = (const tree_unwind_protect_command&); | |
2982 | 154 }; |
155 | |
156 #endif |