pt-arg-list.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_arg_list_h)
00024 #define octave_tree_arg_list_h 1
00025 
00026 #include <list>
00027 
00028 class octave_value_list;
00029 class octave_lvalue;
00030 class tree_expression;
00031 class tree_walker;
00032 
00033 #include "str-vec.h"
00034 
00035 #include "base-list.h"
00036 
00037 // Argument lists.  Used to hold the list of expressions that are the
00038 // arguments in a function call or index expression.
00039 
00040 class
00041 tree_argument_list : public octave_base_list<tree_expression *>
00042 {
00043 public:
00044 
00045   typedef tree_expression* element_type;
00046 
00047   tree_argument_list (void)
00048     : list_includes_magic_end (false), list_includes_magic_tilde (false),
00049     simple_assign_lhs (false) { }
00050 
00051   tree_argument_list (tree_expression *t)
00052     : list_includes_magic_end (false), list_includes_magic_tilde (false),
00053     simple_assign_lhs (false)
00054   { append (t); }
00055 
00056   ~tree_argument_list (void);
00057 
00058   bool has_magic_end (void) const;
00059 
00060   bool has_magic_tilde (void) const
00061     { return list_includes_magic_tilde; }
00062 
00063   tree_expression *remove_front (void)
00064     {
00065       iterator p = begin ();
00066       tree_expression *retval = *p;
00067       erase (p);
00068       return retval;
00069     }
00070 
00071   void append (const element_type& s);
00072 
00073   void mark_as_simple_assign_lhs (void) { simple_assign_lhs = true; }
00074 
00075   bool is_simple_assign_lhs (void) { return simple_assign_lhs; }
00076 
00077   bool all_elements_are_constant (void) const;
00078 
00079   octave_value_list convert_to_const_vector (const octave_value *object = 0);
00080 
00081   std::list<octave_lvalue> lvalue_list (void);
00082 
00083   string_vector get_arg_names (void) const;
00084 
00085   tree_argument_list *dup (symbol_table::scope_id scope,
00086                            symbol_table::context_id context) const;
00087 
00088   void accept (tree_walker& tw);
00089 
00090 private:
00091 
00092   bool list_includes_magic_end;
00093 
00094   bool list_includes_magic_tilde;
00095 
00096   bool simple_assign_lhs;
00097 
00098   // No copying!
00099 
00100   tree_argument_list (const tree_argument_list&);
00101 
00102   tree_argument_list& operator = (const tree_argument_list&);
00103 };
00104 
00105 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines