pt.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_tree_h)
00024 #define octave_tree_h 1
00025 
00026 #include <string>
00027 
00028 #include <iosfwd>
00029 
00030 class octave_function;
00031 class tree_walker;
00032 
00033 // Base class for the parse tree.
00034 
00035 class
00036 tree
00037 {
00038 public:
00039 
00040   tree (int l = -1, int c = -1)
00041     : line_num (l), column_num (c), bp (false) { }
00042 
00043   virtual ~tree (void) { }
00044 
00045   virtual int line (void) const { return line_num; }
00046 
00047   virtual int column (void) const { return column_num; }
00048 
00049   void line (int l) { line_num = l; }
00050 
00051   void column (int c) { column_num = c; }
00052 
00053   virtual void set_breakpoint (void) { bp = true; }
00054 
00055   virtual void delete_breakpoint (void) { bp = false; }
00056 
00057   bool is_breakpoint (void) const { return bp; }
00058 
00059   std::string str_print_code (void);
00060 
00061   virtual void accept (tree_walker& tw) = 0;
00062 
00063 private:
00064 
00065   // The input line and column where we found the text that was
00066   // eventually converted to this tree node.
00067   int line_num;
00068   int column_num;
00069 
00070   // Breakpoint flag.
00071   bool bp;
00072 
00073   // No copying!
00074 
00075   tree (const tree&);
00076 
00077   tree& operator = (const tree&);
00078 };
00079 
00080 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines