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.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-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_h)
24 #define octave_pt_h 1
25 
26 #include "octave-config.h"
27 
28 #include <string>
29 
30 #include <iosfwd>
31 
32 class octave_function;
33 class tree_walker;
34 class bp_table;
36 
37 // Base class for the parse tree.
38 
39 class
40 tree
41 {
42 public:
43 
44  tree (int l = -1, int c = -1)
45  : line_num (l), column_num (c), bp (NULL) { }
46 
47  virtual ~tree (void) { }
48 
49  virtual int line (void) const { return line_num; }
50 
51  virtual int column (void) const { return column_num; }
52 
53  void line (int l) { line_num = l; }
54 
55  void column (int c) { column_num = c; }
56 
57  void set_location (int l, int c)
58  {
59  line_num = l;
60  column_num = c;
61  }
62 
63  virtual void set_breakpoint (const std::string& condition)
64  {
65  if (bp)
66  *bp = condition;
67  else
68  bp = new std::string(condition);
69  }
70 
71  virtual void delete_breakpoint (void) { if (bp) delete bp; bp = NULL; }
72 
73  bool meets_bp_condition (void) const;
74 
75  bool is_breakpoint (bool check_active = false) const
76  { return bp && (!check_active || meets_bp_condition ()); }
77 
78  // breakpoint condition, or "0" (i.e., "false") if no breakpoint.
79  // To distinguish "0" from a disabled breakpoint, test "is_breakpoint" too.
80  const std::string bp_cond (void) const
81  { return bp ? *bp : std::string("0"); }
82 
83  std::string str_print_code (void);
84 
85  virtual void accept (tree_walker& tw) = 0;
86 
87 private:
88 
89  // The input line and column where we found the text that was
90  // eventually converted to this tree node.
91  int line_num;
93 
94  // Breakpoint flag: NULL if no breakpoint, or the condition if there is one
96 
97  // No copying!
98 
99  tree (const tree&);
100 
101  tree& operator = (const tree&);
102 };
103 
104 #endif
const std::string bp_cond(void) const
Definition: pt.h:80
void line(int l)
Definition: pt.h:53
virtual void delete_breakpoint(void)
Definition: pt.h:71
Definition: debug.h:47
tree(int l=-1, int c=-1)
Definition: pt.h:44
std::string * bp
Definition: pt.h:95
virtual ~tree(void)
Definition: pt.h:47
void set_location(int l, int c)
Definition: pt.h:57
bool meets_condition(std::string *)
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
virtual int line(void) const
Definition: pt.h:49
int column_num
Definition: pt.h:92
Definition: pt.h:39
bool is_breakpoint(bool check_active=false) const
Definition: pt.h:75
void column(int c)
Definition: pt.h:55
int line_num
Definition: pt.h:91
virtual int column(void) const
Definition: pt.h:51
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
virtual void set_breakpoint(const std::string &condition)
Definition: pt.h:63