diff --git a/src/lexer.rs b/src/lexer.rs index 1a2451e..85a1360 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -170,6 +170,13 @@ impl Lexer cursor.column = 0; } + // Remove the last newline character if the text did not end with a + // newline. + if !text.ends_with('\n') + { + stream.pop(); + } + Ok(transform(&stream)) }