annotate libinterp/parse-tree/pt-anon-scopes.h @ 27923:bd51beb6205e

update formatting of copyright notices * Use <https://octave.org/copyright/> instead of <https://octave.org/COPYRIGHT.html/>. * For consistency with other comments in the Octave sources, use C++-style comments for copyright blocks in C and C++ files. * Use delimiters above and below copyright blocks that are appropriate for the language used in the file. * Eliminate extra spacing inside copyright blocks. * lex.ll (looks_like_copyright): Also allow newlines and carriage returns before the word "Copyright". * scripts/mk-doc.pl (gethelp): Also skip empty comment lines. * bp-table.cc, type.m: Adjust tests.
author John W. Eaton <jwe@octave.org>
date Wed, 08 Jan 2020 11:59:41 -0500
parents 1891570abac8
children 0a5b15007766
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
3 // Copyright (C) 1996-2020 The Octave Project Developers
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
25824
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
25
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
26 #if !defined (octave_pt_anon_scopes_h)
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
27 #define octave_pt_anon_scopes_h 1
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
28
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
29 #include <set>
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
30 #include <string>
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
31
25824
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
32 #include "pt-walk.h"
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
33
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
34 namespace octave
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
35 {
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
36 // In possibly nested definitions of anonymous functions, collect
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
37 // their scopes and the symbol records therein.
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
38
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
39 class
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
40 tree_anon_scopes : public tree_walker
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
41 {
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
42 public:
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
43
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
44 tree_anon_scopes (void) = delete;
25824
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
45
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
46 tree_anon_scopes (tree_anon_fcn_handle& anon_fh);
25824
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
47
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
48 // No copying!
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
49
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
50 tree_anon_scopes (const tree_anon_scopes&) = delete;
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
51
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
52 tree_anon_scopes& operator = (const tree_anon_scopes&) = delete;
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
53
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
54 ~tree_anon_scopes (void) = default;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
55
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
56 std::set<std::string> fcn_parameters (void) const { return m_params; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
57
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
58 std::set<std::string> free_variables (void) const { return m_vars; }
25824
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
59
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
60 // The following methods, though public, don't belong to the
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
61 // intended user interface of this class.
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
62
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
63 void visit_anon_fcn_handle (tree_anon_fcn_handle&);
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
64
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
65 void visit_identifier (tree_identifier&);
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
66
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
67 void visit_parameter_list (tree_parameter_list&);
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
68
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
69 void visit_statement (tree_statement&);
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
70
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
71 void visit_statement_list (tree_statement_list&);
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
72
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
73 private:
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
74
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
75 // Variable names that are function parameters.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
76 std::set<std::string> m_params;
25824
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
77
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
78 // Other variable names.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
79 std::set<std::string> m_vars;
25824
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
80 };
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
81 }
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
82
91e1ca0e3a9d Save all scopes of nested anonymous functions (bug #45969).
Olaf Till <i7tiol@t-online.de>
parents:
diff changeset
83 #endif