mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-03 13:14:34 +00:00
## Summary This PR refactors unary expression parsing with the following changes: * Ability to get `OperatorPrecedence` from a unary operator (`UnaryOp`) * Implement methods on `TokenKind` * Add `as_unary_operator` which returns an `Option<UnaryOp>` * Add `as_unary_arithmetic_operator` which returns an `Option<UnaryOp>` (used for pattern parsing) * Rename `is_unary` to `is_unary_arithmetic_operator` (used in the linter) resolves: #10752 ## Test Plan Verify that the existing test cases pass, no ecosystem changes, run the Python based fuzzer on 3000 random inputs and run it on dozens of open-source repositories. |
||
|---|---|---|
| .. | ||
| lexer | ||
| parser | ||
| snapshots | ||
| error.rs | ||
| lexer.rs | ||
| lib.rs | ||
| soft_keywords.rs | ||
| string.rs | ||
| token.rs | ||
| token_set.rs | ||
| token_source.rs | ||
| typing.rs | ||