mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-17 18:06:02 +08:00
Refactor a bit for Python 2.
This commit is contained in:
@@ -39,38 +39,3 @@ except:
|
||||
pass
|
||||
except ZeroDivisionError:
|
||||
pass
|
||||
|
||||
|
||||
def c():
|
||||
a = 3
|
||||
|
||||
def d():
|
||||
class X():
|
||||
nonlocal a
|
||||
|
||||
|
||||
def x():
|
||||
a = 3
|
||||
|
||||
def y():
|
||||
nonlocal a
|
||||
|
||||
|
||||
def x():
|
||||
def y():
|
||||
nonlocal a
|
||||
|
||||
a = 3
|
||||
|
||||
|
||||
def x():
|
||||
a = 3
|
||||
|
||||
def y():
|
||||
class z():
|
||||
nonlocal a
|
||||
|
||||
|
||||
a = *args, *args
|
||||
error[(*args, *args)] = 3
|
||||
*args, *args
|
||||
|
||||
@@ -8,3 +8,38 @@ foo[3]: int
|
||||
def glob():
|
||||
global x
|
||||
y: foo = x
|
||||
|
||||
|
||||
def c():
|
||||
a = 3
|
||||
|
||||
def d():
|
||||
class X():
|
||||
nonlocal a
|
||||
|
||||
|
||||
def x():
|
||||
a = 3
|
||||
|
||||
def y():
|
||||
nonlocal a
|
||||
|
||||
|
||||
def x():
|
||||
def y():
|
||||
nonlocal a
|
||||
|
||||
a = 3
|
||||
|
||||
|
||||
def x():
|
||||
a = 3
|
||||
|
||||
def y():
|
||||
class z():
|
||||
nonlocal a
|
||||
|
||||
|
||||
a = *args, *args
|
||||
error[(*args, *args)] = 3
|
||||
*args, *args
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Testing if parso finds syntax errors and indentation errors.
|
||||
"""
|
||||
@@ -218,8 +219,9 @@ if sys.version_info >= (3, 4):
|
||||
|
||||
|
||||
def _get_error_list(code, version=None):
|
||||
tree = parso.parse(code, version=version)
|
||||
config = ErrorFinderConfig()
|
||||
grammar = parso.load_grammar(version=version)
|
||||
tree = grammar.parse(code)
|
||||
config = ErrorFinderConfig(grammar=grammar)
|
||||
return list(tree._get_normalizer_issues(config))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user