GNU Octave
10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Loading...
Searching...
No Matches
pt-anon-scopes.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_anon_scopes_h)
27
#define octave_pt_anon_scopes_h 1
28
29
#include <set>
30
#include <string>
31
32
#include "
pt-walk.h
"
33
34
OCTAVE_BEGIN_NAMESPACE
(octave)
35
36
// In possibly nested definitions of anonymous functions, collect
37
// their scopes and the symbol records therein.
38
39
class
tree_anon_scopes
: public
tree_walker
40
{
41
public
:
42
43
tree_anon_scopes
() =
delete
;
44
45
tree_anon_scopes
(
tree_anon_fcn_handle
& anon_fh);
46
47
OCTAVE_DISABLE_COPY_MOVE (
tree_anon_scopes
)
48
49
~tree_anon_scopes
() =
default
;
50
51
std::set<std::string>
fcn_parameters
()
const
{
return
m_params; }
52
53
std::set<std::string>
free_variables
()
const
{
return
m_vars; }
54
55
// The following methods, though public, don't belong to the
56
// intended user interface of this class.
57
58
void
visit_anon_fcn_handle (
tree_anon_fcn_handle
&);
59
60
void
visit_identifier (
tree_identifier
&);
61
62
void
visit_parameter_list (
tree_parameter_list
&);
63
64
void
visit_statement (
tree_statement
&);
65
66
void
visit_statement_list (
tree_statement_list
&);
67
68
private
:
69
70
// Variable names that are function parameters.
71
std::set<std::string> m_params;
72
73
// Other variable names.
74
std::set<std::string> m_vars;
75
};
76
77
OCTAVE_END_NAMESPACE(octave)
78
79
#endif
tree_anon_fcn_handle
Definition
pt-fcn-handle.h:94
tree_anon_scopes
Definition
pt-anon-scopes.h:40
tree_anon_scopes::fcn_parameters
std::set< std::string > fcn_parameters() const
Definition
pt-anon-scopes.h:51
tree_anon_scopes::tree_anon_scopes
tree_anon_scopes()=delete
tree_anon_scopes::~tree_anon_scopes
~tree_anon_scopes()=default
tree_anon_scopes::free_variables
std::set< std::string > free_variables() const
Definition
pt-anon-scopes.h:53
tree_identifier
Definition
pt-id.h:53
tree_parameter_list
Definition
pt-misc.h:47
tree_statement_list
Definition
pt-stmt.h:142
tree_statement
Definition
pt-stmt.h:53
tree_walker
Definition
pt-walk.h:111
OCTAVE_BEGIN_NAMESPACE
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
pt-walk.h
libinterp
parse-tree
pt-anon-scopes.h
Generated on Sat Aug 2 2025 06:52:13 for GNU Octave by
1.9.8