Skip to content

Commit 9ffba43

Browse files
author
whitequark
committedMay 10, 2015
Doc fixes.
1 parent 5688d04 commit 9ffba43

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎pyparser/__init__.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys, pyparser.source, pyparser.lexer, pyparser.parser, pyparser.diagnostic
33

44
def parse(source, filename='<unknown>', mode='exec',
5-
flags=[], version=None, engine=pyparser.diagnostic.Engine()):
5+
flags=[], version=None, engine=None):
66
"""
77
Parse a string into an abstract syntax tree.
88
This is the replacement for the built-in :meth:`..ast.parse`.
@@ -18,14 +18,18 @@ def parse(source, filename='<unknown>', mode='exec',
1818
Equivalent to ``from __future__ import <flags>``.
1919
:param version: (2-tuple of int) Major and minor version of Python
2020
syntax to recognize, ``sys.version_info[0:2]`` by default.
21-
:param engine: :class:`diagnostic.Engine` Diagnostic engine
22-
:return: (:class:`ast.AST`) abstract syntax tree
21+
:param engine: (:class:`diagnostic.Engine`) Diagnostic engine,
22+
a fresh one is created by default
23+
:return: (:class:`ast.AST`) Abstract syntax tree
2324
:raise: :class:`diagnostic.Error`
2425
if the source code is not well-formed
2526
"""
2627
if version is None:
2728
version = sys.version_info[0:2]
2829

30+
if engine is None:
31+
engine = pyparser.diagnostic.Engine()
32+
2933
buffer = pyparser.source.Buffer(source, filename)
3034

3135
lexer = pyparser.lexer.Lexer(buffer, version, engine)

0 commit comments

Comments
 (0)
Please sign in to comment.