A parso docstring.

This commit is contained in:
Dave Halter
2017-05-23 14:36:45 -04:00
parent 29fa0d27fc
commit 25941bbfb8
3 changed files with 21 additions and 2 deletions

View File

@@ -1,3 +1,22 @@
"""
parso is a Python parser. It's really easy to use and supports multiple Python
versions, file caching, round-trips and other stuff:
>>> from parso import load_python_grammar
>>> grammar = load_python_grammar(version='2.7')
>>> module = grammar.parse('hello + 1')
>>> stmt = module.children[0]
>>> stmt
PythonNode(simple_stmt, [PythonNode(arith_expr, [...]), <Newline: ''>])
>>> stmt.get_code()
'hello + 1'
>>> name = stmt.children[0].children[0]
>>> name
<Name: hello@1,0>
>>> name.end_pos
(1, 5)
"""
from parso.parser import ParserSyntaxError
from parso.grammar import create_grammar, load_python_grammar