annotate libinterp/parse-tree/pt-classdef.h @ 33634:4a70f390c85e default tip @

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 28 May 2024 15:25:54 +0200
parents d422992b5483
children
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 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 32464
diff changeset
3 // Copyright (C) 2012-2024 The Octave Project Developers
27923
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 ////////////////////////////////////////////////////////////////////////
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 #if ! defined (octave_tree_classdef_h)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #define octave_tree_classdef_h 1
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
30
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 class octave_value;
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include "pt-cmd.h"
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
34 #include "pt-delimiter-list.h"
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 #include "pt-exp.h"
23435
c452180ab672 begin refactoring parse tree evaluator
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
36 #include "pt-walk.h"
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 #include "pt-id.h"
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
38 #include "token.h"
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 #include <list>
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
42 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
43
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
44 class coment_list;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
45 class interpreter;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
46 class tree_arg_validation;
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
47
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
48 class tree_superclass_ref : public tree_expression
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
49 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
50 public:
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
51
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
52 tree_superclass_ref (const std::string& meth, const std::string& cls, const token& tok)
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
53 : m_method_name (meth), m_class_name (cls), m_token (tok)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
54 { }
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
55
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
56 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_superclass_ref)
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
57
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
58 ~tree_superclass_ref () = default;
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
59
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
60 filepos beg_pos () const { return m_token.beg_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
61 filepos end_pos () const { return m_token.end_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
62
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
63 std::string method_name () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
64 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
65 return m_method_name;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
66 }
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
67
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
68 std::string class_name () const { return m_class_name; }
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 27189
diff changeset
69
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
70 tree_superclass_ref * dup (symbol_scope& scope) const;
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 27189
diff changeset
71
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
72 octave_value evaluate (tree_evaluator& tw, int nargout = 1)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
73 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
74 octave_value_list retval = evaluate_n (tw, nargout);
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
75
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
76 return retval.length () > 0 ? retval(0) : octave_value ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
77 }
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
78
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
79 octave_value_list evaluate_n (tree_evaluator& tw, int nargout = 1);
26718
9b0335f4bc74 revise naming of the parts of a superclass reference
John W. Eaton <jwe@octave.org>
parents: 26686
diff changeset
80
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
81 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
82 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
83 tw.visit_superclass_ref (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
84 }
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
85
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
86 private:
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
87
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
88 // The name of the method to call. This is the text before the
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
89 // "@" and may be of the form "object.method".
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
90 std::string m_method_name;
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
91
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
92 // The name of the superclass. This is the text after the "@"
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
93 // and may be of the form "object.method".
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
94 std::string m_class_name;
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
95
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
96 token m_token;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
97 };
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
98
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
99 class tree_metaclass_query : public tree_expression
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
100 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
101 public:
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
102
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
103 tree_metaclass_query (const std::string& cls, const token& tok)
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
104 : m_class_name (cls), m_token (tok)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
105 { }
27371
fcaecdbc8d8a don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents: 27189
diff changeset
106
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
107 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_metaclass_query)
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
108
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
109 ~tree_metaclass_query () = default;
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
110
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
111 filepos beg_pos () const { return m_token.beg_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
112 filepos end_pos () const { return m_token.end_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
113
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
114 std::string class_name () const { return m_class_name; }
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
115
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
116 tree_metaclass_query * dup (symbol_scope& scope) const;
26686
581d01526b34 eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
117
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
118 octave_value evaluate (tree_evaluator&, int nargout = 1);
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
120 octave_value_list evaluate_n (tree_evaluator& tw, int nargout = 1)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
121 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
122 return ovl (evaluate (tw, nargout));
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
123 }
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
124
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
125 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
126 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
127 tw.visit_metaclass_query (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
128 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
130 private:
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
131
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
132 std::string m_class_name;
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
133
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
134 token m_token;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
135 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
137 class tree_classdef_attribute
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
138 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
139 public:
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
140
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
141 tree_classdef_attribute (tree_identifier *i)
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
142 : m_id (i)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
143 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
144
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
145 tree_classdef_attribute (tree_identifier *i, const token eq_tok, tree_expression *e)
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
146 : m_id (i), m_eq_tok (eq_tok), m_expr (e)
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
147 { }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
148
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
149 tree_classdef_attribute (const token& not_tok, tree_identifier *i, bool b)
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
150 : m_not_tok (not_tok), m_id (i), m_neg (b)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
151 { }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
152
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
153 OCTAVE_DISABLE_COPY_MOVE (tree_classdef_attribute)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
154
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
155 ~tree_classdef_attribute ()
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
156 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
157 delete m_id;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
158 delete m_expr;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
159 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
160
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
161 filepos beg_pos () const { return m_not_tok ? m_not_tok.beg_pos () : m_id->beg_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
162 filepos end_pos () const { return m_expr ? m_expr->end_pos () : m_id->end_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
163
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
164 tree_identifier * ident () { return m_id; }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
166 tree_expression * expression () { return m_expr; }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
167
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
168 bool negate () { return m_neg; }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
170 void accept (tree_walker& tw)
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
171 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
172 tw.visit_classdef_attribute (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
173 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
174
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
175 private:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
177 token m_not_tok;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
178 tree_identifier *m_id;
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
179 token m_eq_tok;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
180 tree_expression *m_expr {nullptr};
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
181 bool m_neg {false};
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
182 };
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
183
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
184 class tree_classdef_attribute_list : public std::list<tree_classdef_attribute *>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
185 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
186 public:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
187
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
188 tree_classdef_attribute_list () { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
189
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
190 tree_classdef_attribute_list (tree_classdef_attribute *a) { push_back (a); }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
191
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
192 tree_classdef_attribute_list (const std::list<tree_classdef_attribute *>& a)
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
193 : std::list<tree_classdef_attribute *> (a)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
194 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
195
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
196 OCTAVE_DISABLE_COPY_MOVE (tree_classdef_attribute_list)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
197
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
198 ~tree_classdef_attribute_list ();
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
199
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
200 tree_classdef_attribute_list * mark_in_delims (const token& open_delim, token& close_delim)
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
201 {
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
202 m_delims.push (open_delim, close_delim);
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
203 return this;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
204 }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
205
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
206 void accept (tree_walker& tw)
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
207 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
208 tw.visit_classdef_attribute_list (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
209 }
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
210
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
211 private:
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
212
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
213 tree_delimiter_list m_delims;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
214 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
215
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
216 class tree_classdef_superclass
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
217 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
218 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
219
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
220 tree_classdef_superclass (const token& fqident)
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
221 : m_fqident (fqident)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
222 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
224 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_classdef_superclass)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
225
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
226 ~tree_classdef_superclass () = default;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
228 void set_separator (const token& sep_tok) { m_sep_tok = sep_tok; }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
229
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
230 std::string class_name () { return m_fqident.text (); }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
232 void accept (tree_walker& tw)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
234 tw.visit_classdef_superclass (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
235 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
236
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
237 private:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
238
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
239 // The '<' or '&&' token introducing an element of a superclass list
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
240 // element. Is there a better name for it?
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
241
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
242 token m_sep_tok;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
243
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
244 // The fully-qualified identifier token for this superclass element.
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
245 token m_fqident;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
246 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
247
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
248 class tree_classdef_superclass_list
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
249 : public std::list<tree_classdef_superclass *>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
250 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
251 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
252
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
253 tree_classdef_superclass_list () { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
254
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
255 tree_classdef_superclass_list (tree_classdef_superclass *sc)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
256 {
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
257 push_back (sc);
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
258 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
259
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
260 tree_classdef_superclass_list (const std::list<tree_classdef_superclass *>& a)
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
261 : std::list<tree_classdef_superclass *> (a)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
262 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
263
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
264 OCTAVE_DISABLE_COPY_MOVE (tree_classdef_superclass_list)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
265
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
266 ~tree_classdef_superclass_list ();
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
267
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
268 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
269 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
270 tw.visit_classdef_superclass_list (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
271 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
272 };
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18520
diff changeset
273
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
274 class tree_base_classdef_block : public tree
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
275 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
276 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
277
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
278 tree_base_classdef_block (const token& block_tok, tree_classdef_attribute_list *a, const token& end_tok)
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
279 : m_block_tok (block_tok), m_attr_list (a), m_end_tok (end_tok)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
280 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
281
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
282 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_base_classdef_block)
28511
59dfd9ed72a3 capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
283
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
284 ~tree_base_classdef_block ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
285 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
286 delete m_attr_list;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
287 }
28511
59dfd9ed72a3 capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
288
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
289 comment_list leading_comments () const { return m_block_tok.leading_comments (); }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
290
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
291 tree_classdef_attribute_list * attribute_list () { return m_attr_list; }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
292
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
293 void accept (tree_walker&) { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
294
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
295 protected:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
296
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
297 token m_block_tok;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
298
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
299 // List of attributes that apply to this class.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
300 tree_classdef_attribute_list *m_attr_list;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
301
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
302 token m_end_tok;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
303 };
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
304
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
305 template <typename T>
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
306 class tree_classdef_block : public tree_base_classdef_block
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
307 {
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
308 public:
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
309
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
310 tree_classdef_block (const token& block_tok, tree_classdef_attribute_list *a, T *elt_list, const token& end_tok)
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
311 : tree_base_classdef_block (block_tok, a, end_tok), m_elt_list (elt_list)
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
312 { }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
313
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
314 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_classdef_block)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
315
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
316 ~tree_classdef_block ()
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
317 {
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
318 delete m_elt_list;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
319 }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
320
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
321 filepos beg_pos () const { return m_block_tok.beg_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
322 filepos end_pos () const { return m_end_tok.end_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
323
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
324 T * element_list () { return m_elt_list; }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
325
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
326 private:
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
327
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
328 T *m_elt_list;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
329 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
330
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
331 // FIXME: should this class be derived from tree?
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
332
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
333 class tree_classdef_property
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
334 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
335 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
336
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
337 tree_classdef_property (tree_arg_validation *av);
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
338
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
339 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_classdef_property)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
340
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
341 ~tree_classdef_property ();
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
342
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
343 comment_list leading_comments ();
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
344
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
345 void doc_string (const std::string& s) { m_doc_string = s; }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
346
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
347 std::string doc_string () const { return m_doc_string; }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
348
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
349 bool have_doc_string () const { return ! m_doc_string.empty (); }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
350
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
351 tree_identifier * ident ();
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
352
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
353 tree_expression * expression ();
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
354
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
355 void accept (tree_walker& tw)
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
356 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
357 tw.visit_classdef_property (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
358 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
359
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
360 private:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
361
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
362 tree_arg_validation *m_av;
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
363
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
364 std::string m_doc_string;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
365 };
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
366
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
367 class tree_classdef_property_list : public std::list<tree_classdef_property *>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
368 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
369 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
370
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
371 tree_classdef_property_list () { }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
372
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
373 tree_classdef_property_list (tree_classdef_property *p) { push_back (p); }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
374
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
375 tree_classdef_property_list (const std::list<tree_classdef_property *>& a)
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
376 : std::list<tree_classdef_property *> (a) { }
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
377
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
378 OCTAVE_DISABLE_COPY_MOVE (tree_classdef_property_list)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
379
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
380 ~tree_classdef_property_list ();
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
381
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
382 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
383 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
384 tw.visit_classdef_property_list (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
385 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
386 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
387
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
388 class tree_classdef_properties_block : public tree_classdef_block<tree_classdef_property_list>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
389 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
390 public:
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
391
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
392 tree_classdef_properties_block (const token& block_tok, tree_classdef_attribute_list *a, tree_classdef_property_list *plist, const token& end_tok)
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
393 : tree_classdef_block<tree_classdef_property_list> (block_tok, a, plist, end_tok)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
394 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
395
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
396 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_classdef_properties_block)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
397
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
398 ~tree_classdef_properties_block () = default;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
399
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
400 tree_classdef_property_list * property_list () { return element_list (); }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
401
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
402 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
403 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
404 tw.visit_classdef_properties_block (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
405 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
406 };
28511
59dfd9ed72a3 capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
407
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
408 class tree_classdef_method_list : public std::list<octave_value>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
409 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
410 public:
28511
59dfd9ed72a3 capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
411
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
412 tree_classdef_method_list () { }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
413
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
414 tree_classdef_method_list (const octave_value& f) { push_back (f); }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
415
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
416 tree_classdef_method_list (const std::list<octave_value>& a)
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
417 : std::list<octave_value> (a) { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
418
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
419 OCTAVE_DISABLE_COPY_MOVE (tree_classdef_method_list)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
420
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
421 ~tree_classdef_method_list () = default;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
422
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
423 void accept (tree_walker& tw)
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
424 {
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
425 tw.visit_classdef_method_list (*this);
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
426 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
427 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
428
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
429 class tree_classdef_methods_block : public tree_classdef_block<tree_classdef_method_list>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
430 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
431 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
432
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
433 tree_classdef_methods_block (const token& block_tok, tree_classdef_attribute_list *a, tree_classdef_method_list *mlist, const token& end_tok)
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
434 : tree_classdef_block<tree_classdef_method_list> (block_tok, a, mlist, end_tok)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
435 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
436
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
437 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_classdef_methods_block)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
438
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
439 ~tree_classdef_methods_block () = default;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
440
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
441 tree_classdef_method_list * method_list () { return element_list (); }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
442
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
443 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
444 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
445 tw.visit_classdef_methods_block (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
446 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
447 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
448
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
449 class tree_classdef_event
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
450 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
451 public:
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
452
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
453 tree_classdef_event (tree_identifier *i = nullptr);
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
454
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
455 OCTAVE_DISABLE_COPY_MOVE (tree_classdef_event)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
456
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
457 ~tree_classdef_event ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
458 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
459 delete m_id;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
460 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
461
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
462 tree_identifier * ident () { return m_id; }
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
463
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
464 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
465 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
466 tw.visit_classdef_event (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
467 }
28511
59dfd9ed72a3 capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
468
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
469 private:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
470
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
471 tree_identifier *m_id;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
472 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
473
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
474 class tree_classdef_event_list : public std::list<tree_classdef_event *>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
475 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
476 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
477
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
478 tree_classdef_event_list () { }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
479
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
480 tree_classdef_event_list (tree_classdef_event *e) { push_back (e); }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
481
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
482 tree_classdef_event_list (const std::list<tree_classdef_event *>& a)
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
483 : std::list<tree_classdef_event *> (a)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
484 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
485
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
486 OCTAVE_DISABLE_COPY_MOVE (tree_classdef_event_list)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
487
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
488 ~tree_classdef_event_list ();
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
489
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
490 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
491 {
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
492 tw.visit_classdef_event_list (*this);
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
493 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
494 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
495
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
496 class tree_classdef_events_block : public tree_classdef_block<tree_classdef_event_list>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
497 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
498 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
499
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
500 tree_classdef_events_block (const token& block_tok, tree_classdef_attribute_list *a, tree_classdef_event_list *elist, const token& end_tok)
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
501 : tree_classdef_block<tree_classdef_event_list> (block_tok, a, elist, end_tok)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
502 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
503
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
504 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_classdef_events_block)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
505
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
506 ~tree_classdef_events_block () = default;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
507
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
508 tree_classdef_event_list * event_list () { return element_list (); }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
509
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
510 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
511 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
512 tw.visit_classdef_events_block (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
513 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
514 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
515
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
516 class tree_classdef_enum
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
517 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
518 public:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
519
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
520 tree_classdef_enum (tree_identifier *i, const token& open_paren, tree_expression *e, const token& close_paren);
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
521
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
522 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_classdef_enum)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
523
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
524 ~tree_classdef_enum ()
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
525 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
526 delete m_id;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
527 delete m_expr;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
528 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
529
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
530 tree_identifier * ident () { return m_id; }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
531
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
532 token open_paren () const { return m_open_paren; }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
533
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
534 tree_expression * expression () { return m_expr; }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
535
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
536 token close_paren () const { return m_close_paren; }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
537
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
538 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
539 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
540 tw.visit_classdef_enum (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
541 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
542
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
543 private:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
544
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
545 tree_identifier *m_id;
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
546 token m_open_paren;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
547 tree_expression *m_expr;
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
548 token m_close_paren;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
549 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
550
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
551 class tree_classdef_enum_list : public std::list<tree_classdef_enum *>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
552 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
553 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
554
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
555 tree_classdef_enum_list () { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
556
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
557 tree_classdef_enum_list (tree_classdef_enum *e) { push_back (e); }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
558
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
559 tree_classdef_enum_list (const std::list<tree_classdef_enum *>& a)
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
560 : std::list<tree_classdef_enum *> (a)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
561 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
562
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
563 OCTAVE_DISABLE_COPY_MOVE (tree_classdef_enum_list)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
564
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
565 ~tree_classdef_enum_list ();
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
566
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
567 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
568 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
569 tw.visit_classdef_enum_list (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
570 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
571 };
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
572
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
573 class tree_classdef_enum_block : public tree_classdef_block<tree_classdef_enum_list>
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
574 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
575 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
576
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
577 tree_classdef_enum_block (const token& block_tok, tree_classdef_attribute_list *a, tree_classdef_enum_list *elist, const token& end_tok)
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
578 : tree_classdef_block<tree_classdef_enum_list> (block_tok, a, elist, end_tok)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
579 { }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
580
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
581 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_classdef_enum_block)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
582
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
583 ~tree_classdef_enum_block () = default;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
584
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
585 tree_classdef_enum_list * enum_list () { return element_list (); }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
586
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
587 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
588 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
589 tw.visit_classdef_enum_block (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
590 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
591 };
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
592
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
593 // FIXME: should this class be derived from tree?
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
594
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
595 class tree_classdef_body
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
596 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
597 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
598
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
599 typedef std::list<tree_classdef_properties_block *>::iterator property_list_iterator;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
600 typedef std::list<tree_classdef_properties_block *>::const_iterator property_list_const_iterator;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
601
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
602 typedef std::list<tree_classdef_methods_block *>::iterator method_list_iterator;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
603 typedef std::list<tree_classdef_methods_block *>::const_iterator method_list_const_iterator;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
604
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
605 typedef std::list<tree_classdef_events_block *>::iterator event_list_iterator;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
606 typedef std::list<tree_classdef_events_block *>::const_iterator event_list_const_iterator;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
608 typedef std::list<tree_classdef_enum_block *>::iterator enum_list_iterator;
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
609 typedef std::list<tree_classdef_enum_block *>::const_iterator enum_list_const_iterator;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
610
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
611 tree_classdef_body ();
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
612
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
613 tree_classdef_body (tree_classdef_properties_block *pb);
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
614
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
615 tree_classdef_body (tree_classdef_methods_block *mb);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
616
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
617 tree_classdef_body (tree_classdef_events_block *evb);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
618
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
619 tree_classdef_body (tree_classdef_enum_block *enb);
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
620
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
621 OCTAVE_DISABLE_COPY_MOVE (tree_classdef_body)
28511
59dfd9ed72a3 capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
622
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
623 ~tree_classdef_body ();
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
624
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
625 comment_list leading_comments () const;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
626
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
627 tree_classdef_body * append (tree_classdef_properties_block *pb)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
628 {
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
629 m_property_lst.push_back (pb);
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
630 m_all_elements.push_back (pb);
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
631 return this;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
632 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
633
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
634 tree_classdef_body * append (tree_classdef_methods_block *mb)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
635 {
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
636 m_method_lst.push_back (mb);
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
637 m_all_elements.push_back (mb);
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
638 return this;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
639 }
28511
59dfd9ed72a3 capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
640
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
641 tree_classdef_body * append (tree_classdef_events_block *evb)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
642 {
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
643 m_event_lst.push_back (evb);
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
644 m_all_elements.push_back (evb);
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
645 return this;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
646 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
647
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
648 tree_classdef_body * append (tree_classdef_enum_block *enb)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
649 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
650 m_enum_lst.push_back (enb);
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
651 m_all_elements.push_back (enb);
32936
0b5f3219b650 eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents: 32892
diff changeset
652 return this;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
653 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
654
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
655 std::list<tree_classdef_properties_block *> property_list ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
656 {
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
657 return m_property_lst;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
658 }
28511
59dfd9ed72a3 capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
659
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
660 std::list<tree_classdef_methods_block *> method_list ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
661 {
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
662 return m_method_lst;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
663 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
664
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
665 std::list<tree_classdef_events_block *> event_list ()
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
666 {
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
667 return m_event_lst;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
668 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
669
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
670 std::list<tree_classdef_enum_block *> enum_list ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
671 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
672 return m_enum_lst;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
673 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
674
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
675 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
676 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
677 tw.visit_classdef_body (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
678 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
679
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
680 private:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
681
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
682 std::list<tree_classdef_properties_block *> m_property_lst;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
683
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
684 std::list<tree_classdef_methods_block *> m_method_lst;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
685
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
686 std::list<tree_classdef_events_block *> m_event_lst;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
687
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
688 std::list<tree_classdef_enum_block *> m_enum_lst;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
689
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
690 std::list<tree_base_classdef_block *> m_all_elements;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
691 };
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
692
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
693 // Classdef definition.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
694
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
695 class tree_classdef : public tree_command
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
696 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
697 public:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
698
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
699 tree_classdef (const symbol_scope& scope, const token& cdef_tok, tree_classdef_attribute_list *a, tree_identifier *i, tree_classdef_superclass_list *sc, tree_classdef_body *b, const token& end_tok, const std::string& pn = "", const std::string& fn = "")
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
700 : m_scope (scope), m_cdef_tok (cdef_tok), m_attr_list (a), m_id (i), m_supclass_list (sc), m_body (b), m_end_tok (end_tok), m_pack_name (pn), m_file_name (fn)
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
701 {
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
702 cache_doc_string ();
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
703 }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
704
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
705 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_classdef)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
706
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
707 ~tree_classdef ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
708 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
709 delete m_attr_list;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
710 delete m_id;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
711 delete m_supclass_list;
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
712 delete m_body;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
713 }
30259
03ff3f1020cf store file name in classdef class object
John W. Eaton <jwe@octave.org>
parents: 29862
diff changeset
714
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
715 filepos beg_pos () const { return m_cdef_tok.beg_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
716 filepos end_pos () const { return m_end_tok.end_pos (); }
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
717
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
718 symbol_scope scope () { return m_scope; }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
719
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
720 tree_classdef_attribute_list *
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
721 attribute_list () { return m_attr_list; }
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
722
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
723 tree_identifier * ident () { return m_id; }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
724
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
725 tree_classdef_superclass_list *
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
726 superclass_list () { return m_supclass_list; }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
727
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
728 tree_classdef_body * body () { return m_body; }
28511
59dfd9ed72a3 capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
729
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
730 comment_list leading_comments () const { return m_cdef_tok.leading_comments (); }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
731
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
732 std::string package_name () const { return m_pack_name; }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
733
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
734 std::string file_name () const { return m_file_name; }
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
735
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
736 octave_value make_meta_class (interpreter& interp,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
737 bool is_at_folder = false);
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
738
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
739 std::string doc_string () const { return m_doc_string; }
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
740
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
741 void accept (tree_walker& tw)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
742 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
743 tw.visit_classdef (*this);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
744 }
27189
946c6f117091 use dummy stack frame when creating meta class (bug #55766 and #55768)
John W. Eaton <jwe@octave.org>
parents: 26718
diff changeset
745
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
746 private:
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
747
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
748 void cache_doc_string ()
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
749 {
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
750 // First non-copyright comments found above and below classdef
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
751 // keyword are candidates for the documentation string. Use the
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
752 // first one that is not empty.
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
753
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
754 comment_list comments = m_cdef_tok.leading_comments ();
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
755
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
756 m_doc_string = comments.find_doc_string ();
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
757
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
758 if (m_doc_string.empty ())
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
759 {
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
760 comments = m_body->leading_comments ();
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
761
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
762 m_doc_string = comments.find_doc_string ();
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
763 }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
764 }
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
765
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
766 // The scope that was used when parsing the classdef object and that
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
767 // corresponds to any identifiers that were found in attribute lists
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
768 // (for example). Used again when computing the meta class object.
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
769
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
770 symbol_scope m_scope;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
771
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
772 token m_cdef_tok;
32892
80d3a6abfc4d improve capture of classdef and classdef method doc strings
John W. Eaton <jwe@octave.org>
parents: 32632
diff changeset
773
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
774 tree_classdef_attribute_list *m_attr_list;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
775
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
776 tree_identifier *m_id;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
777
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
778 tree_classdef_superclass_list *m_supclass_list;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
779
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
780 tree_classdef_body *m_body;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
781
33296
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
782 token m_end_tok;
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
783
70b7f1c285c7 refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents: 32936
diff changeset
784 std::string m_doc_string;
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
785
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
786 std::string m_pack_name;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
787 std::string m_file_name;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
788 };
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
789
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
790 OCTAVE_END_NAMESPACE(octave)
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
791
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff changeset
792 #endif
33309
d422992b5483 refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents: 33296
diff changeset
793