add # quotes, which I forgot about

This commit is contained in:
comex
2015-06-22 21:20:35 -04:00
parent e02f01f217
commit 95ef6961a2
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "shlex"
version = "0.1.0"
version = "0.1.1"
authors = ["comex <comexk@gmail.com>"]
license = "MIT/Apache-2.0"
repository = "https://github.com/comex/rust-shlex"
+10 -2
View File
@@ -130,11 +130,15 @@ impl<'a> Iterator for Shlex<'a> {
// skip initial whitespace
loop {
match ch as char {
' ' | '\t' | '\n' => {
if let Some(ch2) = self.next_char() { ch = ch2; } else { return None; }
' ' | '\t' | '\n' => {},
'#' => {
while let Some(ch2) = self.next_char() {
if ch2 as char == '\n' { break; }
}
},
_ => { break; }
}
if let Some(ch2) = self.next_char() { ch = ch2; } else { return None; }
}
self.parse_word(ch)
} else { // no initial character
@@ -193,6 +197,10 @@ static SPLIT_TEST_ITEMS: &'static [(&'static str, Option<&'static [&'static str]
("'\\", None),
("\"", None),
("'", None),
("foo #bar\nbaz", Some(&["foo", "baz"])),
("foo #bar", Some(&["foo"])),
("foo#bar", Some(&["foo#bar"])),
("foo\"#bar", None),
];
#[test]