mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-23 03:45:14 +00:00
41 lines
928 B
Rust
41 lines
928 B
Rust
// See: https://github.com/python/cpython/blob/9d692841691590c25e6cf5b2250a594d3bf54825/Lib/keyword.py#L18
|
|
pub fn is_keyword(name: &str) -> bool {
|
|
matches!(
|
|
name,
|
|
"False"
|
|
| "None"
|
|
| "True"
|
|
| "and"
|
|
| "as"
|
|
| "assert"
|
|
| "async"
|
|
| "await"
|
|
| "break"
|
|
| "class"
|
|
| "continue"
|
|
| "def"
|
|
| "del"
|
|
| "elif"
|
|
| "else"
|
|
| "except"
|
|
| "finally"
|
|
| "for"
|
|
| "from"
|
|
| "global"
|
|
| "if"
|
|
| "import"
|
|
| "in"
|
|
| "is"
|
|
| "lambda"
|
|
| "nonlocal"
|
|
| "not"
|
|
| "or"
|
|
| "pass"
|
|
| "raise"
|
|
| "return"
|
|
| "try"
|
|
| "while"
|
|
| "with"
|
|
| "yield",
|
|
)
|
|
}
|