lex: add Windows line ending support
This commit is contained in:
parent
bcbcec46a9
commit
ab4fa5f03f
1 changed files with 10 additions and 3 deletions
|
@ -21,9 +21,16 @@ impl<'a> Cursor<'a> {
|
|||
let c = self.stream.next();
|
||||
|
||||
self.col += 1;
|
||||
if c == Some('\n') {
|
||||
self.line += 1;
|
||||
self.col = 0;
|
||||
|
||||
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);
|
||||
},
|
||||
}
|
||||
|
||||
c
|
||||
|
|
Loading…
Reference in a new issue