lex: drop Windows line ending support again for now
This commit is contained in:
parent
ab4fa5f03f
commit
efe80cb930
1 changed files with 4 additions and 11 deletions
|
@ -11,7 +11,7 @@ pub(crate) struct Cursor<'a> {
|
|||
impl<'a> Cursor<'a> {
|
||||
pub const fn new(stream: Chars<'a>) -> Cursor<'a> {
|
||||
Cursor {
|
||||
stream: stream,
|
||||
stream,
|
||||
line: 1,
|
||||
col: 1,
|
||||
}
|
||||
|
@ -21,16 +21,9 @@ impl<'a> Cursor<'a> {
|
|||
let c = self.stream.next();
|
||||
|
||||
self.col += 1;
|
||||
|
||||
match c {
|
||||
Some('\n') => {
|
||||
self.line += 1;
|
||||
self.col = 0;
|
||||
},
|
||||
Some('\r') => unsafe {
|
||||
let null: *const i32 = std::ptr::null();
|
||||
std::ptr::read_volatile(null);
|
||||
},
|
||||
if c == Some('\n') {
|
||||
self.line += 1;
|
||||
self.col = 0;
|
||||
}
|
||||
|
||||
c
|
||||
|
|
Loading…
Reference in a new issue