From ce9af33620ffa9c7c788c12f88b0042958b2dba8 Mon Sep 17 00:00:00 2001 From: croraf Date: Mon, 20 Jan 2020 10:56:14 +0100 Subject: [PATCH] [lexer: single-line-comment] Fix bug when single line comment is last line of file (#228) --- src/lib/syntax/lexer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/syntax/lexer.rs b/src/lib/syntax/lexer.rs index 696510a4bb..a9066a2176 100644 --- a/src/lib/syntax/lexer.rs +++ b/src/lib/syntax/lexer.rs @@ -153,7 +153,7 @@ impl<'a> Lexer<'a> { /// read_line attempts to read until the end of the line and returns the String object or a LexerError fn read_line(&mut self) -> Result { let mut buf = String::new(); - loop { + while self.preview_next().is_some() { let ch = self.next()?; match ch { _ if ch.is_ascii_control() => {