mirror of
https://github.com/github/codeql.git
synced 2026-05-14 19:29:28 +02:00
Python: Support unpacking in comprehensions in tree-sitter-python
This is the easy part -- we just allow `dictionary_splat` or `list_splat` to appear in the same place as the expression.
This commit is contained in:
@@ -1031,28 +1031,28 @@ module.exports = grammar({
|
||||
|
||||
list_comprehension: $ => seq(
|
||||
'[',
|
||||
field('body', $.expression),
|
||||
field('body', choice($.expression, $.list_splat)),
|
||||
$._comprehension_clauses,
|
||||
']'
|
||||
),
|
||||
|
||||
dictionary_comprehension: $ => seq(
|
||||
'{',
|
||||
field('body', $.pair),
|
||||
field('body', choice($.pair, $.dictionary_splat)),
|
||||
$._comprehension_clauses,
|
||||
'}'
|
||||
),
|
||||
|
||||
set_comprehension: $ => seq(
|
||||
'{',
|
||||
field('body', $.expression),
|
||||
field('body', choice($.expression, $.list_splat)),
|
||||
$._comprehension_clauses,
|
||||
'}'
|
||||
),
|
||||
|
||||
generator_expression: $ => seq(
|
||||
'(',
|
||||
field('body', $.expression),
|
||||
field('body', choice($.expression, $.list_splat)),
|
||||
$._comprehension_clauses,
|
||||
')'
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user