Mercurial > octave
annotate src/pt.h @ 8658:73c4516fae10
New evaluator and debugger derived from tree-walker class
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 04 Feb 2009 00:47:53 -0500 |
parents | 5640a70cbab1 |
children | b9ce57a309a3 |
rev | line source |
---|---|
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 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
41 tree (int l = -1, int c = -1) |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
42 : line_num (l), column_num (c), bp (false) { } |
2987 | 43 |
44 virtual ~tree (void) { } | |
45 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
46 virtual int line (void) const { return line_num; } |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
47 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
48 virtual int column (void) const { return column_num; } |
2987 | 49 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
50 void set_breakpoint (void) { bp = true; } |
2987 | 51 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
52 void delete_breakpoint (void) { bp = false; } |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
53 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
54 bool is_breakpoint (void) const { return bp; } |
2987 | 55 |
3523 | 56 std::string str_print_code (void); |
2991 | 57 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
58 virtual void accept (tree_walker& tw) = 0; |
3772 | 59 |
2987 | 60 private: |
61 | |
62 // The input line and column where we found the text that was | |
63 // eventually converted to this tree node. | |
64 int line_num; | |
65 int column_num; | |
66 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
67 // Breakpoint flag. |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
68 bool bp; |
3770 | 69 |
2987 | 70 // No copying! |
71 | |
72 tree (const tree&); | |
73 | |
74 tree& operator = (const tree&); | |
75 }; | |
76 | |
77 #endif | |
78 | |
79 /* | |
80 ;;; Local Variables: *** | |
81 ;;; mode: C++ *** | |
82 ;;; End: *** | |
83 */ |