GNU Octave
6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
pt-anon-scopes.h
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (C) 1996-2021 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
namespace
octave
35
{
36
// In possibly nested definitions of anonymous functions, collect
37
// their scopes and the symbol records therein.
38
39
class
40
tree_anon_scopes
:
public
tree_walker
41
{
42
public
:
43
44
tree_anon_scopes
(
void
) =
delete
;
45
46
tree_anon_scopes
(
tree_anon_fcn_handle
& anon_fh);
47
48
// No copying!
49
50
tree_anon_scopes
(
const
tree_anon_scopes
&) =
delete
;
51
52
tree_anon_scopes
& operator = (
const
tree_anon_scopes
&) =
delete
;
53
54
~tree_anon_scopes
(
void
) =
default
;
55
56
std::set<std::string>
fcn_parameters
(
void
)
const
{
return
m_params; }
57
58
std::set<std::string>
free_variables
(
void
)
const
{
return
m_vars; }
59
60
// The following methods, though public, don't belong to the
61
// intended user interface of this class.
62
63
void
visit_anon_fcn_handle (
tree_anon_fcn_handle
&);
64
65
void
visit_identifier (
tree_identifier
&);
66
67
void
visit_parameter_list (
tree_parameter_list
&);
68
69
void
visit_statement (
tree_statement
&);
70
71
void
visit_statement_list (
tree_statement_list
&);
72
73
private
:
74
75
// Variable names that are function parameters.
76
std::set<std::string>
m_params
;
77
78
// Other variable names.
79
std::set<std::string>
m_vars
;
80
};
81
}
82
83
#endif
octave::tree_anon_fcn_handle
Definition:
pt-fcn-handle.h:97
octave::tree_anon_scopes
Definition:
pt-anon-scopes.h:41
octave::tree_anon_scopes::m_vars
std::set< std::string > m_vars
Definition:
pt-anon-scopes.h:79
octave::tree_anon_scopes::free_variables
std::set< std::string > free_variables(void) const
Definition:
pt-anon-scopes.h:58
octave::tree_anon_scopes::~tree_anon_scopes
~tree_anon_scopes(void)=default
octave::tree_anon_scopes::fcn_parameters
std::set< std::string > fcn_parameters(void) const
Definition:
pt-anon-scopes.h:56
octave::tree_anon_scopes::tree_anon_scopes
tree_anon_scopes(void)=delete
octave::tree_anon_scopes::m_params
std::set< std::string > m_params
Definition:
pt-anon-scopes.h:76
octave::tree_anon_scopes::tree_anon_scopes
tree_anon_scopes(const tree_anon_scopes &)=delete
octave::tree_identifier
Definition:
pt-id.h:51
octave::tree_parameter_list
Definition:
pt-misc.h:46
octave::tree_statement_list
Definition:
pt-stmt.h:144
octave::tree_statement
Definition:
pt-stmt.h:53
octave::tree_walker
Definition:
pt-walk.h:104
octave
Definition:
aepbalance.cc:41
pt-walk.h
libinterp
parse-tree
pt-anon-scopes.h
Generated on Tue Apr 13 2021 15:27:48 for GNU Octave by
1.9.1