Fix multiline lexer bug

Co-authored-by: Hyeonji-Ryu <cjstk3940@naver.com>
This commit is contained in:
kth496andHyeonji-Ryu committed 2022-07-13 17:02:17 +09:00
1 parent bed4877f8d
commit 203d1998e2
2 files changed
+2 -4

No files matched your search

-2
View File
@@ -257,8 +257,6 @@ the \'lazy\' dog.\n\
self.assertTrue(x is Ellipsis)
self.assertRaises(SyntaxError, eval, ".. .")
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_eof_error(self):
samples = ("def foo(", "\ndef foo(", "def foo(\n")
for s in samples:
+2 -2
View File
@@ -568,7 +568,7 @@ where
} else {
if (c == '\n' && !triple_quoted) || (is_bytes && !c.is_ascii()) {
return Err(LexicalError {
error: LexicalErrorType::StringError,
error: LexicalErrorType::Eof,
location: self.get_pos(),
});
}
@@ -784,7 +784,7 @@ where
// First of all, we need all nestings to be finished.
if self.nesting > 0 {
return Err(LexicalError {
error: LexicalErrorType::NestingError,
error: LexicalErrorType::Eof,
location: tok_pos,
});
}