mirror of
https://github.com/davidhalter/parso.git
synced 2026-04-14 03:39:49 +08:00
Self test on parsos files to check if there's no syntax errors.
This commit is contained in:
@@ -430,7 +430,7 @@ class ErrorFinder(Normalizer):
|
||||
self._add_syntax_error(message % p.name.value, p.name)
|
||||
param_names.add(p.name.value)
|
||||
|
||||
if p.default is None:
|
||||
if p.default is None and not p.star_count:
|
||||
if default_only:
|
||||
# def f(x=3, y): pass
|
||||
message = "non-default argument follows default argument"
|
||||
@@ -510,6 +510,9 @@ class ErrorFinder(Normalizer):
|
||||
|
||||
yield
|
||||
|
||||
if node.type == 'suite':
|
||||
self._indentation_count -= 1
|
||||
|
||||
def visit_leaf(self, leaf):
|
||||
if leaf.type == 'error_leaf':
|
||||
if leaf.original_type in ('indent', 'error_dedent'):
|
||||
@@ -597,7 +600,7 @@ class ErrorFinder(Normalizer):
|
||||
elif leaf.value == 'break':
|
||||
in_loop = False
|
||||
for block in self._context.blocks:
|
||||
if block.type == 'for_stmt':
|
||||
if block.type in ('for_stmt', 'while_stmt'):
|
||||
in_loop = True
|
||||
if not in_loop:
|
||||
self._add_syntax_error("'break' outside loop", leaf)
|
||||
|
||||
Reference in New Issue
Block a user