ruff/crates/ruff_python_parser/src
Brent Westbrook b5e5271adf
Preserve triple quotes and prefixes for strings (#15818)
## Summary

This is a follow-up to #15726, #15778, and #15794 to preserve the triple
quote and prefix flags in plain strings, bytestrings, and f-strings.

I also added a `StringLiteralFlags::without_triple_quotes` method to
avoid passing along triple quotes in rules like SIM905 where it might
not make sense, as discussed
[here](https://github.com/astral-sh/ruff/pull/15726#discussion_r1930532426).

## Test Plan

Existing tests, plus many new cases in the `generator::tests::quote`
test that should cover all combinations of quotes and prefixes, at least
for simple string bodies.

Closes #7799 when combined with #15694, #15726, #15778, and #15794.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-02-04 08:41:06 -05:00
..
lexer Mention that Cursor is based on rustc's implementation. (#12109) 2024-06-30 16:53:25 +01:00
parser Parse triple quoted string annotations as if parenthesized (#15387) 2025-01-16 11:38:15 +05:30
snapshots Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
error.rs Raise syntax error for unparenthesized generator expr in multi-argument call (#12445) 2024-07-22 14:44:20 +05:30
lexer.rs Parse triple quoted string annotations as if parenthesized (#15387) 2025-01-16 11:38:15 +05:30
lib.rs Preserve quote style in generated code (#15726) 2025-01-27 13:41:03 -05:00
string.rs Upgrade to Rust 1.81 (#13265) 2024-09-06 15:09:09 +02:00
token.rs Preserve triple quotes and prefixes for strings (#15818) 2025-02-04 08:41:06 -05:00
token_set.rs Replace LALRPOP parser with hand-written parser (#10036) 2024-04-18 17:57:39 +05:30
token_source.rs Use TokenSource to find new location for re-lexing (#12060) 2024-06-27 17:12:39 +05:30
typing.rs Parse triple quoted string annotations as if parenthesized (#15387) 2025-01-16 11:38:15 +05:30