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