494
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2004, 2005, |
|
4 2006, 2007 John W. Eaton |
494
|
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. |
494
|
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/>. |
494
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_tree_cmd_h) |
|
25 #define octave_tree_cmd_h 1 |
|
26 |
2982
|
27 #include <string> |
494
|
28 |
2124
|
29 class tree_walker; |
5861
|
30 class symbol_table; |
2124
|
31 |
2988
|
32 #include "pt.h" |
3770
|
33 #include "pt-bp.h" |
578
|
34 |
|
35 // A base class for commands. |
|
36 |
494
|
37 class |
|
38 tree_command : public tree |
|
39 { |
578
|
40 public: |
2124
|
41 |
2982
|
42 tree_command (int l = -1, int c = -1) |
|
43 : tree (l, c) { } |
578
|
44 |
1270
|
45 virtual ~tree_command (void) { } |
|
46 |
578
|
47 virtual void eval (void) = 0; |
2988
|
48 |
5861
|
49 virtual tree_command *dup (symbol_table *) = 0; |
|
50 |
2988
|
51 private: |
|
52 |
|
53 // No copying! |
|
54 |
|
55 tree_command (const tree_command&); |
|
56 |
|
57 tree_command& operator = (const tree_command&); |
494
|
58 }; |
|
59 |
2620
|
60 // No-op. |
|
61 |
|
62 class |
|
63 tree_no_op_command : public tree_command |
|
64 { |
|
65 public: |
|
66 |
3523
|
67 tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1) |
2620
|
68 : tree_command (l, c), orig_cmd (cmd) { } |
|
69 |
|
70 ~tree_no_op_command (void) { } |
|
71 |
3770
|
72 void eval (void) { MAYBE_DO_BREAKPOINT; } |
2620
|
73 |
5861
|
74 tree_command *dup (symbol_table *sym_tab); |
|
75 |
2620
|
76 void accept (tree_walker& tw); |
|
77 |
3523
|
78 std::string original_command (void) { return orig_cmd; } |
2620
|
79 |
|
80 private: |
|
81 |
3523
|
82 std::string orig_cmd; |
2988
|
83 |
|
84 // No copying! |
|
85 |
|
86 tree_no_op_command (const tree_no_op_command&); |
|
87 |
|
88 tree_no_op_command& operator = (const tree_no_op_command&); |
2620
|
89 }; |
|
90 |
494
|
91 #endif |
|
92 |
|
93 /* |
|
94 ;;; Local Variables: *** |
|
95 ;;; mode: C++ *** |
|
96 ;;; End: *** |
|
97 */ |