GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pt-cmd.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2017 John W. Eaton
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 3 of the License, or (at your
10 option) any 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, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_pt_cmd_h)
24 #define octave_pt_cmd_h 1
25 
26 #include "octave-config.h"
27 
28 #include <string>
29 
30 class tree_walker;
31 
32 #include "ov-fcn.h"
33 #include "pt.h"
34 #include "pt-bp.h"
35 #include "symtab.h"
36 
37 // A base class for commands.
38 
39 class
40 tree_command : public tree
41 {
42 public:
43 
44  tree_command (int l = -1, int c = -1)
45  : tree (l, c) { }
46 
47  virtual ~tree_command (void) { }
48 
51 
52 private:
53 
54  // No copying!
55 
56  tree_command (const tree_command&);
57 
59 };
60 
61 // No-op.
62 
63 class
65 {
66 public:
67 
68  tree_no_op_command (const std::string& cmd = "no_op", bool e = false,
69  int l = -1, int c = -1)
70  : tree_command (l, c), eof (e), orig_cmd (cmd) { }
71 
73 
76 
77  void accept (tree_walker& tw);
78 
79  bool is_end_of_fcn_or_script (void) const
80  {
81  return (orig_cmd == "endfunction" || orig_cmd == "endscript");
82  }
83 
84  bool is_end_of_file (void) const { return eof; }
85 
86  std::string original_command (void) { return orig_cmd; }
87 
88 private:
89 
90  bool eof;
91 
93 
94  // No copying!
95 
97 
99 };
100 
101 // Function definition.
102 
103 class
105 {
106 public:
107 
108  tree_function_def (octave_function *f, int l = -1, int c = -1)
109  : tree_command (l, c), fcn (f) { }
110 
112 
115 
116  void accept (tree_walker& tw);
117 
118  octave_value function (void) { return fcn; }
119 
120 private:
121 
123 
124  tree_function_def (const octave_value& v, int l = -1, int c = -1)
125  : tree_command (l, c), fcn (v) { }
126 
127  // No copying!
128 
130 
132 };
133 
134 #endif
tree_command(int l=-1, int c=-1)
Definition: pt-cmd.h:44
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
std::string original_command(void)
Definition: pt-cmd.h:86
bool is_end_of_fcn_or_script(void) const
Definition: pt-cmd.h:79
tree_function_def(const octave_value &v, int l=-1, int c=-1)
Definition: pt-cmd.h:124
i e
Definition: data.cc:2724
octave_value fcn
Definition: pt-cmd.h:122
octave_function * fcn
Definition: ov-class.cc:1743
static llvm::LLVMContext & context
Definition: jit-typeinfo.cc:76
virtual ~tree_command(void)
Definition: pt-cmd.h:47
bool is_end_of_file(void) const
Definition: pt-cmd.h:84
tree_no_op_command(const std::string &cmd="no_op", bool e=false, int l=-1, int c=-1)
Definition: pt-cmd.h:68
std::string orig_cmd
Definition: pt-cmd.h:92
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
tree_function_def(octave_function *f, int l=-1, int c=-1)
Definition: pt-cmd.h:108
~tree_function_def(void)
Definition: pt-cmd.h:111
Definition: pt.h:39
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
tree_walker & operator=(const tree_walker &)
~tree_no_op_command(void)
Definition: pt-cmd.h:72