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
35
36// In possibly nested definitions of anonymous functions, collect
37// their scopes and the symbol records therein.
38
40{
41public:
42
43 tree_anon_scopes () = delete;
44
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
68private:
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
77OCTAVE_END_NAMESPACE(octave)
78
79#endif
std::set< std::string > fcn_parameters() const
tree_anon_scopes()=delete
~tree_anon_scopes()=default
std::set< std::string > free_variables() const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn