2987
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 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 2, or (at your option) any |
|
10 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, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_tree_h) |
|
24 #define octave_tree_h 1 |
|
25 |
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
2991
|
30 #include <string> |
|
31 |
3503
|
32 #include <iostream> |
2991
|
33 |
3805
|
34 class octave_user_function; |
2987
|
35 class tree_walker; |
|
36 |
|
37 // Base class for the parse tree. |
|
38 |
|
39 class |
|
40 tree |
|
41 { |
|
42 public: |
|
43 |
3770
|
44 tree (int l = -1, int c = -1) : break_point(false) |
2987
|
45 { |
|
46 line_num = l; |
|
47 column_num = c; |
|
48 } |
|
49 |
|
50 virtual ~tree (void) { } |
|
51 |
|
52 virtual int line (void) const |
|
53 { return line_num; } |
|
54 |
|
55 virtual int column (void) const |
|
56 { return column_num; } |
|
57 |
|
58 virtual void accept (tree_walker& tw) = 0; |
|
59 |
3523
|
60 std::string str_print_code (void); |
2991
|
61 |
3770
|
62 virtual void set_breakpoint (void) |
|
63 { break_point = true; } |
|
64 |
|
65 virtual void delete_breakpoint (void) |
|
66 { break_point = false; } |
|
67 |
|
68 virtual bool is_breakpoint (void) const |
|
69 { return break_point; } |
|
70 |
3772
|
71 // If true, stop executing at the next possible point. |
|
72 static bool break_next; |
3805
|
73 |
|
74 // The line where dbg_next was executed. |
|
75 static int last_line; |
|
76 |
|
77 // The function where the last breakpoint occurred. |
|
78 static const octave_user_function *break_function; |
|
79 |
|
80 // The statement where the last breakpoint occurred. |
|
81 static const tree *break_statement; |
3772
|
82 |
2987
|
83 private: |
|
84 |
|
85 // The input line and column where we found the text that was |
|
86 // eventually converted to this tree node. |
|
87 int line_num; |
|
88 int column_num; |
|
89 |
3770
|
90 // Stop before executing this tree node |
|
91 bool break_point; |
|
92 |
2987
|
93 // No copying! |
|
94 |
|
95 tree (const tree&); |
|
96 |
|
97 tree& operator = (const tree&); |
|
98 }; |
|
99 |
|
100 #endif |
|
101 |
|
102 /* |
|
103 ;;; Local Variables: *** |
|
104 ;;; mode: C++ *** |
|
105 ;;; End: *** |
|
106 */ |