More general overhaul of the documentation.

This commit is contained in:
Dave Halter
2017-09-03 22:19:48 +02:00
parent 8aa280342a
commit 435d310c2b
2 changed files with 8 additions and 3 deletions

View File

@@ -40,10 +40,9 @@ issues in it:
Utility Utility
------- -------
There are some utility functions that |parso| also offers some utility functions that can be really useful:
.. autofunction:: parso.parse .. autofunction:: parso.parse
.. autofunction:: parso.split_lines .. autofunction:: parso.split_lines
.. autofunction:: parso.python_bytes_to_unicode .. autofunction:: parso.python_bytes_to_unicode

View File

@@ -67,7 +67,8 @@ class Grammar(object):
directory. If not given, defaults to the default cache places on directory. If not given, defaults to the default cache places on
each platform. each platform.
:return: A subclass of :py:class:`parso.tree.Node`. Typically a module. :return: A subclass of :py:class:`parso.tree.NodeOrLeaf`. Typically a
:py:class:`parso.python.tree.Module`.
""" """
if 'start_pos' in kwargs: if 'start_pos' in kwargs:
raise TypeError("parse() got an unexpected keyworda argument.") raise TypeError("parse() got an unexpected keyworda argument.")
@@ -155,6 +156,11 @@ class Grammar(object):
return ns return ns
def iter_errors(self, node): def iter_errors(self, node):
"""
Given a :py:class:`parso.tree.NodeOrLeaf` returns a generator of
:py:class:`parso.normalizer.Issue` objects. For Python this is
a list of syntax/indentation errors.
"""
if self._error_normalizer_config is None: if self._error_normalizer_config is None:
raise ValueError("No error normalizer specified for this grammar.") raise ValueError("No error normalizer specified for this grammar.")