Mercurial > hg > octave-nkf
annotate src/pt.h @ 12119:e320928eeb3a release-3-2-x release-3-2-4
version 3.2.4
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 22 Jan 2010 12:43:12 +0100 |
parents | d865363208d6 |
children | cd96d29c5efa |
rev | line source |
---|---|
2987 | 1 /* |
2 | |
8920 | 3 Copyright (C) 1996, 1997, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009 |
7017 | 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 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
29 #include <iosfwd> |
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 |
8843
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
50 void line (int l) { line_num = l; } |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
51 |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
52 void column (int c) { column_num = c; } |
2987 | 53 |
8843
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
54 virtual void set_breakpoint (void) { bp = true; } |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
55 |
b9ce57a309a3
don't store breakpoint info in tree_statement object
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
56 virtual void delete_breakpoint (void) { bp = false; } |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
57 |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
58 bool is_breakpoint (void) const { return bp; } |
2987 | 59 |
3523 | 60 std::string str_print_code (void); |
2991 | 61 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
62 virtual void accept (tree_walker& tw) = 0; |
3772 | 63 |
2987 | 64 private: |
65 | |
66 // The input line and column where we found the text that was | |
67 // eventually converted to this tree node. | |
68 int line_num; | |
69 int column_num; | |
70 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
71 // Breakpoint flag. |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7818
diff
changeset
|
72 bool bp; |
3770 | 73 |
2987 | 74 // No copying! |
75 | |
76 tree (const tree&); | |
77 | |
78 tree& operator = (const tree&); | |
79 }; | |
80 | |
81 #endif | |
82 | |
83 /* | |
84 ;;; Local Variables: *** | |
85 ;;; mode: C++ *** | |
86 ;;; End: *** | |
87 */ |