GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
pt-arg-list.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2025 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
33class octave_value;
35
36#include "str-vec.h"
37
38#include "pt-delimiter-list.h"
39#include "pt-exp.h"
40#include "pt-walk.h"
41#include "token.h"
42
44
45class symbol_scope;
46class tree_evaluator;
47class tree_expression;
48
49// Argument lists. Used to hold the list of expressions that are the
50// arguments in a function call or index expression.
51
52class tree_argument_list : public std::list<tree_expression *>
53{
54public:
55
57
59
61
62 OCTAVE_DISABLE_COPY_MOVE (tree_argument_list)
63
65
66 tree_argument_list * mark_in_delims (const token& open_delim, const token& close_delim)
67 {
68 m_delims.push (open_delim, close_delim);
69 return this;
70 }
71
73 {
74 if (m_delims.empty ())
75 {
76 if (empty ())
77 return filepos ();
78
79 tree_expression *elt = front ();
80 return elt->beg_pos ();
81 }
82
83 return m_delims.beg_pos ();
84 }
85
87 {
88 if (m_delims.empty ())
89 {
90 if (empty ())
91 return filepos ();
92
93 tree_expression *elt = back ();
94 return elt->end_pos ();
95 }
96
97 return m_delims.end_pos ();
98 }
99
100 bool has_magic_tilde () const
101 {
102 return m_list_includes_magic_tilde;
103 }
104
106 {
107 return m_list_includes_magic_tilde;
108 }
109
111 {
112 auto p = begin ();
113 tree_expression *retval = *p;
114 erase (p);
115 return retval;
116 }
117
118 void push_back (const element_type& s);
119
120 void mark_as_simple_assign_lhs () { m_simple_assign_lhs = true; }
121
122 bool is_simple_assign_lhs () { return m_simple_assign_lhs; }
123
124 bool all_elements_are_constant () const;
125
126 bool is_valid_lvalue_list () const;
127
129
130 std::list<std::string> variable_names () const;
131
132 tree_argument_list * dup (symbol_scope& scope) const;
133
135 {
136 tw.visit_argument_list (*this);
137 }
138
139private:
140
141 bool m_list_includes_magic_tilde {false};
142
143 bool m_simple_assign_lhs {false};
144
145 tree_delimiter_list m_delims;
146};
147
148OCTAVE_END_NAMESPACE(octave)
149
150#endif
Definition token.h:42
bool includes_magic_tilde() const
filepos end_pos() const
Definition pt-arg-list.h:86
tree_expression * remove_front()
std::list< std::string > variable_names() const
filepos beg_pos() const
Definition pt-arg-list.h:72
bool all_elements_are_constant() const
void push_back(const element_type &s)
void accept(tree_walker &tw)
tree_argument_list(tree_expression *t)
Definition pt-arg-list.h:60
tree_argument_list * dup(symbol_scope &scope) const
bool is_valid_lvalue_list() const
void mark_as_simple_assign_lhs()
string_vector get_arg_names() const
bool has_magic_tilde() const
tree_expression * element_type
Definition pt-arg-list.h:56
tree_argument_list * mark_in_delims(const token &open_delim, const token &close_delim)
Definition pt-arg-list.h:66
bool is_simple_assign_lhs()
void push(const token &open_delim, const token &close_delim)
filepos beg_pos() const
filepos end_pos() const
virtual void visit_argument_list(tree_argument_list &)
Definition pt-walk.cc:48
virtual filepos end_pos() const =0
virtual filepos beg_pos() const =0
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn