mirror of
https://github.com/openharmony/third_party_rust_shlex.git
synced 2026-07-01 21:34:03 -04:00
add # quotes, which I forgot about
This commit is contained in:
+1
-1
@@ -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
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user