ruff/crates/ruff_python_parser/src/parser
Brent Westbrook 764aa0e6a1
Allow passing ParseOptions to inline tests (#16357)
## Summary

This PR adds support for a pragma-style header for inline parser tests
containing JSON-serialized `ParseOptions`. For example,

```python
# parse_options: { "target-version": "3.9" }
match 2:
    case 1:
        pass
```

The line must start with `# parse_options: ` and then the rest of the
(trimmed) line is deserialized into `ParseOptions` used for parsing the
the test.

## Test Plan

Existing inline tests, plus two new inline tests for
`match-before-py310`.

---------

Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2025-02-27 10:23:15 -05:00
..
snapshots Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
expression.rs Pass ParserOptions to the parser (#16220) 2025-02-19 10:50:50 -05:00
helpers.rs Refactor binary expression parsing (#11073) 2024-04-23 04:42:40 +00:00
mod.rs Start detecting version-related syntax errors in the parser (#16090) 2025-02-25 23:03:48 -05:00
options.rs Start detecting version-related syntax errors in the parser (#16090) 2025-02-25 23:03:48 -05:00
pattern.rs Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
progress.rs
recovery.rs Use CompactString for Identifier (#12101) 2024-07-01 10:06:02 +02:00
statement.rs Allow passing ParseOptions to inline tests (#16357) 2025-02-27 10:23:15 -05:00
tests.rs Pass ParserOptions to the parser (#16220) 2025-02-19 10:50:50 -05:00