From dea09b096dbceb10cf4034d2b5a2d3bf2362d4d1 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 26 Apr 2017 18:16:50 +0200 Subject: [PATCH] Some docstrings for the parser. --- jedi/parser/python/tree.py | 3 +++ jedi/parser/tree.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jedi/parser/python/tree.py b/jedi/parser/python/tree.py index 360ff002..4e8c2804 100644 --- a/jedi/parser/python/tree.py +++ b/jedi/parser/python/tree.py @@ -47,6 +47,9 @@ class DocstringMixin(object): __slots__ = () def get_doc_node(self): + """ + Returns the string leaf of a docstring. e.g. `r'foo'` + """ if self.type == 'file_input': node = self.children[0] elif isinstance(self, ClassOrFunc): diff --git a/jedi/parser/tree.py b/jedi/parser/tree.py index 28ccfbbf..7a797db4 100644 --- a/jedi/parser/tree.py +++ b/jedi/parser/tree.py @@ -291,7 +291,9 @@ class Node(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__ = () type = 'error_node' @@ -299,7 +301,8 @@ class ErrorNode(BaseNode): 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') type = 'error_leaf'