meh / steamy

Steam controller handling.
20 stars 6 forks source link

Error parsing vdf with empty item #1

Open CosmicHorrorDev opened 3 years ago

CosmicHorrorDev commented 3 years ago

Hello! I was trying to poke through the code to fix the issue myself and send a PR, but all the macro magic of old nom was really hurting my brain. Long story short steamy-vdf fails to parse

"key"    ""

and returns a parse error. If "" actually contains text then it works fine.

I think this is a problem in vdf/src/parser.rs's enclosed parser where super::enclosed(b"\"\"") returns Error(Position(Alt, [34, 34])) when I think it should return Done(&b""[..], Token::Item("".into())).

Let me know if there's any way I can help, or if this crate isn't supported anymore!

striezel commented 2 years ago

PR #3 may possibly fix that problem.

CosmicHorrorDev commented 2 years ago

Thanks for submitting a PR!

Just to let you know I made a separate parser and serde library for VDF since this parser didn't seem to be maintained. Specifically keyvalues-parser and keyvalues-serde