2987
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 1996, 1997, 2000, 2001, 2002, 2004, 2005, 2007 |
|
4 John W. Eaton |
2987
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
2987
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
2987
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_tree_h) |
|
25 #define octave_tree_h 1 |
|
26 |
2991
|
27 #include <string> |
|
28 |
3503
|
29 #include <iostream> |
2991
|
30 |
4748
|
31 class octave_function; |
2987
|
32 class tree_walker; |
|
33 |
|
34 // Base class for the parse tree. |
|
35 |
|
36 class |
|
37 tree |
|
38 { |
|
39 public: |
|
40 |
3770
|
41 tree (int l = -1, int c = -1) : break_point(false) |
2987
|
42 { |
|
43 line_num = l; |
|
44 column_num = c; |
|
45 } |
|
46 |
|
47 virtual ~tree (void) { } |
|
48 |
|
49 virtual int line (void) const |
|
50 { return line_num; } |
|
51 |
|
52 virtual int column (void) const |
|
53 { return column_num; } |
|
54 |
|
55 virtual void accept (tree_walker& tw) = 0; |
|
56 |
3523
|
57 std::string str_print_code (void); |
2991
|
58 |
3770
|
59 virtual void set_breakpoint (void) |
|
60 { break_point = true; } |
|
61 |
|
62 virtual void delete_breakpoint (void) |
|
63 { break_point = false; } |
|
64 |
|
65 virtual bool is_breakpoint (void) const |
|
66 { return break_point; } |
|
67 |
3772
|
68 // If true, stop executing at the next possible point. |
|
69 static bool break_next; |
3805
|
70 |
5388
|
71 // The line where dbnext was executed. |
3805
|
72 static int last_line; |
|
73 |
|
74 // The function where the last breakpoint occurred. |
4748
|
75 static const octave_function *break_function; |
3805
|
76 |
|
77 // The statement where the last breakpoint occurred. |
|
78 static const tree *break_statement; |
3772
|
79 |
2987
|
80 private: |
|
81 |
|
82 // The input line and column where we found the text that was |
|
83 // eventually converted to this tree node. |
|
84 int line_num; |
|
85 int column_num; |
|
86 |
3770
|
87 // Stop before executing this tree node |
|
88 bool break_point; |
|
89 |
2987
|
90 // No copying! |
|
91 |
|
92 tree (const tree&); |
|
93 |
|
94 tree& operator = (const tree&); |
|
95 }; |
|
96 |
|
97 #endif |
|
98 |
|
99 /* |
|
100 ;;; Local Variables: *** |
|
101 ;;; mode: C++ *** |
|
102 ;;; End: *** |
|
103 */ |