@@ -100,72 +100,15 @@ def extract_result_types(comment):
100
100
comment = m .group (1 )
101
101
102
102
103
- def find_next_closing_rbrace (
104
- data : str , start_pos : int , braces_to_be_matched : int
105
- ) -> int :
106
- """Finds the location of the closing rbrace '}' inside of data."""
107
- """'start_pos' should be one past the opening lbrace and braces_to_be_matched is initialized with 0"""
108
- next_lbrace = data .find ("{" , start_pos )
109
- next_rbrace = data .find ("}" , start_pos )
110
- if next_lbrace != - 1 :
111
- if next_lbrace < next_rbrace :
112
- return find_next_closing_rbrace (
113
- data , next_lbrace + 1 , braces_to_be_matched + 1
114
- )
115
- if braces_to_be_matched == 0 :
116
- return next_rbrace
117
- return find_next_closing_rbrace (data , next_rbrace + 1 , braces_to_be_matched - 1 )
118
-
119
- if braces_to_be_matched > 0 :
120
- return find_next_closing_rbrace (data , next_rbrace + 1 , braces_to_be_matched - 1 )
121
-
122
- return next_rbrace
123
-
124
-
125
103
def strip_doxygen (comment ):
126
104
"""Returns the given comment without \-escaped words."""
105
+ # If there is only a doxygen keyword in the line, delete the whole line.
106
+ comment = re .sub (r"^\\[^\s]+\n" , r"" , comment , flags = re .M )
107
+
127
108
# If there is a doxygen \see command, change the \see prefix into "See also:".
128
109
# FIXME: it would be better to turn this into a link to the target instead.
129
110
comment = re .sub (r"\\see" , r"See also:" , comment )
130
111
131
- commands : list [str ] = [
132
- "\\ compile_args{" ,
133
- "\\ matcher{" ,
134
- "\\ match{" ,
135
- "\\ nomatch{" ,
136
- ]
137
-
138
- for command in commands :
139
- delete_command = command == "\\ compile_args{"
140
- command_begin_loc = comment .find (command )
141
- while command_begin_loc != - 1 :
142
- command_end_loc = command_begin_loc + len (command )
143
- end_brace_loc = find_next_closing_rbrace (comment , command_end_loc + 1 , 0 )
144
- if end_brace_loc == - 1 :
145
- print ("found unmatched {" )
146
- command_begin_loc = comment .find (command , command_end_loc )
147
- continue
148
-
149
- if delete_command :
150
- comment = comment [0 :command_begin_loc ] + comment [end_brace_loc + 1 :]
151
- command_begin_loc = comment .find (command , command_begin_loc )
152
- continue
153
-
154
- tag_seperator_loc = comment .find ("$" , command_end_loc )
155
- if tag_seperator_loc != - 1 and tag_seperator_loc < end_brace_loc :
156
- command_end_loc = tag_seperator_loc + 1
157
-
158
- comment = (
159
- comment [0 :command_begin_loc ]
160
- + comment [command_end_loc :end_brace_loc ]
161
- + comment [end_brace_loc + 1 :]
162
- )
163
-
164
- command_begin_loc = comment .find (command , command_begin_loc )
165
-
166
- # If there is only a doxygen keyword in the line, delete the whole line.
167
- comment = re .sub (r"^\\[^\s]+\n" , r"" , comment , flags = re .M )
168
-
169
112
# Delete the doxygen command and the following whitespace.
170
113
comment = re .sub (r"\\[^\s]+\s+" , r"" , comment )
171
114
return comment
@@ -248,9 +191,8 @@ def act_on_decl(declaration, comment, allowed_types):
248
191
definition.
249
192
"""
250
193
if declaration .strip ():
251
- if re .match (
252
- r"^\s?(#|namespace|using|template <typename NodeType> using|})" , declaration
253
- ):
194
+
195
+ if re .match (r"^\s?(#|namespace|using|template <typename NodeType> using|})" , declaration ):
254
196
return
255
197
256
198
# Node matchers are defined by writing:
0 commit comments