1
0
forked from VimPlug/jedi

Some docstrings for the parser.

This commit is contained in:
Dave Halter
2017-04-26 18:16:50 +02:00
parent c124fc91ca
commit dea09b096d
2 changed files with 8 additions and 2 deletions

View File

@@ -47,6 +47,9 @@ class DocstringMixin(object):
__slots__ = () __slots__ = ()
def get_doc_node(self): def get_doc_node(self):
"""
Returns the string leaf of a docstring. e.g. `r'foo'`
"""
if self.type == 'file_input': if self.type == 'file_input':
node = self.children[0] node = self.children[0]
elif isinstance(self, ClassOrFunc): elif isinstance(self, ClassOrFunc):

View File

@@ -291,7 +291,9 @@ class Node(BaseNode):
class ErrorNode(BaseNode): class ErrorNode(BaseNode):
""" """
TODO doc A node that containes valid nodes/leaves that we're follow by a token that
was invalid. This basically means that the leaf after this node is where
Python would mark a syntax error.
""" """
__slots__ = () __slots__ = ()
type = 'error_node' type = 'error_node'
@@ -299,7 +301,8 @@ class ErrorNode(BaseNode):
class ErrorLeaf(Leaf): class ErrorLeaf(Leaf):
""" """
TODO doc A leaf that is either completely invalid in a language (like `$` in Python)
or is invalid at that position. Like the star in `1 +* 1`.
""" """
__slots__ = ('original_type') __slots__ = ('original_type')
type = 'error_leaf' type = 'error_leaf'