Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_tree_cmd_h)
00024 #define octave_tree_cmd_h 1
00025
00026 #include <string>
00027
00028 class tree_walker;
00029
00030 #include "ov-fcn.h"
00031 #include "pt.h"
00032 #include "pt-bp.h"
00033 #include "symtab.h"
00034
00035
00036
00037 class
00038 tree_command : public tree
00039 {
00040 public:
00041
00042 tree_command (int l = -1, int c = -1)
00043 : tree (l, c) { }
00044
00045 virtual ~tree_command (void) { }
00046
00047 virtual tree_command *dup (symbol_table::scope_id,
00048 symbol_table::context_id context) const = 0;
00049
00050 private:
00051
00052
00053
00054 tree_command (const tree_command&);
00055
00056 tree_command& operator = (const tree_command&);
00057 };
00058
00059
00060
00061 class
00062 tree_no_op_command : public tree_command
00063 {
00064 public:
00065
00066 tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1)
00067 : tree_command (l, c), eof (cmd == "endfunction" || cmd == "endscript"),
00068 orig_cmd (cmd) { }
00069
00070 ~tree_no_op_command (void) { }
00071
00072 tree_command *dup (symbol_table::scope_id scope,
00073 symbol_table::context_id context) const;
00074
00075 void accept (tree_walker& tw);
00076
00077 bool is_end_of_fcn_or_script (void) const { return eof; }
00078
00079 std::string original_command (void) { return orig_cmd; }
00080
00081 private:
00082
00083 bool eof;
00084
00085 std::string orig_cmd;
00086
00087
00088
00089 tree_no_op_command (const tree_no_op_command&);
00090
00091 tree_no_op_command& operator = (const tree_no_op_command&);
00092 };
00093
00094
00095
00096 class
00097 tree_function_def : public tree_command
00098 {
00099 public:
00100
00101 tree_function_def (octave_function *f, int l = -1, int c = -1)
00102 : tree_command (l, c), fcn (f) { }
00103
00104 ~tree_function_def (void) { }
00105
00106 tree_command *dup (symbol_table::scope_id scope,
00107 symbol_table::context_id context) const;
00108
00109 void accept (tree_walker& tw);
00110
00111 octave_value function (void) { return fcn; }
00112
00113 private:
00114
00115 octave_value fcn;
00116
00117 tree_function_def (const octave_value& v, int l = -1, int c = -1)
00118 : tree_command (l, c), fcn (v) { }
00119
00120
00121
00122 tree_function_def (const tree_function_def&);
00123
00124 tree_function_def& operator = (const tree_function_def&);
00125 };
00126
00127 #endif