-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing support for #include and #base directives #26
Comments
Thanks for opening an issue. I remember seeing mention of Now that everything else is pretty established it would be good for me to actually handle these statements. I'll take a look and see how languages in other libraries handle things, but just ignoring the files may be a good solution since it seems odd for the parser to try and access other files on your computer while running. There may also be some clean way of including the tokens for both of those statements in the parsed output as well so that consumers can manually stitch them together if they desire. I'll look into things more this weekend and get back to you with any info! |
So I've been looking into this issue and I've got a couple of questions if you don't mind So I downloaded all the free to play or already owned Valve games that I have, and from some investigation it looks like the files you are talking about are packed into a From that I would assume that you're on Windows using the Just making sure that I get the usage of WaveSchedule
{
StartingCurrency 1200
RespawnWaveTime 2
CanBotsAttackWhileInSpawnRoom no
Templates
{
// Sniper
T_TFBot_Sniper
{
Class Sniper
Skill Hard
MaxVisionRange 2500
}
}
} and then I would assume that I should be able to add support for exposing both of these in the parser, although it will involve some breaking changes (totally fine by me, the parser is just v0.1.0 after all) |
I've been using the ValvePython command-line vpk tool on Linux: https://github.com/ValvePython/vpk
Yeah. The C++ code for this step is surprisingly well-documented: https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/tier1/KeyValues.cpp#L2014-L2049
I haven't been able to figure out what |
Thanks for linking the python tool and the extra info! I think I saw some I'll dig in to things more later tonight |
Thanks for all that information. Knowing how to unpack
The things that I'm not super clear on yet
I'll be hacking together a script so that I can test the parser across all these new files and dump any files that failed to parse so that I can look at them for reference, but from what I've seen so far supporting |
Alright so with 0ea6be9 there is now very limited support for Currently this is restricted to just parsing and doesn't yet have any documentation or ergonomics that I'm planning on adding down the line. The good news is that it does now parse the provided file you listed # Cargo.toml
[package]
name = "parse-vdf-with-base"
version = "0.1.0"
edition = "2021"
[dependencies.keyvalues-parser]
git = "https://github.com/LovecraftianHorror/vdf-rs"
rev = "0ea6be99eb372932344be6210ca519f143c3649b" // main.rs
use keyvalues_parser::{PartialVdf, Vdf};
const VDF_TEXT: &str = r#"
#base robot_standard.pop
WaveSchedule
{
StartingCurrency 1200
RespawnWaveTime 2
CanBotsAttackWhileInSpawnRoom no
}
"#;
fn main() {
println!("{:#?}", Vdf::parse(VDF_TEXT).unwrap());
println!("{:#?}", PartialVdf::parse(VDF_TEXT).unwrap());
} The
I'm still planning on adding in more functionality later on (rendering with bases, merging, etc.), but that will take some time to get through for the next release |
Hi.
Valve's KeyValues format supports two statements for including and merging other KeyValues files (
#include
and#base
), but trying to parse a vdf file using either statement causes aParseError
. Merging other files seems to be beyond the scope of this parser, but would it be possible to add an option that ignores statements like these instead of throwing an error?Here's a stripped-down example from Team Fortress 2's population files:
minimal.pop:
robot_standard.pop:
The text was updated successfully, but these errors were encountered: