Skip to content

Commit 203d199

Browse files
kth496dev-bearabbit
andcommitted
Fix multiline lexer bug
Co-authored-by: Hyeonji-Ryu <cjstk3940@naver.com>
1 parent bed4877 commit 203d199

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Lib/test/test_grammar.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ def test_ellipsis(self):
257257
self.assertTrue(x is Ellipsis)
258258
self.assertRaises(SyntaxError, eval, ".. .")
259259

260-
# TODO: RUSTPYTHON
261-
@unittest.expectedFailure
262260
def test_eof_error(self):
263261
samples = ("def foo(", "\ndef foo(", "def foo(\n")
264262
for s in samples:

parser/src/lexer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ where
568568
} else {
569569
if (c == '\n' && !triple_quoted) || (is_bytes && !c.is_ascii()) {
570570
return Err(LexicalError {
571-
error: LexicalErrorType::StringError,
571+
error: LexicalErrorType::Eof,
572572
location: self.get_pos(),
573573
});
574574
}
@@ -784,7 +784,7 @@ where
784784
// First of all, we need all nestings to be finished.
785785
if self.nesting > 0 {
786786
return Err(LexicalError {
787-
error: LexicalErrorType::NestingError,
787+
error: LexicalErrorType::Eof,
788788
location: tok_pos,
789789
});
790790
}

0 commit comments

Comments
 (0)