aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-06-23 22:25:54 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-06-23 22:28:53 -0700
commitb663d6ae99294a0825f4e1b11c5b3110d56bc65f (patch)
tree1388d028d5ea21f1e0903549eded30ccf6d3f164
parent6e3077035507f4df3be1d5a04783ceed5554c310 (diff)
downloadmilf-rs-b663d6ae99294a0825f4e1b11c5b3110d56bc65f.tar.gz
milf-rs-b663d6ae99294a0825f4e1b11c5b3110d56bc65f.zip
Handle \r\n
-rw-r--r--src/parser.rs10
1 files 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,
}
}