mirror of
https://github.com/davidhalter/parso.git
synced 2026-05-11 09:08:40 +08:00
The parse shortcut now supports a version argument.
This commit is contained in:
+2
-1
@@ -31,5 +31,6 @@ def parse(code=None, **kwargs):
|
|||||||
A utility function to parse Python with the current Python version. Params
|
A utility function to parse Python with the current Python version. Params
|
||||||
are documented in ``Grammar.parse``.
|
are documented in ``Grammar.parse``.
|
||||||
"""
|
"""
|
||||||
grammar = load_grammar()
|
version = kwargs.pop('version', None)
|
||||||
|
grammar = load_grammar(version=version)
|
||||||
return grammar.parse(code, **kwargs)
|
return grammar.parse(code, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user