Mercurial > octave
annotate libinterp/parse-tree/pt-classdef.cc @ 28511:59dfd9ed72a3 stable
capture comments for classdef classes, properties, events, and enumerations
* parse.h, oct-parse.yy: Refactor parser rules for collecting comments
and docstrings for classdef parse tree elements.
* pt-classdef.h, pt-classdef.cc
(tree_classdef_property, tree_classdef_event, tree_classdef_enum):
Store comments and docstrings and provide access to them.
(tree_classdef_body): Store docstring for classdef object.
(tree_classdef): Provide access to classdef docstring from classdef
body object.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 28 May 2020 13:48:37 -0400 |
parents | bd51beb6205e |
children | 0a5b15007766 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 // Copyright (C) 2012-2020 The Octave Project Developers |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
27 # include "config.h" |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #endif |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
28511
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
30 #include <iostream> |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
31 |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
32 #include "ov.h" |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include "ov-classdef.h" |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 #include "pt-classdef.h" |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
35 #include "pt-eval.h" |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
37 namespace octave |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 { |
26686
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
39 tree_superclass_ref * |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
40 tree_superclass_ref::dup (symbol_scope&) const |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
41 { |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
42 tree_superclass_ref *new_scr |
26718
9b0335f4bc74
revise naming of the parts of a superclass reference
John W. Eaton <jwe@octave.org>
parents:
26686
diff
changeset
|
43 = new tree_superclass_ref (m_method_name, m_class_name, |
26686
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
44 line (), column ()); |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
45 |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
46 new_scr->copy_base (*this); |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
47 |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
48 return new_scr; |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
49 } |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
50 |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
51 octave_value_list |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
52 tree_superclass_ref::evaluate_n (tree_evaluator& tw, int nargout) |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
53 { |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
54 octave_value tmp |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
55 = octave_classdef::superclass_ref (m_method_name, m_class_name); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
56 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
57 if (! is_postfix_indexed ()) |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
58 { |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
59 // There was no index, so this superclass_ref object is not |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
60 // part of an index expression. It is also not an identifier in |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
61 // the syntax tree but we need to handle it as if it were. So |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
62 // call the function here. |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
63 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
64 octave_function *f = tmp.function_value (true); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
65 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
66 assert (f); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
67 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
68 return f->call (tw, nargout); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
69 } |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
70 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
71 // The superclass_ref function object will be indexed as part of the |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
72 // enclosing index expression. |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
73 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
74 return ovl (tmp); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
75 } |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
76 |
26686
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
77 tree_metaclass_query * |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
78 tree_metaclass_query::dup (symbol_scope&) const |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
79 { |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
80 tree_metaclass_query *new_mcq |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
81 = new tree_metaclass_query (m_class_name, line (), column ()); |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
82 |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
83 new_mcq->copy_base (*this); |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
84 |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
85 return new_mcq; |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
86 } |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
87 |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
88 octave_value |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
89 tree_metaclass_query::evaluate (tree_evaluator&, int) |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
90 { |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
91 return octave_classdef::metaclass_query (m_class_name); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
92 } |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
93 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
94 // Classdef attribute |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
95 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
96 // Classdef attribute_list |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
97 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
98 tree_classdef_attribute_list::~tree_classdef_attribute_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
99 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
100 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
101 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
102 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
103 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
104 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
105 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
106 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
107 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
108 // Classdef superclass |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
109 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
110 // Classdef superclass_list |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
111 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
112 tree_classdef_superclass_list::~tree_classdef_superclass_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
113 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
114 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
115 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
116 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
117 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
118 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
119 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
120 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
121 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
122 // Classdef property |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 |
28511
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
124 std::string check_for_doc_string (comment_list *comments) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
125 { |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
126 // If the comment list ends in a block comment or full-line comment, |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
127 // then it is the doc string for this property. |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
128 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
129 if (comments) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
130 { |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
131 comment_elt last_elt = comments->back (); |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
132 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
133 if (last_elt.is_block () || last_elt.is_full_line ()) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
134 return last_elt.text (); |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
135 } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
136 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
137 return ""; |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
138 } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
139 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
140 tree_classdef_property::tree_classdef_property (tree_identifier *i, |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
141 comment_list *comments) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
142 : m_id (i), m_expr (nullptr), m_comments (comments), |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
143 m_doc_string (check_for_doc_string (m_comments)) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
144 { } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
145 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
146 tree_classdef_property::tree_classdef_property (tree_identifier *i, |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
147 tree_expression *e, |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
148 comment_list *comments) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
149 : m_id (i), m_expr (e), m_comments (comments), |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
150 m_doc_string (check_for_doc_string (m_comments)) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
151 { } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
152 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
153 // Classdef property_list |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
154 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
155 tree_classdef_property_list::~tree_classdef_property_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
156 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
157 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
158 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
159 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
160 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
161 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
162 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
163 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
164 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
165 // Classdef properties_block |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
166 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
167 // Classdef methods_list |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
168 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
169 // Classdef methods_block |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
170 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
171 // Classdef event |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
172 |
28511
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
173 tree_classdef_event::tree_classdef_event (tree_identifier *i, |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
174 comment_list *comments) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
175 : m_id (i), m_comments (comments), |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
176 m_doc_string (check_for_doc_string (m_comments)) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
177 { } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
178 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
179 // Classdef events_list |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
180 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
181 tree_classdef_events_list::~tree_classdef_events_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
182 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
183 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
184 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
185 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
186 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
187 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
188 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
189 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
190 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
191 // Classdef events_block |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
192 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
193 // Classdef enum |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
194 |
28511
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
195 tree_classdef_enum::tree_classdef_enum (tree_identifier *i, |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
196 tree_expression *e, |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
197 comment_list *comments) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
198 : m_id (i), m_expr (e), m_comments (comments), |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
199 m_doc_string (check_for_doc_string (m_comments)) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
200 { } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
201 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
202 // Classdef enum_list |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
203 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
204 tree_classdef_enum_list::~tree_classdef_enum_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
205 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
206 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
207 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
208 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
209 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
210 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
211 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
212 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
213 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
214 // Classdef enum_block |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
215 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
216 // Classdef body |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
217 |
28511
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
218 tree_classdef_body::tree_classdef_body (void) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
219 : m_properties_lst (), m_methods_lst (), m_events_lst (), m_enum_lst () |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
220 { } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
221 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
222 tree_classdef_body::tree_classdef_body (tree_classdef_properties_block *pb) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
223 : m_properties_lst (), m_methods_lst (), m_events_lst (), m_enum_lst (), |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
224 m_doc_string (pb ? get_doc_string (pb->leading_comment ()) : "") |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
225 { |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
226 append (pb); |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
227 } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
228 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
229 tree_classdef_body::tree_classdef_body (tree_classdef_methods_block *mb) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
230 : m_properties_lst (), m_methods_lst (), m_events_lst (), m_enum_lst (), |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
231 m_doc_string (mb ? get_doc_string (mb->leading_comment ()) : "") |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
232 { |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
233 append (mb); |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
234 } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
235 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
236 tree_classdef_body::tree_classdef_body (tree_classdef_events_block *evb) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
237 : m_properties_lst (), m_methods_lst (), m_events_lst (), m_enum_lst (), |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
238 m_doc_string (evb ? get_doc_string (evb->leading_comment ()) : "") |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
239 { |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
240 append (evb); |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
241 } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
242 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
243 tree_classdef_body::tree_classdef_body (tree_classdef_enum_block *enb) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
244 : m_properties_lst (), m_methods_lst (), m_events_lst (), m_enum_lst (), |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
245 m_doc_string (enb ? get_doc_string (enb->leading_comment ()) : "") |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
246 { |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
247 append (enb); |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
248 } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
249 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
250 tree_classdef_body::~tree_classdef_body (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
251 { |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
252 while (! m_properties_lst.empty ()) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
253 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
254 auto p = m_properties_lst.begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
255 delete *p; |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
256 m_properties_lst.erase (p); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
257 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
258 |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
259 while (! m_methods_lst.empty ()) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
260 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
261 auto p = m_methods_lst.begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
262 delete *p; |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
263 m_methods_lst.erase (p); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
264 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
265 |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
266 while (! m_events_lst.empty ()) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
267 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
268 auto p = m_events_lst.begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
269 delete *p; |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
270 m_events_lst.erase (p); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
271 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
272 |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
273 while (! m_enum_lst.empty ()) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
274 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
275 auto p = m_enum_lst.begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
276 delete *p; |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
277 m_enum_lst.erase (p); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
278 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
279 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
280 |
28511
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
281 std::string |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
282 tree_classdef_body::get_doc_string (comment_list *comments) const |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
283 { |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
284 // Grab the first comment from the list and use it as the doc string |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
285 // for this classdef body. |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
286 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
287 if (comments) |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
288 { |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
289 comment_elt first_elt = comments->front (); |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
290 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
291 return first_elt.text (); |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
292 } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
293 |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
294 return ""; |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
295 } |
59dfd9ed72a3
capture comments for classdef classes, properties, events, and enumerations
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
296 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
297 // Classdef |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
298 |
27505
c409d16b7190
eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents:
27371
diff
changeset
|
299 octave_value |
23533
8edbc923a7dc
begin refactoring use of interpreter/evaluator in classdef objects
John W. Eaton <jwe@octave.org>
parents:
23435
diff
changeset
|
300 tree_classdef::make_meta_class (interpreter& interp, bool is_at_folder) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
301 { |
23533
8edbc923a7dc
begin refactoring use of interpreter/evaluator in classdef objects
John W. Eaton <jwe@octave.org>
parents:
23435
diff
changeset
|
302 cdef_class cls = cdef_class::make_meta_class (interp, this, is_at_folder); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
303 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
304 if (cls.ok ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
305 return cls.get_constructor_function (); |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
306 |
27505
c409d16b7190
eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents:
27371
diff
changeset
|
307 return octave_value (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
308 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
309 } |