mirror of
https://codeberg.org/icewind/vdf-reader.git
synced 2026-06-03 18:14:07 +02:00
handle leading space in array strings
This commit is contained in:
parent
21e97bae76
commit
63b3bdbefd
5 changed files with 7 additions and 8 deletions
|
|
@ -573,7 +573,7 @@ impl<'de> Deserializer<'de> for Entry {
|
|||
where
|
||||
V: Visitor<'de>,
|
||||
{
|
||||
match dbg!(self) {
|
||||
match self {
|
||||
Entry::Array(arr) => visitor.visit_seq(ArraySeq::new(arr)),
|
||||
_ => Err(UnknownError::from("array2").into()),
|
||||
}
|
||||
|
|
@ -583,7 +583,7 @@ impl<'de> Deserializer<'de> for Entry {
|
|||
where
|
||||
V: Visitor<'de>,
|
||||
{
|
||||
match dbg!(self) {
|
||||
match self {
|
||||
Entry::Array(arr) => visitor.visit_seq(ArraySeq::new(arr)),
|
||||
_ => Err(UnknownError::from("tuple").into()),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,12 +71,12 @@ impl Table {
|
|||
value,
|
||||
..
|
||||
}) => {
|
||||
if string_is_array(value.as_str()) {
|
||||
let str = value.as_str();
|
||||
if string_is_array(str) {
|
||||
insert(
|
||||
&mut map,
|
||||
key,
|
||||
Array::from_space_separated(&str[1..str.len() - 1]),
|
||||
Array::from_space_separated(str[1..str.len() - 1].trim()),
|
||||
)
|
||||
} else {
|
||||
insert(&mut map, key, Value::from(value.into_content()))
|
||||
|
|
|
|||
|
|
@ -315,7 +315,6 @@ impl<'de> Deserializer<'de> for Value {
|
|||
where
|
||||
V: Visitor<'de>,
|
||||
{
|
||||
dbg!(&self);
|
||||
Err(SerdeParseError::new("seq", self.0.as_ref(), 0..0, "").into())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
|
|||
|| (value_str.starts_with("\"{") && value_str.ends_with("}\""))
|
||||
{
|
||||
let _ = self.next();
|
||||
let seq = &value_str[2..value_str.len() - 2];
|
||||
let seq = &value_str[2..value_str.len() - 2].trim();
|
||||
let span = token.span.start + 2..token.span.end - 2;
|
||||
visitor.visit_seq(StringArrayWalker::new(self.source(), seq, span))
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue