MCPcopy Create free account
hub / github.com/astral-sh/ruff / lex_ipython_escape_command

Method lex_ipython_escape_command

crates/ruff_python_parser/src/lexer.rs:1118–1134  ·  view source on GitHub ↗

Lex a single IPython escape command.

(&mut self)

Source from the content-addressed store, hash-verified

1116
1117 /// Lex a single IPython escape command.
1118 fn lex_ipython_escape_command(&mut self) -> TokenKind {
1119 loop {
1120 match self.cursor.first() {
1121 '\\' => {
1122 // Consume an escaped newline so it doesn't terminate the command. A normal
1123 // backslash is consumed by itself and remains part of the token range.
1124 self.cursor.bump();
1125 self.cursor.eat_char('\r');
1126 self.cursor.eat_char('\n');
1127 }
1128 '\n' | '\r' | EOF_CHAR => return TokenKind::IpyEscapeCommand,
1129 _ => {
1130 self.cursor.bump();
1131 }
1132 }
1133 }
1134 }
1135
1136 fn consume_end(&mut self) -> TokenKind {
1137 // We reached end of file.

Callers 1

Calls 3

firstMethod · 0.45
bumpMethod · 0.45
eat_charMethod · 0.45

Tested by

no test coverage detected