---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/unterminated_fstring_newline_recovery.py
---
## AST

```
Module(
    ModModule {
        range: 0..67,
        body: [
            Expr(
                StmtExpr {
                    range: 0..7,
                    value: FString(
                        ExprFString {
                            range: 0..7,
                            value: FStringValue {
                                inner: Single(
                                    FString(
                                        FString {
                                            range: 0..7,
                                            elements: [],
                                            flags: FStringFlags {
                                                quote_style: Double,
                                                prefix: Regular,
                                                triple_quoted: false,
                                            },
                                        },
                                    ),
                                ),
                            },
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 8..13,
                    value: BinOp(
                        ExprBinOp {
                            range: 8..13,
                            left: NumberLiteral(
                                ExprNumberLiteral {
                                    range: 8..9,
                                    value: Int(
                                        1,
                                    ),
                                },
                            ),
                            op: Add,
                            right: NumberLiteral(
                                ExprNumberLiteral {
                                    range: 12..13,
                                    value: Int(
                                        1,
                                    ),
                                },
                            ),
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 14..24,
                    value: FString(
                        ExprFString {
                            range: 14..24,
                            value: FStringValue {
                                inner: Single(
                                    FString(
                                        FString {
                                            range: 14..24,
                                            elements: [
                                                Literal(
                                                    FStringLiteralElement {
                                                        range: 16..22,
                                                        value: "hello ",
                                                    },
                                                ),
                                                Expression(
                                                    FStringExpressionElement {
                                                        range: 22..24,
                                                        expression: Name(
                                                            ExprName {
                                                                range: 23..24,
                                                                id: "x",
                                                                ctx: Load,
                                                            },
                                                        ),
                                                        debug_text: None,
                                                        conversion: None,
                                                        format_spec: None,
                                                    },
                                                ),
                                            ],
                                            flags: FStringFlags {
                                                quote_style: Double,
                                                prefix: Regular,
                                                triple_quoted: false,
                                            },
                                        },
                                    ),
                                ),
                            },
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 25..30,
                    value: BinOp(
                        ExprBinOp {
                            range: 25..30,
                            left: NumberLiteral(
                                ExprNumberLiteral {
                                    range: 25..26,
                                    value: Int(
                                        2,
                                    ),
                                },
                            ),
                            op: Add,
                            right: NumberLiteral(
                                ExprNumberLiteral {
                                    range: 29..30,
                                    value: Int(
                                        2,
                                    ),
                                },
                            ),
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 31..42,
                    value: FString(
                        ExprFString {
                            range: 31..42,
                            value: FStringValue {
                                inner: Single(
                                    FString(
                                        FString {
                                            range: 31..42,
                                            elements: [
                                                Literal(
                                                    FStringLiteralElement {
                                                        range: 33..39,
                                                        value: "hello ",
                                                    },
                                                ),
                                                Expression(
                                                    FStringExpressionElement {
                                                        range: 39..42,
                                                        expression: Name(
                                                            ExprName {
                                                                range: 40..41,
                                                                id: "x",
                                                                ctx: Load,
                                                            },
                                                        ),
                                                        debug_text: None,
                                                        conversion: None,
                                                        format_spec: Some(
                                                            FStringFormatSpec {
                                                                range: 43..43,
                                                                elements: [],
                                                            },
                                                        ),
                                                    },
                                                ),
                                            ],
                                            flags: FStringFlags {
                                                quote_style: Double,
                                                prefix: Regular,
                                                triple_quoted: false,
                                            },
                                        },
                                    ),
                                ),
                            },
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 43..48,
                    value: BinOp(
                        ExprBinOp {
                            range: 43..48,
                            left: NumberLiteral(
                                ExprNumberLiteral {
                                    range: 43..44,
                                    value: Int(
                                        3,
                                    ),
                                },
                            ),
                            op: Add,
                            right: NumberLiteral(
                                ExprNumberLiteral {
                                    range: 47..48,
                                    value: Int(
                                        3,
                                    ),
                                },
                            ),
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 49..60,
                    value: FString(
                        ExprFString {
                            range: 49..60,
                            value: FStringValue {
                                inner: Single(
                                    FString(
                                        FString {
                                            range: 49..60,
                                            elements: [
                                                Literal(
                                                    FStringLiteralElement {
                                                        range: 51..57,
                                                        value: "hello ",
                                                    },
                                                ),
                                                Expression(
                                                    FStringExpressionElement {
                                                        range: 57..60,
                                                        expression: Name(
                                                            ExprName {
                                                                range: 58..59,
                                                                id: "x",
                                                                ctx: Load,
                                                            },
                                                        ),
                                                        debug_text: None,
                                                        conversion: None,
                                                        format_spec: None,
                                                    },
                                                ),
                                            ],
                                            flags: FStringFlags {
                                                quote_style: Double,
                                                prefix: Regular,
                                                triple_quoted: false,
                                            },
                                        },
                                    ),
                                ),
                            },
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 61..66,
                    value: BinOp(
                        ExprBinOp {
                            range: 61..66,
                            left: NumberLiteral(
                                ExprNumberLiteral {
                                    range: 61..62,
                                    value: Int(
                                        4,
                                    ),
                                },
                            ),
                            op: Add,
                            right: NumberLiteral(
                                ExprNumberLiteral {
                                    range: 65..66,
                                    value: Int(
                                        4,
                                    ),
                                },
                            ),
                        },
                    ),
                },
            ),
        ],
    },
)
```
## Errors

  |
1 | f"hello
  |   ^^^^^ Syntax Error: f-string: unterminated string
2 | 1 + 1
3 | f"hello {x
  |


  |
1 | f"hello
  |        ^ Syntax Error: Expected FStringEnd, found newline
2 | 1 + 1
3 | f"hello {x
4 | 2 + 2
  |


  |
2 | 1 + 1
3 | f"hello {x
4 | 2 + 2
  | ^ Syntax Error: f-string: expecting '}'
5 | f"hello {x:
6 | 3 + 3
  |


  |
3 | f"hello {x
4 | 2 + 2
5 | f"hello {x:
  | ^^ Syntax Error: Simple statements must be separated by newlines or semicolons
6 | 3 + 3
7 | f"hello {x}
  |


  |
4 | 2 + 2
5 | f"hello {x:
6 | 3 + 3
  | ^ Syntax Error: Expected an f-string element or the end of the f-string
7 | f"hello {x}
8 | 4 + 4
  |


  |
5 | f"hello {x:
6 | 3 + 3
7 | f"hello {x}
  | ^^ Syntax Error: Simple statements must be separated by newlines or semicolons
8 | 4 + 4
  |


  |
5 | f"hello {x:
6 | 3 + 3
7 | f"hello {x}
  |             Syntax Error: f-string: unterminated string
8 | 4 + 4
  |


  |
6 | 3 + 3
7 | f"hello {x}
8 | 4 + 4
  | ^ Syntax Error: Expected an f-string element or the end of the f-string
  |


  |
7 | f"hello {x}
8 | 4 + 4
  |


  |
7 | f"hello {x}
8 | 4 + 4
  |


  |
7 | f"hello {x}
8 | 4 + 4
  |
