fix sequence at end of group, support bare sequences

This commit is contained in:
Robin Appelman 2025-02-28 23:52:55 +01:00
commit fe7bc149d6
10 changed files with 110 additions and 22 deletions

View file

@ -8,6 +8,6 @@
array "3"
windows_path "C:\test\no newline"
\\"$translucent" 1 // this is read vdf written by real valve developers
"$envmaptint" .5 .5 .5 // found in the wild, pretty sure they mean "[.5 .5 .5]", but it ends up working by accident with a stray `.5 = .5` kv
\\"$translucent" 1 // this is real vdf written by real valve developers
"$envmaptint" .5 .5 .5
}

View file

@ -5,4 +5,5 @@
single 1.2
triple "{1.2 1.3 1.4}"
single_int 2
another_tuple 8 foo 0
}

View file

@ -18,6 +18,7 @@ enum Expected {
single: SingleOrTriple<f32>,
triple: SingleOrTriple<f32>,
single_int: SingleOrTriple<f32>,
another_tuple: (u8, String, bool),
},
LightmappedGeneric {
#[serde(rename = "$baseTexture")]
@ -45,9 +46,7 @@ enum Expected {
#[serde(rename = r#"\\"$translucent""#)]
translucent: bool,
#[serde(rename = "$envmaptint")]
env_map_tint: f32,
#[serde(rename = ".5")]
spare: f32,
env_map_tint: [f32; 3],
},
UserConfigData {
#[serde(rename = "Steam")]

View file

@ -4,6 +4,7 @@ expression: result
---
{
"Types": {
"another_tuple": "8",
"fixed_array": [
"1",
"2",
@ -13,6 +14,7 @@ expression: result
"1",
"2.2",
],
"foo": "0",
"single": "1.2",
"single_int": "2",
"triple": [

View file

@ -0,0 +1,16 @@
---
source: tests/serde.rs
expression: out
---
vmt_reader::unexpected_token
× invalid type: boolean `true`, expected u32
╭─[6:9]
5 │ }
6 │ ╭─▶ data2 {
7 │ │ kind Bar
8 │ │ val1 1
9 │ ├─▶ }
· ╰──── invalid type: boolean `true`, expected u32
10 │ }
╰────

View file

@ -11,6 +11,5 @@ r#Resource/specificPanel.res(
],
windows_path: "C:\\test\\no newline",
r#\\"$translucent": true,
r#$envmaptint: 0.5,
r#.5: 0.5,
r#$envmaptint: (0.5, 0.5, 0.5),
)

View file

@ -12,4 +12,5 @@ Types(
single: 1.2,
triple: (1.2, 1.3, 1.4),
single_int: 2.0,
another_tuple: (8, "foo", false),
)