-
-
Notifications
You must be signed in to change notification settings - Fork 169
Open
Labels
Description
Did you check existing issues?
- I have read all the tree-sitter docs if it relates to using the parser
- I have searched the existing issues of tree-sitter-python
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version
)
No response
Describe the bug
Hi,
I am using tree sitter to parse some code and I found something that seems weird with this piece of code:
class SequenceProcessor:
def __init__(self, indices):
self.indices = indices
self._segslices = [*map(slice, indices[:-1], indices[1:])]
def process_sequence(self, sequence):
return [sequence[slice_obj] for slice_obj in self._segslices]
What I am finding strange is the result of self._segslices = [*map(slice, indices[:-1], indices[1:])] and especially *map(slice, indices[:-1], indices[1:]).
In that case, we end up with a call having as function a list_splat of map.
But I have the impression that this is wrong. We should have instead a list_splat wrapping a call having an identifier map as a function instead.
Steps To Reproduce/Bad Parse Tree
Parse:
class SequenceProcessor:
def __init__(self, indices):
self.indices = indices
self._segslices = [*map(slice, indices[:-1], indices[1:])]
def process_sequence(self, sequence):
return [sequence[slice_obj] for slice_obj in self._segslices]
Expected Behavior/Parse Tree
I expect a list_splat wrapping a call for *map(slice, indices[:-1], indices[1:])
but I get a function with a list_splat as function.
Repro
[*map(slice, indices[:-1], indices[1:])]