rustpython-ruff_python_parser 0.15.8

Unofficial fork for RustPython
Documentation
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/double_star_comprehension.py
---
## AST

```
Module(
    ModModule {
        node_index: NodeIndex(None),
        range: 0..358,
        body: [
            Expr(
                StmtExpr {
                    node_index: NodeIndex(None),
                    range: 122..147,
                    value: Dict(
                        ExprDict {
                            node_index: NodeIndex(None),
                            range: 122..147,
                            items: [
                                DictItem {
                                    key: None,
                                    value: Name(
                                        ExprName {
                                            node_index: NodeIndex(None),
                                            range: 125..126,
                                            id: Name("x"),
                                            ctx: Load,
                                        },
                                    ),
                                },
                                DictItem {
                                    key: Some(
                                        Name(
                                            ExprName {
                                                node_index: NodeIndex(None),
                                                range: 128..129,
                                                id: Name("y"),
                                                ctx: Load,
                                            },
                                        ),
                                    ),
                                    value: Name(
                                        ExprName {
                                            node_index: NodeIndex(None),
                                            range: 130..133,
                                            id: Name("for"),
                                            ctx: Load,
                                        },
                                    ),
                                },
                                DictItem {
                                    key: Some(
                                        Name(
                                            ExprName {
                                                node_index: NodeIndex(None),
                                                range: 134..135,
                                                id: Name("x"),
                                                ctx: Load,
                                            },
                                        ),
                                    ),
                                    value: Name(
                                        ExprName {
                                            node_index: NodeIndex(None),
                                            range: 135..135,
                                            id: Name(""),
                                            ctx: Invalid,
                                        },
                                    ),
                                },
                                DictItem {
                                    key: Some(
                                        Compare(
                                            ExprCompare {
                                                node_index: NodeIndex(None),
                                                range: 137..146,
                                                left: Name(
                                                    ExprName {
                                                        node_index: NodeIndex(None),
                                                        range: 137..138,
                                                        id: Name("y"),
                                                        ctx: Load,
                                                    },
                                                ),
                                                ops: [
                                                    In,
                                                ],
                                                comparators: [
                                                    Name(
                                                        ExprName {
                                                            node_index: NodeIndex(None),
                                                            range: 142..146,
                                                            id: Name("data"),
                                                            ctx: Load,
                                                        },
                                                    ),
                                                ],
                                            },
                                        ),
                                    ),
                                    value: Name(
                                        ExprName {
                                            node_index: NodeIndex(None),
                                            range: 146..146,
                                            id: Name(""),
                                            ctx: Invalid,
                                        },
                                    ),
                                },
                            ],
                        },
                    ),
                },
            ),
        ],
    },
)
```
## Errors

  |
2 | # it's actually a comprehension.
3 |
4 | {**x: y for x, y in data}
  |     ^ Syntax Error: Expected an expression or a '}'
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
  |


  |
2 | # it's actually a comprehension.
3 |
4 | {**x: y for x, y in data}
  |         ^^^ Syntax Error: Expected `:`, found `for`
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
  |


  |
2 | # it's actually a comprehension.
3 |
4 | {**x: y for x, y in data}
  |             ^ Syntax Error: Expected `,`, found name
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
  |


  |
2 | # it's actually a comprehension.
3 |
4 | {**x: y for x, y in data}
  |              ^ Syntax Error: Expected `:`, found `,`
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
  |


  |
2 | # it's actually a comprehension.
3 |
4 | {**x: y for x, y in data}
  |                         ^ Syntax Error: Expected `:`, found `}`
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
  |