Replace LALRPOP parser with hand-written parser
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
committed by
Dhruv Manilawala
parent
461cdad53a
commit
78ee6441a7
@@ -0,0 +1 @@
|
||||
x = {y for y in (1, 2, 3)}
|
||||
@@ -0,0 +1,11 @@
|
||||
lambda: 1
|
||||
|
||||
lambda a, b, c: 1
|
||||
|
||||
lambda a, b=20, c=30: 1
|
||||
|
||||
lambda *, a, b, c: 1
|
||||
|
||||
lambda *, a, b=20, c=30: 1
|
||||
|
||||
lambda a, b, c, *, d, e: 0
|
||||
@@ -0,0 +1 @@
|
||||
x = [y for y in (1, 2, 3)]
|
||||
@@ -0,0 +1,4 @@
|
||||
if x := 1:
|
||||
pass
|
||||
|
||||
(x := 5)
|
||||
@@ -0,0 +1 @@
|
||||
x: int = 1
|
||||
@@ -0,0 +1,40 @@
|
||||
x = (1, 2, 3)
|
||||
|
||||
(x, y) = (1, 2, 3)
|
||||
|
||||
[x, y] = (1, 2, 3)
|
||||
|
||||
x.y = (1, 2, 3)
|
||||
|
||||
x[y] = (1, 2, 3)
|
||||
|
||||
(x, *y) = (1, 2, 3)
|
||||
|
||||
|
||||
# This last group of tests checks that assignments we expect to be parsed
|
||||
# (including some interesting ones) continue to be parsed successfully.
|
||||
|
||||
*foo = 42
|
||||
|
||||
[x, y, z] = [1, 2, 3]
|
||||
|
||||
(x, y, z) = (1, 2, 3)
|
||||
x[0] = 42
|
||||
|
||||
# This is actually a type error, not a syntax error. So check that it
|
||||
# doesn't fail parsing.
|
||||
|
||||
5[0] = 42
|
||||
x[1:2] = [42]
|
||||
|
||||
# This is actually a type error, not a syntax error. So check that it
|
||||
# doesn't fail parsing.
|
||||
5[1:2] = [42]
|
||||
|
||||
foo.bar = 42
|
||||
|
||||
# This is actually an attribute error, not a syntax error. So check that
|
||||
# it doesn't fail parsing.
|
||||
"foo".y = 42
|
||||
|
||||
foo = 42
|
||||
@@ -0,0 +1,3 @@
|
||||
x += 1
|
||||
x.y += (1, 2, 3)
|
||||
x[y] += (1, 2, 3)
|
||||
@@ -0,0 +1,3 @@
|
||||
del x
|
||||
del x.y
|
||||
del x[y]
|
||||
@@ -0,0 +1,2 @@
|
||||
for x in (1, 2, 3):
|
||||
pass
|
||||
@@ -0,0 +1,38 @@
|
||||
def no_parameters():
|
||||
pass
|
||||
|
||||
|
||||
def positional_parameters(a, b, c):
|
||||
pass
|
||||
|
||||
|
||||
def positional_parameters_with_default_values(a, b=20, c=30):
|
||||
pass
|
||||
|
||||
|
||||
def keyword_only_parameters(*, a, b, c):
|
||||
pass
|
||||
|
||||
|
||||
def keyword_only_parameters_with_defaults(*, a, b=20, c=30):
|
||||
pass
|
||||
|
||||
|
||||
def positional_and_keyword_parameters(a, b, c, *, d, e, f):
|
||||
pass
|
||||
|
||||
|
||||
def positional_and_keyword_parameters_with_defaults(a, b, c, *, d, e=20, f=30):
|
||||
pass
|
||||
|
||||
|
||||
def positional_and_keyword_parameters_with_defaults_and_varargs(
|
||||
a, b, c, *args, d, e=20, f=30
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
def positional_and_keyword_parameters_with_defaults_and_varargs_and_kwargs(
|
||||
a, b, c, *args, d, e=20, f=30, **kwargs
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
with 1 as x:
|
||||
pass
|
||||
Reference in New Issue
Block a user