From b663d6ae99294a0825f4e1b11c5b3110d56bc65f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 23 Jun 2014 22:25:54 -0700 Subject: Handle \r\n --- src/parser.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 04ffaed..29de39b 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -141,7 +141,8 @@ impl<'a> Parser<'a> { self.ws(); match self.cur.clone().next() { Some((_, '#')) => { self.comment(); } - Some((_, '\n')) => { self.cur.next(); } + Some((_, '\n')) | + Some((_, '\r')) => { self.cur.next(); } Some((start, '[')) => { self.cur.next(); let array = self.eat('['); @@ -193,7 +194,8 @@ impl<'a> Parser<'a> { self.ws(); match self.cur.clone().next() { Some((_, '#')) => self.comment(), - Some((_, '\n')) => { self.cur.next(); } + Some((_, '\n')) | + Some((_, '\r')) => { self.cur.next(); } Some((_, '[')) => break, Some((start, _)) => { let mut key = String::new(); @@ -225,6 +227,7 @@ impl<'a> Parser<'a> { self.insert(into, key, value, start); self.ws(); self.comment(); + self.eat('\r'); self.eat('\n'); } None => break, @@ -481,7 +484,8 @@ impl<'a> Parser<'a> { me.ws(); match me.cur.clone().next() { Some((_, '#')) => { me.comment(); } - Some((_, '\n')) => { me.cur.next(); } + Some((_, '\n')) | + Some((_, '\r')) => { me.cur.next(); } _ => break, } } -- cgit v1.2.3