Skip to content

Commit 6db4704

Browse files
committed
Fix #6
1 parent 263e9c4 commit 6db4704

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/lib.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,6 @@ impl<'a> Shlex<'a> {
9696
loop {
9797
if let Some(ch2) = self.next_char() {
9898
match ch2 as char {
99-
'\\' => {
100-
if let Some(ch3) = self.next_char() {
101-
match ch3 as char {
102-
// for single quotes, only these can be escaped
103-
'\'' | '\\' => { result.push(ch3); },
104-
_ => { result.push('\\' as u8); result.push(ch3); }
105-
}
106-
} else {
107-
return Err(());
108-
}
109-
},
11099
'\'' => { return Ok(()); },
111100
_ => { result.push(ch2); },
112101
}
@@ -200,7 +189,7 @@ static SPLIT_TEST_ITEMS: &'static [(&'static str, Option<&'static [&'static str]
200189
("foo\\\nbar", Some(&["foobar"])),
201190
("\"foo\\\nbar\"", Some(&["foobar"])),
202191
("'baz\\$b'", Some(&["baz\\$b"])),
203-
("'baz\\\''", Some(&["baz\'"])),
192+
("'baz\\\''", None),
204193
("\\", None),
205194
("\"\\", None),
206195
("'\\", None),
@@ -210,6 +199,8 @@ static SPLIT_TEST_ITEMS: &'static [(&'static str, Option<&'static [&'static str]
210199
("foo #bar", Some(&["foo"])),
211200
("foo#bar", Some(&["foo#bar"])),
212201
("foo\"#bar", None),
202+
("'\\n'", Some(&["\\n"])),
203+
("'\\\\n'", Some(&["\\\\n"])),
213204
];
214205

215206
#[test]

0 commit comments

Comments
 (0)