GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pt-except.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
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
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
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
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_pt_except_h)
24 #define octave_pt_except_h 1
25 
26 #include "octave-config.h"
27 
29 
30 class tree_walker;
31 
32 #include "comment-list.h"
33 #include "pt-cmd.h"
34 #include "pt-id.h"
35 #include "symtab.h"
36 
37 // Simple exception handling.
38 
39 class
41 {
42 public:
43 
44  tree_try_catch_command (int l = -1, int c = -1)
45  : tree_command (l, c), try_code (0), catch_code (0), expr_id (0),
46  lead_comm (0), mid_comm (0), trail_comm (0) { }
47 
49  tree_identifier *id,
50  octave_comment_list *cl = 0,
51  octave_comment_list *cm = 0,
52  octave_comment_list *ct = 0,
53  int l = -1, int c = -1)
54  : tree_command (l, c), try_code (tc), catch_code (cc), expr_id (id),
55  lead_comm (cl), mid_comm (cm), trail_comm (ct) { }
56 
57  ~tree_try_catch_command (void);
58 
59  tree_identifier *identifier (void) { return expr_id; }
60 
61  tree_statement_list *body (void) { return try_code; }
62 
63  tree_statement_list *cleanup (void) { return catch_code; }
64 
65  octave_comment_list *leading_comment (void) { return lead_comm; }
66 
67  octave_comment_list *middle_comment (void) { return mid_comm; }
68 
69  octave_comment_list *trailing_comment (void) { return trail_comm; }
70 
73 
74  void accept (tree_walker& tw);
75 
76 private:
77 
78  // The first block of code to attempt to execute.
80 
81  // The code to execute if an error occurs in the first block.
83 
84  // Identifier to modify.
86 
87  // Comment preceding TRY token.
89 
90  // Comment preceding CATCH token.
92 
93  // Comment preceding END_TRY_CATCH token.
95 
96  // No copying!
97 
99 
101 };
102 
103 // Simple exception handling.
104 
105 class
107 {
108 public:
109 
110  tree_unwind_protect_command (int l = -1, int c = -1)
111  : tree_command (l, c), unwind_protect_code (0), cleanup_code (0),
112  lead_comm (0), mid_comm (0), trail_comm (0) { }
113 
116  octave_comment_list *cl = 0,
117  octave_comment_list *cm = 0,
118  octave_comment_list *ct = 0,
119  int l = -1, int c = -1)
120  : tree_command (l, c), unwind_protect_code (tc), cleanup_code (cc),
121  lead_comm (cl), mid_comm (cm), trail_comm (ct) { }
122 
124 
125  tree_statement_list *body (void) { return unwind_protect_code; }
126 
127  tree_statement_list *cleanup (void) { return cleanup_code; }
128 
129  octave_comment_list *leading_comment (void) { return lead_comm; }
130 
131  octave_comment_list *middle_comment (void) { return mid_comm; }
132 
133  octave_comment_list *trailing_comment (void) { return trail_comm; }
134 
137 
138  void accept (tree_walker& tw);
139 
140 private:
141 
142  // The first body of code to attempt to execute.
144 
145  // The body of code to execute no matter what happens in the first
146  // body of code.
148 
149  // Comment preceding UNWIND_PROTECT token.
151 
152  // Comment preceding UNWIND_PROTECT_CLEANUP token.
154 
155  // Comment preceding END_UNWIND_PROTECT token.
157 
158  // No copying!
159 
161 
163 };
164 
165 #endif
tree_unwind_protect_command(tree_statement_list *tc, tree_statement_list *cc, octave_comment_list *cl=0, octave_comment_list *cm=0, octave_comment_list *ct=0, int l=-1, int c=-1)
Definition: pt-except.h:114
tree_identifier * identifier(void)
Definition: pt-except.h:59
tree_identifier * expr_id
Definition: pt-except.h:85
octave_comment_list * leading_comment(void)
Definition: pt-except.h:129
tree_statement_list * cleanup(void)
Definition: pt-except.h:127
tree_statement_list * try_code
Definition: pt-except.h:79
octave_comment_list * mid_comm
Definition: pt-except.h:91
octave_comment_list * middle_comment(void)
Definition: pt-except.h:67
tree_statement_list * catch_code
Definition: pt-except.h:82
octave_comment_list * trailing_comment(void)
Definition: pt-except.h:133
tree_statement_list * unwind_protect_code
Definition: pt-except.h:143
octave_comment_list * lead_comm
Definition: pt-except.h:88
static llvm::LLVMContext & context
Definition: jit-typeinfo.cc:76
octave_comment_list * trail_comm
Definition: pt-except.h:94
tree_unwind_protect_command(int l=-1, int c=-1)
Definition: pt-except.h:110
tree_try_catch_command(tree_statement_list *tc, tree_statement_list *cc, tree_identifier *id, octave_comment_list *cl=0, octave_comment_list *cm=0, octave_comment_list *ct=0, int l=-1, int c=-1)
Definition: pt-except.h:48
tree_statement_list * body(void)
Definition: pt-except.h:125
octave_comment_list * trail_comm
Definition: pt-except.h:156
tree_statement_list * body(void)
Definition: pt-except.h:61
octave_comment_list * middle_comment(void)
Definition: pt-except.h:131
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
tree_statement_list * cleanup_code
Definition: pt-except.h:147
tree_statement_list * cleanup(void)
Definition: pt-except.h:63
tree_try_catch_command(int l=-1, int c=-1)
Definition: pt-except.h:44
octave_comment_list * trailing_comment(void)
Definition: pt-except.h:69
octave_comment_list * mid_comm
Definition: pt-except.h:153
octave_comment_list * lead_comm
Definition: pt-except.h:150
octave_comment_list * leading_comment(void)
Definition: pt-except.h:65
tree_walker & operator=(const tree_walker &)