GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
pt-arg-list.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_pt_arg_list_h)
27 #define octave_pt_arg_list_h 1
28 
29 #include "octave-config.h"
30 
31 #include <list>
32 
33 class octave_value;
34 class octave_value_list;
35 
36 #include "str-vec.h"
37 
38 #include "base-list.h"
39 #include "pt-walk.h"
40 
42 
43 class symbol_scope;
44 class tree_evaluator;
45 class tree_expression;
46 
47 // Argument lists. Used to hold the list of expressions that are the
48 // arguments in a function call or index expression.
49 
50 class tree_argument_list : public base_list<tree_expression *>
51 {
52 public:
53 
55 
57  : m_list_includes_magic_tilde (false), m_simple_assign_lhs (false)
58  { }
59 
61  : m_list_includes_magic_tilde (false), m_simple_assign_lhs (false)
62  { append (t); }
63 
64  OCTAVE_DISABLE_COPY_MOVE (tree_argument_list)
65 
67 
68  bool has_magic_tilde () const
69  {
70  return m_list_includes_magic_tilde;
71  }
72 
73  bool includes_magic_tilde () const
74  {
75  return m_list_includes_magic_tilde;
76  }
77 
79  {
80  auto p = begin ();
81  tree_expression *retval = *p;
82  erase (p);
83  return retval;
84  }
85 
86  void append (const element_type& s);
87 
88  void mark_as_simple_assign_lhs () { m_simple_assign_lhs = true; }
89 
90  bool is_simple_assign_lhs () { return m_simple_assign_lhs; }
91 
92  bool all_elements_are_constant () const;
93 
94  bool is_valid_lvalue_list () const;
95 
97 
98  std::list<std::string> variable_names () const;
99 
100  tree_argument_list * dup (symbol_scope& scope) const;
101 
102  void accept (tree_walker& tw)
103  {
104  tw.visit_argument_list (*this);
105  }
106 
107 private:
108 
109  bool m_list_includes_magic_tilde;
110 
111  bool m_simple_assign_lhs;
112 };
113 
114 OCTAVE_END_NAMESPACE(octave)
115 
116 #endif
iterator erase(iterator pos)
Definition: base-list.h:55
bool includes_magic_tilde() const
Definition: pt-arg-list.h:73
tree_expression * remove_front()
Definition: pt-arg-list.h:78
std::list< std::string > variable_names() const
Definition: pt-arg-list.cc:116
bool all_elements_are_constant() const
Definition: pt-arg-list.cc:69
void accept(tree_walker &tw)
Definition: pt-arg-list.h:102
tree_argument_list(tree_expression *t)
Definition: pt-arg-list.h:60
tree_argument_list * dup(symbol_scope &scope) const
Definition: pt-arg-list.cc:141
bool is_valid_lvalue_list() const
Definition: pt-arg-list.cc:81
void append(const element_type &s)
Definition: pt-arg-list.cc:57
void mark_as_simple_assign_lhs()
Definition: pt-arg-list.h:88
string_vector get_arg_names() const
Definition: pt-arg-list.cc:101
bool has_magic_tilde() const
Definition: pt-arg-list.h:68
tree_expression * element_type
Definition: pt-arg-list.h:54
bool is_simple_assign_lhs()
Definition: pt-arg-list.h:90
virtual void visit_argument_list(tree_argument_list &)
Definition: pt-walk.cc:48
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn