Support SLICE opcodes
This commit is contained in:
BIN
tests/compiled/binary_slice.3.12.pyc
Normal file
BIN
tests/compiled/binary_slice.3.12.pyc
Normal file
Binary file not shown.
BIN
tests/compiled/store_slice.3.12.pyc
Normal file
BIN
tests/compiled/store_slice.3.12.pyc
Normal file
Binary file not shown.
7
tests/input/binary_slice.py
Normal file
7
tests/input/binary_slice.py
Normal file
@@ -0,0 +1,7 @@
|
||||
l = [1,2,3,4,5,6]
|
||||
print(l[1:3])
|
||||
print(l[:2])
|
||||
print(l[3:])
|
||||
print(l[-4:])
|
||||
print(l[:-2])
|
||||
print(l[:])
|
8
tests/input/store_slice.py
Normal file
8
tests/input/store_slice.py
Normal file
@@ -0,0 +1,8 @@
|
||||
a = [0] * 16
|
||||
l = [1,2,3]
|
||||
a[13:] = l
|
||||
a[5] = 10
|
||||
a[:2] = [1,2]
|
||||
a[:] = range(16)
|
||||
|
||||
print(a)
|
7
tests/tokenized/binary_slice.txt
Normal file
7
tests/tokenized/binary_slice.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
l = [ 1 , 2 , 3 , 4 , 5 , 6 ] <EOL>
|
||||
print ( l [ 1 : 3 ] ) <EOL>
|
||||
print ( l [ : 2 ] ) <EOL>
|
||||
print ( l [ 3 : ] ) <EOL>
|
||||
print ( l [ - 4 : ] ) <EOL>
|
||||
print ( l [ : - 2 ] ) <EOL>
|
||||
print ( l [ : ] ) <EOL>
|
7
tests/tokenized/store_slice.txt
Normal file
7
tests/tokenized/store_slice.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
a = [ 0 ] * 16 <EOL>
|
||||
l = [ 1 , 2 , 3 ] <EOL>
|
||||
a [ 13 : ] = l <EOL>
|
||||
a [ 5 ] = 10 <EOL>
|
||||
a [ : 2 ] = [ 1 , 2 ] <EOL>
|
||||
a [ : ] = range ( 16 ) <EOL>
|
||||
print ( a ) <EOL>
|
Reference in New Issue
Block a user