File tree Expand file tree Collapse file tree
coalib/bearlib/languages/documentation
tests/bearlib/languages/documentation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,6 +131,11 @@ def _parse_documentation_with_symbols(self,
131131 # splitted contains the whole line from the param's name,
132132 # which in turn is further divided into its name and desc.
133133 splitted = line [param_offset :].split (param_identifiers [1 ], 1 )
134+ # parser breaks if param_identifiers[1] is not present.
135+ # This checks for space and then splits the line accordingly
136+ # to extract param's name and desc.
137+ if len (splitted ) == 1 :
138+ splitted = line [param_offset :].split (' ' , 1 )
134139 cur_param = splitted [0 ].strip ()
135140
136141 param_desc = splitted [1 ]
@@ -143,6 +148,11 @@ def _parse_documentation_with_symbols(self,
143148 exception_identifiers [0 ]) + len (exception_identifiers [0 ])
144149 splitted = line [exception_offset :].split (
145150 exception_identifiers [1 ], 1 )
151+ # parser breaks if exception_identifiers[1] is not present.
152+ # This checks for space and then splits the line accordingly
153+ # to extract exception's name and desc.
154+ if len (splitted ) == 1 :
155+ splitted = line [exception_offset :].split (' ' , 1 )
146156 cur_exception = splitted [0 ].strip ()
147157
148158 exception_desc = splitted [1 ]
Original file line number Diff line number Diff line change @@ -214,6 +214,17 @@ def test_python_doxygen(self):
214214
215215 self .assertEqual (parsed_docs , expected )
216216
217+ def test_python_missing_ending_colon (self ):
218+ doc = (' This is a malformed docstring\n '
219+ ' :param abc test description1\n '
220+ ' :raises xyz test description2\n ' )
221+ expected = [self .Description (desc = ' This is a malformed docstring\n ' ),
222+ self .Parameter (name = 'abc' ,
223+ desc = ' test description1\n ' ),
224+ self .ExceptionValue (name = 'xyz' ,
225+ desc = ' test description2\n ' )]
226+ self .check_docstring (doc , expected )
227+
217228
218229class JavaDocumentationCommentTest (DocumentationCommentTest ):
219230
You can’t perform that action at this time.
0 commit comments