ruff/crates/ruff_python_trivia/src
David Peter 9a33924a65
[red-knot] Hand-written MDTest parser (#15926)
## Summary

Replaces our existing Markdown test parser with a fully hand-written
parser. I tried to fix this bug using the old approach and kept running
into problems. Eventually this seemed like the easier way. It's more
code (+50 lines, excluding the new test), but I hope it's relatively
straightforward to understand, compared to the complex interplay between
the byte-stream-manipulation and regex-parsing that we had before.

I did not really focus on performance, as the parsing time does not
dominate the test execution time, but this seems to be slightly faster
than what we had before (executing all MD tests; debug):

| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| this branch | 2.775 ± 0.072 | 2.690 | 2.877 | 1.00 |
| `main` | 2.921 ± 0.034 | 2.865 | 2.967 | 1.05 ± 0.03 |

closes #15923

## Test Plan

One new regression test.
2025-02-04 14:01:53 +01:00
..
comment_ranges.rs Extract LineIndex independent methods from Locator (#13938) 2024-10-28 07:53:41 +00:00
comments.rs Implement RUF028 to detect useless formatter suppression comments (#9899) 2024-02-28 19:21:06 +00:00
cursor.rs [red-knot] Hand-written MDTest parser (#15926) 2025-02-04 14:01:53 +01:00
lib.rs Implement RUF028 to detect useless formatter suppression comments (#9899) 2024-02-28 19:21:06 +00:00
pragmas.rs Extend pragma comment cases (#7687) 2023-09-28 18:55:19 +00:00
textwrap.rs Update dedent_to to support blocks that are composed of comments (#13572) 2024-10-01 04:38:03 +00:00
tokenizer.rs [pylint] Preserve original value format (PLR6104) (#14978) 2024-12-17 16:07:07 +01:00
whitespace.rs Extract LineIndex independent methods from Locator (#13938) 2024-10-28 07:53:41 +00:00