ruff/crates/ruff_python_parser/src
Dhruv Manilawala bfc17fecaa
Raise syntax error when \ is at end of file (#17409)
## Summary

This PR fixes a bug in the lexer specifically around line continuation
character at end of file.

The reason this was occurring is because the lexer wouldn't check for
EOL _after_ consuming the escaped newline but only if the EOL was right
after the line continuation character.

fixes: #17398 

## Test Plan

Add tests for the scenarios where this should occur mainly (a) when the
state is `AfterNewline` and (b) when the state is `Other`.
2025-04-15 21:26:12 +05:30
..
lexer Mention that Cursor is based on rustc's implementation. (#12109) 2024-06-30 16:53:25 +01:00
parser [syntax-errors] Invalid syntax in annotations (#17101) 2025-04-03 17:56:55 -04:00
snapshots Raise syntax error when \ is at end of file (#17409) 2025-04-15 21:26:12 +05:30
error.rs [red-knot] Add 'Format document' to playground (#17217) 2025-04-07 09:26:03 +02:00
lexer.rs Raise syntax error when \ is at end of file (#17409) 2025-04-15 21:26:12 +05:30
lib.rs [red-knot] Add basic on-hover to playground and LSP (#17057) 2025-04-04 08:13:43 +02:00
semantic_errors.rs [syntax-errors] await outside async functions (#17363) 2025-04-14 13:01:48 -04:00
string.rs Upgrade to Rust 1.81 (#13265) 2024-09-06 15:09:09 +02:00
token.rs [syntax-errors] PEP 701 f-strings before Python 3.12 (#16543) 2025-03-18 11:12:15 -04:00
token_set.rs Replace LALRPOP parser with hand-written parser (#10036) 2024-04-18 17:57:39 +05:30
token_source.rs [syntax-errors] PEP 701 f-strings before Python 3.12 (#16543) 2025-03-18 11:12:15 -04:00
typing.rs Rename ExprStringLiteral::as_unconcatenated_string() to ExprStringLiteral::as_single_part_string() (#16253) 2025-02-19 16:06:57 +00:00