Lex a single IPython escape command.
(&mut self)
| 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. |
no test coverage detected