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