ruff/crates/ruff_python_parser/src
Dhruv Manilawala 6a64f2289b
Rename Magic* to IpyEscape* (#6395)
## Summary

This PR renames the `MagicCommand` token to `IpyEscapeCommand` token and
`MagicKind` to `IpyEscapeKind` type to better reflect the purpose of the
token and type. Similarly, it renames the AST nodes from `LineMagic` to
`IpyEscapeCommand` prefixed with `Stmt`/`Expr` wherever necessary.

It also makes renames from using `jupyter_magic` to
`ipython_escape_commands` in various function names.

The mode value is still `Mode::Jupyter` because the escape commands are
part of the IPython syntax but the lexing/parsing is done for a Jupyter
notebook.

### Motivation behind the rename:
* IPython codebase defines it as "EscapeCommand" / "Escape Sequences":
* Escape Sequences:
292e3a2345/IPython/core/inputtransformer2.py (L329-L333)
* Escape command:
292e3a2345/IPython/core/inputtransformer2.py (L410-L411)
* The word "magic" is used mainly for the actual magic commands i.e.,
the ones starting with `%`/`%%`
(https://ipython.readthedocs.io/en/stable/interactive/reference.html#magic-command-system).
So, this avoids any confusion between the Magic token (`%`, `%%`) and
the escape command itself.
## Test Plan

* `cargo test` to make sure all renames are done correctly.
* `grep` for `jupyter_escape`/`magic` to make sure all renames are done
correctly.
2023-08-09 13:28:18 +00:00
..
lexer Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
snapshots Rename Magic* to IpyEscape* (#6395) 2023-08-09 13:28:18 +00:00
context.rs Remove Parse trait (#6235) 2023-08-01 18:35:03 +02:00
function.rs Introduce an Arguments AST node for function calls and class definitions (#6259) 2023-08-02 10:01:13 -04:00
lexer.rs Rename Magic* to IpyEscape* (#6395) 2023-08-09 13:28:18 +00:00
lib.rs Use Jupyter mode while parsing Notebook files (#5552) 2023-08-05 00:32:07 +00:00
parser.rs Rename Magic* to IpyEscape* (#6395) 2023-08-09 13:28:18 +00:00
python.lalrpop Rename Magic* to IpyEscape* (#6395) 2023-08-09 13:28:18 +00:00
python.rs Rename Magic* to IpyEscape* (#6395) 2023-08-09 13:28:18 +00:00
soft_keywords.rs Replace .map_or(false, $closure) with .is_some_and(closure) (#6244) 2023-08-01 19:29:42 +02:00
string.rs Rename JoinedStr to FString in the AST (#6379) 2023-08-07 17:33:17 +00:00
token.rs Rename Magic* to IpyEscape* (#6395) 2023-08-09 13:28:18 +00:00
typing.rs Replace .map_or(false, $closure) with .is_some_and(closure) (#6244) 2023-08-01 19:29:42 +02:00