Skip to content

Commit

Permalink
DocumentationComment.py: Add in-line comment
Browse files Browse the repository at this point in the history
Add subsequent in-line comment to `if-else` block.
  • Loading branch information
damngamerz committed Jun 9, 2017
1 parent fa26911 commit 6abf8a0
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -118,12 +118,16 @@ def _parse_documentation_with_symbols(self,


if stripped_line.startswith(param_identifiers[0]): if stripped_line.startswith(param_identifiers[0]):
parse_mode = self.Parameter parse_mode = self.Parameter
# param_offset contains the starting column of param's name.
param_offset = line.find( param_offset = line.find(
param_identifiers[0]) + len(param_identifiers[0]) param_identifiers[0]) + len(param_identifiers[0])
# splitted contains the whole line from the param's name,
# which in turn is further divided into its name and desc.
splitted = line[param_offset:].split(param_identifiers[1], 1) splitted = line[param_offset:].split(param_identifiers[1], 1)
cur_param = splitted[0].strip() cur_param = splitted[0].strip()


param_desc = splitted[1] param_desc = splitted[1]
# parsed section is added to the final list.
parsed.append(self.Parameter(name=cur_param, desc=param_desc)) parsed.append(self.Parameter(name=cur_param, desc=param_desc))


elif stripped_line.startswith(exception_identifiers[0]): elif stripped_line.startswith(exception_identifiers[0]):
Expand All @@ -145,6 +149,9 @@ def _parse_documentation_with_symbols(self,
retval_desc = line[return_offset:] retval_desc = line[return_offset:]
parsed.append(self.ReturnValue(desc=retval_desc)) parsed.append(self.ReturnValue(desc=retval_desc))


# These conditions will take care if the parsed section
# descriptions are not on the same line as that of it's
# name. Further, adding the parsed section to the final list.
elif parse_mode == self.ReturnValue: elif parse_mode == self.ReturnValue:
retval_desc += line retval_desc += line
parsed.pop() parsed.pop()
Expand Down

0 comments on commit 6abf8a0

Please sign in to comment.