1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use crate::error::*;
use crate::parser::*;
use enquote::unquote;
use snafu::ResultExt;
pub(crate) fn parse_string_array(array: Pair) -> Result<Vec<String>> {
let mut ret = Vec::new();
for field in array.into_inner() {
match field.as_rule() {
Rule::string => {
let s = unquote(field.as_str()).context(UnescapeError)?;
ret.push(s);
},
_ => return Err(unexpected_token(field))
}
}
Ok(ret)
}
pub(crate) fn clean_escaped_breaks(s: &str) -> String {
s.replace("\\\n", "")
}