Skip to content

Commit

Permalink
add # quotes, which I forgot about
Browse files Browse the repository at this point in the history
  • Loading branch information
comex committed Jun 23, 2015
1 parent e02f01f commit 95ef696
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
12 changes: 10 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 95ef696

Please sign in to comment.