Fixing how the Lexer handles text.
Scanning a file has all the lines terminating with a '\n' newline character, but when giving the text directly to the lexer via the scan_text function it should not append a newline at the end if there was no newline in the original input.
This commit is contained in:
parent
34a579332d
commit
693ff20224
@ -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))
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user