* replaced docstr-string with TokenDocstring object

This commit is contained in:
Jean-Louis Fuchs
2013-12-13 01:22:56 +01:00
parent 53e4962711
commit d687fa4df6
6 changed files with 80 additions and 24 deletions

View File

@@ -395,7 +395,9 @@ class Parser(object):
and first_tok.token_type == tokenize.STRING:
# Normal docstring check
if self.freshscope and not self.no_docstr:
self._scope.add_docstr(first_tok.token)
self._scope.add_docstr(
token_pr.TokenDocstring(first_tok)
)
return None, tok
# Attribute docstring (PEP 224) support (sphinx uses it, e.g.)
@@ -403,7 +405,9 @@ class Parser(object):
elif first_tok.token_type == tokenize.STRING:
with common.ignored(IndexError, AttributeError):
# ...then set it as a docstring
self._scope.statements[-1].add_docstr(first_tok.token)
self._scope.statements[-1].add_docstr(
token_pr.TokenDocstring(first_tok)
)
return None, tok
stmt = stmt_class(self.module, tok_list, first_pos, self.end_pos,