mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-15 00:47:11 +08:00
More general overhaul of the documentation.
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user